@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
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
useSafeContext,
|
|
13
13
|
polymorphic,
|
|
14
14
|
mergeEventHandlers,
|
|
15
|
+
ButtonBase,
|
|
15
16
|
} from '../utils/index.js';
|
|
16
17
|
const ExpandableBlockContext = React.createContext(undefined);
|
|
17
18
|
ExpandableBlockContext.displayName = 'ExpandableBlockContext';
|
|
@@ -73,10 +74,8 @@ const ExpandableBlockHeader = React.forwardRef((props, forwardedRef) => {
|
|
|
73
74
|
ExpandableBlockContext,
|
|
74
75
|
);
|
|
75
76
|
return React.createElement(
|
|
76
|
-
|
|
77
|
+
ButtonBase,
|
|
77
78
|
{
|
|
78
|
-
as: 'button',
|
|
79
|
-
type: 'button',
|
|
80
79
|
className: cx('iui-expandable-header', className),
|
|
81
80
|
'aria-expanded': isExpanded,
|
|
82
81
|
'aria-disabled': disabled,
|
|
@@ -15,6 +15,10 @@ type FileUploadProps = {
|
|
|
15
15
|
* Either pass `FileUploadCard` (for default state) or a different component to wrap.
|
|
16
16
|
*/
|
|
17
17
|
children: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Allows for custom prop to be passed for content.
|
|
20
|
+
*/
|
|
21
|
+
contentProps?: React.ComponentProps<'div'>;
|
|
18
22
|
};
|
|
19
23
|
/**
|
|
20
24
|
* File upload component to be wrapped around `FileUploadCard` or any arbitrary component.
|
|
@@ -13,7 +13,14 @@ import { Box, useMergedRefs } from '../utils/index.js';
|
|
|
13
13
|
* <FileUpload dragContent='Drop file here' onFileDropped={console.log}><Textarea /></FileUpload>
|
|
14
14
|
*/
|
|
15
15
|
export const FileUpload = React.forwardRef((props, ref) => {
|
|
16
|
-
const {
|
|
16
|
+
const {
|
|
17
|
+
dragContent,
|
|
18
|
+
children,
|
|
19
|
+
onFileDropped,
|
|
20
|
+
className,
|
|
21
|
+
contentProps,
|
|
22
|
+
...rest
|
|
23
|
+
} = props;
|
|
17
24
|
const [isDragActive, setIsDragActive] = React.useState(false);
|
|
18
25
|
const fileUploadRef = React.useRef(null);
|
|
19
26
|
const refs = useMergedRefs(fileUploadRef, ref);
|
|
@@ -58,9 +65,25 @@ export const FileUpload = React.forwardRef((props, ref) => {
|
|
|
58
65
|
},
|
|
59
66
|
dragContent
|
|
60
67
|
? children
|
|
61
|
-
: React.createElement(
|
|
68
|
+
: React.createElement(
|
|
69
|
+
Box,
|
|
70
|
+
{
|
|
71
|
+
as: 'div',
|
|
72
|
+
...contentProps,
|
|
73
|
+
className: cx('iui-content', contentProps?.className),
|
|
74
|
+
},
|
|
75
|
+
children,
|
|
76
|
+
),
|
|
62
77
|
dragContent &&
|
|
63
|
-
React.createElement(
|
|
78
|
+
React.createElement(
|
|
79
|
+
Box,
|
|
80
|
+
{
|
|
81
|
+
as: 'div',
|
|
82
|
+
...contentProps,
|
|
83
|
+
className: cx('iui-content', contentProps?.className),
|
|
84
|
+
},
|
|
85
|
+
dragContent,
|
|
86
|
+
),
|
|
64
87
|
);
|
|
65
88
|
});
|
|
66
89
|
export default FileUpload;
|
|
@@ -4,30 +4,17 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { ButtonBase } from '../utils/index.js';
|
|
8
8
|
export const HeaderBasicButton = React.forwardRef((props, ref) => {
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
className,
|
|
12
|
-
children,
|
|
13
|
-
style,
|
|
14
|
-
startIcon,
|
|
15
|
-
endIcon,
|
|
16
|
-
styleType,
|
|
17
|
-
size,
|
|
18
|
-
...rest
|
|
19
|
-
} = props;
|
|
9
|
+
const { className, children, startIcon, endIcon, styleType, size, ...rest } =
|
|
10
|
+
props;
|
|
20
11
|
styleType; // To omit and prevent eslint error.
|
|
21
12
|
size; // To omit and prevent eslint error.
|
|
22
13
|
return React.createElement(
|
|
23
|
-
|
|
14
|
+
ButtonBase,
|
|
24
15
|
{
|
|
25
|
-
as: 'button',
|
|
26
16
|
className: cx('iui-header-breadcrumb-button', className),
|
|
27
|
-
onClick: onClick,
|
|
28
17
|
ref: ref,
|
|
29
|
-
type: 'button',
|
|
30
|
-
style: style,
|
|
31
18
|
...rest,
|
|
32
19
|
},
|
|
33
20
|
startIcon,
|
|
@@ -26,7 +26,7 @@ export const HeaderDropdownButton = React.forwardRef((props, ref) => {
|
|
|
26
26
|
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
|
},
|
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { DropdownMenu } from '../DropdownMenu/index.js';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
SvgCaretDownSmall,
|
|
10
|
+
SvgCaretUpSmall,
|
|
11
|
+
Box,
|
|
12
|
+
ButtonBase,
|
|
13
|
+
} from '../utils/index.js';
|
|
9
14
|
import { HeaderBasicButton } from './HeaderBasicButton.js';
|
|
10
15
|
export const HeaderSplitButton = React.forwardRef((props, forwardedRef) => {
|
|
11
16
|
const {
|
|
@@ -40,15 +45,13 @@ export const HeaderSplitButton = React.forwardRef((props, forwardedRef) => {
|
|
|
40
45
|
{
|
|
41
46
|
placement: menuPlacement,
|
|
42
47
|
menuItems: menuItems,
|
|
43
|
-
style: {
|
|
48
|
+
style: { minInlineSize: menuWidth },
|
|
44
49
|
onShow: React.useCallback(() => setIsMenuOpen(true), []),
|
|
45
50
|
onHide: React.useCallback(() => setIsMenuOpen(false), []),
|
|
46
51
|
},
|
|
47
52
|
React.createElement(
|
|
48
|
-
|
|
53
|
+
ButtonBase,
|
|
49
54
|
{
|
|
50
|
-
as: 'button',
|
|
51
|
-
type: 'button',
|
|
52
55
|
className:
|
|
53
56
|
'iui-header-breadcrumb-button iui-header-breadcrumb-button-split',
|
|
54
57
|
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
|
|
@@ -28,6 +28,7 @@ export const ProgressLinear = React.forwardRef((props, forwardedRef) => {
|
|
|
28
28
|
isAnimated = false,
|
|
29
29
|
status,
|
|
30
30
|
className,
|
|
31
|
+
labelGroupProps,
|
|
31
32
|
...rest
|
|
32
33
|
} = props;
|
|
33
34
|
const boundedValue = getBoundedValue(value ?? 100, 0, 100);
|
|
@@ -47,7 +48,14 @@ export const ProgressLinear = React.forwardRef((props, forwardedRef) => {
|
|
|
47
48
|
labels.length > 0 &&
|
|
48
49
|
React.createElement(
|
|
49
50
|
Box,
|
|
50
|
-
{
|
|
51
|
+
{
|
|
52
|
+
as: 'div',
|
|
53
|
+
...labelGroupProps,
|
|
54
|
+
className: cx(
|
|
55
|
+
'iui-progress-indicator-linear-label',
|
|
56
|
+
labelGroupProps?.className,
|
|
57
|
+
),
|
|
58
|
+
},
|
|
51
59
|
labels.map((label, index) =>
|
|
52
60
|
React.createElement('span', { key: index }, label),
|
|
53
61
|
),
|
|
@@ -210,8 +210,8 @@ export const Select = (props) => {
|
|
|
210
210
|
role: 'listbox',
|
|
211
211
|
className: cx('iui-scroll', menuClassName),
|
|
212
212
|
style: {
|
|
213
|
-
minWidth,
|
|
214
|
-
|
|
213
|
+
minInlineSize: minWidth,
|
|
214
|
+
maxInlineSize: `min(${minWidth * 2}px, 90vw)`,
|
|
215
215
|
...menuStyle,
|
|
216
216
|
},
|
|
217
217
|
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.
|
|
@@ -31,6 +31,10 @@ export const SideNavigation = React.forwardRef((props, forwardedRef) => {
|
|
|
31
31
|
onExpanderClick,
|
|
32
32
|
submenu,
|
|
33
33
|
isSubmenuOpen = false,
|
|
34
|
+
wrapperProps,
|
|
35
|
+
contentProps,
|
|
36
|
+
topProps,
|
|
37
|
+
bottomProps,
|
|
34
38
|
...rest
|
|
35
39
|
} = props;
|
|
36
40
|
const [_isExpanded, _setIsExpanded] = React.useState(isExpanded);
|
|
@@ -51,25 +55,39 @@ export const SideNavigation = React.forwardRef((props, forwardedRef) => {
|
|
|
51
55
|
return React.createElement(
|
|
52
56
|
Box,
|
|
53
57
|
{
|
|
54
|
-
|
|
58
|
+
...wrapperProps,
|
|
59
|
+
className: cx('iui-side-navigation-wrapper', wrapperProps?.className),
|
|
55
60
|
ref: forwardedRef,
|
|
56
|
-
...rest,
|
|
57
61
|
},
|
|
58
62
|
React.createElement(
|
|
59
63
|
Box,
|
|
60
64
|
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
'iui-
|
|
64
|
-
|
|
65
|
+
as: 'div',
|
|
66
|
+
className: cx(
|
|
67
|
+
'iui-side-navigation',
|
|
68
|
+
{
|
|
69
|
+
'iui-expanded': _isExpanded,
|
|
70
|
+
'iui-collapsed': !_isExpanded,
|
|
71
|
+
},
|
|
72
|
+
className,
|
|
73
|
+
),
|
|
74
|
+
...rest,
|
|
65
75
|
},
|
|
66
76
|
expanderPlacement === 'top' && ExpandButton,
|
|
67
77
|
React.createElement(
|
|
68
78
|
Box,
|
|
69
|
-
{
|
|
79
|
+
{
|
|
80
|
+
as: 'div',
|
|
81
|
+
...contentProps,
|
|
82
|
+
className: cx('iui-sidenav-content', contentProps?.className),
|
|
83
|
+
},
|
|
70
84
|
React.createElement(
|
|
71
85
|
Box,
|
|
72
|
-
{
|
|
86
|
+
{
|
|
87
|
+
as: 'div',
|
|
88
|
+
...topProps,
|
|
89
|
+
className: cx('iui-top', topProps?.className),
|
|
90
|
+
},
|
|
73
91
|
items.map((sidenavButton, index) =>
|
|
74
92
|
!_isExpanded
|
|
75
93
|
? React.createElement(
|
|
@@ -86,7 +104,11 @@ export const SideNavigation = React.forwardRef((props, forwardedRef) => {
|
|
|
86
104
|
),
|
|
87
105
|
React.createElement(
|
|
88
106
|
Box,
|
|
89
|
-
{
|
|
107
|
+
{
|
|
108
|
+
as: 'div',
|
|
109
|
+
...bottomProps,
|
|
110
|
+
className: cx('iui-bottom', bottomProps?.className),
|
|
111
|
+
},
|
|
90
112
|
secondaryItems?.map((sidenavButton, index) =>
|
|
91
113
|
!_isExpanded
|
|
92
114
|
? 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
|
|
@@ -79,6 +79,12 @@ export const Slider = React.forwardRef((props, ref) => {
|
|
|
79
79
|
thumbProps,
|
|
80
80
|
className,
|
|
81
81
|
railContainerProps,
|
|
82
|
+
minProps,
|
|
83
|
+
maxProps,
|
|
84
|
+
railProps,
|
|
85
|
+
trackProps,
|
|
86
|
+
tickProps,
|
|
87
|
+
ticksProps,
|
|
82
88
|
orientation = 'horizontal',
|
|
83
89
|
...rest
|
|
84
90
|
} = props;
|
|
@@ -263,18 +269,27 @@ export const Slider = React.forwardRef((props, ref) => {
|
|
|
263
269
|
if (Array.isArray(tickLabels)) {
|
|
264
270
|
return React.createElement(
|
|
265
271
|
Box,
|
|
266
|
-
{
|
|
272
|
+
{
|
|
273
|
+
as: 'div',
|
|
274
|
+
...ticksProps,
|
|
275
|
+
className: cx('iui-slider-ticks', ticksProps?.className),
|
|
276
|
+
},
|
|
267
277
|
tickLabels.map((label, index) =>
|
|
268
278
|
React.createElement(
|
|
269
279
|
Box,
|
|
270
|
-
{
|
|
280
|
+
{
|
|
281
|
+
as: 'span',
|
|
282
|
+
...tickProps,
|
|
283
|
+
key: index,
|
|
284
|
+
className: cx('iui-slider-tick', tickProps?.className),
|
|
285
|
+
},
|
|
271
286
|
label,
|
|
272
287
|
),
|
|
273
288
|
),
|
|
274
289
|
);
|
|
275
290
|
}
|
|
276
291
|
return tickLabels;
|
|
277
|
-
}, [tickLabels]);
|
|
292
|
+
}, [tickLabels, tickProps, ticksProps]);
|
|
278
293
|
const generateTooltipProps = React.useCallback(
|
|
279
294
|
(index, val) => {
|
|
280
295
|
const outProps = tooltipProps ? tooltipProps(index, val, step) : {};
|
|
@@ -302,20 +317,33 @@ export const Slider = React.forwardRef((props, ref) => {
|
|
|
302
317
|
minValueLabel &&
|
|
303
318
|
React.createElement(
|
|
304
319
|
Box,
|
|
305
|
-
{
|
|
320
|
+
{
|
|
321
|
+
as: 'span',
|
|
322
|
+
...minProps,
|
|
323
|
+
className: cx('iui-slider-min', minProps?.className),
|
|
324
|
+
},
|
|
306
325
|
minValueLabel,
|
|
307
326
|
),
|
|
308
327
|
React.createElement(
|
|
309
328
|
Box,
|
|
310
329
|
{
|
|
330
|
+
as: 'div',
|
|
311
331
|
ref: containerRef,
|
|
312
|
-
className: cx('iui-slider-container', {
|
|
313
|
-
'iui-grabbing': undefined !== activeThumbIndex,
|
|
314
|
-
}),
|
|
315
|
-
onPointerDown: handlePointerDownOnSlider,
|
|
316
332
|
...railContainerProps,
|
|
333
|
+
className: cx(
|
|
334
|
+
'iui-slider-container',
|
|
335
|
+
{
|
|
336
|
+
'iui-grabbing': undefined !== activeThumbIndex,
|
|
337
|
+
},
|
|
338
|
+
railContainerProps?.className,
|
|
339
|
+
),
|
|
340
|
+
onPointerDown: handlePointerDownOnSlider,
|
|
317
341
|
},
|
|
318
|
-
React.createElement(Box, {
|
|
342
|
+
React.createElement(Box, {
|
|
343
|
+
as: 'div',
|
|
344
|
+
...railProps,
|
|
345
|
+
className: cx('iui-slider-rail', railProps?.className),
|
|
346
|
+
}),
|
|
319
347
|
currentValues.map((thumbValue, index) => {
|
|
320
348
|
const [minVal, maxVal] = getAllowableThumbRange(index);
|
|
321
349
|
const thisThumbProps = thumbProps?.(index);
|
|
@@ -343,13 +371,18 @@ export const Slider = React.forwardRef((props, ref) => {
|
|
|
343
371
|
sliderMax: max,
|
|
344
372
|
values: currentValues,
|
|
345
373
|
orientation: orientation,
|
|
374
|
+
...trackProps,
|
|
346
375
|
}),
|
|
347
376
|
tickMarkArea,
|
|
348
377
|
),
|
|
349
378
|
maxValueLabel &&
|
|
350
379
|
React.createElement(
|
|
351
380
|
Box,
|
|
352
|
-
{
|
|
381
|
+
{
|
|
382
|
+
as: 'span',
|
|
383
|
+
...maxProps,
|
|
384
|
+
className: cx('iui-slider-max', maxProps?.className),
|
|
385
|
+
},
|
|
353
386
|
maxValueLabel,
|
|
354
387
|
),
|
|
355
388
|
);
|
package/esm/core/Slider/Thumb.js
CHANGED
|
@@ -97,8 +97,8 @@ export const Thumb = (props) => {
|
|
|
97
97
|
style: {
|
|
98
98
|
...style,
|
|
99
99
|
...(orientation === 'horizontal'
|
|
100
|
-
? {
|
|
101
|
-
: {
|
|
100
|
+
? { insetInlineStart: `${lowPercent}%` }
|
|
101
|
+
: { insetBlockEnd: `${lowPercent}%` }),
|
|
102
102
|
},
|
|
103
103
|
className: cx('iui-slider-thumb', { 'iui-active': isActive }, className),
|
|
104
104
|
role: 'slider',
|
|
@@ -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/esm/core/Slider/Track.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import cx from 'classnames';
|
|
6
7
|
import { Box } from '../utils/index.js';
|
|
7
8
|
function shouldDisplaySegment(segmentIndex, mode) {
|
|
8
9
|
if ('odd-segments' === mode && 0 === (segmentIndex + 1) % 2) {
|
|
@@ -37,7 +38,14 @@ function generateSegments(values, min, max) {
|
|
|
37
38
|
* colorized is based on `trackDisplayMode`.
|
|
38
39
|
*/
|
|
39
40
|
export const Track = (props) => {
|
|
40
|
-
const {
|
|
41
|
+
const {
|
|
42
|
+
className,
|
|
43
|
+
trackDisplayMode,
|
|
44
|
+
sliderMin,
|
|
45
|
+
sliderMax,
|
|
46
|
+
values,
|
|
47
|
+
orientation,
|
|
48
|
+
} = props;
|
|
41
49
|
const [segments, setSegments] = React.useState(() =>
|
|
42
50
|
generateSegments(values, sliderMin, sliderMax),
|
|
43
51
|
);
|
|
@@ -63,16 +71,16 @@ export const Track = (props) => {
|
|
|
63
71
|
{ key: index },
|
|
64
72
|
shouldDisplaySegment(index, trackDisplayMode)
|
|
65
73
|
? React.createElement(Box, {
|
|
66
|
-
className: 'iui-slider-track',
|
|
74
|
+
className: cx('iui-slider-track', className),
|
|
67
75
|
style: {
|
|
68
76
|
...(orientation === 'horizontal'
|
|
69
77
|
? {
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
insetInlineStart: `${lowPercent}%`,
|
|
79
|
+
insetInlineEnd: `${highPercent}%`,
|
|
72
80
|
}
|
|
73
81
|
: {
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
insetBlockStart: `${highPercent}%`,
|
|
83
|
+
insetBlockEnd: `${lowPercent}%`,
|
|
76
84
|
}),
|
|
77
85
|
},
|
|
78
86
|
})
|
|
@@ -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;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import cx from 'classnames';
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import { Box } from '../utils/index.js';
|
|
7
8
|
import { StepperStep } from './StepperStep.js';
|
|
@@ -16,6 +17,12 @@ export const Stepper = React.forwardRef((props, ref) => {
|
|
|
16
17
|
type = 'default',
|
|
17
18
|
localization = defaultStepperLocalization,
|
|
18
19
|
onStepClick,
|
|
20
|
+
stepProps,
|
|
21
|
+
trackContentProps,
|
|
22
|
+
circleProps,
|
|
23
|
+
nameProps,
|
|
24
|
+
labelProps,
|
|
25
|
+
labelCountProps,
|
|
19
26
|
...rest
|
|
20
27
|
} = props;
|
|
21
28
|
const boundedCurrentStep = Math.min(
|
|
@@ -28,8 +35,16 @@ export const Stepper = React.forwardRef((props, ref) => {
|
|
|
28
35
|
React.createElement(
|
|
29
36
|
'ol',
|
|
30
37
|
null,
|
|
31
|
-
steps.map((s, index) =>
|
|
32
|
-
|
|
38
|
+
steps.map((s, index) => {
|
|
39
|
+
const thisStepProps = stepProps?.(index);
|
|
40
|
+
const thisTrackContentProps = trackContentProps?.(index);
|
|
41
|
+
const thisCircleProps = circleProps?.(index);
|
|
42
|
+
const thisNameProps = nameProps?.(index);
|
|
43
|
+
return React.createElement(StepperStep, {
|
|
44
|
+
stepProps: thisStepProps,
|
|
45
|
+
trackContentProps: thisTrackContentProps,
|
|
46
|
+
circleProps: thisCircleProps,
|
|
47
|
+
nameProps: thisNameProps,
|
|
33
48
|
key: index,
|
|
34
49
|
index: index,
|
|
35
50
|
title: type === 'long' ? '' : s.name,
|
|
@@ -38,16 +53,27 @@ export const Stepper = React.forwardRef((props, ref) => {
|
|
|
38
53
|
type: type,
|
|
39
54
|
onClick: onStepClick,
|
|
40
55
|
description: s.description,
|
|
41
|
-
})
|
|
42
|
-
),
|
|
56
|
+
});
|
|
57
|
+
}),
|
|
43
58
|
),
|
|
44
59
|
type === 'long' &&
|
|
45
60
|
React.createElement(
|
|
46
61
|
Box,
|
|
47
|
-
{
|
|
62
|
+
{
|
|
63
|
+
as: 'div',
|
|
64
|
+
...labelProps,
|
|
65
|
+
className: cx('iui-stepper-steps-label', labelProps?.className),
|
|
66
|
+
},
|
|
48
67
|
React.createElement(
|
|
49
68
|
Box,
|
|
50
|
-
{
|
|
69
|
+
{
|
|
70
|
+
as: 'span',
|
|
71
|
+
...labelCountProps,
|
|
72
|
+
className: cx(
|
|
73
|
+
'iui-stepper-steps-label-count',
|
|
74
|
+
labelCountProps?.className,
|
|
75
|
+
),
|
|
76
|
+
},
|
|
51
77
|
localization.stepsCountLabel(boundedCurrentStep + 1, steps.length),
|
|
52
78
|
),
|
|
53
79
|
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>;
|