@itwin/itwinui-react 3.0.0-dev.6 → 3.0.0-dev.8

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 (283) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/cjs/core/Alert/Alert.d.ts +20 -9
  3. package/cjs/core/Alert/Alert.js +48 -10
  4. package/cjs/core/Avatar/Avatar.d.ts +3 -2
  5. package/cjs/core/Avatar/Avatar.js +21 -19
  6. package/cjs/core/AvatarGroup/AvatarGroup.js +3 -8
  7. package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
  8. package/cjs/core/Buttons/Button/Button.d.ts +15 -2
  9. package/cjs/core/Buttons/Button/Button.js +23 -9
  10. package/cjs/core/Buttons/DropdownButton/DropdownButton.js +1 -1
  11. package/cjs/core/Buttons/IconButton/IconButton.d.ts +5 -1
  12. package/cjs/core/Buttons/IconButton/IconButton.js +27 -38
  13. package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
  14. package/cjs/core/Buttons/SplitButton/SplitButton.js +25 -13
  15. package/cjs/core/Carousel/Carousel.d.ts +6 -4
  16. package/cjs/core/Carousel/Carousel.js +2 -2
  17. package/cjs/core/Carousel/CarouselDot.js +1 -3
  18. package/cjs/core/Carousel/CarouselNavigation.d.ts +6 -4
  19. package/cjs/core/ColorPicker/ColorBuilder.js +2 -1
  20. package/cjs/core/ColorPicker/ColorInputPanel.js +172 -231
  21. package/cjs/core/ComboBox/ComboBox.js +3 -3
  22. package/cjs/core/ComboBox/ComboBoxDropdown.js +4 -9
  23. package/cjs/core/ComboBox/ComboBoxEndIcon.js +3 -22
  24. package/cjs/core/ComboBox/ComboBoxInput.js +1 -1
  25. package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
  26. package/cjs/core/ComboBox/ComboBoxMenu.js +5 -5
  27. package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
  28. package/cjs/core/ComboBox/ComboBoxMenuItem.js +8 -6
  29. package/cjs/core/ComboBox/helpers.d.ts +1 -2
  30. package/cjs/core/DatePicker/DatePicker.d.ts +30 -8
  31. package/cjs/core/DatePicker/DatePicker.js +47 -6
  32. package/cjs/core/Dialog/Dialog.js +10 -17
  33. package/cjs/core/Dialog/DialogContext.d.ts +3 -4
  34. package/cjs/core/Dialog/DialogMain.js +5 -5
  35. package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
  36. package/cjs/core/ExpandableBlock/ExpandableBlock.js +39 -18
  37. package/cjs/core/FileUpload/FileUpload.d.ts +4 -0
  38. package/cjs/core/FileUpload/FileUpload.js +24 -3
  39. package/cjs/core/Header/HeaderBasicButton.js +3 -16
  40. package/cjs/core/Header/HeaderDropdownButton.js +1 -1
  41. package/cjs/core/Header/HeaderSplitButton.js +3 -4
  42. package/cjs/core/Input/Input.d.ts +4 -0
  43. package/cjs/core/Input/Input.js +2 -1
  44. package/cjs/core/InputGrid/InputGrid.d.ts +25 -0
  45. package/cjs/core/InputGrid/InputGrid.js +39 -0
  46. package/cjs/core/InputGrid/index.d.ts +3 -0
  47. package/cjs/core/InputGrid/index.js +15 -0
  48. package/cjs/core/InputGroup/InputGroup.d.ts +13 -0
  49. package/cjs/core/InputGroup/InputGroup.js +35 -9
  50. package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
  51. package/cjs/core/InputWithDecorations/InputWithDecorations.js +81 -0
  52. package/cjs/core/InputWithDecorations/index.d.ts +3 -0
  53. package/cjs/core/InputWithDecorations/index.js +15 -0
  54. package/cjs/core/Label/Label.d.ts +5 -0
  55. package/cjs/core/Label/Label.js +2 -0
  56. package/cjs/core/LabeledInput/LabeledInput.d.ts +22 -16
  57. package/cjs/core/LabeledInput/LabeledInput.js +52 -29
  58. package/cjs/core/LabeledSelect/LabeledSelect.d.ts +17 -7
  59. package/cjs/core/LabeledSelect/LabeledSelect.js +36 -17
  60. package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
  61. package/cjs/core/LabeledTextarea/LabeledTextarea.js +12 -45
  62. package/cjs/core/Menu/Menu.d.ts +1 -1
  63. package/cjs/core/Menu/Menu.js +1 -1
  64. package/cjs/core/Menu/MenuDivider.d.ts +2 -1
  65. package/cjs/core/Menu/MenuDivider.js +1 -1
  66. package/cjs/core/Menu/MenuItem.d.ts +1 -1
  67. package/cjs/core/Menu/MenuItem.js +1 -0
  68. package/cjs/core/Menu/MenuItemSkeleton.d.ts +1 -1
  69. package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
  70. package/cjs/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
  71. package/cjs/core/ProgressIndicators/ProgressLinear.js +9 -1
  72. package/cjs/core/SearchBox/SearchBox.js +1 -1
  73. package/cjs/core/Select/Select.d.ts +4 -0
  74. package/cjs/core/Select/Select.js +12 -11
  75. package/cjs/core/SideNavigation/SideNavigation.d.ts +16 -0
  76. package/cjs/core/SideNavigation/SideNavigation.js +42 -9
  77. package/cjs/core/Slider/Slider.d.ts +24 -0
  78. package/cjs/core/Slider/Slider.js +58 -10
  79. package/cjs/core/Slider/Thumb.js +3 -2
  80. package/cjs/core/Slider/Track.d.ts +1 -1
  81. package/cjs/core/Slider/Track.js +17 -6
  82. package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
  83. package/cjs/core/StatusMessage/StatusMessage.js +23 -9
  84. package/cjs/core/Stepper/Stepper.d.ts +26 -1
  85. package/cjs/core/Stepper/Stepper.js +35 -6
  86. package/cjs/core/Stepper/StepperStep.d.ts +17 -0
  87. package/cjs/core/Stepper/StepperStep.js +33 -8
  88. package/cjs/core/Stepper/WorkflowDiagram.d.ts +11 -1
  89. package/cjs/core/Stepper/WorkflowDiagram.js +23 -10
  90. package/cjs/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
  91. package/cjs/core/Stepper/WorkflowDiagramStep.js +9 -2
  92. package/cjs/core/Table/SubRowExpander.js +3 -1
  93. package/cjs/core/Table/Table.js +0 -1
  94. package/cjs/core/Table/TableCell.js +1 -1
  95. package/cjs/core/Table/TablePaginator.js +1 -3
  96. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
  97. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +46 -18
  98. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
  99. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
  100. package/cjs/core/Tabs/Tab.js +1 -2
  101. package/cjs/core/Textarea/Textarea.d.ts +7 -1
  102. package/cjs/core/Textarea/Textarea.js +6 -11
  103. package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
  104. package/cjs/core/ThemeProvider/ThemeProvider.d.ts +23 -3
  105. package/cjs/core/ThemeProvider/ThemeProvider.js +56 -23
  106. package/cjs/core/Tile/Tile.d.ts +142 -17
  107. package/cjs/core/Tile/Tile.js +107 -16
  108. package/cjs/core/Toast/Toast.d.ts +12 -4
  109. package/cjs/core/Toast/Toast.js +24 -13
  110. package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
  111. package/cjs/core/Tooltip/Tooltip.js +116 -118
  112. package/cjs/core/TransferList/TransferList.js +4 -12
  113. package/cjs/core/Tree/TreeNode.js +1 -1
  114. package/cjs/core/index.d.ts +2 -0
  115. package/cjs/core/index.js +20 -4
  116. package/cjs/core/utils/components/ButtonBase.d.ts +14 -0
  117. package/cjs/core/utils/components/ButtonBase.js +46 -0
  118. package/cjs/core/utils/components/Icon.d.ts +5 -0
  119. package/cjs/core/utils/components/Icon.js +8 -1
  120. package/cjs/core/utils/components/InputContainer.d.ts +0 -1
  121. package/cjs/core/utils/components/InputContainer.js +14 -34
  122. package/cjs/core/utils/components/InputFlexContainer.d.ts +1 -0
  123. package/cjs/core/utils/components/InputFlexContainer.js +3 -1
  124. package/cjs/core/utils/components/Popover.js +5 -3
  125. package/cjs/core/utils/components/Portal.d.ts +27 -0
  126. package/cjs/core/utils/components/Portal.js +43 -0
  127. package/cjs/core/utils/components/VirtualScroll.js +4 -4
  128. package/cjs/core/utils/components/index.d.ts +2 -0
  129. package/cjs/core/utils/components/index.js +2 -0
  130. package/cjs/core/utils/functions/colors.d.ts +1 -1
  131. package/cjs/core/utils/functions/colors.js +1 -13
  132. package/cjs/core/utils/functions/index.d.ts +1 -0
  133. package/cjs/core/utils/functions/index.js +1 -0
  134. package/cjs/core/utils/functions/react.d.ts +8 -0
  135. package/cjs/core/utils/functions/react.js +40 -0
  136. package/cjs/core/utils/hooks/index.d.ts +1 -0
  137. package/cjs/core/utils/hooks/index.js +1 -0
  138. package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
  139. package/cjs/core/utils/hooks/useControlledState.js +39 -0
  140. package/cjs/core/utils/hooks/useGlobals.d.ts +1 -1
  141. package/cjs/styles.js +11 -35
  142. package/esm/core/Alert/Alert.d.ts +20 -9
  143. package/esm/core/Alert/Alert.js +49 -10
  144. package/esm/core/Avatar/Avatar.d.ts +3 -2
  145. package/esm/core/Avatar/Avatar.js +21 -17
  146. package/esm/core/AvatarGroup/AvatarGroup.js +3 -8
  147. package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
  148. package/esm/core/Buttons/Button/Button.d.ts +15 -2
  149. package/esm/core/Buttons/Button/Button.js +18 -10
  150. package/esm/core/Buttons/DropdownButton/DropdownButton.js +1 -1
  151. package/esm/core/Buttons/IconButton/IconButton.d.ts +5 -1
  152. package/esm/core/Buttons/IconButton/IconButton.js +25 -37
  153. package/esm/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
  154. package/esm/core/Buttons/SplitButton/SplitButton.js +31 -14
  155. package/esm/core/Carousel/Carousel.d.ts +6 -4
  156. package/esm/core/Carousel/Carousel.js +8 -3
  157. package/esm/core/Carousel/CarouselDot.js +2 -4
  158. package/esm/core/Carousel/CarouselNavigation.d.ts +6 -4
  159. package/esm/core/ColorPicker/ColorBuilder.js +2 -1
  160. package/esm/core/ColorPicker/ColorInputPanel.js +173 -232
  161. package/esm/core/ComboBox/ComboBox.js +3 -3
  162. package/esm/core/ComboBox/ComboBoxDropdown.js +4 -9
  163. package/esm/core/ComboBox/ComboBoxEndIcon.js +4 -25
  164. package/esm/core/ComboBox/ComboBoxInput.js +1 -1
  165. package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
  166. package/esm/core/ComboBox/ComboBoxMenu.js +5 -5
  167. package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
  168. package/esm/core/ComboBox/ComboBoxMenuItem.js +9 -7
  169. package/esm/core/ComboBox/helpers.d.ts +1 -2
  170. package/esm/core/DatePicker/DatePicker.d.ts +30 -8
  171. package/esm/core/DatePicker/DatePicker.js +33 -6
  172. package/esm/core/Dialog/Dialog.js +11 -23
  173. package/esm/core/Dialog/DialogContext.d.ts +3 -4
  174. package/esm/core/Dialog/DialogMain.js +5 -5
  175. package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
  176. package/esm/core/ExpandableBlock/ExpandableBlock.js +41 -20
  177. package/esm/core/FileUpload/FileUpload.d.ts +4 -0
  178. package/esm/core/FileUpload/FileUpload.js +26 -3
  179. package/esm/core/Header/HeaderBasicButton.js +4 -17
  180. package/esm/core/Header/HeaderDropdownButton.js +1 -1
  181. package/esm/core/Header/HeaderSplitButton.js +9 -5
  182. package/esm/core/Input/Input.d.ts +4 -0
  183. package/esm/core/Input/Input.js +2 -1
  184. package/esm/core/InputGrid/InputGrid.d.ts +25 -0
  185. package/esm/core/InputGrid/InputGrid.js +35 -0
  186. package/esm/core/InputGrid/index.d.ts +3 -0
  187. package/esm/core/InputGrid/index.js +6 -0
  188. package/esm/core/InputGroup/InputGroup.d.ts +13 -0
  189. package/esm/core/InputGroup/InputGroup.js +34 -10
  190. package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
  191. package/esm/core/InputWithDecorations/InputWithDecorations.js +80 -0
  192. package/esm/core/InputWithDecorations/index.d.ts +3 -0
  193. package/esm/core/InputWithDecorations/index.js +6 -0
  194. package/esm/core/Label/Label.d.ts +5 -0
  195. package/esm/core/Label/Label.js +2 -0
  196. package/esm/core/LabeledInput/LabeledInput.d.ts +22 -16
  197. package/esm/core/LabeledInput/LabeledInput.js +53 -29
  198. package/esm/core/LabeledSelect/LabeledSelect.d.ts +17 -7
  199. package/esm/core/LabeledSelect/LabeledSelect.js +37 -18
  200. package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
  201. package/esm/core/LabeledTextarea/LabeledTextarea.js +14 -45
  202. package/esm/core/Menu/Menu.d.ts +1 -1
  203. package/esm/core/Menu/Menu.js +1 -1
  204. package/esm/core/Menu/MenuDivider.d.ts +2 -1
  205. package/esm/core/Menu/MenuDivider.js +1 -1
  206. package/esm/core/Menu/MenuItem.d.ts +1 -1
  207. package/esm/core/Menu/MenuItem.js +1 -0
  208. package/esm/core/Menu/MenuItemSkeleton.d.ts +1 -1
  209. package/esm/core/Menu/MenuItemSkeleton.js +0 -1
  210. package/esm/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
  211. package/esm/core/ProgressIndicators/ProgressLinear.js +9 -1
  212. package/esm/core/SearchBox/SearchBox.js +1 -1
  213. package/esm/core/Select/Select.d.ts +4 -0
  214. package/esm/core/Select/Select.js +12 -11
  215. package/esm/core/SideNavigation/SideNavigation.d.ts +16 -0
  216. package/esm/core/SideNavigation/SideNavigation.js +33 -9
  217. package/esm/core/Slider/Slider.d.ts +24 -0
  218. package/esm/core/Slider/Slider.js +43 -10
  219. package/esm/core/Slider/Thumb.js +3 -2
  220. package/esm/core/Slider/Track.d.ts +1 -1
  221. package/esm/core/Slider/Track.js +14 -6
  222. package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
  223. package/esm/core/StatusMessage/StatusMessage.js +23 -16
  224. package/esm/core/Stepper/Stepper.d.ts +26 -1
  225. package/esm/core/Stepper/Stepper.js +32 -6
  226. package/esm/core/Stepper/StepperStep.d.ts +17 -0
  227. package/esm/core/Stepper/StepperStep.js +27 -8
  228. package/esm/core/Stepper/WorkflowDiagram.d.ts +11 -1
  229. package/esm/core/Stepper/WorkflowDiagram.js +10 -7
  230. package/esm/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
  231. package/esm/core/Stepper/WorkflowDiagramStep.js +6 -2
  232. package/esm/core/Table/SubRowExpander.js +3 -1
  233. package/esm/core/Table/Table.js +0 -1
  234. package/esm/core/Table/TableCell.js +1 -1
  235. package/esm/core/Table/TablePaginator.js +2 -3
  236. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
  237. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +45 -17
  238. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
  239. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
  240. package/esm/core/Tabs/Tab.js +2 -3
  241. package/esm/core/Textarea/Textarea.d.ts +7 -1
  242. package/esm/core/Textarea/Textarea.js +6 -11
  243. package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
  244. package/esm/core/ThemeProvider/ThemeProvider.d.ts +23 -3
  245. package/esm/core/ThemeProvider/ThemeProvider.js +65 -24
  246. package/esm/core/Tile/Tile.d.ts +142 -17
  247. package/esm/core/Tile/Tile.js +107 -16
  248. package/esm/core/Toast/Toast.d.ts +12 -4
  249. package/esm/core/Toast/Toast.js +26 -13
  250. package/esm/core/Tooltip/Tooltip.d.ts +35 -28
  251. package/esm/core/Tooltip/Tooltip.js +119 -116
  252. package/esm/core/TransferList/TransferList.js +4 -9
  253. package/esm/core/Tree/TreeNode.js +1 -1
  254. package/esm/core/index.d.ts +2 -0
  255. package/esm/core/index.js +2 -0
  256. package/esm/core/utils/components/ButtonBase.d.ts +14 -0
  257. package/esm/core/utils/components/ButtonBase.js +42 -0
  258. package/esm/core/utils/components/Icon.d.ts +5 -0
  259. package/esm/core/utils/components/Icon.js +8 -1
  260. package/esm/core/utils/components/InputContainer.d.ts +0 -1
  261. package/esm/core/utils/components/InputContainer.js +14 -30
  262. package/esm/core/utils/components/InputFlexContainer.d.ts +1 -0
  263. package/esm/core/utils/components/InputFlexContainer.js +3 -1
  264. package/esm/core/utils/components/Popover.js +5 -3
  265. package/esm/core/utils/components/Portal.d.ts +27 -0
  266. package/esm/core/utils/components/Portal.js +36 -0
  267. package/esm/core/utils/components/VirtualScroll.js +4 -4
  268. package/esm/core/utils/components/index.d.ts +2 -0
  269. package/esm/core/utils/components/index.js +2 -0
  270. package/esm/core/utils/functions/colors.d.ts +1 -1
  271. package/esm/core/utils/functions/colors.js +1 -13
  272. package/esm/core/utils/functions/index.d.ts +1 -0
  273. package/esm/core/utils/functions/index.js +1 -0
  274. package/esm/core/utils/functions/react.d.ts +8 -0
  275. package/esm/core/utils/functions/react.js +35 -0
  276. package/esm/core/utils/hooks/index.d.ts +1 -0
  277. package/esm/core/utils/hooks/index.js +1 -0
  278. package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
  279. package/esm/core/utils/hooks/useControlledState.js +34 -0
  280. package/esm/core/utils/hooks/useGlobals.d.ts +1 -1
  281. package/esm/styles.js +11 -35
  282. package/package.json +3 -3
  283. package/styles.css +49 -46
@@ -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;
@@ -1,4 +1,5 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
+ import { ButtonBase } from '../../utils/index.js';
2
3
  import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
3
4
  export type ButtonProps = {
4
5
  /**
@@ -19,7 +20,19 @@ export type ButtonProps = {
19
20
  * Icon shown after the main button content.
20
21
  */
21
22
  endIcon?: JSX.Element;
22
- };
23
+ /**
24
+ * Passes props to the button label.
25
+ */
26
+ labelProps?: React.ComponentProps<'span'>;
27
+ /**
28
+ * Passes props to the start icon.
29
+ */
30
+ startIconProps?: React.ComponentProps<'span'>;
31
+ /**
32
+ * Passes props to the end icon.
33
+ */
34
+ endIconProps?: React.ComponentProps<'span'>;
35
+ } & Pick<React.ComponentProps<typeof ButtonBase>, 'htmlDisabled'>;
23
36
  /**
24
37
  * Generic button component
25
38
  * @example
@@ -4,7 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import cx from 'classnames';
6
6
  import * as React from 'react';
7
- import { Box } from '../../utils/index.js';
7
+ import { Box, ButtonBase } from '../../utils/index.js';
8
8
  /**
9
9
  * Generic button component
10
10
  * @example
@@ -19,36 +19,44 @@ export const Button = React.forwardRef((props, ref) => {
19
19
  children,
20
20
  className,
21
21
  size,
22
- style,
23
22
  styleType = 'default',
24
- type = 'button',
25
23
  startIcon,
26
24
  endIcon,
25
+ labelProps,
26
+ startIconProps,
27
+ endIconProps,
27
28
  ...rest
28
29
  } = props;
29
30
  return React.createElement(
30
- Box,
31
+ ButtonBase,
31
32
  {
32
- as: 'button',
33
33
  ref: ref,
34
34
  className: cx('iui-button', className),
35
35
  'data-iui-variant': styleType !== 'default' ? styleType : undefined,
36
36
  'data-iui-size': size,
37
- style: style,
38
- type: type,
39
37
  ...rest,
40
38
  },
41
39
  startIcon &&
42
40
  React.createElement(
43
41
  Box,
44
- { as: 'span', className: 'iui-button-icon', 'aria-hidden': true },
42
+ {
43
+ as: 'span',
44
+ 'aria-hidden': true,
45
+ ...startIconProps,
46
+ className: cx('iui-button-icon', startIconProps?.className),
47
+ },
45
48
  startIcon,
46
49
  ),
47
- children && React.createElement('span', null, children),
50
+ children && React.createElement('span', { ...labelProps }, children),
48
51
  endIcon &&
49
52
  React.createElement(
50
53
  Box,
51
- { as: 'span', className: 'iui-button-icon', 'aria-hidden': true },
54
+ {
55
+ as: 'span',
56
+ 'aria-hidden': true,
57
+ ...endIconProps,
58
+ className: cx('iui-button-icon', endIconProps?.className),
59
+ },
52
60
  endIcon,
53
61
  ),
54
62
  );
@@ -52,7 +52,7 @@ export const DropdownButton = React.forwardRef((props, ref) => {
52
52
  setIsMenuOpen(false);
53
53
  dropdownMenuProps?.onHide?.(i);
54
54
  },
55
- style: { minWidth: menuWidth, ...dropdownMenuProps?.style },
55
+ style: { minInlineSize: menuWidth, ...dropdownMenuProps?.style },
56
56
  },
57
57
  React.createElement(
58
58
  Button,
@@ -11,7 +11,11 @@ export type IconButtonProps = {
11
11
  * Name of the button, shown in a tooltip and exposed to assistive technologies.
12
12
  */
13
13
  label?: React.ReactNode;
14
- } & Omit<ButtonProps, 'startIcon' | 'endIcon'>;
14
+ /**
15
+ * Passes props to IconButton icon.
16
+ */
17
+ iconProps?: React.ComponentProps<'span'>;
18
+ } & Omit<ButtonProps, 'startIcon' | 'endIcon' | 'startIconProps' | 'endIconProps' | 'labelProps'>;
15
19
  /**
16
20
  * Icon button
17
21
  * @example
@@ -4,7 +4,8 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import cx from 'classnames';
6
6
  import * as React from 'react';
7
- import { VisuallyHidden, Popover, Box } 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
@@ -18,53 +19,40 @@ export const IconButton = React.forwardRef((props, ref) => {
18
19
  children,
19
20
  styleType = 'default',
20
21
  size,
21
- type = 'button',
22
22
  className,
23
23
  label,
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
39
  Box,
31
40
  {
32
- as: 'button',
33
- ref: ref,
34
- className: cx('iui-button', className),
35
- 'data-iui-variant': styleType !== 'default' ? styleType : undefined,
36
- 'data-iui-size': size,
37
- 'data-iui-active': isActive,
38
- 'aria-pressed': isActive,
39
- type: type,
40
- ...rest,
41
+ as: 'span',
42
+ 'aria-hidden': true,
43
+ ...iconProps,
44
+ className: cx('iui-button-icon', iconProps?.className),
41
45
  },
42
- React.createElement(
43
- Box,
44
- { as: 'span', className: 'iui-button-icon', 'aria-hidden': true },
45
- children,
46
- ),
47
- label ? React.createElement(VisuallyHidden, null, label) : null,
46
+ children,
48
47
  ),
48
+ label ? React.createElement(VisuallyHidden, null, label) : null,
49
49
  );
50
- });
51
- const IconButtonTooltip = (props) => {
52
- const { label, children } = props;
53
50
  return label
54
51
  ? React.createElement(
55
- Popover,
56
- {
57
- interactive: false,
58
- offset: [0, 4],
59
- aria: { content: null },
60
- content: React.createElement(
61
- Box,
62
- { 'aria-hidden': 'true', className: 'iui-tooltip' },
63
- label,
64
- ),
65
- },
66
- children,
52
+ Tooltip,
53
+ { content: label, ariaStrategy: 'none' },
54
+ button,
67
55
  )
68
- : children;
69
- };
56
+ : button;
57
+ });
70
58
  export default IconButton;
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import type { ButtonProps } from '../Button/Button.js';
3
+ import { IconButton } from '../IconButton/index.js';
3
4
  import type { Placement } from 'tippy.js';
4
5
  import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
5
6
  export type SplitButtonProps = ButtonProps & {
@@ -18,6 +19,14 @@ export type SplitButtonProps = ButtonProps & {
18
19
  * Content of primary button.
19
20
  */
20
21
  children: React.ReactNode;
22
+ /**
23
+ * Passes props to SplitButton wrapper.
24
+ */
25
+ wrapperProps?: React.ComponentProps<'div'>;
26
+ /**
27
+ * Passes props to SplitButton menu button.
28
+ */
29
+ menuButtonProps?: React.ComponentProps<typeof IconButton>;
21
30
  };
22
31
  /**
23
32
  * Split button component with a DropdownMenu.
@@ -7,7 +7,12 @@ import * as React from 'react';
7
7
  import { Button } from '../Button/index.js';
8
8
  import { IconButton } from '../IconButton/index.js';
9
9
  import { DropdownMenu } from '../../DropdownMenu/index.js';
10
- import { Box, SvgCaretDownSmall, SvgCaretUpSmall } from '../../utils/index.js';
10
+ import {
11
+ Box,
12
+ SvgCaretDownSmall,
13
+ SvgCaretUpSmall,
14
+ useId,
15
+ } from '../../utils/index.js';
11
16
  /**
12
17
  * Split button component with a DropdownMenu.
13
18
  *
@@ -31,36 +36,42 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
31
36
  styleType = 'default',
32
37
  size,
33
38
  children,
34
- style,
35
- title,
39
+ wrapperProps,
40
+ menuButtonProps,
36
41
  ...rest
37
42
  } = props;
38
43
  const [isMenuOpen, setIsMenuOpen] = React.useState(false);
39
44
  const [menuWidth, setMenuWidth] = React.useState(0);
40
- const ref = React.useRef(null);
45
+ const wrapperRef = React.useRef(null);
41
46
  React.useEffect(() => {
42
- if (ref.current) {
43
- setMenuWidth(ref.current.offsetWidth);
47
+ if (wrapperRef.current) {
48
+ setMenuWidth(wrapperRef.current.offsetWidth);
44
49
  }
45
50
  }, [children, size]);
51
+ const labelId = useId();
46
52
  return React.createElement(
47
53
  Box,
48
54
  {
49
- className: cx(className, 'iui-button-split', {
50
- 'iui-disabled': props.disabled,
51
- }),
52
- style: style,
53
- title: title,
54
- ref: ref,
55
+ ...wrapperProps,
56
+ className: cx(
57
+ 'iui-button-split',
58
+ {
59
+ 'iui-disabled': props.disabled,
60
+ },
61
+ wrapperProps?.className,
62
+ ),
63
+ ref: wrapperRef,
55
64
  },
56
65
  React.createElement(
57
66
  Button,
58
67
  {
68
+ className: className,
59
69
  styleType: styleType,
60
70
  size: size,
61
71
  onClick: onClick,
62
72
  ref: forwardedRef,
63
73
  ...rest,
74
+ labelProps: { id: labelId, ...props.labelProps },
64
75
  },
65
76
  children,
66
77
  ),
@@ -69,13 +80,19 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
69
80
  {
70
81
  placement: menuPlacement,
71
82
  menuItems: menuItems,
72
- style: { minWidth: menuWidth },
83
+ style: { minInlineSize: menuWidth },
73
84
  onShow: React.useCallback(() => setIsMenuOpen(true), []),
74
85
  onHide: React.useCallback(() => setIsMenuOpen(false), []),
75
86
  },
76
87
  React.createElement(
77
88
  IconButton,
78
- { styleType: styleType, size: size, disabled: props.disabled },
89
+ {
90
+ styleType: styleType,
91
+ size: size,
92
+ disabled: props.disabled,
93
+ 'aria-labelledby': props.labelProps?.id || labelId,
94
+ ...menuButtonProps,
95
+ },
79
96
  isMenuOpen
80
97
  ? React.createElement(SvgCaretUpSmall, null)
81
98
  : React.createElement(SvgCaretDownSmall, null),
@@ -38,18 +38,20 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
38
38
  Navigation: PolymorphicForwardRefComponent<"nav", {}> & {
39
39
  PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
40
40
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
41
- }, "label" | "as" | "size" | "styleType" | "isActive"> & {
41
+ }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "isActive" | "iconProps"> & {
42
42
  isActive?: boolean | undefined;
43
43
  label?: React.ReactNode;
44
- } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
44
+ iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
45
+ } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
45
46
  as?: "button" | undefined;
46
47
  }>;
47
48
  NextButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
48
49
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
49
- }, "label" | "as" | "size" | "styleType" | "isActive"> & {
50
+ }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "isActive" | "iconProps"> & {
50
51
  isActive?: boolean | undefined;
51
52
  label?: React.ReactNode;
52
- } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
53
+ iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
54
+ } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
53
55
  as?: "button" | undefined;
54
56
  }>;
55
57
  };
@@ -4,7 +4,12 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import * as React from 'react';
6
6
  import cx from 'classnames';
7
- import { getRandomValue, useMergedRefs, Box } from '../utils/index.js';
7
+ import {
8
+ getRandomValue,
9
+ useMergedRefs,
10
+ Box,
11
+ useLatestRef,
12
+ } from '../utils/index.js';
8
13
  import { CarouselContext } from './CarouselContext.js';
9
14
  import { CarouselSlider } from './CarouselSlider.js';
10
15
  import { CarouselSlide } from './CarouselSlide.js';
@@ -70,10 +75,10 @@ const CarouselComponent = React.forwardRef((props, ref) => {
70
75
  }
71
76
  }
72
77
  };
73
- const userOnSlideChange = React.useRef(onSlideChange);
78
+ const userOnSlideChange = useLatestRef(onSlideChange);
74
79
  React.useEffect(() => {
75
80
  userOnSlideChange.current?.(currentIndex);
76
- }, [currentIndex]);
81
+ }, [userOnSlideChange, currentIndex]);
77
82
  return React.createElement(
78
83
  Box,
79
84
  {
@@ -4,16 +4,14 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import * as React from 'react';
6
6
  import cx from 'classnames';
7
- import { Box } from '../utils/index.js';
7
+ import { ButtonBase } from '../utils/index.js';
8
8
  /**
9
9
  * `CarouselDot` is the actual "dot" component used to activate a slide on clicking.
10
10
  * It should be used as a child of `CarouselDotsList`.
11
11
  */
12
12
  export const CarouselDot = React.forwardRef((props, ref) => {
13
13
  const { isActive, isSmaller, isSmall, className, ...rest } = props;
14
- return React.createElement(Box, {
15
- as: 'button',
16
- type: 'button',
14
+ return React.createElement(ButtonBase, {
17
15
  role: 'tab',
18
16
  tabIndex: -1,
19
17
  className: cx(
@@ -9,18 +9,20 @@ import type { PolymorphicForwardRefComponent } from '../utils/index.js';
9
9
  export declare const CarouselNavigation: PolymorphicForwardRefComponent<"nav", {}> & {
10
10
  PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
11
11
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
12
- }, "label" | "as" | "size" | "styleType" | "isActive"> & {
12
+ }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "isActive" | "iconProps"> & {
13
13
  isActive?: boolean | undefined;
14
14
  label?: React.ReactNode;
15
- } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
15
+ iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
16
+ } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
16
17
  as?: "button" | undefined;
17
18
  }>;
18
19
  NextButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
19
20
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
20
- }, "label" | "as" | "size" | "styleType" | "isActive"> & {
21
+ }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "isActive" | "iconProps"> & {
21
22
  isActive?: boolean | undefined;
22
23
  label?: React.ReactNode;
23
- } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
24
+ iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
25
+ } & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
24
26
  as?: "button" | undefined;
25
27
  }>;
26
28
  };
@@ -245,7 +245,8 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
245
245
  React.createElement(Box, {
246
246
  className: 'iui-color-dot',
247
247
  style: {
248
- '--iui-color-dot-inset': `${squareTop.toString()}% auto auto ${squareLeft.toString()}%`,
248
+ '--iui-color-dot-inset-block': `${squareTop.toString()}% auto`,
249
+ '--iui-color-dot-inset-inline': `${squareLeft.toString()}% auto`,
249
250
  },
250
251
  onPointerDown: () => {
251
252
  setColorDotActive(true);