@automattic/vip-design-system 2.0.0 → 2.1.0
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/Form/Checkbox/Checkbox.d.ts +1 -1
- package/build/system/Form/Checkbox/Checkbox.stories.js +2 -26
- package/build/system/Form/Checkbox/styles.js +6 -0
- package/build/system/Form/Radio/Radio.d.ts +1 -1
- package/build/system/Form/Radio/Radio.stories.js +3 -3
- package/build/system/Form/Radio/styles.js +18 -12
- package/build/system/Form/RadioBoxGroup.js +1 -0
- package/build/system/theme/colors.js +0 -1
- package/package.json +1 -1
- package/src/system/Form/Checkbox/Checkbox.stories.tsx +9 -40
- package/src/system/Form/Checkbox/Checkbox.tsx +1 -1
- package/src/system/Form/Checkbox/styles.ts +7 -0
- package/src/system/Form/Radio/Radio.stories.tsx +28 -32
- package/src/system/Form/Radio/Radio.tsx +1 -1
- package/src/system/Form/Radio/styles.ts +14 -8
- package/src/system/Form/RadioBoxGroup.js +1 -0
- package/src/system/theme/colors.js +0 -1
- package/tokens/utilities/colors/package-lock.json +6 -6
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
4
4
|
export interface CheckboxProps extends CheckboxPrimitive.CheckboxProps {
|
|
5
5
|
disabled?: boolean;
|
|
6
|
-
variant?: 'primary' | 'success' | '
|
|
6
|
+
variant?: 'primary' | 'success' | 'brand' | 'disabled';
|
|
7
7
|
}
|
|
8
8
|
declare const Checkbox: ({ disabled, onCheckedChange, variant, ...props }: CheckboxProps) => import("react").JSX.Element;
|
|
9
9
|
export { Checkbox };
|
|
@@ -33,7 +33,7 @@ var Default = exports.Default = function Default() {
|
|
|
33
33
|
checked2 = _useState2[0],
|
|
34
34
|
setChecked2 = _useState2[1];
|
|
35
35
|
return (0, _jsxRuntime.jsxs)(_.Form.Root, {
|
|
36
|
-
children: [['primary', 'success', '
|
|
36
|
+
children: [['primary', 'success', 'brand'].map(function (variant) {
|
|
37
37
|
return (0, _jsxRuntime.jsxs)(_.Form.Fieldset, {
|
|
38
38
|
children: [(0, _jsxRuntime.jsxs)(_.Form.Legend, {
|
|
39
39
|
children: ["Tell me your ", variant, " prefereces"]
|
|
@@ -49,10 +49,6 @@ var Default = exports.Default = function Default() {
|
|
|
49
49
|
onCheckedChange: setChecked
|
|
50
50
|
}), (0, _jsxRuntime.jsx)(_Label.Label, {
|
|
51
51
|
clickable: true,
|
|
52
|
-
sx: {
|
|
53
|
-
m: 0,
|
|
54
|
-
ml: 2
|
|
55
|
-
},
|
|
56
52
|
htmlFor: "check1-" + variant,
|
|
57
53
|
id: "label-check1-" + variant,
|
|
58
54
|
children: "This option"
|
|
@@ -69,10 +65,6 @@ var Default = exports.Default = function Default() {
|
|
|
69
65
|
onCheckedChange: setChecked2
|
|
70
66
|
}), (0, _jsxRuntime.jsx)(_Label.Label, {
|
|
71
67
|
clickable: true,
|
|
72
|
-
sx: {
|
|
73
|
-
m: 0,
|
|
74
|
-
ml: 2
|
|
75
|
-
},
|
|
76
68
|
htmlFor: "check2-" + variant,
|
|
77
69
|
id: "label-check2-" + variant,
|
|
78
70
|
children: "This option too"
|
|
@@ -95,10 +87,6 @@ var Default = exports.Default = function Default() {
|
|
|
95
87
|
onCheckedChange: setChecked
|
|
96
88
|
}), (0, _jsxRuntime.jsx)(_Label.Label, {
|
|
97
89
|
clickable: true,
|
|
98
|
-
sx: {
|
|
99
|
-
m: 0,
|
|
100
|
-
ml: 2
|
|
101
|
-
},
|
|
102
90
|
htmlFor: "check1-disabled",
|
|
103
91
|
id: "label-check1-disabled",
|
|
104
92
|
children: "This option"
|
|
@@ -115,10 +103,6 @@ var Default = exports.Default = function Default() {
|
|
|
115
103
|
onCheckedChange: setChecked2
|
|
116
104
|
}), (0, _jsxRuntime.jsx)(_Label.Label, {
|
|
117
105
|
clickable: true,
|
|
118
|
-
sx: {
|
|
119
|
-
m: 0,
|
|
120
|
-
ml: 2
|
|
121
|
-
},
|
|
122
106
|
htmlFor: "check2-disabled",
|
|
123
107
|
id: "label-check2-disabled",
|
|
124
108
|
children: "This option too"
|
|
@@ -136,7 +120,7 @@ var Indeterminate = exports.Indeterminate = function Indeterminate() {
|
|
|
136
120
|
}
|
|
137
121
|
}, [checkRef]);
|
|
138
122
|
return (0, _jsxRuntime.jsxs)(_.Form.Root, {
|
|
139
|
-
children: [['primary', 'success', '
|
|
123
|
+
children: [['primary', 'success', 'brand'].map(function (variant) {
|
|
140
124
|
return (0, _jsxRuntime.jsxs)(_.Form.Fieldset, {
|
|
141
125
|
children: [(0, _jsxRuntime.jsxs)(_.Form.Legend, {
|
|
142
126
|
children: ["Indeterminate state ", variant]
|
|
@@ -150,10 +134,6 @@ var Indeterminate = exports.Indeterminate = function Indeterminate() {
|
|
|
150
134
|
"aria-labelledby": "label-check1-" + variant,
|
|
151
135
|
checked: 'indeterminate'
|
|
152
136
|
}), (0, _jsxRuntime.jsx)(_Label.Label, {
|
|
153
|
-
sx: {
|
|
154
|
-
m: 0,
|
|
155
|
-
ml: 2
|
|
156
|
-
},
|
|
157
137
|
htmlFor: "check1-" + variant,
|
|
158
138
|
id: "label-check1-" + variant,
|
|
159
139
|
children: "This option"
|
|
@@ -173,10 +153,6 @@ var Indeterminate = exports.Indeterminate = function Indeterminate() {
|
|
|
173
153
|
"aria-labelledby": "label-check1-disabled",
|
|
174
154
|
checked: 'indeterminate'
|
|
175
155
|
}), (0, _jsxRuntime.jsx)(_Label.Label, {
|
|
176
|
-
sx: {
|
|
177
|
-
m: 0,
|
|
178
|
-
ml: 2
|
|
179
|
-
},
|
|
180
156
|
htmlFor: "check1-disabled",
|
|
181
157
|
id: "label-check1-disabled",
|
|
182
158
|
children: "This option"
|
|
@@ -27,6 +27,12 @@ var checkboxStyle = exports.checkboxStyle = function checkboxStyle(variant) {
|
|
|
27
27
|
color: variant,
|
|
28
28
|
borderColor: variant
|
|
29
29
|
},
|
|
30
|
+
'& ~ label': {
|
|
31
|
+
fontWeight: 'regular',
|
|
32
|
+
color: _Input.inputBaseText,
|
|
33
|
+
m: 0,
|
|
34
|
+
ml: 2
|
|
35
|
+
},
|
|
30
36
|
svg: {
|
|
31
37
|
position: 'absolute',
|
|
32
38
|
top: 0,
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { RadioOptionOptionProps } from './RadioOption';
|
|
4
4
|
export declare const VIP_RADIO = "vip-radio-component";
|
|
5
5
|
export type RadioProps = {
|
|
6
|
-
variant?: 'primary' | 'success' | '
|
|
6
|
+
variant?: 'primary' | 'success' | 'brand' | 'disabled';
|
|
7
7
|
disabled?: boolean | undefined;
|
|
8
8
|
defaultValue?: string | number;
|
|
9
9
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>, option?: RadioOptionOptionProps) => void;
|
|
@@ -32,7 +32,7 @@ var Default = exports.Default = function Default() {
|
|
|
32
32
|
setChecked(_extends({}, checked, (_extends2 = {}, _extends2[radioName] = value, _extends2)));
|
|
33
33
|
};
|
|
34
34
|
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
35
|
-
children: [['primary', 'success', '
|
|
35
|
+
children: [['primary', 'success', 'brand'].map(function (variant) {
|
|
36
36
|
return (0, _jsxRuntime.jsxs)(_2.Box, {
|
|
37
37
|
children: [(0, _jsxRuntime.jsx)(_2.Heading, {
|
|
38
38
|
as: "h2",
|
|
@@ -64,7 +64,7 @@ var Default = exports.Default = function Default() {
|
|
|
64
64
|
sx: {
|
|
65
65
|
textTransform: 'capitalize'
|
|
66
66
|
},
|
|
67
|
-
children: "
|
|
67
|
+
children: "disabled"
|
|
68
68
|
}), (0, _jsxRuntime.jsx)(_Radio.Radio, {
|
|
69
69
|
disabled: true,
|
|
70
70
|
name: "the_option_",
|
|
@@ -169,7 +169,7 @@ var AcessibleExamples = exports.AcessibleExamples = function AcessibleExamples()
|
|
|
169
169
|
fontSize: 2,
|
|
170
170
|
fontWeight: 'bold'
|
|
171
171
|
},
|
|
172
|
-
children: "All
|
|
172
|
+
children: "All disabled options"
|
|
173
173
|
}), (0, _jsxRuntime.jsx)(_Flex.Flex, {
|
|
174
174
|
sx: {
|
|
175
175
|
alignItems: 'center'
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.labelStyle = exports.itemStyle = exports.inputStyle = void 0;
|
|
5
|
-
var _ScreenReaderText = require("../../ScreenReaderText/ScreenReaderText");
|
|
6
5
|
var _Input = require("../Input.styles");
|
|
7
|
-
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); }
|
|
8
6
|
// The output willl be 18px because of the 1px border.
|
|
9
7
|
var RADIO_SIZE = 16;
|
|
10
8
|
var inputStyle = exports.inputStyle = function inputStyle(variant) {
|
|
11
|
-
return
|
|
9
|
+
return {
|
|
10
|
+
position: 'absolute',
|
|
11
|
+
top: 0,
|
|
12
|
+
left: 0,
|
|
13
|
+
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
14
|
+
clipPath: 'inset(50%)',
|
|
12
15
|
width: RADIO_SIZE,
|
|
13
16
|
height: RADIO_SIZE,
|
|
14
17
|
'&:focus ~ label:before': {
|
|
@@ -16,7 +19,7 @@ var inputStyle = exports.inputStyle = function inputStyle(variant) {
|
|
|
16
19
|
content: '""',
|
|
17
20
|
border: '1px solid',
|
|
18
21
|
borderColor: _Input.baseControlBorderStyle.borderColor,
|
|
19
|
-
left:
|
|
22
|
+
left: 0
|
|
20
23
|
},
|
|
21
24
|
'&:checked ~ label::after': {
|
|
22
25
|
borderColor: variant,
|
|
@@ -26,22 +29,20 @@ var inputStyle = exports.inputStyle = function inputStyle(variant) {
|
|
|
26
29
|
backgroundColor: variant,
|
|
27
30
|
borderColor: variant
|
|
28
31
|
}
|
|
29
|
-
}
|
|
32
|
+
};
|
|
30
33
|
};
|
|
31
34
|
var labelStyle = exports.labelStyle = function labelStyle(variant) {
|
|
32
35
|
return {
|
|
36
|
+
display: 'flex',
|
|
33
37
|
cursor: 'pointer',
|
|
34
38
|
position: 'relative',
|
|
35
|
-
marginLeft: 5,
|
|
36
39
|
marginBottom: 0,
|
|
37
40
|
userSelect: 'none',
|
|
38
41
|
color: _Input.inputBaseText,
|
|
39
|
-
|
|
42
|
+
fontWeight: 'regular',
|
|
43
|
+
lineHeight: 'normal',
|
|
40
44
|
'&:before, &:after': {
|
|
41
45
|
borderRadius: '100%',
|
|
42
|
-
position: 'absolute',
|
|
43
|
-
top: 1,
|
|
44
|
-
left: -5,
|
|
45
46
|
transition: 'all .3s ease-out',
|
|
46
47
|
width: RADIO_SIZE,
|
|
47
48
|
height: RADIO_SIZE
|
|
@@ -49,9 +50,13 @@ var labelStyle = exports.labelStyle = function labelStyle(variant) {
|
|
|
49
50
|
'&::before': {
|
|
50
51
|
content: '""',
|
|
51
52
|
border: '1px solid',
|
|
52
|
-
borderColor: _Input.baseControlBorderStyle.borderColor
|
|
53
|
+
borderColor: _Input.baseControlBorderStyle.borderColor,
|
|
54
|
+
marginRight: 2
|
|
53
55
|
},
|
|
54
56
|
'&::after': {
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
top: 0,
|
|
59
|
+
left: 0,
|
|
55
60
|
content: '""',
|
|
56
61
|
backgroundColor: variant,
|
|
57
62
|
backgroundSize: '100%',
|
|
@@ -66,5 +71,6 @@ var labelStyle = exports.labelStyle = function labelStyle(variant) {
|
|
|
66
71
|
var itemStyle = exports.itemStyle = {
|
|
67
72
|
display: 'flex',
|
|
68
73
|
alignItems: 'center',
|
|
69
|
-
my: 2
|
|
74
|
+
my: 2,
|
|
75
|
+
position: 'relative'
|
|
70
76
|
};
|
package/package.json
CHANGED
|
@@ -61,9 +61,7 @@ export const Default = () => {
|
|
|
61
61
|
|
|
62
62
|
return (
|
|
63
63
|
<Form.Root>
|
|
64
|
-
{ (
|
|
65
|
-
[ 'primary', 'success', 'error', 'warning', 'info' ] as CheckboxProps[ 'variant' ][]
|
|
66
|
-
).map( variant => (
|
|
64
|
+
{ ( [ 'primary', 'success', 'brand' ] as CheckboxProps[ 'variant' ][] ).map( variant => (
|
|
67
65
|
<Form.Fieldset key={ variant }>
|
|
68
66
|
<Form.Legend>Tell me your { variant } prefereces</Form.Legend>
|
|
69
67
|
|
|
@@ -75,12 +73,7 @@ export const Default = () => {
|
|
|
75
73
|
aria-labelledby={ `label-check1-${ variant }` }
|
|
76
74
|
onCheckedChange={ setChecked }
|
|
77
75
|
/>
|
|
78
|
-
<Label
|
|
79
|
-
clickable
|
|
80
|
-
sx={ { m: 0, ml: 2 } }
|
|
81
|
-
htmlFor={ `check1-${ variant }` }
|
|
82
|
-
id={ `label-check1-${ variant }` }
|
|
83
|
-
>
|
|
76
|
+
<Label clickable htmlFor={ `check1-${ variant }` } id={ `label-check1-${ variant }` }>
|
|
84
77
|
This option
|
|
85
78
|
</Label>
|
|
86
79
|
</Flex>
|
|
@@ -93,12 +86,7 @@ export const Default = () => {
|
|
|
93
86
|
aria-labelledby={ `label-check2-${ variant }` }
|
|
94
87
|
onCheckedChange={ setChecked2 }
|
|
95
88
|
/>
|
|
96
|
-
<Label
|
|
97
|
-
clickable
|
|
98
|
-
sx={ { m: 0, ml: 2 } }
|
|
99
|
-
htmlFor={ `check2-${ variant }` }
|
|
100
|
-
id={ `label-check2-${ variant }` }
|
|
101
|
-
>
|
|
89
|
+
<Label clickable htmlFor={ `check2-${ variant }` } id={ `label-check2-${ variant }` }>
|
|
102
90
|
This option too
|
|
103
91
|
</Label>
|
|
104
92
|
</Flex>
|
|
@@ -117,12 +105,7 @@ export const Default = () => {
|
|
|
117
105
|
aria-labelledby={ `label-check1-disabled` }
|
|
118
106
|
onCheckedChange={ setChecked }
|
|
119
107
|
/>
|
|
120
|
-
<Label
|
|
121
|
-
clickable
|
|
122
|
-
sx={ { m: 0, ml: 2 } }
|
|
123
|
-
htmlFor={ `check1-disabled` }
|
|
124
|
-
id={ `label-check1-disabled` }
|
|
125
|
-
>
|
|
108
|
+
<Label clickable htmlFor={ `check1-disabled` } id={ `label-check1-disabled` }>
|
|
126
109
|
This option
|
|
127
110
|
</Label>
|
|
128
111
|
</Flex>
|
|
@@ -135,12 +118,7 @@ export const Default = () => {
|
|
|
135
118
|
aria-labelledby={ `label-check2-disabled` }
|
|
136
119
|
onCheckedChange={ setChecked2 }
|
|
137
120
|
/>
|
|
138
|
-
<Label
|
|
139
|
-
clickable
|
|
140
|
-
sx={ { m: 0, ml: 2 } }
|
|
141
|
-
htmlFor={ `check2-disabled` }
|
|
142
|
-
id={ `label-check2-disabled` }
|
|
143
|
-
>
|
|
121
|
+
<Label clickable htmlFor={ `check2-disabled` } id={ `label-check2-disabled` }>
|
|
144
122
|
This option too
|
|
145
123
|
</Label>
|
|
146
124
|
</Flex>
|
|
@@ -161,9 +139,7 @@ export const Indeterminate = () => {
|
|
|
161
139
|
|
|
162
140
|
return (
|
|
163
141
|
<Form.Root>
|
|
164
|
-
{ (
|
|
165
|
-
[ 'primary', 'success', 'error', 'warning', 'info' ] as CheckboxProps[ 'variant' ][]
|
|
166
|
-
).map( variant => (
|
|
142
|
+
{ ( [ 'primary', 'success', 'brand' ] as CheckboxProps[ 'variant' ][] ).map( variant => (
|
|
167
143
|
<Form.Fieldset key={ variant }>
|
|
168
144
|
<Form.Legend>Indeterminate state { variant }</Form.Legend>
|
|
169
145
|
|
|
@@ -174,11 +150,8 @@ export const Indeterminate = () => {
|
|
|
174
150
|
aria-labelledby={ `label-check1-${ variant }` }
|
|
175
151
|
checked={ 'indeterminate' }
|
|
176
152
|
/>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
htmlFor={ `check1-${ variant }` }
|
|
180
|
-
id={ `label-check1-${ variant }` }
|
|
181
|
-
>
|
|
153
|
+
|
|
154
|
+
<Label htmlFor={ `check1-${ variant }` } id={ `label-check1-${ variant }` }>
|
|
182
155
|
This option
|
|
183
156
|
</Label>
|
|
184
157
|
</Flex>
|
|
@@ -195,11 +168,7 @@ export const Indeterminate = () => {
|
|
|
195
168
|
aria-labelledby={ `label-check1-disabled` }
|
|
196
169
|
checked={ 'indeterminate' }
|
|
197
170
|
/>
|
|
198
|
-
<Label
|
|
199
|
-
sx={ { m: 0, ml: 2 } }
|
|
200
|
-
htmlFor={ `check1-disabled` }
|
|
201
|
-
id={ `label-check1-disabled` }
|
|
202
|
-
>
|
|
171
|
+
<Label htmlFor={ `check1-disabled` } id={ `label-check1-disabled` }>
|
|
203
172
|
This option
|
|
204
173
|
</Label>
|
|
205
174
|
</Flex>
|
|
@@ -7,7 +7,7 @@ import { RadioOptionProps } from '../Radio/RadioOption';
|
|
|
7
7
|
|
|
8
8
|
export interface CheckboxProps extends CheckboxPrimitive.CheckboxProps {
|
|
9
9
|
disabled?: boolean;
|
|
10
|
-
variant?: 'primary' | 'success' | '
|
|
10
|
+
variant?: 'primary' | 'success' | 'brand' | 'disabled';
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const StyledCheckbox = ( { variant = 'primary', ...rest }: CheckboxProps ) => (
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
baseControlBorderStyle,
|
|
5
5
|
baseControlFocusStyle,
|
|
6
6
|
inputBaseBackground,
|
|
7
|
+
inputBaseText,
|
|
7
8
|
} from '../Input.styles';
|
|
8
9
|
|
|
9
10
|
// The output willl be 16px because of the 1px border.
|
|
@@ -30,6 +31,12 @@ export const checkboxStyle = ( variant: string ): ThemeUIStyleObject => ( {
|
|
|
30
31
|
color: variant,
|
|
31
32
|
borderColor: variant,
|
|
32
33
|
},
|
|
34
|
+
'& ~ label': {
|
|
35
|
+
fontWeight: 'regular',
|
|
36
|
+
color: inputBaseText,
|
|
37
|
+
m: 0,
|
|
38
|
+
ml: 2,
|
|
39
|
+
},
|
|
33
40
|
svg: {
|
|
34
41
|
position: 'absolute',
|
|
35
42
|
top: 0,
|
|
@@ -62,39 +62,35 @@ export const Default = () => {
|
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
64
|
<>
|
|
65
|
-
{ ( [ 'primary', 'success', '
|
|
66
|
-
variant
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
/>
|
|
92
|
-
</Box>
|
|
93
|
-
)
|
|
94
|
-
) }
|
|
65
|
+
{ ( [ 'primary', 'success', 'brand' ] as RadioProps[ 'variant' ][] ).map( variant => (
|
|
66
|
+
<Box key={ variant }>
|
|
67
|
+
<Heading as="h2" sx={ { textTransform: 'capitalize' } }>
|
|
68
|
+
{ variant }
|
|
69
|
+
</Heading>
|
|
70
|
+
|
|
71
|
+
<Radio
|
|
72
|
+
variant={ variant }
|
|
73
|
+
onChange={ ( _, option ) => toggleChecked( `the_option_${ variant }`, option?.value ) }
|
|
74
|
+
name={ `the_option_${ variant }` }
|
|
75
|
+
defaultValue={ checked?.[ `the_option_${ variant }` ] || `${ variant }-option-a` }
|
|
76
|
+
options={ [
|
|
77
|
+
{
|
|
78
|
+
id: `${ variant }-option-a`,
|
|
79
|
+
value: `${ variant }-option-a`,
|
|
80
|
+
label: `I am the ${ variant } option A`,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: `${ variant }-option-b`,
|
|
84
|
+
value: `${ variant }-option-b`,
|
|
85
|
+
label: `I am the ${ variant } option B`,
|
|
86
|
+
},
|
|
87
|
+
] }
|
|
88
|
+
/>
|
|
89
|
+
</Box>
|
|
90
|
+
) ) }
|
|
95
91
|
<Box>
|
|
96
92
|
<Heading as="h2" sx={ { textTransform: 'capitalize' } }>
|
|
97
|
-
|
|
93
|
+
disabled
|
|
98
94
|
</Heading>
|
|
99
95
|
|
|
100
96
|
<Radio
|
|
@@ -197,7 +193,7 @@ export const AcessibleExamples = () => {
|
|
|
197
193
|
|
|
198
194
|
<Form.Fieldset>
|
|
199
195
|
<Form.Legend sx={ { mb: 0, fontSize: 2, fontWeight: 'bold' } }>
|
|
200
|
-
All
|
|
196
|
+
All disabled options
|
|
201
197
|
</Form.Legend>
|
|
202
198
|
|
|
203
199
|
<Flex sx={ { alignItems: 'center' } }>
|
|
@@ -8,7 +8,7 @@ import { RadioOption, RadioOptionOptionProps } from './RadioOption';
|
|
|
8
8
|
export const VIP_RADIO = 'vip-radio-component';
|
|
9
9
|
|
|
10
10
|
export type RadioProps = {
|
|
11
|
-
variant?: 'primary' | 'success' | '
|
|
11
|
+
variant?: 'primary' | 'success' | 'brand' | 'disabled';
|
|
12
12
|
disabled?: boolean | undefined;
|
|
13
13
|
defaultValue?: string | number;
|
|
14
14
|
onChange?: ( e: React.ChangeEvent< HTMLInputElement >, option?: RadioOptionOptionProps ) => void;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { ThemeUIStyleObject } from 'theme-ui';
|
|
2
2
|
|
|
3
|
-
import { screenReaderTextClass } from '../../ScreenReaderText/ScreenReaderText';
|
|
4
3
|
import { baseControlBorderStyle, inputBaseText } from '../Input.styles';
|
|
5
4
|
|
|
6
5
|
// The output willl be 18px because of the 1px border.
|
|
7
6
|
const RADIO_SIZE = 16;
|
|
8
7
|
|
|
9
8
|
export const inputStyle = ( variant: string ): ThemeUIStyleObject => ( {
|
|
10
|
-
|
|
9
|
+
position: 'absolute',
|
|
10
|
+
top: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
13
|
+
clipPath: 'inset(50%)',
|
|
11
14
|
width: RADIO_SIZE,
|
|
12
15
|
height: RADIO_SIZE,
|
|
13
16
|
'&:focus ~ label:before': {
|
|
@@ -15,7 +18,7 @@ export const inputStyle = ( variant: string ): ThemeUIStyleObject => ( {
|
|
|
15
18
|
content: '""',
|
|
16
19
|
border: '1px solid',
|
|
17
20
|
borderColor: baseControlBorderStyle.borderColor,
|
|
18
|
-
left:
|
|
21
|
+
left: 0,
|
|
19
22
|
},
|
|
20
23
|
'&:checked ~ label::after': {
|
|
21
24
|
borderColor: variant,
|
|
@@ -28,18 +31,16 @@ export const inputStyle = ( variant: string ): ThemeUIStyleObject => ( {
|
|
|
28
31
|
} );
|
|
29
32
|
|
|
30
33
|
export const labelStyle = ( variant: string ): ThemeUIStyleObject => ( {
|
|
34
|
+
display: 'flex',
|
|
31
35
|
cursor: 'pointer',
|
|
32
36
|
position: 'relative',
|
|
33
|
-
marginLeft: 5,
|
|
34
37
|
marginBottom: 0,
|
|
35
38
|
userSelect: 'none',
|
|
36
39
|
color: inputBaseText,
|
|
37
|
-
|
|
40
|
+
fontWeight: 'regular',
|
|
41
|
+
lineHeight: 'normal',
|
|
38
42
|
'&:before, &:after': {
|
|
39
43
|
borderRadius: '100%',
|
|
40
|
-
position: 'absolute',
|
|
41
|
-
top: 1,
|
|
42
|
-
left: -5,
|
|
43
44
|
transition: 'all .3s ease-out',
|
|
44
45
|
width: RADIO_SIZE,
|
|
45
46
|
height: RADIO_SIZE,
|
|
@@ -48,8 +49,12 @@ export const labelStyle = ( variant: string ): ThemeUIStyleObject => ( {
|
|
|
48
49
|
content: '""',
|
|
49
50
|
border: '1px solid',
|
|
50
51
|
borderColor: baseControlBorderStyle.borderColor,
|
|
52
|
+
marginRight: 2,
|
|
51
53
|
},
|
|
52
54
|
'&::after': {
|
|
55
|
+
position: 'absolute',
|
|
56
|
+
top: 0,
|
|
57
|
+
left: 0,
|
|
53
58
|
content: '""',
|
|
54
59
|
backgroundColor: variant,
|
|
55
60
|
backgroundSize: '100%',
|
|
@@ -65,4 +70,5 @@ export const itemStyle: ThemeUIStyleObject = {
|
|
|
65
70
|
display: 'flex',
|
|
66
71
|
alignItems: 'center',
|
|
67
72
|
my: 2,
|
|
73
|
+
position: 'relative',
|
|
68
74
|
};
|
|
@@ -1506,9 +1506,9 @@
|
|
|
1506
1506
|
}
|
|
1507
1507
|
},
|
|
1508
1508
|
"node_modules/follow-redirects": {
|
|
1509
|
-
"version": "1.15.
|
|
1510
|
-
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.
|
|
1511
|
-
"integrity": "sha512-
|
|
1509
|
+
"version": "1.15.6",
|
|
1510
|
+
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
|
1511
|
+
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
|
|
1512
1512
|
"funding": [
|
|
1513
1513
|
{
|
|
1514
1514
|
"type": "individual",
|
|
@@ -4658,9 +4658,9 @@
|
|
|
4658
4658
|
}
|
|
4659
4659
|
},
|
|
4660
4660
|
"follow-redirects": {
|
|
4661
|
-
"version": "1.15.
|
|
4662
|
-
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.
|
|
4663
|
-
"integrity": "sha512-
|
|
4661
|
+
"version": "1.15.6",
|
|
4662
|
+
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
|
4663
|
+
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
|
|
4664
4664
|
"peer": true
|
|
4665
4665
|
},
|
|
4666
4666
|
"font-atlas": {
|