@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.
- package/CHANGELOG.md +56 -0
- package/cjs/core/Alert/Alert.d.ts +20 -9
- package/cjs/core/Alert/Alert.js +48 -10
- package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
- package/cjs/core/Buttons/IconButton/IconButton.js +27 -44
- package/cjs/core/Buttons/SplitButton/SplitButton.js +3 -0
- package/cjs/core/ColorPicker/ColorInputPanel.js +172 -231
- package/cjs/core/ComboBox/ComboBox.js +3 -3
- package/cjs/core/ComboBox/ComboBoxDropdown.js +4 -9
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +3 -22
- package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +8 -6
- package/cjs/core/ComboBox/helpers.d.ts +1 -2
- package/cjs/core/DatePicker/DatePicker.d.ts +30 -8
- package/cjs/core/DatePicker/DatePicker.js +40 -5
- package/cjs/core/Dialog/Dialog.js +10 -16
- package/cjs/core/Dialog/DialogContext.d.ts +3 -4
- package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +38 -15
- package/cjs/core/Header/HeaderSplitButton.js +1 -0
- package/cjs/core/Input/Input.d.ts +4 -0
- package/cjs/core/Input/Input.js +2 -1
- package/cjs/core/InputGrid/InputGrid.d.ts +25 -0
- package/cjs/core/InputGrid/InputGrid.js +39 -0
- package/cjs/core/InputGrid/index.d.ts +3 -0
- package/cjs/core/InputGrid/index.js +15 -0
- package/cjs/core/InputGroup/InputGroup.d.ts +13 -0
- package/cjs/core/InputGroup/InputGroup.js +35 -9
- package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
- package/cjs/core/InputWithDecorations/InputWithDecorations.js +81 -0
- package/cjs/core/InputWithDecorations/index.d.ts +3 -0
- package/cjs/core/InputWithDecorations/index.js +15 -0
- package/cjs/core/Label/Label.d.ts +5 -0
- package/cjs/core/Label/Label.js +2 -0
- package/cjs/core/LabeledInput/LabeledInput.d.ts +22 -16
- package/cjs/core/LabeledInput/LabeledInput.js +52 -29
- package/cjs/core/LabeledSelect/LabeledSelect.d.ts +17 -7
- package/cjs/core/LabeledSelect/LabeledSelect.js +36 -17
- package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +12 -45
- package/cjs/core/Menu/Menu.d.ts +1 -1
- package/cjs/core/Menu/Menu.js +1 -1
- package/cjs/core/Menu/MenuDivider.d.ts +2 -1
- package/cjs/core/Menu/MenuDivider.js +1 -1
- package/cjs/core/Menu/MenuItem.d.ts +1 -1
- package/cjs/core/Menu/MenuItem.js +1 -0
- package/cjs/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
- package/cjs/core/SearchBox/SearchBox.js +1 -1
- package/cjs/core/Select/Select.d.ts +4 -0
- package/cjs/core/Select/Select.js +10 -9
- package/cjs/core/SideNavigation/SideNavigation.js +2 -0
- package/cjs/core/Slider/Thumb.js +1 -0
- package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/cjs/core/StatusMessage/StatusMessage.js +23 -9
- package/cjs/core/Table/SubRowExpander.js +2 -0
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +46 -18
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/cjs/core/Textarea/Textarea.d.ts +7 -1
- package/cjs/core/Textarea/Textarea.js +6 -11
- package/cjs/core/ThemeProvider/ThemeProvider.js +1 -1
- package/cjs/core/Tile/Tile.d.ts +139 -15
- package/cjs/core/Tile/Tile.js +107 -16
- package/cjs/core/Toast/Toast.d.ts +12 -4
- package/cjs/core/Toast/Toast.js +20 -4
- package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
- package/cjs/core/Tooltip/Tooltip.js +116 -117
- package/cjs/core/TransferList/TransferList.js +4 -12
- package/cjs/core/index.d.ts +2 -0
- package/cjs/core/index.js +20 -4
- package/cjs/core/utils/components/Icon.d.ts +5 -0
- package/cjs/core/utils/components/Icon.js +8 -1
- package/cjs/core/utils/components/InputContainer.d.ts +0 -1
- package/cjs/core/utils/components/InputContainer.js +14 -34
- package/cjs/core/utils/components/InputFlexContainer.d.ts +1 -0
- package/cjs/core/utils/components/InputFlexContainer.js +3 -1
- package/cjs/core/utils/components/Portal.d.ts +27 -0
- package/cjs/core/utils/components/Portal.js +43 -0
- package/cjs/core/utils/components/index.d.ts +1 -0
- package/cjs/core/utils/components/index.js +1 -0
- package/cjs/core/utils/functions/index.d.ts +1 -0
- package/cjs/core/utils/functions/index.js +1 -0
- package/cjs/core/utils/functions/react.d.ts +8 -0
- package/cjs/core/utils/functions/react.js +40 -0
- package/cjs/core/utils/hooks/index.d.ts +1 -1
- package/cjs/core/utils/hooks/index.js +1 -1
- package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
- package/cjs/core/utils/hooks/useControlledState.js +39 -0
- package/cjs/styles.js +10 -28
- package/esm/core/Alert/Alert.d.ts +20 -9
- package/esm/core/Alert/Alert.js +49 -10
- package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
- package/esm/core/Buttons/IconButton/IconButton.js +25 -40
- package/esm/core/Buttons/SplitButton/SplitButton.js +9 -1
- package/esm/core/ColorPicker/ColorInputPanel.js +173 -232
- package/esm/core/ComboBox/ComboBox.js +3 -3
- package/esm/core/ComboBox/ComboBoxDropdown.js +4 -9
- package/esm/core/ComboBox/ComboBoxEndIcon.js +4 -25
- package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/esm/core/ComboBox/ComboBoxMenuItem.js +9 -7
- package/esm/core/ComboBox/helpers.d.ts +1 -2
- package/esm/core/DatePicker/DatePicker.d.ts +30 -8
- package/esm/core/DatePicker/DatePicker.js +25 -5
- package/esm/core/Dialog/Dialog.js +11 -23
- package/esm/core/Dialog/DialogContext.d.ts +3 -4
- package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/esm/core/ExpandableBlock/ExpandableBlock.js +39 -17
- package/esm/core/Header/HeaderSplitButton.js +1 -0
- package/esm/core/Input/Input.d.ts +4 -0
- package/esm/core/Input/Input.js +2 -1
- package/esm/core/InputGrid/InputGrid.d.ts +25 -0
- package/esm/core/InputGrid/InputGrid.js +35 -0
- package/esm/core/InputGrid/index.d.ts +3 -0
- package/esm/core/InputGrid/index.js +6 -0
- package/esm/core/InputGroup/InputGroup.d.ts +13 -0
- package/esm/core/InputGroup/InputGroup.js +34 -10
- package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
- package/esm/core/InputWithDecorations/InputWithDecorations.js +80 -0
- package/esm/core/InputWithDecorations/index.d.ts +3 -0
- package/esm/core/InputWithDecorations/index.js +6 -0
- package/esm/core/Label/Label.d.ts +5 -0
- package/esm/core/Label/Label.js +2 -0
- package/esm/core/LabeledInput/LabeledInput.d.ts +22 -16
- package/esm/core/LabeledInput/LabeledInput.js +53 -29
- package/esm/core/LabeledSelect/LabeledSelect.d.ts +17 -7
- package/esm/core/LabeledSelect/LabeledSelect.js +37 -18
- package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
- package/esm/core/LabeledTextarea/LabeledTextarea.js +14 -45
- package/esm/core/Menu/Menu.d.ts +1 -1
- package/esm/core/Menu/Menu.js +1 -1
- package/esm/core/Menu/MenuDivider.d.ts +2 -1
- package/esm/core/Menu/MenuDivider.js +1 -1
- package/esm/core/Menu/MenuItem.d.ts +1 -1
- package/esm/core/Menu/MenuItem.js +1 -0
- package/esm/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/esm/core/Menu/MenuItemSkeleton.js +0 -1
- package/esm/core/SearchBox/SearchBox.js +1 -1
- package/esm/core/Select/Select.d.ts +4 -0
- package/esm/core/Select/Select.js +10 -9
- package/esm/core/SideNavigation/SideNavigation.js +2 -0
- package/esm/core/Slider/Thumb.js +1 -0
- package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/esm/core/StatusMessage/StatusMessage.js +23 -16
- package/esm/core/Table/SubRowExpander.js +2 -0
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +45 -17
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/esm/core/Textarea/Textarea.d.ts +7 -1
- package/esm/core/Textarea/Textarea.js +6 -11
- package/esm/core/ThemeProvider/ThemeProvider.js +4 -3
- package/esm/core/Tile/Tile.d.ts +139 -15
- package/esm/core/Tile/Tile.js +107 -16
- package/esm/core/Toast/Toast.d.ts +12 -4
- package/esm/core/Toast/Toast.js +21 -4
- package/esm/core/Tooltip/Tooltip.d.ts +35 -28
- package/esm/core/Tooltip/Tooltip.js +119 -116
- package/esm/core/TransferList/TransferList.js +4 -9
- package/esm/core/index.d.ts +2 -0
- package/esm/core/index.js +2 -0
- package/esm/core/utils/components/Icon.d.ts +5 -0
- package/esm/core/utils/components/Icon.js +8 -1
- package/esm/core/utils/components/InputContainer.d.ts +0 -1
- package/esm/core/utils/components/InputContainer.js +14 -30
- package/esm/core/utils/components/InputFlexContainer.d.ts +1 -0
- package/esm/core/utils/components/InputFlexContainer.js +3 -1
- package/esm/core/utils/components/Portal.d.ts +27 -0
- package/esm/core/utils/components/Portal.js +36 -0
- package/esm/core/utils/components/index.d.ts +1 -0
- package/esm/core/utils/components/index.js +1 -0
- package/esm/core/utils/functions/index.d.ts +1 -0
- package/esm/core/utils/functions/index.js +1 -0
- package/esm/core/utils/functions/react.d.ts +8 -0
- package/esm/core/utils/functions/react.js +35 -0
- package/esm/core/utils/hooks/index.d.ts +1 -1
- package/esm/core/utils/hooks/index.js +1 -1
- package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
- package/esm/core/utils/hooks/useControlledState.js +34 -0
- package/esm/styles.js +10 -28
- package/package.json +3 -3
- package/styles.css +22 -19
- package/cjs/core/utils/hooks/useUncontrolledState.d.ts +0 -6
- package/cjs/core/utils/hooks/useUncontrolledState.js +0 -18
- package/esm/core/utils/hooks/useUncontrolledState.d.ts +0 -6
- package/esm/core/utils/hooks/useUncontrolledState.js +0 -13
package/esm/core/Alert/Alert.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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,
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
{
|
|
27
|
+
const button = React.createElement(
|
|
28
|
+
ButtonBase,
|
|
29
|
+
{
|
|
30
|
+
ref: ref,
|
|
31
|
+
className: cx('iui-button', className),
|
|
32
|
+
'data-iui-variant': styleType !== 'default' ? styleType : undefined,
|
|
33
|
+
'data-iui-size': size,
|
|
34
|
+
'data-iui-active': isActive,
|
|
35
|
+
'aria-pressed': isActive,
|
|
36
|
+
...rest,
|
|
37
|
+
},
|
|
29
38
|
React.createElement(
|
|
30
|
-
|
|
39
|
+
Box,
|
|
31
40
|
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
'
|
|
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
|
-
|
|
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
|
-
|
|
59
|
-
{
|
|
60
|
-
|
|
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
|
-
:
|
|
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 {
|
|
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
|