@itwin/itwinui-react 3.0.0-dev.6 → 3.0.0-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +101 -0
- package/cjs/core/Alert/Alert.d.ts +20 -9
- package/cjs/core/Alert/Alert.js +48 -10
- package/cjs/core/Avatar/Avatar.d.ts +3 -2
- package/cjs/core/Avatar/Avatar.js +21 -19
- package/cjs/core/AvatarGroup/AvatarGroup.js +3 -8
- package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
- package/cjs/core/Buttons/Button/Button.d.ts +15 -2
- package/cjs/core/Buttons/Button/Button.js +23 -9
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/cjs/core/Buttons/IconButton/IconButton.d.ts +5 -1
- package/cjs/core/Buttons/IconButton/IconButton.js +27 -38
- package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
- package/cjs/core/Buttons/SplitButton/SplitButton.js +25 -13
- package/cjs/core/Carousel/Carousel.d.ts +6 -4
- package/cjs/core/Carousel/Carousel.js +2 -2
- package/cjs/core/Carousel/CarouselDot.js +1 -3
- package/cjs/core/Carousel/CarouselNavigation.d.ts +6 -4
- package/cjs/core/ColorPicker/ColorBuilder.js +2 -1
- 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/ComboBoxInput.js +1 -1
- package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/cjs/core/ComboBox/ComboBoxMenu.js +5 -5
- 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 +47 -6
- package/cjs/core/Dialog/Dialog.js +10 -17
- package/cjs/core/Dialog/DialogContext.d.ts +3 -4
- package/cjs/core/Dialog/DialogMain.js +5 -5
- package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +39 -18
- package/cjs/core/FileUpload/FileUpload.d.ts +4 -0
- package/cjs/core/FileUpload/FileUpload.js +24 -3
- package/cjs/core/Header/HeaderBasicButton.js +3 -16
- package/cjs/core/Header/HeaderDropdownButton.js +1 -1
- package/cjs/core/Header/HeaderSplitButton.js +3 -4
- 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/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/cjs/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/cjs/core/SearchBox/SearchBox.js +1 -1
- package/cjs/core/Select/Select.d.ts +4 -0
- package/cjs/core/Select/Select.js +12 -11
- package/cjs/core/SideNavigation/SideNavigation.d.ts +16 -0
- package/cjs/core/SideNavigation/SideNavigation.js +42 -9
- package/cjs/core/Slider/Slider.d.ts +24 -0
- package/cjs/core/Slider/Slider.js +58 -10
- package/cjs/core/Slider/Thumb.js +3 -2
- package/cjs/core/Slider/Track.d.ts +1 -1
- package/cjs/core/Slider/Track.js +17 -6
- package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/cjs/core/StatusMessage/StatusMessage.js +23 -9
- package/cjs/core/Stepper/Stepper.d.ts +26 -1
- package/cjs/core/Stepper/Stepper.js +35 -6
- package/cjs/core/Stepper/StepperStep.d.ts +17 -0
- package/cjs/core/Stepper/StepperStep.js +33 -8
- package/cjs/core/Stepper/WorkflowDiagram.d.ts +11 -1
- package/cjs/core/Stepper/WorkflowDiagram.js +23 -10
- package/cjs/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
- package/cjs/core/Stepper/WorkflowDiagramStep.js +9 -2
- package/cjs/core/Table/SubRowExpander.js +3 -1
- package/cjs/core/Table/Table.js +0 -1
- package/cjs/core/Table/TableCell.js +1 -1
- package/cjs/core/Table/TablePaginator.js +1 -3
- 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/Tabs/Tab.js +1 -2
- package/cjs/core/Textarea/Textarea.d.ts +7 -1
- package/cjs/core/Textarea/Textarea.js +6 -11
- package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +23 -3
- package/cjs/core/ThemeProvider/ThemeProvider.js +56 -23
- package/cjs/core/Tile/Tile.d.ts +142 -17
- package/cjs/core/Tile/Tile.js +107 -16
- package/cjs/core/Toast/Toast.d.ts +12 -4
- package/cjs/core/Toast/Toast.js +24 -13
- package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
- package/cjs/core/Tooltip/Tooltip.js +116 -118
- package/cjs/core/TransferList/TransferList.js +4 -12
- package/cjs/core/Tree/TreeNode.js +1 -1
- package/cjs/core/index.d.ts +2 -0
- package/cjs/core/index.js +20 -4
- package/cjs/core/utils/components/ButtonBase.d.ts +14 -0
- package/cjs/core/utils/components/ButtonBase.js +46 -0
- 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/Popover.js +5 -3
- package/cjs/core/utils/components/Portal.d.ts +27 -0
- package/cjs/core/utils/components/Portal.js +43 -0
- package/cjs/core/utils/components/VirtualScroll.js +4 -4
- package/cjs/core/utils/components/index.d.ts +2 -0
- package/cjs/core/utils/components/index.js +2 -0
- package/cjs/core/utils/functions/colors.d.ts +1 -1
- package/cjs/core/utils/functions/colors.js +1 -13
- 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 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
- package/cjs/core/utils/hooks/useControlledState.js +39 -0
- package/cjs/core/utils/hooks/useGlobals.d.ts +1 -1
- package/cjs/styles.js +11 -35
- package/esm/core/Alert/Alert.d.ts +20 -9
- package/esm/core/Alert/Alert.js +49 -10
- package/esm/core/Avatar/Avatar.d.ts +3 -2
- package/esm/core/Avatar/Avatar.js +21 -17
- package/esm/core/AvatarGroup/AvatarGroup.js +3 -8
- package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
- package/esm/core/Buttons/Button/Button.d.ts +15 -2
- package/esm/core/Buttons/Button/Button.js +18 -10
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/esm/core/Buttons/IconButton/IconButton.d.ts +5 -1
- package/esm/core/Buttons/IconButton/IconButton.js +25 -37
- package/esm/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
- package/esm/core/Buttons/SplitButton/SplitButton.js +31 -14
- package/esm/core/Carousel/Carousel.d.ts +6 -4
- package/esm/core/Carousel/Carousel.js +8 -3
- package/esm/core/Carousel/CarouselDot.js +2 -4
- package/esm/core/Carousel/CarouselNavigation.d.ts +6 -4
- package/esm/core/ColorPicker/ColorBuilder.js +2 -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/ComboBoxInput.js +1 -1
- package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/esm/core/ComboBox/ComboBoxMenu.js +5 -5
- 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 +33 -6
- package/esm/core/Dialog/Dialog.js +11 -23
- package/esm/core/Dialog/DialogContext.d.ts +3 -4
- package/esm/core/Dialog/DialogMain.js +5 -5
- package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/esm/core/ExpandableBlock/ExpandableBlock.js +41 -20
- package/esm/core/FileUpload/FileUpload.d.ts +4 -0
- package/esm/core/FileUpload/FileUpload.js +26 -3
- package/esm/core/Header/HeaderBasicButton.js +4 -17
- package/esm/core/Header/HeaderDropdownButton.js +1 -1
- package/esm/core/Header/HeaderSplitButton.js +9 -5
- 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/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/esm/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/esm/core/SearchBox/SearchBox.js +1 -1
- package/esm/core/Select/Select.d.ts +4 -0
- package/esm/core/Select/Select.js +12 -11
- package/esm/core/SideNavigation/SideNavigation.d.ts +16 -0
- package/esm/core/SideNavigation/SideNavigation.js +33 -9
- package/esm/core/Slider/Slider.d.ts +24 -0
- package/esm/core/Slider/Slider.js +43 -10
- package/esm/core/Slider/Thumb.js +3 -2
- package/esm/core/Slider/Track.d.ts +1 -1
- package/esm/core/Slider/Track.js +14 -6
- package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/esm/core/StatusMessage/StatusMessage.js +23 -16
- package/esm/core/Stepper/Stepper.d.ts +26 -1
- package/esm/core/Stepper/Stepper.js +32 -6
- package/esm/core/Stepper/StepperStep.d.ts +17 -0
- package/esm/core/Stepper/StepperStep.js +27 -8
- package/esm/core/Stepper/WorkflowDiagram.d.ts +11 -1
- package/esm/core/Stepper/WorkflowDiagram.js +10 -7
- package/esm/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
- package/esm/core/Stepper/WorkflowDiagramStep.js +6 -2
- package/esm/core/Table/SubRowExpander.js +3 -1
- package/esm/core/Table/Table.js +0 -1
- package/esm/core/Table/TableCell.js +1 -1
- package/esm/core/Table/TablePaginator.js +2 -3
- 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/Tabs/Tab.js +2 -3
- package/esm/core/Textarea/Textarea.d.ts +7 -1
- package/esm/core/Textarea/Textarea.js +6 -11
- package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +23 -3
- package/esm/core/ThemeProvider/ThemeProvider.js +65 -24
- package/esm/core/Tile/Tile.d.ts +142 -17
- package/esm/core/Tile/Tile.js +107 -16
- package/esm/core/Toast/Toast.d.ts +12 -4
- package/esm/core/Toast/Toast.js +26 -13
- 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/Tree/TreeNode.js +1 -1
- package/esm/core/index.d.ts +2 -0
- package/esm/core/index.js +2 -0
- package/esm/core/utils/components/ButtonBase.d.ts +14 -0
- package/esm/core/utils/components/ButtonBase.js +42 -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/Popover.js +5 -3
- package/esm/core/utils/components/Portal.d.ts +27 -0
- package/esm/core/utils/components/Portal.js +36 -0
- package/esm/core/utils/components/VirtualScroll.js +4 -4
- package/esm/core/utils/components/index.d.ts +2 -0
- package/esm/core/utils/components/index.js +2 -0
- package/esm/core/utils/functions/colors.d.ts +1 -1
- package/esm/core/utils/functions/colors.js +1 -13
- 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 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
- package/esm/core/utils/hooks/useControlledState.js +34 -0
- package/esm/core/utils/hooks/useGlobals.d.ts +1 -1
- package/esm/styles.js +11 -35
- package/package.json +3 -3
- package/styles.css +49 -46
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { useOverflow, useMergedRefs, Box } from '../utils/index.js';
|
|
8
|
+
import { FloatingDelayGroup } from '@floating-ui/react';
|
|
8
9
|
/**
|
|
9
10
|
* Group buttons together for common actions.
|
|
10
11
|
* Handles responsive overflow when the `overflowButton` prop is specified.
|
|
@@ -56,42 +57,46 @@ export const ButtonGroup = React.forwardRef((props, ref) => {
|
|
|
56
57
|
);
|
|
57
58
|
const refs = useMergedRefs(overflowRef, ref);
|
|
58
59
|
return React.createElement(
|
|
59
|
-
|
|
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;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
{
|
|
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',
|
|
50
|
+
children && React.createElement('span', { ...labelProps }, children),
|
|
48
51
|
endIcon &&
|
|
49
52
|
React.createElement(
|
|
50
53
|
Box,
|
|
51
|
-
{
|
|
54
|
+
{
|
|
55
|
+
as: 'span',
|
|
56
|
+
'aria-hidden': true,
|
|
57
|
+
...endIconProps,
|
|
58
|
+
className: cx('iui-button-icon', endIconProps?.className),
|
|
59
|
+
},
|
|
52
60
|
endIcon,
|
|
53
61
|
),
|
|
54
62
|
);
|
|
@@ -52,7 +52,7 @@ export const DropdownButton = React.forwardRef((props, ref) => {
|
|
|
52
52
|
setIsMenuOpen(false);
|
|
53
53
|
dropdownMenuProps?.onHide?.(i);
|
|
54
54
|
},
|
|
55
|
-
style: {
|
|
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
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Passes props to IconButton icon.
|
|
16
|
+
*/
|
|
17
|
+
iconProps?: React.ComponentProps<'span'>;
|
|
18
|
+
} & Omit<ButtonProps, 'startIcon' | 'endIcon' | 'startIconProps' | 'endIconProps' | 'labelProps'>;
|
|
15
19
|
/**
|
|
16
20
|
* Icon button
|
|
17
21
|
* @example
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import { VisuallyHidden,
|
|
7
|
+
import { VisuallyHidden, Box, ButtonBase } from '../../utils/index.js';
|
|
8
|
+
import { Tooltip } from '../../Tooltip/Tooltip.js';
|
|
8
9
|
/**
|
|
9
10
|
* Icon button
|
|
10
11
|
* @example
|
|
@@ -18,53 +19,40 @@ export const IconButton = React.forwardRef((props, ref) => {
|
|
|
18
19
|
children,
|
|
19
20
|
styleType = 'default',
|
|
20
21
|
size,
|
|
21
|
-
type = 'button',
|
|
22
22
|
className,
|
|
23
23
|
label,
|
|
24
|
+
iconProps,
|
|
24
25
|
...rest
|
|
25
26
|
} = props;
|
|
26
|
-
|
|
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
|
-
as: '
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
'
|
|
36
|
-
'data-iui-size': size,
|
|
37
|
-
'data-iui-active': isActive,
|
|
38
|
-
'aria-pressed': isActive,
|
|
39
|
-
type: type,
|
|
40
|
-
...rest,
|
|
41
|
+
as: 'span',
|
|
42
|
+
'aria-hidden': true,
|
|
43
|
+
...iconProps,
|
|
44
|
+
className: cx('iui-button-icon', iconProps?.className),
|
|
41
45
|
},
|
|
42
|
-
|
|
43
|
-
Box,
|
|
44
|
-
{ as: 'span', className: 'iui-button-icon', 'aria-hidden': true },
|
|
45
|
-
children,
|
|
46
|
-
),
|
|
47
|
-
label ? React.createElement(VisuallyHidden, null, label) : null,
|
|
46
|
+
children,
|
|
48
47
|
),
|
|
48
|
+
label ? React.createElement(VisuallyHidden, null, label) : null,
|
|
49
49
|
);
|
|
50
|
-
});
|
|
51
|
-
const IconButtonTooltip = (props) => {
|
|
52
|
-
const { label, children } = props;
|
|
53
50
|
return label
|
|
54
51
|
? React.createElement(
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
offset: [0, 4],
|
|
59
|
-
aria: { content: null },
|
|
60
|
-
content: React.createElement(
|
|
61
|
-
Box,
|
|
62
|
-
{ 'aria-hidden': 'true', className: 'iui-tooltip' },
|
|
63
|
-
label,
|
|
64
|
-
),
|
|
65
|
-
},
|
|
66
|
-
children,
|
|
52
|
+
Tooltip,
|
|
53
|
+
{ content: label, ariaStrategy: 'none' },
|
|
54
|
+
button,
|
|
67
55
|
)
|
|
68
|
-
:
|
|
69
|
-
};
|
|
56
|
+
: button;
|
|
57
|
+
});
|
|
70
58
|
export default IconButton;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { ButtonProps } from '../Button/Button.js';
|
|
3
|
+
import { IconButton } from '../IconButton/index.js';
|
|
3
4
|
import type { Placement } from 'tippy.js';
|
|
4
5
|
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
5
6
|
export type SplitButtonProps = ButtonProps & {
|
|
@@ -18,6 +19,14 @@ export type SplitButtonProps = ButtonProps & {
|
|
|
18
19
|
* Content of primary button.
|
|
19
20
|
*/
|
|
20
21
|
children: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Passes props to SplitButton wrapper.
|
|
24
|
+
*/
|
|
25
|
+
wrapperProps?: React.ComponentProps<'div'>;
|
|
26
|
+
/**
|
|
27
|
+
* Passes props to SplitButton menu button.
|
|
28
|
+
*/
|
|
29
|
+
menuButtonProps?: React.ComponentProps<typeof IconButton>;
|
|
21
30
|
};
|
|
22
31
|
/**
|
|
23
32
|
* Split button component with a DropdownMenu.
|
|
@@ -7,7 +7,12 @@ import * as React from 'react';
|
|
|
7
7
|
import { Button } from '../Button/index.js';
|
|
8
8
|
import { IconButton } from '../IconButton/index.js';
|
|
9
9
|
import { DropdownMenu } from '../../DropdownMenu/index.js';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
Box,
|
|
12
|
+
SvgCaretDownSmall,
|
|
13
|
+
SvgCaretUpSmall,
|
|
14
|
+
useId,
|
|
15
|
+
} from '../../utils/index.js';
|
|
11
16
|
/**
|
|
12
17
|
* Split button component with a DropdownMenu.
|
|
13
18
|
*
|
|
@@ -31,36 +36,42 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
|
|
|
31
36
|
styleType = 'default',
|
|
32
37
|
size,
|
|
33
38
|
children,
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
wrapperProps,
|
|
40
|
+
menuButtonProps,
|
|
36
41
|
...rest
|
|
37
42
|
} = props;
|
|
38
43
|
const [isMenuOpen, setIsMenuOpen] = React.useState(false);
|
|
39
44
|
const [menuWidth, setMenuWidth] = React.useState(0);
|
|
40
|
-
const
|
|
45
|
+
const wrapperRef = React.useRef(null);
|
|
41
46
|
React.useEffect(() => {
|
|
42
|
-
if (
|
|
43
|
-
setMenuWidth(
|
|
47
|
+
if (wrapperRef.current) {
|
|
48
|
+
setMenuWidth(wrapperRef.current.offsetWidth);
|
|
44
49
|
}
|
|
45
50
|
}, [children, size]);
|
|
51
|
+
const labelId = useId();
|
|
46
52
|
return React.createElement(
|
|
47
53
|
Box,
|
|
48
54
|
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
...wrapperProps,
|
|
56
|
+
className: cx(
|
|
57
|
+
'iui-button-split',
|
|
58
|
+
{
|
|
59
|
+
'iui-disabled': props.disabled,
|
|
60
|
+
},
|
|
61
|
+
wrapperProps?.className,
|
|
62
|
+
),
|
|
63
|
+
ref: wrapperRef,
|
|
55
64
|
},
|
|
56
65
|
React.createElement(
|
|
57
66
|
Button,
|
|
58
67
|
{
|
|
68
|
+
className: className,
|
|
59
69
|
styleType: styleType,
|
|
60
70
|
size: size,
|
|
61
71
|
onClick: onClick,
|
|
62
72
|
ref: forwardedRef,
|
|
63
73
|
...rest,
|
|
74
|
+
labelProps: { id: labelId, ...props.labelProps },
|
|
64
75
|
},
|
|
65
76
|
children,
|
|
66
77
|
),
|
|
@@ -69,13 +80,19 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
|
|
|
69
80
|
{
|
|
70
81
|
placement: menuPlacement,
|
|
71
82
|
menuItems: menuItems,
|
|
72
|
-
style: {
|
|
83
|
+
style: { minInlineSize: menuWidth },
|
|
73
84
|
onShow: React.useCallback(() => setIsMenuOpen(true), []),
|
|
74
85
|
onHide: React.useCallback(() => setIsMenuOpen(false), []),
|
|
75
86
|
},
|
|
76
87
|
React.createElement(
|
|
77
88
|
IconButton,
|
|
78
|
-
{
|
|
89
|
+
{
|
|
90
|
+
styleType: styleType,
|
|
91
|
+
size: size,
|
|
92
|
+
disabled: props.disabled,
|
|
93
|
+
'aria-labelledby': props.labelProps?.id || labelId,
|
|
94
|
+
...menuButtonProps,
|
|
95
|
+
},
|
|
79
96
|
isMenuOpen
|
|
80
97
|
? React.createElement(SvgCaretUpSmall, null)
|
|
81
98
|
: React.createElement(SvgCaretDownSmall, null),
|
|
@@ -38,18 +38,20 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
|
|
|
38
38
|
Navigation: PolymorphicForwardRefComponent<"nav", {}> & {
|
|
39
39
|
PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
40
40
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
41
|
-
}, "label" | "as" | "size" | "styleType" | "isActive"> & {
|
|
41
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "isActive" | "iconProps"> & {
|
|
42
42
|
isActive?: boolean | undefined;
|
|
43
43
|
label?: React.ReactNode;
|
|
44
|
-
|
|
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
|
-
|
|
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 {
|
|
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 =
|
|
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 {
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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);
|