@cloudflare/component-toggle 4.2.42 → 5.0.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/CHANGELOG.md +40 -0
- package/dist/Toggle.d.ts +194 -168
- package/dist/index.d.ts +1 -2
- package/es/Toggle.js +48 -74
- package/es/index.js +1 -2
- package/lib/Toggle.js +39 -67
- package/lib/index.js +0 -8
- package/package.json +8 -8
- package/dist/LabelledToggle.d.ts +0 -9
- package/es/LabelledToggle.js +0 -51
- package/lib/LabelledToggle.js +0 -75
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,46 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-toggle@4.2.45...@cloudflare/component-toggle@5.0.0) (2022-01-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **component-toggle:** A11Y-584 Fix focus effect, simplify rendered html ([742eddf](http://stash.cfops.it:7999/fe/stratus/commits/742eddf))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* **component-toggle:** Removed LabelledToggle
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [4.2.45](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-toggle@4.2.44...@cloudflare/component-toggle@4.2.45) (2021-12-28)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @cloudflare/component-toggle
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [4.2.44](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-toggle@4.2.43...@cloudflare/component-toggle@4.2.44) (2021-12-22)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @cloudflare/component-toggle
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [4.2.43](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-toggle@4.2.42...@cloudflare/component-toggle@4.2.43) (2021-12-22)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @cloudflare/component-toggle
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
6
46
|
## [4.2.42](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-toggle@4.2.40...@cloudflare/component-toggle@4.2.42) (2021-12-21)
|
|
7
47
|
|
|
8
48
|
**Note:** Version bump only for package @cloudflare/component-toggle
|
package/dist/Toggle.d.ts
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
import React, { ComponentProps } from 'react';
|
|
2
|
-
declare const
|
|
2
|
+
declare const ToggleInput: React.ComponentType<{
|
|
3
|
+
form?: string | undefined;
|
|
3
4
|
slot?: string | undefined;
|
|
4
5
|
style?: React.CSSProperties | undefined;
|
|
5
6
|
title?: string | undefined;
|
|
7
|
+
pattern?: string | undefined;
|
|
6
8
|
children?: React.ReactNode;
|
|
7
9
|
key?: React.Key | null | undefined;
|
|
8
|
-
onClick?: React.MouseEventHandler<
|
|
9
|
-
onMouseEnter?: React.MouseEventHandler<
|
|
10
|
-
onMouseLeave?: React.MouseEventHandler<
|
|
10
|
+
onClick?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
11
|
+
onMouseEnter?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
12
|
+
onMouseLeave?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
11
13
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
12
|
-
onDragStart?: React.DragEventHandler<
|
|
13
|
-
onDrag?: React.DragEventHandler<
|
|
14
|
-
onDragEnd?: React.DragEventHandler<
|
|
14
|
+
onDragStart?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
15
|
+
onDrag?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
16
|
+
onDragEnd?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
15
17
|
className?: string | undefined;
|
|
16
18
|
color?: (string & (string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined])) | undefined;
|
|
19
|
+
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;
|
|
17
20
|
id?: string | undefined;
|
|
18
21
|
lang?: string | undefined;
|
|
22
|
+
max?: string | number | undefined;
|
|
23
|
+
min?: string | number | undefined;
|
|
24
|
+
name?: string | undefined;
|
|
25
|
+
type?: 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;
|
|
19
27
|
role?: string | undefined;
|
|
20
28
|
tabIndex?: number | undefined;
|
|
29
|
+
crossOrigin?: string | undefined;
|
|
21
30
|
'aria-activedescendant'?: string | undefined;
|
|
22
31
|
'aria-atomic'?: boolean | "true" | "false" | undefined;
|
|
23
32
|
'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -69,162 +78,167 @@ declare const Container: React.ComponentType<{
|
|
|
69
78
|
dangerouslySetInnerHTML?: {
|
|
70
79
|
__html: string;
|
|
71
80
|
} | undefined;
|
|
72
|
-
onCopy?: React.ClipboardEventHandler<
|
|
73
|
-
onCopyCapture?: React.ClipboardEventHandler<
|
|
74
|
-
onCut?: React.ClipboardEventHandler<
|
|
75
|
-
onCutCapture?: React.ClipboardEventHandler<
|
|
76
|
-
onPaste?: React.ClipboardEventHandler<
|
|
77
|
-
onPasteCapture?: React.ClipboardEventHandler<
|
|
78
|
-
onCompositionEnd?: React.CompositionEventHandler<
|
|
79
|
-
onCompositionEndCapture?: React.CompositionEventHandler<
|
|
80
|
-
onCompositionStart?: React.CompositionEventHandler<
|
|
81
|
-
onCompositionStartCapture?: React.CompositionEventHandler<
|
|
82
|
-
onCompositionUpdate?: React.CompositionEventHandler<
|
|
83
|
-
onCompositionUpdateCapture?: React.CompositionEventHandler<
|
|
84
|
-
onFocus?: React.FocusEventHandler<
|
|
85
|
-
onFocusCapture?: React.FocusEventHandler<
|
|
86
|
-
onBlur?: React.FocusEventHandler<
|
|
87
|
-
onBlurCapture?: React.FocusEventHandler<
|
|
88
|
-
onChange?: React.
|
|
89
|
-
onChangeCapture?: React.FormEventHandler<
|
|
90
|
-
onBeforeInput?: React.FormEventHandler<
|
|
91
|
-
onBeforeInputCapture?: React.FormEventHandler<
|
|
92
|
-
onInput?: React.FormEventHandler<
|
|
93
|
-
onInputCapture?: React.FormEventHandler<
|
|
94
|
-
onReset?: React.FormEventHandler<
|
|
95
|
-
onResetCapture?: React.FormEventHandler<
|
|
96
|
-
onSubmit?: React.FormEventHandler<
|
|
97
|
-
onSubmitCapture?: React.FormEventHandler<
|
|
98
|
-
onInvalid?: React.FormEventHandler<
|
|
99
|
-
onInvalidCapture?: React.FormEventHandler<
|
|
100
|
-
onLoad?: React.ReactEventHandler<
|
|
101
|
-
onLoadCapture?: React.ReactEventHandler<
|
|
102
|
-
onError?: React.ReactEventHandler<
|
|
103
|
-
onErrorCapture?: React.ReactEventHandler<
|
|
104
|
-
onKeyDown?: React.KeyboardEventHandler<
|
|
105
|
-
onKeyDownCapture?: React.KeyboardEventHandler<
|
|
106
|
-
onKeyPress?: React.KeyboardEventHandler<
|
|
107
|
-
onKeyPressCapture?: React.KeyboardEventHandler<
|
|
108
|
-
onKeyUp?: React.KeyboardEventHandler<
|
|
109
|
-
onKeyUpCapture?: React.KeyboardEventHandler<
|
|
110
|
-
onAbort?: React.ReactEventHandler<
|
|
111
|
-
onAbortCapture?: React.ReactEventHandler<
|
|
112
|
-
onCanPlay?: React.ReactEventHandler<
|
|
113
|
-
onCanPlayCapture?: React.ReactEventHandler<
|
|
114
|
-
onCanPlayThrough?: React.ReactEventHandler<
|
|
115
|
-
onCanPlayThroughCapture?: React.ReactEventHandler<
|
|
116
|
-
onDurationChange?: React.ReactEventHandler<
|
|
117
|
-
onDurationChangeCapture?: React.ReactEventHandler<
|
|
118
|
-
onEmptied?: React.ReactEventHandler<
|
|
119
|
-
onEmptiedCapture?: React.ReactEventHandler<
|
|
120
|
-
onEncrypted?: React.ReactEventHandler<
|
|
121
|
-
onEncryptedCapture?: React.ReactEventHandler<
|
|
122
|
-
onEnded?: React.ReactEventHandler<
|
|
123
|
-
onEndedCapture?: React.ReactEventHandler<
|
|
124
|
-
onLoadedData?: React.ReactEventHandler<
|
|
125
|
-
onLoadedDataCapture?: React.ReactEventHandler<
|
|
126
|
-
onLoadedMetadata?: React.ReactEventHandler<
|
|
127
|
-
onLoadedMetadataCapture?: React.ReactEventHandler<
|
|
128
|
-
onLoadStart?: React.ReactEventHandler<
|
|
129
|
-
onLoadStartCapture?: React.ReactEventHandler<
|
|
130
|
-
onPause?: React.ReactEventHandler<
|
|
131
|
-
onPauseCapture?: React.ReactEventHandler<
|
|
132
|
-
onPlay?: React.ReactEventHandler<
|
|
133
|
-
onPlayCapture?: React.ReactEventHandler<
|
|
134
|
-
onPlaying?: React.ReactEventHandler<
|
|
135
|
-
onPlayingCapture?: React.ReactEventHandler<
|
|
136
|
-
onProgress?: React.ReactEventHandler<
|
|
137
|
-
onProgressCapture?: React.ReactEventHandler<
|
|
138
|
-
onRateChange?: React.ReactEventHandler<
|
|
139
|
-
onRateChangeCapture?: React.ReactEventHandler<
|
|
140
|
-
onSeeked?: React.ReactEventHandler<
|
|
141
|
-
onSeekedCapture?: React.ReactEventHandler<
|
|
142
|
-
onSeeking?: React.ReactEventHandler<
|
|
143
|
-
onSeekingCapture?: React.ReactEventHandler<
|
|
144
|
-
onStalled?: React.ReactEventHandler<
|
|
145
|
-
onStalledCapture?: React.ReactEventHandler<
|
|
146
|
-
onSuspend?: React.ReactEventHandler<
|
|
147
|
-
onSuspendCapture?: React.ReactEventHandler<
|
|
148
|
-
onTimeUpdate?: React.ReactEventHandler<
|
|
149
|
-
onTimeUpdateCapture?: React.ReactEventHandler<
|
|
150
|
-
onVolumeChange?: React.ReactEventHandler<
|
|
151
|
-
onVolumeChangeCapture?: React.ReactEventHandler<
|
|
152
|
-
onWaiting?: React.ReactEventHandler<
|
|
153
|
-
onWaitingCapture?: React.ReactEventHandler<
|
|
154
|
-
onAuxClick?: React.MouseEventHandler<
|
|
155
|
-
onAuxClickCapture?: React.MouseEventHandler<
|
|
156
|
-
onClickCapture?: React.MouseEventHandler<
|
|
157
|
-
onContextMenu?: React.MouseEventHandler<
|
|
158
|
-
onContextMenuCapture?: React.MouseEventHandler<
|
|
159
|
-
onDoubleClick?: React.MouseEventHandler<
|
|
160
|
-
onDoubleClickCapture?: React.MouseEventHandler<
|
|
161
|
-
onDragCapture?: React.DragEventHandler<
|
|
162
|
-
onDragEndCapture?: React.DragEventHandler<
|
|
163
|
-
onDragEnter?: React.DragEventHandler<
|
|
164
|
-
onDragEnterCapture?: React.DragEventHandler<
|
|
165
|
-
onDragExit?: React.DragEventHandler<
|
|
166
|
-
onDragExitCapture?: React.DragEventHandler<
|
|
167
|
-
onDragLeave?: React.DragEventHandler<
|
|
168
|
-
onDragLeaveCapture?: React.DragEventHandler<
|
|
169
|
-
onDragOver?: React.DragEventHandler<
|
|
170
|
-
onDragOverCapture?: React.DragEventHandler<
|
|
171
|
-
onDragStartCapture?: React.DragEventHandler<
|
|
172
|
-
onDrop?: React.DragEventHandler<
|
|
173
|
-
onDropCapture?: React.DragEventHandler<
|
|
174
|
-
onMouseDown?: React.MouseEventHandler<
|
|
175
|
-
onMouseDownCapture?: React.MouseEventHandler<
|
|
176
|
-
onMouseMove?: React.MouseEventHandler<
|
|
177
|
-
onMouseMoveCapture?: React.MouseEventHandler<
|
|
178
|
-
onMouseOut?: React.MouseEventHandler<
|
|
179
|
-
onMouseOutCapture?: React.MouseEventHandler<
|
|
180
|
-
onMouseOver?: React.MouseEventHandler<
|
|
181
|
-
onMouseOverCapture?: React.MouseEventHandler<
|
|
182
|
-
onMouseUp?: React.MouseEventHandler<
|
|
183
|
-
onMouseUpCapture?: React.MouseEventHandler<
|
|
184
|
-
onSelect?: React.ReactEventHandler<
|
|
185
|
-
onSelectCapture?: React.ReactEventHandler<
|
|
186
|
-
onTouchCancel?: React.TouchEventHandler<
|
|
187
|
-
onTouchCancelCapture?: React.TouchEventHandler<
|
|
188
|
-
onTouchEnd?: React.TouchEventHandler<
|
|
189
|
-
onTouchEndCapture?: React.TouchEventHandler<
|
|
190
|
-
onTouchMove?: React.TouchEventHandler<
|
|
191
|
-
onTouchMoveCapture?: React.TouchEventHandler<
|
|
192
|
-
onTouchStart?: React.TouchEventHandler<
|
|
193
|
-
onTouchStartCapture?: React.TouchEventHandler<
|
|
194
|
-
onPointerDown?: React.PointerEventHandler<
|
|
195
|
-
onPointerDownCapture?: React.PointerEventHandler<
|
|
196
|
-
onPointerMove?: React.PointerEventHandler<
|
|
197
|
-
onPointerMoveCapture?: React.PointerEventHandler<
|
|
198
|
-
onPointerUp?: React.PointerEventHandler<
|
|
199
|
-
onPointerUpCapture?: React.PointerEventHandler<
|
|
200
|
-
onPointerCancel?: React.PointerEventHandler<
|
|
201
|
-
onPointerCancelCapture?: React.PointerEventHandler<
|
|
202
|
-
onPointerEnter?: React.PointerEventHandler<
|
|
203
|
-
onPointerEnterCapture?: React.PointerEventHandler<
|
|
204
|
-
onPointerLeave?: React.PointerEventHandler<
|
|
205
|
-
onPointerLeaveCapture?: React.PointerEventHandler<
|
|
206
|
-
onPointerOver?: React.PointerEventHandler<
|
|
207
|
-
onPointerOverCapture?: React.PointerEventHandler<
|
|
208
|
-
onPointerOut?: React.PointerEventHandler<
|
|
209
|
-
onPointerOutCapture?: React.PointerEventHandler<
|
|
210
|
-
onGotPointerCapture?: React.PointerEventHandler<
|
|
211
|
-
onGotPointerCaptureCapture?: React.PointerEventHandler<
|
|
212
|
-
onLostPointerCapture?: React.PointerEventHandler<
|
|
213
|
-
onLostPointerCaptureCapture?: React.PointerEventHandler<
|
|
214
|
-
onScroll?: React.UIEventHandler<
|
|
215
|
-
onScrollCapture?: React.UIEventHandler<
|
|
216
|
-
onWheel?: React.WheelEventHandler<
|
|
217
|
-
onWheelCapture?: React.WheelEventHandler<
|
|
218
|
-
onAnimationStart?: React.AnimationEventHandler<
|
|
219
|
-
onAnimationStartCapture?: React.AnimationEventHandler<
|
|
220
|
-
onAnimationEnd?: React.AnimationEventHandler<
|
|
221
|
-
onAnimationEndCapture?: React.AnimationEventHandler<
|
|
222
|
-
onAnimationIteration?: React.AnimationEventHandler<
|
|
223
|
-
onAnimationIterationCapture?: React.AnimationEventHandler<
|
|
224
|
-
onTransitionEnd?: React.TransitionEventHandler<
|
|
225
|
-
onTransitionEndCapture?: React.TransitionEventHandler<
|
|
81
|
+
onCopy?: React.ClipboardEventHandler<HTMLInputElement> | undefined;
|
|
82
|
+
onCopyCapture?: React.ClipboardEventHandler<HTMLInputElement> | undefined;
|
|
83
|
+
onCut?: React.ClipboardEventHandler<HTMLInputElement> | undefined;
|
|
84
|
+
onCutCapture?: React.ClipboardEventHandler<HTMLInputElement> | undefined;
|
|
85
|
+
onPaste?: React.ClipboardEventHandler<HTMLInputElement> | undefined;
|
|
86
|
+
onPasteCapture?: React.ClipboardEventHandler<HTMLInputElement> | undefined;
|
|
87
|
+
onCompositionEnd?: React.CompositionEventHandler<HTMLInputElement> | undefined;
|
|
88
|
+
onCompositionEndCapture?: React.CompositionEventHandler<HTMLInputElement> | undefined;
|
|
89
|
+
onCompositionStart?: React.CompositionEventHandler<HTMLInputElement> | undefined;
|
|
90
|
+
onCompositionStartCapture?: React.CompositionEventHandler<HTMLInputElement> | undefined;
|
|
91
|
+
onCompositionUpdate?: React.CompositionEventHandler<HTMLInputElement> | undefined;
|
|
92
|
+
onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLInputElement> | undefined;
|
|
93
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement> | undefined;
|
|
94
|
+
onFocusCapture?: React.FocusEventHandler<HTMLInputElement> | undefined;
|
|
95
|
+
onBlur?: React.FocusEventHandler<HTMLInputElement> | undefined;
|
|
96
|
+
onBlurCapture?: React.FocusEventHandler<HTMLInputElement> | undefined;
|
|
97
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement> | undefined;
|
|
98
|
+
onChangeCapture?: React.FormEventHandler<HTMLInputElement> | undefined;
|
|
99
|
+
onBeforeInput?: React.FormEventHandler<HTMLInputElement> | undefined;
|
|
100
|
+
onBeforeInputCapture?: React.FormEventHandler<HTMLInputElement> | undefined;
|
|
101
|
+
onInput?: React.FormEventHandler<HTMLInputElement> | undefined;
|
|
102
|
+
onInputCapture?: React.FormEventHandler<HTMLInputElement> | undefined;
|
|
103
|
+
onReset?: React.FormEventHandler<HTMLInputElement> | undefined;
|
|
104
|
+
onResetCapture?: React.FormEventHandler<HTMLInputElement> | undefined;
|
|
105
|
+
onSubmit?: React.FormEventHandler<HTMLInputElement> | undefined;
|
|
106
|
+
onSubmitCapture?: React.FormEventHandler<HTMLInputElement> | undefined;
|
|
107
|
+
onInvalid?: React.FormEventHandler<HTMLInputElement> | undefined;
|
|
108
|
+
onInvalidCapture?: React.FormEventHandler<HTMLInputElement> | undefined;
|
|
109
|
+
onLoad?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
110
|
+
onLoadCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
111
|
+
onError?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
112
|
+
onErrorCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
113
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement> | undefined;
|
|
114
|
+
onKeyDownCapture?: React.KeyboardEventHandler<HTMLInputElement> | undefined;
|
|
115
|
+
onKeyPress?: React.KeyboardEventHandler<HTMLInputElement> | undefined;
|
|
116
|
+
onKeyPressCapture?: React.KeyboardEventHandler<HTMLInputElement> | undefined;
|
|
117
|
+
onKeyUp?: React.KeyboardEventHandler<HTMLInputElement> | undefined;
|
|
118
|
+
onKeyUpCapture?: React.KeyboardEventHandler<HTMLInputElement> | undefined;
|
|
119
|
+
onAbort?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
120
|
+
onAbortCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
121
|
+
onCanPlay?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
122
|
+
onCanPlayCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
123
|
+
onCanPlayThrough?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
124
|
+
onCanPlayThroughCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
125
|
+
onDurationChange?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
126
|
+
onDurationChangeCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
127
|
+
onEmptied?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
128
|
+
onEmptiedCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
129
|
+
onEncrypted?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
130
|
+
onEncryptedCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
131
|
+
onEnded?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
132
|
+
onEndedCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
133
|
+
onLoadedData?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
134
|
+
onLoadedDataCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
135
|
+
onLoadedMetadata?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
136
|
+
onLoadedMetadataCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
137
|
+
onLoadStart?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
138
|
+
onLoadStartCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
139
|
+
onPause?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
140
|
+
onPauseCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
141
|
+
onPlay?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
142
|
+
onPlayCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
143
|
+
onPlaying?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
144
|
+
onPlayingCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
145
|
+
onProgress?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
146
|
+
onProgressCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
147
|
+
onRateChange?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
148
|
+
onRateChangeCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
149
|
+
onSeeked?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
150
|
+
onSeekedCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
151
|
+
onSeeking?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
152
|
+
onSeekingCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
153
|
+
onStalled?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
154
|
+
onStalledCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
155
|
+
onSuspend?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
156
|
+
onSuspendCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
157
|
+
onTimeUpdate?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
158
|
+
onTimeUpdateCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
159
|
+
onVolumeChange?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
160
|
+
onVolumeChangeCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
161
|
+
onWaiting?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
162
|
+
onWaitingCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
163
|
+
onAuxClick?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
164
|
+
onAuxClickCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
165
|
+
onClickCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
166
|
+
onContextMenu?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
167
|
+
onContextMenuCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
168
|
+
onDoubleClick?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
169
|
+
onDoubleClickCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
170
|
+
onDragCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
171
|
+
onDragEndCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
172
|
+
onDragEnter?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
173
|
+
onDragEnterCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
174
|
+
onDragExit?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
175
|
+
onDragExitCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
176
|
+
onDragLeave?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
177
|
+
onDragLeaveCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
178
|
+
onDragOver?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
179
|
+
onDragOverCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
180
|
+
onDragStartCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
181
|
+
onDrop?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
182
|
+
onDropCapture?: React.DragEventHandler<HTMLInputElement> | undefined;
|
|
183
|
+
onMouseDown?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
184
|
+
onMouseDownCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
185
|
+
onMouseMove?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
186
|
+
onMouseMoveCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
187
|
+
onMouseOut?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
188
|
+
onMouseOutCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
189
|
+
onMouseOver?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
190
|
+
onMouseOverCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
191
|
+
onMouseUp?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
192
|
+
onMouseUpCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
193
|
+
onSelect?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
194
|
+
onSelectCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
195
|
+
onTouchCancel?: React.TouchEventHandler<HTMLInputElement> | undefined;
|
|
196
|
+
onTouchCancelCapture?: React.TouchEventHandler<HTMLInputElement> | undefined;
|
|
197
|
+
onTouchEnd?: React.TouchEventHandler<HTMLInputElement> | undefined;
|
|
198
|
+
onTouchEndCapture?: React.TouchEventHandler<HTMLInputElement> | undefined;
|
|
199
|
+
onTouchMove?: React.TouchEventHandler<HTMLInputElement> | undefined;
|
|
200
|
+
onTouchMoveCapture?: React.TouchEventHandler<HTMLInputElement> | undefined;
|
|
201
|
+
onTouchStart?: React.TouchEventHandler<HTMLInputElement> | undefined;
|
|
202
|
+
onTouchStartCapture?: React.TouchEventHandler<HTMLInputElement> | undefined;
|
|
203
|
+
onPointerDown?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
204
|
+
onPointerDownCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
205
|
+
onPointerMove?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
206
|
+
onPointerMoveCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
207
|
+
onPointerUp?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
208
|
+
onPointerUpCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
209
|
+
onPointerCancel?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
210
|
+
onPointerCancelCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
211
|
+
onPointerEnter?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
212
|
+
onPointerEnterCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
213
|
+
onPointerLeave?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
214
|
+
onPointerLeaveCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
215
|
+
onPointerOver?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
216
|
+
onPointerOverCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
217
|
+
onPointerOut?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
218
|
+
onPointerOutCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
219
|
+
onGotPointerCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
220
|
+
onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
221
|
+
onLostPointerCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
222
|
+
onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLInputElement> | undefined;
|
|
223
|
+
onScroll?: React.UIEventHandler<HTMLInputElement> | undefined;
|
|
224
|
+
onScrollCapture?: React.UIEventHandler<HTMLInputElement> | undefined;
|
|
225
|
+
onWheel?: React.WheelEventHandler<HTMLInputElement> | undefined;
|
|
226
|
+
onWheelCapture?: React.WheelEventHandler<HTMLInputElement> | undefined;
|
|
227
|
+
onAnimationStart?: React.AnimationEventHandler<HTMLInputElement> | undefined;
|
|
228
|
+
onAnimationStartCapture?: React.AnimationEventHandler<HTMLInputElement> | undefined;
|
|
229
|
+
onAnimationEnd?: React.AnimationEventHandler<HTMLInputElement> | undefined;
|
|
230
|
+
onAnimationEndCapture?: React.AnimationEventHandler<HTMLInputElement> | undefined;
|
|
231
|
+
onAnimationIteration?: React.AnimationEventHandler<HTMLInputElement> | undefined;
|
|
232
|
+
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLInputElement> | undefined;
|
|
233
|
+
onTransitionEnd?: React.TransitionEventHandler<HTMLInputElement> | undefined;
|
|
234
|
+
onTransitionEndCapture?: React.TransitionEventHandler<HTMLInputElement> | undefined;
|
|
235
|
+
list?: string | undefined;
|
|
236
|
+
step?: string | number | undefined;
|
|
226
237
|
dir?: string | undefined;
|
|
227
238
|
is?: string | undefined;
|
|
239
|
+
value?: string | number | readonly string[] | undefined;
|
|
240
|
+
disabled?: boolean | undefined;
|
|
241
|
+
multiple?: boolean | undefined;
|
|
228
242
|
translate?: "no" | "yes" | undefined;
|
|
229
243
|
defaultChecked?: boolean | undefined;
|
|
230
244
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
@@ -256,10 +270,25 @@ declare const Container: React.ComponentType<{
|
|
|
256
270
|
results?: number | undefined;
|
|
257
271
|
security?: string | undefined;
|
|
258
272
|
unselectable?: "off" | "on" | undefined;
|
|
273
|
+
alt?: string | undefined;
|
|
274
|
+
src?: string | undefined;
|
|
275
|
+
autoFocus?: boolean | undefined;
|
|
276
|
+
formAction?: string | undefined;
|
|
277
|
+
formEncType?: string | undefined;
|
|
278
|
+
formMethod?: string | undefined;
|
|
279
|
+
formNoValidate?: boolean | undefined;
|
|
280
|
+
formTarget?: string | undefined;
|
|
281
|
+
autoComplete?: string | undefined;
|
|
282
|
+
accept?: string | undefined;
|
|
283
|
+
capture?: string | boolean | undefined;
|
|
284
|
+
checked?: boolean | undefined;
|
|
285
|
+
maxLength?: number | undefined;
|
|
286
|
+
minLength?: number | undefined;
|
|
287
|
+
readOnly?: boolean | undefined;
|
|
288
|
+
required?: boolean | undefined;
|
|
289
|
+
size?: number | undefined;
|
|
259
290
|
hidden?: boolean | undefined;
|
|
260
291
|
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;
|
|
261
|
-
height: (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;
|
|
262
|
-
width?: 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;
|
|
263
292
|
cursor?: string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined] | undefined;
|
|
264
293
|
display?: string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined] | undefined;
|
|
265
294
|
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;
|
|
@@ -320,16 +349,14 @@ declare const Container: React.ComponentType<{
|
|
|
320
349
|
px?: import("csstype").PaddingLeftProperty<string | number> | [import("csstype").PaddingLeftProperty<string | number> | undefined, import("csstype").PaddingLeftProperty<string | number> | undefined] | [import("csstype").PaddingLeftProperty<string | number> | undefined, import("csstype").PaddingLeftProperty<string | number> | undefined, import("csstype").PaddingLeftProperty<string | number> | undefined] | undefined;
|
|
321
350
|
py?: import("csstype").PaddingTopProperty<string | number> | [import("csstype").PaddingTopProperty<string | number> | undefined, import("csstype").PaddingTopProperty<string | number> | undefined] | [import("csstype").PaddingTopProperty<string | number> | undefined, import("csstype").PaddingTopProperty<string | number> | undefined, import("csstype").PaddingTopProperty<string | number> | undefined] | undefined;
|
|
322
351
|
borderbottomRightRadius?: ([never, never] | [never, never, never]) | undefined;
|
|
323
|
-
disabled?: boolean | undefined;
|
|
324
352
|
controlSize: number;
|
|
325
353
|
invalid?: boolean | undefined;
|
|
326
|
-
innerRef?: React.Ref<
|
|
354
|
+
innerRef?: React.Ref<HTMLInputElement> | undefined;
|
|
327
355
|
}>;
|
|
328
|
-
declare type ToggleProps = Omit<ComponentProps<typeof
|
|
356
|
+
declare type ToggleProps = Omit<ComponentProps<typeof ToggleInput>, 'value' | 'type' | 'checked' | 'onChange' | 'height' | 'controlSize'> & {
|
|
329
357
|
value?: boolean;
|
|
330
358
|
onChange: ((value: boolean) => void | Promise<void>) | false;
|
|
331
359
|
labelledBy?: string;
|
|
332
|
-
name?: string;
|
|
333
360
|
invalid?: boolean;
|
|
334
361
|
height?: number;
|
|
335
362
|
color?: string;
|
|
@@ -337,6 +364,5 @@ declare type ToggleProps = Omit<ComponentProps<typeof Container>, 'value' | 'typ
|
|
|
337
364
|
testId?: string;
|
|
338
365
|
describedBy?: string;
|
|
339
366
|
};
|
|
340
|
-
export declare const toggleProperties: string[];
|
|
341
367
|
declare const Toggle: React.FC<ToggleProps>;
|
|
342
368
|
export default Toggle;
|
package/dist/index.d.ts
CHANGED
package/es/Toggle.js
CHANGED
|
@@ -9,7 +9,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
9
9
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
10
|
|
|
11
11
|
import React from 'react';
|
|
12
|
-
import {
|
|
12
|
+
import { createStyledComponent } from '@cloudflare/style-container';
|
|
13
13
|
import { isDarkMode } from '@cloudflare/style-const';
|
|
14
14
|
|
|
15
15
|
const onSvg = darkMode => `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.0275 16.2537L6 12.0462L7.08375 11.0075L10.0462 14.1013L16.0837 8L17.1487 9.05375L10.0275 16.2537Z" fill="${darkMode ? 'black' : 'white'}"/></svg>`;
|
|
@@ -19,7 +19,7 @@ const offSvg = darkMode => `<svg width="24" height="24" viewBox="0 0 24 24" fill
|
|
|
19
19
|
const backgroundImage = darkMode => `url('data:image/svg+xml;utf8,${onSvg(darkMode)}'), url('data:image/svg+xml;utf8,${offSvg(darkMode)}')`;
|
|
20
20
|
|
|
21
21
|
const transition = 'all .25s ease';
|
|
22
|
-
const
|
|
22
|
+
const ToggleInput = createStyledComponent(({
|
|
23
23
|
theme,
|
|
24
24
|
height,
|
|
25
25
|
controlSize,
|
|
@@ -31,6 +31,7 @@ const Container = createStyledComponent(({
|
|
|
31
31
|
var _color, _borderColor;
|
|
32
32
|
|
|
33
33
|
return _objectSpread({
|
|
34
|
+
appearance: 'none',
|
|
34
35
|
position: 'relative',
|
|
35
36
|
display: 'inline-block',
|
|
36
37
|
width: `${height * 2}px`,
|
|
@@ -39,108 +40,81 @@ const Container = createStyledComponent(({
|
|
|
39
40
|
opacity: disabled ? 0.5 : 1,
|
|
40
41
|
transition: 'opacity .25s ease',
|
|
41
42
|
borderRadius: `${controlSize * 2}px`,
|
|
42
|
-
'
|
|
43
|
+
cursor: disabled ? 'not-allowed' : 'pointer'
|
|
44
|
+
}, theme.mixins.focus({
|
|
45
|
+
invalid
|
|
46
|
+
}), {
|
|
47
|
+
':before': {
|
|
48
|
+
content: '" "',
|
|
43
49
|
position: 'absolute',
|
|
44
50
|
top: 0,
|
|
45
51
|
right: 0,
|
|
46
52
|
bottom: 0,
|
|
47
53
|
left: 0,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
color: theme.colors.white,
|
|
55
|
+
backgroundColor: theme.colors.gray[4],
|
|
56
|
+
backgroundImage: backgroundImage(isDarkMode()),
|
|
57
|
+
backgroundPosition: `${height * 0.1}px 0, ${height * 0.9}px 0`,
|
|
58
|
+
backgroundRepeat: 'no-repeat',
|
|
59
|
+
backgroundSize: 'contain',
|
|
60
|
+
border: `1px solid ${theme.colors.gray[2]}`,
|
|
61
|
+
borderRadius: `${height * 2}px`,
|
|
62
|
+
transition
|
|
63
|
+
},
|
|
64
|
+
':after': {
|
|
65
|
+
content: '" "',
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
top: `${(height - controlSize) / 2}px`,
|
|
68
|
+
left: `${(height - controlSize) / 2}px`,
|
|
69
|
+
boxSizing: 'border-box',
|
|
70
|
+
width: `${controlSize}px`,
|
|
71
|
+
height: `${controlSize}px`,
|
|
72
|
+
backgroundColor: theme.colors.background,
|
|
73
|
+
borderRadius: `${controlSize * 2}px`,
|
|
74
|
+
boxShadow: `0 0 2px 1px ${theme.colors.gray[2]}`,
|
|
75
|
+
transition
|
|
53
76
|
},
|
|
54
|
-
'
|
|
77
|
+
'&:checked:after': {
|
|
55
78
|
transform: `translateX(${height}px)`,
|
|
56
79
|
boxShadow: 'none'
|
|
57
80
|
},
|
|
58
|
-
'
|
|
81
|
+
'&:checked:before': {
|
|
59
82
|
backgroundColor: (_color = color) !== null && _color !== void 0 ? _color : theme.colors.green[5],
|
|
60
83
|
borderColor: (_borderColor = borderColor) !== null && _borderColor !== void 0 ? _borderColor : theme.colors.green[2]
|
|
61
84
|
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
borderRadius: height / 2
|
|
65
|
-
}));
|
|
66
|
-
});
|
|
67
|
-
const ToggleIcon = createComponent(({
|
|
68
|
-
theme,
|
|
69
|
-
height,
|
|
70
|
-
controlSize
|
|
71
|
-
}) => ({
|
|
72
|
-
pointerEvents: 'none',
|
|
73
|
-
':before': {
|
|
74
|
-
content: '" "',
|
|
75
|
-
position: 'absolute',
|
|
76
|
-
top: 0,
|
|
77
|
-
right: 0,
|
|
78
|
-
bottom: 0,
|
|
79
|
-
left: 0,
|
|
80
|
-
color: theme.colors.white,
|
|
81
|
-
backgroundColor: theme.colors.gray[4],
|
|
82
|
-
backgroundImage: backgroundImage(isDarkMode()),
|
|
83
|
-
backgroundPosition: `${height * 0.1}px 0, ${height * 0.9}px 0`,
|
|
84
|
-
backgroundRepeat: 'no-repeat',
|
|
85
|
-
backgroundSize: 'contain',
|
|
86
|
-
border: `1px solid ${theme.colors.gray[2]}`,
|
|
87
|
-
borderRadius: `${height * 2}px`,
|
|
88
|
-
transition
|
|
89
|
-
},
|
|
90
|
-
':after': {
|
|
91
|
-
content: '" "',
|
|
92
|
-
position: 'absolute',
|
|
93
|
-
top: `${(height - controlSize) / 2}px`,
|
|
94
|
-
left: `${(height - controlSize) / 2}px`,
|
|
95
|
-
boxSizing: 'border-box',
|
|
96
|
-
width: `${controlSize}px`,
|
|
97
|
-
height: `${controlSize}px`,
|
|
98
|
-
backgroundColor: theme.colors.background,
|
|
99
|
-
borderRadius: `${controlSize * 2}px`,
|
|
100
|
-
boxShadow: `0 0 2px 1px ${theme.colors.gray[2]}`,
|
|
101
|
-
transition
|
|
102
|
-
}
|
|
103
|
-
}));
|
|
104
|
-
// Used by LabelledToggle
|
|
105
|
-
export const toggleProperties = ['value', 'onChange', 'labelledBy', 'invalid', 'height', 'color', 'testId', 'describedBy'];
|
|
85
|
+
});
|
|
86
|
+
}, 'input');
|
|
106
87
|
|
|
107
88
|
const Toggle = (_ref) => {
|
|
108
|
-
let
|
|
109
|
-
|
|
89
|
+
let value = _ref.value,
|
|
90
|
+
testId = _ref.testId,
|
|
91
|
+
onChange = _ref.onChange,
|
|
110
92
|
labelledBy = _ref.labelledBy,
|
|
111
93
|
describedBy = _ref.describedBy,
|
|
94
|
+
className = _ref.className,
|
|
112
95
|
disabled = _ref.disabled,
|
|
113
|
-
onChange = _ref.onChange,
|
|
114
|
-
testId = _ref.testId,
|
|
115
96
|
color = _ref.color,
|
|
116
97
|
borderColor = _ref.borderColor,
|
|
117
98
|
invalid = _ref.invalid,
|
|
118
|
-
name = _ref.name,
|
|
119
99
|
_ref$height = _ref.height,
|
|
120
100
|
height = _ref$height === void 0 ? 24 : _ref$height,
|
|
121
|
-
rest = _objectWithoutProperties(_ref, ["
|
|
101
|
+
rest = _objectWithoutProperties(_ref, ["value", "testId", "onChange", "labelledBy", "describedBy", "className", "disabled", "color", "borderColor", "invalid", "height"]);
|
|
122
102
|
|
|
123
103
|
const controlSize = height - 4;
|
|
124
|
-
return /*#__PURE__*/React.createElement(
|
|
104
|
+
return /*#__PURE__*/React.createElement(ToggleInput, _extends({}, rest, {
|
|
105
|
+
className: className,
|
|
106
|
+
type: "checkbox",
|
|
107
|
+
checked: value,
|
|
125
108
|
height: height,
|
|
126
109
|
controlSize: controlSize,
|
|
127
|
-
disabled: disabled,
|
|
128
110
|
color: color,
|
|
129
111
|
borderColor: borderColor,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
id: id,
|
|
133
|
-
type: "checkbox",
|
|
134
|
-
checked: value,
|
|
135
|
-
name: name,
|
|
112
|
+
disabled: disabled,
|
|
113
|
+
invalid: invalid,
|
|
136
114
|
onChange: disabled || !onChange ? undefined : e => onChange(e.target.checked),
|
|
115
|
+
"data-testid": testId,
|
|
137
116
|
"aria-labelledby": labelledBy,
|
|
138
|
-
"aria-describedby": describedBy
|
|
139
|
-
disabled: disabled,
|
|
140
|
-
"data-testid": testId
|
|
141
|
-
}), /*#__PURE__*/React.createElement(ToggleIcon, {
|
|
142
|
-
height: height,
|
|
143
|
-
controlSize: controlSize
|
|
117
|
+
"aria-describedby": describedBy
|
|
144
118
|
}));
|
|
145
119
|
};
|
|
146
120
|
|
package/es/index.js
CHANGED
package/lib/Toggle.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -36,7 +36,7 @@ var backgroundImage = function backgroundImage(darkMode) {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
var transition = 'all .25s ease';
|
|
39
|
-
var
|
|
39
|
+
var ToggleInput = (0, _styleContainer.createStyledComponent)(function (_ref) {
|
|
40
40
|
var _color, _borderColor;
|
|
41
41
|
|
|
42
42
|
var theme = _ref.theme,
|
|
@@ -47,6 +47,7 @@ var Container = (0, _styleContainer.createStyledComponent)(function (_ref) {
|
|
|
47
47
|
invalid = _ref.invalid,
|
|
48
48
|
disabled = _ref.disabled;
|
|
49
49
|
return _objectSpread({
|
|
50
|
+
appearance: 'none',
|
|
50
51
|
position: 'relative',
|
|
51
52
|
display: 'inline-block',
|
|
52
53
|
width: "".concat(height * 2, "px"),
|
|
@@ -55,37 +56,10 @@ var Container = (0, _styleContainer.createStyledComponent)(function (_ref) {
|
|
|
55
56
|
opacity: disabled ? 0.5 : 1,
|
|
56
57
|
transition: 'opacity .25s ease',
|
|
57
58
|
borderRadius: "".concat(controlSize * 2, "px"),
|
|
58
|
-
'
|
|
59
|
-
position: 'absolute',
|
|
60
|
-
top: 0,
|
|
61
|
-
right: 0,
|
|
62
|
-
bottom: 0,
|
|
63
|
-
left: 0,
|
|
64
|
-
height: '100%',
|
|
65
|
-
width: '100%',
|
|
66
|
-
margin: 0,
|
|
67
|
-
opacity: 0,
|
|
68
|
-
cursor: disabled ? 'not-allowed' : 'pointer'
|
|
69
|
-
},
|
|
70
|
-
'> input[type=checkbox]:checked + div:after': {
|
|
71
|
-
transform: "translateX(".concat(height, "px)"),
|
|
72
|
-
boxShadow: 'none'
|
|
73
|
-
},
|
|
74
|
-
'> input[type=checkbox]:checked + div:before': {
|
|
75
|
-
backgroundColor: (_color = color) !== null && _color !== void 0 ? _color : theme.colors.green[5],
|
|
76
|
-
borderColor: (_borderColor = borderColor) !== null && _borderColor !== void 0 ? _borderColor : theme.colors.green[2]
|
|
77
|
-
}
|
|
59
|
+
cursor: disabled ? 'not-allowed' : 'pointer'
|
|
78
60
|
}, theme.mixins.focus({
|
|
79
|
-
invalid: invalid
|
|
80
|
-
|
|
81
|
-
}));
|
|
82
|
-
});
|
|
83
|
-
var ToggleIcon = (0, _styleContainer.createComponent)(function (_ref2) {
|
|
84
|
-
var theme = _ref2.theme,
|
|
85
|
-
height = _ref2.height,
|
|
86
|
-
controlSize = _ref2.controlSize;
|
|
87
|
-
return {
|
|
88
|
-
pointerEvents: 'none',
|
|
61
|
+
invalid: invalid
|
|
62
|
+
}), {
|
|
89
63
|
':before': {
|
|
90
64
|
content: '" "',
|
|
91
65
|
position: 'absolute',
|
|
@@ -115,52 +89,50 @@ var ToggleIcon = (0, _styleContainer.createComponent)(function (_ref2) {
|
|
|
115
89
|
borderRadius: "".concat(controlSize * 2, "px"),
|
|
116
90
|
boxShadow: "0 0 2px 1px ".concat(theme.colors.gray[2]),
|
|
117
91
|
transition: transition
|
|
92
|
+
},
|
|
93
|
+
'&:checked:after': {
|
|
94
|
+
transform: "translateX(".concat(height, "px)"),
|
|
95
|
+
boxShadow: 'none'
|
|
96
|
+
},
|
|
97
|
+
'&:checked:before': {
|
|
98
|
+
backgroundColor: (_color = color) !== null && _color !== void 0 ? _color : theme.colors.green[5],
|
|
99
|
+
borderColor: (_borderColor = borderColor) !== null && _borderColor !== void 0 ? _borderColor : theme.colors.green[2]
|
|
118
100
|
}
|
|
119
|
-
};
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
name = _ref3.name,
|
|
137
|
-
_ref3$height = _ref3.height,
|
|
138
|
-
height = _ref3$height === void 0 ? 24 : _ref3$height,
|
|
139
|
-
rest = _objectWithoutProperties(_ref3, ["id", "value", "labelledBy", "describedBy", "disabled", "onChange", "testId", "color", "borderColor", "invalid", "name", "height"]);
|
|
101
|
+
});
|
|
102
|
+
}, 'input');
|
|
103
|
+
|
|
104
|
+
var Toggle = function Toggle(_ref2) {
|
|
105
|
+
var value = _ref2.value,
|
|
106
|
+
testId = _ref2.testId,
|
|
107
|
+
onChange = _ref2.onChange,
|
|
108
|
+
labelledBy = _ref2.labelledBy,
|
|
109
|
+
describedBy = _ref2.describedBy,
|
|
110
|
+
className = _ref2.className,
|
|
111
|
+
disabled = _ref2.disabled,
|
|
112
|
+
color = _ref2.color,
|
|
113
|
+
borderColor = _ref2.borderColor,
|
|
114
|
+
invalid = _ref2.invalid,
|
|
115
|
+
_ref2$height = _ref2.height,
|
|
116
|
+
height = _ref2$height === void 0 ? 24 : _ref2$height,
|
|
117
|
+
rest = _objectWithoutProperties(_ref2, ["value", "testId", "onChange", "labelledBy", "describedBy", "className", "disabled", "color", "borderColor", "invalid", "height"]);
|
|
140
118
|
|
|
141
119
|
var controlSize = height - 4;
|
|
142
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
120
|
+
return /*#__PURE__*/_react.default.createElement(ToggleInput, _extends({}, rest, {
|
|
121
|
+
className: className,
|
|
122
|
+
type: "checkbox",
|
|
123
|
+
checked: value,
|
|
143
124
|
height: height,
|
|
144
125
|
controlSize: controlSize,
|
|
145
|
-
disabled: disabled,
|
|
146
126
|
color: color,
|
|
147
127
|
borderColor: borderColor,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
id: id,
|
|
151
|
-
type: "checkbox",
|
|
152
|
-
checked: value,
|
|
153
|
-
name: name,
|
|
128
|
+
disabled: disabled,
|
|
129
|
+
invalid: invalid,
|
|
154
130
|
onChange: disabled || !onChange ? undefined : function (e) {
|
|
155
131
|
return onChange(e.target.checked);
|
|
156
132
|
},
|
|
133
|
+
"data-testid": testId,
|
|
157
134
|
"aria-labelledby": labelledBy,
|
|
158
|
-
"aria-describedby": describedBy
|
|
159
|
-
disabled: disabled,
|
|
160
|
-
"data-testid": testId
|
|
161
|
-
}), /*#__PURE__*/_react.default.createElement(ToggleIcon, {
|
|
162
|
-
height: height,
|
|
163
|
-
controlSize: controlSize
|
|
135
|
+
"aria-describedby": describedBy
|
|
164
136
|
}));
|
|
165
137
|
};
|
|
166
138
|
|
package/lib/index.js
CHANGED
|
@@ -9,15 +9,7 @@ Object.defineProperty(exports, "Toggle", {
|
|
|
9
9
|
return _Toggle.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "LabelledToggle", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _LabelledToggle.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
12
|
|
|
19
13
|
var _Toggle = _interopRequireDefault(require("./Toggle"));
|
|
20
14
|
|
|
21
|
-
var _LabelledToggle = _interopRequireDefault(require("./LabelledToggle"));
|
|
22
|
-
|
|
23
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/component-toggle",
|
|
3
3
|
"description": "Cloudflare Toggle Component",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
7
|
"author": "James Kyle <jkyle@cloudflare.com>",
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@cloudflare/component-icon": "^6.6.
|
|
15
|
-
"@cloudflare/elements": "^1.11.
|
|
16
|
-
"@cloudflare/intl-react": "^1.9.
|
|
17
|
-
"@cloudflare/style-const": "^5.
|
|
18
|
-
"@cloudflare/style-container": "^7.
|
|
19
|
-
"@cloudflare/types": "^6.11.
|
|
14
|
+
"@cloudflare/component-icon": "^6.6.9",
|
|
15
|
+
"@cloudflare/elements": "^1.11.39",
|
|
16
|
+
"@cloudflare/intl-react": "^1.9.24",
|
|
17
|
+
"@cloudflare/style-const": "^5.2.0",
|
|
18
|
+
"@cloudflare/style-container": "^7.6.0",
|
|
19
|
+
"@cloudflare/types": "^6.11.19",
|
|
20
20
|
"prop-types": "^15.6.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"test-coverage": "stratus test --coverage",
|
|
34
34
|
"test-watch": "stratus test --watch"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "b7c207b9d1a4a78c3412f7ad4185e92ec36c4f5e"
|
|
37
37
|
}
|
package/dist/LabelledToggle.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React, { ComponentProps, ReactNode } from 'react';
|
|
2
|
-
import Toggle from './Toggle';
|
|
3
|
-
declare type Props = ComponentProps<typeof Toggle> & {
|
|
4
|
-
label?: ReactNode;
|
|
5
|
-
error?: ReactNode;
|
|
6
|
-
layout?: 'vertical' | 'horizontal';
|
|
7
|
-
};
|
|
8
|
-
declare const LabelledToggle: React.FC<Props>;
|
|
9
|
-
export default LabelledToggle;
|
package/es/LabelledToggle.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
|
|
3
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
-
|
|
5
|
-
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; }
|
|
6
|
-
|
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
8
|
-
|
|
9
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
-
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import { createStyledComponent } from '@cloudflare/style-container';
|
|
13
|
-
import { Div, Label } from '@cloudflare/elements';
|
|
14
|
-
import Toggle, { toggleProperties } from './Toggle';
|
|
15
|
-
const ToggleError = createStyledComponent(({
|
|
16
|
-
theme
|
|
17
|
-
}) => _objectSpread({}, theme.mixins.error()));
|
|
18
|
-
|
|
19
|
-
const LabelledToggle = (_ref) => {
|
|
20
|
-
let label = _ref.label,
|
|
21
|
-
error = _ref.error,
|
|
22
|
-
layout = _ref.layout,
|
|
23
|
-
rest = _objectWithoutProperties(_ref, ["label", "error", "layout"]);
|
|
24
|
-
|
|
25
|
-
const wrapperProps = {};
|
|
26
|
-
const toggleProps = {}; // Any properties which don't belong to the Toggle directly are applied to
|
|
27
|
-
// wrapper
|
|
28
|
-
|
|
29
|
-
Object.keys(rest).forEach(prop => {
|
|
30
|
-
if (toggleProperties.includes(prop)) {
|
|
31
|
-
toggleProps[prop] = rest[prop];
|
|
32
|
-
} else {
|
|
33
|
-
wrapperProps[prop] = rest[prop];
|
|
34
|
-
}
|
|
35
|
-
}, {});
|
|
36
|
-
const isVertical = layout === 'vertical';
|
|
37
|
-
const toggle = /*#__PURE__*/React.createElement(Toggle, rest);
|
|
38
|
-
const err = !!error && /*#__PURE__*/React.createElement(ToggleError, null, error);
|
|
39
|
-
return /*#__PURE__*/React.createElement(Div, _extends({
|
|
40
|
-
textAlign: "left"
|
|
41
|
-
}, wrapperProps), label ? /*#__PURE__*/React.createElement(Label, {
|
|
42
|
-
display: "flex",
|
|
43
|
-
alignItems: "center",
|
|
44
|
-
flexDirection: isVertical ? 'column' : 'row'
|
|
45
|
-
}, toggle, isVertical && err, /*#__PURE__*/React.createElement(Div, {
|
|
46
|
-
ml: 2,
|
|
47
|
-
mt: isVertical ? 1 : 0
|
|
48
|
-
}, label)) : toggle, !isVertical && err);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default LabelledToggle;
|
package/lib/LabelledToggle.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _styleContainer = require("@cloudflare/style-container");
|
|
13
|
-
|
|
14
|
-
var _elements = require("@cloudflare/elements");
|
|
15
|
-
|
|
16
|
-
var _Toggle = _interopRequireWildcard(require("./Toggle"));
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
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); }
|
|
25
|
-
|
|
26
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
|
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
31
|
-
|
|
32
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
|
-
|
|
34
|
-
var ToggleError = (0, _styleContainer.createStyledComponent)(function (_ref) {
|
|
35
|
-
var theme = _ref.theme;
|
|
36
|
-
return _objectSpread({}, theme.mixins.error());
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
var LabelledToggle = function LabelledToggle(_ref2) {
|
|
40
|
-
var label = _ref2.label,
|
|
41
|
-
error = _ref2.error,
|
|
42
|
-
layout = _ref2.layout,
|
|
43
|
-
rest = _objectWithoutProperties(_ref2, ["label", "error", "layout"]);
|
|
44
|
-
|
|
45
|
-
var wrapperProps = {};
|
|
46
|
-
var toggleProps = {}; // Any properties which don't belong to the Toggle directly are applied to
|
|
47
|
-
// wrapper
|
|
48
|
-
|
|
49
|
-
Object.keys(rest).forEach(function (prop) {
|
|
50
|
-
if (_Toggle.toggleProperties.includes(prop)) {
|
|
51
|
-
toggleProps[prop] = rest[prop];
|
|
52
|
-
} else {
|
|
53
|
-
wrapperProps[prop] = rest[prop];
|
|
54
|
-
}
|
|
55
|
-
}, {});
|
|
56
|
-
var isVertical = layout === 'vertical';
|
|
57
|
-
|
|
58
|
-
var toggle = /*#__PURE__*/_react.default.createElement(_Toggle.default, rest);
|
|
59
|
-
|
|
60
|
-
var err = !!error && /*#__PURE__*/_react.default.createElement(ToggleError, null, error);
|
|
61
|
-
|
|
62
|
-
return /*#__PURE__*/_react.default.createElement(_elements.Div, _extends({
|
|
63
|
-
textAlign: "left"
|
|
64
|
-
}, wrapperProps), label ? /*#__PURE__*/_react.default.createElement(_elements.Label, {
|
|
65
|
-
display: "flex",
|
|
66
|
-
alignItems: "center",
|
|
67
|
-
flexDirection: isVertical ? 'column' : 'row'
|
|
68
|
-
}, toggle, isVertical && err, /*#__PURE__*/_react.default.createElement(_elements.Div, {
|
|
69
|
-
ml: 2,
|
|
70
|
-
mt: isVertical ? 1 : 0
|
|
71
|
-
}, label)) : toggle, !isVertical && err);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
var _default = LabelledToggle;
|
|
75
|
-
exports.default = _default;
|