@lumx/react 4.3.2-alpha.12 → 4.3.2-alpha.14

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.
@@ -0,0 +1,986 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default, { Ref, ReactElement, AriaAttributes, ReactNode, ReactText, RefObject, SyntheticEvent } from 'react';
3
+ import { GenericProps as GenericProps$1, Size as Size$1 } from '@lumx/core/js/constants';
4
+ import { Selector } from '@lumx/core/js/types/Selector';
5
+ import { ValueOf, GenericProps, HasTheme as HasTheme$1, HasAriaDisabled as HasAriaDisabled$1, HasCloseMode } from '@lumx/core/js/types';
6
+
7
+ /** LumX Component Type. */
8
+ type Comp<P, T = HTMLElement> = {
9
+ (props: P & {
10
+ ref?: Ref<T>;
11
+ }): ReactElement | null;
12
+ /** React component type. */
13
+ readonly $$typeof: symbol;
14
+ /** Component default props. */
15
+ defaultProps?: Partial<P>;
16
+ /** Component name. */
17
+ displayName?: string;
18
+ /** Component base class name. */
19
+ className?: string;
20
+ };
21
+
22
+ /**
23
+ * Alignments.
24
+ */
25
+ declare const Alignment: {
26
+ readonly bottom: "bottom";
27
+ readonly center: "center";
28
+ readonly end: "end";
29
+ readonly left: "left";
30
+ readonly right: "right";
31
+ readonly spaceAround: "space-around";
32
+ readonly spaceBetween: "space-between";
33
+ readonly spaceEvenly: "space-evenly";
34
+ readonly start: "start";
35
+ readonly top: "top";
36
+ };
37
+ type Alignment = ValueOf<typeof Alignment>;
38
+ type VerticalAlignment = Extract<Alignment, 'top' | 'center' | 'bottom'>;
39
+ type HorizontalAlignment = Extract<Alignment, 'right' | 'center' | 'left'>;
40
+ declare const Theme: {
41
+ readonly light: "light";
42
+ readonly dark: "dark";
43
+ };
44
+ type Theme = ValueOf<typeof Theme>;
45
+ declare const Size: {
46
+ readonly xxs: "xxs";
47
+ readonly xs: "xs";
48
+ readonly s: "s";
49
+ readonly m: "m";
50
+ readonly l: "l";
51
+ readonly xl: "xl";
52
+ readonly xxl: "xxl";
53
+ readonly tiny: "tiny";
54
+ readonly regular: "regular";
55
+ readonly medium: "medium";
56
+ readonly big: "big";
57
+ readonly huge: "huge";
58
+ };
59
+ type Size = ValueOf<typeof Size>;
60
+ type GlobalSize = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;
61
+ declare const Orientation: {
62
+ readonly horizontal: "horizontal";
63
+ readonly vertical: "vertical";
64
+ };
65
+ type Orientation = ValueOf<typeof Orientation>;
66
+ declare const Emphasis: {
67
+ readonly low: "low";
68
+ readonly medium: "medium";
69
+ readonly high: "high";
70
+ };
71
+ type Emphasis = ValueOf<typeof Emphasis>;
72
+ /**
73
+ * List of typographies that can't be customized.
74
+ */
75
+ declare const TypographyInterface: {
76
+ readonly overline: "overline";
77
+ readonly caption: "caption";
78
+ readonly body1: "body1";
79
+ readonly body2: "body2";
80
+ readonly subtitle1: "subtitle1";
81
+ readonly subtitle2: "subtitle2";
82
+ readonly title: "title";
83
+ readonly headline: "headline";
84
+ readonly display1: "display1";
85
+ };
86
+ type TypographyInterface = ValueOf<typeof TypographyInterface>;
87
+ /**
88
+ * List of typographies that can be customized (via CSS variables).
89
+ */
90
+ declare const TypographyCustom: {
91
+ readonly intro: "custom-intro";
92
+ readonly 'body-large': "custom-body-large";
93
+ readonly body: "custom-body";
94
+ readonly quote: "custom-quote";
95
+ readonly 'publish-info': "custom-publish-info";
96
+ readonly button: "custom-button";
97
+ readonly title1: "custom-title1";
98
+ readonly title2: "custom-title2";
99
+ readonly title3: "custom-title3";
100
+ readonly title4: "custom-title4";
101
+ readonly title5: "custom-title5";
102
+ readonly title6: "custom-title6";
103
+ };
104
+ type TypographyCustom = ValueOf<typeof TypographyCustom>;
105
+ /**
106
+ * List of all typographies.
107
+ */
108
+ declare const Typography: {
109
+ readonly custom: {
110
+ readonly intro: "custom-intro";
111
+ readonly 'body-large': "custom-body-large";
112
+ readonly body: "custom-body";
113
+ readonly quote: "custom-quote";
114
+ readonly 'publish-info': "custom-publish-info";
115
+ readonly button: "custom-button";
116
+ readonly title1: "custom-title1";
117
+ readonly title2: "custom-title2";
118
+ readonly title3: "custom-title3";
119
+ readonly title4: "custom-title4";
120
+ readonly title5: "custom-title5";
121
+ readonly title6: "custom-title6";
122
+ };
123
+ readonly overline: "overline";
124
+ readonly caption: "caption";
125
+ readonly body1: "body1";
126
+ readonly body2: "body2";
127
+ readonly subtitle1: "subtitle1";
128
+ readonly subtitle2: "subtitle2";
129
+ readonly title: "title";
130
+ readonly headline: "headline";
131
+ readonly display1: "display1";
132
+ };
133
+ type Typography = TypographyInterface | TypographyCustom;
134
+ /**
135
+ * All available aspect ratios.
136
+ */
137
+ declare const AspectRatio: {
138
+ /** Intrinsic content ratio. */
139
+ readonly original: "original";
140
+ /** Ratio 3:1 */
141
+ readonly panoramic: "panoramic";
142
+ /** Ratio 16:9 */
143
+ readonly wide: "wide";
144
+ /** Ratio 3:2 */
145
+ readonly horizontal: "horizontal";
146
+ /** Ratio 3:2 */
147
+ readonly vertical: "vertical";
148
+ /** Ratio 1:1 */
149
+ readonly square: "square";
150
+ /** Ratio constrained by the parent. */
151
+ readonly free: "free";
152
+ };
153
+ type AspectRatio = ValueOf<typeof AspectRatio>;
154
+ /**
155
+ * Semantic info about the purpose of the component
156
+ */
157
+ declare const Kind: {
158
+ readonly info: "info";
159
+ readonly success: "success";
160
+ readonly warning: "warning";
161
+ readonly error: "error";
162
+ };
163
+ type Kind = ValueOf<typeof Kind>;
164
+ /**
165
+ * All available white-space values
166
+ * */
167
+ declare const WhiteSpace: {
168
+ normal: string;
169
+ nowrap: string;
170
+ pre: string;
171
+ 'pre-wrap': string;
172
+ 'pre-line': string;
173
+ 'break-spaces': string;
174
+ };
175
+ type WhiteSpace = ValueOf<typeof WhiteSpace>;
176
+ /**
177
+ * See SCSS variable $lumx-color-palette
178
+ */
179
+ declare const ColorPalette: {
180
+ readonly primary: "primary";
181
+ readonly secondary: "secondary";
182
+ readonly blue: "blue";
183
+ readonly dark: "dark";
184
+ readonly green: "green";
185
+ readonly yellow: "yellow";
186
+ readonly red: "red";
187
+ readonly light: "light";
188
+ readonly grey: "grey";
189
+ };
190
+ type ColorPalette = ValueOf<typeof ColorPalette>;
191
+ /**
192
+ * See SCSS variable $lumx-color-variants
193
+ */
194
+ declare const ColorVariant: {
195
+ readonly D1: "D1";
196
+ readonly D2: "D2";
197
+ readonly L1: "L1";
198
+ readonly L2: "L2";
199
+ readonly L3: "L3";
200
+ readonly L4: "L4";
201
+ readonly L5: "L5";
202
+ readonly L6: "L6";
203
+ readonly N: "N";
204
+ };
205
+ type ColorVariant = ValueOf<typeof ColorVariant>;
206
+ /** ColorPalette with all possible color variant combination */
207
+ type ColorWithVariants = ColorPalette | Exclude<`${ColorPalette}-${ColorVariant}`, `light-D${number}` | `dark-D${number}`>;
208
+
209
+ interface HasClassName {
210
+ /**
211
+ * Class name forwarded to the root element of the component.
212
+ */
213
+ className?: string;
214
+ }
215
+
216
+ interface HasTheme {
217
+ /**
218
+ * Theme adapting the component to light or dark background.
219
+ */
220
+ theme?: Theme;
221
+ }
222
+
223
+ /**
224
+ * Framework-agnostic type for renderable content.
225
+ * Vue components should cast VNode[] from slots to this type.
226
+ *
227
+ * Note: Uses type-only import to avoid runtime dependencies.
228
+ */
229
+ type JSXElement = React__default.ReactNode;
230
+
231
+ type CommonRef = any;
232
+
233
+ type Booleanish = boolean | 'true' | 'false';
234
+
235
+ interface HasAriaDisabled {
236
+ /** Similar to `disabled` but does not block pointer events or focus */
237
+ 'aria-disabled'?: Booleanish;
238
+ }
239
+
240
+ interface HasDisabled {
241
+ /** Whether the component is disabled or not. */
242
+ isDisabled?: boolean;
243
+ /** @alias isDisabled */
244
+ disabled?: boolean;
245
+ }
246
+
247
+ interface BaseClickableProps extends HasDisabled, HasAriaDisabled {
248
+ children?: JSXElement;
249
+ onClick?: (event?: any) => void;
250
+ ref?: CommonRef;
251
+ }
252
+
253
+ /**
254
+ * Button size definition.
255
+ */
256
+ type ButtonSize = Extract<Size, 's' | 'm'>;
257
+ interface BaseButtonProps extends Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label'>, HasClassName, HasTheme, HasAriaDisabled, BaseClickableProps {
258
+ /** Color variant. */
259
+ color?: ColorPalette;
260
+ /** Emphasis variant. */
261
+ emphasis?: Emphasis;
262
+ /** Whether or not the button has a background color in low emphasis. */
263
+ hasBackground?: boolean;
264
+ /** Native anchor href property. It determines whether the Button will be a <button> or an <a>. */
265
+ href?: string;
266
+ /** Whether the component is disabled or not. */
267
+ isDisabled?: boolean;
268
+ /** Whether the component is selected or not (unsupported in `high` emphasis). */
269
+ isSelected?: boolean;
270
+ /** Native button name property. */
271
+ name?: string;
272
+ /** Size variant. */
273
+ size?: ButtonSize;
274
+ /** Native anchor target property. */
275
+ target?: '_self' | '_blank' | '_parent' | '_top';
276
+ /** Native button type. */
277
+ type?: 'submit' | 'reset' | 'button' | undefined;
278
+ /** Custom component for the link (can be used to inject router Link). */
279
+ linkAs?: 'a' | any;
280
+ /** whether the button is dispalyed in full width or not */
281
+ fullWidth?: boolean;
282
+ /** whether the button is currently active or not */
283
+ isActive?: boolean;
284
+ /** whether the button is currently focused or not */
285
+ isFocused?: boolean;
286
+ /** whether the button is currently focused or not */
287
+ isHovered?: boolean;
288
+ }
289
+
290
+ interface IconButtonProps$1 extends BaseButtonProps {
291
+ /**
292
+ * Icon (SVG path).
293
+ * If `image` is also set, `image` will be used instead.
294
+ */
295
+ icon?: string;
296
+ /**
297
+ * Image (image url).
298
+ * Has priority over `icon`.
299
+ */
300
+ image?: string;
301
+ /**
302
+ * Label text (required for a11y purpose).
303
+ * If you really don't want an aria-label, you can set an empty label (this is not recommended).
304
+ */
305
+ label: string;
306
+ /** text to be displayed on hover */
307
+ title?: string;
308
+ }
309
+
310
+ interface IconButtonProps extends GenericProps, Omit<IconButtonProps$1, 'title' | 'children'> {
311
+ /**
312
+ * Props to pass to the tooltip.
313
+ * If undefined or if tooltipProps.label is undefined, the label prop will be used as tooltip label.
314
+ * */
315
+ tooltipProps?: Partial<TooltipProps>;
316
+ /** Whether the tooltip should be hidden or not. */
317
+ hideTooltip?: boolean;
318
+ }
319
+ /**
320
+ * IconButton component.
321
+ *
322
+ * @param props Component props.
323
+ * @param ref Component ref.
324
+ * @return React element.
325
+ */
326
+ declare const IconButton: Comp<IconButtonProps, HTMLButtonElement>;
327
+
328
+ /**
329
+ * The source of the combobox option selection
330
+ * It could either be on click / touch or keyboard selection
331
+ */
332
+ type ComboboxOptionSelectEventSource = 'keyboard' | 'click';
333
+ type ComboboxSelectionType = 'single' | 'multiple';
334
+ type BaseLoadingStatus = 'loading' | 'loadingMore' | 'idle' | 'error' | 'debouncing' | 'filtering' | 'empty';
335
+ /**
336
+ * Options related types
337
+ */
338
+ /** All possible values a combobox option can have */
339
+ type BaseComboboxOptionProps<O = any> = {
340
+ /**
341
+ * A unique id to track the option
342
+ */
343
+ id: string;
344
+ /**
345
+ * Whether the current input value should filter this option.
346
+ */
347
+ filterFromInput?: boolean;
348
+ /**
349
+ * Callback to call when the option is selected.
350
+ * This should only be used to add custom actions on options.
351
+ * For most cases, the "onSelect" on the Combobox root component should be enough.
352
+ */
353
+ onSelect?: (option: O, eventSource?: ComboboxOptionSelectEventSource) => void;
354
+ /**
355
+ * Additional data to link to the option. This can be useful to retrieve with `onSelect`.
356
+ */
357
+ data?: O;
358
+ /**
359
+ * Whether the option is disabled
360
+ */
361
+ isDisabled?: boolean;
362
+ /**
363
+ * The components to use to visually customize options.
364
+ * ! Options must not have interactive elements.
365
+ * ! If you need additional actions, you might need to create custom options and search how to
366
+ * ! make them accessible.
367
+ */
368
+ children?: ReactNode;
369
+ /**
370
+ * The text value the option has.
371
+ * This is the value used to filter the options by when manual filtering is disabled
372
+ * and that will be used as input value when an option is selected
373
+ */
374
+ textValue?: string;
375
+ /**
376
+ * Element to display before the content of the option.
377
+ * ! Options must not have interactive elements.
378
+ * ! If you need additional actions, you might need to create custom options and search how to
379
+ * ! make them accessible.
380
+ */
381
+ before?: ReactNode;
382
+ /**
383
+ * Element to display after the content of the option.
384
+ * ! Options must not have interactive elements.
385
+ * ! If you need additional actions, you might need to create custom options and search how to
386
+ * ! make them accessible.
387
+ */
388
+ after?: ReactNode;
389
+ /**
390
+ * Size of the list item.
391
+ * Default to tiny
392
+ */
393
+ size?: ListItemSize;
394
+ /**
395
+ * Fill to activate a tooltip on mouse over
396
+ */
397
+ tooltipProps?: Partial<TooltipProps>;
398
+ };
399
+ /**
400
+ * Props for when an option has no children.
401
+ * In these case, we need at least the text value to know what to display
402
+ * */
403
+ type TextValueOnly<O = any> = BaseComboboxOptionProps<O> & {
404
+ children?: never;
405
+ textValue: string;
406
+ };
407
+ /**
408
+ * Props for when an option has a react element as string
409
+ * In that case, we can use the children as the textValue without having
410
+ * to set a manual props.
411
+ * The props is still available to have a text value different than the displayed value.
412
+ */
413
+ type StringOption<O = any> = BaseComboboxOptionProps<O> & {
414
+ children: ReactText;
415
+ textValue?: string;
416
+ };
417
+ /**
418
+ * Props for when an option has a react element as children
419
+ * In that case, we cannot know what the actual value of the
420
+ * option is, so the `textValue` prop has to be set.
421
+ */
422
+ type NodeOption<O = any> = BaseComboboxOptionProps<O> & {
423
+ children: Exclude<ReactNode, ReactText>;
424
+ textValue: string;
425
+ };
426
+ /** Props for the ComboboxOption component */
427
+ type ComboboxOptionProps<O = any> = TextValueOnly<O> | StringOption<O> | NodeOption<O>;
428
+ /** Shared data between all combobox option types. */
429
+ interface BaseRegisteredComboboxOption {
430
+ id: string;
431
+ /** The id that was generated for this option */
432
+ generatedId: string;
433
+ /** Whether the "option" is an action */
434
+ isAction?: boolean;
435
+ /** Whether the "option" is disabled */
436
+ isDisabled?: boolean;
437
+ }
438
+ /** Values of action type options */
439
+ interface RegisteredComboboxAction extends BaseRegisteredComboboxOption {
440
+ /** Whether the "option" is an action */
441
+ isAction: true;
442
+ /** Callback when the action is triggered. */
443
+ onSelect?: () => void;
444
+ }
445
+ /** Combobox value */
446
+ interface RegisteredComboboxOptionValue<O = any> extends BaseRegisteredComboboxOption, Pick<ComboboxOptionProps<O>, 'data' | 'filterFromInput' | 'textValue' | 'onSelect'> {
447
+ /** The section the option is a child of. */
448
+ sectionId?: string;
449
+ /** Whether the "option" is an action */
450
+ isAction?: never;
451
+ }
452
+ /** The option values stored in the state */
453
+ type RegisteredComboboxOption<O = any> = RegisteredComboboxAction | RegisteredComboboxOptionValue<O>;
454
+ type OnComboboxSelect<O = any> = (option: RegisteredComboboxOptionValue<O>) => void;
455
+ type OnComboboxInputChange = TextFieldProps['onChange'];
456
+ type ComboboxTranslations = {
457
+ clearLabel: string;
458
+ showSuggestionsLabel: string;
459
+ loadingLabel: string;
460
+ noResultsForInputLabel: (input?: string) => string;
461
+ serviceUnavailableLabel: string;
462
+ tryReloadLabel: string;
463
+ nbOptionsLabel: (options: number) => string;
464
+ };
465
+ /** Props for the main combobox component. */
466
+ type ComboboxProps<O = any> = {
467
+ /**
468
+ * HTML id
469
+ */
470
+ id?: string;
471
+ /**
472
+ * The current option id to set as selected.
473
+ * If omitted, the local state will be used instead;
474
+ */
475
+ selectedIds?: Array<string | number>;
476
+ /**
477
+ * The current value for the combobox input.
478
+ * If omitted, the input is controlled locally */
479
+ inputValue?: string;
480
+ /**
481
+ * The default value to set on the input.
482
+ * Use this if you want to initialize the input with a value and not control it
483
+ */
484
+ defaultInputValue?: string;
485
+ /**
486
+ * Whether the options should be automatically filtered or not.
487
+ * By default, the combobox will try to filter the options from the current input value
488
+ * using a "contains" strategy.
489
+ * If this is `false`, the option will not be automatically filtered and must be manually filtered by the parent.
490
+ * Useful for asynchronous comboboxes.
491
+ */
492
+ autoFilter: boolean;
493
+ /**
494
+ * Whether the combobox should open on focus
495
+ */
496
+ openOnFocus?: boolean;
497
+ /**
498
+ * Whether the combobox should open on click
499
+ */
500
+ openOnClick?: boolean;
501
+ /**
502
+ * Status of the combobox
503
+ */
504
+ status?: BaseLoadingStatus;
505
+ /**
506
+ * Callback when the input changes.
507
+ */
508
+ onInputChange?: OnComboboxInputChange;
509
+ /**
510
+ * Callback for when an option is selected
511
+ */
512
+ onSelect?: OnComboboxSelect<O>;
513
+ /**
514
+ * Callback called when the combobox opens
515
+ */
516
+ onOpen?: (options: {
517
+ currentValue?: string;
518
+ manual: boolean;
519
+ }) => void;
520
+ /**
521
+ * The combobox components to render.
522
+ * Must be one of the exposed components (Combobox.Input, Combobox.ListBox etc...)
523
+ */
524
+ children: ReactNode;
525
+ /**
526
+ * The combobox can have a specific selection type:
527
+ * - Single: only one item is selected
528
+ * - Multiple: several items can be selected (this impacts the combobox list, which will now not close when selectiong an option)
529
+ */
530
+ selectionType?: ComboboxSelectionType;
531
+ /**
532
+ * Whether the error state should be displayed when the status is in error.
533
+ * @default `true` if `status` is defined
534
+ */
535
+ showErrorState?: boolean;
536
+ /**
537
+ * Whether the empty state should be displayed when there is no results.
538
+ * @default `true` if `autoFilter=false`
539
+ */
540
+ showEmptyState?: boolean;
541
+ /** custom className */
542
+ className?: string;
543
+ /** translations to be used across the combobox */
544
+ translations: ComboboxTranslations;
545
+ };
546
+ /** Entity related types for single selection. */
547
+ type SingleSelection<O = any> = {
548
+ selectionType: 'single';
549
+ /**
550
+ * Selected option object
551
+ */
552
+ value?: O;
553
+ /**
554
+ * Callback on option object selected
555
+ */
556
+ onChange?(newValue?: O): void;
557
+ /**
558
+ * No chips in single selection mode.
559
+ */
560
+ renderChip?: never;
561
+ };
562
+ /** Entity related types for multiple selection. */
563
+ type MultipleSelection<O = any> = {
564
+ selectionType: 'multiple';
565
+ /**
566
+ * Selected options array
567
+ */
568
+ value?: O[];
569
+ /**
570
+ * Callback on option array selected
571
+ */
572
+ onChange?(newValue?: O[]): void;
573
+ /**
574
+ * Custom selection chip render function
575
+ */
576
+ renderChip?: (option: O) => ReactNode;
577
+ };
578
+ /** Shared props between SelectTextField and SelectButton */
579
+ type BaseSelectProps<O = any> = {
580
+ /**
581
+ * List of option objects
582
+ */
583
+ options?: Array<O>;
584
+ /**
585
+ * Option object id selector (either the property name or a function to get the id)
586
+ */
587
+ getOptionId: Selector<O>;
588
+ /**
589
+ * Option object name selector (either the property name or a function to get the name)
590
+ * Fallbacks on the ID if not defined
591
+ */
592
+ getOptionName?: Selector<O, string | undefined | null>;
593
+ /**
594
+ * Option object description selector (either the property name or a function to get the description)
595
+ */
596
+ getOptionDescription?: Selector<O, string | undefined | null>;
597
+ /**
598
+ * Option object section id selector.
599
+ * Providing this will group options by sections (and may change their order)
600
+ * If the section id is a string, it is used as section label. Else, the section won't have a label.
601
+ */
602
+ getSectionId?: Selector<O, any>;
603
+ /**
604
+ * option object section title selector.
605
+ * If provided, the section will be rendered using this function.
606
+ */
607
+ renderSectionTitle?: (option: O, sectionIndex: number) => React.ReactNode;
608
+ /**
609
+ * Whether the sections are separated by dividers
610
+ */
611
+ hasSectionDividers?: boolean;
612
+ /**
613
+ * Option object render function
614
+ * Default to rendering option using the id & name obtained with `optionIdSelector` & `optionNameSelector`
615
+ *
616
+ * **The direct child must be a Combobox.Option, otherwise it will not render the children.**.
617
+ */
618
+ renderOption?: (option: O, index: number) => React.ReactNode;
619
+ /**
620
+ * Callback to load more items
621
+ */
622
+ onLoadMore?(): void;
623
+ /**
624
+ * Props passed to the option list.
625
+ */
626
+ listProps?: Partial<ComboboxListBoxProps>;
627
+ /**
628
+ * Add custom elements before the options
629
+ */
630
+ beforeOptions?: ReactNode;
631
+ /**
632
+ * Data attribute scope
633
+ */
634
+ scope?: string;
635
+ };
636
+ type OpenComboboxAction = {
637
+ type: 'OPEN_COMBOBOX';
638
+ payload?: {
639
+ manual?: boolean;
640
+ };
641
+ };
642
+ type CloseComboboxAction = {
643
+ type: 'CLOSE_COMBOBOX';
644
+ };
645
+ type SetInputValueAction = {
646
+ type: 'SET_INPUT_VALUE';
647
+ payload: string;
648
+ };
649
+ type AddOptionAction = {
650
+ type: 'ADD_OPTION';
651
+ payload: {
652
+ id: string;
653
+ option: RegisteredComboboxOption;
654
+ };
655
+ };
656
+ type RemoveOptionAction = {
657
+ type: 'REMOVE_OPTION';
658
+ payload: {
659
+ id: string;
660
+ };
661
+ };
662
+ type ComboboxAction = OpenComboboxAction | CloseComboboxAction | SetInputValueAction | AddOptionAction | RemoveOptionAction;
663
+
664
+ interface ComboboxOptionSkeletonProps {
665
+ className?: string;
666
+ index?: number;
667
+ children?: ReactNode | ((options: {
668
+ index?: number;
669
+ }) => ReactNode);
670
+ before?: ComboboxOptionProps['before'];
671
+ after?: ComboboxOptionProps['after'];
672
+ size?: ComboboxOptionProps['size'];
673
+ }
674
+ /**
675
+ * Skeleton for a combobox option.
676
+ * A typography skeleton is rendered by default but can be overridden by passing children.
677
+ */
678
+ declare const ComboboxOptionSkeleton: ({ className, index, before, after, size, children, }: ComboboxOptionSkeletonProps) => react_jsx_runtime.JSX.Element;
679
+
680
+ interface ComboboxListSkeletonProps {
681
+ isLoadingMore?: boolean;
682
+ children?: ComboboxOptionSkeletonProps['children'];
683
+ }
684
+
685
+ interface ComboboxListBoxProps extends GenericProps$1, React__default.ComponentProps<'ul'> {
686
+ /** Options display in the combobox */
687
+ children?: ReactNode;
688
+ /**
689
+ * Component to use as skeleton for each option instead of the default one.
690
+ * Can either be a react node or a component that receives the index as prop
691
+ */
692
+ renderItemSkeleton?: ComboboxListSkeletonProps['children'];
693
+ /** Label for the list */
694
+ label?: string;
695
+ /** Props of the popover element. */
696
+ popoverProps?: Partial<PopoverProps>;
697
+ /**
698
+ * An element to display at the bottom of the listbox.
699
+ * No interactive element must be set here as they will not be accessible.
700
+ */
701
+ footer?: ReactNode;
702
+ /** List ref */
703
+ listRef?: React__default.Ref<HTMLElement>;
704
+ }
705
+ /**
706
+ * The listbox containing the combobox's options.
707
+ *
708
+ * @family Combobox
709
+ * @param ComboboxListBoxProps
710
+ * @returns ComboboxListBox
711
+ */
712
+ declare const ComboboxListBox: ({ children, renderItemSkeleton, label, popoverProps, footer, listRef, ...forwardedProps }: ComboboxListBoxProps) => react_jsx_runtime.JSX.Element;
713
+
714
+ /**
715
+ * Different possible placements for the popover.
716
+ */
717
+ declare const Placement: {
718
+ readonly AUTO: "auto";
719
+ readonly AUTO_END: "auto-end";
720
+ readonly AUTO_START: "auto-start";
721
+ readonly TOP: "top";
722
+ readonly TOP_END: "top-end";
723
+ readonly TOP_START: "top-start";
724
+ readonly RIGHT: "right";
725
+ readonly RIGHT_END: "right-end";
726
+ readonly RIGHT_START: "right-start";
727
+ readonly BOTTOM: "bottom";
728
+ readonly BOTTOM_END: "bottom-end";
729
+ readonly BOTTOM_START: "bottom-start";
730
+ readonly LEFT: "left";
731
+ readonly LEFT_END: "left-end";
732
+ readonly LEFT_START: "left-start";
733
+ };
734
+ type Placement = ValueOf<typeof Placement>;
735
+ /**
736
+ * Offset of the popover.
737
+ */
738
+ interface Offset {
739
+ /** Offset size along the reference. */
740
+ along?: number;
741
+ /** Offset size away from the reference. */
742
+ away?: number;
743
+ }
744
+ /**
745
+ * Popover elevation index.
746
+ */
747
+ type Elevation = 1 | 2 | 3 | 4 | 5;
748
+ /**
749
+ * Popover fit anchor width options.
750
+ */
751
+ declare const FitAnchorWidth: {
752
+ readonly MAX_WIDTH: "maxWidth";
753
+ readonly MIN_WIDTH: "minWidth";
754
+ readonly WIDTH: "width";
755
+ };
756
+ type FitAnchorWidth = ValueOf<typeof FitAnchorWidth>;
757
+
758
+ /**
759
+ * Defines the props of the component.
760
+ */
761
+ interface PopoverProps extends GenericProps, HasTheme$1 {
762
+ /** Reference to the DOM element used to set the position of the popover. */
763
+ anchorRef: React.RefObject<HTMLElement>;
764
+ /** Customize the root element. (Must accept ref forwarding and props forwarding!). */
765
+ as?: React.ElementType;
766
+ /** Element which will act as boundary when opening the popover. */
767
+ boundaryRef?: RefObject<HTMLElement>;
768
+ /** Content. */
769
+ children: ReactNode;
770
+ /** Whether a click anywhere out of the popover would close it. */
771
+ closeOnClickAway?: boolean;
772
+ /** Whether an escape key press would close the popover. */
773
+ closeOnEscape?: boolean;
774
+ /** Shadow elevation. */
775
+ elevation?: Elevation;
776
+ /**
777
+ * Manage popover width:
778
+ * - `maxWidth`: popover not bigger than anchor
779
+ * - `minWidth` or `true`: popover not smaller than anchor
780
+ * - `width`: popover equal to the anchor.
781
+ */
782
+ fitToAnchorWidth?: FitAnchorWidth | boolean;
783
+ /** Shrink popover if even after flipping there is not enough space. */
784
+ fitWithinViewportHeight?: boolean;
785
+ /** Element to focus when opening the popover. */
786
+ focusElement?: RefObject<HTMLElement>;
787
+ /** Whether the focus should go back on the anchor when popover closes and focus is within. */
788
+ focusAnchorOnClose?: boolean;
789
+ /** Whether we put an arrow or not. */
790
+ hasArrow?: boolean;
791
+ /** Whether the popover is open or not. */
792
+ isOpen: boolean;
793
+ /** Offset placement relative to anchor. */
794
+ offset?: Offset;
795
+ /** Reference to the parent element that triggered the popover (will get back focus on close or else fallback on the anchor element). */
796
+ parentElement?: RefObject<HTMLElement>;
797
+ /** Placement relative to anchor. */
798
+ placement?: Placement;
799
+ /** Whether the popover should be rendered into a DOM node that exists outside the DOM hierarchy of the parent component. */
800
+ usePortal?: boolean;
801
+ /** The element in which the focus trap should be set. Default to popover. */
802
+ focusTrapZoneElement?: RefObject<HTMLElement>;
803
+ /** Z-axis position. */
804
+ zIndex?: number;
805
+ /** On close callback (on click away or Escape pressed). */
806
+ onClose?(): void;
807
+ /** Whether the popover should trap the focus within itself. Default to false. */
808
+ withFocusTrap?: boolean;
809
+ }
810
+ /**
811
+ * Popover component.
812
+ *
813
+ * @param props Component props.
814
+ * @param ref Component ref.
815
+ * @return React element.
816
+ */
817
+ declare const Popover: Comp<PopoverProps, HTMLDivElement>;
818
+
819
+ interface InputLabelProps$1 extends HasClassName, HasTheme {
820
+ /** Typography variant. */
821
+ typography?: Typography;
822
+ /** Label content. */
823
+ children: JSXElement;
824
+ /** Native htmlFor property. */
825
+ htmlFor: string;
826
+ /** Whether the component is required or not. */
827
+ isRequired?: boolean;
828
+ /** ref to the root element */
829
+ ref?: CommonRef;
830
+ }
831
+
832
+ interface InputLabelProps extends InputLabelProps$1, GenericProps {
833
+ }
834
+ /**
835
+ * InputLabel component.
836
+ *
837
+ * @param props Component props.
838
+ * @param ref Component ref.
839
+ * @return React element.
840
+ */
841
+ declare const InputLabel: Comp<InputLabelProps, HTMLLabelElement>;
842
+
843
+ type ListItemSize = Extract<Size$1, 'tiny' | 'regular' | 'big' | 'huge'>;
844
+ /**
845
+ * Defines the props of the component.
846
+ */
847
+ interface ListItemProps extends GenericProps, HasAriaDisabled$1 {
848
+ /** A component to be rendered after the content. */
849
+ after?: ReactNode;
850
+ /** A component to be rendered before the content. */
851
+ before?: ReactNode;
852
+ /** Content. */
853
+ children: string | ReactNode;
854
+ /** Whether the list item should be highlighted or not. */
855
+ isHighlighted?: boolean;
856
+ /** Whether the component is selected or not. */
857
+ isSelected?: boolean;
858
+ /** Whether link/button is disabled or not. */
859
+ isDisabled?: boolean;
860
+ /** Reference to the <li> element. */
861
+ listItemRef?: Ref<HTMLLIElement>;
862
+ /** Custom react component for the link (can be used to inject react router Link). */
863
+ linkAs?: 'a' | any;
864
+ /** Props that will be passed on to the Link */
865
+ linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
866
+ /** Reference to the link element. */
867
+ linkRef?: Ref<HTMLAnchorElement>;
868
+ /** Size variant. */
869
+ size?: ListItemSize;
870
+ /** On selected callback. */
871
+ onItemSelected?(evt: SyntheticEvent): void;
872
+ }
873
+ /**
874
+ * Check if the list item is clickable.
875
+ * @return `true` if the list item is clickable; `false` otherwise.
876
+ */
877
+ declare function isClickable({ linkProps, onItemSelected }: Partial<ListItemProps>): boolean;
878
+ /**
879
+ * ListItem component.
880
+ *
881
+ * @param props Component props.
882
+ * @param ref Component ref.
883
+ * @return React element.
884
+ */
885
+ declare const ListItem: Comp<ListItemProps, HTMLLIElement>;
886
+
887
+ /**
888
+ * Defines the props of the component.
889
+ */
890
+ interface TextFieldProps extends GenericProps, HasTheme$1, HasAriaDisabled$1 {
891
+ /** Chip Group to be rendered before the main text input. */
892
+ chips?: ReactNode;
893
+ /** Props to pass to the clear button (minus those already set by the TextField props). If not specified, the button won't be displayed. */
894
+ clearButtonProps?: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;
895
+ /** Error message. */
896
+ error?: string | ReactNode;
897
+ /** Whether we force the focus style or not. */
898
+ forceFocusStyle?: boolean;
899
+ /** Whether the text field is displayed with error style or not. */
900
+ hasError?: boolean;
901
+ /** Additional element to put at the end of the text field. */
902
+ afterElement?: ReactNode;
903
+ /** Helper text. */
904
+ helper?: string | ReactNode;
905
+ /** Icon (SVG path). */
906
+ icon?: string;
907
+ /** Native input id property (generated if not provided to link the label element). */
908
+ id?: string;
909
+ /** Reference to the <input> or <textarea> element. */
910
+ inputRef?: Ref<HTMLInputElement | HTMLTextAreaElement>;
911
+ /** Whether the component is disabled or not. */
912
+ isDisabled?: boolean;
913
+ /** Whether the component is required or not. */
914
+ isRequired?: boolean;
915
+ /** Whether the text field is displayed with valid style or not. */
916
+ isValid?: boolean;
917
+ /** Label text. */
918
+ label?: string;
919
+ /** Additional label props. */
920
+ labelProps?: InputLabelProps;
921
+ /** Max string length the input accepts (constrains the input and displays a character counter). */
922
+ maxLength?: number;
923
+ /** Minimum number of rows displayed in multiline mode (requires `multiline` to be enabled). */
924
+ minimumRows?: number;
925
+ /** Whether the text field is a textarea or an input. */
926
+ multiline?: boolean;
927
+ /** Native input name property. */
928
+ name?: string;
929
+ /** Placeholder text. */
930
+ placeholder?: string;
931
+ /** Reference to the wrapper. */
932
+ textFieldRef?: Ref<HTMLDivElement>;
933
+ /** Native input type (only when `multiline` is disabled). */
934
+ type?: React.ComponentProps<'input'>['type'];
935
+ /** Value. */
936
+ value?: string;
937
+ /** On blur callback. */
938
+ onBlur?(event: React.FocusEvent): void;
939
+ /** On change callback. */
940
+ onChange(value: string, name?: string, event?: SyntheticEvent): void;
941
+ /** On clear callback. */
942
+ onClear?(event?: SyntheticEvent): void;
943
+ /** On focus callback. */
944
+ onFocus?(event: React.FocusEvent): void;
945
+ }
946
+ /**
947
+ * TextField component.
948
+ *
949
+ * @param props Component props.
950
+ * @param ref Component ref.
951
+ * @return React element.
952
+ */
953
+ declare const TextField: Comp<TextFieldProps, HTMLDivElement>;
954
+
955
+ declare const ARIA_LINK_MODES: readonly ["aria-describedby", "aria-labelledby"];
956
+
957
+ /** Position of the tooltip relative to the anchor element. */
958
+ type TooltipPlacement = Extract<Placement, 'top' | 'right' | 'bottom' | 'left'>;
959
+ /**
960
+ * Defines the props of the component.
961
+ */
962
+ interface TooltipProps extends GenericProps, HasCloseMode {
963
+ /** Anchor (element on which we activate the tooltip). */
964
+ children: ReactNode;
965
+ /** Delay (in ms) before closing the tooltip. */
966
+ delay?: number;
967
+ /** Whether the tooltip is displayed even without the mouse hovering the anchor. */
968
+ forceOpen?: boolean;
969
+ /** Label text. */
970
+ label?: string | null | false;
971
+ /** Placement of the tooltip relative to the anchor. */
972
+ placement?: TooltipPlacement;
973
+ /** Choose how the tooltip text should link to the anchor */
974
+ ariaLinkMode?: (typeof ARIA_LINK_MODES)[number];
975
+ }
976
+ /**
977
+ * Tooltip component.
978
+ *
979
+ * @param props Component props.
980
+ * @param ref Component ref.
981
+ * @return React element.
982
+ */
983
+ declare const Tooltip: Comp<TooltipProps, HTMLDivElement>;
984
+
985
+ export { Alignment as A, Kind as K, ListItem as L, Placement as P, Popover as Q, Size as S, TextField as U, WhiteSpace as W, Tooltip as X, isClickable as _, ColorPalette as a, ColorVariant as m, Typography as n, Orientation as p, AspectRatio as q, TypographyInterface as r, ComboboxListBox as u, ComboboxOptionSkeleton as v, IconButton as w, InputLabel as x };
986
+ export type { ComboboxAction as $, BaseButtonProps as B, Comp as C, ListItemSize as D, Elevation as E, OnComboboxInputChange as F, GlobalSize as G, HasClassName as H, IconButtonProps as I, JSXElement as J, MultipleSelection as M, OnComboboxSelect as N, Offset as O, SingleSelection as R, TextFieldProps as T, VerticalAlignment as V, TooltipPlacement as Y, TooltipProps as Z, ComboboxSelectionType as a0, ComboboxTranslations as a1, BaseLoadingStatus as a2, RegisteredComboboxOption as a3, ComboboxOptionSelectEventSource as a4, CommonRef as b, HasTheme as c, HasAriaDisabled as d, HasDisabled as e, ComboboxOptionProps as f, PopoverProps as g, ComboboxListSkeletonProps as h, ComboboxProps as i, ComboboxOptionSkeletonProps as j, ComboboxListBoxProps as k, ColorWithVariants as l, HorizontalAlignment as o, BaseSelectProps as s, ButtonSize as t, InputLabelProps as y, ListItemProps as z };