@automattic/vip-design-system 0.34.0 → 0.34.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/build/system/Form/Label.js +12 -4
- package/build/system/Form/RadioBoxGroup.js +7 -7
- package/build/system/Wizard/WizardStep.js +5 -2
- package/build/system/theme/generated/valet-theme.json +8 -26
- package/package.json +1 -1
- package/src/system/Form/Label.js +21 -16
- package/src/system/Form/RadioBoxGroup.js +6 -3
- package/src/system/Wizard/WizardStep.js +4 -2
- package/build/system/ResourceList/ResourceItem.js +0 -89
- package/build/system/ResourceList/ResourceList.js +0 -140
- package/build/system/ResourceList/ResourceList.stories.js +0 -379
- package/build/system/ResourceList/index.js +0 -11
|
@@ -13,11 +13,13 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
13
13
|
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
|
|
16
|
+
var _themeUi = require("theme-ui");
|
|
17
|
+
|
|
16
18
|
var _RequiredLabel = require("./RequiredLabel");
|
|
17
19
|
|
|
18
20
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
19
21
|
|
|
20
|
-
var _excluded = ["sx", "children", "required"];
|
|
22
|
+
var _excluded = ["sx", "children", "required", "as"];
|
|
21
23
|
var baseLabelColor = 'input.label.default';
|
|
22
24
|
exports.baseLabelColor = baseLabelColor;
|
|
23
25
|
var baseLabelStyle = {
|
|
@@ -32,9 +34,14 @@ var Label = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef
|
|
|
32
34
|
var sx = _ref.sx,
|
|
33
35
|
children = _ref.children,
|
|
34
36
|
required = _ref.required,
|
|
37
|
+
_ref$as = _ref.as,
|
|
38
|
+
as = _ref$as === void 0 ? 'label' : _ref$as,
|
|
35
39
|
rest = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
36
|
-
return (0, _jsxRuntime.jsxs)(
|
|
37
|
-
|
|
40
|
+
return (0, _jsxRuntime.jsxs)(_themeUi.Box, (0, _extends2["default"])({
|
|
41
|
+
as: as,
|
|
42
|
+
sx: (0, _extends2["default"])({
|
|
43
|
+
all: 'unset'
|
|
44
|
+
}, baseLabelStyle, {
|
|
38
45
|
display: 'block',
|
|
39
46
|
mb: 2
|
|
40
47
|
}, sx),
|
|
@@ -48,6 +55,7 @@ exports.Label = Label;
|
|
|
48
55
|
Label.propTypes = {
|
|
49
56
|
children: _propTypes["default"].any,
|
|
50
57
|
required: _propTypes["default"].bool,
|
|
51
|
-
sx: _propTypes["default"].object
|
|
58
|
+
sx: _propTypes["default"].object,
|
|
59
|
+
as: _propTypes["default"].node
|
|
52
60
|
};
|
|
53
61
|
Label.displayName = 'Label';
|
|
@@ -15,10 +15,10 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
15
15
|
|
|
16
16
|
var _ScreenReaderText = _interopRequireDefault(require("../ScreenReaderText"));
|
|
17
17
|
|
|
18
|
-
var _Label = require("./Label");
|
|
19
|
-
|
|
20
18
|
var _Validation = require("./Validation");
|
|
21
19
|
|
|
20
|
+
var _RequiredLabel = require("./RequiredLabel");
|
|
21
|
+
|
|
22
22
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
23
23
|
|
|
24
24
|
var _excluded = ["id", "value", "className", "label", "description", "labelProps"],
|
|
@@ -171,15 +171,15 @@ var RadioBoxGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, f
|
|
|
171
171
|
borderColor: 'input.border.error',
|
|
172
172
|
borderRadius: 2
|
|
173
173
|
} : {}),
|
|
174
|
-
ref: forwardRef
|
|
174
|
+
ref: forwardRef,
|
|
175
|
+
"aria-required": required,
|
|
176
|
+
role: "radiogroup"
|
|
175
177
|
}, props, {
|
|
176
|
-
children: [groupLabel ? (0, _jsxRuntime.
|
|
177
|
-
as: "legend",
|
|
178
|
+
children: [groupLabel ? (0, _jsxRuntime.jsxs)("legend", {
|
|
178
179
|
sx: {
|
|
179
180
|
mb: 2
|
|
180
181
|
},
|
|
181
|
-
|
|
182
|
-
children: groupLabel
|
|
182
|
+
children: [groupLabel, required ? (0, _jsxRuntime.jsx)(_RequiredLabel.RequiredLabel, {}) : null]
|
|
183
183
|
}) : (0, _jsxRuntime.jsx)(_ScreenReaderText["default"], {
|
|
184
184
|
children: "Choose an option"
|
|
185
185
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
@@ -54,7 +54,7 @@ var WizardStep = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwa
|
|
|
54
54
|
|
|
55
55
|
if (active) {
|
|
56
56
|
status = 'active';
|
|
57
|
-
statusText = '
|
|
57
|
+
statusText = ''; // not adding the status text for active step since it's announced by aria-current
|
|
58
58
|
} else if (complete) {
|
|
59
59
|
status = 'complete';
|
|
60
60
|
statusText = 'Step completed';
|
|
@@ -63,7 +63,10 @@ var WizardStep = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwa
|
|
|
63
63
|
statusText = 'Step skipped';
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
statusText
|
|
66
|
+
if (statusText !== '') {
|
|
67
|
+
statusText = "Status: " + statusText;
|
|
68
|
+
}
|
|
69
|
+
|
|
67
70
|
var stepText = "Step " + order + " of " + totalSteps;
|
|
68
71
|
var borderLeftColor = "wizard.step.border." + status;
|
|
69
72
|
var statusIconColor = "wizard.step.icon." + status;
|
|
@@ -38,23 +38,6 @@
|
|
|
38
38
|
"value": "#ffffff",
|
|
39
39
|
"type": "color"
|
|
40
40
|
},
|
|
41
|
-
"label": {
|
|
42
|
-
"default": {
|
|
43
|
-
"value": "#13191e",
|
|
44
|
-
"type": "color"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"text": {
|
|
48
|
-
"default": {
|
|
49
|
-
"value": "#13191e",
|
|
50
|
-
"type": "color"
|
|
51
|
-
},
|
|
52
|
-
"placeholder": {
|
|
53
|
-
"type": "color",
|
|
54
|
-
"value": "#767372",
|
|
55
|
-
"description": "Use for placeholder text in fields"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
41
|
"border": {
|
|
59
42
|
"default": {
|
|
60
43
|
"value": "#8f8c8b",
|
|
@@ -196,19 +179,18 @@
|
|
|
196
179
|
"description": "Use for helper text",
|
|
197
180
|
"value": "#6a6766"
|
|
198
181
|
},
|
|
182
|
+
"placeholder": {
|
|
183
|
+
"type": "color",
|
|
184
|
+
"value": "#767372",
|
|
185
|
+
"description": "Use for placeholder text in fields"
|
|
186
|
+
},
|
|
199
187
|
"disabled": {
|
|
200
188
|
"type": "color",
|
|
201
189
|
"value": "#9b9796"
|
|
202
190
|
},
|
|
203
191
|
"inverse": {
|
|
204
192
|
"type": "color",
|
|
205
|
-
"value": "#fbfbfb"
|
|
206
|
-
"description": "Use for primary text on an inverse layer"
|
|
207
|
-
},
|
|
208
|
-
"inverse-secondary": {
|
|
209
|
-
"value": "#b3afae",
|
|
210
|
-
"type": "color",
|
|
211
|
-
"description": "Use for secondary text on an inverse layer."
|
|
193
|
+
"value": "#fbfbfb"
|
|
212
194
|
},
|
|
213
195
|
"accent": {
|
|
214
196
|
"type": "color",
|
|
@@ -643,8 +625,8 @@
|
|
|
643
625
|
"info": {
|
|
644
626
|
"default": {
|
|
645
627
|
"type": "color",
|
|
646
|
-
"
|
|
647
|
-
"
|
|
628
|
+
"description": "Use for text links",
|
|
629
|
+
"value": "#007586"
|
|
648
630
|
},
|
|
649
631
|
"hover": {
|
|
650
632
|
"type": "color",
|
package/package.json
CHANGED
package/src/system/Form/Label.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
8
|
+
import { Box } from 'theme-ui';
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
@@ -19,26 +19,31 @@ export const baseLabelStyle = {
|
|
|
19
19
|
color: baseLabelColor,
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const Label = React.forwardRef(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
const Label = React.forwardRef(
|
|
23
|
+
( { sx, children, required, as = 'label', ...rest }, forwardRef ) => (
|
|
24
|
+
<Box
|
|
25
|
+
as={ as }
|
|
26
|
+
sx={ {
|
|
27
|
+
all: 'unset',
|
|
28
|
+
...baseLabelStyle,
|
|
29
|
+
display: 'block',
|
|
30
|
+
mb: 2,
|
|
31
|
+
...sx,
|
|
32
|
+
} }
|
|
33
|
+
ref={ forwardRef }
|
|
34
|
+
{ ...rest }
|
|
35
|
+
>
|
|
36
|
+
{ children }
|
|
37
|
+
{ required && <RequiredLabel /> }
|
|
38
|
+
</Box>
|
|
39
|
+
)
|
|
40
|
+
);
|
|
37
41
|
|
|
38
42
|
Label.propTypes = {
|
|
39
43
|
children: PropTypes.any,
|
|
40
44
|
required: PropTypes.bool,
|
|
41
45
|
sx: PropTypes.object,
|
|
46
|
+
as: PropTypes.node,
|
|
42
47
|
};
|
|
43
48
|
|
|
44
49
|
Label.displayName = 'Label';
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import ScreenReaderText from '../ScreenReaderText';
|
|
9
|
-
import { Label } from './Label';
|
|
10
9
|
import { Validation } from './Validation';
|
|
10
|
+
import { RequiredLabel } from './RequiredLabel';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
@@ -154,12 +154,15 @@ const RadioBoxGroup = React.forwardRef(
|
|
|
154
154
|
: {} ),
|
|
155
155
|
} }
|
|
156
156
|
ref={ forwardRef }
|
|
157
|
+
aria-required={ required }
|
|
158
|
+
role="radiogroup"
|
|
157
159
|
{ ...props }
|
|
158
160
|
>
|
|
159
161
|
{ groupLabel ? (
|
|
160
|
-
<
|
|
162
|
+
<legend sx={ { mb: 2 } }>
|
|
161
163
|
{ groupLabel }
|
|
162
|
-
|
|
164
|
+
{ required ? <RequiredLabel /> : null }
|
|
165
|
+
</legend>
|
|
163
166
|
) : (
|
|
164
167
|
<ScreenReaderText>Choose an option</ScreenReaderText>
|
|
165
168
|
) }
|
|
@@ -36,7 +36,7 @@ const WizardStep = React.forwardRef(
|
|
|
36
36
|
let statusText = 'Step not completed';
|
|
37
37
|
if ( active ) {
|
|
38
38
|
status = 'active';
|
|
39
|
-
statusText = '
|
|
39
|
+
statusText = ''; // not adding the status text for active step since it's announced by aria-current
|
|
40
40
|
} else if ( complete ) {
|
|
41
41
|
status = 'complete';
|
|
42
42
|
statusText = 'Step completed';
|
|
@@ -44,7 +44,9 @@ const WizardStep = React.forwardRef(
|
|
|
44
44
|
status = 'skipped';
|
|
45
45
|
statusText = 'Step skipped';
|
|
46
46
|
}
|
|
47
|
-
statusText
|
|
47
|
+
if ( statusText !== '' ) {
|
|
48
|
+
statusText = `Status: ${ statusText }`;
|
|
49
|
+
}
|
|
48
50
|
const stepText = `Step ${ order } of ${ totalSteps }`;
|
|
49
51
|
|
|
50
52
|
const borderLeftColor = `wizard.step.border.${ status }`;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
exports.__esModule = true;
|
|
6
|
-
exports.ResourceItem = void 0;
|
|
7
|
-
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
|
-
var _ = require("..");
|
|
11
|
-
|
|
12
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
13
|
-
|
|
14
|
-
/** @jsxImportSource theme-ui */
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* External dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
var ResourceItem = function ResourceItem(_ref) {
|
|
24
|
-
var children = _ref.children,
|
|
25
|
-
item = _ref.item,
|
|
26
|
-
renderActions = _ref.renderActions,
|
|
27
|
-
_ref$relativeTime = _ref.relativeTime,
|
|
28
|
-
relativeTime = _ref$relativeTime === void 0 ? false : _ref$relativeTime,
|
|
29
|
-
_ref$timeOnly = _ref.timeOnly,
|
|
30
|
-
timeOnly = _ref$timeOnly === void 0 ? false : _ref$timeOnly,
|
|
31
|
-
dateKey = _ref.dateKey,
|
|
32
|
-
_ref$icon = _ref.icon,
|
|
33
|
-
icon = _ref$icon === void 0 ? null : _ref$icon;
|
|
34
|
-
return (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
35
|
-
sx: {
|
|
36
|
-
alignItems: 'center',
|
|
37
|
-
gap: 3
|
|
38
|
-
},
|
|
39
|
-
children: [icon, (0, _jsxRuntime.jsx)(_.Box, {
|
|
40
|
-
sx: {
|
|
41
|
-
flex: '1 1 auto'
|
|
42
|
-
},
|
|
43
|
-
children: children
|
|
44
|
-
}), (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
45
|
-
sx: {
|
|
46
|
-
flex: '0 0 auto',
|
|
47
|
-
alignItems: 'center',
|
|
48
|
-
gap: 3
|
|
49
|
-
},
|
|
50
|
-
children: [(0, _jsxRuntime.jsx)(_.Time, {
|
|
51
|
-
className: "time",
|
|
52
|
-
relativeTime: relativeTime,
|
|
53
|
-
timeOnly: timeOnly,
|
|
54
|
-
time: item[dateKey],
|
|
55
|
-
sx: {
|
|
56
|
-
color: 'muted',
|
|
57
|
-
mb: 0,
|
|
58
|
-
textAlign: 'right',
|
|
59
|
-
flex: '0 0 auto'
|
|
60
|
-
}
|
|
61
|
-
}), renderActions && (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
62
|
-
className: "actions",
|
|
63
|
-
sx: {
|
|
64
|
-
alignItems: 'center',
|
|
65
|
-
gap: 3
|
|
66
|
-
},
|
|
67
|
-
children: [(0, _jsxRuntime.jsx)(_.Box, {
|
|
68
|
-
sx: {
|
|
69
|
-
width: 4,
|
|
70
|
-
height: 4,
|
|
71
|
-
borderRadius: 4,
|
|
72
|
-
bg: 'border'
|
|
73
|
-
}
|
|
74
|
-
}), renderActions(item)]
|
|
75
|
-
})]
|
|
76
|
-
})]
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
exports.ResourceItem = ResourceItem;
|
|
81
|
-
ResourceItem.propTypes = {
|
|
82
|
-
children: _propTypes["default"].node,
|
|
83
|
-
item: _propTypes["default"].object,
|
|
84
|
-
icon: _propTypes["default"].node,
|
|
85
|
-
relativeTime: _propTypes["default"].bool,
|
|
86
|
-
timeOnly: _propTypes["default"].bool,
|
|
87
|
-
dateKey: _propTypes["default"].string,
|
|
88
|
-
renderActions: _propTypes["default"].func
|
|
89
|
-
};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
exports.__esModule = true;
|
|
6
|
-
exports.ResourceList = void 0;
|
|
7
|
-
|
|
8
|
-
var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _react = require("react");
|
|
13
|
-
|
|
14
|
-
var _ = require("..");
|
|
15
|
-
|
|
16
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
17
|
-
|
|
18
|
-
/** @jsxImportSource theme-ui */
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* External dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Internal dependencies
|
|
26
|
-
*/
|
|
27
|
-
var formatterOptions = {
|
|
28
|
-
weekday: 'long',
|
|
29
|
-
year: 'numeric',
|
|
30
|
-
month: 'long',
|
|
31
|
-
day: 'numeric'
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
var formatDate = function formatDate(date) {
|
|
35
|
-
var today = new Date();
|
|
36
|
-
|
|
37
|
-
if (date.getFullYear() !== today.getFullYear()) {
|
|
38
|
-
return date.toLocaleDateString(formatterOptions);
|
|
39
|
-
} else if (date.getMonth() !== today.getMonth()) {
|
|
40
|
-
return date.toLocaleDateString(formatterOptions);
|
|
41
|
-
} else if (date.getDate() < today.getDate() - 1) {
|
|
42
|
-
return date.toLocaleDateString(formatterOptions);
|
|
43
|
-
} else if (date.getDate() === today.getDate() - 1) {
|
|
44
|
-
return 'Yesterday';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return 'Today';
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
var StyledListItem = function StyledListItem(props) {
|
|
51
|
-
return (0, _jsxRuntime.jsx)(_.Box, (0, _extends3["default"])({
|
|
52
|
-
as: "li",
|
|
53
|
-
sx: {
|
|
54
|
-
py: 2,
|
|
55
|
-
borderBottom: '1px solid',
|
|
56
|
-
borderColor: 'borders.2',
|
|
57
|
-
listStyleType: 'none',
|
|
58
|
-
margin: 0,
|
|
59
|
-
px: 0
|
|
60
|
-
}
|
|
61
|
-
}, props));
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
var ResourceList = function ResourceList(_ref) {
|
|
65
|
-
var _ref$groupedByDay = _ref.groupedByDay,
|
|
66
|
-
groupedByDay = _ref$groupedByDay === void 0 ? false : _ref$groupedByDay,
|
|
67
|
-
items = _ref.items,
|
|
68
|
-
renderItem = _ref.renderItem,
|
|
69
|
-
dateKey = _ref.dateKey;
|
|
70
|
-
var groupedItems = {};
|
|
71
|
-
|
|
72
|
-
if (groupedByDay) {
|
|
73
|
-
groupedItems = items == null ? void 0 : items.reduce(function (itemGroups, item) {
|
|
74
|
-
var _extends2;
|
|
75
|
-
|
|
76
|
-
var formattedDate = formatDate(item[dateKey]);
|
|
77
|
-
var itemsAtDate = itemGroups[formattedDate];
|
|
78
|
-
return (0, _extends3["default"])({}, itemGroups, (_extends2 = {}, _extends2[formattedDate] = itemsAtDate ? [].concat(itemsAtDate, [item]) : [item], _extends2));
|
|
79
|
-
}, {});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var renderItemList = function renderItemList(itemsList) {
|
|
83
|
-
return itemsList.map(function (item, index) {
|
|
84
|
-
return (0, _jsxRuntime.jsx)(StyledListItem, {
|
|
85
|
-
children: renderItem(item)
|
|
86
|
-
}, index);
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
var renderGoupedItems = function renderGoupedItems() {
|
|
91
|
-
return (0, _react.useMemo)(function () {
|
|
92
|
-
return Object.keys(groupedItems).map(function (groupName, index) {
|
|
93
|
-
return (0, _jsxRuntime.jsxs)(_.Box, {
|
|
94
|
-
sx: {
|
|
95
|
-
mb: 4
|
|
96
|
-
},
|
|
97
|
-
as: "li",
|
|
98
|
-
children: [(0, _jsxRuntime.jsx)(_.Heading, {
|
|
99
|
-
variant: "h4",
|
|
100
|
-
as: "h4",
|
|
101
|
-
sx: {
|
|
102
|
-
mb: 3
|
|
103
|
-
},
|
|
104
|
-
children: groupName
|
|
105
|
-
}), (0, _jsxRuntime.jsx)(_.Box, {
|
|
106
|
-
as: "ul",
|
|
107
|
-
sx: {
|
|
108
|
-
listStyleType: 'none',
|
|
109
|
-
m: 0,
|
|
110
|
-
p: 0,
|
|
111
|
-
borderTop: '1px solid',
|
|
112
|
-
borderColor: 'border'
|
|
113
|
-
},
|
|
114
|
-
children: renderItemList(groupedItems[groupName])
|
|
115
|
-
})]
|
|
116
|
-
}, index);
|
|
117
|
-
});
|
|
118
|
-
}, [groupedItems]);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
return (0, _jsxRuntime.jsx)(_.Box, {
|
|
122
|
-
as: "ul",
|
|
123
|
-
sx: {
|
|
124
|
-
listStyleType: 'none',
|
|
125
|
-
m: 0,
|
|
126
|
-
p: 0
|
|
127
|
-
},
|
|
128
|
-
className: "vip-resource-list-component",
|
|
129
|
-
children: groupedByDay ? renderGoupedItems(groupedItems) : renderItemList(items)
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
exports.ResourceList = ResourceList;
|
|
134
|
-
ResourceList.propTypes = {
|
|
135
|
-
groupedByDay: _propTypes["default"].bool,
|
|
136
|
-
items: _propTypes["default"].array,
|
|
137
|
-
renderItem: _propTypes["default"].func,
|
|
138
|
-
relativeTime: _propTypes["default"].bool,
|
|
139
|
-
dateKey: _propTypes["default"].string
|
|
140
|
-
};
|
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
exports.__esModule = true;
|
|
6
|
-
exports["default"] = exports.Relative = exports.Grouped = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _bi = require("react-icons/bi");
|
|
11
|
-
|
|
12
|
-
var _ = require("..");
|
|
13
|
-
|
|
14
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
15
|
-
|
|
16
|
-
/** @jsxImportSource theme-ui */
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* External dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
var _default = {
|
|
26
|
-
title: 'ResourceList',
|
|
27
|
-
component: _.ResourceList
|
|
28
|
-
};
|
|
29
|
-
exports["default"] = _default;
|
|
30
|
-
var logs = [{
|
|
31
|
-
actor: 'Saxon Fletcher',
|
|
32
|
-
action: 'switched primary domain to',
|
|
33
|
-
object: 'mydomain.com',
|
|
34
|
-
date: new Date()
|
|
35
|
-
}, {
|
|
36
|
-
actor: 'Saxon Fletcher',
|
|
37
|
-
action: 'switched primary domain to',
|
|
38
|
-
object: 'mydomain.com',
|
|
39
|
-
date: new Date(new Date().setHours(11))
|
|
40
|
-
}, {
|
|
41
|
-
actor: 'Simon Wheatley',
|
|
42
|
-
action: 'deployed to',
|
|
43
|
-
object: 'Production',
|
|
44
|
-
showObject: true,
|
|
45
|
-
date: new Date(new Date().setDate(15))
|
|
46
|
-
}, {
|
|
47
|
-
actor: 'Saxon Fletcher',
|
|
48
|
-
action: 'created a backup on',
|
|
49
|
-
object: 'Production',
|
|
50
|
-
date: new Date(new Date().setDate(13))
|
|
51
|
-
}];
|
|
52
|
-
|
|
53
|
-
var Grouped = function Grouped() {
|
|
54
|
-
return (0, _jsxRuntime.jsxs)(_.Box, {
|
|
55
|
-
sx: {
|
|
56
|
-
p: 5,
|
|
57
|
-
pt: 2
|
|
58
|
-
},
|
|
59
|
-
children: [(0, _jsxRuntime.jsx)(_.Heading, {
|
|
60
|
-
sx: {
|
|
61
|
-
mb: 2
|
|
62
|
-
},
|
|
63
|
-
children: "Audit Log"
|
|
64
|
-
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
65
|
-
sx: {
|
|
66
|
-
mb: 4
|
|
67
|
-
},
|
|
68
|
-
children: "A live trail of system and human events."
|
|
69
|
-
}), (0, _jsxRuntime.jsx)(_.ResourceList, {
|
|
70
|
-
items: logs,
|
|
71
|
-
dateKey: "date",
|
|
72
|
-
groupedByDay: true,
|
|
73
|
-
renderItem: function renderItem(item) {
|
|
74
|
-
return (0, _jsxRuntime.jsxs)(_.ResourceItem, {
|
|
75
|
-
item: item,
|
|
76
|
-
icon: (0, _jsxRuntime.jsx)(_bi.BiGlobe, {
|
|
77
|
-
sx: {
|
|
78
|
-
color: 'red'
|
|
79
|
-
}
|
|
80
|
-
}),
|
|
81
|
-
dateKey: 'date',
|
|
82
|
-
relativeTime: true,
|
|
83
|
-
timeOnly: true,
|
|
84
|
-
children: [(0, _jsxRuntime.jsxs)(_.Flex, {
|
|
85
|
-
sx: {
|
|
86
|
-
alignItems: 'center',
|
|
87
|
-
gap: 3
|
|
88
|
-
},
|
|
89
|
-
children: [(0, _jsxRuntime.jsx)(_.Avatar, {
|
|
90
|
-
name: item.actor,
|
|
91
|
-
src: "https://uifaces.co/our-content/donated/1H_7AxP0.jpg",
|
|
92
|
-
size: 16
|
|
93
|
-
}), (0, _jsxRuntime.jsxs)(_.Heading, {
|
|
94
|
-
variant: "h4",
|
|
95
|
-
as: "p",
|
|
96
|
-
sx: {
|
|
97
|
-
mb: 0,
|
|
98
|
-
fontWeight: 'normal'
|
|
99
|
-
},
|
|
100
|
-
children: [item.actor, ' ', (0, _jsxRuntime.jsx)(_.Text, {
|
|
101
|
-
as: "span",
|
|
102
|
-
sx: {
|
|
103
|
-
color: 'muted',
|
|
104
|
-
mb: 0
|
|
105
|
-
},
|
|
106
|
-
children: item.action
|
|
107
|
-
}), ' ', item.object]
|
|
108
|
-
})]
|
|
109
|
-
}), item.showObject && (0, _jsxRuntime.jsxs)(_.Box, {
|
|
110
|
-
variant: "indent",
|
|
111
|
-
sx: {
|
|
112
|
-
mt: 2,
|
|
113
|
-
display: 'flex',
|
|
114
|
-
flexWrap: 'wrap',
|
|
115
|
-
gap: 3,
|
|
116
|
-
alignItems: 'center'
|
|
117
|
-
},
|
|
118
|
-
children: [(0, _jsxRuntime.jsxs)(_.Heading, {
|
|
119
|
-
variant: "h5",
|
|
120
|
-
as: "div",
|
|
121
|
-
sx: {
|
|
122
|
-
mb: 0
|
|
123
|
-
},
|
|
124
|
-
children: ["Merge pull request", ' ', (0, _jsxRuntime.jsx)(_.Text, {
|
|
125
|
-
as: "span",
|
|
126
|
-
sx: {
|
|
127
|
-
color: 'muted'
|
|
128
|
-
},
|
|
129
|
-
children: "#443"
|
|
130
|
-
})]
|
|
131
|
-
}), (0, _jsxRuntime.jsxs)(_.Text, {
|
|
132
|
-
as: "div",
|
|
133
|
-
sx: {
|
|
134
|
-
mb: 0,
|
|
135
|
-
fontSize: 1,
|
|
136
|
-
display: 'flex',
|
|
137
|
-
alignItems: 'center',
|
|
138
|
-
gap: 1
|
|
139
|
-
},
|
|
140
|
-
children: [(0, _jsxRuntime.jsx)(_.Avatar, {
|
|
141
|
-
name: item.actor,
|
|
142
|
-
src: "https://uifaces.co/our-content/donated/n4Ngwvi7.jpg",
|
|
143
|
-
size: 16
|
|
144
|
-
}), item.actor]
|
|
145
|
-
}), (0, _jsxRuntime.jsxs)(_.Text, {
|
|
146
|
-
sx: {
|
|
147
|
-
mb: 0,
|
|
148
|
-
fontSize: 1,
|
|
149
|
-
display: 'flex',
|
|
150
|
-
alignItems: 'center',
|
|
151
|
-
gap: 1
|
|
152
|
-
},
|
|
153
|
-
children: [(0, _jsxRuntime.jsx)(_bi.BiCheckCircle, {
|
|
154
|
-
size: 16
|
|
155
|
-
}), "Deployed in 31s"]
|
|
156
|
-
})]
|
|
157
|
-
})]
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
})]
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
exports.Grouped = Grouped;
|
|
165
|
-
var deploys = [{
|
|
166
|
-
title: 'Merge pull request',
|
|
167
|
-
id: '#773',
|
|
168
|
-
author: 'Saxon Fletcher',
|
|
169
|
-
date: new Date(new Date().setHours(11)),
|
|
170
|
-
status: 'running'
|
|
171
|
-
}, {
|
|
172
|
-
title: 'Update homepage',
|
|
173
|
-
id: '#772',
|
|
174
|
-
author: 'Saxon Fletcher',
|
|
175
|
-
date: new Date(new Date().setHours(9))
|
|
176
|
-
}, {
|
|
177
|
-
title: 'Improve overall performance',
|
|
178
|
-
id: '#771',
|
|
179
|
-
author: 'Saxon Fletcher',
|
|
180
|
-
date: new Date(new Date().setHours(8))
|
|
181
|
-
}, {
|
|
182
|
-
title: 'Merge pull request',
|
|
183
|
-
id: '#770',
|
|
184
|
-
author: 'Saxon Fletcher',
|
|
185
|
-
date: new Date(new Date().setHours(5)),
|
|
186
|
-
status: 'failed'
|
|
187
|
-
}, {
|
|
188
|
-
title: 'Merge pull request',
|
|
189
|
-
id: '#773',
|
|
190
|
-
author: 'Saxon Fletcher',
|
|
191
|
-
date: new Date(new Date().setHours(11))
|
|
192
|
-
}, {
|
|
193
|
-
title: 'Update homepage',
|
|
194
|
-
id: '#772',
|
|
195
|
-
author: 'Saxon Fletcher',
|
|
196
|
-
date: new Date(new Date().setHours(9))
|
|
197
|
-
}, {
|
|
198
|
-
title: 'Improve overall performance',
|
|
199
|
-
id: '#771',
|
|
200
|
-
author: 'Saxon Fletcher',
|
|
201
|
-
date: new Date(new Date().setHours(8))
|
|
202
|
-
}, {
|
|
203
|
-
title: 'Merge pull request',
|
|
204
|
-
id: '#770',
|
|
205
|
-
author: 'Saxon Fletcher',
|
|
206
|
-
date: new Date(new Date().setHours(5))
|
|
207
|
-
}, {
|
|
208
|
-
title: 'Merge pull request',
|
|
209
|
-
id: '#773',
|
|
210
|
-
author: 'Saxon Fletcher',
|
|
211
|
-
date: new Date(new Date().setHours(11))
|
|
212
|
-
}, {
|
|
213
|
-
title: 'Update homepage',
|
|
214
|
-
id: '#772',
|
|
215
|
-
author: 'Saxon Fletcher',
|
|
216
|
-
date: new Date(new Date().setHours(9))
|
|
217
|
-
}, {
|
|
218
|
-
title: 'Improve overall performance',
|
|
219
|
-
id: '#771',
|
|
220
|
-
author: 'Saxon Fletcher',
|
|
221
|
-
date: new Date(new Date().setHours(8))
|
|
222
|
-
}, {
|
|
223
|
-
title: 'Merge pull request',
|
|
224
|
-
id: '#770',
|
|
225
|
-
author: 'Saxon Fletcher',
|
|
226
|
-
date: new Date(new Date().setHours(5))
|
|
227
|
-
}, {
|
|
228
|
-
title: 'Merge pull request',
|
|
229
|
-
id: '#773',
|
|
230
|
-
author: 'Saxon Fletcher',
|
|
231
|
-
date: new Date(new Date().setHours(11))
|
|
232
|
-
}, {
|
|
233
|
-
title: 'Update homepage',
|
|
234
|
-
id: '#772',
|
|
235
|
-
author: 'Saxon Fletcher',
|
|
236
|
-
date: new Date(new Date().setHours(9))
|
|
237
|
-
}, {
|
|
238
|
-
title: 'Improve overall performance',
|
|
239
|
-
id: '#771',
|
|
240
|
-
author: 'Saxon Fletcher',
|
|
241
|
-
date: new Date(new Date().setHours(8))
|
|
242
|
-
}, {
|
|
243
|
-
title: 'Merge pull request',
|
|
244
|
-
id: '#770',
|
|
245
|
-
author: 'Saxon Fletcher',
|
|
246
|
-
date: new Date(new Date().setHours(5))
|
|
247
|
-
}];
|
|
248
|
-
|
|
249
|
-
var Relative = function Relative() {
|
|
250
|
-
return (0, _jsxRuntime.jsxs)(_.Box, {
|
|
251
|
-
sx: {
|
|
252
|
-
p: 5,
|
|
253
|
-
pt: 2
|
|
254
|
-
},
|
|
255
|
-
children: [(0, _jsxRuntime.jsx)(_.Heading, {
|
|
256
|
-
sx: {
|
|
257
|
-
mb: 2
|
|
258
|
-
},
|
|
259
|
-
children: "Deploys"
|
|
260
|
-
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
261
|
-
sx: {
|
|
262
|
-
mb: 4
|
|
263
|
-
},
|
|
264
|
-
children: "View and manage application deployments."
|
|
265
|
-
}), (0, _jsxRuntime.jsx)(_.Card, {
|
|
266
|
-
variant: "indent",
|
|
267
|
-
sx: {
|
|
268
|
-
mb: 4,
|
|
269
|
-
display: 'flex',
|
|
270
|
-
flexDirection: 'row-reverse',
|
|
271
|
-
gap: 1
|
|
272
|
-
},
|
|
273
|
-
children: deploys.map(function (deploy, index) {
|
|
274
|
-
return (0, _jsxRuntime.jsx)(_.Box, {
|
|
275
|
-
sx: {
|
|
276
|
-
flex: '1 1 auto',
|
|
277
|
-
width: 10,
|
|
278
|
-
height: 4,
|
|
279
|
-
backgroundColor: deploy.status === 'running' ? 'blue.50' : 'green.50',
|
|
280
|
-
borderRadius: 1
|
|
281
|
-
}
|
|
282
|
-
}, index);
|
|
283
|
-
})
|
|
284
|
-
}), (0, _jsxRuntime.jsx)(_.ResourceList, {
|
|
285
|
-
items: deploys,
|
|
286
|
-
dateKey: "date",
|
|
287
|
-
groupedByDay: false,
|
|
288
|
-
renderItem: function renderItem(item) {
|
|
289
|
-
return (0, _jsxRuntime.jsx)(_.ResourceItem, {
|
|
290
|
-
item: item,
|
|
291
|
-
dateKey: 'date',
|
|
292
|
-
relativeTime: true,
|
|
293
|
-
timeOnly: true,
|
|
294
|
-
renderActions: function renderActions() {
|
|
295
|
-
return (0, _jsxRuntime.jsx)(_.Flex, {
|
|
296
|
-
sx: {
|
|
297
|
-
alignItems: 'center'
|
|
298
|
-
},
|
|
299
|
-
children: (0, _jsxRuntime.jsx)(_.Button, {
|
|
300
|
-
variant: "secondary",
|
|
301
|
-
sx: {
|
|
302
|
-
fontSize: 1
|
|
303
|
-
},
|
|
304
|
-
children: "Rollback"
|
|
305
|
-
})
|
|
306
|
-
});
|
|
307
|
-
},
|
|
308
|
-
children: (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
309
|
-
sx: {
|
|
310
|
-
alignItems: 'center',
|
|
311
|
-
gap: 4
|
|
312
|
-
},
|
|
313
|
-
children: [(0, _jsxRuntime.jsxs)(_.Flex, {
|
|
314
|
-
sx: {
|
|
315
|
-
alignItems: 'center',
|
|
316
|
-
gap: 3,
|
|
317
|
-
minWidth: 300
|
|
318
|
-
},
|
|
319
|
-
children: [(0, _jsxRuntime.jsxs)(_.Heading, {
|
|
320
|
-
variant: "h4",
|
|
321
|
-
as: "p",
|
|
322
|
-
sx: {
|
|
323
|
-
mb: 0,
|
|
324
|
-
fontWeight: 'normal'
|
|
325
|
-
},
|
|
326
|
-
children: [item.title, ' ', (0, _jsxRuntime.jsx)(_.Text, {
|
|
327
|
-
as: "span",
|
|
328
|
-
sx: {
|
|
329
|
-
color: 'muted',
|
|
330
|
-
mb: 0
|
|
331
|
-
},
|
|
332
|
-
children: item.id
|
|
333
|
-
})]
|
|
334
|
-
}), item.status === 'running' && (0, _jsxRuntime.jsx)(_.Badge, {
|
|
335
|
-
sx: {
|
|
336
|
-
mb: 0
|
|
337
|
-
},
|
|
338
|
-
children: "Running"
|
|
339
|
-
})]
|
|
340
|
-
}), (0, _jsxRuntime.jsxs)(_.Text, {
|
|
341
|
-
as: "div",
|
|
342
|
-
sx: {
|
|
343
|
-
mb: 0,
|
|
344
|
-
color: 'muted',
|
|
345
|
-
display: 'flex',
|
|
346
|
-
alignItems: 'center',
|
|
347
|
-
gap: 2
|
|
348
|
-
},
|
|
349
|
-
children: [(0, _jsxRuntime.jsx)(_.Avatar, {
|
|
350
|
-
name: item.author,
|
|
351
|
-
size: 16,
|
|
352
|
-
src: "https://randomuser.me/api/portraits/men/46.jpg"
|
|
353
|
-
}), item.author]
|
|
354
|
-
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
355
|
-
sx: {
|
|
356
|
-
mb: 0,
|
|
357
|
-
color: item.status === 'running' ? 'blue.60' : 'muted',
|
|
358
|
-
display: 'flex',
|
|
359
|
-
alignItems: 'center',
|
|
360
|
-
gap: 1
|
|
361
|
-
},
|
|
362
|
-
children: item.status === 'running' ? (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
|
|
363
|
-
children: [(0, _jsxRuntime.jsx)(_bi.BiRevision, {
|
|
364
|
-
size: 16
|
|
365
|
-
}), "Running for 31s"]
|
|
366
|
-
}) : (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
|
|
367
|
-
children: [(0, _jsxRuntime.jsx)(_bi.BiCheckCircle, {
|
|
368
|
-
size: 16
|
|
369
|
-
}), "Deployed in 31s"]
|
|
370
|
-
})
|
|
371
|
-
})]
|
|
372
|
-
})
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
})]
|
|
376
|
-
});
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
exports.Relative = Relative;
|