@automattic/vip-design-system 0.7.0 → 0.9.0

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 (121) 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 +6 -2
  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 +8 -5
  17. package/build/system/Code/Code.js +4 -4
  18. package/build/system/ConfirmationDialog/ConfirmationDialog.js +2 -2
  19. package/build/system/Dialog/Dialog.js +3 -0
  20. package/build/system/Dialog/DialogButton.js +2 -4
  21. package/build/system/Dialog/DialogContent.js +5 -5
  22. package/build/system/Form/Checkbox.js +52 -5
  23. package/build/system/Form/InlineSelect.js +32 -16
  24. package/build/system/Form/Input.js +9 -6
  25. package/build/system/Form/Label.js +2 -2
  26. package/build/system/Form/RadioBoxGroup.js +101 -0
  27. package/build/system/Form/SearchSelect.js +36 -56
  28. package/build/system/Form/Select.js +3 -3
  29. package/build/system/Form/Textarea.js +9 -6
  30. package/build/system/Form/Toggle.js +1 -1
  31. package/build/system/Form/ToggleGroup.js +78 -0
  32. package/build/system/Form/ToggleRow.js +6 -5
  33. package/build/system/Form/Validation.js +4 -4
  34. package/build/system/Form/index.js +8 -0
  35. package/build/system/Notice/Notice.js +58 -54
  36. package/build/system/Notification/Notification.js +4 -4
  37. package/build/system/OptionRow/OptionRow.js +12 -11
  38. package/build/system/ResourceList/ResourceItem.js +89 -0
  39. package/build/system/ResourceList/ResourceList.js +121 -0
  40. package/build/system/ResourceList/index.js +11 -0
  41. package/build/system/Table/TableRow.js +2 -2
  42. package/build/system/Tabs/TabItem.js +3 -3
  43. package/build/system/Tabs/Tabs.js +1 -1
  44. package/build/system/Time/index.js +91 -0
  45. package/build/system/Tooltip/Tooltip.js +49 -47
  46. package/build/system/Wizard/WizardStep.js +5 -5
  47. package/build/system/Wizard/WizardStepHorizontal.js +2 -2
  48. package/build/system/index.js +9 -2
  49. package/build/system/theme/colors.js +235 -131
  50. package/build/system/theme/index.js +140 -107
  51. package/package.json +48 -11
  52. package/src/system/Avatar/Avatar.js +6 -2
  53. package/src/system/Avatar/Avatar.stories.js +0 -5
  54. package/src/system/Avatar/Avatar.test.js +31 -0
  55. package/src/system/Badge/Badge.js +3 -3
  56. package/src/system/Badge/Badge.stories.js +0 -5
  57. package/src/system/BlankState/BlankState.js +5 -5
  58. package/src/system/BlankState/BlankState.stories.js +0 -5
  59. package/src/system/Box/Box.stories.js +0 -5
  60. package/src/system/Button/Button.js +6 -2
  61. package/src/system/Card/Card.js +6 -4
  62. package/src/system/Card/Card.stories.js +0 -5
  63. package/src/system/Code/Code.js +4 -4
  64. package/src/system/Code/Code.stories.js +4 -1
  65. package/src/system/ConfirmationDialog/ConfirmationDialog.js +2 -2
  66. package/src/system/ConfirmationDialog/ConfirmationDialog.stories.js +0 -5
  67. package/src/system/Dialog/Dialog.js +1 -1
  68. package/src/system/Dialog/Dialog.stories.js +0 -5
  69. package/src/system/Dialog/DialogButton.js +2 -3
  70. package/src/system/Dialog/DialogContent.js +17 -4
  71. package/src/system/Flex/Flex.stories.js +0 -5
  72. package/src/system/Form/Checkbox.js +44 -2
  73. package/src/system/Form/InlineSelect.js +30 -15
  74. package/src/system/Form/Input.js +6 -4
  75. package/src/system/Form/Input.stories.js +0 -5
  76. package/src/system/Form/Label.js +2 -2
  77. package/src/system/Form/RadioBoxGroup.js +68 -0
  78. package/src/system/Form/RadioBoxGroup.stories.js +37 -0
  79. package/src/system/Form/SearchSelect.js +35 -42
  80. package/src/system/Form/Select.js +18 -18
  81. package/src/system/Form/Select.stories.js +1 -1
  82. package/src/system/Form/Textarea.js +6 -4
  83. package/src/system/Form/Toggle.js +1 -1
  84. package/src/system/Form/ToggleGroup.js +63 -0
  85. package/src/system/Form/ToggleGroup.stories.js +34 -0
  86. package/src/system/Form/ToggleRow.js +5 -5
  87. package/src/system/Form/Validation.js +2 -2
  88. package/src/system/Form/index.js +3 -1
  89. package/src/system/Grid/Grid.stories.js +0 -5
  90. package/src/system/Heading/Heading.stories.js +0 -5
  91. package/src/system/Link/Link.stories.js +0 -5
  92. package/src/system/Notice/Notice.js +33 -28
  93. package/src/system/Notification/Notification.js +6 -6
  94. package/src/system/Notification/Notification.stories.js +0 -5
  95. package/src/system/OptionRow/OptionRow.js +37 -32
  96. package/src/system/OptionRow/OptionRow.stories.js +0 -5
  97. package/src/system/Progress/Progress.stories.js +0 -5
  98. package/src/system/ResourceList/ResourceItem.js +66 -0
  99. package/src/system/ResourceList/ResourceList.js +96 -0
  100. package/src/system/ResourceList/ResourceList.stories.js +300 -0
  101. package/src/system/ResourceList/index.js +7 -0
  102. package/src/system/Spinner/Spinner.stories.js +0 -5
  103. package/src/system/Table/Table.stories.js +0 -5
  104. package/src/system/Table/TableRow.js +3 -3
  105. package/src/system/Tabs/TabItem.js +3 -3
  106. package/src/system/Tabs/Tabs.js +1 -1
  107. package/src/system/Tabs/Tabs.stories.js +0 -5
  108. package/src/system/Text/Text.stories.js +0 -5
  109. package/src/system/{Timeline/Timeline.stories.js → Time/Time.stories.js} +5 -5
  110. package/src/system/Time/index.js +62 -0
  111. package/src/system/Tooltip/Tooltip.js +40 -35
  112. package/src/system/Tooltip/Tooltip.stories.js +0 -5
  113. package/src/system/Wizard/Wizard.js +7 -7
  114. package/src/system/Wizard/WizardStep.js +10 -10
  115. package/src/system/Wizard/WizardStepHorizontal.js +3 -3
  116. package/src/system/index.js +29 -4
  117. package/src/system/theme/colors.js +233 -129
  118. package/src/system/theme/index.js +298 -256
  119. package/test/setupAfterEnv.js +13 -0
  120. package/test/setupTests.js +4 -0
  121. 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,48 +154,54 @@ 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'
173
+ }
174
+ },
175
+ border: {
176
+ background: 'none',
177
+ border: '1px solid',
178
+ borderColor: 'border',
179
+ cursor: 'pointer',
180
+ display: 'inline-flex',
181
+ alignItems: 'center',
182
+ color: 'text',
183
+ '&:hover': {
184
+ bg: 'hover'
113
185
  }
114
186
  },
115
187
  danger: {
116
188
  // you can reference other values defined in the theme
117
189
  variant: 'buttons.primary',
118
- bg: _colors["default"].red['70'],
190
+ bg: 'red.70',
119
191
  '&:hover, &:focus': {
120
192
  backgroundColor: 'red.80'
121
193
  }
122
194
  },
123
195
  secondary: {
124
- color: 'inherit',
196
+ color: 'text',
125
197
  cursor: 'pointer',
126
198
  boxShadow: 'none',
199
+ fontWeight: 'heading',
127
200
  borderRadius: 1,
128
- backgroundColor: 'backgroundSecondary',
129
- svg: {
130
- position: 'relative',
131
- top: '0.125em'
132
- },
201
+ bg: 'grey.10',
133
202
  '&:hover, &:focus': {
134
- bg: 'brand.7'
203
+ color: 'grey.100',
204
+ bg: 'grey.20'
135
205
  }
136
206
  },
137
207
  text: {
@@ -152,9 +222,6 @@ var _default = {
152
222
  cursor: 'pointer',
153
223
  fontWeight: 'heading',
154
224
  padding: 1,
155
- svg: {
156
- display: 'block'
157
- },
158
225
  '&:hover, &:focus': {
159
226
  backgroundColor: 'border'
160
227
  }
@@ -180,53 +247,15 @@ var _default = {
180
247
  }
181
248
  }
182
249
  },
183
- text: {
184
- h1: {
185
- fontSize: 5,
186
- marginBottom: 3,
187
- letterSpacing: '-.02em',
188
- fontWeight: 'heading'
189
- },
190
- h2: {
191
- fontSize: 4,
192
- marginBottom: 2,
193
- letterSpacing: '-.005em',
194
- fontWeight: 400
195
- },
196
- h3: {
197
- fontSize: 3,
198
- marginBottom: 3,
199
- letterSpacing: '-.005em',
200
- lineHeight: 1.25,
201
- fontWeight: 'heading'
202
- },
203
- h4: {
204
- fontSize: 2,
205
- marginBottom: 1,
206
- lineHeight: 1.5,
207
- fontWeight: 'heading'
208
- },
209
- h5: {
210
- fontSize: 1,
211
- marginBottom: 1,
212
- lineHeight: 1.5,
213
- fontWeight: 'body'
214
- },
215
- caps: {
216
- fontSize: 1,
217
- marginBottom: 2,
218
- textTransform: 'uppercase',
219
- color: 'muted',
220
- fontWeight: 'bold',
221
- letterSpacing: '.05em'
222
- }
223
- },
250
+ text: textStyles,
224
251
  dialog: {
225
252
  modal: {
226
253
  position: 'fixed',
227
254
  top: '10vh',
228
255
  left: '50%',
229
- maxWidth: '90%'
256
+ maxWidth: '90%',
257
+ backgroundColor: 'background',
258
+ boxShadow: 'high'
230
259
  },
231
260
  sidebar: {
232
261
  position: 'fixed',
@@ -236,6 +265,7 @@ var _default = {
236
265
  overflow: 'auto',
237
266
  margin: 0,
238
267
  borderRadius: 0,
268
+ boxShadow: 'high',
239
269
  backgroundColor: 'background'
240
270
  },
241
271
  cover: {
@@ -251,20 +281,23 @@ var _default = {
251
281
  }
252
282
  },
253
283
  styles: {
254
- root: {
284
+ root: _extends({
255
285
  fontFamily: 'body',
256
286
  lineHeight: 'body',
257
287
  fontWeight: 'body',
258
- letterSpacing: '-.011em',
259
288
  fontSize: 2,
260
289
  color: 'text',
261
290
  backgroundColor: 'background',
262
- 'WebkitFontSmoothing': 'antialiased',
263
- 'MozOsxFontSmoothing': 'grayscale',
291
+ '-webkit-font-smoothing': 'antialiased',
292
+ '-moz-osx-font-smoothing': 'grayscale',
264
293
  svg: {
265
- fill: 'currentColor'
294
+ fill: 'currentColor',
295
+ display: 'block'
296
+ },
297
+ pre: {
298
+ fontFamily: 'body'
266
299
  }
267
- }
300
+ }, textStyles)
268
301
  }
269
302
  };
270
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.0",
3
+ "version": "0.9.0",
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,20 +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
67
  "@storybook/addon-actions": "5.3.21",
43
68
  "@storybook/addon-links": "5.3.21",
44
69
  "@storybook/addons": "5.3.21",
70
+ "@storybook/node-logger": "^6.4.0",
45
71
  "@storybook/preset-create-react-app": "^3.2.0",
46
72
  "@storybook/react": "5.3.21",
47
- "@theme-ui/color-modes": "^0.10.0",
48
- "@theme-ui/components": "^0.10.0",
49
- "@theme-ui/core": "^0.10.0",
50
- "@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",
51
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",
52
89
  "optimize-css-assets-webpack-plugin": "^6.0.1",
53
90
  "react-input-autosize": "^3.0.0",
54
- "react-scripts": "^4.0.3",
55
- "theme-ui": "^0.6.2"
91
+ "react-refresh": "^0.9.0",
92
+ "react-scripts": "^4.0.3"
56
93
  }
57
94
  }
@@ -26,7 +26,10 @@ const Avatar = ( {
26
26
  border: '2px solid',
27
27
  borderColor: isVIP ? 'primary' : 'transparent',
28
28
  overflow: 'hidden',
29
- backgroundColor: 'white',
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,24 @@ import PropTypes from 'prop-types';
11
11
  */
12
12
  import { Box } from '..';
13
13
 
14
- const Card = React.forwardRef(({ variant = 'primary', sx = {}, ...props }, ref) => (
14
+ const CardComponent = ( { variant = 'primary', sx = {}, ...props }, ref ) => (
15
15
  <Box
16
16
  ref={ref}
17
17
  sx={{
18
18
  // pass variant prop to sx
19
- variant: `cards.${variant}`,
19
+ variant: `cards.${ variant }`,
20
20
  overflow: 'hidden',
21
21
  ...sx,
22
22
  }}
23
23
  {...props}
24
24
  />
25
- ));
25
+ );
26
26
 
27
- Card.propTypes = {
27
+ CardComponent.propTypes = {
28
28
  variant: PropTypes.string,
29
29
  sx: PropTypes.object,
30
30
  };
31
31
 
32
+ const Card = React.forwardRef( CardComponent );
33
+
32
34
  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,