@itwin/itwinui-react 3.0.0-dev.7 → 3.0.0-dev.9

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 (215) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/cjs/core/Alert/Alert.d.ts +20 -9
  3. package/cjs/core/Alert/Alert.js +48 -10
  4. package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
  5. package/cjs/core/Buttons/DropdownButton/DropdownButton.js +7 -19
  6. package/cjs/core/Buttons/IconButton/IconButton.js +27 -44
  7. package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +4 -4
  8. package/cjs/core/Buttons/SplitButton/SplitButton.js +54 -29
  9. package/cjs/core/ColorPicker/ColorInputPanel.js +172 -231
  10. package/cjs/core/ComboBox/ComboBox.d.ts +2 -2
  11. package/cjs/core/ComboBox/ComboBox.js +33 -25
  12. package/cjs/core/ComboBox/ComboBoxEndIcon.js +3 -22
  13. package/cjs/core/ComboBox/ComboBoxInput.js +29 -21
  14. package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
  15. package/cjs/core/ComboBox/ComboBoxMenu.js +73 -93
  16. package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
  17. package/cjs/core/ComboBox/ComboBoxMenuItem.js +8 -6
  18. package/cjs/core/ComboBox/helpers.d.ts +5 -3
  19. package/cjs/core/DatePicker/DatePicker.d.ts +30 -8
  20. package/cjs/core/DatePicker/DatePicker.js +40 -5
  21. package/cjs/core/Dialog/Dialog.js +10 -16
  22. package/cjs/core/Dialog/DialogContext.d.ts +3 -4
  23. package/cjs/core/DropdownMenu/DropdownMenu.d.ts +6 -5
  24. package/cjs/core/DropdownMenu/DropdownMenu.js +59 -55
  25. package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
  26. package/cjs/core/ExpandableBlock/ExpandableBlock.js +38 -15
  27. package/cjs/core/Header/HeaderDropdownButton.js +1 -2
  28. package/cjs/core/Header/HeaderSplitButton.js +2 -2
  29. package/cjs/core/Input/Input.d.ts +4 -0
  30. package/cjs/core/Input/Input.js +2 -1
  31. package/cjs/core/InputGrid/InputGrid.d.ts +25 -0
  32. package/cjs/core/InputGrid/InputGrid.js +39 -0
  33. package/cjs/core/InputGrid/index.d.ts +3 -0
  34. package/cjs/core/InputGrid/index.js +15 -0
  35. package/cjs/core/InputGroup/InputGroup.d.ts +13 -0
  36. package/cjs/core/InputGroup/InputGroup.js +35 -9
  37. package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
  38. package/cjs/core/InputWithDecorations/InputWithDecorations.js +81 -0
  39. package/cjs/core/InputWithDecorations/index.d.ts +3 -0
  40. package/cjs/core/InputWithDecorations/index.js +15 -0
  41. package/cjs/core/Label/Label.d.ts +5 -0
  42. package/cjs/core/Label/Label.js +2 -0
  43. package/cjs/core/LabeledInput/LabeledInput.d.ts +22 -16
  44. package/cjs/core/LabeledInput/LabeledInput.js +52 -29
  45. package/cjs/core/LabeledSelect/LabeledSelect.d.ts +17 -7
  46. package/cjs/core/LabeledSelect/LabeledSelect.js +36 -17
  47. package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
  48. package/cjs/core/LabeledTextarea/LabeledTextarea.js +12 -45
  49. package/cjs/core/Menu/Menu.d.ts +1 -1
  50. package/cjs/core/Menu/Menu.js +2 -2
  51. package/cjs/core/Menu/MenuDivider.d.ts +2 -1
  52. package/cjs/core/Menu/MenuDivider.js +1 -1
  53. package/cjs/core/Menu/MenuItem.d.ts +1 -1
  54. package/cjs/core/Menu/MenuItem.js +78 -55
  55. package/cjs/core/Menu/MenuItemSkeleton.d.ts +1 -1
  56. package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
  57. package/cjs/core/SearchBox/SearchBox.js +1 -1
  58. package/cjs/core/Select/Select.d.ts +9 -5
  59. package/cjs/core/Select/Select.js +81 -99
  60. package/cjs/core/SideNavigation/SideNavigation.js +2 -0
  61. package/cjs/core/Slider/Thumb.js +1 -0
  62. package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
  63. package/cjs/core/StatusMessage/StatusMessage.js +23 -9
  64. package/cjs/core/Table/SubRowExpander.js +2 -0
  65. package/cjs/core/Table/columns/actionColumn.js +3 -7
  66. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
  67. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +56 -33
  68. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
  69. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
  70. package/cjs/core/Table/filters/FilterToggle.js +3 -2
  71. package/cjs/core/Textarea/Textarea.d.ts +7 -1
  72. package/cjs/core/Textarea/Textarea.js +6 -11
  73. package/cjs/core/ThemeProvider/ThemeProvider.js +1 -1
  74. package/cjs/core/Tile/Tile.d.ts +139 -15
  75. package/cjs/core/Tile/Tile.js +128 -38
  76. package/cjs/core/Toast/Toast.d.ts +12 -4
  77. package/cjs/core/Toast/Toast.js +20 -4
  78. package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
  79. package/cjs/core/Tooltip/Tooltip.js +116 -117
  80. package/cjs/core/TransferList/TransferList.js +4 -12
  81. package/cjs/core/index.d.ts +3 -1
  82. package/cjs/core/index.js +28 -5
  83. package/cjs/core/utils/components/Icon.d.ts +5 -0
  84. package/cjs/core/utils/components/Icon.js +8 -1
  85. package/cjs/core/utils/components/InputContainer.d.ts +4 -5
  86. package/cjs/core/utils/components/InputContainer.js +21 -37
  87. package/cjs/core/utils/components/InputFlexContainer.d.ts +1 -0
  88. package/cjs/core/utils/components/InputFlexContainer.js +3 -1
  89. package/cjs/core/utils/components/Popover.d.ts +113 -27
  90. package/cjs/core/utils/components/Popover.js +156 -118
  91. package/cjs/core/utils/components/Portal.d.ts +27 -0
  92. package/cjs/core/utils/components/Portal.js +43 -0
  93. package/cjs/core/utils/components/index.d.ts +1 -0
  94. package/cjs/core/utils/components/index.js +1 -0
  95. package/cjs/core/utils/functions/index.d.ts +1 -0
  96. package/cjs/core/utils/functions/index.js +1 -0
  97. package/cjs/core/utils/functions/react.d.ts +8 -0
  98. package/cjs/core/utils/functions/react.js +40 -0
  99. package/cjs/core/utils/hooks/index.d.ts +1 -1
  100. package/cjs/core/utils/hooks/index.js +1 -1
  101. package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
  102. package/cjs/core/utils/hooks/useControlledState.js +39 -0
  103. package/cjs/styles.js +10 -31
  104. package/esm/core/Alert/Alert.d.ts +20 -9
  105. package/esm/core/Alert/Alert.js +49 -10
  106. package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
  107. package/esm/core/Buttons/DropdownButton/DropdownButton.js +8 -24
  108. package/esm/core/Buttons/IconButton/IconButton.js +25 -40
  109. package/esm/core/Buttons/SplitButton/SplitButton.d.ts +4 -4
  110. package/esm/core/Buttons/SplitButton/SplitButton.js +61 -28
  111. package/esm/core/ColorPicker/ColorInputPanel.js +173 -232
  112. package/esm/core/ComboBox/ComboBox.d.ts +2 -2
  113. package/esm/core/ComboBox/ComboBox.js +34 -25
  114. package/esm/core/ComboBox/ComboBoxEndIcon.js +4 -25
  115. package/esm/core/ComboBox/ComboBoxInput.js +22 -21
  116. package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
  117. package/esm/core/ComboBox/ComboBoxMenu.js +67 -87
  118. package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
  119. package/esm/core/ComboBox/ComboBoxMenuItem.js +9 -7
  120. package/esm/core/ComboBox/helpers.d.ts +5 -3
  121. package/esm/core/DatePicker/DatePicker.d.ts +30 -8
  122. package/esm/core/DatePicker/DatePicker.js +25 -5
  123. package/esm/core/Dialog/Dialog.js +11 -23
  124. package/esm/core/Dialog/DialogContext.d.ts +3 -4
  125. package/esm/core/DropdownMenu/DropdownMenu.d.ts +6 -5
  126. package/esm/core/DropdownMenu/DropdownMenu.js +64 -56
  127. package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
  128. package/esm/core/ExpandableBlock/ExpandableBlock.js +39 -17
  129. package/esm/core/Header/HeaderDropdownButton.js +1 -2
  130. package/esm/core/Header/HeaderSplitButton.js +2 -2
  131. package/esm/core/Input/Input.d.ts +4 -0
  132. package/esm/core/Input/Input.js +2 -1
  133. package/esm/core/InputGrid/InputGrid.d.ts +25 -0
  134. package/esm/core/InputGrid/InputGrid.js +35 -0
  135. package/esm/core/InputGrid/index.d.ts +3 -0
  136. package/esm/core/InputGrid/index.js +6 -0
  137. package/esm/core/InputGroup/InputGroup.d.ts +13 -0
  138. package/esm/core/InputGroup/InputGroup.js +34 -10
  139. package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
  140. package/esm/core/InputWithDecorations/InputWithDecorations.js +80 -0
  141. package/esm/core/InputWithDecorations/index.d.ts +3 -0
  142. package/esm/core/InputWithDecorations/index.js +6 -0
  143. package/esm/core/Label/Label.d.ts +5 -0
  144. package/esm/core/Label/Label.js +2 -0
  145. package/esm/core/LabeledInput/LabeledInput.d.ts +22 -16
  146. package/esm/core/LabeledInput/LabeledInput.js +53 -29
  147. package/esm/core/LabeledSelect/LabeledSelect.d.ts +17 -7
  148. package/esm/core/LabeledSelect/LabeledSelect.js +37 -18
  149. package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
  150. package/esm/core/LabeledTextarea/LabeledTextarea.js +14 -45
  151. package/esm/core/Menu/Menu.d.ts +1 -1
  152. package/esm/core/Menu/Menu.js +8 -3
  153. package/esm/core/Menu/MenuDivider.d.ts +2 -1
  154. package/esm/core/Menu/MenuDivider.js +1 -1
  155. package/esm/core/Menu/MenuItem.d.ts +1 -1
  156. package/esm/core/Menu/MenuItem.js +85 -52
  157. package/esm/core/Menu/MenuItemSkeleton.d.ts +1 -1
  158. package/esm/core/Menu/MenuItemSkeleton.js +0 -1
  159. package/esm/core/SearchBox/SearchBox.js +1 -1
  160. package/esm/core/Select/Select.d.ts +9 -5
  161. package/esm/core/Select/Select.js +81 -96
  162. package/esm/core/SideNavigation/SideNavigation.js +2 -0
  163. package/esm/core/Slider/Thumb.js +1 -0
  164. package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
  165. package/esm/core/StatusMessage/StatusMessage.js +23 -16
  166. package/esm/core/Table/SubRowExpander.js +2 -0
  167. package/esm/core/Table/columns/actionColumn.js +3 -7
  168. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
  169. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +56 -33
  170. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
  171. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
  172. package/esm/core/Table/filters/FilterToggle.js +3 -2
  173. package/esm/core/Textarea/Textarea.d.ts +7 -1
  174. package/esm/core/Textarea/Textarea.js +6 -11
  175. package/esm/core/ThemeProvider/ThemeProvider.js +4 -3
  176. package/esm/core/Tile/Tile.d.ts +139 -15
  177. package/esm/core/Tile/Tile.js +128 -38
  178. package/esm/core/Toast/Toast.d.ts +12 -4
  179. package/esm/core/Toast/Toast.js +21 -4
  180. package/esm/core/Tooltip/Tooltip.d.ts +35 -28
  181. package/esm/core/Tooltip/Tooltip.js +119 -116
  182. package/esm/core/TransferList/TransferList.js +4 -9
  183. package/esm/core/index.d.ts +3 -1
  184. package/esm/core/index.js +3 -0
  185. package/esm/core/utils/components/Icon.d.ts +5 -0
  186. package/esm/core/utils/components/Icon.js +8 -1
  187. package/esm/core/utils/components/InputContainer.d.ts +4 -5
  188. package/esm/core/utils/components/InputContainer.js +21 -32
  189. package/esm/core/utils/components/InputFlexContainer.d.ts +1 -0
  190. package/esm/core/utils/components/InputFlexContainer.js +3 -1
  191. package/esm/core/utils/components/Popover.d.ts +113 -27
  192. package/esm/core/utils/components/Popover.js +175 -118
  193. package/esm/core/utils/components/Portal.d.ts +27 -0
  194. package/esm/core/utils/components/Portal.js +36 -0
  195. package/esm/core/utils/components/index.d.ts +1 -0
  196. package/esm/core/utils/components/index.js +1 -0
  197. package/esm/core/utils/functions/index.d.ts +1 -0
  198. package/esm/core/utils/functions/index.js +1 -0
  199. package/esm/core/utils/functions/react.d.ts +8 -0
  200. package/esm/core/utils/functions/react.js +35 -0
  201. package/esm/core/utils/hooks/index.d.ts +1 -1
  202. package/esm/core/utils/hooks/index.js +1 -1
  203. package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
  204. package/esm/core/utils/hooks/useControlledState.js +34 -0
  205. package/esm/styles.js +10 -31
  206. package/package.json +3 -5
  207. package/styles.css +23 -20
  208. package/cjs/core/ComboBox/ComboBoxDropdown.d.ts +0 -7
  209. package/cjs/core/ComboBox/ComboBoxDropdown.js +0 -48
  210. package/cjs/core/utils/hooks/useUncontrolledState.d.ts +0 -6
  211. package/cjs/core/utils/hooks/useUncontrolledState.js +0 -18
  212. package/esm/core/ComboBox/ComboBoxDropdown.d.ts +0 -7
  213. package/esm/core/ComboBox/ComboBoxDropdown.js +0 -42
  214. package/esm/core/utils/hooks/useUncontrolledState.d.ts +0 -6
  215. package/esm/core/utils/hooks/useUncontrolledState.js +0 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0-dev.9
4
+
5
+ ### Major Changes
6
+
7
+ - [#1506](https://github.com/iTwin/iTwinUI/pull/1506): Replaced `tippy.js` with `floating-ui` in all popover-based components. While the basic usage is unchanged, all advanced props from tippy are no longer available.
8
+
9
+ Components affected: Select, ComboBox, DropdownMenu, DropdownButton, SplitButton.
10
+
11
+ ### Minor Changes
12
+
13
+ - [#1506](https://github.com/iTwin/iTwinUI/pull/1506): Added new `Popover` component for public use.
14
+
15
+ ## 3.0.0-dev.8
16
+
17
+ ### Major Changes
18
+
19
+ - [#1544](https://github.com/iTwin/iTwinUI/pull/1544): Removed `iconDisplayStyle` prop from `LabeledInput` and `LabeledTextarea` components. `svgIcon` is now added inline. Users must use `StatusMessage` to add custom icon to the message.
20
+ - [#1355](https://github.com/iTwin/iTwinUI/pull/1355): Removed `inputStyle` and `inputClassName` props from `LabeledInput`; style and className props are being passed down to input. Added `wrapperProps`, `labelProps`, `messageProps`, `messageIconProps`, `inputWrapperProps` to pass props to sub elements.
21
+ - [#1355](https://github.com/iTwin/iTwinUI/pull/1355): Removed `selectStyle` and `selectClassName` props from `LabeledSelect`; style and className props are being passed down to textarea. Added `wrapperProps`, `labelProps`, `messageProps`, `messageIconProps` to pass props to sub elements.
22
+ - [#1355](https://github.com/iTwin/iTwinUI/pull/1355): Removed `textareaStyle` and `textareaClassName` props from `LabeledTextarea`; style and className props are being passed down to textarea. Added `wrapperProps`, `labelProps`, `messageProps`, `messageIconProps` to pass props to sub elements.
23
+
24
+ ### Minor Changes
25
+
26
+ - [#1355](https://github.com/iTwin/iTwinUI/pull/1355): Added `status` prop to `Input`, `Textarea` and `Select`.
27
+ - [#1510](https://github.com/iTwin/iTwinUI/pull/1510): Added `domProps` to allow Toast's DOM customisation.
28
+ - [#1355](https://github.com/iTwin/iTwinUI/pull/1355): Added two new components for building complex input layouts.
29
+
30
+ - `InputGrid` for the "outer" layout (label, inputs and statusMessage)
31
+ - `InputWithDecorations` for the "inner" layout (start icon/button, end icon/button)
32
+
33
+ `LabeledInput`, `LabeledSelect`, `LabeledTextarea` and table `DatePickerInput` have been updated to make use of these new components internally.
34
+
35
+ - [#1531](https://github.com/iTwin/iTwinUI/pull/1531): Selected options in Select/ComboBox will now have a checkmark.
36
+ - [#1355](https://github.com/iTwin/iTwinUI/pull/1355): Added new `padded` prop to `Icon`.
37
+ - [#1466](https://github.com/iTwin/iTwinUI/pull/1466): Adding the ability for every DOM node inside DatePicker component to have a custom className passed to it.
38
+ - [#1523](https://github.com/iTwin/iTwinUI/pull/1523): Added `ariaStrategy` prop to Tooltip. Can be used to change how the tooltip is associated with the trigger element.
39
+
40
+ ### Patch Changes
41
+
42
+ - [#1533](https://github.com/iTwin/iTwinUI/pull/1533): Fixed missing accessible name in SplitButton.
43
+ - [#1495](https://github.com/iTwin/iTwinUI/pull/1495): Added accessible name to dropdown menu button in HeaderSplitButton.
44
+ - [#1496](https://github.com/iTwin/iTwinUI/pull/1496): Added accessible button name to SideNavigation expand button.
45
+ - [#1505](https://github.com/iTwin/iTwinUI/pull/1505): Gave accessible label to the sub-row toggle in <Table>.
46
+
3
47
  ## 3.0.0-dev.7
4
48
 
5
49
  ### Major Changes
@@ -146,6 +190,30 @@
146
190
  - Updated dependencies:
147
191
  - @itwin/itwinui-css@2.0.0-dev.0
148
192
 
193
+ ## 2.12.7
194
+
195
+ ### Patch Changes
196
+
197
+ - [#1545](https://github.com/iTwin/iTwinUI/pull/1545): `tableFilters.DateRangeFilter` now supports localizing the date picker using `translatedLabels.datePicker`.
198
+
199
+ ## 2.12.6
200
+
201
+ ### Patch Changes
202
+
203
+ - [#1516](https://github.com/iTwin/iTwinUI/pull/1516): Update SearchBox placeholder color to match Input.
204
+
205
+ ## 2.12.5
206
+
207
+ ### Patch Changes
208
+
209
+ - [#1511](https://github.com/iTwin/iTwinUI/pull/1511): Fix high-visibility button background on hover.
210
+
211
+ ## 2.12.4
212
+
213
+ ### Patch Changes
214
+
215
+ - [#1508](https://github.com/iTwin/iTwinUI/pull/1508): Fixed an issue where styles were not included in CommonJS environments.
216
+
149
217
  ## 2.12.3
150
218
 
151
219
  ### Patch Changes
@@ -12,20 +12,26 @@ type AlertOwnProps = {
12
12
  */
13
13
  isSticky?: boolean;
14
14
  };
15
+ type AlertLegacyProps = {
16
+ /** @deprecated Use `Alert.Action` subcomponent. */
17
+ clickableText?: React.ReactNode;
18
+ /** @deprecated Use `Alert.Action` subcomponent. */
19
+ clickableTextProps?: React.ComponentPropsWithoutRef<'a'>;
20
+ /** @deprecated Use `Alert.CloseButton` subcomponent. */
21
+ onClose?: () => void;
22
+ };
15
23
  /**
16
24
  * A small box to quickly grab user attention and communicate a brief message
17
25
  * @example
18
- * <Alert>
19
- * <Alert.Message>This is an alert.</Alert.Message>
20
- * </Alert>
26
+ * <Alert>This is an alert.</Alert>
21
27
  * @example
22
- * <Alert type='informational'>
28
+ * <Alert.Wrapper type='informational'>
23
29
  * <Alert.Icon />
24
30
  * <Alert.Message>This is an informational alert.</Alert.Message>
25
31
  * <Alert.CloseButton onClick={() => {}} />
26
- * </Alert>
32
+ * </Alert.Wrapper>
27
33
  * @example
28
- * <Alert type='positive'>
34
+ * <Alert.Wrapper type='positive'>
29
35
  * <Alert.Icon>
30
36
  * <SvgSmileyHappy />
31
37
  * </Alert.Icon>
@@ -36,17 +42,22 @@ type AlertOwnProps = {
36
42
  * <Alert.CloseButton onClick={() => {}}>
37
43
  * <SvgCollapse />
38
44
  * </Alert.CloseButton>
39
- * </Alert>
45
+ * </Alert.Wrapper>
40
46
  */
41
- export declare const Alert: PolymorphicForwardRefComponent<"div", AlertOwnProps> & {
47
+ export declare const Alert: PolymorphicForwardRefComponent<"div", AlertOwnProps & AlertLegacyProps> & {
48
+ /**
49
+ * Alert wrapper subcomponent
50
+ */
51
+ Wrapper: PolymorphicForwardRefComponent<"div", AlertOwnProps>;
42
52
  /**
43
53
  * Alert icon subcomponent
44
54
  */
45
55
  Icon: PolymorphicForwardRefComponent<"span", Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
46
56
  ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
47
- }, "fill" | "as" | "key" | "size" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
57
+ }, "fill" | "as" | "key" | "size" | keyof React.HTMLAttributes<HTMLSpanElement> | "padded"> & {
48
58
  size?: "small" | "large" | "auto" | "medium" | import("../utils/types.js").AnyString | undefined;
49
59
  fill?: "default" | "informational" | "negative" | "positive" | "warning" | import("../utils/types.js").AnyString | undefined;
60
+ padded?: boolean | undefined;
50
61
  } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
51
62
  as?: "span" | undefined;
52
63
  }>;
@@ -11,7 +11,43 @@ const React = tslib_1.__importStar(require('react'));
11
11
  const index_js_1 = require('../utils/index.js');
12
12
  const index_js_2 = require('../Buttons/index.js');
13
13
  const AlertContext = React.createContext(undefined);
14
- const AlertComponent = React.forwardRef((props, ref) => {
14
+ // ----------------------------------------------------------------------------
15
+ // Alert component
16
+ const AlertComponent = React.forwardRef((props, forwardedRef) => {
17
+ const {
18
+ children,
19
+ type = 'informational',
20
+ isSticky = false,
21
+ clickableText,
22
+ clickableTextProps,
23
+ onClose,
24
+ ...rest
25
+ } = props;
26
+ return React.createElement(
27
+ exports.Alert.Wrapper,
28
+ { type: type, isSticky: isSticky, ref: forwardedRef, ...rest },
29
+ React.createElement(exports.Alert.Icon, null),
30
+ React.createElement(
31
+ exports.Alert.Message,
32
+ null,
33
+ children,
34
+ clickableText
35
+ ? React.createElement(
36
+ exports.Alert.Action,
37
+ { ...clickableTextProps },
38
+ clickableText,
39
+ )
40
+ : null,
41
+ ),
42
+ onClose
43
+ ? React.createElement(exports.Alert.CloseButton, { onClick: onClose })
44
+ : null,
45
+ );
46
+ });
47
+ AlertComponent.displayName = 'Alert';
48
+ // ----------------------------------------------------------------------------
49
+ // Alert.Wrapper component
50
+ const AlertWrapper = React.forwardRef((props, ref) => {
15
51
  const {
16
52
  children,
17
53
  className,
@@ -31,7 +67,7 @@ const AlertComponent = React.forwardRef((props, ref) => {
31
67
  React.createElement(AlertContext.Provider, { value: { type } }, children),
32
68
  );
33
69
  });
34
- AlertComponent.displayName = 'Alert';
70
+ AlertWrapper.displayName = 'Alert.Wrapper';
35
71
  // ----------------------------------------------------------------------------
36
72
  // Alert.Icon component
37
73
  const AlertIcon = React.forwardRef((props, ref) => {
@@ -54,7 +90,7 @@ AlertMessage.displayName = 'Alert.Message';
54
90
  const AlertAction = React.forwardRef((props, ref) => {
55
91
  const { children, className, ...rest } = props;
56
92
  return React.createElement(
57
- index_js_1.Box,
93
+ index_js_1.ButtonBase,
58
94
  {
59
95
  as: !!props.href ? 'a' : 'button',
60
96
  className: (0, classnames_1.default)('iui-alert-link', className),
@@ -85,17 +121,15 @@ AlertCloseButton.displayName = 'Alert.CloseButton';
85
121
  /**
86
122
  * A small box to quickly grab user attention and communicate a brief message
87
123
  * @example
88
- * <Alert>
89
- * <Alert.Message>This is an alert.</Alert.Message>
90
- * </Alert>
124
+ * <Alert>This is an alert.</Alert>
91
125
  * @example
92
- * <Alert type='informational'>
126
+ * <Alert.Wrapper type='informational'>
93
127
  * <Alert.Icon />
94
128
  * <Alert.Message>This is an informational alert.</Alert.Message>
95
129
  * <Alert.CloseButton onClick={() => {}} />
96
- * </Alert>
130
+ * </Alert.Wrapper>
97
131
  * @example
98
- * <Alert type='positive'>
132
+ * <Alert.Wrapper type='positive'>
99
133
  * <Alert.Icon>
100
134
  * <SvgSmileyHappy />
101
135
  * </Alert.Icon>
@@ -106,9 +140,13 @@ AlertCloseButton.displayName = 'Alert.CloseButton';
106
140
  * <Alert.CloseButton onClick={() => {}}>
107
141
  * <SvgCollapse />
108
142
  * </Alert.CloseButton>
109
- * </Alert>
143
+ * </Alert.Wrapper>
110
144
  */
111
145
  exports.Alert = Object.assign(AlertComponent, {
146
+ /**
147
+ * Alert wrapper subcomponent
148
+ */
149
+ Wrapper: AlertWrapper,
112
150
  /**
113
151
  * Alert icon subcomponent
114
152
  */
@@ -9,6 +9,7 @@ const tslib_1 = require('tslib');
9
9
  const React = tslib_1.__importStar(require('react'));
10
10
  const classnames_1 = tslib_1.__importDefault(require('classnames'));
11
11
  const index_js_1 = require('../utils/index.js');
12
+ const react_1 = require('@floating-ui/react');
12
13
  /**
13
14
  * Group buttons together for common actions.
14
15
  * Handles responsive overflow when the `overflowButton` prop is specified.
@@ -60,42 +61,46 @@ exports.ButtonGroup = React.forwardRef((props, ref) => {
60
61
  );
61
62
  const refs = (0, index_js_1.useMergedRefs)(overflowRef, ref);
62
63
  return React.createElement(
63
- index_js_1.Box,
64
- {
65
- className: (0, classnames_1.default)(
66
- {
67
- 'iui-button-group': orientation === 'horizontal',
68
- 'iui-button-group-vertical': orientation === 'vertical',
69
- 'iui-button-group-overflow-x':
70
- !!overflowButton && orientation === 'horizontal',
71
- },
72
- className,
73
- ),
74
- ref: refs,
75
- ...rest,
76
- },
77
- (() => {
78
- if (!(visibleCount < items.length)) {
79
- return items;
80
- }
81
- const overflowStart =
82
- overflowPlacement === 'start'
83
- ? items.length - visibleCount
84
- : visibleCount - 1;
85
- return React.createElement(
86
- React.Fragment,
87
- null,
88
- overflowButton &&
89
- overflowPlacement === 'start' &&
90
- React.createElement('div', null, overflowButton(overflowStart)),
91
- overflowPlacement === 'start'
92
- ? items.slice(overflowStart + 1)
93
- : items.slice(0, Math.max(0, overflowStart)),
94
- overflowButton &&
95
- overflowPlacement === 'end' &&
96
- React.createElement('div', null, overflowButton(overflowStart)),
97
- );
98
- })(),
64
+ react_1.FloatingDelayGroup,
65
+ { delay: { open: 50, close: 250 } },
66
+ React.createElement(
67
+ index_js_1.Box,
68
+ {
69
+ className: (0, classnames_1.default)(
70
+ {
71
+ 'iui-button-group': orientation === 'horizontal',
72
+ 'iui-button-group-vertical': orientation === 'vertical',
73
+ 'iui-button-group-overflow-x':
74
+ !!overflowButton && orientation === 'horizontal',
75
+ },
76
+ className,
77
+ ),
78
+ ref: refs,
79
+ ...rest,
80
+ },
81
+ (() => {
82
+ if (!(visibleCount < items.length)) {
83
+ return items;
84
+ }
85
+ const overflowStart =
86
+ overflowPlacement === 'start'
87
+ ? items.length - visibleCount
88
+ : visibleCount - 1;
89
+ return React.createElement(
90
+ React.Fragment,
91
+ null,
92
+ overflowButton &&
93
+ overflowPlacement === 'start' &&
94
+ React.createElement('div', null, overflowButton(overflowStart)),
95
+ overflowPlacement === 'start'
96
+ ? items.slice(overflowStart + 1)
97
+ : items.slice(0, Math.max(0, overflowStart)),
98
+ overflowButton &&
99
+ overflowPlacement === 'end' &&
100
+ React.createElement('div', null, overflowButton(overflowStart)),
101
+ );
102
+ })(),
103
+ ),
99
104
  );
100
105
  });
101
106
  exports.default = exports.ButtonGroup;
@@ -20,7 +20,7 @@ const index_js_3 = require('../../utils/index.js');
20
20
  * ];
21
21
  * <DropdownButton menuItems={menuItems}>Default</DropdownButton>
22
22
  */
23
- exports.DropdownButton = React.forwardRef((props, ref) => {
23
+ exports.DropdownButton = React.forwardRef((props, forwardedRef) => {
24
24
  const {
25
25
  menuItems,
26
26
  className,
@@ -31,28 +31,17 @@ exports.DropdownButton = React.forwardRef((props, ref) => {
31
31
  ...rest
32
32
  } = props;
33
33
  const [isMenuOpen, setIsMenuOpen] = React.useState(false);
34
- const [menuWidth, setMenuWidth] = React.useState(0);
35
- const buttonRef = React.useRef(null);
36
- const refs = (0, index_js_3.useMergedRefs)(ref, buttonRef);
37
- React.useEffect(() => {
38
- if (buttonRef.current) {
39
- setMenuWidth(buttonRef.current.offsetWidth);
40
- }
41
- }, [children, size, styleType]);
42
34
  return React.createElement(
43
35
  index_js_2.DropdownMenu,
44
36
  {
45
37
  menuItems: menuItems,
38
+ matchWidth: true,
39
+ visible: isMenuOpen,
46
40
  ...dropdownMenuProps,
47
- onShow: (i) => {
48
- setIsMenuOpen(true);
49
- dropdownMenuProps?.onShow?.(i);
41
+ onVisibleChange: (open) => {
42
+ setIsMenuOpen(open);
43
+ dropdownMenuProps?.onVisibleChange?.(open);
50
44
  },
51
- onHide: (i) => {
52
- setIsMenuOpen(false);
53
- dropdownMenuProps?.onHide?.(i);
54
- },
55
- style: { minInlineSize: menuWidth, ...dropdownMenuProps?.style },
56
45
  },
57
46
  React.createElement(
58
47
  index_js_1.Button,
@@ -67,8 +56,7 @@ exports.DropdownButton = React.forwardRef((props, ref) => {
67
56
  : React.createElement(index_js_3.SvgCaretDownSmall, {
68
57
  'aria-hidden': true,
69
58
  }),
70
- ref: refs,
71
- 'aria-label': 'Dropdown',
59
+ ref: forwardedRef,
72
60
  ...rest,
73
61
  },
74
62
  children,
@@ -9,6 +9,7 @@ const tslib_1 = require('tslib');
9
9
  const classnames_1 = tslib_1.__importDefault(require('classnames'));
10
10
  const React = tslib_1.__importStar(require('react'));
11
11
  const index_js_1 = require('../../utils/index.js');
12
+ const Tooltip_js_1 = require('../../Tooltip/Tooltip.js');
12
13
  /**
13
14
  * Icon button
14
15
  * @example
@@ -27,56 +28,38 @@ exports.IconButton = React.forwardRef((props, ref) => {
27
28
  iconProps,
28
29
  ...rest
29
30
  } = props;
30
- return React.createElement(
31
- IconButtonTooltip,
32
- { label: label },
31
+ const button = React.createElement(
32
+ index_js_1.ButtonBase,
33
+ {
34
+ ref: ref,
35
+ className: (0, classnames_1.default)('iui-button', className),
36
+ 'data-iui-variant': styleType !== 'default' ? styleType : undefined,
37
+ 'data-iui-size': size,
38
+ 'data-iui-active': isActive,
39
+ 'aria-pressed': isActive,
40
+ ...rest,
41
+ },
33
42
  React.createElement(
34
- index_js_1.ButtonBase,
43
+ index_js_1.Box,
35
44
  {
36
- ref: ref,
37
- className: (0, classnames_1.default)('iui-button', className),
38
- 'data-iui-variant': styleType !== 'default' ? styleType : undefined,
39
- 'data-iui-size': size,
40
- 'data-iui-active': isActive,
41
- 'aria-pressed': isActive,
42
- ...rest,
45
+ as: 'span',
46
+ 'aria-hidden': true,
47
+ ...iconProps,
48
+ className: (0, classnames_1.default)(
49
+ 'iui-button-icon',
50
+ iconProps?.className,
51
+ ),
43
52
  },
44
- React.createElement(
45
- index_js_1.Box,
46
- {
47
- as: 'span',
48
- 'aria-hidden': true,
49
- ...iconProps,
50
- className: (0, classnames_1.default)(
51
- 'iui-button-icon',
52
- iconProps?.className,
53
- ),
54
- },
55
- children,
56
- ),
57
- label
58
- ? React.createElement(index_js_1.VisuallyHidden, null, label)
59
- : null,
53
+ children,
60
54
  ),
55
+ label ? React.createElement(index_js_1.VisuallyHidden, null, label) : null,
61
56
  );
62
- });
63
- const IconButtonTooltip = (props) => {
64
- const { label, children } = props;
65
57
  return label
66
58
  ? React.createElement(
67
- index_js_1.Popover,
68
- {
69
- interactive: false,
70
- offset: [0, 4],
71
- aria: { content: null },
72
- content: React.createElement(
73
- index_js_1.Box,
74
- { 'aria-hidden': 'true', className: 'iui-tooltip' },
75
- label,
76
- ),
77
- },
78
- children,
59
+ Tooltip_js_1.Tooltip,
60
+ { content: label, ariaStrategy: 'none' },
61
+ button,
79
62
  )
80
- : children;
81
- };
63
+ : button;
64
+ });
82
65
  exports.default = exports.IconButton;
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import type { ButtonProps } from '../Button/Button.js';
3
3
  import { IconButton } from '../IconButton/index.js';
4
- import type { Placement } from 'tippy.js';
5
- import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
4
+ import type { PolymorphicForwardRefComponent, PortalProps } from '../../utils/index.js';
5
+ import type { Placement } from '@floating-ui/react';
6
6
  export type SplitButtonProps = ButtonProps & {
7
7
  /**
8
8
  * Items in the dropdown menu.
@@ -26,8 +26,8 @@ export type SplitButtonProps = ButtonProps & {
26
26
  /**
27
27
  * Passes props to SplitButton menu button.
28
28
  */
29
- menuButtonProps?: React.ComponentProps<typeof IconButton>;
30
- };
29
+ menuButtonProps?: Omit<React.ComponentProps<typeof IconButton>, 'label' | 'size'>;
30
+ } & Pick<PortalProps, 'portal'>;
31
31
  /**
32
32
  * Split button component with a DropdownMenu.
33
33
  *
@@ -10,8 +10,8 @@ const classnames_1 = tslib_1.__importDefault(require('classnames'));
10
10
  const React = tslib_1.__importStar(require('react'));
11
11
  const index_js_1 = require('../Button/index.js');
12
12
  const index_js_2 = require('../IconButton/index.js');
13
- const index_js_3 = require('../../DropdownMenu/index.js');
14
- const index_js_4 = require('../../utils/index.js');
13
+ const index_js_3 = require('../../utils/index.js');
14
+ const Menu_js_1 = require('../../Menu/Menu.js');
15
15
  /**
16
16
  * Split button component with a DropdownMenu.
17
17
  *
@@ -37,20 +37,33 @@ exports.SplitButton = React.forwardRef((props, forwardedRef) => {
37
37
  children,
38
38
  wrapperProps,
39
39
  menuButtonProps,
40
+ portal = true,
40
41
  ...rest
41
42
  } = props;
42
- const [isMenuOpen, setIsMenuOpen] = React.useState(false);
43
- const [menuWidth, setMenuWidth] = React.useState(0);
44
- const wrapperRef = React.useRef(null);
45
- React.useEffect(() => {
46
- if (wrapperRef.current) {
47
- setMenuWidth(wrapperRef.current.offsetWidth);
43
+ const buttonRef = React.useRef(null);
44
+ const [visible, setVisible] = React.useState(false);
45
+ const close = React.useCallback(() => {
46
+ setVisible(false);
47
+ buttonRef.current?.focus({ preventScroll: true });
48
+ }, []);
49
+ const menuContent = React.useMemo(() => {
50
+ if (typeof menuItems === 'function') {
51
+ return menuItems(close);
48
52
  }
49
- }, [children, size]);
53
+ return menuItems;
54
+ }, [menuItems, close]);
55
+ const popover = (0, index_js_3.usePopover)({
56
+ visible,
57
+ onVisibleChange: (open) => (open ? setVisible(true) : close()),
58
+ placement: menuPlacement,
59
+ matchWidth: true,
60
+ });
61
+ const labelId = (0, index_js_3.useId)();
50
62
  return React.createElement(
51
- index_js_4.Box,
63
+ index_js_3.Box,
52
64
  {
53
65
  ...wrapperProps,
66
+ ref: popover.refs.setPositionReference,
54
67
  className: (0, classnames_1.default)(
55
68
  'iui-button-split',
56
69
  {
@@ -58,7 +71,6 @@ exports.SplitButton = React.forwardRef((props, forwardedRef) => {
58
71
  },
59
72
  wrapperProps?.className,
60
73
  ),
61
- ref: wrapperRef,
62
74
  },
63
75
  React.createElement(
64
76
  index_js_1.Button,
@@ -67,33 +79,46 @@ exports.SplitButton = React.forwardRef((props, forwardedRef) => {
67
79
  styleType: styleType,
68
80
  size: size,
69
81
  onClick: onClick,
70
- ref: forwardedRef,
82
+ ref: (0, index_js_3.useMergedRefs)(buttonRef, forwardedRef),
71
83
  ...rest,
84
+ labelProps: { id: labelId, ...props.labelProps },
72
85
  },
73
86
  children,
74
87
  ),
75
88
  React.createElement(
76
- index_js_3.DropdownMenu,
89
+ index_js_2.IconButton,
77
90
  {
78
- placement: menuPlacement,
79
- menuItems: menuItems,
80
- style: { minInlineSize: menuWidth },
81
- onShow: React.useCallback(() => setIsMenuOpen(true), []),
82
- onHide: React.useCallback(() => setIsMenuOpen(false), []),
91
+ styleType: styleType,
92
+ size: size,
93
+ disabled: props.disabled,
94
+ 'aria-labelledby': props.labelProps?.id || labelId,
95
+ 'aria-expanded': popover.open,
96
+ ref: popover.refs.setReference,
97
+ ...popover.getReferenceProps(menuButtonProps),
83
98
  },
99
+ visible
100
+ ? React.createElement(index_js_3.SvgCaretUpSmall, null)
101
+ : React.createElement(index_js_3.SvgCaretDownSmall, null),
102
+ ),
103
+ popover.open &&
84
104
  React.createElement(
85
- index_js_2.IconButton,
86
- {
87
- styleType: styleType,
88
- size: size,
89
- disabled: props.disabled,
90
- ...menuButtonProps,
91
- },
92
- isMenuOpen
93
- ? React.createElement(index_js_4.SvgCaretUpSmall, null)
94
- : React.createElement(index_js_4.SvgCaretDownSmall, null),
105
+ index_js_3.Portal,
106
+ { portal: portal },
107
+ React.createElement(
108
+ Menu_js_1.Menu,
109
+ {
110
+ ...popover.getFloatingProps({
111
+ onKeyDown: ({ key }) => {
112
+ if (key === 'Tab') {
113
+ close();
114
+ }
115
+ },
116
+ }),
117
+ ref: popover.refs.setFloating,
118
+ },
119
+ menuContent,
120
+ ),
95
121
  ),
96
- ),
97
122
  );
98
123
  });
99
124
  exports.default = exports.SplitButton;