@automattic/vip-design-system 0.23.4 → 0.23.6
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/codeql-analysis.yml +29 -29
- package/.github/workflows/nodejs.yaml +3 -3
- package/build/system/Button/Button.js +1 -2
- package/build/system/Link/Link.js +2 -2
- package/build/system/Notice/Notice.js +8 -4
- package/build/system/Notice/Notice.stories.js +10 -12
- package/build/system/OptionRow/OptionRow.js +46 -28
- package/build/system/OptionRow/OptionRow.stories.js +13 -6
- package/build/system/OptionRow/OptionRow.test.js +6 -11
- package/package.json +1 -1
- package/src/system/Button/Button.js +1 -2
- package/src/system/Link/Link.js +1 -1
- package/src/system/Notice/Notice.js +15 -2
- package/src/system/Notice/Notice.stories.jsx +13 -5
- package/src/system/OptionRow/OptionRow.js +39 -23
- package/src/system/OptionRow/OptionRow.stories.jsx +16 -3
- package/src/system/OptionRow/OptionRow.test.js +1 -10
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
10
|
# supported CodeQL languages.
|
|
11
11
|
#
|
|
12
|
-
name:
|
|
12
|
+
name: 'CodeQL'
|
|
13
13
|
|
|
14
14
|
on:
|
|
15
15
|
push:
|
|
16
|
-
branches: [
|
|
16
|
+
branches: [master]
|
|
17
17
|
pull_request:
|
|
18
18
|
# The branches below must be a subset of the branches above
|
|
19
|
-
branches: [
|
|
19
|
+
branches: [master]
|
|
20
20
|
schedule:
|
|
21
21
|
- cron: '32 21 * * 6'
|
|
22
22
|
|
|
@@ -32,40 +32,40 @@ jobs:
|
|
|
32
32
|
strategy:
|
|
33
33
|
fail-fast: false
|
|
34
34
|
matrix:
|
|
35
|
-
language: [
|
|
35
|
+
language: ['javascript']
|
|
36
36
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
|
37
37
|
# Learn more:
|
|
38
38
|
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
|
39
39
|
|
|
40
40
|
steps:
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
- name: Checkout repository
|
|
42
|
+
uses: actions/checkout@v3
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
# Initializes the CodeQL tools for scanning.
|
|
45
|
+
- name: Initialize CodeQL
|
|
46
|
+
uses: github/codeql-action/init@v1
|
|
47
|
+
with:
|
|
48
|
+
languages: ${{ matrix.language }}
|
|
49
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
50
|
+
# By default, queries listed here will override any specified in a config file.
|
|
51
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
52
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
55
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
56
|
+
- name: Autobuild
|
|
57
|
+
uses: github/codeql-action/autobuild@v1
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
60
|
+
# 📚 https://git.io/JvXDl
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
63
|
+
# and modify them (or add more) to build your code if your project
|
|
64
|
+
# uses a compiled language
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
#- run: |
|
|
67
|
+
# make bootstrap
|
|
68
|
+
# make release
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
- name: Perform CodeQL Analysis
|
|
71
|
+
uses: github/codeql-action/analyze@v1
|
|
@@ -10,14 +10,14 @@ jobs:
|
|
|
10
10
|
|
|
11
11
|
strategy:
|
|
12
12
|
matrix:
|
|
13
|
-
node-version: [
|
|
13
|
+
node-version: [16]
|
|
14
14
|
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v3
|
|
17
17
|
with:
|
|
18
18
|
persist-credentials: false
|
|
19
19
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
-
uses: actions/setup-node@
|
|
20
|
+
uses: actions/setup-node@v3
|
|
21
21
|
with:
|
|
22
22
|
node-version: ${{ matrix.node-version }}
|
|
23
23
|
- run: npm install -g npm@7.24.2
|
|
@@ -32,7 +32,7 @@ var Button = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRe
|
|
|
32
32
|
justifyContent: 'center',
|
|
33
33
|
height: '36px',
|
|
34
34
|
py: 0,
|
|
35
|
-
textDecoration:
|
|
35
|
+
textDecoration: 'none',
|
|
36
36
|
'&:hover': {
|
|
37
37
|
textDecoration: 'none'
|
|
38
38
|
},
|
|
@@ -58,6 +58,5 @@ exports.Button = Button;
|
|
|
58
58
|
Button.displayName = 'Button';
|
|
59
59
|
Button.propTypes = {
|
|
60
60
|
sx: _propTypes["default"].object,
|
|
61
|
-
to: _propTypes["default"].any,
|
|
62
61
|
className: _propTypes["default"].any
|
|
63
62
|
};
|
|
@@ -24,7 +24,7 @@ var Link = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef)
|
|
|
24
24
|
active = _ref$active === void 0 ? false : _ref$active,
|
|
25
25
|
sx = _ref.sx,
|
|
26
26
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
27
|
-
return (0, _jsxRuntime.jsx)(_themeUi.Link, (0, _extends2["default"])({
|
|
27
|
+
return (0, _jsxRuntime.jsx)(_themeUi.Link, (0, _extends2["default"])({
|
|
28
28
|
sx: (0, _extends2["default"])({
|
|
29
29
|
color: active ? 'links.active' : 'link',
|
|
30
30
|
textDdecorationThickness: '0.1em',
|
|
@@ -47,7 +47,7 @@ var Link = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef)
|
|
|
47
47
|
}
|
|
48
48
|
}, sx),
|
|
49
49
|
ref: forwardRef
|
|
50
|
-
}));
|
|
50
|
+
}, props));
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
exports.Link = Link;
|
|
@@ -21,7 +21,7 @@ var _ = require("../");
|
|
|
21
21
|
|
|
22
22
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["variant", "inline", "children", "title", "sx", "className"];
|
|
24
|
+
var _excluded = ["variant", "inline", "children", "title", "sx", "className", "headingVariant"];
|
|
25
25
|
|
|
26
26
|
var NoticeIcon = function NoticeIcon(_ref) {
|
|
27
27
|
var color = _ref.color,
|
|
@@ -68,6 +68,8 @@ var Notice = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, forwardR
|
|
|
68
68
|
sx = _ref2$sx === void 0 ? {} : _ref2$sx,
|
|
69
69
|
_ref2$className = _ref2.className,
|
|
70
70
|
className = _ref2$className === void 0 ? null : _ref2$className,
|
|
71
|
+
_ref2$headingVariant = _ref2.headingVariant,
|
|
72
|
+
headingVariant = _ref2$headingVariant === void 0 ? 'p' : _ref2$headingVariant,
|
|
71
73
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref2, _excluded);
|
|
72
74
|
var color = 'yellow';
|
|
73
75
|
|
|
@@ -117,11 +119,12 @@ var Notice = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, forwardR
|
|
|
117
119
|
ml: 3
|
|
118
120
|
},
|
|
119
121
|
children: [title && (0, _jsxRuntime.jsx)(_.Heading, {
|
|
120
|
-
|
|
121
|
-
as: "p",
|
|
122
|
+
as: headingVariant,
|
|
122
123
|
sx: {
|
|
123
124
|
color: color + ".100",
|
|
124
|
-
mb: 0
|
|
125
|
+
mb: 0,
|
|
126
|
+
fontSize: 2,
|
|
127
|
+
fontWeight: 'bold'
|
|
125
128
|
},
|
|
126
129
|
children: title
|
|
127
130
|
}), children]
|
|
@@ -139,5 +142,6 @@ Notice.propTypes = {
|
|
|
139
142
|
sx: _propTypes["default"].object,
|
|
140
143
|
title: _propTypes["default"].node,
|
|
141
144
|
variant: _propTypes["default"].string,
|
|
145
|
+
headingVariant: _propTypes["default"].string,
|
|
142
146
|
className: _propTypes["default"].any
|
|
143
147
|
};
|
|
@@ -26,20 +26,19 @@ exports["default"] = _default;
|
|
|
26
26
|
|
|
27
27
|
var Default = function Default() {
|
|
28
28
|
return (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
|
|
29
|
-
children: [(0, _jsxRuntime.
|
|
29
|
+
children: [(0, _jsxRuntime.jsx)(_.Notice, {
|
|
30
30
|
variant: "alert",
|
|
31
|
+
headingVariant: "h2",
|
|
31
32
|
sx: {
|
|
32
33
|
mb: 4
|
|
33
34
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
children: "Your site is ready to launch!"
|
|
37
|
-
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
35
|
+
title: "Your site is ready to launch!",
|
|
36
|
+
children: (0, _jsxRuntime.jsx)(_.Text, {
|
|
38
37
|
sx: {
|
|
39
38
|
mb: 0
|
|
40
39
|
},
|
|
41
40
|
children: "It looks like you\u2018re ready to share your application with the world."
|
|
42
|
-
})
|
|
41
|
+
})
|
|
43
42
|
}), (0, _jsxRuntime.jsxs)(_.Notice, {
|
|
44
43
|
variant: "success",
|
|
45
44
|
sx: {
|
|
@@ -66,15 +65,14 @@ var Default = function Default() {
|
|
|
66
65
|
},
|
|
67
66
|
children: "This notice has a title and children"
|
|
68
67
|
})
|
|
69
|
-
}), (0, _jsxRuntime.
|
|
68
|
+
}), (0, _jsxRuntime.jsx)(_.Notice, {
|
|
70
69
|
variant: "alert",
|
|
71
70
|
sx: {
|
|
72
71
|
mb: 4
|
|
73
72
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}), (0, _jsxRuntime.jsxs)("ul", {
|
|
73
|
+
title: "There are errors in your form",
|
|
74
|
+
headingVariant: "h2",
|
|
75
|
+
children: (0, _jsxRuntime.jsxs)("ul", {
|
|
78
76
|
sx: {
|
|
79
77
|
mb: 0
|
|
80
78
|
},
|
|
@@ -94,7 +92,7 @@ var Default = function Default() {
|
|
|
94
92
|
children: "Please agree to the terms."
|
|
95
93
|
})
|
|
96
94
|
})]
|
|
97
|
-
})
|
|
95
|
+
})
|
|
98
96
|
})]
|
|
99
97
|
});
|
|
100
98
|
};
|
|
@@ -21,24 +21,23 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
21
21
|
|
|
22
22
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["image", "icon", "badge", "label", "inline", "subTitle", "body", "meta", "
|
|
24
|
+
var _excluded = ["image", "icon", "badge", "label", "inline", "subTitle", "body", "meta", "small", "disabled", "order", "className", "variant"];
|
|
25
25
|
var disabledStyles = {
|
|
26
26
|
border: '1px solid',
|
|
27
27
|
borderColor: 'borders.2',
|
|
28
28
|
background: 'none',
|
|
29
29
|
boxShadow: 'none',
|
|
30
|
-
color: '
|
|
30
|
+
color: 'text'
|
|
31
31
|
};
|
|
32
32
|
var gridInlineStyle = {
|
|
33
33
|
py: 2,
|
|
34
|
-
px: 2
|
|
35
|
-
mx: -2
|
|
34
|
+
px: 2
|
|
36
35
|
};
|
|
37
36
|
|
|
38
|
-
var regularGridStyle = function regularGridStyle(
|
|
37
|
+
var regularGridStyle = function regularGridStyle() {
|
|
39
38
|
return {
|
|
40
39
|
py: 3,
|
|
41
|
-
px:
|
|
40
|
+
px: 3,
|
|
42
41
|
borderBottom: '1px solid',
|
|
43
42
|
borderColor: 'borders.2'
|
|
44
43
|
};
|
|
@@ -54,7 +53,6 @@ var OptionRow = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwar
|
|
|
54
53
|
subTitle = _ref.subTitle,
|
|
55
54
|
body = _ref.body,
|
|
56
55
|
meta = _ref.meta,
|
|
57
|
-
to = _ref.to,
|
|
58
56
|
_ref$small = _ref.small,
|
|
59
57
|
small = _ref$small === void 0 ? false : _ref$small,
|
|
60
58
|
_ref$disabled = _ref.disabled,
|
|
@@ -63,22 +61,20 @@ var OptionRow = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwar
|
|
|
63
61
|
order = _ref$order === void 0 ? null : _ref$order,
|
|
64
62
|
_ref$className = _ref.className,
|
|
65
63
|
className = _ref$className === void 0 ? null : _ref$className,
|
|
64
|
+
_ref$variant = _ref.variant,
|
|
65
|
+
variant = _ref$variant === void 0 ? 'h3' : _ref$variant,
|
|
66
66
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
67
67
|
var mergedCard = disabled ? disabledStyles : {};
|
|
68
68
|
var inlineStyles = inline ? gridInlineStyle : regularGridStyle(small);
|
|
69
|
-
return (0, _jsxRuntime.jsxs)(_.Grid,
|
|
70
|
-
to: to,
|
|
69
|
+
return (0, _jsxRuntime.jsxs)(_.Grid, {
|
|
71
70
|
columns: [1, 1, 'auto 1fr auto'],
|
|
72
71
|
gap: [3, 3, "" + (small ? 3 : 4)],
|
|
73
72
|
"data-order": order || undefined,
|
|
74
73
|
className: (0, _classnames["default"])('vip-option-row-component', className),
|
|
75
|
-
ref: forwardRef
|
|
76
|
-
}, props, {
|
|
74
|
+
ref: forwardRef,
|
|
77
75
|
sx: (0, _extends2["default"])({
|
|
76
|
+
position: 'relative',
|
|
78
77
|
alignItems: 'center',
|
|
79
|
-
cursor: disabled ? 'auto' : 'pointer',
|
|
80
|
-
textDecoration: 'none',
|
|
81
|
-
color: 'inherit',
|
|
82
78
|
'&:hover': !disabled && {
|
|
83
79
|
backgroundColor: 'hover'
|
|
84
80
|
}
|
|
@@ -99,28 +95,46 @@ var OptionRow = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwar
|
|
|
99
95
|
sx: {
|
|
100
96
|
display: 'block'
|
|
101
97
|
},
|
|
102
|
-
alt: "
|
|
98
|
+
alt: ""
|
|
103
99
|
})
|
|
104
100
|
}) : icon && icon
|
|
105
101
|
}), (0, _jsxRuntime.jsxs)(_.Box, {
|
|
106
102
|
sx: {
|
|
107
103
|
flex: '1 1 auto'
|
|
108
104
|
},
|
|
109
|
-
children: [(0, _jsxRuntime.
|
|
110
|
-
variant:
|
|
105
|
+
children: [(0, _jsxRuntime.jsx)(_.Heading, {
|
|
106
|
+
variant: variant,
|
|
111
107
|
sx: {
|
|
112
|
-
mb: subTitle || body ? 1 : 0
|
|
108
|
+
mb: subTitle || body ? 1 : 0,
|
|
109
|
+
fontSize: 2,
|
|
110
|
+
fontWeight: 'bold'
|
|
113
111
|
},
|
|
114
|
-
children:
|
|
112
|
+
children: (0, _jsxRuntime.jsxs)(_.Link, (0, _extends2["default"])({
|
|
113
|
+
as: 'a',
|
|
115
114
|
sx: {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
cursor: disabled ? 'auto' : 'pointer',
|
|
116
|
+
color: disabled ? 'text' : 'link',
|
|
117
|
+
'&:after': {
|
|
118
|
+
content: '""',
|
|
119
|
+
position: 'absolute',
|
|
120
|
+
top: 0,
|
|
121
|
+
right: 0,
|
|
122
|
+
bottom: 0,
|
|
123
|
+
left: 0
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}, props, {
|
|
127
|
+
children: [label, badge && (0, _jsxRuntime.jsx)(_.Badge, {
|
|
128
|
+
sx: {
|
|
129
|
+
marginLeft: 2
|
|
130
|
+
},
|
|
131
|
+
children: badge
|
|
132
|
+
})]
|
|
133
|
+
}))
|
|
120
134
|
}), subTitle && (0, _jsxRuntime.jsx)(_.Text, {
|
|
121
135
|
sx: {
|
|
122
136
|
mb: 1,
|
|
123
|
-
color: '
|
|
137
|
+
color: 'text'
|
|
124
138
|
},
|
|
125
139
|
children: subTitle
|
|
126
140
|
}), body && (0, _jsxRuntime.jsx)(_.Text, {
|
|
@@ -132,10 +146,14 @@ var OptionRow = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwar
|
|
|
132
146
|
}), false !== meta && '' !== meta && (0, _jsxRuntime.jsx)(_.Box, {
|
|
133
147
|
"data-testid": "meta",
|
|
134
148
|
children: meta ? meta : (0, _jsxRuntime.jsx)(_md.MdArrowForward, {
|
|
135
|
-
size: 24
|
|
149
|
+
size: 24,
|
|
150
|
+
sx: {
|
|
151
|
+
color: 'text'
|
|
152
|
+
},
|
|
153
|
+
"aria-hidden": "true"
|
|
136
154
|
})
|
|
137
155
|
})]
|
|
138
|
-
})
|
|
156
|
+
});
|
|
139
157
|
});
|
|
140
158
|
|
|
141
159
|
exports.OptionRow = OptionRow;
|
|
@@ -149,9 +167,9 @@ OptionRow.propTypes = {
|
|
|
149
167
|
subTitle: _propTypes["default"].node,
|
|
150
168
|
body: _propTypes["default"].node,
|
|
151
169
|
meta: _propTypes["default"].node,
|
|
152
|
-
to: _propTypes["default"].string,
|
|
153
170
|
small: _propTypes["default"].bool,
|
|
154
171
|
disabled: _propTypes["default"].bool,
|
|
155
172
|
order: _propTypes["default"].number,
|
|
156
|
-
className: _propTypes["default"].any
|
|
173
|
+
className: _propTypes["default"].any,
|
|
174
|
+
variant: _propTypes["default"].string
|
|
157
175
|
};
|
|
@@ -22,19 +22,18 @@ var image2 = // eslint-disable-next-line max-len
|
|
|
22
22
|
|
|
23
23
|
var Default = function Default() {
|
|
24
24
|
return (0, _jsxRuntime.jsxs)(_.Box, {
|
|
25
|
-
sx: {
|
|
26
|
-
mx: -5
|
|
27
|
-
},
|
|
28
25
|
children: [(0, _jsxRuntime.jsx)(_.OptionRow, {
|
|
29
26
|
image: image1,
|
|
30
|
-
label: "Option Row",
|
|
27
|
+
label: "Option Row 1",
|
|
31
28
|
subTitle: "Mostly used to link off to other pages.",
|
|
32
|
-
as: "a"
|
|
29
|
+
as: "a",
|
|
30
|
+
href: "http://google.com/"
|
|
33
31
|
}), (0, _jsxRuntime.jsx)(_.OptionRow, {
|
|
34
32
|
image: image2,
|
|
35
|
-
label: "Option Row",
|
|
33
|
+
label: "Option Row 2",
|
|
36
34
|
subTitle: "Mostly used to link off to other pages.",
|
|
37
35
|
as: "a",
|
|
36
|
+
href: "http://google.com/",
|
|
38
37
|
order: 2
|
|
39
38
|
}), (0, _jsxRuntime.jsx)(_.OptionRow, {
|
|
40
39
|
image: image2,
|
|
@@ -43,6 +42,14 @@ var Default = function Default() {
|
|
|
43
42
|
as: _.Box,
|
|
44
43
|
disabled: true,
|
|
45
44
|
meta: ""
|
|
45
|
+
}), (0, _jsxRuntime.jsx)(_.OptionRow, {
|
|
46
|
+
image: image2,
|
|
47
|
+
label: "Custom heading HTML h2",
|
|
48
|
+
subTitle: "Use the variant prop to adjust the heading structure",
|
|
49
|
+
as: "a",
|
|
50
|
+
href: "http://google.com/",
|
|
51
|
+
variant: "h2",
|
|
52
|
+
meta: ""
|
|
46
53
|
})]
|
|
47
54
|
});
|
|
48
55
|
};
|
|
@@ -53,37 +53,32 @@ describe('<OptionRow />', function () {
|
|
|
53
53
|
}, _callee);
|
|
54
54
|
})));
|
|
55
55
|
it('renders a disabled OptionRow', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
56
|
-
var
|
|
56
|
+
var _render2, container;
|
|
57
57
|
|
|
58
58
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
59
59
|
while (1) {
|
|
60
60
|
switch (_context2.prev = _context2.next) {
|
|
61
61
|
case 0:
|
|
62
|
-
image1 = // eslint-disable-next-line max-len
|
|
63
|
-
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='79' height='79' viewBox='0 0 79 79' fill='none' %3E%3Cpath d='M71.4 15.3L54.2 4.2C54 4 53.7 4 53.4 4H26.4C26.1 4 25.8 4.1 25.6 4.2L8.29997 15.3C7.89997 15.6 7.59998 16 7.59998 16.5V32.1V63C7.59998 63.5 7.89997 64 8.29997 64.2L25.5 75.3C25.5 75.3 25.6 75.3 25.6 75.4C25.6 75.4 25.7 75.4 25.7 75.5C25.9 75.6 26 75.6 26.2 75.6H53.2C53.4 75.6 53.5 75.6 53.7 75.5C53.8 75.5 53.8 75.5 53.8 75.4C53.8 75.4 53.9 75.4 53.9 75.3L71.4 64.2C71.5 64.1 71.7 64 71.8 63.8C71.8 63.8 71.8 63.7 71.9 63.7C72 63.6 72.1 63.4 72.1 63.2V63.1C72.1 63 72.1 62.9 72.1 62.8V32.1V16.5C72.1 16 71.8 15.6 71.4 15.3ZM24.9 71.4L10.6 62.2V34.8L24.9 44V71.4ZM51.9 72.6H27.8V44.7H51.9V72.6ZM69.1 31.3L52.9 41.7H26.8L10.6 31.3V17.3L26.8 6.9H52.9L69.1 17.3V31.3Z' fill='%23BD9D70' /%3E%3C/svg%3E";
|
|
64
62
|
_render2 = (0, _react.render)((0, _jsxRuntime.jsx)(_OptionRow.OptionRow, {
|
|
65
|
-
image: image1,
|
|
66
63
|
label: "Option Row",
|
|
67
64
|
subTitle: "Mostly used to link off to other pages.",
|
|
68
65
|
as: "a",
|
|
69
66
|
disabled: true,
|
|
67
|
+
variant: "h3",
|
|
70
68
|
meta: ""
|
|
71
69
|
})), container = _render2.container;
|
|
72
|
-
expect(_react.screen.getByAltText('Image representing the list item').closest('div')).toHaveStyle({
|
|
73
|
-
background: 'none'
|
|
74
|
-
});
|
|
75
70
|
expect(_react.screen.queryByTestId('meta')).not.toBeInTheDocument(); // Check for accessibility issues
|
|
76
71
|
|
|
77
72
|
_context2.t0 = expect;
|
|
78
|
-
_context2.next =
|
|
73
|
+
_context2.next = 5;
|
|
79
74
|
return (0, _jestAxe.axe)(container);
|
|
80
75
|
|
|
81
|
-
case
|
|
76
|
+
case 5:
|
|
82
77
|
_context2.t1 = _context2.sent;
|
|
83
|
-
_context2.next =
|
|
78
|
+
_context2.next = 8;
|
|
84
79
|
return (0, _context2.t0)(_context2.t1).toHaveNoViolations();
|
|
85
80
|
|
|
86
|
-
case
|
|
81
|
+
case 8:
|
|
87
82
|
case "end":
|
|
88
83
|
return _context2.stop();
|
|
89
84
|
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ const Button = React.forwardRef( ( { sx, ...props }, forwardRef ) => (
|
|
|
17
17
|
justifyContent: 'center',
|
|
18
18
|
height: '36px',
|
|
19
19
|
py: 0,
|
|
20
|
-
textDecoration:
|
|
20
|
+
textDecoration: 'none',
|
|
21
21
|
'&:hover': {
|
|
22
22
|
textDecoration: 'none',
|
|
23
23
|
},
|
|
@@ -40,7 +40,6 @@ Button.displayName = 'Button';
|
|
|
40
40
|
|
|
41
41
|
Button.propTypes = {
|
|
42
42
|
sx: PropTypes.object,
|
|
43
|
-
to: PropTypes.any,
|
|
44
43
|
className: PropTypes.any,
|
|
45
44
|
};
|
|
46
45
|
|
package/src/system/Link/Link.js
CHANGED
|
@@ -9,7 +9,6 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
|
|
10
10
|
const Link = React.forwardRef( ( { active = false, sx, ...props }, forwardRef ) => (
|
|
11
11
|
<ThemeLink
|
|
12
|
-
{ ...props }
|
|
13
12
|
sx={ {
|
|
14
13
|
color: active ? 'links.active' : 'link',
|
|
15
14
|
textDdecorationThickness: '0.1em',
|
|
@@ -29,6 +28,7 @@ const Link = React.forwardRef( ( { active = false, sx, ...props }, forwardRef )
|
|
|
29
28
|
...sx,
|
|
30
29
|
} }
|
|
31
30
|
ref={ forwardRef }
|
|
31
|
+
{ ...props }
|
|
32
32
|
/>
|
|
33
33
|
) );
|
|
34
34
|
|
|
@@ -38,7 +38,16 @@ NoticeIcon.propTypes = {
|
|
|
38
38
|
|
|
39
39
|
const Notice = React.forwardRef(
|
|
40
40
|
(
|
|
41
|
-
{
|
|
41
|
+
{
|
|
42
|
+
variant = 'warning',
|
|
43
|
+
inline = false,
|
|
44
|
+
children,
|
|
45
|
+
title,
|
|
46
|
+
sx = {},
|
|
47
|
+
className = null,
|
|
48
|
+
headingVariant = 'p',
|
|
49
|
+
...props
|
|
50
|
+
},
|
|
42
51
|
forwardRef
|
|
43
52
|
) => {
|
|
44
53
|
let color = 'yellow';
|
|
@@ -88,7 +97,10 @@ const Notice = React.forwardRef(
|
|
|
88
97
|
|
|
89
98
|
<Box sx={ { ml: 3 } }>
|
|
90
99
|
{ title && (
|
|
91
|
-
<Heading
|
|
100
|
+
<Heading
|
|
101
|
+
as={ headingVariant }
|
|
102
|
+
sx={ { color: `${ color }.100`, mb: 0, fontSize: 2, fontWeight: 'bold' } }
|
|
103
|
+
>
|
|
92
104
|
{ title }
|
|
93
105
|
</Heading>
|
|
94
106
|
) }
|
|
@@ -109,6 +121,7 @@ Notice.propTypes = {
|
|
|
109
121
|
sx: PropTypes.object,
|
|
110
122
|
title: PropTypes.node,
|
|
111
123
|
variant: PropTypes.string,
|
|
124
|
+
headingVariant: PropTypes.string,
|
|
112
125
|
className: PropTypes.any,
|
|
113
126
|
};
|
|
114
127
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Internal dependencies
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import { Notice, Text } from '..';
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
title: 'Notice',
|
|
@@ -15,8 +15,12 @@ export default {
|
|
|
15
15
|
|
|
16
16
|
export const Default = () => (
|
|
17
17
|
<React.Fragment>
|
|
18
|
-
<Notice
|
|
19
|
-
|
|
18
|
+
<Notice
|
|
19
|
+
variant="alert"
|
|
20
|
+
headingVariant="h2"
|
|
21
|
+
sx={ { mb: 4 } }
|
|
22
|
+
title="Your site is ready to launch!"
|
|
23
|
+
>
|
|
20
24
|
<Text sx={ { mb: 0 } }>
|
|
21
25
|
It looks like you‘re ready to share your application with the world.
|
|
22
26
|
</Text>
|
|
@@ -32,8 +36,12 @@ export const Default = () => (
|
|
|
32
36
|
<Text sx={ { mb: 0 } }>This notice has a title and children</Text>
|
|
33
37
|
</Notice>
|
|
34
38
|
|
|
35
|
-
<Notice
|
|
36
|
-
|
|
39
|
+
<Notice
|
|
40
|
+
variant="alert"
|
|
41
|
+
sx={ { mb: 4 } }
|
|
42
|
+
title="There are errors in your form"
|
|
43
|
+
headingVariant="h2"
|
|
44
|
+
>
|
|
37
45
|
<ul sx={ { mb: 0 } }>
|
|
38
46
|
<li>
|
|
39
47
|
<a href="#name">Please enter your name.</a>
|
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
|
-
import { Badge, Box, Grid, Heading, Text } from '..';
|
|
13
|
+
import { Badge, Box, Grid, Heading, Text, Link } from '..';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
|
|
16
16
|
const disabledStyles = {
|
|
@@ -18,18 +18,17 @@ const disabledStyles = {
|
|
|
18
18
|
borderColor: 'borders.2',
|
|
19
19
|
background: 'none',
|
|
20
20
|
boxShadow: 'none',
|
|
21
|
-
color: '
|
|
21
|
+
color: 'text',
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const gridInlineStyle = {
|
|
25
25
|
py: 2,
|
|
26
26
|
px: 2,
|
|
27
|
-
mx: -2,
|
|
28
27
|
};
|
|
29
28
|
|
|
30
|
-
const regularGridStyle =
|
|
29
|
+
const regularGridStyle = () => ( {
|
|
31
30
|
py: 3,
|
|
32
|
-
px:
|
|
31
|
+
px: 3,
|
|
33
32
|
borderBottom: '1px solid',
|
|
34
33
|
borderColor: 'borders.2',
|
|
35
34
|
} );
|
|
@@ -45,11 +44,11 @@ const OptionRow = React.forwardRef(
|
|
|
45
44
|
subTitle,
|
|
46
45
|
body,
|
|
47
46
|
meta,
|
|
48
|
-
to,
|
|
49
47
|
small = false,
|
|
50
48
|
disabled = false,
|
|
51
49
|
order = null,
|
|
52
50
|
className = null,
|
|
51
|
+
variant = 'h3',
|
|
53
52
|
...props
|
|
54
53
|
},
|
|
55
54
|
forwardRef
|
|
@@ -59,18 +58,14 @@ const OptionRow = React.forwardRef(
|
|
|
59
58
|
|
|
60
59
|
return (
|
|
61
60
|
<Grid
|
|
62
|
-
to={ to }
|
|
63
61
|
columns={ [ 1, 1, 'auto 1fr auto' ] }
|
|
64
62
|
gap={ [ 3, 3, `${ small ? 3 : 4 }` ] }
|
|
65
63
|
data-order={ order || undefined }
|
|
66
64
|
className={ classNames( 'vip-option-row-component', className ) }
|
|
67
65
|
ref={ forwardRef }
|
|
68
|
-
{ ...props }
|
|
69
66
|
sx={ {
|
|
67
|
+
position: 'relative',
|
|
70
68
|
alignItems: 'center',
|
|
71
|
-
cursor: disabled ? 'auto' : 'pointer',
|
|
72
|
-
textDecoration: 'none',
|
|
73
|
-
color: 'inherit',
|
|
74
69
|
'&:hover': ! disabled && {
|
|
75
70
|
backgroundColor: 'hover',
|
|
76
71
|
},
|
|
@@ -93,12 +88,7 @@ const OptionRow = React.forwardRef(
|
|
|
93
88
|
{ React.isValidElement( image ) ? (
|
|
94
89
|
image
|
|
95
90
|
) : (
|
|
96
|
-
<img
|
|
97
|
-
src={ image }
|
|
98
|
-
width={ small ? 32 : 48 }
|
|
99
|
-
sx={ { display: 'block' } }
|
|
100
|
-
alt="Image representing the list item"
|
|
101
|
-
/>
|
|
91
|
+
<img src={ image } width={ small ? 32 : 48 } sx={ { display: 'block' } } alt="" />
|
|
102
92
|
) }
|
|
103
93
|
</Box>
|
|
104
94
|
) : (
|
|
@@ -107,15 +97,41 @@ const OptionRow = React.forwardRef(
|
|
|
107
97
|
</Box>
|
|
108
98
|
|
|
109
99
|
<Box sx={ { flex: '1 1 auto' } }>
|
|
110
|
-
<Heading
|
|
111
|
-
{
|
|
112
|
-
{
|
|
100
|
+
<Heading
|
|
101
|
+
variant={ variant }
|
|
102
|
+
sx={ { mb: subTitle || body ? 1 : 0, fontSize: 2, fontWeight: 'bold' } }
|
|
103
|
+
>
|
|
104
|
+
<Link
|
|
105
|
+
as={ 'a' }
|
|
106
|
+
sx={ {
|
|
107
|
+
cursor: disabled ? 'auto' : 'pointer',
|
|
108
|
+
color: disabled ? 'text' : 'link',
|
|
109
|
+
'&:after': {
|
|
110
|
+
content: '""',
|
|
111
|
+
position: 'absolute',
|
|
112
|
+
top: 0,
|
|
113
|
+
right: 0,
|
|
114
|
+
bottom: 0,
|
|
115
|
+
left: 0,
|
|
116
|
+
},
|
|
117
|
+
} }
|
|
118
|
+
{ ...props }
|
|
119
|
+
>
|
|
120
|
+
{ label }
|
|
121
|
+
{ badge && <Badge sx={ { marginLeft: 2 } }>{ badge }</Badge> }
|
|
122
|
+
</Link>
|
|
113
123
|
</Heading>
|
|
114
|
-
{ subTitle && <Text sx={ { mb: 1, color: '
|
|
124
|
+
{ subTitle && <Text sx={ { mb: 1, color: 'text' } }>{ subTitle }</Text> }
|
|
115
125
|
{ body && <Text sx={ { mb: 0 } }>{ body }</Text> }
|
|
116
126
|
</Box>
|
|
117
127
|
{ false !== meta && '' !== meta && (
|
|
118
|
-
<Box data-testid="meta">
|
|
128
|
+
<Box data-testid="meta">
|
|
129
|
+
{ meta ? (
|
|
130
|
+
meta
|
|
131
|
+
) : (
|
|
132
|
+
<MdArrowForward size={ 24 } sx={ { color: 'text' } } aria-hidden="true" />
|
|
133
|
+
) }
|
|
134
|
+
</Box>
|
|
119
135
|
) }
|
|
120
136
|
</Grid>
|
|
121
137
|
);
|
|
@@ -133,11 +149,11 @@ OptionRow.propTypes = {
|
|
|
133
149
|
subTitle: PropTypes.node,
|
|
134
150
|
body: PropTypes.node,
|
|
135
151
|
meta: PropTypes.node,
|
|
136
|
-
to: PropTypes.string,
|
|
137
152
|
small: PropTypes.bool,
|
|
138
153
|
disabled: PropTypes.bool,
|
|
139
154
|
order: PropTypes.number,
|
|
140
155
|
className: PropTypes.any,
|
|
156
|
+
variant: PropTypes.string,
|
|
141
157
|
};
|
|
142
158
|
|
|
143
159
|
export { OptionRow };
|
|
@@ -16,20 +16,23 @@ const image2 =
|
|
|
16
16
|
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='79' height='79' viewBox='0 0 79 79' fill='none'%3E%3Cpath d='M66.3001 15.9C66.3001 15.9 66.3 15.8 66.2 15.8C66.1 15.7 66 15.5 65.9001 15.4C65.9001 15.4 65.9001 15.4 65.9001 15.3L44.4001 0.2C44.3001 0.0999998 44.2 0.0999994 44.1 0.0999994C44 0.0999994 44.0001 0 43.9001 0H43.3C43.2 0 43.1 0.0999994 43.1 0.0999994C43 0.0999994 42.9 0.2 42.8 0.2L28.2001 10.3C28.1 10.4 28.0001 10.5 27.9001 10.6C27.9001 10.6 27.9001 10.6 27.9001 10.7C27.8001 10.8 27.7001 11 27.7001 11.2C27.7001 11.2 27.7001 11.2 27.7001 11.3V31.1L13.9 40.8L13.7001 41C13.6001 41.1 13.6 41.1 13.6 41.2L13.5 41.3C13.5 41.4 13.4 41.5 13.4 41.5V41.6C13.4 41.7 13.3 41.8 13.3 42V62.2C13.3 62.4 13.3 62.6 13.4 62.7V62.8C13.5 62.9 13.6001 63.1 13.7001 63.2C13.7001 63.2 13.7 63.2 13.8 63.3L13.9 63.4L35.3 78.6H35.4001C35.4001 78.6 35.5 78.6 35.5 78.7H35.6C35.8 78.8 36 78.8 36.2001 78.8C36.3001 78.8 36.5 78.8 36.6 78.7H36.7001C36.8001 78.7 36.8001 78.7 36.9001 78.6C36.9001 78.6 37 78.6 37 78.5H37.1L66 58.3C66.1 58.2 66.2001 58.1 66.3001 58V15.9ZM34.6 74.5L16.1 61.3V44.7L34.6 57.8V74.5ZM36 55.3L17.2001 41.9L29 33.5L47.9001 46.9L36 55.3ZM49 44.1L30.5 31V14.4L49 27.5V44.1ZM50.5 24.9L31.6 11.5L43.5 3.2L62.4001 16.6L50.5 24.9Z' fill='%23BD9D70'/%3E%3C/svg%3E";
|
|
17
17
|
|
|
18
18
|
export const Default = () => (
|
|
19
|
-
<Box
|
|
19
|
+
<Box>
|
|
20
20
|
<OptionRow
|
|
21
21
|
image={ image1 }
|
|
22
|
-
label="Option Row"
|
|
22
|
+
label="Option Row 1"
|
|
23
23
|
subTitle="Mostly used to link off to other pages."
|
|
24
24
|
as="a"
|
|
25
|
+
href="http://google.com/"
|
|
25
26
|
/>
|
|
26
27
|
<OptionRow
|
|
27
28
|
image={ image2 }
|
|
28
|
-
label="Option Row"
|
|
29
|
+
label="Option Row 2"
|
|
29
30
|
subTitle="Mostly used to link off to other pages."
|
|
30
31
|
as="a"
|
|
32
|
+
href="http://google.com/"
|
|
31
33
|
order={ 2 }
|
|
32
34
|
/>
|
|
35
|
+
|
|
33
36
|
<OptionRow
|
|
34
37
|
image={ image2 }
|
|
35
38
|
label="Option Row – Disabled"
|
|
@@ -38,5 +41,15 @@ export const Default = () => (
|
|
|
38
41
|
disabled
|
|
39
42
|
meta=""
|
|
40
43
|
/>
|
|
44
|
+
|
|
45
|
+
<OptionRow
|
|
46
|
+
image={ image2 }
|
|
47
|
+
label="Custom heading HTML h2"
|
|
48
|
+
subTitle="Use the variant prop to adjust the heading structure"
|
|
49
|
+
as="a"
|
|
50
|
+
href="http://google.com/"
|
|
51
|
+
variant="h2"
|
|
52
|
+
meta=""
|
|
53
|
+
/>
|
|
41
54
|
</Box>
|
|
42
55
|
);
|
|
@@ -22,26 +22,17 @@ describe( '<OptionRow />', () => {
|
|
|
22
22
|
} );
|
|
23
23
|
|
|
24
24
|
it( 'renders a disabled OptionRow', async () => {
|
|
25
|
-
const image1 =
|
|
26
|
-
// eslint-disable-next-line max-len
|
|
27
|
-
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='79' height='79' viewBox='0 0 79 79' fill='none' %3E%3Cpath d='M71.4 15.3L54.2 4.2C54 4 53.7 4 53.4 4H26.4C26.1 4 25.8 4.1 25.6 4.2L8.29997 15.3C7.89997 15.6 7.59998 16 7.59998 16.5V32.1V63C7.59998 63.5 7.89997 64 8.29997 64.2L25.5 75.3C25.5 75.3 25.6 75.3 25.6 75.4C25.6 75.4 25.7 75.4 25.7 75.5C25.9 75.6 26 75.6 26.2 75.6H53.2C53.4 75.6 53.5 75.6 53.7 75.5C53.8 75.5 53.8 75.5 53.8 75.4C53.8 75.4 53.9 75.4 53.9 75.3L71.4 64.2C71.5 64.1 71.7 64 71.8 63.8C71.8 63.8 71.8 63.7 71.9 63.7C72 63.6 72.1 63.4 72.1 63.2V63.1C72.1 63 72.1 62.9 72.1 62.8V32.1V16.5C72.1 16 71.8 15.6 71.4 15.3ZM24.9 71.4L10.6 62.2V34.8L24.9 44V71.4ZM51.9 72.6H27.8V44.7H51.9V72.6ZM69.1 31.3L52.9 41.7H26.8L10.6 31.3V17.3L26.8 6.9H52.9L69.1 17.3V31.3Z' fill='%23BD9D70' /%3E%3C/svg%3E";
|
|
28
|
-
|
|
29
25
|
const { container } = render(
|
|
30
26
|
<OptionRow
|
|
31
|
-
image={ image1 }
|
|
32
27
|
label="Option Row"
|
|
33
28
|
subTitle="Mostly used to link off to other pages."
|
|
34
29
|
as="a"
|
|
35
30
|
disabled
|
|
31
|
+
variant="h3"
|
|
36
32
|
meta=""
|
|
37
33
|
/>
|
|
38
34
|
);
|
|
39
35
|
|
|
40
|
-
expect(
|
|
41
|
-
screen.getByAltText( 'Image representing the list item' ).closest( 'div' )
|
|
42
|
-
).toHaveStyle( {
|
|
43
|
-
background: 'none',
|
|
44
|
-
} );
|
|
45
36
|
expect( screen.queryByTestId( 'meta' ) ).not.toBeInTheDocument();
|
|
46
37
|
|
|
47
38
|
// Check for accessibility issues
|