@kanso-labs/react-native-kanso-ui 0.0.0-stage → 0.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/LICENSE.md +20 -0
- package/README.md +205 -2
- package/dist/button/index.d.ts +56 -0
- package/dist/button/index.js +169 -0
- package/dist/button/index.js.map +1 -0
- package/dist/button/palettes.js +47 -0
- package/dist/button/palettes.js.map +1 -0
- package/dist/chip/index.js +194 -0
- package/dist/chip/index.js.map +1 -0
- package/dist/chip/styles.js +36 -0
- package/dist/chip/styles.js.map +1 -0
- package/dist/clipboard/index.js +58 -0
- package/dist/clipboard/index.js.map +1 -0
- package/dist/components/avatar/index.d.ts +82 -0
- package/dist/components/avatar/index.js +62 -0
- package/dist/components/avatar/index.js.map +1 -0
- package/dist/components/button/index.d.ts +87 -0
- package/dist/components/button/index.js +377 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/card/index.d.ts +78 -0
- package/dist/components/card/index.js +315 -0
- package/dist/components/card/index.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +76 -0
- package/dist/components/checkbox/index.js +360 -0
- package/dist/components/checkbox/index.js.map +1 -0
- package/dist/components/chip/index.d.ts +84 -0
- package/dist/components/chip/index.js +257 -0
- package/dist/components/chip/index.js.map +1 -0
- package/dist/components/chip-group/index.d.ts +143 -0
- package/dist/components/chip-group/index.js +669 -0
- package/dist/components/chip-group/index.js.map +1 -0
- package/dist/components/copy-field/index.d.ts +60 -0
- package/dist/components/copy-field/index.js +277 -0
- package/dist/components/copy-field/index.js.map +1 -0
- package/dist/components/currency/index.d.ts +69 -0
- package/dist/components/currency/index.js +162 -0
- package/dist/components/currency/index.js.map +1 -0
- package/dist/components/form/index.d.ts +84 -0
- package/dist/components/form/index.js +95 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/icon-button/index.d.ts +68 -0
- package/dist/components/icon-button/index.js +289 -0
- package/dist/components/icon-button/index.js.map +1 -0
- package/dist/components/link/index.d.ts +59 -0
- package/dist/components/link/index.js +191 -0
- package/dist/components/link/index.js.map +1 -0
- package/dist/components/number-field/index.d.ts +151 -0
- package/dist/components/number-field/index.js +832 -0
- package/dist/components/number-field/index.js.map +1 -0
- package/dist/components/product-icon/index.d.ts +70 -0
- package/dist/components/product-icon/index.js +60 -0
- package/dist/components/product-icon/index.js.map +1 -0
- package/dist/components/radio-group/index.d.ts +105 -0
- package/dist/components/radio-group/index.js +597 -0
- package/dist/components/radio-group/index.js.map +1 -0
- package/dist/components/search-field/index.d.ts +98 -0
- package/dist/components/search-field/index.js +521 -0
- package/dist/components/search-field/index.js.map +1 -0
- package/dist/components/segmented-button/index.d.ts +113 -0
- package/dist/components/segmented-button/index.js +937 -0
- package/dist/components/segmented-button/index.js.map +1 -0
- package/dist/components/separator/index.d.ts +45 -0
- package/dist/components/separator/index.js +109 -0
- package/dist/components/separator/index.js.map +1 -0
- package/dist/components/stack/index.d.ts +70 -0
- package/dist/components/stack/index.js +107 -0
- package/dist/components/stack/index.js.map +1 -0
- package/dist/components/switch/index.d.ts +76 -0
- package/dist/components/switch/index.js +591 -0
- package/dist/components/switch/index.js.map +1 -0
- package/dist/components/text/index.d.ts +44 -0
- package/dist/components/text/index.js +78 -0
- package/dist/components/text/index.js.map +1 -0
- package/dist/components/text-field/index.d.ts +146 -0
- package/dist/components/text-field/index.js +228 -0
- package/dist/components/text-field/index.js.map +1 -0
- package/dist/control/index.js +117 -0
- package/dist/control/index.js.map +1 -0
- package/dist/control/styles.js +36 -0
- package/dist/control/styles.js.map +1 -0
- package/dist/field/index.d.ts +13 -0
- package/dist/field/index.js +1007 -0
- package/dist/field/index.js.map +1 -0
- package/dist/field/styles.js +131 -0
- package/dist/field/styles.js.map +1 -0
- package/dist/form/index.d.ts +24 -0
- package/dist/form/index.js +209 -0
- package/dist/form/index.js.map +1 -0
- package/dist/glyphs/icon-style.d.ts +25 -0
- package/dist/glyphs/icon-style.js +22 -0
- package/dist/glyphs/icon-style.js.map +1 -0
- package/dist/glyphs/index.js +170 -0
- package/dist/glyphs/index.js.map +1 -0
- package/dist/glyphs/styles.js +7 -0
- package/dist/glyphs/styles.js.map +1 -0
- package/dist/hooks/useWindowSizeClass.d.ts +25 -0
- package/dist/hooks/useWindowSizeClass.js +39 -0
- package/dist/hooks/useWindowSizeClass.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +27 -0
- package/dist/mark/image.js +61 -0
- package/dist/mark/image.js.map +1 -0
- package/dist/mark/index.d.ts +9 -0
- package/dist/mark/index.js +234 -0
- package/dist/mark/index.js.map +1 -0
- package/dist/mark/initials.js +65 -0
- package/dist/mark/initials.js.map +1 -0
- package/dist/mark/styles.d.ts +1 -0
- package/dist/mark/styles.js +73 -0
- package/dist/mark/styles.js.map +1 -0
- package/dist/number/parser.js +321 -0
- package/dist/number/parser.js.map +1 -0
- package/dist/number/state.js +235 -0
- package/dist/number/state.js.map +1 -0
- package/dist/overlay/host.js +111 -0
- package/dist/overlay/host.js.map +1 -0
- package/dist/press/index.js +350 -0
- package/dist/press/index.js.map +1 -0
- package/dist/press/styles.js +31 -0
- package/dist/press/styles.js.map +1 -0
- package/dist/router/index.d.ts +28 -0
- package/dist/router/index.js +82 -0
- package/dist/router/index.js.map +1 -0
- package/dist/theme/color.js +25 -0
- package/dist/theme/color.js.map +1 -0
- package/dist/theme/resolve.d.ts +6 -0
- package/dist/theme/resolve.js +310 -0
- package/dist/theme/resolve.js.map +1 -0
- package/dist/theme/scope.d.ts +42 -0
- package/dist/theme/scope.js +80 -0
- package/dist/theme/scope.js.map +1 -0
- package/dist/theme/styles.js +39 -0
- package/dist/theme/styles.js.map +1 -0
- package/dist/theme-scope.d.ts +56 -0
- package/dist/theme-scope.js +127 -0
- package/dist/theme-scope.js.map +1 -0
- package/dist/tokens/defaults.d.ts +407 -0
- package/dist/tokens/defaults.js +403 -0
- package/dist/tokens/defaults.js.map +1 -0
- package/dist/typography/fonts.js +84 -0
- package/dist/typography/fonts.js.map +1 -0
- package/dist/typography/roles.d.ts +10 -0
- package/dist/typography/roles.js +82 -0
- package/dist/typography/roles.js.map +1 -0
- package/package.json +132 -4
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
import { CheckGlyph } from "../../glyphs/index.js";
|
|
2
|
+
import { useTheme } from "../../theme/scope.js";
|
|
3
|
+
import { composeStyles, themedStyles } from "../../theme/styles.js";
|
|
4
|
+
import { withOpacity } from "../../theme/color.js";
|
|
5
|
+
import { hitSlop, usePressFeedback } from "../../press/index.js";
|
|
6
|
+
import { controlStylesOf } from "../../control/styles.js";
|
|
7
|
+
import { ControlLabel, ControlMessage, describedBy, messageOf } from "../../control/index.js";
|
|
8
|
+
import { c } from "react/compiler-runtime";
|
|
9
|
+
import { I18nManager, Platform, Pressable, StyleSheet, View } from "react-native";
|
|
10
|
+
import { useId, useState } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import Animated, { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from "react-native-reanimated";
|
|
13
|
+
import { useToggleState } from "react-stately/useToggleState";
|
|
14
|
+
import { Gesture, GestureDetector, GestureHandlerRootView } from "react-native-gesture-handler";
|
|
15
|
+
//#region src/components/switch/index.tsx
|
|
16
|
+
const TRACK_WIDTH = 52;
|
|
17
|
+
const TRACK_HEIGHT = 32;
|
|
18
|
+
const TRACK_RULE = 2;
|
|
19
|
+
const HANDLE_OFF = 16;
|
|
20
|
+
const HANDLE_ON = 24;
|
|
21
|
+
const HANDLE_PRESSED = 28;
|
|
22
|
+
const ICON_SIZE = 16;
|
|
23
|
+
const TRAVEL = 20;
|
|
24
|
+
const DRAG_SLOP = TRAVEL / 2;
|
|
25
|
+
const styles = StyleSheet.create({
|
|
26
|
+
control: {
|
|
27
|
+
flexShrink: 0,
|
|
28
|
+
height: 40,
|
|
29
|
+
width: TRACK_WIDTH
|
|
30
|
+
},
|
|
31
|
+
drag: {
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
flexGrow: 1,
|
|
34
|
+
justifyContent: "center"
|
|
35
|
+
},
|
|
36
|
+
handle: {
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
justifyContent: "center"
|
|
39
|
+
},
|
|
40
|
+
layer: {
|
|
41
|
+
height: 40,
|
|
42
|
+
position: "absolute",
|
|
43
|
+
start: -6,
|
|
44
|
+
top: -6,
|
|
45
|
+
width: 40
|
|
46
|
+
},
|
|
47
|
+
seat: {
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
height: HANDLE_PRESSED,
|
|
50
|
+
justifyContent: "center",
|
|
51
|
+
position: "absolute",
|
|
52
|
+
start: 0,
|
|
53
|
+
top: 0,
|
|
54
|
+
width: HANDLE_PRESSED
|
|
55
|
+
},
|
|
56
|
+
track: {
|
|
57
|
+
borderWidth: TRACK_RULE,
|
|
58
|
+
height: TRACK_HEIGHT,
|
|
59
|
+
width: TRACK_WIDTH
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const stylesOf = themedStyles(({ radii, spacing }) => StyleSheet.create({
|
|
63
|
+
handle: { borderRadius: radii.circle },
|
|
64
|
+
messages: { marginStart: TRACK_WIDTH + spacing.sm },
|
|
65
|
+
track: { borderRadius: radii.pill }
|
|
66
|
+
}));
|
|
67
|
+
function flipOf(state, took) {
|
|
68
|
+
return () => {
|
|
69
|
+
if (took.get()) {
|
|
70
|
+
took.set(false);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
state.toggle();
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* What the switch is painted in: the track's fill and rule, the handle and
|
|
78
|
+
* the icon. Where the page draws no rule it is the fill made clear rather than
|
|
79
|
+
* plain transparent black, so the rule eases through its own colour rather
|
|
80
|
+
* than through grey.
|
|
81
|
+
*/
|
|
82
|
+
function paintOf({ colors, stateLayerOpacity }, { active, isDisabled, on }) {
|
|
83
|
+
const disabledContent = withOpacity(colors.onSurface, stateLayerOpacity.disabledContent);
|
|
84
|
+
if (isDisabled) {
|
|
85
|
+
const fill = withOpacity(on ? colors.onSurface : colors.surfaceContainerHighest, stateLayerOpacity.disabledContainer);
|
|
86
|
+
return {
|
|
87
|
+
fill,
|
|
88
|
+
glyph: disabledContent,
|
|
89
|
+
handle: on ? colors.surface : disabledContent,
|
|
90
|
+
rule: on ? withOpacity(fill, 0) : withOpacity(colors.onSurface, stateLayerOpacity.disabledContainer)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (on) return {
|
|
94
|
+
fill: colors.primary,
|
|
95
|
+
glyph: colors.onPrimaryContainer,
|
|
96
|
+
handle: active ? colors.primaryContainer : colors.onPrimary,
|
|
97
|
+
rule: colors.primary
|
|
98
|
+
};
|
|
99
|
+
return {
|
|
100
|
+
fill: colors.surfaceContainerHighest,
|
|
101
|
+
glyph: colors.onPrimaryContainer,
|
|
102
|
+
handle: active ? colors.onSurfaceVariant : colors.outline,
|
|
103
|
+
rule: colors.outline
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A switch that turns a setting on or off, with its label and optionally a
|
|
108
|
+
* description or an error under it. Its state is React Stately's, as web's
|
|
109
|
+
* is: pass `isSelected` with `onChange` to control it, or `defaultSelected` to
|
|
110
|
+
* let it keep its own. A switch takes effect as it is flipped, which is what
|
|
111
|
+
* sets it apart from a checkbox in a form.
|
|
112
|
+
*
|
|
113
|
+
* ```tsx
|
|
114
|
+
* <Switch defaultSelected description="Supporting line">
|
|
115
|
+
* Label
|
|
116
|
+
* </Switch>
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* A screen reader hears it as a switch named by its label, on or off,
|
|
120
|
+
* followed by the line under it. A press anywhere on the track or the label
|
|
121
|
+
* flips it, and the handle can be dragged across the track, settling on
|
|
122
|
+
* whichever side it is let go. `style`, `ref` and `testID` land on the view
|
|
123
|
+
* holding the row and the line under it, which is the element a layout
|
|
124
|
+
* positions. With a `testID`, the drag is registered with Gesture Handler as
|
|
125
|
+
* `<testID>-drag`, which its `getByGestureTestId` finds in a test.
|
|
126
|
+
*/
|
|
127
|
+
function Switch(t0) {
|
|
128
|
+
const $ = c(110);
|
|
129
|
+
let ariaLabel;
|
|
130
|
+
let children;
|
|
131
|
+
let defaultSelected;
|
|
132
|
+
let description;
|
|
133
|
+
let error;
|
|
134
|
+
let isSelected;
|
|
135
|
+
let onChange;
|
|
136
|
+
let props;
|
|
137
|
+
let style;
|
|
138
|
+
let t1;
|
|
139
|
+
let t2;
|
|
140
|
+
let t3;
|
|
141
|
+
let testID;
|
|
142
|
+
if ($[0] !== t0) {
|
|
143
|
+
({"aria-label": ariaLabel, children, defaultSelected, description, error, icon: t1, isDisabled: t2, isReadOnly: t3, isSelected, onChange, style, testID, ...props} = t0);
|
|
144
|
+
$[0] = t0;
|
|
145
|
+
$[1] = ariaLabel;
|
|
146
|
+
$[2] = children;
|
|
147
|
+
$[3] = defaultSelected;
|
|
148
|
+
$[4] = description;
|
|
149
|
+
$[5] = error;
|
|
150
|
+
$[6] = isSelected;
|
|
151
|
+
$[7] = onChange;
|
|
152
|
+
$[8] = props;
|
|
153
|
+
$[9] = style;
|
|
154
|
+
$[10] = t1;
|
|
155
|
+
$[11] = t2;
|
|
156
|
+
$[12] = t3;
|
|
157
|
+
$[13] = testID;
|
|
158
|
+
} else {
|
|
159
|
+
ariaLabel = $[1];
|
|
160
|
+
children = $[2];
|
|
161
|
+
defaultSelected = $[3];
|
|
162
|
+
description = $[4];
|
|
163
|
+
error = $[5];
|
|
164
|
+
isSelected = $[6];
|
|
165
|
+
onChange = $[7];
|
|
166
|
+
props = $[8];
|
|
167
|
+
style = $[9];
|
|
168
|
+
t1 = $[10];
|
|
169
|
+
t2 = $[11];
|
|
170
|
+
t3 = $[12];
|
|
171
|
+
testID = $[13];
|
|
172
|
+
}
|
|
173
|
+
const icon = t1 === void 0 ? false : t1;
|
|
174
|
+
const isDisabled = t2 === void 0 ? false : t2;
|
|
175
|
+
const isReadOnly = t3 === void 0 ? false : t3;
|
|
176
|
+
const theme = useTheme();
|
|
177
|
+
const own = stylesOf(theme);
|
|
178
|
+
let t4;
|
|
179
|
+
if ($[14] !== defaultSelected || $[15] !== isReadOnly || $[16] !== isSelected || $[17] !== onChange) {
|
|
180
|
+
t4 = {
|
|
181
|
+
defaultSelected,
|
|
182
|
+
isReadOnly,
|
|
183
|
+
isSelected,
|
|
184
|
+
onChange
|
|
185
|
+
};
|
|
186
|
+
$[14] = defaultSelected;
|
|
187
|
+
$[15] = isReadOnly;
|
|
188
|
+
$[16] = isSelected;
|
|
189
|
+
$[17] = onChange;
|
|
190
|
+
$[18] = t4;
|
|
191
|
+
} else t4 = $[18];
|
|
192
|
+
const state = useToggleState(t4);
|
|
193
|
+
const messageId = useId();
|
|
194
|
+
const { colors, radii } = theme;
|
|
195
|
+
const on = state.isSelected;
|
|
196
|
+
const interactive = !isDisabled && !isReadOnly;
|
|
197
|
+
let t5;
|
|
198
|
+
if ($[19] !== interactive || $[20] !== on || $[21] !== state || $[22] !== testID) {
|
|
199
|
+
t5 = {
|
|
200
|
+
enabled: interactive,
|
|
201
|
+
on,
|
|
202
|
+
state,
|
|
203
|
+
testID
|
|
204
|
+
};
|
|
205
|
+
$[19] = interactive;
|
|
206
|
+
$[20] = on;
|
|
207
|
+
$[21] = state;
|
|
208
|
+
$[22] = testID;
|
|
209
|
+
$[23] = t5;
|
|
210
|
+
} else t5 = $[23];
|
|
211
|
+
const drag = useHandleDrag(t5);
|
|
212
|
+
const t6 = on ? colors.primary : colors.onSurface;
|
|
213
|
+
let t7;
|
|
214
|
+
if ($[24] !== radii.circle) {
|
|
215
|
+
t7 = { borderRadius: radii.circle };
|
|
216
|
+
$[24] = radii.circle;
|
|
217
|
+
$[25] = t7;
|
|
218
|
+
} else t7 = $[25];
|
|
219
|
+
const t8 = !interactive;
|
|
220
|
+
let t9;
|
|
221
|
+
if ($[26] !== drag.onPressIn || $[27] !== t6 || $[28] !== t7 || $[29] !== t8) {
|
|
222
|
+
t9 = {
|
|
223
|
+
color: t6,
|
|
224
|
+
corners: t7,
|
|
225
|
+
disabled: t8,
|
|
226
|
+
disc: 40,
|
|
227
|
+
onPressIn: drag.onPressIn
|
|
228
|
+
};
|
|
229
|
+
$[26] = drag.onPressIn;
|
|
230
|
+
$[27] = t6;
|
|
231
|
+
$[28] = t7;
|
|
232
|
+
$[29] = t8;
|
|
233
|
+
$[30] = t9;
|
|
234
|
+
} else t9 = $[30];
|
|
235
|
+
const feedback = usePressFeedback(t9);
|
|
236
|
+
const active = interactive && (drag.dragging || feedback.hovered || feedback.pressed || feedback.ring !== void 0);
|
|
237
|
+
let t10;
|
|
238
|
+
if ($[31] !== active || $[32] !== isDisabled || $[33] !== on || $[34] !== theme) {
|
|
239
|
+
t10 = paintOf(theme, {
|
|
240
|
+
active,
|
|
241
|
+
isDisabled,
|
|
242
|
+
on
|
|
243
|
+
});
|
|
244
|
+
$[31] = active;
|
|
245
|
+
$[32] = isDisabled;
|
|
246
|
+
$[33] = on;
|
|
247
|
+
$[34] = theme;
|
|
248
|
+
$[35] = t10;
|
|
249
|
+
} else t10 = $[35];
|
|
250
|
+
const paint = t10;
|
|
251
|
+
const size = drag.dragging || feedback.pressed ? HANDLE_PRESSED : on ? HANDLE_ON : HANDLE_OFF;
|
|
252
|
+
let t11;
|
|
253
|
+
if ($[36] !== drag.offset || $[37] !== on || $[38] !== size) {
|
|
254
|
+
t11 = {
|
|
255
|
+
offset: drag.offset,
|
|
256
|
+
on,
|
|
257
|
+
size
|
|
258
|
+
};
|
|
259
|
+
$[36] = drag.offset;
|
|
260
|
+
$[37] = on;
|
|
261
|
+
$[38] = size;
|
|
262
|
+
$[39] = t11;
|
|
263
|
+
} else t11 = $[39];
|
|
264
|
+
const motion = useSwitchMotion(paint, t11);
|
|
265
|
+
const T0 = View;
|
|
266
|
+
const T1 = Pressable;
|
|
267
|
+
const t12 = "switch";
|
|
268
|
+
let t13;
|
|
269
|
+
if ($[40] !== description || $[41] !== error || $[42] !== messageId) {
|
|
270
|
+
t13 = describedBy(messageId, messageOf(description, error));
|
|
271
|
+
$[40] = description;
|
|
272
|
+
$[41] = error;
|
|
273
|
+
$[42] = messageId;
|
|
274
|
+
$[43] = t13;
|
|
275
|
+
} else t13 = $[43];
|
|
276
|
+
const t14 = feedback.handlers;
|
|
277
|
+
let t15;
|
|
278
|
+
if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
|
|
279
|
+
t15 = hitSlop(40, TRACK_WIDTH);
|
|
280
|
+
$[44] = t15;
|
|
281
|
+
} else t15 = $[44];
|
|
282
|
+
let t16;
|
|
283
|
+
if ($[45] !== drag || $[46] !== state) {
|
|
284
|
+
t16 = drag.pressOf(state);
|
|
285
|
+
$[45] = drag;
|
|
286
|
+
$[46] = state;
|
|
287
|
+
$[47] = t16;
|
|
288
|
+
} else t16 = $[47];
|
|
289
|
+
let t17;
|
|
290
|
+
if ($[48] !== theme) {
|
|
291
|
+
t17 = controlStylesOf(theme);
|
|
292
|
+
$[48] = theme;
|
|
293
|
+
$[49] = t17;
|
|
294
|
+
} else t17 = $[49];
|
|
295
|
+
const t18 = t17.row;
|
|
296
|
+
const T2 = GestureHandlerRootView;
|
|
297
|
+
const t19 = styles;
|
|
298
|
+
const T3 = GestureDetector;
|
|
299
|
+
const t20 = drag.gesture;
|
|
300
|
+
const T4 = View;
|
|
301
|
+
const t21 = styles;
|
|
302
|
+
const t22 = Animated;
|
|
303
|
+
const t23 = composeStyles(styles.track, own.track, motion.track, feedback.ring);
|
|
304
|
+
const t24 = Animated;
|
|
305
|
+
let t25;
|
|
306
|
+
if ($[50] !== motion.seat) {
|
|
307
|
+
t25 = composeStyles(styles.seat, motion.seat);
|
|
308
|
+
$[50] = motion.seat;
|
|
309
|
+
$[51] = t25;
|
|
310
|
+
} else t25 = $[51];
|
|
311
|
+
let t26;
|
|
312
|
+
if ($[52] !== feedback.layer) {
|
|
313
|
+
t26 = /* @__PURE__ */ jsx(View, {
|
|
314
|
+
style: styles.layer,
|
|
315
|
+
children: feedback.layer
|
|
316
|
+
});
|
|
317
|
+
$[52] = feedback.layer;
|
|
318
|
+
$[53] = t26;
|
|
319
|
+
} else t26 = $[53];
|
|
320
|
+
const t27 = Animated;
|
|
321
|
+
const t28 = composeStyles(styles.handle, own.handle, motion.handle);
|
|
322
|
+
let t29;
|
|
323
|
+
if ($[54] !== icon || $[55] !== on || $[56] !== paint) {
|
|
324
|
+
t29 = icon && on ? /* @__PURE__ */ jsx(CheckGlyph, {
|
|
325
|
+
color: paint.glyph,
|
|
326
|
+
size: ICON_SIZE
|
|
327
|
+
}) : null;
|
|
328
|
+
$[54] = icon;
|
|
329
|
+
$[55] = on;
|
|
330
|
+
$[56] = paint;
|
|
331
|
+
$[57] = t29;
|
|
332
|
+
} else t29 = $[57];
|
|
333
|
+
let t30;
|
|
334
|
+
if ($[58] !== t27.View || $[59] !== t28 || $[60] !== t29) {
|
|
335
|
+
t30 = /* @__PURE__ */ jsx(t27.View, {
|
|
336
|
+
style: t28,
|
|
337
|
+
children: t29
|
|
338
|
+
});
|
|
339
|
+
$[58] = t27.View;
|
|
340
|
+
$[59] = t28;
|
|
341
|
+
$[60] = t29;
|
|
342
|
+
$[61] = t30;
|
|
343
|
+
} else t30 = $[61];
|
|
344
|
+
let t31;
|
|
345
|
+
if ($[62] !== t24.View || $[63] !== t25 || $[64] !== t26 || $[65] !== t30) {
|
|
346
|
+
t31 = /* @__PURE__ */ jsxs(t24.View, {
|
|
347
|
+
style: t25,
|
|
348
|
+
children: [t26, t30]
|
|
349
|
+
});
|
|
350
|
+
$[62] = t24.View;
|
|
351
|
+
$[63] = t25;
|
|
352
|
+
$[64] = t26;
|
|
353
|
+
$[65] = t30;
|
|
354
|
+
$[66] = t31;
|
|
355
|
+
} else t31 = $[66];
|
|
356
|
+
let t32;
|
|
357
|
+
if ($[67] !== t22.View || $[68] !== t23 || $[69] !== t31) {
|
|
358
|
+
t32 = /* @__PURE__ */ jsx(t22.View, {
|
|
359
|
+
style: t23,
|
|
360
|
+
children: t31
|
|
361
|
+
});
|
|
362
|
+
$[67] = t22.View;
|
|
363
|
+
$[68] = t23;
|
|
364
|
+
$[69] = t31;
|
|
365
|
+
$[70] = t32;
|
|
366
|
+
} else t32 = $[70];
|
|
367
|
+
let t33;
|
|
368
|
+
if ($[71] !== T4 || $[72] !== t21.drag || $[73] !== t32) {
|
|
369
|
+
t33 = /* @__PURE__ */ jsx(T4, {
|
|
370
|
+
style: t21.drag,
|
|
371
|
+
children: t32
|
|
372
|
+
});
|
|
373
|
+
$[71] = T4;
|
|
374
|
+
$[72] = t21.drag;
|
|
375
|
+
$[73] = t32;
|
|
376
|
+
$[74] = t33;
|
|
377
|
+
} else t33 = $[74];
|
|
378
|
+
let t34;
|
|
379
|
+
if ($[75] !== T3 || $[76] !== drag.gesture || $[77] !== t33) {
|
|
380
|
+
t34 = /* @__PURE__ */ jsx(T3, {
|
|
381
|
+
gesture: t20,
|
|
382
|
+
children: t33
|
|
383
|
+
});
|
|
384
|
+
$[75] = T3;
|
|
385
|
+
$[76] = drag.gesture;
|
|
386
|
+
$[77] = t33;
|
|
387
|
+
$[78] = t34;
|
|
388
|
+
} else t34 = $[78];
|
|
389
|
+
let t35;
|
|
390
|
+
if ($[79] !== T2 || $[80] !== t19.control || $[81] !== t34) {
|
|
391
|
+
t35 = /* @__PURE__ */ jsx(T2, {
|
|
392
|
+
style: t19.control,
|
|
393
|
+
children: t34
|
|
394
|
+
});
|
|
395
|
+
$[79] = T2;
|
|
396
|
+
$[80] = t19.control;
|
|
397
|
+
$[81] = t34;
|
|
398
|
+
$[82] = t35;
|
|
399
|
+
} else t35 = $[82];
|
|
400
|
+
let t36;
|
|
401
|
+
if ($[83] !== children || $[84] !== isDisabled) {
|
|
402
|
+
t36 = /* @__PURE__ */ jsx(ControlLabel, {
|
|
403
|
+
isDisabled,
|
|
404
|
+
children
|
|
405
|
+
});
|
|
406
|
+
$[83] = children;
|
|
407
|
+
$[84] = isDisabled;
|
|
408
|
+
$[85] = t36;
|
|
409
|
+
} else t36 = $[85];
|
|
410
|
+
let t37;
|
|
411
|
+
if ($[86] !== T1 || $[87] !== ariaLabel || $[88] !== feedback.handlers || $[89] !== isDisabled || $[90] !== on || $[91] !== t13 || $[92] !== t15 || $[93] !== t16 || $[94] !== t17.row || $[95] !== t35 || $[96] !== t36) {
|
|
412
|
+
t37 = /* @__PURE__ */ jsxs(T1, {
|
|
413
|
+
"aria-checked": on,
|
|
414
|
+
"aria-label": ariaLabel,
|
|
415
|
+
role: t12,
|
|
416
|
+
...t13,
|
|
417
|
+
...t14,
|
|
418
|
+
disabled: isDisabled,
|
|
419
|
+
hitSlop: t15,
|
|
420
|
+
onPress: t16,
|
|
421
|
+
style: t18,
|
|
422
|
+
children: [t35, t36]
|
|
423
|
+
});
|
|
424
|
+
$[86] = T1;
|
|
425
|
+
$[87] = ariaLabel;
|
|
426
|
+
$[88] = feedback.handlers;
|
|
427
|
+
$[89] = isDisabled;
|
|
428
|
+
$[90] = on;
|
|
429
|
+
$[91] = t13;
|
|
430
|
+
$[92] = t15;
|
|
431
|
+
$[93] = t16;
|
|
432
|
+
$[94] = t17.row;
|
|
433
|
+
$[95] = t35;
|
|
434
|
+
$[96] = t36;
|
|
435
|
+
$[97] = t37;
|
|
436
|
+
} else t37 = $[97];
|
|
437
|
+
let t38;
|
|
438
|
+
if ($[98] !== description || $[99] !== error || $[100] !== messageId || $[101] !== own.messages) {
|
|
439
|
+
t38 = /* @__PURE__ */ jsx(ControlMessage, {
|
|
440
|
+
description,
|
|
441
|
+
error,
|
|
442
|
+
id: messageId,
|
|
443
|
+
style: own.messages
|
|
444
|
+
});
|
|
445
|
+
$[98] = description;
|
|
446
|
+
$[99] = error;
|
|
447
|
+
$[100] = messageId;
|
|
448
|
+
$[101] = own.messages;
|
|
449
|
+
$[102] = t38;
|
|
450
|
+
} else t38 = $[102];
|
|
451
|
+
let t39;
|
|
452
|
+
if ($[103] !== T0 || $[104] !== props || $[105] !== style || $[106] !== t37 || $[107] !== t38 || $[108] !== testID) {
|
|
453
|
+
t39 = /* @__PURE__ */ jsxs(T0, {
|
|
454
|
+
...props,
|
|
455
|
+
style,
|
|
456
|
+
testID,
|
|
457
|
+
children: [t37, t38]
|
|
458
|
+
});
|
|
459
|
+
$[103] = T0;
|
|
460
|
+
$[104] = props;
|
|
461
|
+
$[105] = style;
|
|
462
|
+
$[106] = t37;
|
|
463
|
+
$[107] = t38;
|
|
464
|
+
$[108] = testID;
|
|
465
|
+
$[109] = t39;
|
|
466
|
+
} else t39 = $[109];
|
|
467
|
+
return t39;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* The handle following a drag across the track, and settling from where it
|
|
471
|
+
* is let go: on past the middle, off before it. `offset` is where the drag
|
|
472
|
+
* has put the handle's seat while one is under way, measured from the start
|
|
473
|
+
* of the track, and nothing otherwise, when the seat rests at the end the
|
|
474
|
+
* switch is on.
|
|
475
|
+
*
|
|
476
|
+
* The drag is recognised once it has moved `DRAG_SLOP` across the track, and
|
|
477
|
+
* on the JavaScript thread, since settling sets React state and a drag moves
|
|
478
|
+
* one shared value.
|
|
479
|
+
*/
|
|
480
|
+
function useHandleDrag(t0) {
|
|
481
|
+
const $ = c(9);
|
|
482
|
+
const { enabled, on, state, testID } = t0;
|
|
483
|
+
const [dragging, setDragging] = useState(false);
|
|
484
|
+
const offset = useSharedValue(null);
|
|
485
|
+
const took = useSharedValue(false);
|
|
486
|
+
const began = useSharedValue(0);
|
|
487
|
+
const follow = function follow(x) {
|
|
488
|
+
const along = I18nManager.isRTL ? began.get() - x : x - began.get();
|
|
489
|
+
offset.set(Math.min(TRAVEL, Math.max(0, (on ? TRAVEL : 0) + along)));
|
|
490
|
+
};
|
|
491
|
+
const pan = Gesture.Pan().activeOffsetX([-10, DRAG_SLOP]).enabled(enabled).runOnJS(true).onBegin((t1) => {
|
|
492
|
+
const { x: x_0 } = t1;
|
|
493
|
+
began.set(x_0);
|
|
494
|
+
}).onStart((t2) => {
|
|
495
|
+
const { x: x_1 } = t2;
|
|
496
|
+
took.set(Platform.OS === "web");
|
|
497
|
+
setDragging(true);
|
|
498
|
+
follow(x_1);
|
|
499
|
+
}).onUpdate((t3) => {
|
|
500
|
+
const { x: x_2 } = t3;
|
|
501
|
+
follow(x_2);
|
|
502
|
+
}).onEnd((_event, success) => {
|
|
503
|
+
const stopped = offset.get();
|
|
504
|
+
if (success && stopped !== null && stopped > TRAVEL / 2 !== on) state.setSelected(!on);
|
|
505
|
+
}).onFinalize(() => {
|
|
506
|
+
offset.set(null);
|
|
507
|
+
setDragging(false);
|
|
508
|
+
});
|
|
509
|
+
const t4 = testID === void 0 ? pan : pan.withTestId(`${testID}-drag`);
|
|
510
|
+
let t5;
|
|
511
|
+
let t6;
|
|
512
|
+
if ($[0] !== took) {
|
|
513
|
+
t5 = () => {
|
|
514
|
+
took.set(false);
|
|
515
|
+
};
|
|
516
|
+
t6 = (toggle) => flipOf(toggle, took);
|
|
517
|
+
$[0] = took;
|
|
518
|
+
$[1] = t5;
|
|
519
|
+
$[2] = t6;
|
|
520
|
+
} else {
|
|
521
|
+
t5 = $[1];
|
|
522
|
+
t6 = $[2];
|
|
523
|
+
}
|
|
524
|
+
let t7;
|
|
525
|
+
if ($[3] !== dragging || $[4] !== offset || $[5] !== t4 || $[6] !== t5 || $[7] !== t6) {
|
|
526
|
+
t7 = {
|
|
527
|
+
dragging,
|
|
528
|
+
gesture: t4,
|
|
529
|
+
offset,
|
|
530
|
+
onPressIn: t5,
|
|
531
|
+
pressOf: t6
|
|
532
|
+
};
|
|
533
|
+
$[3] = dragging;
|
|
534
|
+
$[4] = offset;
|
|
535
|
+
$[5] = t4;
|
|
536
|
+
$[6] = t5;
|
|
537
|
+
$[7] = t6;
|
|
538
|
+
$[8] = t7;
|
|
539
|
+
} else t7 = $[8];
|
|
540
|
+
return t7;
|
|
541
|
+
}
|
|
542
|
+
function useSwitchMotion(t0, t1) {
|
|
543
|
+
const $ = c(4);
|
|
544
|
+
const { fill, handle, rule } = t0;
|
|
545
|
+
const { offset, on, size } = t1;
|
|
546
|
+
const { motion } = useTheme();
|
|
547
|
+
const reduceMotion = useReducedMotion();
|
|
548
|
+
const timing = {
|
|
549
|
+
duration: motion.durationShort2,
|
|
550
|
+
easing: Easing.bezier(...motion.easingStandard)
|
|
551
|
+
};
|
|
552
|
+
const direction = I18nManager.isRTL ? -1 : 1;
|
|
553
|
+
const rest = (on ? TRAVEL : 0) * direction;
|
|
554
|
+
const track = useAnimatedStyle(() => {
|
|
555
|
+
"worklet";
|
|
556
|
+
return {
|
|
557
|
+
backgroundColor: reduceMotion ? fill : withTiming(fill, timing),
|
|
558
|
+
borderColor: reduceMotion ? rule : withTiming(rule, timing)
|
|
559
|
+
};
|
|
560
|
+
});
|
|
561
|
+
const seat = useAnimatedStyle(() => {
|
|
562
|
+
"worklet";
|
|
563
|
+
const dragged = offset.get();
|
|
564
|
+
return { transform: [{ translateX: dragged !== null ? dragged * direction : reduceMotion ? rest : withTiming(rest, timing) }] };
|
|
565
|
+
});
|
|
566
|
+
const handleMotion = useAnimatedStyle(() => {
|
|
567
|
+
"worklet";
|
|
568
|
+
return {
|
|
569
|
+
backgroundColor: reduceMotion ? handle : withTiming(handle, timing),
|
|
570
|
+
height: reduceMotion ? size : withTiming(size, timing),
|
|
571
|
+
width: reduceMotion ? size : withTiming(size, timing)
|
|
572
|
+
};
|
|
573
|
+
});
|
|
574
|
+
let t2;
|
|
575
|
+
if ($[0] !== handleMotion || $[1] !== seat || $[2] !== track) {
|
|
576
|
+
t2 = {
|
|
577
|
+
handle: handleMotion,
|
|
578
|
+
seat,
|
|
579
|
+
track
|
|
580
|
+
};
|
|
581
|
+
$[0] = handleMotion;
|
|
582
|
+
$[1] = seat;
|
|
583
|
+
$[2] = track;
|
|
584
|
+
$[3] = t2;
|
|
585
|
+
} else t2 = $[3];
|
|
586
|
+
return t2;
|
|
587
|
+
}
|
|
588
|
+
//#endregion
|
|
589
|
+
export { Switch };
|
|
590
|
+
|
|
591
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","Ref","StyleProp","ViewProps","ViewStyle","AnimatedStyle","SharedValue","ToggleState","useId","useState","I18nManager","Platform","Pressable","StyleSheet","View","Gesture","GestureDetector","GestureHandlerRootView","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","useToggleState","ResolvedTheme","ControlLabel","ControlMessage","describedBy","LAYER_SIZE","messageOf","controlStylesOf","CheckGlyph","hitSlop","usePressFeedback","withOpacity","useTheme","composeStyles","themedStyles","Paint","fill","glyph","handle","rule","SwitchProps","Omit","children","defaultSelected","description","error","icon","isDisabled","isReadOnly","isSelected","onChange","ref","style","TRACK_WIDTH","TRACK_HEIGHT","TRACK_RULE","HANDLE_OFF","HANDLE_ON","HANDLE_PRESSED","ICON_SIZE","TRAVEL","DRAG_SLOP","styles","create","control","flexShrink","height","width","drag","alignItems","flexGrow","justifyContent","layer","position","start","top","seat","track","borderWidth","stylesOf","radii","spacing","borderRadius","circle","messages","marginStart","sm","pill","flipOf","state","took","get","set","toggle","paintOf","colors","stateLayerOpacity","active","on","disabledContent","onSurface","surfaceContainerHighest","disabledContainer","surface","primary","onPrimaryContainer","primaryContainer","onPrimary","onSurfaceVariant","outline","Switch","t0","$","_c","ariaLabel","props","t1","t2","t3","testID","undefined","theme","own","t4","messageId","interactive","t5","enabled","useHandleDrag","t6","t7","t8","t9","onPressIn","color","corners","disabled","disc","feedback","dragging","hovered","pressed","ring","t10","paint","size","t11","offset","motion","useSwitchMotion","T0","T1","t12","t13","t14","handlers","t15","Symbol","for","t16","pressOf","t17","t18","row","T2","T3","t20","gesture","T4","t22","t23","t24","t25","t26","t27","t28","t29","t30","t31","t32","t33","t21","t34","t35","t19","t36","t37","t38","t39","setDragging","began","follow","x","along","isRTL","Math","min","max","pan","Pan","activeOffsetX","runOnJS","onBegin","x_0","onStart","x_1","OS","onUpdate","x_2","onEnd","_event","success","stopped","setSelected","onFinalize","withTestId","reduceMotion","timing","duration","durationShort2","easing","bezier","easingStandard","direction","rest","backgroundColor","borderColor","dragged","transform","translateX","handleMotion","_c"],"sources":["../../../src/components/switch/index.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react'\nimport type { StyleProp, ViewProps, ViewStyle } from 'react-native'\nimport type { AnimatedStyle, SharedValue } from 'react-native-reanimated'\nimport type { ToggleState } from 'react-stately/useToggleState'\n\nimport { useId, useState } from 'react'\nimport {\n I18nManager,\n Platform,\n Pressable,\n StyleSheet,\n View,\n} from 'react-native'\nimport {\n Gesture,\n GestureDetector,\n GestureHandlerRootView,\n} from 'react-native-gesture-handler'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated'\nimport { useToggleState } from 'react-stately/useToggleState'\n\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport {\n ControlLabel,\n ControlMessage,\n describedBy,\n LAYER_SIZE,\n messageOf,\n} from '../../control'\nimport { controlStylesOf } from '../../control/styles'\nimport { CheckGlyph } from '../../glyphs'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { withOpacity } from '../../theme/color'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// The switch page, as kanso-ui's Switch draws it: a 52 by 32dp track with a\n// 2dp outline and a full corner, a handle that is 16dp off, 24dp on and 28dp\n// while pressed, a 16dp icon in the handle when asked for, a 40dp state layer\n// around the handle and a 48dp target. Off, the track is surface container\n// highest inside an outline rule and the handle is outline, turning on surface\n// variant while hovered, pressed or focused; on, the track is primary and the\n// handle on primary, turning primary container in the same states, with the\n// icon in on primary container. Disabled, the track and its rule are on\n// surface at the disabled container opacity and the handle on surface at the\n// disabled content opacity, or surface when on. The state layer is on surface\n// off and primary on, at each state's opacity, and does not swap once pressed\n// as a checkbox's does.\n//\n// The handle travels between the two ends of the track and grows between its\n// three sizes over the motion tokens' short duration on the standard curve,\n// as web's transition does, and at once for a reader who asks the device for\n// reduced motion. The track's colours ease alongside. The state layer and the\n// ripple sit on a 40dp disc centred on the handle, so they travel with it.\n//\n// The handle follows a drag, as the page's pressed switch does: the switch\n// flips when it is let go past the middle of the track and springs back when\n// it is not. The drag is Gesture Handler's, over the whole track rather than\n// only the handle, as a drag on iOS's own switch is. A press that moves less\n// than half the travel is still a tap, which the row's `Pressable` takes and\n// which flips the switch on its own. Once a drag takes over, Gesture Handler\n// ends that press without a tap on iOS and Android, so letting go settles the\n// switch once, from where the handle is. React Native Web has nothing to end\n// the press with, and the click a pointer's release sends would flip it a\n// second time, so there the switch ignores the tap a drag took over.\n//\n// Under a right-to-left layout the handle starts from the right, and a drag\n// toward the left turns the switch on.\n//\n// Gesture Handler recognises a drag only under its root view, so the track\n// carries one of its own, as its guide asks of a library. An app that wraps\n// itself in one already makes this one a plain view.\n//\n// The row, the label and the line under it are src/control's, which Checkbox\n// and Radio draw through as well. The whole row is the `Pressable`, so a press\n// on the label flips the switch, as a press on web's label does. The line\n// under it starts where the label does, past the track.\n\ntype Paint = {\n readonly fill: string\n readonly glyph: string\n readonly handle: string\n readonly rule: string\n}\n\ntype SwitchProps = Omit<ViewProps, 'children' | 'style'> & {\n /**\n * The label, beside the switch. A switch that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n */\n readonly children?: ReactNode\n /**\n * Whether the switch starts on, when it keeps its own state.\n * @default false\n */\n readonly defaultSelected?: boolean\n /**\n * A hint under the label. Replaced by `error` when there is one, so the\n * two never stack.\n */\n readonly description?: string\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the switch in its error state: the line under the label is the error, in\n * the error colour.\n */\n readonly error?: string\n /**\n * Draws the check in the handle while the switch is on, the page's \"icon on\n * selected switch\" form.\n * @default false\n */\n readonly icon?: boolean\n /**\n * Draws the switch disabled, and takes no presses or drags.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Shows the state without letting a press or a drag change it.\n * @default false\n */\n readonly isReadOnly?: boolean\n /**\n * Whether the switch is on, for a call site holding the state itself with\n * `onChange`.\n */\n readonly isSelected?: boolean\n /** Called with the new state whenever a press or a drag changes it. */\n readonly onChange?: (isSelected: boolean) => void\n readonly ref?: Ref<View>\n readonly style?: StyleProp<ViewStyle>\n}\n\n// The track's size and its rule, from the page.\nconst TRACK_WIDTH = 52\nconst TRACK_HEIGHT = 32\nconst TRACK_RULE = 2\n\n// The handle's three sizes and the icon's, from the page.\nconst HANDLE_OFF = 16\nconst HANDLE_ON = 24\nconst HANDLE_PRESSED = 28\nconst ICON_SIZE = 16\n\n// How far the handle's seat, the pressed handle's 28dp, travels: the track's\n// 48dp inside its rule, less the seat. Off, the seat's centre is 16dp from the\n// track's start, and on, 16dp from its end, which is where the page's handles\n// sit.\nconst TRAVEL = TRACK_WIDTH - 2 * TRACK_RULE - HANDLE_PRESSED\n\n// How far a press moves before it is a drag: half the travel, the platforms'\n// own touch slop, as web's is for a finger. A finger drifts several dp on an\n// ordinary tap, and a tap inside this flips the switch. A drag past it is past\n// the middle too, so it turns the switch over unless it comes back.\nconst DRAG_SLOP = TRAVEL / 2\n\nconst styles = StyleSheet.create({\n // The 52 by 40 the switch takes in the row, the height of the state layer\n // around the handle, with the track centred in it. Gesture Handler's root\n // view, sized to the track rather than to the screen it fills by default.\n control: {\n flexShrink: 0,\n height: LAYER_SIZE,\n width: TRACK_WIDTH,\n },\n // What the drag is recognised over: the whole of the control.\n drag: {\n alignItems: 'center',\n flexGrow: 1,\n justifyContent: 'center',\n },\n handle: {\n alignItems: 'center',\n justifyContent: 'center',\n },\n // The 40dp state layer, centred on the handle and so on its seat.\n layer: {\n height: LAYER_SIZE,\n position: 'absolute',\n start: (HANDLE_PRESSED - LAYER_SIZE) / 2,\n top: (HANDLE_PRESSED - LAYER_SIZE) / 2,\n width: LAYER_SIZE,\n },\n // The handle's seat, the pressed handle's size, at the start of the track\n // inside its rule. It travels by a translation, so the layout never moves.\n seat: {\n alignItems: 'center',\n height: HANDLE_PRESSED,\n justifyContent: 'center',\n position: 'absolute',\n start: 0,\n top: 0,\n width: HANDLE_PRESSED,\n },\n track: {\n borderWidth: TRACK_RULE,\n height: TRACK_HEIGHT,\n width: TRACK_WIDTH,\n },\n})\n\nconst stylesOf = themedStyles(({ radii, spacing }) =>\n StyleSheet.create({\n handle: {\n borderRadius: radii.circle,\n },\n // Past the track rather than the 40dp layer a checkbox draws, so the line\n // starts where the label's text does.\n messages: {\n marginStart: TRACK_WIDTH + spacing.sm,\n },\n track: {\n borderRadius: radii.pill,\n },\n }),\n)\n\n// A press's flip, unless a drag took the press over. Built by a call rather\n// than declared in the component, which is what react-perf's\n// jsx-no-new-function-as-prop is after.\nfunction flipOf(state: ToggleState, took: SharedValue<boolean>) {\n return () => {\n if (took.get()) {\n took.set(false)\n return\n }\n state.toggle()\n }\n}\n\n/**\n * What the switch is painted in: the track's fill and rule, the handle and\n * the icon. Where the page draws no rule it is the fill made clear rather than\n * plain transparent black, so the rule eases through its own colour rather\n * than through grey.\n */\nfunction paintOf(\n { colors, stateLayerOpacity }: ResolvedTheme,\n {\n active,\n isDisabled,\n on,\n }: {\n readonly active: boolean\n readonly isDisabled: boolean\n readonly on: boolean\n },\n): Paint {\n const disabledContent = withOpacity(\n colors.onSurface,\n stateLayerOpacity.disabledContent,\n )\n\n if (isDisabled) {\n const fill = withOpacity(\n on ? colors.onSurface : colors.surfaceContainerHighest,\n stateLayerOpacity.disabledContainer,\n )\n\n return {\n fill,\n glyph: disabledContent,\n handle: on ? colors.surface : disabledContent,\n rule: on\n ? withOpacity(fill, 0)\n : withOpacity(colors.onSurface, stateLayerOpacity.disabledContainer),\n }\n }\n\n if (on) {\n return {\n fill: colors.primary,\n glyph: colors.onPrimaryContainer,\n handle: active ? colors.primaryContainer : colors.onPrimary,\n rule: colors.primary,\n }\n }\n\n return {\n fill: colors.surfaceContainerHighest,\n glyph: colors.onPrimaryContainer,\n handle: active ? colors.onSurfaceVariant : colors.outline,\n rule: colors.outline,\n }\n}\n\n/**\n * A switch that turns a setting on or off, with its label and optionally a\n * description or an error under it. Its state is React Stately's, as web's\n * is: pass `isSelected` with `onChange` to control it, or `defaultSelected` to\n * let it keep its own. A switch takes effect as it is flipped, which is what\n * sets it apart from a checkbox in a form.\n *\n * ```tsx\n * <Switch defaultSelected description=\"Supporting line\">\n * Label\n * </Switch>\n * ```\n *\n * A screen reader hears it as a switch named by its label, on or off,\n * followed by the line under it. A press anywhere on the track or the label\n * flips it, and the handle can be dragged across the track, settling on\n * whichever side it is let go. `style`, `ref` and `testID` land on the view\n * holding the row and the line under it, which is the element a layout\n * positions. With a `testID`, the drag is registered with Gesture Handler as\n * `<testID>-drag`, which its `getByGestureTestId` finds in a test.\n */\nfunction Switch({\n 'aria-label': ariaLabel,\n children,\n defaultSelected,\n description,\n error,\n icon = false,\n isDisabled = false,\n isReadOnly = false,\n isSelected,\n onChange,\n style,\n testID,\n ...props\n}: SwitchProps) {\n const theme = useTheme()\n const own = stylesOf(theme)\n const state = useToggleState({\n defaultSelected,\n isReadOnly,\n isSelected,\n onChange,\n })\n const messageId = useId()\n\n const { colors, radii } = theme\n const on = state.isSelected\n const interactive = !isDisabled && !isReadOnly\n const drag = useHandleDrag({ enabled: interactive, on, state, testID })\n\n const feedback = usePressFeedback({\n color: on ? colors.primary : colors.onSurface,\n corners: { borderRadius: radii.circle },\n disabled: !interactive,\n disc: LAYER_SIZE,\n onPressIn: drag.onPressIn,\n })\n const active =\n interactive &&\n (drag.dragging ||\n feedback.hovered ||\n feedback.pressed ||\n feedback.ring !== undefined)\n const paint = paintOf(theme, { active, isDisabled, on })\n const size =\n drag.dragging || feedback.pressed\n ? HANDLE_PRESSED\n : on\n ? HANDLE_ON\n : HANDLE_OFF\n const motion = useSwitchMotion(paint, { offset: drag.offset, on, size })\n\n return (\n <View {...props} style={style} testID={testID}>\n <Pressable\n aria-checked={on}\n aria-label={ariaLabel}\n role=\"switch\"\n {...describedBy(messageId, messageOf(description, error))}\n {...feedback.handlers}\n disabled={isDisabled}\n hitSlop={hitSlop(LAYER_SIZE, TRACK_WIDTH)}\n onPress={drag.pressOf(state)}\n style={controlStylesOf(theme).row}\n >\n <GestureHandlerRootView style={styles.control}>\n <GestureDetector gesture={drag.gesture}>\n <View style={styles.drag}>\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.track,\n own.track,\n motion.track,\n feedback.ring,\n )}\n >\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.seat,\n motion.seat,\n )}\n >\n <View style={styles.layer}>{feedback.layer}</View>\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.handle,\n own.handle,\n motion.handle,\n )}\n >\n {icon && on ? (\n <CheckGlyph color={paint.glyph} size={ICON_SIZE} />\n ) : null}\n </Animated.View>\n </Animated.View>\n </Animated.View>\n </View>\n </GestureDetector>\n </GestureHandlerRootView>\n <ControlLabel isDisabled={isDisabled}>{children}</ControlLabel>\n </Pressable>\n <ControlMessage\n description={description}\n error={error}\n id={messageId}\n style={own.messages}\n />\n </View>\n )\n}\n\n/**\n * The handle following a drag across the track, and settling from where it\n * is let go: on past the middle, off before it. `offset` is where the drag\n * has put the handle's seat while one is under way, measured from the start\n * of the track, and nothing otherwise, when the seat rests at the end the\n * switch is on.\n *\n * The drag is recognised once it has moved `DRAG_SLOP` across the track, and\n * on the JavaScript thread, since settling sets React state and a drag moves\n * one shared value.\n */\nfunction useHandleDrag({\n enabled,\n on,\n state,\n testID,\n}: {\n readonly enabled: boolean\n readonly on: boolean\n readonly state: ToggleState\n readonly testID: string | undefined\n}) {\n const [dragging, setDragging] = useState(false)\n const offset = useSharedValue<null | number>(null)\n // Whether a drag has taken over the press in flight, whose click React\n // Native Web would otherwise turn into a second flip. Cleared by the next\n // press rather than by that click, which a touch dragged far enough never\n // sends. A shared value rather than a ref: the gesture's callbacks are\n // built while rendering, and the React Compiler lets no ref reach them.\n const took = useSharedValue(false)\n\n // Where the press began across the track. Gesture Handler measures its\n // translation from where the drag was recognised, past the slop, so the\n // distance is taken from here instead, as web's is from the press.\n const began = useSharedValue(0)\n\n // Puts the seat where the drag has carried it, from the end it started at,\n // and no further than either end.\n function follow(x: number) {\n const along = I18nManager.isRTL ? began.get() - x : x - began.get()\n offset.set(Math.min(TRAVEL, Math.max(0, (on ? TRAVEL : 0) + along)))\n }\n\n // oxlint-disable-next-line react/capitalized-calls -- a builder Gesture Handler names after the gesture, not a component\n const pan = Gesture.Pan()\n .activeOffsetX([-DRAG_SLOP, DRAG_SLOP])\n .enabled(enabled)\n .runOnJS(true)\n .onBegin(({ x }) => {\n began.set(x)\n })\n .onStart(({ x }) => {\n took.set(Platform.OS === 'web')\n setDragging(true)\n follow(x)\n })\n .onUpdate(({ x }) => {\n follow(x)\n })\n .onEnd((_event, success) => {\n const stopped = offset.get()\n if (success && stopped !== null && stopped > TRAVEL / 2 !== on) {\n state.setSelected(!on)\n }\n })\n .onFinalize(() => {\n offset.set(null)\n setDragging(false)\n })\n\n return {\n dragging,\n gesture: testID === undefined ? pan : pan.withTestId(`${testID}-drag`),\n offset,\n onPressIn: () => {\n took.set(false)\n },\n pressOf: (toggle: ToggleState) => flipOf(toggle, took),\n }\n}\n\n// The track's colours, the seat's travel and the handle's size and colour,\n// eased to as the state changes. While a drag is under way the seat follows it\n// at once, and once it ends the seat eases from wherever it was let go.\nfunction useSwitchMotion(\n { fill, handle, rule }: Paint,\n {\n offset,\n on,\n size,\n }: {\n readonly offset: SharedValue<null | number>\n readonly on: boolean\n readonly size: number\n },\n) {\n const { motion } = useTheme()\n const reduceMotion = useReducedMotion()\n const timing = {\n duration: motion.durationShort2,\n easing: Easing.bezier(...motion.easingStandard),\n }\n // A translation is not mirrored under a right-to-left layout, though the\n // seat's start is, so the seat travels the other way there.\n const direction = I18nManager.isRTL ? -1 : 1\n const rest = (on ? TRAVEL : 0) * direction\n\n const track = useAnimatedStyle(() => {\n 'worklet'\n return {\n backgroundColor: reduceMotion ? fill : withTiming(fill, timing),\n borderColor: reduceMotion ? rule : withTiming(rule, timing),\n }\n })\n const seat = useAnimatedStyle(() => {\n 'worklet'\n const dragged = offset.get()\n return {\n transform: [\n {\n translateX:\n dragged !== null\n ? dragged * direction\n : reduceMotion\n ? rest\n : withTiming(rest, timing),\n },\n ],\n }\n })\n const handleMotion = useAnimatedStyle(() => {\n 'worklet'\n return {\n backgroundColor: reduceMotion ? handle : withTiming(handle, timing),\n height: reduceMotion ? size : withTiming(size, timing),\n width: reduceMotion ? size : withTiming(size, timing),\n }\n })\n\n return { handle: handleMotion, seat, track }\n}\n\nexport { Switch }\nexport type { SwitchProps }\n"],"mappings":";;;;;;;;;;;;;;;AA8IA,MAAMyD,cAAc;AACpB,MAAMC,eAAe;AACrB,MAAMC,aAAa;AAGnB,MAAMC,aAAa;AACnB,MAAMC,YAAY;AAClB,MAAMC,iBAAiB;AACvB,MAAMC,YAAY;AAMlB,MAAMC,SAASP;AAMf,MAAMQ,YAAYD,SAAS;AAE3B,MAAME,SAASrD,WAAWsD,OAAO;CAI/BC,SAAS;EACPC,YAAY;EACZC,QAAAA;EACAC,OAAOd;CACT;CAEAe,MAAM;EACJC,YAAY;EACZC,UAAU;EACVC,gBAAgB;CAClB;CACAjC,QAAQ;EACN+B,YAAY;EACZE,gBAAgB;CAClB;CAEAC,OAAO;EACLN,QAAAA;EACAO,UAAU;EACVC,OAAAA;EACAC,KAAAA;EACAR,OAAAA;CACF;CAGAS,MAAM;EACJP,YAAY;EACZH,QAAQR;EACRa,gBAAgB;EAChBE,UAAU;EACVC,OAAO;EACPC,KAAK;EACLR,OAAOT;CACT;CACAmB,OAAO;EACLC,aAAavB;EACbW,QAAQZ;EACRa,OAAOd;CACT;AACF,CAAC;AAED,MAAM0B,WAAW7C,cAAc,EAAE8C,OAAOC,cACtCxE,WAAWsD,OAAO;CAChBzB,QAAQ,EACN4C,cAAcF,MAAMG,OACtB;CAGAC,UAAU,EACRC,aAAahC,cAAc4B,QAAQK,GACrC;CACA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