@automattic/vip-design-system 2.13.4 → 2.13.5
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/build/system/Wizard/Wizard.js +3 -1
- package/build/system/Wizard/Wizard.stories.js +1 -0
- package/build/system/Wizard/WizardStep.d.ts +1 -0
- package/build/system/Wizard/WizardStep.js +4 -2
- package/package.json +1 -1
- package/src/system/Wizard/Wizard.stories.tsx +1 -0
- package/src/system/Wizard/Wizard.tsx +24 -18
- package/src/system/Wizard/WizardStep.tsx +4 -1
|
@@ -44,7 +44,8 @@ export var Wizard = /*#__PURE__*/React.forwardRef(function (_ref, forwardRef) {
|
|
|
44
44
|
children = _ref2.children,
|
|
45
45
|
titleVariant = _ref2.titleVariant,
|
|
46
46
|
summary = _ref2.summary,
|
|
47
|
-
onChange = _ref2.onChange
|
|
47
|
+
onChange = _ref2.onChange,
|
|
48
|
+
actionLabel = _ref2.actionLabel;
|
|
48
49
|
return _jsx(WizardStep, {
|
|
49
50
|
active: index === activeStep,
|
|
50
51
|
complete: completed.includes(index),
|
|
@@ -57,6 +58,7 @@ export var Wizard = /*#__PURE__*/React.forwardRef(function (_ref, forwardRef) {
|
|
|
57
58
|
summary: summary,
|
|
58
59
|
onChange: onChange,
|
|
59
60
|
shouldFocusTitle: titleAutofocus && didMount,
|
|
61
|
+
actionLabel: actionLabel,
|
|
60
62
|
children: children
|
|
61
63
|
}, index);
|
|
62
64
|
})
|
|
@@ -21,5 +21,6 @@ export interface WizardStepProps {
|
|
|
21
21
|
onChange?: () => void;
|
|
22
22
|
summary?: WizardStepSummary[];
|
|
23
23
|
shouldFocusTitle?: boolean;
|
|
24
|
+
actionLabel?: string;
|
|
24
25
|
}
|
|
25
26
|
export declare const WizardStep: React.ForwardRefExoticComponent<WizardStepProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -28,7 +28,9 @@ export var WizardStep = /*#__PURE__*/React.forwardRef(function (_ref, forwardRef
|
|
|
28
28
|
_ref$titleVariant = _ref.titleVariant,
|
|
29
29
|
titleVariant = _ref$titleVariant === void 0 ? 'h3' : _ref$titleVariant,
|
|
30
30
|
summary = _ref.summary,
|
|
31
|
-
onChange = _ref.onChange
|
|
31
|
+
onChange = _ref.onChange,
|
|
32
|
+
_ref$actionLabel = _ref.actionLabel,
|
|
33
|
+
actionLabel = _ref$actionLabel === void 0 ? 'Change' : _ref$actionLabel;
|
|
32
34
|
var titleRef = React.useRef(null);
|
|
33
35
|
var status = 'inactive';
|
|
34
36
|
var statusText = 'Step not completed';
|
|
@@ -129,7 +131,7 @@ export var WizardStep = /*#__PURE__*/React.forwardRef(function (_ref, forwardRef
|
|
|
129
131
|
height: 'auto',
|
|
130
132
|
alignSelf: 'flex-end'
|
|
131
133
|
},
|
|
132
|
-
children: [
|
|
134
|
+
children: [actionLabel, ' ', _jsx(ScreenReaderText, {
|
|
133
135
|
children: "the " + (title == null ? void 0 : title.toString()) + " step"
|
|
134
136
|
})]
|
|
135
137
|
})]
|
package/package.json
CHANGED
|
@@ -36,24 +36,30 @@ export const Wizard = React.forwardRef< HTMLDivElement, WizardProps >(
|
|
|
36
36
|
}, [ initialStep, activeStep, didMount, setDidMount ] );
|
|
37
37
|
return (
|
|
38
38
|
<Box className={ classNames( 'vip-wizard-component', className ) } ref={ forwardRef }>
|
|
39
|
-
{ steps.map(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
39
|
+
{ steps.map(
|
|
40
|
+
(
|
|
41
|
+
{ title, subTitle, children, titleVariant, summary, onChange, actionLabel },
|
|
42
|
+
index
|
|
43
|
+
) => (
|
|
44
|
+
<WizardStep
|
|
45
|
+
active={ index === activeStep }
|
|
46
|
+
complete={ completed.includes( index ) }
|
|
47
|
+
skipped={ skipped.includes( index ) }
|
|
48
|
+
key={ index }
|
|
49
|
+
order={ index + 1 }
|
|
50
|
+
totalSteps={ steps.length }
|
|
51
|
+
subTitle={ subTitle }
|
|
52
|
+
title={ title }
|
|
53
|
+
titleVariant={ titleVariant }
|
|
54
|
+
summary={ summary }
|
|
55
|
+
onChange={ onChange }
|
|
56
|
+
shouldFocusTitle={ titleAutofocus && didMount }
|
|
57
|
+
actionLabel={ actionLabel }
|
|
58
|
+
>
|
|
59
|
+
{ children }
|
|
60
|
+
</WizardStep>
|
|
61
|
+
)
|
|
62
|
+
) }
|
|
57
63
|
</Box>
|
|
58
64
|
);
|
|
59
65
|
}
|
|
@@ -30,6 +30,7 @@ export interface WizardStepProps {
|
|
|
30
30
|
onChange?: () => void;
|
|
31
31
|
summary?: WizardStepSummary[];
|
|
32
32
|
shouldFocusTitle?: boolean;
|
|
33
|
+
actionLabel?: string;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export const WizardStep = React.forwardRef< HTMLDivElement, WizardStepProps >(
|
|
@@ -47,6 +48,7 @@ export const WizardStep = React.forwardRef< HTMLDivElement, WizardStepProps >(
|
|
|
47
48
|
titleVariant = 'h3',
|
|
48
49
|
summary,
|
|
49
50
|
onChange,
|
|
51
|
+
actionLabel = 'Change',
|
|
50
52
|
},
|
|
51
53
|
forwardRef
|
|
52
54
|
) => {
|
|
@@ -146,7 +148,8 @@ export const WizardStep = React.forwardRef< HTMLDivElement, WizardStepProps >(
|
|
|
146
148
|
onClick={ onChange }
|
|
147
149
|
sx={ { height: 'auto', alignSelf: 'flex-end' } }
|
|
148
150
|
>
|
|
149
|
-
|
|
151
|
+
{ actionLabel }{ ' ' }
|
|
152
|
+
<ScreenReaderText>{ `the ${ title?.toString() } step` }</ScreenReaderText>
|
|
150
153
|
</Button>
|
|
151
154
|
) }
|
|
152
155
|
</Flex>
|