@innovaccer/design-system 2.28.3 → 2.30.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 (84) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/css/dist/index.css +287 -0
  3. package/css/dist/index.css.map +1 -1
  4. package/css/src/components/avatarSelection.css +111 -0
  5. package/css/src/components/calendar.css +4 -0
  6. package/css/src/components/grid.css +6 -0
  7. package/css/src/components/listbox.css +4 -0
  8. package/css/src/components/menu.css +27 -0
  9. package/css/src/components/select.css +127 -0
  10. package/dist/.lib/tsconfig.type.tsbuildinfo +858 -34
  11. package/dist/core/common.type.d.ts +7 -0
  12. package/dist/core/components/atoms/_text/index.d.ts +2 -4
  13. package/dist/core/components/atoms/avatar/Avatar.d.ts +1 -0
  14. package/dist/core/components/atoms/avatar/avatarIcon/AvatarIcon.d.ts +0 -4
  15. package/dist/core/components/atoms/avatarSelection/AvatarSelection.d.ts +59 -0
  16. package/dist/core/components/atoms/avatarSelection/AvatarSelectionContext.d.ts +19 -0
  17. package/dist/core/components/atoms/avatarSelection/avatarPopover/AvatarSelectionEmptyState.d.ts +8 -0
  18. package/dist/core/components/atoms/avatarSelection/avatarPopover/AvatarSelectionInput.d.ts +3 -0
  19. package/dist/core/components/atoms/avatarSelection/avatarPopover/AvatarSelectionList.d.ts +20 -0
  20. package/dist/core/components/atoms/avatarSelection/avatarPopover/AvatarSelectionOption.d.ts +15 -0
  21. package/dist/core/components/atoms/avatarSelection/avatarPopover/AvatarSelectionPopover.d.ts +15 -0
  22. package/dist/core/components/atoms/avatarSelection/avatarPopover/index.d.ts +5 -0
  23. package/dist/core/components/atoms/avatarSelection/avatarPopover/utils.d.ts +3 -0
  24. package/dist/core/components/atoms/avatarSelection/avatarsSelection/AvatarSelectionCount.d.ts +13 -0
  25. package/dist/core/components/atoms/avatarSelection/avatarsSelection/SelectionAvatar.d.ts +15 -0
  26. package/dist/core/components/atoms/avatarSelection/avatarsSelection/SelectionAvatarsWrapper.d.ts +15 -0
  27. package/dist/core/components/atoms/avatarSelection/avatarsSelection/index.d.ts +2 -0
  28. package/dist/core/components/atoms/avatarSelection/avatarsSelection/utils.d.ts +3 -0
  29. package/dist/core/components/atoms/avatarSelection/index.d.ts +2 -0
  30. package/dist/core/components/atoms/popperWrapper/PopperWrapper.d.ts +23 -19
  31. package/dist/core/components/atoms/text/Text.d.ts +3 -10
  32. package/dist/core/components/molecules/popover/Popover.d.ts +6 -1
  33. package/dist/core/components/molecules/tooltip/Tooltip.d.ts +10 -0
  34. package/dist/core/components/organisms/calendar/Calendar.d.ts +1 -0
  35. package/dist/core/components/organisms/combobox/Combobox.d.ts +45 -0
  36. package/dist/core/components/organisms/combobox/ComboboxContext.d.ts +23 -0
  37. package/dist/core/components/organisms/combobox/ComboboxList.d.ts +20 -0
  38. package/dist/core/components/organisms/combobox/ComboboxOption.d.ts +18 -0
  39. package/dist/core/components/organisms/combobox/index.d.ts +2 -0
  40. package/dist/core/components/organisms/combobox/trigger/ChipInputBox.d.ts +3 -0
  41. package/dist/core/components/organisms/combobox/trigger/ComboboxTrigger.d.ts +20 -0
  42. package/dist/core/components/organisms/combobox/trigger/InputBox.d.ts +3 -0
  43. package/dist/core/components/organisms/combobox/trigger/MultiselectTrigger.d.ts +40 -0
  44. package/dist/core/components/organisms/combobox/trigger/index.d.ts +1 -0
  45. package/dist/core/components/organisms/combobox/trigger/utils.d.ts +3 -0
  46. package/dist/core/components/organisms/combobox/utils.d.ts +2 -0
  47. package/dist/core/components/organisms/list/List.d.ts +1 -0
  48. package/dist/core/components/organisms/listbox/Listbox.d.ts +2 -2
  49. package/dist/core/components/organisms/listbox/listboxItem/ListBody.d.ts +4 -1
  50. package/dist/core/components/organisms/listbox/listboxItem/ListboxItem.d.ts +5 -4
  51. package/dist/core/components/organisms/menu/Menu.d.ts +49 -0
  52. package/dist/core/components/organisms/menu/MenuContext.d.ts +13 -0
  53. package/dist/core/components/organisms/menu/MenuGroup.d.ts +14 -0
  54. package/dist/core/components/organisms/menu/MenuItem.d.ts +17 -0
  55. package/dist/core/components/organisms/menu/MenuList.d.ts +19 -0
  56. package/dist/core/components/organisms/menu/SubMenu.d.ts +6 -0
  57. package/dist/core/components/organisms/menu/SubMenuContext.d.ts +10 -0
  58. package/dist/core/components/organisms/menu/index.d.ts +2 -0
  59. package/dist/core/components/organisms/menu/trigger/MenuTrigger.d.ts +6 -0
  60. package/dist/core/components/organisms/menu/trigger/utils.d.ts +3 -0
  61. package/dist/core/components/organisms/menu/utils.d.ts +2 -0
  62. package/dist/core/components/organisms/select/SearchInput.d.ts +8 -0
  63. package/dist/core/components/organisms/select/Select.d.ts +35 -0
  64. package/dist/core/components/organisms/select/SelectContext.d.ts +24 -0
  65. package/dist/core/components/organisms/select/SelectEmptyTemplate.d.ts +9 -0
  66. package/dist/core/components/organisms/select/SelectFooter.d.ts +7 -0
  67. package/dist/core/components/organisms/select/SelectList.d.ts +20 -0
  68. package/dist/core/components/organisms/select/SelectOption.d.ts +19 -0
  69. package/dist/core/components/organisms/select/SelectTrigger.d.ts +24 -0
  70. package/dist/core/components/organisms/select/__test__/Select.test.d.ts +1 -0
  71. package/dist/core/components/organisms/select/__test__/utils.test.d.ts +1 -0
  72. package/dist/core/components/organisms/select/index.d.ts +2 -0
  73. package/dist/core/components/organisms/select/utils.d.ts +12 -0
  74. package/dist/core/components/organisms/table/Header.d.ts +2 -0
  75. package/dist/core/components/organisms/table/Table.d.ts +3 -0
  76. package/dist/core/index.d.ts +4 -0
  77. package/dist/core/index.type.d.ts +6 -0
  78. package/dist/index.esm.js +2779 -152
  79. package/dist/index.js +2627 -52
  80. package/dist/index.js.map +1 -1
  81. package/dist/index.umd.js +1 -1
  82. package/dist/index.umd.js.br +0 -0
  83. package/dist/index.umd.js.gz +0 -0
  84. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /**
3
- * Generated on: 1709299646057
3
+ * Generated on: 1711981289386
4
4
  * Package: @innovaccer/design-system
5
- * Version: v2.28.3
5
+ * Version: v2.30.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 || '') || '';
@@ -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$V = ["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$V);
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
 
@@ -2360,7 +2366,7 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
2360
2366
  } else if (startDate) {
2361
2367
  inRange = !disabled && (dateComparison(hoverDate, 'more', dateInString, monthInString, yearInString) || inRangeLast) && dateComparison(startDate, 'less', dateInString, monthInString, yearInString);
2362
2368
  } else if (endDate) {
2363
- inRange = !disabled && (compareDate(hoverDate, 'less', yearNavVal, monthNavVal, date) || inRangeLast) && compareDate(endDate, 'more', yearNavVal, monthNavVal, date);
2369
+ inRange = !disabled && (dateComparison(hoverDate, 'less', dateInString, monthInString, yearInString) || inRangeLast) && dateComparison(endDate, 'more', dateInString, monthInString, yearInString);
2364
2370
  }
2365
2371
  }
2366
2372
 
@@ -2368,7 +2374,8 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
2368
2374
  var isStartActive = startDate && dateComparison(startDate, 'equal', dateInString, monthInString, yearInString);
2369
2375
  var isEndActive = endDate && dateComparison(endDate, 'equal', dateInString, monthInString, yearInString);
2370
2376
  var activeDate = startDate && endDate && (isStartActive || isEndActive);
2371
- var isHoverLast = dateComparison(hoverDate, 'equal', dateInString, monthInString, yearInString) && hoverDate && startDate && hoverDate >= startDate;
2377
+ var isHoverBackwardLast = _this.props.allowReverseSelection && dateComparison(hoverDate, 'equal', dateInString, monthInString, yearInString) && hoverDate && (startDate && hoverDate < startDate || endDate && hoverDate < endDate);
2378
+ var isHoverForwardLast = dateComparison(hoverDate, 'equal', dateInString, monthInString, yearInString) && hoverDate && startDate && hoverDate >= startDate;
2372
2379
  var isEdgeElement = col === 0 || col === 6;
2373
2380
  var isValueRange = inRange || rangePicker && (active || activeDate);
2374
2381
  var wrapperClass = classnames({
@@ -2382,7 +2389,8 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
2382
2389
  'Calendar-valueWrapper--startError': isStart && isRangeError || rangePicker && isRangeError && isStartActive,
2383
2390
  'Calendar-valueWrapper--endError': isEnd && isRangeError || rangePicker && isRangeError && isEndActive,
2384
2391
  'Calendar-valueWrapper--dummy': dummy,
2385
- 'Calendar-valueWrapper--hoverDate': rangePicker && isHoverLast,
2392
+ 'Calendar-valueWrapper--hoverDate': rangePicker && isHoverForwardLast,
2393
+ 'Calendar-valueWrapper--hoverEndDate': rangePicker && isHoverBackwardLast,
2386
2394
  'Calendar-valueWrapper--inStartRange': isValueRange && col === 0 && !active && !activeDate,
2387
2395
  'Calendar-valueWrapper--inEndRange': isValueRange && col === 6 && !active && !activeDate
2388
2396
  });
@@ -2623,24 +2631,57 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
2623
2631
  if (onRangeChange) onRangeChange(_startDate4, _endDate4);
2624
2632
  }
2625
2633
 
2634
+ if (this.props.allowReverseSelection && prevState.hoverDate !== this.state.hoverDate) {
2635
+ var _this$state11 = this.state,
2636
+ hoverDate = _this$state11.hoverDate,
2637
+ _startDate5 = _this$state11.startDate,
2638
+ _endDate5 = _this$state11.endDate;
2639
+
2640
+ if (_startDate5 && !_endDate5) {
2641
+ var _getDateInfo9 = getDateInfo(_startDate5),
2642
+ _year3 = _getDateInfo9.year,
2643
+ _month3 = _getDateInfo9.month,
2644
+ _date4 = _getDateInfo9.date;
2645
+
2646
+ if (compareDate(hoverDate, 'less', _year3, _month3, _date4)) {
2647
+ this.setState({
2648
+ startDate: undefined,
2649
+ endDate: _startDate5
2650
+ });
2651
+ }
2652
+ } else if (_endDate5 && !_startDate5) {
2653
+ var _getDateInfo10 = getDateInfo(_endDate5),
2654
+ _year4 = _getDateInfo10.year,
2655
+ _month4 = _getDateInfo10.month,
2656
+ _date5 = _getDateInfo10.date;
2657
+
2658
+ if (compareDate(hoverDate, 'more', _year4, _month4, _date5)) {
2659
+ this.setState({
2660
+ startDate: _endDate5,
2661
+ endDate: undefined
2662
+ });
2663
+ }
2664
+ }
2665
+ }
2666
+
2626
2667
  if (prevState.year !== this.state.year) {
2627
- var _year3 = this.state.year;
2668
+ var _year5 = this.state.year;
2628
2669
 
2629
- if (_year3 !== undefined && monthsInView === 1) {
2670
+ if (_year5 !== undefined && monthsInView === 1) {
2630
2671
  this.setState({
2631
- year: _year3,
2632
- yearBlockNav: getYearBlock(_year3),
2633
- yearNav: _year3
2672
+ year: _year5,
2673
+ yearBlockNav: getYearBlock(_year5),
2674
+ yearNav: _year5
2634
2675
  });
2635
2676
  }
2636
2677
  }
2637
2678
 
2638
2679
  if (prevState.month !== this.state.month) {
2639
- var _month3 = this.state.month;
2680
+ var _month5 = this.state.month;
2640
2681
 
2641
- if (_month3 !== undefined && monthsInView === 1) {
2682
+ if (_month5 !== undefined && monthsInView === 1) {
2642
2683
  this.setState({
2643
- monthNav: _month3
2684
+ monthNav: _month5
2644
2685
  });
2645
2686
  }
2646
2687
  }
@@ -2692,7 +2733,7 @@ _defineProperty$1(Calendar, "defaultProps", {
2692
2733
  jumpView: true
2693
2734
  });
2694
2735
 
2695
- var _excluded$F = ["shadow", "children", "className"];
2736
+ var _excluded$U = ["shadow", "children", "className"];
2696
2737
  var Card = /*#__PURE__*/React.forwardRef(function (props, ref) {
2697
2738
  var _classNames;
2698
2739
 
@@ -2700,7 +2741,7 @@ var Card = /*#__PURE__*/React.forwardRef(function (props, ref) {
2700
2741
  shadow = _props$shadow === void 0 ? 'shadow10' : _props$shadow,
2701
2742
  children = props.children,
2702
2743
  className = props.className,
2703
- rest = _objectWithoutProperties(props, _excluded$F);
2744
+ rest = _objectWithoutProperties(props, _excluded$U);
2704
2745
 
2705
2746
  var classes = classnames((_classNames = {
2706
2747
  Card: true
@@ -2717,12 +2758,12 @@ Card.defaultProps = {
2717
2758
  shadow: 'shadow10'
2718
2759
  };
2719
2760
 
2720
- var _excluded$E = ["border", "children", "className"];
2761
+ var _excluded$T = ["border", "children", "className"];
2721
2762
  var CardSubdued = /*#__PURE__*/React.forwardRef(function (props, ref) {
2722
2763
  var border = props.border,
2723
2764
  children = props.children,
2724
2765
  className = props.className,
2725
- rest = _objectWithoutProperties(props, _excluded$E);
2766
+ rest = _objectWithoutProperties(props, _excluded$T);
2726
2767
 
2727
2768
  var classes = classnames(_defineProperty$1({
2728
2769
  CardSubdued: true
@@ -2789,7 +2830,7 @@ var isSpaceKey = function isSpaceKey(e) {
2789
2830
  return e.key === 'Space';
2790
2831
  };
2791
2832
 
2792
- var _excluded$D = ["onClick", "onKeyDown", "role", "tabIndex"];
2833
+ var _excluded$S = ["onClick", "onKeyDown", "role", "tabIndex"];
2793
2834
  var allowed = {
2794
2835
  button: new Set(['Enter', 'Space', 'Spacebar', ' ']),
2795
2836
  link: new Set(['Enter']),
@@ -2813,7 +2854,7 @@ var useAccessibilityProps = function useAccessibilityProps(_ref) {
2813
2854
  _ref$role = _ref.role,
2814
2855
  role = _ref$role === void 0 ? 'button' : _ref$role,
2815
2856
  tabIndex = _ref.tabIndex,
2816
- rest = _objectWithoutProperties(_ref, _excluded$D);
2857
+ rest = _objectWithoutProperties(_ref, _excluded$S);
2817
2858
 
2818
2859
  return _objectSpread2({}, onClick ? {
2819
2860
  onClick: onClick,
@@ -2931,43 +2972,49 @@ Icon.defaultProps = {
2931
2972
  size: 16
2932
2973
  };
2933
2974
 
2934
- var _excluded$C = ["children", "componentType", "className"];
2975
+ var _excluded$R = ["children", "componentType", "className"];
2935
2976
 
2936
- var GenericText = function GenericText(_ref) {
2977
+ var GenericText = function GenericText(_ref, ref) {
2937
2978
  var children = _ref.children,
2938
2979
  _ref$componentType = _ref.componentType,
2939
2980
  componentType = _ref$componentType === void 0 ? 'span' : _ref$componentType,
2940
2981
  className = _ref.className,
2941
- props = _objectWithoutProperties(_ref, _excluded$C);
2982
+ rest = _objectWithoutProperties(_ref, _excluded$R);
2942
2983
 
2943
- return /*#__PURE__*/React.createElement(componentType, _objectSpread2(_objectSpread2({}, props), {}, {
2944
- className: className
2984
+ return /*#__PURE__*/React.createElement(componentType, _objectSpread2(_objectSpread2({}, rest), {}, {
2985
+ className: className,
2986
+ ref: ref
2945
2987
  }), children);
2946
2988
  };
2947
2989
 
2948
- var _excluded$B = ["appearance", "size", "children", "weight", "small", "className", "color"];
2949
- var Text = function Text(props) {
2990
+ var Link$1 = /*#__PURE__*/React.forwardRef(GenericText);
2991
+
2992
+ var _excluded$Q = ["appearance", "size", "children", "weight", "small", "className", "color"];
2993
+ var Text = /*#__PURE__*/React.forwardRef(function (props, ref) {
2950
2994
  var _classNames;
2951
2995
 
2952
- var appearance = props.appearance,
2953
- size = props.size,
2996
+ var _props$appearance = props.appearance,
2997
+ appearance = _props$appearance === void 0 ? 'default' : _props$appearance,
2998
+ _props$size = props.size,
2999
+ size = _props$size === void 0 ? 'regular' : _props$size,
2954
3000
  children = props.children,
2955
3001
  weight = props.weight,
2956
3002
  small = props.small,
2957
3003
  className = props.className,
2958
3004
  color = props.color,
2959
- rest = _objectWithoutProperties(props, _excluded$B);
3005
+ rest = _objectWithoutProperties(props, _excluded$Q);
2960
3006
 
2961
3007
  var classes = classnames((_classNames = {
2962
3008
  Text: true
2963
3009
  }, _defineProperty$1(_classNames, "Text--".concat(appearance), !color && appearance), _defineProperty$1(_classNames, "Text--".concat(weight), weight), _defineProperty$1(_classNames, "Text--".concat(size), size), _defineProperty$1(_classNames, "color-".concat(color), color), _defineProperty$1(_classNames, 'Text--small', size === 'small' || small), _classNames), className);
2964
- return /*#__PURE__*/React.createElement(GenericText, _extends$2({
3010
+ return /*#__PURE__*/React.createElement(Link$1, _extends$2({
3011
+ ref: ref,
2965
3012
  "data-test": "DesignSystem-Text"
2966
3013
  }, rest, {
2967
3014
  className: classes,
2968
3015
  componentType: "span"
2969
3016
  }), children);
2970
- };
3017
+ });
2971
3018
  Text.displayName = 'Text';
2972
3019
  Text.defaultProps = {
2973
3020
  appearance: 'default',
@@ -3243,7 +3290,7 @@ var CheckboxIcon = function CheckboxIcon(props) {
3243
3290
  }
3244
3291
  };
3245
3292
 
3246
- var _excluded$A = ["size", "tabIndex", "defaultChecked", "indeterminate", "label", "error", "disabled", "onChange", "name", "value", "className", "checked", "helpText", "id"];
3293
+ var _excluded$P = ["size", "tabIndex", "defaultChecked", "indeterminate", "label", "error", "disabled", "onChange", "name", "value", "className", "checked", "helpText", "id"];
3247
3294
  var Checkbox = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
3248
3295
  var _classNames, _classNames2, _classNames3, _classNames4, _classNames5, _classNames6;
3249
3296
 
@@ -3264,7 +3311,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
3264
3311
  helpText = props.helpText,
3265
3312
  _props$id = props.id,
3266
3313
  id = _props$id === void 0 ? "".concat(name, "-").concat(label, "-").concat(uidGenerator()) : _props$id,
3267
- rest = _objectWithoutProperties(props, _excluded$A);
3314
+ rest = _objectWithoutProperties(props, _excluded$P);
3268
3315
 
3269
3316
  var ref = React.useRef(null);
3270
3317
  React.useImperativeHandle(forwardedRef, function () {
@@ -3345,7 +3392,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
3345
3392
  });
3346
3393
  Checkbox.displayName = 'Checkbox';
3347
3394
 
3348
- var _excluded$z = ["size", "sizeXS", "sizeS", "sizeM", "sizeL", "sizeXL", "className", "children"];
3395
+ var _excluded$O = ["size", "sizeXS", "sizeS", "sizeM", "sizeL", "sizeXL", "className", "children"];
3349
3396
  var Column = /*#__PURE__*/React.forwardRef(function (props, ref) {
3350
3397
  var _classNames;
3351
3398
 
@@ -3357,7 +3404,7 @@ var Column = /*#__PURE__*/React.forwardRef(function (props, ref) {
3357
3404
  sizeXL = props.sizeXL,
3358
3405
  className = props.className,
3359
3406
  children = props.children,
3360
- rest = _objectWithoutProperties(props, _excluded$z);
3407
+ rest = _objectWithoutProperties(props, _excluded$O);
3361
3408
 
3362
3409
  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
3410
  return /*#__PURE__*/React.createElement("div", _extends$2({
@@ -3468,7 +3515,7 @@ var Trigger$1 = function Trigger(props) {
3468
3515
  }));
3469
3516
  };
3470
3517
 
3471
- var _excluded$y = ["date", "open", "position", "inputFormat", "outputFormat", "inputOptions", "validators", "withInput", "disabledBefore", "disabledAfter", "onDateChange", "closeOnSelect", "size", "showTodayDate", "children", "view"];
3518
+ var _excluded$N = ["date", "open", "position", "inputFormat", "outputFormat", "inputOptions", "validators", "withInput", "disabledBefore", "disabledAfter", "onDateChange", "closeOnSelect", "size", "showTodayDate", "children", "view"];
3472
3519
  var DatePicker = /*#__PURE__*/function (_React$Component) {
3473
3520
  _inherits(DatePicker, _React$Component);
3474
3521
 
@@ -3623,7 +3670,7 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
3623
3670
  _this$props4$children = _this$props4.children,
3624
3671
  children = _this$props4$children === void 0 ? /*#__PURE__*/React.createElement(React.Fragment, null) : _this$props4$children,
3625
3672
  view = _this$props4.view,
3626
- rest = _objectWithoutProperties(_this$props4, _excluded$y);
3673
+ rest = _objectWithoutProperties(_this$props4, _excluded$N);
3627
3674
 
3628
3675
  var date = this.state.date;
3629
3676
  var months = config.months;
@@ -4689,7 +4736,7 @@ function debounce$1 (delay, atBegin, callback) {
4689
4736
  return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
4690
4737
  }
4691
4738
 
4692
- var _excluded$x = ["triggerSize", "placeholder", "menu", "children", "icon", "disabled", "open", "inlineLabel", "error", "iconType"];
4739
+ var _excluded$M = ["triggerSize", "placeholder", "menu", "children", "icon", "disabled", "open", "inlineLabel", "error", "iconType"];
4693
4740
  var DropdownButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
4694
4741
  var _classNames, _classNames2;
4695
4742
 
@@ -4706,7 +4753,7 @@ var DropdownButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
4706
4753
  inlineLabel = props.inlineLabel,
4707
4754
  error = props.error,
4708
4755
  iconType = props.iconType,
4709
- rest = _objectWithoutProperties(props, _excluded$x);
4756
+ rest = _objectWithoutProperties(props, _excluded$M);
4710
4757
 
4711
4758
  var buttonDisabled = disabled ? 'disabled' : 'default';
4712
4759
  var trimmedPlaceholder = placeholder.trim();
@@ -5779,7 +5826,7 @@ var DropdownList = function DropdownList(props) {
5779
5826
 
5780
5827
  DropdownList.displayName = 'DropdownList';
5781
5828
 
5782
- var _excluded$w = ["triggerOptions", "selected", "tabIndex"];
5829
+ var _excluded$L = ["triggerOptions", "selected", "tabIndex"];
5783
5830
  var inputRef = /*#__PURE__*/React.createRef();
5784
5831
 
5785
5832
  /**
@@ -6471,7 +6518,7 @@ var Dropdown = /*#__PURE__*/function (_React$Component) {
6471
6518
  triggerOptions = _this$props14$trigger === void 0 ? {} : _this$props14$trigger;
6472
6519
  _this$props14.selected;
6473
6520
  var tabIndex = _this$props14.tabIndex,
6474
- rest = _objectWithoutProperties(_this$props14, _excluded$w);
6521
+ rest = _objectWithoutProperties(_this$props14, _excluded$L);
6475
6522
 
6476
6523
  var remainingOptionsLen = searchedOptionsLength - options.length;
6477
6524
  var firstEnabledOption = tabIndex ? tabIndex : _isSelectAllPresent(searchTerm, remainingOptionsLen, withSelectAll, withCheckbox) ? 0 : options.findIndex(function (option) {
@@ -6519,7 +6566,7 @@ _defineProperty$1(Dropdown, "defaultProps", {
6519
6566
  searchDebounceDuration: 300
6520
6567
  });
6521
6568
 
6522
- var _excluded$v = ["appearance", "size", "children", "className", "color"];
6569
+ var _excluded$K = ["appearance", "size", "children", "className", "color"];
6523
6570
  var sizeMap = {
6524
6571
  s: 'h5',
6525
6572
  m: 'h4',
@@ -6535,12 +6582,12 @@ var Heading = function Heading(props) {
6535
6582
  children = props.children,
6536
6583
  className = props.className,
6537
6584
  color = props.color,
6538
- rest = _objectWithoutProperties(props, _excluded$v);
6585
+ rest = _objectWithoutProperties(props, _excluded$K);
6539
6586
 
6540
6587
  var classes = classnames((_classNames = {
6541
6588
  Heading: true
6542
6589
  }, _defineProperty$1(_classNames, "Heading--".concat(size), size), _defineProperty$1(_classNames, "Heading--".concat(appearance), !color && appearance), _defineProperty$1(_classNames, "color-".concat(color), color), _classNames), className);
6543
- return /*#__PURE__*/React.createElement(GenericText, _extends$2({
6590
+ return /*#__PURE__*/React.createElement(Link$1, _extends$2({
6544
6591
  "data-test": "DesignSystem-Heading"
6545
6592
  }, rest, {
6546
6593
  className: classes,
@@ -6553,13 +6600,13 @@ Heading.defaultProps = {
6553
6600
  size: 'm'
6554
6601
  };
6555
6602
 
6556
- var _excluded$u = ["className", "iconType"];
6603
+ var _excluded$J = ["className", "iconType"];
6557
6604
  var ActionButton$1 = function ActionButton(props) {
6558
6605
  var _classNames;
6559
6606
 
6560
6607
  var className = props.className,
6561
6608
  iconType = props.iconType,
6562
- rest = _objectWithoutProperties(props, _excluded$u);
6609
+ rest = _objectWithoutProperties(props, _excluded$J);
6563
6610
 
6564
6611
  var iconClass = classnames((_classNames = {}, _defineProperty$1(_classNames, 'ActionButton', true), _defineProperty$1(_classNames, "".concat(className), className), _classNames));
6565
6612
  return /*#__PURE__*/React.createElement(Icon, _extends$2({
@@ -6574,7 +6621,7 @@ ActionButton$1.defaultProps = {
6574
6621
  type: 'rounded'
6575
6622
  };
6576
6623
 
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"];
6624
+ var _excluded$I = ["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
6625
  var sizeMapping$2 = {
6579
6626
  tiny: 12,
6580
6627
  regular: 16,
@@ -6616,7 +6663,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
6616
6663
  disabled = props.disabled,
6617
6664
  readOnly = props.readOnly,
6618
6665
  iconType = props.iconType,
6619
- rest = _objectWithoutProperties(props, _excluded$t);
6666
+ rest = _objectWithoutProperties(props, _excluded$I);
6620
6667
 
6621
6668
  var ref = React.useRef(null);
6622
6669
 
@@ -6725,7 +6772,7 @@ Object.assign(Input, {
6725
6772
  ActionButton: ActionButton$1
6726
6773
  });
6727
6774
 
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"];
6775
+ var _excluded$H = ["size", "defaultValue", "name", "placeholder", "icon", "prefix", "suffix", "error", "min", "max", "onChange", "onClick", "onBlur", "onFocus", "className", "autoFocus", "disabled", "readOnly", "value", "showActionButton", "onKeyDown", "iconType"];
6729
6776
  var sizeMapping$1 = {
6730
6777
  regular: 16,
6731
6778
  large: 20
@@ -6776,7 +6823,7 @@ var MetricInput = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
6776
6823
  showActionButton = _props$showActionButt === void 0 ? true : _props$showActionButt,
6777
6824
  onKeyDown = props.onKeyDown,
6778
6825
  iconType = props.iconType,
6779
- rest = _objectWithoutProperties(props, _excluded$s);
6826
+ rest = _objectWithoutProperties(props, _excluded$H);
6780
6827
 
6781
6828
  var ref = React.useRef(null);
6782
6829
  var isUncontrolled = valueProp === undefined;
@@ -6942,7 +6989,7 @@ var getDefaultValue = function getDefaultValue(mask, placeholderChar) {
6942
6989
  return val;
6943
6990
  };
6944
6991
 
6945
- var _excluded$r = ["mask", "value", "placeholderChar", "validators", "clearOnEmptyBlur", "defaultValue", "mask", "error", "caption", "required", "onChange", "onPaste", "onBlur", "onFocus", "onClear", "className", "id", "helpText"];
6992
+ var _excluded$G = ["mask", "value", "placeholderChar", "validators", "clearOnEmptyBlur", "defaultValue", "mask", "error", "caption", "required", "onChange", "onPaste", "onBlur", "onFocus", "onClear", "className", "id", "helpText"];
6946
6993
 
6947
6994
  /**
6948
6995
  * It works as Uncontrolled Input
@@ -6971,7 +7018,7 @@ var InputMask = /*#__PURE__*/React.forwardRef(function (props, forwardRef) {
6971
7018
  className = props.className,
6972
7019
  id = props.id,
6973
7020
  helpText = props.helpText,
6974
- rest = _objectWithoutProperties(props, _excluded$r);
7021
+ rest = _objectWithoutProperties(props, _excluded$G);
6975
7022
 
6976
7023
  var isEditable = React.useCallback(function (pos) {
6977
7024
  return _typeof(mask[pos]) === 'object';
@@ -7275,7 +7322,7 @@ InputMask.utils = {
7275
7322
  };
7276
7323
  var X = InputMask;
7277
7324
 
7278
- var _excluded$q = ["required", "optional", "withInput", "disabled", "children", "className", "info"];
7325
+ var _excluded$F = ["required", "optional", "withInput", "disabled", "children", "className", "info"];
7279
7326
 
7280
7327
  /**
7281
7328
  * *NOTE: Extends props with HTMLProps<HTMLLabelElement>*
@@ -7290,7 +7337,7 @@ var Label = function Label(props) {
7290
7337
  children = props.children,
7291
7338
  className = props.className,
7292
7339
  info = props.info,
7293
- rest = _objectWithoutProperties(props, _excluded$q);
7340
+ rest = _objectWithoutProperties(props, _excluded$F);
7294
7341
 
7295
7342
  var baseProps = extractBaseProps(props);
7296
7343
  var LabelClass = classnames((_classNames = {
@@ -7339,7 +7386,7 @@ var Label = function Label(props) {
7339
7386
  "data-test": "DesignSystem-Label"
7340
7387
  }, baseProps, {
7341
7388
  className: LabelClass
7342
- }), /*#__PURE__*/React.createElement(GenericText, _extends$2({
7389
+ }), /*#__PURE__*/React.createElement(Link$1, _extends$2({
7343
7390
  "data-test": "DesignSystem-Label--Text",
7344
7391
  className: classes,
7345
7392
  componentType: "label"
@@ -7448,7 +7495,7 @@ var Editable = function Editable(props) {
7448
7495
  };
7449
7496
  Editable.displayName = 'Editable';
7450
7497
 
7451
- var _excluded$p = ["onChange", "onClose"];
7498
+ var _excluded$E = ["onChange", "onClose"];
7452
7499
  var EditableDropdown = function EditableDropdown(props) {
7453
7500
  var _classNames2;
7454
7501
 
@@ -7459,7 +7506,7 @@ var EditableDropdown = function EditableDropdown(props) {
7459
7506
 
7460
7507
  var onDropdownChange = dropdownOptions.onChange,
7461
7508
  onDropdownClose = dropdownOptions.onClose,
7462
- rest = _objectWithoutProperties(dropdownOptions, _excluded$p);
7509
+ rest = _objectWithoutProperties(dropdownOptions, _excluded$E);
7463
7510
 
7464
7511
  var _React$useState = React.useState(placeholder),
7465
7512
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -7540,7 +7587,7 @@ EditableDropdown.defaultProps = {
7540
7587
  dropdownOptions: {}
7541
7588
  };
7542
7589
 
7543
- var _excluded$o = ["children", "className", "appearance", "size", "disabled"];
7590
+ var _excluded$D = ["children", "className", "appearance", "size", "disabled"];
7544
7591
  var Link = function Link(props) {
7545
7592
  var _classNames;
7546
7593
 
@@ -7549,12 +7596,12 @@ var Link = function Link(props) {
7549
7596
  appearance = props.appearance,
7550
7597
  size = props.size,
7551
7598
  disabled = props.disabled,
7552
- rest = _objectWithoutProperties(props, _excluded$o);
7599
+ rest = _objectWithoutProperties(props, _excluded$D);
7553
7600
 
7554
7601
  var classes = classnames((_classNames = {
7555
7602
  Link: true
7556
7603
  }, _defineProperty$1(_classNames, "Link--".concat(size), size), _defineProperty$1(_classNames, "Link--".concat(appearance), appearance), _defineProperty$1(_classNames, "Link--".concat(appearance, "-disabled"), disabled), _classNames), className);
7557
- return /*#__PURE__*/React.createElement(GenericText, _extends$2({
7604
+ return /*#__PURE__*/React.createElement(Link$1, _extends$2({
7558
7605
  "data-test": "DesignSystem-Link",
7559
7606
  className: classes,
7560
7607
  componentType: "a",
@@ -8445,12 +8492,12 @@ _defineProperty$1(MultiSlider, "defaultProps", {
8445
8492
 
8446
8493
  _defineProperty$1(MultiSlider, "Handle", MultiSliderHandle);
8447
8494
 
8448
- var _excluded$n = ["children", "className", "onOutsideClick"];
8495
+ var _excluded$C = ["children", "className", "onOutsideClick"];
8449
8496
  var OutsideClick = /*#__PURE__*/React.forwardRef(function (props, ref) {
8450
8497
  var children = props.children,
8451
8498
  className = props.className,
8452
8499
  onOutsideClick = props.onOutsideClick,
8453
- rest = _objectWithoutProperties(props, _excluded$n);
8500
+ rest = _objectWithoutProperties(props, _excluded$C);
8454
8501
 
8455
8502
  var innerRef = React.useRef(null);
8456
8503
  React.useImperativeHandle(ref, function () {
@@ -8482,7 +8529,7 @@ var OutsideClick = /*#__PURE__*/React.forwardRef(function (props, ref) {
8482
8529
  });
8483
8530
  OutsideClick.displayName = 'OutsideClick';
8484
8531
 
8485
- var _excluded$m = ["appearance", "children", "className", "color"];
8532
+ var _excluded$B = ["appearance", "children", "className", "color"];
8486
8533
  var Paragraph = function Paragraph(props) {
8487
8534
  var _classNames;
8488
8535
 
@@ -8490,12 +8537,12 @@ var Paragraph = function Paragraph(props) {
8490
8537
  children = props.children,
8491
8538
  className = props.className,
8492
8539
  color = props.color,
8493
- rest = _objectWithoutProperties(props, _excluded$m);
8540
+ rest = _objectWithoutProperties(props, _excluded$B);
8494
8541
 
8495
8542
  var classes = classnames((_classNames = {
8496
8543
  Text: true
8497
8544
  }, _defineProperty$1(_classNames, "Text--".concat(appearance), !color && appearance), _defineProperty$1(_classNames, "color-".concat(color), color), _classNames), className);
8498
- return /*#__PURE__*/React.createElement(GenericText, _extends$2({
8545
+ return /*#__PURE__*/React.createElement(Link$1, _extends$2({
8499
8546
  "data-test": "DesignSystem-Paragraph"
8500
8547
  }, rest, {
8501
8548
  className: classes,
@@ -8538,7 +8585,7 @@ ProgressBar.defaultProps = {
8538
8585
  size: 'regular'
8539
8586
  };
8540
8587
 
8541
- var _excluded$l = ["size", "label", "disabled", "onChange", "name", "value", "checked", "defaultChecked", "className", "helpText", "error"];
8588
+ var _excluded$A = ["size", "label", "disabled", "onChange", "name", "value", "checked", "defaultChecked", "className", "helpText", "error"];
8542
8589
  var Radio = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
8543
8590
  var _classNames, _classNames2, _classNames3;
8544
8591
 
@@ -8554,7 +8601,7 @@ var Radio = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
8554
8601
  className = props.className,
8555
8602
  helpText = props.helpText,
8556
8603
  error = props.error,
8557
- rest = _objectWithoutProperties(props, _excluded$l);
8604
+ rest = _objectWithoutProperties(props, _excluded$A);
8558
8605
 
8559
8606
  var ref = React.useRef(null);
8560
8607
  React.useImperativeHandle(forwardedRef, function () {
@@ -8605,11 +8652,11 @@ var Radio = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
8605
8652
  });
8606
8653
  Radio.displayName = 'Radio';
8607
8654
 
8608
- var _excluded$k = ["className", "children"];
8655
+ var _excluded$z = ["className", "children"];
8609
8656
  var Row = /*#__PURE__*/React.forwardRef(function (props, ref) {
8610
8657
  var className = props.className,
8611
8658
  children = props.children,
8612
- rest = _objectWithoutProperties(props, _excluded$k);
8659
+ rest = _objectWithoutProperties(props, _excluded$z);
8613
8660
 
8614
8661
  var classes = classnames(_defineProperty$1({
8615
8662
  Row: true
@@ -8726,13 +8773,13 @@ Spinner.defaultProps = {
8726
8773
  size: 'medium'
8727
8774
  };
8728
8775
 
8729
- var _excluded$j = ["value", "defaultValue", "onRelease", "onChange"];
8776
+ var _excluded$y = ["value", "defaultValue", "onRelease", "onChange"];
8730
8777
  var Slider = function Slider(props) {
8731
8778
  var valueProp = props.value,
8732
8779
  defaultValue = props.defaultValue,
8733
8780
  onRelease = props.onRelease,
8734
8781
  onChange = props.onChange,
8735
- rest = _objectWithoutProperties(props, _excluded$j);
8782
+ rest = _objectWithoutProperties(props, _excluded$y);
8736
8783
 
8737
8784
  var _React$useState = React.useState(valueProp === undefined ? defaultValue : valueProp),
8738
8785
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -8765,7 +8812,7 @@ Slider.defaultProps = _objectSpread2(_objectSpread2({}, MultiSlider.defaultProps
8765
8812
  defaultValue: 0
8766
8813
  });
8767
8814
 
8768
- var _excluded$i = ["value", "defaultValue", "onChange", "onRelease"];
8815
+ var _excluded$x = ["value", "defaultValue", "onChange", "onRelease"];
8769
8816
  var RangeIndex;
8770
8817
 
8771
8818
  (function (RangeIndex) {
@@ -8778,7 +8825,7 @@ var RangeSlider = function RangeSlider(props) {
8778
8825
  defaultValue = props.defaultValue,
8779
8826
  onChange = props.onChange,
8780
8827
  onRelease = props.onRelease,
8781
- rest = _objectWithoutProperties(props, _excluded$i);
8828
+ rest = _objectWithoutProperties(props, _excluded$x);
8782
8829
 
8783
8830
  var _React$useState = React.useState(valueProp === undefined ? defaultValue : valueProp),
8784
8831
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -8814,7 +8861,7 @@ RangeSlider.defaultProps = _objectSpread2(_objectSpread2({}, MultiSlider.default
8814
8861
  defaultValue: [0, 10]
8815
8862
  });
8816
8863
 
8817
- var _excluded$h = ["appearance", "children", "className", "color"];
8864
+ var _excluded$w = ["appearance", "children", "className", "color"];
8818
8865
  var Subheading = function Subheading(props) {
8819
8866
  var _classNames;
8820
8867
 
@@ -8822,12 +8869,12 @@ var Subheading = function Subheading(props) {
8822
8869
  children = props.children,
8823
8870
  className = props.className,
8824
8871
  color = props.color,
8825
- rest = _objectWithoutProperties(props, _excluded$h);
8872
+ rest = _objectWithoutProperties(props, _excluded$w);
8826
8873
 
8827
8874
  var classes = classnames((_classNames = {
8828
8875
  Subheading: true
8829
8876
  }, _defineProperty$1(_classNames, "Subheading--".concat(appearance), !color && appearance), _defineProperty$1(_classNames, "color-".concat(color), color), _classNames), className);
8830
- return /*#__PURE__*/React.createElement(GenericText, _extends$2({
8877
+ return /*#__PURE__*/React.createElement(Link$1, _extends$2({
8831
8878
  "data-test": "DesignSystem-Subheading"
8832
8879
  }, rest, {
8833
8880
  className: classes,
@@ -8839,7 +8886,7 @@ Subheading.defaultProps = {
8839
8886
  appearance: 'default'
8840
8887
  };
8841
8888
 
8842
- var _excluded$g = ["size", "defaultChecked", "disabled", "onChange", "name", "value", "className", "appearance", "checked"];
8889
+ var _excluded$v = ["size", "defaultChecked", "disabled", "onChange", "name", "value", "className", "appearance", "checked"];
8843
8890
 
8844
8891
  /**
8845
8892
  * ######Switch has two types:
@@ -8859,7 +8906,7 @@ var Switch = /*#__PURE__*/React.forwardRef(function (props, ref) {
8859
8906
  className = props.className;
8860
8907
  props.appearance;
8861
8908
  var checkedProp = props.checked,
8862
- rest = _objectWithoutProperties(props, _excluded$g);
8909
+ rest = _objectWithoutProperties(props, _excluded$v);
8863
8910
 
8864
8911
  var _React$useState = React.useState(checkedProp === undefined ? defaultChecked : checkedProp),
8865
8912
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -8898,7 +8945,7 @@ var Switch = /*#__PURE__*/React.forwardRef(function (props, ref) {
8898
8945
  });
8899
8946
  Switch.displayName = 'Switch';
8900
8947
 
8901
- var _excluded$f = ["rows", "resize", "disabled", "name", "placeholder", "value", "defaultValue", "required", "error", "onChange", "onClick", "onBlur", "onFocus", "className"];
8948
+ var _excluded$u = ["rows", "resize", "disabled", "name", "placeholder", "value", "defaultValue", "required", "error", "onChange", "onClick", "onBlur", "onFocus", "className"];
8902
8949
  var Textarea = /*#__PURE__*/React.forwardRef(function (props, ref) {
8903
8950
  var _classNames;
8904
8951
 
@@ -8918,7 +8965,7 @@ var Textarea = /*#__PURE__*/React.forwardRef(function (props, ref) {
8918
8965
  onBlur = props.onBlur,
8919
8966
  onFocus = props.onFocus,
8920
8967
  className = props.className,
8921
- rest = _objectWithoutProperties(props, _excluded$f);
8968
+ rest = _objectWithoutProperties(props, _excluded$u);
8922
8969
 
8923
8970
  var classes = classnames((_classNames = {}, _defineProperty$1(_classNames, 'Textarea', true), _defineProperty$1(_classNames, 'Textarea--resize', resize), _defineProperty$1(_classNames, 'Textarea--error', error), _classNames), className);
8924
8971
  return /*#__PURE__*/React.createElement("textarea", _extends$2({
@@ -13694,6 +13741,11 @@ var PopperWrapper = /*#__PURE__*/function (_React$Component) {
13694
13741
  break;
13695
13742
  }
13696
13743
 
13744
+ if (_this.props.triggerCoordinates) {
13745
+ newStyle.position = 'absolute';
13746
+ newStyle.transform = "translate(".concat(_this.props.triggerCoordinates.x, "px, ").concat(_this.props.triggerCoordinates.y, "px)");
13747
+ }
13748
+
13697
13749
  return newStyle;
13698
13750
  });
13699
13751
 
@@ -14008,16 +14060,33 @@ var PopperWrapper = /*#__PURE__*/function (_React$Component) {
14008
14060
  placement = _this$props6.placement,
14009
14061
  appendToBody = _this$props6.appendToBody,
14010
14062
  hide = _this$props6.hide,
14011
- boundaryElement = _this$props6.boundaryElement;
14063
+ boundaryElement = _this$props6.boundaryElement,
14064
+ triggerCoordinates = _this$props6.triggerCoordinates;
14012
14065
  var _this$state2 = this.state,
14013
14066
  animationKeyframe = _this$state2.animationKeyframe,
14014
14067
  isOpen = _this$state2.isOpen;
14068
+ var coordinatesPopper = /*#__PURE__*/React.createElement(Popper, {
14069
+ placement: placement,
14070
+ innerRef: this.popupRef,
14071
+ modifiers: _objectSpread2({
14072
+ preventOverflow: {
14073
+ boundariesElement: boundaryElement || document.body
14074
+ },
14075
+ hide: {
14076
+ enabled: hide
14077
+ }
14078
+ }, triggerCoordinates && {
14079
+ offset: {
14080
+ offset: "".concat(triggerCoordinates.x, "px, ").concat(triggerCoordinates.y, "px")
14081
+ }
14082
+ })
14083
+ }, this.getPopperChildren);
14015
14084
  return /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement("style", null, animationKeyframe), /*#__PURE__*/React.createElement(Reference, {
14016
14085
  innerRef: this.triggerRef
14017
14086
  }, function (_ref2) {
14018
14087
  var ref = _ref2.ref;
14019
14088
  return _this6.getTriggerElement(ref);
14020
- }), isOpen && appendToBody && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(Popper, {
14089
+ }), isOpen && appendToBody && !triggerCoordinates && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(Popper, {
14021
14090
  placement: placement,
14022
14091
  innerRef: this.popupRef,
14023
14092
  modifiers: {
@@ -14028,7 +14097,7 @@ var PopperWrapper = /*#__PURE__*/function (_React$Component) {
14028
14097
  enabled: hide
14029
14098
  }
14030
14099
  }
14031
- }, this.getPopperChildren), document.body), isOpen && !appendToBody && /*#__PURE__*/React.createElement(Popper, {
14100
+ }, this.getPopperChildren), document.body), isOpen && appendToBody && triggerCoordinates && /*#__PURE__*/ReactDOM.createPortal(coordinatesPopper, document.body), isOpen && !appendToBody && !triggerCoordinates && /*#__PURE__*/React.createElement(Popper, {
14032
14101
  placement: placement,
14033
14102
  innerRef: this.popupRef
14034
14103
  }, this.getPopperChildren));
@@ -14047,7 +14116,7 @@ _defineProperty$1(PopperWrapper, "defaultProps", {
14047
14116
  style: {}
14048
14117
  });
14049
14118
 
14050
- var _excluded$e = ["position", "customStyle", "dark", "children", "onToggle", "className", "hideOnReferenceEscape", "boundaryElement"];
14119
+ var _excluded$t = ["position", "customStyle", "dark", "children", "onToggle", "className", "hideOnReferenceEscape", "boundaryElement", "name"];
14051
14120
  var propsList = ['appendToBody', 'trigger', 'hoverable', 'on', 'open', 'closeOnBackdropClick', 'offset', 'closeOnScroll'];
14052
14121
  var Popover = function Popover(props) {
14053
14122
  var position = props.position,
@@ -14059,7 +14128,8 @@ var Popover = function Popover(props) {
14059
14128
  hideOnReferenceEscape = props.hideOnReferenceEscape,
14060
14129
  _props$boundaryElemen = props.boundaryElement,
14061
14130
  boundaryElement = _props$boundaryElemen === void 0 ? document.body : _props$boundaryElemen,
14062
- rest = _objectWithoutProperties(props, _excluded$e);
14131
+ name = props.name,
14132
+ rest = _objectWithoutProperties(props, _excluded$t);
14063
14133
 
14064
14134
  var _React$useState = React.useState(!!props.open),
14065
14135
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -14091,7 +14161,8 @@ var Popover = function Popover(props) {
14091
14161
  "data-test": "DesignSystem-Popover",
14092
14162
  className: classes,
14093
14163
  "data-layer": true,
14094
- "data-opened": open
14164
+ "data-opened": open,
14165
+ "data-name": name
14095
14166
  }, children);
14096
14167
  return /*#__PURE__*/React.createElement(PopperWrapper, _extends$2({}, rest, {
14097
14168
  init: init,
@@ -14111,8 +14182,8 @@ Popover.defaultProps = Object.assign({}, filterProps(PopperWrapper.defaultProps,
14111
14182
  customStyle: {}
14112
14183
  });
14113
14184
 
14114
- var _excluded$d = ["type", "onClick"];
14115
- var keyCodes = {
14185
+ var _excluded$s = ["type", "onClick"];
14186
+ var keyCodes$1 = {
14116
14187
  BACKSPACE: 'Backspace',
14117
14188
  DELETE: 'Delete',
14118
14189
  ENTER: 'Enter'
@@ -14201,15 +14272,15 @@ var ChipInput = function ChipInput(props) {
14201
14272
  var chipsLength = chips.length;
14202
14273
 
14203
14274
  switch (event.key) {
14204
- case keyCodes.DELETE:
14205
- case keyCodes.BACKSPACE:
14275
+ case keyCodes$1.DELETE:
14276
+ case keyCodes$1.BACKSPACE:
14206
14277
  if (inputValue === '' && chipsLength > 0) {
14207
14278
  onChipDeleteHandler(chipsLength - 1);
14208
14279
  }
14209
14280
 
14210
14281
  break;
14211
14282
 
14212
- case keyCodes.ENTER:
14283
+ case keyCodes$1.ENTER:
14213
14284
  event.preventDefault();
14214
14285
  onChipAddHandler();
14215
14286
  break;
@@ -14230,7 +14301,7 @@ var ChipInput = function ChipInput(props) {
14230
14301
  var _chipOptions$type = chipOptions.type,
14231
14302
  type = _chipOptions$type === void 0 ? 'input' : _chipOptions$type,
14232
14303
  _onClick = chipOptions.onClick,
14233
- rest = _objectWithoutProperties(chipOptions, _excluded$d);
14304
+ rest = _objectWithoutProperties(chipOptions, _excluded$s);
14234
14305
 
14235
14306
  return /*#__PURE__*/React.createElement(Chip, _extends$2({
14236
14307
  "data-test": "DesignSystem-ChipInput--Chip",
@@ -14401,7 +14472,7 @@ var _MenuPills = function MenuPills(props) {
14401
14472
  }, count);
14402
14473
  };
14403
14474
 
14404
- var MenuItem = function MenuItem(props) {
14475
+ var MenuItem$1 = function MenuItem(props) {
14405
14476
  var _classNames2;
14406
14477
 
14407
14478
  var menu = props.menu,
@@ -14474,7 +14545,7 @@ var MenuItem = function MenuItem(props) {
14474
14545
  /*#__PURE__*/
14475
14546
  // TODO(a11y)
14476
14547
  // eslint-disable-next-line
14477
- React.createElement(GenericText, _extends$2({
14548
+ React.createElement(Link$1, _extends$2({
14478
14549
  componentType: "a",
14479
14550
  className: ItemClass
14480
14551
  }, baseProps), /*#__PURE__*/React.createElement("div", {
@@ -14489,7 +14560,7 @@ var MenuItem = function MenuItem(props) {
14489
14560
  labelColor: itemColor
14490
14561
  })), expanded && renderSubMenu());
14491
14562
  };
14492
- MenuItem.defaultProps = {
14563
+ MenuItem$1.defaultProps = {
14493
14564
  isActive: false
14494
14565
  };
14495
14566
 
@@ -14592,7 +14663,7 @@ var VerticalNav = function VerticalNav(props) {
14592
14663
  }, menu.group)), showTooltip ? /*#__PURE__*/React.createElement(Tooltip, {
14593
14664
  tooltip: menu.label,
14594
14665
  position: "right"
14595
- }, /*#__PURE__*/React.createElement(MenuItem, {
14666
+ }, /*#__PURE__*/React.createElement(MenuItem$1, {
14596
14667
  "data-test": "DesignSystem-VerticalNav--Item",
14597
14668
  menu: menu,
14598
14669
  expanded: expanded,
@@ -14603,7 +14674,7 @@ var VerticalNav = function VerticalNav(props) {
14603
14674
  isChildrenVisible: isChildrenVisible,
14604
14675
  onClick: onClickHandler,
14605
14676
  customItemRenderer: customItemRenderer
14606
- })) : /*#__PURE__*/React.createElement(MenuItem, {
14677
+ })) : /*#__PURE__*/React.createElement(MenuItem$1, {
14607
14678
  "data-test": "DesignSystem-VerticalNav--Item",
14608
14679
  menu: menu,
14609
14680
  expanded: expanded,
@@ -14618,7 +14689,7 @@ var VerticalNav = function VerticalNav(props) {
14618
14689
  return showTooltip ? /*#__PURE__*/React.createElement(Tooltip, {
14619
14690
  tooltip: subMenu.label,
14620
14691
  position: "right"
14621
- }, /*#__PURE__*/React.createElement(MenuItem, {
14692
+ }, /*#__PURE__*/React.createElement(MenuItem$1, {
14622
14693
  key: id,
14623
14694
  menu: subMenu,
14624
14695
  expanded: expanded,
@@ -14628,7 +14699,7 @@ var VerticalNav = function VerticalNav(props) {
14628
14699
  onClick: onClickHandler,
14629
14700
  isActive: isMenuActive(menus, subMenu, active),
14630
14701
  customItemRenderer: customItemRenderer
14631
- })) : /*#__PURE__*/React.createElement(MenuItem, {
14702
+ })) : /*#__PURE__*/React.createElement(MenuItem$1, {
14632
14703
  key: id,
14633
14704
  menu: subMenu,
14634
14705
  expanded: expanded,
@@ -14743,7 +14814,7 @@ var HorizontalNav = function HorizontalNav(props) {
14743
14814
  }), list);
14744
14815
  };
14745
14816
 
14746
- var _excluded$c = ["children", "tooltip", "showTooltip"];
14817
+ var _excluded$r = ["children", "tooltip", "showTooltip", "showOnTruncation", "elementRef"];
14747
14818
  var tooltipPropsList = ['trigger', 'on', 'open', 'offset', 'onToggle', 'dark', 'customStyle', 'closeOnBackdropClick', 'hideOnReferenceEscape', 'closeOnScroll'];
14748
14819
  var positionValue = {
14749
14820
  bottom: 'bottom',
@@ -14755,11 +14826,33 @@ var positionValue = {
14755
14826
  left: 'left',
14756
14827
  right: 'right'
14757
14828
  };
14829
+ var detectTruncation = function detectTruncation(boundaryRef) {
14830
+ var element = boundaryRef === null || boundaryRef === void 0 ? void 0 : boundaryRef.current;
14831
+ var isTruncated = element ? element.scrollWidth > element.clientWidth : false;
14832
+ return isTruncated;
14833
+ };
14758
14834
  var Tooltip = function Tooltip(props) {
14759
14835
  var children = props.children,
14760
14836
  tooltip = props.tooltip,
14761
14837
  showTooltip = props.showTooltip,
14762
- rest = _objectWithoutProperties(props, _excluded$c);
14838
+ showOnTruncation = props.showOnTruncation,
14839
+ elementRef = props.elementRef,
14840
+ rest = _objectWithoutProperties(props, _excluded$r);
14841
+
14842
+ var childrenRef = React.useRef(null);
14843
+
14844
+ var _React$useState = React.useState(false),
14845
+ _React$useState2 = _slicedToArray(_React$useState, 2),
14846
+ isTruncated = _React$useState2[0],
14847
+ setIsTruncated = _React$useState2[1];
14848
+
14849
+ React.useEffect(function () {
14850
+ var element = elementRef ? elementRef : childrenRef;
14851
+ setIsTruncated(detectTruncation(element));
14852
+ }, [childrenRef, elementRef]);
14853
+ var renderChildern = elementRef || ! /*#__PURE__*/React.isValidElement(children) ? children : /*#__PURE__*/React.cloneElement(children, {
14854
+ ref: childrenRef
14855
+ });
14763
14856
 
14764
14857
  if (!showTooltip) {
14765
14858
  // If showTooltip is false skip the Popover and return the children directly
@@ -14772,6 +14865,21 @@ var Tooltip = function Tooltip(props) {
14772
14865
  className: "Tooltip-text",
14773
14866
  appearance: "white"
14774
14867
  }, tooltip));
14868
+
14869
+ if (showOnTruncation) {
14870
+ return isTruncated ? /*#__PURE__*/React.createElement(Popover, _extends$2({
14871
+ trigger: renderChildern,
14872
+ on: 'hover',
14873
+ offset: 'medium'
14874
+ }, rest, {
14875
+ animationClass: {
14876
+ open: "Tooltip-animation-open-".concat(positionValue[props.position]),
14877
+ close: "Tooltip-animation-close-".concat(positionValue[props.position])
14878
+ },
14879
+ className: "Tooltip-container"
14880
+ }), tooltipWrapper) : renderChildern;
14881
+ }
14882
+
14775
14883
  return /*#__PURE__*/React.createElement(Popover, _extends$2({
14776
14884
  trigger: children,
14777
14885
  on: 'hover',
@@ -14783,14 +14891,18 @@ var Tooltip = function Tooltip(props) {
14783
14891
  },
14784
14892
  className: "Tooltip-container"
14785
14893
  }), tooltipWrapper);
14786
- }; // Tooltip.defaultProps = filterProps({
14787
- // ...Popover.defaultProps,
14788
- // hoverable: false
14789
- // }, propsList);
14894
+ };
14895
+
14896
+ Tooltip.useAutoTooltip = function () {
14897
+ return {
14898
+ detectTruncation: detectTruncation
14899
+ };
14900
+ };
14790
14901
 
14791
14902
  Tooltip.defaultProps = Object.assign({}, filterProps(Popover.defaultProps, tooltipPropsList), {
14792
14903
  hoverable: false,
14793
- showTooltip: true
14904
+ showTooltip: true,
14905
+ showOnTruncation: false
14794
14906
  });
14795
14907
 
14796
14908
  var Dialog = function Dialog(props) {
@@ -14841,7 +14953,7 @@ Dialog.defaultProps = {
14841
14953
  secondaryButtonAppearance: 'basic'
14842
14954
  };
14843
14955
 
14844
- var _excluded$b = ["label"];
14956
+ var _excluded$q = ["label"];
14845
14957
  var OverlayFooter = function OverlayFooter(props) {
14846
14958
  var open = props.open,
14847
14959
  className = props.className,
@@ -14878,7 +14990,7 @@ var OverlayFooter = function OverlayFooter(props) {
14878
14990
  className: classes
14879
14991
  }), actions.map(function (_ref, index) {
14880
14992
  _ref.label;
14881
- var options = _objectWithoutProperties(_ref, _excluded$b);
14993
+ var options = _objectWithoutProperties(_ref, _excluded$q);
14882
14994
 
14883
14995
  return /*#__PURE__*/React.createElement(Button, _extends$2({
14884
14996
  type: "button"
@@ -16239,7 +16351,7 @@ Pagination.defaultProps = {
16239
16351
  pageJumpDebounceDuration: 750
16240
16352
  };
16241
16353
 
16242
- var _excluded$a = ["onChange"];
16354
+ var _excluded$p = ["onChange"];
16243
16355
  var EditableInput = function EditableInput(props) {
16244
16356
  var _classNames2, _classNames4;
16245
16357
 
@@ -16253,7 +16365,7 @@ var EditableInput = function EditableInput(props) {
16253
16365
  className = props.className;
16254
16366
 
16255
16367
  var onInputChange = inputOptions.onChange,
16256
- rest = _objectWithoutProperties(inputOptions, _excluded$a);
16368
+ rest = _objectWithoutProperties(inputOptions, _excluded$p);
16257
16369
 
16258
16370
  var _React$useState = React.useState(props.value),
16259
16371
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -16416,8 +16528,8 @@ EditableInput.defaultProps = {
16416
16528
  inputOptions: {}
16417
16529
  };
16418
16530
 
16419
- var _excluded$9 = ["onChange", "chipOptions"],
16420
- _excluded2$1 = ["onClick"];
16531
+ var _excluded$o = ["onChange", "chipOptions"],
16532
+ _excluded2$2 = ["onClick"];
16421
16533
  var EditableChipInput = function EditableChipInput(props) {
16422
16534
  var _classNames3;
16423
16535
 
@@ -16430,10 +16542,10 @@ var EditableChipInput = function EditableChipInput(props) {
16430
16542
  var onChipInputChange = chipInputOptions.onChange,
16431
16543
  _chipInputOptions$chi = chipInputOptions.chipOptions,
16432
16544
  chipOptions = _chipInputOptions$chi === void 0 ? {} : _chipInputOptions$chi,
16433
- rest = _objectWithoutProperties(chipInputOptions, _excluded$9);
16545
+ rest = _objectWithoutProperties(chipInputOptions, _excluded$o);
16434
16546
 
16435
16547
  var _onClick = chipOptions.onClick,
16436
- chipObject = _objectWithoutProperties(chipOptions, _excluded2$1);
16548
+ chipObject = _objectWithoutProperties(chipOptions, _excluded2$2);
16437
16549
 
16438
16550
  var _React$useState = React.useState(props.value),
16439
16551
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -17246,7 +17358,7 @@ var getCustomDates = function getCustomDates() {
17246
17358
  };
17247
17359
  };
17248
17360
 
17249
- var _excluded$8 = ["startDate", "endDate", "yearNav", "monthNav", "open", "inputFormat", "outputFormat", "startInputOptions", "endInputOptions", "validators", "withInput", "position", "disabledBefore", "disabledAfter", "onRangeChange", "rangeLimit"];
17361
+ var _excluded$n = ["startDate", "endDate", "yearNav", "monthNav", "open", "inputFormat", "outputFormat", "startInputOptions", "endInputOptions", "validators", "withInput", "position", "disabledBefore", "disabledAfter", "onRangeChange", "rangeLimit"];
17250
17362
  var DateRangePicker = /*#__PURE__*/function (_React$Component) {
17251
17363
  _inherits(DateRangePicker, _React$Component);
17252
17364
 
@@ -17287,7 +17399,7 @@ var DateRangePicker = /*#__PURE__*/function (_React$Component) {
17287
17399
  daMonth = _getDateInfo2.month,
17288
17400
  daDate = _getDateInfo2.date;
17289
17401
 
17290
- return !date ? true : compareDate(date, 'less', dbYear, dbMonth, dbDate) || compareDate(date, 'more', daYear, daMonth, daDate);
17402
+ return !date ? false : compareDate(date, 'less', dbYear, dbMonth, dbDate) || compareDate(date, 'more', daYear, daMonth, daDate);
17291
17403
  };
17292
17404
 
17293
17405
  var startError = isError(startDate);
@@ -17483,8 +17595,14 @@ var DateRangePicker = /*#__PURE__*/function (_React$Component) {
17483
17595
  var eValue = translateToString(outputFormat, _endDate3);
17484
17596
 
17485
17597
  if (!inRangeError && !startError && !endError) {
17486
- onRangeChange(_startDate3, _endDate3, sValue, eValue);
17487
- } else {
17598
+ if (this.props.allowReverseSelection) {
17599
+ if (_startDate3 && _endDate3) {
17600
+ onRangeChange(_startDate3, _endDate3, sValue, eValue);
17601
+ }
17602
+ } else {
17603
+ onRangeChange(_startDate3, _endDate3, sValue, eValue);
17604
+ }
17605
+ } else if (!this.props.allowReverseSelection) {
17488
17606
  if (!startError) onRangeChange(_startDate3, undefined, sValue, eValue);else if (!endError) onRangeChange(undefined, _endDate3, sValue, eValue);else onRangeChange(undefined, undefined, sValue, eValue);
17489
17607
  }
17490
17608
  }
@@ -17516,7 +17634,7 @@ var DateRangePicker = /*#__PURE__*/function (_React$Component) {
17516
17634
  disabledAfter = _this$props6.disabledAfter;
17517
17635
  _this$props6.onRangeChange;
17518
17636
  var rangeLimit = _this$props6.rangeLimit,
17519
- rest = _objectWithoutProperties(_this$props6, _excluded$8);
17637
+ rest = _objectWithoutProperties(_this$props6, _excluded$n);
17520
17638
 
17521
17639
  var _this$state3 = this.state,
17522
17640
  startDate = _this$state3.startDate,
@@ -18420,8 +18538,8 @@ function _fromFileEntry() {
18420
18538
  return _fromFileEntry.apply(this, arguments);
18421
18539
  }
18422
18540
 
18423
- var _excluded$7 = ["refKey", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnterCallback", "onDragOverCallback", "onDragLeaveCallback", "onDropCallback"],
18424
- _excluded2 = ["refKey", "onChange", "onClick"];
18541
+ var _excluded$m = ["refKey", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnterCallback", "onDragOverCallback", "onDragLeaveCallback", "onDropCallback"],
18542
+ _excluded2$1 = ["refKey", "onChange", "onClick"];
18425
18543
  var initialState = {
18426
18544
  isFocused: false,
18427
18545
  isFileDialogActive: false,
@@ -18698,7 +18816,7 @@ var DropzoneBase = function DropzoneBase(props) {
18698
18816
  onDragOverCallback = _ref.onDragOverCallback,
18699
18817
  onDragLeaveCallback = _ref.onDragLeaveCallback,
18700
18818
  onDropCallback = _ref.onDropCallback,
18701
- rest = _objectWithoutProperties(_ref, _excluded$7);
18819
+ rest = _objectWithoutProperties(_ref, _excluded$m);
18702
18820
 
18703
18821
  return _objectSpread2(_defineProperty$1({
18704
18822
  onDragEnter: composeDragHandler(composeEventHandlers(onDragEnterCallback, onDragEnterCb)),
@@ -18718,7 +18836,7 @@ var DropzoneBase = function DropzoneBase(props) {
18718
18836
  refKey = _ref2$refKey === void 0 ? 'ref' : _ref2$refKey,
18719
18837
  onChange = _ref2.onChange,
18720
18838
  onClick = _ref2.onClick,
18721
- rest = _objectWithoutProperties(_ref2, _excluded2);
18839
+ rest = _objectWithoutProperties(_ref2, _excluded2$1);
18722
18840
 
18723
18841
  var inputProps = _defineProperty$1({
18724
18842
  accept: accept,
@@ -20713,6 +20831,7 @@ var Header = function Header(props) {
20713
20831
  var loading = props.loading,
20714
20832
  error = props.error,
20715
20833
  data = props.data,
20834
+ displayData = props.displayData,
20716
20835
  schema = props.schema,
20717
20836
  withSearch = props.withSearch,
20718
20837
  showHead = props.showHead,
@@ -20732,6 +20851,7 @@ var Header = function Header(props) {
20732
20851
  selectAll = props.selectAll,
20733
20852
  searchTerm = props.searchTerm,
20734
20853
  updateSearchTerm = props.updateSearchTerm,
20854
+ globalActionRenderer = props.globalActionRenderer,
20735
20855
  dynamicColumn = props.dynamicColumn,
20736
20856
  allowSelectAll = props.allowSelectAll,
20737
20857
  showFilters = props.showFilters,
@@ -20812,6 +20932,8 @@ var Header = function Header(props) {
20812
20932
  className: "Header"
20813
20933
  }, /*#__PURE__*/React.createElement("div", {
20814
20934
  className: "Header-content Header-content--top"
20935
+ }, /*#__PURE__*/React.createElement("div", {
20936
+ className: "d-flex"
20815
20937
  }, withSearch && /*#__PURE__*/React.createElement("div", {
20816
20938
  className: "Header-search"
20817
20939
  }, /*#__PURE__*/React.createElement(Input, {
@@ -20854,7 +20976,9 @@ var Header = function Header(props) {
20854
20976
  });
20855
20977
  }))), children && /*#__PURE__*/React.createElement("div", {
20856
20978
  className: "Header-actions"
20857
- }, children)), /*#__PURE__*/React.createElement("div", {
20979
+ }, children)), globalActionRenderer && /*#__PURE__*/React.createElement("div", {
20980
+ className: "Header-global-actions"
20981
+ }, globalActionRenderer(displayData))), /*#__PURE__*/React.createElement("div", {
20858
20982
  className: "Header-content Header-content--bottom"
20859
20983
  }, /*#__PURE__*/React.createElement("div", {
20860
20984
  className: "Header-label"
@@ -20896,7 +21020,7 @@ Header.defaultProps = {
20896
21020
  showFilters: true
20897
21021
  };
20898
21022
 
20899
- var _excluded$6 = ["children"];
21023
+ var _excluded$l = ["children"];
20900
21024
 
20901
21025
  var defaultErrorTemplate = function defaultErrorTemplate(props) {
20902
21026
  var _props$errorType = props.errorType,
@@ -20922,6 +21046,7 @@ var defaultProps = {
20922
21046
  pageSize: 15,
20923
21047
  draggable: true,
20924
21048
  data: [],
21049
+ displayData: [],
20925
21050
  schema: [],
20926
21051
  loading: false,
20927
21052
  error: false,
@@ -21026,6 +21151,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21026
21151
 
21027
21152
  _this.setState({
21028
21153
  data: _data2,
21154
+ displayData: _data2,
21029
21155
  schema: schema,
21030
21156
  selectAll: getSelectAll(_data2, _this.props.selectDisabledRow),
21031
21157
  totalRecords: res.count,
@@ -21062,6 +21188,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21062
21188
  errorType: 'NO_RECORDS_FOUND',
21063
21189
  selectAll: getSelectAll(renderedData, _this.props.selectDisabledRow),
21064
21190
  schema: renderedSchema,
21191
+ displayData: sortedData,
21065
21192
  data: renderedData
21066
21193
  });
21067
21194
  }
@@ -21165,6 +21292,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21165
21292
  _this.state = {
21166
21293
  async: _async,
21167
21294
  data: !_async ? _data : [],
21295
+ displayData: !_async ? _data : [],
21168
21296
  schema: !_async ? _schema : [],
21169
21297
  page: props.page,
21170
21298
  sortingList: props.sortingList,
@@ -21200,6 +21328,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21200
21328
 
21201
21329
  this.setState({
21202
21330
  data: _data3,
21331
+ displayData: _data3,
21203
21332
  schema: schema,
21204
21333
  error: this.props.error || false,
21205
21334
  errorType: this.props.errorType,
@@ -21218,6 +21347,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21218
21347
 
21219
21348
  this.setState({
21220
21349
  data: _data4,
21350
+ displayData: _data4,
21221
21351
  schema: _schema2,
21222
21352
  loading: this.props.loading || false,
21223
21353
  error: this.props.error || false,
@@ -21281,7 +21411,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21281
21411
 
21282
21412
  var _ref = headerOptions,
21283
21413
  headerChildren = _ref.children,
21284
- headerAttr = _objectWithoutProperties(_ref, _excluded$6);
21414
+ headerAttr = _objectWithoutProperties(_ref, _excluded$l);
21285
21415
 
21286
21416
  var classes = className ? " ".concat(className) : '';
21287
21417
  var totalRecords = this.state.totalRecords;
@@ -21845,7 +21975,7 @@ FileList.defaultProps = {
21845
21975
  };
21846
21976
  FileList.displayName = 'FileList';
21847
21977
 
21848
- var _excluded$5 = ["type", "fields", "placeholder", "autoFocus", "onComplete", "onFocus", "onBlur", "className", "value"];
21978
+ var _excluded$k = ["type", "fields", "placeholder", "autoFocus", "onComplete", "onFocus", "onBlur", "className", "value"];
21849
21979
  var KEY_CODE = {
21850
21980
  backspace: 'Backspace',
21851
21981
  left: 'ArrowLeft',
@@ -21870,7 +22000,7 @@ var VerificationCodeInput = function VerificationCodeInput(props) {
21870
22000
  onBlur = props.onBlur,
21871
22001
  className = props.className;
21872
22002
  props.value;
21873
- var rest = _objectWithoutProperties(props, _excluded$5);
22003
+ var rest = _objectWithoutProperties(props, _excluded$k);
21874
22004
 
21875
22005
  var initialValues = useMemo(function () {
21876
22006
  if (props.value && props.value.length) {
@@ -22281,7 +22411,7 @@ var HelpText = function HelpText(props) {
22281
22411
  };
22282
22412
  HelpText.displayName = 'HelpText';
22283
22413
 
22284
- var _excluded$4 = ["children", "type", "className", "disabled", "tabIndex", "icon", "subtle", "size", "iconAlign", "iconType"];
22414
+ var _excluded$j = ["children", "type", "className", "disabled", "tabIndex", "icon", "subtle", "size", "iconAlign", "iconType"];
22285
22415
  var sizeMapping = {
22286
22416
  tiny: 12,
22287
22417
  regular: 16
@@ -22299,7 +22429,7 @@ var LinkButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
22299
22429
  size = props.size,
22300
22430
  iconAlign = props.iconAlign,
22301
22431
  iconType = props.iconType,
22302
- rest = _objectWithoutProperties(props, _excluded$4);
22432
+ rest = _objectWithoutProperties(props, _excluded$j);
22303
22433
 
22304
22434
  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
22435
  var iconClass = classnames((_classNames2 = {}, _defineProperty$1(_classNames2, 'LinkButton-icon', true), _defineProperty$1(_classNames2, "LinkButton-icon--".concat(iconAlign), children && iconAlign), _classNames2));
@@ -22326,7 +22456,7 @@ LinkButton.defaultProps = {
22326
22456
  iconAlign: 'left'
22327
22457
  };
22328
22458
 
22329
- var _excluded$3 = ["children", "disabled", "className", "zIndex", "onClick"];
22459
+ var _excluded$i = ["children", "disabled", "className", "zIndex", "onClick"];
22330
22460
  var ActionCard = function ActionCard(props) {
22331
22461
  var _classNames;
22332
22462
 
@@ -22335,7 +22465,7 @@ var ActionCard = function ActionCard(props) {
22335
22465
  className = props.className,
22336
22466
  zIndex = props.zIndex,
22337
22467
  onClick = props.onClick,
22338
- rest = _objectWithoutProperties(props, _excluded$3);
22468
+ rest = _objectWithoutProperties(props, _excluded$i);
22339
22469
 
22340
22470
  var classes = classnames((_classNames = {}, _defineProperty$1(_classNames, 'ActionCard', true), _defineProperty$1(_classNames, 'ActionCard--disabled', disabled), _classNames), className);
22341
22471
 
@@ -22437,7 +22567,7 @@ function useSingleSelect() {
22437
22567
  };
22438
22568
  }
22439
22569
 
22440
- var _excluded$2 = ["children", "onClick", "disabled", "id", "cardValue", "overlayZIndex", "selected", "className"];
22570
+ var _excluded$h = ["children", "onClick", "disabled", "id", "cardValue", "overlayZIndex", "selected", "className"];
22441
22571
  var SelectionCard = function SelectionCard(props) {
22442
22572
  var _classNames;
22443
22573
 
@@ -22449,7 +22579,7 @@ var SelectionCard = function SelectionCard(props) {
22449
22579
  overlayZIndex = props.overlayZIndex,
22450
22580
  selected = props.selected,
22451
22581
  className = props.className,
22452
- rest = _objectWithoutProperties(props, _excluded$2);
22582
+ rest = _objectWithoutProperties(props, _excluded$h);
22453
22583
 
22454
22584
  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
22585
 
@@ -23257,7 +23387,8 @@ var ListBody = function ListBody(props) {
23257
23387
  className = props.className,
23258
23388
  disabled = props.disabled,
23259
23389
  selected = props.selected,
23260
- activated = props.activated;
23390
+ activated = props.activated,
23391
+ tabIndex = props.tabIndex;
23261
23392
  var contextProp = React.useContext(ListboxContext);
23262
23393
  var size = contextProp.size,
23263
23394
  type = contextProp.type,
@@ -23268,7 +23399,7 @@ var ListBody = function ListBody(props) {
23268
23399
  return /*#__PURE__*/React.createElement("div", {
23269
23400
  "data-disabled": disabled,
23270
23401
  "data-test": "DesignSystem-Listbox-ItemWrapper",
23271
- tabIndex: draggable ? -1 : 0,
23402
+ tabIndex: draggable ? -1 : tabIndex || 0,
23272
23403
  className: itemClass,
23273
23404
  onKeyDown: onKeyDown,
23274
23405
  role: "tablist"
@@ -23280,6 +23411,7 @@ var ListBody = function ListBody(props) {
23280
23411
  "data-test": "DesignSystem-Listbox-DragIcon"
23281
23412
  }), children);
23282
23413
  };
23414
+ ListBody.displayName = 'ListBody';
23283
23415
 
23284
23416
  var getAnimationClass = function getAnimationClass(uniqueKey, expanded) {
23285
23417
  if (expanded) return "nestedList-open-".concat(uniqueKey, " 240ms cubic-bezier(0, 0, 0.38, 0.9)");else if (!expanded) return "nestedList-close-".concat(uniqueKey, " 160ms cubic-bezier(0.2, 0, 1, 0.9)");
@@ -23360,15 +23492,16 @@ var NestedList = function NestedList(props) {
23360
23492
  }, nestedBody));
23361
23493
  };
23362
23494
 
23363
- var _excluded$1 = ["nestedBody", "expanded", "id", "onClick", "value", "tagName"];
23495
+ var _excluded$g = ["nestedBody", "expanded", "id", "onClick", "value", "tagName"];
23364
23496
  var ListboxItem = function ListboxItem(props) {
23365
23497
  var nestedBody = props.nestedBody,
23366
23498
  expanded = props.expanded,
23367
23499
  id = props.id,
23368
23500
  onClick = props.onClick,
23369
23501
  value = props.value,
23370
- Tag = props.tagName,
23371
- rest = _objectWithoutProperties(props, _excluded$1);
23502
+ _props$tagName = props.tagName,
23503
+ Tag = _props$tagName === void 0 ? 'li' : _props$tagName,
23504
+ rest = _objectWithoutProperties(props, _excluded$g);
23372
23505
 
23373
23506
  var contextProp = React.useContext(ListboxContext);
23374
23507
  var showDivider = contextProp.showDivider,
@@ -23381,9 +23514,8 @@ var ListboxItem = function ListboxItem(props) {
23381
23514
  var tagClass = classnames(_defineProperty$1({}, 'Listbox-item-wrapper', !draggable));
23382
23515
  return /*#__PURE__*/React.createElement(Tag, _extends$2({
23383
23516
  id: id,
23384
- key: id
23517
+ "data-test": "DesignSystem-Listbox-Item"
23385
23518
  }, rest, {
23386
- "data-test": "DesignSystem-Listbox-Item",
23387
23519
  onClick: onClickHandler,
23388
23520
  "data-value": value,
23389
23521
  className: tagClass
@@ -23394,12 +23526,12 @@ var ListboxItem = function ListboxItem(props) {
23394
23526
  className: "Listbox-divider"
23395
23527
  }));
23396
23528
  };
23397
- ListboxItem.displayName = 'ListboxItem';
23529
+ ListboxItem.displayName = 'Listbox.Item';
23398
23530
  ListboxItem.defaultProps = {
23399
23531
  tagName: 'li'
23400
23532
  };
23401
23533
 
23402
- var _excluded = ["children", "className", "draggable", "size", "type", "showDivider", "tagName"];
23534
+ var _excluded$f = ["children", "className", "draggable", "size", "type", "showDivider", "tagName"];
23403
23535
  var ListboxContext = /*#__PURE__*/React.createContext({
23404
23536
  size: 'standard',
23405
23537
  type: 'resource',
@@ -23415,7 +23547,7 @@ var Listbox = function Listbox(props) {
23415
23547
  type = props.type,
23416
23548
  showDivider = props.showDivider,
23417
23549
  Tag = props.tagName,
23418
- rest = _objectWithoutProperties(props, _excluded);
23550
+ rest = _objectWithoutProperties(props, _excluded$f);
23419
23551
 
23420
23552
  var baseProps = extractBaseProps(props);
23421
23553
  var classes = classnames({
@@ -23609,6 +23741,2501 @@ var TextField = function TextField(props) {
23609
23741
  };
23610
23742
  TextField.displayName = 'TextField';
23611
23743
 
23612
- var version = "2.28.3";
23744
+ var _excluded$e = ["icon", "image"];
23745
+ var SelectionAvatar = function SelectionAvatar(props) {
23746
+ var icon = props.icon,
23747
+ image = props.image,
23748
+ rest = _objectWithoutProperties(props, _excluded$e);
23749
+
23750
+ return /*#__PURE__*/React.createElement(Avatar, _extends$2({
23751
+ role: "checkbox"
23752
+ }, rest, {
23753
+ withTooltip: true,
23754
+ className: "cursor-pointer"
23755
+ }), image || icon);
23756
+ };
23757
+
23758
+ var AvatarSelectionContext = /*#__PURE__*/React.createContext({});
23759
+
23760
+ var SelectionAvatarsWrapper = function SelectionAvatarsWrapper(props) {
23761
+ var avatarList = props.avatarList,
23762
+ avatarStyle = props.avatarStyle,
23763
+ tooltipPosition = props.tooltipPosition,
23764
+ size = props.size,
23765
+ avatarRenderer = props.avatarRenderer;
23766
+ var contextProp = React.useContext(AvatarSelectionContext);
23767
+ var setSelectedItems = contextProp.setSelectedItems,
23768
+ selectedItems = contextProp.selectedItems,
23769
+ onSelect = contextProp.onSelect;
23770
+
23771
+ var onClickHandler = function onClickHandler(item) {
23772
+ var list = selectedItems;
23773
+
23774
+ if (selectedItems !== null && selectedItems !== void 0 && selectedItems.includes(item)) {
23775
+ list = selectedItems.filter(function (selectedItem) {
23776
+ return selectedItem !== item;
23777
+ });
23778
+ } else {
23779
+ var _list;
23780
+
23781
+ (_list = list) === null || _list === void 0 ? void 0 : _list.push(item);
23782
+ }
23783
+
23784
+ list && (setSelectedItems === null || setSelectedItems === void 0 ? void 0 : setSelectedItems(_toConsumableArray(list)));
23785
+ onSelect && onSelect(list);
23786
+ };
23787
+
23788
+ var handleKeyDown = function handleKeyDown(event, item) {
23789
+ switch (event.key) {
23790
+ case 'Enter':
23791
+ onClickHandler(item);
23792
+ break;
23793
+ }
23794
+ };
23795
+
23796
+ return /*#__PURE__*/React.createElement(React.Fragment, null, avatarList.map(function (avatarItem, index) {
23797
+ var _classNames;
23798
+
23799
+ var appearance = avatarItem.appearance,
23800
+ firstName = avatarItem.firstName,
23801
+ lastName = avatarItem.lastName,
23802
+ icon = avatarItem.icon,
23803
+ image = avatarItem.image;
23804
+ 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));
23805
+
23806
+ if (avatarRenderer) {
23807
+ return avatarRenderer(avatarItem);
23808
+ }
23809
+
23810
+ return /*#__PURE__*/React.createElement("span", {
23811
+ key: index,
23812
+ className: "SelectionAvatarGroup-wrapper"
23813
+ }, /*#__PURE__*/React.createElement("div", {
23814
+ tabIndex: 0,
23815
+ role: "checkbox",
23816
+ style: avatarStyle,
23817
+ className: GroupClass,
23818
+ "data-test": "DesignSystem-AvatarSelection--Avatar",
23819
+ "aria-checked": selectedItems && selectedItems.includes(avatarItem),
23820
+ onClick: function onClick() {
23821
+ return onClickHandler(avatarItem);
23822
+ },
23823
+ onKeyDown: function onKeyDown(event) {
23824
+ return handleKeyDown(event, avatarItem);
23825
+ }
23826
+ }, /*#__PURE__*/React.createElement(SelectionAvatar, {
23827
+ size: size,
23828
+ appearance: appearance,
23829
+ firstName: firstName,
23830
+ lastName: lastName,
23831
+ withTooltip: true,
23832
+ tooltipPosition: tooltipPosition,
23833
+ icon: icon,
23834
+ image: image
23835
+ })));
23836
+ }));
23837
+ };
23838
+
23839
+ var handleKeyDown$6 = function handleKeyDown(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem) {
23840
+ switch (event.key) {
23841
+ case 'Enter':
23842
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
23843
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(true);
23844
+ break;
23845
+
23846
+ case 'ArrowDown':
23847
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
23848
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(true);
23849
+ break;
23850
+
23851
+ case 'ArrowUp':
23852
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
23853
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(true);
23854
+ break;
23855
+ }
23856
+ };
23857
+ var focusListItem$3 = function focusListItem(position, setFocusedOption, listRef, withSearch) {
23858
+ var _listRef$current2, _targetOption, _targetOption2, _targetOption2$scroll;
23859
+
23860
+ if (withSearch && position === 'down') {
23861
+ var _listRef$current, _searchInput$;
23862
+
23863
+ var searchInput = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.querySelectorAll('[data-test="DesignSystem-AvatarSelection--Input"]');
23864
+ searchInput && ((_searchInput$ = searchInput[0]) === null || _searchInput$ === void 0 ? void 0 : _searchInput$.focus());
23865
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(searchInput);
23866
+ return;
23867
+ }
23868
+
23869
+ var listItems = (_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
23870
+ var targetOption;
23871
+
23872
+ if (position === 'down') {
23873
+ targetOption = listItems === null || listItems === void 0 ? void 0 : listItems[0];
23874
+ } else {
23875
+ targetOption = listItems === null || listItems === void 0 ? void 0 : listItems[listItems.length - 1];
23876
+ }
23877
+
23878
+ (_targetOption = targetOption) === null || _targetOption === void 0 ? void 0 : _targetOption.focus();
23879
+ (_targetOption2 = targetOption) === null || _targetOption2 === void 0 ? void 0 : (_targetOption2$scroll = _targetOption2.scrollIntoView) === null || _targetOption2$scroll === void 0 ? void 0 : _targetOption2$scroll.call(_targetOption2, {
23880
+ block: 'center'
23881
+ });
23882
+ setFocusedOption && setFocusedOption(targetOption);
23883
+ };
23884
+
23885
+ var AvatarSelectionCount = function AvatarSelectionCount(props) {
23886
+ var _classNames;
23887
+
23888
+ var hiddenAvatarCount = props.hiddenAvatarCount,
23889
+ avatarStyle = props.avatarStyle,
23890
+ size = props.size,
23891
+ hiddenAvatarList = props.hiddenAvatarList;
23892
+ var contextProp = React.useContext(AvatarSelectionContext);
23893
+ var selectedItems = contextProp.selectedItems,
23894
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
23895
+ setHighlightLastItem = contextProp.setHighlightLastItem,
23896
+ triggerRef = contextProp.triggerRef,
23897
+ setOpenPopover = contextProp.setOpenPopover,
23898
+ openPopover = contextProp.openPopover,
23899
+ popoverId = contextProp.popoverId;
23900
+
23901
+ var _React$useState = React.useState(0),
23902
+ _React$useState2 = _slicedToArray(_React$useState, 2),
23903
+ selectedItemCount = _React$useState2[0],
23904
+ setSelectedItemCount = _React$useState2[1];
23905
+
23906
+ var wrapperClassName = classnames((_classNames = {}, _defineProperty$1(_classNames, 'SelectionAvatarCount-wrapper', true), _defineProperty$1(_classNames, 'SelectionAvatarCount--selected', selectedItemCount > 0), _classNames));
23907
+ React.useEffect(function () {
23908
+ var selectedList = hiddenAvatarList.filter(function (data1) {
23909
+ return selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.some(function (data2) {
23910
+ return data2 === data1;
23911
+ });
23912
+ });
23913
+ setSelectedItemCount(selectedList.length);
23914
+ }, [selectedItems]);
23915
+ return /*#__PURE__*/React.createElement("div", {
23916
+ "data-test": "DesignSystem-AvatarSelection--TriggerAvatar",
23917
+ className: wrapperClassName,
23918
+ onKeyDown: function onKeyDown(event) {
23919
+ return handleKeyDown$6(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem);
23920
+ },
23921
+ style: avatarStyle,
23922
+ tabIndex: 0,
23923
+ role: "button",
23924
+ "aria-haspopup": "listbox",
23925
+ "aria-expanded": openPopover,
23926
+ "aria-controls": popoverId,
23927
+ ref: triggerRef
23928
+ }, /*#__PURE__*/React.createElement(Avatar, {
23929
+ size: size,
23930
+ appearance: "secondary",
23931
+ className: "SelectionAvatarCount cursor-pointer"
23932
+ }, /*#__PURE__*/React.createElement(Text, {
23933
+ className: "overflow-hidden"
23934
+ }, "+".concat(hiddenAvatarCount))));
23935
+ };
23936
+
23937
+ var handleKeyDown$5 = function handleKeyDown(event, focusedOption, setFocusedOption, setHighlightFirstItem, setHighlightLastItem, listRef, withSearch, setOpenPopover, triggerRef) {
23938
+ switch (event.key) {
23939
+ case 'ArrowUp':
23940
+ event.preventDefault();
23941
+ navigateOptions$3('up', focusedOption, setFocusedOption, listRef, withSearch);
23942
+ break;
23943
+
23944
+ case 'ArrowDown':
23945
+ event.preventDefault();
23946
+ navigateOptions$3('down', focusedOption, setFocusedOption, listRef, withSearch);
23947
+ break;
23948
+
23949
+ case 'Enter':
23950
+ handleEnterKey$2(focusedOption);
23951
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(false);
23952
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(false);
23953
+ break;
23954
+
23955
+ case 'Escape':
23956
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
23957
+ triggerRef.current.focus();
23958
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(undefined);
23959
+ break;
23960
+ }
23961
+ };
23962
+
23963
+ var handleEnterKey$2 = function handleEnterKey(focusedOption) {
23964
+ focusedOption === null || focusedOption === void 0 ? void 0 : focusedOption.click();
23965
+ };
23966
+
23967
+ var navigateOptions$3 = function navigateOptions(direction, focusedOption, setFocusedOption, listRef, withSearch) {
23968
+ var listItems = listRef === null || listRef === void 0 ? void 0 : listRef.current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
23969
+ var index = Array.from(listItems).findIndex(function (item) {
23970
+ return item == focusedOption;
23971
+ });
23972
+
23973
+ if (index === -1) {
23974
+ index = direction === 'up' ? listItems.length - 1 : 0;
23975
+ } else if (withSearch && index === 0 && direction === 'up' || withSearch && index === listItems.length - 1 && direction === 'down') {
23976
+ var searchInput = listRef.current.querySelector('[data-test="DesignSystem-AvatarSelection--Input"]');
23977
+ searchInput.focus();
23978
+ setFocusedOption && setFocusedOption(searchInput);
23979
+ } else {
23980
+ index = direction === 'up' ? (index - 1 + listItems.length) % listItems.length : (index + 1) % listItems.length;
23981
+ var targetOption = listItems[index];
23982
+ targetOption.focus();
23983
+ setFocusedOption && setFocusedOption(targetOption);
23984
+ targetOption.scrollIntoView({
23985
+ block: 'center'
23986
+ });
23987
+ }
23988
+ };
23989
+
23990
+ var handleInputKeyDown$1 = function handleInputKeyDown(event, listRef, setFocusedOption, setOpenPopover, triggerRef) {
23991
+ var _listRef$current, _targetOption, _targetOption2, _targetOption2$scroll;
23992
+
23993
+ var listItems = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
23994
+ var targetOption;
23995
+
23996
+ switch (event.key) {
23997
+ case 'ArrowUp':
23998
+ event.preventDefault();
23999
+ targetOption = listItems[listItems.length - 1];
24000
+ break;
24001
+
24002
+ case 'ArrowDown':
24003
+ event.preventDefault();
24004
+ targetOption = listItems[0];
24005
+ break;
24006
+
24007
+ case 'Escape':
24008
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
24009
+ triggerRef.current.focus();
24010
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(undefined);
24011
+ break;
24012
+ }
24013
+
24014
+ (_targetOption = targetOption) === null || _targetOption === void 0 ? void 0 : _targetOption.focus();
24015
+ (_targetOption2 = targetOption) === null || _targetOption2 === void 0 ? void 0 : (_targetOption2$scroll = _targetOption2.scrollIntoView) === null || _targetOption2$scroll === void 0 ? void 0 : _targetOption2$scroll.call(_targetOption2, {
24016
+ block: 'center'
24017
+ });
24018
+ setFocusedOption && setFocusedOption(targetOption);
24019
+ };
24020
+
24021
+ var AvatarSelectionInput = function AvatarSelectionInput(props) {
24022
+ var contextProp = React.useContext(AvatarSelectionContext);
24023
+ var listRef = contextProp.listRef,
24024
+ setFocusedOption = contextProp.setFocusedOption,
24025
+ setOpenPopover = contextProp.setOpenPopover,
24026
+ triggerRef = contextProp.triggerRef;
24027
+ return /*#__PURE__*/React.createElement("div", {
24028
+ className: "SelectionAvatar-inputWrapper"
24029
+ }, /*#__PURE__*/React.createElement(Input, _extends$2({
24030
+ icon: "search",
24031
+ onKeyDown: function onKeyDown(event) {
24032
+ return handleInputKeyDown$1(event, listRef, setFocusedOption, setOpenPopover, triggerRef);
24033
+ },
24034
+ className: "w-100 SelectionAvatar-input",
24035
+ "data-test": "DesignSystem-AvatarSelection--Input"
24036
+ }, props)));
24037
+ };
24038
+
24039
+ var AvatarSelectionList = function AvatarSelectionList(props) {
24040
+ return /*#__PURE__*/React.createElement(Listbox, props, props.children);
24041
+ };
24042
+ AvatarSelectionList.defaultProps = {
24043
+ type: 'option',
24044
+ showDivider: false,
24045
+ size: 'compressed',
24046
+ tagName: 'ul'
24047
+ };
24048
+
24049
+ var _excluded$d = ["children", "value"];
24050
+ var AvatarSelectionOption = function AvatarSelectionOption(props) {
24051
+ var children = props.children,
24052
+ value = props.value,
24053
+ rest = _objectWithoutProperties(props, _excluded$d);
24054
+
24055
+ var contextProp = React.useContext(AvatarSelectionContext);
24056
+ var setSelectedItems = contextProp.setSelectedItems,
24057
+ selectedItems = contextProp.selectedItems,
24058
+ onSelect = contextProp.onSelect,
24059
+ focusedOption = contextProp.focusedOption,
24060
+ setFocusedOption = contextProp.setFocusedOption,
24061
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
24062
+ setHighlightLastItem = contextProp.setHighlightLastItem,
24063
+ listRef = contextProp.listRef,
24064
+ withSearch = contextProp.withSearch,
24065
+ setOpenPopover = contextProp.setOpenPopover,
24066
+ triggerRef = contextProp.triggerRef;
24067
+
24068
+ var onSelectHandler = function onSelectHandler(event, avatarData) {
24069
+ event.preventDefault();
24070
+ var list = selectedItems ? _toConsumableArray(selectedItems) : [];
24071
+
24072
+ if (selectedItems !== null && selectedItems !== void 0 && selectedItems.includes(avatarData)) {
24073
+ list = selectedItems.filter(function (selectedItem) {
24074
+ return selectedItem !== avatarData;
24075
+ });
24076
+ } else {
24077
+ list.push(avatarData);
24078
+ }
24079
+
24080
+ setSelectedItems === null || setSelectedItems === void 0 ? void 0 : setSelectedItems(_toConsumableArray(list));
24081
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24082
+ onSelect && onSelect(list);
24083
+ };
24084
+
24085
+ var onKeyDownHandler = function onKeyDownHandler(event) {
24086
+ handleKeyDown$5(event, focusedOption, setFocusedOption, setHighlightFirstItem, setHighlightLastItem, listRef, withSearch, setOpenPopover, triggerRef);
24087
+ };
24088
+
24089
+ return /*#__PURE__*/React.createElement(Listbox.Item, _extends$2({
24090
+ onClick: function onClick(event) {
24091
+ return onSelectHandler(event, value);
24092
+ },
24093
+ onKeyDown: function onKeyDown(event) {
24094
+ return onKeyDownHandler(event);
24095
+ },
24096
+ selected: selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.includes(value),
24097
+ "data-test": "DesignSystem-AvatarSelection--Option",
24098
+ tabIndex: -1
24099
+ }, rest), children);
24100
+ };
24101
+ AvatarSelectionOption.defaultProps = {
24102
+ tagName: 'li'
24103
+ };
24104
+
24105
+ var AvatarSelectionEmptyState = function AvatarSelectionEmptyState(props) {
24106
+ var height = props.height,
24107
+ title = props.title,
24108
+ description = props.description;
24109
+ return /*#__PURE__*/React.createElement("div", {
24110
+ className: "d-flex flex-column justify-content-center align-items-center",
24111
+ style: {
24112
+ height: height ? height - 4 : ''
24113
+ },
24114
+ "data-test": "DesignSystem-AvatarSelection--EmptyState"
24115
+ }, title && /*#__PURE__*/React.createElement(Text, {
24116
+ className: "text-align-center mb-3",
24117
+ weight: "strong"
24118
+ }, title), description && /*#__PURE__*/React.createElement(Text, {
24119
+ className: "text-align-center mb-6",
24120
+ weight: "medium",
24121
+ size: "small",
24122
+ appearance: "subtle"
24123
+ }, description));
24124
+ };
24125
+
24126
+ var AvatarSelectionPopover = function AvatarSelectionPopover(props) {
24127
+ var _classNames;
24128
+
24129
+ var hiddenAvatarList = props.hiddenAvatarList,
24130
+ customStyle = props.customStyle,
24131
+ searchPlaceholder = props.searchPlaceholder,
24132
+ searchComparator = props.searchComparator,
24133
+ children = props.children;
24134
+
24135
+ var _React$useState = React.useState(hiddenAvatarList),
24136
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24137
+ searchList = _React$useState2[0],
24138
+ setSearchList = _React$useState2[1];
24139
+
24140
+ var _React$useState3 = React.useState(''),
24141
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
24142
+ searchValue = _React$useState4[0],
24143
+ setSearchValue = _React$useState4[1];
24144
+
24145
+ var contextProp = React.useContext(AvatarSelectionContext);
24146
+ var selectedItems = contextProp.selectedItems,
24147
+ listRef = contextProp.listRef,
24148
+ withSearch = contextProp.withSearch,
24149
+ popoverId = contextProp.popoverId;
24150
+
24151
+ if (children) {
24152
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
24153
+ }
24154
+
24155
+ var onSearchHandler = function onSearchHandler(event) {
24156
+ var searchValue = event.target.value;
24157
+ var list = hiddenAvatarList === null || hiddenAvatarList === void 0 ? void 0 : hiddenAvatarList.filter(function (avatarData) {
24158
+ var _firstName$toLowerCas, _lastName$toLowerCase;
24159
+
24160
+ var firstName = avatarData.firstName,
24161
+ lastName = avatarData.lastName;
24162
+
24163
+ if (searchComparator) {
24164
+ return searchComparator(searchValue, avatarData);
24165
+ }
24166
+
24167
+ 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()));
24168
+ });
24169
+ setSearchValue(searchValue);
24170
+ setSearchList(list);
24171
+ };
24172
+
24173
+ var onClearHandler = function onClearHandler() {
24174
+ setSearchValue('');
24175
+ setSearchList(hiddenAvatarList);
24176
+ };
24177
+
24178
+ 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));
24179
+ return /*#__PURE__*/React.createElement("div", {
24180
+ style: {
24181
+ width: customStyle.width
24182
+ },
24183
+ ref: listRef,
24184
+ "data-test": "DesignSystem-AvatarSelection--Popover",
24185
+ id: popoverId
24186
+ }, withSearch && /*#__PURE__*/React.createElement(AvatarSelectionInput, {
24187
+ placeholder: searchPlaceholder,
24188
+ onChange: onSearchHandler,
24189
+ value: searchValue,
24190
+ onClear: onClearHandler
24191
+ }), /*#__PURE__*/React.createElement("div", {
24192
+ style: customStyle,
24193
+ className: popperClassName
24194
+ }, searchList.length === 0 && /*#__PURE__*/React.createElement(AvatarSelectionEmptyState, {
24195
+ height: customStyle.maxHeight,
24196
+ title: "No users found",
24197
+ description: "Try modifying your search to find what you are looking for."
24198
+ }), /*#__PURE__*/React.createElement(AvatarSelectionList, null, searchList.map(function (avatarData, index) {
24199
+ var _avatarData$firstName = avatarData.firstName,
24200
+ firstName = _avatarData$firstName === void 0 ? '' : _avatarData$firstName,
24201
+ _avatarData$lastName = avatarData.lastName,
24202
+ lastName = _avatarData$lastName === void 0 ? '' : _avatarData$lastName;
24203
+ var name = "".concat(firstName, " ").concat(lastName);
24204
+ var isSelected = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.includes(avatarData);
24205
+ return /*#__PURE__*/React.createElement(AvatarSelectionOption, {
24206
+ key: index,
24207
+ value: avatarData
24208
+ }, /*#__PURE__*/React.createElement(Checkbox, {
24209
+ defaultChecked: isSelected,
24210
+ checked: isSelected,
24211
+ label: name,
24212
+ size: "regular",
24213
+ tabIndex: -1,
24214
+ className: "ellipsis--noWrap",
24215
+ "data-test": "DesignSystem-AvatarSelection--Checkbox"
24216
+ }));
24217
+ }))));
24218
+ };
24219
+
24220
+ var AvatarSelection = function AvatarSelection(props) {
24221
+ var max = props.max,
24222
+ borderColor = props.borderColor,
24223
+ tooltipPosition = props.tooltipPosition,
24224
+ list = props.list,
24225
+ className = props.className,
24226
+ size = props.size,
24227
+ avatarRenderer = props.avatarRenderer,
24228
+ onSelect = props.onSelect,
24229
+ width = props.width,
24230
+ maxHeight = props.maxHeight,
24231
+ minHeight = props.minHeight,
24232
+ searchPlaceholder = props.searchPlaceholder,
24233
+ withSearch = props.withSearch,
24234
+ searchComparator = props.searchComparator,
24235
+ children = props.children;
24236
+
24237
+ var _React$useState = React.useState([]),
24238
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24239
+ selectedItems = _React$useState2[0],
24240
+ setSelectedItems = _React$useState2[1];
24241
+
24242
+ var _React$useState3 = React.useState(false),
24243
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
24244
+ openPopover = _React$useState4[0],
24245
+ setOpenPopover = _React$useState4[1];
24246
+
24247
+ var _React$useState5 = React.useState(),
24248
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
24249
+ focusedOption = _React$useState6[0],
24250
+ setFocusedOption = _React$useState6[1];
24251
+
24252
+ var _React$useState7 = React.useState(false),
24253
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
24254
+ highlightFirstItem = _React$useState8[0],
24255
+ setHighlightFirstItem = _React$useState8[1];
24256
+
24257
+ var _React$useState9 = React.useState(false),
24258
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
24259
+ highlightLastItem = _React$useState10[0],
24260
+ setHighlightLastItem = _React$useState10[1];
24261
+
24262
+ var listRef = /*#__PURE__*/React.createRef();
24263
+ var triggerRef = /*#__PURE__*/React.createRef();
24264
+ React.useEffect(function () {
24265
+ var selectedList = [];
24266
+ list.forEach(function (avatarItem) {
24267
+ if (avatarItem.selected) {
24268
+ selectedList.push(avatarItem);
24269
+ }
24270
+ });
24271
+ setSelectedItems(selectedList);
24272
+ }, []);
24273
+ React.useEffect(function () {
24274
+ if (!openPopover) {
24275
+ setHighlightFirstItem(false);
24276
+ setHighlightLastItem(false);
24277
+ } else {
24278
+ setHighlightFirstItem(true);
24279
+ }
24280
+ }, [openPopover]);
24281
+ React.useEffect(function () {
24282
+ if (highlightFirstItem && openPopover) {
24283
+ requestAnimationFrame(function () {
24284
+ return focusListItem$3('down', setFocusedOption, listRef, withSearch);
24285
+ });
24286
+ }
24287
+ }, [highlightFirstItem]);
24288
+ React.useEffect(function () {
24289
+ if (highlightLastItem && openPopover) {
24290
+ requestAnimationFrame(function () {
24291
+ return focusListItem$3('up', setFocusedOption, listRef, withSearch);
24292
+ });
24293
+ }
24294
+ }, [highlightLastItem]);
24295
+ var baseProps = extractBaseProps(props);
24296
+ var hiddenAvatarCount = list.length - max;
24297
+ var avatarStyle = {
24298
+ backgroundColor: "".concat(borderColor),
24299
+ boxShadow: "0 0 0 calc(var(--spacing-xs) + var(--spacing-s)) ".concat(borderColor)
24300
+ };
24301
+ var AvatarSelectionClass = classnames(_defineProperty$1({}, 'SelectionAvatarGroup', true), className);
24302
+ var searchInputHeight = 36;
24303
+ var searchBorder = 1;
24304
+ var customStyle = {
24305
+ width: width,
24306
+ minHeight: minHeight,
24307
+ maxHeight: withSearch ? maxHeight - searchInputHeight - searchBorder : maxHeight
24308
+ };
24309
+ var hiddenAvatarList = list.slice(max, list.length);
24310
+ var popoverId = "DesignSystem-AvatarSelection-Popover-".concat(uidGenerator());
24311
+ var popoverProps = {
24312
+ hiddenAvatarList: hiddenAvatarList,
24313
+ customStyle: customStyle,
24314
+ searchPlaceholder: searchPlaceholder,
24315
+ searchComparator: searchComparator,
24316
+ children: children
24317
+ };
24318
+ var triggerProps = {
24319
+ size: size,
24320
+ avatarStyle: avatarStyle,
24321
+ hiddenAvatarCount: hiddenAvatarCount,
24322
+ hiddenAvatarList: hiddenAvatarList
24323
+ };
24324
+
24325
+ var onToggleHandler = function onToggleHandler(open) {
24326
+ open ? setOpenPopover(true) : setOpenPopover(false);
24327
+ };
24328
+
24329
+ var contextProp = {
24330
+ listRef: listRef,
24331
+ onSelect: onSelect,
24332
+ withSearch: withSearch,
24333
+ triggerRef: triggerRef,
24334
+ selectedItems: selectedItems,
24335
+ focusedOption: focusedOption,
24336
+ openPopover: openPopover,
24337
+ setSelectedItems: setSelectedItems,
24338
+ setFocusedOption: setFocusedOption,
24339
+ setHighlightFirstItem: setHighlightFirstItem,
24340
+ setHighlightLastItem: setHighlightLastItem,
24341
+ setOpenPopover: setOpenPopover,
24342
+ popoverId: popoverId
24343
+ };
24344
+ return /*#__PURE__*/React.createElement(AvatarSelectionContext.Provider, {
24345
+ value: contextProp
24346
+ }, /*#__PURE__*/React.createElement("div", _extends$2({
24347
+ "data-test": "DesignSystem-AvatarSelection"
24348
+ }, baseProps, {
24349
+ className: AvatarSelectionClass
24350
+ }), /*#__PURE__*/React.createElement(SelectionAvatarsWrapper, {
24351
+ size: size,
24352
+ avatarStyle: avatarStyle,
24353
+ avatarList: list.slice(0, max),
24354
+ avatarRenderer: avatarRenderer,
24355
+ tooltipPosition: tooltipPosition
24356
+ }), (hiddenAvatarCount > 0 || children && hiddenAvatarCount > 0) && /*#__PURE__*/React.createElement(Popover, {
24357
+ open: openPopover,
24358
+ position: "bottom-end",
24359
+ trigger: /*#__PURE__*/React.createElement(AvatarSelectionCount, triggerProps),
24360
+ triggerClass: "flex-grow-0",
24361
+ onToggle: onToggleHandler
24362
+ }, /*#__PURE__*/React.createElement(AvatarSelectionPopover, popoverProps))));
24363
+ };
24364
+ AvatarSelection.displayName = 'AvatarSelection';
24365
+ AvatarSelection.defaultProps = {
24366
+ max: 5,
24367
+ tooltipPosition: 'bottom',
24368
+ borderColor: 'white',
24369
+ size: 'regular',
24370
+ width: 176,
24371
+ maxHeight: 256
24372
+ };
24373
+ AvatarSelection.Input = AvatarSelectionInput;
24374
+ AvatarSelection.List = AvatarSelectionList;
24375
+ AvatarSelection.Option = AvatarSelectionOption;
24376
+ AvatarSelection.EmptyState = AvatarSelectionEmptyState;
24377
+
24378
+ var ComboboxList = function ComboboxList(props) {
24379
+ return /*#__PURE__*/React.createElement(Listbox, _extends$2({
24380
+ className: "py-3"
24381
+ }, props, {
24382
+ role: "listbox"
24383
+ }), props.children);
24384
+ };
24385
+ ComboboxList.defaultProps = {
24386
+ type: 'option',
24387
+ showDivider: false,
24388
+ tagName: 'ul',
24389
+ size: 'compressed'
24390
+ };
24391
+
24392
+ var ComboboxContext = /*#__PURE__*/React.createContext({});
24393
+
24394
+ var handleKeyDown$4 = function handleKeyDown(event, focusedOption, setFocusedOption, setOpenPopover, inputTriggerRef, setHighlightFirstItem, setHighlightLastItem, multiSelect, listRef) {
24395
+ switch (event.key) {
24396
+ case 'ArrowUp':
24397
+ event.preventDefault();
24398
+ navigateOptions$2('up', focusedOption, setFocusedOption, listRef);
24399
+ break;
24400
+
24401
+ case 'ArrowDown':
24402
+ event.preventDefault();
24403
+ navigateOptions$2('down', focusedOption, setFocusedOption, listRef);
24404
+ break;
24405
+
24406
+ case 'Enter':
24407
+ handleEnterKey$1(focusedOption, multiSelect, inputTriggerRef, listRef, setFocusedOption);
24408
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(false);
24409
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(false);
24410
+ break;
24411
+
24412
+ case 'Escape':
24413
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
24414
+ inputTriggerRef.current.focus();
24415
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(undefined);
24416
+ break;
24417
+ }
24418
+ };
24419
+
24420
+ var handleEnterKey$1 = function handleEnterKey(focusedOption, multiSelect, inputTriggerRef, listRef, setFocusedOption) {
24421
+ focusedOption === null || focusedOption === void 0 ? void 0 : focusedOption.click();
24422
+
24423
+ if (!multiSelect) {
24424
+ inputTriggerRef.current.focus();
24425
+ } else {
24426
+ // to focus first option by default when last option is selected
24427
+ var listItems = listRef.current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
24428
+ var listArr = Array.from(listItems);
24429
+ var index = listArr.findIndex(function (item) {
24430
+ return item == focusedOption;
24431
+ });
24432
+
24433
+ if (index === listArr.length - 1) {
24434
+ listItems[0].focus();
24435
+ setFocusedOption && setFocusedOption(listItems[0]);
24436
+ listItems[0].scrollIntoView({
24437
+ block: 'center'
24438
+ });
24439
+ }
24440
+ }
24441
+ };
24442
+
24443
+ var navigateOptions$2 = function navigateOptions(direction, focusedOption, setFocusedOption, listRef) {
24444
+ var _targetOption$scrollI;
24445
+
24446
+ var listItems = listRef.current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
24447
+ var index = Array.from(listItems).findIndex(function (item) {
24448
+ return item == focusedOption;
24449
+ });
24450
+
24451
+ if (index === -1) {
24452
+ index = direction === 'up' ? listItems.length - 1 : 0;
24453
+ } else {
24454
+ index = direction === 'up' ? (index - 1 + listItems.length) % listItems.length : (index + 1) % listItems.length;
24455
+ }
24456
+
24457
+ var targetOption = listItems[index];
24458
+ targetOption.focus();
24459
+ setFocusedOption && setFocusedOption(targetOption);
24460
+ targetOption === null || targetOption === void 0 ? void 0 : (_targetOption$scrollI = targetOption.scrollIntoView) === null || _targetOption$scrollI === void 0 ? void 0 : _targetOption$scrollI.call(targetOption, {
24461
+ block: 'center'
24462
+ });
24463
+ };
24464
+
24465
+ var _excluded$c = ["children", "option", "onClick"];
24466
+ var ComboboxOption = function ComboboxOption(props) {
24467
+ var children = props.children,
24468
+ option = props.option,
24469
+ onClick = props.onClick,
24470
+ rest = _objectWithoutProperties(props, _excluded$c);
24471
+
24472
+ var contextProp = React.useContext(ComboboxContext);
24473
+ var onOptionClick = contextProp.onOptionClick,
24474
+ inputValue = contextProp.inputValue,
24475
+ focusedOption = contextProp.focusedOption,
24476
+ setFocusedOption = contextProp.setFocusedOption,
24477
+ setOpenPopover = contextProp.setOpenPopover,
24478
+ inputTriggerRef = contextProp.inputTriggerRef,
24479
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
24480
+ setHighlightLastItem = contextProp.setHighlightLastItem,
24481
+ multiSelect = contextProp.multiSelect,
24482
+ listRef = contextProp.listRef;
24483
+
24484
+ var onClickHandler = function onClickHandler() {
24485
+ if (onClick) {
24486
+ return onClick(option);
24487
+ }
24488
+
24489
+ return onOptionClick && onOptionClick(_objectSpread2(_objectSpread2({}, option), {}, {
24490
+ isSelectedOption: true
24491
+ }));
24492
+ };
24493
+
24494
+ var onKeyDownHandler = function onKeyDownHandler(event) {
24495
+ handleKeyDown$4(event, focusedOption, setFocusedOption, setOpenPopover, inputTriggerRef, setHighlightFirstItem, setHighlightLastItem, multiSelect, listRef);
24496
+ };
24497
+
24498
+ return /*#__PURE__*/React.createElement(Listbox.Item, _extends$2({
24499
+ onClick: onClickHandler,
24500
+ selected: option.label === (inputValue === null || inputValue === void 0 ? void 0 : inputValue.label),
24501
+ onKeyDown: onKeyDownHandler,
24502
+ tabIndex: -1,
24503
+ role: "option",
24504
+ "data-test": "DesignSystem-Combobox-Option"
24505
+ }, rest), children);
24506
+ };
24507
+ ComboboxOption.defaultProps = {
24508
+ tagName: 'li'
24509
+ };
24510
+
24511
+ var handleKeyDown$3 = function handleKeyDown(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem) {
24512
+ switch (event.key) {
24513
+ case 'ArrowUp':
24514
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24515
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(true);
24516
+ break;
24517
+
24518
+ case 'ArrowDown':
24519
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24520
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(true);
24521
+ break;
24522
+
24523
+ case 'Escape':
24524
+ case 'Tab':
24525
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
24526
+ break;
24527
+ }
24528
+ };
24529
+ var focusListItem$2 = function focusListItem(position, setFocusedOption, listRef) {
24530
+ var _listRef$current, _targetOption;
24531
+
24532
+ var listItems = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
24533
+ var targetOption;
24534
+
24535
+ if (position === 'down') {
24536
+ targetOption = listItems === null || listItems === void 0 ? void 0 : listItems[0];
24537
+ } else {
24538
+ targetOption = listItems[listItems.length - 1];
24539
+ }
24540
+
24541
+ (_targetOption = targetOption) === null || _targetOption === void 0 ? void 0 : _targetOption.focus();
24542
+
24543
+ if (targetOption && typeof targetOption.scrollIntoView === 'function') {
24544
+ var _targetOption2;
24545
+
24546
+ (_targetOption2 = targetOption) === null || _targetOption2 === void 0 ? void 0 : _targetOption2.scrollIntoView({
24547
+ block: 'center',
24548
+ behavior: 'smooth'
24549
+ });
24550
+ }
24551
+
24552
+ setFocusedOption && setFocusedOption(targetOption);
24553
+ };
24554
+
24555
+ var InputBox = function InputBox(props) {
24556
+ var contextProp = React.useContext(ComboboxContext);
24557
+ var inputValue = contextProp.inputValue,
24558
+ setInputValue = contextProp.setInputValue,
24559
+ setFocusedOption = contextProp.setFocusedOption,
24560
+ setOpenPopover = contextProp.setOpenPopover,
24561
+ inputTriggerRef = contextProp.inputTriggerRef,
24562
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
24563
+ setHighlightLastItem = contextProp.setHighlightLastItem,
24564
+ openPopover = contextProp.openPopover,
24565
+ popoverId = contextProp.popoverId;
24566
+
24567
+ var onChangeHandler = function onChangeHandler(event) {
24568
+ var value = event.target.value;
24569
+ setFocusedOption && setFocusedOption(undefined);
24570
+ var newValue = {
24571
+ label: value,
24572
+ value: value,
24573
+ isSelectedOption: false
24574
+ };
24575
+ setInputValue && setInputValue(newValue);
24576
+
24577
+ if (value !== '') {
24578
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24579
+ }
24580
+ };
24581
+
24582
+ var onClearHandler = function onClearHandler(event) {
24583
+ var _props$onClear;
24584
+
24585
+ event.stopPropagation();
24586
+ var newValue = {
24587
+ label: '',
24588
+ value: '',
24589
+ isSelectedOption: false
24590
+ };
24591
+ setInputValue && setInputValue(newValue);
24592
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24593
+ (_props$onClear = props.onClear) === null || _props$onClear === void 0 ? void 0 : _props$onClear.call(props, event);
24594
+ };
24595
+
24596
+ var onKeyDownHandler = function onKeyDownHandler(event) {
24597
+ handleKeyDown$3(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem);
24598
+ };
24599
+
24600
+ return /*#__PURE__*/React.createElement(Input, _extends$2({}, props, {
24601
+ ref: inputTriggerRef,
24602
+ value: inputValue === null || inputValue === void 0 ? void 0 : inputValue.label,
24603
+ onChange: onChangeHandler,
24604
+ onKeyDown: onKeyDownHandler,
24605
+ onClear: onClearHandler,
24606
+ role: "combobox",
24607
+ "aria-haspopup": "listbox",
24608
+ "aria-controls": popoverId,
24609
+ "aria-label": props.placeholder || 'Combobox-Input-Trigger',
24610
+ "aria-expanded": openPopover,
24611
+ "data-test": "DesignSystem-Combobox-Input"
24612
+ }));
24613
+ };
24614
+
24615
+ var _excluded$b = ["chipOptions", "allowDuplicates", "disabled", "error", "placeholder", "defaultValue", "value", "className", "autoFocus", "onChange", "onBlur", "onFocus", "onKeyDown", "onInputChange", "tabIndex", "role"],
24616
+ _excluded2 = ["type", "onClick"];
24617
+ var keyCodes = {
24618
+ BACKSPACE: 'Backspace',
24619
+ DELETE: 'Delete',
24620
+ ENTER: 'Enter'
24621
+ };
24622
+ var MultiSelectTrigger = function MultiSelectTrigger(props) {
24623
+ var _classNames, _classNames2;
24624
+
24625
+ var chipOptions = props.chipOptions,
24626
+ allowDuplicates = props.allowDuplicates,
24627
+ disabled = props.disabled,
24628
+ error = props.error,
24629
+ placeholder = props.placeholder,
24630
+ defaultValue = props.defaultValue,
24631
+ value = props.value,
24632
+ className = props.className,
24633
+ autoFocus = props.autoFocus,
24634
+ onChange = props.onChange,
24635
+ onBlur = props.onBlur,
24636
+ onFocus = props.onFocus,
24637
+ onKeyDown = props.onKeyDown,
24638
+ onInputChange = props.onInputChange,
24639
+ tabIndex = props.tabIndex,
24640
+ role = props.role,
24641
+ rest = _objectWithoutProperties(props, _excluded$b);
24642
+
24643
+ var inputRef = /*#__PURE__*/React.createRef();
24644
+
24645
+ var _React$useState = React.useState(value || defaultValue),
24646
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24647
+ chips = _React$useState2[0],
24648
+ setChips = _React$useState2[1];
24649
+
24650
+ var _React$useState3 = React.useState(''),
24651
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
24652
+ inputValue = _React$useState4[0],
24653
+ setInputValue = _React$useState4[1];
24654
+
24655
+ var baseProps = extractBaseProps(props);
24656
+ React.useEffect(function () {
24657
+ if (value !== undefined) {
24658
+ setChips(value);
24659
+ setInputValue('');
24660
+ }
24661
+ }, [value]);
24662
+ var ChipInputBorderClass = classnames((_classNames = {}, _defineProperty$1(_classNames, 'ChipInput-border', true), _defineProperty$1(_classNames, 'ChipInput-border--error', error), _classNames));
24663
+ var ChipInputClass = classnames((_classNames2 = {
24664
+ ChipInput: true
24665
+ }, _defineProperty$1(_classNames2, 'ChipInput--disabled', disabled), _defineProperty$1(_classNames2, 'ChipInput--withChips', chips && chips.length > 0), _defineProperty$1(_classNames2, 'ChipInput--error', error), _classNames2), className);
24666
+
24667
+ var onUpdateChips = function onUpdateChips(updatedChips) {
24668
+ if (onChange) onChange(updatedChips);
24669
+ };
24670
+
24671
+ var onChipDeleteHandler = function onChipDeleteHandler(index) {
24672
+ var updatedChips = _toConsumableArray(chips);
24673
+
24674
+ updatedChips.splice(index, 1);
24675
+
24676
+ if (!value) {
24677
+ setChips(updatedChips);
24678
+ }
24679
+
24680
+ onUpdateChips(updatedChips);
24681
+ };
24682
+
24683
+ var onChipAddHandler = function onChipAddHandler() {
24684
+ if (!inputValue) return;
24685
+ var chip = inputValue.trim();
24686
+ var isChipExist = chips.filter(function (item) {
24687
+ return item.label === chip;
24688
+ }).length > 0;
24689
+
24690
+ if ((allowDuplicates || !isChipExist) && chip) {
24691
+ var updatedChips = [].concat(_toConsumableArray(chips), [{
24692
+ label: chip,
24693
+ value: chip,
24694
+ isSelectedOption: false
24695
+ }]);
24696
+
24697
+ if (!value) {
24698
+ setChips(updatedChips);
24699
+ }
24700
+
24701
+ onUpdateChips(updatedChips);
24702
+ setInputValue('');
24703
+ }
24704
+ };
24705
+
24706
+ var onDeleteAllHandler = function onDeleteAllHandler(e) {
24707
+ e.stopPropagation();
24708
+ var updatedChips = [];
24709
+
24710
+ if (!value) {
24711
+ setChips(updatedChips);
24712
+ }
24713
+
24714
+ onUpdateChips(updatedChips);
24715
+ setInputValue('');
24716
+ onInputChange && onInputChange();
24717
+ };
24718
+
24719
+ var onKeyDownHandler = function onKeyDownHandler(event) {
24720
+ var chipsLength = chips.length;
24721
+
24722
+ switch (event.key) {
24723
+ case keyCodes.DELETE:
24724
+ case keyCodes.BACKSPACE:
24725
+ if (inputValue === '' && chipsLength > 0) {
24726
+ onChipDeleteHandler(chipsLength - 1);
24727
+ }
24728
+
24729
+ break;
24730
+
24731
+ case keyCodes.ENTER:
24732
+ event.preventDefault();
24733
+ onChipAddHandler();
24734
+ break;
24735
+ }
24736
+
24737
+ onKeyDown && onKeyDown(event);
24738
+ };
24739
+
24740
+ var onInputChangeHandler = function onInputChangeHandler(event) {
24741
+ setInputValue(event.target.value);
24742
+ onInputChange && onInputChange(event);
24743
+ };
24744
+
24745
+ var onClickHandler = function onClickHandler() {
24746
+ var _inputRef$current;
24747
+
24748
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
24749
+ };
24750
+
24751
+ var chipComponents = chips.map(function (chip, index) {
24752
+ var _chipOptions$type = chipOptions.type,
24753
+ type = _chipOptions$type === void 0 ? 'input' : _chipOptions$type,
24754
+ _onClick = chipOptions.onClick,
24755
+ rest = _objectWithoutProperties(chipOptions, _excluded2);
24756
+
24757
+ var chipLabel = typeof chip === 'string' ? chip : chip === null || chip === void 0 ? void 0 : chip.label;
24758
+ return /*#__PURE__*/React.createElement(Chip, _extends$2({
24759
+ "data-test": "DesignSystem-MultiSelectTrigger--Chip",
24760
+ label: chipLabel,
24761
+ name: chip,
24762
+ type: type,
24763
+ disabled: disabled,
24764
+ key: index,
24765
+ className: "my-3 mx-2",
24766
+ onClick: function onClick() {
24767
+ return _onClick && _onClick(chip, index);
24768
+ },
24769
+ onClose: function onClose() {
24770
+ return onChipDeleteHandler(index);
24771
+ }
24772
+ }, rest));
24773
+ });
24774
+ return (
24775
+ /*#__PURE__*/
24776
+
24777
+ /* TODO(a11y): fix accessibility */
24778
+
24779
+ /* eslint-disable */
24780
+ React.createElement("div", {
24781
+ "data-test": "DesignSystem-MultiSelectTrigger--Border",
24782
+ className: ChipInputBorderClass
24783
+ }, /*#__PURE__*/React.createElement("div", _extends$2({
24784
+ "data-test": "DesignSystem-MultiSelectTrigger"
24785
+ }, baseProps, {
24786
+ className: ChipInputClass,
24787
+ onClick: onClickHandler,
24788
+ tabIndex: disabled ? -1 : tabIndex || 0
24789
+ }), /*#__PURE__*/React.createElement("div", {
24790
+ className: "ChipInput-wrapper"
24791
+ }, chips && chips.length > 0 && chipComponents, /*#__PURE__*/React.createElement("input", _extends$2({}, rest, {
24792
+ "data-test": "DesignSystem-MultiSelectTrigger--Input",
24793
+ ref: props.forwardedRef || inputRef,
24794
+ className: "ChipInput-input",
24795
+ autoFocus: autoFocus,
24796
+ placeholder: chips && chips.length > 0 ? '' : placeholder,
24797
+ disabled: disabled,
24798
+ value: inputValue,
24799
+ onBlur: onBlur,
24800
+ onFocus: onFocus,
24801
+ onChange: onInputChangeHandler,
24802
+ onKeyDown: onKeyDownHandler,
24803
+ role: role
24804
+ }))), (chips.length > 0 || inputValue.length > 0) && /*#__PURE__*/React.createElement(Icon, {
24805
+ "data-test": "DesignSystem-MultiSelectTrigger--Icon",
24806
+ name: "close",
24807
+ appearance: disabled ? 'disabled' : 'subtle',
24808
+ className: "ChipInput-icon",
24809
+ onClick: onDeleteAllHandler,
24810
+ tabIndex: disabled ? -1 : 0
24811
+ })))
24812
+ );
24813
+ };
24814
+ MultiSelectTrigger.displayName = 'MultiSelectTrigger';
24815
+ MultiSelectTrigger.defaultProps = {
24816
+ chipOptions: {},
24817
+ defaultValue: [],
24818
+ allowDuplicates: false,
24819
+ autoFocus: false
24820
+ };
24821
+
24822
+ var ChipInputBox = function ChipInputBox(props) {
24823
+ var contextProp = React__default.useContext(ComboboxContext);
24824
+ var chipInputValue = contextProp.chipInputValue,
24825
+ setChipInputValue = contextProp.setChipInputValue,
24826
+ setOpenPopover = contextProp.setOpenPopover,
24827
+ setFocusedOption = contextProp.setFocusedOption,
24828
+ setChipInputText = contextProp.setChipInputText,
24829
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
24830
+ setHighlightLastItem = contextProp.setHighlightLastItem,
24831
+ inputTriggerRef = contextProp.inputTriggerRef,
24832
+ openPopover = contextProp.openPopover,
24833
+ popoverId = contextProp.popoverId;
24834
+
24835
+ var onChangeHandler = function onChangeHandler(chips) {
24836
+ setFocusedOption && setFocusedOption(undefined);
24837
+ setChipInputValue && setChipInputValue(chips);
24838
+
24839
+ if (chips.length === 0) {
24840
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24841
+ }
24842
+ };
24843
+
24844
+ var onUpdateHandler = function onUpdateHandler(event) {
24845
+ var _event$target;
24846
+
24847
+ var value = event === null || event === void 0 ? void 0 : (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value;
24848
+
24849
+ if (!value) {
24850
+ setChipInputText === null || setChipInputText === void 0 ? void 0 : setChipInputText('');
24851
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24852
+ inputTriggerRef === null || inputTriggerRef === void 0 ? void 0 : inputTriggerRef.current.focus();
24853
+ return;
24854
+ }
24855
+
24856
+ setChipInputText && setChipInputText(value);
24857
+
24858
+ if (value !== '') {
24859
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
24860
+ }
24861
+ };
24862
+
24863
+ var onKeyDownHandler = function onKeyDownHandler(event) {
24864
+ handleKeyDown$3(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem);
24865
+ };
24866
+
24867
+ return /*#__PURE__*/React__default.createElement(MultiSelectTrigger, _extends$2({}, props, {
24868
+ value: chipInputValue,
24869
+ onChange: onChangeHandler,
24870
+ onInputChange: onUpdateHandler,
24871
+ onKeyDown: onKeyDownHandler,
24872
+ tabIndex: -1,
24873
+ forwardedRef: inputTriggerRef,
24874
+ role: "combobox",
24875
+ "aria-haspopup": "listbox",
24876
+ "aria-controls": popoverId,
24877
+ "aria-label": props.placeholder || 'Combobox-ChipInput-Trigger',
24878
+ "aria-expanded": openPopover,
24879
+ "data-test": "DesignSystem-Combobox-ChipInput"
24880
+ }));
24881
+ };
24882
+
24883
+ var _excluded$a = ["multiSelect", "chipValue", "value"];
24884
+ var ComboboxTrigger = function ComboboxTrigger(props) {
24885
+ var multiSelect = props.multiSelect,
24886
+ chipValue = props.chipValue,
24887
+ value = props.value,
24888
+ rest = _objectWithoutProperties(props, _excluded$a);
24889
+
24890
+ if (multiSelect) {
24891
+ var icon = props.icon,
24892
+ clearButton = props.clearButton,
24893
+ iconType = props.iconType;
24894
+ var chipInputOptions = {
24895
+ icon: icon,
24896
+ clearButton: clearButton,
24897
+ iconType: iconType
24898
+ };
24899
+ return /*#__PURE__*/React.createElement(ChipInputBox, _extends$2({
24900
+ defaultValue: [],
24901
+ chipOptions: _objectSpread2({}, chipInputOptions)
24902
+ }, rest, {
24903
+ value: chipValue
24904
+ }));
24905
+ }
24906
+
24907
+ return /*#__PURE__*/React.createElement(InputBox, _extends$2({}, props, {
24908
+ value: value === null || value === void 0 ? void 0 : value.label
24909
+ }));
24910
+ };
24911
+
24912
+ var Combobox = function Combobox(props) {
24913
+ var children = props.children,
24914
+ onChange = props.onChange,
24915
+ multiSelect = props.multiSelect,
24916
+ className = props.className,
24917
+ maxHeight = props.maxHeight,
24918
+ width = props.width,
24919
+ value = props.value,
24920
+ placeholder = props.placeholder,
24921
+ disabled = props.disabled,
24922
+ error = props.error,
24923
+ onBlur = props.onBlur,
24924
+ onFocus = props.onFocus,
24925
+ onClear = props.onClear,
24926
+ icon = props.icon,
24927
+ iconType = props.iconType,
24928
+ size = props.size,
24929
+ chipValue = props.chipValue,
24930
+ clearButton = props.clearButton,
24931
+ onSearch = props.onSearch;
24932
+
24933
+ var _React$useState = React.useState(),
24934
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24935
+ popoverStyle = _React$useState2[0],
24936
+ setPopoverStyle = _React$useState2[1];
24937
+
24938
+ var _React$useState3 = React.useState({}),
24939
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
24940
+ wrapperStyle = _React$useState4[0],
24941
+ setWrapperStyle = _React$useState4[1];
24942
+
24943
+ var triggerRef = /*#__PURE__*/React.createRef();
24944
+ var listRef = /*#__PURE__*/React.createRef();
24945
+
24946
+ var _React$useState5 = React.useState(false),
24947
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
24948
+ openPopover = _React$useState6[0],
24949
+ setOpenPopover = _React$useState6[1];
24950
+
24951
+ var _React$useState7 = React.useState(false),
24952
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
24953
+ isOptionSelected = _React$useState8[0],
24954
+ setIsOptionSelected = _React$useState8[1];
24955
+
24956
+ var _React$useState9 = React.useState(),
24957
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
24958
+ focusedOption = _React$useState10[0],
24959
+ setFocusedOption = _React$useState10[1];
24960
+
24961
+ var _React$useState11 = React.useState(value || {
24962
+ label: '',
24963
+ value: ''
24964
+ }),
24965
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
24966
+ inputValue = _React$useState12[0],
24967
+ setInputValue = _React$useState12[1];
24968
+
24969
+ var _React$useState13 = React.useState(chipValue),
24970
+ _React$useState14 = _slicedToArray(_React$useState13, 2),
24971
+ chipInputValue = _React$useState14[0],
24972
+ setChipInputValue = _React$useState14[1];
24973
+
24974
+ var _React$useState15 = React.useState(''),
24975
+ _React$useState16 = _slicedToArray(_React$useState15, 2),
24976
+ chipInputText = _React$useState16[0],
24977
+ setChipInputText = _React$useState16[1];
24978
+
24979
+ var _React$useState17 = React.useState(false),
24980
+ _React$useState18 = _slicedToArray(_React$useState17, 2),
24981
+ highlightFirstItem = _React$useState18[0],
24982
+ setHighlightFirstItem = _React$useState18[1];
24983
+
24984
+ var _React$useState19 = React.useState(false),
24985
+ _React$useState20 = _slicedToArray(_React$useState19, 2),
24986
+ highlightLastItem = _React$useState20[0],
24987
+ setHighlightLastItem = _React$useState20[1];
24988
+
24989
+ var inputTriggerRef = React.useRef();
24990
+ var popoverId = "DesignSystem-Combobox--Popover-".concat(uidGenerator());
24991
+ React.useEffect(function () {
24992
+ var _triggerRef$current;
24993
+
24994
+ var popperWidth = (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.clientWidth;
24995
+ var popperWrapperStyle = {
24996
+ width: width || popperWidth
24997
+ };
24998
+ var wrapperStyle = {
24999
+ maxHeight: maxHeight || 'var(--spacing-9)',
25000
+ overflowY: 'auto',
25001
+ boxSizing: 'border-box'
25002
+ };
25003
+ setWrapperStyle(wrapperStyle);
25004
+ setPopoverStyle(popperWrapperStyle);
25005
+ }, []);
25006
+ React.useEffect(function () {
25007
+ if (isOptionSelected) {
25008
+ multiSelect ? setOpenPopover(true) : setOpenPopover(false);
25009
+ setIsOptionSelected(false);
25010
+ }
25011
+
25012
+ var value = multiSelect ? chipInputValue : inputValue;
25013
+ onChange && !isOptionSelected && onChange(value);
25014
+ }, [inputValue, chipInputValue]);
25015
+ React.useEffect(function () {
25016
+ if (highlightFirstItem && openPopover) {
25017
+ requestAnimationFrame(function () {
25018
+ return focusListItem$2('down', setFocusedOption, listRef);
25019
+ });
25020
+ }
25021
+ }, [highlightFirstItem]);
25022
+ React.useEffect(function () {
25023
+ if (highlightLastItem && openPopover) {
25024
+ requestAnimationFrame(function () {
25025
+ return focusListItem$2('up', setFocusedOption, listRef);
25026
+ });
25027
+ }
25028
+ }, [highlightLastItem]);
25029
+ React.useEffect(function () {
25030
+ if (!openPopover) {
25031
+ setHighlightFirstItem(false);
25032
+ setHighlightLastItem(false);
25033
+ }
25034
+ }, [openPopover]);
25035
+ React.useEffect(function () {
25036
+ onSearch && onSearch(chipInputText);
25037
+ }, [chipInputText]);
25038
+
25039
+ var onOptionClick = function onOptionClick(option) {
25040
+ setIsOptionSelected(true);
25041
+
25042
+ if (!multiSelect) {
25043
+ setInputValue(option);
25044
+ onChange && onChange(option);
25045
+ } else {
25046
+ var chipList = chipInputValue ? [].concat(_toConsumableArray(chipInputValue), [option]) : [option];
25047
+ setChipInputValue(chipList);
25048
+ onChange && onChange(chipList);
25049
+ }
25050
+ };
25051
+
25052
+ var outsideClickHandler = function outsideClickHandler() {
25053
+ !multiSelect && setOpenPopover(false);
25054
+ };
25055
+
25056
+ var onToggleHandler = function onToggleHandler(open) {
25057
+ open ? setOpenPopover(true) : setOpenPopover(false);
25058
+ };
25059
+
25060
+ var triggerProps = {
25061
+ value: value,
25062
+ placeholder: placeholder,
25063
+ disabled: disabled,
25064
+ error: error,
25065
+ onBlur: onBlur,
25066
+ onFocus: onFocus,
25067
+ onClear: onClear,
25068
+ icon: icon,
25069
+ iconType: iconType,
25070
+ size: size,
25071
+ multiSelect: multiSelect,
25072
+ chipValue: chipValue,
25073
+ clearButton: clearButton
25074
+ };
25075
+ var contextProp = {
25076
+ inputValue: inputValue,
25077
+ setInputValue: setInputValue,
25078
+ onOptionClick: onOptionClick,
25079
+ openPopover: openPopover,
25080
+ setOpenPopover: setOpenPopover,
25081
+ isOptionSelected: isOptionSelected,
25082
+ setIsOptionSelected: setIsOptionSelected,
25083
+ chipInputValue: chipInputValue,
25084
+ setChipInputValue: setChipInputValue,
25085
+ focusedOption: focusedOption,
25086
+ setFocusedOption: setFocusedOption,
25087
+ chipInputText: chipInputText,
25088
+ setChipInputText: setChipInputText,
25089
+ inputTriggerRef: inputTriggerRef,
25090
+ setHighlightFirstItem: setHighlightFirstItem,
25091
+ setHighlightLastItem: setHighlightLastItem,
25092
+ multiSelect: multiSelect,
25093
+ listRef: listRef,
25094
+ onSearch: onSearch,
25095
+ popoverId: popoverId
25096
+ };
25097
+ return /*#__PURE__*/React.createElement(ComboboxContext.Provider, {
25098
+ value: contextProp
25099
+ }, /*#__PURE__*/React.createElement("div", {
25100
+ ref: triggerRef,
25101
+ className: className
25102
+ }, /*#__PURE__*/React.createElement(OutsideClick, {
25103
+ onOutsideClick: outsideClickHandler
25104
+ }, /*#__PURE__*/React.createElement(Popover, {
25105
+ open: openPopover && !disabled,
25106
+ triggerClass: "d-block",
25107
+ customStyle: popoverStyle,
25108
+ onToggle: onToggleHandler,
25109
+ trigger: /*#__PURE__*/React.createElement(ComboboxTrigger, triggerProps)
25110
+ }, /*#__PURE__*/React.createElement("div", {
25111
+ style: wrapperStyle,
25112
+ ref: listRef,
25113
+ id: popoverId
25114
+ }, children && typeof children === 'function' ? children(contextProp) : children)))));
25115
+ };
25116
+ Combobox.List = ComboboxList;
25117
+ Combobox.Option = ComboboxOption;
25118
+
25119
+ var SelectContext = /*#__PURE__*/React.createContext({});
25120
+
25121
+ var _excluded$9 = ["children"];
25122
+ var SelectList = function SelectList(props) {
25123
+ var contextProp = React.useContext(SelectContext);
25124
+ var withSearch = contextProp.withSearch,
25125
+ minHeight = contextProp.minHeight,
25126
+ maxHeight = contextProp.maxHeight,
25127
+ multiSelect = contextProp.multiSelect;
25128
+
25129
+ var children = props.children,
25130
+ rest = _objectWithoutProperties(props, _excluded$9);
25131
+
25132
+ var searchInputHeight = 33;
25133
+ var wrapperStyle = {
25134
+ maxHeight: withSearch ? maxHeight - searchInputHeight : maxHeight,
25135
+ overflowY: 'auto',
25136
+ minHeight: minHeight
25137
+ };
25138
+ return /*#__PURE__*/React.createElement(Listbox, _extends$2({
25139
+ "aria-label": "Options item list",
25140
+ "aria-multiselectable": multiSelect,
25141
+ className: "my-3"
25142
+ }, rest), /*#__PURE__*/React.createElement("div", {
25143
+ style: wrapperStyle
25144
+ }, children));
25145
+ };
25146
+ SelectList.defaultProps = {
25147
+ type: 'option',
25148
+ showDivider: false,
25149
+ size: 'compressed',
25150
+ tagName: 'ul'
25151
+ };
25152
+
25153
+ var mapInitialValue = function mapInitialValue(multiSelect, selectedValue) {
25154
+ if (multiSelect) {
25155
+ return selectedValue && !Array.isArray(selectedValue) ? [selectedValue] : selectedValue || [];
25156
+ } else {
25157
+ return selectedValue || {
25158
+ label: '',
25159
+ value: ''
25160
+ };
25161
+ }
25162
+ };
25163
+ var elementExist = function elementExist(targetObject, mainList) {
25164
+ if (!Array.isArray(mainList)) {
25165
+ return targetObject.value === (mainList === null || mainList === void 0 ? void 0 : mainList.value) ? 0 : -1;
25166
+ }
25167
+
25168
+ return mainList.findIndex(function (item) {
25169
+ return item.value === targetObject.value;
25170
+ });
25171
+ };
25172
+ var removeOrAddToList = function removeOrAddToList(targetObject, prevList) {
25173
+ var newList = _toConsumableArray(prevList);
25174
+
25175
+ var existingIndex = elementExist(targetObject, newList);
25176
+
25177
+ if (existingIndex !== -1) {
25178
+ newList.splice(existingIndex, 1);
25179
+ } else {
25180
+ newList.push(targetObject);
25181
+ }
25182
+
25183
+ return newList;
25184
+ };
25185
+ var computeValue = function computeValue(multiSelect, selectValue, setLabel) {
25186
+ if (!multiSelect) {
25187
+ return (selectValue === null || selectValue === void 0 ? void 0 : selectValue.label.trim()) || '';
25188
+ }
25189
+
25190
+ var label = setLabel === null || setLabel === void 0 ? void 0 : setLabel(selectValue.length);
25191
+
25192
+ if (label) {
25193
+ return label;
25194
+ }
25195
+
25196
+ if (selectValue.length <= 2) {
25197
+ return selectValue.map(function (pair) {
25198
+ return "".concat(pair.label);
25199
+ }).join(', ');
25200
+ } else {
25201
+ return "".concat(selectValue.length, " Selected");
25202
+ }
25203
+ };
25204
+ var handleKeyDownTrigger = function handleKeyDownTrigger(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem) {
25205
+ switch (event.key) {
25206
+ case 'Enter':
25207
+ event.preventDefault();
25208
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
25209
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(true);
25210
+ break;
25211
+
25212
+ case 'ArrowDown':
25213
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
25214
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(true);
25215
+ break;
25216
+
25217
+ case 'ArrowUp':
25218
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
25219
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(true);
25220
+ break;
25221
+ }
25222
+ };
25223
+ var focusListItem$1 = function focusListItem(position, setFocusedOption, listRef) {
25224
+ var _listRef$current, _listRef$current2, _targetOption, _targetOption2;
25225
+
25226
+ var searchInput = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.querySelectorAll('[data-test="DesignSystem-Select--Input"]');
25227
+ var listItems = (_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
25228
+ var targetOption;
25229
+
25230
+ if (position === 'down') {
25231
+ targetOption = (searchInput === null || searchInput === void 0 ? void 0 : searchInput[0]) || (listItems === null || listItems === void 0 ? void 0 : listItems[0]);
25232
+ } else {
25233
+ targetOption = listItems === null || listItems === void 0 ? void 0 : listItems[listItems.length - 1];
25234
+ }
25235
+
25236
+ (_targetOption = targetOption) === null || _targetOption === void 0 ? void 0 : _targetOption.focus();
25237
+ (_targetOption2 = targetOption) === null || _targetOption2 === void 0 ? void 0 : _targetOption2.scrollIntoView({
25238
+ block: 'center'
25239
+ });
25240
+ setFocusedOption && setFocusedOption(targetOption);
25241
+ };
25242
+ var handleKeyDown$2 = function handleKeyDown(event, focusedOption, setFocusedOption, setHighlightFirstItem, setHighlightLastItem, listRef, withSearch, setOpenPopover, triggerRef) {
25243
+ switch (event.key) {
25244
+ case 'ArrowUp':
25245
+ event.preventDefault();
25246
+ navigateOptions$1('up', focusedOption, setFocusedOption, listRef, withSearch);
25247
+ break;
25248
+
25249
+ case 'ArrowDown':
25250
+ event.preventDefault();
25251
+ navigateOptions$1('down', focusedOption, setFocusedOption, listRef, withSearch);
25252
+ break;
25253
+
25254
+ case 'Enter':
25255
+ handleEnterKey(focusedOption);
25256
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(false);
25257
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(false);
25258
+ break;
25259
+
25260
+ case 'Tab':
25261
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(false);
25262
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(false);
25263
+ break;
25264
+
25265
+ case 'Escape':
25266
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
25267
+ triggerRef.current.focus();
25268
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(undefined);
25269
+ break;
25270
+ }
25271
+ };
25272
+ var handleEnterKey = function handleEnterKey(focusedOption) {
25273
+ focusedOption === null || focusedOption === void 0 ? void 0 : focusedOption.click();
25274
+ };
25275
+ var navigateOptions$1 = function navigateOptions(direction, focusedOption, setFocusedOption, listRef, withSearch) {
25276
+ var listItems = listRef.current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
25277
+ var index = Array.from(listItems).findIndex(function (item) {
25278
+ return item == focusedOption;
25279
+ });
25280
+
25281
+ if (index === -1) {
25282
+ index = direction === 'up' ? listItems.length - 1 : 0;
25283
+ } else if (withSearch && index === 0 && direction === 'up' || withSearch && index === listItems.length - 1 && direction === 'down') {
25284
+ var searchInput = listRef.current.querySelector('[data-test="DesignSystem-Select--Input"]');
25285
+ searchInput.focus();
25286
+ setFocusedOption && setFocusedOption(searchInput);
25287
+ } else {
25288
+ index = direction === 'up' ? (index - 1 + listItems.length) % listItems.length : (index + 1) % listItems.length;
25289
+ var targetOption = listItems[index];
25290
+ targetOption.focus();
25291
+ setFocusedOption && setFocusedOption(targetOption);
25292
+ targetOption.scrollIntoView({
25293
+ block: 'center'
25294
+ });
25295
+ }
25296
+ };
25297
+ var handleInputKeyDown = function handleInputKeyDown(event, listRef, setFocusedOption, setOpenPopover, triggerRef) {
25298
+ var _listRef$current3, _targetOption3, _targetOption4;
25299
+
25300
+ var listItems = (_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 ? void 0 : _listRef$current3.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
25301
+ var targetOption;
25302
+
25303
+ switch (event.key) {
25304
+ case 'ArrowUp':
25305
+ event.preventDefault();
25306
+ targetOption = listItems[listItems.length - 1];
25307
+ break;
25308
+
25309
+ case 'ArrowDown':
25310
+ event.preventDefault();
25311
+ targetOption = listItems[0];
25312
+ break;
25313
+
25314
+ case 'Escape':
25315
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
25316
+ triggerRef.current.focus();
25317
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(undefined);
25318
+ break;
25319
+ }
25320
+
25321
+ (_targetOption3 = targetOption) === null || _targetOption3 === void 0 ? void 0 : _targetOption3.focus();
25322
+ (_targetOption4 = targetOption) === null || _targetOption4 === void 0 ? void 0 : _targetOption4.scrollIntoView({
25323
+ block: 'center'
25324
+ });
25325
+ setFocusedOption && setFocusedOption(targetOption);
25326
+ };
25327
+
25328
+ var _excluded$8 = ["children", "option", "checkedState", "onClick", "withCheckbox", "disabled"];
25329
+ var SelectOption = function SelectOption(props) {
25330
+ var children = props.children,
25331
+ option = props.option,
25332
+ checkedState = props.checkedState,
25333
+ onClick = props.onClick,
25334
+ _props$withCheckbox = props.withCheckbox,
25335
+ withCheckbox = _props$withCheckbox === void 0 ? true : _props$withCheckbox,
25336
+ disabled = props.disabled,
25337
+ rest = _objectWithoutProperties(props, _excluded$8);
25338
+
25339
+ var contextProp = React.useContext(SelectContext);
25340
+ var onOptionClick = contextProp.onOptionClick,
25341
+ selectValue = contextProp.selectValue,
25342
+ setSelectValue = contextProp.setSelectValue,
25343
+ multiSelect = contextProp.multiSelect,
25344
+ setIsOptionSelected = contextProp.setIsOptionSelected,
25345
+ focusedOption = contextProp.focusedOption,
25346
+ setFocusedOption = contextProp.setFocusedOption,
25347
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
25348
+ setHighlightLastItem = contextProp.setHighlightLastItem,
25349
+ listRef = contextProp.listRef,
25350
+ withSearch = contextProp.withSearch,
25351
+ setOpenPopover = contextProp.setOpenPopover,
25352
+ triggerRef = contextProp.triggerRef;
25353
+
25354
+ var onClickHandler = function onClickHandler() {
25355
+ if (disabled) return;
25356
+
25357
+ if (onClick) {
25358
+ onClick(option);
25359
+ return;
25360
+ }
25361
+
25362
+ var newList = multiSelect && Array.isArray(selectValue) ? removeOrAddToList(option, selectValue) : option;
25363
+ setIsOptionSelected === null || setIsOptionSelected === void 0 ? void 0 : setIsOptionSelected(Array.isArray(newList) ? newList.length !== 0 : true);
25364
+ setSelectValue === null || setSelectValue === void 0 ? void 0 : setSelectValue(newList);
25365
+ onOptionClick === null || onOptionClick === void 0 ? void 0 : onOptionClick(newList);
25366
+ };
25367
+
25368
+ var checked = checkedState === 'checked' || elementExist(option, selectValue) !== -1;
25369
+ var indeterminate = checkedState === 'indeterminate';
25370
+
25371
+ var onKeyDownHandler = function onKeyDownHandler(event) {
25372
+ handleKeyDown$2(event, focusedOption, setFocusedOption, setHighlightFirstItem, setHighlightLastItem, listRef, withSearch, setOpenPopover, triggerRef);
25373
+ };
25374
+
25375
+ return /*#__PURE__*/React.createElement(Listbox.Item, _extends$2({
25376
+ role: "option",
25377
+ onClick: onClickHandler,
25378
+ "aria-selected": checked,
25379
+ "aria-label": "option item",
25380
+ onKeyDown: function onKeyDown(event) {
25381
+ return onKeyDownHandler(event);
25382
+ },
25383
+ selected: checked,
25384
+ tabIndex: -1,
25385
+ disabled: disabled,
25386
+ "data-test": "DesignSystem-Select-Option"
25387
+ }, rest), /*#__PURE__*/React.createElement("div", {
25388
+ className: "d-flex align-items-center"
25389
+ }, multiSelect && withCheckbox && /*#__PURE__*/React.createElement(Checkbox, {
25390
+ tabIndex: -1,
25391
+ "aria-checked": indeterminate ? 'mixed' : checked,
25392
+ checked: checked,
25393
+ indeterminate: indeterminate
25394
+ }), /*#__PURE__*/React.createElement("div", {
25395
+ className: multiSelect ? 'Select-trigger-text pt-2' : 'Select-trigger-text'
25396
+ }, children)));
25397
+ };
25398
+ SelectOption.defaultProps = {
25399
+ withCheckbox: true
25400
+ };
25401
+
25402
+ var _excluded$7 = ["triggerSize", "placeholder", "withClearButton", "icon", "disabled", "inlineLabel", "iconType", "onClear", "setLabel"];
25403
+
25404
+ var SelectTrigger = function SelectTrigger(props) {
25405
+ var _classNames, _classNames2;
25406
+
25407
+ var triggerSize = props.triggerSize,
25408
+ placeholder = props.placeholder,
25409
+ withClearButton = props.withClearButton,
25410
+ icon = props.icon,
25411
+ disabled = props.disabled,
25412
+ inlineLabel = props.inlineLabel,
25413
+ iconType = props.iconType,
25414
+ onClear = props.onClear,
25415
+ setLabel = props.setLabel,
25416
+ rest = _objectWithoutProperties(props, _excluded$7);
25417
+
25418
+ var contextProp = React.useContext(SelectContext);
25419
+ var openPopover = contextProp.openPopover,
25420
+ selectValue = contextProp.selectValue,
25421
+ setSelectValue = contextProp.setSelectValue,
25422
+ isOptionSelected = contextProp.isOptionSelected,
25423
+ setIsOptionSelected = contextProp.setIsOptionSelected,
25424
+ multiSelect = contextProp.multiSelect,
25425
+ setOpenPopover = contextProp.setOpenPopover,
25426
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
25427
+ setHighlightLastItem = contextProp.setHighlightLastItem,
25428
+ triggerRef = contextProp.triggerRef;
25429
+ var buttonDisabled = disabled ? 'disabled' : 'default';
25430
+ var trimmedPlaceholder = placeholder === null || placeholder === void 0 ? void 0 : placeholder.trim();
25431
+ var displayValue = computeValue(multiSelect, selectValue, setLabel);
25432
+ var value = isOptionSelected && displayValue.length > 0 ? displayValue : trimmedPlaceholder;
25433
+ var iconName = openPopover ? 'keyboard_arrow_up' : 'keyboard_arrow_down';
25434
+
25435
+ var onClearHandler = function onClearHandler(event) {
25436
+ event.stopPropagation();
25437
+ var emptyValue = multiSelect ? [] : {
25438
+ label: '',
25439
+ value: ''
25440
+ };
25441
+ setSelectValue === null || setSelectValue === void 0 ? void 0 : setSelectValue(emptyValue);
25442
+ setIsOptionSelected === null || setIsOptionSelected === void 0 ? void 0 : setIsOptionSelected(false);
25443
+
25444
+ if (onClear) {
25445
+ onClear(event);
25446
+ }
25447
+ };
25448
+
25449
+ 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));
25450
+ var textClass = classnames((_classNames2 = {}, _defineProperty$1(_classNames2, 'Text', true), _defineProperty$1(_classNames2, 'Text--regular', true), _defineProperty$1(_classNames2, 'Select-trigger-text', true), _classNames2));
25451
+ return /*#__PURE__*/React.createElement("button", _extends$2({
25452
+ ref: triggerRef,
25453
+ onKeyDown: function onKeyDown(event) {
25454
+ return handleKeyDownTrigger(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem);
25455
+ },
25456
+ type: "button",
25457
+ className: buttonClass,
25458
+ disabled: disabled,
25459
+ tabIndex: 0,
25460
+ "aria-haspopup": "listbox",
25461
+ "aria-expanded": openPopover,
25462
+ "aria-label": "trigger",
25463
+ "data-test": "DesignSystem-Select-trigger"
25464
+ }, rest), /*#__PURE__*/React.createElement("div", {
25465
+ className: "Select-trigger-wrapper"
25466
+ }, inlineLabel && /*#__PURE__*/React.createElement(Text, {
25467
+ appearance: "subtle",
25468
+ className: "mr-4 white-space-nowrap"
25469
+ }, "".concat(inlineLabel.trim().charAt(0).toUpperCase()).concat(inlineLabel.trim().slice(1))), icon && !inlineLabel && /*#__PURE__*/React.createElement(Icon, {
25470
+ appearance: buttonDisabled,
25471
+ className: "d-flex align-items-center mr-4",
25472
+ name: icon,
25473
+ type: iconType
25474
+ }), value && /*#__PURE__*/React.createElement("span", {
25475
+ className: textClass
25476
+ }, value)), isOptionSelected && withClearButton && /*#__PURE__*/React.createElement(Icon, {
25477
+ appearance: buttonDisabled,
25478
+ onClick: onClearHandler,
25479
+ className: "align-items-center mr-2 ml-3 Select-crossButton",
25480
+ size: 12,
25481
+ name: "close",
25482
+ "aria-label": "clear selected",
25483
+ type: iconType,
25484
+ "data-test": "DesignSystem-Select--closeIcon"
25485
+ }), /*#__PURE__*/React.createElement(Icon, {
25486
+ appearance: buttonDisabled,
25487
+ name: iconName,
25488
+ type: iconType
25489
+ }));
25490
+ };
25491
+
25492
+ SelectTrigger.defaultProps = {
25493
+ triggerSize: 'regular',
25494
+ placeholder: 'Select',
25495
+ withClearButton: true
25496
+ };
25497
+
25498
+ var _excluded$6 = ["onChange", "onClear"];
25499
+ var SearchInput = function SearchInput(props) {
25500
+ var contextProp = React.useContext(SelectContext);
25501
+ var setWithSearch = contextProp.setWithSearch,
25502
+ maxHeight = contextProp.maxHeight,
25503
+ listRef = contextProp.listRef,
25504
+ setFocusedOption = contextProp.setFocusedOption,
25505
+ setOpenPopover = contextProp.setOpenPopover,
25506
+ triggerRef = contextProp.triggerRef;
25507
+
25508
+ var onChange = props.onChange,
25509
+ onClear = props.onClear,
25510
+ rest = _objectWithoutProperties(props, _excluded$6);
25511
+
25512
+ React.useEffect(function () {
25513
+ setWithSearch === null || setWithSearch === void 0 ? void 0 : setWithSearch(true);
25514
+ }, [maxHeight]);
25515
+
25516
+ var searchHandler = function searchHandler(event) {
25517
+ if (onChange) onChange(event.target.value);
25518
+ };
25519
+
25520
+ var searchClearHandler = function searchClearHandler(event) {
25521
+ if (onClear) onClear(event);
25522
+ };
25523
+
25524
+ return /*#__PURE__*/React.createElement("div", {
25525
+ className: "Select-inputWrapper"
25526
+ }, /*#__PURE__*/React.createElement(Input, _extends$2({}, rest, {
25527
+ icon: 'search',
25528
+ onKeyDown: function onKeyDown(event) {
25529
+ return handleInputKeyDown(event, listRef, setFocusedOption, setOpenPopover, triggerRef);
25530
+ } // TODO(a11y): research more on this.
25531
+ // eslint-disable-next-line jsx-a11y/no-autofocus
25532
+ ,
25533
+ autoFocus: true,
25534
+ onChange: searchHandler,
25535
+ onClear: searchClearHandler,
25536
+ autoComplete: 'off',
25537
+ "aria-label": "Search",
25538
+ "aria-haspopup": "listbox",
25539
+ className: "Select-input",
25540
+ "data-test": "DesignSystem-Select--Input"
25541
+ })));
25542
+ };
25543
+
25544
+ var _excluded$5 = ["title", "description", "children"];
25545
+ var SelectEmptyTemplate = function SelectEmptyTemplate(props) {
25546
+ var contextProp = React.useContext(SelectContext);
25547
+ var maxHeight = contextProp.maxHeight,
25548
+ withSearch = contextProp.withSearch;
25549
+
25550
+ var title = props.title,
25551
+ description = props.description,
25552
+ children = props.children,
25553
+ rest = _objectWithoutProperties(props, _excluded$5);
25554
+
25555
+ var searchInputHeight = 33;
25556
+ var wrapperStyle = {
25557
+ minHeight: withSearch ? maxHeight - searchInputHeight : maxHeight
25558
+ };
25559
+ return /*#__PURE__*/React.createElement("div", _extends$2({
25560
+ className: "px-7 d-flex justify-content-center align-items-center",
25561
+ style: wrapperStyle,
25562
+ "data-test": "DesignSystem-Select-EmptyState--wrapper",
25563
+ "aria-live": "polite",
25564
+ role: "alert"
25565
+ }, rest), /*#__PURE__*/React.createElement("div", {
25566
+ "aria-labelledby": title,
25567
+ "aria-describedby": description,
25568
+ className: "d-flex flex-column justify-content-center align-items-center"
25569
+ }, title && /*#__PURE__*/React.createElement(Text, {
25570
+ id: title,
25571
+ role: "heading",
25572
+ className: "text-align-center mb-3",
25573
+ weight: "strong"
25574
+ }, title), description && /*#__PURE__*/React.createElement(Text, {
25575
+ id: description,
25576
+ className: "text-align-center mb-6",
25577
+ weight: "medium",
25578
+ size: "small",
25579
+ appearance: "subtle"
25580
+ }, description), children && children));
25581
+ };
25582
+
25583
+ var _excluded$4 = ["children"];
25584
+ var SelectFooter = function SelectFooter(props) {
25585
+ var children = props.children,
25586
+ rest = _objectWithoutProperties(props, _excluded$4);
25587
+
25588
+ return /*#__PURE__*/React.createElement("div", _extends$2({
25589
+ className: "Select-buttonWrapper"
25590
+ }, rest), children);
25591
+ };
25592
+
25593
+ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
25594
+ var children = props.children,
25595
+ onSelect = props.onSelect,
25596
+ width = props.width,
25597
+ maxHeight = props.maxHeight,
25598
+ minHeight = props.minHeight,
25599
+ value = props.value,
25600
+ _props$multiSelect = props.multiSelect,
25601
+ multiSelect = _props$multiSelect === void 0 ? false : _props$multiSelect,
25602
+ onOutsideClick = props.onOutsideClick,
25603
+ triggerOptions = props.triggerOptions,
25604
+ popoverWidth = props.popoverWidth;
25605
+
25606
+ var _React$useState = React.useState(false),
25607
+ _React$useState2 = _slicedToArray(_React$useState, 2),
25608
+ openPopover = _React$useState2[0],
25609
+ setOpenPopover = _React$useState2[1];
25610
+
25611
+ var mapValue = mapInitialValue(multiSelect, value);
25612
+
25613
+ var _React$useState3 = React.useState(mapValue),
25614
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
25615
+ selectValue = _React$useState4[0],
25616
+ setSelectValue = _React$useState4[1];
25617
+
25618
+ var _React$useState5 = React.useState(false),
25619
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
25620
+ isOptionSelected = _React$useState6[0],
25621
+ setIsOptionSelected = _React$useState6[1];
25622
+
25623
+ var triggerRef = /*#__PURE__*/React.createRef();
25624
+ var listRef = React.useRef(null);
25625
+
25626
+ var _React$useState7 = React.useState(false),
25627
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
25628
+ withSearch = _React$useState8[0],
25629
+ setWithSearch = _React$useState8[1];
25630
+
25631
+ var _React$useState9 = React.useState(),
25632
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
25633
+ focusedOption = _React$useState10[0],
25634
+ setFocusedOption = _React$useState10[1];
25635
+
25636
+ var _React$useState11 = React.useState(false),
25637
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
25638
+ highlightFirstItem = _React$useState12[0],
25639
+ setHighlightFirstItem = _React$useState12[1];
25640
+
25641
+ var _React$useState13 = React.useState(false),
25642
+ _React$useState14 = _slicedToArray(_React$useState13, 2),
25643
+ highlightLastItem = _React$useState14[0],
25644
+ setHighlightLastItem = _React$useState14[1];
25645
+
25646
+ var triggerStyle = {
25647
+ width: width
25648
+ };
25649
+ var popoverStyle = {
25650
+ width: popoverWidth ? popoverWidth : width
25651
+ };
25652
+ React.useImperativeHandle(ref, function () {
25653
+ return {
25654
+ setOpen: function setOpen(open) {
25655
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(open);
25656
+ },
25657
+ setFocusFirstItem: function setFocusFirstItem() {
25658
+ if (openPopover) {
25659
+ requestAnimationFrame(function () {
25660
+ return focusListItem$1('down', setFocusedOption, listRef);
25661
+ });
25662
+ setHighlightFirstItem(true);
25663
+ }
25664
+ },
25665
+ setFocusLastItem: function setFocusLastItem() {
25666
+ if (openPopover) {
25667
+ requestAnimationFrame(function () {
25668
+ return focusListItem$1('up', setFocusedOption, listRef);
25669
+ });
25670
+ setHighlightLastItem(true);
25671
+ }
25672
+ }
25673
+ };
25674
+ });
25675
+ React.useEffect(function () {
25676
+ if (!openPopover) {
25677
+ setHighlightFirstItem(false);
25678
+ setHighlightLastItem(false);
25679
+ }
25680
+ }, [openPopover]);
25681
+ React.useEffect(function () {
25682
+ if (highlightFirstItem && openPopover) {
25683
+ requestAnimationFrame(function () {
25684
+ return focusListItem$1('down', setFocusedOption, listRef);
25685
+ });
25686
+ }
25687
+ }, [highlightFirstItem]);
25688
+ React.useEffect(function () {
25689
+ if (highlightLastItem && openPopover) {
25690
+ requestAnimationFrame(function () {
25691
+ return focusListItem$1('up', setFocusedOption, listRef);
25692
+ });
25693
+ }
25694
+ }, [highlightLastItem]);
25695
+ React.useEffect(function () {
25696
+ if (value) {
25697
+ setSelectValue(value);
25698
+ setIsOptionSelected(Array.isArray(value) ? value.length > 0 : value.value.trim().length > 0);
25699
+ }
25700
+ }, [value]);
25701
+
25702
+ var onToggleHandler = function onToggleHandler(open) {
25703
+ if (triggerOptions && triggerOptions.disabled) {
25704
+ setOpenPopover(false);
25705
+ } else {
25706
+ setHighlightFirstItem(open);
25707
+ setOpenPopover(open);
25708
+ }
25709
+ };
25710
+
25711
+ var onOptionClick = function onOptionClick(option) {
25712
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(option);
25713
+ !multiSelect && setOpenPopover(false);
25714
+ };
25715
+
25716
+ var onOutsideClickHandler = function onOutsideClickHandler() {
25717
+ onOutsideClick === null || onOutsideClick === void 0 ? void 0 : onOutsideClick();
25718
+ };
25719
+
25720
+ var contextProp = {
25721
+ openPopover: openPopover,
25722
+ setOpenPopover: setOpenPopover,
25723
+ selectValue: selectValue,
25724
+ setSelectValue: setSelectValue,
25725
+ isOptionSelected: isOptionSelected,
25726
+ setIsOptionSelected: setIsOptionSelected,
25727
+ onOptionClick: onOptionClick,
25728
+ maxHeight: maxHeight,
25729
+ minHeight: minHeight,
25730
+ withSearch: withSearch,
25731
+ setWithSearch: setWithSearch,
25732
+ multiSelect: multiSelect,
25733
+ listRef: listRef,
25734
+ triggerRef: triggerRef,
25735
+ focusedOption: focusedOption,
25736
+ setFocusedOption: setFocusedOption,
25737
+ setHighlightFirstItem: setHighlightFirstItem,
25738
+ setHighlightLastItem: setHighlightLastItem
25739
+ };
25740
+ return /*#__PURE__*/React.createElement(SelectContext.Provider, {
25741
+ value: contextProp
25742
+ }, /*#__PURE__*/React.createElement("div", {
25743
+ "data-test": "DesignSystem-Select",
25744
+ "aria-haspopup": "listbox",
25745
+ "aria-expanded": openPopover,
25746
+ style: triggerStyle
25747
+ }, /*#__PURE__*/React.createElement(Popover, {
25748
+ open: openPopover,
25749
+ onToggle: onToggleHandler,
25750
+ className: "mt-3",
25751
+ triggerClass: "d-block",
25752
+ customStyle: popoverStyle,
25753
+ trigger: /*#__PURE__*/React.createElement(SelectTrigger, _extends$2({
25754
+ "aria-controls": "select-listbox"
25755
+ }, triggerOptions))
25756
+ }, /*#__PURE__*/React.createElement(OutsideClick, {
25757
+ onOutsideClick: onOutsideClickHandler
25758
+ }, /*#__PURE__*/React.createElement("div", {
25759
+ role: "listbox",
25760
+ id: "select-listbox",
25761
+ tabIndex: 0,
25762
+ ref: listRef
25763
+ }, children)))));
25764
+ });
25765
+ Select.displayName = 'Select';
25766
+ Select.defaultProps = {
25767
+ maxHeight: 256,
25768
+ width: 176
25769
+ };
25770
+ Select.Option = SelectOption;
25771
+ Select.List = SelectList;
25772
+ Select.SearchInput = SearchInput;
25773
+ Select.EmptyTemplate = SelectEmptyTemplate;
25774
+ Select.Footer = SelectFooter;
25775
+
25776
+ var _excluded$3 = ["label", "children", "showDivider"];
25777
+ var MenuGroup = function MenuGroup(props) {
25778
+ var label = props.label,
25779
+ children = props.children,
25780
+ showDivider = props.showDivider,
25781
+ rest = _objectWithoutProperties(props, _excluded$3);
25782
+
25783
+ if (label) {
25784
+ return /*#__PURE__*/React__default.createElement("div", _extends$2({
25785
+ "data-test": "DesignSystem-Menu-Group",
25786
+ role: "group",
25787
+ className: "Menu-Group"
25788
+ }, rest), /*#__PURE__*/React__default.createElement(Text, {
25789
+ "data-test": "DesignSystem-Menu-Group-Label",
25790
+ size: "small",
25791
+ weight: "medium",
25792
+ appearance: "subtle",
25793
+ className: "Menu-Group-Label"
25794
+ }, label), children);
25795
+ }
25796
+
25797
+ return /*#__PURE__*/React__default.createElement("div", _extends$2({
25798
+ "data-test": "DesignSystem-Menu-Group",
25799
+ role: "group"
25800
+ }, rest), children, showDivider && /*#__PURE__*/React__default.createElement(Divider, {
25801
+ className: "my-3"
25802
+ }));
25803
+ };
25804
+ MenuGroup.defaultProps = {
25805
+ showDivider: true
25806
+ };
25807
+
25808
+ var MenuContext = /*#__PURE__*/React.createContext({});
25809
+
25810
+ var handleKeyDown$1 = function handleKeyDown(event, focusedOption, setFocusedOption, setOpenPopover, menuTriggerRef, listRef, subListRef, isSubMenuTrigger, triggerRef, menuID, triggerID, parentListRef) {
25811
+ switch (event.key) {
25812
+ case 'ArrowUp':
25813
+ event.preventDefault();
25814
+ navigateOptions('up', focusedOption, setFocusedOption, listRef);
25815
+ break;
25816
+
25817
+ case 'ArrowDown':
25818
+ event.preventDefault();
25819
+ navigateOptions('down', focusedOption, setFocusedOption, listRef);
25820
+ break;
25821
+
25822
+ case 'Enter':
25823
+ focusedOption === null || focusedOption === void 0 ? void 0 : focusedOption.click();
25824
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
25825
+ break;
25826
+
25827
+ case 'Escape':
25828
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
25829
+
25830
+ if (triggerRef && !isSubMenuTrigger) {
25831
+ var _triggerRef$current;
25832
+
25833
+ triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
25834
+ } else {
25835
+ var _menuTriggerRef$curre;
25836
+
25837
+ menuTriggerRef === null || menuTriggerRef === void 0 ? void 0 : (_menuTriggerRef$curre = menuTriggerRef.current) === null || _menuTriggerRef$curre === void 0 ? void 0 : _menuTriggerRef$curre.focus();
25838
+ }
25839
+
25840
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(undefined);
25841
+ break;
25842
+
25843
+ case 'Tab':
25844
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
25845
+ break;
25846
+
25847
+ case 'ArrowRight':
25848
+ navigateSubMenu(isSubMenuTrigger, 'right', subListRef, menuID, triggerID, parentListRef);
25849
+ break;
25850
+
25851
+ case 'ArrowLeft':
25852
+ navigateSubMenu(isSubMenuTrigger, 'left', subListRef, menuID, triggerID, parentListRef);
25853
+ break;
25854
+ }
25855
+ };
25856
+
25857
+ var navigateOptions = function navigateOptions(direction, focusedOption, setFocusedOption, listRef) {
25858
+ var _listRef$current, _targetOption$scrollI;
25859
+
25860
+ var listItems = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
25861
+ var index = Array.from(listItems).findIndex(function (item) {
25862
+ return item == focusedOption;
25863
+ });
25864
+
25865
+ if (index === -1) {
25866
+ index = direction === 'up' ? listItems.length - 1 : 0;
25867
+ } else {
25868
+ index = direction === 'up' ? (index - 1 + listItems.length) % listItems.length : (index + 1) % listItems.length;
25869
+ }
25870
+
25871
+ var targetOption = listItems[index];
25872
+ targetOption.focus();
25873
+ setFocusedOption && setFocusedOption(targetOption);
25874
+ targetOption === null || targetOption === void 0 ? void 0 : (_targetOption$scrollI = targetOption.scrollIntoView) === null || _targetOption$scrollI === void 0 ? void 0 : _targetOption$scrollI.call(targetOption, {
25875
+ block: 'center'
25876
+ });
25877
+ };
25878
+
25879
+ var navigateSubMenu = function navigateSubMenu(isSubMenuTrigger, direction, subListRef, menuID, triggerID, parentListRef) {
25880
+ var element = document.querySelector("[data-name=\"".concat(menuID, "\"]"));
25881
+ var menuPlacement = element === null || element === void 0 ? void 0 : element.getAttribute('data-placement');
25882
+
25883
+ if (isSubMenuTrigger) {
25884
+ if (direction === 'right' && menuPlacement !== null && menuPlacement !== void 0 && menuPlacement.includes('right') || direction === 'left' && menuPlacement !== null && menuPlacement !== void 0 && menuPlacement.includes('left')) {
25885
+ var _subListRef$current;
25886
+
25887
+ var listItems = subListRef === null || subListRef === void 0 ? void 0 : (_subListRef$current = subListRef.current) === null || _subListRef$current === void 0 ? void 0 : _subListRef$current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
25888
+ (listItems === null || listItems === void 0 ? void 0 : listItems[0]).focus();
25889
+ }
25890
+ } else if (direction === 'left' && menuPlacement !== null && menuPlacement !== void 0 && menuPlacement.includes('right') || direction === 'right' && menuPlacement !== null && menuPlacement !== void 0 && menuPlacement.includes('left')) {
25891
+ var _parentListRef$curren, _parentListRef$curren2;
25892
+
25893
+ var triggerElement = parentListRef === null || parentListRef === void 0 ? void 0 : (_parentListRef$curren = parentListRef.current) === null || _parentListRef$curren === void 0 ? void 0 : (_parentListRef$curren2 = _parentListRef$curren.querySelector("#".concat(triggerID))) === null || _parentListRef$curren2 === void 0 ? void 0 : _parentListRef$curren2.firstChild;
25894
+ triggerElement === null || triggerElement === void 0 ? void 0 : triggerElement.focus();
25895
+ }
25896
+ };
25897
+
25898
+ var SubMenuContext = /*#__PURE__*/React.createContext({});
25899
+
25900
+ var _excluded$2 = ["children", "className", "onClick", "disabled"];
25901
+ var MenuItem = function MenuItem(props) {
25902
+ var children = props.children,
25903
+ className = props.className,
25904
+ onClick = props.onClick,
25905
+ disabled = props.disabled,
25906
+ rest = _objectWithoutProperties(props, _excluded$2);
25907
+
25908
+ var contextProp = React__default.useContext(MenuContext);
25909
+ var subMenuContextProp = React__default.useContext(SubMenuContext);
25910
+ var isSubMenuTrigger = false;
25911
+ var subListRef = null;
25912
+ var triggerRef = subMenuContextProp.triggerRef,
25913
+ menuID = subMenuContextProp.menuID,
25914
+ setParentOpen = subMenuContextProp.setParentOpen,
25915
+ triggerID = subMenuContextProp.triggerID,
25916
+ parentListRef = subMenuContextProp.parentListRef;
25917
+ var setOpenPopover = contextProp.setOpenPopover,
25918
+ focusedOption = contextProp.focusedOption,
25919
+ setFocusedOption = contextProp.setFocusedOption,
25920
+ menuTriggerRef = contextProp.menuTriggerRef,
25921
+ listRef = contextProp.listRef;
25922
+ var MenuItemClassName = classnames({
25923
+ 'Menu-Item': true
25924
+ }, className);
25925
+ React__default.useEffect(function () {
25926
+ var _parentListRef$curren, _parentListRef$curren2;
25927
+
25928
+ var handlePopoverOpen = function handlePopoverOpen() {
25929
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
25930
+ };
25931
+
25932
+ var handlePopoverClose = function handlePopoverClose() {
25933
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
25934
+ };
25935
+
25936
+ var triggerElement = parentListRef === null || parentListRef === void 0 ? void 0 : (_parentListRef$curren = parentListRef.current) === null || _parentListRef$curren === void 0 ? void 0 : (_parentListRef$curren2 = _parentListRef$curren.querySelector("#".concat(triggerID))) === null || _parentListRef$curren2 === void 0 ? void 0 : _parentListRef$curren2.firstChild;
25937
+ triggerElement === null || triggerElement === void 0 ? void 0 : triggerElement.addEventListener('focus', handlePopoverOpen);
25938
+ triggerElement === null || triggerElement === void 0 ? void 0 : triggerElement.addEventListener('blur', handlePopoverClose);
25939
+ return function () {
25940
+ triggerElement === null || triggerElement === void 0 ? void 0 : triggerElement.removeEventListener('focus', handlePopoverOpen);
25941
+ triggerElement === null || triggerElement === void 0 ? void 0 : triggerElement.removeEventListener('blur', handlePopoverClose);
25942
+ };
25943
+ }, [triggerID]);
25944
+
25945
+ var onFocusHandler = function onFocusHandler(event) {
25946
+ setFocusedOption === null || setFocusedOption === void 0 ? void 0 : setFocusedOption(event.target);
25947
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
25948
+ };
25949
+
25950
+ var onKeyDownHandler = function onKeyDownHandler(event) {
25951
+ handleKeyDown$1(event, focusedOption, setFocusedOption, setOpenPopover, menuTriggerRef, listRef, subListRef, isSubMenuTrigger, triggerRef, menuID, triggerID, parentListRef);
25952
+ };
25953
+
25954
+ var onClickHandler = function onClickHandler(event) {
25955
+ if (disabled) {
25956
+ return;
25957
+ }
25958
+
25959
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
25960
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
25961
+ setParentOpen === null || setParentOpen === void 0 ? void 0 : setParentOpen(false);
25962
+ };
25963
+
25964
+ return /*#__PURE__*/React__default.createElement(Listbox.Item, _extends$2({
25965
+ "data-test": "DesignSystem-Menu-ListItem",
25966
+ className: MenuItemClassName,
25967
+ tabIndex: -1,
25968
+ onKeyDown: onKeyDownHandler,
25969
+ onFocus: onFocusHandler,
25970
+ onClick: onClickHandler,
25971
+ disabled: disabled,
25972
+ role: "menuitem",
25973
+ "aria-disabled": disabled
25974
+ }, rest), children);
25975
+ };
25976
+ MenuItem.displayName = 'MenuItem';
25977
+ MenuItem.defaultProps = {
25978
+ tagName: 'a'
25979
+ };
25980
+
25981
+ var _excluded$1 = ["children"];
25982
+ var MenuList = function MenuList(props) {
25983
+ var children = props.children,
25984
+ rest = _objectWithoutProperties(props, _excluded$1);
25985
+
25986
+ return /*#__PURE__*/React__default.createElement(Listbox, _extends$2({
25987
+ "data-test": "DesignSystem-Menu-List"
25988
+ }, rest), children);
25989
+ };
25990
+ MenuList.defaultProps = {
25991
+ type: 'option',
25992
+ showDivider: false,
25993
+ tagName: 'nav',
25994
+ size: 'compressed'
25995
+ };
25996
+
25997
+ var handleKeyDown = function handleKeyDown(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem) {
25998
+ switch (event.key) {
25999
+ case 'ArrowUp':
26000
+ event.preventDefault();
26001
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
26002
+ setHighlightLastItem === null || setHighlightLastItem === void 0 ? void 0 : setHighlightLastItem(true);
26003
+ break;
26004
+
26005
+ case 'ArrowDown':
26006
+ event.preventDefault();
26007
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(true);
26008
+ setHighlightFirstItem === null || setHighlightFirstItem === void 0 ? void 0 : setHighlightFirstItem(true);
26009
+ break;
26010
+
26011
+ case 'Escape':
26012
+ case 'Tab':
26013
+ setOpenPopover === null || setOpenPopover === void 0 ? void 0 : setOpenPopover(false);
26014
+ break;
26015
+ }
26016
+ };
26017
+ var focusListItem = function focusListItem(position, setFocusedOption, listRef) {
26018
+ var _listRef$current, _targetOption;
26019
+
26020
+ var listItems = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.querySelectorAll('[data-test="DesignSystem-Listbox-ItemWrapper"]');
26021
+ var targetOption;
26022
+
26023
+ if (position === 'down') {
26024
+ targetOption = listItems === null || listItems === void 0 ? void 0 : listItems[0];
26025
+ } else {
26026
+ targetOption = listItems === null || listItems === void 0 ? void 0 : listItems[listItems.length - 1];
26027
+ }
26028
+
26029
+ (_targetOption = targetOption) === null || _targetOption === void 0 ? void 0 : _targetOption.focus();
26030
+
26031
+ if (targetOption && typeof targetOption.scrollIntoView === 'function') {
26032
+ var _targetOption2;
26033
+
26034
+ (_targetOption2 = targetOption) === null || _targetOption2 === void 0 ? void 0 : _targetOption2.scrollIntoView({
26035
+ block: 'end'
26036
+ });
26037
+ }
26038
+
26039
+ setFocusedOption && setFocusedOption(targetOption);
26040
+ };
26041
+
26042
+ var MenuTrigger = function MenuTrigger(props) {
26043
+ var className = props.className;
26044
+ var contextProp = React__default.useContext(MenuContext);
26045
+ var openPopover = contextProp.openPopover,
26046
+ setOpenPopover = contextProp.setOpenPopover,
26047
+ setHighlightFirstItem = contextProp.setHighlightFirstItem,
26048
+ setHighlightLastItem = contextProp.setHighlightLastItem,
26049
+ menuTriggerRef = contextProp.menuTriggerRef;
26050
+ var triggerClassName = classnames({
26051
+ 'Menu-Trigger--active': openPopover
26052
+ }, className);
26053
+
26054
+ var onKeyDownHandler = function onKeyDownHandler(event) {
26055
+ handleKeyDown(event, setOpenPopover, setHighlightFirstItem, setHighlightLastItem);
26056
+ };
26057
+
26058
+ return /*#__PURE__*/React__default.createElement(Button, _extends$2({
26059
+ "data-test": "DesignSystem-Menu-Trigger",
26060
+ icon: "more_horiz",
26061
+ ref: menuTriggerRef,
26062
+ "aria-label": "Open menu",
26063
+ "aria-haspopup": true,
26064
+ "aria-expanded": openPopover
26065
+ }, props, {
26066
+ className: triggerClassName,
26067
+ onKeyDown: onKeyDownHandler
26068
+ }));
26069
+ };
26070
+
26071
+ var SubMenu = function SubMenu(props) {
26072
+ var children = props.children;
26073
+ var menuID = "DesignSystem-Menu--Popover-".concat(uidGenerator());
26074
+ var triggerID = "DesignSystem-Menu--Trigger-".concat(uidGenerator());
26075
+
26076
+ var _React$Children$toArr = React__default.Children.toArray(children),
26077
+ _React$Children$toArr2 = _slicedToArray(_React$Children$toArr, 2),
26078
+ submenuTrigger = _React$Children$toArr2[0],
26079
+ submenuContent = _React$Children$toArr2[1];
26080
+
26081
+ var contextProp = React__default.useContext(MenuContext);
26082
+ var subListRef = React__default.useRef(null);
26083
+ var triggerRef = React__default.useRef(null);
26084
+ var isSubMenuTrigger = true;
26085
+ var subMenuElement = /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
26086
+ var setOpenPopover = contextProp.setOpenPopover,
26087
+ focusedOption = contextProp.focusedOption,
26088
+ setFocusedOption = contextProp.setFocusedOption,
26089
+ menuTriggerRef = contextProp.menuTriggerRef,
26090
+ listRef = contextProp.listRef;
26091
+
26092
+ var onKeyDownHandler = function onKeyDownHandler(event) {
26093
+ handleKeyDown$1(event, focusedOption, setFocusedOption, setOpenPopover, menuTriggerRef, listRef, subListRef, isSubMenuTrigger, triggerRef, menuID);
26094
+ };
26095
+
26096
+ var subMenuContextProp = {
26097
+ triggerRef: triggerRef,
26098
+ menuID: menuID,
26099
+ setParentOpen: setOpenPopover,
26100
+ parentListRef: listRef,
26101
+ triggerID: triggerID
26102
+ };
26103
+ var triggerElement = /*#__PURE__*/React__default.cloneElement(submenuTrigger, _objectSpread2(_objectSpread2({}, submenuTrigger === null || submenuTrigger === void 0 ? void 0 : submenuTrigger.props), {}, {
26104
+ onKeyDown: onKeyDownHandler,
26105
+ ref: triggerRef,
26106
+ 'aria-haspopup': 'menu',
26107
+ 'aria-expanded': subListRef.current ? 'true' : 'false',
26108
+ 'aria-controls': menuID,
26109
+ id: triggerID
26110
+ }));
26111
+
26112
+ if ( /*#__PURE__*/React__default.isValidElement(submenuContent)) {
26113
+ var _submenuContent$props = submenuContent === null || submenuContent === void 0 ? void 0 : submenuContent.props,
26114
+ on = _submenuContent$props.on,
26115
+ _children = _submenuContent$props.children;
26116
+
26117
+ subMenuElement = /*#__PURE__*/React__default.cloneElement(submenuContent, _objectSpread2(_objectSpread2({}, submenuContent.props), {}, {
26118
+ on: on || 'hover',
26119
+ offset: 'small',
26120
+ children: /*#__PURE__*/React__default.createElement("div", {
26121
+ ref: subListRef
26122
+ }, _children),
26123
+ trigger: triggerElement
26124
+ }));
26125
+ }
26126
+
26127
+ return /*#__PURE__*/React__default.createElement(SubMenuContext.Provider, {
26128
+ value: subMenuContextProp
26129
+ }, subMenuElement);
26130
+ };
26131
+
26132
+ var _excluded = ["children", "width", "minHeight", "maxHeight", "className", "open"];
26133
+ var Menu = function Menu(props) {
26134
+ var children = props.children,
26135
+ width = props.width,
26136
+ minHeight = props.minHeight,
26137
+ maxHeight = props.maxHeight,
26138
+ className = props.className,
26139
+ open = props.open,
26140
+ rest = _objectWithoutProperties(props, _excluded);
26141
+
26142
+ var _React$useState = React__default.useState(open),
26143
+ _React$useState2 = _slicedToArray(_React$useState, 2),
26144
+ openPopover = _React$useState2[0],
26145
+ setOpenPopover = _React$useState2[1];
26146
+
26147
+ var _React$useState3 = React__default.useState(false),
26148
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
26149
+ highlightFirstItem = _React$useState4[0],
26150
+ setHighlightFirstItem = _React$useState4[1];
26151
+
26152
+ var _React$useState5 = React__default.useState(false),
26153
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
26154
+ highlightLastItem = _React$useState6[0],
26155
+ setHighlightLastItem = _React$useState6[1];
26156
+
26157
+ var _React$useState7 = React__default.useState(),
26158
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
26159
+ focusedOption = _React$useState8[0],
26160
+ setFocusedOption = _React$useState8[1];
26161
+
26162
+ var listRef = /*#__PURE__*/React__default.createRef();
26163
+ var menuTriggerRef = React__default.useRef(null);
26164
+ var subMenuContextProp = React__default.useContext(SubMenuContext);
26165
+ var menuID = subMenuContextProp.menuID;
26166
+ var popoverClassName = classnames(_defineProperty$1({}, 'Menu', true), className);
26167
+ React__default.useEffect(function () {
26168
+ setOpenPopover(open);
26169
+ }, [open]);
26170
+ React__default.useEffect(function () {
26171
+ if (highlightFirstItem && openPopover) {
26172
+ requestAnimationFrame(function () {
26173
+ return focusListItem('down', setFocusedOption, listRef);
26174
+ });
26175
+ }
26176
+ }, [highlightFirstItem]);
26177
+ React__default.useEffect(function () {
26178
+ if (highlightLastItem && openPopover) {
26179
+ requestAnimationFrame(function () {
26180
+ return focusListItem('up', setFocusedOption, listRef);
26181
+ });
26182
+ }
26183
+ }, [highlightLastItem]);
26184
+ React__default.useEffect(function () {
26185
+ if (!openPopover) {
26186
+ setHighlightFirstItem(false);
26187
+ setHighlightLastItem(false);
26188
+ }
26189
+ }, [openPopover]);
26190
+
26191
+ var onToggleHandler = function onToggleHandler(open) {
26192
+ setOpenPopover(open);
26193
+ };
26194
+
26195
+ var contextProp = {
26196
+ openPopover: openPopover,
26197
+ setOpenPopover: setOpenPopover,
26198
+ setHighlightFirstItem: setHighlightFirstItem,
26199
+ setHighlightLastItem: setHighlightLastItem,
26200
+ focusedOption: focusedOption,
26201
+ setFocusedOption: setFocusedOption,
26202
+ menuTriggerRef: menuTriggerRef,
26203
+ listRef: listRef
26204
+ };
26205
+ return /*#__PURE__*/React__default.createElement(MenuContext.Provider, {
26206
+ value: contextProp
26207
+ }, /*#__PURE__*/React__default.createElement(Popover, _extends$2({
26208
+ "data-test": "DesignSystem-Menu",
26209
+ name: menuID,
26210
+ offset: "medium"
26211
+ }, rest, {
26212
+ open: openPopover,
26213
+ customStyle: {
26214
+ width: width
26215
+ },
26216
+ onToggle: onToggleHandler
26217
+ }), /*#__PURE__*/React__default.createElement("div", {
26218
+ ref: listRef,
26219
+ role: "menu",
26220
+ "data-test": props['data-test'] || 'DesignSystem-Menu-Wrapper',
26221
+ className: popoverClassName,
26222
+ style: {
26223
+ maxHeight: maxHeight,
26224
+ minHeight: minHeight
26225
+ }
26226
+ }, children)));
26227
+ };
26228
+ Menu.Group = MenuGroup;
26229
+ Menu.Item = MenuItem;
26230
+ Menu.List = MenuList;
26231
+ Menu.Trigger = MenuTrigger;
26232
+ Menu.SubMenu = SubMenu;
26233
+ Menu.defaultProps = {
26234
+ width: 176,
26235
+ maxHeight: 256,
26236
+ position: 'bottom-start'
26237
+ };
26238
+
26239
+ var version = "2.30.0";
23613
26240
 
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 };
26241
+ 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, Menu, 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 };