@automattic/vip-design-system 0.19.2 → 0.20.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/.github/workflows/stale.yml +15 -0
- package/build/system/Button/Button.js +5 -0
- package/build/system/Button/Button.stories.js +8 -0
- package/build/system/Heading/Heading.js +7 -3
- package/build/system/Heading/Heading.stories.js +0 -3
- package/build/system/Link/Link.js +2 -1
- package/build/system/Notice/Notice.js +7 -3
- package/build/system/Progress/Progress.js +45 -16
- package/build/system/Progress/Progress.stories.js +21 -4
- package/build/system/ResourceList/ResourceList.js +1 -1
- package/build/system/Table/Table.js +7 -3
- package/package.json +1 -1
- package/src/system/Button/Button.js +5 -0
- package/src/system/Button/Button.stories.jsx +3 -0
- package/src/system/Heading/Heading.js +18 -12
- package/src/system/Heading/Heading.stories.jsx +0 -1
- package/src/system/Link/Link.js +1 -0
- package/src/system/Notice/Notice.js +54 -53
- package/src/system/Progress/Progress.js +55 -26
- package/src/system/Progress/Progress.stories.jsx +15 -8
- package/src/system/Table/Table.js +6 -2
- package/build/system/Form/MultiSelect.js +0 -38
- package/build/system/UsageChart/UsageChart.js +0 -60
- package/build/system/UsageChart/index.js +0 -7
|
@@ -32,6 +32,10 @@ var Button = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRe
|
|
|
32
32
|
justifyContent: 'center',
|
|
33
33
|
height: '36px',
|
|
34
34
|
py: 0,
|
|
35
|
+
textDecoration: props != null && props.to ? 'underline' : 'none',
|
|
36
|
+
'&:hover': {
|
|
37
|
+
textDecoration: 'none'
|
|
38
|
+
},
|
|
35
39
|
'&:focus': function focus(theme) {
|
|
36
40
|
return theme.outline;
|
|
37
41
|
},
|
|
@@ -54,5 +58,6 @@ exports.Button = Button;
|
|
|
54
58
|
Button.displayName = 'Button';
|
|
55
59
|
Button.propTypes = {
|
|
56
60
|
sx: _propTypes["default"].object,
|
|
61
|
+
to: _propTypes["default"].any,
|
|
57
62
|
className: _propTypes["default"].any
|
|
58
63
|
};
|
|
@@ -37,6 +37,14 @@ var Default = function Default() {
|
|
|
37
37
|
ml: 2
|
|
38
38
|
},
|
|
39
39
|
children: "Secondary"
|
|
40
|
+
}), (0, _jsxRuntime.jsx)(_.Button, {
|
|
41
|
+
variant: "text",
|
|
42
|
+
sx: {
|
|
43
|
+
ml: 2
|
|
44
|
+
},
|
|
45
|
+
as: "a",
|
|
46
|
+
href: "https://google/com",
|
|
47
|
+
children: "Button link"
|
|
40
48
|
})]
|
|
41
49
|
});
|
|
42
50
|
};
|
|
@@ -9,6 +9,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
12
14
|
var _themeUi = require("theme-ui");
|
|
13
15
|
|
|
14
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -19,7 +21,7 @@ var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
|
19
21
|
|
|
20
22
|
var _excluded = ["variant", "sx", "className"];
|
|
21
23
|
|
|
22
|
-
var Heading = function
|
|
24
|
+
var Heading = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
|
|
23
25
|
var _ref$variant = _ref.variant,
|
|
24
26
|
variant = _ref$variant === void 0 ? 'h3' : _ref$variant,
|
|
25
27
|
sx = _ref.sx,
|
|
@@ -33,11 +35,13 @@ var Heading = function Heading(_ref) {
|
|
|
33
35
|
// pass variant prop to sx
|
|
34
36
|
variant: "text." + variant
|
|
35
37
|
}, sx),
|
|
36
|
-
className: (0, _classnames["default"])('vip-heading-component', className)
|
|
38
|
+
className: (0, _classnames["default"])('vip-heading-component', className),
|
|
39
|
+
ref: forwardRef
|
|
37
40
|
}, props));
|
|
38
|
-
};
|
|
41
|
+
});
|
|
39
42
|
|
|
40
43
|
exports.Heading = Heading;
|
|
44
|
+
Heading.displayName = 'Heading';
|
|
41
45
|
Heading.propTypes = {
|
|
42
46
|
variant: _propTypes["default"].string,
|
|
43
47
|
sx: _propTypes["default"].object,
|
|
@@ -9,6 +9,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
12
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
15
|
|
|
14
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -54,7 +56,7 @@ NoticeIcon.propTypes = {
|
|
|
54
56
|
variant: _propTypes["default"].string
|
|
55
57
|
};
|
|
56
58
|
|
|
57
|
-
var Notice = function
|
|
59
|
+
var Notice = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, forwardRef) {
|
|
58
60
|
var _ref2$variant = _ref2.variant,
|
|
59
61
|
variant = _ref2$variant === void 0 ? 'warning' : _ref2$variant,
|
|
60
62
|
_ref2$inline = _ref2.inline,
|
|
@@ -94,7 +96,8 @@ var Notice = function Notice(_ref2) {
|
|
|
94
96
|
border: 'none'
|
|
95
97
|
}
|
|
96
98
|
}, sx),
|
|
97
|
-
className: (0, _classnames["default"])('vip-notice-component', className)
|
|
99
|
+
className: (0, _classnames["default"])('vip-notice-component', className),
|
|
100
|
+
ref: forwardRef
|
|
98
101
|
}, props, {
|
|
99
102
|
children: (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
100
103
|
sx: {
|
|
@@ -124,9 +127,10 @@ var Notice = function Notice(_ref2) {
|
|
|
124
127
|
})]
|
|
125
128
|
})
|
|
126
129
|
}));
|
|
127
|
-
};
|
|
130
|
+
});
|
|
128
131
|
|
|
129
132
|
exports.Notice = Notice;
|
|
133
|
+
Notice.displayName = 'Notice';
|
|
130
134
|
Notice.propTypes = {
|
|
131
135
|
children: _propTypes["default"].node,
|
|
132
136
|
color: _propTypes["default"].string,
|
|
@@ -9,49 +9,76 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
12
14
|
var _themeUi = require("theme-ui");
|
|
13
15
|
|
|
14
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
17
|
|
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
+
|
|
16
20
|
var _Spinner = require("../Spinner");
|
|
17
21
|
|
|
18
|
-
var
|
|
22
|
+
var _md = require("react-icons/md");
|
|
19
23
|
|
|
20
|
-
var
|
|
24
|
+
var _ = require("../");
|
|
21
25
|
|
|
22
26
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
23
27
|
|
|
24
|
-
var _excluded = ["steps", "activeStep", "sx", "className"];
|
|
28
|
+
var _excluded = ["steps", "activeStep", "sx", "forLabel", "className"];
|
|
29
|
+
var prefix = 'vip-progress-component';
|
|
30
|
+
|
|
31
|
+
var uniqueID = function uniqueID() {
|
|
32
|
+
return Math.random().toString(36).substring(7);
|
|
33
|
+
};
|
|
25
34
|
|
|
26
|
-
var Progress = function
|
|
35
|
+
var Progress = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
|
|
27
36
|
var steps = _ref.steps,
|
|
28
37
|
activeStep = _ref.activeStep,
|
|
29
38
|
sx = _ref.sx,
|
|
39
|
+
_ref$forLabel = _ref.forLabel,
|
|
40
|
+
forLabel = _ref$forLabel === void 0 ? '' : _ref$forLabel,
|
|
30
41
|
className = _ref.className,
|
|
31
42
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
43
|
+
var stepsTotal = steps.length;
|
|
44
|
+
var isDone = activeStep === stepsTotal - 1;
|
|
45
|
+
var instance = uniqueID();
|
|
46
|
+
var htmlFor = prefix + "-" + instance;
|
|
47
|
+
var currentValue = activeStep + 1;
|
|
32
48
|
return (0, _jsxRuntime.jsxs)(_.Box, {
|
|
49
|
+
className: (0, _classnames["default"])(prefix, className),
|
|
33
50
|
children: [(0, _jsxRuntime.jsx)(_themeUi.Progress, (0, _extends2["default"])({
|
|
34
|
-
className: (0, _classnames["default"])('vip-progress-component', className)
|
|
35
|
-
}, props, {
|
|
36
51
|
sx: (0, _extends2["default"])({
|
|
37
|
-
color: 'primary'
|
|
52
|
+
color: 'primary',
|
|
53
|
+
backgroundColor: 'background'
|
|
38
54
|
}, sx),
|
|
39
|
-
max:
|
|
40
|
-
value:
|
|
41
|
-
|
|
55
|
+
max: stepsTotal,
|
|
56
|
+
value: currentValue,
|
|
57
|
+
id: htmlFor,
|
|
58
|
+
"aria-label": forLabel,
|
|
59
|
+
ref: forwardRef
|
|
60
|
+
}, props)), steps && (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
42
61
|
sx: {
|
|
43
62
|
alignItems: 'center',
|
|
44
63
|
mt: 2
|
|
45
64
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
65
|
+
"aria-live": "polite",
|
|
66
|
+
"aria-atomic": "true",
|
|
67
|
+
"aria-describedby": htmlFor,
|
|
68
|
+
children: [!isDone && (0, _jsxRuntime.jsx)(_Spinner.Spinner, {
|
|
69
|
+
size: 24,
|
|
70
|
+
"aria-hidden": "true"
|
|
71
|
+
}), isDone && (0, _jsxRuntime.jsx)(_md.MdCheck, {
|
|
72
|
+
size: 24,
|
|
73
|
+
"aria-hidden": "true"
|
|
74
|
+
}), (0, _jsxRuntime.jsxs)(_.Text, {
|
|
50
75
|
sx: {
|
|
51
76
|
ml: 2,
|
|
52
77
|
mb: 0
|
|
53
78
|
},
|
|
54
|
-
children: [
|
|
79
|
+
children: [(0, _jsxRuntime.jsxs)("strong", {
|
|
80
|
+
children: [currentValue + " of " + stepsTotal, ": "]
|
|
81
|
+
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
55
82
|
as: "span",
|
|
56
83
|
sx: {
|
|
57
84
|
color: 'muted'
|
|
@@ -61,12 +88,14 @@ var Progress = function Progress(_ref) {
|
|
|
61
88
|
})]
|
|
62
89
|
})]
|
|
63
90
|
});
|
|
64
|
-
};
|
|
91
|
+
});
|
|
65
92
|
|
|
66
93
|
exports.Progress = Progress;
|
|
94
|
+
Progress.displayName = 'Progress';
|
|
67
95
|
Progress.propTypes = {
|
|
68
96
|
steps: _propTypes["default"].array,
|
|
69
97
|
activeStep: _propTypes["default"].number,
|
|
98
|
+
forLabel: _propTypes["default"].node,
|
|
70
99
|
sx: _propTypes["default"].object,
|
|
71
100
|
className: _propTypes["default"].any
|
|
72
101
|
};
|
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = exports.Default = void 0;
|
|
5
5
|
|
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
+
|
|
6
8
|
var _ = require("..");
|
|
7
9
|
|
|
8
10
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
11
|
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
10
16
|
/**
|
|
11
17
|
* Internal dependencies
|
|
12
18
|
*/
|
|
@@ -17,11 +23,22 @@ var _default = {
|
|
|
17
23
|
exports["default"] = _default;
|
|
18
24
|
|
|
19
25
|
var Default = function Default() {
|
|
26
|
+
var _React$useState = _react["default"].useState(0),
|
|
27
|
+
counter = _React$useState[0],
|
|
28
|
+
setCounter = _React$useState[1];
|
|
29
|
+
|
|
30
|
+
var steps = ['Downloading Data', 'Importing Data...', 'Finalizing', 'Done'];
|
|
31
|
+
(0, _react.useEffect)(function () {
|
|
32
|
+
setTimeout(function () {
|
|
33
|
+
if (counter < steps.length - 1) {
|
|
34
|
+
setCounter(counter + 1);
|
|
35
|
+
}
|
|
36
|
+
}, 2000);
|
|
37
|
+
}, [counter, setCounter]);
|
|
20
38
|
return (0, _jsxRuntime.jsx)(_.Progress, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
activeStep: 1
|
|
39
|
+
forLabel: "Update site progress",
|
|
40
|
+
steps: steps,
|
|
41
|
+
activeStep: counter
|
|
25
42
|
});
|
|
26
43
|
};
|
|
27
44
|
|
|
@@ -9,6 +9,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
12
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
15
|
|
|
14
16
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -17,7 +19,7 @@ var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
|
17
19
|
|
|
18
20
|
var _excluded = ["sx", "className"];
|
|
19
21
|
|
|
20
|
-
var Table = function
|
|
22
|
+
var Table = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
|
|
21
23
|
var sx = _ref.sx,
|
|
22
24
|
className = _ref.className,
|
|
23
25
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
@@ -28,11 +30,13 @@ var Table = function Table(_ref) {
|
|
|
28
30
|
}, sx),
|
|
29
31
|
cellPadding: 0,
|
|
30
32
|
cellSpacing: 0,
|
|
31
|
-
className: (0, _classnames["default"])('vip-table-component', className)
|
|
33
|
+
className: (0, _classnames["default"])('vip-table-component', className),
|
|
34
|
+
ref: forwardRef
|
|
32
35
|
}, props));
|
|
33
|
-
};
|
|
36
|
+
});
|
|
34
37
|
|
|
35
38
|
exports.Table = Table;
|
|
39
|
+
Table.displayName = 'Table';
|
|
36
40
|
Table.propTypes = {
|
|
37
41
|
sx: _propTypes["default"].object,
|
|
38
42
|
className: _propTypes["default"].any
|
package/package.json
CHANGED
|
@@ -17,6 +17,10 @@ const Button = React.forwardRef( ( { sx, ...props }, forwardRef ) => (
|
|
|
17
17
|
justifyContent: 'center',
|
|
18
18
|
height: '36px',
|
|
19
19
|
py: 0,
|
|
20
|
+
textDecoration: props?.to ? 'underline' : 'none',
|
|
21
|
+
'&:hover': {
|
|
22
|
+
textDecoration: 'none',
|
|
23
|
+
},
|
|
20
24
|
'&:focus': theme => theme.outline,
|
|
21
25
|
'&:focus-visible': theme => theme.outline,
|
|
22
26
|
'&:disabled': {
|
|
@@ -36,6 +40,7 @@ Button.displayName = 'Button';
|
|
|
36
40
|
|
|
37
41
|
Button.propTypes = {
|
|
38
42
|
sx: PropTypes.object,
|
|
43
|
+
to: PropTypes.any,
|
|
39
44
|
className: PropTypes.any,
|
|
40
45
|
};
|
|
41
46
|
|
|
@@ -3,24 +3,30 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
+
import React from 'react';
|
|
6
7
|
import { Heading as ThemeHeading } from 'theme-ui';
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
8
9
|
import classNames from 'classnames';
|
|
9
10
|
|
|
10
|
-
const Heading = (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
const Heading = React.forwardRef(
|
|
12
|
+
( { variant = 'h3', sx, className = null, ...props }, forwardRef ) => (
|
|
13
|
+
<ThemeHeading
|
|
14
|
+
as={ variant }
|
|
15
|
+
sx={ {
|
|
16
|
+
color: 'heading',
|
|
17
|
+
// pass variant prop to sx
|
|
18
|
+
variant: `text.${ variant }`,
|
|
19
|
+
...sx,
|
|
20
|
+
} }
|
|
21
|
+
className={ classNames( 'vip-heading-component', className ) }
|
|
22
|
+
ref={ forwardRef }
|
|
23
|
+
{ ...props }
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
22
26
|
);
|
|
23
27
|
|
|
28
|
+
Heading.displayName = 'Heading';
|
|
29
|
+
|
|
24
30
|
Heading.propTypes = {
|
|
25
31
|
variant: PropTypes.string,
|
|
26
32
|
sx: PropTypes.object,
|
package/src/system/Link/Link.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
+
import React from 'react';
|
|
6
7
|
import classNames from 'classnames';
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
8
9
|
import { MdError, MdWarning, MdCheckCircle, MdInfo } from 'react-icons/md';
|
|
@@ -35,71 +36,71 @@ NoticeIcon.propTypes = {
|
|
|
35
36
|
variant: PropTypes.string,
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
const Notice = (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
className = null,
|
|
45
|
-
...props
|
|
46
|
-
} ) => {
|
|
47
|
-
let color = 'yellow';
|
|
39
|
+
const Notice = React.forwardRef(
|
|
40
|
+
(
|
|
41
|
+
{ variant = 'warning', inline = false, children, title, sx = {}, className = null, ...props },
|
|
42
|
+
forwardRef
|
|
43
|
+
) => {
|
|
44
|
+
let color = 'yellow';
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
switch ( variant ) {
|
|
47
|
+
case 'info':
|
|
48
|
+
color = 'blue';
|
|
49
|
+
break;
|
|
50
|
+
case 'alert':
|
|
51
|
+
color = 'red';
|
|
52
|
+
break;
|
|
53
|
+
case 'success':
|
|
54
|
+
color = 'green';
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
sx={ {
|
|
64
|
-
boxShadow: 'none',
|
|
65
|
-
borderRadius: 2,
|
|
66
|
-
bg: inline ? 'transparent' : `${ color }.10`,
|
|
67
|
-
p: inline ? 0 : 3,
|
|
68
|
-
color: `${ color }.90`,
|
|
69
|
-
a: {
|
|
70
|
-
color: `${ color }.90`,
|
|
71
|
-
border: 'none',
|
|
72
|
-
},
|
|
73
|
-
...sx,
|
|
74
|
-
} }
|
|
75
|
-
className={ classNames( 'vip-notice-component', className ) }
|
|
76
|
-
{ ...props }
|
|
77
|
-
>
|
|
78
|
-
<Flex
|
|
58
|
+
return (
|
|
59
|
+
<Card
|
|
79
60
|
sx={ {
|
|
80
|
-
|
|
61
|
+
boxShadow: 'none',
|
|
62
|
+
borderRadius: 2,
|
|
63
|
+
bg: inline ? 'transparent' : `${ color }.10`,
|
|
64
|
+
p: inline ? 0 : 3,
|
|
65
|
+
color: `${ color }.90`,
|
|
66
|
+
a: {
|
|
67
|
+
color: `${ color }.90`,
|
|
68
|
+
border: 'none',
|
|
69
|
+
},
|
|
70
|
+
...sx,
|
|
81
71
|
} }
|
|
72
|
+
className={ classNames( 'vip-notice-component', className ) }
|
|
73
|
+
ref={ forwardRef }
|
|
74
|
+
{ ...props }
|
|
82
75
|
>
|
|
83
76
|
<Flex
|
|
84
77
|
sx={ {
|
|
85
78
|
alignItems: 'center',
|
|
86
79
|
} }
|
|
87
80
|
>
|
|
88
|
-
<
|
|
81
|
+
<Flex
|
|
82
|
+
sx={ {
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
} }
|
|
85
|
+
>
|
|
86
|
+
<NoticeIcon color={ `${ color }.200` } variant={ variant } />
|
|
87
|
+
</Flex>
|
|
88
|
+
|
|
89
|
+
<Box sx={ { ml: 3 } }>
|
|
90
|
+
{ title && (
|
|
91
|
+
<Heading variant="h4" as="p" sx={ { color: `${ color }.100`, mb: 0 } }>
|
|
92
|
+
{ title }
|
|
93
|
+
</Heading>
|
|
94
|
+
) }
|
|
95
|
+
{ children }
|
|
96
|
+
</Box>
|
|
89
97
|
</Flex>
|
|
98
|
+
</Card>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
);
|
|
90
102
|
|
|
91
|
-
|
|
92
|
-
{ title && (
|
|
93
|
-
<Heading variant="h4" as="p" sx={ { color: `${ color }.100`, mb: 0 } }>
|
|
94
|
-
{ title }
|
|
95
|
-
</Heading>
|
|
96
|
-
) }
|
|
97
|
-
{ children }
|
|
98
|
-
</Box>
|
|
99
|
-
</Flex>
|
|
100
|
-
</Card>
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
|
+
Notice.displayName = 'Notice';
|
|
103
104
|
|
|
104
105
|
Notice.propTypes = {
|
|
105
106
|
children: PropTypes.node,
|
|
@@ -3,45 +3,74 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
+
import React from 'react';
|
|
6
7
|
import { Progress as ThemeProgress } from 'theme-ui';
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import classNames from 'classnames';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Internal dependencies
|
|
11
13
|
*/
|
|
12
14
|
import { Spinner } from '../Spinner';
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
+
import { MdCheck } from 'react-icons/md';
|
|
16
|
+
import { Box, Text, Flex } from '../';
|
|
17
|
+
|
|
18
|
+
const prefix = 'vip-progress-component';
|
|
19
|
+
const uniqueID = () => Math.random().toString( 36 ).substring( 7 );
|
|
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;
|
|
15
28
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
+
}
|
|
40
66
|
);
|
|
41
67
|
|
|
68
|
+
Progress.displayName = 'Progress';
|
|
69
|
+
|
|
42
70
|
Progress.propTypes = {
|
|
43
71
|
steps: PropTypes.array,
|
|
44
72
|
activeStep: PropTypes.number,
|
|
73
|
+
forLabel: PropTypes.node,
|
|
45
74
|
sx: PropTypes.object,
|
|
46
75
|
className: PropTypes.any,
|
|
47
76
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
4
5
|
import { Progress } from '..';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
@@ -8,11 +9,17 @@ export default {
|
|
|
8
9
|
component: Progress,
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
export const Default = () =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
);
|
|
12
|
+
export const Default = () => {
|
|
13
|
+
const [ counter, setCounter ] = React.useState( 0 );
|
|
14
|
+
const steps = [ 'Downloading Data', 'Importing Data...', 'Finalizing', 'Done' ];
|
|
15
|
+
|
|
16
|
+
useEffect( () => {
|
|
17
|
+
setTimeout( () => {
|
|
18
|
+
if ( counter < steps.length - 1 ) {
|
|
19
|
+
setCounter( counter + 1 );
|
|
20
|
+
}
|
|
21
|
+
}, 2000 );
|
|
22
|
+
}, [ counter, setCounter ] );
|
|
23
|
+
|
|
24
|
+
return <Progress forLabel="Update site progress" steps={ steps } activeStep={ counter } />;
|
|
25
|
+
};
|
|
@@ -3,18 +3,22 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
+
import React from 'react';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
8
|
import classNames from 'classnames';
|
|
8
9
|
|
|
9
|
-
const Table = ( { sx, className, ...props } ) => (
|
|
10
|
+
const Table = React.forwardRef( ( { sx, className, ...props }, forwardRef ) => (
|
|
10
11
|
<table
|
|
11
12
|
sx={ { width: '100%', minWidth: 1024, ...sx } }
|
|
12
13
|
cellPadding={ 0 }
|
|
13
14
|
cellSpacing={ 0 }
|
|
14
15
|
className={ classNames( 'vip-table-component', className ) }
|
|
16
|
+
ref={ forwardRef }
|
|
15
17
|
{ ...props }
|
|
16
18
|
/>
|
|
17
|
-
);
|
|
19
|
+
) );
|
|
20
|
+
|
|
21
|
+
Table.displayName = 'Table';
|
|
18
22
|
|
|
19
23
|
Table.propTypes = {
|
|
20
24
|
sx: PropTypes.object,
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.MultiSelect = void 0;
|
|
5
|
-
|
|
6
|
-
var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
7
|
-
|
|
8
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
function _extends() { _extends = Object.assign || 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); }
|
|
13
|
-
|
|
14
|
-
var vipGold = '#c29c69'; // hardcoding for now
|
|
15
|
-
|
|
16
|
-
var vipGrey2 = '#d7dee2';
|
|
17
|
-
var customStyles = {
|
|
18
|
-
control: function control(styles) {
|
|
19
|
-
return _extends({}, styles, {
|
|
20
|
-
border: "1px solid " + vipGrey2,
|
|
21
|
-
boxShadow: 'none',
|
|
22
|
-
'&:hover': {
|
|
23
|
-
border: "1px solid " + vipGold
|
|
24
|
-
},
|
|
25
|
-
'&:focus': {
|
|
26
|
-
border: "1px solid " + vipGold
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
var MultiSelect = function MultiSelect(props) {
|
|
33
|
-
return (0, _jsxRuntime.jsx)(_reactSelect["default"], _extends({}, props, {
|
|
34
|
-
styles: customStyles
|
|
35
|
-
}));
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
exports.MultiSelect = MultiSelect;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.UsageChart = void 0;
|
|
5
|
-
|
|
6
|
-
var _framerMotion = require("framer-motion");
|
|
7
|
-
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* External dependencies
|
|
16
|
-
*/
|
|
17
|
-
var UsageChart = function UsageChart(_ref) {
|
|
18
|
-
var total = _ref.total,
|
|
19
|
-
max = _ref.max,
|
|
20
|
-
_ref$variant = _ref.variant,
|
|
21
|
-
variant = _ref$variant === void 0 ? 'primary' : _ref$variant;
|
|
22
|
-
var width = total / max * 100 + '%';
|
|
23
|
-
var formattedTotal = total;
|
|
24
|
-
|
|
25
|
-
if (total > 1000000) {
|
|
26
|
-
formattedTotal = (total / 1000000).toFixed(2) + "M";
|
|
27
|
-
} else if (total > 1000) {
|
|
28
|
-
formattedTotal = (total / 1000).toFixed(2) + "K";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return (0, _jsxRuntime.jsx)("div", {
|
|
32
|
-
sx: {
|
|
33
|
-
height: variant === 'primary' ? 32 : 8,
|
|
34
|
-
overflow: 'hidden',
|
|
35
|
-
backgroundColor: variant === 'primary' ? 'border' : 'transparent'
|
|
36
|
-
},
|
|
37
|
-
children: (0, _jsxRuntime.jsx)(_framerMotion.motion.div, {
|
|
38
|
-
initial: {
|
|
39
|
-
width: 0
|
|
40
|
-
},
|
|
41
|
-
animate: {
|
|
42
|
-
width: width
|
|
43
|
-
},
|
|
44
|
-
transition: {
|
|
45
|
-
duration: 0.7
|
|
46
|
-
},
|
|
47
|
-
sx: {
|
|
48
|
-
height: '100%',
|
|
49
|
-
backgroundColor: variant === 'primary' ? 'primary' : 'grey.40'
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
exports.UsageChart = UsageChart;
|
|
56
|
-
UsageChart.propTypes = {
|
|
57
|
-
total: _propTypes["default"].number,
|
|
58
|
-
max: _propTypes["default"].number,
|
|
59
|
-
variant: _propTypes["default"].string
|
|
60
|
-
};
|