@cloudflare/component-toggle 6.0.0 → 7.0.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.
- package/CHANGELOG.md +15 -0
- package/dist/Toggle.d.ts +87 -80
- package/es/Toggle.js +5 -4
- package/lib/Toggle.js +5 -4
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 7.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0214229aa1: Add aria-invalid property, show error color in background
|
|
8
|
+
|
|
9
|
+
## 7.0.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [77059b4a95]
|
|
14
|
+
- @cloudflare/style-container@7.10.0
|
|
15
|
+
- @cloudflare/component-icon@9.0.0
|
|
16
|
+
- @cloudflare/elements@3.0.0
|
|
17
|
+
|
|
3
18
|
## 6.0.0
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/Toggle.d.ts
CHANGED
|
@@ -1,32 +1,57 @@
|
|
|
1
1
|
import React, { ComponentProps } from 'react';
|
|
2
2
|
declare const ToggleInput: React.ComponentType<{
|
|
3
|
+
is?: string | undefined;
|
|
4
|
+
name?: string | undefined;
|
|
5
|
+
disabled?: boolean | undefined;
|
|
6
|
+
color?: (string & (string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined])) | undefined;
|
|
7
|
+
capture?: string | boolean | undefined;
|
|
8
|
+
children?: React.ReactNode;
|
|
3
9
|
form?: string | undefined;
|
|
4
10
|
slot?: string | undefined;
|
|
5
11
|
style?: React.CSSProperties | undefined;
|
|
6
12
|
title?: string | undefined;
|
|
7
13
|
pattern?: string | undefined;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
onDrag?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
18
|
-
onDragEnd?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
14
|
+
value?: string | number | readonly string[] | undefined;
|
|
15
|
+
defaultChecked?: boolean | undefined;
|
|
16
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
17
|
+
suppressContentEditableWarning?: boolean | undefined;
|
|
18
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
19
|
+
dangerouslySetInnerHTML?: {
|
|
20
|
+
__html: string;
|
|
21
|
+
} | undefined;
|
|
22
|
+
accessKey?: string | undefined;
|
|
19
23
|
className?: string | undefined;
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
|
|
25
|
+
contextMenu?: string | undefined;
|
|
26
|
+
dir?: string | undefined;
|
|
27
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
28
|
+
id?: string | undefined;
|
|
22
29
|
lang?: string | undefined;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
name?: string | undefined;
|
|
26
|
-
width?: ((string | number) & (import("csstype").WidthProperty<string | number> | [import("csstype").WidthProperty<string | number> | undefined, import("csstype").WidthProperty<string | number> | undefined] | [import("csstype").WidthProperty<string | number> | undefined, import("csstype").WidthProperty<string | number> | undefined, import("csstype").WidthProperty<string | number> | undefined])) | undefined;
|
|
27
|
-
role?: string | undefined;
|
|
30
|
+
placeholder?: string | undefined;
|
|
31
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
28
32
|
tabIndex?: number | undefined;
|
|
29
|
-
|
|
33
|
+
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
34
|
+
radioGroup?: string | undefined;
|
|
35
|
+
role?: string | undefined;
|
|
36
|
+
about?: string | undefined;
|
|
37
|
+
datatype?: string | undefined;
|
|
38
|
+
inlist?: any;
|
|
39
|
+
prefix?: string | undefined;
|
|
40
|
+
property?: string | undefined;
|
|
41
|
+
resource?: string | undefined;
|
|
42
|
+
typeof?: string | undefined;
|
|
43
|
+
vocab?: string | undefined;
|
|
44
|
+
autoCapitalize?: string | undefined;
|
|
45
|
+
autoCorrect?: string | undefined;
|
|
46
|
+
autoSave?: string | undefined;
|
|
47
|
+
itemProp?: string | undefined;
|
|
48
|
+
itemScope?: boolean | undefined;
|
|
49
|
+
itemType?: string | undefined;
|
|
50
|
+
itemID?: string | undefined;
|
|
51
|
+
itemRef?: string | undefined;
|
|
52
|
+
results?: number | undefined;
|
|
53
|
+
security?: string | undefined;
|
|
54
|
+
unselectable?: "on" | "off" | undefined;
|
|
30
55
|
'aria-activedescendant'?: string | undefined;
|
|
31
56
|
'aria-atomic'?: boolean | "true" | "false" | undefined;
|
|
32
57
|
'aria-autocomplete'?: "none" | "list" | "both" | "inline" | undefined;
|
|
@@ -45,7 +70,7 @@ declare const ToggleInput: React.ComponentType<{
|
|
|
45
70
|
'aria-expanded'?: boolean | "true" | "false" | undefined;
|
|
46
71
|
'aria-flowto'?: string | undefined;
|
|
47
72
|
'aria-grabbed'?: boolean | "true" | "false" | undefined;
|
|
48
|
-
'aria-haspopup'?: boolean | "
|
|
73
|
+
'aria-haspopup'?: boolean | "menu" | "dialog" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
|
|
49
74
|
'aria-hidden'?: boolean | "true" | "false" | undefined;
|
|
50
75
|
'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
51
76
|
'aria-keyshortcuts'?: string | undefined;
|
|
@@ -75,9 +100,34 @@ declare const ToggleInput: React.ComponentType<{
|
|
|
75
100
|
'aria-valuemin'?: number | undefined;
|
|
76
101
|
'aria-valuenow'?: number | undefined;
|
|
77
102
|
'aria-valuetext'?: string | undefined;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
103
|
+
type?: string | undefined;
|
|
104
|
+
alt?: string | undefined;
|
|
105
|
+
crossOrigin?: string | undefined;
|
|
106
|
+
src?: string | undefined;
|
|
107
|
+
autoFocus?: boolean | undefined;
|
|
108
|
+
formAction?: string | undefined;
|
|
109
|
+
formEncType?: string | undefined;
|
|
110
|
+
formMethod?: string | undefined;
|
|
111
|
+
formNoValidate?: boolean | undefined;
|
|
112
|
+
formTarget?: string | undefined;
|
|
113
|
+
height: (string | number | undefined) & (import("csstype").HeightProperty<string | number> | [import("csstype").HeightProperty<string | number> | undefined, import("csstype").HeightProperty<string | number> | undefined] | [import("csstype").HeightProperty<string | number> | undefined, import("csstype").HeightProperty<string | number> | undefined, import("csstype").HeightProperty<string | number> | undefined] | undefined) & number;
|
|
114
|
+
width?: ((string | number) & (import("csstype").WidthProperty<string | number> | [import("csstype").WidthProperty<string | number> | undefined, import("csstype").WidthProperty<string | number> | undefined] | [import("csstype").WidthProperty<string | number> | undefined, import("csstype").WidthProperty<string | number> | undefined, import("csstype").WidthProperty<string | number> | undefined])) | undefined;
|
|
115
|
+
autoComplete?: string | undefined;
|
|
116
|
+
accept?: string | undefined;
|
|
117
|
+
checked?: boolean | undefined;
|
|
118
|
+
list?: string | undefined;
|
|
119
|
+
max?: string | number | undefined;
|
|
120
|
+
maxLength?: number | undefined;
|
|
121
|
+
min?: string | number | undefined;
|
|
122
|
+
minLength?: number | undefined;
|
|
123
|
+
multiple?: boolean | undefined;
|
|
124
|
+
readOnly?: boolean | undefined;
|
|
125
|
+
required?: boolean | undefined;
|
|
126
|
+
size?: number | undefined;
|
|
127
|
+
step?: string | number | undefined;
|
|
128
|
+
key?: React.Key | null | undefined;
|
|
129
|
+
hidden?: boolean | undefined;
|
|
130
|
+
translate?: "yes" | "no" | undefined;
|
|
81
131
|
onCopy?: React.ClipboardEventHandler<HTMLInputElement> | undefined;
|
|
82
132
|
onCopyCapture?: React.ClipboardEventHandler<HTMLInputElement> | undefined;
|
|
83
133
|
onCut?: React.ClipboardEventHandler<HTMLInputElement> | undefined;
|
|
@@ -162,12 +212,15 @@ declare const ToggleInput: React.ComponentType<{
|
|
|
162
212
|
onWaitingCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
163
213
|
onAuxClick?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
164
214
|
onAuxClickCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
215
|
+
onClick?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
165
216
|
onClickCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
166
217
|
onContextMenu?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
167
218
|
onContextMenuCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
168
219
|
onDoubleClick?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
169
220
|
onDoubleClickCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
221
|
+
onDrag?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
170
222
|
onDragCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
223
|
+
onDragEnd?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
171
224
|
onDragEndCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
172
225
|
onDragEnter?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
173
226
|
onDragEnterCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
@@ -177,11 +230,14 @@ declare const ToggleInput: React.ComponentType<{
|
|
|
177
230
|
onDragLeaveCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
178
231
|
onDragOver?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
179
232
|
onDragOverCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
233
|
+
onDragStart?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
180
234
|
onDragStartCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
181
235
|
onDrop?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
182
236
|
onDropCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
183
237
|
onMouseDown?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
184
238
|
onMouseDownCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
239
|
+
onMouseEnter?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
240
|
+
onMouseLeave?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
185
241
|
onMouseMove?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
186
242
|
onMouseMoveCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
187
243
|
onMouseOut?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
@@ -232,69 +288,13 @@ declare const ToggleInput: React.ComponentType<{
|
|
|
232
288
|
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLInputElement> | undefined;
|
|
233
289
|
onTransitionEnd?: React.TransitionEventHandler<HTMLInputElement> | undefined;
|
|
234
290
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLInputElement> | undefined;
|
|
235
|
-
|
|
236
|
-
is?: string | undefined;
|
|
237
|
-
disabled?: boolean | undefined;
|
|
238
|
-
value?: string | number | readonly string[] | undefined;
|
|
239
|
-
defaultChecked?: boolean | undefined;
|
|
240
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
241
|
-
suppressContentEditableWarning?: boolean | undefined;
|
|
242
|
-
suppressHydrationWarning?: boolean | undefined;
|
|
243
|
-
accessKey?: string | undefined;
|
|
244
|
-
contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
|
|
245
|
-
contextMenu?: string | undefined;
|
|
246
|
-
placeholder?: string | undefined;
|
|
247
|
-
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
248
|
-
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
249
|
-
radioGroup?: string | undefined;
|
|
250
|
-
about?: string | undefined;
|
|
251
|
-
datatype?: string | undefined;
|
|
252
|
-
inlist?: any;
|
|
253
|
-
prefix?: string | undefined;
|
|
254
|
-
property?: string | undefined;
|
|
255
|
-
resource?: string | undefined;
|
|
256
|
-
typeof?: string | undefined;
|
|
257
|
-
vocab?: string | undefined;
|
|
258
|
-
autoCapitalize?: string | undefined;
|
|
259
|
-
autoCorrect?: string | undefined;
|
|
260
|
-
autoSave?: string | undefined;
|
|
261
|
-
itemProp?: string | undefined;
|
|
262
|
-
itemScope?: boolean | undefined;
|
|
263
|
-
itemType?: string | undefined;
|
|
264
|
-
itemID?: string | undefined;
|
|
265
|
-
itemRef?: string | undefined;
|
|
266
|
-
results?: number | undefined;
|
|
267
|
-
security?: string | undefined;
|
|
268
|
-
unselectable?: "on" | "off" | undefined;
|
|
269
|
-
alt?: string | undefined;
|
|
270
|
-
src?: string | undefined;
|
|
271
|
-
autoFocus?: boolean | undefined;
|
|
272
|
-
formAction?: string | undefined;
|
|
273
|
-
formEncType?: string | undefined;
|
|
274
|
-
formMethod?: string | undefined;
|
|
275
|
-
formNoValidate?: boolean | undefined;
|
|
276
|
-
formTarget?: string | undefined;
|
|
277
|
-
autoComplete?: string | undefined;
|
|
278
|
-
accept?: string | undefined;
|
|
279
|
-
capture?: string | boolean | undefined;
|
|
280
|
-
checked?: boolean | undefined;
|
|
281
|
-
list?: string | undefined;
|
|
282
|
-
maxLength?: number | undefined;
|
|
283
|
-
minLength?: number | undefined;
|
|
284
|
-
multiple?: boolean | undefined;
|
|
285
|
-
readOnly?: boolean | undefined;
|
|
286
|
-
required?: boolean | undefined;
|
|
287
|
-
size?: number | undefined;
|
|
288
|
-
step?: string | number | undefined;
|
|
289
|
-
hidden?: boolean | undefined;
|
|
290
|
-
translate?: "no" | "yes" | undefined;
|
|
291
|
+
borderColor?: ((string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined]) & string) | undefined;
|
|
291
292
|
p?: import("csstype").PaddingProperty<string | number> | [import("csstype").PaddingProperty<string | number> | undefined, import("csstype").PaddingProperty<string | number> | undefined] | [import("csstype").PaddingProperty<string | number> | undefined, import("csstype").PaddingProperty<string | number> | undefined, import("csstype").PaddingProperty<string | number> | undefined] | undefined;
|
|
292
293
|
cursor?: string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined] | undefined;
|
|
293
294
|
display?: string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined] | undefined;
|
|
294
295
|
fontSize?: import("csstype").FontSizeProperty<string | number> | [import("csstype").FontSizeProperty<string | number> | undefined, import("csstype").FontSizeProperty<string | number> | undefined] | [import("csstype").FontSizeProperty<string | number> | undefined, import("csstype").FontSizeProperty<string | number> | undefined, import("csstype").FontSizeProperty<string | number> | undefined] | undefined;
|
|
295
296
|
fontWeight?: import("csstype").FontWeightProperty | [import("csstype").FontWeightProperty | undefined, import("csstype").FontWeightProperty | undefined] | [import("csstype").FontWeightProperty | undefined, import("csstype").FontWeightProperty | undefined, import("csstype").FontWeightProperty | undefined] | undefined;
|
|
296
297
|
textDecoration?: string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined] | undefined;
|
|
297
|
-
borderColor?: ((string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined]) & string) | undefined;
|
|
298
298
|
margin?: import("csstype").MarginProperty<string | number> | [import("csstype").MarginProperty<string | number> | undefined, import("csstype").MarginProperty<string | number> | undefined] | [import("csstype").MarginProperty<string | number> | undefined, import("csstype").MarginProperty<string | number> | undefined, import("csstype").MarginProperty<string | number> | undefined] | undefined;
|
|
299
299
|
marginLeft?: import("csstype").MarginLeftProperty<string | number> | [import("csstype").MarginLeftProperty<string | number> | undefined, import("csstype").MarginLeftProperty<string | number> | undefined] | [import("csstype").MarginLeftProperty<string | number> | undefined, import("csstype").MarginLeftProperty<string | number> | undefined, import("csstype").MarginLeftProperty<string | number> | undefined] | undefined;
|
|
300
300
|
marginRight?: import("csstype").MarginRightProperty<string | number> | [import("csstype").MarginRightProperty<string | number> | undefined, import("csstype").MarginRightProperty<string | number> | undefined] | [import("csstype").MarginRightProperty<string | number> | undefined, import("csstype").MarginRightProperty<string | number> | undefined, import("csstype").MarginRightProperty<string | number> | undefined] | undefined;
|
|
@@ -353,9 +353,16 @@ declare const ToggleInput: React.ComponentType<{
|
|
|
353
353
|
flexDirection?: import("csstype").FlexDirectionProperty | [import("csstype").FlexDirectionProperty | undefined, import("csstype").FlexDirectionProperty | undefined] | [import("csstype").FlexDirectionProperty | undefined, import("csstype").FlexDirectionProperty | undefined, import("csstype").FlexDirectionProperty | undefined] | undefined;
|
|
354
354
|
flexBasis?: import("csstype").FlexBasisProperty<string | number> | [import("csstype").FlexBasisProperty<string | number> | undefined, import("csstype").FlexBasisProperty<string | number> | undefined] | [import("csstype").FlexBasisProperty<string | number> | undefined, import("csstype").FlexBasisProperty<string | number> | undefined, import("csstype").FlexBasisProperty<string | number> | undefined] | undefined;
|
|
355
355
|
flexGrow?: import("csstype").GlobalsNumber | [import("csstype").GlobalsNumber | undefined, import("csstype").GlobalsNumber | undefined] | [import("csstype").GlobalsNumber | undefined, import("csstype").GlobalsNumber | undefined, import("csstype").GlobalsNumber | undefined] | undefined;
|
|
356
|
+
gridTemplateColumns?: import("csstype").GridTemplateColumnsProperty<string | number> | [import("csstype").GridTemplateColumnsProperty<string | number> | undefined, import("csstype").GridTemplateColumnsProperty<string | number> | undefined] | [import("csstype").GridTemplateColumnsProperty<string | number> | undefined, import("csstype").GridTemplateColumnsProperty<string | number> | undefined, import("csstype").GridTemplateColumnsProperty<string | number> | undefined] | undefined;
|
|
356
357
|
controlSize: number;
|
|
357
358
|
invalid?: boolean | undefined;
|
|
358
359
|
innerRef?: React.Ref<HTMLInputElement> | undefined;
|
|
360
|
+
gridColumnSpan?: number | number[] | "end" | "all" | undefined;
|
|
361
|
+
gridColumnPad?: number | number[] | undefined;
|
|
362
|
+
gridRowSpan?: number | number[] | undefined;
|
|
363
|
+
gridRowPad?: number | number[] | undefined;
|
|
364
|
+
gridAlign?: ("start" | "end" | "center" | "stretch") | undefined;
|
|
365
|
+
gridJustify?: ("start" | "end" | "center" | "stretch") | undefined;
|
|
359
366
|
}>;
|
|
360
367
|
declare type ToggleProps = Omit<ComponentProps<typeof ToggleInput>, 'value' | 'type' | 'checked' | 'onChange' | 'height' | 'controlSize'> & {
|
|
361
368
|
value?: boolean;
|
package/es/Toggle.js
CHANGED
|
@@ -55,7 +55,7 @@ var ToggleInput = createStyledComponent(_ref => {
|
|
|
55
55
|
bottom: 0,
|
|
56
56
|
left: 0,
|
|
57
57
|
color: theme.colors.white,
|
|
58
|
-
backgroundColor: theme.colors.gray[4],
|
|
58
|
+
backgroundColor: invalid ? theme.colors.red[3] : theme.colors.gray[4],
|
|
59
59
|
backgroundImage: backgroundImage(isDarkMode()),
|
|
60
60
|
backgroundPosition: "".concat(height * 0.1, "px 0, ").concat(height * 0.9, "px 0"),
|
|
61
61
|
backgroundRepeat: 'no-repeat',
|
|
@@ -82,8 +82,8 @@ var ToggleInput = createStyledComponent(_ref => {
|
|
|
82
82
|
boxShadow: 'none'
|
|
83
83
|
},
|
|
84
84
|
'&:checked:before': {
|
|
85
|
-
backgroundColor: color !== null && color !== void 0 ? color : theme.colors.green[5],
|
|
86
|
-
borderColor: borderColor !== null && borderColor !== void 0 ? borderColor : theme.colors.green[2]
|
|
85
|
+
backgroundColor: invalid ? theme.colors.error : color !== null && color !== void 0 ? color : theme.colors.green[5],
|
|
86
|
+
borderColor: invalid ? theme.colors.red[2] : borderColor !== null && borderColor !== void 0 ? borderColor : theme.colors.green[2]
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
}, 'input');
|
|
@@ -118,7 +118,8 @@ var Toggle = _ref2 => {
|
|
|
118
118
|
onChange: disabled || !onChange ? undefined : e => onChange(e.target.checked),
|
|
119
119
|
"data-testid": testId,
|
|
120
120
|
"aria-labelledby": labelledBy,
|
|
121
|
-
"aria-describedby": describedBy
|
|
121
|
+
"aria-describedby": describedBy,
|
|
122
|
+
"aria-invalid": invalid || undefined
|
|
122
123
|
}));
|
|
123
124
|
};
|
|
124
125
|
|
package/lib/Toggle.js
CHANGED
|
@@ -70,7 +70,7 @@ var ToggleInput = (0, _styleContainer.createStyledComponent)(function (_ref) {
|
|
|
70
70
|
bottom: 0,
|
|
71
71
|
left: 0,
|
|
72
72
|
color: theme.colors.white,
|
|
73
|
-
backgroundColor: theme.colors.gray[4],
|
|
73
|
+
backgroundColor: invalid ? theme.colors.red[3] : theme.colors.gray[4],
|
|
74
74
|
backgroundImage: backgroundImage((0, _styleConst.isDarkMode)()),
|
|
75
75
|
backgroundPosition: "".concat(height * 0.1, "px 0, ").concat(height * 0.9, "px 0"),
|
|
76
76
|
backgroundRepeat: 'no-repeat',
|
|
@@ -97,8 +97,8 @@ var ToggleInput = (0, _styleContainer.createStyledComponent)(function (_ref) {
|
|
|
97
97
|
boxShadow: 'none'
|
|
98
98
|
},
|
|
99
99
|
'&:checked:before': {
|
|
100
|
-
backgroundColor: color !== null && color !== void 0 ? color : theme.colors.green[5],
|
|
101
|
-
borderColor: borderColor !== null && borderColor !== void 0 ? borderColor : theme.colors.green[2]
|
|
100
|
+
backgroundColor: invalid ? theme.colors.error : color !== null && color !== void 0 ? color : theme.colors.green[5],
|
|
101
|
+
borderColor: invalid ? theme.colors.red[2] : borderColor !== null && borderColor !== void 0 ? borderColor : theme.colors.green[2]
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
}, 'input');
|
|
@@ -134,7 +134,8 @@ var Toggle = function Toggle(_ref2) {
|
|
|
134
134
|
},
|
|
135
135
|
"data-testid": testId,
|
|
136
136
|
"aria-labelledby": labelledBy,
|
|
137
|
-
"aria-describedby": describedBy
|
|
137
|
+
"aria-describedby": describedBy,
|
|
138
|
+
"aria-invalid": invalid || undefined
|
|
138
139
|
}));
|
|
139
140
|
};
|
|
140
141
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/component-toggle",
|
|
3
3
|
"description": "Cloudflare Toggle Component",
|
|
4
|
-
"version": "
|
|
5
|
-
"types": "./dist/index.d.ts",
|
|
4
|
+
"version": "7.0.1",
|
|
6
5
|
"main": "lib/index.js",
|
|
7
6
|
"module": "es/index.js",
|
|
8
7
|
"author": "James Kyle <jkyle@cloudflare.com>",
|
|
@@ -10,18 +9,19 @@
|
|
|
10
9
|
"publishConfig": {
|
|
11
10
|
"access": "public",
|
|
12
11
|
"main": "lib/index.js",
|
|
13
|
-
"module": "es/index.js"
|
|
12
|
+
"module": "es/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@cloudflare/component-icon": "^
|
|
17
|
-
"@cloudflare/elements": "^
|
|
16
|
+
"@cloudflare/component-icon": "^9.0.0",
|
|
17
|
+
"@cloudflare/elements": "^3.0.0",
|
|
18
18
|
"@cloudflare/intl-react": "^1.9.80",
|
|
19
19
|
"@cloudflare/types": "^6.15.15",
|
|
20
20
|
"prop-types": "^15.6.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@cloudflare/style-const": "^5.3.9",
|
|
24
|
-
"@cloudflare/style-container": "^7.
|
|
24
|
+
"@cloudflare/style-container": "^7.10.0",
|
|
25
25
|
"react": "^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0"
|
|
26
26
|
},
|
|
27
27
|
"stratus": {
|
|
@@ -34,5 +34,6 @@
|
|
|
34
34
|
"test": "stratus test",
|
|
35
35
|
"test-coverage": "stratus test --coverage",
|
|
36
36
|
"test-watch": "stratus test --watch"
|
|
37
|
-
}
|
|
37
|
+
},
|
|
38
|
+
"types": "./dist/index.d.ts"
|
|
38
39
|
}
|