@itwin/itwinui-react 3.0.0-dev.5 → 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 +98 -1
- 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.d.ts +1 -1
- 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/DialogContent.d.ts +2 -1
- package/cjs/core/Dialog/DialogContent.js +25 -1
- package/cjs/core/Dialog/DialogMain.js +5 -6
- 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/HeaderButton.d.ts +4 -0
- package/cjs/core/Header/HeaderButton.js +2 -0
- package/cjs/core/Header/HeaderDropdownButton.js +1 -1
- package/cjs/core/Header/HeaderSplitButton.js +2 -4
- package/cjs/core/Input/Input.d.ts +5 -0
- package/cjs/core/Input/Input.js +2 -1
- package/cjs/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/cjs/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/cjs/core/Radio/Radio.d.ts +8 -0
- package/cjs/core/Radio/Radio.js +22 -9
- package/cjs/core/RadioTiles/RadioTile.d.ts +16 -0
- package/cjs/core/RadioTiles/RadioTile.js +61 -27
- 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.d.ts +16 -0
- package/cjs/core/Table/Table.js +50 -9
- 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/Resizer.js +21 -13
- 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 +4 -11
- 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.d.ts +1 -1
- 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/DialogContent.d.ts +2 -1
- package/esm/core/Dialog/DialogContent.js +25 -2
- package/esm/core/Dialog/DialogMain.js +5 -6
- 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/HeaderButton.d.ts +4 -0
- package/esm/core/Header/HeaderButton.js +2 -0
- package/esm/core/Header/HeaderDropdownButton.js +1 -1
- package/esm/core/Header/HeaderSplitButton.js +8 -5
- package/esm/core/Input/Input.d.ts +5 -0
- package/esm/core/Input/Input.js +2 -1
- package/esm/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/esm/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/esm/core/Radio/Radio.d.ts +8 -0
- package/esm/core/Radio/Radio.js +19 -6
- package/esm/core/RadioTiles/RadioTile.d.ts +16 -0
- package/esm/core/RadioTiles/RadioTile.js +52 -22
- 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.d.ts +16 -0
- package/esm/core/Table/Table.js +47 -9
- 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/Resizer.js +21 -13
- 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/functions/import.js +2 -1
- 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 +4 -11
- package/package.json +2 -2
- package/styles.css +723 -1566
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>;
|
|
@@ -17,6 +17,10 @@ export const StepperStep = React.forwardRef((props, forwardedRef) => {
|
|
|
17
17
|
description,
|
|
18
18
|
className,
|
|
19
19
|
style,
|
|
20
|
+
stepProps,
|
|
21
|
+
trackContentProps,
|
|
22
|
+
circleProps,
|
|
23
|
+
nameProps,
|
|
20
24
|
...rest
|
|
21
25
|
} = props;
|
|
22
26
|
const isPast = currentStepNumber > index;
|
|
@@ -42,17 +46,17 @@ export const StepperStep = React.forwardRef((props, forwardedRef) => {
|
|
|
42
46
|
Box,
|
|
43
47
|
{
|
|
44
48
|
as: 'li',
|
|
49
|
+
...stepProps,
|
|
45
50
|
className: cx(
|
|
46
51
|
'iui-stepper-step',
|
|
47
|
-
{
|
|
48
|
-
'iui-current': isActive,
|
|
49
|
-
'iui-clickable': isClickable,
|
|
50
|
-
},
|
|
52
|
+
{ 'iui-current': isActive, 'iui-clickable': isClickable },
|
|
51
53
|
className,
|
|
54
|
+
stepProps?.className,
|
|
52
55
|
),
|
|
53
56
|
style: {
|
|
54
|
-
|
|
57
|
+
inlineSize: type === 'default' ? `${100 / totalSteps}%` : undefined,
|
|
55
58
|
...style,
|
|
59
|
+
...stepProps?.style,
|
|
56
60
|
},
|
|
57
61
|
onClick: onCompletedClick,
|
|
58
62
|
onKeyDown: onKeyDown,
|
|
@@ -63,17 +67,32 @@ export const StepperStep = React.forwardRef((props, forwardedRef) => {
|
|
|
63
67
|
},
|
|
64
68
|
React.createElement(
|
|
65
69
|
Box,
|
|
66
|
-
{
|
|
70
|
+
{
|
|
71
|
+
as: 'div',
|
|
72
|
+
...trackContentProps,
|
|
73
|
+
className: cx(
|
|
74
|
+
'iui-stepper-track-content',
|
|
75
|
+
trackContentProps?.className,
|
|
76
|
+
),
|
|
77
|
+
},
|
|
67
78
|
React.createElement(
|
|
68
79
|
Box,
|
|
69
|
-
{
|
|
80
|
+
{
|
|
81
|
+
as: 'span',
|
|
82
|
+
...circleProps,
|
|
83
|
+
className: cx('iui-stepper-circle', circleProps?.className),
|
|
84
|
+
},
|
|
70
85
|
index + 1,
|
|
71
86
|
),
|
|
72
87
|
),
|
|
73
88
|
type === 'default' &&
|
|
74
89
|
React.createElement(
|
|
75
90
|
Box,
|
|
76
|
-
{
|
|
91
|
+
{
|
|
92
|
+
as: 'span',
|
|
93
|
+
...nameProps,
|
|
94
|
+
className: cx('iui-stepper-step-name', nameProps?.className),
|
|
95
|
+
},
|
|
77
96
|
title,
|
|
78
97
|
),
|
|
79
98
|
);
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
2
3
|
import type { StepperProps } from './Stepper.js';
|
|
3
|
-
type WorkflowDiagramProps = Pick<StepperProps, 'steps'
|
|
4
|
+
type WorkflowDiagramProps = Pick<StepperProps, 'steps'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Allows props to be passed for diagram.
|
|
7
|
+
*/
|
|
8
|
+
contentProps?: (index: number) => React.ComponentProps<'span'>;
|
|
9
|
+
/**
|
|
10
|
+
* Allows props to be passed for diagram wrapper.
|
|
11
|
+
*/
|
|
12
|
+
wrapperProps?: React.ComponentProps<'div'>;
|
|
13
|
+
};
|
|
4
14
|
export declare const WorkflowDiagram: PolymorphicForwardRefComponent<"ol", WorkflowDiagramProps>;
|
|
5
15
|
export default WorkflowDiagram;
|
|
@@ -3,25 +3,28 @@
|
|
|
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
|
import { WorkflowDiagramStep } from './WorkflowDiagramStep.js';
|
|
8
9
|
export const WorkflowDiagram = React.forwardRef(
|
|
9
10
|
// TODO: Remove this ref cast. ref and rest props should be applied on the same element
|
|
10
11
|
(props, ref) => {
|
|
11
|
-
const { steps, ...rest } = props;
|
|
12
|
+
const { steps, className, contentProps, wrapperProps, ...rest } = props;
|
|
12
13
|
return React.createElement(
|
|
13
14
|
Box,
|
|
14
|
-
{ ref: ref },
|
|
15
|
+
{ as: 'div', ...wrapperProps, ref: ref },
|
|
15
16
|
React.createElement(
|
|
16
17
|
Box,
|
|
17
|
-
{ as: 'ol', className: 'iui-workflow-diagram', ...rest },
|
|
18
|
-
steps.map((s, index) =>
|
|
19
|
-
|
|
18
|
+
{ as: 'ol', className: cx('iui-workflow-diagram', className), ...rest },
|
|
19
|
+
steps.map((s, index) => {
|
|
20
|
+
const thisContentProps = contentProps?.(index);
|
|
21
|
+
return React.createElement(WorkflowDiagramStep, {
|
|
22
|
+
contentProps: thisContentProps,
|
|
20
23
|
key: index,
|
|
21
24
|
title: s.name,
|
|
22
25
|
description: s.description,
|
|
23
|
-
})
|
|
24
|
-
),
|
|
26
|
+
});
|
|
27
|
+
}),
|
|
25
28
|
),
|
|
26
29
|
);
|
|
27
30
|
},
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type CommonProps } from '../utils/index.js';
|
|
3
3
|
import type { StepperStepProps } from './StepperStep.js';
|
|
4
|
-
export type WorkflowDiagramStepProps =
|
|
4
|
+
export type WorkflowDiagramStepProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Allows props to be passed for diagram content.
|
|
7
|
+
*/
|
|
8
|
+
contentProps?: React.ComponentProps<'span'>;
|
|
9
|
+
} & Pick<StepperStepProps, 'title' | 'description'> & Omit<CommonProps, 'title'>;
|
|
5
10
|
export declare const WorkflowDiagramStep: (props: WorkflowDiagramStepProps) => React.JSX.Element;
|
|
@@ -7,7 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import { Tooltip } from '../Tooltip/index.js';
|
|
8
8
|
import { Box } from '../utils/index.js';
|
|
9
9
|
export const WorkflowDiagramStep = (props) => {
|
|
10
|
-
const { title, description, className, style, ...rest } = props;
|
|
10
|
+
const { title, description, className, style, contentProps, ...rest } = props;
|
|
11
11
|
const stepShape = React.createElement(
|
|
12
12
|
Box,
|
|
13
13
|
{
|
|
@@ -18,7 +18,11 @@ export const WorkflowDiagramStep = (props) => {
|
|
|
18
18
|
},
|
|
19
19
|
React.createElement(
|
|
20
20
|
Box,
|
|
21
|
-
{
|
|
21
|
+
{
|
|
22
|
+
as: 'span',
|
|
23
|
+
...contentProps,
|
|
24
|
+
className: cx('iui-workflow-diagram-content', contentProps?.className),
|
|
25
|
+
},
|
|
22
26
|
title,
|
|
23
27
|
),
|
|
24
28
|
);
|
|
@@ -190,6 +190,22 @@ export type TableProps<T extends Record<string, unknown> = Record<string, unknow
|
|
|
190
190
|
* @default false
|
|
191
191
|
*/
|
|
192
192
|
enableColumnReordering?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Passes props to Table header wrapper.
|
|
195
|
+
*/
|
|
196
|
+
headerWrapperProps?: React.ComponentProps<'div'>;
|
|
197
|
+
/**
|
|
198
|
+
* Passes props to Table header.
|
|
199
|
+
*/
|
|
200
|
+
headerProps?: React.ComponentProps<'div'>;
|
|
201
|
+
/**
|
|
202
|
+
* Passes custom props to Table body.
|
|
203
|
+
*/
|
|
204
|
+
bodyProps?: React.ComponentProps<'div'>;
|
|
205
|
+
/**
|
|
206
|
+
* Passes custom props to empty table.
|
|
207
|
+
*/
|
|
208
|
+
emptyTableContentProps?: React.ComponentProps<'div'>;
|
|
193
209
|
/**
|
|
194
210
|
* Function that returns index of the row that you want to scroll to.
|
|
195
211
|
*
|
package/esm/core/Table/Table.js
CHANGED
|
@@ -146,6 +146,10 @@ export const Table = (props) => {
|
|
|
146
146
|
styleType = 'default',
|
|
147
147
|
enableVirtualization = false,
|
|
148
148
|
enableColumnReordering = false,
|
|
149
|
+
headerWrapperProps,
|
|
150
|
+
headerProps,
|
|
151
|
+
bodyProps,
|
|
152
|
+
emptyTableContentProps,
|
|
149
153
|
...rest
|
|
150
154
|
} = props;
|
|
151
155
|
useGlobals();
|
|
@@ -596,7 +600,7 @@ export const Table = (props) => {
|
|
|
596
600
|
return React.createElement(
|
|
597
601
|
Box,
|
|
598
602
|
{
|
|
599
|
-
|
|
603
|
+
as: 'div',
|
|
600
604
|
ref: headerRef,
|
|
601
605
|
onScroll: () => {
|
|
602
606
|
if (headerRef.current && bodyRef.current) {
|
|
@@ -605,10 +609,19 @@ export const Table = (props) => {
|
|
|
605
609
|
}
|
|
606
610
|
},
|
|
607
611
|
key: headerGroupProps.key,
|
|
612
|
+
...headerWrapperProps,
|
|
613
|
+
className: cx(
|
|
614
|
+
'iui-table-header-wrapper',
|
|
615
|
+
headerWrapperProps?.className,
|
|
616
|
+
),
|
|
608
617
|
},
|
|
609
618
|
React.createElement(
|
|
610
619
|
Box,
|
|
611
|
-
{
|
|
620
|
+
{
|
|
621
|
+
as: 'div',
|
|
622
|
+
...headerProps,
|
|
623
|
+
className: cx('iui-table-header', headerProps?.className),
|
|
624
|
+
},
|
|
612
625
|
React.createElement(
|
|
613
626
|
Box,
|
|
614
627
|
{ ...headerGroupProps },
|
|
@@ -723,10 +736,15 @@ export const Table = (props) => {
|
|
|
723
736
|
React.createElement(
|
|
724
737
|
Box,
|
|
725
738
|
{
|
|
739
|
+
...bodyProps,
|
|
726
740
|
...getTableBodyProps({
|
|
727
|
-
className: cx(
|
|
728
|
-
'iui-
|
|
729
|
-
|
|
741
|
+
className: cx(
|
|
742
|
+
'iui-table-body',
|
|
743
|
+
{
|
|
744
|
+
'iui-zebra-striping': styleType === 'zebra-rows',
|
|
745
|
+
},
|
|
746
|
+
bodyProps?.className,
|
|
747
|
+
),
|
|
730
748
|
style: { outline: 0 },
|
|
731
749
|
}),
|
|
732
750
|
ref: bodyRef,
|
|
@@ -756,7 +774,14 @@ export const Table = (props) => {
|
|
|
756
774
|
data.length === 0 &&
|
|
757
775
|
React.createElement(
|
|
758
776
|
Box,
|
|
759
|
-
{
|
|
777
|
+
{
|
|
778
|
+
as: 'div',
|
|
779
|
+
...emptyTableContentProps,
|
|
780
|
+
className: cx(
|
|
781
|
+
'iui-table-empty',
|
|
782
|
+
emptyTableContentProps?.className,
|
|
783
|
+
),
|
|
784
|
+
},
|
|
760
785
|
React.createElement(ProgressRadial, { indeterminate: true }),
|
|
761
786
|
),
|
|
762
787
|
isLoading &&
|
|
@@ -773,7 +798,6 @@ export const Table = (props) => {
|
|
|
773
798
|
React.createElement(ProgressRadial, {
|
|
774
799
|
indeterminate: true,
|
|
775
800
|
size: 'small',
|
|
776
|
-
style: { float: 'none', marginLeft: 0 },
|
|
777
801
|
}),
|
|
778
802
|
),
|
|
779
803
|
),
|
|
@@ -782,7 +806,14 @@ export const Table = (props) => {
|
|
|
782
806
|
!areFiltersSet &&
|
|
783
807
|
React.createElement(
|
|
784
808
|
Box,
|
|
785
|
-
{
|
|
809
|
+
{
|
|
810
|
+
as: 'div',
|
|
811
|
+
...emptyTableContentProps,
|
|
812
|
+
className: cx(
|
|
813
|
+
'iui-table-empty',
|
|
814
|
+
emptyTableContentProps?.className,
|
|
815
|
+
),
|
|
816
|
+
},
|
|
786
817
|
React.createElement('div', null, emptyTableContent),
|
|
787
818
|
),
|
|
788
819
|
!isLoading &&
|
|
@@ -790,7 +821,14 @@ export const Table = (props) => {
|
|
|
790
821
|
areFiltersSet &&
|
|
791
822
|
React.createElement(
|
|
792
823
|
Box,
|
|
793
|
-
{
|
|
824
|
+
{
|
|
825
|
+
as: 'div',
|
|
826
|
+
...emptyTableContentProps,
|
|
827
|
+
className: cx(
|
|
828
|
+
'iui-table-empty',
|
|
829
|
+
emptyTableContentProps?.className,
|
|
830
|
+
),
|
|
831
|
+
},
|
|
794
832
|
React.createElement('div', null, emptyFilteredTableContent),
|
|
795
833
|
),
|
|
796
834
|
),
|
|
@@ -39,7 +39,7 @@ export const TableCell = (props) => {
|
|
|
39
39
|
}
|
|
40
40
|
const multiplier = 26 + expanderMargin; // 26 = expander width
|
|
41
41
|
return {
|
|
42
|
-
|
|
42
|
+
paddingInlineStart: cellPadding + dynamicMargin * multiplier,
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
const cellElementProps = cell.getCellProps({
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
SvgChevronLeft,
|
|
16
16
|
SvgChevronRight,
|
|
17
17
|
Box,
|
|
18
|
+
ButtonBase,
|
|
18
19
|
} from '../utils/index.js';
|
|
19
20
|
const defaultLocalization = {
|
|
20
21
|
pageSizeLabel: (size) => `${size} per page`,
|
|
@@ -86,11 +87,9 @@ export const TablePaginator = (props) => {
|
|
|
86
87
|
const pageButton = React.useCallback(
|
|
87
88
|
(index, tabIndex = index === focusedIndex ? 0 : -1) =>
|
|
88
89
|
React.createElement(
|
|
89
|
-
|
|
90
|
+
ButtonBase,
|
|
90
91
|
{
|
|
91
|
-
as: 'button',
|
|
92
92
|
key: index,
|
|
93
|
-
type: 'button',
|
|
94
93
|
className: cx('iui-table-paginator-page-button', {
|
|
95
94
|
'iui-table-paginator-page-button-small': buttonSize === 'small',
|
|
96
95
|
}),
|
package/esm/core/Tabs/Tab.js
CHANGED
|
@@ -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
|
* Individual tab component to be used in the `labels` prop of `Tabs`.
|
|
10
10
|
* @example
|
|
@@ -24,9 +24,8 @@ export const Tab = React.forwardRef((props, forwardedRef) => {
|
|
|
24
24
|
...rest
|
|
25
25
|
} = props;
|
|
26
26
|
return React.createElement(
|
|
27
|
-
|
|
27
|
+
ButtonBase,
|
|
28
28
|
{
|
|
29
|
-
as: 'button',
|
|
30
29
|
className: cx('iui-tab', { 'iui-active': active }, className),
|
|
31
30
|
role: 'tab',
|
|
32
31
|
tabIndex: -1,
|
|
@@ -3,5 +3,5 @@ import type { ThemeOptions, ThemeType } from './ThemeProvider.js';
|
|
|
3
3
|
export declare const ThemeContext: React.Context<{
|
|
4
4
|
theme?: ThemeType | undefined;
|
|
5
5
|
themeOptions?: ThemeOptions | undefined;
|
|
6
|
-
|
|
6
|
+
portalContainer?: HTMLElement | null | undefined;
|
|
7
7
|
} | undefined>;
|
|
@@ -44,11 +44,31 @@ type RootProps = {
|
|
|
44
44
|
type ThemeProviderOwnProps = Pick<RootProps, 'theme'> & {
|
|
45
45
|
themeOptions?: RootProps['themeOptions'];
|
|
46
46
|
children: Required<React.ReactNode>;
|
|
47
|
+
/**
|
|
48
|
+
* The element used as the portal for floating elements (Tooltip, Toast, DropdownMenu, Dialog, etc).
|
|
49
|
+
*
|
|
50
|
+
* Defaults to a `<div>` rendered at the end of the ThemeProvider.
|
|
51
|
+
*
|
|
52
|
+
* When passing an element, it is recommended to use state.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const [myPortal, setMyPortal] = React.useState(null);
|
|
56
|
+
*
|
|
57
|
+
* <div ref={setMyPortal} />
|
|
58
|
+
* <ThemeProvider
|
|
59
|
+
* portalContainer={myPortal}
|
|
60
|
+
* >
|
|
61
|
+
* ...
|
|
62
|
+
* </ThemeProvider>
|
|
63
|
+
*/
|
|
64
|
+
portalContainer?: HTMLElement;
|
|
47
65
|
};
|
|
48
66
|
/**
|
|
49
|
-
* This component provides global
|
|
50
|
-
* that it is wrapping around.
|
|
51
|
-
*
|
|
67
|
+
* This component provides global state and applies theme to the entire tree
|
|
68
|
+
* that it is wrapping around.
|
|
69
|
+
*
|
|
70
|
+
* The `theme` prop defaults to "inherit", which looks upwards for closest ThemeProvider
|
|
71
|
+
* and falls back to "light" theme if one is not found.
|
|
52
72
|
*
|
|
53
73
|
* If you want to theme the entire app, you should use this component at the root. You can also
|
|
54
74
|
* use this component to apply a different theme to only a part of the tree.
|