@automattic/vip-design-system 2.13.2 → 2.13.4
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.
- package/build/system/Accordion/Accordion.stories.js +15 -3
- package/build/system/Form/Toggle.d.ts +2 -1
- package/build/system/Form/Toggle.js +5 -3
- package/build/system/Form/Toggle.stories.d.ts +1 -1
- package/build/system/theme/index.js +4 -0
- package/package.json +1 -1
- package/src/system/Accordion/Accordion.stories.tsx +11 -3
- package/src/system/Form/Toggle.tsx +5 -2
- package/src/system/theme/index.js +4 -0
|
@@ -42,7 +42,11 @@ var ExampleAccordion = function ExampleAccordion() {
|
|
|
42
42
|
children: [_jsxs(Accordion.Item, {
|
|
43
43
|
value: "teamPermissions",
|
|
44
44
|
children: [_jsx(Accordion.TriggerWithIcon, {
|
|
45
|
-
icon: _jsx(RiUserAddLine, {
|
|
45
|
+
icon: _jsx(RiUserAddLine, {
|
|
46
|
+
sx: {
|
|
47
|
+
color: 'support.accent.success'
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
46
50
|
children: "Team & Permissions"
|
|
47
51
|
}), _jsx(Accordion.Content, {
|
|
48
52
|
children: _jsx(ExampleContent, {})
|
|
@@ -50,7 +54,11 @@ var ExampleAccordion = function ExampleAccordion() {
|
|
|
50
54
|
}), _jsxs(Accordion.Item, {
|
|
51
55
|
value: "addContentMedia",
|
|
52
56
|
children: [_jsx(Accordion.TriggerWithIcon, {
|
|
53
|
-
icon: _jsx(BiBookContent, {
|
|
57
|
+
icon: _jsx(BiBookContent, {
|
|
58
|
+
sx: {
|
|
59
|
+
color: 'support.accent.success'
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
54
62
|
children: "Add Content & Media"
|
|
55
63
|
}), _jsx(Accordion.Content, {
|
|
56
64
|
children: _jsx(ExampleContent, {})
|
|
@@ -58,7 +66,11 @@ var ExampleAccordion = function ExampleAccordion() {
|
|
|
58
66
|
}), _jsxs(Accordion.Item, {
|
|
59
67
|
value: "addCode",
|
|
60
68
|
children: [_jsx(Accordion.TriggerWithIcon, {
|
|
61
|
-
icon: _jsx(RiCodeSSlashFill, {
|
|
69
|
+
icon: _jsx(RiCodeSSlashFill, {
|
|
70
|
+
sx: {
|
|
71
|
+
color: 'support.accent.success'
|
|
72
|
+
}
|
|
73
|
+
}),
|
|
62
74
|
children: "Add Code"
|
|
63
75
|
}), _jsx(Accordion.Content, {
|
|
64
76
|
children: _jsx(ExampleContent, {})
|
|
@@ -7,8 +7,9 @@ export type ToggleProps = Switch.SwitchProps & {
|
|
|
7
7
|
className?: Argument;
|
|
8
8
|
onChange?: () => void;
|
|
9
9
|
variant?: string;
|
|
10
|
+
disabled?: boolean;
|
|
10
11
|
};
|
|
11
12
|
export declare const Toggle: {
|
|
12
|
-
({ name, onChange, className, variant, ...rest }: ToggleProps): import("react").JSX.Element;
|
|
13
|
+
({ name, onChange, className, variant, disabled, ...rest }: ToggleProps): import("react").JSX.Element;
|
|
13
14
|
displayName: string;
|
|
14
15
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["name", "onChange", "className", "variant"];
|
|
1
|
+
var _excluded = ["name", "onChange", "className", "variant", "disabled"];
|
|
2
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
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
4
|
/* eslint-disable max-len */
|
|
@@ -17,12 +17,13 @@ export var Toggle = function Toggle(_ref) {
|
|
|
17
17
|
className = _ref.className,
|
|
18
18
|
_ref$variant = _ref.variant,
|
|
19
19
|
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
20
|
+
disabled = _ref.disabled,
|
|
20
21
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21
22
|
return _jsx(Switch.Root, _extends({
|
|
22
23
|
className: classNames('vip-toggle-component', className),
|
|
23
24
|
sx: {
|
|
24
25
|
all: 'unset',
|
|
25
|
-
cursor: 'pointer',
|
|
26
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
26
27
|
position: 'relative',
|
|
27
28
|
width: 40,
|
|
28
29
|
height: 20,
|
|
@@ -36,8 +37,9 @@ export var Toggle = function Toggle(_ref) {
|
|
|
36
37
|
return theme.outline;
|
|
37
38
|
},
|
|
38
39
|
'&[disabled]': {
|
|
39
|
-
opacity: 0.
|
|
40
|
+
opacity: 0.5
|
|
40
41
|
},
|
|
42
|
+
opacity: disabled ? 0.5 : 1,
|
|
41
43
|
'&[data-state="checked"]': {
|
|
42
44
|
backgroundColor: variant,
|
|
43
45
|
backgroundPosition: 'left 2px top 2px',
|
|
@@ -5,7 +5,7 @@ import { Toggle } from '..';
|
|
|
5
5
|
declare const _default: {
|
|
6
6
|
title: string;
|
|
7
7
|
component: {
|
|
8
|
-
({ name, onChange, className, variant, ...rest }: import("./Toggle").ToggleProps): import("react").JSX.Element;
|
|
8
|
+
({ name, onChange, className, variant, disabled, ...rest }: import("./Toggle").ToggleProps): import("react").JSX.Element;
|
|
9
9
|
displayName: string;
|
|
10
10
|
};
|
|
11
11
|
argTypes: {
|
package/package.json
CHANGED
|
@@ -27,7 +27,9 @@ const ExampleContent = () => (
|
|
|
27
27
|
const ExampleAccordion = () => (
|
|
28
28
|
<Accordion.Root defaultValue="teamPermissions" sx={ { width: '250px' } }>
|
|
29
29
|
<Accordion.Item value="teamPermissions">
|
|
30
|
-
<Accordion.TriggerWithIcon
|
|
30
|
+
<Accordion.TriggerWithIcon
|
|
31
|
+
icon={ <RiUserAddLine sx={ { color: 'support.accent.success' } } /> }
|
|
32
|
+
>
|
|
31
33
|
Team & Permissions
|
|
32
34
|
</Accordion.TriggerWithIcon>
|
|
33
35
|
<Accordion.Content>
|
|
@@ -35,7 +37,9 @@ const ExampleAccordion = () => (
|
|
|
35
37
|
</Accordion.Content>
|
|
36
38
|
</Accordion.Item>
|
|
37
39
|
<Accordion.Item value="addContentMedia">
|
|
38
|
-
<Accordion.TriggerWithIcon
|
|
40
|
+
<Accordion.TriggerWithIcon
|
|
41
|
+
icon={ <BiBookContent sx={ { color: 'support.accent.success' } } /> }
|
|
42
|
+
>
|
|
39
43
|
Add Content & Media
|
|
40
44
|
</Accordion.TriggerWithIcon>
|
|
41
45
|
<Accordion.Content>
|
|
@@ -43,7 +47,11 @@ const ExampleAccordion = () => (
|
|
|
43
47
|
</Accordion.Content>
|
|
44
48
|
</Accordion.Item>
|
|
45
49
|
<Accordion.Item value="addCode">
|
|
46
|
-
<Accordion.TriggerWithIcon
|
|
50
|
+
<Accordion.TriggerWithIcon
|
|
51
|
+
icon={ <RiCodeSSlashFill sx={ { color: 'support.accent.success' } } /> }
|
|
52
|
+
>
|
|
53
|
+
Add Code
|
|
54
|
+
</Accordion.TriggerWithIcon>
|
|
47
55
|
<Accordion.Content>
|
|
48
56
|
<ExampleContent />
|
|
49
57
|
</Accordion.Content>
|
|
@@ -17,6 +17,7 @@ export type ToggleProps = Switch.SwitchProps & {
|
|
|
17
17
|
className?: Argument;
|
|
18
18
|
onChange?: () => void;
|
|
19
19
|
variant?: string;
|
|
20
|
+
disabled?: boolean;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export const Toggle = ( {
|
|
@@ -24,13 +25,14 @@ export const Toggle = ( {
|
|
|
24
25
|
onChange,
|
|
25
26
|
className,
|
|
26
27
|
variant = 'primary',
|
|
28
|
+
disabled,
|
|
27
29
|
...rest
|
|
28
30
|
}: ToggleProps ) => (
|
|
29
31
|
<Switch.Root
|
|
30
32
|
className={ classNames( 'vip-toggle-component', className ) }
|
|
31
33
|
sx={ {
|
|
32
34
|
all: 'unset',
|
|
33
|
-
cursor: 'pointer',
|
|
35
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
34
36
|
position: 'relative',
|
|
35
37
|
width: 40,
|
|
36
38
|
height: 20,
|
|
@@ -44,8 +46,9 @@ export const Toggle = ( {
|
|
|
44
46
|
|
|
45
47
|
'&:focus-visible': ( theme: ThemeProps ) => theme.outline,
|
|
46
48
|
'&[disabled]': {
|
|
47
|
-
opacity: 0.
|
|
49
|
+
opacity: 0.5,
|
|
48
50
|
},
|
|
51
|
+
opacity: disabled ? 0.5 : 1,
|
|
49
52
|
'&[data-state="checked"]': {
|
|
50
53
|
backgroundColor: variant,
|
|
51
54
|
backgroundPosition: 'left 2px top 2px',
|