@qualtrics/ui-react 2.19.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 (261) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/__shared/cjs/{index-4e4cc354.js → index-384184bd.js} +994 -1872
  3. package/dist/__shared/cjs/{index-bf07471d.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/Stack.js +0 -3
  229. package/dist/next/TimePicker/TimeDropdown.js +4 -5
  230. package/dist/next/TimePicker/TimeInput.js +4 -5
  231. package/dist/next/TimePicker/TimePicker.js +12 -30
  232. package/dist/next/TimePicker/TimePicker2.js +3 -3
  233. package/dist/next/TimePicker/TimePickerIcon.js +1 -3
  234. package/dist/next/TimePicker/utils.js +12 -52
  235. package/dist/next/ToggleButton/ToggleButton.js +0 -5
  236. package/dist/next/ToggleButton/ToggleButtonGroup.js +2 -1
  237. package/dist/next/ToggleButton/styles.js +3 -3
  238. package/dist/next/index.js +376 -748
  239. package/dist/utils/Flyout/Flyout.js +4 -5
  240. package/dist/utils/Flyout/Flyout2.js +3 -3
  241. package/dist/utils/Popper/Popper.js +18 -25
  242. package/dist/utils/Portal/Portal.js +2 -1
  243. package/dist/utils/TextOverflowTooltip/TextOverflowTooltip.js +4 -4
  244. package/dist/utils/Translation/Translate.js +0 -4
  245. package/dist/utils/Translation/TranslationProvider.js +0 -1
  246. package/dist/utils/Translation/containsComponentOrElement.js +1 -5
  247. package/dist/utils/Translation/insertPlaceholders.js +0 -1
  248. package/dist/utils/Translation/useTranslation.js +7 -14
  249. package/dist/utils/concatIds/concatIds.js +0 -1
  250. package/dist/utils/constants.js +2 -2
  251. package/dist/utils/createContextUtilities/createContextUtilities.js +0 -4
  252. package/dist/utils/filterChildren/filterChildren.js +8 -17
  253. package/dist/utils/getSubDataTestId/getSubDataTestId.js +1 -2
  254. package/dist/utils/keyboardUser/keyboardUser.js +0 -1
  255. package/dist/utils/mediaQueryManager/mediaQueryManager.js +1 -12
  256. package/dist/utils/mergeRefs/mergeRefs.js +1 -2
  257. package/dist/utils/wrapAround/wrapAround.js +1 -2
  258. package/dist/utils/wrapEvent/wrapEvent.js +2 -4
  259. package/icons/package.json +2 -1
  260. package/next/package.json +5 -1
  261. package/package.json +9 -4
@@ -18,9 +18,8 @@ const SelectMenu = /*#__PURE__*/React__default.forwardRef(function SelectMenu(_r
18
18
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
19
19
  args[_key - 1] = arguments[_key];
20
20
  }
21
-
22
- onSelectedValueChange === null || onSelectedValueChange === void 0 ? void 0 : onSelectedValueChange(value, ...args);
23
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
21
+ onSelectedValueChange?.(value, ...args);
22
+ onChange?.(value);
24
23
  }
25
24
  }, rest));
26
25
  });
@@ -10,10 +10,9 @@ import useLatest from '../../../../hooks/useLatest/useLatest.js';
10
10
  import { SUBMENU_POPPER_OFFSET, FLYOUT_POPPER_OFFSET } from '../../../../utils/constants.js';
11
11
 
12
12
  function useChildrenRefs(children, getAdditionalProps, isNavItem, searchable) {
13
- const refs = useRef({}); // eslint-disable-next-line no-return-assign
14
-
13
+ const refs = useRef({});
14
+ // eslint-disable-next-line no-return-assign
15
15
  const createRefCallback = index => node => refs.current[index] = node;
16
-
17
16
  let refIndex = searchable ? 1 : 0;
18
17
  const allChildren = React__default.Children.map(children, child => {
19
18
  if (isNavItem(child)) {
@@ -25,13 +24,11 @@ function useChildrenRefs(children, getAdditionalProps, isNavItem, searchable) {
25
24
  ...additionalProps
26
25
  });
27
26
  }
28
-
29
27
  return child;
30
28
  });
31
29
  refs.current.length = refIndex;
32
30
  return [refs, allChildren];
33
31
  }
34
-
35
32
  const ArrowNav = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
36
33
  let {
37
34
  role,
@@ -65,19 +62,18 @@ const ArrowNav = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
65
62
  onHighlightedIndexChange(index);
66
63
  })
67
64
  }), isNavItem, searchable);
68
- const isKeyboardUserRef = useLatest(isKeyboardUser); // Update the focused menu item when the highlighted index changes
65
+ const isKeyboardUserRef = useLatest(isKeyboardUser);
69
66
 
67
+ // Update the focused menu item when the highlighted index changes
70
68
  useEffect(() => {
71
69
  if (isPopperReady) {
72
70
  if (refs.current[highlightedIndex]) {
73
71
  // Scroll the item into view when navigating with a keyboard
74
72
  const element = refs.current[highlightedIndex];
75
73
  const searchInputSize = searchable ? 53 : 0;
76
-
77
74
  if (isKeyboardUserRef.current && containerRef.current) {
78
75
  const scrollBottom = containerRef.current.clientHeight + containerRef.current.scrollTop;
79
76
  const elementBottom = element.offsetTop + element.offsetHeight;
80
-
81
77
  if (elementBottom > scrollBottom) {
82
78
  containerRef.current.scrollTop = elementBottom - containerRef.current.clientHeight;
83
79
  } else if (element.offsetTop - searchInputSize < containerRef.current.scrollTop) {
@@ -88,58 +84,46 @@ const ArrowNav = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
88
84
  * For keyboard users it makes no difference since the item is already in view when .focus() is called.
89
85
  * For mouse users, it prevents scrolling from occurring when hovering over a menu item that is partially out of view.
90
86
  */
91
-
92
-
93
87
  element.focus({
94
88
  preventScroll: true
95
89
  });
96
90
  } else if (highlightedIndex === 0 && searchable) {
97
- searchBoxRef === null || searchBoxRef === void 0 ? void 0 : searchBoxRef.current.focus();
91
+ searchBoxRef?.current.focus();
98
92
  } else {
99
- var _anchorRef$current;
100
-
101
- anchorRef === null || anchorRef === void 0 ? void 0 : (_anchorRef$current = anchorRef.current) === null || _anchorRef$current === void 0 ? void 0 : _anchorRef$current.focus();
93
+ anchorRef?.current?.focus();
102
94
  }
103
95
  }
104
- }, [highlightedIndex, refs, searchable, allChildren.length, // Needed to prevent QuickSearch from losing focus in some cases when items are loaded asynchronously while the user is navigating
96
+ }, [highlightedIndex, refs, searchable, allChildren.length,
97
+ // Needed to prevent QuickSearch from losing focus in some cases when items are loaded asynchronously while the user is navigating
105
98
  isPopperReady, isKeyboardUserRef, searchBoxRef, anchorRef]);
106
99
  const numChildren = refs.current.length;
107
-
108
100
  const handleKeyDown = e => {
109
101
  setIsKeyboardUser(true);
110
-
111
102
  if (e.key === 'ArrowDown') {
112
103
  e.preventDefault(); // prevent scroll
113
-
114
104
  if (highlightedIndex !== -1) {
115
105
  onHighlightedIndexChange((highlightedIndex + 1) % numChildren);
116
106
  }
117
107
  } else if (e.key === 'ArrowUp') {
118
108
  e.preventDefault(); // prevent scroll
119
-
120
109
  if (highlightedIndex !== -1) {
121
110
  onHighlightedIndexChange((highlightedIndex - 1 + numChildren) % numChildren);
122
111
  }
123
112
  } else if (e.key === 'PageUp' || e.key === 'Home') {
124
- var _containerRef$current;
125
-
126
113
  // Only call the highlighted index change handler for the current nav list (i.e. if the event bubbles up to a parent nav list, don't call the highlighted index change handler on the parent nav list)
127
- if ((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.contains(e.target)) {
114
+ if (containerRef.current?.contains(e.target)) {
128
115
  e.preventDefault();
129
116
  onHighlightedIndexChange(0);
130
117
  }
131
118
  } else if (e.key === 'PageDown' || e.key === 'End') {
132
- var _containerRef$current2;
133
-
134
119
  // Only call the highlighted index change handler for the current nav list (i.e. if the event bubbles up to a parent nav list, don't call the highlighted index change handler on the parent nav list)
135
- if ((_containerRef$current2 = containerRef.current) !== null && _containerRef$current2 !== void 0 && _containerRef$current2.contains(e.target)) {
120
+ if (containerRef.current?.contains(e.target)) {
136
121
  e.preventDefault();
137
122
  const lastIndex = numChildren - 1;
138
123
  onHighlightedIndexChange(lastIndex);
139
124
  }
140
125
  }
141
126
  };
142
-
143
127
  return (
144
128
  /*#__PURE__*/
145
129
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
@@ -148,19 +132,23 @@ const ArrowNav = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
148
132
  tabIndex: tabIndex,
149
133
  onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
150
134
  "data-popper-ready": isPopperReady,
151
- style: { ...style,
135
+ style: {
136
+ ...style,
152
137
  minWidth,
153
- maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : // This logic is located here instead of BaseMenu.js so the maxHeight will update with screen resizing (Popper has a resize listener that causes this to rerender)
154
- Math.min(350, (isSubmenu ? // Submenus: window height - submenu popper offset - 8px of container padding - half of anchor height (fallback to default 18px))
155
- document.documentElement.clientHeight - SUBMENU_POPPER_OFFSET[0] : // Menus: half of window height - menu popper offset - 8px of container padding - half of anchor height (fallback to default 18px)
156
- document.documentElement.clientHeight / 2 - FLYOUT_POPPER_OFFSET[1]) - 8 - (anchorRef !== null && anchorRef !== void 0 && anchorRef.current ? anchorRef.current.offsetHeight / 2 : 18))
138
+ maxHeight: maxHeight ??
139
+ // This logic is located here instead of BaseMenu.js so the maxHeight will update with screen resizing (Popper has a resize listener that causes this to rerender)
140
+ Math.min(350, (isSubmenu ?
141
+ // Submenus: window height - submenu popper offset - 8px of container padding - half of anchor height (fallback to default 18px))
142
+ document.documentElement.clientHeight - SUBMENU_POPPER_OFFSET[0] :
143
+ // Menus: half of window height - menu popper offset - 8px of container padding - half of anchor height (fallback to default 18px)
144
+ document.documentElement.clientHeight / 2 - FLYOUT_POPPER_OFFSET[1]) - 8 - (anchorRef?.current ? anchorRef.current.offsetHeight / 2 : 18))
157
145
  }
158
146
  }, rest), searchable && /*#__PURE__*/React__default.createElement(MenuSearchBox, {
159
147
  "aria-controls": menuId,
160
148
  value: searchTerm,
161
149
  ref: searchBoxRef,
162
150
  onChange: e => {
163
- setSearchTerm === null || setSearchTerm === void 0 ? void 0 : setSearchTerm(e.target.value);
151
+ setSearchTerm?.(e.target.value);
164
152
  },
165
153
  onFocus: () => onHighlightedIndexChange(0)
166
154
  }), /*#__PURE__*/React__default.createElement("div", {
@@ -24,19 +24,17 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
24
24
  ...rest
25
25
  } = _ref;
26
26
  const defaultRole = isSelectable ? isMultiSelect ? 'menuitemcheckbox' : 'menuitemradio' : 'menuitem';
27
-
28
27
  const handleSelect = e => {
29
28
  if (typeof onSelect === 'function' && !disabled) {
30
29
  onSelect(e);
31
30
  }
32
31
  };
33
-
34
32
  return (
35
33
  /*#__PURE__*/
36
34
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
37
35
  React__default.createElement("div", _extends({}, rest, {
38
36
  ref: ref,
39
- role: role !== null && role !== void 0 ? role : defaultRole,
37
+ role: role ?? defaultRole,
40
38
  tabIndex: tabIndex,
41
39
  "aria-disabled": disabled,
42
40
  "aria-checked": isSelectable ? isSelected : undefined,
@@ -51,6 +49,7 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
51
49
  e.preventDefault(); // prevent scroll
52
50
  }
53
51
  }),
52
+
54
53
  onClick: wrapEvent(onClick, handleSelect)
55
54
  }), isMultiSelect && /*#__PURE__*/React__default.createElement(VisualCheckbox, {
56
55
  className: classNames(styles.checkbox, {
@@ -9,7 +9,8 @@ import SearchIcon from '../../../icons/components/SearchIcon.js';
9
9
  import Input from '../../Input/Input.js';
10
10
 
11
11
  const MenuSearchBox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
12
- let { ...rest
12
+ let {
13
+ ...rest
13
14
  } = _ref;
14
15
  const {
15
16
  translate
@@ -10,7 +10,6 @@ import useScreenReaderAnnouncement from '../../hooks/useScreenReaderAnnouncement
10
10
  import useControllableState from '../../hooks/useControllableState/useControllableState.js';
11
11
 
12
12
  /* eslint-disable @typescript-eslint/no-use-before-define */
13
-
14
13
  /**
15
14
  * Renders the NumberStepper component.
16
15
  * This component is offered as a "default" (aka simple) component or an "advanced" (aka composite) component.
@@ -40,6 +39,7 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
40
39
  const announceToScreenReader = useScreenReaderAnnouncement('assertive');
41
40
  const componentHasFocus = useRef(false);
42
41
  const isSeparatedByComma = useCallback(number => decimalSeparator === 'comma' || String(number).indexOf(',') !== -1 || latestDecimalSeparator.current === ',', [decimalSeparator]);
42
+
43
43
  /*
44
44
  * Input value that comes from:
45
45
  * (1) The `externalValue` prop, or
@@ -65,79 +65,78 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
65
65
  useEffect(() => {
66
66
  if (componentIsControlled && convertToNumber(inputValue) !== externalValue) {
67
67
  setInputValue(localizeNumber(internalValue, isSeparatedByComma(inputValue)));
68
- } // forceInternalValueUpdate is required because the consumer may pass the same value twice consecutively, this would fail to update the internal value, and this useEffect wouldn't run.
68
+ }
69
+ // forceInternalValueUpdate is required because the consumer may pass the same value twice consecutively, this would fail to update the internal value, and this useEffect wouldn't run.
69
70
  // exhaustive-deps is disabled because reacting to `inputValue` would cause an infinite loop
70
71
  // eslint-disable-next-line react-hooks/exhaustive-deps
71
-
72
72
  }, [internalValue, forceInternalValueUpdate, componentIsControlled, isSeparatedByComma, externalValue]);
73
+
73
74
  /**
74
75
  * Increments the `inputValue` by `step`.
75
76
  * The new value is bounded by `max` if `max` is defined.
76
77
  */
77
-
78
78
  const increment = useCallback(isTriggeredByIncrementButton => {
79
79
  setInputValue(currentValue => {
80
- const newValue = convertToNumber(currentValue) + step; // Value needs to be rounded for accuracy
80
+ const newValue = convertToNumber(currentValue) + step;
81
81
 
82
+ // Value needs to be rounded for accuracy
82
83
  const newValueRounded = roundToTwoDecimalPlaces(newValue);
83
84
  const newValueFinal = localizeNumber(clampMinMax(newValueRounded, {
84
85
  max
85
86
  }), isSeparatedByComma(currentValue));
86
-
87
87
  if (isTriggeredByIncrementButton) {
88
88
  announceToScreenReader(newValueFinal);
89
89
  }
90
-
91
90
  return newValueFinal;
92
91
  });
93
92
  }, [step, max, setInputValue, isSeparatedByComma, announceToScreenReader]);
93
+
94
94
  /**
95
95
  * Decrements the `inputValue` by `step`.
96
96
  * The new value is bounded by `min` if `min` is defined.
97
97
  */
98
-
99
98
  const decrement = useCallback(isTriggeredByDecrementButton => {
100
99
  setInputValue(currentValue => {
101
- const newValue = convertToNumber(currentValue) - step; // Value needs to be rounded for accuracy
100
+ const newValue = convertToNumber(currentValue) - step;
102
101
 
102
+ // Value needs to be rounded for accuracy
103
103
  const newValueRounded = roundToTwoDecimalPlaces(newValue);
104
104
  const newValueFinal = localizeNumber(clampMinMax(newValueRounded, {
105
105
  min
106
106
  }), isSeparatedByComma(currentValue));
107
-
108
107
  if (isTriggeredByDecrementButton) {
109
108
  announceToScreenReader(newValueFinal);
110
109
  }
111
-
112
110
  return newValueFinal;
113
111
  });
114
112
  }, [step, min, setInputValue, isSeparatedByComma, announceToScreenReader]);
113
+
115
114
  /**
116
115
  * Updates the `inputValue` to `max`
117
116
  */
118
-
119
117
  const increaseToMax = useCallback(() => {
120
118
  if (max !== undefined) {
121
119
  setInputValue(localizeNumber(max, isSeparatedByComma(inputValue)));
122
120
  }
123
121
  }, [max, setInputValue, inputValue, isSeparatedByComma]);
122
+
124
123
  /**
125
124
  * Updates the `inputValue` to `min`
126
125
  */
127
-
128
126
  const decreaseToMin = useCallback(() => {
129
127
  if (min !== undefined) {
130
128
  setInputValue(localizeNumber(min, isSeparatedByComma(inputValue)));
131
129
  }
132
130
  }, [min, setInputValue, inputValue, isSeparatedByComma]);
131
+
133
132
  /**
134
133
  * Updates the `inputValue` to be:
135
134
  * (1) An empty string, or
136
135
  * (2) The entered value as a number
137
136
  */
138
-
139
137
  const handleInputChange = useCallback(e => {
140
138
  const val = e.target.value;
139
+
141
140
  /*
142
141
  ^ begin matching string from this point
143
142
  -? 0 or 1 of '-'
@@ -147,10 +146,9 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
147
146
  (\.|,)? 0 or 1 of either '.' or ','
148
147
  $ end matching string at this point
149
148
  */
150
- // default is whole numbers
151
149
 
150
+ // default is whole numbers
152
151
  let regex = /^-?\d*$/;
153
-
154
152
  if (allowDecimalNumbers) {
155
153
  if (decimalSeparator === 'period') {
156
154
  regex = /^-?\d*\.?\d*$/;
@@ -160,40 +158,37 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
160
158
  regex = /^-?\d*(\.|,)?\d*$/;
161
159
  }
162
160
  }
163
-
164
161
  if (regex.test(val)) {
165
- var _val$split;
166
-
167
162
  const currentIsSeparatedByComma = isSeparatedByComma(val);
168
163
  const currentDecimalSeparator = currentIsSeparatedByComma ? ',' : '.';
169
- const decimalPortion = (_val$split = val.split(currentDecimalSeparator)) === null || _val$split === void 0 ? void 0 : _val$split[1];
170
-
171
- if ((decimalPortion === null || decimalPortion === void 0 ? void 0 : decimalPortion.length) > 2) {
172
- let rounded = String(roundToTwoDecimalPlaces(convertToNumber(val))); // If a user types a number that rounds out to a whole number, such as '23.000' or `1.999`, the '.' is rounded away, causing the user to lose their place in the input.
164
+ const decimalPortion = val.split(currentDecimalSeparator)?.[1];
165
+ if (decimalPortion?.length > 2) {
166
+ let rounded = String(roundToTwoDecimalPlaces(convertToNumber(val)));
173
167
 
168
+ // If a user types a number that rounds out to a whole number, such as '23.000' or `1.999`, the '.' is rounded away, causing the user to lose their place in the input.
174
169
  if (rounded.indexOf('.') === -1) {
175
- rounded += "".concat(currentDecimalSeparator, "00");
170
+ rounded += `${currentDecimalSeparator}00`;
176
171
  }
177
-
178
172
  setInputValue(localizeNumber(rounded, currentIsSeparatedByComma));
179
173
  } else {
180
174
  setInputValue(val);
181
175
  }
182
176
  }
183
177
  }, [setInputValue, allowDecimalNumbers, decimalSeparator, isSeparatedByComma]);
178
+
184
179
  /**
185
180
  * Updates the `inputValue` to be:
186
181
  * (1) The entered value as a number, or
187
182
  * (2) The `min` or `max` value
188
183
  */
189
-
190
184
  const handleInputBlur = useCallback(() => {
191
185
  setInputValue(currentValue => localizeNumber(clampMinMax(convertToNumber(currentValue), {
192
186
  min,
193
187
  max
194
188
  }), isSeparatedByComma(currentValue)));
195
- }, [max, min, setInputValue, isSeparatedByComma]); // NumberStepper context
189
+ }, [max, min, setInputValue, isSeparatedByComma]);
196
190
 
191
+ // NumberStepper context
197
192
  const context = useMemo(() => ({
198
193
  isExternallyDisabled,
199
194
  dataTestId,
@@ -221,22 +216,22 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
221
216
  const {
222
217
  currentTarget
223
218
  } = e;
224
-
225
219
  if (!componentHasFocus.current && currentTarget.contains(document.activeElement)) {
226
220
  componentHasFocus.current = true;
227
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
221
+ onFocus?.(e);
228
222
  }
229
223
  },
230
224
  onBlur: e => {
231
225
  const {
232
226
  currentTarget
233
- } = e; // Give browser time to focus the next element
227
+ } = e;
234
228
 
229
+ // Give browser time to focus the next element
235
230
  requestAnimationFrame(() => {
236
231
  // Check if the new focused element is a child of the original container
237
232
  if (!currentTarget.contains(document.activeElement)) {
238
233
  componentHasFocus.current = false;
239
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
234
+ onBlur?.(e);
240
235
  }
241
236
  });
242
237
  }
@@ -244,54 +239,44 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
244
239
  value: context
245
240
  }, children || /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(NumberStepperDecrement, null), /*#__PURE__*/React__default.createElement(NumberStepperInput, null), /*#__PURE__*/React__default.createElement(NumberStepperIncrement, null))));
246
241
  });
242
+
247
243
  /**
248
244
  * Attempts to convert the given `value` to a number
249
245
  */
250
-
251
246
  function convertToNumber(value) {
252
247
  if (typeof value === 'number') {
253
248
  return value;
254
249
  }
255
-
256
- const num = Number(value === null || value === void 0 ? void 0 : value.replace(',', '.'));
257
-
250
+ const num = Number(value?.replace(',', '.'));
258
251
  if (Number.isNaN(num)) {
259
252
  return 0;
260
253
  }
261
-
262
254
  return num;
263
255
  }
264
-
265
256
  function localizeNumber(number, isSeparatedByComma) {
266
257
  if (isSeparatedByComma) {
267
258
  return String(number).replace('.', ',');
268
259
  }
269
-
270
260
  return number;
271
261
  }
272
-
273
262
  function roundToTwoDecimalPlaces(value) {
274
263
  return Math.round(value * 100) / 100;
275
264
  }
265
+
276
266
  /**
277
267
  * Compares the given `value` to min and/or max
278
268
  */
279
-
280
-
281
269
  function clampMinMax(value, _ref2) {
282
270
  let {
283
271
  min,
284
272
  max
285
273
  } = _ref2;
286
-
287
274
  if (typeof max === 'number' && value > max) {
288
275
  return max;
289
276
  }
290
-
291
277
  if (typeof min === 'number' && value < min) {
292
278
  return min;
293
279
  }
294
-
295
280
  return value;
296
281
  }
297
282
 
@@ -1,8 +1,8 @@
1
1
  import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = "._3Wb1o{display:inline-flex;width:127px}._1i2am{color:#32363a;background:#fafafa;outline:none;text-align:center;padding:0 12px;min-width:55px;width:100%;font-size:14px;border:1px solid #898989;border-radius:0;-moz-appearance:textfield}._1i2am:hover:not(._3ZIJi){cursor:pointer;background:#f5f5f5}._1i2am._3swUr{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000}._1i2am._3ZIJi{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._1i2am._3ZIJi>svg{opacity:.4}._1i2am::-webkit-inner-spin-button,._1i2am::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._1i2am:focus{z-index:0;border:none;border-radius:4px}._1i2am:focus:not(._3swUr){box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._1i2am:focus:not(._3ZIJi),._1SCb2{background:#fafafa}._1SCb2{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;fill:#515559;outline:none;border-radius:4px 0 0 4px;border:1px solid #898989;border-right-width:0}._1SCb2:hover:not(._3ZIJi){cursor:pointer;background:#f5f5f5}._1SCb2:active:not(._3ZIJi){background:#e5e5e5}._1SCb2._3ZIJi{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._1SCb2._3ZIJi>svg{opacity:.4}._2Rl3e{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;background:#fafafa;fill:#515559;outline:none;border-radius:0 4px 4px 0;border:1px solid #898989;border-left-width:0}._2Rl3e:hover:not(._3ZIJi){cursor:pointer;background:#f5f5f5}._2Rl3e:active:not(._3ZIJi){background:#e5e5e5}._2Rl3e._3ZIJi{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._2Rl3e._3ZIJi>svg{opacity:.4}";
4
- var styles = {"numberStepperContainer":"_3Wb1o","numberStepperInput":"_1i2am","disabled":"_3ZIJi","invalid":"_3swUr","decrementBtn":"_1SCb2","incrementBtn":"_2Rl3e"};
5
- var stylesheet="._3Wb1o{display:inline-flex;width:127px}._1i2am{color:#32363a;background:#fafafa;outline:none;text-align:center;padding:0 12px;min-width:55px;width:100%;font-size:14px;border:1px solid #898989;border-radius:0;-moz-appearance:textfield}._1i2am:hover:not(._3ZIJi){cursor:pointer;background:#f5f5f5}._1i2am._3swUr{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000}._1i2am._3ZIJi{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._1i2am._3ZIJi>svg{opacity:.4}._1i2am::-webkit-inner-spin-button,._1i2am::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._1i2am:focus{z-index:0;border:none;border-radius:4px}._1i2am:focus:not(._3swUr){box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._1i2am:focus:not(._3ZIJi),._1SCb2{background:#fafafa}._1SCb2{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;fill:#515559;outline:none;border-radius:4px 0 0 4px;border:1px solid #898989;border-right-width:0}._1SCb2:hover:not(._3ZIJi){cursor:pointer;background:#f5f5f5}._1SCb2:active:not(._3ZIJi){background:#e5e5e5}._1SCb2._3ZIJi{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._1SCb2._3ZIJi>svg{opacity:.4}._2Rl3e{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;background:#fafafa;fill:#515559;outline:none;border-radius:0 4px 4px 0;border:1px solid #898989;border-left-width:0}._2Rl3e:hover:not(._3ZIJi){cursor:pointer;background:#f5f5f5}._2Rl3e:active:not(._3ZIJi){background:#e5e5e5}._2Rl3e._3ZIJi{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._2Rl3e._3ZIJi>svg{opacity:.4}";
3
+ var css_248z = "._mfcv4{display:inline-flex;width:127px}._LJiKN{color:#32363a;background:#fafafa;outline:none;text-align:center;padding:0 12px;min-width:55px;width:100%;font-size:14px;border:1px solid #898989;border-radius:0;-moz-appearance:textfield}._LJiKN:hover:not(._g-sWc){cursor:pointer;background:#f5f5f5}._LJiKN._M5s3Q{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000}._LJiKN._g-sWc{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._LJiKN._g-sWc>svg{opacity:.4}._LJiKN::-webkit-inner-spin-button,._LJiKN::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._LJiKN:focus{z-index:0;border:none;border-radius:4px}._LJiKN:focus:not(._M5s3Q){box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._Kgxgi,._LJiKN:focus:not(._g-sWc){background:#fafafa}._Kgxgi{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;fill:#515559;outline:none;border-radius:4px 0 0 4px;border:1px solid #898989;border-right-width:0}._Kgxgi:hover:not(._g-sWc){cursor:pointer;background:#f5f5f5}._Kgxgi:active:not(._g-sWc){background:#e5e5e5}._Kgxgi._g-sWc{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._Kgxgi._g-sWc>svg{opacity:.4}._WHgHf{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;background:#fafafa;fill:#515559;outline:none;border-radius:0 4px 4px 0;border:1px solid #898989;border-left-width:0}._WHgHf:hover:not(._g-sWc){cursor:pointer;background:#f5f5f5}._WHgHf:active:not(._g-sWc){background:#e5e5e5}._WHgHf._g-sWc{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._WHgHf._g-sWc>svg{opacity:.4}";
4
+ var styles = {"numberStepperContainer":"_mfcv4","numberStepperInput":"_LJiKN","disabled":"_g-sWc","invalid":"_M5s3Q","decrementBtn":"_Kgxgi","incrementBtn":"_WHgHf"};
5
+ var stylesheet="._mfcv4{display:inline-flex;width:127px}._LJiKN{color:#32363a;background:#fafafa;outline:none;text-align:center;padding:0 12px;min-width:55px;width:100%;font-size:14px;border:1px solid #898989;border-radius:0;-moz-appearance:textfield}._LJiKN:hover:not(._g-sWc){cursor:pointer;background:#f5f5f5}._LJiKN._M5s3Q{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000}._LJiKN._g-sWc{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._LJiKN._g-sWc>svg{opacity:.4}._LJiKN::-webkit-inner-spin-button,._LJiKN::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._LJiKN:focus{z-index:0;border:none;border-radius:4px}._LJiKN:focus:not(._M5s3Q){box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._Kgxgi,._LJiKN:focus:not(._g-sWc){background:#fafafa}._Kgxgi{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;fill:#515559;outline:none;border-radius:4px 0 0 4px;border:1px solid #898989;border-right-width:0}._Kgxgi:hover:not(._g-sWc){cursor:pointer;background:#f5f5f5}._Kgxgi:active:not(._g-sWc){background:#e5e5e5}._Kgxgi._g-sWc{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._Kgxgi._g-sWc>svg{opacity:.4}._WHgHf{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;background:#fafafa;fill:#515559;outline:none;border-radius:0 4px 4px 0;border:1px solid #898989;border-left-width:0}._WHgHf:hover:not(._g-sWc){cursor:pointer;background:#f5f5f5}._WHgHf:active:not(._g-sWc){background:#e5e5e5}._WHgHf._g-sWc{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._WHgHf._g-sWc>svg{opacity:.4}";
6
6
  styleInject(css_248z);
7
7
 
8
8
  export { styles as default, stylesheet };
@@ -21,29 +21,30 @@ const NumberStepperDecrement = /*#__PURE__*/React__default.forwardRef((_ref, ref
21
21
  } = _ref;
22
22
  const {
23
23
  translate
24
- } = useTranslation(); // Context from NumberStepper
24
+ } = useTranslation();
25
25
 
26
+ // Context from NumberStepper
26
27
  const {
27
28
  isExternallyDisabled,
28
29
  dataTestId,
29
30
  decrement,
30
31
  internalValue,
31
32
  min
32
- } = useNumberStepperContext(); // Indicates if the button is disabled
33
+ } = useNumberStepperContext();
33
34
 
35
+ // Indicates if the button is disabled
34
36
  const isDisabled = internalValue <= min || isExternallyDisabled;
37
+
35
38
  /**
36
39
  * Calls `onClick` if it is defined.
37
40
  * Calls `decrement`.
38
41
  */
39
-
40
42
  const handleClick = e => {
41
43
  if (!isDisabled) {
42
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
44
+ onClick?.(e);
43
45
  decrement(true);
44
46
  }
45
47
  };
46
-
47
48
  return /*#__PURE__*/React__default.createElement("button", _extends({}, rest, {
48
49
  "data-testid": getSubDataTestId(dataTestId, 'Decrement'),
49
50
  ref: ref,
@@ -21,29 +21,30 @@ const NumberStepperIncrement = /*#__PURE__*/React__default.forwardRef((_ref, ref
21
21
  } = _ref;
22
22
  const {
23
23
  translate
24
- } = useTranslation(); // Context from NumberStepper
24
+ } = useTranslation();
25
25
 
26
+ // Context from NumberStepper
26
27
  const {
27
28
  isExternallyDisabled,
28
29
  dataTestId,
29
30
  increment,
30
31
  internalValue,
31
32
  max
32
- } = useNumberStepperContext(); // Indicates if the button is disabled
33
+ } = useNumberStepperContext();
33
34
 
35
+ // Indicates if the button is disabled
34
36
  const isDisabled = internalValue >= max || isExternallyDisabled;
37
+
35
38
  /**
36
39
  * Calls `onClick` if it is defined.
37
40
  * Calls `increment`.
38
41
  */
39
-
40
42
  const handleClick = e => {
41
43
  if (!isDisabled) {
42
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
44
+ onClick?.(e);
43
45
  increment(true);
44
46
  }
45
47
  };
46
-
47
48
  return /*#__PURE__*/React__default.createElement("button", _extends({}, rest, {
48
49
  "data-testid": getSubDataTestId(dataTestId, 'Increment'),
49
50
  ref: ref,
@@ -39,24 +39,24 @@ const NumberStepperInput = /*#__PURE__*/React__default.forwardRef((_ref, ref) =>
39
39
  handleInputChange,
40
40
  handleInputBlur,
41
41
  internalValue
42
- } = useNumberStepperContext(); // TODO: Add proper styling for the form field label (this is a breaking change)
42
+ } = useNumberStepperContext();
43
43
 
44
+ // TODO: Add proper styling for the form field label (this is a breaking change)
44
45
  const {
45
46
  helperTextId: formFieldHelperTextId,
46
47
  errorTextId: formFieldErrorTextId
47
48
  } = useFormFieldControl();
48
49
  const internalAriaDescribedby = concatIds(ariaDescribedBy, formFieldHelperTextId, formFieldErrorTextId);
49
50
  const isInvalid = internalValue > inputMax || internalValue < inputMin;
51
+
50
52
  /**
51
53
  * Calls `onKeyDown` if it is defined.
52
54
  * Calls `increment`, `decrement`, `increaseToMax`, or `decreaseToMin`
53
55
  * depending on the key that was pressed.
54
56
  */
55
-
56
57
  const handleKeyDown = e => {
57
- onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
58
+ onKeyDown?.(e);
58
59
  if (isExternallyDisabled) return;
59
-
60
60
  if (e.key === 'ArrowUp') {
61
61
  // Prevents browser's default increment
62
62
  e.preventDefault();
@@ -73,7 +73,8 @@ const NumberStepperInput = /*#__PURE__*/React__default.forwardRef((_ref, ref) =>
73
73
  // Prevents browser's default page scroll
74
74
  e.preventDefault();
75
75
  decreaseToMin();
76
- } // The w3 defines 'PageUp' and 'PageDown' as optional behavior.
76
+ }
77
+ // The w3 defines 'PageUp' and 'PageDown' as optional behavior.
77
78
  // We decided not to add this optional behavior, but still wanted to prevent default scrolling behavior.
78
79
  else if (e.key === 'PageUp') {
79
80
  // Prevents browser's default page scroll
@@ -83,29 +84,26 @@ const NumberStepperInput = /*#__PURE__*/React__default.forwardRef((_ref, ref) =>
83
84
  e.preventDefault();
84
85
  }
85
86
  };
87
+
86
88
  /**
87
89
  * Calls `onFocus` if it is defined.
88
90
  * Selects the DOM element
89
91
  */
90
-
91
-
92
92
  const handleFocus = e => {
93
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
93
+ onFocus?.(e);
94
94
  if (isExternallyDisabled) return;
95
95
  e.target.select();
96
96
  };
97
+
97
98
  /**
98
99
  * Calls `onBlur` if it is defined.
99
100
  * Calls `handleInputBlur`
100
101
  */
101
-
102
-
103
102
  const handleBlur = e => {
104
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
103
+ onBlur?.(e);
105
104
  if (isExternallyDisabled) return;
106
105
  handleInputBlur(e);
107
106
  };
108
-
109
107
  return /*#__PURE__*/React__default.createElement("input", _extends({}, rest, {
110
108
  ref: ref,
111
109
  "data-testid": getSubDataTestId(dataTestId, 'Input'),
@@ -1,8 +1,8 @@
1
1
  import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = "._2RpNN{height:100vh;width:100vw;display:grid;grid-template-rows:auto 1fr;grid-template-columns:auto auto 1fr;grid-template-areas:\"pageHeader pageHeader pageHeader\" \"sidebarNav configPane mainContent\"}._2OH5b{grid-area:pageHeader}._2HNqt{grid-area:mainContent;height:100%;overflow:auto}";
4
- var styles = {"pageContainer":"_2RpNN","pageHeader":"_2OH5b","mainContent":"_2HNqt"};
5
- var stylesheet="._2RpNN{height:100vh;width:100vw;display:grid;grid-template-rows:auto 1fr;grid-template-columns:auto auto 1fr;grid-template-areas:\"pageHeader pageHeader pageHeader\" \"sidebarNav configPane mainContent\"}._2OH5b{grid-area:pageHeader}._2HNqt{grid-area:mainContent;height:100%;overflow:auto}";
3
+ var css_248z = "._0aw7q{height:100vh;width:100vw;display:grid;grid-template-rows:auto 1fr;grid-template-columns:auto auto 1fr;grid-template-areas:\"pageHeader pageHeader pageHeader\" \"sidebarNav configPane mainContent\"}._w1q4t{grid-area:pageHeader}._6gm07{grid-area:mainContent;height:100%;overflow:auto}";
4
+ var styles = {"pageContainer":"_0aw7q","pageHeader":"_w1q4t","mainContent":"_6gm07"};
5
+ var stylesheet="._0aw7q{height:100vh;width:100vw;display:grid;grid-template-rows:auto 1fr;grid-template-columns:auto auto 1fr;grid-template-areas:\"pageHeader pageHeader pageHeader\" \"sidebarNav configPane mainContent\"}._w1q4t{grid-area:pageHeader}._6gm07{grid-area:mainContent;height:100%;overflow:auto}";
6
6
  styleInject(css_248z);
7
7
 
8
8
  export { styles as default, stylesheet };