@automattic/vip-design-system 0.7.1 → 0.9.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.
Files changed (115) hide show
  1. package/.eslines.json +10 -0
  2. package/.eslintignore +7 -0
  3. package/.eslintrc.json +23 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  5. package/.github/workflows/codeql-analysis.yml +71 -0
  6. package/.github/workflows/nodejs.yaml +29 -0
  7. package/.prettierrc +9 -0
  8. package/.storybook/preview.js +8 -7
  9. package/README.md +52 -2
  10. package/babel.config.js +10 -10
  11. package/build/system/Avatar/Avatar.js +5 -1
  12. package/build/system/Avatar/Avatar.test.js +54 -0
  13. package/build/system/Badge/Badge.js +2 -2
  14. package/build/system/BlankState/BlankState.js +5 -4
  15. package/build/system/Button/Button.js +5 -1
  16. package/build/system/Card/Card.js +2 -1
  17. package/build/system/Code/Code.js +4 -4
  18. package/build/system/ConfirmationDialog/ConfirmationDialog.js +1 -1
  19. package/build/system/Dialog/DialogButton.js +2 -4
  20. package/build/system/Dialog/DialogContent.js +5 -5
  21. package/build/system/Form/InlineSelect.js +28 -16
  22. package/build/system/Form/Input.js +3 -2
  23. package/build/system/Form/Label.js +2 -2
  24. package/build/system/Form/RadioBoxGroup.js +0 -2
  25. package/build/system/Form/SearchSelect.js +36 -56
  26. package/build/system/Form/Select.js +3 -3
  27. package/build/system/Form/Textarea.js +3 -2
  28. package/build/system/Form/Toggle.js +1 -1
  29. package/build/system/Form/ToggleGroup.js +0 -4
  30. package/build/system/Form/ToggleRow.js +5 -4
  31. package/build/system/Form/Validation.js +4 -4
  32. package/build/system/Notice/Notice.js +58 -54
  33. package/build/system/Notification/Notification.js +3 -3
  34. package/build/system/OptionRow/OptionRow.js +11 -10
  35. package/build/system/ResourceList/ResourceItem.js +89 -0
  36. package/build/system/ResourceList/ResourceList.js +121 -0
  37. package/build/system/ResourceList/index.js +11 -0
  38. package/build/system/Table/TableRow.js +1 -1
  39. package/build/system/Tabs/TabItem.js +2 -2
  40. package/build/system/Tabs/Tabs.js +1 -1
  41. package/build/system/Time/index.js +91 -0
  42. package/build/system/Tooltip/Tooltip.js +49 -47
  43. package/build/system/Wizard/WizardStep.js +4 -4
  44. package/build/system/Wizard/WizardStepHorizontal.js +2 -2
  45. package/build/system/index.js +7 -2
  46. package/build/system/theme/colors.js +235 -131
  47. package/build/system/theme/index.js +128 -107
  48. package/package.json +48 -13
  49. package/src/system/Avatar/Avatar.js +5 -1
  50. package/src/system/Avatar/Avatar.stories.js +0 -5
  51. package/src/system/Avatar/Avatar.test.js +31 -0
  52. package/src/system/Badge/Badge.js +3 -3
  53. package/src/system/Badge/Badge.stories.js +0 -5
  54. package/src/system/BlankState/BlankState.js +5 -5
  55. package/src/system/BlankState/BlankState.stories.js +0 -5
  56. package/src/system/Box/Box.stories.js +0 -5
  57. package/src/system/Button/Button.js +6 -2
  58. package/src/system/Card/Card.js +16 -12
  59. package/src/system/Card/Card.stories.js +0 -5
  60. package/src/system/Code/Code.js +4 -4
  61. package/src/system/Code/Code.stories.js +4 -1
  62. package/src/system/ConfirmationDialog/ConfirmationDialog.js +1 -1
  63. package/src/system/ConfirmationDialog/ConfirmationDialog.stories.js +0 -5
  64. package/src/system/Dialog/Dialog.stories.js +0 -5
  65. package/src/system/Dialog/DialogButton.js +2 -3
  66. package/src/system/Dialog/DialogContent.js +17 -4
  67. package/src/system/Flex/Flex.stories.js +0 -5
  68. package/src/system/Form/InlineSelect.js +28 -15
  69. package/src/system/Form/Input.js +3 -1
  70. package/src/system/Form/Input.stories.js +0 -5
  71. package/src/system/Form/Label.js +2 -2
  72. package/src/system/Form/RadioBoxGroup.js +1 -2
  73. package/src/system/Form/RadioBoxGroup.stories.js +4 -5
  74. package/src/system/Form/SearchSelect.js +35 -42
  75. package/src/system/Form/Select.js +18 -18
  76. package/src/system/Form/Select.stories.js +1 -1
  77. package/src/system/Form/Textarea.js +3 -1
  78. package/src/system/Form/Toggle.js +1 -1
  79. package/src/system/Form/ToggleGroup.js +34 -37
  80. package/src/system/Form/ToggleGroup.stories.js +30 -32
  81. package/src/system/Form/ToggleRow.js +4 -4
  82. package/src/system/Form/Validation.js +2 -2
  83. package/src/system/Grid/Grid.stories.js +0 -5
  84. package/src/system/Heading/Heading.stories.js +0 -5
  85. package/src/system/Link/Link.stories.js +0 -5
  86. package/src/system/Notice/Notice.js +33 -28
  87. package/src/system/Notification/Notification.js +5 -5
  88. package/src/system/Notification/Notification.stories.js +0 -5
  89. package/src/system/OptionRow/OptionRow.js +36 -31
  90. package/src/system/OptionRow/OptionRow.stories.js +0 -5
  91. package/src/system/Progress/Progress.stories.js +0 -5
  92. package/src/system/ResourceList/ResourceItem.js +66 -0
  93. package/src/system/ResourceList/ResourceList.js +96 -0
  94. package/src/system/ResourceList/ResourceList.stories.js +300 -0
  95. package/src/system/ResourceList/index.js +7 -0
  96. package/src/system/Spinner/Spinner.stories.js +0 -5
  97. package/src/system/Table/Table.stories.js +0 -5
  98. package/src/system/Table/TableRow.js +2 -2
  99. package/src/system/Tabs/TabItem.js +2 -2
  100. package/src/system/Tabs/Tabs.js +1 -1
  101. package/src/system/Tabs/Tabs.stories.js +0 -5
  102. package/src/system/Text/Text.stories.js +0 -5
  103. package/src/system/{Timeline/Timeline.stories.js → Time/Time.stories.js} +5 -5
  104. package/src/system/Time/index.js +62 -0
  105. package/src/system/Tooltip/Tooltip.js +40 -35
  106. package/src/system/Tooltip/Tooltip.stories.js +0 -5
  107. package/src/system/Wizard/Wizard.js +7 -7
  108. package/src/system/Wizard/WizardStep.js +9 -9
  109. package/src/system/Wizard/WizardStepHorizontal.js +3 -3
  110. package/src/system/index.js +27 -4
  111. package/src/system/theme/colors.js +233 -129
  112. package/src/system/theme/index.js +290 -260
  113. package/test/setupAfterEnv.js +13 -0
  114. package/test/setupTests.js +4 -0
  115. package/src/system/Timeline/index.js +0 -40
@@ -3,21 +3,66 @@
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
5
 
6
- var _colors = _interopRequireDefault(require("./colors"));
7
-
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6
+ var _colors = require("./colors");
9
7
 
10
8
  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); }
11
9
 
10
+ var textStyles = {
11
+ h1: {
12
+ fontSize: 5,
13
+ marginBottom: 3,
14
+ letterSpacing: '-.02em',
15
+ fontWeight: 'body',
16
+ fontFamily: 'serif',
17
+ color: 'heading'
18
+ },
19
+ h2: {
20
+ fontSize: 4,
21
+ marginBottom: 2,
22
+ letterSpacing: '-.005em',
23
+ fontWeight: 400,
24
+ color: 'heading'
25
+ },
26
+ h3: {
27
+ fontSize: 3,
28
+ marginBottom: 3,
29
+ letterSpacing: '-.005em',
30
+ lineHeight: 1.4,
31
+ fontWeight: 'heading',
32
+ color: 'heading'
33
+ },
34
+ h4: {
35
+ fontSize: 2,
36
+ marginBottom: 1,
37
+ lineHeight: 1.5,
38
+ fontWeight: 'heading',
39
+ color: 'heading'
40
+ },
41
+ h5: {
42
+ fontSize: 1,
43
+ marginBottom: 1,
44
+ lineHeight: 1.5,
45
+ fontWeight: 'heading',
46
+ color: 'heading'
47
+ },
48
+ caps: {
49
+ fontSize: 1,
50
+ marginBottom: 2,
51
+ textTransform: 'uppercase',
52
+ color: 'muted',
53
+ fontWeight: 'bold',
54
+ letterSpacing: '.05em'
55
+ }
56
+ };
12
57
  var _default = {
13
- initialColorModeName: 'light',
14
58
  space: [0, 4, 8, 16, 32, 64, 128, 256, 512],
15
59
  fonts: {
16
- body: '"SF Pro Text", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif',
60
+ body: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif',
17
61
  heading: 'inherit',
18
- monospace: '"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace'
62
+ monospace: '"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',
63
+ serif: 'recoletaregular, Georgia, serif'
19
64
  },
20
- fontSizes: [11, 13, 15, 20, 32, 48, 56, 64, 96],
65
+ fontSizes: [10, 12, 14, 19, 32, 40, 56, 64, 96],
21
66
  fontWeights: {
22
67
  body: 400,
23
68
  heading: 500,
@@ -30,45 +75,64 @@ var _default = {
30
75
  sizes: {
31
76
  sidebar: 260
32
77
  },
33
- radii: [0, 3, 5],
78
+ radii: [0, 5, 10],
79
+ config: {
80
+ useColorSchemeMediaQuery: false
81
+ },
82
+ initialColorModeName: 'light',
34
83
  colors: _extends({
35
- text: _colors["default"].grey['70'],
36
- heading: _colors["default"].grey['100'],
37
- background: _colors["default"].brand['0'],
38
- backgroundSecondary: _colors["default"].brand['3'],
39
- primary: _colors["default"].brand['50'],
84
+ text: _colors.light.grey['90'],
85
+ heading: _colors.light.grey['100'],
86
+ background: '#fdfdfd',
87
+ backgroundSecondary: _colors.light.grey['10'],
88
+ primary: _colors.light.brand['70'],
40
89
  secondary: '#30c',
41
- muted: _colors["default"].grey['60'],
42
- link: _colors["default"].brand['70'],
43
- card: '#fefefe',
44
- border: _colors["default"].brand['7'],
45
- hover: 'rgba(0,0,0,.025)',
90
+ muted: _colors.light.grey['90'],
91
+ link: _colors.light.brand['90'],
92
+ card: '#fff',
93
+ border: _colors.light.grey['20'],
94
+ hover: 'rgba(0,0,0,.02)',
46
95
  lightenBackground: 'rgba(255,255,255,.5)',
47
- placeholder: _colors["default"].grey['40'],
96
+ darken: 'rgba(0,0,0,.05)',
97
+ placeholder: _colors.light.grey['70'],
48
98
  midnight: '#13191E',
99
+ navigationStart: _colors.light.grey['5'],
100
+ navigationEnd: _colors.light.grey['5'],
101
+ success: _colors.light.green['90'],
102
+ error: _colors.light.red['90'],
103
+ warning: _colors.light.yellow['90'],
104
+ dialog: _colors.light.grey['0'],
105
+ backgroundMuted: _colors.light.grey['5']
106
+ }, _colors.light, {
49
107
  modes: {
50
- dark: {
51
- text: _colors["default"].grey['30'],
52
- heading: _colors["default"].grey['10'],
53
- background: _colors["default"].grey['90'],
54
- backgroundSecondary: _colors["default"].grey['80'],
55
- lightenBackground: 'rgba(0,0,0,.1)',
56
- primary: _colors["default"].brand['50'],
57
- muted: _colors["default"].grey['40'],
58
- link: _colors["default"].brand['30'],
59
- card: _colors["default"].grey['80'],
60
- placeholder: _colors["default"].grey['70'],
61
- border: 'rgba(255,255,255,.08)',
108
+ dark: _extends({
109
+ text: _colors.dark.grey['90'],
110
+ heading: _colors.dark.grey['100'],
111
+ background: _colors.dark.grey['5'],
112
+ backgroundSecondary: _colors.dark.grey['10'],
113
+ primary: _colors.light.brand['70'],
114
+ secondary: '#30c',
115
+ muted: _colors.dark.grey['90'],
116
+ link: _colors.dark.brand['90'],
117
+ card: _colors.dark.grey['20'],
118
+ placeholder: _colors.dark.grey['70'],
119
+ border: _colors.dark.grey['30'],
62
120
  hover: 'rgba(255,255,255,.02)',
63
- midnight: _colors["default"].grey['90']
64
- }
121
+ midnight: _colors.dark.grey['90'],
122
+ navigationStart: _colors.dark.grey['5'],
123
+ navigationEnd: _colors.dark.grey['5'],
124
+ success: _colors.dark.green['90'],
125
+ error: _colors.dark.red['90'],
126
+ warning: _colors.dark.yellow['90'],
127
+ dialog: _colors.dark.grey['40'],
128
+ backgroundMuted: _colors.dark.grey['10']
129
+ }, _colors.dark)
65
130
  }
66
- }, _colors["default"]),
131
+ }),
67
132
  shadows: {
68
- low: // eslint-disable-next-line max-len
69
- '0px 0.11069px 0.193708px rgba(0, 0, 0, 0.0196802), 0px 0.266004px 0.465507px rgba(0, 0, 0, 0.0282725), 0px 0.500862px 0.876509px rgba(0, 0, 0, 0.035), 0px 0.893452px 1.56354px rgba(0, 0, 0, 0.0417275), 0px 1.6711px 2.92443px rgba(0, 0, 0, 0.0503198), 0px 4px 7px rgba(0, 0, 0, 0.07)',
133
+ low: '0px 1px 5px rgba(0, 0, 0, 0.05), 0px 1px 1px rgba(0, 0, 0, 0.15)',
70
134
  medium: // eslint-disable-next-line max-len
71
- '0px 1.97961px 2.21381px rgba(0, 0, 0, 0.0196802), 0px 4.36146px 5.32008px rgba(0, 0, 0, 0.0282725), 0px 7.34273px 10.0172px rgba(0, 0, 0, 0.035), 0px 11.2752px 17.869px rgba(0, 0, 0, 0.0417275), 0px 16.7372px 33.4221px rgba(0, 0, 0, 0.0503198), 0px 24px 80px rgba(0, 0, 0, 0.07)',
135
+ '0px 15px 30px rgba(0, 0, 0, 0.07), 0px 1px 2px rgba(0, 0, 0, 0.03)',
72
136
  high: // eslint-disable-next-line max-len
73
137
  '0px 2.76726px 2.21381px rgba(0, 0, 0, 0.0196802), 0px 6.6501px 5.32008px rgba(0, 0, 0, 0.0282725), 0px 12.5216px 10.0172px rgba(0, 0, 0, 0.035), 0px 22.3363px 17.869px rgba(0, 0, 0, 0.0417275), 0px 41.7776px 33.4221px rgba(0, 0, 0, 0.0503198), 0px 100px 80px rgba(0, 0, 0, 0.07)'
74
138
  },
@@ -90,26 +154,22 @@ var _default = {
90
154
  borderRadius: 2,
91
155
  p: 3,
92
156
  boxShadow: 'none',
93
- backgroundColor: 'backgroundSecondary'
157
+ backgroundColor: 'backgroundMuted'
94
158
  }
95
159
  },
96
160
  buttons: {
97
161
  primary: {
98
162
  // you can reference other values defined in the theme
99
- color: 'white',
100
- bg: _colors["default"].brand['70'],
163
+ color: 'grey.0',
164
+ bg: 'grey.100',
101
165
  cursor: 'pointer',
102
- fontWeight: 'heading',
103
- boxShadow: 'low',
166
+ fontWeight: 'bold',
167
+ boxShadow: 'none',
104
168
  borderRadius: 1,
105
169
  border: '1px solid transparent',
106
- svg: {
107
- position: 'relative',
108
- top: '0.125em'
109
- },
110
170
  '&:hover, &:focus': {
111
- backgroundColor: 'brand.80',
112
- color: 'white'
171
+ backgroundColor: 'grey.90',
172
+ color: 'grey.0'
113
173
  }
114
174
  },
115
175
  border: {
@@ -127,23 +187,21 @@ var _default = {
127
187
  danger: {
128
188
  // you can reference other values defined in the theme
129
189
  variant: 'buttons.primary',
130
- bg: _colors["default"].red['70'],
190
+ bg: 'red.70',
131
191
  '&:hover, &:focus': {
132
192
  backgroundColor: 'red.80'
133
193
  }
134
194
  },
135
195
  secondary: {
136
- color: 'inherit',
196
+ color: 'text',
137
197
  cursor: 'pointer',
138
198
  boxShadow: 'none',
199
+ fontWeight: 'heading',
139
200
  borderRadius: 1,
140
- backgroundColor: 'backgroundSecondary',
141
- svg: {
142
- position: 'relative',
143
- top: '0.125em'
144
- },
201
+ bg: 'grey.10',
145
202
  '&:hover, &:focus': {
146
- bg: 'brand.7'
203
+ color: 'grey.100',
204
+ bg: 'grey.20'
147
205
  }
148
206
  },
149
207
  text: {
@@ -164,9 +222,6 @@ var _default = {
164
222
  cursor: 'pointer',
165
223
  fontWeight: 'heading',
166
224
  padding: 1,
167
- svg: {
168
- display: 'block'
169
- },
170
225
  '&:hover, &:focus': {
171
226
  backgroundColor: 'border'
172
227
  }
@@ -192,53 +247,15 @@ var _default = {
192
247
  }
193
248
  }
194
249
  },
195
- text: {
196
- h1: {
197
- fontSize: 5,
198
- marginBottom: 3,
199
- letterSpacing: '-.02em',
200
- fontWeight: 'heading'
201
- },
202
- h2: {
203
- fontSize: 4,
204
- marginBottom: 2,
205
- letterSpacing: '-.005em',
206
- fontWeight: 400
207
- },
208
- h3: {
209
- fontSize: 3,
210
- marginBottom: 3,
211
- letterSpacing: '-.005em',
212
- lineHeight: 1.25,
213
- fontWeight: 'heading'
214
- },
215
- h4: {
216
- fontSize: 2,
217
- marginBottom: 1,
218
- lineHeight: 1.5,
219
- fontWeight: 'heading'
220
- },
221
- h5: {
222
- fontSize: 1,
223
- marginBottom: 1,
224
- lineHeight: 1.5,
225
- fontWeight: 'body'
226
- },
227
- caps: {
228
- fontSize: 1,
229
- marginBottom: 2,
230
- textTransform: 'uppercase',
231
- color: 'muted',
232
- fontWeight: 'bold',
233
- letterSpacing: '.05em'
234
- }
235
- },
250
+ text: textStyles,
236
251
  dialog: {
237
252
  modal: {
238
253
  position: 'fixed',
239
254
  top: '10vh',
240
255
  left: '50%',
241
- maxWidth: '90%'
256
+ maxWidth: '90%',
257
+ backgroundColor: 'background',
258
+ boxShadow: 'high'
242
259
  },
243
260
  sidebar: {
244
261
  position: 'fixed',
@@ -248,6 +265,7 @@ var _default = {
248
265
  overflow: 'auto',
249
266
  margin: 0,
250
267
  borderRadius: 0,
268
+ boxShadow: 'high',
251
269
  backgroundColor: 'background'
252
270
  },
253
271
  cover: {
@@ -263,20 +281,23 @@ var _default = {
263
281
  }
264
282
  },
265
283
  styles: {
266
- root: {
284
+ root: _extends({
267
285
  fontFamily: 'body',
268
286
  lineHeight: 'body',
269
287
  fontWeight: 'body',
270
- letterSpacing: '-.011em',
271
288
  fontSize: 2,
272
289
  color: 'text',
273
290
  backgroundColor: 'background',
274
- 'WebkitFontSmoothing': 'antialiased',
275
- 'MozOsxFontSmoothing': 'grayscale',
291
+ '-webkit-font-smoothing': 'antialiased',
292
+ '-moz-osx-font-smoothing': 'grayscale',
276
293
  svg: {
277
- fill: 'currentColor'
294
+ fill: 'currentColor',
295
+ display: 'block'
296
+ },
297
+ pre: {
298
+ fontFamily: 'body'
278
299
  }
279
- }
300
+ }, textStyles)
280
301
  }
281
302
  };
282
303
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,14 +1,22 @@
1
1
  {
2
2
  "name": "@automattic/vip-design-system",
3
- "version": "0.7.1",
3
+ "version": "0.9.1",
4
4
  "main": "build/system/index.js",
5
5
  "scripts": {
6
6
  "build-storybook": "build-storybook",
7
7
  "build": "cross-env NODE_ENV=production babel src --out-dir build",
8
- "watch": "npm run build -- --watch",
9
- "storybook": "start-storybook -p 6006"
8
+ "format": "eslint . --fix",
9
+ "jest": "NODE_ENV=test jest --detectOpenHandles",
10
+ "jest:watch": "npm run jest --watch",
11
+ "lint": "eslint . -f json | eslines --quiet",
12
+ "storybook": "start-storybook -p 6006",
13
+ "test": "npm run lint && npm run jest",
14
+ "watch": "npm run build -- --watch"
10
15
  },
11
16
  "dependencies": {
17
+ "@radix-ui/react-checkbox": "^0.1.0",
18
+ "@radix-ui/react-radio-group": "^0.1.0",
19
+ "@radix-ui/react-tooltip": "^0.1.0",
12
20
  "babel-loader": "^8.2.2",
13
21
  "framer-motion": "^3.9.1",
14
22
  "react-icons": "^4.2.0",
@@ -17,7 +25,7 @@
17
25
  "peerDependencies": {
18
26
  "react": "*",
19
27
  "react-dom": "*",
20
- "theme-ui": "^0.6.2"
28
+ "theme-ui": "0.10.0"
21
29
  },
22
30
  "resolutions": {
23
31
  "react": "17.0.1",
@@ -25,9 +33,27 @@
25
33
  "**/react": "17.0.1",
26
34
  "**/react-dom": "17.0.1"
27
35
  },
36
+ "jest": {
37
+ "testURL": "http://localhost",
38
+ "setupFiles": [
39
+ "./test/setupTests.js"
40
+ ],
41
+ "setupFilesAfterEnv": [
42
+ "./test/setupAfterEnv.js"
43
+ ],
44
+ "transformIgnorePatterns": [
45
+ ".*.stories.js$"
46
+ ],
47
+ "transform": {
48
+ "\\.[jt]sx?$": "babel-jest"
49
+ }
50
+ },
28
51
  "devDependencies": {
52
+ "immer": ">=9.0.6",
53
+ "@axe-core/react": "4.3.2",
29
54
  "@babel/cli": "^7.14.3",
30
55
  "@babel/core": "7.14.0",
56
+ "@babel/eslint-parser": "7.15.7",
31
57
  "@babel/plugin-proposal-class-properties": "7.13.0",
32
58
  "@babel/plugin-proposal-class-static-block": "^7.14.5",
33
59
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
@@ -38,22 +64,31 @@
38
64
  "@babel/preset-flow": "7.13.13",
39
65
  "@babel/preset-react": "^7.12.13",
40
66
  "@babel/runtime": "7.14.0",
41
- "@material-ui/icons": "^4.11.2",
42
- "@radix-ui/react-radio-group": "^0.1.0",
43
- "@radix-ui/react-checkbox": "^0.0.16",
44
67
  "@storybook/addon-actions": "5.3.21",
45
68
  "@storybook/addon-links": "5.3.21",
46
69
  "@storybook/addons": "5.3.21",
70
+ "@storybook/node-logger": "^6.4.0",
47
71
  "@storybook/preset-create-react-app": "^3.2.0",
48
72
  "@storybook/react": "5.3.21",
49
- "@theme-ui/color-modes": "^0.10.0",
50
- "@theme-ui/components": "^0.10.0",
51
- "@theme-ui/core": "^0.10.0",
52
- "@theme-ui/mdx": "^0.10.0",
73
+ "@testing-library/dom": "^8.11.1",
74
+ "@testing-library/jest-dom": "^5.15.0",
75
+ "@testing-library/react": "^12.1.2",
76
+ "babel-jest": "^27.3.1",
53
77
  "cross-env": "^7.0.3",
78
+ "eslines": "2.1.0",
79
+ "eslint": "7.32.0",
80
+ "eslint-config-react-app": "6.0.0",
81
+ "eslint-config-wpvip": "automattic/eslint-config-wpvip#c6605d1c3a545d43ac2149cd464ec3c38ebc58d5",
82
+ "eslint-plugin-jest": "24.4.2",
83
+ "eslint-plugin-json": "3.1.0",
84
+ "eslint-plugin-jsx-a11y": "6.4.1",
85
+ "eslint-plugin-no-async-foreach": "0.1.1",
86
+ "eslint-plugin-react": "7.25.3",
87
+ "eslint-plugin-wpcalypso": "4.1.0",
88
+ "jest-axe": "5.0.1",
54
89
  "optimize-css-assets-webpack-plugin": "^6.0.1",
55
90
  "react-input-autosize": "^3.0.0",
56
- "react-scripts": "^4.0.3",
57
- "theme-ui": "^0.6.2"
91
+ "react-refresh": "^0.9.0",
92
+ "react-scripts": "^4.0.3"
58
93
  }
59
94
  }
@@ -27,6 +27,9 @@ const Avatar = ( {
27
27
  borderColor: isVIP ? 'primary' : 'transparent',
28
28
  overflow: 'hidden',
29
29
  backgroundColor: 'primary',
30
+ display: 'inline-flex',
31
+ alignItems: 'center',
32
+ justifyContent: 'center',
30
33
  color: 'white',
31
34
  padding: '1px',
32
35
  textAlign: 'center',
@@ -36,7 +39,7 @@ const Avatar = ( {
36
39
  { src ? (
37
40
  <Image
38
41
  src={ src }
39
- alt={ name }
42
+ alt={ `Avatar image from ${ name }` }
40
43
  sx={ {
41
44
  borderRadius: 9999,
42
45
  width: '100%',
@@ -48,6 +51,7 @@ const Avatar = ( {
48
51
  as="span"
49
52
  sx={ {
50
53
  color: 'white',
54
+ mb: 0,
51
55
  fontWeight: 'bold',
52
56
  fontSize: 0,
53
57
  textTransform: 'uppercase',
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
@@ -0,0 +1,31 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, screen } from '@testing-library/react';
5
+ import { axe } from 'jest-axe';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { Avatar } from './Avatar';
11
+
12
+ describe( '<Avatar />', () => {
13
+ it( 'renders the Avatar without an image', () => {
14
+ render( <Avatar name="John Doe" /> );
15
+
16
+ expect( screen.getByText( 'J' ) ).toBeInTheDocument();
17
+ } );
18
+
19
+ it( 'renders the Avatar with image', () => {
20
+ render( <Avatar name="John Doe" src="path/to/image" /> );
21
+
22
+ expect( screen.getByAltText( 'Avatar image from John Doe' ) ).toBeInTheDocument();
23
+ } );
24
+
25
+ it( 'should not have basic accessibility issues', async () => {
26
+ const { container } = render( <Avatar name="John Doe" src="path/to/image" /> );
27
+ const results = await axe( container );
28
+
29
+ expect( results ).toHaveNoViolations();
30
+ } );
31
+ } );
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
- import { Text } from '../';
11
+ import { Text } from '../';
12
12
 
13
13
  const Badge = ( { variant = 'blue', sx, ...props } ) => (
14
14
  <Text
@@ -16,8 +16,8 @@ const Badge = ( { variant = 'blue', sx, ...props } ) => (
16
16
  sx={ {
17
17
  fontSize: 0,
18
18
  padding: 0,
19
- bg: `${ variant }.10`,
20
- color: `${ variant }.90`,
19
+ bg: `${ variant }.20`,
20
+ color: `${ variant }.100`,
21
21
  py: 1,
22
22
  verticalAlign: 'middle',
23
23
  px: 2,
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
@@ -10,10 +10,10 @@ import PropTypes from 'prop-types';
10
10
  */
11
11
  import { Box, Heading, Text } from '..';
12
12
 
13
- const BlankState = ({ image, icon, title, body, cta }) => {
13
+ const BlankState = ( { image, icon, title, body, cta } ) => {
14
14
  return (
15
15
  <Box sx={{ textAlign: 'center', padding: 5 }}>
16
- {icon ? icon : <img src={image} sx={{ mb: 3 }} />}
16
+ {icon ? icon : <img src={image} sx={{ mb: 3 }} alt="Icon representing the blank state" />}
17
17
  <Heading variant="h4">{title}</Heading>
18
18
  <Text>{body}</Text>
19
19
  <Box sx={{ mt: 3 }}>{cta}</Box>
@@ -22,10 +22,10 @@ const BlankState = ({ image, icon, title, body, cta }) => {
22
22
  };
23
23
 
24
24
  BlankState.propTypes = {
25
- image: PropTypes.string,
25
+ image: PropTypes.oneOfType( [ PropTypes.object, PropTypes.string ] ),
26
26
  icon: PropTypes.node,
27
- title: PropTypes.string,
28
- body: PropTypes.string,
27
+ title: PropTypes.node,
28
+ body: PropTypes.node,
29
29
  cta: PropTypes.node,
30
30
  };
31
31
 
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
@@ -6,11 +6,15 @@
6
6
  import { Button as ThemeButton } from 'theme-ui';
7
7
  import PropTypes from 'prop-types';
8
8
 
9
- const Button = ({ sx, ...props }) => (
9
+ const Button = ( { sx, ...props } ) => (
10
10
  <ThemeButton
11
11
  sx={{
12
12
  verticalAlign: 'middle',
13
- display: 'inline-block',
13
+ display: 'inline-flex',
14
+ alignItems: 'center',
15
+ justifyContent: 'center',
16
+ height: '36px',
17
+ py: 0,
14
18
  '&:disabled': {
15
19
  opacity: 0.5,
16
20
  cursor: 'not-allowed',
@@ -11,22 +11,26 @@ import PropTypes from 'prop-types';
11
11
  */
12
12
  import { Box } from '..';
13
13
 
14
- const Card = React.forwardRef(({ variant = 'primary', sx = {}, ...props }, ref) => (
15
- <Box
16
- ref={ref}
17
- sx={{
18
- // pass variant prop to sx
19
- variant: `cards.${variant}`,
20
- overflow: 'hidden',
21
- ...sx,
22
- }}
23
- {...props}
24
- />
25
- ));
14
+ const Card = React.forwardRef( ( { variant = 'primary', sx = {}, ...props }, ref ) => {
15
+ return (
16
+ <Box
17
+ ref={ref}
18
+ sx={{
19
+ // pass variant prop to sx
20
+ variant: `cards.${ variant }`,
21
+ overflow: 'hidden',
22
+ ...sx,
23
+ }}
24
+ {...props}
25
+ />
26
+ );
27
+ } );
26
28
 
27
29
  Card.propTypes = {
28
30
  variant: PropTypes.string,
29
31
  sx: PropTypes.object,
30
32
  };
31
33
 
34
+ Card.displayName = 'Card';
35
+
32
36
  export { Card };
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
@@ -16,9 +16,9 @@ const Code = ( { prompt = false, showCopy = false, onCopy = null, ...props } ) =
16
16
  sx={ {
17
17
  fontSize: 1,
18
18
  display: 'block',
19
- bg: 'modes.dark.card',
20
- color: 'modes.dark.heading',
21
- borderRadius: 2,
19
+ bg: 'grey.90',
20
+ color: 'grey.10',
21
+ borderRadius: 1,
22
22
  py: 2,
23
23
  px: 3,
24
24
  verticalAlign: 'middle',
@@ -51,7 +51,7 @@ const Code = ( { prompt = false, showCopy = false, onCopy = null, ...props } ) =
51
51
  sx={ {
52
52
  position: 'absolute',
53
53
  top: 0,
54
- bg: 'modes.dark.heading',
54
+ bg: 'grey.10',
55
55
  right: 0,
56
56
  paddingRight: 2,
57
57
  paddingLeft: 2,