@@ -25,108 +25,118 @@ export enum SelectPickerVariantType {
25
25
26
26
type SelectProps = ReactSelectProps < SelectPickerOptionType >
27
27
28
- export interface SelectPickerProps
29
- extends Pick <
30
- SelectProps ,
31
- | 'options'
32
- | 'value'
33
- | 'onChange'
34
- | 'isSearchable'
35
- | 'isClearable'
36
- | 'isLoading'
37
- | 'hideSelectedOptions'
38
- | 'controlShouldRenderValue'
39
- | 'closeMenuOnSelect'
40
- | 'isDisabled'
41
- | 'isLoading'
42
- | 'required'
43
- | 'isOptionDisabled'
44
- | 'placeholder'
45
- | 'isMulti'
46
- | 'getOptionLabel'
47
- | 'getOptionValue'
48
- | 'isOptionSelected'
49
- | 'isOptionDisabled'
50
- > ,
51
- Required < Pick < SelectProps , 'classNamePrefix' | 'inputId' | 'name' > > {
52
- /**
53
- * Icon to be rendered in the control
54
- */
55
- icon ?: ReactElement
56
- /**
57
- * Error message for the select
58
- */
59
- error ?: ReactNode
60
- /**
61
- * Render function for the footer at the bottom of menu list. It is sticky by default
62
- */
63
- renderMenuListFooter ?: ( ) => ReactNode
64
- /**
65
- * Info text for the select, if any
66
- */
67
- helperText ?: ReactNode
68
- /**
69
- * Label for the select. if required is added, the corresponding * is also added
70
- */
71
- label ?: ReactNode
72
- /**
73
- * If true, the selected option icon is shown in the container.
74
- * startIcon has higher priority than endIcon.
75
- *
76
- * @default 'true'
77
- */
78
- showSelectedOptionIcon ?: boolean
79
- /**
80
- * Height of the dropdown
81
- *
82
- * @default 'ComponentSizeType.medium'
83
- */
84
- size ?: Extract < ComponentSizeType , ComponentSizeType . medium | ComponentSizeType . large >
85
- /**
86
- * Content to be shown in a tippy when disabled
87
- */
88
- disabledTippyContent ?: ReactNode
89
- /**
90
- * If true, the selected options count is shown in a chip inside ValueContainer
91
- *
92
- * @default 'false'
93
- */
94
- showSelectedOptionsCount ?: boolean
95
- /**
96
- * Width of the menu list
97
- *
98
- * Note: the overflow needs to be handled explicitly for non-small variants
99
- *
100
- * @default 'ComponentSizeType.small'
101
- */
102
- menuSize ?: ComponentSizeType
103
- /**
104
- * Variant of the select.
105
- *
106
- * @default SelectPickerVariantType.DEFAULT
107
- */
108
- variant ?: SelectPickerVariantType
109
- /**
110
- * Disables the ellipsis on description, it will be shown in full width, wrapped if required.
111
- *
112
- * @default false
113
- */
114
- disableDescriptionEllipsis ?: boolean
115
- getIsOptionValid ?: ( option : SelectPickerOptionType ) => boolean
116
- /**
117
- * If true, the select picker creates the new option
118
- * Only applicable for isMulti: true
119
- *
120
- * @default false
121
- */
122
- isCreatable ?: boolean
123
- /**
124
- * If true, the group heading can be selected
125
- *
126
- * Only applicable for isMulti: true
127
- *
128
- * @default false
129
- */
130
- isGroupHeadingSelectable ?: boolean
131
- // TODO: Improve typing and add support for custom option list; isMenuOpen prop expose?
132
- }
28
+ export type SelectPickerProps = Pick <
29
+ SelectProps ,
30
+ | 'options'
31
+ | 'value'
32
+ | 'onChange'
33
+ | 'isSearchable'
34
+ | 'isClearable'
35
+ | 'isLoading'
36
+ | 'hideSelectedOptions'
37
+ | 'controlShouldRenderValue'
38
+ | 'closeMenuOnSelect'
39
+ | 'isDisabled'
40
+ | 'isLoading'
41
+ | 'required'
42
+ | 'isOptionDisabled'
43
+ | 'placeholder'
44
+ | 'getOptionLabel'
45
+ | 'getOptionValue'
46
+ | 'isOptionSelected'
47
+ > &
48
+ Required < Pick < SelectProps , 'classNamePrefix' | 'inputId' | 'name' > > & {
49
+ /**
50
+ * Icon to be rendered in the control
51
+ */
52
+ icon ?: ReactElement
53
+ /**
54
+ * Error message for the select
55
+ */
56
+ error ?: ReactNode
57
+ /**
58
+ * Render function for the footer at the bottom of menu list. It is sticky by default
59
+ */
60
+ renderMenuListFooter ?: ( ) => ReactNode
61
+ /**
62
+ * Info text for the select, if any
63
+ */
64
+ helperText ?: ReactNode
65
+ /**
66
+ * Label for the select. if required is added, the corresponding * is also added
67
+ */
68
+ label ?: ReactNode
69
+ /**
70
+ * If true, the selected option icon is shown in the container.
71
+ * startIcon has higher priority than endIcon.
72
+ *
73
+ * @default 'true'
74
+ */
75
+ showSelectedOptionIcon ?: boolean
76
+ /**
77
+ * Height of the dropdown
78
+ *
79
+ * @default 'ComponentSizeType.medium'
80
+ */
81
+ size ?: Extract < ComponentSizeType , ComponentSizeType . medium | ComponentSizeType . large >
82
+ /**
83
+ * Content to be shown in a tippy when disabled
84
+ */
85
+ disabledTippyContent ?: ReactNode
86
+ /**
87
+ * If true, the selected options count is shown in a chip inside ValueContainer
88
+ *
89
+ * @default 'false'
90
+ */
91
+ showSelectedOptionsCount ?: boolean
92
+ /**
93
+ * Width of the menu list
94
+ *
95
+ * Note: the overflow needs to be handled explicitly for non-small variants
96
+ *
97
+ * @default 'ComponentSizeType.small'
98
+ */
99
+ menuSize ?: ComponentSizeType
100
+ /**
101
+ * Variant of the select.
102
+ *
103
+ * @default SelectPickerVariantType.DEFAULT
104
+ */
105
+ variant ?: SelectPickerVariantType
106
+ /**
107
+ * Disables the ellipsis on description, it will be shown in full width, wrapped if required.
108
+ *
109
+ * @default false
110
+ */
111
+ disableDescriptionEllipsis ?: boolean
112
+ // TODO: Improve typing and add support for custom option list; isMenuOpen prop expose?
113
+ } & (
114
+ | {
115
+ isMulti ?: never
116
+ multiSelectProps ?: never
117
+ }
118
+ | {
119
+ isMulti : boolean
120
+ multiSelectProps ?: {
121
+ /**
122
+ * If true, the select picker creates the new option
123
+ * Only applicable for isMulti: true
124
+ *
125
+ * @default false
126
+ */
127
+ isCreatable ?: boolean
128
+ /**
129
+ * If true, the group heading can be selected
130
+ *
131
+ * Only applicable for isMulti: true
132
+ *
133
+ * @default false
134
+ */
135
+ isGroupHeadingSelectable ?: boolean
136
+ /**
137
+ * Callback handler to check if the given selection is valid or not
138
+ */
139
+ getIsOptionValid ?: ( option : SelectPickerOptionType ) => boolean
140
+ }
141
+ }
142
+ )
0 commit comments