uikit-react-public 0.51.0 → 0.52.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/components/MultiSelect/MultiSelect.d.ts +4 -0
  2. package/dist/components/MultiSelect/MultiSelect.stories.d.ts +206 -0
  3. package/dist/components/MultiSelect/MultiSelect.types.d.ts +128 -0
  4. package/dist/components/MultiSelect/__tests__/MultiSelect.test.d.ts +1 -0
  5. package/dist/components/MultiSelect/index.d.ts +2 -0
  6. package/dist/components/MultiSelect/subcomponents/CustomOption.d.ts +3 -0
  7. package/dist/components/MultiSelect/subcomponents/CustomSelect.d.ts +4 -0
  8. package/dist/components/MultiSelect/subcomponents/FilterInput.d.ts +16 -0
  9. package/dist/components/MultiSelect/subcomponents/Panel.d.ts +8 -0
  10. package/dist/components/MultiSelect/subcomponents/VisibleField.d.ts +17 -0
  11. package/dist/components/MultiSelect/subcomponents/index.d.ts +5 -0
  12. package/dist/components/index.d.ts +2 -0
  13. package/dist/index.js +1079 -525
  14. package/lib/components/Calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +4 -4
  15. package/lib/components/MultiSelect/MultiSelect.mdx +151 -0
  16. package/lib/components/MultiSelect/MultiSelect.stories.tsx +308 -0
  17. package/lib/components/MultiSelect/MultiSelect.tsx +24 -0
  18. package/lib/components/MultiSelect/MultiSelect.types.ts +142 -0
  19. package/lib/components/MultiSelect/__tests__/MultiSelect.test.tsx +1300 -0
  20. package/lib/components/MultiSelect/__tests__/__snapshots__/MultiSelect.test.tsx.snap +44 -0
  21. package/lib/components/MultiSelect/index.ts +2 -0
  22. package/lib/components/MultiSelect/subcomponents/CustomOption.tsx +107 -0
  23. package/lib/components/MultiSelect/subcomponents/CustomSelect.tsx +701 -0
  24. package/lib/components/MultiSelect/subcomponents/FilterInput.tsx +90 -0
  25. package/lib/components/MultiSelect/subcomponents/Panel.tsx +69 -0
  26. package/lib/components/MultiSelect/subcomponents/VisibleField.tsx +147 -0
  27. package/lib/components/MultiSelect/subcomponents/index.tsx +5 -0
  28. package/lib/components/index.ts +3 -0
  29. package/lib/theme/Theme.mdx +2 -0
  30. package/lib/theme/light/lightColour.ts +3 -7
  31. package/lib/theme/original/originalColourNewStructure.ts +3 -7
  32. package/package.json +2 -2
@@ -192,13 +192,13 @@ exports[`Calendar > Snapshot: no date provided 1`] = `
192
192
  F
193
193
  </div>
194
194
  <div
195
- class="ucl-uikit-paragraph ucl-uikit-calendar__column-heading css-1yk7pei"
195
+ class="ucl-uikit-paragraph ucl-uikit-calendar__column-heading css-1v4rj53"
196
196
  data-testid="ucl-uikit-calendar__column-heading"
197
197
  >
198
198
  S
199
199
  </div>
200
200
  <div
201
- class="ucl-uikit-paragraph ucl-uikit-calendar__column-heading css-1yk7pei"
201
+ class="ucl-uikit-paragraph ucl-uikit-calendar__column-heading css-1v4rj53"
202
202
  data-testid="ucl-uikit-calendar__column-heading"
203
203
  >
204
204
  S
@@ -1072,13 +1072,13 @@ exports[`Calendar > Snapshot: with date provided 1`] = `
1072
1072
  F
1073
1073
  </div>
1074
1074
  <div
1075
- class="ucl-uikit-paragraph ucl-uikit-calendar__column-heading css-1yk7pei"
1075
+ class="ucl-uikit-paragraph ucl-uikit-calendar__column-heading css-1v4rj53"
1076
1076
  data-testid="ucl-uikit-calendar__column-heading"
1077
1077
  >
1078
1078
  S
1079
1079
  </div>
1080
1080
  <div
1081
- class="ucl-uikit-paragraph ucl-uikit-calendar__column-heading css-1yk7pei"
1081
+ class="ucl-uikit-paragraph ucl-uikit-calendar__column-heading css-1v4rj53"
1082
1082
  data-testid="ucl-uikit-calendar__column-heading"
1083
1083
  >
1084
1084
  S
@@ -0,0 +1,151 @@
1
+ import * as SelectStories from "./MultiSelect.stories";
2
+ import { Meta, Title, Subtitle, Canvas, Controls, ArgTypes } from "@storybook/addon-docs/blocks";
3
+
4
+ export const usage = {
5
+ default: `<MultiSelect
6
+ options={[
7
+ { label: 'Option one', value: '1' },
8
+ { label: 'Option two', value: '2' },
9
+ { label: 'Option three', value: '3' },
10
+ ]}
11
+ value={value}
12
+ onValueChange={handleChange}
13
+ />`,
14
+ filterable: `<MultiSelect
15
+ filterable
16
+ options={[
17
+ { label: 'Option one', value: '1' },
18
+ { label: 'Option two', value: '2' },
19
+ { label: 'Option three', value: '3' },
20
+ ]}
21
+ value={value}
22
+ onValueChange={handleChange}
23
+ placeholder="Type to filter..."
24
+ filterInputProps={{ 'aria-describedby': 'filter-hint' }}
25
+ />`,
26
+ clearable: `<MultiSelect
27
+ clearable
28
+ options={[
29
+ { label: 'Option one', value: '1' },
30
+ { label: 'Option two', value: '2' },
31
+ { label: 'Option three', value: '3' },
32
+ ]}
33
+ value={value}
34
+ onValueChange={handleChange}
35
+ placeholder="Clear selection"
36
+ />`,
37
+ disabled: `<MultiSelect
38
+ disabled
39
+ options={[
40
+ { label: 'Option one', value: '1' },
41
+ { label: 'Option two', value: '2' },
42
+ { label: 'Option three', value: '3' },
43
+ ]}
44
+ value={value}
45
+ onValueChange={handleChange}
46
+ />`,
47
+ placeholder: `<MultiSelect
48
+ placeholder="Please select an option"
49
+ options={[
50
+ { label: 'Option one', value: '1' },
51
+ { label: 'Option two', value: '2' },
52
+ { label: 'Option three', value: '3' },
53
+ ]}
54
+ value={value}
55
+ onValueChange={handleChange}
56
+ />`,
57
+ };
58
+
59
+ <Meta of={SelectStories} />
60
+ <Title />
61
+ <Subtitle>
62
+ A custom select, opt-in filtering, and long-text handling.
63
+ </Subtitle>
64
+
65
+ Use `<MultiSelect>` when you need a styled dropdown that works like a standard form control but matches the UCL UI kit. The component renders a custom combobox by default.
66
+
67
+ Key features:
68
+ - Custom dropdown with keyboard support (Enter/Space to open, arrows to navigate, Escape to close)
69
+ - Optional filterable dropdown (`filterable`) that lets users type to narrow options
70
+ - Optional clear action (`clearable`) in the custom variant
71
+ - Optional count label (`selectionCountLabel`) to set the noun used in the selection summary when 3 or more options are selected (e.g. "3 items selected")
72
+ - `filterInputProps` to forward additional attributes (e.g. `aria-describedby`) to the filter input
73
+ - Support for long option text via `lineBreak`
74
+ - Disabled state and placeholder support
75
+ - Story previews set a fixed control width and wrapper height for better readability in docs.
76
+
77
+ ## Variants
78
+
79
+ ### Custom (default)
80
+ The default renders a fully styled combobox that handles focus, keyboard navigation, and selection. Use this for most desktop/web cases.
81
+
82
+ <Canvas
83
+ of={SelectStories.Default}
84
+ sourceState="shown"
85
+ source={{ code: usage.default }}
86
+ />
87
+
88
+ ### Disabled
89
+ Applies the disabled state to custom variants; interactions are blocked and styles are subdued.
90
+
91
+ <Canvas
92
+ of={SelectStories.Disabled}
93
+ sourceState="shown"
94
+ source={{ code: usage.disabled }}
95
+ />
96
+
97
+ ### Placeholder
98
+ Shows helper text until a value is selected. It shows in the visible field.
99
+
100
+ <Canvas
101
+ of={SelectStories.WithPlaceholder}
102
+ sourceState="shown"
103
+ source={{ code: usage.placeholder }}
104
+ />
105
+
106
+ ### With filter
107
+ Adds an inline text input when the dropdown is open so users can type to filter options. Arrow keys and Escape still control the dropdown; the filter text is preserved while open and cleared on close.
108
+
109
+ Use `filterInputProps` to pass extra attributes to the input (e.g. `aria-describedby`, `inputMode`).
110
+
111
+ <Canvas
112
+ of={SelectStories.filterable}
113
+ sourceState="shown"
114
+ source={{ code: usage.filterable }}
115
+ />
116
+
117
+ ### Clearable
118
+ Adds a built-in clear button in the custom variant when a selection is present. Clearing calls `onValueChange(null, event)` and restores the placeholder text.
119
+
120
+ <Canvas
121
+ of={SelectStories.Clearable}
122
+ sourceState="shown"
123
+ source={{ code: usage.clearable }}
124
+ />
125
+
126
+ ## Long text and wrapping
127
+ For very long labels, set `lineBreak` to allow breaking the text inside options. Without it, text is truncated/ellipsized to keep layout intact.
128
+
129
+ ## Accessibility
130
+ - Custom variant exposes `role="combobox"` and `aria-expanded`, and listens for Enter/Space/Escape/arrow keys.
131
+ - In `selectionBehaviour="commit"`, arrow keys move highlight without changing value until Enter/click.
132
+ - Tabbing away from an open custom dropdown closes it and lets focus move normally to the next or previous control.
133
+ - Tabbing to a filterable custom MultiSelect focuses the closed combobox. Typing starts filtering immediately; Enter, Space, an arrow key, or a click also opens the panel. Focus moves to the filter input when the panel opens.
134
+ - The filter input (when `filterable` is true) is focusable when the panel opens; Escape and arrow keys bubble to the parent so the dropdown still closes/navigates.
135
+ - In the custom variant, `clearable` emits `null` as the cleared value.
136
+ - `filterInputProps` lets you forward ARIA hooks like `aria-describedby` to the filter input.
137
+ - Standard HTML attributes (`id`, `title`, `data-*`) are forwarded to the combobox.
138
+
139
+ ## Props
140
+
141
+ Full props specification for `<MultiSelect>` is below.
142
+
143
+ <Canvas
144
+ of={SelectStories.Default}
145
+ sourceState="hidden"
146
+ source={{ code: usage.default }}
147
+ />
148
+
149
+ You can use the controls below to manipulate the `<MultiSelect>` component above.
150
+
151
+ <Controls />
@@ -0,0 +1,308 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { useArgs } from 'storybook/preview-api';
3
+ import MultiSelect from './MultiSelect.tsx';
4
+ import { css } from '@emotion/css';
5
+
6
+ const select400pxWidthClass = css`
7
+ width: 400px;
8
+ `;
9
+ const storyWrapperStyle: React.CSSProperties = { minHeight: 150, width: 400 };
10
+
11
+ const meta = {
12
+ title: 'Components/MultiSelect',
13
+ component: MultiSelect,
14
+ argTypes: {
15
+ options: {
16
+ description: 'Array of option objects `{ label, value, optionProps? }`',
17
+ control: { type: 'object' },
18
+ table: { type: { summary: 'OptionData[]' } },
19
+ },
20
+ value: {
21
+ description: 'Selected value (array of strings or numbers)',
22
+ control: { type: 'object' },
23
+ table: { type: { summary: '(string | number)[]' } },
24
+ },
25
+ onValueChange: {
26
+ description:
27
+ 'Change handler for the custom select variant (value, event)',
28
+ control: false,
29
+ table: {
30
+ type: {
31
+ summary:
32
+ '(value: string | number)[], ev: React.SyntheticEvent) => void',
33
+ },
34
+ },
35
+ },
36
+ disabled: {
37
+ description: 'Disable interaction',
38
+ control: { type: 'boolean' },
39
+ table: { type: { summary: 'boolean' } },
40
+ },
41
+ placeholder: {
42
+ description: 'Helper text when no value is selected',
43
+ control: { type: 'text' },
44
+ table: { type: { summary: 'string' } },
45
+ },
46
+ selectionCountLabel: {
47
+ description:
48
+ 'Noun shown in the selection summary when 3 or more options are selected, e.g. "items" shows "3 items selected"',
49
+ control: { type: 'text' },
50
+ table: { type: { summary: 'string' } },
51
+ },
52
+ filterable: {
53
+ description:
54
+ 'Show a filter input to narrow options in the custom variant',
55
+ control: { type: 'boolean' },
56
+ table: { type: { summary: 'boolean' } },
57
+ },
58
+ clearable: {
59
+ description:
60
+ 'Show a clear action in the custom variant when a value is selected',
61
+ control: { type: 'boolean' },
62
+ table: { type: { summary: 'boolean' } },
63
+ },
64
+ filterInputProps: {
65
+ description:
66
+ 'Additional props to spread onto the filter input (when filterable)',
67
+ control: { type: 'object' },
68
+ table: {
69
+ type: {
70
+ summary: 'React.InputHTMLAttributes<HTMLInputElement>',
71
+ },
72
+ },
73
+ },
74
+ id: {
75
+ description: 'Standard HTML id forwarded to the combobox/native select',
76
+ control: { type: 'text' },
77
+ table: { type: { summary: 'string' } },
78
+ },
79
+ title: {
80
+ description:
81
+ 'Standard title attribute forwarded to the combobox/native select',
82
+ control: { type: 'text' },
83
+ table: { type: { summary: 'string' } },
84
+ },
85
+ lineBreak: {
86
+ description: 'Wrap long option labels',
87
+ control: { type: 'boolean' },
88
+ table: { type: { summary: 'boolean' } },
89
+ },
90
+ dropdownWidth: {
91
+ description:
92
+ 'Control whether the options panel grows to content or matches the Select width',
93
+ control: { type: 'radio' },
94
+ options: ['content', 'match-select'],
95
+ table: { type: { summary: "'content' | 'match-select'" } },
96
+ },
97
+ panelClassName: {
98
+ description: 'Custom className for the options panel',
99
+ control: { type: 'text' },
100
+ table: { type: { summary: 'string' } },
101
+ },
102
+ className: {
103
+ description: 'Custom className for the root element',
104
+ control: { type: 'text' },
105
+ table: { type: { summary: 'string' } },
106
+ },
107
+ testId: {
108
+ description: 'Test id applied to the root element',
109
+ control: { type: 'text' },
110
+ table: { type: { summary: 'string' } },
111
+ },
112
+ },
113
+ args: {
114
+ value: undefined,
115
+ selectionCountLabel: 'items',
116
+ options: [
117
+ { label: 'Option one', value: '1' },
118
+ { label: 'Option two', value: '2' },
119
+ { label: 'Option three', value: '3' },
120
+ ],
121
+ },
122
+ parameters: {
123
+ docs: {
124
+ story: { inline: true },
125
+ },
126
+ },
127
+ } satisfies Meta<typeof MultiSelect>;
128
+
129
+ export default meta;
130
+ type Story = StoryObj<typeof meta>;
131
+
132
+ export const Default: Story = {
133
+ render: () => {
134
+ const [args, updateArgs] = useArgs();
135
+ const onValueChange = (value: (string | number)[]) => {
136
+ updateArgs({ value });
137
+ };
138
+ return (
139
+ <div style={storyWrapperStyle}>
140
+ <MultiSelect
141
+ {...args}
142
+ className={select400pxWidthClass}
143
+ options={args.options}
144
+ value={args.value}
145
+ onValueChange={onValueChange}
146
+ />
147
+ </div>
148
+ );
149
+ },
150
+ };
151
+
152
+ export const Disabled: Story = {
153
+ args: {
154
+ disabled: true,
155
+ },
156
+ render: () => {
157
+ const [args, updateArgs] = useArgs();
158
+ const onValueChange = (value: (string | number)[]) => {
159
+ updateArgs({ value });
160
+ };
161
+
162
+ return (
163
+ <div style={storyWrapperStyle}>
164
+ <MultiSelect
165
+ {...args}
166
+ className={select400pxWidthClass}
167
+ options={args.options}
168
+ value={args.value}
169
+ onValueChange={onValueChange}
170
+ />
171
+ </div>
172
+ );
173
+ },
174
+ };
175
+
176
+ export const WithPlaceholder: Story = {
177
+ args: { placeholder: 'Please select an option' },
178
+ render: () => {
179
+ const [args, updateArgs] = useArgs();
180
+ const onValueChange = (value: (string | number)[]) => {
181
+ updateArgs({ value });
182
+ };
183
+
184
+ return (
185
+ <div style={storyWrapperStyle}>
186
+ <MultiSelect
187
+ {...args}
188
+ className={select400pxWidthClass}
189
+ options={args.options}
190
+ value={args.value}
191
+ onValueChange={onValueChange}
192
+ />
193
+ </div>
194
+ );
195
+ },
196
+ };
197
+
198
+ export const SingleLongOption: Story = {
199
+ name: 'Long option',
200
+ args: {
201
+ options: [
202
+ { label: 'Option 1', value: '1' },
203
+ { label: 'Option 2', value: '2' },
204
+ { label: 'Option 3 long long long long ', value: '3' },
205
+ ],
206
+ },
207
+ render: () => {
208
+ const [args, updateArgs] = useArgs();
209
+ const onValueChange = (value: (string | number)[]) => {
210
+ updateArgs({ value });
211
+ };
212
+
213
+ return (
214
+ <div style={storyWrapperStyle}>
215
+ <MultiSelect
216
+ {...args}
217
+ className={select400pxWidthClass}
218
+ options={args.options}
219
+ value={args.value}
220
+ onValueChange={onValueChange}
221
+ />
222
+ </div>
223
+ );
224
+ },
225
+ };
226
+
227
+ export const ManyOptions: Story = {
228
+ name: 'Many options',
229
+ args: {
230
+ options: [
231
+ { label: 'Option one', value: '1' },
232
+ { label: 'Option two', value: '2' },
233
+ { label: 'Option three', value: '3' },
234
+ { label: 'Option four', value: '4' },
235
+ { label: 'Option five', value: '5' },
236
+ { label: 'Option six', value: '6' },
237
+ { label: 'Option seven', value: '7' },
238
+ { label: 'Option eight', value: '8' },
239
+ { label: 'Option nine', value: '9' },
240
+ { label: 'Option ten', value: '10' },
241
+ { label: 'Option eleven', value: '11' },
242
+ { label: 'Option twelve', value: '12' },
243
+ { label: 'Option thirteen', value: '13' },
244
+ { label: 'Option fourteen', value: '14' },
245
+ { label: 'Option fifteen', value: '15' },
246
+ ],
247
+ },
248
+ render: () => {
249
+ const [args, updateArgs] = useArgs();
250
+ const onValueChange = (value: (string | number)[]) => {
251
+ updateArgs({ value });
252
+ };
253
+ return (
254
+ <div style={storyWrapperStyle}>
255
+ <MultiSelect
256
+ {...args}
257
+ className={select400pxWidthClass}
258
+ options={args.options}
259
+ value={args.value}
260
+ onValueChange={onValueChange}
261
+ />
262
+ </div>
263
+ );
264
+ },
265
+ };
266
+
267
+ export const filterable: Story = {
268
+ args: { filterable: true },
269
+ render: () => {
270
+ const [args, updateArgs] = useArgs();
271
+ const onValueChange = (value: (string | number)[]) => updateArgs({ value });
272
+ return (
273
+ <div style={storyWrapperStyle}>
274
+ <MultiSelect
275
+ {...args}
276
+ className={select400pxWidthClass}
277
+ options={args.options}
278
+ value={args.value}
279
+ onValueChange={onValueChange}
280
+ placeholder='Type to filter...'
281
+ />
282
+ </div>
283
+ );
284
+ },
285
+ };
286
+
287
+ export const Clearable: Story = {
288
+ args: {
289
+ clearable: true,
290
+ value: ['2'],
291
+ placeholder: 'Clear selection',
292
+ },
293
+ render: () => {
294
+ const [args, updateArgs] = useArgs();
295
+ const onValueChange = (value: (string | number)[]) => updateArgs({ value });
296
+ return (
297
+ <div style={storyWrapperStyle}>
298
+ <MultiSelect
299
+ {...args}
300
+ className={select400pxWidthClass}
301
+ options={args.options}
302
+ value={args.value}
303
+ onValueChange={onValueChange}
304
+ />
305
+ </div>
306
+ );
307
+ },
308
+ };
@@ -0,0 +1,24 @@
1
+ import { CustomSelect } from './subcomponents';
2
+ import type {
3
+ InternalMultiSelectProps,
4
+ MultiSelectProps,
5
+ } from './MultiSelect.types';
6
+
7
+ type MultiSelectComponent = <T extends string | number = string>(
8
+ props: MultiSelectProps<T>
9
+ ) => React.JSX.Element;
10
+
11
+ const MultiSelect = (<T extends string | number = string>(
12
+ props: InternalMultiSelectProps<T>
13
+ ) => {
14
+ const { ref, ...rest } = props;
15
+
16
+ return (
17
+ <CustomSelect<T>
18
+ ref={ref as React.Ref<HTMLDivElement>}
19
+ {...rest}
20
+ />
21
+ );
22
+ }) as MultiSelectComponent;
23
+
24
+ export default MultiSelect;
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Represents an 'option' in the <Select>
3
+ * Maps to a native <option> element in <NativeSelect>
4
+ * or a <CustomOption> in <CustomSelect>
5
+ */
6
+ export type OptionData<T> = {
7
+ /**
8
+ * Display text shown to the user
9
+ */
10
+ label: string;
11
+ /**
12
+ * Data-friendly value that is returned when the option is selected
13
+ * We assume this will be submitted to a server or used in some other way
14
+ */
15
+ value: T;
16
+ /**
17
+ * Apply additional props to a select option component.
18
+ */
19
+ optionProps?: Record<string, unknown>;
20
+ /**
21
+ Deprecated
22
+ */
23
+ icon?: React.ReactNode;
24
+ };
25
+
26
+ /**
27
+ * Additional props forwarded to the filter input when `filterable` is true
28
+ */
29
+ export type FilterInputProps = Omit<
30
+ React.InputHTMLAttributes<HTMLInputElement>,
31
+ 'value' | 'onChange' | 'disabled' | 'ref' | 'role' | 'aria-autocomplete'
32
+ >;
33
+
34
+ export type SelectDropdownWidth = 'content' | 'match-select';
35
+
36
+ type MultiSelectBaseProps<T = string | number> = Omit<
37
+ React.HTMLAttributes<HTMLElement>,
38
+ 'onChange'
39
+ > & {
40
+ /**
41
+ * An array of option data, to be rendered either natively or custom
42
+ */
43
+ options: OptionData<T>[];
44
+ /**
45
+ * Placeholder text shown when no option is selected
46
+ * Displayed in visible field of custom implementation
47
+ * or as a disabled option in the native implementation
48
+ */
49
+ placeholder?: string;
50
+ /**
51
+ * Specify a specific width if the default (325px) is not suitable
52
+ */
53
+ width?: number;
54
+ /**
55
+ * Test ID for testing purposes
56
+ * This is passed to the root element of the component
57
+ * as `data-testid`
58
+ */
59
+ testId?: string;
60
+ /**
61
+ * Adds a text input to filter options in the custom variant;
62
+ */
63
+ filterable?: boolean;
64
+ /**
65
+ * Extra props to apply to the filter input when `filterable` is true
66
+ */
67
+ filterInputProps?: FilterInputProps;
68
+ /** * Noun used in the selection summary shown when 3 or more options are selected, * e.g. passing "items" shows "3 items selected" * @default 'selected' */
69
+ selectionCountLabel?: string;
70
+ /**
71
+ * Disable interaction
72
+ */
73
+ disabled?: boolean;
74
+ /**
75
+ * Allow long option labels to wrap instead of truncating
76
+ */
77
+ lineBreak?: boolean;
78
+ /**
79
+ * Controls the width of the custom options panel.
80
+ * - `content` (default): panel is at least the Select width and can grow to fit option labels.
81
+ * - `match-select`: panel width is capped to the Select width.
82
+ */
83
+ dropdownWidth?: SelectDropdownWidth;
84
+ /**
85
+ * Custom className for the root element
86
+ */
87
+ className?: string;
88
+ /**
89
+ * Custom className for the options panel
90
+ */
91
+ panelClassName?: string;
92
+ /**
93
+ * Custom className for the custom select visible field
94
+ */
95
+ visibleFieldClassName?: string;
96
+ /**
97
+ * Custom className for each custom select option
98
+ */
99
+ optionClassName?: string;
100
+ /**
101
+ * Custom className for the custom select chevron icon
102
+ */
103
+ chevronIconClassName?: string;
104
+ /**
105
+ * Ref forwarded to the rendered element
106
+ * (div for custom)
107
+ */
108
+ ref?: React.Ref<HTMLDivElement | HTMLSelectElement | null>;
109
+ };
110
+
111
+ export type MultiSelectProps<T = string | number> = MultiSelectBaseProps<T> & {
112
+ /**
113
+ * Current value (controlled) - array of selected values
114
+ */
115
+ value?: T[];
116
+ /**
117
+ * Show a clear action in the custom variant when a value is selected
118
+ */
119
+ clearable?: boolean;
120
+ /**
121
+ * Change handler for the custom variant
122
+ */
123
+ onValueChange?: (value: T[], ev: React.SyntheticEvent) => void;
124
+ };
125
+
126
+ export type InternalMultiSelectProps<T = string | number> = MultiSelectProps<T>;
127
+
128
+ /**
129
+ * Each option as displayed in the Panel of <CustomSelect>
130
+ * Roughly equivalent to a custom version of <option>
131
+ */
132
+ export interface CustomOptionProps<T> extends Omit<
133
+ React.HTMLAttributes<HTMLDivElement>,
134
+ 'onSelect'
135
+ > {
136
+ value: T;
137
+ testId?: string;
138
+ isSelected?: boolean;
139
+ isActive?: boolean;
140
+ onSelect: (event: React.MouseEvent, value: T) => void;
141
+ lineBreak?: boolean;
142
+ }