From f604bf6d686d3feec69bf1843ed9d3190ed037eb Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Tue, 11 Jul 2023 13:30:16 +0100 Subject: [PATCH] UI/Select: Adjust typing to support extended props (#71211) --- packages/grafana-ui/src/components/Select/Select.tsx | 12 ++++++------ .../grafana-ui/src/components/Select/SelectBase.tsx | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/grafana-ui/src/components/Select/Select.tsx b/packages/grafana-ui/src/components/Select/Select.tsx index 8c0ed3d2c9f..d118d9ada33 100644 --- a/packages/grafana-ui/src/components/Select/Select.tsx +++ b/packages/grafana-ui/src/components/Select/Select.tsx @@ -12,11 +12,11 @@ import { VirtualizedSelectAsyncProps, } from './types'; -export function Select(props: SelectCommonProps) { +export function Select(props: SelectCommonProps & Rest) { return ; } -export function MultiSelect(props: MultiSelectCommonProps) { +export function MultiSelect(props: MultiSelectCommonProps & Rest) { // @ts-ignore return ; } @@ -26,15 +26,15 @@ export interface AsyncSelectProps extends Omit, 'options value?: T | SelectableValue | null; } -export function AsyncSelect(props: AsyncSelectProps) { +export function AsyncSelect(props: AsyncSelectProps & Rest) { return ; } -export function VirtualizedSelect(props: VirtualizedSelectProps) { +export function VirtualizedSelect(props: VirtualizedSelectProps & Rest) { return ; } -export function AsyncVirtualizedSelect(props: VirtualizedSelectAsyncProps) { +export function AsyncVirtualizedSelect(props: VirtualizedSelectAsyncProps & Rest) { return ; } @@ -43,7 +43,7 @@ interface AsyncMultiSelectProps extends Omit, 'opti value?: Array>; } -export function AsyncMultiSelect(props: AsyncMultiSelectProps) { +export function AsyncMultiSelect(props: AsyncMultiSelectProps & Rest) { // @ts-ignore return ; } diff --git a/packages/grafana-ui/src/components/Select/SelectBase.tsx b/packages/grafana-ui/src/components/Select/SelectBase.tsx index 419b6ca5a92..c47d9cf3c5c 100644 --- a/packages/grafana-ui/src/components/Select/SelectBase.tsx +++ b/packages/grafana-ui/src/components/Select/SelectBase.tsx @@ -88,7 +88,7 @@ const CustomControl = (props: any) => { ); }; -export function SelectBase({ +export function SelectBase({ allowCustomValue = false, allowCreateWhileLoading = false, 'aria-label': ariaLabel, @@ -149,7 +149,8 @@ export function SelectBase({ isValidNewOption, formatOptionLabel, hideSelectedOptions, -}: SelectBaseProps) { + ...rest +}: SelectBaseProps & Rest) { const theme = useTheme2(); const styles = getSelectStyles(theme); @@ -376,6 +377,7 @@ export function SelectBase({ {...commonSelectProps} {...creatableProps} {...asyncSelectProps} + {...rest} /> );