@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,41 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Legend = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
7
|
+
var _Label = require("../Form/Label");
|
|
8
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
+
var _excluded = ["children", "className", "sx"];
|
|
10
|
+
/** @jsxImportSource theme-ui */
|
|
3
11
|
/**
|
|
4
12
|
* External dependencies
|
|
5
13
|
*/
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import classNames from 'classnames';
|
|
9
|
-
|
|
10
14
|
/**
|
|
11
15
|
* Internal dependencies
|
|
12
16
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
className: PropTypes.any,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
Legend.displayName = 'Legend';
|
|
40
|
-
|
|
41
|
-
export { Legend };
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
18
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
+
var Legend = exports.Legend = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
|
|
21
|
+
var children = _ref.children,
|
|
22
|
+
className = _ref.className,
|
|
23
|
+
_ref$sx = _ref.sx,
|
|
24
|
+
sx = _ref$sx === void 0 ? {} : _ref$sx,
|
|
25
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
26
|
+
return (0, _jsxRuntime.jsx)("legend", _extends({
|
|
27
|
+
ref: forwardRef,
|
|
28
|
+
className: (0, _classnames["default"])('vip-form-legend-component', className),
|
|
29
|
+
sx: _extends({
|
|
30
|
+
all: 'unset'
|
|
31
|
+
}, _Label.baseLabelStyle, {
|
|
32
|
+
px: 1,
|
|
33
|
+
mb: 0
|
|
34
|
+
}, sx)
|
|
35
|
+
}, props, {
|
|
36
|
+
children: children
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
39
|
+
Legend.displayName = 'Legend';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default Root;
|
|
2
|
-
export const Root: import("react").ForwardRefExoticComponent<import("react").RefAttributes<
|
|
2
|
+
export const Root: import("react").ForwardRefExoticComponent<import("./Form").FormProps & import("react").RefAttributes<HTMLFormElement>>;
|
|
3
3
|
export const Select: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
4
4
|
export const Autocomplete: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
5
5
|
export const AutocompleteMulti: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
@@ -77,7 +77,7 @@ const OptionRow = React.forwardRef(
|
|
|
77
77
|
<Box
|
|
78
78
|
sx={ {
|
|
79
79
|
display: [ 'inline-block', 'inline-block', 'block' ],
|
|
80
|
-
p: small ?
|
|
80
|
+
p: small ? 3 : 5,
|
|
81
81
|
flex: '0 0 auto',
|
|
82
82
|
bg: `optionRow.${ variant }.background`,
|
|
83
83
|
color: `optionRow.${ variant }.icon`,
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ProgressProps } from 'theme-ui';
|
|
3
|
+
export interface ThemeProgressProps extends ProgressProps {
|
|
4
|
+
steps: string[];
|
|
5
|
+
activeStep: number;
|
|
6
|
+
forLabel?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const Progress: import("react").ForwardRefExoticComponent<Omit<ThemeProgressProps, "ref"> & import("react").RefAttributes<HTMLProgressElement>>;
|
|
@@ -1,78 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Progress = void 0;
|
|
5
|
+
var _react = require("react");
|
|
6
|
+
var _themeUi = require("theme-ui");
|
|
7
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
+
var _Spinner = require("../Spinner");
|
|
9
|
+
var _md = require("react-icons/md");
|
|
10
|
+
var _ = require("..");
|
|
11
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
12
|
+
var _excluded = ["steps", "activeStep", "sx", "forLabel", "className"];
|
|
3
13
|
/**
|
|
4
14
|
* External dependencies
|
|
5
15
|
*/
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { Progress as ThemeProgress } from 'theme-ui';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
import classNames from 'classnames';
|
|
10
|
-
|
|
11
16
|
/**
|
|
12
17
|
* Internal dependencies
|
|
13
18
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const Progress = React.forwardRef(
|
|
22
|
-
( { steps, activeStep, sx, forLabel = '', className, ...props }, forwardRef ) => {
|
|
23
|
-
const stepsTotal = steps.length;
|
|
24
|
-
const isDone = activeStep === stepsTotal - 1;
|
|
25
|
-
const instance = uniqueID();
|
|
26
|
-
const htmlFor = `${ prefix }-${ instance }`;
|
|
27
|
-
const currentValue = activeStep + 1;
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Box className={ classNames( prefix, className ) }>
|
|
31
|
-
<ThemeProgress
|
|
32
|
-
sx={ {
|
|
33
|
-
color: 'primary',
|
|
34
|
-
backgroundColor: 'background',
|
|
35
|
-
...sx,
|
|
36
|
-
} }
|
|
37
|
-
max={ stepsTotal }
|
|
38
|
-
value={ currentValue }
|
|
39
|
-
id={ htmlFor }
|
|
40
|
-
aria-label={ forLabel }
|
|
41
|
-
ref={ forwardRef }
|
|
42
|
-
{ ...props }
|
|
43
|
-
/>
|
|
44
|
-
|
|
45
|
-
{ steps && (
|
|
46
|
-
<Flex
|
|
47
|
-
sx={ { alignItems: 'center', mt: 2 } }
|
|
48
|
-
aria-live="polite"
|
|
49
|
-
aria-atomic="true"
|
|
50
|
-
aria-describedby={ htmlFor }
|
|
51
|
-
>
|
|
52
|
-
{ ! isDone && <Spinner size={ 24 } aria-hidden="true" /> }
|
|
53
|
-
{ isDone && <MdCheck size={ 24 } aria-hidden="true" /> }
|
|
54
|
-
|
|
55
|
-
<Text sx={ { ml: 2, mb: 0 } }>
|
|
56
|
-
<strong>{ `${ currentValue } of ${ stepsTotal }` }: </strong>
|
|
57
|
-
<Text as="span" sx={ { color: 'muted' } }>
|
|
58
|
-
{ steps[ activeStep ] }
|
|
59
|
-
</Text>
|
|
60
|
-
</Text>
|
|
61
|
-
</Flex>
|
|
62
|
-
) }
|
|
63
|
-
</Box>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
Progress.displayName = 'Progress';
|
|
69
|
-
|
|
70
|
-
Progress.propTypes = {
|
|
71
|
-
steps: PropTypes.array,
|
|
72
|
-
activeStep: PropTypes.number,
|
|
73
|
-
forLabel: PropTypes.node,
|
|
74
|
-
sx: PropTypes.object,
|
|
75
|
-
className: PropTypes.any,
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
20
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
22
|
+
var prefix = 'vip-progress-component';
|
|
23
|
+
var uniqueID = function uniqueID() {
|
|
24
|
+
return Math.random().toString(36).substring(7);
|
|
76
25
|
};
|
|
77
|
-
|
|
78
|
-
|
|
26
|
+
var Progress = exports.Progress = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
27
|
+
var steps = _ref.steps,
|
|
28
|
+
activeStep = _ref.activeStep,
|
|
29
|
+
sx = _ref.sx,
|
|
30
|
+
_ref$forLabel = _ref.forLabel,
|
|
31
|
+
forLabel = _ref$forLabel === void 0 ? '' : _ref$forLabel,
|
|
32
|
+
className = _ref.className,
|
|
33
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
34
|
+
var stepsTotal = steps.length;
|
|
35
|
+
var isDone = activeStep === stepsTotal - 1;
|
|
36
|
+
var instance = uniqueID();
|
|
37
|
+
var htmlFor = prefix + "-" + instance;
|
|
38
|
+
var currentValue = activeStep + 1;
|
|
39
|
+
return (0, _jsxRuntime.jsxs)(_.Box, {
|
|
40
|
+
className: (0, _classnames["default"])(prefix, className),
|
|
41
|
+
children: [(0, _jsxRuntime.jsx)(_themeUi.Progress, _extends({
|
|
42
|
+
sx: _extends({
|
|
43
|
+
color: 'primary',
|
|
44
|
+
backgroundColor: 'background'
|
|
45
|
+
}, sx),
|
|
46
|
+
max: stepsTotal,
|
|
47
|
+
value: currentValue,
|
|
48
|
+
id: htmlFor,
|
|
49
|
+
"aria-label": forLabel,
|
|
50
|
+
ref: ref
|
|
51
|
+
}, props)), steps && (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
52
|
+
sx: {
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
mt: 2
|
|
55
|
+
},
|
|
56
|
+
"aria-live": "polite",
|
|
57
|
+
"aria-atomic": "true",
|
|
58
|
+
"aria-describedby": htmlFor,
|
|
59
|
+
children: [!isDone && (0, _jsxRuntime.jsx)(_Spinner.Spinner, {
|
|
60
|
+
size: 24,
|
|
61
|
+
"aria-hidden": "true"
|
|
62
|
+
}), isDone && (0, _jsxRuntime.jsx)(_md.MdCheck, {
|
|
63
|
+
size: 24,
|
|
64
|
+
"aria-hidden": "true"
|
|
65
|
+
}), (0, _jsxRuntime.jsxs)(_.Text, {
|
|
66
|
+
sx: {
|
|
67
|
+
ml: 2,
|
|
68
|
+
mb: 0
|
|
69
|
+
},
|
|
70
|
+
children: [(0, _jsxRuntime.jsxs)("strong", {
|
|
71
|
+
children: [currentValue + " of " + stepsTotal, ": "]
|
|
72
|
+
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
73
|
+
as: "span",
|
|
74
|
+
sx: {
|
|
75
|
+
color: 'muted'
|
|
76
|
+
},
|
|
77
|
+
children: steps[activeStep]
|
|
78
|
+
})]
|
|
79
|
+
})]
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
Progress.displayName = 'Progress';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export default _default;
|
|
6
|
-
export function Default(): React.JSX.Element;
|
|
7
|
-
import { Progress } from '..';
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
8
4
|
import React from 'react';
|
|
5
|
+
declare const _default: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: React.ForwardRefExoticComponent<Omit<import("./Progress").ThemeProgressProps, "ref"> & React.RefAttributes<HTMLProgressElement>>;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
export declare const Default: () => React.JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.Default = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _ = require("..");
|
|
7
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
var _default = exports["default"] = {
|
|
14
|
+
title: 'Progress',
|
|
15
|
+
component: _.Progress
|
|
16
|
+
};
|
|
17
|
+
var Default = exports.Default = function Default() {
|
|
18
|
+
var _React$useState = _react["default"].useState(0),
|
|
19
|
+
counter = _React$useState[0],
|
|
20
|
+
setCounter = _React$useState[1];
|
|
21
|
+
var steps = ['Downloading Data', 'Importing Data...', 'Finalizing', 'Done'];
|
|
22
|
+
(0, _react.useEffect)(function () {
|
|
23
|
+
setTimeout(function () {
|
|
24
|
+
if (counter < steps.length - 1) {
|
|
25
|
+
setCounter(counter + 1);
|
|
26
|
+
}
|
|
27
|
+
}, 2000);
|
|
28
|
+
}, [counter, setCounter]);
|
|
29
|
+
return (0, _jsxRuntime.jsx)(_.Progress, {
|
|
30
|
+
forLabel: "Update site progress",
|
|
31
|
+
steps: steps,
|
|
32
|
+
activeStep: counter
|
|
33
|
+
});
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
|
+
var _jestAxe = require("jest-axe");
|
|
5
|
+
var _Progress = require("./Progress");
|
|
6
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
7
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } /**
|
|
10
|
+
* External dependencies
|
|
11
|
+
*/ /**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
var steps = ['Downloading Data', 'Importing Data...', 'Finalizing', 'Done'];
|
|
15
|
+
describe('<Progress />', function () {
|
|
16
|
+
it('renders the progress component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
17
|
+
var _render, container;
|
|
18
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19
|
+
while (1) switch (_context.prev = _context.next) {
|
|
20
|
+
case 0:
|
|
21
|
+
_render = (0, _react.render)((0, _jsxRuntime.jsx)(_Progress.Progress, {
|
|
22
|
+
steps: steps,
|
|
23
|
+
activeStep: 1
|
|
24
|
+
})), container = _render.container;
|
|
25
|
+
expect(container.getElementsByClassName('vip-progress-component')).toBeDefined();
|
|
26
|
+
|
|
27
|
+
// Check for accessibility issues
|
|
28
|
+
_context.t0 = expect;
|
|
29
|
+
_context.next = 5;
|
|
30
|
+
return (0, _jestAxe.axe)(container);
|
|
31
|
+
case 5:
|
|
32
|
+
_context.t1 = _context.sent;
|
|
33
|
+
(0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
34
|
+
case 7:
|
|
35
|
+
case "end":
|
|
36
|
+
return _context.stop();
|
|
37
|
+
}
|
|
38
|
+
}, _callee);
|
|
39
|
+
})));
|
|
40
|
+
it('renders the progress component with different label text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
41
|
+
var _render2, container;
|
|
42
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
43
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
44
|
+
case 0:
|
|
45
|
+
_render2 = (0, _react.render)((0, _jsxRuntime.jsx)(_Progress.Progress, {
|
|
46
|
+
forLabel: "My progress bar",
|
|
47
|
+
steps: steps,
|
|
48
|
+
activeStep: 1
|
|
49
|
+
})), container = _render2.container;
|
|
50
|
+
expect(_react.screen.getByLabelText('My progress bar')).toBeInTheDocument();
|
|
51
|
+
|
|
52
|
+
// Check for accessibility issues
|
|
53
|
+
_context2.t0 = expect;
|
|
54
|
+
_context2.next = 5;
|
|
55
|
+
return (0, _jestAxe.axe)(container);
|
|
56
|
+
case 5:
|
|
57
|
+
_context2.t1 = _context2.sent;
|
|
58
|
+
(0, _context2.t0)(_context2.t1).toHaveNoViolations();
|
|
59
|
+
case 7:
|
|
60
|
+
case "end":
|
|
61
|
+
return _context2.stop();
|
|
62
|
+
}
|
|
63
|
+
}, _callee2);
|
|
64
|
+
})));
|
|
65
|
+
});
|
|
@@ -27,6 +27,42 @@ var Default = exports.Default = function Default() {
|
|
|
27
27
|
color: 'texts.helper'
|
|
28
28
|
},
|
|
29
29
|
children: "Text Helper"
|
|
30
|
+
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
31
|
+
sx: {
|
|
32
|
+
color: 'texts.helper',
|
|
33
|
+
fontWeight: 'body'
|
|
34
|
+
},
|
|
35
|
+
children: "Text Helper"
|
|
36
|
+
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
37
|
+
sx: {
|
|
38
|
+
color: 'texts.helper',
|
|
39
|
+
fontWeight: 'heading'
|
|
40
|
+
},
|
|
41
|
+
children: "Text Helper"
|
|
42
|
+
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
43
|
+
sx: {
|
|
44
|
+
color: 'texts.helper',
|
|
45
|
+
fontWeight: 'regular'
|
|
46
|
+
},
|
|
47
|
+
children: "Text Helper"
|
|
48
|
+
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
49
|
+
sx: {
|
|
50
|
+
color: 'texts.helper',
|
|
51
|
+
fontWeight: 'medium'
|
|
52
|
+
},
|
|
53
|
+
children: "Text Helper"
|
|
54
|
+
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
55
|
+
sx: {
|
|
56
|
+
color: 'texts.helper',
|
|
57
|
+
fontWeight: 'bold'
|
|
58
|
+
},
|
|
59
|
+
children: "Text Helper"
|
|
60
|
+
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
61
|
+
sx: {
|
|
62
|
+
color: 'texts.helper',
|
|
63
|
+
fontWeight: 'light'
|
|
64
|
+
},
|
|
65
|
+
children: "Text Helper"
|
|
30
66
|
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
31
67
|
sx: {
|
|
32
68
|
color: 'texts.secondary'
|
|
@@ -22,11 +22,15 @@
|
|
|
22
22
|
[data-vip-tooltip]::before {
|
|
23
23
|
content: attr(data-vip-tooltip);
|
|
24
24
|
z-index: 9999;
|
|
25
|
-
width:
|
|
25
|
+
width: max-content;
|
|
26
|
+
max-width: 210px;
|
|
26
27
|
color: #fff;
|
|
27
28
|
background: rgba(0,0,0, .7);
|
|
28
29
|
border-radius: 5px;
|
|
29
|
-
padding:
|
|
30
|
+
padding-left: 12px;
|
|
31
|
+
padding-right: 12px;
|
|
32
|
+
padding-top: 8px;
|
|
33
|
+
padding-bottom: 8px;
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
[data-vip-tooltip]::after {
|
|
@@ -13,7 +13,7 @@ var _default = exports["default"] = {
|
|
|
13
13
|
parameters: {
|
|
14
14
|
docs: {
|
|
15
15
|
description: {
|
|
16
|
-
component: "\nA tooltip is a short descriptive message that appears when a user hovers or focuses on an\nelement. Our tooltip aims to be 100% CSS-only. It uses a global css approach to inject the\ntooltip styles.\n\n## Kwown issues\n\n- Storybook uses iframes to render the components. This means that the tooltip box will overlap in the demos, but you can click on each demo page to see the correct render.\n- The current implementation of this component is <strong>NOT</strong> protected from viewport\nclipping (collision). For now, you can pick another <code>vip-tooltip-position</code> if\npossible.\n\n## Guidance\n\n### When to use the tooltip component\n\n- <strong>Helpful, non-critical information.</strong> Use tooltips to strengthen an existing\nmessage.\n- <strong>Enhance confidence.</strong> Use tooltips to increase certainty about an\ninteraction.\n- <strong>Brief descriptions.</strong> Tooltips perform best with succinct helper text.\n- <strong>Lack of space.</strong> Tooltips are useful as a last resort for space-constrained\nUI. Explore other options for keeping content visible without a tooltip.\n\n### When to consider something else\n\n- <strong>Critical information.</strong> Don't hide information necessary for completing\na task behind an tooltip interaction.\n- <strong>Lengthy descriptions.</strong> Tooltips are microcopy, and should be brief.\nDon't use a tooltip if you need a lot of text.\n- <strong>Redundant content.</strong> Don't use a tooltip when its content is repetitive\nor if usability is obvious.\n- <strong>Sufficient space.</strong> If content can fit outside a tooltip, don't use a\ntooltip.\n\n### Usability guidance\n\n- <strong>Use affordances.</strong> A hidden tooltip is unusable. Use tooltips only on\nelements that appear interactive, like buttons or links.\n- <strong>Avoid collisions.</strong> Be careful not introduce conflicting hover or focus\nevents.\n- <strong>Use consistently.</strong> If using tooltips in one context, use in all similar\ncontexts.\n- <strong>Don't block content.</strong> Use the <code>
|
|
16
|
+
component: "\nA tooltip is a short descriptive message that appears when a user hovers or focuses on an\nelement. Our tooltip aims to be 100% CSS-only. It uses a global css approach to inject the\ntooltip styles.\n\n## Kwown issues\n\n- Storybook uses iframes to render the components. This means that the tooltip box will overlap in the demos, but you can click on each demo page to see the correct render.\n- The current implementation of this component is <strong>NOT</strong> protected from viewport\nclipping (collision). For now, you can pick another <code>vip-tooltip-position</code> if\npossible.\n\n## Guidance\n\n### When to use the tooltip component\n\n- <strong>Helpful, non-critical information.</strong> Use tooltips to strengthen an existing\nmessage.\n- <strong>Enhance confidence.</strong> Use tooltips to increase certainty about an\ninteraction.\n- <strong>Brief descriptions.</strong> Tooltips perform best with succinct helper text.\n- <strong>Lack of space.</strong> Tooltips are useful as a last resort for space-constrained\nUI. Explore other options for keeping content visible without a tooltip.\n\n### When to consider something else\n\n- <strong>Critical information.</strong> Don't hide information necessary for completing\na task behind an tooltip interaction.\n- <strong>Lengthy descriptions.</strong> Tooltips are microcopy, and should be brief.\nDon't use a tooltip if you need a lot of text.\n- <strong>Redundant content.</strong> Don't use a tooltip when its content is repetitive\nor if usability is obvious.\n- <strong>Sufficient space.</strong> If content can fit outside a tooltip, don't use a\ntooltip.\n\n### Usability guidance\n\n- <strong>Use affordances.</strong> A hidden tooltip is unusable. Use tooltips only on\nelements that appear interactive, like buttons or links.\n- <strong>Avoid collisions.</strong> Be careful not introduce conflicting hover or focus\nevents.\n- <strong>Use consistently.</strong> If using tooltips in one context, use in all similar\ncontexts.\n- <strong>Don't block content.</strong> Use the <code>vip-tooltip-position</code> attribute to\nprevent the tooltip from covering other page elements.\n\n-------\n\nThis documentation is heavily inspired by the [U.S Web Design System (USWDS)](https://designsystem.digital.gov/components/tooltip/#package). We use USWDS as trusted source of truth for accessibility and usability best practices.\n\n## Component Properties\n"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -74,7 +74,7 @@ var Container = exports.Container = function Container() {
|
|
|
74
74
|
}), " component. To use tooltips you can simply pass ", (0, _jsxRuntime.jsx)("code", {
|
|
75
75
|
children: "data-vip-tooltip"
|
|
76
76
|
}), " as an HTML attribute to your component."]
|
|
77
|
-
}), (0, _jsxRuntime.jsx)(
|
|
77
|
+
}), (0, _jsxRuntime.jsx)(_.Box, {
|
|
78
78
|
sx: {
|
|
79
79
|
backgroundColor: 'red'
|
|
80
80
|
},
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
2
5
|
import React from 'react';
|
|
6
|
+
import { WizardStepProps } from './WizardStep';
|
|
7
|
+
export interface WizardProps {
|
|
8
|
+
steps: WizardStepProps[];
|
|
9
|
+
activeStep?: number;
|
|
10
|
+
completed?: number[];
|
|
11
|
+
skipped?: number[];
|
|
12
|
+
className?: string;
|
|
13
|
+
titleAutofocus?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const Wizard: React.ForwardRefExoticComponent<WizardProps & React.RefAttributes<HTMLDivElement>>;
|