@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,103 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Wizard = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
7
|
+
var _ = require("..");
|
|
8
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
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, useState } from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import classNames from 'classnames';
|
|
9
|
-
import { MdArrowForward } from 'react-icons/md';
|
|
10
17
|
|
|
11
18
|
/**
|
|
12
19
|
* Internal dependencies
|
|
13
20
|
*/
|
|
14
|
-
import { Box, WizardStep, Flex, WizardStepHorizontal } from '..';
|
|
15
|
-
|
|
16
|
-
const Wizard = React.forwardRef(
|
|
17
|
-
(
|
|
18
|
-
{
|
|
19
|
-
steps,
|
|
20
|
-
activeStep,
|
|
21
|
-
variant,
|
|
22
|
-
completed = [],
|
|
23
|
-
skipped = [],
|
|
24
|
-
className = null,
|
|
25
|
-
titleAutofocus = false,
|
|
26
|
-
...props
|
|
27
|
-
},
|
|
28
|
-
forwardRef
|
|
29
|
-
) => {
|
|
30
|
-
const [ didMount, setDidMount ] = useState( false );
|
|
31
|
-
const [ initialStep ] = useState( activeStep );
|
|
32
|
-
// didMount helps us to track the initial render, so we can focus the title only subsequent renders
|
|
33
|
-
// to avoid stealing the focus from the page we're in.
|
|
34
|
-
useLayoutEffect( () => {
|
|
35
|
-
if ( ! didMount && activeStep !== initialStep ) {
|
|
36
|
-
setDidMount( true );
|
|
37
|
-
}
|
|
38
|
-
}, [ initialStep, activeStep, didMount, setDidMount ] );
|
|
39
|
-
return (
|
|
40
|
-
<Box className={ classNames( 'vip-wizard-component', className ) } ref={ forwardRef }>
|
|
41
|
-
{ variant === 'horizontal' ? (
|
|
42
|
-
<Box>
|
|
43
|
-
<Flex
|
|
44
|
-
sx={ {
|
|
45
|
-
flex: '0 0 auto',
|
|
46
|
-
} }
|
|
47
|
-
{ ...props }
|
|
48
|
-
>
|
|
49
|
-
{ steps.map( ( { title, subTitle, titleVariant }, index ) => (
|
|
50
|
-
<React.Fragment key={ index }>
|
|
51
|
-
<WizardStepHorizontal
|
|
52
|
-
active={ index === activeStep }
|
|
53
|
-
order={ index + 1 }
|
|
54
|
-
subTitle={ subTitle }
|
|
55
|
-
title={ title }
|
|
56
|
-
titleVariant={ titleVariant }
|
|
57
|
-
/>
|
|
58
|
-
{ index < steps.length - 1 && (
|
|
59
|
-
<MdArrowForward sx={ { mx: 2, color: 'gray.80' } } />
|
|
60
|
-
) }
|
|
61
|
-
</React.Fragment>
|
|
62
|
-
) ) }
|
|
63
|
-
</Flex>
|
|
64
|
-
{ steps[ activeStep ].children }
|
|
65
|
-
</Box>
|
|
66
|
-
) : (
|
|
67
|
-
steps.map( ( { title, subTitle, children, titleVariant, summary, onChange }, index ) => (
|
|
68
|
-
<WizardStep
|
|
69
|
-
active={ index === activeStep }
|
|
70
|
-
complete={ completed.includes( index ) }
|
|
71
|
-
skipped={ skipped.includes( index ) }
|
|
72
|
-
key={ index }
|
|
73
|
-
order={ index + 1 }
|
|
74
|
-
totalSteps={ steps.length }
|
|
75
|
-
subTitle={ subTitle }
|
|
76
|
-
title={ title }
|
|
77
|
-
titleVariant={ titleVariant }
|
|
78
|
-
summary={ summary }
|
|
79
|
-
onChange={ onChange }
|
|
80
|
-
shouldFocusTitle={ titleAutofocus && didMount }
|
|
81
|
-
>
|
|
82
|
-
{ children }
|
|
83
|
-
</WizardStep>
|
|
84
|
-
) )
|
|
85
|
-
) }
|
|
86
|
-
</Box>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
Wizard.displayName = 'Wizard';
|
|
92
|
-
|
|
93
|
-
Wizard.propTypes = {
|
|
94
|
-
steps: PropTypes.array,
|
|
95
|
-
activeStep: PropTypes.number,
|
|
96
|
-
variant: PropTypes.string,
|
|
97
|
-
completed: PropTypes.array,
|
|
98
|
-
skipped: PropTypes.array,
|
|
99
|
-
className: PropTypes.any,
|
|
100
|
-
titleAutofocus: PropTypes.bool,
|
|
101
|
-
};
|
|
102
21
|
|
|
103
|
-
|
|
22
|
+
var Wizard = exports.Wizard = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
|
|
23
|
+
var steps = _ref.steps,
|
|
24
|
+
activeStep = _ref.activeStep,
|
|
25
|
+
_ref$completed = _ref.completed,
|
|
26
|
+
completed = _ref$completed === void 0 ? [] : _ref$completed,
|
|
27
|
+
_ref$skipped = _ref.skipped,
|
|
28
|
+
skipped = _ref$skipped === void 0 ? [] : _ref$skipped,
|
|
29
|
+
_ref$className = _ref.className,
|
|
30
|
+
className = _ref$className === void 0 ? null : _ref$className,
|
|
31
|
+
_ref$titleAutofocus = _ref.titleAutofocus,
|
|
32
|
+
titleAutofocus = _ref$titleAutofocus === void 0 ? false : _ref$titleAutofocus;
|
|
33
|
+
var _useState = (0, _react.useState)(false),
|
|
34
|
+
didMount = _useState[0],
|
|
35
|
+
setDidMount = _useState[1];
|
|
36
|
+
var _useState2 = (0, _react.useState)(activeStep),
|
|
37
|
+
initialStep = _useState2[0];
|
|
38
|
+
// didMount helps us to track the initial render, so we can focus the title only subsequent renders
|
|
39
|
+
// to avoid stealing the focus from the page we're in.
|
|
40
|
+
(0, _react.useLayoutEffect)(function () {
|
|
41
|
+
if (!didMount && activeStep !== initialStep) {
|
|
42
|
+
setDidMount(true);
|
|
43
|
+
}
|
|
44
|
+
}, [initialStep, activeStep, didMount, setDidMount]);
|
|
45
|
+
return (0, _jsxRuntime.jsx)(_.Box, {
|
|
46
|
+
className: (0, _classnames["default"])('vip-wizard-component', className),
|
|
47
|
+
ref: forwardRef,
|
|
48
|
+
children: steps.map(function (_ref2, index) {
|
|
49
|
+
var title = _ref2.title,
|
|
50
|
+
subTitle = _ref2.subTitle,
|
|
51
|
+
children = _ref2.children,
|
|
52
|
+
titleVariant = _ref2.titleVariant,
|
|
53
|
+
summary = _ref2.summary,
|
|
54
|
+
onChange = _ref2.onChange;
|
|
55
|
+
return (0, _jsxRuntime.jsx)(_.WizardStep, {
|
|
56
|
+
active: index === activeStep,
|
|
57
|
+
complete: completed.includes(index),
|
|
58
|
+
skipped: skipped.includes(index),
|
|
59
|
+
order: index + 1,
|
|
60
|
+
totalSteps: steps.length,
|
|
61
|
+
subTitle: subTitle,
|
|
62
|
+
title: title,
|
|
63
|
+
titleVariant: titleVariant,
|
|
64
|
+
summary: summary,
|
|
65
|
+
onChange: onChange,
|
|
66
|
+
shouldFocusTitle: titleAutofocus && didMount,
|
|
67
|
+
children: children
|
|
68
|
+
}, index);
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
Wizard.displayName = 'Wizard';
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default _default;
|
|
6
|
-
export function Default(): React.JSX.Element;
|
|
7
|
-
export function WithTitleAutoFocus(): React.JSX.Element;
|
|
8
|
-
import { Wizard } from '..';
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
9
5
|
import React from 'react';
|
|
6
|
+
declare const _default: {
|
|
7
|
+
title: string;
|
|
8
|
+
component: React.ForwardRefExoticComponent<import("./Wizard").WizardProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
export declare const Default: () => React.JSX.Element;
|
|
12
|
+
export declare const WithTitleAutoFocus: () => React.JSX.Element;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.WithTitleAutoFocus = exports.Default = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _ = require("..");
|
|
7
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
/** @jsxImportSource theme-ui */
|
|
10
|
+
/**
|
|
11
|
+
* External dependencies
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
var _default = exports["default"] = {
|
|
17
|
+
title: 'Wizard',
|
|
18
|
+
component: _.Wizard
|
|
19
|
+
};
|
|
20
|
+
var Default = exports.Default = function Default() {
|
|
21
|
+
var steps = [{
|
|
22
|
+
title: 'Choose Domain',
|
|
23
|
+
titleVariant: 'h2',
|
|
24
|
+
subTitle: 'You can bring a domain name you already own, or buy a new one.',
|
|
25
|
+
children: (0, _jsxRuntime.jsxs)(_.Box, {
|
|
26
|
+
children: [(0, _jsxRuntime.jsx)(_.Label, {
|
|
27
|
+
children: "Domain"
|
|
28
|
+
}), (0, _jsxRuntime.jsx)(_.Input, {
|
|
29
|
+
placeholder: "yourdomain.com"
|
|
30
|
+
}), (0, _jsxRuntime.jsx)(_.Button, {
|
|
31
|
+
sx: {
|
|
32
|
+
mt: 3
|
|
33
|
+
},
|
|
34
|
+
children: "Continue"
|
|
35
|
+
})]
|
|
36
|
+
})
|
|
37
|
+
}, {
|
|
38
|
+
title: 'Configure DNS',
|
|
39
|
+
titleVariant: 'h2'
|
|
40
|
+
}, {
|
|
41
|
+
title: 'Configure Certificate',
|
|
42
|
+
titleVariant: 'h2'
|
|
43
|
+
}, {
|
|
44
|
+
title: 'Verify Domain',
|
|
45
|
+
titleVariant: 'h2'
|
|
46
|
+
}];
|
|
47
|
+
return (0, _jsxRuntime.jsx)(_react["default"].Fragment, {
|
|
48
|
+
children: (0, _jsxRuntime.jsx)(_.Box, {
|
|
49
|
+
mt: 4,
|
|
50
|
+
children: (0, _jsxRuntime.jsx)(_.Wizard, {
|
|
51
|
+
activeStep: 0,
|
|
52
|
+
steps: steps,
|
|
53
|
+
completed: [1],
|
|
54
|
+
className: "vip-wizard-xyz"
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
var WithTitleAutoFocus = exports.WithTitleAutoFocus = function WithTitleAutoFocus() {
|
|
60
|
+
var _React$useState = _react["default"].useState(0),
|
|
61
|
+
activeStep = _React$useState[0],
|
|
62
|
+
setActiveStep = _React$useState[1];
|
|
63
|
+
var _React$useState2 = _react["default"].useState(true),
|
|
64
|
+
autoFocus = _React$useState2[0],
|
|
65
|
+
setAutoFocus = _React$useState2[1];
|
|
66
|
+
var steps = [{
|
|
67
|
+
title: 'Choose Domain',
|
|
68
|
+
titleVariant: 'h2',
|
|
69
|
+
summary: [{
|
|
70
|
+
label: 'Demo Label',
|
|
71
|
+
value: 'Demo value'
|
|
72
|
+
}],
|
|
73
|
+
onChange: function onChange() {
|
|
74
|
+
return setActiveStep(0);
|
|
75
|
+
},
|
|
76
|
+
children: (0, _jsxRuntime.jsxs)(_.Box, {
|
|
77
|
+
children: [(0, _jsxRuntime.jsx)(_.Label, {
|
|
78
|
+
children: "Domain"
|
|
79
|
+
}), (0, _jsxRuntime.jsx)(_.Input, {
|
|
80
|
+
placeholder: "yourdomain.com"
|
|
81
|
+
}), (0, _jsxRuntime.jsx)(_.Button, {
|
|
82
|
+
sx: {
|
|
83
|
+
mt: 3
|
|
84
|
+
},
|
|
85
|
+
onClick: function onClick() {
|
|
86
|
+
return setActiveStep(1);
|
|
87
|
+
},
|
|
88
|
+
children: "Continue"
|
|
89
|
+
})]
|
|
90
|
+
})
|
|
91
|
+
}, {
|
|
92
|
+
title: 'Configure DNS',
|
|
93
|
+
titleVariant: 'h2',
|
|
94
|
+
onChange: function onChange() {
|
|
95
|
+
return setActiveStep(1);
|
|
96
|
+
},
|
|
97
|
+
children: (0, _jsxRuntime.jsxs)(_.Box, {
|
|
98
|
+
children: [(0, _jsxRuntime.jsx)(_.Label, {
|
|
99
|
+
children: "DNS"
|
|
100
|
+
}), (0, _jsxRuntime.jsx)(_.Button, {
|
|
101
|
+
sx: {
|
|
102
|
+
mt: 3
|
|
103
|
+
},
|
|
104
|
+
onClick: function onClick() {
|
|
105
|
+
return setActiveStep(0);
|
|
106
|
+
},
|
|
107
|
+
children: "back"
|
|
108
|
+
})]
|
|
109
|
+
})
|
|
110
|
+
}, {
|
|
111
|
+
title: 'Certificate',
|
|
112
|
+
titleVariant: 'h2',
|
|
113
|
+
summary: [{
|
|
114
|
+
label: 'Certificate status',
|
|
115
|
+
value: 'Not found'
|
|
116
|
+
}],
|
|
117
|
+
onChange: function onChange() {
|
|
118
|
+
return setActiveStep(2);
|
|
119
|
+
},
|
|
120
|
+
children: (0, _jsxRuntime.jsxs)(_.Box, {
|
|
121
|
+
children: [(0, _jsxRuntime.jsx)(_.Label, {
|
|
122
|
+
children: "Certificate validation"
|
|
123
|
+
}), (0, _jsxRuntime.jsx)(_.Button, {
|
|
124
|
+
sx: {
|
|
125
|
+
mt: 3
|
|
126
|
+
},
|
|
127
|
+
children: "Check certificate"
|
|
128
|
+
})]
|
|
129
|
+
})
|
|
130
|
+
}];
|
|
131
|
+
return (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
|
|
132
|
+
children: [(0, _jsxRuntime.jsx)(_.Box, {
|
|
133
|
+
mt: 4,
|
|
134
|
+
children: (0, _jsxRuntime.jsx)(_.Wizard, {
|
|
135
|
+
completed: [0, 1],
|
|
136
|
+
skipped: [2],
|
|
137
|
+
activeStep: activeStep,
|
|
138
|
+
steps: steps,
|
|
139
|
+
titleAutofocus: autoFocus,
|
|
140
|
+
className: "vip-wizard-xyz"
|
|
141
|
+
})
|
|
142
|
+
}), (0, _jsxRuntime.jsx)(_.Box, {
|
|
143
|
+
mt: 4,
|
|
144
|
+
children: (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
145
|
+
sx: {
|
|
146
|
+
alignItems: 'center'
|
|
147
|
+
},
|
|
148
|
+
children: [(0, _jsxRuntime.jsx)(_.Checkbox, {
|
|
149
|
+
id: "wizard-autofocus",
|
|
150
|
+
checked: autoFocus,
|
|
151
|
+
"aria-labelledby": "label-check1",
|
|
152
|
+
onCheckedChange: function onCheckedChange(e) {
|
|
153
|
+
setAutoFocus(e === true);
|
|
154
|
+
}
|
|
155
|
+
}), (0, _jsxRuntime.jsx)(_.Label, {
|
|
156
|
+
sx: {
|
|
157
|
+
m: 0,
|
|
158
|
+
ml: 2
|
|
159
|
+
},
|
|
160
|
+
htmlFor: "wizard-autofocus",
|
|
161
|
+
id: "label-check1",
|
|
162
|
+
children: "Autofocus enabled?"
|
|
163
|
+
})]
|
|
164
|
+
})
|
|
165
|
+
})]
|
|
166
|
+
});
|
|
167
|
+
};
|
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
2
5
|
import React from 'react';
|
|
6
|
+
import { HeadingProps } from '../Heading/Heading';
|
|
7
|
+
export interface WizardStepSummary {
|
|
8
|
+
label?: React.ReactNode;
|
|
9
|
+
value?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface WizardStepProps {
|
|
12
|
+
active?: boolean;
|
|
13
|
+
complete?: boolean;
|
|
14
|
+
order?: number;
|
|
15
|
+
totalSteps?: number;
|
|
16
|
+
title: React.ReactNode;
|
|
17
|
+
titleVariant?: HeadingProps['variant'];
|
|
18
|
+
subTitle?: React.ReactNode;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
skipped?: boolean;
|
|
21
|
+
onChange?: () => void;
|
|
22
|
+
summary?: WizardStepSummary[];
|
|
23
|
+
shouldFocusTitle?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare const WizardStep: React.ForwardRefExoticComponent<WizardStepProps & React.RefAttributes<HTMLDivElement>>;
|