@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/cjs/styles.js CHANGED
@@ -34,8 +34,9 @@ const styles = {
34
34
  'iui-button-dropdown': '_iui3-button-dropdown',
35
35
  'iui-button-split': '_iui3-button-split',
36
36
  'iui-button-group': '_iui3-button-group',
37
- 'iui-input-container': '_iui3-input-container',
37
+ 'iui-input-flex-container': '_iui3-input-flex-container',
38
38
  'iui-input': '_iui3-input',
39
+ 'iui-input-grid': '_iui3-input-grid',
39
40
  'iui-disabled': '_iui3-disabled',
40
41
  'iui-button-group-vertical': '_iui3-button-group-vertical',
41
42
  'iui-button-group-overflow-x': '_iui3-button-group-overflow-x',
@@ -178,36 +179,18 @@ const styles = {
178
179
  'iui-information-body-content': '_iui3-information-body-content',
179
180
  'iui-input-label': '_iui3-input-label',
180
181
  'iui-inline': '_iui3-inline',
181
- 'iui-required': '_iui3-required',
182
182
  'iui-input-with-icon': '_iui3-input-with-icon',
183
183
  'iui-select-tag-container': '_iui3-select-tag-container',
184
184
  'iui-end-icon': '_iui3-end-icon',
185
- 'iui-actionable': '_iui3-actionable',
186
185
  'iui-open': '_iui3-open',
187
- 'iui-inline-icon': '_iui3-inline-icon',
188
- 'iui-with-message': '_iui3-with-message',
189
- 'iui-input-icon': '_iui3-input-icon',
186
+ 'iui-required': '_iui3-required',
190
187
  'iui-input-group': '_iui3-input-group',
188
+ 'iui-status-message': '_iui3-status-message',
189
+ 'iui-select-button': '_iui3-select-button',
190
+ 'iui-input-group-wrapper': '_iui3-input-group-wrapper',
191
191
  'iui-toggle-switch-wrapper': '_iui3-toggle-switch-wrapper',
192
192
  'iui-radio-wrapper': '_iui3-radio-wrapper',
193
- 'iui-inline-label': '_iui3-inline-label',
194
- 'iui-label': '_iui3-label',
195
- 'iui-message': '_iui3-message',
196
- 'iui-select-button': '_iui3-select-button',
197
- 'iui-input-flex-container': '_iui3-input-flex-container',
198
193
  'iui-keyboard': '_iui3-keyboard',
199
- 'iui-location-marker': '_iui3-location-marker',
200
- 'iui-location-marker-default': '_iui3-location-marker-default',
201
- 'iui-location-marker-default-pin': '_iui3-location-marker-default-pin',
202
- 'iui-location-marker-default-pin-dot':
203
- '_iui3-location-marker-default-pin-dot',
204
- 'iui-location-marker-data-rich': '_iui3-location-marker-data-rich',
205
- 'iui-location-marker-data-rich-body': '_iui3-location-marker-data-rich-body',
206
- 'iui-location-marker-data-rich-icon': '_iui3-location-marker-data-rich-icon',
207
- 'iui-location-marker-data-rich-icon-monochrome':
208
- '_iui3-location-marker-data-rich-icon-monochrome',
209
- 'iui-location-marker-me': '_iui3-location-marker-me',
210
- 'iui-location-marker-me-dot': '_iui3-location-marker-me-dot',
211
194
  'iui-list': '_iui3-list',
212
195
  'iui-menu': '_iui3-menu',
213
196
  'iui-header-menu-icon': '_iui3-header-menu-icon',
@@ -236,10 +219,10 @@ const styles = {
236
219
  'iui-overlay-exiting': '_iui3-overlay-exiting',
237
220
  closeAnimation,
238
221
  'iui-progress-indicator-radial': '_iui3-progress-indicator-radial',
239
- 'iui-u8bwhh6': '_iui3-u8bwhh6',
222
+ 'iui-ugj3ux4': '_iui3-ugj3ux4',
240
223
  'iui-progress-indicator-linear-label':
241
224
  '_iui3-progress-indicator-linear-label',
242
- 'iui-u8bwhhv': '_iui3-u8bwhhv',
225
+ 'iui-ugj3uxq': '_iui3-ugj3uxq',
243
226
  'iui-radio': '_iui3-radio',
244
227
  'iui-radio-tile': '_iui3-radio-tile',
245
228
  'iui-radio-tile-icon': '_iui3-radio-tile-icon',
@@ -306,6 +289,7 @@ const styles = {
306
289
  'iui-table-body': '_iui3-table-body',
307
290
  'iui-table-header-wrapper': '_iui3-table-header-wrapper',
308
291
  'iui-slot': '_iui3-slot',
292
+ 'iui-actionable': '_iui3-actionable',
309
293
  'iui-table-filter-button': '_iui3-table-filter-button',
310
294
  'iui-table-resizer': '_iui3-table-resizer',
311
295
  'iui-table-resizer-bar': '_iui3-table-resizer-bar',
@@ -402,6 +386,7 @@ const styles = {
402
386
  'iui-placement-bottom-start': '_iui3-placement-bottom-start',
403
387
  'iui-placement-bottom-end': '_iui3-placement-bottom-end',
404
388
  'iui-status-area': '_iui3-status-area',
389
+ 'iui-message': '_iui3-message',
405
390
  'iui-toast-anchor': '_iui3-toast-anchor',
406
391
  'iui-informational': '_iui3-informational',
407
392
  'iui-label-on-left': '_iui3-label-on-left',
@@ -409,11 +394,8 @@ const styles = {
409
394
  'iui-toggle-switch-icon': '_iui3-toggle-switch-icon',
410
395
  'iui-toggle-switch': '_iui3-toggle-switch',
411
396
  'iui-toggle-switch-label': '_iui3-toggle-switch-label',
412
- 'iui-tooltip-container': '_iui3-tooltip-container',
413
397
  'iui-tooltip': '_iui3-tooltip',
414
- 'iui-tooltip-visible': '_iui3-tooltip-visible',
415
398
  'iui-transfer-list-wrapper': '_iui3-transfer-list-wrapper',
416
- 'iui-transfer-list-listbox-label': '_iui3-transfer-list-listbox-label',
417
399
  'iui-transfer-list-listbox-wrapper': '_iui3-transfer-list-listbox-wrapper',
418
400
  'iui-transfer-list-listbox': '_iui3-transfer-list-listbox',
419
401
  'iui-transfer-list-toolbar': '_iui3-transfer-list-toolbar',
@@ -435,9 +417,6 @@ const styles = {
435
417
  'iui-svg-icon': '_iui3-svg-icon',
436
418
  'iui-notification-marker': '_iui3-notification-marker',
437
419
  pulse,
438
- 'iui-popover': '_iui3-popover',
439
- 'tippy-box': '_iui3-tippy-box',
440
- 'tippy-content': '_iui3-tippy-content',
441
420
  'iui-divider': '_iui3-divider',
442
421
  'iui-flex': '_iui3-flex',
443
422
  'iui-flex-spacer': '_iui3-flex-spacer',
@@ -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,10 +11,47 @@ import {
11
11
  StatusIconMap,
12
12
  SvgCloseSmall,
13
13
  Box,
14
+ ButtonBase,
14
15
  } from '../utils/index.js';
15
16
  import { IconButton } from '../Buttons/index.js';
16
17
  const AlertContext = React.createContext(undefined);
17
- const AlertComponent = React.forwardRef((props, ref) => {
18
+ // ----------------------------------------------------------------------------
19
+ // Alert component
20
+ const AlertComponent = React.forwardRef((props, forwardedRef) => {
21
+ const {
22
+ children,
23
+ type = 'informational',
24
+ isSticky = false,
25
+ clickableText,
26
+ clickableTextProps,
27
+ onClose,
28
+ ...rest
29
+ } = props;
30
+ return React.createElement(
31
+ Alert.Wrapper,
32
+ { type: type, isSticky: isSticky, ref: forwardedRef, ...rest },
33
+ React.createElement(Alert.Icon, null),
34
+ React.createElement(
35
+ Alert.Message,
36
+ null,
37
+ children,
38
+ clickableText
39
+ ? React.createElement(
40
+ Alert.Action,
41
+ { ...clickableTextProps },
42
+ clickableText,
43
+ )
44
+ : null,
45
+ ),
46
+ onClose
47
+ ? React.createElement(Alert.CloseButton, { onClick: onClose })
48
+ : null,
49
+ );
50
+ });
51
+ AlertComponent.displayName = 'Alert';
52
+ // ----------------------------------------------------------------------------
53
+ // Alert.Wrapper component
54
+ const AlertWrapper = React.forwardRef((props, ref) => {
18
55
  const {
19
56
  children,
20
57
  className,
@@ -34,7 +71,7 @@ const AlertComponent = React.forwardRef((props, ref) => {
34
71
  React.createElement(AlertContext.Provider, { value: { type } }, children),
35
72
  );
36
73
  });
37
- AlertComponent.displayName = 'Alert';
74
+ AlertWrapper.displayName = 'Alert.Wrapper';
38
75
  // ----------------------------------------------------------------------------
39
76
  // Alert.Icon component
40
77
  const AlertIcon = React.forwardRef((props, ref) => {
@@ -57,7 +94,7 @@ AlertMessage.displayName = 'Alert.Message';
57
94
  const AlertAction = React.forwardRef((props, ref) => {
58
95
  const { children, className, ...rest } = props;
59
96
  return React.createElement(
60
- Box,
97
+ ButtonBase,
61
98
  {
62
99
  as: !!props.href ? 'a' : 'button',
63
100
  className: cx('iui-alert-link', className),
@@ -88,17 +125,15 @@ AlertCloseButton.displayName = 'Alert.CloseButton';
88
125
  /**
89
126
  * A small box to quickly grab user attention and communicate a brief message
90
127
  * @example
91
- * <Alert>
92
- * <Alert.Message>This is an alert.</Alert.Message>
93
- * </Alert>
128
+ * <Alert>This is an alert.</Alert>
94
129
  * @example
95
- * <Alert type='informational'>
130
+ * <Alert.Wrapper type='informational'>
96
131
  * <Alert.Icon />
97
132
  * <Alert.Message>This is an informational alert.</Alert.Message>
98
133
  * <Alert.CloseButton onClick={() => {}} />
99
- * </Alert>
134
+ * </Alert.Wrapper>
100
135
  * @example
101
- * <Alert type='positive'>
136
+ * <Alert.Wrapper type='positive'>
102
137
  * <Alert.Icon>
103
138
  * <SvgSmileyHappy />
104
139
  * </Alert.Icon>
@@ -109,9 +144,13 @@ AlertCloseButton.displayName = 'Alert.CloseButton';
109
144
  * <Alert.CloseButton onClick={() => {}}>
110
145
  * <SvgCollapse />
111
146
  * </Alert.CloseButton>
112
- * </Alert>
147
+ * </Alert.Wrapper>
113
148
  */
114
149
  export const Alert = Object.assign(AlertComponent, {
150
+ /**
151
+ * Alert wrapper subcomponent
152
+ */
153
+ Wrapper: AlertWrapper,
115
154
  /**
116
155
  * Alert icon subcomponent
117
156
  */
@@ -5,6 +5,7 @@
5
5
  import * as React from 'react';
6
6
  import cx from 'classnames';
7
7
  import { useOverflow, useMergedRefs, Box } from '../utils/index.js';
8
+ import { FloatingDelayGroup } from '@floating-ui/react';
8
9
  /**
9
10
  * Group buttons together for common actions.
10
11
  * Handles responsive overflow when the `overflowButton` prop is specified.
@@ -56,42 +57,46 @@ export const ButtonGroup = React.forwardRef((props, ref) => {
56
57
  );
57
58
  const refs = useMergedRefs(overflowRef, ref);
58
59
  return React.createElement(
59
- Box,
60
- {
61
- className: cx(
62
- {
63
- 'iui-button-group': orientation === 'horizontal',
64
- 'iui-button-group-vertical': orientation === 'vertical',
65
- 'iui-button-group-overflow-x':
66
- !!overflowButton && orientation === 'horizontal',
67
- },
68
- className,
69
- ),
70
- ref: refs,
71
- ...rest,
72
- },
73
- (() => {
74
- if (!(visibleCount < items.length)) {
75
- return items;
76
- }
77
- const overflowStart =
78
- overflowPlacement === 'start'
79
- ? items.length - visibleCount
80
- : visibleCount - 1;
81
- return React.createElement(
82
- React.Fragment,
83
- null,
84
- overflowButton &&
85
- overflowPlacement === 'start' &&
86
- React.createElement('div', null, overflowButton(overflowStart)),
87
- overflowPlacement === 'start'
88
- ? items.slice(overflowStart + 1)
89
- : items.slice(0, Math.max(0, overflowStart)),
90
- overflowButton &&
91
- overflowPlacement === 'end' &&
92
- React.createElement('div', null, overflowButton(overflowStart)),
93
- );
94
- })(),
60
+ FloatingDelayGroup,
61
+ { delay: { open: 50, close: 250 } },
62
+ React.createElement(
63
+ Box,
64
+ {
65
+ className: cx(
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
+ })(),
99
+ ),
95
100
  );
96
101
  });
97
102
  export default ButtonGroup;
@@ -6,11 +6,7 @@ import * as React from 'react';
6
6
  import cx from 'classnames';
7
7
  import { Button } from '../Button/index.js';
8
8
  import { DropdownMenu } from '../../DropdownMenu/index.js';
9
- import {
10
- SvgCaretDownSmall,
11
- SvgCaretUpSmall,
12
- useMergedRefs,
13
- } from '../../utils/index.js';
9
+ import { SvgCaretDownSmall, SvgCaretUpSmall } from '../../utils/index.js';
14
10
  /**
15
11
  * Button that opens a DropdownMenu.
16
12
  * @example
@@ -20,7 +16,7 @@ import {
20
16
  * ];
21
17
  * <DropdownButton menuItems={menuItems}>Default</DropdownButton>
22
18
  */
23
- export const DropdownButton = React.forwardRef((props, ref) => {
19
+ export const DropdownButton = React.forwardRef((props, forwardedRef) => {
24
20
  const {
25
21
  menuItems,
26
22
  className,
@@ -31,28 +27,17 @@ export const DropdownButton = React.forwardRef((props, ref) => {
31
27
  ...rest
32
28
  } = props;
33
29
  const [isMenuOpen, setIsMenuOpen] = React.useState(false);
34
- const [menuWidth, setMenuWidth] = React.useState(0);
35
- const buttonRef = React.useRef(null);
36
- const refs = useMergedRefs(ref, buttonRef);
37
- React.useEffect(() => {
38
- if (buttonRef.current) {
39
- setMenuWidth(buttonRef.current.offsetWidth);
40
- }
41
- }, [children, size, styleType]);
42
30
  return React.createElement(
43
31
  DropdownMenu,
44
32
  {
45
33
  menuItems: menuItems,
34
+ matchWidth: true,
35
+ visible: isMenuOpen,
46
36
  ...dropdownMenuProps,
47
- onShow: (i) => {
48
- setIsMenuOpen(true);
49
- dropdownMenuProps?.onShow?.(i);
37
+ onVisibleChange: (open) => {
38
+ setIsMenuOpen(open);
39
+ dropdownMenuProps?.onVisibleChange?.(open);
50
40
  },
51
- onHide: (i) => {
52
- setIsMenuOpen(false);
53
- dropdownMenuProps?.onHide?.(i);
54
- },
55
- style: { minInlineSize: menuWidth, ...dropdownMenuProps?.style },
56
41
  },
57
42
  React.createElement(
58
43
  Button,
@@ -63,8 +48,7 @@ export const DropdownButton = React.forwardRef((props, ref) => {
63
48
  endIcon: isMenuOpen
64
49
  ? React.createElement(SvgCaretUpSmall, { 'aria-hidden': true })
65
50
  : React.createElement(SvgCaretDownSmall, { 'aria-hidden': true }),
66
- ref: refs,
67
- 'aria-label': 'Dropdown',
51
+ ref: forwardedRef,
68
52
  ...rest,
69
53
  },
70
54
  children,
@@ -4,7 +4,8 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import cx from 'classnames';
6
6
  import * as React from 'react';
7
- import { VisuallyHidden, Popover, Box, ButtonBase } from '../../utils/index.js';
7
+ import { VisuallyHidden, Box, ButtonBase } from '../../utils/index.js';
8
+ import { Tooltip } from '../../Tooltip/Tooltip.js';
8
9
  /**
9
10
  * Icon button
10
11
  * @example
@@ -23,51 +24,35 @@ export const IconButton = React.forwardRef((props, ref) => {
23
24
  iconProps,
24
25
  ...rest
25
26
  } = props;
26
- return React.createElement(
27
- IconButtonTooltip,
28
- { label: label },
27
+ const button = React.createElement(
28
+ ButtonBase,
29
+ {
30
+ ref: ref,
31
+ className: cx('iui-button', className),
32
+ 'data-iui-variant': styleType !== 'default' ? styleType : undefined,
33
+ 'data-iui-size': size,
34
+ 'data-iui-active': isActive,
35
+ 'aria-pressed': isActive,
36
+ ...rest,
37
+ },
29
38
  React.createElement(
30
- ButtonBase,
39
+ Box,
31
40
  {
32
- ref: ref,
33
- className: cx('iui-button', className),
34
- 'data-iui-variant': styleType !== 'default' ? styleType : undefined,
35
- 'data-iui-size': size,
36
- 'data-iui-active': isActive,
37
- 'aria-pressed': isActive,
38
- ...rest,
41
+ as: 'span',
42
+ 'aria-hidden': true,
43
+ ...iconProps,
44
+ className: cx('iui-button-icon', iconProps?.className),
39
45
  },
40
- React.createElement(
41
- Box,
42
- {
43
- as: 'span',
44
- 'aria-hidden': true,
45
- ...iconProps,
46
- className: cx('iui-button-icon', iconProps?.className),
47
- },
48
- children,
49
- ),
50
- label ? React.createElement(VisuallyHidden, null, label) : null,
46
+ children,
51
47
  ),
48
+ label ? React.createElement(VisuallyHidden, null, label) : null,
52
49
  );
53
- });
54
- const IconButtonTooltip = (props) => {
55
- const { label, children } = props;
56
50
  return label
57
51
  ? React.createElement(
58
- Popover,
59
- {
60
- interactive: false,
61
- offset: [0, 4],
62
- aria: { content: null },
63
- content: React.createElement(
64
- Box,
65
- { 'aria-hidden': 'true', className: 'iui-tooltip' },
66
- label,
67
- ),
68
- },
69
- children,
52
+ Tooltip,
53
+ { content: label, ariaStrategy: 'none' },
54
+ button,
70
55
  )
71
- : children;
72
- };
56
+ : button;
57
+ });
73
58
  export default 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
  *
@@ -6,8 +6,16 @@ import cx from 'classnames';
6
6
  import * as React from 'react';
7
7
  import { Button } from '../Button/index.js';
8
8
  import { IconButton } from '../IconButton/index.js';
9
- import { DropdownMenu } from '../../DropdownMenu/index.js';
10
- import { Box, SvgCaretDownSmall, SvgCaretUpSmall } from '../../utils/index.js';
9
+ import {
10
+ Box,
11
+ Portal,
12
+ SvgCaretDownSmall,
13
+ SvgCaretUpSmall,
14
+ useId,
15
+ useMergedRefs,
16
+ usePopover,
17
+ } from '../../utils/index.js';
18
+ import { Menu } from '../../Menu/Menu.js';
11
19
  /**
12
20
  * Split button component with a DropdownMenu.
13
21
  *
@@ -33,20 +41,33 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
33
41
  children,
34
42
  wrapperProps,
35
43
  menuButtonProps,
44
+ portal = true,
36
45
  ...rest
37
46
  } = props;
38
- const [isMenuOpen, setIsMenuOpen] = React.useState(false);
39
- const [menuWidth, setMenuWidth] = React.useState(0);
40
- const wrapperRef = React.useRef(null);
41
- React.useEffect(() => {
42
- if (wrapperRef.current) {
43
- setMenuWidth(wrapperRef.current.offsetWidth);
47
+ const buttonRef = React.useRef(null);
48
+ const [visible, setVisible] = React.useState(false);
49
+ const close = React.useCallback(() => {
50
+ setVisible(false);
51
+ buttonRef.current?.focus({ preventScroll: true });
52
+ }, []);
53
+ const menuContent = React.useMemo(() => {
54
+ if (typeof menuItems === 'function') {
55
+ return menuItems(close);
44
56
  }
45
- }, [children, size]);
57
+ return menuItems;
58
+ }, [menuItems, close]);
59
+ const popover = usePopover({
60
+ visible,
61
+ onVisibleChange: (open) => (open ? setVisible(true) : close()),
62
+ placement: menuPlacement,
63
+ matchWidth: true,
64
+ });
65
+ const labelId = useId();
46
66
  return React.createElement(
47
67
  Box,
48
68
  {
49
69
  ...wrapperProps,
70
+ ref: popover.refs.setPositionReference,
50
71
  className: cx(
51
72
  'iui-button-split',
52
73
  {
@@ -54,7 +75,6 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
54
75
  },
55
76
  wrapperProps?.className,
56
77
  ),
57
- ref: wrapperRef,
58
78
  },
59
79
  React.createElement(
60
80
  Button,
@@ -63,33 +83,46 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
63
83
  styleType: styleType,
64
84
  size: size,
65
85
  onClick: onClick,
66
- ref: forwardedRef,
86
+ ref: useMergedRefs(buttonRef, forwardedRef),
67
87
  ...rest,
88
+ labelProps: { id: labelId, ...props.labelProps },
68
89
  },
69
90
  children,
70
91
  ),
71
92
  React.createElement(
72
- DropdownMenu,
93
+ IconButton,
73
94
  {
74
- placement: menuPlacement,
75
- menuItems: menuItems,
76
- style: { minInlineSize: menuWidth },
77
- onShow: React.useCallback(() => setIsMenuOpen(true), []),
78
- onHide: React.useCallback(() => setIsMenuOpen(false), []),
95
+ styleType: styleType,
96
+ size: size,
97
+ disabled: props.disabled,
98
+ 'aria-labelledby': props.labelProps?.id || labelId,
99
+ 'aria-expanded': popover.open,
100
+ ref: popover.refs.setReference,
101
+ ...popover.getReferenceProps(menuButtonProps),
79
102
  },
103
+ visible
104
+ ? React.createElement(SvgCaretUpSmall, null)
105
+ : React.createElement(SvgCaretDownSmall, null),
106
+ ),
107
+ popover.open &&
80
108
  React.createElement(
81
- IconButton,
82
- {
83
- styleType: styleType,
84
- size: size,
85
- disabled: props.disabled,
86
- ...menuButtonProps,
87
- },
88
- isMenuOpen
89
- ? React.createElement(SvgCaretUpSmall, null)
90
- : React.createElement(SvgCaretDownSmall, null),
109
+ Portal,
110
+ { portal: portal },
111
+ React.createElement(
112
+ Menu,
113
+ {
114
+ ...popover.getFloatingProps({
115
+ onKeyDown: ({ key }) => {
116
+ if (key === 'Tab') {
117
+ close();
118
+ }
119
+ },
120
+ }),
121
+ ref: popover.refs.setFloating,
122
+ },
123
+ menuContent,
124
+ ),
91
125
  ),
92
- ),
93
126
  );
94
127
  });
95
128
  export default SplitButton;