@itwin/itwinui-react 3.0.0-dev.7 → 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 (189) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/cjs/core/Alert/Alert.d.ts +20 -9
  3. package/cjs/core/Alert/Alert.js +48 -10
  4. package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
  5. package/cjs/core/Buttons/IconButton/IconButton.js +27 -44
  6. package/cjs/core/Buttons/SplitButton/SplitButton.js +3 -0
  7. package/cjs/core/ColorPicker/ColorInputPanel.js +172 -231
  8. package/cjs/core/ComboBox/ComboBox.js +3 -3
  9. package/cjs/core/ComboBox/ComboBoxDropdown.js +4 -9
  10. package/cjs/core/ComboBox/ComboBoxEndIcon.js +3 -22
  11. package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
  12. package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
  13. package/cjs/core/ComboBox/ComboBoxMenuItem.js +8 -6
  14. package/cjs/core/ComboBox/helpers.d.ts +1 -2
  15. package/cjs/core/DatePicker/DatePicker.d.ts +30 -8
  16. package/cjs/core/DatePicker/DatePicker.js +40 -5
  17. package/cjs/core/Dialog/Dialog.js +10 -16
  18. package/cjs/core/Dialog/DialogContext.d.ts +3 -4
  19. package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
  20. package/cjs/core/ExpandableBlock/ExpandableBlock.js +38 -15
  21. package/cjs/core/Header/HeaderSplitButton.js +1 -0
  22. package/cjs/core/Input/Input.d.ts +4 -0
  23. package/cjs/core/Input/Input.js +2 -1
  24. package/cjs/core/InputGrid/InputGrid.d.ts +25 -0
  25. package/cjs/core/InputGrid/InputGrid.js +39 -0
  26. package/cjs/core/InputGrid/index.d.ts +3 -0
  27. package/cjs/core/InputGrid/index.js +15 -0
  28. package/cjs/core/InputGroup/InputGroup.d.ts +13 -0
  29. package/cjs/core/InputGroup/InputGroup.js +35 -9
  30. package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
  31. package/cjs/core/InputWithDecorations/InputWithDecorations.js +81 -0
  32. package/cjs/core/InputWithDecorations/index.d.ts +3 -0
  33. package/cjs/core/InputWithDecorations/index.js +15 -0
  34. package/cjs/core/Label/Label.d.ts +5 -0
  35. package/cjs/core/Label/Label.js +2 -0
  36. package/cjs/core/LabeledInput/LabeledInput.d.ts +22 -16
  37. package/cjs/core/LabeledInput/LabeledInput.js +52 -29
  38. package/cjs/core/LabeledSelect/LabeledSelect.d.ts +17 -7
  39. package/cjs/core/LabeledSelect/LabeledSelect.js +36 -17
  40. package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
  41. package/cjs/core/LabeledTextarea/LabeledTextarea.js +12 -45
  42. package/cjs/core/Menu/Menu.d.ts +1 -1
  43. package/cjs/core/Menu/Menu.js +1 -1
  44. package/cjs/core/Menu/MenuDivider.d.ts +2 -1
  45. package/cjs/core/Menu/MenuDivider.js +1 -1
  46. package/cjs/core/Menu/MenuItem.d.ts +1 -1
  47. package/cjs/core/Menu/MenuItem.js +1 -0
  48. package/cjs/core/Menu/MenuItemSkeleton.d.ts +1 -1
  49. package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
  50. package/cjs/core/SearchBox/SearchBox.js +1 -1
  51. package/cjs/core/Select/Select.d.ts +4 -0
  52. package/cjs/core/Select/Select.js +10 -9
  53. package/cjs/core/SideNavigation/SideNavigation.js +2 -0
  54. package/cjs/core/Slider/Thumb.js +1 -0
  55. package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
  56. package/cjs/core/StatusMessage/StatusMessage.js +23 -9
  57. package/cjs/core/Table/SubRowExpander.js +2 -0
  58. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
  59. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +46 -18
  60. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
  61. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
  62. package/cjs/core/Textarea/Textarea.d.ts +7 -1
  63. package/cjs/core/Textarea/Textarea.js +6 -11
  64. package/cjs/core/ThemeProvider/ThemeProvider.js +1 -1
  65. package/cjs/core/Tile/Tile.d.ts +139 -15
  66. package/cjs/core/Tile/Tile.js +107 -16
  67. package/cjs/core/Toast/Toast.d.ts +12 -4
  68. package/cjs/core/Toast/Toast.js +20 -4
  69. package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
  70. package/cjs/core/Tooltip/Tooltip.js +116 -117
  71. package/cjs/core/TransferList/TransferList.js +4 -12
  72. package/cjs/core/index.d.ts +2 -0
  73. package/cjs/core/index.js +20 -4
  74. package/cjs/core/utils/components/Icon.d.ts +5 -0
  75. package/cjs/core/utils/components/Icon.js +8 -1
  76. package/cjs/core/utils/components/InputContainer.d.ts +0 -1
  77. package/cjs/core/utils/components/InputContainer.js +14 -34
  78. package/cjs/core/utils/components/InputFlexContainer.d.ts +1 -0
  79. package/cjs/core/utils/components/InputFlexContainer.js +3 -1
  80. package/cjs/core/utils/components/Portal.d.ts +27 -0
  81. package/cjs/core/utils/components/Portal.js +43 -0
  82. package/cjs/core/utils/components/index.d.ts +1 -0
  83. package/cjs/core/utils/components/index.js +1 -0
  84. package/cjs/core/utils/functions/index.d.ts +1 -0
  85. package/cjs/core/utils/functions/index.js +1 -0
  86. package/cjs/core/utils/functions/react.d.ts +8 -0
  87. package/cjs/core/utils/functions/react.js +40 -0
  88. package/cjs/core/utils/hooks/index.d.ts +1 -1
  89. package/cjs/core/utils/hooks/index.js +1 -1
  90. package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
  91. package/cjs/core/utils/hooks/useControlledState.js +39 -0
  92. package/cjs/styles.js +10 -28
  93. package/esm/core/Alert/Alert.d.ts +20 -9
  94. package/esm/core/Alert/Alert.js +49 -10
  95. package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
  96. package/esm/core/Buttons/IconButton/IconButton.js +25 -40
  97. package/esm/core/Buttons/SplitButton/SplitButton.js +9 -1
  98. package/esm/core/ColorPicker/ColorInputPanel.js +173 -232
  99. package/esm/core/ComboBox/ComboBox.js +3 -3
  100. package/esm/core/ComboBox/ComboBoxDropdown.js +4 -9
  101. package/esm/core/ComboBox/ComboBoxEndIcon.js +4 -25
  102. package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
  103. package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
  104. package/esm/core/ComboBox/ComboBoxMenuItem.js +9 -7
  105. package/esm/core/ComboBox/helpers.d.ts +1 -2
  106. package/esm/core/DatePicker/DatePicker.d.ts +30 -8
  107. package/esm/core/DatePicker/DatePicker.js +25 -5
  108. package/esm/core/Dialog/Dialog.js +11 -23
  109. package/esm/core/Dialog/DialogContext.d.ts +3 -4
  110. package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
  111. package/esm/core/ExpandableBlock/ExpandableBlock.js +39 -17
  112. package/esm/core/Header/HeaderSplitButton.js +1 -0
  113. package/esm/core/Input/Input.d.ts +4 -0
  114. package/esm/core/Input/Input.js +2 -1
  115. package/esm/core/InputGrid/InputGrid.d.ts +25 -0
  116. package/esm/core/InputGrid/InputGrid.js +35 -0
  117. package/esm/core/InputGrid/index.d.ts +3 -0
  118. package/esm/core/InputGrid/index.js +6 -0
  119. package/esm/core/InputGroup/InputGroup.d.ts +13 -0
  120. package/esm/core/InputGroup/InputGroup.js +34 -10
  121. package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
  122. package/esm/core/InputWithDecorations/InputWithDecorations.js +80 -0
  123. package/esm/core/InputWithDecorations/index.d.ts +3 -0
  124. package/esm/core/InputWithDecorations/index.js +6 -0
  125. package/esm/core/Label/Label.d.ts +5 -0
  126. package/esm/core/Label/Label.js +2 -0
  127. package/esm/core/LabeledInput/LabeledInput.d.ts +22 -16
  128. package/esm/core/LabeledInput/LabeledInput.js +53 -29
  129. package/esm/core/LabeledSelect/LabeledSelect.d.ts +17 -7
  130. package/esm/core/LabeledSelect/LabeledSelect.js +37 -18
  131. package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
  132. package/esm/core/LabeledTextarea/LabeledTextarea.js +14 -45
  133. package/esm/core/Menu/Menu.d.ts +1 -1
  134. package/esm/core/Menu/Menu.js +1 -1
  135. package/esm/core/Menu/MenuDivider.d.ts +2 -1
  136. package/esm/core/Menu/MenuDivider.js +1 -1
  137. package/esm/core/Menu/MenuItem.d.ts +1 -1
  138. package/esm/core/Menu/MenuItem.js +1 -0
  139. package/esm/core/Menu/MenuItemSkeleton.d.ts +1 -1
  140. package/esm/core/Menu/MenuItemSkeleton.js +0 -1
  141. package/esm/core/SearchBox/SearchBox.js +1 -1
  142. package/esm/core/Select/Select.d.ts +4 -0
  143. package/esm/core/Select/Select.js +10 -9
  144. package/esm/core/SideNavigation/SideNavigation.js +2 -0
  145. package/esm/core/Slider/Thumb.js +1 -0
  146. package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
  147. package/esm/core/StatusMessage/StatusMessage.js +23 -16
  148. package/esm/core/Table/SubRowExpander.js +2 -0
  149. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
  150. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +45 -17
  151. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
  152. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
  153. package/esm/core/Textarea/Textarea.d.ts +7 -1
  154. package/esm/core/Textarea/Textarea.js +6 -11
  155. package/esm/core/ThemeProvider/ThemeProvider.js +4 -3
  156. package/esm/core/Tile/Tile.d.ts +139 -15
  157. package/esm/core/Tile/Tile.js +107 -16
  158. package/esm/core/Toast/Toast.d.ts +12 -4
  159. package/esm/core/Toast/Toast.js +21 -4
  160. package/esm/core/Tooltip/Tooltip.d.ts +35 -28
  161. package/esm/core/Tooltip/Tooltip.js +119 -116
  162. package/esm/core/TransferList/TransferList.js +4 -9
  163. package/esm/core/index.d.ts +2 -0
  164. package/esm/core/index.js +2 -0
  165. package/esm/core/utils/components/Icon.d.ts +5 -0
  166. package/esm/core/utils/components/Icon.js +8 -1
  167. package/esm/core/utils/components/InputContainer.d.ts +0 -1
  168. package/esm/core/utils/components/InputContainer.js +14 -30
  169. package/esm/core/utils/components/InputFlexContainer.d.ts +1 -0
  170. package/esm/core/utils/components/InputFlexContainer.js +3 -1
  171. package/esm/core/utils/components/Portal.d.ts +27 -0
  172. package/esm/core/utils/components/Portal.js +36 -0
  173. package/esm/core/utils/components/index.d.ts +1 -0
  174. package/esm/core/utils/components/index.js +1 -0
  175. package/esm/core/utils/functions/index.d.ts +1 -0
  176. package/esm/core/utils/functions/index.js +1 -0
  177. package/esm/core/utils/functions/react.d.ts +8 -0
  178. package/esm/core/utils/functions/react.js +35 -0
  179. package/esm/core/utils/hooks/index.d.ts +1 -1
  180. package/esm/core/utils/hooks/index.js +1 -1
  181. package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
  182. package/esm/core/utils/hooks/useControlledState.js +34 -0
  183. package/esm/styles.js +10 -28
  184. package/package.json +3 -3
  185. package/styles.css +22 -19
  186. package/cjs/core/utils/hooks/useUncontrolledState.d.ts +0 -6
  187. package/cjs/core/utils/hooks/useUncontrolledState.js +0 -18
  188. package/esm/core/utils/hooks/useUncontrolledState.d.ts +0 -6
  189. package/esm/core/utils/hooks/useUncontrolledState.js +0 -13
@@ -11,10 +11,47 @@ import {
11
11
  StatusIconMap,
12
12
  SvgCloseSmall,
13
13
  Box,
14
+ ButtonBase,
14
15
  } from '../utils/index.js';
15
16
  import { IconButton } from '../Buttons/index.js';
16
17
  const AlertContext = React.createContext(undefined);
17
- const AlertComponent = React.forwardRef((props, ref) => {
18
+ // ----------------------------------------------------------------------------
19
+ // Alert component
20
+ const AlertComponent = React.forwardRef((props, forwardedRef) => {
21
+ const {
22
+ children,
23
+ type = 'informational',
24
+ isSticky = false,
25
+ clickableText,
26
+ clickableTextProps,
27
+ onClose,
28
+ ...rest
29
+ } = props;
30
+ return React.createElement(
31
+ Alert.Wrapper,
32
+ { type: type, isSticky: isSticky, ref: forwardedRef, ...rest },
33
+ React.createElement(Alert.Icon, null),
34
+ React.createElement(
35
+ Alert.Message,
36
+ null,
37
+ children,
38
+ clickableText
39
+ ? React.createElement(
40
+ Alert.Action,
41
+ { ...clickableTextProps },
42
+ clickableText,
43
+ )
44
+ : null,
45
+ ),
46
+ onClose
47
+ ? React.createElement(Alert.CloseButton, { onClick: onClose })
48
+ : null,
49
+ );
50
+ });
51
+ AlertComponent.displayName = 'Alert';
52
+ // ----------------------------------------------------------------------------
53
+ // Alert.Wrapper component
54
+ const AlertWrapper = React.forwardRef((props, ref) => {
18
55
  const {
19
56
  children,
20
57
  className,
@@ -34,7 +71,7 @@ const AlertComponent = React.forwardRef((props, ref) => {
34
71
  React.createElement(AlertContext.Provider, { value: { type } }, children),
35
72
  );
36
73
  });
37
- AlertComponent.displayName = 'Alert';
74
+ AlertWrapper.displayName = 'Alert.Wrapper';
38
75
  // ----------------------------------------------------------------------------
39
76
  // Alert.Icon component
40
77
  const AlertIcon = React.forwardRef((props, ref) => {
@@ -57,7 +94,7 @@ AlertMessage.displayName = 'Alert.Message';
57
94
  const AlertAction = React.forwardRef((props, ref) => {
58
95
  const { children, className, ...rest } = props;
59
96
  return React.createElement(
60
- Box,
97
+ ButtonBase,
61
98
  {
62
99
  as: !!props.href ? 'a' : 'button',
63
100
  className: cx('iui-alert-link', className),
@@ -88,17 +125,15 @@ AlertCloseButton.displayName = 'Alert.CloseButton';
88
125
  /**
89
126
  * A small box to quickly grab user attention and communicate a brief message
90
127
  * @example
91
- * <Alert>
92
- * <Alert.Message>This is an alert.</Alert.Message>
93
- * </Alert>
128
+ * <Alert>This is an alert.</Alert>
94
129
  * @example
95
- * <Alert type='informational'>
130
+ * <Alert.Wrapper type='informational'>
96
131
  * <Alert.Icon />
97
132
  * <Alert.Message>This is an informational alert.</Alert.Message>
98
133
  * <Alert.CloseButton onClick={() => {}} />
99
- * </Alert>
134
+ * </Alert.Wrapper>
100
135
  * @example
101
- * <Alert type='positive'>
136
+ * <Alert.Wrapper type='positive'>
102
137
  * <Alert.Icon>
103
138
  * <SvgSmileyHappy />
104
139
  * </Alert.Icon>
@@ -109,9 +144,13 @@ AlertCloseButton.displayName = 'Alert.CloseButton';
109
144
  * <Alert.CloseButton onClick={() => {}}>
110
145
  * <SvgCollapse />
111
146
  * </Alert.CloseButton>
112
- * </Alert>
147
+ * </Alert.Wrapper>
113
148
  */
114
149
  export const Alert = Object.assign(AlertComponent, {
150
+ /**
151
+ * Alert wrapper subcomponent
152
+ */
153
+ Wrapper: AlertWrapper,
115
154
  /**
116
155
  * Alert icon subcomponent
117
156
  */
@@ -5,6 +5,7 @@
5
5
  import * as React from 'react';
6
6
  import cx from 'classnames';
7
7
  import { useOverflow, useMergedRefs, Box } from '../utils/index.js';
8
+ import { FloatingDelayGroup } from '@floating-ui/react';
8
9
  /**
9
10
  * Group buttons together for common actions.
10
11
  * Handles responsive overflow when the `overflowButton` prop is specified.
@@ -56,42 +57,46 @@ export const ButtonGroup = React.forwardRef((props, ref) => {
56
57
  );
57
58
  const refs = useMergedRefs(overflowRef, ref);
58
59
  return React.createElement(
59
- Box,
60
- {
61
- className: cx(
62
- {
63
- 'iui-button-group': orientation === 'horizontal',
64
- 'iui-button-group-vertical': orientation === 'vertical',
65
- 'iui-button-group-overflow-x':
66
- !!overflowButton && orientation === 'horizontal',
67
- },
68
- className,
69
- ),
70
- ref: refs,
71
- ...rest,
72
- },
73
- (() => {
74
- if (!(visibleCount < items.length)) {
75
- return items;
76
- }
77
- const overflowStart =
78
- overflowPlacement === 'start'
79
- ? items.length - visibleCount
80
- : visibleCount - 1;
81
- return React.createElement(
82
- React.Fragment,
83
- null,
84
- overflowButton &&
85
- overflowPlacement === 'start' &&
86
- React.createElement('div', null, overflowButton(overflowStart)),
87
- overflowPlacement === 'start'
88
- ? items.slice(overflowStart + 1)
89
- : items.slice(0, Math.max(0, overflowStart)),
90
- overflowButton &&
91
- overflowPlacement === 'end' &&
92
- React.createElement('div', null, overflowButton(overflowStart)),
93
- );
94
- })(),
60
+ FloatingDelayGroup,
61
+ { delay: { open: 50, close: 250 } },
62
+ React.createElement(
63
+ Box,
64
+ {
65
+ className: cx(
66
+ {
67
+ 'iui-button-group': orientation === 'horizontal',
68
+ 'iui-button-group-vertical': orientation === 'vertical',
69
+ 'iui-button-group-overflow-x':
70
+ !!overflowButton && orientation === 'horizontal',
71
+ },
72
+ className,
73
+ ),
74
+ ref: refs,
75
+ ...rest,
76
+ },
77
+ (() => {
78
+ if (!(visibleCount < items.length)) {
79
+ return items;
80
+ }
81
+ const overflowStart =
82
+ overflowPlacement === 'start'
83
+ ? items.length - visibleCount
84
+ : visibleCount - 1;
85
+ return React.createElement(
86
+ React.Fragment,
87
+ null,
88
+ overflowButton &&
89
+ overflowPlacement === 'start' &&
90
+ React.createElement('div', null, overflowButton(overflowStart)),
91
+ overflowPlacement === 'start'
92
+ ? items.slice(overflowStart + 1)
93
+ : items.slice(0, Math.max(0, overflowStart)),
94
+ overflowButton &&
95
+ overflowPlacement === 'end' &&
96
+ React.createElement('div', null, overflowButton(overflowStart)),
97
+ );
98
+ })(),
99
+ ),
95
100
  );
96
101
  });
97
102
  export default ButtonGroup;
@@ -4,7 +4,8 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import cx from 'classnames';
6
6
  import * as React from 'react';
7
- import { VisuallyHidden, Popover, Box, ButtonBase } from '../../utils/index.js';
7
+ import { VisuallyHidden, Box, ButtonBase } from '../../utils/index.js';
8
+ import { Tooltip } from '../../Tooltip/Tooltip.js';
8
9
  /**
9
10
  * Icon button
10
11
  * @example
@@ -23,51 +24,35 @@ export const IconButton = React.forwardRef((props, ref) => {
23
24
  iconProps,
24
25
  ...rest
25
26
  } = props;
26
- return React.createElement(
27
- IconButtonTooltip,
28
- { label: label },
27
+ const button = React.createElement(
28
+ ButtonBase,
29
+ {
30
+ ref: ref,
31
+ className: cx('iui-button', className),
32
+ 'data-iui-variant': styleType !== 'default' ? styleType : undefined,
33
+ 'data-iui-size': size,
34
+ 'data-iui-active': isActive,
35
+ 'aria-pressed': isActive,
36
+ ...rest,
37
+ },
29
38
  React.createElement(
30
- ButtonBase,
39
+ Box,
31
40
  {
32
- ref: ref,
33
- className: cx('iui-button', className),
34
- 'data-iui-variant': styleType !== 'default' ? styleType : undefined,
35
- 'data-iui-size': size,
36
- 'data-iui-active': isActive,
37
- 'aria-pressed': isActive,
38
- ...rest,
41
+ as: 'span',
42
+ 'aria-hidden': true,
43
+ ...iconProps,
44
+ className: cx('iui-button-icon', iconProps?.className),
39
45
  },
40
- React.createElement(
41
- Box,
42
- {
43
- as: 'span',
44
- 'aria-hidden': true,
45
- ...iconProps,
46
- className: cx('iui-button-icon', iconProps?.className),
47
- },
48
- children,
49
- ),
50
- label ? React.createElement(VisuallyHidden, null, label) : null,
46
+ children,
51
47
  ),
48
+ label ? React.createElement(VisuallyHidden, null, label) : null,
52
49
  );
53
- });
54
- const IconButtonTooltip = (props) => {
55
- const { label, children } = props;
56
50
  return label
57
51
  ? React.createElement(
58
- Popover,
59
- {
60
- interactive: false,
61
- offset: [0, 4],
62
- aria: { content: null },
63
- content: React.createElement(
64
- Box,
65
- { 'aria-hidden': 'true', className: 'iui-tooltip' },
66
- label,
67
- ),
68
- },
69
- children,
52
+ Tooltip,
53
+ { content: label, ariaStrategy: 'none' },
54
+ button,
70
55
  )
71
- : children;
72
- };
56
+ : button;
57
+ });
73
58
  export default IconButton;
@@ -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
  *
@@ -43,6 +48,7 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
43
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
  {
@@ -65,6 +71,7 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
65
71
  onClick: onClick,
66
72
  ref: forwardedRef,
67
73
  ...rest,
74
+ labelProps: { id: labelId, ...props.labelProps },
68
75
  },
69
76
  children,
70
77
  ),
@@ -83,6 +90,7 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
83
90
  styleType: styleType,
84
91
  size: size,
85
92
  disabled: props.disabled,
93
+ 'aria-labelledby': props.labelProps?.id || labelId,
86
94
  ...menuButtonProps,
87
95
  },
88
96
  isMenuOpen