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

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 (172) hide show
  1. package/CHANGELOG.md +98 -1
  2. package/cjs/core/Avatar/Avatar.d.ts +3 -2
  3. package/cjs/core/Avatar/Avatar.js +21 -19
  4. package/cjs/core/AvatarGroup/AvatarGroup.js +3 -8
  5. package/cjs/core/Buttons/Button/Button.d.ts +15 -2
  6. package/cjs/core/Buttons/Button/Button.js +23 -9
  7. package/cjs/core/Buttons/DropdownButton/DropdownButton.d.ts +1 -1
  8. package/cjs/core/Buttons/DropdownButton/DropdownButton.js +1 -1
  9. package/cjs/core/Buttons/IconButton/IconButton.d.ts +5 -1
  10. package/cjs/core/Buttons/IconButton/IconButton.js +11 -5
  11. package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
  12. package/cjs/core/Buttons/SplitButton/SplitButton.js +22 -13
  13. package/cjs/core/Carousel/Carousel.d.ts +6 -4
  14. package/cjs/core/Carousel/Carousel.js +2 -2
  15. package/cjs/core/Carousel/CarouselDot.js +1 -3
  16. package/cjs/core/Carousel/CarouselNavigation.d.ts +6 -4
  17. package/cjs/core/ColorPicker/ColorBuilder.js +2 -1
  18. package/cjs/core/ComboBox/ComboBoxInput.js +1 -1
  19. package/cjs/core/ComboBox/ComboBoxMenu.js +5 -5
  20. package/cjs/core/DatePicker/DatePicker.js +7 -1
  21. package/cjs/core/Dialog/Dialog.js +1 -2
  22. package/cjs/core/Dialog/DialogContent.d.ts +2 -1
  23. package/cjs/core/Dialog/DialogContent.js +25 -1
  24. package/cjs/core/Dialog/DialogMain.js +5 -6
  25. package/cjs/core/ExpandableBlock/ExpandableBlock.js +1 -3
  26. package/cjs/core/FileUpload/FileUpload.d.ts +4 -0
  27. package/cjs/core/FileUpload/FileUpload.js +24 -3
  28. package/cjs/core/Header/HeaderBasicButton.js +3 -16
  29. package/cjs/core/Header/HeaderButton.d.ts +4 -0
  30. package/cjs/core/Header/HeaderButton.js +2 -0
  31. package/cjs/core/Header/HeaderDropdownButton.js +1 -1
  32. package/cjs/core/Header/HeaderSplitButton.js +2 -4
  33. package/cjs/core/Input/Input.d.ts +5 -0
  34. package/cjs/core/Input/Input.js +2 -1
  35. package/cjs/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
  36. package/cjs/core/ProgressIndicators/ProgressLinear.js +9 -1
  37. package/cjs/core/Radio/Radio.d.ts +8 -0
  38. package/cjs/core/Radio/Radio.js +22 -9
  39. package/cjs/core/RadioTiles/RadioTile.d.ts +16 -0
  40. package/cjs/core/RadioTiles/RadioTile.js +61 -27
  41. package/cjs/core/Select/Select.js +2 -2
  42. package/cjs/core/SideNavigation/SideNavigation.d.ts +16 -0
  43. package/cjs/core/SideNavigation/SideNavigation.js +40 -9
  44. package/cjs/core/Slider/Slider.d.ts +24 -0
  45. package/cjs/core/Slider/Slider.js +58 -10
  46. package/cjs/core/Slider/Thumb.js +2 -2
  47. package/cjs/core/Slider/Track.d.ts +1 -1
  48. package/cjs/core/Slider/Track.js +17 -6
  49. package/cjs/core/Stepper/Stepper.d.ts +26 -1
  50. package/cjs/core/Stepper/Stepper.js +35 -6
  51. package/cjs/core/Stepper/StepperStep.d.ts +17 -0
  52. package/cjs/core/Stepper/StepperStep.js +33 -8
  53. package/cjs/core/Stepper/WorkflowDiagram.d.ts +11 -1
  54. package/cjs/core/Stepper/WorkflowDiagram.js +23 -10
  55. package/cjs/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
  56. package/cjs/core/Stepper/WorkflowDiagramStep.js +9 -2
  57. package/cjs/core/Table/SubRowExpander.js +1 -1
  58. package/cjs/core/Table/Table.d.ts +16 -0
  59. package/cjs/core/Table/Table.js +50 -9
  60. package/cjs/core/Table/TableCell.js +1 -1
  61. package/cjs/core/Table/TablePaginator.js +1 -3
  62. package/cjs/core/Tabs/Tab.js +1 -2
  63. package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
  64. package/cjs/core/ThemeProvider/ThemeProvider.d.ts +23 -3
  65. package/cjs/core/ThemeProvider/ThemeProvider.js +56 -23
  66. package/cjs/core/Tile/Tile.d.ts +3 -2
  67. package/cjs/core/Toast/Toast.js +4 -9
  68. package/cjs/core/Tooltip/Tooltip.d.ts +1 -1
  69. package/cjs/core/Tooltip/Tooltip.js +1 -2
  70. package/cjs/core/Tree/TreeNode.js +1 -1
  71. package/cjs/core/utils/components/ButtonBase.d.ts +14 -0
  72. package/cjs/core/utils/components/ButtonBase.js +46 -0
  73. package/cjs/core/utils/components/Popover.js +5 -3
  74. package/cjs/core/utils/components/Resizer.js +21 -13
  75. package/cjs/core/utils/components/VirtualScroll.js +4 -4
  76. package/cjs/core/utils/components/index.d.ts +1 -0
  77. package/cjs/core/utils/components/index.js +1 -0
  78. package/cjs/core/utils/functions/colors.d.ts +1 -1
  79. package/cjs/core/utils/functions/colors.js +1 -13
  80. package/cjs/core/utils/hooks/index.d.ts +1 -0
  81. package/cjs/core/utils/hooks/index.js +1 -0
  82. package/cjs/core/utils/hooks/useGlobals.d.ts +1 -1
  83. package/cjs/core/utils/hooks/useUncontrolledState.d.ts +6 -0
  84. package/cjs/core/utils/hooks/useUncontrolledState.js +18 -0
  85. package/cjs/styles.js +4 -11
  86. package/esm/core/Avatar/Avatar.d.ts +3 -2
  87. package/esm/core/Avatar/Avatar.js +21 -17
  88. package/esm/core/AvatarGroup/AvatarGroup.js +3 -8
  89. package/esm/core/Buttons/Button/Button.d.ts +15 -2
  90. package/esm/core/Buttons/Button/Button.js +18 -10
  91. package/esm/core/Buttons/DropdownButton/DropdownButton.d.ts +1 -1
  92. package/esm/core/Buttons/DropdownButton/DropdownButton.js +1 -1
  93. package/esm/core/Buttons/IconButton/IconButton.d.ts +5 -1
  94. package/esm/core/Buttons/IconButton/IconButton.js +9 -6
  95. package/esm/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
  96. package/esm/core/Buttons/SplitButton/SplitButton.js +22 -13
  97. package/esm/core/Carousel/Carousel.d.ts +6 -4
  98. package/esm/core/Carousel/Carousel.js +8 -3
  99. package/esm/core/Carousel/CarouselDot.js +2 -4
  100. package/esm/core/Carousel/CarouselNavigation.d.ts +6 -4
  101. package/esm/core/ColorPicker/ColorBuilder.js +2 -1
  102. package/esm/core/ComboBox/ComboBoxInput.js +1 -1
  103. package/esm/core/ComboBox/ComboBoxMenu.js +5 -5
  104. package/esm/core/DatePicker/DatePicker.js +8 -1
  105. package/esm/core/Dialog/Dialog.js +1 -1
  106. package/esm/core/Dialog/DialogContent.d.ts +2 -1
  107. package/esm/core/Dialog/DialogContent.js +25 -2
  108. package/esm/core/Dialog/DialogMain.js +5 -6
  109. package/esm/core/ExpandableBlock/ExpandableBlock.js +2 -3
  110. package/esm/core/FileUpload/FileUpload.d.ts +4 -0
  111. package/esm/core/FileUpload/FileUpload.js +26 -3
  112. package/esm/core/Header/HeaderBasicButton.js +4 -17
  113. package/esm/core/Header/HeaderButton.d.ts +4 -0
  114. package/esm/core/Header/HeaderButton.js +2 -0
  115. package/esm/core/Header/HeaderDropdownButton.js +1 -1
  116. package/esm/core/Header/HeaderSplitButton.js +8 -5
  117. package/esm/core/Input/Input.d.ts +5 -0
  118. package/esm/core/Input/Input.js +2 -1
  119. package/esm/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
  120. package/esm/core/ProgressIndicators/ProgressLinear.js +9 -1
  121. package/esm/core/Radio/Radio.d.ts +8 -0
  122. package/esm/core/Radio/Radio.js +19 -6
  123. package/esm/core/RadioTiles/RadioTile.d.ts +16 -0
  124. package/esm/core/RadioTiles/RadioTile.js +52 -22
  125. package/esm/core/Select/Select.js +2 -2
  126. package/esm/core/SideNavigation/SideNavigation.d.ts +16 -0
  127. package/esm/core/SideNavigation/SideNavigation.js +31 -9
  128. package/esm/core/Slider/Slider.d.ts +24 -0
  129. package/esm/core/Slider/Slider.js +43 -10
  130. package/esm/core/Slider/Thumb.js +2 -2
  131. package/esm/core/Slider/Track.d.ts +1 -1
  132. package/esm/core/Slider/Track.js +14 -6
  133. package/esm/core/Stepper/Stepper.d.ts +26 -1
  134. package/esm/core/Stepper/Stepper.js +32 -6
  135. package/esm/core/Stepper/StepperStep.d.ts +17 -0
  136. package/esm/core/Stepper/StepperStep.js +27 -8
  137. package/esm/core/Stepper/WorkflowDiagram.d.ts +11 -1
  138. package/esm/core/Stepper/WorkflowDiagram.js +10 -7
  139. package/esm/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
  140. package/esm/core/Stepper/WorkflowDiagramStep.js +6 -2
  141. package/esm/core/Table/SubRowExpander.js +1 -1
  142. package/esm/core/Table/Table.d.ts +16 -0
  143. package/esm/core/Table/Table.js +47 -9
  144. package/esm/core/Table/TableCell.js +1 -1
  145. package/esm/core/Table/TablePaginator.js +2 -3
  146. package/esm/core/Tabs/Tab.js +2 -3
  147. package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
  148. package/esm/core/ThemeProvider/ThemeProvider.d.ts +23 -3
  149. package/esm/core/ThemeProvider/ThemeProvider.js +64 -24
  150. package/esm/core/Tile/Tile.d.ts +3 -2
  151. package/esm/core/Toast/Toast.js +5 -9
  152. package/esm/core/Tooltip/Tooltip.d.ts +1 -1
  153. package/esm/core/Tooltip/Tooltip.js +1 -1
  154. package/esm/core/Tree/TreeNode.js +1 -1
  155. package/esm/core/utils/components/ButtonBase.d.ts +14 -0
  156. package/esm/core/utils/components/ButtonBase.js +42 -0
  157. package/esm/core/utils/components/Popover.js +5 -3
  158. package/esm/core/utils/components/Resizer.js +21 -13
  159. package/esm/core/utils/components/VirtualScroll.js +4 -4
  160. package/esm/core/utils/components/index.d.ts +1 -0
  161. package/esm/core/utils/components/index.js +1 -0
  162. package/esm/core/utils/functions/colors.d.ts +1 -1
  163. package/esm/core/utils/functions/colors.js +1 -13
  164. package/esm/core/utils/functions/import.js +2 -1
  165. package/esm/core/utils/hooks/index.d.ts +1 -0
  166. package/esm/core/utils/hooks/index.js +1 -0
  167. package/esm/core/utils/hooks/useGlobals.d.ts +1 -1
  168. package/esm/core/utils/hooks/useUncontrolledState.d.ts +6 -0
  169. package/esm/core/utils/hooks/useUncontrolledState.js +13 -0
  170. package/esm/styles.js +4 -11
  171. package/package.json +2 -2
  172. package/styles.css +723 -1566
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0-dev.7
4
+
5
+ ### Major Changes
6
+
7
+ - [#1478](https://github.com/iTwin/iTwinUI/pull/1478): ThemeProvider now defaults the `theme` value to `"inherit"` and falls back to `"light"` there is no parent theme found. Also the inherit behavior has been made more resilient for cases where react context fails.
8
+ - [#1458](https://github.com/iTwin/iTwinUI/pull/1458): Added wrapperProps, contentProps, topProps, and bottomProps to Side Navigation component to improve customization. Top-level props (className, styling, etc) now passed to SideNav button instead of to the wrapper.
9
+ - [#1435](https://github.com/iTwin/iTwinUI/pull/1435): Improving customization of SplitButton with wrapperProps and menuButtonProps. ClassName now passed to the button instead of the component wrapper.
10
+ - [#1461](https://github.com/iTwin/iTwinUI/pull/1461): Changed disabled button behavior to make them focusable and use `aria-disabled` instead of `disabled` attribute.
11
+
12
+ ### Minor Changes
13
+
14
+ - [#1440](https://github.com/iTwin/iTwinUI/pull/1440): Adding the ability for every DOM node to have a custom className passed to it.
15
+ New prop for `FileUpload` component: `contentProps`
16
+ - [#1430](https://github.com/iTwin/iTwinUI/pull/1430): Adding the ability for each node element in `Stepper` to have a custom `prop`.
17
+ New props include: `stepProps`, `trackContentProps`, `circleProps`, `nameProps`, `labelProps`, `labelCountProps`
18
+ - [#1435](https://github.com/iTwin/iTwinUI/pull/1435): Improving customization of Button with new props: labelProps, startIconProps, and endIconProps.
19
+ Improving customization of IconButton with iconProps.
20
+ - [#1477](https://github.com/iTwin/iTwinUI/pull/1477): Added a new `portalContainer` prop to `ThemeProvider`. When specified, all floating elements (tooltips, toats, dialogs) under the ThemeProvider will read this prop from context and portal into it.
21
+
22
+ ### Patch Changes
23
+
24
+ - [#1446](https://github.com/iTwin/iTwinUI/pull/1446): Avatar has been refactored to be a single `<span>`. The colors have been updated to pass AAA contrast ratio.
25
+ - [#1492](https://github.com/iTwin/iTwinUI/pull/1492): Fixed `aria-owns` syntax for `TreeNode`
26
+ - [#1486](https://github.com/iTwin/iTwinUI/pull/1486): DatePicker date tables now have accessible labels.
27
+ - [#1499](https://github.com/iTwin/iTwinUI/pull/1499): Removed special handling of iPhone notch in Header and SideNavigation.
28
+
29
+ ## 3.0.0-dev.6
30
+
31
+ ### Major Changes
32
+
33
+ - [#1409](https://github.com/iTwin/iTwinUI/pull/1409): `RadioTile`'s `className` and `style` props will now be applied on the `<input>` element instead of the wrapper. Added `wrapperProps`, `iconProps`, `labelProps`, `subLabelProps` to individually customize each part of the component.
34
+
35
+ ### Minor Changes
36
+
37
+ - [#1457](https://github.com/iTwin/iTwinUI/pull/1457): Added `htmlName` prop to the `HeaderButton` subcomponent which handles the native `name` attribute in `<button>`.
38
+ - [#1437](https://github.com/iTwin/iTwinUI/pull/1437): Added headerWrapperProps, headerProps, bodyProps, and emptyTableContentProps to make each part of the Table component more customizable.
39
+ - [#1412](https://github.com/iTwin/iTwinUI/pull/1412): All styles have been wrapped inside a cascade layer named `itwinui`.
40
+ - [#1419](https://github.com/iTwin/iTwinUI/pull/1419): Added `htmlSize` prop to the `Input` component which handles the native `size` attribute in `<input>`.
41
+
42
+ ### Patch Changes
43
+
44
+ - [#1420](https://github.com/iTwin/iTwinUI/pull/1420): RadioTile DOM has been simplified to remove a content wrapper `div`.
45
+
3
46
  ## 3.0.0-dev.5
4
47
 
5
48
  ### Major Changes
@@ -103,6 +146,60 @@
103
146
  - Updated dependencies:
104
147
  - @itwin/itwinui-css@2.0.0-dev.0
105
148
 
149
+ ## 2.12.3
150
+
151
+ ### Patch Changes
152
+
153
+ - [#1485](https://github.com/iTwin/iTwinUI/pull/1485): Improved color contrast for input and select placeholder text.
154
+ - [#1501](https://github.com/iTwin/iTwinUI/pull/1501): Fixed a small misalignment in Table when using sticky columns.
155
+
156
+ ## 2.12.2
157
+
158
+ ### Patch Changes
159
+
160
+ - [#1494](https://github.com/iTwin/iTwinUI/pull/1494): Updated color-picker dot so its outline adapts dynamically to the backgrounds for better contrast.
161
+
162
+ ## 2.12.1
163
+
164
+ ### Patch Changes
165
+
166
+ - [#1467](https://github.com/iTwin/iTwinUI/pull/1467): Fixed an issue in Carousel where latest `onSlideChange` callback was being ignored.
167
+
168
+ ## 2.12.0
169
+
170
+ ### Minor Changes
171
+
172
+ - [#1415](https://github.com/iTwin/iTwinUI/pull/1415): The styling strategy has changed so there will now be a single stylesheet included at runtime, instead of separate css imports inside every component. All the styles are also wrapped in a cascade layer named `itwinui`. This behavior can be customized using the `includeCss` prop in `ThemeProvider`.
173
+
174
+ **Important note**: The dependencies on `@itwin/itwinui-css` and `@itwin/itwinui-variables` have been removed, so these packages _don't_ need to be installed if you are only using components from `@itwin/itwinui-react`.
175
+
176
+ - [#1422](https://github.com/iTwin/iTwinUI/pull/1422): Changed `all: revert` to `all: revert-layer` so that only styles from the v1 layer are reverted, thus avoiding issues with inadvertently removing browser default styles.
177
+ - [#1443](https://github.com/iTwin/iTwinUI/pull/1443): `DropdownButton` now supports `styleType='high-visibility'` to make it blue. This should be used sparingly, as a default or borderless dropdown button is the better choice in most cases.
178
+ - [#1454](https://github.com/iTwin/iTwinUI/pull/1454): Added `disabled` prop to `ExpandableBlock` to disable intersction with it.
179
+ - [#1441](https://github.com/iTwin/iTwinUI/pull/1441): Added `placement` prop to `Dialog` to allow placing it at one of the corners.
180
+
181
+ ## 2.11.11
182
+
183
+ ### Patch Changes
184
+
185
+ - [#1448](https://github.com/iTwin/iTwinUI/pull/1448): Fix resizable Dialog bug where Dialog jumped around the screen when resized on right side.
186
+
187
+ ## 2.11.10
188
+
189
+ ### Patch Changes
190
+
191
+ - [#1424](https://github.com/iTwin/iTwinUI/pull/1424), [#1427](https://github.com/iTwin/iTwinUI/pull/1427): Fixed a few different resizing issues in Dialog.
192
+ - Updated dependencies:
193
+ - @itwin/itwinui-css@1.11.5
194
+
195
+ ## 2.11.9
196
+
197
+ ### Patch Changes
198
+
199
+ - [#1421](https://github.com/iTwin/iTwinUI/pull/1421): Fixed an issue in Table where column reordering and editable cells were not working when v2 Table was used within a v1 app.
200
+ - Updated dependencies:
201
+ - @itwin/itwinui-css@1.11.4
202
+
106
203
  ## 2.11.8
107
204
 
108
205
  ### Patch Changes
@@ -636,4 +733,4 @@ If you're interested in more details about every signle change, check out a full
636
733
 
637
734
  ## 1.X
638
735
 
639
- For any changes prior to 2.0.0, check out the [1.X changelog](https://github.com/iTwin/iTwinUI-react/blob/v1/packages/iTwinUI-react/CHANGELOG.md).
736
+ For any changes prior to 2.0.0, check out the [1.X changelog](https://github.com/iTwin/iTwinUI/blob/legacy/v1-react/packages/iTwinUI-react/CHANGELOG.md).
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- import type { PolymorphicForwardRefComponent } from '../utils/index.js';
2
+ import { SoftBackgrounds } from '../utils/index.js';
3
+ import type { AnyString, PolymorphicForwardRefComponent } from '../utils/index.js';
3
4
  export type AvatarStatus = 'online' | 'busy' | 'away' | 'offline';
4
5
  type StatusTitles = {
5
6
  [key in Exclude<AvatarStatus, ''>]: string;
@@ -29,7 +30,7 @@ type AvatarProps = {
29
30
  /**
30
31
  * Color of the icon. You can use `getUserColor` function to generate color from user name or email. If not provided, default background color from CSS styling will be used (hsl(72, 51%, 56%) / olive green).
31
32
  */
32
- backgroundColor?: string;
33
+ backgroundColor?: keyof typeof SoftBackgrounds | AnyString;
33
34
  /**
34
35
  * Translated status messages shown on hover.
35
36
  */
@@ -9,6 +9,17 @@ 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
+ /**
13
+ * Helper function that returns one of the preset badge color values.
14
+ */
15
+ const getBackground = (color) => {
16
+ if (!color) {
17
+ return '';
18
+ }
19
+ return (0, index_js_1.isSoftBackground)(color)
20
+ ? index_js_1.SoftBackgrounds[color]
21
+ : color;
22
+ };
12
23
  exports.defaultStatusTitles = {
13
24
  away: 'Away',
14
25
  busy: 'Busy',
@@ -56,30 +67,21 @@ exports.Avatar = React.forwardRef((props, ref) => {
56
67
  { [`iui-${size}`]: size !== 'medium' },
57
68
  className,
58
69
  ),
70
+ 'data-iui-status': status,
59
71
  title: title,
60
- style: { backgroundColor, ...style },
72
+ style: { backgroundColor: getBackground(backgroundColor), ...style },
61
73
  ref: ref,
62
74
  ...rest,
63
75
  },
64
- !image &&
65
- React.createElement(
66
- index_js_1.Box,
67
- { as: 'abbr', className: 'iui-initials' },
68
- abbreviation?.substring(0, 2),
69
- ),
76
+ !image ? abbreviation?.substring(0, 2) : null,
70
77
  image,
71
- React.createElement(index_js_1.Box, {
72
- as: 'span',
73
- className: 'iui-stroke',
74
- }),
75
- status &&
76
- React.createElement(index_js_1.Box, {
77
- as: 'span',
78
- title: statusTitles[status],
79
- className: (0, classnames_1.default)('iui-status', {
80
- [`iui-${status}`]: !!status,
81
- }),
82
- }),
78
+ status
79
+ ? React.createElement(
80
+ index_js_1.VisuallyHidden,
81
+ null,
82
+ statusTitles[status],
83
+ )
84
+ : null,
83
85
  );
84
86
  });
85
87
  exports.default = exports.Avatar;
@@ -89,14 +89,9 @@ exports.AvatarGroup = React.forwardRef((props, ref) => {
89
89
  countIconProps?.className,
90
90
  ),
91
91
  },
92
- React.createElement(
93
- index_js_1.Box,
94
- { as: 'abbr', className: 'iui-initials' },
95
- childrenLength <= maxLength
96
- ? `${childrenLength - maxIcons}`
97
- : `${maxLength}+`,
98
- ),
99
- React.createElement(index_js_1.Box, { className: 'iui-stroke' }),
92
+ childrenLength <= maxLength
93
+ ? `${childrenLength - maxIcons}`
94
+ : `${maxLength}+`,
100
95
  ),
101
96
  ),
102
97
  );
@@ -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
@@ -23,36 +23,50 @@ exports.Button = React.forwardRef((props, ref) => {
23
23
  children,
24
24
  className,
25
25
  size,
26
- style,
27
26
  styleType = 'default',
28
- type = 'button',
29
27
  startIcon,
30
28
  endIcon,
29
+ labelProps,
30
+ startIconProps,
31
+ endIconProps,
31
32
  ...rest
32
33
  } = props;
33
34
  return React.createElement(
34
- index_js_1.Box,
35
+ index_js_1.ButtonBase,
35
36
  {
36
- as: 'button',
37
37
  ref: ref,
38
38
  className: (0, classnames_1.default)('iui-button', className),
39
39
  'data-iui-variant': styleType !== 'default' ? styleType : undefined,
40
40
  'data-iui-size': size,
41
- style: style,
42
- type: type,
43
41
  ...rest,
44
42
  },
45
43
  startIcon &&
46
44
  React.createElement(
47
45
  index_js_1.Box,
48
- { as: 'span', className: 'iui-button-icon', 'aria-hidden': true },
46
+ {
47
+ as: 'span',
48
+ 'aria-hidden': true,
49
+ ...startIconProps,
50
+ className: (0, classnames_1.default)(
51
+ 'iui-button-icon',
52
+ startIconProps?.className,
53
+ ),
54
+ },
49
55
  startIcon,
50
56
  ),
51
- children && React.createElement('span', null, children),
57
+ children && React.createElement('span', { ...labelProps }, children),
52
58
  endIcon &&
53
59
  React.createElement(
54
60
  index_js_1.Box,
55
- { as: 'span', className: 'iui-button-icon', 'aria-hidden': true },
61
+ {
62
+ as: 'span',
63
+ 'aria-hidden': true,
64
+ ...endIconProps,
65
+ className: (0, classnames_1.default)(
66
+ 'iui-button-icon',
67
+ endIconProps?.className,
68
+ ),
69
+ },
56
70
  endIcon,
57
71
  ),
58
72
  );
@@ -14,7 +14,7 @@ export type DropdownButtonProps = {
14
14
  * Use 'borderless' to hide outline.
15
15
  * @default 'default'
16
16
  */
17
- styleType?: 'default' | 'borderless';
17
+ styleType?: 'default' | 'borderless' | 'high-visibility';
18
18
  /**
19
19
  * Props for the `DropdownMenu` which extends `PopoverProps`.
20
20
  */
@@ -52,7 +52,7 @@ exports.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
  index_js_1.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
@@ -22,30 +22,36 @@ exports.IconButton = React.forwardRef((props, ref) => {
22
22
  children,
23
23
  styleType = 'default',
24
24
  size,
25
- type = 'button',
26
25
  className,
27
26
  label,
27
+ iconProps,
28
28
  ...rest
29
29
  } = props;
30
30
  return React.createElement(
31
31
  IconButtonTooltip,
32
32
  { label: label },
33
33
  React.createElement(
34
- index_js_1.Box,
34
+ index_js_1.ButtonBase,
35
35
  {
36
- as: 'button',
37
36
  ref: ref,
38
37
  className: (0, classnames_1.default)('iui-button', className),
39
38
  'data-iui-variant': styleType !== 'default' ? styleType : undefined,
40
39
  'data-iui-size': size,
41
40
  'data-iui-active': isActive,
42
41
  'aria-pressed': isActive,
43
- type: type,
44
42
  ...rest,
45
43
  },
46
44
  React.createElement(
47
45
  index_js_1.Box,
48
- { as: 'span', className: 'iui-button-icon', 'aria-hidden': true },
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
+ },
49
55
  children,
50
56
  ),
51
57
  label
@@ -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.
@@ -35,31 +35,35 @@ exports.SplitButton = React.forwardRef((props, forwardedRef) => {
35
35
  styleType = 'default',
36
36
  size,
37
37
  children,
38
- style,
39
- title,
38
+ wrapperProps,
39
+ menuButtonProps,
40
40
  ...rest
41
41
  } = props;
42
42
  const [isMenuOpen, setIsMenuOpen] = React.useState(false);
43
43
  const [menuWidth, setMenuWidth] = React.useState(0);
44
- const ref = React.useRef(null);
44
+ const wrapperRef = React.useRef(null);
45
45
  React.useEffect(() => {
46
- if (ref.current) {
47
- setMenuWidth(ref.current.offsetWidth);
46
+ if (wrapperRef.current) {
47
+ setMenuWidth(wrapperRef.current.offsetWidth);
48
48
  }
49
49
  }, [children, size]);
50
50
  return React.createElement(
51
51
  index_js_4.Box,
52
52
  {
53
- className: (0, classnames_1.default)(className, 'iui-button-split', {
54
- 'iui-disabled': props.disabled,
55
- }),
56
- style: style,
57
- title: title,
58
- ref: ref,
53
+ ...wrapperProps,
54
+ className: (0, classnames_1.default)(
55
+ 'iui-button-split',
56
+ {
57
+ 'iui-disabled': props.disabled,
58
+ },
59
+ wrapperProps?.className,
60
+ ),
61
+ ref: wrapperRef,
59
62
  },
60
63
  React.createElement(
61
64
  index_js_1.Button,
62
65
  {
66
+ className: className,
63
67
  styleType: styleType,
64
68
  size: size,
65
69
  onClick: onClick,
@@ -73,13 +77,18 @@ exports.SplitButton = React.forwardRef((props, forwardedRef) => {
73
77
  {
74
78
  placement: menuPlacement,
75
79
  menuItems: menuItems,
76
- style: { minWidth: menuWidth },
80
+ style: { minInlineSize: menuWidth },
77
81
  onShow: React.useCallback(() => setIsMenuOpen(true), []),
78
82
  onHide: React.useCallback(() => setIsMenuOpen(false), []),
79
83
  },
80
84
  React.createElement(
81
85
  index_js_2.IconButton,
82
- { styleType: styleType, size: size, disabled: props.disabled },
86
+ {
87
+ styleType: styleType,
88
+ size: size,
89
+ disabled: props.disabled,
90
+ ...menuButtonProps,
91
+ },
83
92
  isMenuOpen
84
93
  ? React.createElement(index_js_4.SvgCaretUpSmall, null)
85
94
  : React.createElement(index_js_4.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
  };
@@ -74,10 +74,10 @@ const CarouselComponent = React.forwardRef((props, ref) => {
74
74
  }
75
75
  }
76
76
  };
77
- const userOnSlideChange = React.useRef(onSlideChange);
77
+ const userOnSlideChange = (0, index_js_1.useLatestRef)(onSlideChange);
78
78
  React.useEffect(() => {
79
79
  userOnSlideChange.current?.(currentIndex);
80
- }, [currentIndex]);
80
+ }, [userOnSlideChange, currentIndex]);
81
81
  return React.createElement(
82
82
  index_js_1.Box,
83
83
  {
@@ -15,9 +15,7 @@ const index_js_1 = require('../utils/index.js');
15
15
  */
16
16
  exports.CarouselDot = React.forwardRef((props, ref) => {
17
17
  const { isActive, isSmaller, isSmall, className, ...rest } = props;
18
- return React.createElement(index_js_1.Box, {
19
- as: 'button',
20
- type: 'button',
18
+ return React.createElement(index_js_1.ButtonBase, {
21
19
  role: 'tab',
22
20
  tabIndex: -1,
23
21
  className: (0, classnames_1.default)(
@@ -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
  };
@@ -254,7 +254,8 @@ exports.ColorBuilder = React.forwardRef((props, ref) => {
254
254
  React.createElement(index_js_1.Box, {
255
255
  className: 'iui-color-dot',
256
256
  style: {
257
- '--iui-color-dot-inset': `${squareTop.toString()}% auto auto ${squareLeft.toString()}%`,
257
+ '--iui-color-dot-inset-block': `${squareTop.toString()}% auto`,
258
+ '--iui-color-dot-inset-inline': `${squareLeft.toString()}% auto`,
258
259
  },
259
260
  onPointerDown: () => {
260
261
  setColorDotActive(true);
@@ -195,7 +195,7 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
195
195
  spellCheck: false,
196
196
  autoCapitalize: 'none',
197
197
  autoCorrect: 'off',
198
- style: multiple ? { paddingLeft: tagContainerWidth + 18 } : {},
198
+ style: multiple ? { paddingInlineStart: tagContainerWidth + 18 } : {},
199
199
  'aria-describedby': multiple ? `${id}-selected-live` : undefined,
200
200
  ...rest,
201
201
  }),
@@ -48,11 +48,11 @@ const VirtualizedComboBoxMenu = React.forwardRef(
48
48
  scrollToIndex: focusedVisibleIndex,
49
49
  });
50
50
  const surfaceStyles = {
51
- minWidth,
51
+ minInlineSize: minWidth,
52
52
  // set as constant because we don't want it shifting when items are unmounted
53
- maxWidth: minWidth,
53
+ maxInlineSize: minWidth,
54
54
  // max-height must be on the outermost element for virtual scroll
55
- maxHeight: 'calc((var(--iui-component-height) - 1px) * 8.5)',
55
+ maxBlockSize: 'calc((var(--iui-component-height) - 1px) * 8.5)',
56
56
  overflowY: isOverflowOverlaySupported() ? 'overlay' : 'auto',
57
57
  ...style,
58
58
  };
@@ -94,8 +94,8 @@ exports.ComboBoxMenu = React.forwardRef((props, forwardedRef) => {
94
94
  const refs = (0, index_js_3.useMergedRefs)(menuRef, forwardedRef);
95
95
  const styles = React.useMemo(
96
96
  () => ({
97
- minWidth,
98
- maxWidth: `min(${minWidth * 2}px, 90vw)`,
97
+ minInlineSize: minWidth,
98
+ maxInlineSize: `min(${minWidth * 2}px, 90vw)`,
99
99
  }),
100
100
  [minWidth],
101
101
  );
@@ -407,6 +407,7 @@ exports.DatePicker = React.forwardRef((props, forwardedRef) => {
407
407
  }
408
408
  return dayClass;
409
409
  };
410
+ const dateTableId = (0, index_js_1.useId)();
410
411
  return React.createElement(
411
412
  index_js_1.Box,
412
413
  {
@@ -449,6 +450,7 @@ exports.DatePicker = React.forwardRef((props, forwardedRef) => {
449
450
  {
450
451
  as: 'span',
451
452
  className: 'iui-calendar-month',
453
+ id: dateTableId,
452
454
  title: monthNames[displayedMonthIndex],
453
455
  },
454
456
  monthNames[displayedMonthIndex],
@@ -487,7 +489,11 @@ exports.DatePicker = React.forwardRef((props, forwardedRef) => {
487
489
  ),
488
490
  React.createElement(
489
491
  'div',
490
- { onKeyDown: handleCalendarKeyDown, role: 'listbox' },
492
+ {
493
+ onKeyDown: handleCalendarKeyDown,
494
+ role: 'listbox',
495
+ 'aria-labelledby': dateTableId,
496
+ },
491
497
  weeks.map((weekDays, weekIndex) => {
492
498
  return React.createElement(
493
499
  index_js_1.Box,
@@ -41,8 +41,7 @@ const DialogComponent = React.forwardRef((props, ref) => {
41
41
  typeof portal !== 'boolean'
42
42
  ? portal.to
43
43
  : portal
44
- ? context?.portalContainerRef?.current ??
45
- (0, index_js_1.getDocument)()?.body
44
+ ? context?.portalContainer || (0, index_js_1.getDocument)()?.body
46
45
  : null;
47
46
  const dialog = React.createElement(index_js_1.Box, {
48
47
  className: (0, classnames_1.default)('iui-dialog-wrapper', className),
@@ -1,3 +1,4 @@
1
+ import type { PolymorphicForwardRefComponent } from '../utils/index.js';
1
2
  /**
2
3
  * Container for content in `Dialog`. Recommended to be used as a child of `Dialog`.
3
4
  * @example
@@ -5,5 +6,5 @@
5
6
  * My dialog content
6
7
  * </Dialog.Content>
7
8
  */
8
- export declare const DialogContent: import("../utils/props.js").PolymorphicForwardRefComponent<"div", {}>;
9
+ export declare const DialogContent: PolymorphicForwardRefComponent<"div", {}>;
9
10
  export default DialogContent;