@lumx/react 4.3.1-alpha.0 → 4.3.2-alpha.0

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.
package/index.js CHANGED
@@ -1,12 +1,13 @@
1
- import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, Theme as Theme$1, AspectRatio, ColorVariant, DIALOG_TRANSITION_DURATION, Orientation as Orientation$1, Alignment, NOTIFICATION_TRANSITION_DURATION, TOOLTIP_LONG_PRESS_DELAY, TOOLTIP_HOVER_DELAY } from '@lumx/core/js/constants';
1
+ import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, Theme as Theme$1, AspectRatio, ColorVariant, REAL_SIZE_FOR_LUMX_SIZE, DIALOG_TRANSITION_DURATION, Orientation as Orientation$1, Alignment, NOTIFICATION_TRANSITION_DURATION, TOOLTIP_LONG_PRESS_DELAY, TOOLTIP_HOVER_DELAY } from '@lumx/core/js/constants';
2
2
  export * from '@lumx/core/js/constants';
3
3
  export * from '@lumx/core/js/types';
4
4
  import * as React from 'react';
5
- import React__default, { useState, useEffect, useMemo, useRef, useCallback, Children, useLayoutEffect, cloneElement, createContext, isValidElement, useContext, useReducer } from 'react';
5
+ import React__default, { useMemo, useState, useEffect, useRef, useCallback, useContext, createContext, useReducer, Children, useLayoutEffect, cloneElement, isValidElement } from 'react';
6
6
  import { mdiAlert } from '@lumx/icons/esm/alert';
7
7
  import { mdiAlertCircle } from '@lumx/icons/esm/alert-circle';
8
8
  import { mdiCheckCircle } from '@lumx/icons/esm/check-circle';
9
9
  import { mdiInformation } from '@lumx/icons/esm/information';
10
+ import uniqueId from 'lodash/uniqueId';
10
11
  import { classNames, onEnterPressed, onEscapePressed, onButtonPressed, detectHorizontalSwipe } from '@lumx/core/js/utils';
11
12
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
12
13
  import last from 'lodash/last';
@@ -16,7 +17,7 @@ import concat from 'lodash/concat';
16
17
  import dropRight from 'lodash/dropRight';
17
18
  import partition from 'lodash/partition';
18
19
  import reduce from 'lodash/reduce';
19
- import { u as useDisabledStateContext, P as Portal, C as ClickAwayProvider } from './_internal/DpdvhbTO.js';
20
+ import { u as useDisabledStateContext, M as MovingFocusContext, a as useVirtualFocusParent, b as useVirtualFocus, c as MovingFocusProvider, P as Portal, C as ClickAwayProvider } from './_internal/Ui3KfDoH.js';
20
21
  import isEmpty from 'lodash/isEmpty';
21
22
  import { getDisabledState } from '@lumx/core/js/utils/disabledState';
22
23
  import { mdiCloseCircle } from '@lumx/icons/esm/close-circle';
@@ -26,13 +27,15 @@ import isFunction from 'lodash/isFunction';
26
27
  import { mdiImageBroken } from '@lumx/icons/esm/image-broken';
27
28
  import { mdiCheck } from '@lumx/icons/esm/check';
28
29
  import { mdiMinus } from '@lumx/icons/esm/minus';
30
+ import { visuallyHidden, bem as bem$1 } from '@lumx/core/js/utils/classNames';
31
+ import noop from 'lodash/noop';
32
+ import debounce$1 from 'lodash/debounce';
33
+ import { mdiChevronDown } from '@lumx/icons/esm/chevron-down';
34
+ import { mdiChevronUp } from '@lumx/icons/esm/chevron-up';
35
+ import castArray from 'lodash/castArray';
29
36
  import { mdiChevronLeft } from '@lumx/icons/esm/chevron-left';
30
37
  import { mdiChevronRight } from '@lumx/icons/esm/chevron-right';
31
- import castArray from 'lodash/castArray';
32
38
  import { mdiDragVertical } from '@lumx/icons/esm/drag-vertical';
33
- import { mdiChevronDown } from '@lumx/icons/esm/chevron-down';
34
- import { mdiChevronUp } from '@lumx/icons/esm/chevron-up';
35
- import noop from 'lodash/noop';
36
39
  import pick from 'lodash/pick';
37
40
  import isInteger from 'lodash/isInteger';
38
41
  import { mdiMagnifyMinusOutline } from '@lumx/icons/esm/magnify-minus-outline';
@@ -52,19 +55,16 @@ import { mdiArrowDown } from '@lumx/icons/esm/arrow-down';
52
55
  import { mdiArrowUp } from '@lumx/icons/esm/arrow-up';
53
56
  import set from 'lodash/set';
54
57
 
55
- let i = 0;
56
-
57
58
  /**
58
- * Generate a unique id (for use in a11y or other id based DOM linking).
59
+ * Generate a unique and stable id that can then safely be used as html id.
60
+ * This is similar to, but much simpler than, React's `useId` hook.
59
61
  *
60
- * (Tries to emulate React 18 useId hook, to remove once we upgrade React)
62
+ * Once we upgrade to React 18, this hook will be deprecated.
61
63
  */
62
- function useId() {
63
- return React__default.useMemo(() => {
64
- i += 1;
65
- return `:lumx${i}:`;
66
- }, []);
67
- }
64
+ const useId = (prefix = 'lumx') => {
65
+ // A common practice to make sure ids are unique is to surround them with colons.
66
+ return useMemo(() => `:${uniqueId(prefix)}:`, [prefix]);
67
+ };
68
68
 
69
69
  /**
70
70
  * React.forwardRef but re-typed to attach some custom metadata on our components.
@@ -101,15 +101,15 @@ const COMPONENT_NAME$1k = 'AlertDialog';
101
101
  /**
102
102
  * Component default class name and class prefix.
103
103
  */
104
- const CLASSNAME$1j = 'lumx-alert-dialog';
104
+ const CLASSNAME$1m = 'lumx-alert-dialog';
105
105
  const {
106
- block: block$14
107
- } = classNames.bem(CLASSNAME$1j);
106
+ block: block$18
107
+ } = classNames.bem(CLASSNAME$1m);
108
108
 
109
109
  /**
110
110
  * Component default props.
111
111
  */
112
- const DEFAULT_PROPS$18 = {
112
+ const DEFAULT_PROPS$16 = {
113
113
  size: Size$1.tiny,
114
114
  kind: Kind$1.info
115
115
  };
@@ -130,8 +130,8 @@ const AlertDialog = forwardRef((props, ref) => {
130
130
  className,
131
131
  cancelProps,
132
132
  confirmProps,
133
- kind = DEFAULT_PROPS$18.kind,
134
- size = DEFAULT_PROPS$18.size,
133
+ kind = DEFAULT_PROPS$16.kind,
134
+ size = DEFAULT_PROPS$16.size,
135
135
  dialogProps,
136
136
  children,
137
137
  ...forwardedProps
@@ -172,7 +172,7 @@ const AlertDialog = forwardRef((props, ref) => {
172
172
  'aria-describedby': descriptionId,
173
173
  ...dialogProps
174
174
  },
175
- className: classNames.join(className, block$14({
175
+ className: classNames.join(className, block$18({
176
176
  [`kind-${kind}`]: Boolean(kind)
177
177
  })),
178
178
  ...forwardedProps,
@@ -218,8 +218,8 @@ const AlertDialog = forwardRef((props, ref) => {
218
218
  });
219
219
  });
220
220
  AlertDialog.displayName = COMPONENT_NAME$1k;
221
- AlertDialog.className = CLASSNAME$1j;
222
- AlertDialog.defaultProps = DEFAULT_PROPS$18;
221
+ AlertDialog.className = CLASSNAME$1m;
222
+ AlertDialog.defaultProps = DEFAULT_PROPS$16;
223
223
 
224
224
  /**
225
225
  * Hook focusing an element when defined and `focus` boolean `true`.
@@ -316,12 +316,12 @@ const COMPONENT_NAME$1j = 'Autocomplete';
316
316
  /**
317
317
  * Component default class name and class prefix.
318
318
  */
319
- const CLASSNAME$1i = 'lumx-autocomplete';
319
+ const CLASSNAME$1l = 'lumx-autocomplete';
320
320
 
321
321
  /**
322
322
  * Component default props.
323
323
  */
324
- const DEFAULT_PROPS$17 = {
324
+ const DEFAULT_PROPS$15 = {
325
325
  anchorToInput: false,
326
326
  closeOnClick: false,
327
327
  closeOnClickAway: true,
@@ -343,13 +343,13 @@ const Autocomplete = forwardRef((props, ref) => {
343
343
  otherProps
344
344
  } = useDisableStateProps(props);
345
345
  const {
346
- anchorToInput = DEFAULT_PROPS$17.anchorToInput,
346
+ anchorToInput = DEFAULT_PROPS$15.anchorToInput,
347
347
  children,
348
348
  chips,
349
349
  className,
350
- closeOnClick = DEFAULT_PROPS$17.closeOnClick,
351
- closeOnClickAway = DEFAULT_PROPS$17.closeOnClickAway,
352
- closeOnEscape = DEFAULT_PROPS$17.closeOnEscape,
350
+ closeOnClick = DEFAULT_PROPS$15.closeOnClick,
351
+ closeOnClickAway = DEFAULT_PROPS$15.closeOnClickAway,
352
+ closeOnEscape = DEFAULT_PROPS$15.closeOnEscape,
353
353
  error,
354
354
  fitToAnchorWidth,
355
355
  hasError,
@@ -370,7 +370,7 @@ const Autocomplete = forwardRef((props, ref) => {
370
370
  onInfiniteScroll,
371
371
  placeholder,
372
372
  placement,
373
- shouldFocusOnClose = DEFAULT_PROPS$17.shouldFocusOnClose,
373
+ shouldFocusOnClose = DEFAULT_PROPS$15.shouldFocusOnClose,
374
374
  theme = defaultTheme,
375
375
  value,
376
376
  textFieldProps = {},
@@ -383,7 +383,7 @@ const Autocomplete = forwardRef((props, ref) => {
383
383
  return /*#__PURE__*/jsxs("div", {
384
384
  ref: ref,
385
385
  ...forwardedProps,
386
- className: classNames.join(className, CLASSNAME$1i),
386
+ className: classNames.join(className, CLASSNAME$1l),
387
387
  children: [/*#__PURE__*/jsx(TextField, {
388
388
  ...textFieldProps,
389
389
  chips: chips,
@@ -424,8 +424,8 @@ const Autocomplete = forwardRef((props, ref) => {
424
424
  });
425
425
  });
426
426
  Autocomplete.displayName = COMPONENT_NAME$1j;
427
- Autocomplete.className = CLASSNAME$1i;
428
- Autocomplete.defaultProps = DEFAULT_PROPS$17;
427
+ Autocomplete.className = CLASSNAME$1l;
428
+ Autocomplete.defaultProps = DEFAULT_PROPS$15;
429
429
 
430
430
  /**
431
431
  * Component display name.
@@ -435,12 +435,12 @@ const COMPONENT_NAME$1i = 'AutocompleteMultiple';
435
435
  /**
436
436
  * Component default class name and class prefix.
437
437
  */
438
- const CLASSNAME$1h = 'lumx-autocomplete-multiple';
438
+ const CLASSNAME$1k = 'lumx-autocomplete-multiple';
439
439
 
440
440
  /**
441
441
  * Component default props.
442
442
  */
443
- const DEFAULT_PROPS$16 = {
443
+ const DEFAULT_PROPS$14 = {
444
444
  closeOnClickAway: true,
445
445
  closeOnEscape: true,
446
446
  selectedChipRender(choice, index, onClear, isDisabled) {
@@ -480,8 +480,8 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
480
480
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
481
481
  chipsAlignment,
482
482
  className,
483
- closeOnClickAway = DEFAULT_PROPS$16.closeOnClickAway,
484
- closeOnEscape = DEFAULT_PROPS$16.closeOnEscape,
483
+ closeOnClickAway = DEFAULT_PROPS$14.closeOnClickAway,
484
+ closeOnEscape = DEFAULT_PROPS$14.closeOnEscape,
485
485
  fitToAnchorWidth,
486
486
  hasError,
487
487
  helper,
@@ -503,19 +503,19 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
503
503
  onKeyDown,
504
504
  placeholder,
505
505
  placement,
506
- selectedChipRender = DEFAULT_PROPS$16.selectedChipRender,
506
+ selectedChipRender = DEFAULT_PROPS$14.selectedChipRender,
507
507
  shouldFocusOnClose,
508
508
  theme = defaultTheme,
509
509
  type,
510
510
  value,
511
- values = DEFAULT_PROPS$16.values,
511
+ values = DEFAULT_PROPS$14.values,
512
512
  ...forwardedProps
513
513
  } = otherProps;
514
514
  return /*#__PURE__*/jsx(Autocomplete, {
515
515
  ref: ref,
516
516
  ...forwardedProps,
517
517
  anchorToInput: anchorToInput,
518
- className: classNames.join(className, CLASSNAME$1h),
518
+ className: classNames.join(className, CLASSNAME$1k),
519
519
  name: name,
520
520
  value: value,
521
521
  onChange: onChange,
@@ -549,8 +549,8 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
549
549
  });
550
550
  });
551
551
  AutocompleteMultiple.displayName = COMPONENT_NAME$1i;
552
- AutocompleteMultiple.className = CLASSNAME$1h;
553
- AutocompleteMultiple.defaultProps = DEFAULT_PROPS$16;
552
+ AutocompleteMultiple.className = CLASSNAME$1k;
553
+ AutocompleteMultiple.defaultProps = DEFAULT_PROPS$14;
554
554
 
555
555
  /**
556
556
  * Component display name.
@@ -560,16 +560,16 @@ const COMPONENT_NAME$1h = 'Avatar';
560
560
  /**
561
561
  * Component default class name and class prefix.
562
562
  */
563
- const CLASSNAME$1g = 'lumx-avatar';
563
+ const CLASSNAME$1j = 'lumx-avatar';
564
564
  const {
565
- block: block$13,
566
- element: element$N
567
- } = classNames.bem(CLASSNAME$1g);
565
+ block: block$17,
566
+ element: element$R
567
+ } = classNames.bem(CLASSNAME$1j);
568
568
 
569
569
  /**
570
570
  * Component default props.
571
571
  */
572
- const DEFAULT_PROPS$15 = {
572
+ const DEFAULT_PROPS$13 = {
573
573
  size: Size$1.m
574
574
  };
575
575
 
@@ -592,7 +592,7 @@ const Avatar = forwardRef((props, ref) => {
592
592
  linkAs,
593
593
  onClick,
594
594
  onKeyPress,
595
- size = DEFAULT_PROPS$15.size,
595
+ size = DEFAULT_PROPS$13.size,
596
596
  theme = defaultTheme,
597
597
  thumbnailProps,
598
598
  ...forwardedProps
@@ -600,14 +600,14 @@ const Avatar = forwardRef((props, ref) => {
600
600
  return /*#__PURE__*/jsxs("div", {
601
601
  ref: ref,
602
602
  ...forwardedProps,
603
- className: classNames.join(className, block$13({
603
+ className: classNames.join(className, block$17({
604
604
  [`size-${size}`]: Boolean(size),
605
605
  [`theme-${theme}`]: Boolean(theme)
606
606
  })),
607
607
  children: [/*#__PURE__*/jsx(Thumbnail, {
608
608
  linkProps: linkProps,
609
609
  linkAs: linkAs,
610
- className: element$N('thumbnail'),
610
+ className: element$R('thumbnail'),
611
611
  onClick: onClick,
612
612
  onKeyPress: onKeyPress,
613
613
  ...thumbnailProps,
@@ -617,17 +617,17 @@ const Avatar = forwardRef((props, ref) => {
617
617
  alt: alt,
618
618
  theme: theme
619
619
  }), actions && /*#__PURE__*/jsx("div", {
620
- className: element$N('actions'),
620
+ className: element$R('actions'),
621
621
  children: actions
622
622
  }), badge && /*#__PURE__*/jsx("div", {
623
- className: element$N('badge'),
623
+ className: element$R('badge'),
624
624
  children: badge
625
625
  })]
626
626
  });
627
627
  });
628
628
  Avatar.displayName = COMPONENT_NAME$1h;
629
- Avatar.className = CLASSNAME$1g;
630
- Avatar.defaultProps = DEFAULT_PROPS$15;
629
+ Avatar.className = CLASSNAME$1j;
630
+ Avatar.defaultProps = DEFAULT_PROPS$13;
631
631
 
632
632
  /**
633
633
  * Component display name.
@@ -637,15 +637,15 @@ const COMPONENT_NAME$1g = 'Badge';
637
637
  /**
638
638
  * Component default class name and class prefix.
639
639
  */
640
- const CLASSNAME$1f = 'lumx-badge';
640
+ const CLASSNAME$1i = 'lumx-badge';
641
641
  const {
642
- block: block$12
643
- } = classNames.bem(CLASSNAME$1f);
642
+ block: block$16
643
+ } = classNames.bem(CLASSNAME$1i);
644
644
 
645
645
  /**
646
646
  * Component default props.
647
647
  */
648
- const DEFAULT_PROPS$14 = {
648
+ const DEFAULT_PROPS$12 = {
649
649
  color: ColorPalette$1.primary
650
650
  };
651
651
 
@@ -660,30 +660,30 @@ const Badge = forwardRef((props, ref) => {
660
660
  const {
661
661
  children,
662
662
  className,
663
- color = DEFAULT_PROPS$14.color,
663
+ color = DEFAULT_PROPS$12.color,
664
664
  ...forwardedProps
665
665
  } = props;
666
666
  return /*#__PURE__*/jsx("div", {
667
667
  ref: ref,
668
668
  ...forwardedProps,
669
- className: classNames.join(className, block$12({
669
+ className: classNames.join(className, block$16({
670
670
  [`color-${color}`]: Boolean(color)
671
671
  })),
672
672
  children: children
673
673
  });
674
674
  });
675
675
  Badge.displayName = COMPONENT_NAME$1g;
676
- Badge.className = CLASSNAME$1f;
677
- Badge.defaultProps = DEFAULT_PROPS$14;
676
+ Badge.className = CLASSNAME$1i;
677
+ Badge.defaultProps = DEFAULT_PROPS$12;
678
678
 
679
679
  /**
680
680
  * Component default class name and class prefix.
681
681
  */
682
- const CLASSNAME$1e = 'lumx-badge-wrapper';
682
+ const CLASSNAME$1h = 'lumx-badge-wrapper';
683
683
  const {
684
- block: block$11,
685
- element: element$M
686
- } = classNames.bem(CLASSNAME$1e);
684
+ block: block$15,
685
+ element: element$Q
686
+ } = classNames.bem(CLASSNAME$1h);
687
687
  const BadgeWrapper = forwardRef((props, ref) => {
688
688
  const {
689
689
  badge,
@@ -694,15 +694,15 @@ const BadgeWrapper = forwardRef((props, ref) => {
694
694
  return /*#__PURE__*/jsxs("div", {
695
695
  ref: ref,
696
696
  ...forwardedProps,
697
- className: classNames.join(className, block$11()),
697
+ className: classNames.join(className, block$15()),
698
698
  children: [children, badge && /*#__PURE__*/jsx("div", {
699
- className: element$M('badge'),
699
+ className: element$Q('badge'),
700
700
  children: badge
701
701
  })]
702
702
  });
703
703
  });
704
704
  BadgeWrapper.displayName = 'BadgeWrapper';
705
- BadgeWrapper.className = CLASSNAME$1e;
705
+ BadgeWrapper.className = CLASSNAME$1h;
706
706
 
707
707
  /**
708
708
  * Alignments.
@@ -764,8 +764,6 @@ const ColorPalette = {
764
764
  red: 'red',
765
765
  light: 'light'};
766
766
 
767
- /** ColorPalette with all possible color variant combination */
768
-
769
767
  function getDefaultExportFromCjs (x) {
770
768
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
771
769
  }
@@ -926,7 +924,7 @@ function modifier$1(baseName, modifiers) {
926
924
  * block('button', { active: true, disabled: false }); // 'button button--active'
927
925
  */
928
926
 
929
- function block$10(baseName, modifiersOrAdditionalClasses, additionalClasses) {
927
+ function block$14(baseName, modifiersOrAdditionalClasses, additionalClasses) {
930
928
  let modifiers;
931
929
  let classes;
932
930
  if (Array.isArray(modifiersOrAdditionalClasses)) {
@@ -961,11 +959,11 @@ function block$10(baseName, modifiersOrAdditionalClasses, additionalClasses) {
961
959
  * element('my-button', 'icon', { active: true }); // 'my-button__icon my-button__icon--active'
962
960
  */
963
961
 
964
- function element$L(baseClass, elem, modifiersOrAdditionalClasses, additionalClasses) {
962
+ function element$P(baseClass, elem, modifiersOrAdditionalClasses, additionalClasses) {
965
963
  if (Array.isArray(modifiersOrAdditionalClasses)) {
966
- return block$10(`${baseClass}__${elem}`, modifiersOrAdditionalClasses);
964
+ return block$14(`${baseClass}__${elem}`, modifiersOrAdditionalClasses);
967
965
  }
968
- return block$10(`${baseClass}__${elem}`, modifiersOrAdditionalClasses, additionalClasses);
966
+ return block$14(`${baseClass}__${elem}`, modifiersOrAdditionalClasses, additionalClasses);
969
967
  }
970
968
 
971
969
  /**
@@ -974,15 +972,15 @@ function element$L(baseClass, elem, modifiersOrAdditionalClasses, additionalClas
974
972
  function bem(baseName) {
975
973
  function blockFn(modifiersOrAdditionalClasses, additionalClasses) {
976
974
  if (Array.isArray(modifiersOrAdditionalClasses)) {
977
- return block$10(baseName, modifiersOrAdditionalClasses);
975
+ return block$14(baseName, modifiersOrAdditionalClasses);
978
976
  }
979
- return block$10(baseName, modifiersOrAdditionalClasses, additionalClasses);
977
+ return block$14(baseName, modifiersOrAdditionalClasses, additionalClasses);
980
978
  }
981
979
  function elementFn(elem, modifiersOrAdditionalClasses, additionalClasses) {
982
980
  if (Array.isArray(modifiersOrAdditionalClasses)) {
983
- return element$L(baseName, elem, modifiersOrAdditionalClasses);
981
+ return element$P(baseName, elem, modifiersOrAdditionalClasses);
984
982
  }
985
- return element$L(baseName, elem, modifiersOrAdditionalClasses, additionalClasses);
983
+ return element$P(baseName, elem, modifiersOrAdditionalClasses, additionalClasses);
986
984
  }
987
985
  return {
988
986
  block: blockFn,
@@ -1150,15 +1148,15 @@ const COMPONENT_NAME$1e = 'Button';
1150
1148
  /**
1151
1149
  * Component default class name and class prefix.
1152
1150
  */
1153
- const CLASSNAME$1d = 'lumx-button';
1151
+ const CLASSNAME$1g = 'lumx-button';
1154
1152
  const {
1155
1153
  modifier
1156
- } = bem(CLASSNAME$1d);
1154
+ } = bem(CLASSNAME$1g);
1157
1155
 
1158
1156
  /**
1159
1157
  * Component default props.
1160
1158
  */
1161
- const DEFAULT_PROPS$13 = {
1159
+ const DEFAULT_PROPS$11 = {
1162
1160
  emphasis: Emphasis.high,
1163
1161
  size: Size.m
1164
1162
  };
@@ -1172,10 +1170,10 @@ const DEFAULT_PROPS$13 = {
1172
1170
  const Button$1 = props => {
1173
1171
  const {
1174
1172
  className,
1175
- emphasis = DEFAULT_PROPS$13.emphasis,
1173
+ emphasis = DEFAULT_PROPS$11.emphasis,
1176
1174
  leftIcon,
1177
1175
  rightIcon,
1178
- size = DEFAULT_PROPS$13.size,
1176
+ size = DEFAULT_PROPS$11.size,
1179
1177
  ...forwardedProps
1180
1178
  } = props;
1181
1179
  const buttonClassName = classnames(className, modifier({
@@ -1191,8 +1189,8 @@ const Button$1 = props => {
1191
1189
  });
1192
1190
  };
1193
1191
  Button$1.displayName = COMPONENT_NAME$1e;
1194
- Button$1.className = CLASSNAME$1d;
1195
- Button$1.defaultProps = DEFAULT_PROPS$13;
1192
+ Button$1.className = CLASSNAME$1g;
1193
+ Button$1.defaultProps = DEFAULT_PROPS$11;
1196
1194
 
1197
1195
  /**
1198
1196
  * Properties of a component to use to determine it's name.
@@ -1259,8 +1257,8 @@ const Button = forwardRef((props, ref) => {
1259
1257
  });
1260
1258
  });
1261
1259
  Button.displayName = COMPONENT_NAME$1e;
1262
- Button.className = CLASSNAME$1d;
1263
- Button.defaultProps = DEFAULT_PROPS$13;
1260
+ Button.className = CLASSNAME$1g;
1261
+ Button.defaultProps = DEFAULT_PROPS$11;
1264
1262
 
1265
1263
  const COMPONENT_NAME$1d = 'Icon';
1266
1264
  const IconClassName = 'lumx-icon';
@@ -1269,15 +1267,15 @@ const IconClassName = 'lumx-icon';
1269
1267
  * Defines the props of the component.
1270
1268
  */
1271
1269
 
1272
- const CLASSNAME$1c = IconClassName;
1270
+ const CLASSNAME$1f = IconClassName;
1273
1271
  const {
1274
- block: block$$
1275
- } = bem(CLASSNAME$1c);
1272
+ block: block$13
1273
+ } = bem(CLASSNAME$1f);
1276
1274
 
1277
1275
  /**
1278
1276
  * Component default props.
1279
1277
  */
1280
- const DEFAULT_PROPS$12 = {};
1278
+ const DEFAULT_PROPS$10 = {};
1281
1279
 
1282
1280
  /**
1283
1281
  * Icon component.
@@ -1326,7 +1324,7 @@ const Icon$1 = props => {
1326
1324
  return /*#__PURE__*/jsx("i", {
1327
1325
  ref: ref,
1328
1326
  ...forwardedProps,
1329
- className: classnames(className, block$$({
1327
+ className: classnames(className, block$13({
1330
1328
  [`color-${iconColor}`]: Boolean(iconColor),
1331
1329
  [`color-variant-${iconColorVariant}`]: Boolean(iconColorVariant),
1332
1330
  'has-shape': hasShape,
@@ -1356,8 +1354,8 @@ const Icon$1 = props => {
1356
1354
  });
1357
1355
  };
1358
1356
  Icon$1.displayName = COMPONENT_NAME$1d;
1359
- Icon$1.className = CLASSNAME$1c;
1360
- Icon$1.defaultProps = DEFAULT_PROPS$12;
1357
+ Icon$1.className = CLASSNAME$1f;
1358
+ Icon$1.defaultProps = DEFAULT_PROPS$10;
1361
1359
 
1362
1360
  /**
1363
1361
  * Component display name.
@@ -1367,12 +1365,12 @@ const COMPONENT_NAME$1c = 'IconButton';
1367
1365
  /**
1368
1366
  * Component default class name and class prefix.
1369
1367
  */
1370
- const CLASSNAME$1b = 'lumx-icon-button';
1368
+ const CLASSNAME$1e = 'lumx-icon-button';
1371
1369
 
1372
1370
  /**
1373
1371
  * Component default props.
1374
1372
  */
1375
- const DEFAULT_PROPS$11 = {
1373
+ const DEFAULT_PROPS$$ = {
1376
1374
  emphasis: Emphasis.high,
1377
1375
  size: Size.m
1378
1376
  };
@@ -1385,11 +1383,11 @@ const DEFAULT_PROPS$11 = {
1385
1383
  */
1386
1384
  const IconButton$1 = props => {
1387
1385
  const {
1388
- emphasis = DEFAULT_PROPS$11.emphasis,
1386
+ emphasis = DEFAULT_PROPS$$.emphasis,
1389
1387
  image,
1390
1388
  icon,
1391
1389
  label,
1392
- size = DEFAULT_PROPS$11.size,
1390
+ size = DEFAULT_PROPS$$.size,
1393
1391
  ...forwardedProps
1394
1392
  } = props;
1395
1393
  const defaultChildren = image ? /*#__PURE__*/jsx("img", {
@@ -1409,8 +1407,8 @@ const IconButton$1 = props => {
1409
1407
  });
1410
1408
  };
1411
1409
  IconButton$1.displayName = COMPONENT_NAME$1c;
1412
- IconButton$1.className = CLASSNAME$1b;
1413
- IconButton$1.defaultProps = DEFAULT_PROPS$11;
1410
+ IconButton$1.className = CLASSNAME$1e;
1411
+ IconButton$1.defaultProps = DEFAULT_PROPS$$;
1414
1412
 
1415
1413
  /**
1416
1414
  * IconButton component.
@@ -1446,8 +1444,8 @@ const IconButton = forwardRef((props, ref) => {
1446
1444
  });
1447
1445
  });
1448
1446
  IconButton.displayName = COMPONENT_NAME$1c;
1449
- IconButton.className = CLASSNAME$1b;
1450
- IconButton.defaultProps = DEFAULT_PROPS$11;
1447
+ IconButton.className = CLASSNAME$1e;
1448
+ IconButton.defaultProps = DEFAULT_PROPS$$;
1451
1449
 
1452
1450
  /**
1453
1451
  * Component display name.
@@ -1457,12 +1455,12 @@ const COMPONENT_NAME$1b = 'ButtonGroup';
1457
1455
  /**
1458
1456
  * Component default class name and class prefix.
1459
1457
  */
1460
- const CLASSNAME$1a = 'lumx-button-group';
1458
+ const CLASSNAME$1d = 'lumx-button-group';
1461
1459
 
1462
1460
  /**
1463
1461
  * Component default props.
1464
1462
  */
1465
- const DEFAULT_PROPS$10 = {};
1463
+ const DEFAULT_PROPS$_ = {};
1466
1464
 
1467
1465
  /**
1468
1466
  * ButtonGroup component.
@@ -1478,13 +1476,13 @@ const ButtonGroup$1 = props => {
1478
1476
  } = props;
1479
1477
  return /*#__PURE__*/jsx("div", {
1480
1478
  ...forwardedProps,
1481
- className: classnames(className, CLASSNAME$1a),
1479
+ className: classnames(className, CLASSNAME$1d),
1482
1480
  children: children
1483
1481
  });
1484
1482
  };
1485
1483
  ButtonGroup$1.displayName = COMPONENT_NAME$1b;
1486
- ButtonGroup$1.className = CLASSNAME$1a;
1487
- ButtonGroup$1.defaultProps = DEFAULT_PROPS$10;
1484
+ ButtonGroup$1.className = CLASSNAME$1d;
1485
+ ButtonGroup$1.defaultProps = DEFAULT_PROPS$_;
1488
1486
 
1489
1487
  /**
1490
1488
  * ButtonGroup component.
@@ -1500,16 +1498,16 @@ const ButtonGroup = forwardRef((props, ref) => {
1500
1498
  });
1501
1499
  });
1502
1500
  ButtonGroup.displayName = COMPONENT_NAME$1b;
1503
- ButtonGroup.className = CLASSNAME$1a;
1504
- ButtonGroup.defaultProps = DEFAULT_PROPS$10;
1501
+ ButtonGroup.className = CLASSNAME$1d;
1502
+ ButtonGroup.defaultProps = DEFAULT_PROPS$_;
1505
1503
 
1506
1504
  const COMPONENT_NAME$1a = 'InputLabel';
1507
1505
  const InputLabelClassName = 'lumx-input-label';
1508
- const CLASSNAME$19 = InputLabelClassName;
1506
+ const CLASSNAME$1c = InputLabelClassName;
1509
1507
  const {
1510
- block: block$_
1511
- } = bem(CLASSNAME$19);
1512
- const DEFAULT_PROPS$$ = {};
1508
+ block: block$12
1509
+ } = bem(CLASSNAME$1c);
1510
+ const DEFAULT_PROPS$Z = {};
1513
1511
 
1514
1512
  /**
1515
1513
  * InputLabel component.
@@ -1529,7 +1527,7 @@ function InputLabel$1(props) {
1529
1527
  ref: ref,
1530
1528
  ...forwardedProps,
1531
1529
  htmlFor: htmlFor,
1532
- className: classnames(className, block$_({
1530
+ className: classnames(className, block$12({
1533
1531
  'is-required': isRequired,
1534
1532
  [`theme-${theme}`]: Boolean(theme),
1535
1533
  'has-custom-typography': Boolean(typography$1)
@@ -1538,8 +1536,8 @@ function InputLabel$1(props) {
1538
1536
  });
1539
1537
  }
1540
1538
  InputLabel$1.displayName = COMPONENT_NAME$1a;
1541
- InputLabel$1.className = CLASSNAME$19;
1542
- InputLabel$1.defaultProps = DEFAULT_PROPS$$;
1539
+ InputLabel$1.className = CLASSNAME$1c;
1540
+ InputLabel$1.defaultProps = DEFAULT_PROPS$Z;
1543
1541
 
1544
1542
  const INPUT_HELPER_CONFIGURATION = {
1545
1543
  [Kind.error]: {
@@ -1560,15 +1558,15 @@ const InputHelperClassName = 'lumx-input-helper';
1560
1558
  * Defines the props of the component.
1561
1559
  */
1562
1560
 
1563
- const CLASSNAME$18 = InputHelperClassName;
1561
+ const CLASSNAME$1b = InputHelperClassName;
1564
1562
  const {
1565
- block: block$Z
1566
- } = bem(CLASSNAME$18);
1563
+ block: block$11
1564
+ } = bem(CLASSNAME$1b);
1567
1565
 
1568
1566
  /**
1569
1567
  * Component default props.
1570
1568
  */
1571
- const DEFAULT_PROPS$_ = {
1569
+ const DEFAULT_PROPS$Y = {
1572
1570
  kind: Kind.info
1573
1571
  };
1574
1572
 
@@ -1579,7 +1577,7 @@ function InputHelper$1(props) {
1579
1577
  const {
1580
1578
  children,
1581
1579
  className,
1582
- kind = DEFAULT_PROPS$_.kind,
1580
+ kind = DEFAULT_PROPS$Y.kind,
1583
1581
  theme,
1584
1582
  ref,
1585
1583
  ...forwardedProps
@@ -1590,7 +1588,7 @@ function InputHelper$1(props) {
1590
1588
  return /*#__PURE__*/jsx("p", {
1591
1589
  ref: ref,
1592
1590
  ...forwardedProps,
1593
- className: classnames(className, block$Z({
1591
+ className: classnames(className, block$11({
1594
1592
  [`color-${color}`]: Boolean(color),
1595
1593
  [`theme-${theme}`]: Boolean(theme)
1596
1594
  })),
@@ -1598,8 +1596,8 @@ function InputHelper$1(props) {
1598
1596
  });
1599
1597
  }
1600
1598
  InputHelper$1.displayName = COMPONENT_NAME$19;
1601
- InputHelper$1.className = CLASSNAME$18;
1602
- InputHelper$1.defaultProps = DEFAULT_PROPS$_;
1599
+ InputHelper$1.className = CLASSNAME$1b;
1600
+ InputHelper$1.defaultProps = DEFAULT_PROPS$Y;
1603
1601
 
1604
1602
  const INTERMEDIATE_STATE = 'intermediate';
1605
1603
 
@@ -1615,11 +1613,11 @@ const COMPONENT_NAME$18 = 'Checkbox';
1615
1613
  /**
1616
1614
  * Component default class name and class prefix.
1617
1615
  */
1618
- const CLASSNAME$17 = 'lumx-checkbox';
1616
+ const CLASSNAME$1a = 'lumx-checkbox';
1619
1617
  const {
1620
- block: block$Y,
1621
- element: element$K
1622
- } = bem(CLASSNAME$17);
1618
+ block: block$10,
1619
+ element: element$O
1620
+ } = bem(CLASSNAME$1a);
1623
1621
 
1624
1622
  /**
1625
1623
  * Checkbox component.
@@ -1655,7 +1653,7 @@ const Checkbox$1 = props => {
1655
1653
  return /*#__PURE__*/jsxs("div", {
1656
1654
  ref: ref,
1657
1655
  ...forwardedProps,
1658
- className: classnames(className, block$Y({
1656
+ className: classnames(className, block$10({
1659
1657
  // Whether state is intermediate class name will "-checked"
1660
1658
  'is-checked': intermediateState ? true : isChecked,
1661
1659
  'is-disabled': isDisabled,
@@ -1663,12 +1661,12 @@ const Checkbox$1 = props => {
1663
1661
  [`theme-${theme}`]: Boolean(theme)
1664
1662
  })),
1665
1663
  children: [/*#__PURE__*/jsxs("div", {
1666
- className: element$K('input-wrapper'),
1664
+ className: element$O('input-wrapper'),
1667
1665
  children: [/*#__PURE__*/jsx("input", {
1668
1666
  ref: inputRef,
1669
1667
  type: "checkbox",
1670
1668
  id: inputId,
1671
- className: element$K('input-native'),
1669
+ className: element$O('input-native'),
1672
1670
  name: name,
1673
1671
  value: value,
1674
1672
  checked: isChecked,
@@ -1680,26 +1678,26 @@ const Checkbox$1 = props => {
1680
1678
  } : {}),
1681
1679
  ...inputProps
1682
1680
  }), /*#__PURE__*/jsxs("div", {
1683
- className: element$K('input-placeholder'),
1681
+ className: element$O('input-placeholder'),
1684
1682
  children: [/*#__PURE__*/jsx("div", {
1685
- className: element$K('input-background')
1683
+ className: element$O('input-background')
1686
1684
  }), /*#__PURE__*/jsx("div", {
1687
- className: element$K('input-indicator'),
1685
+ className: element$O('input-indicator'),
1688
1686
  children: Icon$1({
1689
1687
  icon: intermediateState ? mdiMinus : mdiCheck
1690
1688
  })
1691
1689
  })]
1692
1690
  })]
1693
1691
  }), /*#__PURE__*/jsxs("div", {
1694
- className: element$K('content'),
1692
+ className: element$O('content'),
1695
1693
  children: [label && InputLabel$1({
1696
1694
  htmlFor: inputId,
1697
- className: element$K('label'),
1695
+ className: element$O('label'),
1698
1696
  theme,
1699
1697
  children: label
1700
1698
  }), helper && InputHelper$1({
1701
1699
  id: `${inputId}-helper`,
1702
- className: element$K('helper'),
1700
+ className: element$O('helper'),
1703
1701
  theme,
1704
1702
  children: helper
1705
1703
  })]
@@ -1714,7 +1712,7 @@ const Checkbox$1 = props => {
1714
1712
  /**
1715
1713
  * Component default props.
1716
1714
  */
1717
- const DEFAULT_PROPS$Z = {};
1715
+ const DEFAULT_PROPS$X = {};
1718
1716
 
1719
1717
  /**
1720
1718
  * Checkbox component.
@@ -1775,8 +1773,8 @@ const Checkbox = forwardRef((props, ref) => {
1775
1773
  });
1776
1774
  });
1777
1775
  Checkbox.displayName = COMPONENT_NAME$18;
1778
- Checkbox.className = CLASSNAME$17;
1779
- Checkbox.defaultProps = DEFAULT_PROPS$Z;
1776
+ Checkbox.className = CLASSNAME$1a;
1777
+ Checkbox.defaultProps = DEFAULT_PROPS$X;
1780
1778
 
1781
1779
  /**
1782
1780
  * Wrap mouse event handler to stop event propagation.
@@ -1802,16 +1800,16 @@ const COMPONENT_NAME$17 = 'Chip';
1802
1800
  /**
1803
1801
  * Component default class name and class prefix.
1804
1802
  */
1805
- const CLASSNAME$16 = 'lumx-chip';
1803
+ const CLASSNAME$19 = 'lumx-chip';
1806
1804
  const {
1807
- block: block$X,
1808
- element: element$J
1809
- } = classNames.bem(CLASSNAME$16);
1805
+ block: block$$,
1806
+ element: element$N
1807
+ } = classNames.bem(CLASSNAME$19);
1810
1808
 
1811
1809
  /**
1812
1810
  * Component default props.
1813
1811
  */
1814
- const DEFAULT_PROPS$Y = {
1812
+ const DEFAULT_PROPS$W = {
1815
1813
  size: Size$1.m
1816
1814
  };
1817
1815
 
@@ -1841,7 +1839,7 @@ const Chip = forwardRef((props, ref) => {
1841
1839
  onAfterClick,
1842
1840
  onBeforeClick,
1843
1841
  onClick,
1844
- size = DEFAULT_PROPS$Y.size,
1842
+ size = DEFAULT_PROPS$W.size,
1845
1843
  theme = defaultTheme,
1846
1844
  href,
1847
1845
  onKeyDown,
@@ -1872,7 +1870,7 @@ const Chip = forwardRef((props, ref) => {
1872
1870
  ...forwardedProps,
1873
1871
  href: !disabledStateProps.disabled ? href : undefined,
1874
1872
  ref: ref,
1875
- className: classNames.join(className, block$X({
1873
+ className: classNames.join(className, block$$({
1876
1874
  'is-clickable': isClickable,
1877
1875
  [`color-${chipColor}`]: Boolean(chipColor),
1878
1876
  'is-disabled': isAnyDisabled,
@@ -1890,19 +1888,19 @@ const Chip = forwardRef((props, ref) => {
1890
1888
  /*#__PURE__*/
1891
1889
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
1892
1890
  jsx("div", {
1893
- className: element$J('before', {
1891
+ className: element$N('before', {
1894
1892
  'is-clickable': hasBeforeClick
1895
1893
  }),
1896
1894
  onClick: handleOnBeforeClick,
1897
1895
  children: before
1898
1896
  }), /*#__PURE__*/jsx("div", {
1899
- className: element$J('label'),
1897
+ className: element$N('label'),
1900
1898
  children: children
1901
1899
  }), after &&
1902
1900
  /*#__PURE__*/
1903
1901
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
1904
1902
  jsx("div", {
1905
- className: element$J('after', {
1903
+ className: element$N('after', {
1906
1904
  'is-clickable': hasAfterClick
1907
1905
  }),
1908
1906
  onClick: handleOnAfterClick,
@@ -1912,8 +1910,8 @@ const Chip = forwardRef((props, ref) => {
1912
1910
  );
1913
1911
  });
1914
1912
  Chip.displayName = COMPONENT_NAME$17;
1915
- Chip.className = CLASSNAME$16;
1916
- Chip.defaultProps = DEFAULT_PROPS$Y;
1913
+ Chip.className = CLASSNAME$19;
1914
+ Chip.defaultProps = DEFAULT_PROPS$W;
1917
1915
 
1918
1916
  const INITIAL_STATE_ACTIVE_CHIP = -1;
1919
1917
 
@@ -1969,7 +1967,7 @@ const useChipGroupNavigation = (chips, onChipDeleted, initialActiveChip = INITIA
1969
1967
  /**
1970
1968
  * Component default props.
1971
1969
  */
1972
- const DEFAULT_PROPS$X = {};
1970
+ const DEFAULT_PROPS$V = {};
1973
1971
 
1974
1972
  /**
1975
1973
  * Component display name.
@@ -1979,7 +1977,7 @@ const COMPONENT_NAME$16 = 'ChipGroup';
1979
1977
  /**
1980
1978
  * Component default class name and class prefix.
1981
1979
  */
1982
- const CLASSNAME$15 = 'lumx-chip-group';
1980
+ const CLASSNAME$18 = 'lumx-chip-group';
1983
1981
 
1984
1982
  /**
1985
1983
  * ChipGroup component.
@@ -1998,13 +1996,13 @@ const InternalChipGroup = forwardRef((props, ref) => {
1998
1996
  return /*#__PURE__*/jsx("div", {
1999
1997
  ref: ref,
2000
1998
  ...forwardedProps,
2001
- className: classNames.join(className, CLASSNAME$15),
1999
+ className: classNames.join(className, CLASSNAME$18),
2002
2000
  children: children
2003
2001
  });
2004
2002
  });
2005
2003
  InternalChipGroup.displayName = COMPONENT_NAME$16;
2006
- InternalChipGroup.className = CLASSNAME$15;
2007
- InternalChipGroup.defaultProps = DEFAULT_PROPS$X;
2004
+ InternalChipGroup.className = CLASSNAME$18;
2005
+ InternalChipGroup.defaultProps = DEFAULT_PROPS$V;
2008
2006
  const ChipGroup = Object.assign(InternalChipGroup, {
2009
2007
  useChipGroupNavigation
2010
2008
  });
@@ -2069,124 +2067,1645 @@ function useFocusLastChipOnBackspace(chipRefs, inputRef) {
2069
2067
  return;
2070
2068
  }
2071
2069
 
2072
- // Prevent default backspace behavior and event bubbling
2073
- evt.stopPropagation();
2074
- evt.preventDefault();
2070
+ // Prevent default backspace behavior and event bubbling
2071
+ evt.stopPropagation();
2072
+ evt.preventDefault();
2073
+
2074
+ // Focus the last enabled chip (if any exists)
2075
+ const lastChip = findPreviousEnabledChip();
2076
+ lastChip?.focus();
2077
+ };
2078
+
2079
+ // Attach keyboard event listener
2080
+ input.addEventListener('keydown', onKeyDown);
2081
+
2082
+ // Cleanup listener on unmount
2083
+ return () => {
2084
+ input.removeEventListener('keydown', onKeyDown);
2085
+ };
2086
+ }, [inputRef, findPreviousEnabledChip]);
2087
+ return {
2088
+ findPreviousEnabledChip
2089
+ };
2090
+ }
2091
+
2092
+ /**
2093
+ * Component default class name and class prefix.
2094
+ */
2095
+ const CLASSNAME$17 = 'lumx-selection-chip-group';
2096
+ const {
2097
+ block: block$_,
2098
+ element: element$M
2099
+ } = classNames.bem(CLASSNAME$17);
2100
+
2101
+ /**
2102
+ * SelectionChipGroup component.
2103
+ *
2104
+ * @param props Component props.
2105
+ * @param ref Component ref.
2106
+ * @return React element.
2107
+ */
2108
+ const SelectionChipGroup = ({
2109
+ onChange,
2110
+ value,
2111
+ getOptionId,
2112
+ getOptionName,
2113
+ inputRef,
2114
+ inputLabel,
2115
+ renderChip,
2116
+ theme,
2117
+ isDisabled,
2118
+ chipTooltipLabel,
2119
+ label,
2120
+ ...forwardedProps
2121
+ }) => {
2122
+ const chipRefs = React__default.useRef([]);
2123
+ const {
2124
+ findPreviousEnabledChip
2125
+ } = useFocusLastChipOnBackspace(chipRefs, inputRef);
2126
+ return /*#__PURE__*/jsx(ChipGroup, {
2127
+ role: "group",
2128
+ "aria-label": label,
2129
+ className: block$_(),
2130
+ ...forwardedProps,
2131
+ children: value?.map((v, index) => {
2132
+ const name = getWithSelector(getOptionName, v);
2133
+ const id = getWithSelector(getOptionId, v);
2134
+ const onClick = () => {
2135
+ const newValue = [...value];
2136
+ const existingIndex = value.findIndex(vi => getWithSelector(getOptionId, vi) === id);
2137
+ if (existingIndex === -1) {
2138
+ return;
2139
+ }
2140
+ // Remove value
2141
+ newValue.splice(existingIndex, 1);
2142
+ onChange?.(newValue);
2143
+ };
2144
+ const onKeyDown = evt => {
2145
+ if (evt.key !== 'Backspace') {
2146
+ return;
2147
+ }
2148
+ // Activate (remove value) on Backspace pressed
2149
+ onClick();
2150
+ const previousChip = findPreviousEnabledChip(index - 1);
2151
+ const input = inputRef?.current;
2152
+ // Focus the previous chip or the input
2153
+ (previousChip || input)?.focus();
2154
+ };
2155
+ if (!chipRefs.current[index]) {
2156
+ chipRefs.current[index] = /*#__PURE__*/React__default.createRef();
2157
+ }
2158
+ const ref = chipRefs.current[index];
2159
+ const customChip = renderChip?.(v);
2160
+ const props = isComponentType(Chip)(customChip) ? customChip.props : undefined;
2161
+ const chipIsDisabled = props?.isDisabled || isDisabled;
2162
+ const chipName = typeof props?.children === 'string' ? props.children : name;
2163
+ const tooltipLabel = chipTooltipLabel(chipName);
2164
+ return /*#__PURE__*/jsx(Tooltip, {
2165
+ label: !chipIsDisabled ? tooltipLabel : undefined,
2166
+ closeMode: "hide",
2167
+ ariaLinkMode: "aria-labelledby",
2168
+ children: /*#__PURE__*/jsx(Chip, {
2169
+ ...props,
2170
+ after: /*#__PURE__*/jsx(Icon, {
2171
+ icon: mdiClose
2172
+ }),
2173
+ className: element$M('chip', [props?.className]),
2174
+ size: "s",
2175
+ ref: ref,
2176
+ onClick: onClick,
2177
+ onKeyDown: onKeyDown,
2178
+ theme: theme,
2179
+ isDisabled: chipIsDisabled,
2180
+ tabIndex: chipIsDisabled ? -1 : 0,
2181
+ children: props?.children || name
2182
+ })
2183
+ }, id);
2184
+ })
2185
+ });
2186
+ };
2187
+
2188
+ /** Context to store the refs of the combobox elements */
2189
+ const ComboboxRefsContext = /*#__PURE__*/createContext({
2190
+ triggerRef: {
2191
+ current: null
2192
+ },
2193
+ anchorRef: {
2194
+ current: null
2195
+ }
2196
+ });
2197
+ /** Provider to store the required refs for the Combobox */
2198
+ const ComboboxRefsProvider = ({
2199
+ triggerRef,
2200
+ anchorRef,
2201
+ children
2202
+ }) => {
2203
+ const value = useMemo(() => ({
2204
+ triggerRef,
2205
+ anchorRef
2206
+ }), [triggerRef, anchorRef]);
2207
+ return /*#__PURE__*/jsx(ComboboxRefsContext.Provider, {
2208
+ value: value,
2209
+ children: children
2210
+ });
2211
+ };
2212
+
2213
+ /** Retrieves the combobox elements references from context */
2214
+ const useComboboxRefs = () => {
2215
+ const refs = useContext(ComboboxRefsContext);
2216
+ if (!refs) {
2217
+ throw new Error('The useComboboxRefs hook must be called within a ComboboxRefsProvider');
2218
+ }
2219
+ return refs;
2220
+ };
2221
+
2222
+ /** Generate the combobox option id from the combobox id and the given id */
2223
+ const generateOptionId = (comboboxId, optionId) => `${comboboxId}-option-${optionId}`;
2224
+
2225
+ /** Verifies that the combobox registered option is an action */
2226
+ const isComboboxAction = option => Boolean(option?.isAction);
2227
+
2228
+ /** Verifies that the combobox registered option is the option's value */
2229
+ const isComboboxValue = option => {
2230
+ return !isComboboxAction(option);
2231
+ };
2232
+
2233
+ const comboboxId = `combobox-${uniqueId()}`;
2234
+ const initialState = {
2235
+ comboboxId,
2236
+ listboxId: `${comboboxId}-popover`,
2237
+ status: 'idle',
2238
+ isOpen: false,
2239
+ inputValue: '',
2240
+ showAll: true,
2241
+ options: {},
2242
+ type: 'listbox',
2243
+ optionsLength: 0
2244
+ };
2245
+
2246
+ /** Actions when the combobox opens. */
2247
+ const OPEN_COMBOBOX = (state, action) => {
2248
+ const {
2249
+ manual
2250
+ } = action.payload || {};
2251
+ // If the combobox was manually opened, show all suggestions
2252
+ return {
2253
+ ...state,
2254
+ showAll: Boolean(manual),
2255
+ isOpen: true
2256
+ };
2257
+ };
2258
+
2259
+ /** Actions when the combobox closes */
2260
+ const CLOSE_COMBOBOX = state => {
2261
+ return {
2262
+ ...state,
2263
+ showAll: true,
2264
+ isOpen: false
2265
+ };
2266
+ };
2267
+
2268
+ /** Actions on input update. */
2269
+ const SET_INPUT_VALUE = (state, action) => {
2270
+ return {
2271
+ ...state,
2272
+ inputValue: action.payload,
2273
+ // When the user is changing the value, show only values that are related to the input value.
2274
+ showAll: false,
2275
+ isOpen: true
2276
+ };
2277
+ };
2278
+
2279
+ /** Register an option to the state */
2280
+ const ADD_OPTION = (state, action) => {
2281
+ const {
2282
+ id,
2283
+ option
2284
+ } = action.payload;
2285
+ const {
2286
+ options
2287
+ } = state;
2288
+ if (options[id]) {
2289
+ // Option already exists, return state unchanged
2290
+ return state;
2291
+ }
2292
+ const newOptions = {
2293
+ ...options,
2294
+ [id]: option
2295
+ };
2296
+ let newType = state.type;
2297
+ if (isComboboxAction(option)) {
2298
+ newType = 'grid';
2299
+ }
2300
+ let newOptionsLength = state.optionsLength;
2301
+ if (isComboboxValue(option)) {
2302
+ newOptionsLength += 1;
2303
+ }
2304
+ return {
2305
+ ...state,
2306
+ options: newOptions,
2307
+ type: newType,
2308
+ optionsLength: newOptionsLength
2309
+ };
2310
+ };
2311
+
2312
+ /** Remove an option from the state */
2313
+ const REMOVE_OPTION = (state, action) => {
2314
+ const {
2315
+ id
2316
+ } = action.payload;
2317
+ const {
2318
+ options
2319
+ } = state;
2320
+ const option = options[id];
2321
+ if (!options[id]) {
2322
+ // Option doesn't exist, return state unchanged
2323
+ return state;
2324
+ }
2325
+ const newOptions = {
2326
+ ...options
2327
+ };
2328
+ delete newOptions[id];
2329
+ let newOptionsLength = state.optionsLength;
2330
+ if (isComboboxValue(option)) {
2331
+ newOptionsLength -= 1;
2332
+ }
2333
+ return {
2334
+ ...state,
2335
+ options: newOptions,
2336
+ optionsLength: newOptionsLength
2337
+ };
2338
+ };
2339
+
2340
+ /** Reducers for each action type: */
2341
+ const REDUCERS = {
2342
+ OPEN_COMBOBOX,
2343
+ CLOSE_COMBOBOX,
2344
+ SET_INPUT_VALUE,
2345
+ ADD_OPTION,
2346
+ REMOVE_OPTION
2347
+ };
2348
+
2349
+ /** Main reducer */
2350
+ const reducer$1 = (state, action) => {
2351
+ return REDUCERS[action.type]?.(state, action) || state;
2352
+ };
2353
+
2354
+ /** Dispatch for the combobox component */
2355
+
2356
+ /** Context for the Combobox component */
2357
+ const ComboboxContext = /*#__PURE__*/React__default.createContext({
2358
+ ...initialState,
2359
+ openOnFocus: false,
2360
+ openOnClick: false,
2361
+ selectionType: 'single',
2362
+ optionsLength: 0,
2363
+ onSelect: noop,
2364
+ onInputChange: noop,
2365
+ onOpen: noop,
2366
+ dispatch: noop,
2367
+ translations: {
2368
+ clearLabel: '',
2369
+ tryReloadLabel: '',
2370
+ showSuggestionsLabel: '',
2371
+ noResultsForInputLabel: input => input || '',
2372
+ loadingLabel: '',
2373
+ serviceUnavailableLabel: '',
2374
+ nbOptionsLabel: options => `${options}`
2375
+ }
2376
+ });
2377
+
2378
+ /** Context for a combobox section to store its unique id */
2379
+ const SectionContext = /*#__PURE__*/React__default.createContext({
2380
+ sectionId: ''
2381
+ });
2382
+
2383
+ /** Retrieve the current combobox state and actions */
2384
+ const useCombobox = () => {
2385
+ const comboboxContext = React__default.useContext(ComboboxContext);
2386
+ const {
2387
+ dispatch: movingFocusDispatch
2388
+ } = React__default.useContext(MovingFocusContext);
2389
+ const {
2390
+ onSelect,
2391
+ onInputChange,
2392
+ onOpen,
2393
+ dispatch,
2394
+ inputValue,
2395
+ ...contextValues
2396
+ } = comboboxContext;
2397
+ const {
2398
+ triggerRef
2399
+ } = useComboboxRefs();
2400
+
2401
+ /** Action triggered when the listBox is closed without selecting any option */
2402
+ const handleClose = React__default.useCallback(() => {
2403
+ dispatch({
2404
+ type: 'CLOSE_COMBOBOX'
2405
+ });
2406
+ // Reset visual focus
2407
+ movingFocusDispatch({
2408
+ type: 'RESET_SELECTED_TAB_STOP'
2409
+ });
2410
+ }, [dispatch, movingFocusDispatch]);
2411
+
2412
+ // Handle callbacks on options mounted
2413
+ const [optionsMountedCallbacks, setOptionsMountedCallback] = React__default.useState();
2414
+ React__default.useEffect(() => {
2415
+ if (comboboxContext.optionsLength > 0 && optionsMountedCallbacks?.length) {
2416
+ const optionsArray = Object.values(comboboxContext.options);
2417
+ // Execute callbacks
2418
+ for (const callback of optionsMountedCallbacks) {
2419
+ callback(optionsArray);
2420
+ }
2421
+ setOptionsMountedCallback(undefined);
2422
+ }
2423
+ }, [comboboxContext.options, comboboxContext.optionsLength, optionsMountedCallbacks]);
2424
+
2425
+ /** Callback for when an option is selected */
2426
+ const handleSelected = React__default.useCallback((option, source) => {
2427
+ if (option?.isDisabled) {
2428
+ return;
2429
+ }
2430
+ if (isComboboxValue(option)) {
2431
+ /**
2432
+ * We only close the list if the selection type is single.
2433
+ * If it is multiple, we want to allow the user to continue
2434
+ * selecting multiple options.
2435
+ */
2436
+ if (comboboxContext.selectionType !== 'multiple') {
2437
+ handleClose();
2438
+ }
2439
+ /** Call parent onSelect callback */
2440
+ if (onSelect) {
2441
+ onSelect(option);
2442
+ }
2443
+ }
2444
+
2445
+ /** If the option itself has a custom action, also call it */
2446
+ if (option?.onSelect) {
2447
+ option.onSelect(option, source);
2448
+ }
2449
+
2450
+ /** Reset focus on input */
2451
+ if (triggerRef?.current) {
2452
+ triggerRef.current?.focus();
2453
+ }
2454
+ }, [comboboxContext.selectionType, handleClose, onSelect, triggerRef]);
2455
+
2456
+ /** Callback for when the input must be updated */
2457
+ const handleInputChange = React__default.useCallback((value, ...args) => {
2458
+ // Update the local state
2459
+ dispatch({
2460
+ type: 'SET_INPUT_VALUE',
2461
+ payload: value
2462
+ });
2463
+ // If a callback if given, call it with the value
2464
+ if (onInputChange) {
2465
+ onInputChange(value, ...args);
2466
+ }
2467
+ // Reset visual focus
2468
+ movingFocusDispatch({
2469
+ type: 'RESET_SELECTED_TAB_STOP'
2470
+ });
2471
+ }, [dispatch, movingFocusDispatch, onInputChange]);
2472
+
2473
+ /**
2474
+ * Open the popover
2475
+ *
2476
+ * @returns a promise with the updated context once all options are mounted
2477
+ */
2478
+ const handleOpen = React__default.useCallback(params => {
2479
+ /** update the local state */
2480
+ dispatch({
2481
+ type: 'OPEN_COMBOBOX',
2482
+ payload: params
2483
+ });
2484
+ /** If a parent callback was given, trigger it with state information */
2485
+ if (onOpen) {
2486
+ onOpen({
2487
+ currentValue: inputValue,
2488
+ manual: Boolean(params?.manual)
2489
+ });
2490
+ }
2491
+
2492
+ // Promise resolving options on mount
2493
+ return new Promise(resolve => {
2494
+ // Append to the list of callback on options mounted
2495
+ setOptionsMountedCallback((callbacks = []) => {
2496
+ callbacks.push(resolve);
2497
+ return callbacks;
2498
+ });
2499
+ });
2500
+ }, [dispatch, inputValue, onOpen]);
2501
+ return React__default.useMemo(() => ({
2502
+ handleClose,
2503
+ handleOpen,
2504
+ handleInputChange,
2505
+ handleSelected,
2506
+ dispatch,
2507
+ inputValue,
2508
+ ...contextValues
2509
+ }), [contextValues, dispatch, handleClose, handleInputChange, handleOpen, handleSelected, inputValue]);
2510
+ };
2511
+
2512
+ /**
2513
+ * Provide props for the semantic and behaviors the combobox trigger.
2514
+ *
2515
+ *
2516
+ */
2517
+ function useComboboxTrigger({
2518
+ context,
2519
+ refs,
2520
+ onBlur,
2521
+ onFocus,
2522
+ onKeyDown
2523
+ }) {
2524
+ const {
2525
+ comboboxId,
2526
+ listboxId,
2527
+ isOpen,
2528
+ options,
2529
+ optionsLength,
2530
+ selectedIds,
2531
+ openOnFocus,
2532
+ handleClose,
2533
+ handleOpen,
2534
+ handleSelected,
2535
+ showEmptyState = false,
2536
+ showErrorState = false,
2537
+ status
2538
+ } = context;
2539
+ const highlightedId = useVirtualFocusParent(refs.triggerRef);
2540
+ const {
2541
+ dispatch: movingFocusDispatch
2542
+ } = React__default.useContext(MovingFocusContext);
2543
+ const isErrorStateDisplayed = showErrorState && isOpen && status === 'error';
2544
+ const isEmptyStateDisplayed = showEmptyState && isOpen && status === 'idle' && optionsLength === 0;
2545
+ const showPopover = isOpen && optionsLength > 0 || isEmptyStateDisplayed || isErrorStateDisplayed;
2546
+
2547
+ /**
2548
+ * A debounce close to use to leave time for the
2549
+ * listbox to process things before closing.
2550
+ * This can be useful when clicking an option to leave time for the
2551
+ * event to be processed before closing the popover.
2552
+ */
2553
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2554
+ const debouncedClose = React__default.useCallback(debounce$1(handleClose, 200), []);
2555
+
2556
+ /** Cleanup any ongoing cleanup */
2557
+ React__default.useEffect(() => {
2558
+ return () => {
2559
+ if (debouncedClose?.cancel) {
2560
+ debouncedClose.cancel();
2561
+ }
2562
+ };
2563
+ }, [debouncedClose]);
2564
+ const handleBlur = React__default.useCallback(event => {
2565
+ debouncedClose();
2566
+ if (onBlur) {
2567
+ onBlur(event);
2568
+ }
2569
+ }, [debouncedClose, onBlur]);
2570
+
2571
+ /** Actions triggered when the input field is focused */
2572
+ const handleFocus = event => {
2573
+ // If the field is refocused in the process of closing, cancel close
2574
+ if (debouncedClose?.cancel) {
2575
+ debouncedClose.cancel();
2576
+ }
2577
+ if (onFocus) {
2578
+ onFocus(event);
2579
+ }
2580
+ /**
2581
+ * Only set the open on focus if the combobox isn't already opened.
2582
+ * This avoids the popover re-opening when an option is selected and the
2583
+ * field is refocused
2584
+ */
2585
+ if (openOnFocus && !showPopover) {
2586
+ handleOpen({
2587
+ manual: true
2588
+ });
2589
+ }
2590
+ };
2591
+ const handleClick = () => {
2592
+ handleOpen({
2593
+ manual: true
2594
+ });
2595
+ };
2596
+
2597
+ /**
2598
+ * Keyboard shortcut management following the WAI APG pattern
2599
+ * https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/#kbd_label
2600
+ */
2601
+ const handleKeyDown = React__default.useCallback(async event => {
2602
+ const {
2603
+ key,
2604
+ altKey
2605
+ } = event;
2606
+
2607
+ /**
2608
+ * On Enter key
2609
+ * * Select option that is currently highlighted, if any
2610
+ * * Close suggestions, event if none is highlighted
2611
+ */
2612
+ if (event.key === 'Enter') {
2613
+ if (!showPopover) {
2614
+ return;
2615
+ }
2616
+ if (highlightedId) {
2617
+ // prevent any potential form submission
2618
+ event.preventDefault();
2619
+ const option = options[highlightedId];
2620
+ handleSelected(option, 'keyboard');
2621
+ } else {
2622
+ handleClose();
2623
+ }
2624
+ return;
2625
+ }
2626
+
2627
+ /**
2628
+ * On arrow up/down
2629
+ * * If popover is already opened, do nothing
2630
+ * * If alt key pressed, show the listbox without focusing an option
2631
+ * * If arrow Up is pressed, select last option
2632
+ * * If arrow Down is pressed, select first option
2633
+ * */
2634
+ if (key === 'ArrowDown' || key === 'ArrowUp') {
2635
+ if (showPopover) {
2636
+ return;
2637
+ }
2638
+
2639
+ /** Open the listbox */
2640
+ const listBoxOptions = await handleOpen({
2641
+ manual: true
2642
+ });
2643
+ if (!listBoxOptions) {
2644
+ return;
2645
+ }
2646
+
2647
+ /**
2648
+ * If alt key is pressed, only open without changing visual focus
2649
+ * as per WAI Guidelines
2650
+ */
2651
+ if (!altKey) {
2652
+ /** If a selected id is set, set it as current tabstop */
2653
+ if (selectedIds?.length) {
2654
+ movingFocusDispatch({
2655
+ type: 'SELECT_TAB_STOP',
2656
+ payload: {
2657
+ id: selectedIds?.[0],
2658
+ type: 'keyboard'
2659
+ }
2660
+ });
2661
+ } else {
2662
+ /** Focus either the first or last item depending on the keyboard arrow pressed */
2663
+ movingFocusDispatch({
2664
+ type: 'KEY_NAV',
2665
+ payload: {
2666
+ ctrlKey: false,
2667
+ key: key === 'ArrowUp' ? 'End' : 'Home'
2668
+ }
2669
+ });
2670
+ }
2671
+ }
2672
+ return;
2673
+ }
2674
+
2675
+ // Forward event
2676
+ onKeyDown?.(event);
2677
+ }, [onKeyDown, showPopover, highlightedId, options, handleSelected, handleClose, handleOpen, selectedIds, movingFocusDispatch]);
2678
+ return {
2679
+ id: comboboxId,
2680
+ role: 'combobox',
2681
+ 'aria-activedescendant': showPopover && highlightedId ? highlightedId : '',
2682
+ 'aria-controls': listboxId,
2683
+ 'aria-owns': listboxId,
2684
+ 'aria-expanded': showPopover,
2685
+ onFocus: handleFocus,
2686
+ onBlur: handleBlur,
2687
+ onClick: handleClick,
2688
+ onKeyDown: handleKeyDown
2689
+ };
2690
+ }
2691
+
2692
+ /** Is printable character key press */
2693
+ const isTypeEvent = ({
2694
+ key,
2695
+ altKey,
2696
+ ctrlKey,
2697
+ metaKey
2698
+ }) => key.length === 1 && key !== ' ' && !altKey && !ctrlKey && !metaKey;
2699
+
2700
+ /**
2701
+ * Provide props for the semantic and behaviors the combobox button trigger
2702
+ *
2703
+ * Overrides the useComboboxTrigger() props & behavior to add a jump to option
2704
+ * on printable character key down.
2705
+ */
2706
+ function useComboboxButton(args) {
2707
+ const {
2708
+ context: {
2709
+ handleOpen
2710
+ },
2711
+ onKeyDown: parentOnKeyDown
2712
+ } = args;
2713
+ const {
2714
+ dispatch: movingFocusDispatch,
2715
+ state: {
2716
+ selectedId: highlightedId
2717
+ }
2718
+ } = React__default.useContext(MovingFocusContext);
2719
+ const searchValueRef = React__default.useRef('');
2720
+ const searchTimeoutRef = React__default.useRef();
2721
+ const onKeyDown = React__default.useMemo(() => {
2722
+ function clearSearchTimeout() {
2723
+ const searchTimeout = searchTimeoutRef.current;
2724
+ if (!searchTimeout) {
2725
+ return;
2726
+ }
2727
+ clearTimeout(searchTimeout);
2728
+ searchTimeoutRef.current = undefined;
2729
+ }
2730
+ function clearSearch() {
2731
+ searchValueRef.current = '';
2732
+ clearSearchTimeout();
2733
+ }
2734
+ return async event => {
2735
+ if (!isTypeEvent(event)) {
2736
+ // Forward key down event
2737
+ parentOnKeyDown?.(event);
2738
+ return undefined;
2739
+ }
2740
+ event.stopPropagation();
2741
+
2742
+ // Clear current search timeout
2743
+ clearSearchTimeout();
2744
+
2745
+ // Open combobox and wait for options to mount
2746
+ const options = await handleOpen({
2747
+ manual: false
2748
+ });
2749
+ const optionArray = options && Object.values(options);
2750
+ if (!optionArray?.length) {
2751
+ return undefined;
2752
+ }
2753
+
2754
+ // Append key to current search
2755
+ searchValueRef.current += event.key.toLowerCase();
2756
+ const searchValue = searchValueRef.current;
2757
+
2758
+ // Clear search after 500ms
2759
+ searchTimeoutRef.current = setTimeout(clearSearch, 500);
2760
+
2761
+ // Search is containing all the same letters (ex: aaaa)
2762
+ const allTheSameLetters = searchValue.split('').every(letter => letter === searchValue[0]);
2763
+
2764
+ // start from currently selected option
2765
+ let startIndex = optionArray.findIndex(option => option.generatedId === highlightedId);
2766
+ if (startIndex === -1) {
2767
+ startIndex = 0;
2768
+ }
2769
+ let index = startIndex;
2770
+ do {
2771
+ // Increment index and loop around to 0 if we get over the array length
2772
+ index = (index + 1) % optionArray.length;
2773
+ const option = optionArray[index];
2774
+ // Search by text value or fallback on id.
2775
+ const optionText = isComboboxValue(option) ? option?.textValue || option?.id : null;
2776
+ if (isComboboxValue(option) && optionText) {
2777
+ const optionTextValue = optionText.toLowerCase();
2778
+
2779
+ // Search on first letter if search is all the same letters
2780
+ const searchText = allTheSameLetters ? searchValue[0] : searchValue;
2781
+
2782
+ // Option text value starts with searched text
2783
+ if (optionTextValue.startsWith(searchText)) {
2784
+ movingFocusDispatch({
2785
+ type: 'SELECT_TAB_STOP',
2786
+ payload: {
2787
+ id: option.generatedId,
2788
+ type: 'keyboard'
2789
+ }
2790
+ });
2791
+ break;
2792
+ }
2793
+ }
2794
+ } while (index !== startIndex);
2795
+ return clearSearchTimeout;
2796
+ };
2797
+ }, [handleOpen, parentOnKeyDown, highlightedId, movingFocusDispatch]);
2798
+ return useComboboxTrigger({
2799
+ ...args,
2800
+ onKeyDown
2801
+ });
2802
+ }
2803
+
2804
+ /**
2805
+ * Combobox button trigger.
2806
+ *
2807
+ * @family Combobox
2808
+ */
2809
+ const ComboboxButton = forwardRef((props, ref) => {
2810
+ const {
2811
+ as,
2812
+ label,
2813
+ onFocus,
2814
+ onBlur,
2815
+ labelDisplayMode = 'show-selection',
2816
+ ...forwardedProps
2817
+ } = props;
2818
+ const refs = useComboboxRefs();
2819
+ const context = useCombobox();
2820
+ const buttonProps = useComboboxButton({
2821
+ context,
2822
+ refs,
2823
+ onBlur,
2824
+ onFocus
2825
+ });
2826
+ const Element = as || Button;
2827
+ const showSelection = labelDisplayMode === 'show-selection';
2828
+ const tooltipOnly = labelDisplayMode === 'show-tooltip';
2829
+ const selectionLabel = showSelection && context.selectedIds?.length && context.inputValue;
2830
+ let content = null;
2831
+ if (!tooltipOnly) {
2832
+ // Display selection label or label
2833
+ content = selectionLabel || label;
2834
+ }
2835
+ const hideTooltip =
2836
+ // Hide tooltip if the displayed label and tooltip label are the same
2837
+ label === content ||
2838
+ // Hide tooltip when the combobox is open
2839
+ context.isOpen;
2840
+ const mergedRefs = useMergeRefs(ref, refs.triggerRef, refs.anchorRef);
2841
+ return /*#__PURE__*/jsx(Tooltip, {
2842
+ className: hideTooltip ? visuallyHidden() : undefined,
2843
+ label: label,
2844
+ closeMode: "hide",
2845
+ ariaLinkMode: "aria-labelledby",
2846
+ children: /*#__PURE__*/jsx(Element, {
2847
+ ref: mergedRefs,
2848
+ ...forwardedProps,
2849
+ ...buttonProps,
2850
+ children: content
2851
+ })
2852
+ });
2853
+ });
2854
+
2855
+ /**
2856
+ * Provide props for the semantic and behaviors the combobox input trigger
2857
+ *
2858
+ * Overrides the useComboboxTrigger() props & behavior to prevent open on click
2859
+ * if `openOnFocus` is not enabled.
2860
+ */
2861
+ function useComboboxInput({
2862
+ onKeyDown: propsOnKeyDown,
2863
+ ...args
2864
+ }) {
2865
+ const triggerProps = useComboboxTrigger(args);
2866
+ const {
2867
+ onClick,
2868
+ onKeyDown,
2869
+ 'aria-expanded': showPopover
2870
+ } = triggerProps;
2871
+ const handleClick = () => {
2872
+ if (!args.context.openOnFocus && !args.context.openOnClick) {
2873
+ // Skip if input should not opening on focus nor click
2874
+ return;
2875
+ }
2876
+ onClick();
2877
+ };
2878
+ const handleKeyDown = evt => {
2879
+ if (evt.key === 'Escape') {
2880
+ // Reset field if closed
2881
+ if (!showPopover) {
2882
+ args.context.handleInputChange('');
2883
+ }
2884
+ return;
2885
+ }
2886
+ onKeyDown(evt);
2887
+ if (propsOnKeyDown) {
2888
+ propsOnKeyDown(evt);
2889
+ }
2890
+ };
2891
+ return {
2892
+ ...triggerProps,
2893
+ onClick: handleClick,
2894
+ onKeyDown: handleKeyDown
2895
+ };
2896
+ }
2897
+
2898
+ /**
2899
+ * Combobox input trigger.
2900
+ *
2901
+ * @family Combobox
2902
+ */
2903
+ const ComboboxInput = ({
2904
+ hideToggle,
2905
+ inputRef,
2906
+ textFieldRef,
2907
+ afterElement,
2908
+ onFocus,
2909
+ onBlur,
2910
+ onKeyDown,
2911
+ clearButtonProps,
2912
+ hasClearButton,
2913
+ theme,
2914
+ ...textFieldProps
2915
+ }) => {
2916
+ const refs = useComboboxRefs();
2917
+ const context = useCombobox();
2918
+ const inputProps = useComboboxInput({
2919
+ refs,
2920
+ context,
2921
+ onBlur,
2922
+ onFocus,
2923
+ onKeyDown
2924
+ });
2925
+ const {
2926
+ listboxId,
2927
+ isOpen,
2928
+ handleOpen,
2929
+ handleClose,
2930
+ inputValue,
2931
+ handleInputChange
2932
+ } = context;
2933
+
2934
+ /** Callback for when the toggle button is trigged */
2935
+ const handleManualToggle = () => {
2936
+ if (isOpen) {
2937
+ handleClose();
2938
+ } else {
2939
+ handleOpen({
2940
+ manual: true
2941
+ });
2942
+ }
2943
+ refs.triggerRef?.current?.focus();
2944
+ };
2945
+ return /*#__PURE__*/jsx(TextField
2946
+ // Disable native autocomplete
2947
+ , {
2948
+ autoComplete: "off",
2949
+ ...textFieldProps,
2950
+ inputRef: mergeRefs(refs.triggerRef, inputRef),
2951
+ textFieldRef: mergeRefs(refs.anchorRef, textFieldRef)
2952
+ // Combobox props
2953
+ ,
2954
+ ...inputProps,
2955
+ theme: theme,
2956
+ value: inputValue,
2957
+ onClear: () => handleInputChange(''),
2958
+ onChange: handleInputChange,
2959
+ clearButtonProps: hasClearButton ? {
2960
+ ...clearButtonProps,
2961
+ label: context.translations.clearLabel
2962
+ } : undefined,
2963
+ afterElement: (!hideToggle || afterElement) && /*#__PURE__*/jsxs(Fragment, {
2964
+ children: [afterElement, !hideToggle && /*#__PURE__*/jsx(IconButton, {
2965
+ theme: theme,
2966
+ onClick: handleManualToggle,
2967
+ label: context.translations.showSuggestionsLabel,
2968
+ emphasis: Emphasis$1.low,
2969
+ size: Size$1.s,
2970
+ icon: inputProps['aria-expanded'] ? mdiChevronUp : mdiChevronDown,
2971
+ type: "button",
2972
+ tabIndex: -1,
2973
+ "aria-expanded": inputProps['aria-expanded'],
2974
+ "aria-haspopup": "listbox",
2975
+ "aria-controls": listboxId
2976
+ })]
2977
+ })
2978
+ });
2979
+ };
2980
+
2981
+ const ComboboxOptionContext = /*#__PURE__*/createContext({});
2982
+ /** Context Provider to store the current combobox option id. */
2983
+ const ComboboxOptionContextProvider = ({
2984
+ optionId,
2985
+ isKeyboardHighlighted,
2986
+ children
2987
+ }) => {
2988
+ const value = React__default.useMemo(() => ({
2989
+ optionId,
2990
+ isKeyboardHighlighted
2991
+ }), [optionId, isKeyboardHighlighted]);
2992
+ return /*#__PURE__*/jsx(ComboboxOptionContext.Provider, {
2993
+ value: value,
2994
+ children: children
2995
+ });
2996
+ };
2997
+
2998
+ /** Retrieve the current combobox section id */
2999
+ const useComboboxSectionId = () => {
3000
+ return useContext(SectionContext);
3001
+ };
3002
+
3003
+ /**
3004
+ * Register the given option to the context
3005
+ */
3006
+ const useRegisterOption = (registerId, option, shouldRegister) => {
3007
+ const {
3008
+ dispatch
3009
+ } = useCombobox();
3010
+
3011
+ /** Register the given options */
3012
+ React__default.useEffect(() => {
3013
+ if (option && shouldRegister) {
3014
+ dispatch({
3015
+ type: 'ADD_OPTION',
3016
+ payload: {
3017
+ id: registerId,
3018
+ option
3019
+ }
3020
+ });
3021
+ }
3022
+
3023
+ // Unregister ids if/when the component unmounts or if option changes
3024
+ return () => {
3025
+ if (option) {
3026
+ dispatch({
3027
+ type: 'REMOVE_OPTION',
3028
+ payload: {
3029
+ id: registerId
3030
+ }
3031
+ });
3032
+ }
3033
+ };
3034
+ }, [dispatch, option, registerId, shouldRegister]);
3035
+ };
3036
+
3037
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
3038
+ const CLASSNAME$16 = 'lumx-combobox-option';
3039
+ const LUMX_CLASSNAME = 'lumx-list-item';
3040
+ const {
3041
+ block: block$Z,
3042
+ element: element$L
3043
+ } = classNames.bem(CLASSNAME$16);
3044
+ const lumxListItem = classNames.bem(LUMX_CLASSNAME);
3045
+
3046
+ /**
3047
+ * Content of the option.
3048
+ * This should only be rendered if the option is shown.
3049
+ */
3050
+ const OptionContent = forwardRef((props, ref) => {
3051
+ const {
3052
+ id,
3053
+ onSelect,
3054
+ isSelected,
3055
+ isDisabled,
3056
+ children,
3057
+ className,
3058
+ before,
3059
+ after,
3060
+ as,
3061
+ size = Size$1.tiny,
3062
+ comboboxType,
3063
+ tooltipProps,
3064
+ description,
3065
+ 'aria-hidden': ariaHidden,
3066
+ autofocus,
3067
+ ...forwardedProps
3068
+ } = props;
3069
+ const itemRef = React__default.useRef(null);
3070
+ const {
3071
+ state
3072
+ } = React__default.useContext(MovingFocusContext);
3073
+ const {
3074
+ selectedIds
3075
+ } = useCombobox();
3076
+ const hasSelection = selectedIds !== undefined;
3077
+ const isHighlighted = useVirtualFocus(id, itemRef, false, comboboxType === 'grid' ? id : undefined, autofocus);
3078
+ const Element = as || 'span';
3079
+ const ariaSelected = isSelected ? 'true' : 'false';
3080
+ const ariaDescriptionId = description ? `${id}-description` : undefined;
3081
+ const isKeyboardHighlighted = state.isUsingKeyboard && isHighlighted;
3082
+
3083
+ /**
3084
+ * The DS `ListItem` component has a lot of behavior / default props we do not want here.
3085
+ * Notably the before/after items are within the interactive element, which we do not want.
3086
+ * So we use a native li tag.
3087
+ */
3088
+ return /*#__PURE__*/jsx("li", {
3089
+ className: block$Z(undefined, [className ?? '', lumxListItem.block({
3090
+ [`size-${size}`]: !!size
3091
+ })]),
3092
+ role: "presentation",
3093
+ ref: itemRef,
3094
+ "aria-hidden": ariaHidden,
3095
+ style: {
3096
+ display: ariaHidden ? 'none' : undefined
3097
+ },
3098
+ ...forwardedProps,
3099
+ children: /*#__PURE__*/jsxs(GenericBlock, {
3100
+ as: "div",
3101
+ role: comboboxType === 'grid' ? 'row' : 'presentation',
3102
+ className: element$L('content', {
3103
+ // Not using the lumx list item disabled style as it blocks pointer events
3104
+ 'is-disabled': !!isDisabled
3105
+ },
3106
+ // TODO: migrate away from using lumx-list-item styles https://lumapps.atlassian.net/browse/DSW-288
3107
+ [lumxListItem.element('link', {
3108
+ 'is-selected': Boolean(isSelected),
3109
+ 'is-highlighted': Boolean(isHighlighted)
3110
+ })]),
3111
+ "data-focus-visible-added": isKeyboardHighlighted ? 'true' : undefined,
3112
+ children: [before && /*#__PURE__*/jsx(GenericBlock.Figure, {
3113
+ as: "span",
3114
+ role: "presentation",
3115
+ className: element$L('before', undefined, [lumxListItem.element('before')]),
3116
+ children: before
3117
+ }), /*#__PURE__*/jsxs(GenericBlock.Content, {
3118
+ as: "span",
3119
+ role: "presentation",
3120
+ className: lumxListItem.element('content'),
3121
+ children: [/*#__PURE__*/jsx(Tooltip, {
3122
+ forceOpen: isKeyboardHighlighted,
3123
+ closeMode: "hide",
3124
+ ...tooltipProps,
3125
+ children: /*#__PURE__*/jsx(Element, {
3126
+ id: id,
3127
+ className: element$L('trigger'),
3128
+ role: comboboxType === 'grid' ? 'gridcell' : 'option',
3129
+ "aria-selected": hasSelection ? ariaSelected : undefined,
3130
+ "aria-disabled": isDisabled,
3131
+ "aria-describedby": ariaDescriptionId,
3132
+ onClick: onSelect
3133
+ // Prevent mouse down to avoid blur before the click is activated
3134
+ ,
3135
+ onMouseDown: event => event.preventDefault(),
3136
+ ref: ref,
3137
+ ...forwardedProps,
3138
+ children: children
3139
+ })
3140
+ }), description && /*#__PURE__*/jsx(Text, {
3141
+ as: "span",
3142
+ id: ariaDescriptionId,
3143
+ role: "presentation",
3144
+ className: element$L('description'),
3145
+ typography: "caption",
3146
+ color: "dark",
3147
+ colorVariant: "L2",
3148
+ children: description
3149
+ })]
3150
+ }), after && /*#__PURE__*/jsx(GenericBlock.Actions, {
3151
+ as: "span",
3152
+ role: "presentation",
3153
+ className: element$L('after', undefined, [lumxListItem.element('after')]),
3154
+ children: /*#__PURE__*/jsx(ComboboxOptionContextProvider, {
3155
+ optionId: id,
3156
+ isKeyboardHighlighted: isKeyboardHighlighted,
3157
+ children: after
3158
+ })
3159
+ })]
3160
+ })
3161
+ });
3162
+ });
3163
+
3164
+ /**
3165
+ * Props for ComboboxOption with additional generic properties.
3166
+ */
3167
+
3168
+ /**
3169
+ * Option to set within a combobox list.
3170
+ *
3171
+ * @family Combobox
3172
+ * @param ComboboxOptionProps
3173
+ * @returns ComboboxOption
3174
+ */
3175
+ const ComboboxOption = forwardRef((props, ref) => {
3176
+ const {
3177
+ children,
3178
+ id,
3179
+ textValue,
3180
+ data,
3181
+ filterFromInput = true,
3182
+ onSelect: onOptionSelect,
3183
+ isDisabled,
3184
+ as = 'span',
3185
+ ...optionProps
3186
+ } = props;
3187
+
3188
+ // Get the id of the current group, if any.
3189
+ const section = useComboboxSectionId();
3190
+ const {
3191
+ comboboxId,
3192
+ selectedIds,
3193
+ showAll,
3194
+ inputValue,
3195
+ handleSelected,
3196
+ type
3197
+ } = useCombobox();
3198
+ // Generate a unique id for this option.
3199
+ const generatedId = generateOptionId(comboboxId, id);
3200
+ const isSelected = selectedIds?.includes(generatedId);
3201
+
3202
+ // If no text value is set and the direct child is a simple string, use it as value.
3203
+ const isStringChild = typeof children === 'string' || typeof children === 'number';
3204
+ const value = children && !textValue && isStringChild ? children.toString() : textValue;
3205
+ const showOption = !filterFromInput || showAll || value?.toString()?.toLowerCase().includes(inputValue?.toLowerCase());
3206
+ const registeredOption = React__default.useMemo(() => ({
3207
+ id,
3208
+ generatedId,
3209
+ textValue: value,
3210
+ data,
3211
+ filter: filterFromInput,
3212
+ isDisabled: isDisabled || !showOption,
3213
+ sectionId: section.sectionId,
3214
+ onSelect: onOptionSelect
3215
+ }), [data, filterFromInput, generatedId, section.sectionId, id, isDisabled, onOptionSelect, showOption, value]);
3216
+
3217
+ // Register the option
3218
+ useRegisterOption(generatedId, registeredOption, showOption);
3219
+ const handleSelect = React__default.useCallback(() => handleSelected(registeredOption, 'click'), [handleSelected, registeredOption]);
3220
+ if (!id || !showOption) {
3221
+ return null;
3222
+ }
3223
+ return /*#__PURE__*/jsx(OptionContent, {
3224
+ id: generatedId,
3225
+ onSelect: handleSelect,
3226
+ isSelected: isSelected,
3227
+ isDisabled: isDisabled,
3228
+ as: as,
3229
+ ref: ref,
3230
+ comboboxType: type,
3231
+ "aria-hidden": section.isLoading,
3232
+ ...optionProps,
3233
+ children: children || textValue
3234
+ });
3235
+ });
3236
+
3237
+ // Default widths the skeletons must have
3238
+ const defaultWidths = [REAL_SIZE_FOR_LUMX_SIZE.xxl, REAL_SIZE_FOR_LUMX_SIZE.xl, REAL_SIZE_FOR_LUMX_SIZE.l];
3239
+ const {
3240
+ block: block$Y,
3241
+ element: element$K
3242
+ } = classNames.bem(CLASSNAME$16);
3243
+
3244
+ /**
3245
+ * Skeleton for a combobox option.
3246
+ * A typography skeleton is rendered by default but can be overridden by passing children.
3247
+ */
3248
+ const ComboboxOptionSkeleton = ({
3249
+ className,
3250
+ index,
3251
+ before,
3252
+ after,
3253
+ size = Size$1.tiny,
3254
+ children
3255
+ }) => {
3256
+ const renderedChildren = typeof children === 'function' ? children({
3257
+ index
3258
+ }) : children;
3259
+ const content = renderedChildren || /*#__PURE__*/jsx(SkeletonTypography, {
3260
+ typography: "body1",
3261
+ width: index !== undefined && defaultWidths[index] ? defaultWidths[index] : REAL_SIZE_FOR_LUMX_SIZE.xl
3262
+ });
3263
+ return /*#__PURE__*/jsxs("li", {
3264
+ role: "presentation",
3265
+ className: block$Y({
3266
+ skeleton: true
3267
+ }, ['lumx-list-item', `lumx-list-item--size-${size}`, className]),
3268
+ children: [/*#__PURE__*/jsxs("div", {
3269
+ role: "presentation",
3270
+ className: element$K('content', ['lumx-list-item__wrapper']),
3271
+ children: [before && /*#__PURE__*/jsx(Text, {
3272
+ as: "span",
3273
+ role: "presentation",
3274
+ className: element$K('before', ['lumx-list-item__before']),
3275
+ children: before
3276
+ }), content]
3277
+ }), after && /*#__PURE__*/jsx("div", {
3278
+ role: "presentation",
3279
+ className: element$K('after', ['lumx-list-item__after']),
3280
+ children: after
3281
+ })]
3282
+ });
3283
+ };
3284
+
3285
+ /** Default skeleton for the options list of the combobox */
3286
+ const ComboboxListSkeleton = ({
3287
+ isLoadingMore,
3288
+ children
3289
+ }) => /*#__PURE__*/jsx(Fragment, {
3290
+ children: Array.from({
3291
+ length: isLoadingMore ? 1 : 3
3292
+ }).map((_, index) => {
3293
+ const renderedChildren = typeof children === 'function' ? children({
3294
+ index
3295
+ }) : children || /*#__PURE__*/jsx(ComboboxOptionSkeleton, {
3296
+ index: index
3297
+ });
3298
+ return (
3299
+ /*#__PURE__*/
3300
+ // eslint-disable-next-line react/no-array-index-key
3301
+ jsx(React__default.Fragment, {
3302
+ children: renderedChildren
3303
+ }, index)
3304
+ );
3305
+ })
3306
+ });
2075
3307
 
2076
- // Focus the last enabled chip (if any exists)
2077
- const lastChip = findPreviousEnabledChip();
2078
- lastChip?.focus();
2079
- };
3308
+ /** The states in which the full loading must be displayed */
3309
+ const FULL_LOADING_STATES = ['loading', 'debouncing', 'filtering'];
3310
+ const CLASSNAME$15 = 'lumx-combobox-listbox';
3311
+ const {
3312
+ block: block$X,
3313
+ element: element$J
3314
+ } = bem$1(CLASSNAME$15);
2080
3315
 
2081
- // Attach keyboard event listener
2082
- input.addEventListener('keydown', onKeyDown);
3316
+ /**
3317
+ * The listbox containing the combobox's options.
3318
+ *
3319
+ * @family Combobox
3320
+ * @param ComboboxListBoxProps
3321
+ * @returns ComboboxListBox
3322
+ */
3323
+ const ComboboxListBox = ({
3324
+ children,
3325
+ renderItemSkeleton,
3326
+ label,
3327
+ popoverProps,
3328
+ footer,
3329
+ listRef,
3330
+ ...forwardedProps
3331
+ }) => {
3332
+ const {
3333
+ status,
3334
+ listboxId,
3335
+ isOpen,
3336
+ optionsLength,
3337
+ handleClose: contextHandleClose,
3338
+ type,
3339
+ inputValue,
3340
+ showEmptyState,
3341
+ showErrorState,
3342
+ translations
3343
+ } = useCombobox();
3344
+ const {
3345
+ anchorRef
3346
+ } = useComboboxRefs();
3347
+ const {
3348
+ onClose,
3349
+ ...otherPopoverProps
3350
+ } = popoverProps || {};
3351
+ const {
3352
+ style,
3353
+ className,
3354
+ ...listProps
3355
+ } = forwardedProps;
3356
+ // The states to show a full skeleton instead of the options
3357
+ const showFullLoading = FULL_LOADING_STATES.includes(status);
3358
+ const isErrorStateDisplayed = showErrorState && isOpen && status === 'error';
3359
+ const isEmptyStateDisplayed = showEmptyState && isOpen && status === 'idle' && optionsLength === 0;
2083
3360
 
2084
- // Cleanup listener on unmount
2085
- return () => {
2086
- input.removeEventListener('keydown', onKeyDown);
2087
- };
2088
- }, [inputRef, findPreviousEnabledChip]);
2089
- return {
2090
- findPreviousEnabledChip
3361
+ /**
3362
+ * The conditions in which we want to show the content of the popover
3363
+ * * The parent asked for the popover to be opened
3364
+ * * There is at least one option to displayed OR a skeleton
3365
+ */
3366
+ const showPopover = isOpen && (optionsLength > 0 || showFullLoading) || isEmptyStateDisplayed || isErrorStateDisplayed;
3367
+ const handleClose = () => {
3368
+ if (isOpen) {
3369
+ contextHandleClose?.();
3370
+ onClose?.();
3371
+ }
2091
3372
  };
2092
- }
3373
+ const emptyMessage = translations.noResultsForInputLabel(inputValue);
3374
+ return /*#__PURE__*/jsxs(Fragment, {
3375
+ children: [/*#__PURE__*/jsxs(Text, {
3376
+ as: "p",
3377
+ className: visuallyHidden(),
3378
+ role: "log",
3379
+ "aria-live": "assertive",
3380
+ children: [isOpen && !showFullLoading && !isEmptyStateDisplayed && !isErrorStateDisplayed && translations.nbOptionsLabel(optionsLength), isErrorStateDisplayed && `${translations.serviceUnavailableLabel} ${translations.tryReloadLabel}`, showFullLoading && translations.loadingLabel, isEmptyStateDisplayed && emptyMessage]
3381
+ }), /*#__PURE__*/jsx(Popover, {
3382
+ role: "none",
3383
+ onClose: handleClose,
3384
+ anchorRef: anchorRef,
3385
+ fitToAnchorWidth: true,
3386
+ fitWithinViewportHeight: true,
3387
+ closeOnEscape: true,
3388
+ closeOnClickAway: true,
3389
+ placement: Placement.BOTTOM,
3390
+ isOpen: isOpen,
3391
+ ...otherPopoverProps,
3392
+ children: /*#__PURE__*/jsxs("div", {
3393
+ style: {
3394
+ ...style,
3395
+ overflowY: 'auto',
3396
+ display: showPopover ? 'flex' : 'none',
3397
+ flexDirection: 'column'
3398
+ },
3399
+ children: [/*#__PURE__*/jsxs("ul", {
3400
+ ref: listRef,
3401
+ id: listboxId,
3402
+ role: type,
3403
+ "aria-label": label,
3404
+ className: block$X([className, 'lumx-list lumx-list--item-padding-big']),
3405
+ style: {
3406
+ flex: 1,
3407
+ overflowY: 'auto'
3408
+ },
3409
+ ...listProps,
3410
+ children: [!showFullLoading && children, [...FULL_LOADING_STATES, 'loadingMore'].includes(status) && /*#__PURE__*/jsx(ComboboxListSkeleton, {
3411
+ isLoadingMore: status === 'loadingMore',
3412
+ children: renderItemSkeleton
3413
+ })]
3414
+ }), footer, (isEmptyStateDisplayed || isErrorStateDisplayed) && /*#__PURE__*/jsx(GenericBlock, {
3415
+ className: element$J('state'),
3416
+ orientation: "vertical",
3417
+ vAlign: "center",
3418
+ children: /*#__PURE__*/jsxs(GenericBlock.Content, {
3419
+ children: [inputValue && isEmptyStateDisplayed && /*#__PURE__*/jsx(Text, {
3420
+ as: "p",
3421
+ typography: "body1",
3422
+ color: "dark",
3423
+ colorVariant: "L2",
3424
+ dangerouslySetInnerHTML: {
3425
+ __html: translations.noResultsForInputLabel(inputValue)
3426
+ }
3427
+ }), !inputValue && isEmptyStateDisplayed && /*#__PURE__*/jsx(Text, {
3428
+ as: "p",
3429
+ typography: "body1",
3430
+ color: "dark",
3431
+ colorVariant: "L2",
3432
+ children: translations.noResultsForInputLabel()
3433
+ }), isErrorStateDisplayed && /*#__PURE__*/jsxs(Fragment, {
3434
+ children: [/*#__PURE__*/jsx(Heading, {
3435
+ as: "h2",
3436
+ typography: "subtitle2",
3437
+ children: translations.serviceUnavailableLabel
3438
+ }), /*#__PURE__*/jsx(Text, {
3439
+ as: "p",
3440
+ typography: "body1",
3441
+ color: "dark",
3442
+ colorVariant: "L2",
3443
+ children: translations.tryReloadLabel
3444
+ })]
3445
+ })]
3446
+ })
3447
+ })]
3448
+ })
3449
+ })]
3450
+ });
3451
+ };
2093
3452
 
2094
- /**
2095
- * Component default class name and class prefix.
2096
- */
2097
- const CLASSNAME$14 = 'lumx-selection-chip-group';
3453
+ const CLASSNAME$14 = 'lumx-combobox-section';
2098
3454
  const {
2099
3455
  block: block$W,
2100
3456
  element: element$I
2101
3457
  } = classNames.bem(CLASSNAME$14);
2102
3458
 
2103
3459
  /**
2104
- * SelectionChipGroup component.
2105
- *
2106
- * @param props Component props.
2107
- * @param ref Component ref.
2108
- * @return React element.
3460
+ * Content of the ComboboxSection.
2109
3461
  */
2110
- const SelectionChipGroup = ({
2111
- onChange,
2112
- value,
2113
- getOptionId,
2114
- getOptionName,
2115
- inputRef,
2116
- inputLabel,
2117
- renderChip,
2118
- theme,
2119
- isDisabled,
2120
- chipTooltipLabel,
2121
- label,
2122
- ...forwardedProps
3462
+ const ComboboxSectionContent = ({
3463
+ className,
3464
+ title,
3465
+ children,
3466
+ isLoading,
3467
+ renderItemSkeleton
2123
3468
  }) => {
2124
- const chipRefs = React__default.useRef([]);
2125
3469
  const {
2126
- findPreviousEnabledChip
2127
- } = useFocusLastChipOnBackspace(chipRefs, inputRef);
2128
- return /*#__PURE__*/jsx(ChipGroup, {
2129
- role: "group",
2130
- "aria-label": label,
2131
- className: block$W(),
2132
- ...forwardedProps,
2133
- children: value?.map((v, index) => {
2134
- const name = getWithSelector(getOptionName, v);
2135
- const id = getWithSelector(getOptionId, v);
2136
- const onClick = () => {
2137
- const newValue = [...value];
2138
- const existingIndex = value.findIndex(vi => getWithSelector(getOptionId, vi) === id);
2139
- if (existingIndex === -1) {
2140
- return;
2141
- }
2142
- // Remove value
2143
- newValue.splice(existingIndex, 1);
2144
- onChange?.(newValue);
2145
- };
2146
- const onKeyDown = evt => {
2147
- if (evt.key !== 'Backspace') {
2148
- return;
2149
- }
2150
- // Activate (remove value) on Backspace pressed
2151
- onClick();
2152
- const previousChip = findPreviousEnabledChip(index - 1);
2153
- const input = inputRef?.current;
2154
- // Focus the previous chip or the input
2155
- (previousChip || input)?.focus();
2156
- };
2157
- if (!chipRefs.current[index]) {
2158
- chipRefs.current[index] = /*#__PURE__*/React__default.createRef();
2159
- }
2160
- const ref = chipRefs.current[index];
2161
- const customChip = renderChip?.(v);
2162
- const props = isComponentType(Chip)(customChip) ? customChip.props : undefined;
2163
- const chipIsDisabled = props?.isDisabled || isDisabled;
2164
- const chipName = typeof props?.children === 'string' ? props.children : name;
2165
- const tooltipLabel = chipTooltipLabel(chipName);
2166
- return /*#__PURE__*/jsx(Tooltip, {
2167
- label: !chipIsDisabled ? tooltipLabel : undefined,
2168
- closeMode: "hide",
2169
- ariaLinkMode: "aria-labelledby",
2170
- children: /*#__PURE__*/jsx(Chip, {
2171
- ...props,
2172
- after: /*#__PURE__*/jsx(Icon, {
2173
- icon: mdiClose
2174
- }),
2175
- className: element$I('chip', [props?.className]),
2176
- size: "s",
2177
- ref: ref,
2178
- onClick: onClick,
2179
- onKeyDown: onKeyDown,
2180
- theme: theme,
2181
- isDisabled: chipIsDisabled,
2182
- tabIndex: chipIsDisabled ? -1 : 0,
2183
- children: props?.children || name
2184
- })
2185
- }, id);
3470
+ options
3471
+ } = useCombobox();
3472
+ const {
3473
+ sectionId
3474
+ } = useComboboxSectionId();
3475
+ const hasRegisteredChildren = Boolean(Object.values(options).find(option => isComboboxValue(option) && option.sectionId === sectionId));
3476
+ const titleId = title && `${sectionId}-title`;
3477
+ if (!children && !isLoading) {
3478
+ return null;
3479
+ }
3480
+ const isHidden = !hasRegisteredChildren && !isLoading;
3481
+ return /*#__PURE__*/jsxs("li", {
3482
+ className: block$W([className]),
3483
+ role: !isHidden ? 'none' : undefined,
3484
+ "aria-hidden": isHidden,
3485
+ style: {
3486
+ display: isHidden ? 'none' : undefined
3487
+ },
3488
+ children: [title && /*#__PURE__*/jsx(Text, {
3489
+ as: "span",
3490
+ className: element$I('header', [ListSubheader.className]),
3491
+ "aria-hidden": "true",
3492
+ id: titleId,
3493
+ children: title
3494
+ }), /*#__PURE__*/jsxs("ul", {
3495
+ className: element$I('content'),
3496
+ role: "group",
3497
+ "aria-labelledby": titleId,
3498
+ children: [children, isLoading && /*#__PURE__*/jsx(ComboboxListSkeleton, {
3499
+ children: renderItemSkeleton
3500
+ })]
3501
+ })]
3502
+ });
3503
+ };
3504
+
3505
+ /**
3506
+ * Section for options of a Combobox.
3507
+ *
3508
+ * @family Combobox
3509
+ * @param ComboboxSectionProps
3510
+ * @returns ComboboxSection
3511
+ */
3512
+ const ComboboxSection = ({
3513
+ children,
3514
+ ...props
3515
+ }) => {
3516
+ const sectionId = useId();
3517
+ const value = React__default.useMemo(() => ({
3518
+ sectionId,
3519
+ isLoading: props.isLoading
3520
+ }), [sectionId, props.isLoading]);
3521
+ return /*#__PURE__*/jsx(SectionContext.Provider, {
3522
+ value: value,
3523
+ children: /*#__PURE__*/jsx(ComboboxSectionContent, {
3524
+ ...props,
3525
+ children: children
3526
+ })
3527
+ });
3528
+ };
3529
+
3530
+ /** Context provider for the combobox. */
3531
+ const ComboboxProvider = ({
3532
+ children,
3533
+ value
3534
+ }) => {
3535
+ return /*#__PURE__*/jsx(ComboboxContext.Provider, {
3536
+ value: value,
3537
+ children: /*#__PURE__*/jsx(MovingFocusProvider, {
3538
+ options: {
3539
+ direction: value.type === 'grid' ? 'both' : 'vertical',
3540
+ firstFocusDirection: value.type === 'grid' ? 'vertical' : undefined,
3541
+ loopAround: {
3542
+ row: 'next-loop',
3543
+ col: 'inside'
3544
+ },
3545
+ gridJumpToShortcutDirection: 'vertical',
3546
+ defaultSelectedId: value.selectedIds?.[0],
3547
+ listKey: value.inputValue
3548
+ },
3549
+ children: children
3550
+ })
3551
+ });
3552
+ };
3553
+
3554
+ const Combobox$1 = ({
3555
+ id: htmlId,
3556
+ inputValue,
3557
+ defaultInputValue,
3558
+ autoFilter = true,
3559
+ openOnClick,
3560
+ openOnFocus,
3561
+ status,
3562
+ showEmptyState = !autoFilter,
3563
+ showErrorState = !!status,
3564
+ selectedIds,
3565
+ onInputChange,
3566
+ onSelect,
3567
+ onOpen,
3568
+ children,
3569
+ selectionType,
3570
+ translations
3571
+ }) => {
3572
+ const textFieldRef = useRef(null);
3573
+ const triggerRef = useRef(null);
3574
+
3575
+ // Generate a unique id for the combobox that will be used for every child components.
3576
+ const generatedId = useId('combobox');
3577
+ const comboboxId = htmlId || generatedId;
3578
+ const listboxId = `${comboboxId}-popover`;
3579
+
3580
+ /** Generate the selected option id from the given selected id. */
3581
+ const currentSelectedIds = selectedIds?.map(selectedId => generateOptionId(comboboxId, selectedId.toString()));
3582
+
3583
+ /** Generate the state */
3584
+ const [state, dispatch] = useReducer(reducer$1, initialState, defaultState => ({
3585
+ ...defaultState,
3586
+ comboboxId,
3587
+ listboxId,
3588
+ // a default input value can be set if needed
3589
+ inputValue: defaultInputValue || defaultState.inputValue
3590
+ }));
3591
+
3592
+ /**
3593
+ * Return the current input value.
3594
+ */
3595
+ const currentInputValue = useMemo(() => {
3596
+ // If the component is controlled and a value is already set by the parent, use this value
3597
+ if (inputValue !== null && inputValue !== undefined) {
3598
+ return inputValue;
3599
+ }
3600
+
3601
+ // Then use the local value
3602
+ if (state.inputValue) {
3603
+ return state.inputValue;
3604
+ }
3605
+
3606
+ // In all other cases, return an empty string.
3607
+ return '';
3608
+ }, [inputValue, state.inputValue]);
3609
+
3610
+ /** Return a memoized state */
3611
+ const synchedState = useMemo(() => {
3612
+ return {
3613
+ ...state,
3614
+ showAll: !autoFilter || state.showAll,
3615
+ inputValue: currentInputValue,
3616
+ status: status || state.status,
3617
+ listboxId
3618
+ };
3619
+ }, [currentInputValue, listboxId, autoFilter, state, status]);
3620
+
3621
+ /** Props to set in the context */
3622
+ const comboboxProviderValue = useMemo(() => ({
3623
+ ...synchedState,
3624
+ openOnFocus,
3625
+ openOnClick,
3626
+ onInputChange,
3627
+ onOpen,
3628
+ onSelect,
3629
+ dispatch,
3630
+ selectionType,
3631
+ selectedIds: currentSelectedIds,
3632
+ showEmptyState,
3633
+ showErrorState,
3634
+ translations
3635
+ }), [synchedState, openOnFocus, openOnClick, onInputChange, onOpen, onSelect, selectionType, currentSelectedIds, showEmptyState, showErrorState, translations]);
3636
+ return /*#__PURE__*/jsx(ComboboxRefsProvider, {
3637
+ triggerRef: triggerRef,
3638
+ anchorRef: textFieldRef,
3639
+ children: /*#__PURE__*/jsx(ComboboxProvider, {
3640
+ value: comboboxProviderValue,
3641
+ children: children
2186
3642
  })
2187
3643
  });
2188
3644
  };
2189
3645
 
3646
+ const SUB_COMPONENTS = {
3647
+ /**
3648
+ * Option to set within a combobox list.
3649
+ *
3650
+ * @family Combobox
3651
+ * @param ComboboxOptionProps
3652
+ * @returns ComboboxOption
3653
+ */
3654
+ Option: ComboboxOption,
3655
+ /**
3656
+ * Skeleton for a combobox option.
3657
+ * A typography skeleton is rendered by default but can be overridden by passing children.
3658
+ */
3659
+ OptionSkeleton: ComboboxOptionSkeleton,
3660
+ /**
3661
+ * Section for options of a Combobox.
3662
+ *
3663
+ * @family Combobox
3664
+ * @param ComboboxSectionProps
3665
+ * @returns ComboboxSection
3666
+ */
3667
+ Section: ComboboxSection,
3668
+ /**
3669
+ * Combobox input trigger.
3670
+ *
3671
+ * @family Combobox
3672
+ */
3673
+ Input: ComboboxInput,
3674
+ /**
3675
+ * The listbox containing the combobox's options.
3676
+ *
3677
+ * @family Combobox
3678
+ * @param ComboboxListBoxProps
3679
+ * @returns ComboboxListBox
3680
+ */
3681
+ List: ComboboxListBox,
3682
+ /**
3683
+ * Combobox button trigger.
3684
+ *
3685
+ * @family Combobox
3686
+ */
3687
+ Button: ComboboxButton
3688
+ };
3689
+
3690
+ /**
3691
+ *
3692
+ * A Combobox is a combination of two components:
3693
+ * * An input to enter the user's value
3694
+ * * A popover with a list of suggestions to fill the value.
3695
+ *
3696
+ * These two components are included via the Combobox.Input and Combobox.ListBox components.
3697
+ *
3698
+ * In its simplest implementation the component will automatically filter the given options
3699
+ * from the value of the input and fill the input with the textValue of the selected option.
3700
+ *
3701
+ * Props are available for more complex implementations.
3702
+ *
3703
+ * @family Combobox
3704
+ * @param ComboboxProps
3705
+ * @returns Combobox
3706
+ */
3707
+ const Combobox = Object.assign(Combobox$1, SUB_COMPONENTS);
3708
+
2190
3709
  /**
2191
3710
  * Comment block variants.
2192
3711
  */
@@ -2216,7 +3735,7 @@ const {
2216
3735
  /**
2217
3736
  * Component default props.
2218
3737
  */
2219
- const DEFAULT_PROPS$W = {
3738
+ const DEFAULT_PROPS$U = {
2220
3739
  variant: CommentBlockVariant.indented
2221
3740
  };
2222
3741
 
@@ -2246,7 +3765,7 @@ const CommentBlock = forwardRef((props, ref) => {
2246
3765
  onMouseLeave,
2247
3766
  text,
2248
3767
  theme = defaultTheme,
2249
- variant = DEFAULT_PROPS$W.variant,
3768
+ variant = DEFAULT_PROPS$U.variant,
2250
3769
  ...forwardedProps
2251
3770
  } = props;
2252
3771
  const hasChildren = Children.count(children) > 0;
@@ -2315,7 +3834,7 @@ const CommentBlock = forwardRef((props, ref) => {
2315
3834
  });
2316
3835
  CommentBlock.displayName = COMPONENT_NAME$15;
2317
3836
  CommentBlock.className = CLASSNAME$13;
2318
- CommentBlock.defaultProps = DEFAULT_PROPS$W;
3837
+ CommentBlock.defaultProps = DEFAULT_PROPS$U;
2319
3838
 
2320
3839
  /**
2321
3840
  * Add a number of months from a date while resetting the day to prevent month length mismatches.
@@ -3420,7 +4939,7 @@ const {
3420
4939
  /**
3421
4940
  * Component default props.
3422
4941
  */
3423
- const DEFAULT_PROPS$V = {
4942
+ const DEFAULT_PROPS$T = {
3424
4943
  size: Size$1.big,
3425
4944
  disableBodyScroll: true
3426
4945
  };
@@ -3451,11 +4970,11 @@ const Dialog = forwardRef((props, ref) => {
3451
4970
  parentElement,
3452
4971
  contentRef,
3453
4972
  preventAutoClose,
3454
- size = DEFAULT_PROPS$V.size,
4973
+ size = DEFAULT_PROPS$T.size,
3455
4974
  zIndex,
3456
4975
  dialogProps,
3457
4976
  onVisibilityChange,
3458
- disableBodyScroll = DEFAULT_PROPS$V.disableBodyScroll,
4977
+ disableBodyScroll = DEFAULT_PROPS$T.disableBodyScroll,
3459
4978
  preventCloseOnClick,
3460
4979
  preventCloseOnEscape,
3461
4980
  ...forwardedProps
@@ -3595,7 +5114,7 @@ const Dialog = forwardRef((props, ref) => {
3595
5114
  });
3596
5115
  Dialog.displayName = COMPONENT_NAME$11;
3597
5116
  Dialog.className = CLASSNAME$11;
3598
- Dialog.defaultProps = DEFAULT_PROPS$V;
5117
+ Dialog.defaultProps = DEFAULT_PROPS$T;
3599
5118
 
3600
5119
  /**
3601
5120
  * Component display name.
@@ -3613,7 +5132,7 @@ const {
3613
5132
  /**
3614
5133
  * Component default props.
3615
5134
  */
3616
- const DEFAULT_PROPS$U = {};
5135
+ const DEFAULT_PROPS$S = {};
3617
5136
 
3618
5137
  /**
3619
5138
  * Divider component.
@@ -3639,7 +5158,7 @@ const Divider = forwardRef((props, ref) => {
3639
5158
  });
3640
5159
  Divider.displayName = COMPONENT_NAME$10;
3641
5160
  Divider.className = CLASSNAME$10;
3642
- Divider.defaultProps = DEFAULT_PROPS$U;
5161
+ Divider.defaultProps = DEFAULT_PROPS$S;
3643
5162
 
3644
5163
  /**
3645
5164
  * Component display name.
@@ -3864,7 +5383,7 @@ const {
3864
5383
  /**
3865
5384
  * Component default props.
3866
5385
  */
3867
- const DEFAULT_PROPS$T = {
5386
+ const DEFAULT_PROPS$R = {
3868
5387
  tabIndex: -1
3869
5388
  };
3870
5389
 
@@ -3883,7 +5402,7 @@ const InternalList = forwardRef((props, ref) => {
3883
5402
  isClickable,
3884
5403
  itemPadding,
3885
5404
  onListItemSelected,
3886
- tabIndex = DEFAULT_PROPS$T.tabIndex,
5405
+ tabIndex = DEFAULT_PROPS$R.tabIndex,
3887
5406
  ...forwardedProps
3888
5407
  } = props;
3889
5408
  const adjustedItemPadding = itemPadding ?? (isClickable ? Size$1.big : undefined);
@@ -3899,7 +5418,7 @@ const InternalList = forwardRef((props, ref) => {
3899
5418
  });
3900
5419
  InternalList.displayName = COMPONENT_NAME$_;
3901
5420
  InternalList.className = CLASSNAME$_;
3902
- InternalList.defaultProps = DEFAULT_PROPS$T;
5421
+ InternalList.defaultProps = DEFAULT_PROPS$R;
3903
5422
  const List = Object.assign(InternalList, {
3904
5423
  useKeyboardListNavigation
3905
5424
  });
@@ -6344,7 +7863,7 @@ const {
6344
7863
  /**
6345
7864
  * Component default props.
6346
7865
  */
6347
- const DEFAULT_PROPS$S = {
7866
+ const DEFAULT_PROPS$Q = {
6348
7867
  elevation: 3,
6349
7868
  placement: Placement.AUTO,
6350
7869
  focusAnchorOnClose: true,
@@ -6361,24 +7880,24 @@ const _InnerPopover = forwardRef((props, ref) => {
6361
7880
  className,
6362
7881
  closeOnClickAway,
6363
7882
  closeOnEscape,
6364
- elevation = DEFAULT_PROPS$S.elevation,
7883
+ elevation = DEFAULT_PROPS$Q.elevation,
6365
7884
  focusElement,
6366
7885
  hasArrow,
6367
7886
  isOpen,
6368
7887
  onClose,
6369
7888
  parentElement,
6370
- usePortal = DEFAULT_PROPS$S.usePortal,
6371
- focusAnchorOnClose = DEFAULT_PROPS$S.focusAnchorOnClose,
7889
+ usePortal = DEFAULT_PROPS$Q.usePortal,
7890
+ focusAnchorOnClose = DEFAULT_PROPS$Q.focusAnchorOnClose,
6372
7891
  withFocusTrap,
6373
7892
  boundaryRef,
6374
7893
  fitToAnchorWidth,
6375
7894
  fitWithinViewportHeight,
6376
7895
  focusTrapZoneElement,
6377
7896
  offset,
6378
- placement = DEFAULT_PROPS$S.placement,
7897
+ placement = DEFAULT_PROPS$Q.placement,
6379
7898
  style,
6380
7899
  theme,
6381
- zIndex = DEFAULT_PROPS$S.zIndex,
7900
+ zIndex = DEFAULT_PROPS$Q.zIndex,
6382
7901
  ...forwardedProps
6383
7902
  } = props;
6384
7903
  const popoverRef = useRef(null);
@@ -6464,7 +7983,7 @@ const Popover = skipRender(
6464
7983
  () => Boolean(DOCUMENT), _InnerPopover);
6465
7984
  Popover.displayName = COMPONENT_NAME$Z;
6466
7985
  Popover.className = CLASSNAME$Z;
6467
- Popover.defaultProps = DEFAULT_PROPS$S;
7986
+ Popover.defaultProps = DEFAULT_PROPS$Q;
6468
7987
 
6469
7988
  // The error margin in px we want to have for triggering infinite scroll
6470
7989
  const SCROLL_TRIGGER_MARGIN = 5;
@@ -6524,7 +8043,7 @@ const {
6524
8043
  /**
6525
8044
  * Component default props.
6526
8045
  */
6527
- const DEFAULT_PROPS$R = {
8046
+ const DEFAULT_PROPS$P = {
6528
8047
  closeOnClick: true,
6529
8048
  closeOnClickAway: true,
6530
8049
  closeOnEscape: true,
@@ -6547,18 +8066,18 @@ const Dropdown = forwardRef((props, ref) => {
6547
8066
  anchorRef,
6548
8067
  children,
6549
8068
  className,
6550
- closeOnClick = DEFAULT_PROPS$R.closeOnClick,
6551
- closeOnClickAway = DEFAULT_PROPS$R.closeOnClickAway,
6552
- closeOnEscape = DEFAULT_PROPS$R.closeOnEscape,
6553
- fitToAnchorWidth = DEFAULT_PROPS$R.fitToAnchorWidth,
6554
- fitWithinViewportHeight = DEFAULT_PROPS$R.fitWithinViewportHeight,
8069
+ closeOnClick = DEFAULT_PROPS$P.closeOnClick,
8070
+ closeOnClickAway = DEFAULT_PROPS$P.closeOnClickAway,
8071
+ closeOnEscape = DEFAULT_PROPS$P.closeOnEscape,
8072
+ fitToAnchorWidth = DEFAULT_PROPS$P.fitToAnchorWidth,
8073
+ fitWithinViewportHeight = DEFAULT_PROPS$P.fitWithinViewportHeight,
6555
8074
  isOpen,
6556
8075
  offset,
6557
- focusAnchorOnClose = DEFAULT_PROPS$R.focusAnchorOnClose,
8076
+ focusAnchorOnClose = DEFAULT_PROPS$P.focusAnchorOnClose,
6558
8077
  onClose,
6559
8078
  onInfiniteScroll,
6560
- placement = DEFAULT_PROPS$R.placement,
6561
- shouldFocusOnOpen = DEFAULT_PROPS$R.shouldFocusOnOpen,
8079
+ placement = DEFAULT_PROPS$P.placement,
8080
+ shouldFocusOnOpen = DEFAULT_PROPS$P.shouldFocusOnOpen,
6562
8081
  zIndex,
6563
8082
  ...forwardedProps
6564
8083
  } = props;
@@ -6604,7 +8123,7 @@ const Dropdown = forwardRef((props, ref) => {
6604
8123
  });
6605
8124
  Dropdown.displayName = COMPONENT_NAME$Y;
6606
8125
  Dropdown.className = CLASSNAME$Y;
6607
- Dropdown.defaultProps = DEFAULT_PROPS$R;
8126
+ Dropdown.defaultProps = DEFAULT_PROPS$P;
6608
8127
 
6609
8128
  /**
6610
8129
  * Component display name.
@@ -6623,7 +8142,7 @@ const {
6623
8142
  /**
6624
8143
  * Component default props.
6625
8144
  */
6626
- const DEFAULT_PROPS$Q = {
8145
+ const DEFAULT_PROPS$O = {
6627
8146
  closeMode: 'unmount'
6628
8147
  };
6629
8148
  const isDragHandle = isComponent(DragHandle);
@@ -6641,7 +8160,7 @@ const ExpansionPanel = forwardRef((props, ref) => {
6641
8160
  const defaultTheme = useTheme() || Theme$1.light;
6642
8161
  const {
6643
8162
  className,
6644
- closeMode = DEFAULT_PROPS$Q.closeMode,
8163
+ closeMode = DEFAULT_PROPS$O.closeMode,
6645
8164
  children: anyChildren,
6646
8165
  hasBackground,
6647
8166
  hasHeaderDivider,
@@ -6758,11 +8277,11 @@ const ExpansionPanel = forwardRef((props, ref) => {
6758
8277
  });
6759
8278
  ExpansionPanel.displayName = COMPONENT_NAME$X;
6760
8279
  ExpansionPanel.className = CLASSNAME$X;
6761
- ExpansionPanel.defaultProps = DEFAULT_PROPS$Q;
8280
+ ExpansionPanel.defaultProps = DEFAULT_PROPS$O;
6762
8281
 
6763
8282
  const COMPONENT_NAME$W = 'Flag';
6764
8283
  const CLASSNAME$W = 'lumx-flag';
6765
- const DEFAULT_PROPS$P = {};
8284
+ const DEFAULT_PROPS$N = {};
6766
8285
  const {
6767
8286
  block: block$N,
6768
8287
  element: element$B
@@ -6826,7 +8345,7 @@ const Flag = forwardRef((props, ref) => {
6826
8345
  });
6827
8346
  Flag.displayName = COMPONENT_NAME$W;
6828
8347
  Flag.className = CLASSNAME$W;
6829
- Flag.defaultProps = DEFAULT_PROPS$P;
8348
+ Flag.defaultProps = DEFAULT_PROPS$N;
6830
8349
 
6831
8350
  /**
6832
8351
  * Defines the props of the component.
@@ -6919,7 +8438,7 @@ const {
6919
8438
  /**
6920
8439
  * Component default props.
6921
8440
  */
6922
- const DEFAULT_PROPS$O = {
8441
+ const DEFAULT_PROPS$M = {
6923
8442
  gap: Size$1.big,
6924
8443
  orientation: Orientation$1.horizontal
6925
8444
  };
@@ -6949,8 +8468,8 @@ const BaseGenericBlock = forwardRef((props, ref) => {
6949
8468
  children,
6950
8469
  actions,
6951
8470
  actionsProps,
6952
- gap = DEFAULT_PROPS$O.gap,
6953
- orientation = DEFAULT_PROPS$O.orientation,
8471
+ gap = DEFAULT_PROPS$M.gap,
8472
+ orientation = DEFAULT_PROPS$M.orientation,
6954
8473
  contentProps,
6955
8474
  ...forwardedProps
6956
8475
  } = props;
@@ -7004,7 +8523,7 @@ const BaseGenericBlock = forwardRef((props, ref) => {
7004
8523
  });
7005
8524
  BaseGenericBlock.displayName = COMPONENT_NAME$U;
7006
8525
  BaseGenericBlock.className = CLASSNAME$U;
7007
- BaseGenericBlock.defaultProps = DEFAULT_PROPS$O;
8526
+ BaseGenericBlock.defaultProps = DEFAULT_PROPS$M;
7008
8527
  const GenericBlock = Object.assign(BaseGenericBlock, {
7009
8528
  Figure,
7010
8529
  Content,
@@ -7052,7 +8571,7 @@ const CLASSNAME$T = 'lumx-heading';
7052
8571
  /**
7053
8572
  * Component default props.
7054
8573
  */
7055
- const DEFAULT_PROPS$N = {};
8574
+ const DEFAULT_PROPS$L = {};
7056
8575
 
7057
8576
  /**
7058
8577
  * Get Heading component common props
@@ -7153,7 +8672,7 @@ const {
7153
8672
  /**
7154
8673
  * Component default props.
7155
8674
  */
7156
- const DEFAULT_PROPS$M = {};
8675
+ const DEFAULT_PROPS$K = {};
7157
8676
 
7158
8677
  /**
7159
8678
  * Text component common props
@@ -7240,7 +8759,7 @@ const Text = forwardRef((props, ref) => {
7240
8759
  });
7241
8760
  Text.displayName = COMPONENT_NAME$S;
7242
8761
  Text.className = CLASSNAME$S;
7243
- Text.defaultProps = DEFAULT_PROPS$M;
8762
+ Text.defaultProps = DEFAULT_PROPS$K;
7244
8763
 
7245
8764
  const HeadingLevelContext = /*#__PURE__*/createContext(defaultContext);
7246
8765
 
@@ -7277,7 +8796,7 @@ const Heading = forwardRef((props, ref) => {
7277
8796
  });
7278
8797
  Heading.displayName = COMPONENT_NAME$T;
7279
8798
  Heading.className = CLASSNAME$T;
7280
- Heading.defaultProps = DEFAULT_PROPS$N;
8799
+ Heading.defaultProps = DEFAULT_PROPS$L;
7281
8800
 
7282
8801
  /**
7283
8802
  * Computes the next heading level based on the optional prop level or the parent context level.
@@ -7328,7 +8847,7 @@ const {
7328
8847
  /**
7329
8848
  * Component default props.
7330
8849
  */
7331
- const DEFAULT_PROPS$L = {
8850
+ const DEFAULT_PROPS$J = {
7332
8851
  orientation: Orientation$1.horizontal,
7333
8852
  wrap: 'nowrap'
7334
8853
  };
@@ -7346,9 +8865,9 @@ const Grid = forwardRef((props, ref) => {
7346
8865
  className,
7347
8866
  gutter,
7348
8867
  hAlign,
7349
- orientation = DEFAULT_PROPS$L.orientation,
8868
+ orientation = DEFAULT_PROPS$J.orientation,
7350
8869
  vAlign,
7351
- wrap = DEFAULT_PROPS$L.wrap,
8870
+ wrap = DEFAULT_PROPS$J.wrap,
7352
8871
  ...forwardedProps
7353
8872
  } = props;
7354
8873
  return /*#__PURE__*/jsx("div", {
@@ -7366,7 +8885,7 @@ const Grid = forwardRef((props, ref) => {
7366
8885
  });
7367
8886
  Grid.displayName = COMPONENT_NAME$R;
7368
8887
  Grid.className = CLASSNAME$R;
7369
- Grid.defaultProps = DEFAULT_PROPS$L;
8888
+ Grid.defaultProps = DEFAULT_PROPS$J;
7370
8889
 
7371
8890
  /**
7372
8891
  * Component display name.
@@ -7424,7 +8943,7 @@ const CLASSNAME$P = 'lumx-grid-column';
7424
8943
  /**
7425
8944
  * Component default props.
7426
8945
  */
7427
- const DEFAULT_PROPS$K = {};
8946
+ const DEFAULT_PROPS$I = {};
7428
8947
 
7429
8948
  /**
7430
8949
  * The GridColumn is a layout component that can display children in a grid
@@ -7461,7 +8980,7 @@ const GridColumn = forwardRef((props, ref) => {
7461
8980
  });
7462
8981
  GridColumn.displayName = COMPONENT_NAME$P;
7463
8982
  GridColumn.className = CLASSNAME$P;
7464
- GridColumn.defaultProps = DEFAULT_PROPS$K;
8983
+ GridColumn.defaultProps = DEFAULT_PROPS$I;
7465
8984
 
7466
8985
  /**
7467
8986
  * Icon component.
@@ -7579,7 +9098,7 @@ const {
7579
9098
  /**
7580
9099
  * Component default props.
7581
9100
  */
7582
- const DEFAULT_PROPS$J = {
9101
+ const DEFAULT_PROPS$H = {
7583
9102
  captionPosition: ImageBlockCaptionPosition.below,
7584
9103
  align: Alignment.left
7585
9104
  };
@@ -7595,9 +9114,9 @@ const ImageBlock = forwardRef((props, ref) => {
7595
9114
  const defaultTheme = useTheme() || Theme$1.light;
7596
9115
  const {
7597
9116
  actions,
7598
- align = DEFAULT_PROPS$J.align,
9117
+ align = DEFAULT_PROPS$H.align,
7599
9118
  alt,
7600
- captionPosition = DEFAULT_PROPS$J.captionPosition,
9119
+ captionPosition = DEFAULT_PROPS$H.captionPosition,
7601
9120
  captionStyle,
7602
9121
  className,
7603
9122
  description,
@@ -7651,7 +9170,7 @@ const ImageBlock = forwardRef((props, ref) => {
7651
9170
  });
7652
9171
  ImageBlock.displayName = COMPONENT_NAME$O;
7653
9172
  ImageBlock.className = CLASSNAME$O;
7654
- ImageBlock.defaultProps = DEFAULT_PROPS$J;
9173
+ ImageBlock.defaultProps = DEFAULT_PROPS$H;
7655
9174
 
7656
9175
  /**
7657
9176
  * Component display name.
@@ -8411,7 +9930,7 @@ const {
8411
9930
  /**
8412
9931
  * Component default props.
8413
9932
  */
8414
- const DEFAULT_PROPS$I = {};
9933
+ const DEFAULT_PROPS$G = {};
8415
9934
 
8416
9935
  /**
8417
9936
  * InlineList component.
@@ -8464,7 +9983,7 @@ const InlineList = forwardRef((props, ref) => {
8464
9983
  });
8465
9984
  InlineList.displayName = COMPONENT_NAME$M;
8466
9985
  InlineList.className = CLASSNAME$M;
8467
- InlineList.defaultProps = DEFAULT_PROPS$I;
9986
+ InlineList.defaultProps = DEFAULT_PROPS$G;
8468
9987
 
8469
9988
  /**
8470
9989
  * InputHelper component.
@@ -8738,7 +10257,7 @@ const {
8738
10257
  /**
8739
10258
  * Component default props.
8740
10259
  */
8741
- const DEFAULT_PROPS$H = {
10260
+ const DEFAULT_PROPS$F = {
8742
10261
  size: Size$1.regular,
8743
10262
  titleHeading: 'h2'
8744
10263
  };
@@ -8758,11 +10277,11 @@ const LinkPreview = forwardRef((props, ref) => {
8758
10277
  link,
8759
10278
  linkAs,
8760
10279
  linkProps,
8761
- size = DEFAULT_PROPS$H.size,
10280
+ size = DEFAULT_PROPS$F.size,
8762
10281
  theme = defaultTheme,
8763
10282
  thumbnailProps,
8764
10283
  title,
8765
- titleHeading = DEFAULT_PROPS$H.titleHeading,
10284
+ titleHeading = DEFAULT_PROPS$F.titleHeading,
8766
10285
  ...forwardedProps
8767
10286
  } = props;
8768
10287
  // Use title heading as title wrapper (see DEFAULT_PROPS for the default value).
@@ -8830,7 +10349,7 @@ const LinkPreview = forwardRef((props, ref) => {
8830
10349
  });
8831
10350
  LinkPreview.displayName = COMPONENT_NAME$J;
8832
10351
  LinkPreview.className = CLASSNAME$J;
8833
- LinkPreview.defaultProps = DEFAULT_PROPS$H;
10352
+ LinkPreview.defaultProps = DEFAULT_PROPS$F;
8834
10353
 
8835
10354
  /**
8836
10355
  * Render link with default <a> HTML component or a custom one provided by `linkAs`.
@@ -8863,7 +10382,7 @@ const {
8863
10382
  /**
8864
10383
  * Component default props.
8865
10384
  */
8866
- const DEFAULT_PROPS$G = {
10385
+ const DEFAULT_PROPS$E = {
8867
10386
  size: Size$1.regular
8868
10387
  };
8869
10388
 
@@ -8902,7 +10421,7 @@ const ListItem = forwardRef((props, ref) => {
8902
10421
  linkProps = {},
8903
10422
  linkRef,
8904
10423
  onItemSelected,
8905
- size = DEFAULT_PROPS$G.size,
10424
+ size = DEFAULT_PROPS$E.size,
8906
10425
  ...forwardedProps
8907
10426
  } = otherProps;
8908
10427
  const role = linkAs || linkProps.href ? 'link' : 'button';
@@ -8959,7 +10478,7 @@ const ListItem = forwardRef((props, ref) => {
8959
10478
  });
8960
10479
  ListItem.displayName = COMPONENT_NAME$I;
8961
10480
  ListItem.className = CLASSNAME$I;
8962
- ListItem.defaultProps = DEFAULT_PROPS$G;
10481
+ ListItem.defaultProps = DEFAULT_PROPS$E;
8963
10482
 
8964
10483
  /**
8965
10484
  * Component display name.
@@ -9147,7 +10666,7 @@ const {
9147
10666
  /**
9148
10667
  * Component default props.
9149
10668
  */
9150
- const DEFAULT_PROPS$F = {};
10669
+ const DEFAULT_PROPS$D = {};
9151
10670
 
9152
10671
  /**
9153
10672
  * Mosaic component.
@@ -9214,7 +10733,7 @@ const Mosaic = forwardRef((props, ref) => {
9214
10733
  });
9215
10734
  Mosaic.displayName = COMPONENT_NAME$E;
9216
10735
  Mosaic.className = CLASSNAME$E;
9217
- Mosaic.defaultProps = DEFAULT_PROPS$F;
10736
+ Mosaic.defaultProps = DEFAULT_PROPS$D;
9218
10737
 
9219
10738
  const NavigationContext = /*#__PURE__*/createContext({
9220
10739
  orientation: Orientation$1.vertical
@@ -9403,7 +10922,7 @@ const {
9403
10922
  /**
9404
10923
  * Component default props
9405
10924
  */
9406
- const DEFAULT_PROPS$E = {
10925
+ const DEFAULT_PROPS$C = {
9407
10926
  orientation: Orientation$1.vertical
9408
10927
  };
9409
10928
  const Navigation = forwardRef((props, ref) => {
@@ -9412,7 +10931,7 @@ const Navigation = forwardRef((props, ref) => {
9412
10931
  children,
9413
10932
  className,
9414
10933
  theme = defaultTheme,
9415
- orientation = DEFAULT_PROPS$E.orientation,
10934
+ orientation = DEFAULT_PROPS$C.orientation,
9416
10935
  ...forwardedProps
9417
10936
  } = props;
9418
10937
  return /*#__PURE__*/jsx(ThemeProvider, {
@@ -9438,7 +10957,7 @@ const Navigation = forwardRef((props, ref) => {
9438
10957
  });
9439
10958
  Navigation.displayName = COMPONENT_NAME$C;
9440
10959
  Navigation.className = CLASSNAME$C;
9441
- Navigation.defaultProps = DEFAULT_PROPS$E;
10960
+ Navigation.defaultProps = DEFAULT_PROPS$C;
9442
10961
 
9443
10962
  // Sub components
9444
10963
  Navigation.Section = NavigationSection;
@@ -9483,7 +11002,7 @@ const {
9483
11002
  /**
9484
11003
  * Component default props.
9485
11004
  */
9486
- const DEFAULT_PROPS$D = {
11005
+ const DEFAULT_PROPS$B = {
9487
11006
  zIndex: 9999,
9488
11007
  usePortal: true
9489
11008
  };
@@ -9507,8 +11026,8 @@ const Notification = forwardRef((props, ref) => {
9507
11026
  onClick,
9508
11027
  theme = defaultTheme,
9509
11028
  type,
9510
- zIndex = DEFAULT_PROPS$D.zIndex,
9511
- usePortal = DEFAULT_PROPS$D.usePortal,
11029
+ zIndex = DEFAULT_PROPS$B.zIndex,
11030
+ usePortal = DEFAULT_PROPS$B.usePortal,
9512
11031
  style,
9513
11032
  ...forwardedProps
9514
11033
  } = props;
@@ -9573,7 +11092,7 @@ const Notification = forwardRef((props, ref) => {
9573
11092
  });
9574
11093
  Notification.displayName = COMPONENT_NAME$B;
9575
11094
  Notification.className = CLASSNAME$B;
9576
- Notification.defaultProps = DEFAULT_PROPS$D;
11095
+ Notification.defaultProps = DEFAULT_PROPS$B;
9577
11096
 
9578
11097
  /**
9579
11098
  * Component display name.
@@ -9588,7 +11107,7 @@ const CLASSNAME$A = 'lumx-popover-dialog';
9588
11107
  /**
9589
11108
  * Component default props.
9590
11109
  */
9591
- const DEFAULT_PROPS$C = {};
11110
+ const DEFAULT_PROPS$A = {};
9592
11111
 
9593
11112
  /**
9594
11113
  * PopoverDialog component.
@@ -9631,7 +11150,7 @@ const PopoverDialog = forwardRef((props, ref) => {
9631
11150
  });
9632
11151
  PopoverDialog.displayName = COMPONENT_NAME$A;
9633
11152
  PopoverDialog.className = CLASSNAME$A;
9634
- PopoverDialog.defaultProps = DEFAULT_PROPS$C;
11153
+ PopoverDialog.defaultProps = DEFAULT_PROPS$A;
9635
11154
 
9636
11155
  /**
9637
11156
  * Component display name.
@@ -9650,7 +11169,7 @@ const {
9650
11169
  /**
9651
11170
  * Component default props.
9652
11171
  */
9653
- const DEFAULT_PROPS$B = {
11172
+ const DEFAULT_PROPS$z = {
9654
11173
  orientation: Orientation$1.horizontal
9655
11174
  };
9656
11175
 
@@ -9670,7 +11189,7 @@ const PostBlock = forwardRef((props, ref) => {
9670
11189
  className,
9671
11190
  meta,
9672
11191
  onClick,
9673
- orientation = DEFAULT_PROPS$B.orientation,
11192
+ orientation = DEFAULT_PROPS$z.orientation,
9674
11193
  tags,
9675
11194
  text,
9676
11195
  theme = defaultTheme,
@@ -9732,7 +11251,7 @@ const PostBlock = forwardRef((props, ref) => {
9732
11251
  });
9733
11252
  PostBlock.displayName = COMPONENT_NAME$z;
9734
11253
  PostBlock.className = CLASSNAME$z;
9735
- PostBlock.defaultProps = DEFAULT_PROPS$B;
11254
+ PostBlock.defaultProps = DEFAULT_PROPS$z;
9736
11255
 
9737
11256
  /**
9738
11257
  * Component display name.
@@ -9751,7 +11270,7 @@ const {
9751
11270
  /**
9752
11271
  * Component default props.
9753
11272
  */
9754
- const DEFAULT_PROPS$A = {};
11273
+ const DEFAULT_PROPS$y = {};
9755
11274
 
9756
11275
  /**
9757
11276
  * ProgressLinear component.
@@ -9782,7 +11301,7 @@ const ProgressLinear = forwardRef((props, ref) => {
9782
11301
  });
9783
11302
  ProgressLinear.displayName = COMPONENT_NAME$y;
9784
11303
  ProgressLinear.className = CLASSNAME$y;
9785
- ProgressLinear.defaultProps = DEFAULT_PROPS$A;
11304
+ ProgressLinear.defaultProps = DEFAULT_PROPS$y;
9786
11305
 
9787
11306
  /**
9788
11307
  * Component display name.
@@ -9801,7 +11320,7 @@ const {
9801
11320
  /**
9802
11321
  * Component default props.
9803
11322
  */
9804
- const DEFAULT_PROPS$z = {
11323
+ const DEFAULT_PROPS$x = {
9805
11324
  size: Size$1.m,
9806
11325
  display: 'block'
9807
11326
  };
@@ -9818,8 +11337,8 @@ const ProgressCircular = forwardRef((props, ref) => {
9818
11337
  const {
9819
11338
  className,
9820
11339
  theme = defaultTheme,
9821
- size = DEFAULT_PROPS$z.size,
9822
- display = DEFAULT_PROPS$z.display,
11340
+ size = DEFAULT_PROPS$x.size,
11341
+ display = DEFAULT_PROPS$x.display,
9823
11342
  ...forwardedProps
9824
11343
  } = props;
9825
11344
  const Element = display === 'block' ? 'div' : 'span';
@@ -9851,7 +11370,7 @@ const ProgressCircular = forwardRef((props, ref) => {
9851
11370
  });
9852
11371
  ProgressCircular.displayName = COMPONENT_NAME$x;
9853
11372
  ProgressCircular.className = CLASSNAME$x;
9854
- ProgressCircular.defaultProps = DEFAULT_PROPS$z;
11373
+ ProgressCircular.defaultProps = DEFAULT_PROPS$x;
9855
11374
 
9856
11375
  const ProgressVariant = {
9857
11376
  linear: 'linear',
@@ -9878,7 +11397,7 @@ const {
9878
11397
  /**
9879
11398
  * Component default props.
9880
11399
  */
9881
- const DEFAULT_PROPS$y = {
11400
+ const DEFAULT_PROPS$w = {
9882
11401
  variant: ProgressVariant.circular
9883
11402
  };
9884
11403
 
@@ -9895,7 +11414,7 @@ const Progress = forwardRef((props, ref) => {
9895
11414
  const {
9896
11415
  className,
9897
11416
  theme = defaultTheme,
9898
- variant = DEFAULT_PROPS$y.variant,
11417
+ variant = DEFAULT_PROPS$w.variant,
9899
11418
  ...forwardedProps
9900
11419
  } = props;
9901
11420
  return /*#__PURE__*/jsxs("div", {
@@ -9914,7 +11433,7 @@ const Progress = forwardRef((props, ref) => {
9914
11433
  });
9915
11434
  Progress.displayName = COMPONENT_NAME$w;
9916
11435
  Progress.className = CLASSNAME$w;
9917
- Progress.defaultProps = DEFAULT_PROPS$y;
11436
+ Progress.defaultProps = DEFAULT_PROPS$w;
9918
11437
 
9919
11438
  const INIT_STATE = {
9920
11439
  isLazy: true,
@@ -10041,7 +11560,7 @@ const useTabProviderContextState = () => {
10041
11560
  return context?.[0];
10042
11561
  };
10043
11562
 
10044
- const DEFAULT_PROPS$x = {
11563
+ const DEFAULT_PROPS$v = {
10045
11564
  isLazy: INIT_STATE.isLazy,
10046
11565
  shouldActivateOnFocus: INIT_STATE.shouldActivateOnFocus
10047
11566
  };
@@ -10070,7 +11589,7 @@ const ProgressTrackerProvider = props => {
10070
11589
  dispatch({
10071
11590
  type: 'update',
10072
11591
  payload: {
10073
- ...DEFAULT_PROPS$x,
11592
+ ...DEFAULT_PROPS$v,
10074
11593
  ...propState,
10075
11594
  activeTabIndex: propState.activeStepIndex || INIT_STATE.activeTabIndex
10076
11595
  }
@@ -10093,7 +11612,7 @@ const ProgressTrackerProvider = props => {
10093
11612
  children: children
10094
11613
  });
10095
11614
  };
10096
- ProgressTrackerProvider.defaultProps = DEFAULT_PROPS$x;
11615
+ ProgressTrackerProvider.defaultProps = DEFAULT_PROPS$v;
10097
11616
 
10098
11617
  const useRovingTabIndex = ({
10099
11618
  parentRef,
@@ -10185,7 +11704,7 @@ const {
10185
11704
  /**
10186
11705
  * Component default props.
10187
11706
  */
10188
- const DEFAULT_PROPS$w = {};
11707
+ const DEFAULT_PROPS$u = {};
10189
11708
 
10190
11709
  /**
10191
11710
  * ProgressTracker component.
@@ -10241,7 +11760,7 @@ const ProgressTracker = forwardRef((props, ref) => {
10241
11760
  });
10242
11761
  ProgressTracker.displayName = COMPONENT_NAME$v;
10243
11762
  ProgressTracker.className = CLASSNAME$v;
10244
- ProgressTracker.defaultProps = DEFAULT_PROPS$w;
11763
+ ProgressTracker.defaultProps = DEFAULT_PROPS$u;
10245
11764
 
10246
11765
  /**
10247
11766
  * Component display name.
@@ -10260,7 +11779,7 @@ const {
10260
11779
  /**
10261
11780
  * Component default props.
10262
11781
  */
10263
- const DEFAULT_PROPS$v = {};
11782
+ const DEFAULT_PROPS$t = {};
10264
11783
 
10265
11784
  /**
10266
11785
  * ProgressTrackerStep component.
@@ -10355,7 +11874,7 @@ const ProgressTrackerStep = forwardRef((props, ref) => {
10355
11874
  });
10356
11875
  ProgressTrackerStep.displayName = COMPONENT_NAME$u;
10357
11876
  ProgressTrackerStep.className = CLASSNAME$u;
10358
- ProgressTrackerStep.defaultProps = DEFAULT_PROPS$v;
11877
+ ProgressTrackerStep.defaultProps = DEFAULT_PROPS$t;
10359
11878
 
10360
11879
  /**
10361
11880
  * Component display name.
@@ -10373,7 +11892,7 @@ const {
10373
11892
  /**
10374
11893
  * Component default props.
10375
11894
  */
10376
- const DEFAULT_PROPS$u = {};
11895
+ const DEFAULT_PROPS$s = {};
10377
11896
 
10378
11897
  /**
10379
11898
  * ProgressTrackerStepPanel component.
@@ -10409,7 +11928,7 @@ const ProgressTrackerStepPanel = forwardRef((props, ref) => {
10409
11928
  });
10410
11929
  ProgressTrackerStepPanel.displayName = COMPONENT_NAME$t;
10411
11930
  ProgressTrackerStepPanel.className = CLASSNAME$t;
10412
- ProgressTrackerStepPanel.defaultProps = DEFAULT_PROPS$u;
11931
+ ProgressTrackerStepPanel.defaultProps = DEFAULT_PROPS$s;
10413
11932
 
10414
11933
  /**
10415
11934
  * Component display name.
@@ -10423,15 +11942,27 @@ const CLASSNAME$s = 'lumx-radio-button';
10423
11942
  const {
10424
11943
  block: block$p,
10425
11944
  element: element$h
10426
- } = bem(CLASSNAME$s);
11945
+ } = classNames.bem(CLASSNAME$s);
11946
+
11947
+ /**
11948
+ * Component default props.
11949
+ */
11950
+ const DEFAULT_PROPS$r = {};
10427
11951
 
10428
11952
  /**
10429
11953
  * RadioButton component.
10430
11954
  *
10431
11955
  * @param props Component props.
10432
- * @return JSX element.
11956
+ * @param ref Component ref.
11957
+ * @return React element.
10433
11958
  */
10434
- const RadioButton$1 = props => {
11959
+ const RadioButton = forwardRef((props, ref) => {
11960
+ const {
11961
+ isAnyDisabled,
11962
+ disabledStateProps,
11963
+ otherProps
11964
+ } = useDisableStateProps(props);
11965
+ const defaultTheme = useTheme() || Theme$1.light;
10435
11966
  const {
10436
11967
  checked,
10437
11968
  className,
@@ -10441,15 +11972,14 @@ const RadioButton$1 = props => {
10441
11972
  isChecked = checked,
10442
11973
  label,
10443
11974
  name,
10444
- ref,
10445
11975
  onChange,
10446
- theme,
11976
+ theme = defaultTheme,
10447
11977
  value,
10448
- inputProps = {},
10449
- isDisabled,
10450
- inputId,
11978
+ inputProps,
10451
11979
  ...forwardedProps
10452
- } = props;
11980
+ } = otherProps;
11981
+ const generatedInputId = useId();
11982
+ const inputId = id || generatedInputId;
10453
11983
  const handleChange = event => {
10454
11984
  if (onChange) {
10455
11985
  onChange(value, name, event);
@@ -10458,9 +11988,9 @@ const RadioButton$1 = props => {
10458
11988
  return /*#__PURE__*/jsxs("div", {
10459
11989
  ref: ref,
10460
11990
  ...forwardedProps,
10461
- className: classnames(className, block$p({
11991
+ className: classNames.join(className, block$p({
10462
11992
  'is-checked': isChecked,
10463
- 'is-disabled': isDisabled,
11993
+ 'is-disabled': isAnyDisabled,
10464
11994
  'is-unchecked': !isChecked,
10465
11995
  [`theme-${theme}`]: Boolean(theme)
10466
11996
  })),
@@ -10469,16 +11999,15 @@ const RadioButton$1 = props => {
10469
11999
  children: [/*#__PURE__*/jsx("input", {
10470
12000
  ref: inputRef,
10471
12001
  className: element$h('input-native'),
12002
+ ...disabledStateProps,
10472
12003
  id: inputId,
10473
12004
  type: "radio",
10474
12005
  name: name,
10475
12006
  value: value,
10476
12007
  checked: isChecked,
10477
12008
  onChange: handleChange,
12009
+ readOnly: inputProps?.readOnly || isAnyDisabled,
10478
12010
  "aria-describedby": helper ? `${inputId}-helper` : undefined,
10479
- ...(inputProps?.readOnly ? {
10480
- readOnly: inputProps.readOnly
10481
- } : {}),
10482
12011
  ...inputProps
10483
12012
  }), /*#__PURE__*/jsxs("div", {
10484
12013
  className: element$h('input-placeholder'),
@@ -10490,85 +12019,23 @@ const RadioButton$1 = props => {
10490
12019
  })]
10491
12020
  }), /*#__PURE__*/jsxs("div", {
10492
12021
  className: element$h('content'),
10493
- children: [label && InputLabel$1({
12022
+ children: [label && /*#__PURE__*/jsx(InputLabel, {
10494
12023
  htmlFor: inputId,
12024
+ theme: theme,
10495
12025
  className: element$h('label'),
10496
- theme,
10497
12026
  children: label
10498
- }), helper && InputHelper$1({
12027
+ }), helper && /*#__PURE__*/jsx(InputHelper, {
10499
12028
  id: `${inputId}-helper`,
12029
+ theme: theme,
10500
12030
  className: element$h('helper'),
10501
- theme,
10502
12031
  children: helper
10503
12032
  })]
10504
12033
  })]
10505
12034
  });
10506
- };
10507
-
10508
- /**
10509
- * Defines the props of the component.
10510
- */
10511
-
10512
- /**
10513
- * Component default props.
10514
- */
10515
- const DEFAULT_PROPS$t = {};
10516
-
10517
- /**
10518
- * RadioButton component.
10519
- *
10520
- * @param props Component props.
10521
- * @param ref Component ref.
10522
- * @return React element.
10523
- */
10524
- const RadioButton = forwardRef((props, ref) => {
10525
- const {
10526
- isAnyDisabled,
10527
- disabledStateProps,
10528
- otherProps
10529
- } = useDisableStateProps(props);
10530
- const defaultTheme = useTheme() || Theme$1.light;
10531
- const {
10532
- checked,
10533
- className,
10534
- helper,
10535
- id,
10536
- inputRef,
10537
- isChecked = checked,
10538
- label,
10539
- name,
10540
- onChange,
10541
- theme = defaultTheme,
10542
- value,
10543
- inputProps = {},
10544
- ...forwardedProps
10545
- } = otherProps;
10546
- const generatedInputId = useId();
10547
- const inputId = id || generatedInputId;
10548
- return RadioButton$1({
10549
- ref,
10550
- className,
10551
- helper,
10552
- inputRef,
10553
- isChecked,
10554
- label,
10555
- name,
10556
- onChange,
10557
- theme,
10558
- value,
10559
- inputProps: {
10560
- ...inputProps,
10561
- ...disabledStateProps,
10562
- readOnly: inputProps.readOnly || disabledStateProps['aria-disabled']
10563
- },
10564
- ...forwardedProps,
10565
- isDisabled: isAnyDisabled,
10566
- inputId
10567
- });
10568
12035
  });
10569
12036
  RadioButton.displayName = COMPONENT_NAME$s;
10570
12037
  RadioButton.className = CLASSNAME$s;
10571
- RadioButton.defaultProps = DEFAULT_PROPS$t;
12038
+ RadioButton.defaultProps = DEFAULT_PROPS$r;
10572
12039
 
10573
12040
  /**
10574
12041
  * Component display name.
@@ -10580,58 +12047,25 @@ const COMPONENT_NAME$r = 'RadioGroup';
10580
12047
  */
10581
12048
  const CLASSNAME$r = 'lumx-radio-group';
10582
12049
 
10583
- /**
10584
- * Component default props.
10585
- */
10586
- const DEFAULT_PROPS$s = {};
10587
-
10588
12050
  /**
10589
12051
  * RadioGroup component.
10590
12052
  *
10591
12053
  * @param props Component props.
10592
- * @return JSX element.
12054
+ * @param ref Component ref.
12055
+ * @return React element.
10593
12056
  */
10594
- const RadioGroup$1 = props => {
12057
+ const RadioGroup = forwardRef((props, ref) => {
10595
12058
  const {
10596
12059
  children,
10597
12060
  className,
10598
- ref,
10599
12061
  ...forwardedProps
10600
12062
  } = props;
10601
12063
  return /*#__PURE__*/jsx("div", {
10602
12064
  ref: ref,
10603
12065
  ...forwardedProps,
10604
- className: classnames(className, CLASSNAME$r),
12066
+ className: classNames.join(className, CLASSNAME$r),
10605
12067
  children: children
10606
12068
  });
10607
- };
10608
- RadioGroup$1.displayName = COMPONENT_NAME$r;
10609
- RadioGroup$1.className = CLASSNAME$r;
10610
- RadioGroup$1.defaultProps = DEFAULT_PROPS$s;
10611
-
10612
- /**
10613
- * Defines the props of the component.
10614
- */
10615
-
10616
- /**
10617
- * RadioGroup component.
10618
- *
10619
- * @param props Component props.
10620
- * @param ref Component ref.
10621
- * @return React element.
10622
- */
10623
- const RadioGroup = forwardRef((props, ref) => {
10624
- const {
10625
- children,
10626
- className,
10627
- ...forwardedProps
10628
- } = props;
10629
- return RadioGroup$1({
10630
- ref,
10631
- className,
10632
- children,
10633
- ...forwardedProps
10634
- });
10635
12069
  });
10636
12070
  RadioGroup.displayName = COMPONENT_NAME$r;
10637
12071
  RadioGroup.className = CLASSNAME$r;
@@ -10791,7 +12225,7 @@ const {
10791
12225
  } = classNames.bem(CLASSNAME$p);
10792
12226
 
10793
12227
  /** The default value of props. */
10794
- const DEFAULT_PROPS$r = {
12228
+ const DEFAULT_PROPS$q = {
10795
12229
  selectedValueRender: choice => choice,
10796
12230
  variant: SelectVariant.input
10797
12231
  };
@@ -10914,7 +12348,7 @@ const Select = forwardRef((props, ref) => {
10914
12348
  const isEmpty$1 = isEmpty(props.value);
10915
12349
  const hasInputClear = props.onClear && props.clearButtonProps && !isEmpty$1;
10916
12350
  return WithSelectContext(SelectField, {
10917
- ...DEFAULT_PROPS$r,
12351
+ ...DEFAULT_PROPS$q,
10918
12352
  ...props,
10919
12353
  className: classNames.join(props.className, block$n({
10920
12354
  'has-input-clear': hasInputClear,
@@ -10926,7 +12360,7 @@ const Select = forwardRef((props, ref) => {
10926
12360
  });
10927
12361
  Select.displayName = COMPONENT_NAME$q;
10928
12362
  Select.className = CLASSNAME$p;
10929
- Select.defaultProps = DEFAULT_PROPS$r;
12363
+ Select.defaultProps = DEFAULT_PROPS$q;
10930
12364
  Select.className = CLASSNAME$p;
10931
12365
 
10932
12366
  /** The display name of the component. */
@@ -10940,7 +12374,7 @@ const {
10940
12374
  } = classNames.bem(CLASSNAME$o);
10941
12375
 
10942
12376
  /** The default value of props. */
10943
- const DEFAULT_PROPS$q = {
12377
+ const DEFAULT_PROPS$p = {
10944
12378
  selectedChipRender(choice, index, onClear, isDisabled, theme) {
10945
12379
  const onClick = event => onClear && onClear(event, choice);
10946
12380
  return /*#__PURE__*/jsx(Chip, {
@@ -11066,7 +12500,7 @@ const SelectMultipleField = props => {
11066
12500
  */
11067
12501
  const SelectMultiple = forwardRef((props, ref) => {
11068
12502
  return WithSelectContext(SelectMultipleField, {
11069
- ...DEFAULT_PROPS$q,
12503
+ ...DEFAULT_PROPS$p,
11070
12504
  ...props,
11071
12505
  className: classNames.join(props.className, block$m({
11072
12506
  'has-multiple': !props.isEmpty
@@ -11077,7 +12511,7 @@ const SelectMultiple = forwardRef((props, ref) => {
11077
12511
  });
11078
12512
  SelectMultiple.displayName = COMPONENT_NAME$p;
11079
12513
  SelectMultiple.className = CLASSNAME$o;
11080
- SelectMultiple.defaultProps = DEFAULT_PROPS$q;
12514
+ SelectMultiple.defaultProps = DEFAULT_PROPS$p;
11081
12515
 
11082
12516
  /**
11083
12517
  * Component display name.
@@ -11132,7 +12566,7 @@ const {
11132
12566
  /**
11133
12567
  * Component default props.
11134
12568
  */
11135
- const DEFAULT_PROPS$p = {
12569
+ const DEFAULT_PROPS$o = {
11136
12570
  emphasis: Emphasis$1.high,
11137
12571
  closeMode: 'unmount'
11138
12572
  };
@@ -11148,7 +12582,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
11148
12582
  const {
11149
12583
  children,
11150
12584
  className,
11151
- emphasis = DEFAULT_PROPS$p.emphasis,
12585
+ emphasis = DEFAULT_PROPS$o.emphasis,
11152
12586
  icon,
11153
12587
  isOpen,
11154
12588
  isSelected,
@@ -11158,7 +12592,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
11158
12592
  onActionClick,
11159
12593
  onClick,
11160
12594
  toggleButtonProps,
11161
- closeMode = DEFAULT_PROPS$p.closeMode,
12595
+ closeMode = DEFAULT_PROPS$o.closeMode,
11162
12596
  ...forwardedProps
11163
12597
  } = props;
11164
12598
  const content = children && Children.toArray(children).filter(isComponent(SideNavigationItem));
@@ -11229,9 +12663,9 @@ const SideNavigationItem = forwardRef((props, ref) => {
11229
12663
  });
11230
12664
  SideNavigationItem.displayName = COMPONENT_NAME$n;
11231
12665
  SideNavigationItem.className = CLASSNAME$m;
11232
- SideNavigationItem.defaultProps = DEFAULT_PROPS$p;
12666
+ SideNavigationItem.defaultProps = DEFAULT_PROPS$o;
11233
12667
 
11234
- const DEFAULT_PROPS$o = {};
12668
+ const DEFAULT_PROPS$n = {};
11235
12669
 
11236
12670
  /**
11237
12671
  * Component display name.
@@ -11273,7 +12707,7 @@ const SkeletonCircle = forwardRef((props, ref) => {
11273
12707
  });
11274
12708
  });
11275
12709
  SkeletonCircle.displayName = COMPONENT_NAME$m;
11276
- SkeletonCircle.defaultProps = DEFAULT_PROPS$o;
12710
+ SkeletonCircle.defaultProps = DEFAULT_PROPS$n;
11277
12711
  SkeletonCircle.className = CLASSNAME$l;
11278
12712
 
11279
12713
  const SkeletonRectangleVariant = {
@@ -11286,7 +12720,7 @@ const SkeletonRectangleVariant = {
11286
12720
  * Defines the props of the component.
11287
12721
  */
11288
12722
 
11289
- const DEFAULT_PROPS$n = {
12723
+ const DEFAULT_PROPS$m = {
11290
12724
  variant: SkeletonRectangleVariant.squared
11291
12725
  };
11292
12726
 
@@ -11318,7 +12752,7 @@ const SkeletonRectangle = forwardRef((props, ref) => {
11318
12752
  className,
11319
12753
  height,
11320
12754
  theme = defaultTheme,
11321
- variant = DEFAULT_PROPS$n.variant,
12755
+ variant = DEFAULT_PROPS$m.variant,
11322
12756
  width,
11323
12757
  color,
11324
12758
  ...forwardedProps
@@ -11341,9 +12775,9 @@ const SkeletonRectangle = forwardRef((props, ref) => {
11341
12775
  });
11342
12776
  SkeletonRectangle.displayName = COMPONENT_NAME$l;
11343
12777
  SkeletonRectangle.className = CLASSNAME$k;
11344
- SkeletonRectangle.defaultProps = DEFAULT_PROPS$n;
12778
+ SkeletonRectangle.defaultProps = DEFAULT_PROPS$m;
11345
12779
 
11346
- const DEFAULT_PROPS$m = {};
12780
+ const DEFAULT_PROPS$l = {};
11347
12781
 
11348
12782
  /**
11349
12783
  * Component display name.
@@ -11394,7 +12828,7 @@ const SkeletonTypography = forwardRef((props, ref) => {
11394
12828
  });
11395
12829
  });
11396
12830
  SkeletonTypography.displayName = COMPONENT_NAME$k;
11397
- SkeletonTypography.defaultProps = DEFAULT_PROPS$m;
12831
+ SkeletonTypography.defaultProps = DEFAULT_PROPS$l;
11398
12832
  SkeletonTypography.className = CLASSNAME$j;
11399
12833
 
11400
12834
  const useEnhancedEffect = typeof window !== 'undefined' ? React__default.useLayoutEffect : React__default.useEffect;
@@ -11449,7 +12883,7 @@ const {
11449
12883
  /**
11450
12884
  * Component default props.
11451
12885
  */
11452
- const DEFAULT_PROPS$l = {
12886
+ const DEFAULT_PROPS$k = {
11453
12887
  precision: 0,
11454
12888
  steps: 0
11455
12889
  };
@@ -11500,8 +12934,8 @@ const Slider = forwardRef((props, ref) => {
11500
12934
  name,
11501
12935
  onChange,
11502
12936
  onMouseDown,
11503
- precision = DEFAULT_PROPS$l.precision,
11504
- steps = DEFAULT_PROPS$l.steps,
12937
+ precision = DEFAULT_PROPS$k.precision,
12938
+ steps = DEFAULT_PROPS$k.steps,
11505
12939
  theme = defaultTheme,
11506
12940
  value,
11507
12941
  ...forwardedProps
@@ -11704,7 +13138,7 @@ const Slider = forwardRef((props, ref) => {
11704
13138
  });
11705
13139
  Slider.displayName = COMPONENT_NAME$j;
11706
13140
  Slider.className = CLASSNAME$i;
11707
- Slider.defaultProps = DEFAULT_PROPS$l;
13141
+ Slider.defaultProps = DEFAULT_PROPS$k;
11708
13142
 
11709
13143
  /**
11710
13144
  * Making setInterval Declarative with React Hooks.
@@ -12082,7 +13516,7 @@ SlideshowItemGroup.className = CLASSNAME$h;
12082
13516
  /**
12083
13517
  * Component default props.
12084
13518
  */
12085
- const DEFAULT_PROPS$k = {
13519
+ const DEFAULT_PROPS$j = {
12086
13520
  ...DEFAULT_OPTIONS,
12087
13521
  slideMode: SlideMode.transformTranslate
12088
13522
  };
@@ -12098,19 +13532,19 @@ const Slideshow = forwardRef((props, ref) => {
12098
13532
  const defaultTheme = useTheme() || Theme$1.light;
12099
13533
  const {
12100
13534
  activeIndex,
12101
- autoPlay = DEFAULT_PROPS$k.autoPlay,
13535
+ autoPlay = DEFAULT_PROPS$j.autoPlay,
12102
13536
  children,
12103
13537
  className,
12104
13538
  fillHeight,
12105
13539
  groupBy = DEFAULT_OPTIONS.groupBy,
12106
- interval = DEFAULT_PROPS$k.interval,
13540
+ interval = DEFAULT_PROPS$j.interval,
12107
13541
  onChange,
12108
13542
  slideshowControlsProps,
12109
13543
  theme = defaultTheme,
12110
13544
  id,
12111
13545
  slidesId,
12112
13546
  slideGroupLabel,
12113
- slideMode = DEFAULT_PROPS$k.slideMode,
13547
+ slideMode = DEFAULT_PROPS$j.slideMode,
12114
13548
  ...forwardedProps
12115
13549
  } = props;
12116
13550
  // Number of slideshow items.
@@ -12132,7 +13566,7 @@ const Slideshow = forwardRef((props, ref) => {
12132
13566
  toggleForcePause
12133
13567
  } = SlideshowControls.useSlideshowControls({
12134
13568
  activeIndex,
12135
- defaultActiveIndex: DEFAULT_PROPS$k.activeIndex,
13569
+ defaultActiveIndex: DEFAULT_PROPS$j.activeIndex,
12136
13570
  autoPlay: Boolean(autoPlay),
12137
13571
  itemsCount,
12138
13572
  groupBy,
@@ -12202,7 +13636,7 @@ const Slideshow = forwardRef((props, ref) => {
12202
13636
  });
12203
13637
  });
12204
13638
  Slideshow.displayName = 'Slideshow';
12205
- Slideshow.defaultProps = DEFAULT_PROPS$k;
13639
+ Slideshow.defaultProps = DEFAULT_PROPS$j;
12206
13640
 
12207
13641
  /**
12208
13642
  * Component display name.
@@ -12311,7 +13745,7 @@ const {
12311
13745
  /**
12312
13746
  * Component default props.
12313
13747
  */
12314
- const DEFAULT_PROPS$j = {
13748
+ const DEFAULT_PROPS$i = {
12315
13749
  activeIndex: 0
12316
13750
  };
12317
13751
 
@@ -12325,7 +13759,7 @@ const DEFAULT_PROPS$j = {
12325
13759
  const InternalSlideshowControls = forwardRef((props, ref) => {
12326
13760
  const defaultTheme = useTheme() || Theme$1.light;
12327
13761
  const {
12328
- activeIndex = DEFAULT_PROPS$j.activeIndex,
13762
+ activeIndex = DEFAULT_PROPS$i.activeIndex,
12329
13763
  className,
12330
13764
  nextButtonProps,
12331
13765
  onNextClick,
@@ -12440,7 +13874,7 @@ const InternalSlideshowControls = forwardRef((props, ref) => {
12440
13874
  });
12441
13875
  InternalSlideshowControls.displayName = COMPONENT_NAME$g;
12442
13876
  InternalSlideshowControls.className = CLASSNAME$f;
12443
- InternalSlideshowControls.defaultProps = DEFAULT_PROPS$j;
13877
+ InternalSlideshowControls.defaultProps = DEFAULT_PROPS$i;
12444
13878
  const SlideshowControls = Object.assign(InternalSlideshowControls, {
12445
13879
  useSlideshowControls,
12446
13880
  useSlideshowControlsDefaultOptions: DEFAULT_OPTIONS
@@ -12572,7 +14006,7 @@ const {
12572
14006
  /**
12573
14007
  * Component default props.
12574
14008
  */
12575
- const DEFAULT_PROPS$i = {
14009
+ const DEFAULT_PROPS$h = {
12576
14010
  slideMode: SlideMode.transformTranslate
12577
14011
  };
12578
14012
 
@@ -12599,7 +14033,7 @@ const Slides = forwardRef((props, ref) => {
12599
14033
  afterSlides,
12600
14034
  hasControls,
12601
14035
  slideGroupLabel,
12602
- slideMode = DEFAULT_PROPS$i.slideMode,
14036
+ slideMode = DEFAULT_PROPS$h.slideMode,
12603
14037
  onChange,
12604
14038
  ...forwardedProps
12605
14039
  } = props;
@@ -12681,41 +14115,46 @@ const CLASSNAME$d = 'lumx-switch';
12681
14115
  const {
12682
14116
  block: block$e,
12683
14117
  element: element$7
12684
- } = bem(CLASSNAME$d);
14118
+ } = classNames.bem(CLASSNAME$d);
12685
14119
 
12686
14120
  /**
12687
14121
  * Component default props.
12688
14122
  */
12689
- const DEFAULT_PROPS$h = {
12690
- position: 'left'
14123
+ const DEFAULT_PROPS$g = {
14124
+ position: Alignment.left
12691
14125
  };
12692
14126
 
12693
14127
  /**
12694
14128
  * Switch component.
12695
14129
  *
12696
14130
  * @param props Component props.
12697
- * @return JSX element.
14131
+ * @param ref Component ref.
14132
+ * @return React element.
12698
14133
  */
12699
- const Switch$1 = props => {
14134
+ const Switch = forwardRef((props, ref) => {
14135
+ const {
14136
+ isAnyDisabled,
14137
+ disabledStateProps,
14138
+ otherProps
14139
+ } = useDisableStateProps(props);
14140
+ const defaultTheme = useTheme() || Theme$1.light;
12700
14141
  const {
12701
14142
  checked,
14143
+ children,
12702
14144
  className,
12703
14145
  helper,
12704
14146
  id,
12705
- inputRef,
12706
14147
  isChecked = checked,
12707
- label,
12708
14148
  name,
12709
- ref,
12710
14149
  onChange,
12711
- theme,
14150
+ position = DEFAULT_PROPS$g.position,
14151
+ theme = defaultTheme,
12712
14152
  value,
12713
14153
  inputProps = {},
12714
- isDisabled,
12715
- inputId,
12716
- position = DEFAULT_PROPS$h.position,
12717
14154
  ...forwardedProps
12718
- } = props;
14155
+ } = otherProps;
14156
+ const generatedInputId = useId();
14157
+ const inputId = id || generatedInputId;
12719
14158
  const handleChange = event => {
12720
14159
  if (onChange) {
12721
14160
  onChange(!isChecked, value, name, event);
@@ -12724,30 +14163,28 @@ const Switch$1 = props => {
12724
14163
  return /*#__PURE__*/jsxs("div", {
12725
14164
  ref: ref,
12726
14165
  ...forwardedProps,
12727
- className: classnames(className, block$e({
14166
+ className: classNames.join(className, block$e({
12728
14167
  'is-checked': isChecked,
12729
- 'is-disabled': isDisabled,
12730
- 'is-unchecked': !isChecked,
14168
+ 'is-disabled': isAnyDisabled,
12731
14169
  [`position-${position}`]: Boolean(position),
12732
- [`theme-${theme}`]: Boolean(theme)
14170
+ [`theme-${theme}`]: Boolean(theme),
14171
+ 'is-unchecked': !isChecked
12733
14172
  })),
12734
14173
  children: [/*#__PURE__*/jsxs("div", {
12735
14174
  className: element$7('input-wrapper'),
12736
14175
  children: [/*#__PURE__*/jsx("input", {
12737
- ref: inputRef,
12738
14176
  type: "checkbox",
12739
14177
  role: "switch",
12740
14178
  id: inputId,
12741
14179
  className: element$7('input-native'),
12742
14180
  name: name,
12743
14181
  value: value,
12744
- checked: Boolean(isChecked),
14182
+ ...disabledStateProps,
14183
+ readOnly: inputProps.readOnly || isAnyDisabled,
14184
+ checked: isChecked,
14185
+ "aria-checked": Boolean(isChecked),
12745
14186
  onChange: handleChange,
12746
14187
  "aria-describedby": helper ? `${inputId}-helper` : undefined,
12747
- "aria-checked": Boolean(isChecked),
12748
- ...(inputProps?.readOnly ? {
12749
- readOnly: inputProps.readOnly
12750
- } : {}),
12751
14188
  ...inputProps
12752
14189
  }), /*#__PURE__*/jsxs("div", {
12753
14190
  className: element$7('input-placeholder'),
@@ -12757,88 +14194,21 @@ const Switch$1 = props => {
12757
14194
  className: element$7('input-indicator')
12758
14195
  })]
12759
14196
  })]
12760
- }), /*#__PURE__*/jsxs("div", {
14197
+ }), Children.count(children) > 0 && /*#__PURE__*/jsxs("div", {
12761
14198
  className: element$7('content'),
12762
- children: [label && InputLabel$1({
14199
+ children: [/*#__PURE__*/jsx(InputLabel, {
12763
14200
  htmlFor: inputId,
14201
+ theme: theme,
12764
14202
  className: element$7('label'),
12765
- theme,
12766
- children: label
12767
- }), helper && InputHelper$1({
14203
+ children: children
14204
+ }), !isEmpty(helper) && /*#__PURE__*/jsx(InputHelper, {
12768
14205
  id: `${inputId}-helper`,
14206
+ theme: theme,
12769
14207
  className: element$7('helper'),
12770
- theme,
12771
14208
  children: helper
12772
14209
  })]
12773
14210
  })]
12774
14211
  });
12775
- };
12776
-
12777
- /**
12778
- * Defines the props of the component.
12779
- */
12780
-
12781
- /**
12782
- * Component default props.
12783
- */
12784
- const DEFAULT_PROPS$g = {
12785
- position: Alignment.left
12786
- };
12787
-
12788
- /**
12789
- * Switch component.
12790
- *
12791
- * @param props Component props.
12792
- * @param ref Component ref.
12793
- * @return React element.
12794
- */
12795
- const Switch = forwardRef((props, ref) => {
12796
- const {
12797
- isAnyDisabled,
12798
- disabledStateProps,
12799
- otherProps
12800
- } = useDisableStateProps(props);
12801
- const defaultTheme = useTheme() || Theme$1.light;
12802
- const {
12803
- checked,
12804
- children,
12805
- className,
12806
- helper,
12807
- id,
12808
- inputRef,
12809
- isChecked = checked,
12810
- name,
12811
- onChange,
12812
- position = DEFAULT_PROPS$g.position,
12813
- theme = defaultTheme,
12814
- value,
12815
- inputProps = {},
12816
- ...forwardedProps
12817
- } = otherProps;
12818
- const localInputRef = React__default.useRef(null);
12819
- const generatedInputId = useId();
12820
- const inputId = id || generatedInputId;
12821
- return Switch$1({
12822
- ref,
12823
- className,
12824
- helper,
12825
- inputRef: useMergeRefs(inputRef, localInputRef),
12826
- isChecked,
12827
- label: children,
12828
- name,
12829
- onChange,
12830
- position,
12831
- theme,
12832
- value,
12833
- inputProps: {
12834
- ...inputProps,
12835
- ...disabledStateProps,
12836
- readOnly: inputProps.readOnly || isAnyDisabled
12837
- },
12838
- ...forwardedProps,
12839
- isDisabled: isAnyDisabled,
12840
- inputId
12841
- });
12842
14212
  });
12843
14213
  Switch.displayName = COMPONENT_NAME$e;
12844
14214
  Switch.className = CLASSNAME$d;
@@ -14793,5 +16163,5 @@ UserBlock.displayName = COMPONENT_NAME;
14793
16163
  UserBlock.className = CLASSNAME;
14794
16164
  UserBlock.defaultProps = DEFAULT_PROPS;
14795
16165
 
14796
- export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonGroup, CLASSNAME$1d as CLASSNAME, COMPONENT_NAME$1e as COMPONENT_NAME, Checkbox, Chip, ChipGroup, CommentBlock, CommentBlockVariant, DEFAULT_PROPS$13 as DEFAULT_PROPS, DatePicker, DatePickerControlled, DatePickerField, Dialog, Divider, DragHandle, Dropdown, ExpansionPanel, Flag, FlexBox, GenericBlock, GenericBlockGapSize, Grid, GridColumn, GridItem, Heading, HeadingLevelProvider, Icon, IconButton, ImageBlock, ImageBlockCaptionPosition, ImageLightbox, InlineList, InputHelper, InputLabel, Lightbox, Link, LinkPreview, List, ListDivider, ListItem, ListSubheader, Message, Mosaic, Navigation, Notification, Placement, Popover, PopoverDialog, PostBlock, Progress, ProgressCircular, ProgressLinear, ProgressTracker, ProgressTrackerProvider, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressVariant, RadioButton, RadioGroup, RawInputText, RawInputTextarea, Select, SelectMultiple, SelectMultipleField, SelectVariant, SelectionChipGroup, SideNavigation, SideNavigationItem, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableHeader, TableRow, Text, TextField, ThOrder, ThemeProvider, Thumbnail, ThumbnailAspectRatio, ThumbnailObjectFit, ThumbnailVariant, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, isClickable, useFocusPointStyle, useHeadingLevel, useTheme };
16166
+ export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonGroup, CLASSNAME$1g as CLASSNAME, COMPONENT_NAME$1e as COMPONENT_NAME, Checkbox, Chip, ChipGroup, Combobox, CommentBlock, CommentBlockVariant, DEFAULT_PROPS$11 as DEFAULT_PROPS, DatePicker, DatePickerControlled, DatePickerField, Dialog, Divider, DragHandle, Dropdown, ExpansionPanel, Flag, FlexBox, GenericBlock, GenericBlockGapSize, Grid, GridColumn, GridItem, Heading, HeadingLevelProvider, Icon, IconButton, ImageBlock, ImageBlockCaptionPosition, ImageLightbox, InlineList, InputHelper, InputLabel, Lightbox, Link, LinkPreview, List, ListDivider, ListItem, ListSubheader, Message, Mosaic, Navigation, Notification, Placement, Popover, PopoverDialog, PostBlock, Progress, ProgressCircular, ProgressLinear, ProgressTracker, ProgressTrackerProvider, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressVariant, RadioButton, RadioGroup, RawInputText, RawInputTextarea, SUB_COMPONENTS, Select, SelectMultiple, SelectMultipleField, SelectVariant, SelectionChipGroup, SideNavigation, SideNavigationItem, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableHeader, TableRow, Text, TextField, ThOrder, ThemeProvider, Thumbnail, ThumbnailAspectRatio, ThumbnailObjectFit, ThumbnailVariant, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, isClickable, useFocusPointStyle, useHeadingLevel, useTheme };
14797
16167
  //# sourceMappingURL=index.js.map