@itwin/itwinui-react 3.0.0-dev.1 → 3.0.0-dev.2

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 (211) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/cjs/core/Alert/Alert.d.ts +47 -28
  3. package/cjs/core/Alert/Alert.js +73 -21
  4. package/cjs/core/Avatar/Avatar.js +1 -1
  5. package/cjs/core/AvatarGroup/AvatarGroup.js +1 -1
  6. package/cjs/core/Breadcrumbs/Breadcrumbs.js +2 -3
  7. package/cjs/core/ButtonGroup/ButtonGroup.js +1 -4
  8. package/cjs/core/Buttons/DropdownButton/DropdownButton.js +3 -5
  9. package/cjs/core/Carousel/Carousel.d.ts +2 -2
  10. package/cjs/core/Carousel/Carousel.js +3 -5
  11. package/cjs/core/Carousel/CarouselDotsList.js +8 -10
  12. package/cjs/core/Carousel/CarouselNavigation.d.ts +2 -2
  13. package/cjs/core/Carousel/CarouselNavigation.js +3 -5
  14. package/cjs/core/Carousel/CarouselSlider.js +10 -15
  15. package/cjs/core/ColorPicker/ColorBuilder.js +7 -10
  16. package/cjs/core/ColorPicker/ColorInputPanel.js +12 -15
  17. package/cjs/core/ColorPicker/ColorPalette.js +4 -6
  18. package/cjs/core/ColorPicker/ColorPicker.js +3 -3
  19. package/cjs/core/ComboBox/ComboBox.js +25 -32
  20. package/cjs/core/ComboBox/ComboBoxDropdown.js +1 -2
  21. package/cjs/core/ComboBox/ComboBoxEndIcon.js +1 -1
  22. package/cjs/core/ComboBox/ComboBoxInput.js +21 -20
  23. package/cjs/core/ComboBox/ComboBoxMenu.js +3 -4
  24. package/cjs/core/ComboBox/ComboBoxMenuItem.js +2 -2
  25. package/cjs/core/ComboBox/helpers.js +4 -5
  26. package/cjs/core/DatePicker/DatePicker.js +32 -32
  27. package/cjs/core/Dialog/Dialog.js +11 -4
  28. package/cjs/core/Dialog/DialogBackdrop.js +1 -1
  29. package/cjs/core/Dialog/DialogContext.d.ts +11 -0
  30. package/cjs/core/Dialog/DialogMain.js +16 -22
  31. package/cjs/core/DropdownMenu/DropdownMenu.js +6 -8
  32. package/cjs/core/ExpandableBlock/ExpandableBlock.js +2 -2
  33. package/cjs/core/FileUpload/FileEmptyCard.js +1 -1
  34. package/cjs/core/FileUpload/FileUpload.js +3 -6
  35. package/cjs/core/FileUpload/FileUploadCard.js +9 -10
  36. package/cjs/core/InformationPanel/InformationPanel.js +1 -4
  37. package/cjs/core/LabeledInput/LabeledInput.js +1 -1
  38. package/cjs/core/LabeledTextarea/LabeledTextarea.js +1 -1
  39. package/cjs/core/Menu/Menu.js +3 -4
  40. package/cjs/core/Menu/MenuItem.js +8 -11
  41. package/cjs/core/Modal/Modal.d.ts +8 -9
  42. package/cjs/core/Modal/Modal.js +7 -17
  43. package/cjs/core/SearchBox/SearchBox.js +12 -12
  44. package/cjs/core/Select/Select.js +12 -17
  45. package/cjs/core/SideNavigation/SideNavigation.js +2 -2
  46. package/cjs/core/Slider/Slider.js +16 -19
  47. package/cjs/core/Slider/Thumb.js +1 -1
  48. package/cjs/core/StatusMessage/StatusMessage.js +1 -1
  49. package/cjs/core/Stepper/Stepper.js +1 -1
  50. package/cjs/core/Stepper/StepperStep.js +1 -1
  51. package/cjs/core/Table/Table.js +15 -15
  52. package/cjs/core/Table/TablePaginator.js +2 -3
  53. package/cjs/core/Table/TableRowMemoized.js +38 -45
  54. package/cjs/core/Table/actionHandlers/expandHandler.js +3 -3
  55. package/cjs/core/Table/actionHandlers/filterHandler.js +4 -5
  56. package/cjs/core/Table/actionHandlers/selectHandler.js +6 -6
  57. package/cjs/core/Table/cells/DefaultCell.js +1 -1
  58. package/cjs/core/Table/cells/EditableCell.js +6 -12
  59. package/cjs/core/Table/columns/actionColumn.js +3 -6
  60. package/cjs/core/Table/columns/expanderColumn.js +3 -3
  61. package/cjs/core/Table/columns/selectionColumn.js +4 -4
  62. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
  63. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
  64. package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
  65. package/cjs/core/Table/filters/TextFilter/TextFilter.js +1 -2
  66. package/cjs/core/Table/hooks/useResizeColumns.js +16 -22
  67. package/cjs/core/Table/hooks/useScrollToRow.js +1 -2
  68. package/cjs/core/Table/hooks/useStickyColumns.js +3 -5
  69. package/cjs/core/Table/hooks/useSubRowFiltering.js +2 -4
  70. package/cjs/core/Tabs/Tabs.js +13 -16
  71. package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
  72. package/cjs/core/ThemeProvider/ThemeProvider.d.ts +2 -3
  73. package/cjs/core/ThemeProvider/ThemeProvider.js +11 -13
  74. package/cjs/core/Tile/Tile.js +2 -3
  75. package/cjs/core/TimePicker/TimePicker.js +13 -13
  76. package/cjs/core/Toast/Toast.js +2 -3
  77. package/cjs/core/Toast/Toaster.js +6 -11
  78. package/cjs/core/TransferList/TransferList.js +3 -4
  79. package/cjs/core/Tree/Tree.js +9 -13
  80. package/cjs/core/Tree/TreeNode.js +9 -10
  81. package/cjs/core/utils/color/ColorValue.js +9 -15
  82. package/cjs/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
  83. package/cjs/core/utils/components/FocusTrap.js +4 -4
  84. package/cjs/core/utils/components/MiddleTextTruncation.js +1 -2
  85. package/cjs/core/utils/components/Popover.js +5 -8
  86. package/cjs/core/utils/components/Resizer.js +7 -6
  87. package/cjs/core/utils/components/VirtualScroll.js +14 -21
  88. package/cjs/core/utils/functions/dom.js +5 -5
  89. package/cjs/core/utils/functions/polymorphic.js +1 -1
  90. package/cjs/core/utils/functions/supports.js +1 -1
  91. package/cjs/core/utils/hooks/index.d.ts +0 -1
  92. package/cjs/core/utils/hooks/index.js +0 -1
  93. package/cjs/core/utils/hooks/useContainerWidth.js +1 -1
  94. package/cjs/core/utils/hooks/useDragAndDrop.js +8 -10
  95. package/cjs/core/utils/hooks/useEventListener.js +1 -1
  96. package/cjs/core/utils/hooks/useGlobals.d.ts +9 -2
  97. package/cjs/core/utils/hooks/useGlobals.js +6 -4
  98. package/cjs/core/utils/hooks/useId.js +1 -2
  99. package/cjs/core/utils/hooks/useIntersection.js +2 -3
  100. package/cjs/core/utils/hooks/useMediaQuery.js +6 -8
  101. package/cjs/core/utils/hooks/useOverflow.js +1 -2
  102. package/cjs/core/utils/hooks/useResizeObserver.js +3 -4
  103. package/cjs/styles.js +1 -4
  104. package/esm/core/Alert/Alert.d.ts +47 -28
  105. package/esm/core/Alert/Alert.js +74 -22
  106. package/esm/core/Avatar/Avatar.js +1 -1
  107. package/esm/core/AvatarGroup/AvatarGroup.js +1 -1
  108. package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -3
  109. package/esm/core/ButtonGroup/ButtonGroup.js +1 -4
  110. package/esm/core/Buttons/DropdownButton/DropdownButton.js +3 -5
  111. package/esm/core/Carousel/Carousel.d.ts +2 -2
  112. package/esm/core/Carousel/Carousel.js +3 -5
  113. package/esm/core/Carousel/CarouselDotsList.js +8 -10
  114. package/esm/core/Carousel/CarouselNavigation.d.ts +2 -2
  115. package/esm/core/Carousel/CarouselNavigation.js +3 -5
  116. package/esm/core/Carousel/CarouselSlider.js +10 -15
  117. package/esm/core/ColorPicker/ColorBuilder.js +7 -10
  118. package/esm/core/ColorPicker/ColorInputPanel.js +12 -15
  119. package/esm/core/ColorPicker/ColorPalette.js +4 -6
  120. package/esm/core/ColorPicker/ColorPicker.js +3 -3
  121. package/esm/core/ComboBox/ComboBox.js +25 -32
  122. package/esm/core/ComboBox/ComboBoxDropdown.js +1 -2
  123. package/esm/core/ComboBox/ComboBoxEndIcon.js +1 -1
  124. package/esm/core/ComboBox/ComboBoxInput.js +21 -20
  125. package/esm/core/ComboBox/ComboBoxMenu.js +3 -4
  126. package/esm/core/ComboBox/ComboBoxMenuItem.js +2 -2
  127. package/esm/core/ComboBox/helpers.js +4 -5
  128. package/esm/core/DatePicker/DatePicker.js +32 -32
  129. package/esm/core/Dialog/Dialog.js +12 -5
  130. package/esm/core/Dialog/DialogBackdrop.js +1 -1
  131. package/esm/core/Dialog/DialogContext.d.ts +11 -0
  132. package/esm/core/Dialog/DialogMain.js +16 -22
  133. package/esm/core/DropdownMenu/DropdownMenu.js +6 -8
  134. package/esm/core/ExpandableBlock/ExpandableBlock.js +2 -2
  135. package/esm/core/FileUpload/FileEmptyCard.js +1 -1
  136. package/esm/core/FileUpload/FileUpload.js +3 -6
  137. package/esm/core/FileUpload/FileUploadCard.js +9 -10
  138. package/esm/core/InformationPanel/InformationPanel.js +1 -4
  139. package/esm/core/LabeledInput/LabeledInput.js +1 -1
  140. package/esm/core/LabeledTextarea/LabeledTextarea.js +1 -1
  141. package/esm/core/Menu/Menu.js +3 -4
  142. package/esm/core/Menu/MenuItem.js +8 -11
  143. package/esm/core/Modal/Modal.d.ts +8 -9
  144. package/esm/core/Modal/Modal.js +3 -10
  145. package/esm/core/SearchBox/SearchBox.js +12 -12
  146. package/esm/core/Select/Select.js +12 -17
  147. package/esm/core/SideNavigation/SideNavigation.js +2 -2
  148. package/esm/core/Slider/Slider.js +16 -19
  149. package/esm/core/Slider/Thumb.js +1 -1
  150. package/esm/core/StatusMessage/StatusMessage.js +1 -1
  151. package/esm/core/Stepper/Stepper.js +1 -1
  152. package/esm/core/Stepper/StepperStep.js +1 -1
  153. package/esm/core/Table/Table.js +15 -15
  154. package/esm/core/Table/TablePaginator.js +2 -3
  155. package/esm/core/Table/TableRowMemoized.js +38 -45
  156. package/esm/core/Table/actionHandlers/expandHandler.js +3 -3
  157. package/esm/core/Table/actionHandlers/filterHandler.js +4 -5
  158. package/esm/core/Table/actionHandlers/selectHandler.js +6 -6
  159. package/esm/core/Table/cells/DefaultCell.js +1 -1
  160. package/esm/core/Table/cells/EditableCell.js +6 -12
  161. package/esm/core/Table/columns/actionColumn.js +3 -6
  162. package/esm/core/Table/columns/expanderColumn.js +3 -3
  163. package/esm/core/Table/columns/selectionColumn.js +4 -4
  164. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
  165. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
  166. package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
  167. package/esm/core/Table/filters/TextFilter/TextFilter.js +1 -2
  168. package/esm/core/Table/hooks/useResizeColumns.js +16 -22
  169. package/esm/core/Table/hooks/useScrollToRow.js +1 -2
  170. package/esm/core/Table/hooks/useStickyColumns.js +3 -5
  171. package/esm/core/Table/hooks/useSubRowFiltering.js +2 -4
  172. package/esm/core/Tabs/Tabs.js +13 -16
  173. package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
  174. package/esm/core/ThemeProvider/ThemeProvider.d.ts +2 -3
  175. package/esm/core/ThemeProvider/ThemeProvider.js +12 -14
  176. package/esm/core/Tile/Tile.js +2 -3
  177. package/esm/core/TimePicker/TimePicker.js +13 -13
  178. package/esm/core/Toast/Toast.js +2 -3
  179. package/esm/core/Toast/Toaster.js +6 -11
  180. package/esm/core/TransferList/TransferList.js +3 -4
  181. package/esm/core/Tree/Tree.js +9 -13
  182. package/esm/core/Tree/TreeNode.js +9 -10
  183. package/esm/core/utils/color/ColorValue.js +9 -15
  184. package/esm/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
  185. package/esm/core/utils/components/FocusTrap.js +4 -4
  186. package/esm/core/utils/components/MiddleTextTruncation.js +1 -2
  187. package/esm/core/utils/components/Popover.js +5 -8
  188. package/esm/core/utils/components/Resizer.js +7 -6
  189. package/esm/core/utils/components/VirtualScroll.js +14 -21
  190. package/esm/core/utils/functions/dom.js +5 -5
  191. package/esm/core/utils/functions/polymorphic.js +1 -1
  192. package/esm/core/utils/functions/supports.js +1 -1
  193. package/esm/core/utils/hooks/index.d.ts +0 -1
  194. package/esm/core/utils/hooks/index.js +0 -1
  195. package/esm/core/utils/hooks/useContainerWidth.js +1 -1
  196. package/esm/core/utils/hooks/useDragAndDrop.js +8 -10
  197. package/esm/core/utils/hooks/useEventListener.js +1 -1
  198. package/esm/core/utils/hooks/useGlobals.d.ts +9 -2
  199. package/esm/core/utils/hooks/useGlobals.js +6 -4
  200. package/esm/core/utils/hooks/useId.js +1 -2
  201. package/esm/core/utils/hooks/useIntersection.js +2 -3
  202. package/esm/core/utils/hooks/useMediaQuery.js +6 -8
  203. package/esm/core/utils/hooks/useOverflow.js +1 -2
  204. package/esm/core/utils/hooks/useResizeObserver.js +3 -4
  205. package/esm/styles.js +1 -4
  206. package/package.json +2 -2
  207. package/styles.css +18 -20
  208. package/cjs/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
  209. package/cjs/core/utils/hooks/useIsThemeAlreadySet.js +0 -54
  210. package/esm/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
  211. package/esm/core/utils/hooks/useIsThemeAlreadySet.js +0 -27
@@ -4,32 +4,84 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import cx from 'classnames';
6
6
  import * as React from 'react';
7
- import { StatusIconMap, SvgCloseSmall, Box } from '../utils/index.js';
7
+ import { Icon, useSafeContext, polymorphic, StatusIconMap, SvgCloseSmall, Box, } from '../utils/index.js';
8
+ import { IconButton } from '../Buttons/index.js';
9
+ const AlertContext = React.createContext(undefined);
10
+ const AlertComponent = React.forwardRef((props, ref) => {
11
+ const { children, className, type = 'informational', isSticky = false, ...rest } = props;
12
+ return (React.createElement(Box, { className: cx('iui-alert', className), "data-iui-status": type, "data-iui-variant": isSticky ? 'sticky' : undefined, ref: ref, ...rest },
13
+ React.createElement(AlertContext.Provider, { value: { type } }, children)));
14
+ });
15
+ AlertComponent.displayName = 'Alert';
16
+ // ----------------------------------------------------------------------------
17
+ // Alert.Icon component
18
+ const AlertIcon = React.forwardRef((props, ref) => {
19
+ const { children, ...rest } = props;
20
+ const { type } = useSafeContext(AlertContext);
21
+ const StatusIcon = StatusIconMap[type];
22
+ return (React.createElement(Icon, { fill: type, ref: ref, ...rest }, children ?? React.createElement(StatusIcon, null)));
23
+ });
24
+ AlertIcon.displayName = 'Alert.Icon';
25
+ // ----------------------------------------------------------------------------
26
+ // Alert.Message component
27
+ const AlertMessage = polymorphic.span('iui-alert-message');
28
+ AlertMessage.displayName = 'Alert.Message';
29
+ // ----------------------------------------------------------------------------
30
+ // Alert.Action component
31
+ const AlertAction = React.forwardRef((props, ref) => {
32
+ const { children, className, ...rest } = props;
33
+ return (React.createElement(Box, { as: (!!props.href ? 'a' : 'button'), className: cx('iui-alert-link', className), ref: ref, ...rest }, children));
34
+ });
35
+ AlertAction.displayName = 'Alert.Action';
36
+ // ----------------------------------------------------------------------------
37
+ // Alert.CloseButton component
38
+ const AlertCloseButton = React.forwardRef((props, ref) => {
39
+ const { children, ...rest } = props;
40
+ return (React.createElement(IconButton, { styleType: 'borderless', size: 'small', "aria-label": 'Close', ref: ref, ...rest }, children ?? React.createElement(SvgCloseSmall, null)));
41
+ });
42
+ AlertCloseButton.displayName = 'Alert.CloseButton';
8
43
  /**
9
44
  * A small box to quickly grab user attention and communicate a brief message
10
45
  * @example
11
- * <Alert>This is a basic alert.</Alert>
12
- * <Alert type='positive'>This is a positive alert.</Alert>
13
- * <Alert type='warning'>This is a warning alert.</Alert>
14
- * <Alert type='negative'>This is a negative alert.</Alert>
15
- * <Alert
16
- * type='positive'
17
- * clickableText="I am a clickable text"
18
- * clickableTextProps={{ href: 'https://www.example.com' }}
19
- * >
20
- * This is a positive alert with a clickable text
46
+ * <Alert>
47
+ * <Alert.Message>This is an alert.</Alert.Message>
48
+ * </Alert>
49
+ * @example
50
+ * <Alert type='informational'>
51
+ * <Alert.Icon />
52
+ * <Alert.Message>This is an informational alert.</Alert.Message>
53
+ * <Alert.CloseButton onClick={() => {}} />
54
+ * </Alert>
55
+ * @example
56
+ * <Alert type='positive'>
57
+ * <Alert.Icon>
58
+ * <SvgSmileyHappy />
59
+ * </Alert.Icon>
60
+ * <Alert.Message>
61
+ * This is an alert.
62
+ * <Alert.Action>This is clickable text.</Alert.Action>
63
+ * </Alert.Message>
64
+ * <Alert.CloseButton onClick={() => {}}>
65
+ * <SvgCollapse />
66
+ * </Alert.CloseButton>
21
67
  * </Alert>
22
68
  */
23
- export const Alert = React.forwardRef((props, ref) => {
24
- const { children, className, type = 'informational', clickableText, clickableTextProps, onClose, isSticky = false, ...rest } = props;
25
- const StatusIcon = StatusIconMap[type];
26
- return (React.createElement(Box, { className: cx('iui-alert', className), "data-iui-status": type, "data-iui-variant": isSticky ? 'sticky' : undefined, ref: ref, ...rest },
27
- React.createElement(StatusIcon, { className: 'iui-alert-icon' }),
28
- React.createElement(Box, { as: 'span', className: 'iui-alert-message' },
29
- children,
30
- clickableText && (React.createElement(Box, { as: 'a', ...clickableTextProps, className: cx('iui-alert-link', clickableTextProps === null || clickableTextProps === void 0 ? void 0 : clickableTextProps.className) }, clickableText))),
31
- onClose && (React.createElement(Box, { as: 'button', onClick: onClose, "aria-label": 'Close', type: 'button', className: 'iui-alert-button' },
32
- React.createElement(Box, { as: 'span', className: 'iui-alert-button-icon', "aria-hidden": true },
33
- React.createElement(SvgCloseSmall, null))))));
69
+ export const Alert = Object.assign(AlertComponent, {
70
+ /**
71
+ * Alert icon subcomponent
72
+ */
73
+ Icon: AlertIcon,
74
+ /**
75
+ * Alert message subcomponent
76
+ */
77
+ Message: AlertMessage,
78
+ /**
79
+ * Alert action subcomponent for the link you want to provide.
80
+ */
81
+ Action: AlertAction,
82
+ /**
83
+ * Alert close button subcomponent
84
+ */
85
+ CloseButton: AlertCloseButton,
34
86
  });
35
87
  export default Alert;
@@ -30,7 +30,7 @@ export const Avatar = React.forwardRef((props, ref) => {
30
30
  const { size = 'small', status, abbreviation, image, backgroundColor, title, translatedStatusTitles, className, style, ...rest } = props;
31
31
  const statusTitles = { ...defaultStatusTitles, ...translatedStatusTitles };
32
32
  return (React.createElement(Box, { as: 'span', className: cx('iui-avatar', { [`iui-${size}`]: size !== 'medium' }, className), title: title, style: { backgroundColor, ...style }, ref: ref, ...rest },
33
- !image && (React.createElement(Box, { as: 'abbr', className: 'iui-initials' }, abbreviation === null || abbreviation === void 0 ? void 0 : abbreviation.substring(0, 2))),
33
+ !image && (React.createElement(Box, { as: 'abbr', className: 'iui-initials' }, abbreviation?.substring(0, 2))),
34
34
  image,
35
35
  React.createElement(Box, { as: 'span', className: 'iui-stroke' }),
36
36
  status && (React.createElement(Box, { as: 'span', title: statusTitles[status], className: cx('iui-status', {
@@ -50,7 +50,7 @@ export const AvatarGroup = React.forwardRef((props, ref) => {
50
50
  childrenArray.length <= maxIcons + 1 && getAvatarList(maxIcons + 1),
51
51
  childrenArray.length > maxIcons + 1 && (React.createElement(React.Fragment, null,
52
52
  getAvatarList(maxIcons),
53
- React.createElement(Box, { ...countIconProps, className: cx('iui-avatar', { [`iui-${iconSize}`]: iconSize !== 'medium' }, 'iui-avatar-count', countIconProps === null || countIconProps === void 0 ? void 0 : countIconProps.className) },
53
+ React.createElement(Box, { ...countIconProps, className: cx('iui-avatar', { [`iui-${iconSize}`]: iconSize !== 'medium' }, 'iui-avatar-count', countIconProps?.className) },
54
54
  React.createElement(Box, { as: 'abbr', className: 'iui-initials' }, childrenLength <= maxLength
55
55
  ? `${childrenLength - maxIcons}`
56
56
  : `${maxLength}+`),
@@ -53,12 +53,11 @@ export const Breadcrumbs = React.forwardRef((props, ref) => {
53
53
  }))));
54
54
  });
55
55
  const ListItem = ({ item, isActive, }) => {
56
- var _a;
57
56
  return (React.createElement(Box, { as: 'li', className: 'iui-breadcrumbs-item iui-breadcrumbs-item-overrides' }, React.isValidElement(item)
58
57
  ? React.cloneElement(item, {
59
- 'aria-current': ((_a = item.props['aria-current']) !== null && _a !== void 0 ? _a : isActive) ? 'location' : undefined,
58
+ 'aria-current': item.props['aria-current'] ?? isActive ? 'location' : undefined,
60
59
  })
61
60
  : item));
62
61
  };
63
- const Separator = ({ separator }) => (React.createElement(Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator !== null && separator !== void 0 ? separator : React.createElement(SvgChevronRight, null)));
62
+ const Separator = ({ separator }) => (React.createElement(Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator ?? React.createElement(SvgChevronRight, null)));
64
63
  export default Breadcrumbs;
@@ -35,10 +35,7 @@ import { useOverflow, useMergedRefs, Box } from '../utils/index.js';
35
35
  */
36
36
  export const ButtonGroup = React.forwardRef((props, ref) => {
37
37
  const { children, className, overflowButton, overflowPlacement = 'end', orientation = 'horizontal', ...rest } = props;
38
- const items = React.useMemo(() => {
39
- var _a, _b;
40
- return (_b = (_a = React.Children.map(children, (child) => !!child ? React.createElement("div", null, child) : undefined)) === null || _a === void 0 ? void 0 : _a.filter(Boolean)) !== null && _b !== void 0 ? _b : [];
41
- }, [children]);
38
+ const items = React.useMemo(() => React.Children.map(children, (child) => !!child ? React.createElement("div", null, child) : undefined)?.filter(Boolean) ?? [], [children]);
42
39
  const [overflowRef, visibleCount] = useOverflow(items, !overflowButton, orientation);
43
40
  const refs = useMergedRefs(overflowRef, ref);
44
41
  return (React.createElement(Box, { className: cx({
@@ -28,14 +28,12 @@ export const DropdownButton = React.forwardRef((props, ref) => {
28
28
  }
29
29
  }, [children, size, styleType]);
30
30
  return (React.createElement(DropdownMenu, { menuItems: menuItems, ...dropdownMenuProps, onShow: (i) => {
31
- var _a;
32
31
  setIsMenuOpen(true);
33
- (_a = dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.onShow) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
32
+ dropdownMenuProps?.onShow?.(i);
34
33
  }, onHide: (i) => {
35
- var _a;
36
34
  setIsMenuOpen(false);
37
- (_a = dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
38
- }, style: { minWidth: menuWidth, ...dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.style } },
35
+ dropdownMenuProps?.onHide?.(i);
36
+ }, style: { minWidth: menuWidth, ...dropdownMenuProps?.style } },
39
37
  React.createElement(Button, { className: cx('iui-button-dropdown', className), size: size, styleType: styleType, endIcon: isMenuOpen ? (React.createElement(SvgCaretUpSmall, { "aria-hidden": true })) : (React.createElement(SvgCaretDownSmall, { "aria-hidden": true })), ref: refs, "aria-label": 'Dropdown', ...rest }, children)));
40
38
  });
41
39
  export default DropdownButton;
@@ -38,7 +38,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
38
38
  Navigation: PolymorphicForwardRefComponent<"nav", {}> & {
39
39
  PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
40
40
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
41
- }, "label" | "as" | "size" | "isActive" | "styleType"> & {
41
+ }, "label" | "as" | "size" | "styleType" | "isActive"> & {
42
42
  isActive?: boolean | undefined;
43
43
  label?: React.ReactNode;
44
44
  } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
@@ -46,7 +46,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
46
46
  }>;
47
47
  NextButton: PolymorphicForwardRefComponent<"button", Omit<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
48
48
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
49
- }, "label" | "as" | "size" | "isActive" | "styleType"> & {
49
+ }, "label" | "as" | "size" | "styleType" | "isActive"> & {
50
50
  isActive?: boolean | undefined;
51
51
  label?: React.ReactNode;
52
52
  } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
@@ -14,7 +14,7 @@ import { CarouselNavigation } from './CarouselNavigation.js';
14
14
  const CarouselComponent = React.forwardRef((props, ref) => {
15
15
  const { activeSlideIndex: userActiveIndex = 0, onSlideChange, className, children, ...rest } = props;
16
16
  // Generate a stateful random id if not specified
17
- const [id] = React.useState(() => { var _a; return (_a = props.id) !== null && _a !== void 0 ? _a : `iui-carousel-${getRandomValue(10)}`; });
17
+ const [id] = React.useState(() => props.id ?? `iui-carousel-${getRandomValue(10)}`);
18
18
  const isManuallyUpdating = React.useRef(false);
19
19
  const carouselRef = React.useRef(null);
20
20
  const refs = useMergedRefs(carouselRef, ref);
@@ -22,7 +22,6 @@ const CarouselComponent = React.forwardRef((props, ref) => {
22
22
  const scrollToSlide = React.useRef(() => { }); // stub function populated in CarouselSlider
23
23
  const justMounted = React.useRef(true);
24
24
  React.useEffect(() => {
25
- var _a;
26
25
  setCurrentIndex(userActiveIndex);
27
26
  scrollToSlide.current(userActiveIndex, {
28
27
  instant: justMounted.current,
@@ -30,7 +29,7 @@ const CarouselComponent = React.forwardRef((props, ref) => {
30
29
  // re-focus the carousel for keyboard nav, but not on first mount
31
30
  // because it shows outline and might interfere with other components
32
31
  if (!justMounted.current) {
33
- (_a = carouselRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
32
+ carouselRef.current?.focus({ preventScroll: true });
34
33
  }
35
34
  justMounted.current = false;
36
35
  }, [userActiveIndex]);
@@ -65,8 +64,7 @@ const CarouselComponent = React.forwardRef((props, ref) => {
65
64
  };
66
65
  const userOnSlideChange = React.useRef(onSlideChange);
67
66
  React.useEffect(() => {
68
- var _a;
69
- (_a = userOnSlideChange.current) === null || _a === void 0 ? void 0 : _a.call(userOnSlideChange, currentIndex);
67
+ userOnSlideChange.current?.(currentIndex);
70
68
  }, [currentIndex]);
71
69
  return (React.createElement(Box, { as: 'section', "aria-roledescription": 'carousel', tabIndex: 0, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, ref: refs, className: cx('iui-carousel', className), ...rest, id: id },
72
70
  React.createElement(CarouselContext.Provider, { value: {
@@ -30,18 +30,17 @@ import { CarouselDot } from './CarouselDot.js';
30
30
  * />
31
31
  */
32
32
  export const CarouselDotsList = React.forwardRef((props, ref) => {
33
- var _a, _b, _c;
34
33
  const { currentIndex: userCurrentIndex, length, className, onSlideChange, children, ...rest } = props;
35
34
  const context = React.useContext(CarouselContext);
36
- const slideCount = (_a = length !== null && length !== void 0 ? length : context === null || context === void 0 ? void 0 : context.slideCount) !== null && _a !== void 0 ? _a : React.Children.count(children);
37
- const currentIndex = (_b = userCurrentIndex !== null && userCurrentIndex !== void 0 ? userCurrentIndex : context === null || context === void 0 ? void 0 : context.currentIndex) !== null && _b !== void 0 ? _b : 0;
38
- const idPrefix = (_c = props.id) !== null && _c !== void 0 ? _c : context === null || context === void 0 ? void 0 : context.idPrefix;
35
+ const slideCount = length ?? context?.slideCount ?? React.Children.count(children);
36
+ const currentIndex = userCurrentIndex ?? context?.currentIndex ?? 0;
37
+ const idPrefix = props.id ?? context?.idPrefix;
39
38
  const handleSlideChange = React.useCallback((index) => {
40
39
  if (context) {
41
40
  context.setCurrentIndex(index);
42
41
  context.scrollToSlide.current(index);
43
42
  }
44
- onSlideChange === null || onSlideChange === void 0 ? void 0 : onSlideChange(index);
43
+ onSlideChange?.(index);
45
44
  }, [context, onSlideChange]);
46
45
  const justMounted = React.useRef(true);
47
46
  const [visibleCount, setVisibleCount] = React.useState(slideCount);
@@ -55,7 +54,7 @@ export const CarouselDotsList = React.forwardRef((props, ref) => {
55
54
  const dotWidth = listRef.current.children[0].offsetWidth;
56
55
  setVisibleCount(Math.floor(width / dotWidth));
57
56
  });
58
- React.useEffect(() => resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect(), [resizeObserver]);
57
+ React.useEffect(() => resizeObserver?.disconnect(), [resizeObserver]);
59
58
  const refs = useMergedRefs(ref, resizeRef, listRef);
60
59
  const firstVisibleDotIndex = React.useMemo(() => getBoundedValue(currentIndex - Math.ceil(visibleCount / 2) + 1, 0, slideCount - visibleCount), [currentIndex, slideCount, visibleCount]);
61
60
  const lastVisibleDotIndex = React.useMemo(() => getBoundedValue(currentIndex + Math.floor(visibleCount / 2), visibleCount - 1, slideCount - 1), [currentIndex, slideCount, visibleCount]);
@@ -79,12 +78,11 @@ export const CarouselDotsList = React.forwardRef((props, ref) => {
79
78
  handleSlideChange,
80
79
  ]);
81
80
  React.useEffect(() => {
82
- var _a, _b, _c;
83
- const firstDot = (_a = listRef.current) === null || _a === void 0 ? void 0 : _a.children[firstVisibleDotIndex];
81
+ const firstDot = listRef.current?.children[firstVisibleDotIndex];
84
82
  if (!listRef.current || !firstDot) {
85
83
  return;
86
84
  }
87
- const motionOk = (_c = (_b = getWindow()) === null || _b === void 0 ? void 0 : _b.matchMedia('(prefers-reduced-motion: no-preference)')) === null || _c === void 0 ? void 0 : _c.matches;
85
+ const motionOk = getWindow()?.matchMedia('(prefers-reduced-motion: no-preference)')?.matches;
88
86
  listRef.current.scrollTo({
89
87
  left: firstDot.offsetLeft - listRef.current.offsetLeft,
90
88
  behavior: motionOk && !justMounted.current ? 'smooth' : 'auto',
@@ -94,5 +92,5 @@ export const CarouselDotsList = React.forwardRef((props, ref) => {
94
92
  }
95
93
  }, [currentIndex, firstVisibleDotIndex, slideCount, visibleCount, width]);
96
94
  return (React.createElement(React.Fragment, null,
97
- React.createElement(Box, { className: cx('iui-carousel-navigation-dots', className), role: 'tablist', "aria-label": 'Slides', ref: refs, ...rest }, children !== null && children !== void 0 ? children : dots)));
95
+ React.createElement(Box, { className: cx('iui-carousel-navigation-dots', className), role: 'tablist', "aria-label": 'Slides', ref: refs, ...rest }, children ?? dots)));
98
96
  });
@@ -9,7 +9,7 @@ import type { PolymorphicForwardRefComponent } from '../utils/index.js';
9
9
  export declare const CarouselNavigation: PolymorphicForwardRefComponent<"nav", {}> & {
10
10
  PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
11
11
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
12
- }, "label" | "as" | "size" | "isActive" | "styleType"> & {
12
+ }, "label" | "as" | "size" | "styleType" | "isActive"> & {
13
13
  isActive?: boolean | undefined;
14
14
  label?: React.ReactNode;
15
15
  } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
@@ -17,7 +17,7 @@ export declare const CarouselNavigation: PolymorphicForwardRefComponent<"nav", {
17
17
  }>;
18
18
  NextButton: PolymorphicForwardRefComponent<"button", Omit<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
19
19
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
20
- }, "label" | "as" | "size" | "isActive" | "styleType"> & {
20
+ }, "label" | "as" | "size" | "styleType" | "isActive"> & {
21
21
  isActive?: boolean | undefined;
22
22
  label?: React.ReactNode;
23
23
  } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
@@ -10,7 +10,7 @@ import { CarouselDotsList } from './CarouselDotsList.js';
10
10
  import { Box, SvgChevronLeft, SvgChevronRight } from '../utils/index.js';
11
11
  const CarouselNavigationComponent = React.forwardRef((props, ref) => {
12
12
  const { className, children, ...rest } = props;
13
- return (React.createElement(Box, { as: 'nav', className: cx('iui-carousel-navigation', className), ref: ref, ...rest }, children !== null && children !== void 0 ? children : (React.createElement(React.Fragment, null,
13
+ return (React.createElement(Box, { as: 'nav', className: cx('iui-carousel-navigation', className), ref: ref, ...rest }, children ?? (React.createElement(React.Fragment, null,
14
14
  React.createElement(Box, { className: 'iui-carousel-navigation-left' },
15
15
  React.createElement(PreviousButton, null)),
16
16
  React.createElement(CarouselDotsList, null),
@@ -25,11 +25,10 @@ const PreviousButton = React.forwardRef((props, ref) => {
25
25
  }
26
26
  const { slideCount, currentIndex, setCurrentIndex, keysPressed, scrollToSlide, } = context;
27
27
  return (React.createElement(IconButton, { styleType: 'borderless', size: 'small', tabIndex: -1, "data-pressed": keysPressed['ArrowLeft'] || undefined, ref: ref, ...props, onClick: (e) => {
28
- var _a;
29
28
  const prevIndex = (slideCount + currentIndex - 1) % slideCount;
30
29
  setCurrentIndex(prevIndex);
31
30
  scrollToSlide.current(prevIndex, { instant: e.detail > 3 });
32
- (_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
31
+ props?.onClick?.(e);
33
32
  } },
34
33
  React.createElement(SvgChevronLeft, null)));
35
34
  });
@@ -41,11 +40,10 @@ const NextButton = React.forwardRef((props, ref) => {
41
40
  }
42
41
  const { slideCount, currentIndex, setCurrentIndex, keysPressed, scrollToSlide, } = context;
43
42
  return (React.createElement(IconButton, { styleType: 'borderless', size: 'small', tabIndex: -1, "data-pressed": keysPressed['ArrowRight'] || undefined, ref: ref, ...props, onClick: (e) => {
44
- var _a;
45
43
  const nextIndex = (slideCount + currentIndex + 1) % slideCount;
46
44
  setCurrentIndex(nextIndex);
47
45
  scrollToSlide.current(nextIndex, { instant: e.detail > 3 });
48
- (_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
46
+ props?.onClick?.(e);
49
47
  } },
50
48
  React.createElement(SvgChevronRight, null)));
51
49
  });
@@ -16,28 +16,24 @@ export const CarouselSlider = React.forwardRef((props, ref) => {
16
16
  throw new Error('CarouselSlider must be used within Carousel');
17
17
  }
18
18
  const { setSlideCount, idPrefix, scrollToSlide, isManuallyUpdating } = context;
19
- const items = React.useMemo(() => {
20
- var _a;
21
- return (_a = React.Children.map(children, (child, index) => React.isValidElement(child)
22
- ? React.cloneElement(child, {
23
- id: `${idPrefix}--slide-${index}`,
24
- index,
25
- })
26
- : child)) !== null && _a !== void 0 ? _a : [];
27
- }, [children, idPrefix]);
19
+ const items = React.useMemo(() => React.Children.map(children, (child, index) => React.isValidElement(child)
20
+ ? React.cloneElement(child, {
21
+ id: `${idPrefix}--slide-${index}`,
22
+ index,
23
+ })
24
+ : child) ?? [], [children, idPrefix]);
28
25
  useIsomorphicLayoutEffect(() => {
29
26
  setSlideCount(items.length);
30
27
  }, [items.length, setSlideCount]);
31
28
  const sliderRef = React.useRef(null);
32
29
  const refs = useMergedRefs(sliderRef, ref);
33
30
  scrollToSlide.current = (slideIndex, { instant } = {}) => {
34
- var _a, _b, _c;
35
31
  isManuallyUpdating.current = true; // start manual update
36
- const slideToShow = (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.children.item(slideIndex);
32
+ const slideToShow = sliderRef.current?.children.item(slideIndex);
37
33
  if (!sliderRef.current || !slideToShow) {
38
34
  return;
39
35
  }
40
- const motionOk = (_c = (_b = getWindow()) === null || _b === void 0 ? void 0 : _b.matchMedia('(prefers-reduced-motion: no-preference)')) === null || _c === void 0 ? void 0 : _c.matches;
36
+ const motionOk = getWindow()?.matchMedia('(prefers-reduced-motion: no-preference)')?.matches;
41
37
  sliderRef.current.scrollTo({
42
38
  left: slideToShow.offsetLeft - sliderRef.current.offsetLeft,
43
39
  behavior: (instant || !motionOk ? 'instant' : 'smooth'), // scrollTo accepts 'instant' but ScrollBehavior type is wrong
@@ -46,11 +42,10 @@ export const CarouselSlider = React.forwardRef((props, ref) => {
46
42
  const scrollTimeout = React.useRef();
47
43
  // reset isManuallyUpdating.current to false after the last scroll event
48
44
  const handleOnScroll = React.useCallback(() => {
49
- var _a, _b;
50
45
  if (scrollTimeout.current) {
51
- (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.clearTimeout(scrollTimeout.current);
46
+ getWindow()?.clearTimeout(scrollTimeout.current);
52
47
  }
53
- scrollTimeout.current = (_b = getWindow()) === null || _b === void 0 ? void 0 : _b.setTimeout(() => {
48
+ scrollTimeout.current = getWindow()?.setTimeout(() => {
54
49
  isManuallyUpdating.current = false;
55
50
  }, 100);
56
51
  }, [isManuallyUpdating]);
@@ -21,7 +21,6 @@ const getHorizontalPercentageOfRectangle = (rect, pointer) => {
21
21
  * and a set of sliders to adjust hue and alpha values.
22
22
  */
23
23
  export const ColorBuilder = React.forwardRef((props, ref) => {
24
- var _a, _b, _c;
25
24
  const { className, ...rest } = props;
26
25
  const builderRef = React.useRef();
27
26
  const refs = useMergedRefs(builderRef, ref);
@@ -29,7 +28,7 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
29
28
  // Set values for slider
30
29
  const hueSliderColor = React.useMemo(() => ColorValue.create({ h: hsvColor.h, s: 100, v: 100 }), [hsvColor.h]);
31
30
  const sliderValue = React.useMemo(() => hsvColor.h, [hsvColor]);
32
- const alphaValue = React.useMemo(() => { var _a; return (showAlpha ? (_a = hsvColor.a) !== null && _a !== void 0 ? _a : 1 : 1); }, [hsvColor.a, showAlpha]);
31
+ const alphaValue = React.useMemo(() => (showAlpha ? hsvColor.a ?? 1 : 1), [hsvColor.a, showAlpha]);
33
32
  // Set values for color square and color dot
34
33
  const dotColorString = React.useMemo(() => activeColor.toHexString(), [activeColor]);
35
34
  const [colorDotActive, setColorDotActive] = React.useState(false);
@@ -92,7 +91,7 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
92
91
  event.preventDefault();
93
92
  event.stopPropagation();
94
93
  }, [colorDotActive, updateSquareValue]);
95
- useEventListener('pointerup', handleSquarePointerUp, (_a = builderRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
94
+ useEventListener('pointerup', handleSquarePointerUp, builderRef.current?.ownerDocument);
96
95
  const handleSquarePointerMove = React.useCallback((event) => {
97
96
  if (!colorDotActive) {
98
97
  return;
@@ -101,7 +100,7 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
101
100
  event.stopPropagation();
102
101
  updateSquareValue(event, 'onUpdate');
103
102
  }, [colorDotActive, updateSquareValue]);
104
- useEventListener('pointermove', handleSquarePointerMove, (_b = builderRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument);
103
+ useEventListener('pointermove', handleSquarePointerMove, builderRef.current?.ownerDocument);
105
104
  const handleSquarePointerLeave = React.useCallback((event) => {
106
105
  if (!colorDotActive) {
107
106
  return;
@@ -109,7 +108,7 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
109
108
  updateSquareValue(event, 'onChange');
110
109
  setColorDotActive(false);
111
110
  }, [colorDotActive, updateSquareValue]);
112
- useEventListener('pointerleave', handleSquarePointerLeave, (_c = builderRef.current) === null || _c === void 0 ? void 0 : _c.ownerDocument);
111
+ useEventListener('pointerleave', handleSquarePointerLeave, builderRef.current?.ownerDocument);
113
112
  const keysPressed = React.useRef({}); // keep track of which keys are currently pressed
114
113
  // Arrow key navigation for color dot
115
114
  const handleColorDotKeyDown = (event) => {
@@ -153,7 +152,7 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
153
152
  keysPressed.current['ArrowRight']) {
154
153
  return;
155
154
  }
156
- onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(ColorValue.create(hsvColor));
155
+ onChangeComplete?.(ColorValue.create(hsvColor));
157
156
  break;
158
157
  }
159
158
  };
@@ -162,18 +161,16 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
162
161
  '--iui-color-field-hue': hueColorString,
163
162
  '--iui-color-picker-selected-color': dotColorString,
164
163
  }, ref: squareRef, onPointerDown: (event) => {
165
- var _a;
166
164
  event.preventDefault();
167
165
  updateSquareValue(event, 'onClick');
168
166
  setColorDotActive(true);
169
- (_a = colorDotRef.current) === null || _a === void 0 ? void 0 : _a.focus();
167
+ colorDotRef.current?.focus();
170
168
  } },
171
169
  React.createElement(Box, { className: 'iui-color-dot', style: {
172
170
  '--iui-color-dot-inset': `${squareTop.toString()}% auto auto ${squareLeft.toString()}%`,
173
171
  }, onPointerDown: () => {
174
- var _a;
175
172
  setColorDotActive(true);
176
- (_a = colorDotRef.current) === null || _a === void 0 ? void 0 : _a.focus();
173
+ colorDotRef.current?.focus();
177
174
  }, onKeyDown: handleColorDotKeyDown, onKeyUp: handleColorDotKeyUp, tabIndex: 0, ref: colorDotRef })),
178
175
  React.createElement(Slider, { minLabel: '', maxLabel: '', values: [sliderValue], className: 'iui-hue-slider', trackDisplayMode: 'none', tooltipProps: () => ({ visible: false }), onChange: (values) => {
179
176
  updateHueSlider(values[0], true);
@@ -18,7 +18,6 @@ import { useColorPickerContext } from './ColorPickerContext.js';
18
18
  * </ColorPicker>
19
19
  */
20
20
  export const ColorInputPanel = React.forwardRef((props, ref) => {
21
- var _a, _b, _c, _d, _f, _g, _h, _j;
22
21
  const { defaultColorFormat, allowedColorFormats = ['hsl', 'rgb', 'hex'], className, ...rest } = props;
23
22
  const inputsContainerRef = React.useRef(null);
24
23
  const { activeColor, applyHsvColorChange, hsvColor, showAlpha } = useColorPickerContext();
@@ -29,14 +28,13 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
29
28
  // need to use state since input may have parsing error
30
29
  const [input, setInput] = React.useState(['', '', '', '']);
31
30
  React.useEffect(() => {
32
- var _a, _b;
33
31
  if (currentFormat === 'hsl') {
34
32
  const hsl = activeColor.toHslColor();
35
33
  setInput([
36
34
  ColorValue.getFormattedColorNumber(hsvColor.h),
37
35
  ColorValue.getFormattedColorNumber(hsl.s),
38
36
  ColorValue.getFormattedColorNumber(hsl.l),
39
- ColorValue.getFormattedColorNumber((_a = hsl.a) !== null && _a !== void 0 ? _a : activeColor.getAlpha() / 255, 2),
37
+ ColorValue.getFormattedColorNumber(hsl.a ?? activeColor.getAlpha() / 255, 2),
40
38
  ]);
41
39
  }
42
40
  else if (currentFormat === 'rgb') {
@@ -45,7 +43,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
45
43
  rgb.r.toString(),
46
44
  rgb.g.toString(),
47
45
  rgb.b.toString(),
48
- ColorValue.getFormattedColorNumber((_b = rgb.a) !== null && _b !== void 0 ? _b : activeColor.getAlpha() / 255, 2),
46
+ ColorValue.getFormattedColorNumber(rgb.a ?? activeColor.getAlpha() / 255, 2),
49
47
  ]);
50
48
  }
51
49
  else {
@@ -55,9 +53,8 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
55
53
  }, [activeColor, hsvColor.h, currentFormat, showAlpha]);
56
54
  const [validHexInput, setValidHexInput] = React.useState(true);
57
55
  const swapColorFormat = React.useCallback(() => {
58
- var _a;
59
- const newFormat = (_a = allowedColorFormats[(allowedColorFormats.indexOf(currentFormat) + 1) %
60
- allowedColorFormats.length]) !== null && _a !== void 0 ? _a : allowedColorFormats[0];
56
+ const newFormat = allowedColorFormats[(allowedColorFormats.indexOf(currentFormat) + 1) %
57
+ allowedColorFormats.length] ?? allowedColorFormats[0];
61
58
  setCurrentFormat(newFormat);
62
59
  }, [currentFormat, allowedColorFormats]);
63
60
  const isFocusInside = (focused) => !!(focused &&
@@ -138,7 +135,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
138
135
  React.createElement(InputContainer, { status: Number(input[0]) < 0 || Number(input[0]) > 360
139
136
  ? 'negative'
140
137
  : undefined },
141
- React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '359', step: '.1', placeholder: 'H', value: (_a = input[0]) !== null && _a !== void 0 ? _a : '', onChange: (event) => {
138
+ React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '359', step: '.1', placeholder: 'H', value: input[0] ?? '', onChange: (event) => {
142
139
  setInput([event.target.value, input[1], input[2], input[3]]);
143
140
  }, onKeyDown: (event) => {
144
141
  if (event.key === 'Enter') {
@@ -154,7 +151,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
154
151
  React.createElement(InputContainer, { status: Number(input[1]) < 0 || Number(input[1]) > 100
155
152
  ? 'negative'
156
153
  : undefined },
157
- React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'S', value: (_b = input[1]) !== null && _b !== void 0 ? _b : '', onChange: (event) => {
154
+ React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'S', value: input[1] ?? '', onChange: (event) => {
158
155
  setInput([input[0], event.target.value, input[2], input[3]]);
159
156
  }, onKeyDown: (event) => {
160
157
  if (event.key === 'Enter') {
@@ -170,7 +167,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
170
167
  React.createElement(InputContainer, { status: Number(input[2]) < 0 || Number(input[2]) > 100
171
168
  ? 'negative'
172
169
  : undefined },
173
- React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'L', value: (_c = input[2]) !== null && _c !== void 0 ? _c : '', onChange: (event) => {
170
+ React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'L', value: input[2] ?? '', onChange: (event) => {
174
171
  setInput([input[0], input[1], event.target.value, input[3]]);
175
172
  }, onKeyDown: (event) => {
176
173
  if (event.key === 'Enter') {
@@ -186,7 +183,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
186
183
  showAlpha && (React.createElement(InputContainer, { status: Number(input[3]) < 0 || Number(input[3]) > 1
187
184
  ? 'negative'
188
185
  : undefined },
189
- React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value: (_d = input[3]) !== null && _d !== void 0 ? _d : '', onChange: (event) => {
186
+ React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value: input[3] ?? '', onChange: (event) => {
190
187
  setInput([input[0], input[1], input[2], event.target.value]);
191
188
  }, onKeyDown: (event) => {
192
189
  if (event.key === 'Enter') {
@@ -203,7 +200,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
203
200
  React.createElement(InputContainer, { status: Number(input[0]) < 0 || Number(input[0]) > 255
204
201
  ? 'negative'
205
202
  : undefined },
206
- React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'R', value: (_f = input[0]) !== null && _f !== void 0 ? _f : '', onChange: (event) => {
203
+ React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'R', value: input[0] ?? '', onChange: (event) => {
207
204
  setInput([event.target.value, input[1], input[2], input[3]]);
208
205
  }, onKeyDown: (event) => {
209
206
  if (event.key === 'Enter') {
@@ -219,7 +216,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
219
216
  React.createElement(InputContainer, { status: Number(input[1]) < 0 || Number(input[1]) > 255
220
217
  ? 'negative'
221
218
  : undefined },
222
- React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'G', value: (_g = input[1]) !== null && _g !== void 0 ? _g : '', onChange: (event) => {
219
+ React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'G', value: input[1] ?? '', onChange: (event) => {
223
220
  setInput([input[0], event.target.value, input[2], input[3]]);
224
221
  }, onKeyDown: (event) => {
225
222
  if (event.key === 'Enter') {
@@ -235,7 +232,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
235
232
  React.createElement(InputContainer, { status: Number(input[2]) < 0 || Number(input[2]) > 255
236
233
  ? 'negative'
237
234
  : undefined },
238
- React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'B', value: (_h = input[2]) !== null && _h !== void 0 ? _h : '', onChange: (event) => {
235
+ React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'B', value: input[2] ?? '', onChange: (event) => {
239
236
  setInput([input[0], input[1], event.target.value, input[3]]);
240
237
  }, onKeyDown: (event) => {
241
238
  if (event.key === 'Enter') {
@@ -251,7 +248,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
251
248
  showAlpha && (React.createElement(InputContainer, { status: Number(input[3]) < 0 || Number(input[3]) > 1
252
249
  ? 'negative'
253
250
  : undefined },
254
- React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value: (_j = input[3]) !== null && _j !== void 0 ? _j : '', onChange: (event) => {
251
+ React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value: input[3] ?? '', onChange: (event) => {
255
252
  setInput([input[0], input[1], input[2], event.target.value]);
256
253
  }, onKeyDown: (event) => {
257
254
  if (event.key === 'Enter') {