@automattic/vip-design-system 2.12.3 → 2.12.5

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.
@@ -1,4 +1,4 @@
1
- export function NewConfirmationDialog({ trigger, onConfirm, needsConfirm, label, buttonVariant, title, body, ...props }: {
1
+ export function NewConfirmationDialog({ trigger, onConfirm, needsConfirm, label, buttonVariant, title, body, buttonDisabled, ...props }: {
2
2
  [x: string]: any;
3
3
  trigger: any;
4
4
  onConfirm: any;
@@ -7,6 +7,7 @@ export function NewConfirmationDialog({ trigger, onConfirm, needsConfirm, label,
7
7
  buttonVariant: any;
8
8
  title: any;
9
9
  body?: string | undefined;
10
+ buttonDisabled?: boolean | undefined;
10
11
  }): React.JSX.Element;
11
12
  export namespace NewConfirmationDialog {
12
13
  namespace propTypes {
@@ -17,6 +18,7 @@ export namespace NewConfirmationDialog {
17
18
  let body: PropTypes.Requireable<PropTypes.ReactNodeLike>;
18
19
  let label: PropTypes.Requireable<PropTypes.ReactNodeLike>;
19
20
  let buttonVariant: PropTypes.Requireable<string>;
21
+ let buttonDisabled: PropTypes.Requireable<boolean>;
20
22
  }
21
23
  }
22
24
  import React from 'react';
@@ -59,6 +59,7 @@ const NewConfirmationDialog = ( {
59
59
  buttonVariant,
60
60
  title,
61
61
  body = '',
62
+ buttonDisabled = false,
62
63
  ...props
63
64
  } ) => {
64
65
  const directTrigger = React.cloneElement( trigger, { onClick: onConfirm } );
@@ -79,6 +80,7 @@ const NewConfirmationDialog = ( {
79
80
  body={ body }
80
81
  label={ label }
81
82
  buttonVariant={ buttonVariant }
83
+ buttonDisabled={ buttonDisabled }
82
84
  />
83
85
  ) }
84
86
  trigger={ trigger }
@@ -95,6 +97,7 @@ NewConfirmationDialog.propTypes = {
95
97
  body: PropTypes.node,
96
98
  label: PropTypes.node,
97
99
  buttonVariant: PropTypes.string,
100
+ buttonDisabled: PropTypes.bool,
98
101
  };
99
102
 
100
103
  export { NewConfirmationDialog };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ /// <reference types="react" />
5
+ export interface SkeletonProps {
6
+ variant?: string;
7
+ width?: number | string;
8
+ height?: number | string;
9
+ borderRadius?: number;
10
+ }
11
+ export declare const Skeleton: {
12
+ ({ variant, width, height, borderRadius, times, ...props }: {
13
+ [x: string]: any;
14
+ variant?: string | undefined;
15
+ width?: string | undefined;
16
+ height?: string | undefined;
17
+ borderRadius?: number | undefined;
18
+ times?: number | undefined;
19
+ }): import("react").JSX.Element;
20
+ displayName: string;
21
+ };
22
+ export default Skeleton;
@@ -0,0 +1,56 @@
1
+ var _excluded = ["variant", "width", "height", "borderRadius", "times"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
3
+ 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; }
4
+ /**
5
+ * External dependencies
6
+ */
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { Box } from '../Box';
12
+ import { jsx as _jsx } from "theme-ui/jsx-runtime";
13
+ import { Fragment as _Fragment } from "theme-ui/jsx-runtime";
14
+ export var Skeleton = function Skeleton(_ref) {
15
+ var _ref$variant = _ref.variant,
16
+ variant = _ref$variant === void 0 ? 'text' : _ref$variant,
17
+ _ref$width = _ref.width,
18
+ width = _ref$width === void 0 ? '100%' : _ref$width,
19
+ _ref$height = _ref.height,
20
+ height = _ref$height === void 0 ? '30px' : _ref$height,
21
+ _ref$borderRadius = _ref.borderRadius,
22
+ borderRadius = _ref$borderRadius === void 0 ? 1 : _ref$borderRadius,
23
+ _ref$times = _ref.times,
24
+ times = _ref$times === void 0 ? 1 : _ref$times,
25
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
26
+ return _jsx(_Fragment, {
27
+ children: Array.from({
28
+ length: times
29
+ }).map(function (i, index) {
30
+ return _jsx(Box, _extends({
31
+ sx: {
32
+ borderRadius: variant === 'circle' ? '50%' : borderRadius,
33
+ width: width,
34
+ height: height,
35
+ backgroundColor: 'skeleton.background',
36
+ animation: 'pulse 1.5s ease-in-out infinite',
37
+ '@keyframes pulse': {
38
+ '0%': {
39
+ opacity: 0.1
40
+ },
41
+ '50%': {
42
+ opacity: 0.2
43
+ },
44
+ '100%': {
45
+ opacity: 0.1
46
+ }
47
+ },
48
+ mb: index === times - 1 ? 0 : 4
49
+ },
50
+ "aria-hidden": true
51
+ }, props), index);
52
+ })
53
+ });
54
+ };
55
+ Skeleton.displayName = 'Skeleton';
56
+ export default Skeleton;
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ declare const _default: {
3
+ title: string;
4
+ component: {
5
+ ({ variant, width, height, borderRadius, times, ...props }: {
6
+ [x: string]: any;
7
+ variant?: string | undefined;
8
+ width?: string | undefined;
9
+ height?: string | undefined;
10
+ borderRadius?: number | undefined;
11
+ times?: number | undefined;
12
+ }): import("react").JSX.Element;
13
+ displayName: string;
14
+ };
15
+ };
16
+ export default _default;
17
+ export declare const Default: () => import("react").JSX.Element;
18
+ export declare const Grouped: () => import("react").JSX.Element;
19
+ export declare const Circle: () => import("react").JSX.Element;
20
+ export declare const Text: () => import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { Skeleton } from '..';
5
+ import { jsx as _jsx } from "theme-ui/jsx-runtime";
6
+ export default {
7
+ title: 'Skeleton',
8
+ component: Skeleton
9
+ };
10
+ export var Default = function Default() {
11
+ return _jsx(Skeleton, {});
12
+ };
13
+ export var Grouped = function Grouped() {
14
+ return _jsx(Skeleton, {
15
+ times: 3
16
+ });
17
+ };
18
+ export var Circle = function Circle() {
19
+ return _jsx(Skeleton, {
20
+ variant: "circle",
21
+ width: "50px",
22
+ height: "50px"
23
+ });
24
+ };
25
+ export var Text = function Text() {
26
+ return _jsx(Skeleton, {
27
+ variant: "text"
28
+ });
29
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { Skeleton } from './Skeleton';
5
+ export { Skeleton };
6
+ export default Skeleton;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+
5
+ import { Skeleton } from './Skeleton';
6
+ export { Skeleton };
7
+ export default Skeleton;
@@ -51,6 +51,7 @@ import { Text } from './Text';
51
51
  import { Tabs } from './Tabs';
52
52
  import { Nav } from './Nav/Nav';
53
53
  import { NavItem } from './Nav/NavItem';
54
+ import { Skeleton } from './Skeleton';
54
55
  import { TabsTrigger } from './Tabs';
55
56
  import { TabsContent } from './Tabs';
56
57
  import { TabsList } from './Tabs';
@@ -62,4 +63,4 @@ import { Validation } from './Form';
62
63
  import { Wizard } from './Wizard';
63
64
  import { WizardStep } from './Wizard';
64
65
  import theme from './theme';
65
- export { Accordion, Avatar, Badge, Box, Breadcrumbs, Button, ButtonSubmit, ButtonVariant, Card, Checkbox, Code, Dialog, NewDialog, Form, Drawer, Dropdown, DialogButton, DialogMenu, DialogMenuItem, DialogDivider, DialogContent, DialogTrigger, ConfirmationDialog, MobileMenu, MobileMenuTrigger, MobileMenuWrapper, NewConfirmationDialog, Grid, FilterDropdown, Flex, Notice, OptionRow, Heading, Hr, Input, Label, ScreenReaderText, Spinner, Table, TableRow, TableCell, Tooltip, Link, LinkExternal, Radio, RadioBoxGroup, RadioGroupChip, Textarea, Progress, Text, Tabs, Nav, NavItem, TabsTrigger, TabsContent, TabsList, Toggle, ToggleRow, Toolbar, Snackbar, Validation, Wizard, WizardStep, theme };
66
+ export { Accordion, Avatar, Badge, Box, Breadcrumbs, Button, ButtonSubmit, ButtonVariant, Card, Checkbox, Code, Dialog, NewDialog, Form, Drawer, Dropdown, DialogButton, DialogMenu, DialogMenuItem, DialogDivider, DialogContent, DialogTrigger, ConfirmationDialog, MobileMenu, MobileMenuTrigger, MobileMenuWrapper, NewConfirmationDialog, Grid, FilterDropdown, Flex, Notice, OptionRow, Heading, Hr, Input, Label, ScreenReaderText, Spinner, Table, TableRow, TableCell, Tooltip, Link, LinkExternal, Radio, RadioBoxGroup, RadioGroupChip, Textarea, Progress, Text, Tabs, Nav, NavItem, Skeleton, TabsTrigger, TabsContent, TabsList, Toggle, ToggleRow, Toolbar, Snackbar, Validation, Wizard, WizardStep, theme };
@@ -50,6 +50,7 @@ import { Notice } from './Notice';
50
50
  import { OptionRow } from './OptionRow';
51
51
  import { Progress } from './Progress';
52
52
  import { ScreenReaderText } from './ScreenReaderText';
53
+ import { Skeleton } from './Skeleton';
53
54
  import { Snackbar } from './Snackbar';
54
55
  import { Spinner } from './Spinner';
55
56
  import { Table, TableRow, TableCell } from './Table';
@@ -114,6 +115,7 @@ export {
114
115
  Tabs,
115
116
  Nav,
116
117
  NavItem,
118
+ Skeleton,
117
119
  TabsTrigger,
118
120
  TabsContent,
119
121
  TabsList,
@@ -31,6 +31,9 @@ declare namespace _default {
31
31
  export namespace tag {
32
32
  let gold: {};
33
33
  }
34
+ export namespace skeleton {
35
+ let background: string;
36
+ }
34
37
  export namespace cards {
35
38
  namespace primary {
36
39
  let backgroundColor: string;
@@ -78,6 +78,10 @@ const getComponentColors = ( theme, gColor, gVariants ) => ( {
78
78
  },
79
79
  },
80
80
 
81
+ skeleton: {
82
+ background: theme.layer.inverse,
83
+ },
84
+
81
85
  // Snackbar
82
86
  snackbar: {
83
87
  icon: {
@@ -259,6 +263,10 @@ export default {
259
263
  gold: getVariants( 'tag.gold' ),
260
264
  },
261
265
 
266
+ skeleton: {
267
+ background: 'layer.2',
268
+ },
269
+
262
270
  cards: {
263
271
  primary: {
264
272
  backgroundColor: 'layer.2',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip-design-system",
3
- "version": "2.12.3",
3
+ "version": "2.12.5",
4
4
  "main": "build/system/index.js",
5
5
  "scripts": {
6
6
  "build-storybook": "storybook build",
@@ -59,6 +59,7 @@ const NewConfirmationDialog = ( {
59
59
  buttonVariant,
60
60
  title,
61
61
  body = '',
62
+ buttonDisabled = false,
62
63
  ...props
63
64
  } ) => {
64
65
  const directTrigger = React.cloneElement( trigger, { onClick: onConfirm } );
@@ -79,6 +80,7 @@ const NewConfirmationDialog = ( {
79
80
  body={ body }
80
81
  label={ label }
81
82
  buttonVariant={ buttonVariant }
83
+ buttonDisabled={ buttonDisabled }
82
84
  />
83
85
  ) }
84
86
  trigger={ trigger }
@@ -95,6 +97,7 @@ NewConfirmationDialog.propTypes = {
95
97
  body: PropTypes.node,
96
98
  label: PropTypes.node,
97
99
  buttonVariant: PropTypes.string,
100
+ buttonDisabled: PropTypes.bool,
98
101
  };
99
102
 
100
103
  export { NewConfirmationDialog };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { Skeleton } from '..';
5
+
6
+ export default {
7
+ title: 'Skeleton',
8
+ component: Skeleton,
9
+ };
10
+
11
+ export const Default = () => <Skeleton />;
12
+
13
+ export const Grouped = () => <Skeleton times={ 3 } />;
14
+
15
+ export const Circle = () => <Skeleton variant="circle" width="50px" height="50px" />;
16
+
17
+ export const Text = () => <Skeleton variant="text" />;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import { Box } from '../Box';
9
+
10
+ export interface SkeletonProps {
11
+ variant?: string;
12
+ width?: number | string;
13
+ height?: number | string;
14
+ borderRadius?: number;
15
+ }
16
+
17
+ export const Skeleton = ( {
18
+ variant = 'text',
19
+ width = '100%',
20
+ height = '30px',
21
+ borderRadius = 1,
22
+ times = 1,
23
+ ...props
24
+ } ) => (
25
+ <>
26
+ { Array.from( { length: times } ).map( ( i, index ) => (
27
+ <Box
28
+ key={ index }
29
+ sx={ {
30
+ borderRadius: variant === 'circle' ? '50%' : borderRadius,
31
+ width,
32
+ height,
33
+ backgroundColor: 'skeleton.background',
34
+ animation: 'pulse 1.5s ease-in-out infinite',
35
+ '@keyframes pulse': {
36
+ '0%': {
37
+ opacity: 0.1,
38
+ },
39
+ '50%': {
40
+ opacity: 0.2,
41
+ },
42
+ '100%': {
43
+ opacity: 0.1,
44
+ },
45
+ },
46
+ mb: index === times - 1 ? 0 : 4,
47
+ } }
48
+ aria-hidden
49
+ { ...props }
50
+ ></Box>
51
+ ) ) }
52
+ </>
53
+ );
54
+
55
+ Skeleton.displayName = 'Skeleton';
56
+
57
+ export default Skeleton;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+
5
+ import { Skeleton } from './Skeleton';
6
+
7
+ export { Skeleton };
8
+
9
+ export default Skeleton;
@@ -50,6 +50,7 @@ import { Notice } from './Notice';
50
50
  import { OptionRow } from './OptionRow';
51
51
  import { Progress } from './Progress';
52
52
  import { ScreenReaderText } from './ScreenReaderText';
53
+ import { Skeleton } from './Skeleton';
53
54
  import { Snackbar } from './Snackbar';
54
55
  import { Spinner } from './Spinner';
55
56
  import { Table, TableRow, TableCell } from './Table';
@@ -114,6 +115,7 @@ export {
114
115
  Tabs,
115
116
  Nav,
116
117
  NavItem,
118
+ Skeleton,
117
119
  TabsTrigger,
118
120
  TabsContent,
119
121
  TabsList,
@@ -78,6 +78,10 @@ const getComponentColors = ( theme, gColor, gVariants ) => ( {
78
78
  },
79
79
  },
80
80
 
81
+ skeleton: {
82
+ background: theme.layer.inverse,
83
+ },
84
+
81
85
  // Snackbar
82
86
  snackbar: {
83
87
  icon: {
@@ -259,6 +263,10 @@ export default {
259
263
  gold: getVariants( 'tag.gold' ),
260
264
  },
261
265
 
266
+ skeleton: {
267
+ background: 'layer.2',
268
+ },
269
+
262
270
  cards: {
263
271
  primary: {
264
272
  backgroundColor: 'layer.2',