@itwin/itwinui-react 3.0.0-dev.6 → 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.
- package/CHANGELOG.md +45 -0
- 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/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 +11 -5
- package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
- package/cjs/core/Buttons/SplitButton/SplitButton.js +22 -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/ComboBox/ComboBoxInput.js +1 -1
- package/cjs/core/ComboBox/ComboBoxMenu.js +5 -5
- package/cjs/core/DatePicker/DatePicker.js +7 -1
- package/cjs/core/Dialog/Dialog.js +1 -2
- package/cjs/core/Dialog/DialogMain.js +5 -5
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +1 -3
- 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 +2 -4
- package/cjs/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/cjs/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/cjs/core/Select/Select.js +2 -2
- package/cjs/core/SideNavigation/SideNavigation.d.ts +16 -0
- package/cjs/core/SideNavigation/SideNavigation.js +40 -9
- package/cjs/core/Slider/Slider.d.ts +24 -0
- package/cjs/core/Slider/Slider.js +58 -10
- package/cjs/core/Slider/Thumb.js +2 -2
- package/cjs/core/Slider/Track.d.ts +1 -1
- package/cjs/core/Slider/Track.js +17 -6
- 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 +1 -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/Tabs/Tab.js +1 -2
- 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 +3 -2
- package/cjs/core/Toast/Toast.js +4 -9
- package/cjs/core/Tooltip/Tooltip.d.ts +1 -1
- package/cjs/core/Tooltip/Tooltip.js +1 -2
- package/cjs/core/Tree/TreeNode.js +1 -1
- package/cjs/core/utils/components/ButtonBase.d.ts +14 -0
- package/cjs/core/utils/components/ButtonBase.js +46 -0
- package/cjs/core/utils/components/Popover.js +5 -3
- package/cjs/core/utils/components/VirtualScroll.js +4 -4
- package/cjs/core/utils/components/index.d.ts +1 -0
- package/cjs/core/utils/components/index.js +1 -0
- package/cjs/core/utils/functions/colors.d.ts +1 -1
- package/cjs/core/utils/functions/colors.js +1 -13
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useGlobals.d.ts +1 -1
- package/cjs/core/utils/hooks/useUncontrolledState.d.ts +6 -0
- package/cjs/core/utils/hooks/useUncontrolledState.js +18 -0
- package/cjs/styles.js +3 -9
- 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/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 +9 -6
- package/esm/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
- package/esm/core/Buttons/SplitButton/SplitButton.js +22 -13
- 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/ComboBox/ComboBoxInput.js +1 -1
- package/esm/core/ComboBox/ComboBoxMenu.js +5 -5
- package/esm/core/DatePicker/DatePicker.js +8 -1
- package/esm/core/Dialog/Dialog.js +1 -1
- package/esm/core/Dialog/DialogMain.js +5 -5
- package/esm/core/ExpandableBlock/ExpandableBlock.js +2 -3
- 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 +8 -5
- package/esm/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/esm/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/esm/core/Select/Select.js +2 -2
- package/esm/core/SideNavigation/SideNavigation.d.ts +16 -0
- package/esm/core/SideNavigation/SideNavigation.js +31 -9
- package/esm/core/Slider/Slider.d.ts +24 -0
- package/esm/core/Slider/Slider.js +43 -10
- package/esm/core/Slider/Thumb.js +2 -2
- package/esm/core/Slider/Track.d.ts +1 -1
- package/esm/core/Slider/Track.js +14 -6
- 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 +1 -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/Tabs/Tab.js +2 -3
- package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +23 -3
- package/esm/core/ThemeProvider/ThemeProvider.js +64 -24
- package/esm/core/Tile/Tile.d.ts +3 -2
- package/esm/core/Toast/Toast.js +5 -9
- package/esm/core/Tooltip/Tooltip.d.ts +1 -1
- package/esm/core/Tooltip/Tooltip.js +1 -1
- package/esm/core/Tree/TreeNode.js +1 -1
- package/esm/core/utils/components/ButtonBase.d.ts +14 -0
- package/esm/core/utils/components/ButtonBase.js +42 -0
- package/esm/core/utils/components/Popover.js +5 -3
- package/esm/core/utils/components/VirtualScroll.js +4 -4
- package/esm/core/utils/components/index.d.ts +1 -0
- package/esm/core/utils/components/index.js +1 -0
- package/esm/core/utils/functions/colors.d.ts +1 -1
- package/esm/core/utils/functions/colors.js +1 -13
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useGlobals.d.ts +1 -1
- package/esm/core/utils/hooks/useUncontrolledState.d.ts +6 -0
- package/esm/core/utils/hooks/useUncontrolledState.js +13 -0
- package/esm/styles.js +3 -9
- package/package.json +2 -2
- package/styles.css +37 -37
|
@@ -17,7 +17,14 @@ const index_js_1 = require('../utils/index.js');
|
|
|
17
17
|
* <FileUpload dragContent='Drop file here' onFileDropped={console.log}><Textarea /></FileUpload>
|
|
18
18
|
*/
|
|
19
19
|
exports.FileUpload = React.forwardRef((props, ref) => {
|
|
20
|
-
const {
|
|
20
|
+
const {
|
|
21
|
+
dragContent,
|
|
22
|
+
children,
|
|
23
|
+
onFileDropped,
|
|
24
|
+
className,
|
|
25
|
+
contentProps,
|
|
26
|
+
...rest
|
|
27
|
+
} = props;
|
|
21
28
|
const [isDragActive, setIsDragActive] = React.useState(false);
|
|
22
29
|
const fileUploadRef = React.useRef(null);
|
|
23
30
|
const refs = (0, index_js_1.useMergedRefs)(fileUploadRef, ref);
|
|
@@ -68,13 +75,27 @@ exports.FileUpload = React.forwardRef((props, ref) => {
|
|
|
68
75
|
? children
|
|
69
76
|
: React.createElement(
|
|
70
77
|
index_js_1.Box,
|
|
71
|
-
{
|
|
78
|
+
{
|
|
79
|
+
as: 'div',
|
|
80
|
+
...contentProps,
|
|
81
|
+
className: (0, classnames_1.default)(
|
|
82
|
+
'iui-content',
|
|
83
|
+
contentProps?.className,
|
|
84
|
+
),
|
|
85
|
+
},
|
|
72
86
|
children,
|
|
73
87
|
),
|
|
74
88
|
dragContent &&
|
|
75
89
|
React.createElement(
|
|
76
90
|
index_js_1.Box,
|
|
77
|
-
{
|
|
91
|
+
{
|
|
92
|
+
as: 'div',
|
|
93
|
+
...contentProps,
|
|
94
|
+
className: (0, classnames_1.default)(
|
|
95
|
+
'iui-content',
|
|
96
|
+
contentProps?.className,
|
|
97
|
+
),
|
|
98
|
+
},
|
|
78
99
|
dragContent,
|
|
79
100
|
),
|
|
80
101
|
);
|
|
@@ -10,31 +10,18 @@ const classnames_1 = tslib_1.__importDefault(require('classnames'));
|
|
|
10
10
|
const React = tslib_1.__importStar(require('react'));
|
|
11
11
|
const index_js_1 = require('../utils/index.js');
|
|
12
12
|
exports.HeaderBasicButton = React.forwardRef((props, ref) => {
|
|
13
|
-
const {
|
|
14
|
-
|
|
15
|
-
className,
|
|
16
|
-
children,
|
|
17
|
-
style,
|
|
18
|
-
startIcon,
|
|
19
|
-
endIcon,
|
|
20
|
-
styleType,
|
|
21
|
-
size,
|
|
22
|
-
...rest
|
|
23
|
-
} = props;
|
|
13
|
+
const { className, children, startIcon, endIcon, styleType, size, ...rest } =
|
|
14
|
+
props;
|
|
24
15
|
styleType; // To omit and prevent eslint error.
|
|
25
16
|
size; // To omit and prevent eslint error.
|
|
26
17
|
return React.createElement(
|
|
27
|
-
index_js_1.
|
|
18
|
+
index_js_1.ButtonBase,
|
|
28
19
|
{
|
|
29
|
-
as: 'button',
|
|
30
20
|
className: (0, classnames_1.default)(
|
|
31
21
|
'iui-header-breadcrumb-button',
|
|
32
22
|
className,
|
|
33
23
|
),
|
|
34
|
-
onClick: onClick,
|
|
35
24
|
ref: ref,
|
|
36
|
-
type: 'button',
|
|
37
|
-
style: style,
|
|
38
25
|
...rest,
|
|
39
26
|
},
|
|
40
27
|
startIcon,
|
|
@@ -26,7 +26,7 @@ exports.HeaderDropdownButton = React.forwardRef((props, ref) => {
|
|
|
26
26
|
index_js_1.DropdownMenu,
|
|
27
27
|
{
|
|
28
28
|
menuItems: menuItems,
|
|
29
|
-
style: {
|
|
29
|
+
style: { minInlineSize: menuWidth },
|
|
30
30
|
onShow: () => setIsMenuOpen(true),
|
|
31
31
|
onHide: () => setIsMenuOpen(false),
|
|
32
32
|
},
|
|
@@ -47,15 +47,13 @@ exports.HeaderSplitButton = React.forwardRef((props, forwardedRef) => {
|
|
|
47
47
|
{
|
|
48
48
|
placement: menuPlacement,
|
|
49
49
|
menuItems: menuItems,
|
|
50
|
-
style: {
|
|
50
|
+
style: { minInlineSize: menuWidth },
|
|
51
51
|
onShow: React.useCallback(() => setIsMenuOpen(true), []),
|
|
52
52
|
onHide: React.useCallback(() => setIsMenuOpen(false), []),
|
|
53
53
|
},
|
|
54
54
|
React.createElement(
|
|
55
|
-
index_js_2.
|
|
55
|
+
index_js_2.ButtonBase,
|
|
56
56
|
{
|
|
57
|
-
as: 'button',
|
|
58
|
-
type: 'button',
|
|
59
57
|
className:
|
|
60
58
|
'iui-header-breadcrumb-button iui-header-breadcrumb-button-split',
|
|
61
59
|
disabled: disabled,
|
|
@@ -24,6 +24,10 @@ type ProgressLinearProps = {
|
|
|
24
24
|
* Status of progress.
|
|
25
25
|
*/
|
|
26
26
|
status?: 'positive' | 'negative';
|
|
27
|
+
/**
|
|
28
|
+
* Pass props to ProgressLinear label group.
|
|
29
|
+
*/
|
|
30
|
+
labelGroupProps?: React.ComponentProps<'div'>;
|
|
27
31
|
};
|
|
28
32
|
/**
|
|
29
33
|
* Shows progress on a linear bar
|
|
@@ -32,6 +32,7 @@ exports.ProgressLinear = React.forwardRef((props, forwardedRef) => {
|
|
|
32
32
|
isAnimated = false,
|
|
33
33
|
status,
|
|
34
34
|
className,
|
|
35
|
+
labelGroupProps,
|
|
35
36
|
...rest
|
|
36
37
|
} = props;
|
|
37
38
|
const boundedValue = (0, index_js_1.getBoundedValue)(value ?? 100, 0, 100);
|
|
@@ -54,7 +55,14 @@ exports.ProgressLinear = React.forwardRef((props, forwardedRef) => {
|
|
|
54
55
|
labels.length > 0 &&
|
|
55
56
|
React.createElement(
|
|
56
57
|
index_js_1.Box,
|
|
57
|
-
{
|
|
58
|
+
{
|
|
59
|
+
as: 'div',
|
|
60
|
+
...labelGroupProps,
|
|
61
|
+
className: (0, classnames_1.default)(
|
|
62
|
+
'iui-progress-indicator-linear-label',
|
|
63
|
+
labelGroupProps?.className,
|
|
64
|
+
),
|
|
65
|
+
},
|
|
58
66
|
labels.map((label, index) =>
|
|
59
67
|
React.createElement('span', { key: index }, label),
|
|
60
68
|
),
|
|
@@ -214,8 +214,8 @@ const Select = (props) => {
|
|
|
214
214
|
role: 'listbox',
|
|
215
215
|
className: (0, classnames_1.default)('iui-scroll', menuClassName),
|
|
216
216
|
style: {
|
|
217
|
-
minWidth,
|
|
218
|
-
|
|
217
|
+
minInlineSize: minWidth,
|
|
218
|
+
maxInlineSize: `min(${minWidth * 2}px, 90vw)`,
|
|
219
219
|
...menuStyle,
|
|
220
220
|
},
|
|
221
221
|
id: `${uid}-menu`,
|
|
@@ -48,6 +48,22 @@ type SideNavigationProps = {
|
|
|
48
48
|
* @default false
|
|
49
49
|
*/
|
|
50
50
|
isSubmenuOpen?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Passes props for SideNav wrapper.
|
|
53
|
+
*/
|
|
54
|
+
wrapperProps?: React.ComponentProps<'div'>;
|
|
55
|
+
/**
|
|
56
|
+
* Passes props for SideNav content.
|
|
57
|
+
*/
|
|
58
|
+
contentProps?: React.ComponentProps<'div'>;
|
|
59
|
+
/**
|
|
60
|
+
* Passes props for SideNav top.
|
|
61
|
+
*/
|
|
62
|
+
topProps?: React.ComponentProps<'div'>;
|
|
63
|
+
/**
|
|
64
|
+
* Passes props for SideNav bottom.
|
|
65
|
+
*/
|
|
66
|
+
bottomProps?: React.ComponentProps<'div'>;
|
|
51
67
|
};
|
|
52
68
|
/**
|
|
53
69
|
* Left side navigation menu component.
|
|
@@ -35,6 +35,10 @@ exports.SideNavigation = React.forwardRef((props, forwardedRef) => {
|
|
|
35
35
|
onExpanderClick,
|
|
36
36
|
submenu,
|
|
37
37
|
isSubmenuOpen = false,
|
|
38
|
+
wrapperProps,
|
|
39
|
+
contentProps,
|
|
40
|
+
topProps,
|
|
41
|
+
bottomProps,
|
|
38
42
|
...rest
|
|
39
43
|
} = props;
|
|
40
44
|
const [_isExpanded, _setIsExpanded] = React.useState(isExpanded);
|
|
@@ -55,28 +59,48 @@ exports.SideNavigation = React.forwardRef((props, forwardedRef) => {
|
|
|
55
59
|
return React.createElement(
|
|
56
60
|
index_js_1.Box,
|
|
57
61
|
{
|
|
62
|
+
...wrapperProps,
|
|
58
63
|
className: (0, classnames_1.default)(
|
|
59
64
|
'iui-side-navigation-wrapper',
|
|
60
|
-
className,
|
|
65
|
+
wrapperProps?.className,
|
|
61
66
|
),
|
|
62
67
|
ref: forwardedRef,
|
|
63
|
-
...rest,
|
|
64
68
|
},
|
|
65
69
|
React.createElement(
|
|
66
70
|
index_js_1.Box,
|
|
67
71
|
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
'iui-
|
|
71
|
-
|
|
72
|
+
as: 'div',
|
|
73
|
+
className: (0, classnames_1.default)(
|
|
74
|
+
'iui-side-navigation',
|
|
75
|
+
{
|
|
76
|
+
'iui-expanded': _isExpanded,
|
|
77
|
+
'iui-collapsed': !_isExpanded,
|
|
78
|
+
},
|
|
79
|
+
className,
|
|
80
|
+
),
|
|
81
|
+
...rest,
|
|
72
82
|
},
|
|
73
83
|
expanderPlacement === 'top' && ExpandButton,
|
|
74
84
|
React.createElement(
|
|
75
85
|
index_js_1.Box,
|
|
76
|
-
{
|
|
86
|
+
{
|
|
87
|
+
as: 'div',
|
|
88
|
+
...contentProps,
|
|
89
|
+
className: (0, classnames_1.default)(
|
|
90
|
+
'iui-sidenav-content',
|
|
91
|
+
contentProps?.className,
|
|
92
|
+
),
|
|
93
|
+
},
|
|
77
94
|
React.createElement(
|
|
78
95
|
index_js_1.Box,
|
|
79
|
-
{
|
|
96
|
+
{
|
|
97
|
+
as: 'div',
|
|
98
|
+
...topProps,
|
|
99
|
+
className: (0, classnames_1.default)(
|
|
100
|
+
'iui-top',
|
|
101
|
+
topProps?.className,
|
|
102
|
+
),
|
|
103
|
+
},
|
|
80
104
|
items.map((sidenavButton, index) =>
|
|
81
105
|
!_isExpanded
|
|
82
106
|
? React.createElement(
|
|
@@ -93,7 +117,14 @@ exports.SideNavigation = React.forwardRef((props, forwardedRef) => {
|
|
|
93
117
|
),
|
|
94
118
|
React.createElement(
|
|
95
119
|
index_js_1.Box,
|
|
96
|
-
{
|
|
120
|
+
{
|
|
121
|
+
as: 'div',
|
|
122
|
+
...bottomProps,
|
|
123
|
+
className: (0, classnames_1.default)(
|
|
124
|
+
'iui-bottom',
|
|
125
|
+
bottomProps?.className,
|
|
126
|
+
),
|
|
127
|
+
},
|
|
97
128
|
secondaryItems?.map((sidenavButton, index) =>
|
|
98
129
|
!_isExpanded
|
|
99
130
|
? React.createElement(
|
|
@@ -68,6 +68,30 @@ export type SliderProps = {
|
|
|
68
68
|
* Additional props for container `<div>` that hold the slider rail, thumbs, and tracks.
|
|
69
69
|
*/
|
|
70
70
|
railContainerProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
71
|
+
/**
|
|
72
|
+
* Allows props to be passed for slider-min
|
|
73
|
+
*/
|
|
74
|
+
minProps?: React.ComponentProps<'span'>;
|
|
75
|
+
/**
|
|
76
|
+
* Allows props to be passed for slider-max
|
|
77
|
+
*/
|
|
78
|
+
maxProps?: React.ComponentProps<'span'>;
|
|
79
|
+
/**
|
|
80
|
+
* Allows props to be passed for slider-rail
|
|
81
|
+
*/
|
|
82
|
+
railProps?: React.ComponentProps<'div'>;
|
|
83
|
+
/**
|
|
84
|
+
* Allows props to be passed for slider-track
|
|
85
|
+
*/
|
|
86
|
+
trackProps?: React.ComponentProps<'div'>;
|
|
87
|
+
/**
|
|
88
|
+
* Allows props to be passed for slider-tick
|
|
89
|
+
*/
|
|
90
|
+
tickProps?: React.ComponentProps<'span'>;
|
|
91
|
+
/**
|
|
92
|
+
* Allows props to be passed for slider-ticks
|
|
93
|
+
*/
|
|
94
|
+
ticksProps?: React.ComponentProps<'div'>;
|
|
71
95
|
/**
|
|
72
96
|
* Defines the allowed behavior when moving Thumbs when multiple Thumbs are
|
|
73
97
|
* shown. It controls if a Thumb movement should be limited to only move in
|
|
@@ -91,6 +91,12 @@ exports.Slider = React.forwardRef((props, ref) => {
|
|
|
91
91
|
thumbProps,
|
|
92
92
|
className,
|
|
93
93
|
railContainerProps,
|
|
94
|
+
minProps,
|
|
95
|
+
maxProps,
|
|
96
|
+
railProps,
|
|
97
|
+
trackProps,
|
|
98
|
+
tickProps,
|
|
99
|
+
ticksProps,
|
|
94
100
|
orientation = 'horizontal',
|
|
95
101
|
...rest
|
|
96
102
|
} = props;
|
|
@@ -283,18 +289,33 @@ exports.Slider = React.forwardRef((props, ref) => {
|
|
|
283
289
|
if (Array.isArray(tickLabels)) {
|
|
284
290
|
return React.createElement(
|
|
285
291
|
index_js_1.Box,
|
|
286
|
-
{
|
|
292
|
+
{
|
|
293
|
+
as: 'div',
|
|
294
|
+
...ticksProps,
|
|
295
|
+
className: (0, classnames_1.default)(
|
|
296
|
+
'iui-slider-ticks',
|
|
297
|
+
ticksProps?.className,
|
|
298
|
+
),
|
|
299
|
+
},
|
|
287
300
|
tickLabels.map((label, index) =>
|
|
288
301
|
React.createElement(
|
|
289
302
|
index_js_1.Box,
|
|
290
|
-
{
|
|
303
|
+
{
|
|
304
|
+
as: 'span',
|
|
305
|
+
...tickProps,
|
|
306
|
+
key: index,
|
|
307
|
+
className: (0, classnames_1.default)(
|
|
308
|
+
'iui-slider-tick',
|
|
309
|
+
tickProps?.className,
|
|
310
|
+
),
|
|
311
|
+
},
|
|
291
312
|
label,
|
|
292
313
|
),
|
|
293
314
|
),
|
|
294
315
|
);
|
|
295
316
|
}
|
|
296
317
|
return tickLabels;
|
|
297
|
-
}, [tickLabels]);
|
|
318
|
+
}, [tickLabels, tickProps, ticksProps]);
|
|
298
319
|
const generateTooltipProps = React.useCallback(
|
|
299
320
|
(index, val) => {
|
|
300
321
|
const outProps = tooltipProps ? tooltipProps(index, val, step) : {};
|
|
@@ -322,20 +343,39 @@ exports.Slider = React.forwardRef((props, ref) => {
|
|
|
322
343
|
minValueLabel &&
|
|
323
344
|
React.createElement(
|
|
324
345
|
index_js_1.Box,
|
|
325
|
-
{
|
|
346
|
+
{
|
|
347
|
+
as: 'span',
|
|
348
|
+
...minProps,
|
|
349
|
+
className: (0, classnames_1.default)(
|
|
350
|
+
'iui-slider-min',
|
|
351
|
+
minProps?.className,
|
|
352
|
+
),
|
|
353
|
+
},
|
|
326
354
|
minValueLabel,
|
|
327
355
|
),
|
|
328
356
|
React.createElement(
|
|
329
357
|
index_js_1.Box,
|
|
330
358
|
{
|
|
359
|
+
as: 'div',
|
|
331
360
|
ref: containerRef,
|
|
332
|
-
className: (0, classnames_1.default)('iui-slider-container', {
|
|
333
|
-
'iui-grabbing': undefined !== activeThumbIndex,
|
|
334
|
-
}),
|
|
335
|
-
onPointerDown: handlePointerDownOnSlider,
|
|
336
361
|
...railContainerProps,
|
|
362
|
+
className: (0, classnames_1.default)(
|
|
363
|
+
'iui-slider-container',
|
|
364
|
+
{
|
|
365
|
+
'iui-grabbing': undefined !== activeThumbIndex,
|
|
366
|
+
},
|
|
367
|
+
railContainerProps?.className,
|
|
368
|
+
),
|
|
369
|
+
onPointerDown: handlePointerDownOnSlider,
|
|
337
370
|
},
|
|
338
|
-
React.createElement(index_js_1.Box, {
|
|
371
|
+
React.createElement(index_js_1.Box, {
|
|
372
|
+
as: 'div',
|
|
373
|
+
...railProps,
|
|
374
|
+
className: (0, classnames_1.default)(
|
|
375
|
+
'iui-slider-rail',
|
|
376
|
+
railProps?.className,
|
|
377
|
+
),
|
|
378
|
+
}),
|
|
339
379
|
currentValues.map((thumbValue, index) => {
|
|
340
380
|
const [minVal, maxVal] = getAllowableThumbRange(index);
|
|
341
381
|
const thisThumbProps = thumbProps?.(index);
|
|
@@ -363,13 +403,21 @@ exports.Slider = React.forwardRef((props, ref) => {
|
|
|
363
403
|
sliderMax: max,
|
|
364
404
|
values: currentValues,
|
|
365
405
|
orientation: orientation,
|
|
406
|
+
...trackProps,
|
|
366
407
|
}),
|
|
367
408
|
tickMarkArea,
|
|
368
409
|
),
|
|
369
410
|
maxValueLabel &&
|
|
370
411
|
React.createElement(
|
|
371
412
|
index_js_1.Box,
|
|
372
|
-
{
|
|
413
|
+
{
|
|
414
|
+
as: 'span',
|
|
415
|
+
...maxProps,
|
|
416
|
+
className: (0, classnames_1.default)(
|
|
417
|
+
'iui-slider-max',
|
|
418
|
+
maxProps?.className,
|
|
419
|
+
),
|
|
420
|
+
},
|
|
373
421
|
maxValueLabel,
|
|
374
422
|
),
|
|
375
423
|
);
|
package/cjs/core/Slider/Thumb.js
CHANGED
|
@@ -101,8 +101,8 @@ const Thumb = (props) => {
|
|
|
101
101
|
style: {
|
|
102
102
|
...style,
|
|
103
103
|
...(orientation === 'horizontal'
|
|
104
|
-
? {
|
|
105
|
-
: {
|
|
104
|
+
? { insetInlineStart: `${lowPercent}%` }
|
|
105
|
+
: { insetBlockEnd: `${lowPercent}%` }),
|
|
106
106
|
},
|
|
107
107
|
className: (0, classnames_1.default)(
|
|
108
108
|
'iui-slider-thumb',
|
|
@@ -6,7 +6,7 @@ export type TrackProps = {
|
|
|
6
6
|
sliderMax: number;
|
|
7
7
|
values: number[];
|
|
8
8
|
orientation: SliderProps['orientation'];
|
|
9
|
-
}
|
|
9
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
10
10
|
/**
|
|
11
11
|
* Track displays color segments above Rail. Which, if any, segments that are
|
|
12
12
|
* colorized is based on `trackDisplayMode`.
|
package/cjs/core/Slider/Track.js
CHANGED
|
@@ -7,6 +7,7 @@ const tslib_1 = require('tslib');
|
|
|
7
7
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
8
|
*--------------------------------------------------------------------------------------------*/
|
|
9
9
|
const React = tslib_1.__importStar(require('react'));
|
|
10
|
+
const classnames_1 = tslib_1.__importDefault(require('classnames'));
|
|
10
11
|
const index_js_1 = require('../utils/index.js');
|
|
11
12
|
function shouldDisplaySegment(segmentIndex, mode) {
|
|
12
13
|
if ('odd-segments' === mode && 0 === (segmentIndex + 1) % 2) {
|
|
@@ -41,7 +42,14 @@ function generateSegments(values, min, max) {
|
|
|
41
42
|
* colorized is based on `trackDisplayMode`.
|
|
42
43
|
*/
|
|
43
44
|
const Track = (props) => {
|
|
44
|
-
const {
|
|
45
|
+
const {
|
|
46
|
+
className,
|
|
47
|
+
trackDisplayMode,
|
|
48
|
+
sliderMin,
|
|
49
|
+
sliderMax,
|
|
50
|
+
values,
|
|
51
|
+
orientation,
|
|
52
|
+
} = props;
|
|
45
53
|
const [segments, setSegments] = React.useState(() =>
|
|
46
54
|
generateSegments(values, sliderMin, sliderMax),
|
|
47
55
|
);
|
|
@@ -67,16 +75,19 @@ const Track = (props) => {
|
|
|
67
75
|
{ key: index },
|
|
68
76
|
shouldDisplaySegment(index, trackDisplayMode)
|
|
69
77
|
? React.createElement(index_js_1.Box, {
|
|
70
|
-
className:
|
|
78
|
+
className: (0, classnames_1.default)(
|
|
79
|
+
'iui-slider-track',
|
|
80
|
+
className,
|
|
81
|
+
),
|
|
71
82
|
style: {
|
|
72
83
|
...(orientation === 'horizontal'
|
|
73
84
|
? {
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
insetInlineStart: `${lowPercent}%`,
|
|
86
|
+
insetInlineEnd: `${highPercent}%`,
|
|
76
87
|
}
|
|
77
88
|
: {
|
|
78
|
-
|
|
79
|
-
|
|
89
|
+
insetBlockStart: `${highPercent}%`,
|
|
90
|
+
insetBlockEnd: `${lowPercent}%`,
|
|
80
91
|
}),
|
|
81
92
|
},
|
|
82
93
|
})
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
2
3
|
export type StepperLocalization = {
|
|
3
4
|
stepsCountLabel: (currentStep: number, totalSteps: number) => string;
|
|
@@ -11,7 +12,7 @@ export type StepProperties = {
|
|
|
11
12
|
* A tooltip giving detailed description to this step.
|
|
12
13
|
*/
|
|
13
14
|
description?: string;
|
|
14
|
-
}
|
|
15
|
+
} & React.ComponentProps<'li'>;
|
|
15
16
|
export type StepperProps = {
|
|
16
17
|
/**
|
|
17
18
|
* Current step index, 0 - based.
|
|
@@ -34,6 +35,30 @@ export type StepperProps = {
|
|
|
34
35
|
* Click handler on completed step.
|
|
35
36
|
*/
|
|
36
37
|
onStepClick?: (clickedIndex: number) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Callback that can provide additional props for `<li>` representing a step.
|
|
40
|
+
*/
|
|
41
|
+
stepProps?: (index: number) => React.ComponentProps<'li'>;
|
|
42
|
+
/**
|
|
43
|
+
* Allows props to be passed for track content.
|
|
44
|
+
*/
|
|
45
|
+
trackContentProps?: (index: number) => React.ComponentProps<'div'>;
|
|
46
|
+
/**
|
|
47
|
+
* Allows props to be passed for circle.
|
|
48
|
+
*/
|
|
49
|
+
circleProps?: (index: number) => React.ComponentProps<'span'>;
|
|
50
|
+
/**
|
|
51
|
+
* Allows props to be passed for name.
|
|
52
|
+
*/
|
|
53
|
+
nameProps?: (index: number) => React.ComponentProps<'span'>;
|
|
54
|
+
/**
|
|
55
|
+
* Allows props to be passed for label.
|
|
56
|
+
*/
|
|
57
|
+
labelProps?: React.ComponentProps<'div'>;
|
|
58
|
+
/**
|
|
59
|
+
* Allows props to be passed for label count.
|
|
60
|
+
*/
|
|
61
|
+
labelCountProps?: React.ComponentProps<'span'>;
|
|
37
62
|
};
|
|
38
63
|
export declare const Stepper: PolymorphicForwardRefComponent<"div", StepperProps>;
|
|
39
64
|
export default Stepper;
|
|
@@ -6,6 +6,7 @@ const tslib_1 = require('tslib');
|
|
|
6
6
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
7
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
8
|
*--------------------------------------------------------------------------------------------*/
|
|
9
|
+
const classnames_1 = tslib_1.__importDefault(require('classnames'));
|
|
9
10
|
const React = tslib_1.__importStar(require('react'));
|
|
10
11
|
const index_js_1 = require('../utils/index.js');
|
|
11
12
|
const StepperStep_js_1 = require('./StepperStep.js');
|
|
@@ -20,6 +21,12 @@ exports.Stepper = React.forwardRef((props, ref) => {
|
|
|
20
21
|
type = 'default',
|
|
21
22
|
localization = defaultStepperLocalization,
|
|
22
23
|
onStepClick,
|
|
24
|
+
stepProps,
|
|
25
|
+
trackContentProps,
|
|
26
|
+
circleProps,
|
|
27
|
+
nameProps,
|
|
28
|
+
labelProps,
|
|
29
|
+
labelCountProps,
|
|
23
30
|
...rest
|
|
24
31
|
} = props;
|
|
25
32
|
const boundedCurrentStep = Math.min(
|
|
@@ -32,8 +39,16 @@ exports.Stepper = React.forwardRef((props, ref) => {
|
|
|
32
39
|
React.createElement(
|
|
33
40
|
'ol',
|
|
34
41
|
null,
|
|
35
|
-
steps.map((s, index) =>
|
|
36
|
-
|
|
42
|
+
steps.map((s, index) => {
|
|
43
|
+
const thisStepProps = stepProps?.(index);
|
|
44
|
+
const thisTrackContentProps = trackContentProps?.(index);
|
|
45
|
+
const thisCircleProps = circleProps?.(index);
|
|
46
|
+
const thisNameProps = nameProps?.(index);
|
|
47
|
+
return React.createElement(StepperStep_js_1.StepperStep, {
|
|
48
|
+
stepProps: thisStepProps,
|
|
49
|
+
trackContentProps: thisTrackContentProps,
|
|
50
|
+
circleProps: thisCircleProps,
|
|
51
|
+
nameProps: thisNameProps,
|
|
37
52
|
key: index,
|
|
38
53
|
index: index,
|
|
39
54
|
title: type === 'long' ? '' : s.name,
|
|
@@ -42,16 +57,30 @@ exports.Stepper = React.forwardRef((props, ref) => {
|
|
|
42
57
|
type: type,
|
|
43
58
|
onClick: onStepClick,
|
|
44
59
|
description: s.description,
|
|
45
|
-
})
|
|
46
|
-
),
|
|
60
|
+
});
|
|
61
|
+
}),
|
|
47
62
|
),
|
|
48
63
|
type === 'long' &&
|
|
49
64
|
React.createElement(
|
|
50
65
|
index_js_1.Box,
|
|
51
|
-
{
|
|
66
|
+
{
|
|
67
|
+
as: 'div',
|
|
68
|
+
...labelProps,
|
|
69
|
+
className: (0, classnames_1.default)(
|
|
70
|
+
'iui-stepper-steps-label',
|
|
71
|
+
labelProps?.className,
|
|
72
|
+
),
|
|
73
|
+
},
|
|
52
74
|
React.createElement(
|
|
53
75
|
index_js_1.Box,
|
|
54
|
-
{
|
|
76
|
+
{
|
|
77
|
+
as: 'span',
|
|
78
|
+
...labelCountProps,
|
|
79
|
+
className: (0, classnames_1.default)(
|
|
80
|
+
'iui-stepper-steps-label-count',
|
|
81
|
+
labelCountProps?.className,
|
|
82
|
+
),
|
|
83
|
+
},
|
|
55
84
|
localization.stepsCountLabel(boundedCurrentStep + 1, steps.length),
|
|
56
85
|
),
|
|
57
86
|
steps[boundedCurrentStep].name,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
2
3
|
export type StepperStepProps = {
|
|
3
4
|
/**
|
|
@@ -28,5 +29,21 @@ export type StepperStepProps = {
|
|
|
28
29
|
* A tooltip giving detailed description to this step.
|
|
29
30
|
*/
|
|
30
31
|
description?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Allows props to be passed for stepper step.
|
|
34
|
+
*/
|
|
35
|
+
stepProps?: React.ComponentProps<'li'>;
|
|
36
|
+
/**
|
|
37
|
+
* Allows props to be passed for track content.
|
|
38
|
+
*/
|
|
39
|
+
trackContentProps?: React.ComponentProps<'div'>;
|
|
40
|
+
/**
|
|
41
|
+
* Allows props to be passed for stepper-step circle.
|
|
42
|
+
*/
|
|
43
|
+
circleProps?: React.ComponentProps<'span'>;
|
|
44
|
+
/**
|
|
45
|
+
* Allows props to be passed for stepper name.
|
|
46
|
+
*/
|
|
47
|
+
nameProps?: React.ComponentProps<'span'>;
|
|
31
48
|
};
|
|
32
49
|
export declare const StepperStep: PolymorphicForwardRefComponent<"li", StepperStepProps>;
|