@innovaccer/design-system 2.28.2 → 2.29.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/css/dist/index.css +245 -0
  3. package/css/dist/index.css.map +1 -1
  4. package/css/src/components/avatarSelection.css +111 -0
  5. package/css/src/components/select.css +127 -0
  6. package/dist/.lib/tsconfig.type.tsbuildinfo +669 -22
  7. package/dist/core/common.type.d.ts +7 -0
  8. package/dist/core/components/atoms/avatar/Avatar.d.ts +1 -0
  9. package/dist/core/components/atoms/avatar/avatarIcon/AvatarIcon.d.ts +0 -4
  10. package/dist/core/components/atoms/avatarSelection/AvatarSelection.d.ts +59 -0
  11. package/dist/core/components/atoms/avatarSelection/AvatarSelectionContext.d.ts +19 -0
  12. package/dist/core/components/atoms/avatarSelection/avatarPopover/AvatarSelectionEmptyState.d.ts +8 -0
  13. package/dist/core/components/atoms/avatarSelection/avatarPopover/AvatarSelectionInput.d.ts +3 -0
  14. package/dist/core/components/atoms/avatarSelection/avatarPopover/AvatarSelectionList.d.ts +20 -0
  15. package/dist/core/components/atoms/avatarSelection/avatarPopover/AvatarSelectionOption.d.ts +15 -0
  16. package/dist/core/components/atoms/avatarSelection/avatarPopover/AvatarSelectionPopover.d.ts +15 -0
  17. package/dist/core/components/atoms/avatarSelection/avatarPopover/index.d.ts +5 -0
  18. package/dist/core/components/atoms/avatarSelection/avatarPopover/utils.d.ts +3 -0
  19. package/dist/core/components/atoms/avatarSelection/avatarsSelection/AvatarSelectionCount.d.ts +13 -0
  20. package/dist/core/components/atoms/avatarSelection/avatarsSelection/SelectionAvatar.d.ts +15 -0
  21. package/dist/core/components/atoms/avatarSelection/avatarsSelection/SelectionAvatarsWrapper.d.ts +15 -0
  22. package/dist/core/components/atoms/avatarSelection/avatarsSelection/index.d.ts +2 -0
  23. package/dist/core/components/atoms/avatarSelection/avatarsSelection/utils.d.ts +3 -0
  24. package/dist/core/components/atoms/avatarSelection/index.d.ts +2 -0
  25. package/dist/core/components/atoms/popperWrapper/PopperWrapper.d.ts +19 -19
  26. package/dist/core/components/molecules/popover/Popover.d.ts +1 -1
  27. package/dist/core/components/molecules/tooltip/Tooltip.d.ts +2 -0
  28. package/dist/core/components/organisms/combobox/Combobox.d.ts +45 -0
  29. package/dist/core/components/organisms/combobox/ComboboxContext.d.ts +23 -0
  30. package/dist/core/components/organisms/combobox/ComboboxList.d.ts +20 -0
  31. package/dist/core/components/organisms/combobox/ComboboxOption.d.ts +18 -0
  32. package/dist/core/components/organisms/combobox/index.d.ts +2 -0
  33. package/dist/core/components/organisms/combobox/trigger/ChipInputBox.d.ts +3 -0
  34. package/dist/core/components/organisms/combobox/trigger/ComboboxTrigger.d.ts +20 -0
  35. package/dist/core/components/organisms/combobox/trigger/InputBox.d.ts +3 -0
  36. package/dist/core/components/organisms/combobox/trigger/MultiselectTrigger.d.ts +40 -0
  37. package/dist/core/components/organisms/combobox/trigger/index.d.ts +1 -0
  38. package/dist/core/components/organisms/combobox/trigger/utils.d.ts +3 -0
  39. package/dist/core/components/organisms/combobox/utils.d.ts +2 -0
  40. package/dist/core/components/organisms/listbox/Listbox.d.ts +2 -2
  41. package/dist/core/components/organisms/listbox/listboxItem/ListboxItem.d.ts +2 -1
  42. package/dist/core/components/organisms/select/SearchInput.d.ts +8 -0
  43. package/dist/core/components/organisms/select/Select.d.ts +35 -0
  44. package/dist/core/components/organisms/select/SelectContext.d.ts +24 -0
  45. package/dist/core/components/organisms/select/SelectEmptyTemplate.d.ts +9 -0
  46. package/dist/core/components/organisms/select/SelectFooter.d.ts +7 -0
  47. package/dist/core/components/organisms/select/SelectList.d.ts +20 -0
  48. package/dist/core/components/organisms/select/SelectOption.d.ts +19 -0
  49. package/dist/core/components/organisms/select/SelectTrigger.d.ts +24 -0
  50. package/dist/core/components/organisms/select/__test__/Select.test.d.ts +1 -0
  51. package/dist/core/components/organisms/select/__test__/utils.test.d.ts +1 -0
  52. package/dist/core/components/organisms/select/index.d.ts +2 -0
  53. package/dist/core/components/organisms/select/utils.d.ts +12 -0
  54. package/dist/core/index.d.ts +3 -0
  55. package/dist/core/index.type.d.ts +5 -0
  56. package/dist/index.esm.js +2147 -108
  57. package/dist/index.js +2011 -17
  58. package/dist/index.js.map +1 -1
  59. package/dist/index.umd.js +1 -1
  60. package/dist/index.umd.js.br +0 -0
  61. package/dist/index.umd.js.gz +0 -0
  62. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /**
3
- * Generated on: 1709017853977
3
+ * Generated on: 1710344054629
4
4
  * Package: @innovaccer/design-system
5
- * Version: v2.28.2
5
+ * Version: v2.29.0
6
6
  * License: MIT
7
7
  * Docs: https://innovaccer.github.io/design-system
8
8
  */
@@ -905,7 +905,9 @@ var Avatar = function Avatar(props) {
905
905
  lastName = props.lastName,
906
906
  className = props.className,
907
907
  appearance = props.appearance,
908
- shape = props.shape;
908
+ shape = props.shape,
909
+ _props$role = props.role,
910
+ role = _props$role === void 0 ? 'presentation' : _props$role;
909
911
  var baseProps = extractBaseProps(props);
910
912
  var initials = children && typeof children === 'string' ? children.trim().slice(0, initialsLength) : "".concat(firstName ? firstName.trim()[0] : '').concat(lastName ? lastName.trim()[0] : '');
911
913
  var tooltip = children && typeof children === 'string' ? children : "".concat(firstName || '', " ").concat(lastName || '') || '';
@@ -913,7 +915,7 @@ var Avatar = function Avatar(props) {
913
915
  var AvatarClassNames = classnames((_classNames = {
914
916
  Avatar: true
915
917
  }, _defineProperty$1(_classNames, 'Avatar--square', shape === 'square'), _defineProperty$1(_classNames, "Avatar--".concat(size), shape !== 'square'), _defineProperty$1(_classNames, "Avatar--".concat(AvatarAppearance), AvatarAppearance), _defineProperty$1(_classNames, 'Avatar--disabled', !initials || !withTooltip), _classNames), className);
916
- var AvatarWrapperClassNames = classnames((_classNames2 = {}, _defineProperty$1(_classNames2, 'Avatar--wrapper', shape === 'square'), _defineProperty$1(_classNames2, "Avatar--".concat(size), shape === 'square'), _classNames2), className);
918
+ var AvatarWrapperClassNames = classnames((_classNames2 = {}, _defineProperty$1(_classNames2, 'Avatar--wrapper', shape === 'square'), _defineProperty$1(_classNames2, "Avatar--".concat(size), shape === 'square'), _classNames2));
917
919
  var TextClassNames = classnames((_classNames3 = {}, _defineProperty$1(_classNames3, "Avatar-content--".concat(size), size), _defineProperty$1(_classNames3, "Avatar-content--".concat(AvatarAppearance), AvatarAppearance), _classNames3));
918
920
  var IconClassNames = classnames(_defineProperty$1({}, "Avatar-content--".concat(AvatarAppearance), AvatarAppearance));
919
921
  var sharedProp = {
@@ -927,7 +929,8 @@ var Avatar = function Avatar(props) {
927
929
  if (children && typeof children !== 'string') {
928
930
  return /*#__PURE__*/React.createElement("span", {
929
931
  "data-test": "DesignSystem-AvatarWrapper",
930
- className: AvatarWrapperClassNames
932
+ className: AvatarWrapperClassNames,
933
+ role: role
931
934
  }, /*#__PURE__*/React.createElement(AvatarProvider, {
932
935
  value: sharedProp
933
936
  }, /*#__PURE__*/React.createElement("span", _extends$2({
@@ -939,7 +942,8 @@ var Avatar = function Avatar(props) {
939
942
 
940
943
  return /*#__PURE__*/React.createElement("span", {
941
944
  "data-test": "DesignSystem-AvatarWrapper",
942
- className: AvatarWrapperClassNames
945
+ className: AvatarWrapperClassNames,
946
+ role: role
943
947
  }, /*#__PURE__*/React.createElement("span", _extends$2({
944
948
  "data-test": "DesignSystem-Avatar"
945
949
  }, baseProps, {
@@ -1354,7 +1358,7 @@ var Breadcrumbs = function Breadcrumbs(props) {
1354
1358
  })));
1355
1359
  };
1356
1360
 
1357
- var _excluded$G = ["size", "appearance", "iconAlign", "tabIndex", "largeIcon", "type", "children", "icon", "expanded", "selected", "loading", "disabled", "className", "tooltip", "iconType"];
1361
+ var _excluded$R = ["size", "appearance", "iconAlign", "tabIndex", "largeIcon", "type", "children", "icon", "expanded", "selected", "loading", "disabled", "className", "tooltip", "iconType"];
1358
1362
  var sizeMapping$3 = {
1359
1363
  tiny: 12,
1360
1364
  regular: 16,
@@ -1383,7 +1387,7 @@ var ButtonElement = /*#__PURE__*/React.forwardRef(function (props, ref) {
1383
1387
  className = props.className;
1384
1388
  props.tooltip;
1385
1389
  var iconType = props.iconType,
1386
- rest = _objectWithoutProperties(props, _excluded$G);
1390
+ rest = _objectWithoutProperties(props, _excluded$R);
1387
1391
 
1388
1392
  var buttonClass = classnames((_classNames = {}, _defineProperty$1(_classNames, 'Button', true), _defineProperty$1(_classNames, 'Button--expanded', expanded), _defineProperty$1(_classNames, "Button--".concat(size), size), _defineProperty$1(_classNames, "Button--".concat(size, "Square"), !children), _defineProperty$1(_classNames, "Button--".concat(appearance), appearance), _defineProperty$1(_classNames, 'Button--selected', selected && (appearance === 'basic' || appearance === 'transparent')), _defineProperty$1(_classNames, "Button--iconAlign-".concat(iconAlign), children && iconAlign), _defineProperty$1(_classNames, "".concat(className), className), _classNames));
1389
1393
  var iconClass = classnames((_classNames2 = {}, _defineProperty$1(_classNames2, 'Button-icon', true), _defineProperty$1(_classNames2, "Button-icon--".concat(iconAlign), children && iconAlign), _classNames2));
@@ -2237,7 +2241,9 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
2237
2241
  var prevYear = yearNavVal;
2238
2242
  var prevMonthDayRange = getDaysInMonth(prevYear, prevMonth);
2239
2243
  var dayRange = getDaysInMonth(yearNavVal, monthNavVal);
2240
- var dayDiff = getFirstDayOfMonth(yearNavVal, monthNavVal) - getIndexOfDay(firstDayOfWeek);
2244
+ var firstDayIndex = getFirstDayOfMonth(yearNavVal, monthNavVal);
2245
+ var desiredFirstDayIndex = getIndexOfDay(firstDayOfWeek);
2246
+ var dayDiff = (firstDayIndex - desiredFirstDayIndex + 7) % 7;
2241
2247
  var dummyDays = Math.abs(dayDiff);
2242
2248
  var noOfRows = Math.ceil((dayRange + dummyDays) / daysInRow); // if(noOfRows !== 6 && monthsInView <= 1) ?
2243
2249
 
@@ -2692,7 +2698,7 @@ _defineProperty$1(Calendar, "defaultProps", {
2692
2698
  jumpView: true
2693
2699
  });
2694
2700
 
2695
- var _excluded$F = ["shadow", "children", "className"];
2701
+ var _excluded$Q = ["shadow", "children", "className"];
2696
2702
  var Card = /*#__PURE__*/React.forwardRef(function (props, ref) {
2697
2703
  var _classNames;
2698
2704
 
@@ -2700,7 +2706,7 @@ var Card = /*#__PURE__*/React.forwardRef(function (props, ref) {
2700
2706
  shadow = _props$shadow === void 0 ? 'shadow10' : _props$shadow,
2701
2707
  children = props.children,
2702
2708
  className = props.className,
2703
- rest = _objectWithoutProperties(props, _excluded$F);
2709
+ rest = _objectWithoutProperties(props, _excluded$Q);
2704
2710
 
2705
2711
  var classes = classnames((_classNames = {
2706
2712
  Card: true
@@ -2717,12 +2723,12 @@ Card.defaultProps = {
2717
2723
  shadow: 'shadow10'
2718
2724
  };
2719
2725
 
2720
- var _excluded$E = ["border", "children", "className"];
2726
+ var _excluded$P = ["border", "children", "className"];
2721
2727
  var CardSubdued = /*#__PURE__*/React.forwardRef(function (props, ref) {
2722
2728
  var border = props.border,
2723
2729
  children = props.children,
2724
2730
  className = props.className,
2725
- rest = _objectWithoutProperties(props, _excluded$E);
2731
+ rest = _objectWithoutProperties(props, _excluded$P);
2726
2732
 
2727
2733
  var classes = classnames(_defineProperty$1({
2728
2734
  CardSubdued: true
@@ -2789,7 +2795,7 @@ var isSpaceKey = function isSpaceKey(e) {
2789
2795
  return e.key === 'Space';
2790
2796
  };
2791
2797
 
2792
- var _excluded$D = ["onClick", "onKeyDown", "role", "tabIndex"];
2798
+ var _excluded$O = ["onClick", "onKeyDown", "role", "tabIndex"];
2793
2799
  var allowed = {
2794
2800
  button: new Set(['Enter', 'Space', 'Spacebar', ' ']),
2795
2801
  link: new Set(['Enter']),
@@ -2813,7 +2819,7 @@ var useAccessibilityProps = function useAccessibilityProps(_ref) {
2813
2819
  _ref$role = _ref.role,
2814
2820
  role = _ref$role === void 0 ? 'button' : _ref$role,
2815
2821
  tabIndex = _ref.tabIndex,
2816
- rest = _objectWithoutProperties(_ref, _excluded$D);
2822
+ rest = _objectWithoutProperties(_ref, _excluded$O);
2817
2823
 
2818
2824
  return _objectSpread2({}, onClick ? {
2819
2825
  onClick: onClick,
@@ -2931,21 +2937,21 @@ Icon.defaultProps = {
2931
2937
  size: 16
2932
2938
  };
2933
2939
 
2934
- var _excluded$C = ["children", "componentType", "className"];
2940
+ var _excluded$N = ["children", "componentType", "className"];
2935
2941
 
2936
2942
  var GenericText = function GenericText(_ref) {
2937
2943
  var children = _ref.children,
2938
2944
  _ref$componentType = _ref.componentType,
2939
2945
  componentType = _ref$componentType === void 0 ? 'span' : _ref$componentType,
2940
2946
  className = _ref.className,
2941
- props = _objectWithoutProperties(_ref, _excluded$C);
2947
+ props = _objectWithoutProperties(_ref, _excluded$N);
2942
2948
 
2943
2949
  return /*#__PURE__*/React.createElement(componentType, _objectSpread2(_objectSpread2({}, props), {}, {
2944
2950
  className: className
2945
2951
  }), children);
2946
2952
  };
2947
2953
 
2948
- var _excluded$B = ["appearance", "size", "children", "weight", "small", "className", "color"];
2954
+ var _excluded$M = ["appearance", "size", "children", "weight", "small", "className", "color"];
2949
2955
  var Text = function Text(props) {
2950
2956
  var _classNames;
2951
2957
 
@@ -2956,7 +2962,7 @@ var Text = function Text(props) {
2956
2962
  small = props.small,
2957
2963
  className = props.className,
2958
2964
  color = props.color,
2959
- rest = _objectWithoutProperties(props, _excluded$B);
2965
+ rest = _objectWithoutProperties(props, _excluded$M);
2960
2966
 
2961
2967
  var classes = classnames((_classNames = {
2962
2968
  Text: true
@@ -3243,7 +3249,7 @@ var CheckboxIcon = function CheckboxIcon(props) {
3243
3249
  }
3244
3250
  };
3245
3251
 
3246
- var _excluded$A = ["size", "tabIndex", "defaultChecked", "indeterminate", "label", "error", "disabled", "onChange", "name", "value", "className", "checked", "helpText", "id"];
3252
+ var _excluded$L = ["size", "tabIndex", "defaultChecked", "indeterminate", "label", "error", "disabled", "onChange", "name", "value", "className", "checked", "helpText", "id"];
3247
3253
  var Checkbox = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
3248
3254
  var _classNames, _classNames2, _classNames3, _classNames4, _classNames5, _classNames6;
3249
3255
 
@@ -3264,7 +3270,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
3264
3270
  helpText = props.helpText,
3265
3271
  _props$id = props.id,
3266
3272
  id = _props$id === void 0 ? "".concat(name, "-").concat(label, "-").concat(uidGenerator()) : _props$id,
3267
- rest = _objectWithoutProperties(props, _excluded$A);
3273
+ rest = _objectWithoutProperties(props, _excluded$L);
3268
3274
 
3269
3275
  var ref = React.useRef(null);
3270
3276
  React.useImperativeHandle(forwardedRef, function () {
@@ -3345,7 +3351,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
3345
3351
  });
3346
3352
  Checkbox.displayName = 'Checkbox';
3347
3353
 
3348
- var _excluded$z = ["size", "sizeXS", "sizeS", "sizeM", "sizeL", "sizeXL", "className", "children"];
3354
+ var _excluded$K = ["size", "sizeXS", "sizeS", "sizeM", "sizeL", "sizeXL", "className", "children"];
3349
3355
  var Column = /*#__PURE__*/React.forwardRef(function (props, ref) {
3350
3356
  var _classNames;
3351
3357
 
@@ -3357,7 +3363,7 @@ var Column = /*#__PURE__*/React.forwardRef(function (props, ref) {
3357
3363
  sizeXL = props.sizeXL,
3358
3364
  className = props.className,
3359
3365
  children = props.children,
3360
- rest = _objectWithoutProperties(props, _excluded$z);
3366
+ rest = _objectWithoutProperties(props, _excluded$K);
3361
3367
 
3362
3368
  var classes = classnames((_classNames = {}, _defineProperty$1(_classNames, 'Col', true), _defineProperty$1(_classNames, "Col--".concat(size), size), _defineProperty$1(_classNames, "Col--xs-".concat(sizeXS), sizeXS), _defineProperty$1(_classNames, "Col--s-".concat(sizeS), sizeS), _defineProperty$1(_classNames, "Col--m-".concat(sizeM), sizeM), _defineProperty$1(_classNames, "Col--l-".concat(sizeL), sizeL), _defineProperty$1(_classNames, "Col--xl-".concat(sizeXL), sizeXL), _defineProperty$1(_classNames, "".concat(className), className), _classNames));
3363
3369
  return /*#__PURE__*/React.createElement("div", _extends$2({
@@ -3468,7 +3474,7 @@ var Trigger$1 = function Trigger(props) {
3468
3474
  }));
3469
3475
  };
3470
3476
 
3471
- var _excluded$y = ["date", "open", "position", "inputFormat", "outputFormat", "inputOptions", "validators", "withInput", "disabledBefore", "disabledAfter", "onDateChange", "closeOnSelect", "size", "showTodayDate", "children", "view"];
3477
+ var _excluded$J = ["date", "open", "position", "inputFormat", "outputFormat", "inputOptions", "validators", "withInput", "disabledBefore", "disabledAfter", "onDateChange", "closeOnSelect", "size", "showTodayDate", "children", "view"];
3472
3478
  var DatePicker = /*#__PURE__*/function (_React$Component) {
3473
3479
  _inherits(DatePicker, _React$Component);
3474
3480
 
@@ -3623,7 +3629,7 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
3623
3629
  _this$props4$children = _this$props4.children,
3624
3630
  children = _this$props4$children === void 0 ? /*#__PURE__*/React.createElement(React.Fragment, null) : _this$props4$children,
3625
3631
  view = _this$props4.view,
3626
- rest = _objectWithoutProperties(_this$props4, _excluded$y);
3632
+ rest = _objectWithoutProperties(_this$props4, _excluded$J);
3627
3633
 
3628
3634
  var date = this.state.date;
3629
3635
  var months = config.months;
@@ -4689,7 +4695,7 @@ function debounce$1 (delay, atBegin, callback) {
4689
4695
  return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
4690
4696
  }
4691
4697
 
4692
- var _excluded$x = ["triggerSize", "placeholder", "menu", "children", "icon", "disabled", "open", "inlineLabel", "error", "iconType"];
4698
+ var _excluded$I = ["triggerSize", "placeholder", "menu", "children", "icon", "disabled", "open", "inlineLabel", "error", "iconType"];
4693
4699
  var DropdownButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
4694
4700
  var _classNames, _classNames2;
4695
4701
 
@@ -4706,7 +4712,7 @@ var DropdownButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
4706
4712
  inlineLabel = props.inlineLabel,
4707
4713
  error = props.error,
4708
4714
  iconType = props.iconType,
4709
- rest = _objectWithoutProperties(props, _excluded$x);
4715
+ rest = _objectWithoutProperties(props, _excluded$I);
4710
4716
 
4711
4717
  var buttonDisabled = disabled ? 'disabled' : 'default';
4712
4718
  var trimmedPlaceholder = placeholder.trim();
@@ -5779,7 +5785,7 @@ var DropdownList = function DropdownList(props) {
5779
5785
 
5780
5786
  DropdownList.displayName = 'DropdownList';
5781
5787
 
5782
- var _excluded$w = ["triggerOptions", "selected", "tabIndex"];
5788
+ var _excluded$H = ["triggerOptions", "selected", "tabIndex"];
5783
5789
  var inputRef = /*#__PURE__*/React.createRef();
5784
5790
 
5785
5791
  /**
@@ -6471,7 +6477,7 @@ var Dropdown = /*#__PURE__*/function (_React$Component) {
6471
6477
  triggerOptions = _this$props14$trigger === void 0 ? {} : _this$props14$trigger;
6472
6478
  _this$props14.selected;
6473
6479
  var tabIndex = _this$props14.tabIndex,
6474
- rest = _objectWithoutProperties(_this$props14, _excluded$w);
6480
+ rest = _objectWithoutProperties(_this$props14, _excluded$H);
6475
6481
 
6476
6482
  var remainingOptionsLen = searchedOptionsLength - options.length;
6477
6483
  var firstEnabledOption = tabIndex ? tabIndex : _isSelectAllPresent(searchTerm, remainingOptionsLen, withSelectAll, withCheckbox) ? 0 : options.findIndex(function (option) {
@@ -6519,7 +6525,7 @@ _defineProperty$1(Dropdown, "defaultProps", {
6519
6525
  searchDebounceDuration: 300
6520
6526
  });
6521
6527
 
6522
- var _excluded$v = ["appearance", "size", "children", "className", "color"];
6528
+ var _excluded$G = ["appearance", "size", "children", "className", "color"];
6523
6529
  var sizeMap = {
6524
6530
  s: 'h5',
6525
6531
  m: 'h4',
@@ -6535,7 +6541,7 @@ var Heading = function Heading(props) {
6535
6541
  children = props.children,
6536
6542
  className = props.className,
6537
6543
  color = props.color,
6538
- rest = _objectWithoutProperties(props, _excluded$v);
6544
+ rest = _objectWithoutProperties(props, _excluded$G);
6539
6545
 
6540
6546
  var classes = classnames((_classNames = {
6541
6547
  Heading: true
@@ -6553,13 +6559,13 @@ Heading.defaultProps = {
6553
6559
  size: 'm'
6554
6560
  };
6555
6561
 
6556
- var _excluded$u = ["className", "iconType"];
6562
+ var _excluded$F = ["className", "iconType"];
6557
6563
  var ActionButton$1 = function ActionButton(props) {
6558
6564
  var _classNames;
6559
6565
 
6560
6566
  var className = props.className,
6561
6567
  iconType = props.iconType,
6562
- rest = _objectWithoutProperties(props, _excluded$u);
6568
+ rest = _objectWithoutProperties(props, _excluded$F);
6563
6569
 
6564
6570
  var iconClass = classnames((_classNames = {}, _defineProperty$1(_classNames, 'ActionButton', true), _defineProperty$1(_classNames, "".concat(className), className), _classNames));
6565
6571
  return /*#__PURE__*/React.createElement(Icon, _extends$2({
@@ -6574,7 +6580,7 @@ ActionButton$1.defaultProps = {
6574
6580
  type: 'rounded'
6575
6581
  };
6576
6582
 
6577
- var _excluded$t = ["size", "type", "minWidth", "defaultValue", "name", "placeholder", "value", "icon", "inlineLabel", "required", "error", "info", "onChange", "onClick", "onClear", "onBlur", "onFocus", "onPaste", "actionIcon", "className", "autoFocus", "disabled", "readOnly", "iconType"];
6583
+ var _excluded$E = ["size", "type", "minWidth", "defaultValue", "name", "placeholder", "value", "icon", "inlineLabel", "required", "error", "info", "onChange", "onClick", "onClear", "onBlur", "onFocus", "onPaste", "actionIcon", "className", "autoFocus", "disabled", "readOnly", "iconType"];
6578
6584
  var sizeMapping$2 = {
6579
6585
  tiny: 12,
6580
6586
  regular: 16,
@@ -6616,7 +6622,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
6616
6622
  disabled = props.disabled,
6617
6623
  readOnly = props.readOnly,
6618
6624
  iconType = props.iconType,
6619
- rest = _objectWithoutProperties(props, _excluded$t);
6625
+ rest = _objectWithoutProperties(props, _excluded$E);
6620
6626
 
6621
6627
  var ref = React.useRef(null);
6622
6628
 
@@ -6725,7 +6731,7 @@ Object.assign(Input, {
6725
6731
  ActionButton: ActionButton$1
6726
6732
  });
6727
6733
 
6728
- var _excluded$s = ["size", "defaultValue", "name", "placeholder", "icon", "prefix", "suffix", "error", "min", "max", "onChange", "onClick", "onBlur", "onFocus", "className", "autoFocus", "disabled", "readOnly", "value", "showActionButton", "onKeyDown", "iconType"];
6734
+ var _excluded$D = ["size", "defaultValue", "name", "placeholder", "icon", "prefix", "suffix", "error", "min", "max", "onChange", "onClick", "onBlur", "onFocus", "className", "autoFocus", "disabled", "readOnly", "value", "showActionButton", "onKeyDown", "iconType"];
6729
6735
  var sizeMapping$1 = {
6730
6736
  regular: 16,
6731
6737
  large: 20
@@ -6776,7 +6782,7 @@ var MetricInput = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
6776
6782
  showActionButton = _props$showActionButt === void 0 ? true : _props$showActionButt,
6777
6783
  onKeyDown = props.onKeyDown,
6778
6784
  iconType = props.iconType,
6779
- rest = _objectWithoutProperties(props, _excluded$s);
6785
+ rest = _objectWithoutProperties(props, _excluded$D);
6780
6786
 
6781
6787
  var ref = React.useRef(null);
6782
6788
  var isUncontrolled = valueProp === undefined;
@@ -6942,7 +6948,7 @@ var getDefaultValue = function getDefaultValue(mask, placeholderChar) {
6942
6948
  return val;
6943
6949
  };
6944
6950
 
6945
- var _excluded$r = ["mask", "value", "placeholderChar", "validators", "clearOnEmptyBlur", "defaultValue", "mask", "error", "caption", "required", "onChange", "onPaste", "onBlur", "onFocus", "onClear", "className", "id", "helpText"];
6951
+ var _excluded$C = ["mask", "value", "placeholderChar", "validators", "clearOnEmptyBlur", "defaultValue", "mask", "error", "caption", "required", "onChange", "onPaste", "onBlur", "onFocus", "onClear", "className", "id", "helpText"];
6946
6952
 
6947
6953
  /**
6948
6954
  * It works as Uncontrolled Input
@@ -6971,7 +6977,7 @@ var InputMask = /*#__PURE__*/React.forwardRef(function (props, forwardRef) {
6971
6977
  className = props.className,
6972
6978
  id = props.id,
6973
6979
  helpText = props.helpText,
6974
- rest = _objectWithoutProperties(props, _excluded$r);
6980
+ rest = _objectWithoutProperties(props, _excluded$C);
6975
6981
 
6976
6982
  var isEditable = React.useCallback(function (pos) {
6977
6983
  return _typeof(mask[pos]) === 'object';
@@ -7275,7 +7281,7 @@ InputMask.utils = {
7275
7281
  };
7276
7282
  var X = InputMask;
7277
7283
 
7278
- var _excluded$q = ["required", "optional", "withInput", "disabled", "children", "className", "info"];
7284
+ var _excluded$B = ["required", "optional", "withInput", "disabled", "children", "className", "info"];
7279
7285
 
7280
7286
  /**
7281
7287
  * *NOTE: Extends props with HTMLProps<HTMLLabelElement>*
@@ -7290,7 +7296,7 @@ var Label = function Label(props) {
7290
7296
  children = props.children,
7291
7297
  className = props.className,
7292
7298
  info = props.info,
7293
- rest = _objectWithoutProperties(props, _excluded$q);
7299
+ rest = _objectWithoutProperties(props, _excluded$B);
7294
7300
 
7295
7301
  var baseProps = extractBaseProps(props);
7296
7302
  var LabelClass = classnames((_classNames = {
@@ -7448,7 +7454,7 @@ var Editable = function Editable(props) {
7448
7454
  };
7449
7455
  Editable.displayName = 'Editable';
7450
7456
 
7451
- var _excluded$p = ["onChange", "onClose"];
7457
+ var _excluded$A = ["onChange", "onClose"];
7452
7458
  var EditableDropdown = function EditableDropdown(props) {
7453
7459
  var _classNames2;
7454
7460
 
@@ -7459,7 +7465,7 @@ var EditableDropdown = function EditableDropdown(props) {
7459
7465
 
7460
7466
  var onDropdownChange = dropdownOptions.onChange,
7461
7467
  onDropdownClose = dropdownOptions.onClose,
7462
- rest = _objectWithoutProperties(dropdownOptions, _excluded$p);
7468
+ rest = _objectWithoutProperties(dropdownOptions, _excluded$A);
7463
7469
 
7464
7470
  var _React$useState = React.useState(placeholder),
7465
7471
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -7540,7 +7546,7 @@ EditableDropdown.defaultProps = {
7540
7546
  dropdownOptions: {}
7541
7547
  };
7542
7548
 
7543
- var _excluded$o = ["children", "className", "appearance", "size", "disabled"];
7549
+ var _excluded$z = ["children", "className", "appearance", "size", "disabled"];
7544
7550
  var Link = function Link(props) {
7545
7551
  var _classNames;
7546
7552
 
@@ -7549,7 +7555,7 @@ var Link = function Link(props) {
7549
7555
  appearance = props.appearance,
7550
7556
  size = props.size,
7551
7557
  disabled = props.disabled,
7552
- rest = _objectWithoutProperties(props, _excluded$o);
7558
+ rest = _objectWithoutProperties(props, _excluded$z);
7553
7559
 
7554
7560
  var classes = classnames((_classNames = {
7555
7561
  Link: true
@@ -8445,12 +8451,12 @@ _defineProperty$1(MultiSlider, "defaultProps", {
8445
8451
 
8446
8452
  _defineProperty$1(MultiSlider, "Handle", MultiSliderHandle);
8447
8453
 
8448
- var _excluded$n = ["children", "className", "onOutsideClick"];
8454
+ var _excluded$y = ["children", "className", "onOutsideClick"];
8449
8455
  var OutsideClick = /*#__PURE__*/React.forwardRef(function (props, ref) {
8450
8456
  var children = props.children,
8451
8457
  className = props.className,
8452
8458
  onOutsideClick = props.onOutsideClick,
8453
- rest = _objectWithoutProperties(props, _excluded$n);
8459
+ rest = _objectWithoutProperties(props, _excluded$y);
8454
8460
 
8455
8461
  var innerRef = React.useRef(null);
8456
8462
  React.useImperativeHandle(ref, function () {
@@ -8482,7 +8488,7 @@ var OutsideClick = /*#__PURE__*/React.forwardRef(function (props, ref) {
8482
8488
  });
8483
8489
  OutsideClick.displayName = 'OutsideClick';
8484
8490
 
8485
- var _excluded$m = ["appearance", "children", "className", "color"];
8491
+ var _excluded$x = ["appearance", "children", "className", "color"];
8486
8492
  var Paragraph = function Paragraph(props) {
8487
8493
  var _classNames;
8488
8494
 
@@ -8490,7 +8496,7 @@ var Paragraph = function Paragraph(props) {
8490
8496
  children = props.children,
8491
8497
  className = props.className,
8492
8498
  color = props.color,
8493
- rest = _objectWithoutProperties(props, _excluded$m);
8499
+ rest = _objectWithoutProperties(props, _excluded$x);
8494
8500
 
8495
8501
  var classes = classnames((_classNames = {
8496
8502
  Text: true
@@ -8538,7 +8544,7 @@ ProgressBar.defaultProps = {
8538
8544
  size: 'regular'
8539
8545
  };
8540
8546
 
8541
- var _excluded$l = ["size", "label", "disabled", "onChange", "name", "value", "checked", "defaultChecked", "className", "helpText", "error"];
8547
+ var _excluded$w = ["size", "label", "disabled", "onChange", "name", "value", "checked", "defaultChecked", "className", "helpText", "error"];
8542
8548
  var Radio = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
8543
8549
  var _classNames, _classNames2, _classNames3;
8544
8550
 
@@ -8554,7 +8560,7 @@ var Radio = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
8554
8560
  className = props.className,
8555
8561
  helpText = props.helpText,
8556
8562
  error = props.error,
8557
- rest = _objectWithoutProperties(props, _excluded$l);
8563
+ rest = _objectWithoutProperties(props, _excluded$w);
8558
8564
 
8559
8565
  var ref = React.useRef(null);
8560
8566
  React.useImperativeHandle(forwardedRef, function () {
@@ -8605,11 +8611,11 @@ var Radio = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
8605
8611
  });
8606
8612
  Radio.displayName = 'Radio';
8607
8613
 
8608
- var _excluded$k = ["className", "children"];
8614
+ var _excluded$v = ["className", "children"];
8609
8615
  var Row = /*#__PURE__*/React.forwardRef(function (props, ref) {
8610
8616
  var className = props.className,
8611
8617
  children = props.children,
8612
- rest = _objectWithoutProperties(props, _excluded$k);
8618
+ rest = _objectWithoutProperties(props, _excluded$v);
8613
8619
 
8614
8620
  var classes = classnames(_defineProperty$1({
8615
8621
  Row: true
@@ -8726,13 +8732,13 @@ Spinner.defaultProps = {
8726
8732
  size: 'medium'
8727
8733
  };
8728
8734
 
8729
- var _excluded$j = ["value", "defaultValue", "onRelease", "onChange"];
8735
+ var _excluded$u = ["value", "defaultValue", "onRelease", "onChange"];
8730
8736
  var Slider = function Slider(props) {
8731
8737
  var valueProp = props.value,
8732
8738
  defaultValue = props.defaultValue,
8733
8739
  onRelease = props.onRelease,
8734
8740
  onChange = props.onChange,
8735
- rest = _objectWithoutProperties(props, _excluded$j);
8741
+ rest = _objectWithoutProperties(props, _excluded$u);
8736
8742
 
8737
8743
  var _React$useState = React.useState(valueProp === undefined ? defaultValue : valueProp),
8738
8744
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -8765,7 +8771,7 @@ Slider.defaultProps = _objectSpread2(_objectSpread2({}, MultiSlider.defaultProps
8765
8771
  defaultValue: 0
8766
8772
  });
8767
8773
 
8768
- var _excluded$i = ["value", "defaultValue", "onChange", "onRelease"];
8774
+ var _excluded$t = ["value", "defaultValue", "onChange", "onRelease"];
8769
8775
  var RangeIndex;
8770
8776
 
8771
8777
  (function (RangeIndex) {
@@ -8778,7 +8784,7 @@ var RangeSlider = function RangeSlider(props) {
8778
8784
  defaultValue = props.defaultValue,
8779
8785
  onChange = props.onChange,
8780
8786
  onRelease = props.onRelease,
8781
- rest = _objectWithoutProperties(props, _excluded$i);
8787
+ rest = _objectWithoutProperties(props, _excluded$t);
8782
8788
 
8783
8789
  var _React$useState = React.useState(valueProp === undefined ? defaultValue : valueProp),
8784
8790
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -8814,7 +8820,7 @@ RangeSlider.defaultProps = _objectSpread2(_objectSpread2({}, MultiSlider.default
8814
8820
  defaultValue: [0, 10]
8815
8821
  });
8816
8822
 
8817
- var _excluded$h = ["appearance", "children", "className", "color"];
8823
+ var _excluded$s = ["appearance", "children", "className", "color"];
8818
8824
  var Subheading = function Subheading(props) {
8819
8825
  var _classNames;
8820
8826
 
@@ -8822,7 +8828,7 @@ var Subheading = function Subheading(props) {
8822
8828
  children = props.children,
8823
8829
  className = props.className,
8824
8830
  color = props.color,
8825
- rest = _objectWithoutProperties(props, _excluded$h);
8831
+ rest = _objectWithoutProperties(props, _excluded$s);
8826
8832
 
8827
8833
  var classes = classnames((_classNames = {
8828
8834
  Subheading: true
@@ -8839,7 +8845,7 @@ Subheading.defaultProps = {
8839
8845
  appearance: 'default'
8840
8846
  };
8841
8847
 
8842
- var _excluded$g = ["size", "defaultChecked", "disabled", "onChange", "name", "value", "className", "appearance", "checked"];
8848
+ var _excluded$r = ["size", "defaultChecked", "disabled", "onChange", "name", "value", "className", "appearance", "checked"];
8843
8849
 
8844
8850
  /**
8845
8851
  * ######Switch has two types:
@@ -8859,7 +8865,7 @@ var Switch = /*#__PURE__*/React.forwardRef(function (props, ref) {
8859
8865
  className = props.className;
8860
8866
  props.appearance;
8861
8867
  var checkedProp = props.checked,
8862
- rest = _objectWithoutProperties(props, _excluded$g);
8868
+ rest = _objectWithoutProperties(props, _excluded$r);
8863
8869
 
8864
8870
  var _React$useState = React.useState(checkedProp === undefined ? defaultChecked : checkedProp),
8865
8871
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -8898,7 +8904,7 @@ var Switch = /*#__PURE__*/React.forwardRef(function (props, ref) {
8898
8904
  });
8899
8905
  Switch.displayName = 'Switch';
8900
8906
 
8901
- var _excluded$f = ["rows", "resize", "disabled", "name", "placeholder", "value", "defaultValue", "required", "error", "onChange", "onClick", "onBlur", "onFocus", "className"];
8907
+ var _excluded$q = ["rows", "resize", "disabled", "name", "placeholder", "value", "defaultValue", "required", "error", "onChange", "onClick", "onBlur", "onFocus", "className"];
8902
8908
  var Textarea = /*#__PURE__*/React.forwardRef(function (props, ref) {
8903
8909
  var _classNames;
8904
8910
 
@@ -8918,7 +8924,7 @@ var Textarea = /*#__PURE__*/React.forwardRef(function (props, ref) {
8918
8924
  onBlur = props.onBlur,
8919
8925
  onFocus = props.onFocus,
8920
8926
  className = props.className,
8921
- rest = _objectWithoutProperties(props, _excluded$f);
8927
+ rest = _objectWithoutProperties(props, _excluded$q);
8922
8928
 
8923
8929
  var classes = classnames((_classNames = {}, _defineProperty$1(_classNames, 'Textarea', true), _defineProperty$1(_classNames, 'Textarea--resize', resize), _defineProperty$1(_classNames, 'Textarea--error', error), _classNames), className);
8924
8930
  return /*#__PURE__*/React.createElement("textarea", _extends$2({
@@ -14047,7 +14053,7 @@ _defineProperty$1(PopperWrapper, "defaultProps", {
14047
14053
  style: {}
14048
14054
  });
14049
14055
 
14050
- var _excluded$e = ["position", "customStyle", "dark", "children", "onToggle", "className", "hideOnReferenceEscape", "boundaryElement"];
14056
+ var _excluded$p = ["position", "customStyle", "dark", "children", "onToggle", "className", "hideOnReferenceEscape", "boundaryElement"];
14051
14057
  var propsList = ['appendToBody', 'trigger', 'hoverable', 'on', 'open', 'closeOnBackdropClick', 'offset', 'closeOnScroll'];
14052
14058
  var Popover = function Popover(props) {
14053
14059
  var position = props.position,
@@ -14059,7 +14065,7 @@ var Popover = function Popover(props) {
14059
14065
  hideOnReferenceEscape = props.hideOnReferenceEscape,
14060
14066
  _props$boundaryElemen = props.boundaryElement,
14061
14067
  boundaryElement = _props$boundaryElemen === void 0 ? document.body : _props$boundaryElemen,
14062
- rest = _objectWithoutProperties(props, _excluded$e);
14068
+ rest = _objectWithoutProperties(props, _excluded$p);
14063
14069
 
14064
14070
  var _React$useState = React.useState(!!props.open),
14065
14071
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -14111,8 +14117,8 @@ Popover.defaultProps = Object.assign({}, filterProps(PopperWrapper.defaultProps,
14111
14117
  customStyle: {}
14112
14118
  });
14113
14119
 
14114
- var _excluded$d = ["type", "onClick"];
14115
- var keyCodes = {
14120
+ var _excluded$o = ["type", "onClick"];
14121
+ var keyCodes$1 = {
14116
14122
  BACKSPACE: 'Backspace',
14117
14123
  DELETE: 'Delete',
14118
14124
  ENTER: 'Enter'
@@ -14201,15 +14207,15 @@ var ChipInput = function ChipInput(props) {
14201
14207
  var chipsLength = chips.length;
14202
14208
 
14203
14209
  switch (event.key) {
14204
- case keyCodes.DELETE:
14205
- case keyCodes.BACKSPACE:
14210
+ case keyCodes$1.DELETE:
14211
+ case keyCodes$1.BACKSPACE:
14206
14212
  if (inputValue === '' && chipsLength > 0) {
14207
14213
  onChipDeleteHandler(chipsLength - 1);
14208
14214
  }
14209
14215
 
14210
14216
  break;
14211
14217
 
14212
- case keyCodes.ENTER:
14218
+ case keyCodes$1.ENTER:
14213
14219
  event.preventDefault();
14214
14220
  onChipAddHandler();
14215
14221
  break;
@@ -14230,7 +14236,7 @@ var ChipInput = function ChipInput(props) {
14230
14236
  var _chipOptions$type = chipOptions.type,
14231
14237
  type = _chipOptions$type === void 0 ? 'input' : _chipOptions$type,
14232
14238
  _onClick = chipOptions.onClick,
14233
- rest = _objectWithoutProperties(chipOptions, _excluded$d);
14239
+ rest = _objectWithoutProperties(chipOptions, _excluded$o);
14234
14240
 
14235
14241
  return /*#__PURE__*/React.createElement(Chip, _extends$2({
14236
14242
  "data-test": "DesignSystem-ChipInput--Chip",
@@ -14743,7 +14749,7 @@ var HorizontalNav = function HorizontalNav(props) {
14743
14749
  }), list);
14744
14750
  };
14745
14751
 
14746
- var _excluded$c = ["children", "tooltip", "showTooltip"];
14752
+ var _excluded$n = ["children", "tooltip", "showTooltip"];
14747
14753
  var tooltipPropsList = ['trigger', 'on', 'open', 'offset', 'onToggle', 'dark', 'customStyle', 'closeOnBackdropClick', 'hideOnReferenceEscape', 'closeOnScroll'];
14748
14754
  var positionValue = {
14749
14755
  bottom: 'bottom',
@@ -14759,7 +14765,7 @@ var Tooltip = function Tooltip(props) {
14759
14765
  var children = props.children,
14760
14766
  tooltip = props.tooltip,
14761
14767
  showTooltip = props.showTooltip,
14762
- rest = _objectWithoutProperties(props, _excluded$c);
14768
+ rest = _objectWithoutProperties(props, _excluded$n);
14763
14769
 
14764
14770
  if (!showTooltip) {
14765
14771
  // If showTooltip is false skip the Popover and return the children directly
@@ -14841,7 +14847,7 @@ Dialog.defaultProps = {
14841
14847
  secondaryButtonAppearance: 'basic'
14842
14848
  };
14843
14849
 
14844
- var _excluded$b = ["label"];
14850
+ var _excluded$m = ["label"];
14845
14851
  var OverlayFooter = function OverlayFooter(props) {
14846
14852
  var open = props.open,
14847
14853
  className = props.className,
@@ -14878,7 +14884,7 @@ var OverlayFooter = function OverlayFooter(props) {
14878
14884
  className: classes
14879
14885
  }), actions.map(function (_ref, index) {
14880
14886
  _ref.label;
14881
- var options = _objectWithoutProperties(_ref, _excluded$b);
14887
+ var options = _objectWithoutProperties(_ref, _excluded$m);
14882
14888
 
14883
14889
  return /*#__PURE__*/React.createElement(Button, _extends$2({
14884
14890
  type: "button"
@@ -16239,7 +16245,7 @@ Pagination.defaultProps = {
16239
16245
  pageJumpDebounceDuration: 750
16240
16246
  };
16241
16247
 
16242
- var _excluded$a = ["onChange"];
16248
+ var _excluded$l = ["onChange"];
16243
16249
  var EditableInput = function EditableInput(props) {
16244
16250
  var _classNames2, _classNames4;
16245
16251
 
@@ -16253,7 +16259,7 @@ var EditableInput = function EditableInput(props) {
16253
16259
  className = props.className;
16254
16260
 
16255
16261
  var onInputChange = inputOptions.onChange,
16256
- rest = _objectWithoutProperties(inputOptions, _excluded$a);
16262
+ rest = _objectWithoutProperties(inputOptions, _excluded$l);
16257
16263
 
16258
16264
  var _React$useState = React.useState(props.value),
16259
16265
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -16416,8 +16422,8 @@ EditableInput.defaultProps = {
16416
16422
  inputOptions: {}
16417
16423
  };
16418
16424
 
16419
- var _excluded$9 = ["onChange", "chipOptions"],
16420
- _excluded2$1 = ["onClick"];
16425
+ var _excluded$k = ["onChange", "chipOptions"],
16426
+ _excluded2$2 = ["onClick"];
16421
16427
  var EditableChipInput = function EditableChipInput(props) {
16422
16428
  var _classNames3;
16423
16429
 
@@ -16430,10 +16436,10 @@ var EditableChipInput = function EditableChipInput(props) {
16430
16436
  var onChipInputChange = chipInputOptions.onChange,
16431
16437
  _chipInputOptions$chi = chipInputOptions.chipOptions,
16432
16438
  chipOptions = _chipInputOptions$chi === void 0 ? {} : _chipInputOptions$chi,
16433
- rest = _objectWithoutProperties(chipInputOptions, _excluded$9);
16439
+ rest = _objectWithoutProperties(chipInputOptions, _excluded$k);
16434
16440
 
16435
16441
  var _onClick = chipOptions.onClick,
16436
- chipObject = _objectWithoutProperties(chipOptions, _excluded2$1);
16442
+ chipObject = _objectWithoutProperties(chipOptions, _excluded2$2);
16437
16443
 
16438
16444
  var _React$useState = React.useState(props.value),
16439
16445
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -17246,7 +17252,7 @@ var getCustomDates = function getCustomDates() {
17246
17252
  };
17247
17253
  };
17248
17254
 
17249
- var _excluded$8 = ["startDate", "endDate", "yearNav", "monthNav", "open", "inputFormat", "outputFormat", "startInputOptions", "endInputOptions", "validators", "withInput", "position", "disabledBefore", "disabledAfter", "onRangeChange", "rangeLimit"];
17255
+ var _excluded$j = ["startDate", "endDate", "yearNav", "monthNav", "open", "inputFormat", "outputFormat", "startInputOptions", "endInputOptions", "validators", "withInput", "position", "disabledBefore", "disabledAfter", "onRangeChange", "rangeLimit"];
17250
17256
  var DateRangePicker = /*#__PURE__*/function (_React$Component) {
17251
17257
  _inherits(DateRangePicker, _React$Component);
17252
17258
 
@@ -17516,7 +17522,7 @@ var DateRangePicker = /*#__PURE__*/function (_React$Component) {
17516
17522
  disabledAfter = _this$props6.disabledAfter;
17517
17523
  _this$props6.onRangeChange;
17518
17524
  var rangeLimit = _this$props6.rangeLimit,
17519
- rest = _objectWithoutProperties(_this$props6, _excluded$8);
17525
+ rest = _objectWithoutProperties(_this$props6, _excluded$j);
17520
17526
 
17521
17527
  var _this$state3 = this.state,
17522
17528
  startDate = _this$state3.startDate,
@@ -18420,8 +18426,8 @@ function _fromFileEntry() {
18420
18426
  return _fromFileEntry.apply(this, arguments);
18421
18427
  }
18422
18428
 
18423
- var _excluded$7 = ["refKey", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnterCallback", "onDragOverCallback", "onDragLeaveCallback", "onDropCallback"],
18424
- _excluded2 = ["refKey", "onChange", "onClick"];
18429
+ var _excluded$i = ["refKey", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnterCallback", "onDragOverCallback", "onDragLeaveCallback", "onDropCallback"],
18430
+ _excluded2$1 = ["refKey", "onChange", "onClick"];
18425
18431
  var initialState = {
18426
18432
  isFocused: false,
18427
18433
  isFileDialogActive: false,
@@ -18698,7 +18704,7 @@ var DropzoneBase = function DropzoneBase(props) {
18698
18704
  onDragOverCallback = _ref.onDragOverCallback,
18699
18705
  onDragLeaveCallback = _ref.onDragLeaveCallback,
18700
18706
  onDropCallback = _ref.onDropCallback,
18701
- rest = _objectWithoutProperties(_ref, _excluded$7);
18707
+ rest = _objectWithoutProperties(_ref, _excluded$i);
18702
18708
 
18703
18709
  return _objectSpread2(_defineProperty$1({
18704
18710
  onDragEnter: composeDragHandler(composeEventHandlers(onDragEnterCallback, onDragEnterCb)),
@@ -18718,7 +18724,7 @@ var DropzoneBase = function DropzoneBase(props) {
18718
18724
  refKey = _ref2$refKey === void 0 ? 'ref' : _ref2$refKey,
18719
18725
  onChange = _ref2.onChange,
18720
18726
  onClick = _ref2.onClick,
18721
- rest = _objectWithoutProperties(_ref2, _excluded2);
18727
+ rest = _objectWithoutProperties(_ref2, _excluded2$1);
18722
18728
 
18723
18729
  var inputProps = _defineProperty$1({
18724
18730
  accept: accept,
@@ -20896,7 +20902,7 @@ Header.defaultProps = {
20896
20902
  showFilters: true
20897
20903
  };
20898
20904
 
20899
- var _excluded$6 = ["children"];
20905
+ var _excluded$h = ["children"];
20900
20906
 
20901
20907
  var defaultErrorTemplate = function defaultErrorTemplate(props) {
20902
20908
  var _props$errorType = props.errorType,
@@ -21281,7 +21287,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21281
21287
 
21282
21288
  var _ref = headerOptions,
21283
21289
  headerChildren = _ref.children,
21284
- headerAttr = _objectWithoutProperties(_ref, _excluded$6);
21290
+ headerAttr = _objectWithoutProperties(_ref, _excluded$h);
21285
21291
 
21286
21292
  var classes = className ? " ".concat(className) : '';
21287
21293
  var totalRecords = this.state.totalRecords;
@@ -21845,7 +21851,7 @@ FileList.defaultProps = {
21845
21851
  };
21846
21852
  FileList.displayName = 'FileList';
21847
21853
 
21848
- var _excluded$5 = ["type", "fields", "placeholder", "autoFocus", "onComplete", "onFocus", "onBlur", "className", "value"];
21854
+ var _excluded$g = ["type", "fields", "placeholder", "autoFocus", "onComplete", "onFocus", "onBlur", "className", "value"];
21849
21855
  var KEY_CODE = {
21850
21856
  backspace: 'Backspace',
21851
21857
  left: 'ArrowLeft',
@@ -21870,7 +21876,7 @@ var VerificationCodeInput = function VerificationCodeInput(props) {
21870
21876
  onBlur = props.onBlur,
21871
21877
  className = props.className;
21872
21878
  props.value;
21873
- var rest = _objectWithoutProperties(props, _excluded$5);
21879
+ var rest = _objectWithoutProperties(props, _excluded$g);
21874
21880
 
21875
21881
  var initialValues = useMemo(function () {
21876
21882
  if (props.value && props.value.length) {
@@ -22281,7 +22287,7 @@ var HelpText = function HelpText(props) {
22281
22287
  };
22282
22288
  HelpText.displayName = 'HelpText';
22283
22289
 
22284
- var _excluded$4 = ["children", "type", "className", "disabled", "tabIndex", "icon", "subtle", "size", "iconAlign", "iconType"];
22290
+ var _excluded$f = ["children", "type", "className", "disabled", "tabIndex", "icon", "subtle", "size", "iconAlign", "iconType"];
22285
22291
  var sizeMapping = {
22286
22292
  tiny: 12,
22287
22293
  regular: 16
@@ -22299,7 +22305,7 @@ var LinkButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
22299
22305
  size = props.size,
22300
22306
  iconAlign = props.iconAlign,
22301
22307
  iconType = props.iconType,
22302
- rest = _objectWithoutProperties(props, _excluded$4);
22308
+ rest = _objectWithoutProperties(props, _excluded$f);
22303
22309
 
22304
22310
  var buttonClass = classnames((_classNames = {}, _defineProperty$1(_classNames, 'LinkButton', true), _defineProperty$1(_classNames, "LinkButton--".concat(size), size), _defineProperty$1(_classNames, 'LinkButton--default', !subtle), _defineProperty$1(_classNames, 'LinkButton--subtle', subtle), _defineProperty$1(_classNames, "LinkButton--iconAlign-".concat(iconAlign), children && iconAlign), _defineProperty$1(_classNames, "".concat(className), className), _classNames));
22305
22311
  var iconClass = classnames((_classNames2 = {}, _defineProperty$1(_classNames2, 'LinkButton-icon', true), _defineProperty$1(_classNames2, "LinkButton-icon--".concat(iconAlign), children && iconAlign), _classNames2));
@@ -22326,7 +22332,7 @@ LinkButton.defaultProps = {
22326
22332
  iconAlign: 'left'
22327
22333
  };
22328
22334
 
22329
- var _excluded$3 = ["children", "disabled", "className", "zIndex", "onClick"];
22335
+ var _excluded$e = ["children", "disabled", "className", "zIndex", "onClick"];
22330
22336
  var ActionCard = function ActionCard(props) {
22331
22337
  var _classNames;
22332
22338
 
@@ -22335,7 +22341,7 @@ var ActionCard = function ActionCard(props) {
22335
22341
  className = props.className,
22336
22342
  zIndex = props.zIndex,
22337
22343
  onClick = props.onClick,
22338
- rest = _objectWithoutProperties(props, _excluded$3);
22344
+ rest = _objectWithoutProperties(props, _excluded$e);
22339
22345
 
22340
22346
  var classes = classnames((_classNames = {}, _defineProperty$1(_classNames, 'ActionCard', true), _defineProperty$1(_classNames, 'ActionCard--disabled', disabled), _classNames), className);
22341
22347
 
@@ -22437,7 +22443,7 @@ function useSingleSelect() {
22437
22443
  };
22438
22444
  }
22439
22445
 
22440
- var _excluded$2 = ["children", "onClick", "disabled", "id", "cardValue", "overlayZIndex", "selected", "className"];
22446
+ var _excluded$d = ["children", "onClick", "disabled", "id", "cardValue", "overlayZIndex", "selected", "className"];
22441
22447
  var SelectionCard = function SelectionCard(props) {
22442
22448
  var _classNames;
22443
22449
 
@@ -22449,7 +22455,7 @@ var SelectionCard = function SelectionCard(props) {
22449
22455
  overlayZIndex = props.overlayZIndex,
22450
22456
  selected = props.selected,
22451
22457
  className = props.className,
22452
- rest = _objectWithoutProperties(props, _excluded$2);
22458
+ rest = _objectWithoutProperties(props, _excluded$d);
22453
22459
 
22454
22460
  var classes = classnames((_classNames = {}, _defineProperty$1(_classNames, 'Selection-card', true), _defineProperty$1(_classNames, 'Selection-card--selected', selected), _defineProperty$1(_classNames, 'Selection-card--disabled', disabled && !selected), _defineProperty$1(_classNames, 'Selection-card--selected-disabled', disabled && selected), _classNames), className);
22455
22461
 
@@ -23257,7 +23263,8 @@ var ListBody = function ListBody(props) {
23257
23263
  className = props.className,
23258
23264
  disabled = props.disabled,
23259
23265
  selected = props.selected,
23260
- activated = props.activated;
23266
+ activated = props.activated,
23267
+ tabIndex = props.tabIndex;
23261
23268
  var contextProp = React.useContext(ListboxContext);
23262
23269
  var size = contextProp.size,
23263
23270
  type = contextProp.type,
@@ -23268,7 +23275,7 @@ var ListBody = function ListBody(props) {
23268
23275
  return /*#__PURE__*/React.createElement("div", {
23269
23276
  "data-disabled": disabled,
23270
23277
  "data-test": "DesignSystem-Listbox-ItemWrapper",
23271
- tabIndex: draggable ? -1 : 0,
23278
+ tabIndex: draggable ? -1 : tabIndex || 0,
23272
23279
  className: itemClass,
23273
23280
  onKeyDown: onKeyDown,
23274
23281
  role: "tablist"
@@ -23360,7 +23367,7 @@ var NestedList = function NestedList(props) {
23360
23367
  }, nestedBody));
23361
23368
  };
23362
23369
 
23363
- var _excluded$1 = ["nestedBody", "expanded", "id", "onClick", "value", "tagName"];
23370
+ var _excluded$c = ["nestedBody", "expanded", "id", "onClick", "value", "tagName"];
23364
23371
  var ListboxItem = function ListboxItem(props) {
23365
23372
  var nestedBody = props.nestedBody,
23366
23373
  expanded = props.expanded,
@@ -23368,7 +23375,7 @@ var ListboxItem = function ListboxItem(props) {
23368
23375
  onClick = props.onClick,
23369
23376
  value = props.value,
23370
23377
  Tag = props.tagName,
23371
- rest = _objectWithoutProperties(props, _excluded$1);
23378
+ rest = _objectWithoutProperties(props, _excluded$c);
23372
23379
 
23373
23380
  var contextProp = React.useContext(ListboxContext);
23374
23381
  var showDivider = contextProp.showDivider,
@@ -23381,13 +23388,13 @@ var ListboxItem = function ListboxItem(props) {
23381
23388
  var tagClass = classnames(_defineProperty$1({}, 'Listbox-item-wrapper', !draggable));
23382
23389
  return /*#__PURE__*/React.createElement(Tag, _extends$2({
23383
23390
  id: id,
23384
- key: id
23391
+ key: id,
23392
+ "data-test": "DesignSystem-Listbox-Item"
23385
23393
  }, rest, {
23386
- "data-test": "DesignSystem-Listbox-Item",
23387
23394
  onClick: onClickHandler,
23388
23395
  "data-value": value,
23389
23396
  className: tagClass
23390
- }), /*#__PURE__*/React.createElement(ListBody, props), nestedBody && /*#__PURE__*/React.createElement(NestedList, {
23397
+ }, rest), /*#__PURE__*/React.createElement(ListBody, props), nestedBody && /*#__PURE__*/React.createElement(NestedList, {
23391
23398
  expanded: expanded,
23392
23399
  nestedBody: nestedBody
23393
23400
  }), showDivider && /*#__PURE__*/React.createElement(Divider, {
@@ -23399,7 +23406,7 @@ ListboxItem.defaultProps = {
23399
23406
  tagName: 'li'
23400
23407
  };
23401
23408
 
23402
- var _excluded = ["children", "className", "draggable", "size", "type", "showDivider", "tagName"];
23409
+ var _excluded$b = ["children", "className", "draggable", "size", "type", "showDivider", "tagName"];
23403
23410
  var ListboxContext = /*#__PURE__*/React.createContext({
23404
23411
  size: 'standard',
23405
23412
  type: 'resource',
@@ -23415,7 +23422,7 @@ var Listbox = function Listbox(props) {
23415
23422
  type = props.type,
23416
23423
  showDivider = props.showDivider,
23417
23424
  Tag = props.tagName,
23418
- rest = _objectWithoutProperties(props, _excluded);
23425
+ rest = _objectWithoutProperties(props, _excluded$b);
23419
23426
 
23420
23427
  var baseProps = extractBaseProps(props);
23421
23428
  var classes = classnames({
@@ -23609,6 +23616,2038 @@ var TextField = function TextField(props) {
23609
23616
  };
23610
23617
  TextField.displayName = 'TextField';
23611
23618
 
23612
- var version = "2.28.2";
23619
+ var _excluded$a = ["icon", "image"];
23620
+ var SelectionAvatar = function SelectionAvatar(props) {
23621
+ var icon = props.icon,
23622
+ image = props.image,
23623
+ rest = _objectWithoutProperties(props, _excluded$a);
23624
+
23625
+ return /*#__PURE__*/React.createElement(Avatar, _extends$2({
23626
+ role: "checkbox"
23627
+ }, rest, {
23628
+ withTooltip: true,
23629
+ className: "cursor-pointer"
23630
+ }), image || icon);
23631
+ };
23632
+
23633
+ var AvatarSelectionContext = /*#__PURE__*/React.createContext({});
23634
+
23635
+ var SelectionAvatarsWrapper = function SelectionAvatarsWrapper(props) {
23636
+ var avatarList = props.avatarList,
23637
+ avatarStyle = props.avatarStyle,
23638
+ tooltipPosition = props.tooltipPosition,
23639
+ size = props.size,
23640
+ avatarRenderer = props.avatarRenderer;
23641
+ var contextProp = React.useContext(AvatarSelectionContext);
23642
+ var setSelectedItems = contextProp.setSelectedItems,
23643
+ selectedItems = contextProp.selectedItems,
23644
+ onSelect = contextProp.onSelect;
23645
+
23646
+ var onClickHandler = function onClickHandler(item) {
23647
+ var list = selectedItems;
23648
+
23649
+ if (selectedItems !== null && selectedItems !== void 0 && selectedItems.includes(item)) {
23650
+ list = selectedItems.filter(function (selectedItem) {
23651
+ return selectedItem !== item;
23652
+ });
23653
+ } else {
23654
+ var _list;
23655
+
23656
+ (_list = list) === null || _list === void 0 ? void 0 : _list.push(item);
23657
+ }
23658
+
23659
+ list && (setSelectedItems === null || setSelectedItems === void 0 ? void 0 : setSelectedItems(_toConsumableArray(list)));
23660
+ onSelect && onSelect(list);
23661
+ };
23662
+
23663
+ var handleKeyDown = function handleKeyDown(event, item) {
23664
+ switch (event.key) {
23665
+ case 'Enter':
23666
+ onClickHandler(item);
23667
+ break;
23668
+ }
23669
+ };
23670
+
23671
+ return /*#__PURE__*/React.createElement(React.Fragment, null, avatarList.map(function (avatarItem, index) {
23672
+ var _classNames;
23673
+
23674
+ var appearance = avatarItem.appearance,
23675
+ firstName = avatarItem.firstName,
23676
+ lastName = avatarItem.lastName,
23677
+ icon = avatarItem.icon,
23678
+ image = avatarItem.image;
23679
+ var GroupClass = classnames((_classNames = {}, _defineProperty$1(_classNames, "SelectionAvatarGroup-item", true), _defineProperty$1(_classNames, "SelectionAvatarGroup-item--selected", selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.includes(avatarItem)), _classNames));
23680
+
23681
+ if (avatarRenderer) {
23682
+ return avatarRenderer(avatarItem);
23683
+ }
23684
+
23685
+ return /*#__PURE__*/React.createElement("span", {
23686
+ key: index,
23687
+ className: "SelectionAvatarGroup-wrapper"
23688
+ }, /*#__PURE__*/React.createElement("div", {
23689
+ tabIndex: 0,
23690
+ role: "checkbox",
23691
+ style: avatarStyle,
23692
+ className: GroupClass,
23693
+ "data-test": "DesignSystem-AvatarSelection--Avatar",
23694
+ "aria-checked": selectedItems && selectedItems.includes(avatarItem),
23695
+ onClick: function onClick() {
23696
+ return onClickHandler(avatarItem);
23697
+ },
23698
+ onKeyDown: function onKeyDown(event) {
23699
+ return handleKeyDown(event, avatarItem);
23700
+ }
23701
+ }, /*#__PURE__*/React.createElement(SelectionAvatar, {
23702
+ size: size,
23703
+ appearance: appearance,
23704
+ firstName: firstName,
23705
+ lastName: lastName,
23706
+ withTooltip: true,
23707
+ tooltipPosition: tooltipPosition,
23708
+ icon: icon,
23709
+ image: image
23710
+ })));
23711
+ }));
23712
+ };
23713
+
23714
+ var handleKeyDown$4 = function handleKeyDown(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem) {
23715
+ switch (event.key) {
23716
+ case 'Enter':
23717
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
23718
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(true);
23719
+ break;
23720
+
23721
+ case 'ArrowDown':
23722
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
23723
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(true);
23724
+ break;
23725
+
23726
+ case 'ArrowUp':
23727
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
23728
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(true);
23729
+ break;
23730
+ }
23731
+ };
23732
+ var focusListItem$2 = function focusListItem(position, setFocusedOption, listRef, withSearch) {
23733
+ var _listRef$current2, _targetOption, _targetOption2, _targetOption2$scroll;
23734
+
23735
+ if (withSearch && position === 'down') {
23736
+ var _listRef$current, _searchInput$;
23737
+
23738
+ var searchInput = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.querySelectorAll('[data-test="DesignSystem-AvatarSelection--Input"]');
23739
+ searchInput && ((_searchInput$ = searchInput[0]) === null || _searchInput$ === void 0 ? void 0 : _searchInput$.focus());
23740
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(searchInput);
23741
+ return;
23742
+ }
23743
+
23744
+ var listItems = (_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
23745
+ var targetOption;
23746
+
23747
+ if (position === 'down') {
23748
+ targetOption = listItems === null || listItems === void 0 ? void 0 : listItems[0];
23749
+ } else {
23750
+ targetOption = listItems === null || listItems === void 0 ? void 0 : listItems[listItems.length - 1];
23751
+ }
23752
+
23753
+ (_targetOption = targetOption) === null || _targetOption === void 0 ? void 0 : _targetOption.focus();
23754
+ (_targetOption2 = targetOption) === null || _targetOption2 === void 0 ? void 0 : (_targetOption2$scroll = _targetOption2.scrollIntoView) === null || _targetOption2$scroll === void 0 ? void 0 : _targetOption2$scroll.call(_targetOption2, {
23755
+ block: 'center'
23756
+ });
23757
+ setFocusedOption && setFocusedOption(targetOption);
23758
+ };
23759
+
23760
+ var AvatarSelectionCount = function AvatarSelectionCount(props) {
23761
+ var _classNames;
23762
+
23763
+ var hiddenAvatarCount = props.hiddenAvatarCount,
23764
+ avatarStyle = props.avatarStyle,
23765
+ size = props.size,
23766
+ hiddenAvatarList = props.hiddenAvatarList;
23767
+ var contextProp = React.useContext(AvatarSelectionContext);
23768
+ var selectedItems = contextProp.selectedItems,
23769
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
23770
+ setHighlightLastItem = contextProp.setHighlightLastItem,
23771
+ triggerRef = contextProp.triggerRef,
23772
+ setOpenPopover = contextProp.setOpenPopover,
23773
+ openPopover = contextProp.openPopover,
23774
+ popoverId = contextProp.popoverId;
23775
+
23776
+ var _React$useState = React.useState(0),
23777
+ _React$useState2 = _slicedToArray(_React$useState, 2),
23778
+ selectedItemCount = _React$useState2[0],
23779
+ setSelectedItemCount = _React$useState2[1];
23780
+
23781
+ var wrapperClassName = classnames((_classNames = {}, _defineProperty$1(_classNames, 'SelectionAvatarCount-wrapper', true), _defineProperty$1(_classNames, 'SelectionAvatarCount--selected', selectedItemCount > 0), _classNames));
23782
+ React.useEffect(function () {
23783
+ var selectedList = hiddenAvatarList.filter(function (data1) {
23784
+ return selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.some(function (data2) {
23785
+ return data2 === data1;
23786
+ });
23787
+ });
23788
+ setSelectedItemCount(selectedList.length);
23789
+ }, [selectedItems]);
23790
+ return /*#__PURE__*/React.createElement("div", {
23791
+ "data-test": "DesignSystem-AvatarSelection--TriggerAvatar",
23792
+ className: wrapperClassName,
23793
+ onKeyDown: function onKeyDown(event) {
23794
+ return handleKeyDown$4(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem);
23795
+ },
23796
+ style: avatarStyle,
23797
+ tabIndex: 0,
23798
+ role: "button",
23799
+ "aria-haspopup": "listbox",
23800
+ "aria-expanded": openPopover,
23801
+ "aria-controls": popoverId,
23802
+ ref: triggerRef
23803
+ }, /*#__PURE__*/React.createElement(Avatar, {
23804
+ size: size,
23805
+ appearance: "secondary",
23806
+ className: "SelectionAvatarCount cursor-pointer"
23807
+ }, /*#__PURE__*/React.createElement(Text, {
23808
+ className: "overflow-hidden"
23809
+ }, "+".concat(hiddenAvatarCount))));
23810
+ };
23811
+
23812
+ var handleKeyDown$3 = function handleKeyDown(event, focusedOption, setFocusedOption, setHighlightFirstItem, setHighlightLastItem, listRef, withSearch, setOpenPopover, triggerRef) {
23813
+ switch (event.key) {
23814
+ case 'ArrowUp':
23815
+ event.preventDefault();
23816
+ navigateOptions$2('up', focusedOption, setFocusedOption, listRef, withSearch);
23817
+ break;
23818
+
23819
+ case 'ArrowDown':
23820
+ event.preventDefault();
23821
+ navigateOptions$2('down', focusedOption, setFocusedOption, listRef, withSearch);
23822
+ break;
23823
+
23824
+ case 'Enter':
23825
+ handleEnterKey$2(focusedOption);
23826
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(false);
23827
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(false);
23828
+ break;
23829
+
23830
+ case 'Escape':
23831
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
23832
+ triggerRef.current.focus();
23833
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(undefined);
23834
+ break;
23835
+ }
23836
+ };
23837
+
23838
+ var handleEnterKey$2 = function handleEnterKey(focusedOption) {
23839
+ focusedOption === null || focusedOption === void 0 ? void 0 : focusedOption.click();
23840
+ };
23841
+
23842
+ var navigateOptions$2 = function navigateOptions(direction, focusedOption, setFocusedOption, listRef, withSearch) {
23843
+ var listItems = listRef === null || listRef === void 0 ? void 0 : listRef.current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
23844
+ var index = Array.from(listItems).findIndex(function (item) {
23845
+ return item == focusedOption;
23846
+ });
23847
+
23848
+ if (index === -1) {
23849
+ index = direction === 'up' ? listItems.length - 1 : 0;
23850
+ } else if (withSearch && index === 0 && direction === 'up' || withSearch && index === listItems.length - 1 && direction === 'down') {
23851
+ var searchInput = listRef.current.querySelector('[data-test="DesignSystem-AvatarSelection--Input"]');
23852
+ searchInput.focus();
23853
+ setFocusedOption && setFocusedOption(searchInput);
23854
+ } else {
23855
+ index = direction === 'up' ? (index - 1 + listItems.length) % listItems.length : (index + 1) % listItems.length;
23856
+ var targetOption = listItems[index];
23857
+ targetOption.focus();
23858
+ setFocusedOption && setFocusedOption(targetOption);
23859
+ targetOption.scrollIntoView({
23860
+ block: 'center'
23861
+ });
23862
+ }
23863
+ };
23864
+
23865
+ var handleInputKeyDown$1 = function handleInputKeyDown(event, listRef, setFocusedOption, setOpenPopover, triggerRef) {
23866
+ var _listRef$current, _targetOption, _targetOption2, _targetOption2$scroll;
23867
+
23868
+ var listItems = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
23869
+ var targetOption;
23870
+
23871
+ switch (event.key) {
23872
+ case 'ArrowUp':
23873
+ event.preventDefault();
23874
+ targetOption = listItems[listItems.length - 1];
23875
+ break;
23876
+
23877
+ case 'ArrowDown':
23878
+ event.preventDefault();
23879
+ targetOption = listItems[0];
23880
+ break;
23881
+
23882
+ case 'Escape':
23883
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
23884
+ triggerRef.current.focus();
23885
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(undefined);
23886
+ break;
23887
+ }
23888
+
23889
+ (_targetOption = targetOption) === null || _targetOption === void 0 ? void 0 : _targetOption.focus();
23890
+ (_targetOption2 = targetOption) === null || _targetOption2 === void 0 ? void 0 : (_targetOption2$scroll = _targetOption2.scrollIntoView) === null || _targetOption2$scroll === void 0 ? void 0 : _targetOption2$scroll.call(_targetOption2, {
23891
+ block: 'center'
23892
+ });
23893
+ setFocusedOption && setFocusedOption(targetOption);
23894
+ };
23895
+
23896
+ var AvatarSelectionInput = function AvatarSelectionInput(props) {
23897
+ var contextProp = React.useContext(AvatarSelectionContext);
23898
+ var listRef = contextProp.listRef,
23899
+ setFocusedOption = contextProp.setFocusedOption,
23900
+ setOpenPopover = contextProp.setOpenPopover,
23901
+ triggerRef = contextProp.triggerRef;
23902
+ return /*#__PURE__*/React.createElement("div", {
23903
+ className: "SelectionAvatar-inputWrapper"
23904
+ }, /*#__PURE__*/React.createElement(Input, _extends$2({
23905
+ icon: "search",
23906
+ onKeyDown: function onKeyDown(event) {
23907
+ return handleInputKeyDown$1(event, listRef, setFocusedOption, setOpenPopover, triggerRef);
23908
+ },
23909
+ className: "w-100 SelectionAvatar-input",
23910
+ "data-test": "DesignSystem-AvatarSelection--Input"
23911
+ }, props)));
23912
+ };
23913
+
23914
+ var AvatarSelectionList = function AvatarSelectionList(props) {
23915
+ return /*#__PURE__*/React.createElement(Listbox, props, props.children);
23916
+ };
23917
+ AvatarSelectionList.defaultProps = {
23918
+ type: 'option',
23919
+ showDivider: false,
23920
+ size: 'compressed',
23921
+ tagName: 'ul'
23922
+ };
23923
+
23924
+ var _excluded$9 = ["children", "value"];
23925
+ var AvatarSelectionOption = function AvatarSelectionOption(props) {
23926
+ var children = props.children,
23927
+ value = props.value,
23928
+ rest = _objectWithoutProperties(props, _excluded$9);
23929
+
23930
+ var contextProp = React.useContext(AvatarSelectionContext);
23931
+ var setSelectedItems = contextProp.setSelectedItems,
23932
+ selectedItems = contextProp.selectedItems,
23933
+ onSelect = contextProp.onSelect,
23934
+ focusedOption = contextProp.focusedOption,
23935
+ setFocusedOption = contextProp.setFocusedOption,
23936
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
23937
+ setHighlightLastItem = contextProp.setHighlightLastItem,
23938
+ listRef = contextProp.listRef,
23939
+ withSearch = contextProp.withSearch,
23940
+ setOpenPopover = contextProp.setOpenPopover,
23941
+ triggerRef = contextProp.triggerRef;
23942
+
23943
+ var onSelectHandler = function onSelectHandler(event, avatarData) {
23944
+ event.preventDefault();
23945
+ var list = selectedItems ? _toConsumableArray(selectedItems) : [];
23946
+
23947
+ if (selectedItems !== null && selectedItems !== void 0 && selectedItems.includes(avatarData)) {
23948
+ list = selectedItems.filter(function (selectedItem) {
23949
+ return selectedItem !== avatarData;
23950
+ });
23951
+ } else {
23952
+ list.push(avatarData);
23953
+ }
23954
+
23955
+ setSelectedItems === null || setSelectedItems === void 0 ? void 0 : setSelectedItems(_toConsumableArray(list));
23956
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
23957
+ onSelect && onSelect(list);
23958
+ };
23959
+
23960
+ var onKeyDownHandler = function onKeyDownHandler(event) {
23961
+ handleKeyDown$3(event, focusedOption, setFocusedOption, setHighlightFirstItem, setHighlightLastItem, listRef, withSearch, setOpenPopover, triggerRef);
23962
+ };
23963
+
23964
+ return /*#__PURE__*/React.createElement(Listbox.Item, _extends$2({
23965
+ onClick: function onClick(event) {
23966
+ return onSelectHandler(event, value);
23967
+ },
23968
+ onKeyDown: function onKeyDown(event) {
23969
+ return onKeyDownHandler(event);
23970
+ },
23971
+ selected: selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.includes(value),
23972
+ "data-test": "DesignSystem-AvatarSelection--Option",
23973
+ tabIndex: -1
23974
+ }, rest), children);
23975
+ };
23976
+ AvatarSelectionOption.defaultProps = {
23977
+ tagName: 'li'
23978
+ };
23979
+
23980
+ var AvatarSelectionEmptyState = function AvatarSelectionEmptyState(props) {
23981
+ var height = props.height,
23982
+ title = props.title,
23983
+ description = props.description;
23984
+ return /*#__PURE__*/React.createElement("div", {
23985
+ className: "d-flex flex-column justify-content-center align-items-center",
23986
+ style: {
23987
+ height: height ? height - 4 : ''
23988
+ },
23989
+ "data-test": "DesignSystem-AvatarSelection--EmptyState"
23990
+ }, title && /*#__PURE__*/React.createElement(Text, {
23991
+ className: "text-align-center mb-3",
23992
+ weight: "strong"
23993
+ }, title), description && /*#__PURE__*/React.createElement(Text, {
23994
+ className: "text-align-center mb-6",
23995
+ weight: "medium",
23996
+ size: "small",
23997
+ appearance: "subtle"
23998
+ }, description));
23999
+ };
24000
+
24001
+ var AvatarSelectionPopover = function AvatarSelectionPopover(props) {
24002
+ var _classNames;
24003
+
24004
+ var hiddenAvatarList = props.hiddenAvatarList,
24005
+ customStyle = props.customStyle,
24006
+ searchPlaceholder = props.searchPlaceholder,
24007
+ searchComparator = props.searchComparator,
24008
+ children = props.children;
24009
+
24010
+ var _React$useState = React.useState(hiddenAvatarList),
24011
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24012
+ searchList = _React$useState2[0],
24013
+ setSearchList = _React$useState2[1];
24014
+
24015
+ var _React$useState3 = React.useState(''),
24016
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
24017
+ searchValue = _React$useState4[0],
24018
+ setSearchValue = _React$useState4[1];
24019
+
24020
+ var contextProp = React.useContext(AvatarSelectionContext);
24021
+ var selectedItems = contextProp.selectedItems,
24022
+ listRef = contextProp.listRef,
24023
+ withSearch = contextProp.withSearch,
24024
+ popoverId = contextProp.popoverId;
24025
+
24026
+ if (children) {
24027
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
24028
+ }
24029
+
24030
+ var onSearchHandler = function onSearchHandler(event) {
24031
+ var searchValue = event.target.value;
24032
+ var list = hiddenAvatarList === null || hiddenAvatarList === void 0 ? void 0 : hiddenAvatarList.filter(function (avatarData) {
24033
+ var _firstName$toLowerCas, _lastName$toLowerCase;
24034
+
24035
+ var firstName = avatarData.firstName,
24036
+ lastName = avatarData.lastName;
24037
+
24038
+ if (searchComparator) {
24039
+ return searchComparator(searchValue, avatarData);
24040
+ }
24041
+
24042
+ return (firstName === null || firstName === void 0 ? void 0 : (_firstName$toLowerCas = firstName.toLowerCase()) === null || _firstName$toLowerCas === void 0 ? void 0 : _firstName$toLowerCas.startsWith(searchValue.toLowerCase())) || (lastName === null || lastName === void 0 ? void 0 : (_lastName$toLowerCase = lastName.toLowerCase()) === null || _lastName$toLowerCase === void 0 ? void 0 : _lastName$toLowerCase.startsWith(searchValue.toLowerCase()));
24043
+ });
24044
+ setSearchValue(searchValue);
24045
+ setSearchList(list);
24046
+ };
24047
+
24048
+ var onClearHandler = function onClearHandler() {
24049
+ setSearchValue('');
24050
+ setSearchList(hiddenAvatarList);
24051
+ };
24052
+
24053
+ var popperClassName = classnames((_classNames = {}, _defineProperty$1(_classNames, 'py-3', !withSearch), _defineProperty$1(_classNames, 'pb-3', withSearch), _defineProperty$1(_classNames, 'SelectionAvatarGroup-popper', true), _defineProperty$1(_classNames, 'overflow-hidden', true), _classNames));
24054
+ return /*#__PURE__*/React.createElement("div", {
24055
+ style: {
24056
+ width: customStyle.width
24057
+ },
24058
+ ref: listRef,
24059
+ "data-test": "DesignSystem-AvatarSelection--Popover",
24060
+ id: popoverId
24061
+ }, withSearch && /*#__PURE__*/React.createElement(AvatarSelectionInput, {
24062
+ placeholder: searchPlaceholder,
24063
+ onChange: onSearchHandler,
24064
+ value: searchValue,
24065
+ onClear: onClearHandler
24066
+ }), /*#__PURE__*/React.createElement("div", {
24067
+ style: customStyle,
24068
+ className: popperClassName
24069
+ }, searchList.length === 0 && /*#__PURE__*/React.createElement(AvatarSelectionEmptyState, {
24070
+ height: customStyle.maxHeight,
24071
+ title: "No users found",
24072
+ description: "Try modifying your search to find what you are looking for."
24073
+ }), /*#__PURE__*/React.createElement(AvatarSelectionList, null, searchList.map(function (avatarData, index) {
24074
+ var _avatarData$firstName = avatarData.firstName,
24075
+ firstName = _avatarData$firstName === void 0 ? '' : _avatarData$firstName,
24076
+ _avatarData$lastName = avatarData.lastName,
24077
+ lastName = _avatarData$lastName === void 0 ? '' : _avatarData$lastName;
24078
+ var name = "".concat(firstName, " ").concat(lastName);
24079
+ var isSelected = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.includes(avatarData);
24080
+ return /*#__PURE__*/React.createElement(AvatarSelectionOption, {
24081
+ key: index,
24082
+ value: avatarData
24083
+ }, /*#__PURE__*/React.createElement(Checkbox, {
24084
+ defaultChecked: isSelected,
24085
+ checked: isSelected,
24086
+ label: name,
24087
+ size: "regular",
24088
+ tabIndex: -1,
24089
+ className: "ellipsis--noWrap",
24090
+ "data-test": "DesignSystem-AvatarSelection--Checkbox"
24091
+ }));
24092
+ }))));
24093
+ };
24094
+
24095
+ var AvatarSelection = function AvatarSelection(props) {
24096
+ var max = props.max,
24097
+ borderColor = props.borderColor,
24098
+ tooltipPosition = props.tooltipPosition,
24099
+ list = props.list,
24100
+ className = props.className,
24101
+ size = props.size,
24102
+ avatarRenderer = props.avatarRenderer,
24103
+ onSelect = props.onSelect,
24104
+ width = props.width,
24105
+ maxHeight = props.maxHeight,
24106
+ minHeight = props.minHeight,
24107
+ searchPlaceholder = props.searchPlaceholder,
24108
+ withSearch = props.withSearch,
24109
+ searchComparator = props.searchComparator,
24110
+ children = props.children;
24111
+
24112
+ var _React$useState = React.useState([]),
24113
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24114
+ selectedItems = _React$useState2[0],
24115
+ setSelectedItems = _React$useState2[1];
24116
+
24117
+ var _React$useState3 = React.useState(false),
24118
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
24119
+ openPopover = _React$useState4[0],
24120
+ setOpenPopover = _React$useState4[1];
24121
+
24122
+ var _React$useState5 = React.useState(),
24123
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
24124
+ focusedOption = _React$useState6[0],
24125
+ setFocusedOption = _React$useState6[1];
24126
+
24127
+ var _React$useState7 = React.useState(false),
24128
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
24129
+ highlightFirstItem = _React$useState8[0],
24130
+ setHighlightFirstItem = _React$useState8[1];
24131
+
24132
+ var _React$useState9 = React.useState(false),
24133
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
24134
+ highlightLastItem = _React$useState10[0],
24135
+ setHighlightLastItem = _React$useState10[1];
24136
+
24137
+ var listRef = /*#__PURE__*/React.createRef();
24138
+ var triggerRef = /*#__PURE__*/React.createRef();
24139
+ React.useEffect(function () {
24140
+ var selectedList = [];
24141
+ list.forEach(function (avatarItem) {
24142
+ if (avatarItem.selected) {
24143
+ selectedList.push(avatarItem);
24144
+ }
24145
+ });
24146
+ setSelectedItems(selectedList);
24147
+ }, []);
24148
+ React.useEffect(function () {
24149
+ if (!openPopover) {
24150
+ setHighlightFirstItem(false);
24151
+ setHighlightLastItem(false);
24152
+ } else {
24153
+ setHighlightFirstItem(true);
24154
+ }
24155
+ }, [openPopover]);
24156
+ React.useEffect(function () {
24157
+ if (highlightFirstItem && openPopover) {
24158
+ requestAnimationFrame(function () {
24159
+ return focusListItem$2('down', setFocusedOption, listRef, withSearch);
24160
+ });
24161
+ }
24162
+ }, [highlightFirstItem]);
24163
+ React.useEffect(function () {
24164
+ if (highlightLastItem && openPopover) {
24165
+ requestAnimationFrame(function () {
24166
+ return focusListItem$2('up', setFocusedOption, listRef, withSearch);
24167
+ });
24168
+ }
24169
+ }, [highlightLastItem]);
24170
+ var baseProps = extractBaseProps(props);
24171
+ var hiddenAvatarCount = list.length - max;
24172
+ var avatarStyle = {
24173
+ backgroundColor: "".concat(borderColor),
24174
+ boxShadow: "0 0 0 calc(var(--spacing-xs) + var(--spacing-s)) ".concat(borderColor)
24175
+ };
24176
+ var AvatarSelectionClass = classnames(_defineProperty$1({}, 'SelectionAvatarGroup', true), className);
24177
+ var searchInputHeight = 36;
24178
+ var searchBorder = 1;
24179
+ var customStyle = {
24180
+ width: width,
24181
+ minHeight: minHeight,
24182
+ maxHeight: withSearch ? maxHeight - searchInputHeight - searchBorder : maxHeight
24183
+ };
24184
+ var hiddenAvatarList = list.slice(max, list.length);
24185
+ var popoverId = "DesignSystem-AvatarSelection-Popover-".concat(uidGenerator());
24186
+ var popoverProps = {
24187
+ hiddenAvatarList: hiddenAvatarList,
24188
+ customStyle: customStyle,
24189
+ searchPlaceholder: searchPlaceholder,
24190
+ searchComparator: searchComparator,
24191
+ children: children
24192
+ };
24193
+ var triggerProps = {
24194
+ size: size,
24195
+ avatarStyle: avatarStyle,
24196
+ hiddenAvatarCount: hiddenAvatarCount,
24197
+ hiddenAvatarList: hiddenAvatarList
24198
+ };
24199
+
24200
+ var onToggleHandler = function onToggleHandler(open) {
24201
+ open ? setOpenPopover(true) : setOpenPopover(false);
24202
+ };
24203
+
24204
+ var contextProp = {
24205
+ listRef: listRef,
24206
+ onSelect: onSelect,
24207
+ withSearch: withSearch,
24208
+ triggerRef: triggerRef,
24209
+ selectedItems: selectedItems,
24210
+ focusedOption: focusedOption,
24211
+ openPopover: openPopover,
24212
+ setSelectedItems: setSelectedItems,
24213
+ setFocusedOption: setFocusedOption,
24214
+ setHighlightFirstItem: setHighlightFirstItem,
24215
+ setHighlightLastItem: setHighlightLastItem,
24216
+ setOpenPopover: setOpenPopover,
24217
+ popoverId: popoverId
24218
+ };
24219
+ return /*#__PURE__*/React.createElement(AvatarSelectionContext.Provider, {
24220
+ value: contextProp
24221
+ }, /*#__PURE__*/React.createElement("div", _extends$2({
24222
+ "data-test": "DesignSystem-AvatarSelection"
24223
+ }, baseProps, {
24224
+ className: AvatarSelectionClass
24225
+ }), /*#__PURE__*/React.createElement(SelectionAvatarsWrapper, {
24226
+ size: size,
24227
+ avatarStyle: avatarStyle,
24228
+ avatarList: list.slice(0, max),
24229
+ avatarRenderer: avatarRenderer,
24230
+ tooltipPosition: tooltipPosition
24231
+ }), (hiddenAvatarCount > 0 || children && hiddenAvatarCount > 0) && /*#__PURE__*/React.createElement(Popover, {
24232
+ open: openPopover,
24233
+ position: "bottom-end",
24234
+ trigger: /*#__PURE__*/React.createElement(AvatarSelectionCount, triggerProps),
24235
+ triggerClass: "flex-grow-0",
24236
+ onToggle: onToggleHandler
24237
+ }, /*#__PURE__*/React.createElement(AvatarSelectionPopover, popoverProps))));
24238
+ };
24239
+ AvatarSelection.displayName = 'AvatarSelection';
24240
+ AvatarSelection.defaultProps = {
24241
+ max: 5,
24242
+ tooltipPosition: 'bottom',
24243
+ borderColor: 'white',
24244
+ size: 'regular',
24245
+ width: 176,
24246
+ maxHeight: 256
24247
+ };
24248
+ AvatarSelection.Input = AvatarSelectionInput;
24249
+ AvatarSelection.List = AvatarSelectionList;
24250
+ AvatarSelection.Option = AvatarSelectionOption;
24251
+ AvatarSelection.EmptyState = AvatarSelectionEmptyState;
24252
+
24253
+ var ComboboxList = function ComboboxList(props) {
24254
+ return /*#__PURE__*/React.createElement(Listbox, _extends$2({
24255
+ className: "py-3"
24256
+ }, props, {
24257
+ role: "listbox"
24258
+ }), props.children);
24259
+ };
24260
+ ComboboxList.defaultProps = {
24261
+ type: 'option',
24262
+ showDivider: false,
24263
+ tagName: 'ul',
24264
+ size: 'compressed'
24265
+ };
24266
+
24267
+ var ComboboxContext = /*#__PURE__*/React.createContext({});
24268
+
24269
+ var handleKeyDown$2 = function handleKeyDown(event, focusedOption, setFocusedOption, setOpenPopover, inputTriggerRef, setHighlightFirstItem, setHighlightLastItem, multiSelect, listRef) {
24270
+ switch (event.key) {
24271
+ case 'ArrowUp':
24272
+ event.preventDefault();
24273
+ navigateOptions$1('up', focusedOption, setFocusedOption, listRef);
24274
+ break;
24275
+
24276
+ case 'ArrowDown':
24277
+ event.preventDefault();
24278
+ navigateOptions$1('down', focusedOption, setFocusedOption, listRef);
24279
+ break;
24280
+
24281
+ case 'Enter':
24282
+ handleEnterKey$1(focusedOption, multiSelect, inputTriggerRef, listRef, setFocusedOption);
24283
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(false);
24284
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(false);
24285
+ break;
24286
+
24287
+ case 'Escape':
24288
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
24289
+ inputTriggerRef.current.focus();
24290
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(undefined);
24291
+ break;
24292
+ }
24293
+ };
24294
+
24295
+ var handleEnterKey$1 = function handleEnterKey(focusedOption, multiSelect, inputTriggerRef, listRef, setFocusedOption) {
24296
+ focusedOption === null || focusedOption === void 0 ? void 0 : focusedOption.click();
24297
+
24298
+ if (!multiSelect) {
24299
+ inputTriggerRef.current.focus();
24300
+ } else {
24301
+ // to focus first option by default when last option is selected
24302
+ var listItems = listRef.current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
24303
+ var listArr = Array.from(listItems);
24304
+ var index = listArr.findIndex(function (item) {
24305
+ return item == focusedOption;
24306
+ });
24307
+
24308
+ if (index === listArr.length - 1) {
24309
+ listItems[0].focus();
24310
+ setFocusedOption && setFocusedOption(listItems[0]);
24311
+ listItems[0].scrollIntoView({
24312
+ block: 'center'
24313
+ });
24314
+ }
24315
+ }
24316
+ };
24317
+
24318
+ var navigateOptions$1 = function navigateOptions(direction, focusedOption, setFocusedOption, listRef) {
24319
+ var _targetOption$scrollI;
24320
+
24321
+ var listItems = listRef.current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
24322
+ var index = Array.from(listItems).findIndex(function (item) {
24323
+ return item == focusedOption;
24324
+ });
24325
+
24326
+ if (index === -1) {
24327
+ index = direction === 'up' ? listItems.length - 1 : 0;
24328
+ } else {
24329
+ index = direction === 'up' ? (index - 1 + listItems.length) % listItems.length : (index + 1) % listItems.length;
24330
+ }
24331
+
24332
+ var targetOption = listItems[index];
24333
+ targetOption.focus();
24334
+ setFocusedOption && setFocusedOption(targetOption);
24335
+ targetOption === null || targetOption === void 0 ? void 0 : (_targetOption$scrollI = targetOption.scrollIntoView) === null || _targetOption$scrollI === void 0 ? void 0 : _targetOption$scrollI.call(targetOption, {
24336
+ block: 'center'
24337
+ });
24338
+ };
24339
+
24340
+ var _excluded$8 = ["children", "option", "onClick"];
24341
+ var ComboboxOption = function ComboboxOption(props) {
24342
+ var children = props.children,
24343
+ option = props.option,
24344
+ onClick = props.onClick,
24345
+ rest = _objectWithoutProperties(props, _excluded$8);
24346
+
24347
+ var contextProp = React.useContext(ComboboxContext);
24348
+ var onOptionClick = contextProp.onOptionClick,
24349
+ inputValue = contextProp.inputValue,
24350
+ focusedOption = contextProp.focusedOption,
24351
+ setFocusedOption = contextProp.setFocusedOption,
24352
+ setOpenPopover = contextProp.setOpenPopover,
24353
+ inputTriggerRef = contextProp.inputTriggerRef,
24354
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
24355
+ setHighlightLastItem = contextProp.setHighlightLastItem,
24356
+ multiSelect = contextProp.multiSelect,
24357
+ listRef = contextProp.listRef;
24358
+
24359
+ var onClickHandler = function onClickHandler() {
24360
+ if (onClick) {
24361
+ return onClick(option);
24362
+ }
24363
+
24364
+ return onOptionClick && onOptionClick(_objectSpread2(_objectSpread2({}, option), {}, {
24365
+ isSelectedOption: true
24366
+ }));
24367
+ };
24368
+
24369
+ var onKeyDownHandler = function onKeyDownHandler(event) {
24370
+ handleKeyDown$2(event, focusedOption, setFocusedOption, setOpenPopover, inputTriggerRef, setHighlightFirstItem, setHighlightLastItem, multiSelect, listRef);
24371
+ };
24372
+
24373
+ return /*#__PURE__*/React.createElement(Listbox.Item, _extends$2({
24374
+ onClick: onClickHandler,
24375
+ selected: option.label === (inputValue === null || inputValue === void 0 ? void 0 : inputValue.label),
24376
+ onKeyDown: onKeyDownHandler,
24377
+ tabIndex: -1,
24378
+ role: "option",
24379
+ "data-test": "DesignSystem-Combobox-Option"
24380
+ }, rest), children);
24381
+ };
24382
+ ComboboxOption.defaultProps = {
24383
+ tagName: 'li'
24384
+ };
24385
+
24386
+ var handleKeyDown$1 = function handleKeyDown(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem) {
24387
+ switch (event.key) {
24388
+ case 'ArrowUp':
24389
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24390
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(true);
24391
+ break;
24392
+
24393
+ case 'ArrowDown':
24394
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24395
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(true);
24396
+ break;
24397
+
24398
+ case 'Escape':
24399
+ case 'Tab':
24400
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
24401
+ break;
24402
+ }
24403
+ };
24404
+ var focusListItem$1 = function focusListItem(position, setFocusedOption, listRef) {
24405
+ var _listRef$current, _targetOption;
24406
+
24407
+ var listItems = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
24408
+ var targetOption;
24409
+
24410
+ if (position === 'down') {
24411
+ targetOption = listItems === null || listItems === void 0 ? void 0 : listItems[0];
24412
+ } else {
24413
+ targetOption = listItems[listItems.length - 1];
24414
+ }
24415
+
24416
+ (_targetOption = targetOption) === null || _targetOption === void 0 ? void 0 : _targetOption.focus();
24417
+
24418
+ if (targetOption && typeof targetOption.scrollIntoView === 'function') {
24419
+ var _targetOption2;
24420
+
24421
+ (_targetOption2 = targetOption) === null || _targetOption2 === void 0 ? void 0 : _targetOption2.scrollIntoView({
24422
+ block: 'center',
24423
+ behavior: 'smooth'
24424
+ });
24425
+ }
24426
+
24427
+ setFocusedOption && setFocusedOption(targetOption);
24428
+ };
24429
+
24430
+ var InputBox = function InputBox(props) {
24431
+ var contextProp = React.useContext(ComboboxContext);
24432
+ var inputValue = contextProp.inputValue,
24433
+ setInputValue = contextProp.setInputValue,
24434
+ setFocusedOption = contextProp.setFocusedOption,
24435
+ setOpenPopover = contextProp.setOpenPopover,
24436
+ inputTriggerRef = contextProp.inputTriggerRef,
24437
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
24438
+ setHighlightLastItem = contextProp.setHighlightLastItem,
24439
+ openPopover = contextProp.openPopover,
24440
+ popoverId = contextProp.popoverId;
24441
+
24442
+ var onChangeHandler = function onChangeHandler(event) {
24443
+ var value = event.target.value;
24444
+ setFocusedOption && setFocusedOption(undefined);
24445
+ var newValue = {
24446
+ label: value,
24447
+ value: value,
24448
+ isSelectedOption: false
24449
+ };
24450
+ setInputValue && setInputValue(newValue);
24451
+
24452
+ if (value !== '') {
24453
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24454
+ }
24455
+ };
24456
+
24457
+ var onClearHandler = function onClearHandler(event) {
24458
+ var _props$onClear;
24459
+
24460
+ event.stopPropagation();
24461
+ var newValue = {
24462
+ label: '',
24463
+ value: '',
24464
+ isSelectedOption: false
24465
+ };
24466
+ setInputValue && setInputValue(newValue);
24467
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24468
+ (_props$onClear = props.onClear) === null || _props$onClear === void 0 ? void 0 : _props$onClear.call(props, event);
24469
+ };
24470
+
24471
+ var onKeyDownHandler = function onKeyDownHandler(event) {
24472
+ handleKeyDown$1(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem);
24473
+ };
24474
+
24475
+ return /*#__PURE__*/React.createElement(Input, _extends$2({}, props, {
24476
+ ref: inputTriggerRef,
24477
+ value: inputValue === null || inputValue === void 0 ? void 0 : inputValue.label,
24478
+ onChange: onChangeHandler,
24479
+ onKeyDown: onKeyDownHandler,
24480
+ onClear: onClearHandler,
24481
+ role: "combobox",
24482
+ "aria-haspopup": "listbox",
24483
+ "aria-controls": popoverId,
24484
+ "aria-label": props.placeholder || 'Combobox-Input-Trigger',
24485
+ "aria-expanded": openPopover,
24486
+ "data-test": "DesignSystem-Combobox-Input"
24487
+ }));
24488
+ };
24489
+
24490
+ var _excluded$7 = ["chipOptions", "allowDuplicates", "disabled", "error", "placeholder", "defaultValue", "value", "className", "autoFocus", "onChange", "onBlur", "onFocus", "onKeyDown", "onInputChange", "tabIndex", "role"],
24491
+ _excluded2 = ["type", "onClick"];
24492
+ var keyCodes = {
24493
+ BACKSPACE: 'Backspace',
24494
+ DELETE: 'Delete',
24495
+ ENTER: 'Enter'
24496
+ };
24497
+ var MultiSelectTrigger = function MultiSelectTrigger(props) {
24498
+ var _classNames, _classNames2;
24499
+
24500
+ var chipOptions = props.chipOptions,
24501
+ allowDuplicates = props.allowDuplicates,
24502
+ disabled = props.disabled,
24503
+ error = props.error,
24504
+ placeholder = props.placeholder,
24505
+ defaultValue = props.defaultValue,
24506
+ value = props.value,
24507
+ className = props.className,
24508
+ autoFocus = props.autoFocus,
24509
+ onChange = props.onChange,
24510
+ onBlur = props.onBlur,
24511
+ onFocus = props.onFocus,
24512
+ onKeyDown = props.onKeyDown,
24513
+ onInputChange = props.onInputChange,
24514
+ tabIndex = props.tabIndex,
24515
+ role = props.role,
24516
+ rest = _objectWithoutProperties(props, _excluded$7);
24517
+
24518
+ var inputRef = /*#__PURE__*/React.createRef();
24519
+
24520
+ var _React$useState = React.useState(value || defaultValue),
24521
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24522
+ chips = _React$useState2[0],
24523
+ setChips = _React$useState2[1];
24524
+
24525
+ var _React$useState3 = React.useState(''),
24526
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
24527
+ inputValue = _React$useState4[0],
24528
+ setInputValue = _React$useState4[1];
24529
+
24530
+ var baseProps = extractBaseProps(props);
24531
+ React.useEffect(function () {
24532
+ if (value !== undefined) {
24533
+ setChips(value);
24534
+ setInputValue('');
24535
+ }
24536
+ }, [value]);
24537
+ var ChipInputBorderClass = classnames((_classNames = {}, _defineProperty$1(_classNames, 'ChipInput-border', true), _defineProperty$1(_classNames, 'ChipInput-border--error', error), _classNames));
24538
+ var ChipInputClass = classnames((_classNames2 = {
24539
+ ChipInput: true
24540
+ }, _defineProperty$1(_classNames2, 'ChipInput--disabled', disabled), _defineProperty$1(_classNames2, 'ChipInput--withChips', chips && chips.length > 0), _defineProperty$1(_classNames2, 'ChipInput--error', error), _classNames2), className);
24541
+
24542
+ var onUpdateChips = function onUpdateChips(updatedChips) {
24543
+ if (onChange) onChange(updatedChips);
24544
+ };
24545
+
24546
+ var onChipDeleteHandler = function onChipDeleteHandler(index) {
24547
+ var updatedChips = _toConsumableArray(chips);
24548
+
24549
+ updatedChips.splice(index, 1);
24550
+
24551
+ if (!value) {
24552
+ setChips(updatedChips);
24553
+ }
24554
+
24555
+ onUpdateChips(updatedChips);
24556
+ };
24557
+
24558
+ var onChipAddHandler = function onChipAddHandler() {
24559
+ if (!inputValue) return;
24560
+ var chip = inputValue.trim();
24561
+ var isChipExist = chips.filter(function (item) {
24562
+ return item.label === chip;
24563
+ }).length > 0;
24564
+
24565
+ if ((allowDuplicates || !isChipExist) && chip) {
24566
+ var updatedChips = [].concat(_toConsumableArray(chips), [{
24567
+ label: chip,
24568
+ value: chip,
24569
+ isSelectedOption: false
24570
+ }]);
24571
+
24572
+ if (!value) {
24573
+ setChips(updatedChips);
24574
+ }
24575
+
24576
+ onUpdateChips(updatedChips);
24577
+ setInputValue('');
24578
+ }
24579
+ };
24580
+
24581
+ var onDeleteAllHandler = function onDeleteAllHandler(e) {
24582
+ e.stopPropagation();
24583
+ var updatedChips = [];
24584
+
24585
+ if (!value) {
24586
+ setChips(updatedChips);
24587
+ }
24588
+
24589
+ onUpdateChips(updatedChips);
24590
+ setInputValue('');
24591
+ onInputChange && onInputChange();
24592
+ };
24593
+
24594
+ var onKeyDownHandler = function onKeyDownHandler(event) {
24595
+ var chipsLength = chips.length;
24596
+
24597
+ switch (event.key) {
24598
+ case keyCodes.DELETE:
24599
+ case keyCodes.BACKSPACE:
24600
+ if (inputValue === '' && chipsLength > 0) {
24601
+ onChipDeleteHandler(chipsLength - 1);
24602
+ }
24603
+
24604
+ break;
24605
+
24606
+ case keyCodes.ENTER:
24607
+ event.preventDefault();
24608
+ onChipAddHandler();
24609
+ break;
24610
+ }
24611
+
24612
+ onKeyDown && onKeyDown(event);
24613
+ };
24614
+
24615
+ var onInputChangeHandler = function onInputChangeHandler(event) {
24616
+ setInputValue(event.target.value);
24617
+ onInputChange && onInputChange(event);
24618
+ };
24619
+
24620
+ var onClickHandler = function onClickHandler() {
24621
+ var _inputRef$current;
24622
+
24623
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
24624
+ };
24625
+
24626
+ var chipComponents = chips.map(function (chip, index) {
24627
+ var _chipOptions$type = chipOptions.type,
24628
+ type = _chipOptions$type === void 0 ? 'input' : _chipOptions$type,
24629
+ _onClick = chipOptions.onClick,
24630
+ rest = _objectWithoutProperties(chipOptions, _excluded2);
24631
+
24632
+ var chipLabel = typeof chip === 'string' ? chip : chip === null || chip === void 0 ? void 0 : chip.label;
24633
+ return /*#__PURE__*/React.createElement(Chip, _extends$2({
24634
+ "data-test": "DesignSystem-MultiSelectTrigger--Chip",
24635
+ label: chipLabel,
24636
+ name: chip,
24637
+ type: type,
24638
+ disabled: disabled,
24639
+ key: index,
24640
+ className: "my-3 mx-2",
24641
+ onClick: function onClick() {
24642
+ return _onClick && _onClick(chip, index);
24643
+ },
24644
+ onClose: function onClose() {
24645
+ return onChipDeleteHandler(index);
24646
+ }
24647
+ }, rest));
24648
+ });
24649
+ return (
24650
+ /*#__PURE__*/
24651
+
24652
+ /* TODO(a11y): fix accessibility */
24653
+
24654
+ /* eslint-disable */
24655
+ React.createElement("div", {
24656
+ "data-test": "DesignSystem-MultiSelectTrigger--Border",
24657
+ className: ChipInputBorderClass
24658
+ }, /*#__PURE__*/React.createElement("div", _extends$2({
24659
+ "data-test": "DesignSystem-MultiSelectTrigger"
24660
+ }, baseProps, {
24661
+ className: ChipInputClass,
24662
+ onClick: onClickHandler,
24663
+ tabIndex: disabled ? -1 : tabIndex || 0
24664
+ }), /*#__PURE__*/React.createElement("div", {
24665
+ className: "ChipInput-wrapper"
24666
+ }, chips && chips.length > 0 && chipComponents, /*#__PURE__*/React.createElement("input", _extends$2({}, rest, {
24667
+ "data-test": "DesignSystem-MultiSelectTrigger--Input",
24668
+ ref: props.forwardedRef || inputRef,
24669
+ className: "ChipInput-input",
24670
+ autoFocus: autoFocus,
24671
+ placeholder: chips && chips.length > 0 ? '' : placeholder,
24672
+ disabled: disabled,
24673
+ value: inputValue,
24674
+ onBlur: onBlur,
24675
+ onFocus: onFocus,
24676
+ onChange: onInputChangeHandler,
24677
+ onKeyDown: onKeyDownHandler,
24678
+ role: role
24679
+ }))), (chips.length > 0 || inputValue.length > 0) && /*#__PURE__*/React.createElement(Icon, {
24680
+ "data-test": "DesignSystem-MultiSelectTrigger--Icon",
24681
+ name: "close",
24682
+ appearance: disabled ? 'disabled' : 'subtle',
24683
+ className: "ChipInput-icon",
24684
+ onClick: onDeleteAllHandler,
24685
+ tabIndex: disabled ? -1 : 0
24686
+ })))
24687
+ );
24688
+ };
24689
+ MultiSelectTrigger.displayName = 'MultiSelectTrigger';
24690
+ MultiSelectTrigger.defaultProps = {
24691
+ chipOptions: {},
24692
+ defaultValue: [],
24693
+ allowDuplicates: false,
24694
+ autoFocus: false
24695
+ };
24696
+
24697
+ var ChipInputBox = function ChipInputBox(props) {
24698
+ var contextProp = React__default.useContext(ComboboxContext);
24699
+ var chipInputValue = contextProp.chipInputValue,
24700
+ setChipInputValue = contextProp.setChipInputValue,
24701
+ setOpenPopover = contextProp.setOpenPopover,
24702
+ setFocusedOption = contextProp.setFocusedOption,
24703
+ setChipInputText = contextProp.setChipInputText,
24704
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
24705
+ setHighlightLastItem = contextProp.setHighlightLastItem,
24706
+ inputTriggerRef = contextProp.inputTriggerRef,
24707
+ openPopover = contextProp.openPopover,
24708
+ popoverId = contextProp.popoverId;
24709
+
24710
+ var onChangeHandler = function onChangeHandler(chips) {
24711
+ setFocusedOption && setFocusedOption(undefined);
24712
+ setChipInputValue && setChipInputValue(chips);
24713
+
24714
+ if (chips.length === 0) {
24715
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24716
+ }
24717
+ };
24718
+
24719
+ var onUpdateHandler = function onUpdateHandler(event) {
24720
+ var _event$target;
24721
+
24722
+ var value = event === null || event === void 0 ? void 0 : (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value;
24723
+
24724
+ if (!value) {
24725
+ setChipInputText === null || setChipInputText === void 0 ? void 0 : setChipInputText('');
24726
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24727
+ inputTriggerRef === null || inputTriggerRef === void 0 ? void 0 : inputTriggerRef.current.focus();
24728
+ return;
24729
+ }
24730
+
24731
+ setChipInputText && setChipInputText(value);
24732
+
24733
+ if (value !== '') {
24734
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24735
+ }
24736
+ };
24737
+
24738
+ var onKeyDownHandler = function onKeyDownHandler(event) {
24739
+ handleKeyDown$1(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem);
24740
+ };
24741
+
24742
+ return /*#__PURE__*/React__default.createElement(MultiSelectTrigger, _extends$2({}, props, {
24743
+ value: chipInputValue,
24744
+ onChange: onChangeHandler,
24745
+ onInputChange: onUpdateHandler,
24746
+ onKeyDown: onKeyDownHandler,
24747
+ tabIndex: -1,
24748
+ forwardedRef: inputTriggerRef,
24749
+ role: "combobox",
24750
+ "aria-haspopup": "listbox",
24751
+ "aria-controls": popoverId,
24752
+ "aria-label": props.placeholder || 'Combobox-ChipInput-Trigger',
24753
+ "aria-expanded": openPopover,
24754
+ "data-test": "DesignSystem-Combobox-ChipInput"
24755
+ }));
24756
+ };
24757
+
24758
+ var _excluded$6 = ["multiSelect", "chipValue", "value"];
24759
+ var ComboboxTrigger = function ComboboxTrigger(props) {
24760
+ var multiSelect = props.multiSelect,
24761
+ chipValue = props.chipValue,
24762
+ value = props.value,
24763
+ rest = _objectWithoutProperties(props, _excluded$6);
24764
+
24765
+ if (multiSelect) {
24766
+ var icon = props.icon,
24767
+ clearButton = props.clearButton,
24768
+ iconType = props.iconType;
24769
+ var chipInputOptions = {
24770
+ icon: icon,
24771
+ clearButton: clearButton,
24772
+ iconType: iconType
24773
+ };
24774
+ return /*#__PURE__*/React.createElement(ChipInputBox, _extends$2({
24775
+ defaultValue: [],
24776
+ chipOptions: _objectSpread2({}, chipInputOptions)
24777
+ }, rest, {
24778
+ value: chipValue
24779
+ }));
24780
+ }
24781
+
24782
+ return /*#__PURE__*/React.createElement(InputBox, _extends$2({}, props, {
24783
+ value: value === null || value === void 0 ? void 0 : value.label
24784
+ }));
24785
+ };
24786
+
24787
+ var Combobox = function Combobox(props) {
24788
+ var children = props.children,
24789
+ onChange = props.onChange,
24790
+ multiSelect = props.multiSelect,
24791
+ className = props.className,
24792
+ maxHeight = props.maxHeight,
24793
+ width = props.width,
24794
+ value = props.value,
24795
+ placeholder = props.placeholder,
24796
+ disabled = props.disabled,
24797
+ error = props.error,
24798
+ onBlur = props.onBlur,
24799
+ onFocus = props.onFocus,
24800
+ onClear = props.onClear,
24801
+ icon = props.icon,
24802
+ iconType = props.iconType,
24803
+ size = props.size,
24804
+ chipValue = props.chipValue,
24805
+ clearButton = props.clearButton,
24806
+ onSearch = props.onSearch;
24807
+
24808
+ var _React$useState = React.useState(),
24809
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24810
+ popoverStyle = _React$useState2[0],
24811
+ setPopoverStyle = _React$useState2[1];
24812
+
24813
+ var _React$useState3 = React.useState({}),
24814
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
24815
+ wrapperStyle = _React$useState4[0],
24816
+ setWrapperStyle = _React$useState4[1];
24817
+
24818
+ var triggerRef = /*#__PURE__*/React.createRef();
24819
+ var listRef = /*#__PURE__*/React.createRef();
24820
+
24821
+ var _React$useState5 = React.useState(false),
24822
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
24823
+ openPopover = _React$useState6[0],
24824
+ setOpenPopover = _React$useState6[1];
24825
+
24826
+ var _React$useState7 = React.useState(false),
24827
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
24828
+ isOptionSelected = _React$useState8[0],
24829
+ setIsOptionSelected = _React$useState8[1];
24830
+
24831
+ var _React$useState9 = React.useState(),
24832
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
24833
+ focusedOption = _React$useState10[0],
24834
+ setFocusedOption = _React$useState10[1];
24835
+
24836
+ var _React$useState11 = React.useState(value || {
24837
+ label: '',
24838
+ value: ''
24839
+ }),
24840
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
24841
+ inputValue = _React$useState12[0],
24842
+ setInputValue = _React$useState12[1];
24843
+
24844
+ var _React$useState13 = React.useState(chipValue),
24845
+ _React$useState14 = _slicedToArray(_React$useState13, 2),
24846
+ chipInputValue = _React$useState14[0],
24847
+ setChipInputValue = _React$useState14[1];
24848
+
24849
+ var _React$useState15 = React.useState(''),
24850
+ _React$useState16 = _slicedToArray(_React$useState15, 2),
24851
+ chipInputText = _React$useState16[0],
24852
+ setChipInputText = _React$useState16[1];
24853
+
24854
+ var _React$useState17 = React.useState(false),
24855
+ _React$useState18 = _slicedToArray(_React$useState17, 2),
24856
+ highlightFirstItem = _React$useState18[0],
24857
+ setHighlightFirstItem = _React$useState18[1];
24858
+
24859
+ var _React$useState19 = React.useState(false),
24860
+ _React$useState20 = _slicedToArray(_React$useState19, 2),
24861
+ highlightLastItem = _React$useState20[0],
24862
+ setHighlightLastItem = _React$useState20[1];
24863
+
24864
+ var inputTriggerRef = React.useRef();
24865
+ var popoverId = "DesignSystem-Combobox--Popover-".concat(uidGenerator());
24866
+ React.useEffect(function () {
24867
+ var _triggerRef$current;
24868
+
24869
+ var popperWidth = (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.clientWidth;
24870
+ var popperWrapperStyle = {
24871
+ width: width || popperWidth
24872
+ };
24873
+ var wrapperStyle = {
24874
+ maxHeight: maxHeight || 'var(--spacing-9)',
24875
+ overflowY: 'auto',
24876
+ boxSizing: 'border-box'
24877
+ };
24878
+ setWrapperStyle(wrapperStyle);
24879
+ setPopoverStyle(popperWrapperStyle);
24880
+ }, []);
24881
+ React.useEffect(function () {
24882
+ if (isOptionSelected) {
24883
+ multiSelect ? setOpenPopover(true) : setOpenPopover(false);
24884
+ setIsOptionSelected(false);
24885
+ }
24886
+
24887
+ var value = multiSelect ? chipInputValue : inputValue;
24888
+ onChange && !isOptionSelected && onChange(value);
24889
+ }, [inputValue, chipInputValue]);
24890
+ React.useEffect(function () {
24891
+ if (highlightFirstItem && openPopover) {
24892
+ requestAnimationFrame(function () {
24893
+ return focusListItem$1('down', setFocusedOption, listRef);
24894
+ });
24895
+ }
24896
+ }, [highlightFirstItem]);
24897
+ React.useEffect(function () {
24898
+ if (highlightLastItem && openPopover) {
24899
+ requestAnimationFrame(function () {
24900
+ return focusListItem$1('up', setFocusedOption, listRef);
24901
+ });
24902
+ }
24903
+ }, [highlightLastItem]);
24904
+ React.useEffect(function () {
24905
+ if (!openPopover) {
24906
+ setHighlightFirstItem(false);
24907
+ setHighlightLastItem(false);
24908
+ }
24909
+ }, [openPopover]);
24910
+ React.useEffect(function () {
24911
+ onSearch && onSearch(chipInputText);
24912
+ }, [chipInputText]);
24913
+
24914
+ var onOptionClick = function onOptionClick(option) {
24915
+ setIsOptionSelected(true);
24916
+
24917
+ if (!multiSelect) {
24918
+ setInputValue(option);
24919
+ onChange && onChange(option);
24920
+ } else {
24921
+ var chipList = chipInputValue ? [].concat(_toConsumableArray(chipInputValue), [option]) : [option];
24922
+ setChipInputValue(chipList);
24923
+ onChange && onChange(chipList);
24924
+ }
24925
+ };
24926
+
24927
+ var outsideClickHandler = function outsideClickHandler() {
24928
+ !multiSelect && setOpenPopover(false);
24929
+ };
24930
+
24931
+ var onToggleHandler = function onToggleHandler(open) {
24932
+ open ? setOpenPopover(true) : setOpenPopover(false);
24933
+ };
24934
+
24935
+ var triggerProps = {
24936
+ value: value,
24937
+ placeholder: placeholder,
24938
+ disabled: disabled,
24939
+ error: error,
24940
+ onBlur: onBlur,
24941
+ onFocus: onFocus,
24942
+ onClear: onClear,
24943
+ icon: icon,
24944
+ iconType: iconType,
24945
+ size: size,
24946
+ multiSelect: multiSelect,
24947
+ chipValue: chipValue,
24948
+ clearButton: clearButton
24949
+ };
24950
+ var contextProp = {
24951
+ inputValue: inputValue,
24952
+ setInputValue: setInputValue,
24953
+ onOptionClick: onOptionClick,
24954
+ openPopover: openPopover,
24955
+ setOpenPopover: setOpenPopover,
24956
+ isOptionSelected: isOptionSelected,
24957
+ setIsOptionSelected: setIsOptionSelected,
24958
+ chipInputValue: chipInputValue,
24959
+ setChipInputValue: setChipInputValue,
24960
+ focusedOption: focusedOption,
24961
+ setFocusedOption: setFocusedOption,
24962
+ chipInputText: chipInputText,
24963
+ setChipInputText: setChipInputText,
24964
+ inputTriggerRef: inputTriggerRef,
24965
+ setHighlightFirstItem: setHighlightFirstItem,
24966
+ setHighlightLastItem: setHighlightLastItem,
24967
+ multiSelect: multiSelect,
24968
+ listRef: listRef,
24969
+ onSearch: onSearch,
24970
+ popoverId: popoverId
24971
+ };
24972
+ return /*#__PURE__*/React.createElement(ComboboxContext.Provider, {
24973
+ value: contextProp
24974
+ }, /*#__PURE__*/React.createElement("div", {
24975
+ ref: triggerRef,
24976
+ className: className
24977
+ }, /*#__PURE__*/React.createElement(OutsideClick, {
24978
+ onOutsideClick: outsideClickHandler
24979
+ }, /*#__PURE__*/React.createElement(Popover, {
24980
+ open: openPopover && !disabled,
24981
+ triggerClass: "d-block",
24982
+ customStyle: popoverStyle,
24983
+ onToggle: onToggleHandler,
24984
+ trigger: /*#__PURE__*/React.createElement(ComboboxTrigger, triggerProps)
24985
+ }, /*#__PURE__*/React.createElement("div", {
24986
+ style: wrapperStyle,
24987
+ ref: listRef,
24988
+ id: popoverId
24989
+ }, children && typeof children === 'function' ? children(contextProp) : children)))));
24990
+ };
24991
+ Combobox.List = ComboboxList;
24992
+ Combobox.Option = ComboboxOption;
24993
+
24994
+ var SelectContext = /*#__PURE__*/React.createContext({});
24995
+
24996
+ var _excluded$5 = ["children"];
24997
+ var SelectList = function SelectList(props) {
24998
+ var contextProp = React.useContext(SelectContext);
24999
+ var withSearch = contextProp.withSearch,
25000
+ minHeight = contextProp.minHeight,
25001
+ maxHeight = contextProp.maxHeight,
25002
+ multiSelect = contextProp.multiSelect;
25003
+
25004
+ var children = props.children,
25005
+ rest = _objectWithoutProperties(props, _excluded$5);
25006
+
25007
+ var searchInputHeight = 33;
25008
+ var wrapperStyle = {
25009
+ maxHeight: withSearch ? maxHeight - searchInputHeight : maxHeight,
25010
+ overflowY: 'auto',
25011
+ minHeight: minHeight
25012
+ };
25013
+ return /*#__PURE__*/React.createElement(Listbox, _extends$2({
25014
+ "aria-label": "Options item list",
25015
+ "aria-multiselectable": multiSelect,
25016
+ className: "my-3"
25017
+ }, rest), /*#__PURE__*/React.createElement("div", {
25018
+ style: wrapperStyle
25019
+ }, children));
25020
+ };
25021
+ SelectList.defaultProps = {
25022
+ type: 'option',
25023
+ showDivider: false,
25024
+ size: 'compressed',
25025
+ tagName: 'ul'
25026
+ };
25027
+
25028
+ var mapInitialValue = function mapInitialValue(multiSelect, selectedValue) {
25029
+ if (multiSelect) {
25030
+ return selectedValue && !Array.isArray(selectedValue) ? [selectedValue] : selectedValue || [];
25031
+ } else {
25032
+ return selectedValue || {
25033
+ label: '',
25034
+ value: ''
25035
+ };
25036
+ }
25037
+ };
25038
+ var elementExist = function elementExist(targetObject, mainList) {
25039
+ if (!Array.isArray(mainList)) {
25040
+ return targetObject.value === (mainList === null || mainList === void 0 ? void 0 : mainList.value) ? 0 : -1;
25041
+ }
25042
+
25043
+ return mainList.findIndex(function (item) {
25044
+ return item.value === targetObject.value;
25045
+ });
25046
+ };
25047
+ var removeOrAddToList = function removeOrAddToList(targetObject, prevList) {
25048
+ var newList = _toConsumableArray(prevList);
25049
+
25050
+ var existingIndex = elementExist(targetObject, newList);
25051
+
25052
+ if (existingIndex !== -1) {
25053
+ newList.splice(existingIndex, 1);
25054
+ } else {
25055
+ newList.push(targetObject);
25056
+ }
25057
+
25058
+ return newList;
25059
+ };
25060
+ var computeValue = function computeValue(multiSelect, selectValue, setLabel) {
25061
+ if (!multiSelect) {
25062
+ return (selectValue === null || selectValue === void 0 ? void 0 : selectValue.label.trim()) || '';
25063
+ }
25064
+
25065
+ var label = setLabel === null || setLabel === void 0 ? void 0 : setLabel(selectValue.length);
25066
+
25067
+ if (label) {
25068
+ return label;
25069
+ }
25070
+
25071
+ if (selectValue.length <= 2) {
25072
+ return selectValue.map(function (pair) {
25073
+ return "".concat(pair.label);
25074
+ }).join(', ');
25075
+ } else {
25076
+ return "".concat(selectValue.length, " Selected");
25077
+ }
25078
+ };
25079
+ var handleKeyDownTrigger = function handleKeyDownTrigger(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem) {
25080
+ switch (event.key) {
25081
+ case 'Enter':
25082
+ event.preventDefault();
25083
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
25084
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(true);
25085
+ break;
25086
+
25087
+ case 'ArrowDown':
25088
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
25089
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(true);
25090
+ break;
25091
+
25092
+ case 'ArrowUp':
25093
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
25094
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(true);
25095
+ break;
25096
+ }
25097
+ };
25098
+ var focusListItem = function focusListItem(position, setFocusedOption, listRef) {
25099
+ var _listRef$current, _listRef$current2, _targetOption, _targetOption2;
25100
+
25101
+ var searchInput = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.querySelectorAll('[data-test="DesignSystem-Select--Input"]');
25102
+ var listItems = (_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
25103
+ var targetOption;
25104
+
25105
+ if (position === 'down') {
25106
+ targetOption = (searchInput === null || searchInput === void 0 ? void 0 : searchInput[0]) || (listItems === null || listItems === void 0 ? void 0 : listItems[0]);
25107
+ } else {
25108
+ targetOption = listItems === null || listItems === void 0 ? void 0 : listItems[listItems.length - 1];
25109
+ }
25110
+
25111
+ (_targetOption = targetOption) === null || _targetOption === void 0 ? void 0 : _targetOption.focus();
25112
+ (_targetOption2 = targetOption) === null || _targetOption2 === void 0 ? void 0 : _targetOption2.scrollIntoView({
25113
+ block: 'center'
25114
+ });
25115
+ setFocusedOption && setFocusedOption(targetOption);
25116
+ };
25117
+ var handleKeyDown = function handleKeyDown(event, focusedOption, setFocusedOption, setHighlightFirstItem, setHighlightLastItem, listRef, withSearch, setOpenPopover, triggerRef) {
25118
+ switch (event.key) {
25119
+ case 'ArrowUp':
25120
+ event.preventDefault();
25121
+ navigateOptions('up', focusedOption, setFocusedOption, listRef, withSearch);
25122
+ break;
25123
+
25124
+ case 'ArrowDown':
25125
+ event.preventDefault();
25126
+ navigateOptions('down', focusedOption, setFocusedOption, listRef, withSearch);
25127
+ break;
25128
+
25129
+ case 'Enter':
25130
+ handleEnterKey(focusedOption);
25131
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(false);
25132
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(false);
25133
+ break;
25134
+
25135
+ case 'Tab':
25136
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(false);
25137
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(false);
25138
+ break;
25139
+
25140
+ case 'Escape':
25141
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
25142
+ triggerRef.current.focus();
25143
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(undefined);
25144
+ break;
25145
+ }
25146
+ };
25147
+ var handleEnterKey = function handleEnterKey(focusedOption) {
25148
+ focusedOption === null || focusedOption === void 0 ? void 0 : focusedOption.click();
25149
+ };
25150
+ var navigateOptions = function navigateOptions(direction, focusedOption, setFocusedOption, listRef, withSearch) {
25151
+ var listItems = listRef.current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
25152
+ var index = Array.from(listItems).findIndex(function (item) {
25153
+ return item == focusedOption;
25154
+ });
25155
+
25156
+ if (index === -1) {
25157
+ index = direction === 'up' ? listItems.length - 1 : 0;
25158
+ } else if (withSearch && index === 0 && direction === 'up' || withSearch && index === listItems.length - 1 && direction === 'down') {
25159
+ var searchInput = listRef.current.querySelector('[data-test="DesignSystem-Select--Input"]');
25160
+ searchInput.focus();
25161
+ setFocusedOption && setFocusedOption(searchInput);
25162
+ } else {
25163
+ index = direction === 'up' ? (index - 1 + listItems.length) % listItems.length : (index + 1) % listItems.length;
25164
+ var targetOption = listItems[index];
25165
+ targetOption.focus();
25166
+ setFocusedOption && setFocusedOption(targetOption);
25167
+ targetOption.scrollIntoView({
25168
+ block: 'center'
25169
+ });
25170
+ }
25171
+ };
25172
+ var handleInputKeyDown = function handleInputKeyDown(event, listRef, setFocusedOption, setOpenPopover, triggerRef) {
25173
+ var _listRef$current3, _targetOption3, _targetOption4;
25174
+
25175
+ var listItems = (_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 ? void 0 : _listRef$current3.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
25176
+ var targetOption;
25177
+
25178
+ switch (event.key) {
25179
+ case 'ArrowUp':
25180
+ event.preventDefault();
25181
+ targetOption = listItems[listItems.length - 1];
25182
+ break;
25183
+
25184
+ case 'ArrowDown':
25185
+ event.preventDefault();
25186
+ targetOption = listItems[0];
25187
+ break;
25188
+
25189
+ case 'Escape':
25190
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
25191
+ triggerRef.current.focus();
25192
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(undefined);
25193
+ break;
25194
+ }
25195
+
25196
+ (_targetOption3 = targetOption) === null || _targetOption3 === void 0 ? void 0 : _targetOption3.focus();
25197
+ (_targetOption4 = targetOption) === null || _targetOption4 === void 0 ? void 0 : _targetOption4.scrollIntoView({
25198
+ block: 'center'
25199
+ });
25200
+ setFocusedOption && setFocusedOption(targetOption);
25201
+ };
25202
+
25203
+ var _excluded$4 = ["children", "option", "checkedState", "onClick", "withCheckbox", "disabled"];
25204
+ var SelectOption = function SelectOption(props) {
25205
+ var children = props.children,
25206
+ option = props.option,
25207
+ checkedState = props.checkedState,
25208
+ onClick = props.onClick,
25209
+ _props$withCheckbox = props.withCheckbox,
25210
+ withCheckbox = _props$withCheckbox === void 0 ? true : _props$withCheckbox,
25211
+ disabled = props.disabled,
25212
+ rest = _objectWithoutProperties(props, _excluded$4);
25213
+
25214
+ var contextProp = React.useContext(SelectContext);
25215
+ var onOptionClick = contextProp.onOptionClick,
25216
+ selectValue = contextProp.selectValue,
25217
+ setSelectValue = contextProp.setSelectValue,
25218
+ multiSelect = contextProp.multiSelect,
25219
+ setIsOptionSelected = contextProp.setIsOptionSelected,
25220
+ focusedOption = contextProp.focusedOption,
25221
+ setFocusedOption = contextProp.setFocusedOption,
25222
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
25223
+ setHighlightLastItem = contextProp.setHighlightLastItem,
25224
+ listRef = contextProp.listRef,
25225
+ withSearch = contextProp.withSearch,
25226
+ setOpenPopover = contextProp.setOpenPopover,
25227
+ triggerRef = contextProp.triggerRef;
25228
+
25229
+ var onClickHandler = function onClickHandler() {
25230
+ if (disabled) return;
25231
+
25232
+ if (onClick) {
25233
+ onClick(option);
25234
+ return;
25235
+ }
25236
+
25237
+ var newList = multiSelect && Array.isArray(selectValue) ? removeOrAddToList(option, selectValue) : option;
25238
+ setIsOptionSelected === null || setIsOptionSelected === void 0 ? void 0 : setIsOptionSelected(Array.isArray(newList) ? newList.length !== 0 : true);
25239
+ setSelectValue === null || setSelectValue === void 0 ? void 0 : setSelectValue(newList);
25240
+ onOptionClick === null || onOptionClick === void 0 ? void 0 : onOptionClick(newList);
25241
+ };
25242
+
25243
+ var checked = checkedState === 'checked' || elementExist(option, selectValue) !== -1;
25244
+ var indeterminate = checkedState === 'indeterminate';
25245
+
25246
+ var onKeyDownHandler = function onKeyDownHandler(event) {
25247
+ handleKeyDown(event, focusedOption, setFocusedOption, setHighlightFirstItem, setHighlightLastItem, listRef, withSearch, setOpenPopover, triggerRef);
25248
+ };
25249
+
25250
+ return /*#__PURE__*/React.createElement(Listbox.Item, _extends$2({
25251
+ role: "option",
25252
+ onClick: onClickHandler,
25253
+ "aria-selected": checked,
25254
+ "aria-label": "option item",
25255
+ onKeyDown: function onKeyDown(event) {
25256
+ return onKeyDownHandler(event);
25257
+ },
25258
+ selected: checked,
25259
+ tabIndex: -1,
25260
+ disabled: disabled,
25261
+ "data-test": "DesignSystem-Select-Option"
25262
+ }, rest), /*#__PURE__*/React.createElement("div", {
25263
+ className: "d-flex align-items-center"
25264
+ }, multiSelect && withCheckbox && /*#__PURE__*/React.createElement(Checkbox, {
25265
+ tabIndex: -1,
25266
+ "aria-checked": indeterminate ? 'mixed' : checked,
25267
+ checked: checked,
25268
+ indeterminate: indeterminate
25269
+ }), /*#__PURE__*/React.createElement("div", {
25270
+ className: multiSelect ? 'Select-trigger-text pt-2' : 'Select-trigger-text'
25271
+ }, children)));
25272
+ };
25273
+ SelectOption.defaultProps = {
25274
+ withCheckbox: true
25275
+ };
25276
+
25277
+ var _excluded$3 = ["triggerSize", "placeholder", "withClearButton", "icon", "disabled", "inlineLabel", "iconType", "onClear", "setLabel"];
25278
+
25279
+ var SelectTrigger = function SelectTrigger(props) {
25280
+ var _classNames, _classNames2;
25281
+
25282
+ var triggerSize = props.triggerSize,
25283
+ placeholder = props.placeholder,
25284
+ withClearButton = props.withClearButton,
25285
+ icon = props.icon,
25286
+ disabled = props.disabled,
25287
+ inlineLabel = props.inlineLabel,
25288
+ iconType = props.iconType,
25289
+ onClear = props.onClear,
25290
+ setLabel = props.setLabel,
25291
+ rest = _objectWithoutProperties(props, _excluded$3);
25292
+
25293
+ var contextProp = React.useContext(SelectContext);
25294
+ var openPopover = contextProp.openPopover,
25295
+ selectValue = contextProp.selectValue,
25296
+ setSelectValue = contextProp.setSelectValue,
25297
+ isOptionSelected = contextProp.isOptionSelected,
25298
+ setIsOptionSelected = contextProp.setIsOptionSelected,
25299
+ multiSelect = contextProp.multiSelect,
25300
+ setOpenPopover = contextProp.setOpenPopover,
25301
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
25302
+ setHighlightLastItem = contextProp.setHighlightLastItem,
25303
+ triggerRef = contextProp.triggerRef;
25304
+ var buttonDisabled = disabled ? 'disabled' : 'default';
25305
+ var trimmedPlaceholder = placeholder === null || placeholder === void 0 ? void 0 : placeholder.trim();
25306
+ var displayValue = computeValue(multiSelect, selectValue, setLabel);
25307
+ var value = isOptionSelected && displayValue.length > 0 ? displayValue : trimmedPlaceholder;
25308
+ var iconName = openPopover ? 'keyboard_arrow_up' : 'keyboard_arrow_down';
25309
+
25310
+ var onClearHandler = function onClearHandler(event) {
25311
+ event.stopPropagation();
25312
+ var emptyValue = multiSelect ? [] : {
25313
+ label: '',
25314
+ value: ''
25315
+ };
25316
+ setSelectValue === null || setSelectValue === void 0 ? void 0 : setSelectValue(emptyValue);
25317
+ setIsOptionSelected === null || setIsOptionSelected === void 0 ? void 0 : setIsOptionSelected(false);
25318
+
25319
+ if (onClear) {
25320
+ onClear(event);
25321
+ }
25322
+ };
25323
+
25324
+ var buttonClass = classnames((_classNames = {}, _defineProperty$1(_classNames, 'Button', true), _defineProperty$1(_classNames, 'Select-trigger', true), _defineProperty$1(_classNames, "Select-trigger--".concat(triggerSize), triggerSize), _defineProperty$1(_classNames, 'Select-trigger--placeholder', !isOptionSelected), _defineProperty$1(_classNames, 'Select-trigger--icon', icon), _defineProperty$1(_classNames, 'Select-trigger--open', openPopover), _classNames));
25325
+ var textClass = classnames((_classNames2 = {}, _defineProperty$1(_classNames2, 'Text', true), _defineProperty$1(_classNames2, 'Text--regular', true), _defineProperty$1(_classNames2, 'Select-trigger-text', true), _classNames2));
25326
+ return /*#__PURE__*/React.createElement("button", _extends$2({
25327
+ ref: triggerRef,
25328
+ onKeyDown: function onKeyDown(event) {
25329
+ return handleKeyDownTrigger(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem);
25330
+ },
25331
+ type: "button",
25332
+ className: buttonClass,
25333
+ disabled: disabled,
25334
+ tabIndex: 0,
25335
+ "aria-haspopup": "listbox",
25336
+ "aria-expanded": openPopover,
25337
+ "aria-label": "trigger",
25338
+ "data-test": "DesignSystem-Select-trigger"
25339
+ }, rest), /*#__PURE__*/React.createElement("div", {
25340
+ className: "Select-trigger-wrapper"
25341
+ }, inlineLabel && /*#__PURE__*/React.createElement(Text, {
25342
+ appearance: "subtle",
25343
+ className: "mr-4 white-space-nowrap"
25344
+ }, "".concat(inlineLabel.trim().charAt(0).toUpperCase()).concat(inlineLabel.trim().slice(1))), icon && !inlineLabel && /*#__PURE__*/React.createElement(Icon, {
25345
+ appearance: buttonDisabled,
25346
+ className: "d-flex align-items-center mr-4",
25347
+ name: icon,
25348
+ type: iconType
25349
+ }), value && /*#__PURE__*/React.createElement("span", {
25350
+ className: textClass
25351
+ }, value)), isOptionSelected && withClearButton && /*#__PURE__*/React.createElement(Icon, {
25352
+ appearance: buttonDisabled,
25353
+ onClick: onClearHandler,
25354
+ className: "align-items-center mr-2 ml-3 Select-crossButton",
25355
+ size: 12,
25356
+ name: "close",
25357
+ "aria-label": "clear selected",
25358
+ type: iconType,
25359
+ "data-test": "DesignSystem-Select--closeIcon"
25360
+ }), /*#__PURE__*/React.createElement(Icon, {
25361
+ appearance: buttonDisabled,
25362
+ name: iconName,
25363
+ type: iconType
25364
+ }));
25365
+ };
25366
+
25367
+ SelectTrigger.defaultProps = {
25368
+ triggerSize: 'regular',
25369
+ placeholder: 'Select',
25370
+ withClearButton: true
25371
+ };
25372
+
25373
+ var _excluded$2 = ["onChange", "onClear"];
25374
+ var SearchInput = function SearchInput(props) {
25375
+ var contextProp = React.useContext(SelectContext);
25376
+ var setWithSearch = contextProp.setWithSearch,
25377
+ maxHeight = contextProp.maxHeight,
25378
+ listRef = contextProp.listRef,
25379
+ setFocusedOption = contextProp.setFocusedOption,
25380
+ setOpenPopover = contextProp.setOpenPopover,
25381
+ triggerRef = contextProp.triggerRef;
25382
+
25383
+ var onChange = props.onChange,
25384
+ onClear = props.onClear,
25385
+ rest = _objectWithoutProperties(props, _excluded$2);
25386
+
25387
+ React.useEffect(function () {
25388
+ setWithSearch === null || setWithSearch === void 0 ? void 0 : setWithSearch(true);
25389
+ }, [maxHeight]);
25390
+
25391
+ var searchHandler = function searchHandler(event) {
25392
+ if (onChange) onChange(event.target.value);
25393
+ };
25394
+
25395
+ var searchClearHandler = function searchClearHandler(event) {
25396
+ if (onClear) onClear(event);
25397
+ };
25398
+
25399
+ return /*#__PURE__*/React.createElement("div", {
25400
+ className: "Select-inputWrapper"
25401
+ }, /*#__PURE__*/React.createElement(Input, _extends$2({}, rest, {
25402
+ icon: 'search',
25403
+ onKeyDown: function onKeyDown(event) {
25404
+ return handleInputKeyDown(event, listRef, setFocusedOption, setOpenPopover, triggerRef);
25405
+ } // TODO(a11y): research more on this.
25406
+ // eslint-disable-next-line jsx-a11y/no-autofocus
25407
+ ,
25408
+ autoFocus: true,
25409
+ onChange: searchHandler,
25410
+ onClear: searchClearHandler,
25411
+ autoComplete: 'off',
25412
+ "aria-label": "Search",
25413
+ "aria-haspopup": "listbox",
25414
+ className: "Select-input",
25415
+ "data-test": "DesignSystem-Select--Input"
25416
+ })));
25417
+ };
25418
+
25419
+ var _excluded$1 = ["title", "description", "children"];
25420
+ var SelectEmptyTemplate = function SelectEmptyTemplate(props) {
25421
+ var contextProp = React.useContext(SelectContext);
25422
+ var maxHeight = contextProp.maxHeight,
25423
+ withSearch = contextProp.withSearch;
25424
+
25425
+ var title = props.title,
25426
+ description = props.description,
25427
+ children = props.children,
25428
+ rest = _objectWithoutProperties(props, _excluded$1);
25429
+
25430
+ var searchInputHeight = 33;
25431
+ var wrapperStyle = {
25432
+ minHeight: withSearch ? maxHeight - searchInputHeight : maxHeight
25433
+ };
25434
+ return /*#__PURE__*/React.createElement("div", _extends$2({
25435
+ className: "px-7 d-flex justify-content-center align-items-center",
25436
+ style: wrapperStyle,
25437
+ "data-test": "DesignSystem-Select-EmptyState--wrapper",
25438
+ "aria-live": "polite",
25439
+ role: "alert"
25440
+ }, rest), /*#__PURE__*/React.createElement("div", {
25441
+ "aria-labelledby": title,
25442
+ "aria-describedby": description,
25443
+ className: "d-flex flex-column justify-content-center align-items-center"
25444
+ }, title && /*#__PURE__*/React.createElement(Text, {
25445
+ id: title,
25446
+ role: "heading",
25447
+ className: "text-align-center mb-3",
25448
+ weight: "strong"
25449
+ }, title), description && /*#__PURE__*/React.createElement(Text, {
25450
+ id: description,
25451
+ className: "text-align-center mb-6",
25452
+ weight: "medium",
25453
+ size: "small",
25454
+ appearance: "subtle"
25455
+ }, description), children && children));
25456
+ };
25457
+
25458
+ var _excluded = ["children"];
25459
+ var SelectFooter = function SelectFooter(props) {
25460
+ var children = props.children,
25461
+ rest = _objectWithoutProperties(props, _excluded);
25462
+
25463
+ return /*#__PURE__*/React.createElement("div", _extends$2({
25464
+ className: "Select-buttonWrapper"
25465
+ }, rest), children);
25466
+ };
25467
+
25468
+ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
25469
+ var children = props.children,
25470
+ onSelect = props.onSelect,
25471
+ width = props.width,
25472
+ maxHeight = props.maxHeight,
25473
+ minHeight = props.minHeight,
25474
+ value = props.value,
25475
+ _props$multiSelect = props.multiSelect,
25476
+ multiSelect = _props$multiSelect === void 0 ? false : _props$multiSelect,
25477
+ onOutsideClick = props.onOutsideClick,
25478
+ triggerOptions = props.triggerOptions,
25479
+ popoverWidth = props.popoverWidth;
25480
+
25481
+ var _React$useState = React.useState(false),
25482
+ _React$useState2 = _slicedToArray(_React$useState, 2),
25483
+ openPopover = _React$useState2[0],
25484
+ setOpenPopover = _React$useState2[1];
25485
+
25486
+ var mapValue = mapInitialValue(multiSelect, value);
25487
+
25488
+ var _React$useState3 = React.useState(mapValue),
25489
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
25490
+ selectValue = _React$useState4[0],
25491
+ setSelectValue = _React$useState4[1];
25492
+
25493
+ var _React$useState5 = React.useState(false),
25494
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
25495
+ isOptionSelected = _React$useState6[0],
25496
+ setIsOptionSelected = _React$useState6[1];
25497
+
25498
+ var triggerRef = /*#__PURE__*/React.createRef();
25499
+ var listRef = React.useRef(null);
25500
+
25501
+ var _React$useState7 = React.useState(false),
25502
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
25503
+ withSearch = _React$useState8[0],
25504
+ setWithSearch = _React$useState8[1];
25505
+
25506
+ var _React$useState9 = React.useState(),
25507
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
25508
+ focusedOption = _React$useState10[0],
25509
+ setFocusedOption = _React$useState10[1];
25510
+
25511
+ var _React$useState11 = React.useState(false),
25512
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
25513
+ highlightFirstItem = _React$useState12[0],
25514
+ setHighlightFirstItem = _React$useState12[1];
25515
+
25516
+ var _React$useState13 = React.useState(false),
25517
+ _React$useState14 = _slicedToArray(_React$useState13, 2),
25518
+ highlightLastItem = _React$useState14[0],
25519
+ setHighlightLastItem = _React$useState14[1];
25520
+
25521
+ var triggerStyle = {
25522
+ width: width
25523
+ };
25524
+ var popoverStyle = {
25525
+ width: popoverWidth ? popoverWidth : width
25526
+ };
25527
+ React.useImperativeHandle(ref, function () {
25528
+ return {
25529
+ setOpen: function setOpen(open) {
25530
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(open);
25531
+ },
25532
+ setFocusFirstItem: function setFocusFirstItem() {
25533
+ if (openPopover) {
25534
+ requestAnimationFrame(function () {
25535
+ return focusListItem('down', setFocusedOption, listRef);
25536
+ });
25537
+ setHighlightFirstItem(true);
25538
+ }
25539
+ },
25540
+ setFocusLastItem: function setFocusLastItem() {
25541
+ if (openPopover) {
25542
+ requestAnimationFrame(function () {
25543
+ return focusListItem('up', setFocusedOption, listRef);
25544
+ });
25545
+ setHighlightLastItem(true);
25546
+ }
25547
+ }
25548
+ };
25549
+ });
25550
+ React.useEffect(function () {
25551
+ if (!openPopover) {
25552
+ setHighlightFirstItem(false);
25553
+ setHighlightLastItem(false);
25554
+ }
25555
+ }, [openPopover]);
25556
+ React.useEffect(function () {
25557
+ if (highlightFirstItem && openPopover) {
25558
+ requestAnimationFrame(function () {
25559
+ return focusListItem('down', setFocusedOption, listRef);
25560
+ });
25561
+ }
25562
+ }, [highlightFirstItem]);
25563
+ React.useEffect(function () {
25564
+ if (highlightLastItem && openPopover) {
25565
+ requestAnimationFrame(function () {
25566
+ return focusListItem('up', setFocusedOption, listRef);
25567
+ });
25568
+ }
25569
+ }, [highlightLastItem]);
25570
+ React.useEffect(function () {
25571
+ if (value) {
25572
+ setSelectValue(value);
25573
+ setIsOptionSelected(Array.isArray(value) ? value.length > 0 : value.value.trim().length > 0);
25574
+ }
25575
+ }, [value]);
25576
+
25577
+ var onToggleHandler = function onToggleHandler(open) {
25578
+ if (triggerOptions && triggerOptions.disabled) {
25579
+ setOpenPopover(false);
25580
+ } else {
25581
+ setHighlightFirstItem(open);
25582
+ setOpenPopover(open);
25583
+ }
25584
+ };
25585
+
25586
+ var onOptionClick = function onOptionClick(option) {
25587
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(option);
25588
+ !multiSelect && setOpenPopover(false);
25589
+ };
25590
+
25591
+ var onOutsideClickHandler = function onOutsideClickHandler() {
25592
+ onOutsideClick === null || onOutsideClick === void 0 ? void 0 : onOutsideClick();
25593
+ };
25594
+
25595
+ var contextProp = {
25596
+ openPopover: openPopover,
25597
+ setOpenPopover: setOpenPopover,
25598
+ selectValue: selectValue,
25599
+ setSelectValue: setSelectValue,
25600
+ isOptionSelected: isOptionSelected,
25601
+ setIsOptionSelected: setIsOptionSelected,
25602
+ onOptionClick: onOptionClick,
25603
+ maxHeight: maxHeight,
25604
+ minHeight: minHeight,
25605
+ withSearch: withSearch,
25606
+ setWithSearch: setWithSearch,
25607
+ multiSelect: multiSelect,
25608
+ listRef: listRef,
25609
+ triggerRef: triggerRef,
25610
+ focusedOption: focusedOption,
25611
+ setFocusedOption: setFocusedOption,
25612
+ setHighlightFirstItem: setHighlightFirstItem,
25613
+ setHighlightLastItem: setHighlightLastItem
25614
+ };
25615
+ return /*#__PURE__*/React.createElement(SelectContext.Provider, {
25616
+ value: contextProp
25617
+ }, /*#__PURE__*/React.createElement("div", {
25618
+ "data-test": "DesignSystem-Select",
25619
+ "aria-haspopup": "listbox",
25620
+ "aria-expanded": openPopover,
25621
+ style: triggerStyle
25622
+ }, /*#__PURE__*/React.createElement(Popover, {
25623
+ open: openPopover,
25624
+ onToggle: onToggleHandler,
25625
+ className: "mt-3",
25626
+ triggerClass: "d-block",
25627
+ customStyle: popoverStyle,
25628
+ trigger: /*#__PURE__*/React.createElement(SelectTrigger, _extends$2({
25629
+ "aria-controls": "select-listbox"
25630
+ }, triggerOptions))
25631
+ }, /*#__PURE__*/React.createElement(OutsideClick, {
25632
+ onOutsideClick: onOutsideClickHandler
25633
+ }, /*#__PURE__*/React.createElement("div", {
25634
+ role: "listbox",
25635
+ id: "select-listbox",
25636
+ tabIndex: 0,
25637
+ ref: listRef
25638
+ }, children)))));
25639
+ });
25640
+ Select.displayName = 'Select';
25641
+ Select.defaultProps = {
25642
+ maxHeight: 256,
25643
+ width: 176
25644
+ };
25645
+ Select.Option = SelectOption;
25646
+ Select.List = SelectList;
25647
+ Select.SearchInput = SearchInput;
25648
+ Select.EmptyTemplate = SelectEmptyTemplate;
25649
+ Select.Footer = SelectFooter;
25650
+
25651
+ var version = "2.29.0";
23613
25652
 
23614
- export { ActionCard, Avatar, AvatarGroup, Backdrop, Badge, Breadcrumbs, Button, Calendar, Caption, Card, CardBody, CardFooter, CardHeader, CardSubdued, ChatMessage, Checkbox, Chip, ChipGroup, ChipInput, ChoiceList, Collapsible, Column, DatePicker, DateRangePicker, Dialog, Divider, Dropdown, Dropzone, EditableChipInput, EditableDropdown, EditableInput, EmptyState, FileList, FileUploader, FileUploaderList, FullscreenModal, Grid, GridCell, Heading, HelpText, HorizontalNav, Icon, InlineMessage, Input, X as InputMask, Label, Legend, Link, LinkButton, List, Listbox, Message, MetaList, MetricInput, Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, MultiSlider, Navigation, OutsideClick, PageHeader, Pagination, Paragraph, Pills, Placeholder, PlaceholderImage, PlaceholderParagraph, Popover, ProgressBar, ProgressRing, Radio, RangeSlider, Row, SelectionCard, Sidesheet, Slider, Spinner, StatusHint, Stepper, Subheading, Switch, Tab, Table, Tabs, TabsWrapper, Text, TextField, Textarea, TimePicker, Toast, Tooltip, index as Utils, VerificationCodeInput, VerticalNav, version };
25653
+ export { ActionCard, Avatar, AvatarGroup, AvatarSelection, Backdrop, Badge, Breadcrumbs, Button, Calendar, Caption, Card, CardBody, CardFooter, CardHeader, CardSubdued, ChatMessage, Checkbox, Chip, ChipGroup, ChipInput, ChoiceList, Collapsible, Column, Combobox, DatePicker, DateRangePicker, Dialog, Divider, Dropdown, Dropzone, EditableChipInput, EditableDropdown, EditableInput, EmptyState, FileList, FileUploader, FileUploaderList, FullscreenModal, Grid, GridCell, Heading, HelpText, HorizontalNav, Icon, InlineMessage, Input, X as InputMask, Label, Legend, Link, LinkButton, List, Listbox, Message, MetaList, MetricInput, Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, MultiSlider, Navigation, OutsideClick, PageHeader, Pagination, Paragraph, Pills, Placeholder, PlaceholderImage, PlaceholderParagraph, Popover, ProgressBar, ProgressRing, Radio, RangeSlider, Row, Select, SelectionCard, Sidesheet, Slider, Spinner, StatusHint, Stepper, Subheading, Switch, Tab, Table, Tabs, TabsWrapper, Text, TextField, Textarea, TimePicker, Toast, Tooltip, index as Utils, VerificationCodeInput, VerticalNav, version };