@automattic/vip-design-system 1.2.3 → 1.3.1
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/.eslintignore +2 -1
- package/.prettierignore +1 -0
- package/.storybook/decorators/withBoundingBox.tsx +30 -4
- package/.storybook/decorators/withColorMode.tsx +5 -5
- package/CONTRIBUTING.md +1 -1
- package/build/system/Accordion/Accordion.js +6 -6
- package/build/system/Accordion/Accordion.stories.js +1 -1
- package/build/system/Accordion/Accordion.test.js +7 -5
- package/build/system/Avatar/Avatar.js +3 -2
- package/build/system/Badge/Badge.js +1 -0
- package/build/system/Button/Button.d.ts +11 -0
- package/build/system/Button/Button.js +12 -1
- package/build/system/Button/Button.stories.d.ts +2 -1
- package/build/system/Button/Button.stories.js +1 -2
- package/build/system/Button/Button.test.js +72 -45
- package/build/system/Button/ButtonSubmit.d.ts +17 -1
- package/build/system/Button/ButtonSubmit.js +58 -65
- package/build/system/Button/ButtonSubmit.stories.d.ts +17 -37
- package/build/system/Button/ButtonSubmit.stories.js +52 -0
- package/build/system/Button/ButtonSubmit.test.js +55 -35
- package/build/system/Button/index.d.ts +7 -3
- package/build/system/Button/index.js +8 -7
- package/build/system/Dropdown/DropdownContent.js +1 -1
- package/build/system/Dropdown/DropdownItem.js +1 -1
- package/build/system/Dropdown/DropdownLabel.js +1 -1
- package/build/system/Form/Checkbox.d.ts +9 -9
- package/build/system/Form/Checkbox.js +56 -61
- package/build/system/Form/Checkbox.stories.d.ts +6 -6
- package/build/system/Form/Checkbox.stories.js +71 -0
- package/build/system/Form/Input.d.ts +14 -1
- package/build/system/Form/Input.js +59 -72
- package/build/system/Form/Input.stories.d.ts +6 -4
- package/build/system/Form/Input.stories.js +53 -0
- package/build/system/Form/Input.styles.d.ts +23 -14
- package/build/system/Form/Input.styles.js +40 -28
- package/build/system/Form/InputWithCopyButton.stories.jsx +7 -0
- package/build/system/Form/Label.d.ts +19 -8
- package/build/system/Form/Label.js +39 -43
- package/build/system/Form/Label.stories.d.ts +7 -5
- package/build/system/Form/Label.stories.js +32 -0
- package/build/system/Form/Radio.js +4 -4
- package/build/system/Form/Radio.stories.jsx +1 -1
- package/build/system/Form/RadioBoxGroup.js +1 -1
- package/build/system/Form/RequiredLabel.d.ts +2 -1
- package/build/system/Form/RequiredLabel.js +16 -7
- package/build/system/Form/Toggle.js +2 -2
- package/build/system/Form/Validation.d.ts +8 -13
- package/build/system/Form/Validation.js +39 -35
- package/build/system/Heading/Heading.stories.js +3 -0
- package/build/system/Link/Link.js +1 -1
- package/build/system/NewDialog/DialogClose.js +2 -2
- package/build/system/NewDialog/DialogContent.js +3 -3
- package/build/system/NewDialog/DialogTitle.js +3 -1
- package/build/system/NewDialog/NewDialog.stories.d.ts +0 -1
- package/build/system/NewDialog/NewDialog.stories.jsx +0 -27
- package/build/system/NewForm/Fieldset.d.ts +12 -1
- package/build/system/NewForm/Fieldset.js +38 -40
- package/build/system/NewForm/Form.d.ts +8 -1
- package/build/system/NewForm/Form.js +24 -23
- package/build/system/NewForm/FormAutocomplete.css +0 -11
- package/build/system/NewForm/FormAutocomplete.js +8 -8
- package/build/system/NewForm/FormAutocomplete.stories.jsx +1 -3
- package/build/system/NewForm/FormAutocompleteMultiselect.js +10 -10
- package/build/system/NewForm/FormSelect.js +1 -1
- package/build/system/NewForm/FormSelectArrow.js +1 -1
- package/build/system/NewForm/FormSelectInline.js +1 -1
- package/build/system/NewForm/FormSelectLoading.js +1 -1
- package/build/system/NewForm/FormSelectSearch.js +2 -2
- package/build/system/NewForm/Legend.d.ts +12 -1
- package/build/system/NewForm/Legend.js +32 -34
- package/build/system/NewForm/index.d.ts +1 -1
- package/build/system/OptionRow/OptionRow.js +1 -1
- package/build/system/Progress/Progress.d.ts +9 -2
- package/build/system/Progress/Progress.js +75 -70
- package/build/system/Progress/Progress.stories.d.ts +9 -7
- package/build/system/Progress/Progress.stories.js +34 -0
- package/build/system/Progress/Progress.test.d.ts +1 -0
- package/build/system/Progress/Progress.test.js +65 -0
- package/build/system/Progress/index.d.ts +4 -2
- package/build/system/Progress/index.js +5 -5
- package/build/system/ScreenReaderText/ScreenReaderText.js +1 -2
- package/build/system/Tabs/TabsTrigger.js +0 -1
- package/build/system/Text/Text.js +1 -1
- package/build/system/Text/Text.stories.js +36 -0
- package/build/system/Tooltip/Tooltip.css +6 -2
- package/build/system/Tooltip/Tooltip.stories.js +2 -2
- package/build/system/Wizard/Wizard.d.ts +14 -1
- package/build/system/Wizard/Wizard.js +62 -93
- package/build/system/Wizard/Wizard.stories.d.ts +11 -8
- package/build/system/Wizard/Wizard.stories.js +167 -0
- package/build/system/Wizard/WizardStep.d.ts +24 -1
- package/build/system/Wizard/WizardStep.js +180 -190
- package/build/system/Wizard/index.d.ts +4 -2
- package/build/system/Wizard/index.js +6 -7
- package/build/system/index.d.ts +2 -2
- package/build/system/index.js +2 -1
- package/build/system/theme/generated/valet-theme-dark.json +1219 -476
- package/build/system/theme/generated/valet-theme-light.json +1217 -474
- package/build/system/theme/{getColor.d.ts → getPropValue.d.ts} +2 -1
- package/{src/system/theme/getColor.js → build/system/theme/getPropValue.js} +36 -4
- package/build/system/theme/index.d.ts +20 -65
- package/build/system/theme/index.js +27 -57
- package/package.json +4 -4
- package/src/system/Accordion/Accordion.stories.tsx +1 -1
- package/src/system/Accordion/Accordion.test.tsx +3 -0
- package/src/system/Accordion/Accordion.tsx +6 -6
- package/src/system/Avatar/Avatar.tsx +3 -3
- package/src/system/Badge/Badge.tsx +1 -1
- package/src/system/Button/Button.stories.tsx +2 -3
- package/src/system/Button/{Button.test.js → Button.test.tsx} +2 -2
- package/src/system/Button/Button.tsx +12 -0
- package/src/system/Button/ButtonSubmit.stories.tsx +31 -0
- package/src/system/Button/{ButtonSubmit.test.js → ButtonSubmit.test.tsx} +4 -4
- package/src/system/Button/{ButtonSubmit.js → ButtonSubmit.tsx} +21 -27
- package/src/system/Button/index.ts +8 -0
- package/src/system/Dropdown/DropdownContent.js +1 -1
- package/src/system/Dropdown/DropdownItem.js +1 -1
- package/src/system/Dropdown/DropdownLabel.js +1 -1
- package/src/system/Form/{Checkbox.stories.jsx → Checkbox.stories.tsx} +3 -2
- package/src/system/Form/{Checkbox.js → Checkbox.tsx} +6 -10
- package/src/system/Form/{Input.stories.jsx → Input.stories.tsx} +1 -0
- package/src/system/Form/{Input.styles.js → Input.styles.ts} +14 -5
- package/src/system/Form/{Input.js → Input.tsx} +10 -19
- package/src/system/Form/InputWithCopyButton.stories.jsx +7 -0
- package/src/system/Form/{Label.js → Label.tsx} +8 -13
- package/src/system/Form/Radio.js +4 -4
- package/src/system/Form/Radio.stories.jsx +1 -1
- package/src/system/Form/RadioBoxGroup.js +1 -1
- package/src/system/Form/{RequiredLabel.js → RequiredLabel.tsx} +1 -3
- package/src/system/Form/Toggle.js +2 -2
- package/src/system/Form/{Validation.js → Validation.tsx} +11 -12
- package/src/system/Heading/Heading.stories.tsx +1 -0
- package/src/system/Link/Link.tsx +1 -1
- package/src/system/NewDialog/DialogClose.js +2 -2
- package/src/system/NewDialog/DialogContent.js +3 -3
- package/src/system/NewDialog/DialogTitle.js +3 -1
- package/src/system/NewDialog/NewDialog.stories.jsx +0 -27
- package/src/system/NewForm/Fieldset.tsx +46 -0
- package/src/system/NewForm/Form.tsx +23 -0
- package/src/system/NewForm/FormAutocomplete.css +0 -11
- package/src/system/NewForm/FormAutocomplete.js +8 -8
- package/src/system/NewForm/FormAutocomplete.stories.jsx +1 -3
- package/src/system/NewForm/FormAutocompleteMultiselect.js +10 -10
- package/src/system/NewForm/FormSelect.js +1 -1
- package/src/system/NewForm/FormSelectArrow.js +1 -1
- package/src/system/NewForm/FormSelectInline.js +1 -1
- package/src/system/NewForm/FormSelectLoading.js +1 -1
- package/src/system/NewForm/FormSelectSearch.js +2 -2
- package/src/system/NewForm/Legend.tsx +40 -0
- package/src/system/OptionRow/OptionRow.js +1 -1
- package/src/system/Progress/Progress.test.tsx +33 -0
- package/src/system/Progress/{Progress.js → Progress.tsx} +16 -19
- package/src/system/Progress/index.ts +4 -0
- package/src/system/ScreenReaderText/ScreenReaderText.tsx +0 -2
- package/src/system/Tabs/TabsTrigger.js +0 -1
- package/src/system/Text/Text.stories.tsx +7 -0
- package/src/system/Text/Text.tsx +1 -1
- package/src/system/Tooltip/Tooltip.css +6 -2
- package/src/system/Tooltip/Tooltip.stories.tsx +4 -4
- package/{build/system/Wizard/Wizard.stories.jsx → src/system/Wizard/Wizard.stories.tsx} +18 -23
- package/src/system/Wizard/Wizard.tsx +62 -0
- package/src/system/Wizard/{WizardStep.js → WizardStep.tsx} +38 -41
- package/src/system/Wizard/index.ts +7 -0
- package/src/system/index.js +2 -1
- package/src/system/theme/generated/valet-theme-dark.json +1219 -476
- package/src/system/theme/generated/valet-theme-light.json +1217 -474
- package/{build/system/theme/getColor.js → src/system/theme/getPropValue.js} +36 -4
- package/src/system/theme/index.js +27 -57
- package/tokens/utilities/colors/color output/blue.json +305 -0
- package/tokens/utilities/colors/color output/gold.json +305 -0
- package/tokens/utilities/colors/color output/gray.json +305 -0
- package/tokens/utilities/colors/color output/green.json +305 -0
- package/tokens/utilities/colors/color output/orange.json +305 -0
- package/tokens/utilities/colors/color output/pink.json +305 -0
- package/tokens/utilities/colors/color output/red.json +305 -0
- package/tokens/utilities/colors/color output/salmon.json +305 -0
- package/tokens/utilities/colors/color output/yellow.json +305 -0
- package/tokens/utilities/colors/colorOutput.json +4062 -0
- package/tokens/utilities/colors/color_3d_plot.js +43 -0
- package/tokens/utilities/colors/color_graph.js +31 -0
- package/tokens/utilities/colors/colors.json +1981 -0
- package/tokens/utilities/colors/index.js +118 -0
- package/tokens/utilities/colors/package-lock.json +6749 -0
- package/tokens/utilities/colors/package.json +21 -0
- package/tokens/utilities/figma-type-calculator/responsive-type.js +98 -0
- package/tokens/valet-core/$metadata.json +19 -15
- package/tokens/valet-core/$themes.json +3323 -419
- package/tokens/valet-core/{figma-parsely-expressive-type.json → figma-parsely-web-type.json} +128 -128
- package/tokens/valet-core/{figma-valet-expressive-type.json → figma-valet-web-type.json} +126 -126
- package/tokens/valet-core/figma-wpvip-services-web-type.json +1267 -0
- package/tokens/valet-core/{figma-wpvip-expressive-type.json → figma-wpvip-web-type.json} +162 -162
- package/tokens/valet-core/{parsely-expressive-color.json → parsely-web-color.json} +1 -1
- package/tokens/valet-core/{wpvip-expressive-core.json → parsely-web-core.json} +73 -23
- package/tokens/valet-core/{parsely-expressive-type.json → parsely-web-type.json} +21 -9
- package/tokens/valet-core/valet-core.json +331 -232
- package/tokens/valet-core/{valet-expressive-color.json → valet-web-color.json} +1 -1
- package/tokens/valet-core/{parsely-expressive-core.json → valet-web-core.json} +72 -22
- package/tokens/valet-core/{wpvip-productive-color.json → wpvip-product-core.json} +663 -7
- package/tokens/valet-core/{wpvip-productive-color-dark.json → wpvip-product-dark.json} +332 -10
- package/tokens/valet-core/{wpvip-expressive-color.json → wpvip-services-web-color.json} +1 -1
- package/tokens/valet-core/{valet-expressive-core.json → wpvip-services-web-core.json} +72 -22
- package/tokens/valet-core/wpvip-services-web-type.json +412 -0
- package/tokens/valet-core/{wpvip-expressive-color-dark.json → wpvip-web-color-dark.json} +1 -1
- package/tokens/valet-core/wpvip-web-color.json +730 -0
- package/tokens/valet-core/{wpvip-expressive-type.json → wpvip-web-type.json} +24 -12
- package/tokens/valet-core/wpvip-web.json +1310 -0
- package/tsconfig.json +2 -1
- package/build/system/Button/ButtonSubmit.stories.jsx +0 -40
- package/build/system/Button/variants.d.ts +0 -2
- package/build/system/Button/variants.js +0 -1
- package/build/system/Form/Checkbox.stories.jsx +0 -54
- package/build/system/Form/Input.stories.jsx +0 -38
- package/build/system/Wizard/WizardStepHorizontal.d.ts +0 -2
- package/build/system/Wizard/WizardStepHorizontal.js +0 -55
- package/build/system/theme/textStyles.d.ts +0 -71
- package/build/system/theme/textStyles.js +0 -46
- package/src/system/Button/ButtonSubmit.stories.jsx +0 -40
- package/src/system/Button/index.js +0 -8
- package/src/system/Button/variants.js +0 -1
- package/src/system/Form/Label.stories.jsx +0 -36
- package/src/system/NewForm/Fieldset.js +0 -47
- package/src/system/NewForm/Form.js +0 -26
- package/src/system/NewForm/Legend.js +0 -41
- package/src/system/Progress/Progress.stories.jsx +0 -25
- package/src/system/Progress/index.js +0 -6
- package/src/system/Wizard/Wizard.js +0 -103
- package/src/system/Wizard/Wizard.stories.jsx +0 -145
- package/src/system/Wizard/WizardStepHorizontal.js +0 -55
- package/src/system/Wizard/index.js +0 -8
- package/src/system/theme/textStyles.js +0 -46
- /package/{build/system/Form/Label.stories.jsx → src/system/Form/Label.stories.tsx} +0 -0
- /package/{build/system/Progress/Progress.stories.jsx → src/system/Progress/Progress.stories.tsx} +0 -0
|
@@ -1,200 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.WizardStep = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _bs = require("react-icons/bs");
|
|
7
|
+
var _ = require("..");
|
|
8
|
+
var _ScreenReaderText = require("../ScreenReaderText");
|
|
9
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
12
|
/** @jsxImportSource theme-ui */
|
|
2
13
|
|
|
3
14
|
/**
|
|
4
15
|
* External dependencies
|
|
5
16
|
*/
|
|
6
|
-
import React, { useLayoutEffect } from 'react';
|
|
7
|
-
import { BsCircleFill, BsFillCheckCircleFill } from 'react-icons/bs';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
17
|
|
|
10
18
|
/**
|
|
11
19
|
* Internal dependencies
|
|
12
20
|
*/
|
|
13
|
-
import { Card, Heading, Text, Flex, Table, TableRow, TableCell, Button } from '..';
|
|
14
|
-
import { ScreenReaderText } from '../ScreenReaderText';
|
|
15
|
-
|
|
16
|
-
const WizardStep = React.forwardRef(
|
|
17
|
-
(
|
|
18
|
-
{
|
|
19
|
-
title,
|
|
20
|
-
subTitle,
|
|
21
|
-
skipped = false,
|
|
22
|
-
complete = false,
|
|
23
|
-
children,
|
|
24
|
-
active,
|
|
25
|
-
order,
|
|
26
|
-
totalSteps,
|
|
27
|
-
shouldFocusTitle,
|
|
28
|
-
titleVariant = 'h3',
|
|
29
|
-
summary,
|
|
30
|
-
onChange,
|
|
31
|
-
},
|
|
32
|
-
forwardRef
|
|
33
|
-
) => {
|
|
34
|
-
const titleRef = React.useRef( null );
|
|
35
|
-
let status = 'inactive';
|
|
36
|
-
let statusText = 'Step not completed';
|
|
37
|
-
if ( active ) {
|
|
38
|
-
status = 'active';
|
|
39
|
-
statusText = ''; // not adding the status text for active step since it's announced by aria-current
|
|
40
|
-
} else if ( complete ) {
|
|
41
|
-
status = 'complete';
|
|
42
|
-
statusText = 'Step completed';
|
|
43
|
-
} else if ( skipped ) {
|
|
44
|
-
status = 'skipped';
|
|
45
|
-
statusText = 'Step skipped';
|
|
46
|
-
}
|
|
47
|
-
if ( statusText !== '' ) {
|
|
48
|
-
statusText = `Status: ${ statusText }`;
|
|
49
|
-
}
|
|
50
|
-
const stepText = `Step ${ order } of ${ totalSteps }`;
|
|
51
|
-
|
|
52
|
-
const borderLeftColor = `wizard.step.border.${ status }`;
|
|
53
|
-
const statusIconColor = `wizard.step.icon.${ status }`;
|
|
54
|
-
const headingColor = `wizard.step.heading.${ status }`;
|
|
55
|
-
|
|
56
|
-
const StatusIcon = complete ? BsFillCheckCircleFill : BsCircleFill;
|
|
57
|
-
|
|
58
|
-
useLayoutEffect( () => {
|
|
59
|
-
if ( active && titleRef?.current && shouldFocusTitle ) {
|
|
60
|
-
titleRef.current.focus();
|
|
61
|
-
}
|
|
62
|
-
}, [ active, shouldFocusTitle ] );
|
|
63
|
-
return (
|
|
64
|
-
<Card
|
|
65
|
-
as="section"
|
|
66
|
-
sx={ {
|
|
67
|
-
boxShadow: active ? 'low' : 'none',
|
|
68
|
-
borderLeft: '2px solid',
|
|
69
|
-
p: 4,
|
|
70
|
-
backgroundColor: active ? 'background' : 'transparent',
|
|
71
|
-
borderRadius: 0,
|
|
72
|
-
borderBottom: active ? 'none' : '1px solid',
|
|
73
|
-
'&:first-of-type': {
|
|
74
|
-
borderTopWidth: '1px',
|
|
75
|
-
borderTopStyle: 'solid',
|
|
76
|
-
},
|
|
77
|
-
borderColor: 'wizard.step.border.default',
|
|
78
|
-
borderLeftColor,
|
|
79
|
-
overflow: 'inherit',
|
|
80
|
-
} }
|
|
81
|
-
data-step={ order }
|
|
82
|
-
data-active={ active || undefined }
|
|
83
|
-
ref={ forwardRef }
|
|
84
|
-
// aria-current={ active ? 'step' : undefined }
|
|
85
|
-
>
|
|
86
|
-
<Flex sx={ { alignItems: 'flex-end', mb: 2 } }>
|
|
87
|
-
<Heading
|
|
88
|
-
variant={ titleVariant }
|
|
89
|
-
sx={ {
|
|
90
|
-
mb: 1,
|
|
91
|
-
color: headingColor,
|
|
92
|
-
fontSize: 2,
|
|
93
|
-
fontWeight: '500',
|
|
94
|
-
flexGrow: 1,
|
|
95
|
-
} }
|
|
96
|
-
ref={ titleRef }
|
|
97
|
-
tabIndex={ shouldFocusTitle ? -1 : undefined }
|
|
98
|
-
aria-current={ active ? 'step' : undefined }
|
|
99
|
-
>
|
|
100
|
-
<Text sx={ { color: 'wizard.step.number.color' } } aria-hidden="true">
|
|
101
|
-
{ stepText }
|
|
102
|
-
</Text>
|
|
103
|
-
|
|
104
|
-
<Flex as="span" sx={ { mt: 3, alignItems: 'center' } } aria-hidden="true">
|
|
105
|
-
<StatusIcon
|
|
106
|
-
sx={ {
|
|
107
|
-
mr: 3,
|
|
108
|
-
mt: 0,
|
|
109
|
-
color: statusIconColor,
|
|
110
|
-
} }
|
|
111
|
-
/>
|
|
112
|
-
{ title }
|
|
113
|
-
</Flex>
|
|
114
|
-
|
|
115
|
-
<ScreenReaderText>{
|
|
116
|
-
/**
|
|
117
|
-
* we are adding the composed title here so that it's announced correctly by the voiceover
|
|
118
|
-
* Using tags inside the heading would make the voiceover read the heading in multiple parts
|
|
119
|
-
**/
|
|
120
|
-
`${ stepText }: ${ title }. ${ statusText }`
|
|
121
|
-
}</ScreenReaderText>
|
|
122
|
-
</Heading>
|
|
123
|
-
|
|
124
|
-
{ ! active && ( complete || skipped ) && onChange && (
|
|
125
|
-
<Button
|
|
126
|
-
variant="text"
|
|
127
|
-
onClick={ onChange }
|
|
128
|
-
sx={ { height: 'auto', alignSelf: 'flex-end' } }
|
|
129
|
-
>
|
|
130
|
-
Change <ScreenReaderText>{ `the ${ title } step` }</ScreenReaderText>
|
|
131
|
-
</Button>
|
|
132
|
-
) }
|
|
133
|
-
</Flex>
|
|
134
|
-
{ ! active && ( complete || skipped ) && summary?.length > 0 && (
|
|
135
|
-
<Table
|
|
136
|
-
caption={ `Summary of ${ title }` }
|
|
137
|
-
sx={ {
|
|
138
|
-
width: 'auto',
|
|
139
|
-
minWidth: 'auto',
|
|
140
|
-
'> tbody > tr': {
|
|
141
|
-
'> td, > th': {
|
|
142
|
-
fontWeight: '500',
|
|
143
|
-
border: 'none',
|
|
144
|
-
pl: 0,
|
|
145
|
-
'&:first-of-type': { pl: 0 },
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
} }
|
|
149
|
-
>
|
|
150
|
-
<tbody>
|
|
151
|
-
{ summary.map( ( item, index ) => (
|
|
152
|
-
<TableRow key={ `summary_tb_${ index }` }>
|
|
153
|
-
<TableCell
|
|
154
|
-
as="th"
|
|
155
|
-
scope="row"
|
|
156
|
-
sx={ { color: 'gray', whiteSpace: 'nowrap', pr: 1 } }
|
|
157
|
-
>
|
|
158
|
-
{ item.label }
|
|
159
|
-
{ item.value ? ':' : '' }
|
|
160
|
-
</TableCell>
|
|
161
|
-
<TableCell sx={ { color: 'text' } }>
|
|
162
|
-
<strong>{ item.value }</strong>
|
|
163
|
-
</TableCell>
|
|
164
|
-
</TableRow>
|
|
165
|
-
) ) }
|
|
166
|
-
</tbody>
|
|
167
|
-
</Table>
|
|
168
|
-
) }
|
|
169
|
-
|
|
170
|
-
{ subTitle && active && <Text sx={ { mb: 3, mt: 2 } }>{ subTitle }</Text> }
|
|
171
|
-
|
|
172
|
-
{ active && children }
|
|
173
|
-
</Card>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
);
|
|
177
|
-
|
|
178
|
-
WizardStep.displayName = 'WizardStep';
|
|
179
|
-
|
|
180
|
-
WizardStep.propTypes = {
|
|
181
|
-
active: PropTypes.bool,
|
|
182
|
-
children: PropTypes.node,
|
|
183
|
-
complete: PropTypes.bool,
|
|
184
|
-
order: PropTypes.number.isRequired,
|
|
185
|
-
totalSteps: PropTypes.number.isRequired,
|
|
186
|
-
subTitle: PropTypes.node,
|
|
187
|
-
title: PropTypes.string,
|
|
188
|
-
titleVariant: PropTypes.string,
|
|
189
|
-
skipped: PropTypes.bool,
|
|
190
|
-
onChange: PropTypes.func,
|
|
191
|
-
summary: PropTypes.arrayOf(
|
|
192
|
-
PropTypes.shape( {
|
|
193
|
-
label: PropTypes.node,
|
|
194
|
-
value: PropTypes.node,
|
|
195
|
-
} )
|
|
196
|
-
),
|
|
197
|
-
shouldFocusTitle: PropTypes.bool,
|
|
198
|
-
};
|
|
199
21
|
|
|
200
|
-
|
|
22
|
+
var WizardStep = exports.WizardStep = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
|
|
23
|
+
var title = _ref.title,
|
|
24
|
+
subTitle = _ref.subTitle,
|
|
25
|
+
_ref$skipped = _ref.skipped,
|
|
26
|
+
skipped = _ref$skipped === void 0 ? false : _ref$skipped,
|
|
27
|
+
_ref$complete = _ref.complete,
|
|
28
|
+
complete = _ref$complete === void 0 ? false : _ref$complete,
|
|
29
|
+
children = _ref.children,
|
|
30
|
+
active = _ref.active,
|
|
31
|
+
order = _ref.order,
|
|
32
|
+
totalSteps = _ref.totalSteps,
|
|
33
|
+
shouldFocusTitle = _ref.shouldFocusTitle,
|
|
34
|
+
_ref$titleVariant = _ref.titleVariant,
|
|
35
|
+
titleVariant = _ref$titleVariant === void 0 ? 'h3' : _ref$titleVariant,
|
|
36
|
+
summary = _ref.summary,
|
|
37
|
+
onChange = _ref.onChange;
|
|
38
|
+
var titleRef = _react["default"].useRef(null);
|
|
39
|
+
var status = 'inactive';
|
|
40
|
+
var statusText = 'Step not completed';
|
|
41
|
+
if (active) {
|
|
42
|
+
status = 'active';
|
|
43
|
+
statusText = ''; // not adding the status text for active step since it's announced by aria-current
|
|
44
|
+
} else if (complete) {
|
|
45
|
+
status = 'complete';
|
|
46
|
+
statusText = 'Step completed';
|
|
47
|
+
} else if (skipped) {
|
|
48
|
+
status = 'skipped';
|
|
49
|
+
statusText = 'Step skipped';
|
|
50
|
+
}
|
|
51
|
+
if (statusText !== '') {
|
|
52
|
+
statusText = "Status: " + statusText;
|
|
53
|
+
}
|
|
54
|
+
var stepText = "Step " + order + " of " + totalSteps;
|
|
55
|
+
var borderLeftColor = "wizard.step.border." + status;
|
|
56
|
+
var statusIconColor = "wizard.step.icon." + status;
|
|
57
|
+
var statusIconStyles = {
|
|
58
|
+
mr: 3,
|
|
59
|
+
mt: 0,
|
|
60
|
+
color: statusIconColor
|
|
61
|
+
};
|
|
62
|
+
var headingColor = "wizard.step.heading." + status;
|
|
63
|
+
(0, _react.useLayoutEffect)(function () {
|
|
64
|
+
if (active && titleRef != null && titleRef.current && shouldFocusTitle) {
|
|
65
|
+
titleRef.current.focus();
|
|
66
|
+
}
|
|
67
|
+
}, [active, shouldFocusTitle]);
|
|
68
|
+
return (0, _jsxRuntime.jsxs)(_.Card, {
|
|
69
|
+
as: "section",
|
|
70
|
+
sx: {
|
|
71
|
+
boxShadow: active ? 'low' : 'none',
|
|
72
|
+
borderLeft: '2px solid',
|
|
73
|
+
p: 4,
|
|
74
|
+
backgroundColor: active ? 'background' : 'transparent',
|
|
75
|
+
borderRadius: 0,
|
|
76
|
+
borderBottom: active ? 'none' : '1px solid',
|
|
77
|
+
'&:first-of-type': {
|
|
78
|
+
borderTopWidth: '1px',
|
|
79
|
+
borderTopStyle: 'solid'
|
|
80
|
+
},
|
|
81
|
+
borderColor: 'wizard.step.border.default',
|
|
82
|
+
borderLeftColor: borderLeftColor,
|
|
83
|
+
overflow: 'inherit'
|
|
84
|
+
},
|
|
85
|
+
"data-step": order,
|
|
86
|
+
"data-active": active || undefined,
|
|
87
|
+
ref: forwardRef,
|
|
88
|
+
children: [(0, _jsxRuntime.jsxs)(_.Flex, {
|
|
89
|
+
sx: {
|
|
90
|
+
alignItems: 'flex-end',
|
|
91
|
+
mb: 2
|
|
92
|
+
},
|
|
93
|
+
children: [(0, _jsxRuntime.jsxs)(_.Heading, {
|
|
94
|
+
variant: titleVariant,
|
|
95
|
+
sx: {
|
|
96
|
+
mb: 1,
|
|
97
|
+
color: headingColor,
|
|
98
|
+
fontSize: 2,
|
|
99
|
+
fontWeight: 'heading',
|
|
100
|
+
flexGrow: 1
|
|
101
|
+
},
|
|
102
|
+
ref: titleRef,
|
|
103
|
+
tabIndex: shouldFocusTitle ? -1 : undefined,
|
|
104
|
+
"aria-current": active ? 'step' : undefined,
|
|
105
|
+
children: [(0, _jsxRuntime.jsx)(_.Text, {
|
|
106
|
+
sx: {
|
|
107
|
+
color: 'wizard.step.number.color'
|
|
108
|
+
},
|
|
109
|
+
"aria-hidden": "true",
|
|
110
|
+
children: stepText
|
|
111
|
+
}), (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
112
|
+
as: "span",
|
|
113
|
+
sx: {
|
|
114
|
+
mt: 3,
|
|
115
|
+
alignItems: 'center'
|
|
116
|
+
},
|
|
117
|
+
"aria-hidden": "true",
|
|
118
|
+
children: [complete ? (0, _jsxRuntime.jsx)(_bs.BsFillCheckCircleFill, {
|
|
119
|
+
sx: statusIconStyles
|
|
120
|
+
}) : (0, _jsxRuntime.jsx)(_bs.BsCircleFill, {
|
|
121
|
+
sx: statusIconStyles
|
|
122
|
+
}), title]
|
|
123
|
+
}), (0, _jsxRuntime.jsx)(_ScreenReaderText.ScreenReaderText, {
|
|
124
|
+
children:
|
|
125
|
+
/**
|
|
126
|
+
* we are adding the composed title here so that it's announced correctly by the voiceover
|
|
127
|
+
* Using tags inside the heading would make the voiceover read the heading in multiple parts
|
|
128
|
+
**/
|
|
129
|
+
stepText + ": " + (title == null ? void 0 : title.toString()) + ". " + statusText
|
|
130
|
+
})]
|
|
131
|
+
}), !active && (complete || skipped) && onChange && (0, _jsxRuntime.jsxs)(_.Button, {
|
|
132
|
+
variant: "text",
|
|
133
|
+
onClick: onChange,
|
|
134
|
+
sx: {
|
|
135
|
+
height: 'auto',
|
|
136
|
+
alignSelf: 'flex-end'
|
|
137
|
+
},
|
|
138
|
+
children: ["Change ", (0, _jsxRuntime.jsx)(_ScreenReaderText.ScreenReaderText, {
|
|
139
|
+
children: "the " + (title == null ? void 0 : title.toString()) + " step"
|
|
140
|
+
})]
|
|
141
|
+
})]
|
|
142
|
+
}), !active && (complete || skipped) && summary && summary.length > 0 && (0, _jsxRuntime.jsx)(_.Table, {
|
|
143
|
+
caption: "Summary of " + (title == null ? void 0 : title.toString()),
|
|
144
|
+
sx: {
|
|
145
|
+
width: 'auto',
|
|
146
|
+
minWidth: 'auto',
|
|
147
|
+
'> tbody > tr': {
|
|
148
|
+
'> td, > th': {
|
|
149
|
+
fontWeight: 'heading',
|
|
150
|
+
border: 'none',
|
|
151
|
+
pl: 0,
|
|
152
|
+
'&:first-of-type': {
|
|
153
|
+
pl: 0
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
children: (0, _jsxRuntime.jsx)("tbody", {
|
|
159
|
+
children: summary.map(function (item, index) {
|
|
160
|
+
return (0, _jsxRuntime.jsxs)(_.TableRow, {
|
|
161
|
+
children: [(0, _jsxRuntime.jsxs)(_.TableCell, {
|
|
162
|
+
as: "th",
|
|
163
|
+
scope: "row",
|
|
164
|
+
sx: {
|
|
165
|
+
color: 'gray',
|
|
166
|
+
whiteSpace: 'nowrap',
|
|
167
|
+
pr: 1
|
|
168
|
+
},
|
|
169
|
+
children: [item.label, item.value ? ':' : '']
|
|
170
|
+
}), (0, _jsxRuntime.jsx)(_.TableCell, {
|
|
171
|
+
sx: {
|
|
172
|
+
color: 'text'
|
|
173
|
+
},
|
|
174
|
+
children: (0, _jsxRuntime.jsx)("strong", {
|
|
175
|
+
children: item.value
|
|
176
|
+
})
|
|
177
|
+
})]
|
|
178
|
+
}, "summary_tb_" + index);
|
|
179
|
+
})
|
|
180
|
+
})
|
|
181
|
+
}), subTitle && active && (0, _jsxRuntime.jsx)(_.Text, {
|
|
182
|
+
sx: {
|
|
183
|
+
mb: 3,
|
|
184
|
+
mt: 2
|
|
185
|
+
},
|
|
186
|
+
children: subTitle
|
|
187
|
+
}), active && children]
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
WizardStep.displayName = 'WizardStep';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
1
4
|
import { Wizard } from './Wizard';
|
|
2
5
|
import { WizardStep } from './WizardStep';
|
|
3
|
-
|
|
4
|
-
export { Wizard, WizardStep, WizardStepHorizontal };
|
|
6
|
+
export { Wizard, WizardStep };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Wizard } from './Wizard';
|
|
5
|
-
import { WizardStep } from './WizardStep';
|
|
6
|
-
import { WizardStepHorizontal } from './WizardStepHorizontal';
|
|
1
|
+
"use strict";
|
|
7
2
|
|
|
8
|
-
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
var _Wizard = require("./Wizard");
|
|
5
|
+
exports.Wizard = _Wizard.Wizard;
|
|
6
|
+
var _WizardStep = require("./WizardStep");
|
|
7
|
+
exports.WizardStep = _WizardStep.WizardStep;
|
package/build/system/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Badge } from './Badge';
|
|
|
4
4
|
import { Box } from './Box';
|
|
5
5
|
import { Button } from './Button';
|
|
6
6
|
import { ButtonSubmit } from './Button';
|
|
7
|
+
import { ButtonVariant } from './Button';
|
|
7
8
|
import { Card } from './Card';
|
|
8
9
|
import { Checkbox } from './Form';
|
|
9
10
|
import { Code } from './Code';
|
|
@@ -46,6 +47,5 @@ import { ToggleRow } from './Form';
|
|
|
46
47
|
import { Validation } from './Form';
|
|
47
48
|
import { Wizard } from './Wizard';
|
|
48
49
|
import { WizardStep } from './Wizard';
|
|
49
|
-
import { WizardStepHorizontal } from './Wizard';
|
|
50
50
|
import theme from './theme';
|
|
51
|
-
export { Accordion, Avatar, Badge, Box, Button, ButtonSubmit, Card, Checkbox, Code, Dialog, NewDialog, Form, Dropdown, DialogButton, DialogMenu, DialogMenuItem, DialogDivider, DialogContent, DialogTrigger, ConfirmationDialog, NewConfirmationDialog, Grid, Flex, Notice, OptionRow, Heading, Input, Label, Spinner, Table, TableRow, TableCell, Tooltip, Link, Radio, RadioBoxGroup, Textarea, Progress, Text, Tabs, TabsTrigger, TabsContent, TabsList, Toggle, ToggleRow, Validation, Wizard, WizardStep, WizardStepHorizontal, theme };
|
|
51
|
+
export { Accordion, Avatar, Badge, Box, Button, ButtonSubmit, ButtonVariant, Card, Checkbox, Code, Dialog, NewDialog, Form, Dropdown, DialogButton, DialogMenu, DialogMenuItem, DialogDivider, DialogContent, DialogTrigger, ConfirmationDialog, NewConfirmationDialog, Grid, Flex, Notice, OptionRow, Heading, Input, Label, Spinner, Table, TableRow, TableCell, Tooltip, Link, Radio, RadioBoxGroup, Textarea, Progress, Text, Tabs, TabsTrigger, TabsContent, TabsList, Toggle, ToggleRow, Validation, Wizard, WizardStep, WizardStepHorizontal, theme };
|
package/build/system/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Avatar } from './Avatar';
|
|
5
5
|
import { Badge } from './Badge';
|
|
6
6
|
import { Box } from './Box';
|
|
7
|
-
import { Button, ButtonSubmit } from './Button';
|
|
7
|
+
import { Button, ButtonSubmit, ButtonVariant } from './Button';
|
|
8
8
|
import { Card } from './Card';
|
|
9
9
|
import { Code } from './Code';
|
|
10
10
|
import {
|
|
@@ -58,6 +58,7 @@ export {
|
|
|
58
58
|
Box,
|
|
59
59
|
Button,
|
|
60
60
|
ButtonSubmit,
|
|
61
|
+
ButtonVariant,
|
|
61
62
|
Card,
|
|
62
63
|
Checkbox,
|
|
63
64
|
Code,
|