@automattic/vip-design-system 0.8.0 → 0.9.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 (92) 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 +5 -0
  9. package/README.md +38 -1
  10. package/babel.config.js +10 -10
  11. package/build/system/Avatar/Avatar.js +1 -1
  12. package/build/system/Avatar/Avatar.test.js +54 -0
  13. package/build/system/Card/Card.js +2 -1
  14. package/build/system/Dialog/DialogButton.js +0 -2
  15. package/build/system/Dialog/DialogContent.js +1 -1
  16. package/build/system/Form/InlineSelect.js +2 -2
  17. package/build/system/Form/Input.js +2 -1
  18. package/build/system/Form/RadioBoxGroup.js +0 -2
  19. package/build/system/Form/SearchSelect.js +1 -1
  20. package/build/system/Form/Select.js +3 -3
  21. package/build/system/Form/Textarea.js +3 -2
  22. package/build/system/Form/ToggleGroup.js +0 -4
  23. package/build/system/Notice/Notice.js +50 -29
  24. package/build/system/ResourceList/ResourceItem.js +89 -0
  25. package/build/system/ResourceList/ResourceList.js +121 -0
  26. package/build/system/ResourceList/index.js +11 -0
  27. package/build/system/Time/index.js +91 -0
  28. package/build/system/Timeline/index.js +11 -9
  29. package/build/system/Tooltip/Tooltip.js +4 -3
  30. package/build/system/index.js +9 -0
  31. package/build/system/theme/index.js +1 -1
  32. package/package.json +47 -7
  33. package/src/system/Avatar/Avatar.js +1 -1
  34. package/src/system/Avatar/Avatar.stories.js +0 -5
  35. package/src/system/Avatar/Avatar.test.js +31 -0
  36. package/src/system/Badge/Badge.js +1 -1
  37. package/src/system/Badge/Badge.stories.js +0 -5
  38. package/src/system/BlankState/BlankState.js +2 -2
  39. package/src/system/BlankState/BlankState.stories.js +0 -5
  40. package/src/system/Box/Box.stories.js +0 -5
  41. package/src/system/Button/Button.js +1 -1
  42. package/src/system/Card/Card.js +16 -12
  43. package/src/system/Card/Card.stories.js +0 -5
  44. package/src/system/Code/Code.stories.js +4 -1
  45. package/src/system/ConfirmationDialog/ConfirmationDialog.stories.js +0 -5
  46. package/src/system/Dialog/Dialog.stories.js +0 -5
  47. package/src/system/Dialog/DialogButton.js +0 -1
  48. package/src/system/Dialog/DialogContent.js +14 -1
  49. package/src/system/Flex/Flex.stories.js +0 -5
  50. package/src/system/Form/InlineSelect.js +6 -6
  51. package/src/system/Form/Input.js +2 -0
  52. package/src/system/Form/Input.stories.js +0 -5
  53. package/src/system/Form/RadioBoxGroup.js +1 -2
  54. package/src/system/Form/RadioBoxGroup.stories.js +4 -5
  55. package/src/system/Form/SearchSelect.js +4 -4
  56. package/src/system/Form/Select.js +18 -18
  57. package/src/system/Form/Select.stories.js +1 -1
  58. package/src/system/Form/Textarea.js +3 -1
  59. package/src/system/Form/ToggleGroup.js +34 -37
  60. package/src/system/Form/ToggleGroup.stories.js +30 -32
  61. package/src/system/Form/ToggleRow.js +1 -1
  62. package/src/system/Grid/Grid.stories.js +0 -5
  63. package/src/system/Heading/Heading.stories.js +0 -5
  64. package/src/system/Link/Link.stories.js +0 -5
  65. package/src/system/Notice/Notice.js +30 -11
  66. package/src/system/Notification/Notification.js +2 -2
  67. package/src/system/Notification/Notification.stories.js +0 -5
  68. package/src/system/OptionRow/OptionRow.js +23 -23
  69. package/src/system/OptionRow/OptionRow.stories.js +0 -5
  70. package/src/system/Progress/Progress.stories.js +0 -5
  71. package/src/system/ResourceList/ResourceItem.js +66 -0
  72. package/src/system/ResourceList/ResourceList.js +96 -0
  73. package/src/system/ResourceList/ResourceList.stories.js +300 -0
  74. package/src/system/ResourceList/index.js +7 -0
  75. package/src/system/Spinner/Spinner.stories.js +0 -5
  76. package/src/system/Table/Table.stories.js +0 -5
  77. package/src/system/Table/TableRow.js +1 -1
  78. package/src/system/Tabs/Tabs.stories.js +0 -5
  79. package/src/system/Text/Text.stories.js +0 -5
  80. package/src/system/{Timeline/Timeline.stories.js → Time/Time.stories.js} +5 -5
  81. package/src/system/Time/index.js +62 -0
  82. package/src/system/Timeline/index.js +11 -5
  83. package/src/system/Tooltip/Tooltip.js +5 -4
  84. package/src/system/Tooltip/Tooltip.stories.js +0 -5
  85. package/src/system/Wizard/Wizard.js +7 -7
  86. package/src/system/Wizard/WizardStep.js +5 -5
  87. package/src/system/Wizard/WizardStepHorizontal.js +1 -1
  88. package/src/system/index.js +27 -2
  89. package/src/system/theme/colors.js +1 -1
  90. package/src/system/theme/index.js +248 -248
  91. package/test/setupAfterEnv.js +13 -0
  92. package/test/setupTests.js +4 -0
package/.eslines.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "branches": {
3
+ "default": ["downgrade-unmodified-lines"]
4
+ },
5
+ "processors": {
6
+ "downgrade-unmodified-lines": {
7
+ "remote": "origin/master"
8
+ }
9
+ }
10
+ }
package/.eslintignore ADDED
@@ -0,0 +1,7 @@
1
+ .git
2
+ build
3
+ coverage
4
+ flow-typed
5
+ jest_0
6
+ node_modules
7
+ storybook-static
package/.eslintrc.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "parser": "@babel/eslint-parser",
3
+ "parserOptions": {
4
+ "babelOptions": {
5
+ "presets": ["@babel/preset-react"]
6
+ }
7
+ },
8
+ "extends": [ "wpvip" ],
9
+ "plugins": [
10
+ "react",
11
+ "jsx-a11y"
12
+ ],
13
+ "rules": {
14
+ "id-length": 0,
15
+ "react/jsx-uses-react": "off",
16
+ "react/react-in-jsx-scope": "off"
17
+ },
18
+ "settings": {
19
+ "react": {
20
+ "version": "16.4"
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,22 @@
1
+ ## Description
2
+
3
+ A few sentences describing the overall goals of the pull request. Any special considerations and decisions.
4
+
5
+ Also include any references to relevant discussions and documentation.
6
+
7
+ ## Checklist
8
+
9
+ - [ ] This PR has good automated test coverage
10
+ - [ ] The storybook for the component has been updated
11
+
12
+ ## Steps to Test
13
+
14
+ Outline the steps to test and verify the PR here.
15
+
16
+ Example:
17
+
18
+ 1. Pull down PR.
19
+ 1. `npm run dev`.
20
+ 1. Open Storybook.
21
+ 1. Eat cookies.
22
+ 1. Verify cookies are delicious.
@@ -0,0 +1,71 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ master ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ master ]
20
+ schedule:
21
+ - cron: '32 21 * * 6'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'javascript' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37
+ # Learn more:
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
+
40
+ steps:
41
+ - name: Checkout repository
42
+ uses: actions/checkout@v2
43
+
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
+
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
+
59
+ # ℹ️ Command-line programs to run using the OS shell.
60
+ # 📚 https://git.io/JvXDl
61
+
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
+
66
+ #- run: |
67
+ # make bootstrap
68
+ # make release
69
+
70
+ - name: Perform CodeQL Analysis
71
+ uses: github/codeql-action/analyze@v1
@@ -0,0 +1,29 @@
1
+ name: Node.js CI
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ timeout-minutes: 5
11
+
12
+ strategy:
13
+ matrix:
14
+ node-version: [14.x]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ with:
19
+ persist-credentials: false
20
+ - name: Use Node.js ${{ matrix.node-version }}
21
+ uses: actions/setup-node@v1
22
+ with:
23
+ node-version: ${{ matrix.node-version }}
24
+ - run: npm install -g npm@latest
25
+ - run: npm install
26
+ - run: npm run test
27
+ - run: npm run build
28
+ env:
29
+ CI: true
package/.prettierrc ADDED
@@ -0,0 +1,9 @@
1
+ arrowParens: "avoid"
2
+ bracketSpacing: true
3
+ jsxBracketSameLine: false
4
+ printWidth: 100
5
+ parenSpacing: true
6
+ semi: true
7
+ singleQuote: true
8
+ tabWidth: 2
9
+ useTabs: true
@@ -1,7 +1,9 @@
1
1
  import React from "react";
2
+ import ReactDOM from 'react-dom';
2
3
  import { ThemeProvider, useColorMode } from "theme-ui";
3
4
  import { addDecorator } from "@storybook/react";
4
5
  import { Button, Box, theme, Link } from "../src/system";
6
+ import axe from '@axe-core/react'
5
7
 
6
8
  const ThemeChanger = () => {
7
9
  const [colorMode, setColorMode] = useColorMode();
@@ -23,6 +25,9 @@ const ThemeChanger = () => {
23
25
  );
24
26
  };
25
27
 
28
+
29
+ axe( React, ReactDOM, 1000 );
30
+
26
31
  addDecorator((story) => (
27
32
  <React.Fragment>
28
33
  <ThemeProvider theme={theme}>
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Design system components used throughout VIP.
4
4
 
5
+ [Storybook Components](https://vip-design-system-components.netlify.app/)
6
+
5
7
  ## Development
6
8
 
7
9
  ### Prerequisites
@@ -13,7 +15,7 @@ Make sure you have [node.js](https://nodejs.org/) and [NPM](https://docs.npmjs.c
13
15
  To get setup run the following command in the `vip-design-system` directory:
14
16
 
15
17
  ```
16
- npm install
18
+ npm install
17
19
  ```
18
20
 
19
21
  ### Watching for changes
@@ -38,3 +40,38 @@ For components that include storybooks, we can run `npm run storybook` to view t
38
40
  2. Spin up a local copy of [the VIP Dashboard](https://github.com/automattic/vip-ui) and navigate to a page using the linked components from `@automattic/vip-design-system`
39
41
 
40
42
  Note: it's super useful to run `npm run watch` in another process, so any changes will be almost immediately available / testable.
43
+
44
+ ### Publish NPM Package Instructions
45
+
46
+ Once all the changes needed are merged to master, and you are ready to release a new version, follow these steps:
47
+
48
+ 1. Make sure you have NPM access to our @automattic organization. Ask for #vip-platform-pâtisserie help in case you need it.
49
+ 2. Pull all the changes to your local master. Make sure you have the latest master locally.
50
+ 3. We follow the [https://semver.org/](https://semver.org/) versioning. You should run the specific version you are trying to publish:
51
+
52
+ ```bash
53
+ npm version major|minor|patch
54
+ ```
55
+
56
+ 4. You should see a version bump in the `package.json` file.
57
+ 5. Build the application:
58
+
59
+ ```bash
60
+ npm run build
61
+ ```
62
+
63
+ 6. Publish the application
64
+ ```
65
+ npm publish
66
+ ```
67
+
68
+ Note: You need to have two-factor enabled in your npm account. The publish command will request a two-factor code to complete the publishing process.
69
+
70
+ 7. Push the tags to the repository and master updates.
71
+
72
+ ```
73
+ git push --tags
74
+ git push origin master
75
+ ```
76
+
77
+ 8. For major versions or breaking changes, it's recommended to [create a RELEASE](https://github.com/Automattic/vip-design-system/releases) with the published tag.
package/babel.config.js CHANGED
@@ -1,20 +1,20 @@
1
1
  module.exports = {
2
- "ignore": [
3
- "**/*.stories.js"
2
+ ignore: [
3
+ '**/*.stories.js',
4
4
  ],
5
- "presets": [
5
+ presets: [
6
6
  [
7
- "@babel/preset-env",
7
+ '@babel/preset-env',
8
8
  {
9
- "loose": true
10
- }
9
+ loose: true,
10
+ },
11
11
  ],
12
12
  [
13
- "@babel/preset-react",
13
+ '@babel/preset-react',
14
14
  {
15
- "importSource": "theme-ui",
16
- "runtime": "automatic",
17
- "throwIfNamespace": false,
15
+ importSource: 'theme-ui',
16
+ runtime: 'automatic',
17
+ throwIfNamespace: false,
18
18
  },
19
19
  ],
20
20
  ],
@@ -51,7 +51,7 @@ var Avatar = function Avatar(_ref) {
51
51
  }, props, {
52
52
  children: src ? (0, _jsxRuntime.jsx)(_themeUi.Image, {
53
53
  src: src,
54
- alt: name,
54
+ alt: "Avatar image from " + name,
55
55
  sx: {
56
56
  borderRadius: 9999,
57
57
  width: '100%',
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ var _react = require("@testing-library/react");
4
+
5
+ var _jestAxe = require("jest-axe");
6
+
7
+ var _Avatar = require("./Avatar");
8
+
9
+ var _jsxRuntime = require("theme-ui/jsx-runtime");
10
+
11
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
12
+
13
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
14
+
15
+ describe('<Avatar />', function () {
16
+ it('renders the Avatar without an image', function () {
17
+ (0, _react.render)((0, _jsxRuntime.jsx)(_Avatar.Avatar, {
18
+ name: "John Doe"
19
+ }));
20
+ expect(_react.screen.getByText('J')).toBeInTheDocument();
21
+ });
22
+ it('renders the Avatar with image', function () {
23
+ (0, _react.render)((0, _jsxRuntime.jsx)(_Avatar.Avatar, {
24
+ name: "John Doe",
25
+ src: "path/to/image"
26
+ }));
27
+ expect(_react.screen.getByAltText('Avatar image from John Doe')).toBeInTheDocument();
28
+ });
29
+ it('should not have basic accessibility issues', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
30
+ var _render, container, results;
31
+
32
+ return regeneratorRuntime.wrap(function _callee$(_context) {
33
+ while (1) {
34
+ switch (_context.prev = _context.next) {
35
+ case 0:
36
+ _render = (0, _react.render)((0, _jsxRuntime.jsx)(_Avatar.Avatar, {
37
+ name: "John Doe",
38
+ src: "path/to/image"
39
+ })), container = _render.container;
40
+ _context.next = 3;
41
+ return (0, _jestAxe.axe)(container);
42
+
43
+ case 3:
44
+ results = _context.sent;
45
+ expect(results).toHaveNoViolations();
46
+
47
+ case 5:
48
+ case "end":
49
+ return _context.stop();
50
+ }
51
+ }
52
+ }, _callee);
53
+ })));
54
+ });
@@ -40,4 +40,5 @@ exports.Card = Card;
40
40
  Card.propTypes = {
41
41
  variant: _propTypes["default"].string,
42
42
  sx: _propTypes["default"].object
43
- };
43
+ };
44
+ Card.displayName = 'Card';
@@ -5,8 +5,6 @@ exports.DialogButton = void 0;
5
5
 
6
6
  var _propTypes = _interopRequireDefault(require("prop-types"));
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _md = require("react-icons/md");
11
9
 
12
10
  var _ = require("../");
@@ -58,7 +58,7 @@ var DialogContent = function DialogContent(_ref) {
58
58
  right: 0,
59
59
  bottom: 0,
60
60
  opacity: 0.7,
61
- background: 'linear-gradient(198.09deg, #E5F0F6 2.01%, rgba(235, 238, 242, 0) 43.18%, rgba(249, 234, 232, 0) 47.86%, #FFE9D1 94.31%), linear-gradient(98.65deg, #FFE8E6 0.58%, rgba(255, 233, 214, 0) 52.45%, rgba(255, 233, 219, 0) 53.76%, #FFE9D1 105.86%), #F5F2F1'
61
+ background: "linear-gradient(\n\t\t\t\t\t\t\t198.09deg,\n\t\t\t\t\t\t\t#E5F0F6 2.01%,\n\t\t\t\t\t\t\trgba(235, 238, 242, 0) 43.18%,\n\t\t\t\t\t\t\trgba(249, 234, 232, 0) 47.86%,\n\t\t\t\t\t\t\t#FFE9D1 94.31%\n\t\t\t\t\t\t),\n\t\t\t\t\t\tlinear-gradient(\n\t\t\t\t\t\t\t98.65deg,\n\t\t\t\t\t\t\t#FFE8E6 0.58%,\n\t\t\t\t\t\t\trgba(255, 233, 214, 0) 52.45%,\n\t\t\t\t\t\t\trgba(255, 233, 219, 0) 53.76%,\n\t\t\t\t\t\t\t#FFE9D1 105.86%\n\t\t\t\t\t\t), #F5F2F1"
62
62
  }
63
63
  }), variant === 'sidebar' ? (0, _jsxRuntime.jsx)(SidebarMotion, _extends({}, props)) : (0, _jsxRuntime.jsx)(DialogMotion, _extends({
64
64
  position: position,
@@ -51,7 +51,7 @@ var selectStyles = {
51
51
  menu: function menu() {
52
52
  return {
53
53
  boxShadow: 'none',
54
- borderTop: "1px solid"
54
+ borderTop: '1px solid'
55
55
  };
56
56
  }
57
57
  };
@@ -63,7 +63,7 @@ var InlineSelect = function InlineSelect(_ref) {
63
63
  _ref$noneLabel = _ref.noneLabel,
64
64
  noneLabel = _ref$noneLabel === void 0 ? 'All' : _ref$noneLabel,
65
65
  _ref$position = _ref.position,
66
- position = _ref$position === void 0 ? "left" : _ref$position,
66
+ position = _ref$position === void 0 ? 'left' : _ref$position,
67
67
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
68
68
 
69
69
  var valueLabel = noneLabel;
@@ -74,4 +74,5 @@ Input.propTypes = {
74
74
  required: _propTypes["default"].bool,
75
75
  forLabel: _propTypes["default"].string,
76
76
  errorMessage: _propTypes["default"].string
77
- };
77
+ };
78
+ Input.displayName = 'Input';
@@ -3,8 +3,6 @@
3
3
  exports.__esModule = true;
4
4
  exports.RadioBoxGroup = void 0;
5
5
 
6
- var _react = _interopRequireDefault(require("react"));
7
-
8
6
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
7
 
10
8
  var RadioGroupPrimitive = _interopRequireWildcard(require("@radix-ui/react-radio-group"));
@@ -110,7 +110,7 @@ var SearchSelect = function SearchSelect(props) {
110
110
  '.select__control': {
111
111
  background: 'none',
112
112
  color: 'heading',
113
- border: "1px solid",
113
+ border: '1px solid',
114
114
  borderColor: 'border',
115
115
  margin: 0,
116
116
  padding: 0,
@@ -45,9 +45,9 @@ var Select = function Select(_ref) {
45
45
 
46
46
  exports.Select = Select;
47
47
  Select.propTypes = {
48
- isMulti: _propTypes["default"].bool,
49
48
  isInline: _propTypes["default"].bool,
49
+ isMulti: _propTypes["default"].bool,
50
50
  isSearch: _propTypes["default"].bool,
51
- options: _propTypes["default"].array,
52
- label: _propTypes["default"].string
51
+ label: _propTypes["default"].string,
52
+ options: _propTypes["default"].array
53
53
  };
@@ -30,7 +30,7 @@ var Textarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
30
30
 
31
31
  return (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
32
32
  children: [label && (0, _jsxRuntime.jsxs)(_.Label, {
33
- "for": forLabel,
33
+ htmlFor: forLabel,
34
34
  children: [label, required && '*']
35
35
  }), (0, _jsxRuntime.jsx)("textarea", _extends({}, props, {
36
36
  ref: ref,
@@ -69,4 +69,5 @@ Textarea.propTypes = {
69
69
  required: _propTypes["default"].bool,
70
70
  forLabel: _propTypes["default"].string,
71
71
  errorMessage: _propTypes["default"].string
72
- };
72
+ };
73
+ Textarea.displayName = 'Textarea';
@@ -3,14 +3,10 @@
3
3
  exports.__esModule = true;
4
4
  exports.ToggleGroup = void 0;
5
5
 
6
- var _react = _interopRequireDefault(require("react"));
7
-
8
6
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
7
 
10
8
  var RadioGroupPrimitive = _interopRequireWildcard(require("@radix-ui/react-radio-group"));
11
9
 
12
- var _md = require("react-icons/md");
13
-
14
10
  var _jsxRuntime = require("theme-ui/jsx-runtime");
15
11
 
16
12
  var _excluded = ["onChange", "groupLabel", "value", "options"];
@@ -19,47 +19,65 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
19
19
 
20
20
  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; }
21
21
 
22
- var Notice = function Notice(_ref) {
23
- var _ref$variant = _ref.variant,
24
- variant = _ref$variant === void 0 ? 'warning' : _ref$variant,
25
- _ref$inline = _ref.inline,
26
- inline = _ref$inline === void 0 ? false : _ref$inline,
27
- children = _ref.children,
28
- title = _ref.title,
29
- _ref$sx = _ref.sx,
30
- sx = _ref$sx === void 0 ? {} : _ref$sx,
31
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
32
-
33
- var color = 'yellow';
22
+ var NoticeIcon = function NoticeIcon(_ref) {
23
+ var color = _ref.color,
24
+ variant = _ref.variant;
34
25
  var Icon = _md.MdWarning;
35
26
 
36
27
  switch (variant) {
37
28
  case 'info':
38
- color = 'blue';
39
29
  Icon = _md.MdInfo;
40
30
  break;
41
31
 
42
32
  case 'alert':
43
- color = 'red';
44
33
  Icon = _md.MdError;
45
34
  break;
46
35
 
47
36
  case 'success':
48
- color = 'green';
49
37
  Icon = _md.MdCheckCircle;
50
38
  break;
51
39
  }
52
40
 
53
- var NoticeIcon = function NoticeIcon(_ref2) {
54
- var color = _ref2.color;
55
- return (0, _jsxRuntime.jsx)(Icon, {
56
- sx: {
57
- marginRight: 2,
58
- color: color,
59
- flex: '0 0 auto'
60
- }
61
- });
62
- };
41
+ return (0, _jsxRuntime.jsx)(Icon, {
42
+ sx: {
43
+ marginRight: 2,
44
+ color: color,
45
+ flex: '0 0 auto'
46
+ }
47
+ });
48
+ };
49
+
50
+ NoticeIcon.propTypes = {
51
+ color: _propTypes["default"].string,
52
+ variant: _propTypes["default"].string
53
+ };
54
+
55
+ var Notice = function Notice(_ref2) {
56
+ var _ref2$variant = _ref2.variant,
57
+ variant = _ref2$variant === void 0 ? 'warning' : _ref2$variant,
58
+ _ref2$inline = _ref2.inline,
59
+ inline = _ref2$inline === void 0 ? false : _ref2$inline,
60
+ children = _ref2.children,
61
+ title = _ref2.title,
62
+ _ref2$sx = _ref2.sx,
63
+ sx = _ref2$sx === void 0 ? {} : _ref2$sx,
64
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded);
65
+
66
+ var color = 'yellow';
67
+
68
+ switch (variant) {
69
+ case 'info':
70
+ color = 'blue';
71
+ break;
72
+
73
+ case 'alert':
74
+ color = 'red';
75
+ break;
76
+
77
+ case 'success':
78
+ color = 'green';
79
+ break;
80
+ }
63
81
 
64
82
  return (0, _jsxRuntime.jsx)(_.Card, _extends({
65
83
  sx: _extends({
@@ -84,7 +102,8 @@ var Notice = function Notice(_ref) {
84
102
  alignItems: 'center'
85
103
  },
86
104
  children: (0, _jsxRuntime.jsx)(NoticeIcon, {
87
- color: color + ".100"
105
+ color: color + ".100",
106
+ variant: variant
88
107
  })
89
108
  }), (0, _jsxRuntime.jsxs)(_.Box, {
90
109
  sx: {
@@ -106,8 +125,10 @@ var Notice = function Notice(_ref) {
106
125
 
107
126
  exports.Notice = Notice;
108
127
  Notice.propTypes = {
109
- variant: _propTypes["default"].string,
110
- title: _propTypes["default"].node,
128
+ children: _propTypes["default"].node,
129
+ color: _propTypes["default"].string,
111
130
  inline: _propTypes["default"].bool,
112
- children: _propTypes["default"].node
131
+ sx: _propTypes["default"].object,
132
+ title: _propTypes["default"].node,
133
+ variant: _propTypes["default"].string
113
134
  };