@automattic/vip-design-system 0.9.6 → 0.10.2

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 (161) hide show
  1. package/.eslintrc.json +2 -5
  2. package/.storybook/decorators/withBoundingBox.jsx +15 -0
  3. package/.storybook/decorators/withColorMode.jsx +45 -0
  4. package/.storybook/decorators/withThemeProvider.jsx +18 -0
  5. package/.storybook/main.js +7 -8
  6. package/.storybook/preview.js +13 -32
  7. package/README.md +4 -4
  8. package/babel.config.js +2 -3
  9. package/build/system/Avatar/Avatar.js +17 -12
  10. package/build/system/Avatar/Avatar.stories.js +1 -9
  11. package/build/system/Avatar/Avatar.test.js +16 -7
  12. package/build/system/Badge/Badge.js +18 -13
  13. package/build/system/Badge/Badge.stories.js +1 -9
  14. package/build/system/Badge/Badge.test.js +16 -7
  15. package/build/system/BlankState/BlankState.js +10 -4
  16. package/build/system/BlankState/BlankState.stories.js +1 -9
  17. package/build/system/BlankState/BlankState.test.js +26 -17
  18. package/build/system/Box/Box.js +19 -4
  19. package/build/system/Box/Box.stories.js +1 -9
  20. package/build/system/Button/Button.js +15 -12
  21. package/build/system/Button/Button.stories.js +3 -3
  22. package/build/system/Button/Button.test.js +14 -5
  23. package/build/system/Card/Card.js +17 -13
  24. package/build/system/Card/Card.stories.js +1 -9
  25. package/build/system/Card/Card.test.js +19 -10
  26. package/build/system/Code/Code.js +16 -12
  27. package/build/system/Code/Code.stories.js +17 -5
  28. package/build/system/Code/Code.test.js +29 -20
  29. package/build/system/ConfirmationDialog/ConfirmationDialog.js +16 -10
  30. package/build/system/ConfirmationDialog/ConfirmationDialog.stories.js +1 -9
  31. package/build/system/Dialog/Dialog.js +9 -8
  32. package/build/system/Dialog/Dialog.stories.js +1 -9
  33. package/build/system/Dialog/DialogButton.js +8 -9
  34. package/build/system/Dialog/DialogContent.js +11 -12
  35. package/build/system/Dialog/DialogDivider.js +5 -3
  36. package/build/system/Dialog/DialogMenu.js +5 -3
  37. package/build/system/Dialog/DialogMenuItem.js +8 -9
  38. package/build/system/Dialog/DialogTrigger.js +9 -2
  39. package/build/system/Flex/Flex.js +9 -2
  40. package/build/system/Flex/Flex.stories.js +1 -9
  41. package/build/system/Form/AsyncSearchSelect.js +8 -10
  42. package/build/system/Form/Checkbox.js +10 -11
  43. package/build/system/Form/InlineSelect.js +12 -14
  44. package/build/system/Form/Input.js +8 -9
  45. package/build/system/Form/Input.stories.js +2 -8
  46. package/build/system/Form/Label.js +9 -2
  47. package/build/system/Form/Radio.js +8 -9
  48. package/build/system/Form/RadioBoxGroup.js +8 -9
  49. package/build/system/Form/RadioBoxGroup.stories.js +53 -0
  50. package/build/system/Form/SearchSelect.js +15 -18
  51. package/build/system/Form/Select.js +10 -10
  52. package/build/system/Form/Select.stories.js +96 -10
  53. package/build/system/Form/Select.test.js +14 -5
  54. package/build/system/Form/Textarea.js +8 -9
  55. package/build/system/Form/Toggle.js +18 -13
  56. package/build/system/Form/ToggleGroup.js +8 -9
  57. package/build/system/Form/ToggleGroup.stories.js +50 -0
  58. package/build/system/Form/ToggleRow.js +9 -10
  59. package/build/system/Form/Validation.js +8 -9
  60. package/build/system/Grid/Grid.js +9 -2
  61. package/build/system/Grid/Grid.stories.js +1 -9
  62. package/build/system/Heading/Heading.js +18 -13
  63. package/build/system/Heading/Heading.stories.js +1 -9
  64. package/build/system/Link/Link.js +9 -10
  65. package/build/system/Link/Link.stories.js +1 -9
  66. package/build/system/Notice/Notice.js +18 -13
  67. package/build/system/Notice/Notice.stories.js +20 -3
  68. package/build/system/Notification/Notification.js +3 -2
  69. package/build/system/Notification/Notification.stories.js +1 -9
  70. package/build/system/OptionRow/OptionRow.js +26 -16
  71. package/build/system/OptionRow/OptionRow.stories.js +12 -12
  72. package/build/system/OptionRow/OptionRow.test.js +93 -0
  73. package/build/system/Progress/Progress.js +17 -12
  74. package/build/system/Progress/Progress.stories.js +1 -9
  75. package/build/system/ResourceList/ResourceItem.js +2 -2
  76. package/build/system/ResourceList/ResourceList.js +14 -4
  77. package/build/system/ResourceList/ResourceList.stories.js +377 -0
  78. package/build/system/Spinner/Spinner.js +17 -12
  79. package/build/system/Spinner/Spinner.stories.js +1 -9
  80. package/build/system/Table/Table.js +10 -13
  81. package/build/system/Table/Table.stories.js +1 -9
  82. package/build/system/Table/TableRow.js +2 -2
  83. package/build/system/Tabs/TabItem.js +10 -10
  84. package/build/system/Tabs/Tabs.js +19 -14
  85. package/build/system/Tabs/Tabs.stories.js +1 -9
  86. package/build/system/Text/Text.js +18 -13
  87. package/build/system/Text/Text.stories.js +1 -9
  88. package/build/system/Time/Time.stories.js +52 -0
  89. package/build/system/Time/index.js +17 -13
  90. package/build/system/Timeline/Timeline.js +17 -11
  91. package/build/system/Timeline/Timeline.stories.js +16 -22
  92. package/build/system/Tooltip/Tooltip.js +10 -11
  93. package/build/system/Tooltip/Tooltip.stories.js +1 -9
  94. package/build/system/UsageChart/UsageChart.stories.js +20 -0
  95. package/build/system/Wizard/Wizard.js +18 -11
  96. package/build/system/Wizard/Wizard.stories.js +5 -4
  97. package/build/system/Wizard/WizardStep.js +8 -4
  98. package/build/system/Wizard/WizardStepHorizontal.js +8 -4
  99. package/build/system/index.js +3 -3
  100. package/build/system/theme/colors.js +1 -1
  101. package/build/system/theme/index.js +10 -5
  102. package/package.json +25 -13
  103. package/src/system/Avatar/Avatar.js +4 -0
  104. package/src/system/Avatar/{Avatar.stories.js → Avatar.stories.jsx} +0 -0
  105. package/src/system/Badge/Badge.js +4 -1
  106. package/src/system/Badge/{Badge.stories.js → Badge.stories.jsx} +0 -0
  107. package/src/system/BlankState/BlankState.js +4 -1
  108. package/src/system/BlankState/{BlankState.stories.js → BlankState.stories.jsx} +0 -0
  109. package/src/system/BlankState/BlankState.test.js +23 -22
  110. package/src/system/Box/Box.js +6 -1
  111. package/src/system/Box/{Box.stories.js → Box.stories.jsx} +0 -0
  112. package/src/system/Button/Button.js +3 -0
  113. package/src/system/Button/{Button.stories.js → Button.stories.jsx} +0 -0
  114. package/src/system/Card/Card.js +4 -1
  115. package/src/system/Card/{Card.stories.js → Card.stories.jsx} +0 -0
  116. package/src/system/Code/Code.js +4 -1
  117. package/src/system/Code/{Code.stories.js → Code.stories.jsx} +0 -0
  118. package/src/system/ConfirmationDialog/ConfirmationDialog.js +4 -2
  119. package/src/system/ConfirmationDialog/{ConfirmationDialog.stories.js → ConfirmationDialog.stories.jsx} +0 -0
  120. package/src/system/Dialog/Dialog.js +1 -1
  121. package/src/system/Dialog/{Dialog.stories.js → Dialog.stories.jsx} +0 -0
  122. package/src/system/Flex/{Flex.stories.js → Flex.stories.jsx} +0 -0
  123. package/src/system/Form/{Input.stories.js → Input.stories.jsx} +0 -0
  124. package/src/system/Form/{RadioBoxGroup.stories.js → RadioBoxGroup.stories.jsx} +0 -0
  125. package/src/system/Form/Select.js +1 -1
  126. package/src/system/Form/{Select.stories.js → Select.stories.jsx} +0 -0
  127. package/src/system/Form/Toggle.js +4 -2
  128. package/src/system/Form/{ToggleGroup.stories.js → ToggleGroup.stories.jsx} +0 -0
  129. package/src/system/Grid/{Grid.stories.js → Grid.stories.jsx} +0 -0
  130. package/src/system/Heading/Heading.js +4 -1
  131. package/src/system/Heading/{Heading.stories.js → Heading.stories.jsx} +0 -0
  132. package/src/system/Link/{Link.stories.js → Link.stories.jsx} +0 -0
  133. package/src/system/Notice/Notice.js +4 -1
  134. package/src/system/Notice/{Notice.stories.js → Notice.stories.jsx} +0 -0
  135. package/src/system/Notification/Notification.js +1 -0
  136. package/src/system/Notification/{Notification.stories.js → Notification.stories.jsx} +0 -0
  137. package/src/system/OptionRow/OptionRow.js +11 -2
  138. package/src/system/OptionRow/{OptionRow.stories.js → OptionRow.stories.jsx} +9 -0
  139. package/src/system/OptionRow/OptionRow.test.js +49 -0
  140. package/src/system/Progress/Progress.js +4 -1
  141. package/src/system/Progress/{Progress.stories.js → Progress.stories.jsx} +0 -0
  142. package/src/system/ResourceList/ResourceList.js +1 -1
  143. package/src/system/ResourceList/{ResourceList.stories.js → ResourceList.stories.jsx} +0 -0
  144. package/src/system/Spinner/Spinner.js +4 -1
  145. package/src/system/Spinner/{Spinner.stories.js → Spinner.stories.jsx} +0 -0
  146. package/src/system/Table/Table.js +1 -1
  147. package/src/system/Table/{Table.stories.js → Table.stories.jsx} +0 -0
  148. package/src/system/Tabs/TabItem.js +1 -0
  149. package/src/system/Tabs/Tabs.js +5 -2
  150. package/src/system/Tabs/{Tabs.stories.js → Tabs.stories.jsx} +0 -0
  151. package/src/system/Text/Text.js +4 -1
  152. package/src/system/Text/{Text.stories.js → Text.stories.jsx} +0 -0
  153. package/src/system/Time/{Time.stories.js → Time.stories.jsx} +0 -0
  154. package/src/system/Time/index.js +4 -1
  155. package/src/system/Timeline/Timeline.js +4 -2
  156. package/src/system/Timeline/{Timeline.stories.js → Timeline.stories.jsx} +0 -0
  157. package/src/system/Tooltip/{Tooltip.stories.js → Tooltip.stories.jsx} +0 -0
  158. package/src/system/Wizard/Wizard.js +6 -2
  159. package/src/system/Wizard/{Wizard.stories.js → Wizard.stories.jsx} +1 -1
  160. package/src/system/Wizard/WizardStep.js +5 -2
  161. package/src/system/Wizard/WizardStepHorizontal.js +4 -1
@@ -1,25 +1,27 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  exports.__esModule = true;
4
6
  exports.Wizard = void 0;
5
7
 
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+
10
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
+
6
12
  var _react = _interopRequireDefault(require("react"));
7
13
 
8
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
15
 
16
+ var _classnames = _interopRequireDefault(require("classnames"));
17
+
10
18
  var _md = require("react-icons/md");
11
19
 
12
20
  var _ = require("..");
13
21
 
14
22
  var _jsxRuntime = require("theme-ui/jsx-runtime");
15
23
 
16
- var _excluded = ["steps", "activeStep", "variant", "completed"];
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
-
20
- 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); }
21
-
22
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
24
+ var _excluded = ["steps", "activeStep", "variant", "completed", "className"];
23
25
 
24
26
  var Wizard = function Wizard(_ref) {
25
27
  var steps = _ref.steps,
@@ -27,11 +29,13 @@ var Wizard = function Wizard(_ref) {
27
29
  variant = _ref.variant,
28
30
  _ref$completed = _ref.completed,
29
31
  completed = _ref$completed === void 0 ? [] : _ref$completed,
30
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
31
-
32
+ _ref$className = _ref.className,
33
+ className = _ref$className === void 0 ? null : _ref$className,
34
+ props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
32
35
  return (0, _jsxRuntime.jsx)(_.Box, {
36
+ className: (0, _classnames["default"])('vip-wizard-component', className),
33
37
  children: variant === 'horizontal' ? (0, _jsxRuntime.jsxs)(_.Box, {
34
- children: [(0, _jsxRuntime.jsx)(_.Flex, _extends({
38
+ children: [(0, _jsxRuntime.jsx)(_.Flex, (0, _extends2["default"])({
35
39
  sx: {
36
40
  flex: '0 0 auto'
37
41
  }
@@ -41,6 +45,7 @@ var Wizard = function Wizard(_ref) {
41
45
  subTitle = _ref2.subTitle;
42
46
  return (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
43
47
  children: [(0, _jsxRuntime.jsx)(_.WizardStepHorizontal, {
48
+ order: index + 1,
44
49
  active: index === activeStep,
45
50
  title: title,
46
51
  subTitle: subTitle
@@ -62,6 +67,7 @@ var Wizard = function Wizard(_ref) {
62
67
  title: title,
63
68
  subTitle: subTitle,
64
69
  complete: completed.includes(index),
70
+ order: index + 1,
65
71
  children: children
66
72
  }, index);
67
73
  })
@@ -73,5 +79,6 @@ Wizard.propTypes = {
73
79
  steps: _propTypes["default"].array,
74
80
  activeStep: _propTypes["default"].number,
75
81
  variant: _propTypes["default"].string,
76
- completed: _propTypes["default"].array
82
+ completed: _propTypes["default"].array,
83
+ className: _propTypes["default"].any
77
84
  };
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  exports.__esModule = true;
4
- exports.Default = exports["default"] = void 0;
6
+ exports["default"] = exports.Default = void 0;
5
7
 
6
8
  var _react = _interopRequireDefault(require("react"));
7
9
 
@@ -9,8 +11,6 @@ var _ = require("..");
9
11
 
10
12
  var _jsxRuntime = require("theme-ui/jsx-runtime");
11
13
 
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
14
  /**
15
15
  * External dependencies
16
16
  */
@@ -74,7 +74,8 @@ var Default = function Default() {
74
74
  mt: 4,
75
75
  children: (0, _jsxRuntime.jsx)(_.Wizard, {
76
76
  activeStep: 0,
77
- steps: steps
77
+ steps: steps,
78
+ className: "vip-wizard-xyz"
78
79
  })
79
80
  })]
80
81
  });
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  exports.__esModule = true;
4
6
  exports.WizardStep = void 0;
5
7
 
@@ -11,8 +13,6 @@ var _ = require("..");
11
13
 
12
14
  var _jsxRuntime = require("theme-ui/jsx-runtime");
13
15
 
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
16
  /** @jsxImportSource theme-ui */
17
17
 
18
18
  /**
@@ -28,7 +28,8 @@ var WizardStep = function WizardStep(_ref) {
28
28
  _ref$complete = _ref.complete,
29
29
  complete = _ref$complete === void 0 ? false : _ref$complete,
30
30
  children = _ref.children,
31
- active = _ref.active;
31
+ active = _ref.active,
32
+ order = _ref.order;
32
33
  var borderLeftColor = 'border';
33
34
 
34
35
  if (complete) {
@@ -60,6 +61,8 @@ var WizardStep = function WizardStep(_ref) {
60
61
  borderColor: active ? 'primary' : 'border',
61
62
  borderLeftColor: borderLeftColor
62
63
  },
64
+ "data-step": order,
65
+ "data-active": active || undefined,
63
66
  children: [(0, _jsxRuntime.jsxs)(_.Heading, {
64
67
  variant: "h4",
65
68
  sx: {
@@ -88,5 +91,6 @@ WizardStep.propTypes = {
88
91
  subTitle: _propTypes["default"].node,
89
92
  complete: _propTypes["default"].bool,
90
93
  active: _propTypes["default"].bool,
91
- children: _propTypes["default"].node.isRequired
94
+ children: _propTypes["default"].node,
95
+ order: _propTypes["default"].number.isRequired
92
96
  };
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  exports.__esModule = true;
4
6
  exports.WizardStepHorizontal = void 0;
5
7
 
@@ -11,8 +13,6 @@ var _ = require("..");
11
13
 
12
14
  var _jsxRuntime = require("theme-ui/jsx-runtime");
13
15
 
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
16
  /** @jsxImportSource theme-ui */
17
17
 
18
18
  /**
@@ -24,7 +24,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
24
24
  */
25
25
  var WizardStepHorizontal = function WizardStepHorizontal(_ref) {
26
26
  var title = _ref.title,
27
- active = _ref.active;
27
+ active = _ref.active,
28
+ order = _ref.order;
28
29
  return (0, _jsxRuntime.jsxs)(_.Heading, {
29
30
  variant: "h4",
30
31
  sx: {
@@ -33,6 +34,8 @@ var WizardStepHorizontal = function WizardStepHorizontal(_ref) {
33
34
  alignItems: 'center',
34
35
  color: active ? 'heading' : 'muted'
35
36
  },
37
+ "data-step": order,
38
+ "data-active": active || undefined,
36
39
  children: [(0, _jsxRuntime.jsx)(_md.MdCheckCircle, {
37
40
  sx: {
38
41
  mr: 2
@@ -45,5 +48,6 @@ exports.WizardStepHorizontal = WizardStepHorizontal;
45
48
  WizardStepHorizontal.propTypes = {
46
49
  title: _propTypes["default"].node,
47
50
  subTitle: _propTypes["default"].node,
48
- active: _propTypes["default"].bool
51
+ active: _propTypes["default"].bool,
52
+ order: _propTypes["default"].number.isRequired
49
53
  };
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  exports.__esModule = true;
4
6
 
5
7
  var _Avatar = require("./Avatar");
@@ -133,6 +135,4 @@ var _Wizard = require("./Wizard");
133
135
 
134
136
  exports.Wizard = _Wizard.Wizard;
135
137
  exports.WizardStep = _Wizard.WizardStep;
136
- exports.WizardStepHorizontal = _Wizard.WizardStepHorizontal;
137
-
138
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
138
+ exports.WizardStepHorizontal = _Wizard.WizardStepHorizontal;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports["default"] = exports.dark = exports.light = void 0;
4
+ exports.light = exports["default"] = exports.dark = void 0;
5
5
 
6
6
  /** @jsxImportSource theme-ui */
7
7
 
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  exports.__esModule = true;
4
6
  exports["default"] = void 0;
5
7
 
6
- var _colors = require("./colors");
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
7
9
 
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); }
10
+ var _colors = require("./colors");
9
11
 
12
+ /**
13
+ * Internal dependencies
14
+ */
10
15
  var textStyles = {
11
16
  h1: {
12
17
  fontSize: 5,
@@ -80,7 +85,7 @@ var _default = {
80
85
  useColorSchemeMediaQuery: false
81
86
  },
82
87
  initialColorModeName: 'light',
83
- colors: _extends({
88
+ colors: (0, _extends2["default"])({
84
89
  text: _colors.light.grey['90'],
85
90
  heading: _colors.light.grey['100'],
86
91
  background: '#fdfdfd',
@@ -105,7 +110,7 @@ var _default = {
105
110
  backgroundMuted: _colors.light.grey['5']
106
111
  }, _colors.light, {
107
112
  modes: {
108
- dark: _extends({
113
+ dark: (0, _extends2["default"])({
109
114
  text: _colors.dark.grey['90'],
110
115
  heading: _colors.dark.grey['100'],
111
116
  background: _colors.dark.grey['5'],
@@ -281,7 +286,7 @@ var _default = {
281
286
  }
282
287
  },
283
288
  styles: {
284
- root: _extends({
289
+ root: (0, _extends2["default"])({
285
290
  fontFamily: 'body',
286
291
  lineHeight: 'body',
287
292
  fontWeight: 'body',
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@automattic/vip-design-system",
3
- "version": "0.9.6",
3
+ "version": "0.10.2",
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
8
  "format": "eslint . --fix",
9
- "jest": "NODE_ENV=test jest --detectOpenHandles",
9
+ "jest": "NODE_ENV=test jest --detectOpenHandles --env=jsdom",
10
10
  "jest:coverage": "npm run jest && open-cli ./coverage/index.html",
11
11
  "jest:watch": "npm run jest --watch",
12
12
  "lint": "eslint . -f json | eslines --quiet",
13
13
  "storybook": "start-storybook -p 6006",
14
+ "dev": "npm run storybook",
14
15
  "test": "npm run lint && npm run jest",
15
16
  "watch": "npm run build -- --watch"
16
17
  },
@@ -19,6 +20,7 @@
19
20
  "@radix-ui/react-radio-group": "^0.1.0",
20
21
  "@radix-ui/react-tooltip": "^0.1.0",
21
22
  "babel-loader": "^8.2.2",
23
+ "classnames": "^2.3.1",
22
24
  "framer-motion": "^3.9.1",
23
25
  "react-icons": "^4.2.0",
24
26
  "react-select": "^4.3.1",
@@ -41,7 +43,9 @@
41
43
  "json",
42
44
  "html"
43
45
  ],
44
- "testURL": "http://localhost",
46
+ "testEnvironmentOptions": {
47
+ "url": "http://localhost"
48
+ },
45
49
  "roots": [
46
50
  "<rootDir>/src",
47
51
  "<rootDir>/test"
@@ -53,14 +57,14 @@
53
57
  "<rootDir>/test/setupAfterEnv.js"
54
58
  ],
55
59
  "transformIgnorePatterns": [
56
- ".*.stories.js$"
60
+ "\\.stories.jsx$"
57
61
  ],
58
62
  "transform": {
59
63
  "\\.[jt]sx?$": "babel-jest"
60
64
  }
61
65
  },
62
66
  "devDependencies": {
63
- "@axe-core/react": "4.3.2",
67
+ "@axe-core/react": "4.4.3",
64
68
  "@babel/cli": "^7.14.3",
65
69
  "@babel/core": "7.14.0",
66
70
  "@babel/eslint-parser": "7.15.7",
@@ -70,16 +74,17 @@
70
74
  "@babel/plugin-syntax-class-static-block": "^7.14.5",
71
75
  "@babel/plugin-syntax-private-property-in-object": "^7.14.5",
72
76
  "@babel/plugin-transform-react-display-name": "^7.15.1",
77
+ "@babel/plugin-transform-runtime": "^7.18.5",
73
78
  "@babel/preset-env": "^7.14.1",
74
79
  "@babel/preset-flow": "7.13.13",
75
80
  "@babel/preset-react": "^7.12.13",
76
81
  "@babel/runtime": "7.14.0",
77
- "@storybook/addon-actions": "5.3.21",
78
- "@storybook/addon-links": "5.3.21",
79
- "@storybook/addons": "5.3.21",
80
- "@storybook/node-logger": "^6.4.0",
81
- "@storybook/preset-create-react-app": "^3.2.0",
82
- "@storybook/react": "5.3.21",
82
+ "@mdx-js/react": "^2.1.1",
83
+ "@storybook/addon-a11y": "^6.5.9",
84
+ "@storybook/addon-actions": "^6.5.9",
85
+ "@storybook/addon-essentials": "^6.5.9",
86
+ "@storybook/addon-links": "^6.5.9",
87
+ "@storybook/react": "^6.5.9",
83
88
  "@testing-library/dom": "^8.11.1",
84
89
  "@testing-library/jest-dom": "^5.15.0",
85
90
  "@testing-library/react": "^12.1.2",
@@ -94,13 +99,20 @@
94
99
  "eslint-plugin-jsx-a11y": "6.4.1",
95
100
  "eslint-plugin-no-async-foreach": "0.1.1",
96
101
  "eslint-plugin-react": "7.25.3",
102
+ "eslint-plugin-storybook": "^0.5.12",
97
103
  "eslint-plugin-wpcalypso": "4.1.0",
98
104
  "immer": ">=9.0.6",
99
- "jest-axe": "5.0.1",
105
+ "jest": "^28.1.1",
106
+ "jest-axe": "6.0.0",
107
+ "jest-environment-jsdom": "^28.1.1",
108
+ "jsdom": "19.0.0",
109
+ "jsdom-global": "3.0.2",
100
110
  "open-cli": "^7.0.1",
101
111
  "optimize-css-assets-webpack-plugin": "^6.0.1",
112
+ "react": "^17.0.2",
113
+ "react-dom": "^17.0.2",
102
114
  "react-input-autosize": "^3.0.0",
103
115
  "react-refresh": "^0.9.0",
104
- "react-scripts": "^4.0.3"
116
+ "theme-ui": "0.10.0"
105
117
  }
106
118
  }
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import PropTypes from 'prop-types';
7
7
  import { Image } from 'theme-ui';
8
+ import classNames from 'classnames';
8
9
 
9
10
  /**
10
11
  * Internal dependencies
@@ -16,6 +17,7 @@ const Avatar = ( {
16
17
  name = null,
17
18
  size = 32,
18
19
  src = null,
20
+ className = null,
19
21
  ...props
20
22
  } ) => (
21
23
  <Box
@@ -34,6 +36,7 @@ const Avatar = ( {
34
36
  padding: '1px',
35
37
  textAlign: 'center',
36
38
  } }
39
+ className={ classNames( 'vip-avatar-component', className ) }
37
40
  { ...props }
38
41
  >
39
42
  { src ? (
@@ -68,6 +71,7 @@ Avatar.propTypes = {
68
71
  size: PropTypes.number,
69
72
  src: PropTypes.string,
70
73
  name: PropTypes.string,
74
+ className: PropTypes.any,
71
75
  };
72
76
 
73
77
  export { Avatar };
@@ -3,6 +3,7 @@
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
+ import classNames from 'classnames';
6
7
  import PropTypes from 'prop-types';
7
8
 
8
9
  /**
@@ -10,7 +11,7 @@ import PropTypes from 'prop-types';
10
11
  */
11
12
  import { Text } from '../';
12
13
 
13
- const Badge = ( { variant = 'blue', sx, ...props } ) => (
14
+ const Badge = ( { variant = 'blue', sx, className = null, ...props } ) => (
14
15
  <Text
15
16
  as="span"
16
17
  sx={ {
@@ -26,6 +27,7 @@ const Badge = ( { variant = 'blue', sx, ...props } ) => (
26
27
  fontWeight: 'heading',
27
28
  ...sx,
28
29
  } }
30
+ className={ classNames( 'vip-badge-component', className ) }
29
31
  { ...props }
30
32
  />
31
33
  );
@@ -33,6 +35,7 @@ const Badge = ( { variant = 'blue', sx, ...props } ) => (
33
35
  Badge.propTypes = {
34
36
  variant: PropTypes.string,
35
37
  sx: PropTypes.object,
38
+ className: PropTypes.any,
36
39
  };
37
40
 
38
41
  export { Badge };
@@ -3,6 +3,7 @@
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
+ import classNames from 'classnames';
6
7
  import PropTypes from 'prop-types';
7
8
 
8
9
  /**
@@ -17,9 +18,10 @@ const BlankState = ( {
17
18
  image,
18
19
  imageAlt = 'Image representing the blank state',
19
20
  title,
21
+ className = null,
20
22
  } ) => {
21
23
  return (
22
- <Box sx={{ textAlign: 'center', padding: 5 }}>
24
+ <Box sx={{ textAlign: 'center', padding: 5 }} className={ classNames( 'vip-blank-state-component', className ) }>
23
25
  {icon ? icon : <img src={image} sx={{ mb: 3 }} alt={imageAlt} />}
24
26
  <Heading variant="h4">{title}</Heading>
25
27
  <Text>{body}</Text>
@@ -35,6 +37,7 @@ BlankState.propTypes = {
35
37
  image: PropTypes.oneOfType( [ PropTypes.object, PropTypes.string ] ),
36
38
  imageAlt: PropTypes.string,
37
39
  title: PropTypes.node,
40
+ className: PropTypes.any,
38
41
  };
39
42
 
40
43
  export { BlankState };
@@ -12,47 +12,48 @@ import { BlankState } from './BlankState';
12
12
  import { Link } from '../Link';
13
13
 
14
14
  // eslint-disable-next-line max-len
15
- const image = "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";
15
+ const image =
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";
16
17
 
17
18
  const defaultProps = {
18
- body: 'Sorry, there\'s nothing here yet.',
19
+ body: "Sorry, there's nothing here yet.",
19
20
  cta: <Link as="a">Explore add-ons →</Link>,
20
21
  image,
21
22
  imageAlt: 'This is the image alt',
22
23
  title: 'Power up your application',
23
24
  };
24
25
 
25
- describe( '<BlankState />', () => {
26
- it( 'renders the BlankState component', async () => {
27
- const { container } = render( <BlankState { ...defaultProps } /> );
26
+ describe('<BlankState />', () => {
27
+ it('renders the BlankState component', async () => {
28
+ const { container } = render(<BlankState {...defaultProps} />);
28
29
 
29
- expect( screen.getByText( defaultProps.body ) ).toBeInTheDocument();
30
- expect( screen.getByText( defaultProps.title ) ).toBeInTheDocument();
31
- expect( screen.getByText( 'Explore add-ons →' ) ).toBeInTheDocument();
32
- expect( screen.getByAltText( defaultProps.imageAlt ) ).toBeInTheDocument();
30
+ expect(screen.getByText(defaultProps.body)).toBeInTheDocument();
31
+ expect(screen.getByText(defaultProps.title)).toBeInTheDocument();
32
+ expect(screen.getByText('Explore add-ons →')).toBeInTheDocument();
33
+ expect(screen.getByAltText(defaultProps.imageAlt)).toBeInTheDocument();
33
34
 
34
35
  // Check for accessibility issues
35
- await expect( await axe( container ) ).toHaveNoViolations();
36
- } );
36
+ await expect(await axe(container)).toHaveNoViolations();
37
+ });
37
38
 
38
- it( 'renders the BlankState component with default alt text for the given image', async () => {
39
+ it('renders the BlankState component with default alt text for the given image', async () => {
39
40
  const props = { ...defaultProps, imageAlt: undefined };
40
- const { container } = render( <BlankState { ...props } /> );
41
+ const { container } = render(<BlankState {...props} />);
41
42
 
42
- expect( screen.getByAltText( 'Image representing the blank state' ) ).toBeInTheDocument();
43
+ expect(screen.getByAltText('Image representing the blank state')).toBeInTheDocument();
43
44
 
44
45
  // Check for accessibility issues
45
- await expect( await axe( container ) ).toHaveNoViolations();
46
- } );
46
+ await expect(await axe(container)).toHaveNoViolations();
47
+ });
47
48
 
48
- it( 'renders the BlankState component with an icon', async () => {
49
+ it('renders the BlankState component with an icon', async () => {
49
50
  const icon = <MdContentCopy title="this is an icon" />;
50
51
  const props = { ...defaultProps, icon };
51
- const { container } = render( <BlankState { ...props } /> );
52
+ const { container } = render(<BlankState {...props} />);
52
53
 
53
- expect( screen.getByTitle( 'this is an icon' ) ).toBeInTheDocument();
54
+ expect(screen.getByTitle('this is an icon')).toBeInTheDocument();
54
55
 
55
56
  // Check for accessibility issues
56
- await expect( await axe( container ) ).toHaveNoViolations();
57
- } );
58
- } );
57
+ await expect(await axe(container)).toHaveNoViolations();
58
+ });
59
+ });
@@ -3,11 +3,16 @@
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
+ import PropTypes from 'prop-types';
7
+ import classNames from 'classnames';
6
8
  import { forwardRef } from 'react';
7
9
  import { Box as ThemeBox } from 'theme-ui';
8
10
 
9
- const Box = forwardRef( ( props, ref ) => <ThemeBox ref={ref} {...props} /> );
11
+ const Box = forwardRef( ( props, ref ) => <ThemeBox ref={ref} className={ classNames( 'vip-box-component', props.className ) } {...props} /> );
10
12
 
11
13
  Box.displayName = 'Box';
14
+ Box.propTypes = {
15
+ className: PropTypes.any,
16
+ };
12
17
 
13
18
  export { Box };
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { Button as ThemeButton } from 'theme-ui';
7
7
  import PropTypes from 'prop-types';
8
+ import classNames from 'classnames';
8
9
 
9
10
  const Button = ( { sx, ...props } ) => (
10
11
  <ThemeButton
@@ -22,12 +23,14 @@ const Button = ( { sx, ...props } ) => (
22
23
  },
23
24
  ...sx,
24
25
  }}
26
+ className={ classNames( 'vip-button-component', props.className ) }
25
27
  {...props}
26
28
  />
27
29
  );
28
30
 
29
31
  Button.propTypes = {
30
32
  sx: PropTypes.object,
33
+ className: PropTypes.any,
31
34
  };
32
35
 
33
36
  export { Button };
@@ -10,8 +10,9 @@ import PropTypes from 'prop-types';
10
10
  * Internal dependencies
11
11
  */
12
12
  import { Box } from '..';
13
+ import classNames from 'classnames';
13
14
 
14
- const Card = React.forwardRef( ( { variant = 'primary', sx = {}, ...props }, ref ) => {
15
+ const Card = React.forwardRef( ( { variant = 'primary', sx = {}, className, ...props }, ref ) => {
15
16
  return (
16
17
  <Box
17
18
  ref={ref}
@@ -21,6 +22,7 @@ const Card = React.forwardRef( ( { variant = 'primary', sx = {}, ...props }, ref
21
22
  overflow: 'hidden',
22
23
  ...sx,
23
24
  }}
25
+ className={ classNames( 'vip-card-component', className ) }
24
26
  {...props}
25
27
  />
26
28
  );
@@ -29,6 +31,7 @@ const Card = React.forwardRef( ( { variant = 'primary', sx = {}, ...props }, ref
29
31
  Card.propTypes = {
30
32
  variant: PropTypes.string,
31
33
  sx: PropTypes.object,
34
+ className: PropTypes.any,
32
35
  };
33
36
 
34
37
  Card.displayName = 'Card';
@@ -3,11 +3,12 @@
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
+ import classNames from 'classnames';
6
7
  import PropTypes from 'prop-types';
7
8
  import { useRef, useState } from 'react';
8
9
  import { MdContentCopy } from 'react-icons/md';
9
10
 
10
- const Code = ( { prompt = false, showCopy = false, onCopy = null, ...props } ) => {
11
+ const Code = ( { prompt = false, showCopy = false, onCopy = null, className, ...props } ) => {
11
12
  const ref = useRef();
12
13
 
13
14
  const codeDom = (
@@ -29,6 +30,7 @@ const Code = ( { prompt = false, showCopy = false, onCopy = null, ...props } ) =
29
30
  userSelect: 'none',
30
31
  },
31
32
  } }
33
+ className={ classNames( 'vip-code-component', className ) }
32
34
  { ...props }
33
35
  />
34
36
  );
@@ -88,6 +90,7 @@ Code.propTypes = {
88
90
  prompt: PropTypes.bool,
89
91
  showCopy: PropTypes.bool,
90
92
  onCopy: PropTypes.func,
93
+ className: PropTypes.any,
91
94
  };
92
95
 
93
96
  export { Code };