@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0-dev.2
4
+
5
+ ### Major Changes
6
+
7
+ - [#1300](https://github.com/iTwin/iTwinUI/pull/1300): `modalRootId` and `ownerDocument` props have been removed from `Modal`, in favor of the new `portal` prop (also available in `Dialog`).
8
+ - [#1247](https://github.com/iTwin/iTwinUI/pull/1247): Alert composition has been updated such that it is now made up of customizable subcomponents, thus removing the `onClose`, `clickableText`, and `clickableTextProps` props from `Alert`.
9
+ - [#1346](https://github.com/iTwin/iTwinUI/pull/1346): The build now targets `es2020` instead of `es2018`.
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1347](https://github.com/iTwin/iTwinUI/pull/1347): Fixed an issue where ThemeProvider warning was always logged even when using ThemeProvider.
14
+
3
15
  ## 3.0.0-dev.1
4
16
 
5
17
  ### Major Changes
@@ -35,6 +47,12 @@
35
47
  - Updated dependencies:
36
48
  - @itwin/itwinui-css@2.0.0-dev.0
37
49
 
50
+ ## 2.11.6
51
+
52
+ ### Patch Changes
53
+
54
+ - [#1341](https://github.com/iTwin/iTwinUI/pull/1341): Table: fixed action column header content alignment when using globalFilterValue.
55
+
38
56
  ## 2.11.5
39
57
 
40
58
  ### Patch Changes
@@ -1,47 +1,66 @@
1
1
  import * as React from 'react';
2
2
  import type { PolymorphicForwardRefComponent } from '../utils/index.js';
3
- declare type AlertProps = {
3
+ declare type AlertOwnProps = {
4
4
  /**
5
5
  * Type of the alert.
6
6
  * @default 'informational'
7
7
  */
8
8
  type?: 'positive' | 'warning' | 'negative' | 'informational';
9
- /**
10
- * Text for the link you want to provide.
11
- */
12
- clickableText?: React.ReactNode;
13
- /**
14
- * Props for the clickable text. Used for providing `href` and other attributes.
15
- */
16
- clickableTextProps?: React.ComponentPropsWithRef<'a'>;
17
- /**
18
- * Action handler for close.
19
- */
20
- onClose?: () => void;
21
9
  /**
22
10
  * Stick the alert to the top.
23
11
  * @default false
24
12
  */
25
13
  isSticky?: boolean;
26
- /**
27
- * Alert message text.
28
- */
29
- children: React.ReactNode;
30
14
  };
31
15
  /**
32
16
  * A small box to quickly grab user attention and communicate a brief message
33
17
  * @example
34
- * <Alert>This is a basic alert.</Alert>
35
- * <Alert type='positive'>This is a positive alert.</Alert>
36
- * <Alert type='warning'>This is a warning alert.</Alert>
37
- * <Alert type='negative'>This is a negative alert.</Alert>
38
- * <Alert
39
- * type='positive'
40
- * clickableText="I am a clickable text"
41
- * clickableTextProps={{ href: 'https://www.example.com' }}
42
- * >
43
- * This is a positive alert with a clickable text
18
+ * <Alert>
19
+ * <Alert.Message>This is an alert.</Alert.Message>
20
+ * </Alert>
21
+ * @example
22
+ * <Alert type='informational'>
23
+ * <Alert.Icon />
24
+ * <Alert.Message>This is an informational alert.</Alert.Message>
25
+ * <Alert.CloseButton onClick={() => {}} />
26
+ * </Alert>
27
+ * @example
28
+ * <Alert type='positive'>
29
+ * <Alert.Icon>
30
+ * <SvgSmileyHappy />
31
+ * </Alert.Icon>
32
+ * <Alert.Message>
33
+ * This is an alert.
34
+ * <Alert.Action>This is clickable text.</Alert.Action>
35
+ * </Alert.Message>
36
+ * <Alert.CloseButton onClick={() => {}}>
37
+ * <SvgCollapse />
38
+ * </Alert.CloseButton>
44
39
  * </Alert>
45
40
  */
46
- export declare const Alert: PolymorphicForwardRefComponent<"div", AlertProps>;
41
+ export declare const Alert: PolymorphicForwardRefComponent<"div", AlertOwnProps> & {
42
+ /**
43
+ * Alert icon subcomponent
44
+ */
45
+ Icon: PolymorphicForwardRefComponent<"span", Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
46
+ ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
47
+ }, "as" | "fill" | "key" | "size" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
48
+ size?: "small" | "auto" | "medium" | "large" | import("../utils/types.js").AnyString | undefined;
49
+ fill?: "default" | "positive" | "warning" | "negative" | import("../utils/types.js").AnyString | "informational" | undefined;
50
+ } & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
51
+ as?: "span" | undefined;
52
+ }>;
53
+ /**
54
+ * Alert message subcomponent
55
+ */
56
+ Message: PolymorphicForwardRefComponent<"span", {}>;
57
+ /**
58
+ * Alert action subcomponent for the link you want to provide.
59
+ */
60
+ Action: PolymorphicForwardRefComponent<"a", {}>;
61
+ /**
62
+ * Alert close button subcomponent
63
+ */
64
+ CloseButton: PolymorphicForwardRefComponent<"button", {}>;
65
+ };
47
66
  export default Alert;
@@ -34,31 +34,83 @@ exports.Alert = void 0;
34
34
  const classnames_1 = __importDefault(require("classnames"));
35
35
  const React = __importStar(require("react"));
36
36
  const index_js_1 = require("../utils/index.js");
37
+ const index_js_2 = require("../Buttons/index.js");
38
+ const AlertContext = React.createContext(undefined);
39
+ const AlertComponent = React.forwardRef((props, ref) => {
40
+ const { children, className, type = 'informational', isSticky = false, ...rest } = props;
41
+ return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-alert', className), "data-iui-status": type, "data-iui-variant": isSticky ? 'sticky' : undefined, ref: ref, ...rest },
42
+ React.createElement(AlertContext.Provider, { value: { type } }, children)));
43
+ });
44
+ AlertComponent.displayName = 'Alert';
45
+ // ----------------------------------------------------------------------------
46
+ // Alert.Icon component
47
+ const AlertIcon = React.forwardRef((props, ref) => {
48
+ const { children, ...rest } = props;
49
+ const { type } = (0, index_js_1.useSafeContext)(AlertContext);
50
+ const StatusIcon = index_js_1.StatusIconMap[type];
51
+ return (React.createElement(index_js_1.Icon, { fill: type, ref: ref, ...rest }, children ?? React.createElement(StatusIcon, null)));
52
+ });
53
+ AlertIcon.displayName = 'Alert.Icon';
54
+ // ----------------------------------------------------------------------------
55
+ // Alert.Message component
56
+ const AlertMessage = index_js_1.polymorphic.span('iui-alert-message');
57
+ AlertMessage.displayName = 'Alert.Message';
58
+ // ----------------------------------------------------------------------------
59
+ // Alert.Action component
60
+ const AlertAction = React.forwardRef((props, ref) => {
61
+ const { children, className, ...rest } = props;
62
+ return (React.createElement(index_js_1.Box, { as: (!!props.href ? 'a' : 'button'), className: (0, classnames_1.default)('iui-alert-link', className), ref: ref, ...rest }, children));
63
+ });
64
+ AlertAction.displayName = 'Alert.Action';
65
+ // ----------------------------------------------------------------------------
66
+ // Alert.CloseButton component
67
+ const AlertCloseButton = React.forwardRef((props, ref) => {
68
+ const { children, ...rest } = props;
69
+ return (React.createElement(index_js_2.IconButton, { styleType: 'borderless', size: 'small', "aria-label": 'Close', ref: ref, ...rest }, children ?? React.createElement(index_js_1.SvgCloseSmall, null)));
70
+ });
71
+ AlertCloseButton.displayName = 'Alert.CloseButton';
37
72
  /**
38
73
  * A small box to quickly grab user attention and communicate a brief message
39
74
  * @example
40
- * <Alert>This is a basic alert.</Alert>
41
- * <Alert type='positive'>This is a positive alert.</Alert>
42
- * <Alert type='warning'>This is a warning alert.</Alert>
43
- * <Alert type='negative'>This is a negative alert.</Alert>
44
- * <Alert
45
- * type='positive'
46
- * clickableText="I am a clickable text"
47
- * clickableTextProps={{ href: 'https://www.example.com' }}
48
- * >
49
- * This is a positive alert with a clickable text
75
+ * <Alert>
76
+ * <Alert.Message>This is an alert.</Alert.Message>
77
+ * </Alert>
78
+ * @example
79
+ * <Alert type='informational'>
80
+ * <Alert.Icon />
81
+ * <Alert.Message>This is an informational alert.</Alert.Message>
82
+ * <Alert.CloseButton onClick={() => {}} />
83
+ * </Alert>
84
+ * @example
85
+ * <Alert type='positive'>
86
+ * <Alert.Icon>
87
+ * <SvgSmileyHappy />
88
+ * </Alert.Icon>
89
+ * <Alert.Message>
90
+ * This is an alert.
91
+ * <Alert.Action>This is clickable text.</Alert.Action>
92
+ * </Alert.Message>
93
+ * <Alert.CloseButton onClick={() => {}}>
94
+ * <SvgCollapse />
95
+ * </Alert.CloseButton>
50
96
  * </Alert>
51
97
  */
52
- exports.Alert = React.forwardRef((props, ref) => {
53
- const { children, className, type = 'informational', clickableText, clickableTextProps, onClose, isSticky = false, ...rest } = props;
54
- const StatusIcon = index_js_1.StatusIconMap[type];
55
- return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-alert', className), "data-iui-status": type, "data-iui-variant": isSticky ? 'sticky' : undefined, ref: ref, ...rest },
56
- React.createElement(StatusIcon, { className: 'iui-alert-icon' }),
57
- React.createElement(index_js_1.Box, { as: 'span', className: 'iui-alert-message' },
58
- children,
59
- clickableText && (React.createElement(index_js_1.Box, { as: 'a', ...clickableTextProps, className: (0, classnames_1.default)('iui-alert-link', clickableTextProps === null || clickableTextProps === void 0 ? void 0 : clickableTextProps.className) }, clickableText))),
60
- onClose && (React.createElement(index_js_1.Box, { as: 'button', onClick: onClose, "aria-label": 'Close', type: 'button', className: 'iui-alert-button' },
61
- React.createElement(index_js_1.Box, { as: 'span', className: 'iui-alert-button-icon', "aria-hidden": true },
62
- React.createElement(index_js_1.SvgCloseSmall, null))))));
98
+ exports.Alert = Object.assign(AlertComponent, {
99
+ /**
100
+ * Alert icon subcomponent
101
+ */
102
+ Icon: AlertIcon,
103
+ /**
104
+ * Alert message subcomponent
105
+ */
106
+ Message: AlertMessage,
107
+ /**
108
+ * Alert action subcomponent for the link you want to provide.
109
+ */
110
+ Action: AlertAction,
111
+ /**
112
+ * Alert close button subcomponent
113
+ */
114
+ CloseButton: AlertCloseButton,
63
115
  });
64
116
  exports.default = exports.Alert;
@@ -59,7 +59,7 @@ exports.Avatar = React.forwardRef((props, ref) => {
59
59
  const { size = 'small', status, abbreviation, image, backgroundColor, title, translatedStatusTitles, className, style, ...rest } = props;
60
60
  const statusTitles = { ...exports.defaultStatusTitles, ...translatedStatusTitles };
61
61
  return (React.createElement(index_js_1.Box, { as: 'span', className: (0, classnames_1.default)('iui-avatar', { [`iui-${size}`]: size !== 'medium' }, className), title: title, style: { backgroundColor, ...style }, ref: ref, ...rest },
62
- !image && (React.createElement(index_js_1.Box, { as: 'abbr', className: 'iui-initials' }, abbreviation === null || abbreviation === void 0 ? void 0 : abbreviation.substring(0, 2))),
62
+ !image && (React.createElement(index_js_1.Box, { as: 'abbr', className: 'iui-initials' }, abbreviation?.substring(0, 2))),
63
63
  image,
64
64
  React.createElement(index_js_1.Box, { as: 'span', className: 'iui-stroke' }),
65
65
  status && (React.createElement(index_js_1.Box, { as: 'span', title: statusTitles[status], className: (0, classnames_1.default)('iui-status', {
@@ -79,7 +79,7 @@ exports.AvatarGroup = React.forwardRef((props, ref) => {
79
79
  childrenArray.length <= maxIcons + 1 && getAvatarList(maxIcons + 1),
80
80
  childrenArray.length > maxIcons + 1 && (React.createElement(React.Fragment, null,
81
81
  getAvatarList(maxIcons),
82
- React.createElement(index_js_1.Box, { ...countIconProps, className: (0, classnames_1.default)('iui-avatar', { [`iui-${iconSize}`]: iconSize !== 'medium' }, 'iui-avatar-count', countIconProps === null || countIconProps === void 0 ? void 0 : countIconProps.className) },
82
+ React.createElement(index_js_1.Box, { ...countIconProps, className: (0, classnames_1.default)('iui-avatar', { [`iui-${iconSize}`]: iconSize !== 'medium' }, 'iui-avatar-count', countIconProps?.className) },
83
83
  React.createElement(index_js_1.Box, { as: 'abbr', className: 'iui-initials' }, childrenLength <= maxLength
84
84
  ? `${childrenLength - maxIcons}`
85
85
  : `${maxLength}+`),
@@ -82,12 +82,11 @@ exports.Breadcrumbs = React.forwardRef((props, ref) => {
82
82
  }))));
83
83
  });
84
84
  const ListItem = ({ item, isActive, }) => {
85
- var _a;
86
85
  return (React.createElement(index_js_1.Box, { as: 'li', className: 'iui-breadcrumbs-item iui-breadcrumbs-item-overrides' }, React.isValidElement(item)
87
86
  ? React.cloneElement(item, {
88
- 'aria-current': ((_a = item.props['aria-current']) !== null && _a !== void 0 ? _a : isActive) ? 'location' : undefined,
87
+ 'aria-current': item.props['aria-current'] ?? isActive ? 'location' : undefined,
89
88
  })
90
89
  : item));
91
90
  };
92
- const Separator = ({ separator }) => (React.createElement(index_js_1.Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator !== null && separator !== void 0 ? separator : React.createElement(index_js_1.SvgChevronRight, null)));
91
+ const Separator = ({ separator }) => (React.createElement(index_js_1.Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator ?? React.createElement(index_js_1.SvgChevronRight, null)));
93
92
  exports.default = exports.Breadcrumbs;
@@ -64,10 +64,7 @@ const index_js_1 = require("../utils/index.js");
64
64
  */
65
65
  exports.ButtonGroup = React.forwardRef((props, ref) => {
66
66
  const { children, className, overflowButton, overflowPlacement = 'end', orientation = 'horizontal', ...rest } = props;
67
- const items = React.useMemo(() => {
68
- var _a, _b;
69
- 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 : [];
70
- }, [children]);
67
+ const items = React.useMemo(() => React.Children.map(children, (child) => !!child ? React.createElement("div", null, child) : undefined)?.filter(Boolean) ?? [], [children]);
71
68
  const [overflowRef, visibleCount] = (0, index_js_1.useOverflow)(items, !overflowButton, orientation);
72
69
  const refs = (0, index_js_1.useMergedRefs)(overflowRef, ref);
73
70
  return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)({
@@ -57,14 +57,12 @@ exports.DropdownButton = React.forwardRef((props, ref) => {
57
57
  }
58
58
  }, [children, size, styleType]);
59
59
  return (React.createElement(index_js_2.DropdownMenu, { menuItems: menuItems, ...dropdownMenuProps, onShow: (i) => {
60
- var _a;
61
60
  setIsMenuOpen(true);
62
- (_a = dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.onShow) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
61
+ dropdownMenuProps?.onShow?.(i);
63
62
  }, onHide: (i) => {
64
- var _a;
65
63
  setIsMenuOpen(false);
66
- (_a = dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
67
- }, style: { minWidth: menuWidth, ...dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.style } },
64
+ dropdownMenuProps?.onHide?.(i);
65
+ }, style: { minWidth: menuWidth, ...dropdownMenuProps?.style } },
68
66
  React.createElement(index_js_1.Button, { className: (0, classnames_1.default)('iui-button-dropdown', className), size: size, styleType: styleType, endIcon: isMenuOpen ? (React.createElement(index_js_3.SvgCaretUpSmall, { "aria-hidden": true })) : (React.createElement(index_js_3.SvgCaretDownSmall, { "aria-hidden": true })), ref: refs, "aria-label": 'Dropdown', ...rest }, children)));
69
67
  });
70
68
  exports.default = exports.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"> & {
@@ -43,7 +43,7 @@ const CarouselNavigation_js_1 = require("./CarouselNavigation.js");
43
43
  const CarouselComponent = React.forwardRef((props, ref) => {
44
44
  const { activeSlideIndex: userActiveIndex = 0, onSlideChange, className, children, ...rest } = props;
45
45
  // Generate a stateful random id if not specified
46
- const [id] = React.useState(() => { var _a; return (_a = props.id) !== null && _a !== void 0 ? _a : `iui-carousel-${(0, index_js_1.getRandomValue)(10)}`; });
46
+ const [id] = React.useState(() => props.id ?? `iui-carousel-${(0, index_js_1.getRandomValue)(10)}`);
47
47
  const isManuallyUpdating = React.useRef(false);
48
48
  const carouselRef = React.useRef(null);
49
49
  const refs = (0, index_js_1.useMergedRefs)(carouselRef, ref);
@@ -51,7 +51,6 @@ const CarouselComponent = React.forwardRef((props, ref) => {
51
51
  const scrollToSlide = React.useRef(() => { }); // stub function populated in CarouselSlider
52
52
  const justMounted = React.useRef(true);
53
53
  React.useEffect(() => {
54
- var _a;
55
54
  setCurrentIndex(userActiveIndex);
56
55
  scrollToSlide.current(userActiveIndex, {
57
56
  instant: justMounted.current,
@@ -59,7 +58,7 @@ const CarouselComponent = React.forwardRef((props, ref) => {
59
58
  // re-focus the carousel for keyboard nav, but not on first mount
60
59
  // because it shows outline and might interfere with other components
61
60
  if (!justMounted.current) {
62
- (_a = carouselRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
61
+ carouselRef.current?.focus({ preventScroll: true });
63
62
  }
64
63
  justMounted.current = false;
65
64
  }, [userActiveIndex]);
@@ -94,8 +93,7 @@ const CarouselComponent = React.forwardRef((props, ref) => {
94
93
  };
95
94
  const userOnSlideChange = React.useRef(onSlideChange);
96
95
  React.useEffect(() => {
97
- var _a;
98
- (_a = userOnSlideChange.current) === null || _a === void 0 ? void 0 : _a.call(userOnSlideChange, currentIndex);
96
+ userOnSlideChange.current?.(currentIndex);
99
97
  }, [currentIndex]);
100
98
  return (React.createElement(index_js_1.Box, { as: 'section', "aria-roledescription": 'carousel', tabIndex: 0, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, ref: refs, className: (0, classnames_1.default)('iui-carousel', className), ...rest, id: id },
101
99
  React.createElement(CarouselContext_js_1.CarouselContext.Provider, { value: {
@@ -59,18 +59,17 @@ const CarouselDot_js_1 = require("./CarouselDot.js");
59
59
  * />
60
60
  */
61
61
  exports.CarouselDotsList = React.forwardRef((props, ref) => {
62
- var _a, _b, _c;
63
62
  const { currentIndex: userCurrentIndex, length, className, onSlideChange, children, ...rest } = props;
64
63
  const context = React.useContext(CarouselContext_js_1.CarouselContext);
65
- 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);
66
- const currentIndex = (_b = userCurrentIndex !== null && userCurrentIndex !== void 0 ? userCurrentIndex : context === null || context === void 0 ? void 0 : context.currentIndex) !== null && _b !== void 0 ? _b : 0;
67
- const idPrefix = (_c = props.id) !== null && _c !== void 0 ? _c : context === null || context === void 0 ? void 0 : context.idPrefix;
64
+ const slideCount = length ?? context?.slideCount ?? React.Children.count(children);
65
+ const currentIndex = userCurrentIndex ?? context?.currentIndex ?? 0;
66
+ const idPrefix = props.id ?? context?.idPrefix;
68
67
  const handleSlideChange = React.useCallback((index) => {
69
68
  if (context) {
70
69
  context.setCurrentIndex(index);
71
70
  context.scrollToSlide.current(index);
72
71
  }
73
- onSlideChange === null || onSlideChange === void 0 ? void 0 : onSlideChange(index);
72
+ onSlideChange?.(index);
74
73
  }, [context, onSlideChange]);
75
74
  const justMounted = React.useRef(true);
76
75
  const [visibleCount, setVisibleCount] = React.useState(slideCount);
@@ -84,7 +83,7 @@ exports.CarouselDotsList = React.forwardRef((props, ref) => {
84
83
  const dotWidth = listRef.current.children[0].offsetWidth;
85
84
  setVisibleCount(Math.floor(width / dotWidth));
86
85
  });
87
- React.useEffect(() => resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect(), [resizeObserver]);
86
+ React.useEffect(() => resizeObserver?.disconnect(), [resizeObserver]);
88
87
  const refs = (0, index_js_1.useMergedRefs)(ref, resizeRef, listRef);
89
88
  const firstVisibleDotIndex = React.useMemo(() => (0, index_js_1.getBoundedValue)(currentIndex - Math.ceil(visibleCount / 2) + 1, 0, slideCount - visibleCount), [currentIndex, slideCount, visibleCount]);
90
89
  const lastVisibleDotIndex = React.useMemo(() => (0, index_js_1.getBoundedValue)(currentIndex + Math.floor(visibleCount / 2), visibleCount - 1, slideCount - 1), [currentIndex, slideCount, visibleCount]);
@@ -108,12 +107,11 @@ exports.CarouselDotsList = React.forwardRef((props, ref) => {
108
107
  handleSlideChange,
109
108
  ]);
110
109
  React.useEffect(() => {
111
- var _a, _b, _c;
112
- const firstDot = (_a = listRef.current) === null || _a === void 0 ? void 0 : _a.children[firstVisibleDotIndex];
110
+ const firstDot = listRef.current?.children[firstVisibleDotIndex];
113
111
  if (!listRef.current || !firstDot) {
114
112
  return;
115
113
  }
116
- const motionOk = (_c = (_b = (0, index_js_1.getWindow)()) === null || _b === void 0 ? void 0 : _b.matchMedia('(prefers-reduced-motion: no-preference)')) === null || _c === void 0 ? void 0 : _c.matches;
114
+ const motionOk = (0, index_js_1.getWindow)()?.matchMedia('(prefers-reduced-motion: no-preference)')?.matches;
117
115
  listRef.current.scrollTo({
118
116
  left: firstDot.offsetLeft - listRef.current.offsetLeft,
119
117
  behavior: motionOk && !justMounted.current ? 'smooth' : 'auto',
@@ -123,5 +121,5 @@ exports.CarouselDotsList = React.forwardRef((props, ref) => {
123
121
  }
124
122
  }, [currentIndex, firstVisibleDotIndex, slideCount, visibleCount, width]);
125
123
  return (React.createElement(React.Fragment, null,
126
- React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-carousel-navigation-dots', className), role: 'tablist', "aria-label": 'Slides', ref: refs, ...rest }, children !== null && children !== void 0 ? children : dots)));
124
+ React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-carousel-navigation-dots', className), role: 'tablist', "aria-label": 'Slides', ref: refs, ...rest }, children ?? dots)));
127
125
  });
@@ -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"> & {
@@ -39,7 +39,7 @@ const CarouselDotsList_js_1 = require("./CarouselDotsList.js");
39
39
  const index_js_2 = require("../utils/index.js");
40
40
  const CarouselNavigationComponent = React.forwardRef((props, ref) => {
41
41
  const { className, children, ...rest } = props;
42
- return (React.createElement(index_js_2.Box, { as: 'nav', className: (0, classnames_1.default)('iui-carousel-navigation', className), ref: ref, ...rest }, children !== null && children !== void 0 ? children : (React.createElement(React.Fragment, null,
42
+ return (React.createElement(index_js_2.Box, { as: 'nav', className: (0, classnames_1.default)('iui-carousel-navigation', className), ref: ref, ...rest }, children ?? (React.createElement(React.Fragment, null,
43
43
  React.createElement(index_js_2.Box, { className: 'iui-carousel-navigation-left' },
44
44
  React.createElement(PreviousButton, null)),
45
45
  React.createElement(CarouselDotsList_js_1.CarouselDotsList, null),
@@ -54,11 +54,10 @@ const PreviousButton = React.forwardRef((props, ref) => {
54
54
  }
55
55
  const { slideCount, currentIndex, setCurrentIndex, keysPressed, scrollToSlide, } = context;
56
56
  return (React.createElement(index_js_1.IconButton, { styleType: 'borderless', size: 'small', tabIndex: -1, "data-pressed": keysPressed['ArrowLeft'] || undefined, ref: ref, ...props, onClick: (e) => {
57
- var _a;
58
57
  const prevIndex = (slideCount + currentIndex - 1) % slideCount;
59
58
  setCurrentIndex(prevIndex);
60
59
  scrollToSlide.current(prevIndex, { instant: e.detail > 3 });
61
- (_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
60
+ props?.onClick?.(e);
62
61
  } },
63
62
  React.createElement(index_js_2.SvgChevronLeft, null)));
64
63
  });
@@ -70,11 +69,10 @@ const NextButton = React.forwardRef((props, ref) => {
70
69
  }
71
70
  const { slideCount, currentIndex, setCurrentIndex, keysPressed, scrollToSlide, } = context;
72
71
  return (React.createElement(index_js_1.IconButton, { styleType: 'borderless', size: 'small', tabIndex: -1, "data-pressed": keysPressed['ArrowRight'] || undefined, ref: ref, ...props, onClick: (e) => {
73
- var _a;
74
72
  const nextIndex = (slideCount + currentIndex + 1) % slideCount;
75
73
  setCurrentIndex(nextIndex);
76
74
  scrollToSlide.current(nextIndex, { instant: e.detail > 3 });
77
- (_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
75
+ props?.onClick?.(e);
78
76
  } },
79
77
  React.createElement(index_js_2.SvgChevronRight, null)));
80
78
  });
@@ -45,28 +45,24 @@ exports.CarouselSlider = React.forwardRef((props, ref) => {
45
45
  throw new Error('CarouselSlider must be used within Carousel');
46
46
  }
47
47
  const { setSlideCount, idPrefix, scrollToSlide, isManuallyUpdating } = context;
48
- const items = React.useMemo(() => {
49
- var _a;
50
- return (_a = React.Children.map(children, (child, index) => React.isValidElement(child)
51
- ? React.cloneElement(child, {
52
- id: `${idPrefix}--slide-${index}`,
53
- index,
54
- })
55
- : child)) !== null && _a !== void 0 ? _a : [];
56
- }, [children, idPrefix]);
48
+ const items = React.useMemo(() => React.Children.map(children, (child, index) => React.isValidElement(child)
49
+ ? React.cloneElement(child, {
50
+ id: `${idPrefix}--slide-${index}`,
51
+ index,
52
+ })
53
+ : child) ?? [], [children, idPrefix]);
57
54
  (0, index_js_1.useIsomorphicLayoutEffect)(() => {
58
55
  setSlideCount(items.length);
59
56
  }, [items.length, setSlideCount]);
60
57
  const sliderRef = React.useRef(null);
61
58
  const refs = (0, index_js_1.useMergedRefs)(sliderRef, ref);
62
59
  scrollToSlide.current = (slideIndex, { instant } = {}) => {
63
- var _a, _b, _c;
64
60
  isManuallyUpdating.current = true; // start manual update
65
- const slideToShow = (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.children.item(slideIndex);
61
+ const slideToShow = sliderRef.current?.children.item(slideIndex);
66
62
  if (!sliderRef.current || !slideToShow) {
67
63
  return;
68
64
  }
69
- const motionOk = (_c = (_b = (0, index_js_1.getWindow)()) === null || _b === void 0 ? void 0 : _b.matchMedia('(prefers-reduced-motion: no-preference)')) === null || _c === void 0 ? void 0 : _c.matches;
65
+ const motionOk = (0, index_js_1.getWindow)()?.matchMedia('(prefers-reduced-motion: no-preference)')?.matches;
70
66
  sliderRef.current.scrollTo({
71
67
  left: slideToShow.offsetLeft - sliderRef.current.offsetLeft,
72
68
  behavior: (instant || !motionOk ? 'instant' : 'smooth'), // scrollTo accepts 'instant' but ScrollBehavior type is wrong
@@ -75,11 +71,10 @@ exports.CarouselSlider = React.forwardRef((props, ref) => {
75
71
  const scrollTimeout = React.useRef();
76
72
  // reset isManuallyUpdating.current to false after the last scroll event
77
73
  const handleOnScroll = React.useCallback(() => {
78
- var _a, _b;
79
74
  if (scrollTimeout.current) {
80
- (_a = (0, index_js_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.clearTimeout(scrollTimeout.current);
75
+ (0, index_js_1.getWindow)()?.clearTimeout(scrollTimeout.current);
81
76
  }
82
- scrollTimeout.current = (_b = (0, index_js_1.getWindow)()) === null || _b === void 0 ? void 0 : _b.setTimeout(() => {
77
+ scrollTimeout.current = (0, index_js_1.getWindow)()?.setTimeout(() => {
83
78
  isManuallyUpdating.current = false;
84
79
  }, 100);
85
80
  }, [isManuallyUpdating]);
@@ -50,7 +50,6 @@ const getHorizontalPercentageOfRectangle = (rect, pointer) => {
50
50
  * and a set of sliders to adjust hue and alpha values.
51
51
  */
52
52
  exports.ColorBuilder = React.forwardRef((props, ref) => {
53
- var _a, _b, _c;
54
53
  const { className, ...rest } = props;
55
54
  const builderRef = React.useRef();
56
55
  const refs = (0, index_js_1.useMergedRefs)(builderRef, ref);
@@ -58,7 +57,7 @@ exports.ColorBuilder = React.forwardRef((props, ref) => {
58
57
  // Set values for slider
59
58
  const hueSliderColor = React.useMemo(() => index_js_1.ColorValue.create({ h: hsvColor.h, s: 100, v: 100 }), [hsvColor.h]);
60
59
  const sliderValue = React.useMemo(() => hsvColor.h, [hsvColor]);
61
- const alphaValue = React.useMemo(() => { var _a; return (showAlpha ? (_a = hsvColor.a) !== null && _a !== void 0 ? _a : 1 : 1); }, [hsvColor.a, showAlpha]);
60
+ const alphaValue = React.useMemo(() => (showAlpha ? hsvColor.a ?? 1 : 1), [hsvColor.a, showAlpha]);
62
61
  // Set values for color square and color dot
63
62
  const dotColorString = React.useMemo(() => activeColor.toHexString(), [activeColor]);
64
63
  const [colorDotActive, setColorDotActive] = React.useState(false);
@@ -121,7 +120,7 @@ exports.ColorBuilder = React.forwardRef((props, ref) => {
121
120
  event.preventDefault();
122
121
  event.stopPropagation();
123
122
  }, [colorDotActive, updateSquareValue]);
124
- (0, index_js_1.useEventListener)('pointerup', handleSquarePointerUp, (_a = builderRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
123
+ (0, index_js_1.useEventListener)('pointerup', handleSquarePointerUp, builderRef.current?.ownerDocument);
125
124
  const handleSquarePointerMove = React.useCallback((event) => {
126
125
  if (!colorDotActive) {
127
126
  return;
@@ -130,7 +129,7 @@ exports.ColorBuilder = React.forwardRef((props, ref) => {
130
129
  event.stopPropagation();
131
130
  updateSquareValue(event, 'onUpdate');
132
131
  }, [colorDotActive, updateSquareValue]);
133
- (0, index_js_1.useEventListener)('pointermove', handleSquarePointerMove, (_b = builderRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument);
132
+ (0, index_js_1.useEventListener)('pointermove', handleSquarePointerMove, builderRef.current?.ownerDocument);
134
133
  const handleSquarePointerLeave = React.useCallback((event) => {
135
134
  if (!colorDotActive) {
136
135
  return;
@@ -138,7 +137,7 @@ exports.ColorBuilder = React.forwardRef((props, ref) => {
138
137
  updateSquareValue(event, 'onChange');
139
138
  setColorDotActive(false);
140
139
  }, [colorDotActive, updateSquareValue]);
141
- (0, index_js_1.useEventListener)('pointerleave', handleSquarePointerLeave, (_c = builderRef.current) === null || _c === void 0 ? void 0 : _c.ownerDocument);
140
+ (0, index_js_1.useEventListener)('pointerleave', handleSquarePointerLeave, builderRef.current?.ownerDocument);
142
141
  const keysPressed = React.useRef({}); // keep track of which keys are currently pressed
143
142
  // Arrow key navigation for color dot
144
143
  const handleColorDotKeyDown = (event) => {
@@ -182,7 +181,7 @@ exports.ColorBuilder = React.forwardRef((props, ref) => {
182
181
  keysPressed.current['ArrowRight']) {
183
182
  return;
184
183
  }
185
- onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(index_js_1.ColorValue.create(hsvColor));
184
+ onChangeComplete?.(index_js_1.ColorValue.create(hsvColor));
186
185
  break;
187
186
  }
188
187
  };
@@ -191,18 +190,16 @@ exports.ColorBuilder = React.forwardRef((props, ref) => {
191
190
  '--iui-color-field-hue': hueColorString,
192
191
  '--iui-color-picker-selected-color': dotColorString,
193
192
  }, ref: squareRef, onPointerDown: (event) => {
194
- var _a;
195
193
  event.preventDefault();
196
194
  updateSquareValue(event, 'onClick');
197
195
  setColorDotActive(true);
198
- (_a = colorDotRef.current) === null || _a === void 0 ? void 0 : _a.focus();
196
+ colorDotRef.current?.focus();
199
197
  } },
200
198
  React.createElement(index_js_1.Box, { className: 'iui-color-dot', style: {
201
199
  '--iui-color-dot-inset': `${squareTop.toString()}% auto auto ${squareLeft.toString()}%`,
202
200
  }, onPointerDown: () => {
203
- var _a;
204
201
  setColorDotActive(true);
205
- (_a = colorDotRef.current) === null || _a === void 0 ? void 0 : _a.focus();
202
+ colorDotRef.current?.focus();
206
203
  }, onKeyDown: handleColorDotKeyDown, onKeyUp: handleColorDotKeyUp, tabIndex: 0, ref: colorDotRef })),
207
204
  React.createElement(index_js_2.Slider, { minLabel: '', maxLabel: '', values: [sliderValue], className: 'iui-hue-slider', trackDisplayMode: 'none', tooltipProps: () => ({ visible: false }), onChange: (values) => {
208
205
  updateHueSlider(values[0], true);