@qualtrics/ui-react 2.18.0 → 2.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/__shared/cjs/{index-00992312.js → index-384184bd.js} +994 -1872
  3. package/dist/__shared/cjs/{index-615ed9b2.js → index-4a5425cc.js} +10 -7
  4. package/dist/components/Accordion/Accordion.js +1 -5
  5. package/dist/components/Accordion/Accordion2.js +3 -3
  6. package/dist/components/Accordion/AccordionHeader.js +4 -8
  7. package/dist/components/Accordion/AccordionPanel.js +3 -3
  8. package/dist/components/BreakpointSwitch/Breakpoint.js +0 -2
  9. package/dist/components/BreakpointSwitch/BreakpointSwitch.js +0 -3
  10. package/dist/components/Button/Button.js +3 -3
  11. package/dist/components/Button/Button2.js +2 -7
  12. package/dist/components/ButtonGroup/ButtonGroup.js +1 -2
  13. package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
  14. package/dist/components/Checkbox/Checkbox.js +11 -11
  15. package/dist/components/Checkbox/Checkbox2.js +3 -3
  16. package/dist/components/Checkbox/VisualCheckbox.js +1 -1
  17. package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
  18. package/dist/components/ColorPicker/Alpha.js +9 -30
  19. package/dist/components/ColorPicker/ColorPicker.js +33 -42
  20. package/dist/components/ColorPicker/ColorPicker2.js +3 -3
  21. package/dist/components/ColorPicker/ColorPickerFlyout.js +2 -1
  22. package/dist/components/ColorPicker/ColorPickerFlyoutInputs.js +20 -23
  23. package/dist/components/ColorPicker/Hue.js +2 -19
  24. package/dist/components/ColorPicker/Palette.js +7 -27
  25. package/dist/components/ColorPicker/Saturation.js +8 -29
  26. package/dist/components/ColorPicker/utils/calculateTargetId.js +10 -20
  27. package/dist/components/ColorPicker/utils/getMousePosition.js +4 -3
  28. package/dist/components/ColorPicker/utils/hexToHsv.js +0 -5
  29. package/dist/components/ColorPicker/utils/hexToRgbaString.js +2 -4
  30. package/dist/components/ColorPicker/utils/hsvToHex.js +0 -3
  31. package/dist/components/ColorPicker/utils/rgbToHex.js +1 -1
  32. package/dist/components/ColorPicker/utils/validateHex.js +12 -19
  33. package/dist/components/Combobox/Combobox.js +57 -127
  34. package/dist/components/Combobox/Combobox2.js +3 -3
  35. package/dist/components/Combobox/ComboboxHeader.js +1 -1
  36. package/dist/components/Combobox/ComboboxIcon.js +2 -4
  37. package/dist/components/Combobox/ComboboxInput.js +4 -5
  38. package/dist/components/Combobox/ComboboxList.js +2 -2
  39. package/dist/components/ConfigPane/ConfigPane.js +0 -7
  40. package/dist/components/ConfigPane/ConfigPane2.js +3 -3
  41. package/dist/components/Divider/Divider2.js +3 -3
  42. package/dist/components/Dropdown/ChildIndexContext/index.js +0 -1
  43. package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +34 -30
  44. package/dist/components/Dropdown/Dropdown.js +17 -68
  45. package/dist/components/Dropdown/Dropdown2.js +3 -3
  46. package/dist/components/Dropdown/DropdownButton.js +23 -33
  47. package/dist/components/Dropdown/DropdownHeader.js +2 -1
  48. package/dist/components/Dropdown/DropdownList.js +8 -7
  49. package/dist/components/Dropdown/DropdownOption.js +3 -10
  50. package/dist/components/Dropdown/DropdownSearch.js +6 -24
  51. package/dist/components/FilePicker/FilePicker.js +15 -26
  52. package/dist/components/FilePicker/FilePicker2.js +3 -3
  53. package/dist/components/FormField/Caption.js +3 -3
  54. package/dist/components/FormField/FormField.js +2 -2
  55. package/dist/components/FormField/FormField2.js +3 -3
  56. package/dist/components/FormField/FormFieldContext.js +3 -6
  57. package/dist/components/FormField/ReadOnlyText.js +2 -1
  58. package/dist/components/FullScreenTakeover/FullScreenTakeover.js +5 -11
  59. package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
  60. package/dist/components/Icon/Icon.js +3 -6
  61. package/dist/components/Icon/IconTypes.js +1 -0
  62. package/dist/components/IconButton/IconButton.js +1 -6
  63. package/dist/components/IconButton/IconButton2.js +3 -3
  64. package/dist/components/InlineInput/InlineInput.js +16 -33
  65. package/dist/components/InlineInput/InlineInput2.js +3 -3
  66. package/dist/components/Input/Input.js +3 -2
  67. package/dist/components/Input/Input2.js +3 -3
  68. package/dist/components/Input/InputField.js +2 -5
  69. package/dist/components/InputGroup/InputGroup2.js +3 -3
  70. package/dist/components/InputGroup/InputGroupProvider.js +0 -2
  71. package/dist/components/Label/Label2.js +3 -3
  72. package/dist/components/Link/Link2.js +3 -3
  73. package/dist/components/LoadingSpinner/LoadingSpinner.js +1 -1
  74. package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
  75. package/dist/components/LogicEditor/ConditionContainer.js +0 -2
  76. package/dist/components/LogicEditor/ConditionSet.js +8 -25
  77. package/dist/components/LogicEditor/Controls.js +2 -2
  78. package/dist/components/LogicEditor/LogicEditor.js +3 -12
  79. package/dist/components/LogicEditor/LogicEditor2.js +3 -3
  80. package/dist/components/LogicEditor/utils.js +9 -34
  81. package/dist/components/Modal/Modal.js +22 -35
  82. package/dist/components/Modal/Modal2.js +3 -3
  83. package/dist/components/NewMenu/BaseMenu.js +43 -108
  84. package/dist/components/NewMenu/NewMenu.js +3 -3
  85. package/dist/components/NewMenu/SelectMenu/SelectMenu.js +2 -3
  86. package/dist/components/NewMenu/parts/ArrowNav/ArrowNav.js +20 -32
  87. package/dist/components/NewMenu/parts/MenuItem.js +2 -3
  88. package/dist/components/NewMenu/parts/MenuSearchBox.js +2 -1
  89. package/dist/components/NumberStepper/NumberStepper.js +29 -44
  90. package/dist/components/NumberStepper/NumberStepper2.js +3 -3
  91. package/dist/components/NumberStepper/NumberStepperDecrement.js +6 -5
  92. package/dist/components/NumberStepper/NumberStepperIncrement.js +6 -5
  93. package/dist/components/NumberStepper/NumberStepperInput.js +10 -12
  94. package/dist/components/PageLayout/PageLayout.js +3 -3
  95. package/dist/components/Pagination/Pagination.js +10 -6
  96. package/dist/components/Pagination/Pagination2.js +3 -3
  97. package/dist/components/Pagination/PaginationNextButton.js +8 -8
  98. package/dist/components/Pagination/PaginationPageInput.js +17 -22
  99. package/dist/components/Pagination/PaginationPreviousButton.js +8 -8
  100. package/dist/components/Popover/Popover.js +9 -18
  101. package/dist/components/Popover/Popover2.js +3 -3
  102. package/dist/components/QuickSearch/QuickSearch.js +3 -5
  103. package/dist/components/QuickSearch/QuickSearch2.js +3 -3
  104. package/dist/components/QuickSearch/QuickSearchInput.js +6 -23
  105. package/dist/components/Radio/Radio.js +11 -13
  106. package/dist/components/Radio/Radio2.js +3 -3
  107. package/dist/components/SearchInput/SearchInput.js +5 -11
  108. package/dist/components/SearchInput/SearchInput2.js +3 -3
  109. package/dist/components/SidebarNav/ExpandCollapseButton.js +0 -2
  110. package/dist/components/SidebarNav/SidebarNav.js +5 -4
  111. package/dist/components/SidebarNav/SidebarNav2.js +3 -3
  112. package/dist/components/SidebarNav/SidebarNavLink.js +1 -4
  113. package/dist/components/Slider/RangeSlider.js +8 -22
  114. package/dist/components/Slider/Slider.js +7 -26
  115. package/dist/components/Slider/Slider2.js +3 -3
  116. package/dist/components/Slider/SliderButton.js +7 -9
  117. package/dist/components/Switch/Switch.js +11 -11
  118. package/dist/components/Switch/Switch2.js +3 -3
  119. package/dist/components/Table/Table2.js +3 -3
  120. package/dist/components/Tabs/Tab.js +3 -3
  121. package/dist/components/Tabs/TabContextProvider.js +1 -1
  122. package/dist/components/Tabs/TabList.js +9 -17
  123. package/dist/components/Tabs/TabPanel.js +3 -3
  124. package/dist/components/Tabs/TabPanels.js +0 -2
  125. package/dist/components/Tabs/Tabs2.js +3 -3
  126. package/dist/components/Tooltip/Tooltip.js +12 -41
  127. package/dist/components/Tooltip/Tooltip2.js +3 -3
  128. package/dist/components/UIProvider/PortalTargetContext.js +0 -1
  129. package/dist/components/UIProvider/UIProvider.js +2 -2
  130. package/dist/components/deprecated_ColorPicker/Alpha.js +4 -11
  131. package/dist/components/deprecated_ColorPicker/Color.js +9 -66
  132. package/dist/components/deprecated_ColorPicker/ColorPicker.js +2 -8
  133. package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
  134. package/dist/components/deprecated_ColorPicker/HexInput.js +1 -7
  135. package/dist/components/deprecated_ColorPicker/Hue.js +3 -10
  136. package/dist/components/deprecated_ColorPicker/Saturation.js +7 -14
  137. package/dist/components/deprecated_ColorPicker/Swatch.js +2 -6
  138. package/dist/components/deprecated_ColorPicker/useMouseDrag.js +0 -3
  139. package/dist/components/deprecated_NumberStepper/NumberStepper.js +14 -20
  140. package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
  141. package/dist/components/deprecated_NumberStepper/NumberStepperDecrement.js +7 -6
  142. package/dist/components/deprecated_NumberStepper/NumberStepperIncrement.js +7 -6
  143. package/dist/components/deprecated_NumberStepper/NumberStepperInput.js +16 -17
  144. package/dist/components/deprecated_Tabs/Tabs.js +9 -25
  145. package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
  146. package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
  147. package/dist/components/deprecated_Toolbar/ToolbarPanel.js +3 -3
  148. package/dist/components/deprecated_Toolbar/ToolbarPanels.js +3 -17
  149. package/dist/components/deprecated_Toolbar/ToolbarTab.js +10 -26
  150. package/dist/components/deprecated_Toolbar/ToolbarTabs.js +6 -18
  151. package/dist/hooks/useBreakpoints/useBreakpoints.js +3 -4
  152. package/dist/hooks/useClickOutside/useClickOutside.js +2 -7
  153. package/dist/hooks/useClickOutsidePortals/useClickOutsidePortals.js +3 -6
  154. package/dist/hooks/useControllableState/useControllableState.js +5 -10
  155. package/dist/hooks/useDidUpdate/useDidUpdate.js +2 -4
  156. package/dist/hooks/useEventCallback/useEventCallback.js +2 -1
  157. package/dist/hooks/useEventListener/useEventListener.js +1 -4
  158. package/dist/hooks/useFocusSequence/useFocusSequence.js +10 -17
  159. package/dist/hooks/useId/useId.js +1 -2
  160. package/dist/hooks/useIsFocused/useIsFocused.js +0 -1
  161. package/dist/hooks/useIsHovered/useIsHovered.js +0 -1
  162. package/dist/hooks/useIsTruncated/useIsTruncated.js +4 -3
  163. package/dist/hooks/useLatest/useLatest.js +0 -1
  164. package/dist/hooks/useMounted/useMounted.js +0 -1
  165. package/dist/hooks/useMouseDrag/useMouseDrag.js +0 -4
  166. package/dist/hooks/useOverlay/useOverlay.js +4 -10
  167. package/dist/hooks/useOverlay/useOverlay2.js +3 -3
  168. package/dist/hooks/usePrevious/usePrevious.js +0 -1
  169. package/dist/hooks/useResponsiveValue/useResponsiveValue.js +1 -4
  170. package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement.js +11 -16
  171. package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
  172. package/dist/icons/Icon.js +3 -3
  173. package/dist/icons/components/HeadsetIcon.js +6 -0
  174. package/dist/icons/components/PauseCircleIcon.js +1 -1
  175. package/dist/icons/createIconComponent.js +2 -3
  176. package/dist/icons/index.d.ts +2 -0
  177. package/dist/icons/index.es.js +1 -0
  178. package/dist/icons/index.js +2 -1
  179. package/dist/index.d.ts +1 -0
  180. package/dist/index.es.js +4 -3
  181. package/dist/index.js +6 -5
  182. package/dist/next/AdvancedTable/AdvancedTable.js +82 -188
  183. package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
  184. package/dist/next/AdvancedTable/AdvancedTableCell.js +4 -14
  185. package/dist/next/AdvancedTable/AdvancedTableCheckbox.js +0 -1
  186. package/dist/next/AdvancedTable/AdvancedTableColumnHeader.js +11 -41
  187. package/dist/next/AdvancedTable/AdvancedTableColumnHeaderMenu.js +8 -14
  188. package/dist/next/AdvancedTable/AdvancedTableDragPreview.js +4 -6
  189. package/dist/next/AdvancedTable/AdvancedTablePagination.js +1 -4
  190. package/dist/next/AdvancedTable/AdvancedTableRowExpandButton.js +0 -1
  191. package/dist/next/AdvancedTable/AdvancedTableTypes.js +1 -3
  192. package/dist/next/AdvancedTable/useAdvancedTableDragAndDrop.js +8 -13
  193. package/dist/next/AdvancedTable/useComputedWidth.js +1 -1
  194. package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput.js +5 -20
  195. package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
  196. package/dist/next/CollapsibleSearchInput/CollapsibleSearchInputIconButton.js +1 -1
  197. package/dist/next/Combobox/Combobox2.js +3 -3
  198. package/dist/next/Combobox/ComboboxFlyout.js +3 -3
  199. package/dist/next/Combobox/ComboboxGroup.js +1 -1
  200. package/dist/next/Combobox/ComboboxInput.js +7 -20
  201. package/dist/next/Combobox/ComboboxOption.js +5 -6
  202. package/dist/next/Combobox/hooks/useComboboxFilteredGroup/useComboboxFilteredGroup.js +4 -5
  203. package/dist/next/Combobox/hooks/useComboboxFocusSequence/useComboboxFocusSequence.js +37 -54
  204. package/dist/next/Combobox/hooks/useComboboxLoadingState/useComboboxLoadingState.js +4 -5
  205. package/dist/next/Combobox/hooks/useComboboxValue/useComboboxValue.js +5 -3
  206. package/dist/next/Combobox/hooks/useListboxFlyoutDimensions/useListboxFlyoutDimensions.js +10 -10
  207. package/dist/next/Combobox/hooks/useSelectedOptionScroll/useSelectedOptionScroll.js +1 -6
  208. package/dist/next/Combobox/hooks/useShouldRenderGroupHeader/useShouldRenderGroupHeader.js +6 -6
  209. package/dist/next/Combobox/utils/nodeRegistration/nodeRegistration.js +4 -6
  210. package/dist/next/Drawer/Drawer.js +5 -16
  211. package/dist/next/Drawer/Drawer2.js +3 -3
  212. package/dist/next/FilterAnchor/FilterAnchor.js +7 -5
  213. package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
  214. package/dist/next/Input/Input.js +5 -8
  215. package/dist/next/Input/Input2.js +3 -3
  216. package/dist/next/Menu/Menu.js +10 -23
  217. package/dist/next/Menu/Menu2.js +3 -3
  218. package/dist/next/Menu/MenuContext.js +0 -2
  219. package/dist/next/Menu/MenuItem.js +11 -15
  220. package/dist/next/Menu/MenuPane.js +11 -25
  221. package/dist/next/Menu/MenuSearch.js +15 -22
  222. package/dist/next/Menu/SubMenu.js +10 -27
  223. package/dist/next/Menu/usePaneSearch.js +2 -1
  224. package/dist/next/PhoneNumberInput/PhoneNumberInput.js +12 -19
  225. package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
  226. package/dist/next/SplitButton/SplitButton.js +6 -12
  227. package/dist/next/SplitButton/SplitButton2.js +3 -3
  228. package/dist/next/Stack/HStack.js +11 -0
  229. package/dist/next/Stack/Stack.js +95 -0
  230. package/dist/next/Stack/StackItem.js +37 -0
  231. package/dist/next/Stack/VStack.js +11 -0
  232. package/dist/next/Stack/index.js +3 -0
  233. package/dist/next/TimePicker/TimeDropdown.js +4 -5
  234. package/dist/next/TimePicker/TimeInput.js +4 -5
  235. package/dist/next/TimePicker/TimePicker.js +12 -30
  236. package/dist/next/TimePicker/TimePicker2.js +3 -3
  237. package/dist/next/TimePicker/TimePickerIcon.js +1 -3
  238. package/dist/next/TimePicker/utils.js +12 -52
  239. package/dist/next/ToggleButton/ToggleButton.js +0 -5
  240. package/dist/next/ToggleButton/ToggleButtonGroup.js +2 -1
  241. package/dist/next/ToggleButton/styles.js +3 -3
  242. package/dist/next/index.d.ts +82 -4
  243. package/dist/next/index.es.js +4 -0
  244. package/dist/next/index.js +514 -745
  245. package/dist/utils/Flyout/Flyout.js +4 -5
  246. package/dist/utils/Flyout/Flyout2.js +3 -3
  247. package/dist/utils/Popper/Popper.js +18 -25
  248. package/dist/utils/Portal/Portal.js +2 -1
  249. package/dist/utils/TextOverflowTooltip/TextOverflowTooltip.js +4 -4
  250. package/dist/utils/Translation/Translate.js +0 -4
  251. package/dist/utils/Translation/TranslationProvider.js +0 -1
  252. package/dist/utils/Translation/containsComponentOrElement.js +1 -5
  253. package/dist/utils/Translation/insertPlaceholders.js +0 -1
  254. package/dist/utils/Translation/useTranslation.js +7 -14
  255. package/dist/utils/concatIds/concatIds.js +0 -1
  256. package/dist/utils/constants.js +2 -2
  257. package/dist/utils/createContextUtilities/createContextUtilities.js +0 -4
  258. package/dist/utils/filterChildren/filterChildren.js +8 -17
  259. package/dist/utils/getSubDataTestId/getSubDataTestId.js +1 -2
  260. package/dist/utils/keyboardUser/keyboardUser.js +0 -1
  261. package/dist/utils/mediaQueryManager/mediaQueryManager.js +1 -12
  262. package/dist/utils/mergeRefs/mergeRefs.js +1 -2
  263. package/dist/utils/wrapAround/wrapAround.js +1 -2
  264. package/dist/utils/wrapEvent/wrapEvent.js +2 -4
  265. package/icons/package.json +3 -2
  266. package/next/package.json +6 -2
  267. package/package.json +10 -5
@@ -31,25 +31,22 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
31
31
  closeSubmenu,
32
32
  flyoutRef
33
33
  } = usePaneContext(itemRef);
34
- const dataTestId = getSubDataTestId(menuParentDataTestId === null || menuParentDataTestId === void 0 ? void 0 : menuParentDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM), String(index));
34
+ const dataTestId = getSubDataTestId(menuParentDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM), String(index));
35
35
  const isVisible = useMemo(() => {
36
- var _context;
37
-
38
- const searchMatcher = label !== null && label !== void 0 ? label : typeof children === 'string' ? children : undefined;
39
- return isSearchFilteringDisabled || !searchValue || (searchMatcher === null || searchMatcher === void 0 ? void 0 : _includesInstanceProperty(_context = searchMatcher.toLowerCase()).call(_context, searchValue.toLowerCase()));
36
+ const searchMatcher = label ?? (typeof children === 'string' ? children : undefined);
37
+ return isSearchFilteringDisabled || !searchValue || searchMatcher?.toLowerCase().includes(searchValue.toLowerCase());
40
38
  }, [children, searchValue, label, isSearchFilteringDisabled]);
41
-
42
39
  const handleFocus = () => {
43
40
  if (itemRef.current && flyoutRef.current && getIsKeyboardUser()) {
44
- const stickyBoxHeight = 93; // if the top of the focused menu item is beneath the sticky box
41
+ const stickyBoxHeight = 93;
45
42
 
43
+ // if the top of the focused menu item is beneath the sticky box
46
44
  if (itemRef.current.offsetTop < flyoutRef.current.scrollTop + stickyBoxHeight) {
47
45
  // scroll down a little
48
46
  flyoutRef.current.scrollTop = itemRef.current.offsetTop - stickyBoxHeight;
49
47
  }
50
48
  }
51
49
  };
52
-
53
50
  return isVisible ? /*#__PURE__*/React__default.createElement(Item, _extends({}, rest, {
54
51
  asChild: asChild,
55
52
  "aria-disabled": isDisabled,
@@ -59,21 +56,20 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
59
56
  "data-testid": dataTestId,
60
57
  ref: mergeRefs(ref, itemRef),
61
58
  onKeyDown: e => {
62
- var _context2;
63
-
59
+ var _context;
64
60
  if (!isInteractive) {
65
61
  e.preventDefault();
66
62
  return;
67
63
  }
68
-
69
- if (_includesInstanceProperty(_context2 = KEYS.CLOSE_SUBMENU).call(_context2, e.key)) {
70
- closeSubmenu === null || closeSubmenu === void 0 ? void 0 : closeSubmenu(e);
64
+ if (_includesInstanceProperty(_context = KEYS.CLOSE_SUBMENU).call(_context, e.key)) {
65
+ closeSubmenu?.(e);
71
66
  }
72
67
  },
73
- onFocus: handleFocus // stop radix from closing the menu on selection of disabled item
68
+ onFocus: handleFocus
69
+ // stop radix from closing the menu on selection of disabled item
74
70
  // other pointer and keyboard events still work, even when disabled
75
71
  ,
76
- onSelect: e => isDisabled ? e.preventDefault() : onSelect === null || onSelect === void 0 ? void 0 : onSelect()
72
+ onSelect: e => isDisabled ? e.preventDefault() : onSelect?.()
77
73
  }), (!children || typeof children === 'string') && label ? label : children) : null;
78
74
  });
79
75
 
@@ -38,11 +38,7 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
38
38
  noMatchesText
39
39
  } = usePaneSearch(externalSearchValue, onSearchValueChange, items);
40
40
  const portalTarget = usePortalTarget();
41
- const [side, align] = useMemo(() => {
42
- var _placement$split, _placement$split2;
43
-
44
- return (_placement$split = placement === null || placement === void 0 ? void 0 : (_placement$split2 = placement.split) === null || _placement$split2 === void 0 ? void 0 : _placement$split2.call(placement, '-')) !== null && _placement$split !== void 0 ? _placement$split : [];
45
- }, [placement]);
41
+ const [side, align] = useMemo(() => placement?.split?.('-') ?? [], [placement]);
46
42
  const {
47
43
  dataTestId: rootDataTestId,
48
44
  openPaneDepth,
@@ -50,17 +46,16 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
50
46
  maskHeight,
51
47
  open,
52
48
  triggerRef
53
- } = useMenuContext(); // In order to preseve the css animation for vertical resizing, we cannot set the height of this pane to `auto`. It must be a pixel value.
54
- // We cache the pixel value here, to use it later if the user returns to this pane from a submenu.
49
+ } = useMenuContext();
55
50
 
51
+ // In order to preseve the css animation for vertical resizing, we cannot set the height of this pane to `auto`. It must be a pixel value.
52
+ // We cache the pixel value here, to use it later if the user returns to this pane from a submenu.
56
53
  const initialHeightOfThisPane = useRef(null);
57
54
  useDidUpdate(() => {
58
55
  if (openPaneDepth === 1) {
59
56
  if (initialHeightOfThisPane.current === null) {
60
57
  window.requestAnimationFrame(() => {
61
- var _flyoutRef$current$cl, _flyoutRef$current;
62
-
63
- initialHeightOfThisPane.current = (_flyoutRef$current$cl = (_flyoutRef$current = flyoutRef.current) === null || _flyoutRef$current === void 0 ? void 0 : _flyoutRef$current.clientHeight) !== null && _flyoutRef$current$cl !== void 0 ? _flyoutRef$current$cl : null;
58
+ initialHeightOfThisPane.current = flyoutRef.current?.clientHeight ?? null;
64
59
  setMaskHeight(initialHeightOfThisPane.current);
65
60
  });
66
61
  } else {
@@ -72,7 +67,6 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
72
67
  const animatedLeft = useMemo(() => openPaneDepth > 1, [openPaneDepth]);
73
68
  useEventListener(flyoutRef, 'keydown', e => {
74
69
  var _context;
75
-
76
70
  return _includesInstanceProperty(_context = Object.values(KEYS).flat()).call(_context, e.key) && setIsKeyboardUser(true);
77
71
  }, {
78
72
  additionalDependencies: [openPaneDepth]
@@ -81,36 +75,27 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
81
75
  additionalDependencies: [openPaneDepth]
82
76
  });
83
77
  const defaultSide = useMemo(() => {
84
- var _triggerRef$current;
85
-
86
- const rect = triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.getBoundingClientRect();
87
-
78
+ const rect = triggerRef?.current?.getBoundingClientRect();
88
79
  if (!rect) {
89
80
  return 'bottom';
90
- } // hard coded in Menu.less
91
-
81
+ }
92
82
 
83
+ // hard coded in Menu.less
93
84
  let maxHeight = 350;
94
-
95
85
  if (flyoutRef.current) {
96
86
  const computedString = window.getComputedStyle(flyoutRef.current).maxHeight.slice(0, -2);
97
-
98
87
  if (computedString !== '' && !Number.isNaN(+computedString)) {
99
88
  maxHeight = +computedString;
100
89
  }
101
90
  }
102
-
103
91
  const distanceToBottom = window.innerHeight - rect.bottom;
104
92
  const distanceToTop = rect.top;
105
-
106
93
  if (distanceToBottom > maxHeight) {
107
94
  return 'bottom';
108
95
  }
109
-
110
96
  if (distanceToTop > maxHeight) {
111
97
  return 'top';
112
98
  }
113
-
114
99
  return 'bottom';
115
100
  }, [open, triggerRef]);
116
101
  return /*#__PURE__*/React__default.createElement(PaneContextProvider, {
@@ -138,8 +123,9 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
138
123
  [styles.animatedLeft]: animatedLeft,
139
124
  [styles.containsStickyBox]: isSearchable
140
125
  }, styles.flyout),
141
- style: { ...style,
142
- height: internalSearchValue && openPaneDepth === 1 ? undefined : maskHeight !== null && maskHeight !== void 0 ? maskHeight : undefined
126
+ style: {
127
+ ...style,
128
+ height: internalSearchValue && openPaneDepth === 1 ? undefined : maskHeight ?? undefined
143
129
  }
144
130
  }), isSearchable && /*#__PURE__*/React__default.createElement("div", {
145
131
  className: styles.stickyBox
@@ -32,17 +32,15 @@ const MenuSearch = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
32
32
  closeSubmenu,
33
33
  flyoutRef
34
34
  } = usePaneContext();
35
- const dataTestId = menuParentDataTestId === null || menuParentDataTestId === void 0 ? void 0 : menuParentDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_SEARCH);
35
+ const dataTestId = menuParentDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_SEARCH);
36
36
  useEffect(() => () => setSearchValue(''), [setSearchValue]);
37
- const [previouslyFocusedElement, setPreviouslyFocusedElement] = useState(); // hack to keep focus on search input on mouse leave
37
+ const [previouslyFocusedElement, setPreviouslyFocusedElement] = useState();
38
38
 
39
+ // hack to keep focus on search input on mouse leave
39
40
  useEventListener(flyoutRef, 'focus', e => {
40
41
  if (e.target === e.currentTarget && previouslyFocusedElement === itemRef.current && isInteractive) {
41
- var _inputRef$current;
42
-
43
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
42
+ inputRef.current?.focus();
44
43
  }
45
-
46
44
  setPreviouslyFocusedElement(e.target);
47
45
  }, {
48
46
  isCaptureEvent: true
@@ -50,14 +48,11 @@ const MenuSearch = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
50
48
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Item, {
51
49
  className: classNames(styles.searchBox, {
52
50
  [styles.unresponsive]: !isInteractive
53
- }) // prevents dropdown from closing
51
+ })
52
+ // prevents dropdown from closing
54
53
  ,
55
54
  onSelect: e => e.preventDefault(),
56
- onFocus: () => {
57
- var _inputRef$current2;
58
-
59
- return (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
60
- },
55
+ onFocus: () => inputRef.current?.focus(),
61
56
  role: undefined,
62
57
  ref: mergeRefs(itemRef, ref)
63
58
  }, /*#__PURE__*/React__default.createElement(Input, {
@@ -67,27 +62,25 @@ const MenuSearch = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
67
62
  onChange: e => setSearchValue(e.target.value),
68
63
  placeholder: searchText,
69
64
  onKeyDown: e => {
70
- var _e$target, _context, _context2;
71
-
65
+ var _context, _context2;
72
66
  // stop propagation to prevent typeAhead
73
- e.stopPropagation(); // allow caret movement through text entry, but close searchable submenu if on the very left
67
+ e.stopPropagation();
74
68
 
75
- if (((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.selectionStart) === 0 && _includesInstanceProperty(_context = KEYS.CLOSE_SUBMENU).call(_context, e.key)) {
76
- closeSubmenu === null || closeSubmenu === void 0 ? void 0 : closeSubmenu(e);
69
+ // allow caret movement through text entry, but close searchable submenu if on the very left
70
+ if (e.target?.selectionStart === 0 && _includesInstanceProperty(_context = KEYS.CLOSE_SUBMENU).call(_context, e.key)) {
71
+ closeSubmenu?.(e);
77
72
  return;
78
- } // forward keypress directly to `Item` to let Radix handle keyboard navigation
79
-
73
+ }
80
74
 
75
+ // forward keypress directly to `Item` to let Radix handle keyboard navigation
81
76
  if (_includesInstanceProperty(_context2 = KEYS.IGNORED_BY_SEARCH_INPUT).call(_context2, e.key)) {
82
- var _itemRef$current;
83
-
84
77
  // `view` types are incompatible
85
78
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
86
79
  const {
87
80
  view,
88
81
  ...eventClone
89
82
  } = e;
90
- itemRef === null || itemRef === void 0 ? void 0 : (_itemRef$current = itemRef.current) === null || _itemRef$current === void 0 ? void 0 : _itemRef$current.dispatchEvent(new KeyboardEvent('keydown', eventClone));
83
+ itemRef?.current?.dispatchEvent(new KeyboardEvent('keydown', eventClone));
91
84
  }
92
85
  },
93
86
  leftAddOn: /*#__PURE__*/React__default.createElement(SearchIcon, null),
@@ -59,11 +59,10 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
59
59
  } = useMenuContext();
60
60
  const thisPanesDepth = useRef(totalOpenPaneDepth + 1).current;
61
61
  const paneDataTestId = getSubDataTestId(paneContainingTriggerDataTestId, String(triggerIndex));
62
- const backButtonDataTestId = paneDataTestId === null || paneDataTestId === void 0 ? void 0 : paneDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_BACK);
63
- const triggerDataTestId = paneDataTestId === null || paneDataTestId === void 0 ? void 0 : paneDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM);
62
+ const backButtonDataTestId = paneDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_BACK);
63
+ const triggerDataTestId = paneDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM);
64
64
  const triggerIsVisible = useMemo(() => {
65
65
  var _context;
66
-
67
66
  return isSearchFilteringDisabledForPaneContainingTrigger || !paneContainingTriggerSearchValue || typeof label === 'string' && _includesInstanceProperty(_context = label.toLowerCase()).call(_context, paneContainingTriggerSearchValue.toLowerCase());
68
67
  }, [paneContainingTriggerSearchValue, label, isSearchFilteringDisabledForPaneContainingTrigger]);
69
68
  const [isPaneInDOM, setIsPaneInDOM] = useState(false);
@@ -71,63 +70,49 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
71
70
  const [isTransitioningFromRight, setIsTransitioningFromRight] = useState(false);
72
71
  useDidUpdate(() => {
73
72
  if (isPaneInDOM) {
74
- setIsTransitioningFromRight(true); // trigger css transition
75
-
73
+ setIsTransitioningFromRight(true);
74
+ // trigger css transition
76
75
  setIsFrameAfterPaneAddedToDOM(true);
77
76
  window.requestAnimationFrame(() => setIsFrameAfterPaneAddedToDOM(false));
78
77
  }
79
-
80
78
  registerSubmenu(internalId, isPaneInDOM);
81
79
  }, [isPaneInDOM]);
82
80
  useEffect(() => () => registerSubmenu(internalId, false), []);
83
-
84
81
  const closeThisSubmenu = e => {
85
82
  // prevent closing the entire menu, and Radix keyboard navigation
86
83
  e.preventDefault();
87
84
  registerSubmenu(internalId, false);
88
85
  };
89
-
90
86
  useDidUpdate(() => {
91
87
  if (thisPanesDepth === totalOpenPaneDepth) {
92
88
  window.requestAnimationFrame(() => {
93
- var _flyoutRef$current$cl, _flyoutRef$current;
94
-
95
- setMaskHeight((_flyoutRef$current$cl = (_flyoutRef$current = flyoutRef.current) === null || _flyoutRef$current === void 0 ? void 0 : _flyoutRef$current.clientHeight) !== null && _flyoutRef$current$cl !== void 0 ? _flyoutRef$current$cl : null);
89
+ setMaskHeight(flyoutRef.current?.clientHeight ?? null);
96
90
  });
97
91
  }
98
92
  }, [totalOpenPaneDepth, internalSearchValue]);
99
93
  const animatedLeft = useMemo(() => thisPanesDepth < totalOpenPaneDepth, [totalOpenPaneDepth]);
100
94
  const animatedRight = useMemo(() => thisPanesDepth > totalOpenPaneDepth || isFrameAfterPaneAddedToDOM, [totalOpenPaneDepth, isFrameAfterPaneAddedToDOM]);
101
-
102
95
  const handlePaneTransitionEnd = () => {
103
96
  if (animatedLeft) {
104
97
  return;
105
98
  }
106
-
107
99
  if (animatedRight) {
108
100
  setIsPaneInDOM(false);
109
-
110
101
  if (getIsKeyboardUser()) {
111
- var _triggerRef$current;
112
-
113
- (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
102
+ triggerRef.current?.focus();
114
103
  }
115
104
  } else {
116
- var _flyoutRef$current2;
117
-
118
105
  // if the newly closed submenu doesn't place the focus on its trigger
119
- if (!((_flyoutRef$current2 = flyoutRef.current) !== null && _flyoutRef$current2 !== void 0 && _flyoutRef$current2.contains(document.activeElement)) && getIsKeyboardUser()) {
106
+ if (!flyoutRef.current?.contains(document.activeElement) && getIsKeyboardUser()) {
120
107
  if (searchItemRef.current) {
121
108
  searchItemRef.current.focus();
122
109
  } else if (backButtonRef.current) {
123
110
  backButtonRef.current.focus();
124
111
  }
125
112
  }
126
-
127
113
  setIsTransitioningFromRight(false);
128
114
  }
129
115
  };
130
-
131
116
  return triggerIsVisible ? /*#__PURE__*/React__default.createElement(Sub, {
132
117
  open: isPaneInDOM
133
118
  }, /*#__PURE__*/React__default.createElement(SubTrigger, {
@@ -140,16 +125,14 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
140
125
  onClick: () => !isDisabled && setIsPaneInDOM(true),
141
126
  onKeyDown: e => {
142
127
  var _context2, _context3;
143
-
144
128
  if (!paneContainingTriggerIsInteractive) {
145
129
  e.preventDefault();
146
130
  return;
147
131
  }
148
-
149
132
  if (!isDisabled && _includesInstanceProperty(_context2 = KEYS.OPEN_SUBMENU).call(_context2, e.key)) {
150
133
  setIsPaneInDOM(true);
151
134
  } else if (_includesInstanceProperty(_context3 = KEYS.CLOSE_SUBMENU).call(_context3, e.key)) {
152
- closeSubmenuContainingTrigger === null || closeSubmenuContainingTrigger === void 0 ? void 0 : closeSubmenuContainingTrigger(e);
135
+ closeSubmenuContainingTrigger?.(e);
153
136
  }
154
137
  }
155
138
  }, label, /*#__PURE__*/React__default.createElement(ChevronRightIcon, {
@@ -174,7 +157,8 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
174
157
  [styles.animatedLeft]: animatedLeft
175
158
  }),
176
159
  onTransitionEnd: handlePaneTransitionEnd,
177
- style: { ...style,
160
+ style: {
161
+ ...style,
178
162
  zIndex: thisPanesDepth
179
163
  }
180
164
  }), /*#__PURE__*/React__default.createElement("div", {
@@ -191,7 +175,6 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
191
175
  ref: backButtonRef,
192
176
  onKeyDown: e => {
193
177
  var _context4;
194
-
195
178
  if (_includesInstanceProperty(_context4 = KEYS.CLOSE_SUBMENU).call(_context4, e.key)) {
196
179
  closeThisSubmenu(e);
197
180
  }
@@ -4,6 +4,7 @@ import '../../utils/index.js';
4
4
  import useControllableState from '../../hooks/useControllableState/useControllableState.js';
5
5
  import useTranslation from '../../utils/Translation/useTranslation.js';
6
6
 
7
+ // abstracts the logic required for searching by both `MenuPane` and `SubMenu`
7
8
  function usePaneSearch(externalSearchValue, onSearchValueChange, items) {
8
9
  const [internalSearchValue, setSearchValue] = useControllableState(externalSearchValue, onSearchValueChange, externalSearchValue);
9
10
  const [zeroSearchResults, setZeroSearchResults] = useState();
@@ -12,7 +13,7 @@ function usePaneSearch(externalSearchValue, onSearchValueChange, items) {
12
13
  } = useTranslation();
13
14
  const noMatchesText = translate('menu.noItemsToDisplay');
14
15
  useEffect(() => {
15
- setZeroSearchResults((items === null || items === void 0 ? void 0 : items.filter(item => item.element.current).length) === 0);
16
+ setZeroSearchResults(items?.filter(item => item.element.current).length === 0);
16
17
  }, [items, internalSearchValue]);
17
18
  return {
18
19
  internalSearchValue,
@@ -27,18 +27,16 @@ const PhoneNumberInput = /*#__PURE__*/forwardRef((_ref, ref) => {
27
27
  inputId
28
28
  } = _ref;
29
29
  const [countryCode, setCountryCode] = useState(initialCountryCode);
30
- const [mask, setMask] = useState(); // As of the day of writing the longest number format is 15 numbers long. This is 5 places longer to be safe.
31
-
30
+ const [mask, setMask] = useState();
31
+ // As of the day of writing the longest number format is 15 numbers long. This is 5 places longer to be safe.
32
32
  const genericMaxNumberLength = 20;
33
33
  const {
34
34
  translate
35
35
  } = useTranslation();
36
36
  const getMinMaxLength = useCallback(() => {
37
- var _metadata$numberingPl;
38
-
39
37
  const metadata = new Metadata();
40
38
  metadata.selectNumberingPlan(countryCode);
41
- const possibleLengths = metadata === null || metadata === void 0 ? void 0 : (_metadata$numberingPl = metadata.numberingPlan) === null || _metadata$numberingPl === void 0 ? void 0 : _metadata$numberingPl.possibleLengths();
39
+ const possibleLengths = metadata?.numberingPlan?.possibleLengths();
42
40
  return possibleLengths ? [Math.min(...possibleLengths), Math.max(...possibleLengths)] : [0, genericMaxNumberLength];
43
41
  }, [countryCode]);
44
42
  const shouldUseMask = Number(getCountryCallingCode(countryCode)) === 1;
@@ -52,33 +50,28 @@ const PhoneNumberInput = /*#__PURE__*/forwardRef((_ref, ref) => {
52
50
  useEffect(() => {
53
51
  updateMask();
54
52
  }, [countryCode, updateMask]);
55
-
56
- const removeNonNumericCharacters = value => value === null || value === void 0 ? void 0 : value.replace(/\D/g, '');
57
-
53
+ const removeNonNumericCharacters = value => value?.replace(/\D/g, '');
58
54
  const handleInputChange = a => {
59
55
  // remove all non-numeric characters
60
56
  const value = removeNonNumericCharacters(a.target.value);
61
57
  let internationalNumber = null;
62
58
  let isValidLength = false;
63
-
64
59
  if (!value) {
65
60
  return;
66
61
  }
67
-
68
62
  try {
69
63
  const phoneNumber = parsePhoneNumber(value, countryCode);
70
64
  internationalNumber = phoneNumber.format('E.164');
71
65
  isValidLength = phoneNumber.isPossible();
72
- } catch (e) {// `parsePhoneNumber` throws an error if the inputs are invalid.
66
+ } catch (e) {
67
+ // `parsePhoneNumber` throws an error if the inputs are invalid.
73
68
  }
74
-
75
- onChange === null || onChange === void 0 ? void 0 : onChange(internationalNumber, isValidLength, countryCode, value);
69
+ onChange?.(internationalNumber, isValidLength, countryCode, value);
76
70
  };
77
-
78
71
  const inputClassNames = classNames(styles.input, {
79
72
  [styles.disabled]: isDisabled
80
73
  });
81
- const dropdownLabel = useMemo(() => countryCode ? "+".concat(getCountryCallingCode(countryCode)) : undefined, [countryCode]);
74
+ const dropdownLabel = useMemo(() => countryCode ? `+${getCountryCallingCode(countryCode)}` : undefined, [countryCode]);
82
75
  return /*#__PURE__*/React__default.createElement("div", {
83
76
  className: styles.container,
84
77
  "data-testid": dataTestId
@@ -95,19 +88,19 @@ const PhoneNumberInput = /*#__PURE__*/forwardRef((_ref, ref) => {
95
88
  disabled: isDisabled,
96
89
  "aria-label": buttonAriaLabel,
97
90
  "aria-labelledby": buttonAriaLabelledBy
98
- }, (countryCodes !== null && countryCodes !== void 0 ? countryCodes : getCountries()).map(individualCountryCode => {
91
+ }, (countryCodes ?? getCountries()).map(individualCountryCode => {
99
92
  if (!isSupportedCountry(individualCountryCode)) {
100
93
  return null;
101
94
  }
102
-
103
95
  return /*#__PURE__*/React__default.createElement(MenuItem, {
104
96
  key: individualCountryCode,
105
97
  value: individualCountryCode
106
- }, "".concat(translate(individualCountryCode), " +").concat(getCountryCallingCode(individualCountryCode)));
98
+ }, `${translate(individualCountryCode)} +${getCountryCallingCode(individualCountryCode)}`);
107
99
  })), /*#__PURE__*/React__default.createElement(InputMask, {
108
100
  value: isDisabled ? removeNonNumericCharacters(initialValue) : undefined,
109
101
  type: "tel",
110
- alwaysShowMask: true // hide formatting if not using mask
102
+ alwaysShowMask: true
103
+ // hide formatting if not using mask
111
104
  ,
112
105
  maskChar: shouldUseMask ? '_' : '',
113
106
  mask: mask,
@@ -1,8 +1,8 @@
1
1
  import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = "._kNu6_ input{padding-left:76px!important}._3gbyC input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._3gbyC input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._3gbyC input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._3b6vP{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._3b6vP,._3b6vP._3gbyC:hover{background-color:transparent!important}._3b6vP:hover{background-color:rgba(50,54,58,.08)!important}._3b6vP:active{background-color:rgba(50,54,58,.11)!important}._3b6vP svg{top:2px!important}._2drG7{position:relative}._1x_bk{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
4
- var styles = {"input":"_kNu6_","disabled":"_3gbyC","dropdown":"_3b6vP","container":"_2drG7","countryCode":"_1x_bk"};
5
- var stylesheet="._kNu6_ input{padding-left:76px!important}._3gbyC input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._3gbyC input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._3gbyC input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._3b6vP{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._3b6vP,._3b6vP._3gbyC:hover{background-color:transparent!important}._3b6vP:hover{background-color:rgba(50,54,58,.08)!important}._3b6vP:active{background-color:rgba(50,54,58,.11)!important}._3b6vP svg{top:2px!important}._2drG7{position:relative}._1x_bk{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
3
+ var css_248z = "._ftIEg input{padding-left:76px!important}._xPSHb input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._xPSHb input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._xPSHb input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._S3MtE{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._S3MtE,._S3MtE._xPSHb:hover{background-color:transparent!important}._S3MtE:hover{background-color:rgba(50,54,58,.08)!important}._S3MtE:active{background-color:rgba(50,54,58,.11)!important}._S3MtE svg{top:2px!important}._zPLts{position:relative}._Lv6NS{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
4
+ var styles = {"input":"_ftIEg","disabled":"_xPSHb","dropdown":"_S3MtE","container":"_zPLts","countryCode":"_Lv6NS"};
5
+ var stylesheet="._ftIEg input{padding-left:76px!important}._xPSHb input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._xPSHb input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._xPSHb input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._S3MtE{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._S3MtE,._S3MtE._xPSHb:hover{background-color:transparent!important}._S3MtE:hover{background-color:rgba(50,54,58,.08)!important}._S3MtE:active{background-color:rgba(50,54,58,.11)!important}._S3MtE svg{top:2px!important}._zPLts{position:relative}._Lv6NS{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
6
6
  styleInject(css_248z);
7
7
 
8
8
  export { styles as default, stylesheet };
@@ -30,18 +30,11 @@ const SplitButton = /*#__PURE__*/forwardRef((_ref, ref) => {
30
30
  const mainButtonRef = useRef(null);
31
31
  const dropdownButtonRef = useRef(null);
32
32
  const [dropdownButtonHasFocus, setDropdownButtonHasFocus] = useState(false);
33
- const [mainButtonHasFocus, setMainButtonHasFocus] = useState(false); // Keyboard navigation cannot be implemented using `onKeyDown` on the `button`s because keyboard events are disabled if the buttons are disabled. The consumer must be able to access either button, even if the other is disabled.
33
+ const [mainButtonHasFocus, setMainButtonHasFocus] = useState(false);
34
34
 
35
- useEventListener(mainButtonRef, 'keydown', e => {
36
- var _dropdownButtonRef$cu;
37
-
38
- return e.key === 'ArrowRight' && ((_dropdownButtonRef$cu = dropdownButtonRef.current) === null || _dropdownButtonRef$cu === void 0 ? void 0 : _dropdownButtonRef$cu.focus());
39
- });
40
- useEventListener(dropdownButtonRef, 'keydown', e => {
41
- var _mainButtonRef$curren;
42
-
43
- return e.key === 'ArrowLeft' && ((_mainButtonRef$curren = mainButtonRef.current) === null || _mainButtonRef$curren === void 0 ? void 0 : _mainButtonRef$curren.focus());
44
- });
35
+ // Keyboard navigation cannot be implemented using `onKeyDown` on the `button`s because keyboard events are disabled if the buttons are disabled. The consumer must be able to access either button, even if the other is disabled.
36
+ useEventListener(mainButtonRef, 'keydown', e => e.key === 'ArrowRight' && dropdownButtonRef.current?.focus());
37
+ useEventListener(dropdownButtonRef, 'keydown', e => e.key === 'ArrowLeft' && mainButtonRef.current?.focus());
45
38
  return /*#__PURE__*/React__default.createElement("div", {
46
39
  "data-testid": dataTestId,
47
40
  className: classNames(styles.container, className),
@@ -76,7 +69,8 @@ const SplitButton = /*#__PURE__*/forwardRef((_ref, ref) => {
76
69
  "aria-labelledby": dropdownAriaLabelledBy,
77
70
  value: 0,
78
71
  disabled: isDropdownDisabled
79
- }, /*#__PURE__*/React__default.createElement(DropdownButton // `label` of type `string` adds Dropdown's `isString` class, which causes a css bug in Safari
72
+ }, /*#__PURE__*/React__default.createElement(DropdownButton
73
+ // `label` of type `string` adds Dropdown's `isString` class, which causes a css bug in Safari
80
74
  , {
81
75
  label: /*#__PURE__*/React__default.createElement(React__default.Fragment, null),
82
76
  className: classNames(styles.dropdownButton, {
@@ -1,8 +1,8 @@
1
1
  import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = "._1M_49{display:flex}._Jxwjj{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._Jxwjj._3zBXt{background-color:#fff}._Jxwjj._3LuEh,._Jxwjj._3zBXt._2zzNe:not(._Jxwjj._3zBXt._1brLq),body.keyboard-user ._Jxwjj._3zBXt._39458:not(._1M3QF){background-color:#0b6ed0}._Jxwjj._3LuEh._1brLq._2zzNe,._Jxwjj._3LuEh._1M3QF._1brLq,._Jxwjj._3LuEh._1M3QF._39458{opacity:.4}._3VMBW{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._3VMBW:focus{z-index:1}._3WrqK{border-radius:0 4px 4px 0;transition:border .2s,background .2s,color .2s;border-left:none;min-width:35px!important;padding:0!important;justify-content:center!important}._3WrqK svg{margin-left:1px}._3WrqK._3zBXt{background-color:#0b6ed0;border-color:transparent}._3WrqK._3zBXt svg{fill:#fff!important}._3WrqK._3zBXt:not(._3BOLL):hover{background-color:#085caf!important}._3WrqK._3zBXt:not(._3BOLL):active{background-color:#0854a1!important}._3WrqK._3zBXt._3BOLL{opacity:.4}._3WrqK._3zBXt._3BOLL svg{background-color:transparent}._3WrqK._3LuEh{border-color:#0b6ed0;background-color:#fff}._3WrqK._3LuEh svg{fill:#0b6ed0!important}._3WrqK._3LuEh:not(._3BOLL):hover{background-color:#eef5fc!important}._3WrqK._3LuEh:not(._3BOLL):active{background-color:#e1edf9!important}._3WrqK._3LuEh._3BOLL{opacity:.4}._3WrqK._3LuEh._3BOLL svg{background-color:transparent}._2coMa{width:260px}";
4
- var styles = {"container":"_1M_49","divider":"_Jxwjj","primary":"_3zBXt","mainButtonFocus":"_39458","mainButtonDisabled":"_1M3QF","dropdownButtonFocus":"_2zzNe","dropdownButtonDisabled":"_1brLq","secondary":"_3LuEh","mainButton":"_3VMBW","dropdownButton":"_3WrqK","disabled":"_3BOLL","dropdownOption":"_2coMa"};
5
- var stylesheet="._1M_49{display:flex}._Jxwjj{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._Jxwjj._3zBXt{background-color:#fff}._Jxwjj._3LuEh,._Jxwjj._3zBXt._2zzNe:not(._Jxwjj._3zBXt._1brLq),body.keyboard-user ._Jxwjj._3zBXt._39458:not(._1M3QF){background-color:#0b6ed0}._Jxwjj._3LuEh._1brLq._2zzNe,._Jxwjj._3LuEh._1M3QF._1brLq,._Jxwjj._3LuEh._1M3QF._39458{opacity:.4}._3VMBW{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._3VMBW:focus{z-index:1}._3WrqK{border-radius:0 4px 4px 0;transition:border .2s,background .2s,color .2s;border-left:none;min-width:35px!important;padding:0!important;justify-content:center!important}._3WrqK svg{margin-left:1px}._3WrqK._3zBXt{background-color:#0b6ed0;border-color:transparent}._3WrqK._3zBXt svg{fill:#fff!important}._3WrqK._3zBXt:not(._3BOLL):hover{background-color:#085caf!important}._3WrqK._3zBXt:not(._3BOLL):active{background-color:#0854a1!important}._3WrqK._3zBXt._3BOLL{opacity:.4}._3WrqK._3zBXt._3BOLL svg{background-color:transparent}._3WrqK._3LuEh{border-color:#0b6ed0;background-color:#fff}._3WrqK._3LuEh svg{fill:#0b6ed0!important}._3WrqK._3LuEh:not(._3BOLL):hover{background-color:#eef5fc!important}._3WrqK._3LuEh:not(._3BOLL):active{background-color:#e1edf9!important}._3WrqK._3LuEh._3BOLL{opacity:.4}._3WrqK._3LuEh._3BOLL svg{background-color:transparent}._2coMa{width:260px}";
3
+ var css_248z = "._A2M2P{display:flex}._852aR{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._852aR._GTVJ2{background-color:#fff}._852aR._0j0cF,._852aR._GTVJ2._cqq5X:not(._852aR._GTVJ2._TT3cu),body.keyboard-user ._852aR._GTVJ2._Dxhld:not(._QDQOk){background-color:#0b6ed0}._852aR._0j0cF._QDQOk._Dxhld,._852aR._0j0cF._QDQOk._TT3cu,._852aR._0j0cF._TT3cu._cqq5X{opacity:.4}._il-WD{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._il-WD:focus{z-index:1}._PDkaA{border-radius:0 4px 4px 0;transition:border .2s,background .2s,color .2s;border-left:none;min-width:35px!important;padding:0!important;justify-content:center!important}._PDkaA svg{margin-left:1px}._PDkaA._GTVJ2{background-color:#0b6ed0;border-color:transparent}._PDkaA._GTVJ2 svg{fill:#fff!important}._PDkaA._GTVJ2:not(._ZArO2):hover{background-color:#085caf!important}._PDkaA._GTVJ2:not(._ZArO2):active{background-color:#0854a1!important}._PDkaA._GTVJ2._ZArO2{opacity:.4}._PDkaA._GTVJ2._ZArO2 svg{background-color:transparent}._PDkaA._0j0cF{border-color:#0b6ed0;background-color:#fff}._PDkaA._0j0cF svg{fill:#0b6ed0!important}._PDkaA._0j0cF:not(._ZArO2):hover{background-color:#eef5fc!important}._PDkaA._0j0cF:not(._ZArO2):active{background-color:#e1edf9!important}._PDkaA._0j0cF._ZArO2{opacity:.4}._PDkaA._0j0cF._ZArO2 svg{background-color:transparent}._jRrOX{width:260px}";
4
+ var styles = {"container":"_A2M2P","divider":"_852aR","primary":"_GTVJ2","mainButtonFocus":"_Dxhld","mainButtonDisabled":"_QDQOk","dropdownButtonFocus":"_cqq5X","dropdownButtonDisabled":"_TT3cu","secondary":"_0j0cF","mainButton":"_il-WD","dropdownButton":"_PDkaA","disabled":"_ZArO2","dropdownOption":"_jRrOX"};
5
+ var stylesheet="._A2M2P{display:flex}._852aR{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._852aR._GTVJ2{background-color:#fff}._852aR._0j0cF,._852aR._GTVJ2._cqq5X:not(._852aR._GTVJ2._TT3cu),body.keyboard-user ._852aR._GTVJ2._Dxhld:not(._QDQOk){background-color:#0b6ed0}._852aR._0j0cF._QDQOk._Dxhld,._852aR._0j0cF._QDQOk._TT3cu,._852aR._0j0cF._TT3cu._cqq5X{opacity:.4}._il-WD{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._il-WD:focus{z-index:1}._PDkaA{border-radius:0 4px 4px 0;transition:border .2s,background .2s,color .2s;border-left:none;min-width:35px!important;padding:0!important;justify-content:center!important}._PDkaA svg{margin-left:1px}._PDkaA._GTVJ2{background-color:#0b6ed0;border-color:transparent}._PDkaA._GTVJ2 svg{fill:#fff!important}._PDkaA._GTVJ2:not(._ZArO2):hover{background-color:#085caf!important}._PDkaA._GTVJ2:not(._ZArO2):active{background-color:#0854a1!important}._PDkaA._GTVJ2._ZArO2{opacity:.4}._PDkaA._GTVJ2._ZArO2 svg{background-color:transparent}._PDkaA._0j0cF{border-color:#0b6ed0;background-color:#fff}._PDkaA._0j0cF svg{fill:#0b6ed0!important}._PDkaA._0j0cF:not(._ZArO2):hover{background-color:#eef5fc!important}._PDkaA._0j0cF:not(._ZArO2):active{background-color:#e1edf9!important}._PDkaA._0j0cF._ZArO2{opacity:.4}._PDkaA._0j0cF._ZArO2 svg{background-color:transparent}._jRrOX{width:260px}";
6
6
  styleInject(css_248z);
7
7
 
8
8
  export { styles as default, stylesheet };
@@ -0,0 +1,11 @@
1
+ import _extends from '@babel/runtime-corejs3/helpers/extends';
2
+ import React__default, { forwardRef } from 'react';
3
+ import { Stack } from './Stack.js';
4
+
5
+ const HStack = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/React__default.createElement(Stack, _extends({
6
+ ref: ref
7
+ }, props, {
8
+ direction: "horizontal"
9
+ })));
10
+
11
+ export { HStack };
@@ -0,0 +1,95 @@
1
+ import React__default, { forwardRef, useEffect } from 'react';
2
+ import { HStack } from './HStack.js';
3
+ import { VStack } from './VStack.js';
4
+ import { StackItem } from './StackItem.js';
5
+
6
+ const convertAlignment = alignment => {
7
+ const alignmentMap = {
8
+ top: 'flex-start',
9
+ bottom: 'flex-end',
10
+ left: 'flex-start',
11
+ right: 'flex-end',
12
+ center: 'center',
13
+ spaceAround: 'space-around',
14
+ spaceBetween: 'space-between',
15
+ spaceEvenly: 'space-evenly'
16
+ };
17
+ return alignmentMap[alignment];
18
+ };
19
+ // Explicitly listed props to prevent arbitrary prop spreading
20
+ const Stack = /*#__PURE__*/forwardRef((_ref, ref) => {
21
+ let {
22
+ gap,
23
+ paddingLeft,
24
+ paddingRight,
25
+ paddingTop,
26
+ paddingBottom,
27
+ marginLeft,
28
+ marginRight,
29
+ marginTop,
30
+ marginBottom,
31
+ alignChildrenX = 'center',
32
+ alignChildrenY = 'center',
33
+ children,
34
+ direction,
35
+ width,
36
+ minWidth,
37
+ maxWidth,
38
+ height,
39
+ minHeight,
40
+ maxHeight,
41
+ fillSpace,
42
+ 'aria-label': ariaLabel,
43
+ 'aria-labelledby': ariaLabelledBy,
44
+ 'aria-describedby': ariaDescribedBy,
45
+ 'data-testid': dataTestId
46
+ } = _ref;
47
+ const checkIsStackItem = child => {
48
+ if (!(child.type && (child.type === StackItem || child.type === HStack || child.type === VStack))) {
49
+ throw new Error('Stack received an invalid child. Only StackItems are valid children of Stacks.');
50
+ }
51
+ };
52
+ useEffect(() => {
53
+ if (Array.isArray(children)) {
54
+ children.forEach(child => {
55
+ checkIsStackItem(child);
56
+ });
57
+ } else if (children) {
58
+ checkIsStackItem(children);
59
+ }
60
+ }, [children]);
61
+ const alignment = direction === 'horizontal' ? alignChildrenY : alignChildrenX;
62
+ const justification = direction === 'horizontal' ? alignChildrenX : alignChildrenY;
63
+ return /*#__PURE__*/React__default.createElement("div", {
64
+ ref: ref,
65
+ style: {
66
+ display: 'flex',
67
+ flexWrap: 'nowrap',
68
+ flexDirection: direction === 'horizontal' ? 'row' : 'column',
69
+ gap,
70
+ width,
71
+ minWidth,
72
+ maxWidth,
73
+ height,
74
+ minHeight,
75
+ maxHeight,
76
+ flex: fillSpace ? '1 1 0%' : 'none',
77
+ justifyContent: convertAlignment(justification),
78
+ alignItems: convertAlignment(alignment),
79
+ paddingLeft,
80
+ paddingRight,
81
+ paddingTop,
82
+ paddingBottom,
83
+ marginLeft,
84
+ marginRight,
85
+ marginTop,
86
+ marginBottom
87
+ },
88
+ "aria-label": ariaLabel,
89
+ "aria-labelledby": ariaLabelledBy,
90
+ "aria-describedby": ariaDescribedBy,
91
+ "data-testid": dataTestId
92
+ }, children);
93
+ });
94
+
95
+ export { Stack };