@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
@@ -14,7 +14,6 @@ import hsvToHex from './utils/hsvToHex.js';
14
14
  import getSubDataTestId from '../../utils/getSubDataTestId/getSubDataTestId.js';
15
15
 
16
16
  /* eslint-disable jsx-a11y/no-static-element-interactions */
17
-
18
17
  function Saturation(_ref) {
19
18
  let {
20
19
  hsv,
@@ -24,7 +23,7 @@ function Saturation(_ref) {
24
23
  } = _ref;
25
24
  const gridRef = useRef(null);
26
25
  const loopRef = useRef(null);
27
- const saturationId = "".concat(containerId, "-saturation");
26
+ const saturationId = `${containerId}-saturation`;
28
27
  const {
29
28
  translate
30
29
  } = useTranslation();
@@ -48,91 +47,71 @@ function Saturation(_ref) {
48
47
  onSaturationChange(newSaturation, newValue);
49
48
  });
50
49
  const handleMouseDown = useMouseDrag(handleChange);
51
-
52
50
  function handleKeyDown(e) {
53
51
  switch (e.key) {
54
52
  case 'ArrowUp':
55
53
  e.preventDefault(); // prevent page scroll
56
-
57
54
  setIsKeyboardUser(true);
58
55
  onSaturationChange(hsv.s, Math.min(hsv.v + 0.01, 1));
59
56
  break;
60
-
61
57
  case 'ArrowDown':
62
58
  e.preventDefault(); // prevent page scroll
63
-
64
59
  setIsKeyboardUser(true);
65
60
  onSaturationChange(hsv.s, Math.max(hsv.v - 0.01, 0));
66
61
  break;
67
-
68
62
  case 'ArrowLeft':
69
63
  e.preventDefault(); // prevent page scroll
70
-
71
64
  setIsKeyboardUser(true);
72
65
  onSaturationChange(Math.max(hsv.s - 0.01, 0), hsv.v);
73
66
  break;
74
-
75
67
  case 'ArrowRight':
76
68
  e.preventDefault(); // prevent page scroll
77
-
78
69
  setIsKeyboardUser(true);
79
70
  onSaturationChange(Math.min(hsv.s + 0.01, 1), hsv.v);
80
71
  break;
81
-
82
72
  case 'Home':
83
73
  e.preventDefault(); // prevent page scroll
84
-
85
74
  setIsKeyboardUser(true);
86
75
  onSaturationChange(0, hsv.v);
87
76
  break;
88
-
89
77
  case 'End':
90
78
  e.preventDefault(); // prevent page scroll
91
-
92
79
  setIsKeyboardUser(true);
93
80
  onSaturationChange(1, hsv.v);
94
81
  break;
95
-
96
82
  case 'PageUp':
97
83
  e.preventDefault(); // prevent page scroll
98
-
99
84
  setIsKeyboardUser(true);
100
85
  onSaturationChange(hsv.s, 1);
101
86
  break;
102
-
103
87
  case 'PageDown':
104
88
  e.preventDefault(); // prevent page scroll
105
-
106
89
  setIsKeyboardUser(true);
107
90
  onSaturationChange(hsv.s, 0);
108
91
  break;
109
-
110
92
  default:
111
93
  break;
112
94
  }
113
95
  }
114
-
115
96
  return /*#__PURE__*/React__default.createElement("div", {
116
97
  className: styles.saturationGrid,
117
98
  style: {
118
- backgroundColor: "".concat(hsvToHex({
99
+ backgroundColor: `${hsvToHex({
119
100
  h: hsv.h,
120
101
  s: 1,
121
102
  v: 1
122
- }))
103
+ })}`
123
104
  },
124
105
  onMouseDown: e => {
125
- var _loopRef$current;
126
-
127
106
  // prevent text highlighting while dragging
128
107
  e.preventDefault();
129
- (_loopRef$current = loopRef.current) === null || _loopRef$current === void 0 ? void 0 : _loopRef$current.focus();
108
+ loopRef.current?.focus();
130
109
  handleMouseDown(e);
131
110
  },
132
111
  "data-testid": getSubDataTestId(dataTestId, 'saturation-grid'),
133
112
  ref: gridRef
134
113
  }, /*#__PURE__*/React__default.createElement("div", {
135
- id: "".concat(saturationId, "-saturation-desc"),
114
+ id: `${saturationId}-saturation-desc`,
136
115
  className: styles.hidden
137
116
  }, saturationAriaDesc), /*#__PURE__*/React__default.createElement("div", {
138
117
  "aria-live": loopRef.current === document.activeElement ? 'assertive' : 'off',
@@ -143,13 +122,13 @@ function Saturation(_ref) {
143
122
  }, valueAriaLive), /*#__PURE__*/React__default.createElement("div", {
144
123
  className: styles.saturationLoop,
145
124
  style: {
146
- left: "calc(".concat(hsv.s * 100, "% - ").concat(hsv.s * 12, "px)"),
147
- bottom: "calc(".concat(hsv.v * 100, "% - ").concat(hsv.v * 12, "px)")
125
+ left: `calc(${hsv.s * 100}% - ${hsv.s * 12}px)`,
126
+ bottom: `calc(${hsv.v * 100}% - ${hsv.v * 12}px)`
148
127
  },
149
128
  onKeyDown: handleKeyDown,
150
129
  tabIndex: 0,
151
130
  "aria-label": saturationAriaLabel,
152
- "aria-describedby": "".concat(saturationId, "-saturation-desc"),
131
+ "aria-describedby": `${saturationId}-saturation-desc`,
153
132
  ref: loopRef,
154
133
  "data-testid": getSubDataTestId(dataTestId, 'saturation-thumb')
155
134
  }));
@@ -2,49 +2,39 @@
2
2
  function calculateTargetId(focusedId, paletteLength, direction) {
3
3
  const rowLength = 9;
4
4
  const rowCount = Math.ceil(paletteLength / rowLength);
5
-
6
5
  switch (direction) {
7
6
  case 'up':
8
7
  // move focus up 1 row
9
8
  if (focusedId - rowLength >= 0) {
10
9
  return focusedId - rowLength;
11
- } // loop focus to bottom row
12
-
13
-
10
+ }
11
+ // loop focus to bottom row
14
12
  if ((rowCount - 1) * rowLength + focusedId < paletteLength) {
15
13
  return (rowCount - 1) * rowLength + focusedId;
16
- } // incomplete row exception: loop focus to second row from bottom
17
-
18
-
14
+ }
15
+ // incomplete row exception: loop focus to second row from bottom
19
16
  return (rowCount - 2) * rowLength + focusedId;
20
-
21
17
  case 'down':
22
18
  // move focus down 1 row
23
19
  if (focusedId + rowLength < paletteLength) {
24
20
  return focusedId + rowLength;
25
- } // loop focus to top row
26
-
27
-
21
+ }
22
+ // loop focus to top row
28
23
  return focusedId % rowLength;
29
-
30
24
  case 'left':
31
25
  // first item in row is focused: loop focus to end of row, or last item if row is incomplete
32
26
  if ((focusedId - 1) % rowLength === rowLength - 1 || focusedId - 1 < 0) {
33
27
  return Math.min(focusedId + (rowLength - 1), paletteLength - 1);
34
- } // move focus left 1
35
-
36
-
28
+ }
29
+ // move focus left 1
37
30
  return focusedId - 1;
38
-
39
31
  case 'right':
40
32
  // move focus right 1
41
33
  if (focusedId + 1 < paletteLength && (focusedId + 1) % rowLength !== 0) {
42
34
  return focusedId + 1;
43
- } // last item in row is focused: loop focus to first item in row
44
-
45
-
35
+ }
36
+ // last item in row is focused: loop focus to first item in row
46
37
  return (Math.ceil((focusedId + 1) / rowLength) - 1) * rowLength;
47
-
48
38
  default:
49
39
  return 0;
50
40
  }
@@ -1,11 +1,12 @@
1
1
  function getMousePosition(e, containerRef) {
2
2
  const container = containerRef.current.getBoundingClientRect();
3
3
  const containerWidth = container.width;
4
- const containerHeight = container.height; // mouse positions
5
-
4
+ const containerHeight = container.height;
5
+ // mouse positions
6
6
  const mouseXPosition = e.clientX;
7
- const mouseYPosition = e.clientY; // distance between mouse position and edge of container
7
+ const mouseYPosition = e.clientY;
8
8
 
9
+ // distance between mouse position and edge of container
9
10
  const left = mouseXPosition - container.left;
10
11
  const bottom = container.bottom - mouseYPosition;
11
12
  return {
@@ -1,7 +1,6 @@
1
1
  import hexToRgb from './hexToRgb.js';
2
2
 
3
3
  // formula from https://www.rapidtables.com/convert/color/rgb-to-hsv.html
4
-
5
4
  function hexToHsv(hex) {
6
5
  const {
7
6
  r,
@@ -20,20 +19,16 @@ function hexToHsv(hex) {
20
19
  case rDecimal:
21
20
  h = ((gDecimal - bDecimal) / d + (gDecimal < bDecimal ? 6 : 0)) * 60;
22
21
  break;
23
-
24
22
  case gDecimal:
25
23
  h = ((bDecimal - rDecimal) / d + 2) * 60;
26
24
  break;
27
-
28
25
  case bDecimal:
29
26
  h = ((rDecimal - gDecimal) / d + 4) * 60;
30
27
  break;
31
-
32
28
  default:
33
29
  throw new Error('There was a problem with ColorPicker: broken hexToHsv conversion. Please reach out to the CFE team.');
34
30
  break;
35
31
  }
36
-
37
32
  h = Math.min(Math.round(h), 359);
38
33
  }
39
34
  let s;
@@ -1,11 +1,9 @@
1
1
  import hexToRgb from './hexToRgb.js';
2
2
 
3
3
  function hexToRgbaString(color) {
4
- var _color$alpha;
5
-
6
4
  const rgb = hexToRgb(color.hex);
7
- const alpha = (_color$alpha = color.alpha) !== null && _color$alpha !== void 0 ? _color$alpha : 100;
8
- return "rgba(".concat(rgb.r, ", ").concat(rgb.g, ", ").concat(rgb.b, ", ").concat(alpha / 100, ")");
5
+ const alpha = color.alpha ?? 100;
6
+ return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha / 100})`;
9
7
  }
10
8
 
11
9
  export { hexToRgbaString as default };
@@ -1,7 +1,6 @@
1
1
  import rgbToHex from './rgbToHex.js';
2
2
 
3
3
  // formula from https://www.rapidtables.com/convert/color/hsv-to-rgb.html
4
-
5
4
  function hsvToHex(hsv) {
6
5
  const {
7
6
  h,
@@ -16,7 +15,6 @@ function hsvToHex(hsv) {
16
15
  const secondary = Math.round((x + m) * 255);
17
16
  const tertiary = Math.round(m * 255);
18
17
  let rgb;
19
-
20
18
  if (section === 0) {
21
19
  rgb = {
22
20
  r: primary,
@@ -54,7 +52,6 @@ function hsvToHex(hsv) {
54
52
  b: secondary
55
53
  };
56
54
  }
57
-
58
55
  return rgbToHex(rgb);
59
56
  }
60
57
 
@@ -7,7 +7,7 @@ function rgbToHex(_ref) {
7
7
  const rStr = r.toString(16).padStart(2, '0');
8
8
  const gStr = g.toString(16).padStart(2, '0');
9
9
  const bStr = b.toString(16).padStart(2, '0');
10
- return "#".concat(rStr).concat(gStr).concat(bStr);
10
+ return `#${rStr}${gStr}${bStr}`;
11
11
  }
12
12
 
13
13
  export { rgbToHex as default };
@@ -1,48 +1,41 @@
1
1
  function validateHex(currentColor, newHex, isAlphaEnabled) {
2
- var _currentColor$alpha;
3
-
4
2
  // set current alpha to hex format
5
- const alpha = Math.round(((_currentColor$alpha = currentColor.alpha) !== null && _currentColor$alpha !== void 0 ? _currentColor$alpha : 100) / 100 * 255).toString(16).toUpperCase().padStart(2, '0');
3
+ const alpha = Math.round((currentColor.alpha ?? 100) / 100 * 255).toString(16).toUpperCase().padStart(2, '0');
6
4
  let newAlpha = isAlphaEnabled ? alpha : '';
7
5
  let validatedHex;
8
6
  const hexLength = isAlphaEnabled ? 8 : 6;
9
- const hexRegex = /^[a-fA-F0-9]+$/; // if newHex contains invalid characters or is empty string, revert to previous color
7
+ const hexRegex = /^[a-fA-F0-9]+$/;
10
8
 
11
- if (!hexRegex.test(newHex.slice(0, hexLength))) return "".concat(currentColor.hex.substring(1)).concat(newAlpha); // match validation pattern based on string length
9
+ // if newHex contains invalid characters or is empty string, revert to previous color
10
+ if (!hexRegex.test(newHex.slice(0, hexLength))) return `${currentColor.hex.substring(1)}${newAlpha}`;
12
11
 
12
+ // match validation pattern based on string length
13
13
  switch (newHex.length) {
14
14
  case 1:
15
- validatedHex = "".concat(newHex.repeat(6)).concat(newAlpha);
15
+ validatedHex = `${newHex.repeat(6)}${newAlpha}`;
16
16
  break;
17
-
18
17
  case 2:
19
- validatedHex = "".concat(newHex.repeat(3)).concat(newAlpha);
18
+ validatedHex = `${newHex.repeat(3)}${newAlpha}`;
20
19
  break;
21
-
22
20
  case 3:
23
- validatedHex = "".concat(newHex[0].repeat(2)).concat(newHex[1].repeat(2)).concat(newHex[2].repeat(2)).concat(newAlpha);
21
+ validatedHex = `${newHex[0].repeat(2)}${newHex[1].repeat(2)}${newHex[2].repeat(2)}${newAlpha}`;
24
22
  break;
25
-
26
23
  case 4:
27
24
  case 5:
28
25
  newAlpha = isAlphaEnabled ? newHex[3].repeat(2) : '';
29
- validatedHex = "".concat(newHex[0].repeat(2)).concat(newHex[1].repeat(2)).concat(newHex[2].repeat(2)).concat(newAlpha);
26
+ validatedHex = `${newHex[0].repeat(2)}${newHex[1].repeat(2)}${newHex[2].repeat(2)}${newAlpha}`;
30
27
  break;
31
-
32
28
  case 6:
33
- validatedHex = "".concat(newHex).concat(newAlpha);
29
+ validatedHex = `${newHex}${newAlpha}`;
34
30
  break;
35
-
36
31
  case 7:
37
- validatedHex = "".concat(newHex.substring(0, 6)).concat(newAlpha);
32
+ validatedHex = `${newHex.substring(0, 6)}${newAlpha}`;
38
33
  break;
39
-
40
34
  default:
41
35
  newAlpha = isAlphaEnabled ? newHex.substring(6, 8) : '';
42
- validatedHex = "".concat(newHex.substring(0, 6)).concat(newAlpha);
36
+ validatedHex = `${newHex.substring(0, 6)}${newAlpha}`;
43
37
  break;
44
38
  }
45
-
46
39
  return validatedHex.toUpperCase();
47
40
  }
48
41