@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
@@ -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
  */
@@ -4,7 +4,21 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import cx from 'classnames';
6
6
  import * as React from 'react';
7
- import { Box } from '../utils/index.js';
7
+ import {
8
+ Box,
9
+ VisuallyHidden,
10
+ SoftBackgrounds,
11
+ isSoftBackground,
12
+ } from '../utils/index.js';
13
+ /**
14
+ * Helper function that returns one of the preset badge color values.
15
+ */
16
+ const getBackground = (color) => {
17
+ if (!color) {
18
+ return '';
19
+ }
20
+ return isSoftBackground(color) ? SoftBackgrounds[color] : color;
21
+ };
8
22
  export const defaultStatusTitles = {
9
23
  away: 'Away',
10
24
  busy: 'Busy',
@@ -49,27 +63,17 @@ export const Avatar = React.forwardRef((props, ref) => {
49
63
  { [`iui-${size}`]: size !== 'medium' },
50
64
  className,
51
65
  ),
66
+ 'data-iui-status': status,
52
67
  title: title,
53
- style: { backgroundColor, ...style },
68
+ style: { backgroundColor: getBackground(backgroundColor), ...style },
54
69
  ref: ref,
55
70
  ...rest,
56
71
  },
57
- !image &&
58
- React.createElement(
59
- Box,
60
- { as: 'abbr', className: 'iui-initials' },
61
- abbreviation?.substring(0, 2),
62
- ),
72
+ !image ? abbreviation?.substring(0, 2) : null,
63
73
  image,
64
- React.createElement(Box, { as: 'span', className: 'iui-stroke' }),
65
- status &&
66
- React.createElement(Box, {
67
- as: 'span',
68
- title: statusTitles[status],
69
- className: cx('iui-status', {
70
- [`iui-${status}`]: !!status,
71
- }),
72
- }),
74
+ status
75
+ ? React.createElement(VisuallyHidden, null, statusTitles[status])
76
+ : null,
73
77
  );
74
78
  });
75
79
  export default Avatar;
@@ -85,14 +85,9 @@ export const AvatarGroup = React.forwardRef((props, ref) => {
85
85
  countIconProps?.className,
86
86
  ),
87
87
  },
88
- React.createElement(
89
- Box,
90
- { as: 'abbr', className: 'iui-initials' },
91
- childrenLength <= maxLength
92
- ? `${childrenLength - maxIcons}`
93
- : `${maxLength}+`,
94
- ),
95
- React.createElement(Box, { className: 'iui-stroke' }),
88
+ childrenLength <= maxLength
89
+ ? `${childrenLength - maxIcons}`
90
+ : `${maxLength}+`,
96
91
  ),
97
92
  ),
98
93
  );
@@ -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
  );
@@ -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 @@ 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,7 @@
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, Popover, Box, ButtonBase } from '../../utils/index.js';
8
8
  /**
9
9
  * Icon button
10
10
  * @example
@@ -18,30 +18,33 @@ export const IconButton = React.forwardRef((props, ref) => {
18
18
  children,
19
19
  styleType = 'default',
20
20
  size,
21
- type = 'button',
22
21
  className,
23
22
  label,
23
+ iconProps,
24
24
  ...rest
25
25
  } = props;
26
26
  return React.createElement(
27
27
  IconButtonTooltip,
28
28
  { label: label },
29
29
  React.createElement(
30
- Box,
30
+ ButtonBase,
31
31
  {
32
- as: 'button',
33
32
  ref: ref,
34
33
  className: cx('iui-button', className),
35
34
  'data-iui-variant': styleType !== 'default' ? styleType : undefined,
36
35
  'data-iui-size': size,
37
36
  'data-iui-active': isActive,
38
37
  'aria-pressed': isActive,
39
- type: type,
40
38
  ...rest,
41
39
  },
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
+ ...iconProps,
46
+ className: cx('iui-button-icon', iconProps?.className),
47
+ },
45
48
  children,
46
49
  ),
47
50
  label ? React.createElement(VisuallyHidden, null, label) : null,
@@ -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.
@@ -31,31 +31,35 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
31
31
  styleType = 'default',
32
32
  size,
33
33
  children,
34
- style,
35
- title,
34
+ wrapperProps,
35
+ menuButtonProps,
36
36
  ...rest
37
37
  } = props;
38
38
  const [isMenuOpen, setIsMenuOpen] = React.useState(false);
39
39
  const [menuWidth, setMenuWidth] = React.useState(0);
40
- const ref = React.useRef(null);
40
+ const wrapperRef = React.useRef(null);
41
41
  React.useEffect(() => {
42
- if (ref.current) {
43
- setMenuWidth(ref.current.offsetWidth);
42
+ if (wrapperRef.current) {
43
+ setMenuWidth(wrapperRef.current.offsetWidth);
44
44
  }
45
45
  }, [children, size]);
46
46
  return React.createElement(
47
47
  Box,
48
48
  {
49
- className: cx(className, 'iui-button-split', {
50
- 'iui-disabled': props.disabled,
51
- }),
52
- style: style,
53
- title: title,
54
- ref: ref,
49
+ ...wrapperProps,
50
+ className: cx(
51
+ 'iui-button-split',
52
+ {
53
+ 'iui-disabled': props.disabled,
54
+ },
55
+ wrapperProps?.className,
56
+ ),
57
+ ref: wrapperRef,
55
58
  },
56
59
  React.createElement(
57
60
  Button,
58
61
  {
62
+ className: className,
59
63
  styleType: styleType,
60
64
  size: size,
61
65
  onClick: onClick,
@@ -69,13 +73,18 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
69
73
  {
70
74
  placement: menuPlacement,
71
75
  menuItems: menuItems,
72
- style: { minWidth: menuWidth },
76
+ style: { minInlineSize: menuWidth },
73
77
  onShow: React.useCallback(() => setIsMenuOpen(true), []),
74
78
  onHide: React.useCallback(() => setIsMenuOpen(false), []),
75
79
  },
76
80
  React.createElement(
77
81
  IconButton,
78
- { styleType: styleType, size: size, disabled: props.disabled },
82
+ {
83
+ styleType: styleType,
84
+ size: size,
85
+ disabled: props.disabled,
86
+ ...menuButtonProps,
87
+ },
79
88
  isMenuOpen
80
89
  ? React.createElement(SvgCaretUpSmall, null)
81
90
  : 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);
@@ -197,7 +197,7 @@ export const ComboBoxInput = React.forwardRef((props, forwardedRef) => {
197
197
  spellCheck: false,
198
198
  autoCapitalize: 'none',
199
199
  autoCorrect: 'off',
200
- style: multiple ? { paddingLeft: tagContainerWidth + 18 } : {},
200
+ style: multiple ? { paddingInlineStart: tagContainerWidth + 18 } : {},
201
201
  'aria-describedby': multiple ? `${id}-selected-live` : undefined,
202
202
  ...rest,
203
203
  }),
@@ -47,11 +47,11 @@ const VirtualizedComboBoxMenu = React.forwardRef(
47
47
  scrollToIndex: focusedVisibleIndex,
48
48
  });
49
49
  const surfaceStyles = {
50
- minWidth,
50
+ minInlineSize: minWidth,
51
51
  // set as constant because we don't want it shifting when items are unmounted
52
- maxWidth: minWidth,
52
+ maxInlineSize: minWidth,
53
53
  // max-height must be on the outermost element for virtual scroll
54
- maxHeight: 'calc((var(--iui-component-height) - 1px) * 8.5)',
54
+ maxBlockSize: 'calc((var(--iui-component-height) - 1px) * 8.5)',
55
55
  overflowY: isOverflowOverlaySupported() ? 'overlay' : 'auto',
56
56
  ...style,
57
57
  };
@@ -86,8 +86,8 @@ export const ComboBoxMenu = React.forwardRef((props, forwardedRef) => {
86
86
  const refs = useMergedRefs(menuRef, forwardedRef);
87
87
  const styles = React.useMemo(
88
88
  () => ({
89
- minWidth,
90
- maxWidth: `min(${minWidth * 2}px, 90vw)`,
89
+ minInlineSize: minWidth,
90
+ maxInlineSize: `min(${minWidth * 2}px, 90vw)`,
91
91
  }),
92
92
  [minWidth],
93
93
  );
@@ -11,6 +11,7 @@ import {
11
11
  SvgChevronRightDouble,
12
12
  isBefore,
13
13
  Box,
14
+ useId,
14
15
  } from '../utils/index.js';
15
16
  import { IconButton } from '../Buttons/IconButton/index.js';
16
17
  import { TimePicker } from '../TimePicker/index.js';
@@ -409,6 +410,7 @@ export const DatePicker = React.forwardRef((props, forwardedRef) => {
409
410
  }
410
411
  return dayClass;
411
412
  };
413
+ const dateTableId = useId();
412
414
  return React.createElement(
413
415
  Box,
414
416
  { className: cx('iui-date-picker', className), ref: forwardedRef, ...rest },
@@ -447,6 +449,7 @@ export const DatePicker = React.forwardRef((props, forwardedRef) => {
447
449
  {
448
450
  as: 'span',
449
451
  className: 'iui-calendar-month',
452
+ id: dateTableId,
450
453
  title: monthNames[displayedMonthIndex],
451
454
  },
452
455
  monthNames[displayedMonthIndex],
@@ -485,7 +488,11 @@ export const DatePicker = React.forwardRef((props, forwardedRef) => {
485
488
  ),
486
489
  React.createElement(
487
490
  'div',
488
- { onKeyDown: handleCalendarKeyDown, role: 'listbox' },
491
+ {
492
+ onKeyDown: handleCalendarKeyDown,
493
+ role: 'listbox',
494
+ 'aria-labelledby': dateTableId,
495
+ },
489
496
  weeks.map((weekDays, weekIndex) => {
490
497
  return React.createElement(
491
498
  Box,
@@ -43,7 +43,7 @@ const DialogComponent = React.forwardRef((props, ref) => {
43
43
  typeof portal !== 'boolean'
44
44
  ? portal.to
45
45
  : portal
46
- ? context?.portalContainerRef?.current ?? getDocument()?.body
46
+ ? context?.portalContainer || getDocument()?.body
47
47
  : null;
48
48
  const dialog = React.createElement(Box, {
49
49
  className: cx('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;
@@ -2,7 +2,9 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { polymorphic } from '../utils/index.js';
5
+ import * as React from 'react';
6
+ import cx from 'classnames';
7
+ import { supportsHas, useMergedRefs, Box } from '../utils/index.js';
6
8
  /**
7
9
  * Container for content in `Dialog`. Recommended to be used as a child of `Dialog`.
8
10
  * @example
@@ -10,5 +12,26 @@ import { polymorphic } from '../utils/index.js';
10
12
  * My dialog content
11
13
  * </Dialog.Content>
12
14
  */
13
- export const DialogContent = polymorphic.div('iui-dialog-content');
15
+ export const DialogContent = React.forwardRef((props, ref) => {
16
+ const { children, className, ...rest } = props;
17
+ const contentRef = React.useRef(null);
18
+ React.useEffect(() => {
19
+ // firefox hack for adding data-iui-flex in absence of :has
20
+ if (!supportsHas()) {
21
+ const dialog = contentRef.current?.closest('[role=dialog]');
22
+ if (dialog instanceof HTMLElement) {
23
+ dialog.dataset.iuiFlex = 'true';
24
+ }
25
+ }
26
+ }, []);
27
+ return React.createElement(
28
+ Box,
29
+ {
30
+ className: cx('iui-dialog-content', className),
31
+ ref: useMergedRefs(contentRef, ref),
32
+ ...rest,
33
+ },
34
+ children,
35
+ );
36
+ });
14
37
  export default DialogContent;
@@ -121,10 +121,10 @@ export const DialogMain = React.forwardRef((props, ref) => {
121
121
  const [translateX, translateY] = getTranslateValues(dialogRef.current);
122
122
  setStyle((oldStyle) => ({
123
123
  ...oldStyle,
124
- width: rect?.width,
125
- height: rect?.height,
126
- left: dialogRef.current?.offsetLeft,
127
- top: dialogRef.current?.offsetTop,
124
+ inlineSize: rect?.width,
125
+ blockSize: rect?.height,
126
+ insetInlineStart: dialogRef.current?.offsetLeft,
127
+ insetBlockStart: dialogRef.current?.offsetTop,
128
128
  transform: `translate(${translateX}px,${translateY}px)`,
129
129
  }));
130
130
  }, [isDraggable, isOpen]);
@@ -154,7 +154,6 @@ export const DialogMain = React.forwardRef((props, ref) => {
154
154
  'data-iui-placement': placement,
155
155
  style: {
156
156
  transform,
157
- overflow: 'unset',
158
157
  ...style,
159
158
  ...propStyle,
160
159
  },
@@ -167,7 +166,7 @@ export const DialogMain = React.forwardRef((props, ref) => {
167
166
  onResizeStart: () => {
168
167
  if (!hasBeenResized.current) {
169
168
  hasBeenResized.current = true;
170
- setResizeStyle({ maxWidth: '100%' });
169
+ setResizeStyle({ maxInlineSize: '100%' });
171
170
  }
172
171
  },
173
172
  onResizeEnd: setResizeStyle,
@@ -12,6 +12,7 @@ import {
12
12
  useSafeContext,
13
13
  polymorphic,
14
14
  mergeEventHandlers,
15
+ ButtonBase,
15
16
  } from '../utils/index.js';
16
17
  const ExpandableBlockContext = React.createContext(undefined);
17
18
  ExpandableBlockContext.displayName = 'ExpandableBlockContext';
@@ -73,10 +74,8 @@ const ExpandableBlockHeader = React.forwardRef((props, forwardedRef) => {
73
74
  ExpandableBlockContext,
74
75
  );
75
76
  return React.createElement(
76
- Box,
77
+ ButtonBase,
77
78
  {
78
- as: 'button',
79
- type: 'button',
80
79
  className: cx('iui-expandable-header', className),
81
80
  'aria-expanded': isExpanded,
82
81
  'aria-disabled': disabled,