@automattic/vip-design-system 0.10.0 → 0.10.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 (37) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/build/system/OptionRow/OptionRow.js +3 -2
  3. package/build/system/OptionRow/OptionRow.test.js +38 -0
  4. package/package.json +1 -1
  5. package/src/system/OptionRow/OptionRow.js +4 -2
  6. package/src/system/OptionRow/OptionRow.stories.js +8 -0
  7. package/src/system/OptionRow/OptionRow.test.js +22 -0
  8. package/build/system/Avatar/Avatar.stories.js +0 -16
  9. package/build/system/Badge/Badge.stories.js +0 -16
  10. package/build/system/BlankState/BlankState.stories.js +0 -25
  11. package/build/system/Box/Box.stories.js +0 -16
  12. package/build/system/Button/Button.stories.js +0 -31
  13. package/build/system/Card/Card.stories.js +0 -16
  14. package/build/system/Code/Code.stories.js +0 -16
  15. package/build/system/ConfirmationDialog/ConfirmationDialog.stories.js +0 -32
  16. package/build/system/Dialog/Dialog.stories.js +0 -43
  17. package/build/system/Flex/Flex.stories.js +0 -16
  18. package/build/system/Form/Input.stories.js +0 -18
  19. package/build/system/Form/MultiSelect.js +0 -38
  20. package/build/system/Form/Select.stories.js +0 -120
  21. package/build/system/Grid/Grid.stories.js +0 -16
  22. package/build/system/Heading/Heading.stories.js +0 -28
  23. package/build/system/Link/Link.stories.js +0 -19
  24. package/build/system/Notice/Notice.stories.js +0 -90
  25. package/build/system/Notification/Notification.stories.js +0 -19
  26. package/build/system/OptionRow/OptionRow.stories.js +0 -34
  27. package/build/system/Progress/Progress.stories.js +0 -21
  28. package/build/system/Spinner/Spinner.stories.js +0 -16
  29. package/build/system/Table/Table.stories.js +0 -50
  30. package/build/system/Tabs/Tabs.stories.js +0 -18
  31. package/build/system/Text/Text.stories.js +0 -16
  32. package/build/system/Timeline/Timeline.stories.js +0 -29
  33. package/build/system/Tooltip/Tooltip.stories.js +0 -29
  34. package/build/system/UsageChart/UsageChart.js +0 -60
  35. package/build/system/UsageChart/UsageChart.stories.js +0 -20
  36. package/build/system/UsageChart/index.js +0 -7
  37. package/build/system/Wizard/Wizard.stories.js +0 -55
@@ -0,0 +1,3 @@
1
+ {
2
+ "prettier.enable": false,
3
+ }
@@ -73,7 +73,7 @@ var OptionRow = function OptionRow(_ref) {
73
73
  cursor: disabled ? 'auto' : 'pointer',
74
74
  textDecoration: 'none',
75
75
  color: 'inherit',
76
- '&:hover': {
76
+ '&:hover': !disabled && {
77
77
  backgroundColor: 'hover'
78
78
  }
79
79
  }, inlineStyles),
@@ -123,7 +123,8 @@ var OptionRow = function OptionRow(_ref) {
123
123
  },
124
124
  children: body
125
125
  })]
126
- }), (0, _jsxRuntime.jsx)(_.Box, {
126
+ }), false !== meta && '' !== meta && (0, _jsxRuntime.jsx)(_.Box, {
127
+ "data-testid": "meta",
127
128
  children: meta ? meta : (0, _jsxRuntime.jsx)(_md.MdArrowForward, {
128
129
  size: 24
129
130
  })
@@ -43,4 +43,42 @@ describe('<OptionRow />', function () {
43
43
  }
44
44
  }, _callee);
45
45
  })));
46
+ it('renders a disabled OptionRow', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
47
+ var image1, _render2, container;
48
+
49
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
50
+ while (1) {
51
+ switch (_context2.prev = _context2.next) {
52
+ case 0:
53
+ // eslint-disable-next-line max-len
54
+ image1 = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='79' height='79' viewBox='0 0 79 79' fill='none' %3E%3Cpath d='M71.4 15.3L54.2 4.2C54 4 53.7 4 53.4 4H26.4C26.1 4 25.8 4.1 25.6 4.2L8.29997 15.3C7.89997 15.6 7.59998 16 7.59998 16.5V32.1V63C7.59998 63.5 7.89997 64 8.29997 64.2L25.5 75.3C25.5 75.3 25.6 75.3 25.6 75.4C25.6 75.4 25.7 75.4 25.7 75.5C25.9 75.6 26 75.6 26.2 75.6H53.2C53.4 75.6 53.5 75.6 53.7 75.5C53.8 75.5 53.8 75.5 53.8 75.4C53.8 75.4 53.9 75.4 53.9 75.3L71.4 64.2C71.5 64.1 71.7 64 71.8 63.8C71.8 63.8 71.8 63.7 71.9 63.7C72 63.6 72.1 63.4 72.1 63.2V63.1C72.1 63 72.1 62.9 72.1 62.8V32.1V16.5C72.1 16 71.8 15.6 71.4 15.3ZM24.9 71.4L10.6 62.2V34.8L24.9 44V71.4ZM51.9 72.6H27.8V44.7H51.9V72.6ZM69.1 31.3L52.9 41.7H26.8L10.6 31.3V17.3L26.8 6.9H52.9L69.1 17.3V31.3Z' fill='%23BD9D70' /%3E%3C/svg%3E";
55
+ _render2 = (0, _react.render)((0, _jsxRuntime.jsx)(_OptionRow.OptionRow, {
56
+ image: image1,
57
+ label: "Option Row",
58
+ subTitle: "Mostly used to link off to other pages.",
59
+ as: "a",
60
+ disabled: true,
61
+ meta: ""
62
+ })), container = _render2.container;
63
+ expect(_react.screen.getByAltText('Image representing the list item').closest('div')).toHaveStyle({
64
+ background: 'none'
65
+ });
66
+ expect(_react.screen.queryByTestId('meta')).not.toBeInTheDocument(); // Check for accessibility issues
67
+
68
+ _context2.t0 = expect;
69
+ _context2.next = 7;
70
+ return (0, _jestAxe.axe)(container);
71
+
72
+ case 7:
73
+ _context2.t1 = _context2.sent;
74
+ _context2.next = 10;
75
+ return (0, _context2.t0)(_context2.t1).toHaveNoViolations();
76
+
77
+ case 10:
78
+ case "end":
79
+ return _context2.stop();
80
+ }
81
+ }
82
+ }, _callee2);
83
+ })));
46
84
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip-design-system",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "main": "build/system/index.js",
5
5
  "scripts": {
6
6
  "build-storybook": "build-storybook",
@@ -64,7 +64,7 @@ const OptionRow = ( {
64
64
  cursor: disabled ? 'auto' : 'pointer',
65
65
  textDecoration: 'none',
66
66
  color: 'inherit',
67
- '&:hover': {
67
+ '&:hover': ! disabled && {
68
68
  backgroundColor: 'hover',
69
69
  },
70
70
  ...inlineStyles,
@@ -107,7 +107,9 @@ const OptionRow = ( {
107
107
  {subTitle && <Text sx={{ mb: 1, color: 'muted' }}>{subTitle}</Text>}
108
108
  {body && <Text sx={{ mb: 0 }}>{body}</Text>}
109
109
  </Box>
110
- <Box>{meta ? meta : <MdArrowForward size={24} />}</Box>
110
+ { ( false !== meta && '' !== meta ) && (
111
+ <Box data-testid="meta">{ meta ? meta : <MdArrowForward size={24} /> }</Box>
112
+ ) }
111
113
  </Grid>
112
114
  );
113
115
  };
@@ -28,5 +28,13 @@ export const Default = () => (
28
28
  as="a"
29
29
  order={ 2 }
30
30
  />
31
+ <OptionRow
32
+ image={image2}
33
+ label="Option Row – Disabled"
34
+ subTitle="Mostly used to link off to other pages."
35
+ as={ Box }
36
+ disabled
37
+ meta=""
38
+ />
31
39
  </Box>
32
40
  );
@@ -24,4 +24,26 @@ describe( '<OptionRow />', () => {
24
24
  // Check for accessibility issues
25
25
  await expect( await axe( container ) ).toHaveNoViolations();
26
26
  } );
27
+
28
+ it( 'renders a disabled OptionRow', async () => {
29
+ // eslint-disable-next-line max-len
30
+ const image1 = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='79' height='79' viewBox='0 0 79 79' fill='none' %3E%3Cpath d='M71.4 15.3L54.2 4.2C54 4 53.7 4 53.4 4H26.4C26.1 4 25.8 4.1 25.6 4.2L8.29997 15.3C7.89997 15.6 7.59998 16 7.59998 16.5V32.1V63C7.59998 63.5 7.89997 64 8.29997 64.2L25.5 75.3C25.5 75.3 25.6 75.3 25.6 75.4C25.6 75.4 25.7 75.4 25.7 75.5C25.9 75.6 26 75.6 26.2 75.6H53.2C53.4 75.6 53.5 75.6 53.7 75.5C53.8 75.5 53.8 75.5 53.8 75.4C53.8 75.4 53.9 75.4 53.9 75.3L71.4 64.2C71.5 64.1 71.7 64 71.8 63.8C71.8 63.8 71.8 63.7 71.9 63.7C72 63.6 72.1 63.4 72.1 63.2V63.1C72.1 63 72.1 62.9 72.1 62.8V32.1V16.5C72.1 16 71.8 15.6 71.4 15.3ZM24.9 71.4L10.6 62.2V34.8L24.9 44V71.4ZM51.9 72.6H27.8V44.7H51.9V72.6ZM69.1 31.3L52.9 41.7H26.8L10.6 31.3V17.3L26.8 6.9H52.9L69.1 17.3V31.3Z' fill='%23BD9D70' /%3E%3C/svg%3E";
31
+
32
+ const { container } = render(
33
+ <OptionRow
34
+ image={image1}
35
+ label="Option Row"
36
+ subTitle="Mostly used to link off to other pages."
37
+ as="a"
38
+ disabled
39
+ meta=""
40
+ />
41
+ );
42
+
43
+ expect( screen.getByAltText( 'Image representing the list item' ).closest( 'div' ) ).toHaveStyle( { background: 'none' } );
44
+ expect( screen.queryByTestId( 'meta' ) ).not.toBeInTheDocument();
45
+
46
+ // Check for accessibility issues
47
+ await expect( await axe( container ) ).toHaveNoViolations();
48
+ } );
27
49
  } );
@@ -1,16 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Avatar } from '..';
10
- export default {
11
- title: 'Avatar',
12
- component: Avatar
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Avatar, null);
16
- };
@@ -1,16 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Badge } from '..';
10
- export default {
11
- title: 'Badge',
12
- component: Badge
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Badge, null, "Badge");
16
- };
@@ -1,25 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Link, BlankState } from '..';
10
- export default {
11
- title: 'BlankState',
12
- component: BlankState
13
- }; // eslint-disable-next-line max-len
14
-
15
- var image2 = "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
- export var Default = function Default() {
17
- return /*#__PURE__*/React.createElement(BlankState, {
18
- image: image2,
19
- title: "Power up your application",
20
- body: "Add-ons give you the ability to bolt on extra capabilities to\nyour application, including logging, analytics and performance\nmonitoring.",
21
- cta: /*#__PURE__*/React.createElement(Link, {
22
- as: "a"
23
- }, "Explore add-ons \u2192")
24
- });
25
- };
@@ -1,16 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Box } from '..';
10
- export default {
11
- title: 'Box',
12
- component: Box
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Box, null, "Hello");
16
- };
@@ -1,31 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Button } from '..';
10
- export default {
11
- title: 'Button',
12
- component: Button
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
16
- sx: {
17
- mr: 2
18
- }
19
- }, "Primary"), /*#__PURE__*/React.createElement(Button, {
20
- variant: "secondary",
21
- sx: {
22
- ml: 2
23
- }
24
- }, "Secondary"), /*#__PURE__*/React.createElement(Button, {
25
- variant: "secondary",
26
- isLoading: true,
27
- sx: {
28
- ml: 2
29
- }
30
- }, "Secondary"));
31
- };
@@ -1,16 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Card } from '..';
10
- export default {
11
- title: 'Card',
12
- component: Card
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Card, null, "Hello");
16
- };
@@ -1,16 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Code } from '..';
10
- export default {
11
- title: 'Code',
12
- component: Code
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Code, null, "Code");
16
- };
@@ -1,32 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Box, ConfirmationDialog, Button, Heading, Text, Flex } from '..';
10
- export default {
11
- title: 'ConfirmationDialog',
12
- component: ConfirmationDialog
13
- };
14
- var ConfirmationTrigger = /*#__PURE__*/React.createElement(Button, {
15
- sx: {
16
- mr: 3
17
- }
18
- }, "Dangerous Action");
19
- var ConfirmationContent = /*#__PURE__*/React.createElement(Box, {
20
- p: 5
21
- }, /*#__PURE__*/React.createElement(Heading, null, "This is a Modal"), /*#__PURE__*/React.createElement(Text, {
22
- sx: {
23
- fontSize: 3
24
- }
25
- }, "A modal is used to perform more detailed actions that don\u2018t necessarily need the context behind."));
26
- export var Default = function Default() {
27
- return /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(ConfirmationDialog, {
28
- trigger: ConfirmationTrigger,
29
- title: "Are you sure you want to continue?",
30
- body: "Your site will no longer be accessible via the old domain. Please make sure to test this change before moving forward."
31
- })));
32
- };
@@ -1,43 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Box, Dialog, DialogMenu, DialogMenuItem, DialogDivider, Button, Heading, Text, Flex } from '..';
10
- export default {
11
- title: 'Dialog',
12
- component: Dialog
13
- };
14
- var DropdownTrigger = /*#__PURE__*/React.createElement(Button, null, "Trigger Dropdown");
15
- var ModalTrigger = /*#__PURE__*/React.createElement(Button, {
16
- sx: {
17
- mr: 3
18
- }
19
- }, "Trigger Modal");
20
- var DropdownContent = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DialogMenu, null, /*#__PURE__*/React.createElement(DialogMenuItem, null, "Profile"), /*#__PURE__*/React.createElement(DialogMenuItem, null, "Account"), /*#__PURE__*/React.createElement(DialogMenuItem, null, "Dark Mode")), /*#__PURE__*/React.createElement(DialogDivider, null), /*#__PURE__*/React.createElement(DialogMenu, null, /*#__PURE__*/React.createElement(DialogMenuItem, null, "Logout")));
21
- var ModalContent = /*#__PURE__*/React.createElement(Box, {
22
- p: 5
23
- }, /*#__PURE__*/React.createElement(Heading, null, "This is a Modal"), /*#__PURE__*/React.createElement(Text, {
24
- sx: {
25
- fontSize: 3
26
- }
27
- }, "A modal is used to perform more detailed actions that don\u2018t necessarily need the context behind."));
28
- export var Default = function Default() {
29
- return /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Dialog, {
30
- trigger: ModalTrigger,
31
- content: ModalContent,
32
- sx: {
33
- width: 480
34
- },
35
- variant: "modal"
36
- })), /*#__PURE__*/React.createElement(Dialog, {
37
- trigger: DropdownTrigger,
38
- content: DropdownContent,
39
- sx: {
40
- width: 200
41
- }
42
- }));
43
- };
@@ -1,16 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Flex } from '..';
10
- export default {
11
- title: 'Flex',
12
- component: Flex
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Flex, null, "Hello");
16
- };
@@ -1,18 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Input } from '..';
10
- export default {
11
- title: 'Input',
12
- component: Input
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Input, {
16
- placeholder: "Your input here..."
17
- });
18
- };
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.MultiSelect = void 0;
5
-
6
- var _reactSelect = _interopRequireDefault(require("react-select"));
7
-
8
- var _jsxRuntime = require("theme-ui/jsx-runtime");
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
-
12
- 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); }
13
-
14
- var vipGold = '#c29c69'; // hardcoding for now
15
-
16
- var vipGrey2 = '#d7dee2';
17
- var customStyles = {
18
- control: function control(styles) {
19
- return _extends({}, styles, {
20
- border: "1px solid " + vipGrey2,
21
- boxShadow: 'none',
22
- '&:hover': {
23
- border: "1px solid " + vipGold
24
- },
25
- '&:focus': {
26
- border: "1px solid " + vipGold
27
- }
28
- });
29
- }
30
- };
31
-
32
- var MultiSelect = function MultiSelect(props) {
33
- return (0, _jsxRuntime.jsx)(_reactSelect["default"], _extends({}, props, {
34
- styles: customStyles
35
- }));
36
- };
37
-
38
- exports.MultiSelect = MultiSelect;
@@ -1,120 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
- /**
14
- * External dependencies
15
- */
16
- import React, { useState } from 'react';
17
- /**
18
- * Internal dependencies
19
- */
20
-
21
- import { Box, Dialog, DialogMenu, DialogMenuItem, DialogDivider, Select, Button } from '..';
22
- export default {
23
- title: 'Select',
24
- component: Dialog
25
- };
26
- var options = [{
27
- value: 'chocolate',
28
- label: 'Chocolate'
29
- }, {
30
- value: 'strawberry',
31
- label: 'Strawberry'
32
- }, {
33
- value: 'vanilla',
34
- label: 'Vanilla'
35
- }];
36
- var DropdownContent = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DialogMenu, null, /*#__PURE__*/React.createElement(DialogMenuItem, null, "Profile"), /*#__PURE__*/React.createElement(DialogMenuItem, null, "Account"), /*#__PURE__*/React.createElement(DialogMenuItem, null, "Dark Mode")), /*#__PURE__*/React.createElement(DialogDivider, null), /*#__PURE__*/React.createElement(DialogMenu, null, /*#__PURE__*/React.createElement(DialogMenuItem, null, "Logout")));
37
- var DropdownTrigger = /*#__PURE__*/React.createElement(Button, {
38
- variant: "secondary"
39
- }, "Trigger Dropdown");
40
- export var Multi = function Multi() {
41
- var _useState = useState([]),
42
- _useState2 = _slicedToArray(_useState, 2),
43
- value = _useState2[0],
44
- setValue = _useState2[1];
45
-
46
- return /*#__PURE__*/React.createElement(Box, {
47
- sx: {
48
- mr: 2,
49
- width: 400
50
- }
51
- }, /*#__PURE__*/React.createElement(Select, {
52
- label: "Type",
53
- value: value,
54
- isMulti: true,
55
- placeholder: "Select domains...",
56
- options: options,
57
- onChange: function onChange(newValue) {
58
- return setValue(newValue);
59
- }
60
- }));
61
- };
62
- export var Single = function Single() {
63
- var _useState3 = useState([]),
64
- _useState4 = _slicedToArray(_useState3, 2),
65
- value = _useState4[0],
66
- setValue = _useState4[1];
67
-
68
- return /*#__PURE__*/React.createElement(Box, {
69
- sx: {
70
- mr: 2,
71
- width: 200
72
- }
73
- }, /*#__PURE__*/React.createElement(Select, {
74
- label: "User",
75
- value: value,
76
- placeholder: "Select a domain...",
77
- options: options,
78
- onChange: function onChange(newValue) {
79
- return setValue(newValue);
80
- }
81
- }));
82
- };
83
- export var Inline = function Inline() {
84
- var _useState5 = useState([]),
85
- _useState6 = _slicedToArray(_useState5, 2),
86
- value = _useState6[0],
87
- setValue = _useState6[1];
88
-
89
- return /*#__PURE__*/React.createElement(Box, {
90
- sx: {
91
- mr: 2,
92
- width: 200
93
- }
94
- }, /*#__PURE__*/React.createElement(Select, {
95
- label: "User",
96
- value: value,
97
- isInline: true,
98
- isMulti: true,
99
- noneLabel: "Everyone",
100
- placeholder: "Filter by user...",
101
- options: options,
102
- onChange: function onChange(newValue) {
103
- return setValue(newValue);
104
- }
105
- }));
106
- };
107
- export var DropdownMenu = function DropdownMenu() {
108
- return /*#__PURE__*/React.createElement(Box, {
109
- sx: {
110
- mr: 2,
111
- width: 200
112
- }
113
- }, /*#__PURE__*/React.createElement(Dialog, {
114
- trigger: DropdownTrigger,
115
- content: DropdownContent,
116
- sx: {
117
- width: 200
118
- }
119
- }));
120
- };
@@ -1,16 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Grid } from '..';
10
- export default {
11
- title: 'Grid',
12
- component: Grid
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Grid, null, "Hello");
16
- };
@@ -1,28 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Box, Heading } from '..';
10
- export default {
11
- title: 'Heading',
12
- component: Heading
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Heading, {
16
- variant: "h1"
17
- }, "Your Applications"), /*#__PURE__*/React.createElement(Heading, {
18
- variant: "h2"
19
- }, "Heading Two"), /*#__PURE__*/React.createElement(Heading, {
20
- variant: "h3"
21
- }, "Heading Three"), /*#__PURE__*/React.createElement(Heading, {
22
- variant: "h4"
23
- }, "Heading Four"), /*#__PURE__*/React.createElement(Heading, {
24
- variant: "h5"
25
- }, "Heading Five"), /*#__PURE__*/React.createElement(Heading, {
26
- variant: "caps"
27
- }, "Heading Caps"));
28
- };
@@ -1,19 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Link } from '..';
10
- export default {
11
- title: 'Link',
12
- component: Link
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Link, {
16
- as: "a",
17
- href: "#!"
18
- }, "Hello");
19
- };
@@ -1,90 +0,0 @@
1
- /** @jsx jsx */
2
-
3
- /**
4
- * External dependencies
5
- */
6
- import { jsx } from 'theme-ui';
7
- /**
8
- * Internal dependencies
9
- */
10
-
11
- import { Card, Heading, Notice, Text } from '..';
12
- export default {
13
- title: 'Notice',
14
- component: Notice
15
- };
16
- export var Default = function Default() {
17
- return jsx(Card, {
18
- sx: {
19
- p: 4
20
- }
21
- }, jsx(Notice, {
22
- variant: "alert",
23
- title: "This is an alert notice",
24
- sx: {
25
- mb: 3
26
- }
27
- }, jsx(Text, {
28
- sx: {
29
- mb: 0
30
- }
31
- }, "It looks like you\u2018re ready to share your application with the world.")), jsx(Notice, {
32
- variant: "info",
33
- title: "This is an info heading",
34
- sx: {
35
- mb: 3
36
- }
37
- }, jsx(Text, {
38
- sx: {
39
- mb: 0
40
- }
41
- }, "It looks like you\u2018re ready to share your application with the world.")), jsx(Notice, {
42
- variant: "success",
43
- title: "This is a success heading",
44
- sx: {
45
- mb: 3
46
- }
47
- }, jsx(Text, {
48
- sx: {
49
- mb: 0
50
- }
51
- }, "It looks like you\u2018re ready to share your application with the world.")), jsx(Notice, {
52
- variant: "warning",
53
- title: "This is a warning heading",
54
- sx: {
55
- mb: 3
56
- }
57
- }, jsx(Text, {
58
- sx: {
59
- mb: 0
60
- }
61
- }, "It looks like you\u2018re ready to share your application with the world.")), jsx(Notice, {
62
- inline: true,
63
- variant: "alert",
64
- title: "This is an inline notice",
65
- sx: {
66
- mb: 3
67
- }
68
- }), jsx(Notice, {
69
- inline: true,
70
- variant: "info",
71
- title: "This is an inline notice",
72
- sx: {
73
- mb: 3
74
- }
75
- }), jsx(Notice, {
76
- inline: true,
77
- variant: "success",
78
- title: "This is an inline notice",
79
- sx: {
80
- mb: 3
81
- }
82
- }), jsx(Notice, {
83
- inline: true,
84
- variant: "warning",
85
- title: "This is an inline notice",
86
- sx: {
87
- mb: 3
88
- }
89
- }));
90
- };
@@ -1,19 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Notification } from '..';
10
- export default {
11
- title: 'Notification',
12
- component: Notification
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Notification, {
16
- title: "My first notification",
17
- subTitle: "Use when providing success or error feedback on global action"
18
- });
19
- };
@@ -1,34 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Box, OptionRow } from '..';
10
- export default {
11
- title: 'OptionRow',
12
- component: OptionRow
13
- }; // eslint-disable-next-line max-len
14
-
15
- var image1 = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='79' height='79' viewBox='0 0 79 79' fill='none' %3E%3Cpath d='M71.4 15.3L54.2 4.2C54 4 53.7 4 53.4 4H26.4C26.1 4 25.8 4.1 25.6 4.2L8.29997 15.3C7.89997 15.6 7.59998 16 7.59998 16.5V32.1V63C7.59998 63.5 7.89997 64 8.29997 64.2L25.5 75.3C25.5 75.3 25.6 75.3 25.6 75.4C25.6 75.4 25.7 75.4 25.7 75.5C25.9 75.6 26 75.6 26.2 75.6H53.2C53.4 75.6 53.5 75.6 53.7 75.5C53.8 75.5 53.8 75.5 53.8 75.4C53.8 75.4 53.9 75.4 53.9 75.3L71.4 64.2C71.5 64.1 71.7 64 71.8 63.8C71.8 63.8 71.8 63.7 71.9 63.7C72 63.6 72.1 63.4 72.1 63.2V63.1C72.1 63 72.1 62.9 72.1 62.8V32.1V16.5C72.1 16 71.8 15.6 71.4 15.3ZM24.9 71.4L10.6 62.2V34.8L24.9 44V71.4ZM51.9 72.6H27.8V44.7H51.9V72.6ZM69.1 31.3L52.9 41.7H26.8L10.6 31.3V17.3L26.8 6.9H52.9L69.1 17.3V31.3Z' fill='%23BD9D70' /%3E%3C/svg%3E"; // eslint-disable-next-line max-len
16
-
17
- var image2 = "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";
18
- export var Default = function Default() {
19
- return /*#__PURE__*/React.createElement(Box, {
20
- sx: {
21
- mx: -5
22
- }
23
- }, /*#__PURE__*/React.createElement(OptionRow, {
24
- image: image1,
25
- title: "Option Row",
26
- subTitle: "Mostly used to link off to other pages.",
27
- as: "a"
28
- }), /*#__PURE__*/React.createElement(OptionRow, {
29
- image: image2,
30
- title: "Option Row",
31
- subTitle: "Mostly used to link off to other pages.",
32
- as: "a"
33
- }));
34
- };
@@ -1,21 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Progress } from '..';
10
- export default {
11
- title: 'Progress',
12
- component: Progress
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Progress, {
16
- max: 1,
17
- value: 1 / 2,
18
- steps: ['Downloading Data', 'Importing Data...', 'Finalizing'],
19
- activeStep: 1
20
- });
21
- };
@@ -1,16 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Spinner } from '..';
10
- export default {
11
- title: 'Spinner',
12
- component: Spinner
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Spinner, null);
16
- };
@@ -1,50 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Table, TableRow, Flex, Heading, Text } from '..';
10
- export default {
11
- title: 'Table',
12
- component: Table
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Table, null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement(TableRow, {
16
- head: true,
17
- cells: ['User', 'Command', 'Duration', 'Time']
18
- })), /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement(TableRow, {
19
- cells: [/*#__PURE__*/React.createElement(Flex, {
20
- sx: {
21
- alignItems: 'center'
22
- },
23
- key: "user"
24
- }, /*#__PURE__*/React.createElement(Heading, {
25
- variant: "h4",
26
- sx: {
27
- mb: 0
28
- }
29
- }, "kwaves")), /*#__PURE__*/React.createElement(Heading, {
30
- variant: "h4",
31
- key: "command",
32
- sx: {
33
- mb: 0,
34
- display: 'flex',
35
- alignItems: 'center'
36
- }
37
- }, "wp rewrite flush"), /*#__PURE__*/React.createElement(Text, {
38
- sx: {
39
- mb: 0
40
- },
41
- key: "duration"
42
- }, "2s"), /*#__PURE__*/React.createElement(Text, {
43
- sx: {
44
- mb: 0,
45
- color: 'muted'
46
- },
47
- key: "time"
48
- }, "11th Mar 2020, 16:49:22")]
49
- })));
50
- };
@@ -1,18 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Tabs, TabItem } from '..';
10
- export default {
11
- title: 'Tabs',
12
- component: Tabs
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Tabs, null, /*#__PURE__*/React.createElement(TabItem, {
16
- active: true
17
- }, "All (5)"), /*#__PURE__*/React.createElement(TabItem, null, "Live (2)"), /*#__PURE__*/React.createElement(TabItem, null, "In Development (3)"));
18
- };
@@ -1,16 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Text } from '..';
10
- export default {
11
- title: 'Text',
12
- component: Text
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Text, null, "Apparently we had reached a great height in the atmosphere, for the sky was a dead black, and the stars had ceased to twinkle. By the same illusion which lifts the horizon of the sea to the level of the spectator on a hillside, the sable cloud beneath was dished out, and the car seemed to float in the middle of an immense dark sphere, whose upper half was strewn with silver.", ' ');
16
- };
@@ -1,29 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Timeline, Grid, Box } from '..';
10
- export default {
11
- title: 'Timeline',
12
- component: Timeline
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Grid, {
16
- gap: 2,
17
- columns: [2, '100px 300px'],
18
- sx: {
19
- mb: '20px'
20
- }
21
- }, /*#__PURE__*/React.createElement(Timeline, {
22
- time: "7pm"
23
- }), /*#__PURE__*/React.createElement(Box, null, "It looks like everything is recovered now. You can forget about the last event.")), /*#__PURE__*/React.createElement(Grid, {
24
- gap: 2,
25
- columns: [2, '100px 200px']
26
- }, /*#__PURE__*/React.createElement(Timeline, {
27
- time: "6pm"
28
- }), /*#__PURE__*/React.createElement(Box, null, "At this particular moment in the day, something happened with your environment.")));
29
- };
@@ -1,29 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Flex, Heading, Tooltip, Text, Link } from '..';
10
- export default {
11
- title: 'Tooltip',
12
- component: Tooltip
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(Flex, {
16
- sx: {
17
- alignItems: 'center'
18
- }
19
- }, /*#__PURE__*/React.createElement(Heading, {
20
- sx: {
21
- mb: 0,
22
- mr: 2
23
- }
24
- }, "My Section Heading"), /*#__PURE__*/React.createElement(Tooltip, null, /*#__PURE__*/React.createElement(Text, {
25
- sx: {
26
- fontSize: 1
27
- }
28
- }, "This is a tooltip that can be used to describe various pieces of functionality.", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Link, null, "Find out more \u2192"))));
29
- };
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.UsageChart = void 0;
5
-
6
- var _framerMotion = require("framer-motion");
7
-
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
-
10
- var _jsxRuntime = require("theme-ui/jsx-runtime");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- /**
15
- * External dependencies
16
- */
17
- var UsageChart = function UsageChart(_ref) {
18
- var total = _ref.total,
19
- max = _ref.max,
20
- _ref$variant = _ref.variant,
21
- variant = _ref$variant === void 0 ? 'primary' : _ref$variant;
22
- var width = total / max * 100 + '%';
23
- var formattedTotal = total;
24
-
25
- if (total > 1000000) {
26
- formattedTotal = (total / 1000000).toFixed(2) + "M";
27
- } else if (total > 1000) {
28
- formattedTotal = (total / 1000).toFixed(2) + "K";
29
- }
30
-
31
- return (0, _jsxRuntime.jsx)("div", {
32
- sx: {
33
- height: variant === 'primary' ? 32 : 8,
34
- overflow: 'hidden',
35
- backgroundColor: variant === 'primary' ? 'border' : 'transparent'
36
- },
37
- children: (0, _jsxRuntime.jsx)(_framerMotion.motion.div, {
38
- initial: {
39
- width: 0
40
- },
41
- animate: {
42
- width: width
43
- },
44
- transition: {
45
- duration: 0.7
46
- },
47
- sx: {
48
- height: '100%',
49
- backgroundColor: variant === 'primary' ? 'primary' : 'grey.40'
50
- }
51
- })
52
- });
53
- };
54
-
55
- exports.UsageChart = UsageChart;
56
- UsageChart.propTypes = {
57
- total: _propTypes["default"].number,
58
- max: _propTypes["default"].number,
59
- variant: _propTypes["default"].string
60
- };
@@ -1,20 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { UsageChart } from '..';
10
- export default {
11
- title: 'UsageChart',
12
- component: UsageChart
13
- };
14
- export var Default = function Default() {
15
- return /*#__PURE__*/React.createElement(UsageChart, {
16
- total: 50,
17
- max: 75,
18
- variant: "primary"
19
- });
20
- };
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
-
5
- var _UsageChart = require("./UsageChart");
6
-
7
- exports.UsageChart = _UsageChart.UsageChart;
@@ -1,55 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { Wizard, Flex, Box, Heading, Label, Input, Button } from '..';
10
- export default {
11
- title: 'Wizard',
12
- component: Wizard
13
- };
14
- export var Default = function Default() {
15
- var steps = [{
16
- title: 'Choose Domain',
17
- subTitle: 'You can bring a domain name you already own, or buy a new one.',
18
- children: /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Label, null, "Domain"), /*#__PURE__*/React.createElement(Input, {
19
- autoFocus: true,
20
- placeholder: "yourdomain.com"
21
- }), /*#__PURE__*/React.createElement(Button, null, "Continue"))
22
- }, {
23
- title: 'Configure DNS'
24
- }, {
25
- title: 'Configure Certificate'
26
- }, {
27
- title: 'Verify Domain'
28
- }];
29
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Flex, {
30
- sx: {
31
- alignItems: 'center'
32
- }
33
- }, /*#__PURE__*/React.createElement(Box, {
34
- sx: {
35
- flex: '1 1 auto'
36
- }
37
- }, /*#__PURE__*/React.createElement(Heading, {
38
- variant: "h1",
39
- sx: {
40
- display: 'flex',
41
- alignItems: 'center',
42
- mb: 1
43
- }
44
- }, "Add Domain:", ' ', /*#__PURE__*/React.createElement("span", {
45
- sx: {
46
- color: 'muted',
47
- ml: 2
48
- }
49
- }, "Production")))), /*#__PURE__*/React.createElement(Box, {
50
- mt: 4
51
- }, /*#__PURE__*/React.createElement(Wizard, {
52
- activeStep: 0,
53
- steps: steps
54
- })));
55
- };