panelui-native 0.80.0 → 0.82.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/lib/module/components/bottom-sheet/index.js +90 -17
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/button/index.js +13 -0
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/button-group/index.js +3 -0
- package/lib/module/components/button-group/index.js.map +1 -1
- package/lib/module/components/image-generation/dot-field.js +210 -0
- package/lib/module/components/image-generation/dot-field.js.map +1 -0
- package/lib/module/components/image-generation/index.js +417 -0
- package/lib/module/components/image-generation/index.js.map +1 -0
- package/lib/module/components/kpi/index.js +2 -4
- package/lib/module/components/kpi/index.js.map +1 -1
- package/lib/module/components/menu/index.js +8 -16
- package/lib/module/components/menu/index.js.map +1 -1
- package/lib/module/components/panelside/index.js +340 -33
- package/lib/module/components/panelside/index.js.map +1 -1
- package/lib/module/components/planner/index.js +446 -32
- package/lib/module/components/planner/index.js.map +1 -1
- package/lib/module/components/planner/planner-entries.js +36 -0
- package/lib/module/components/planner/planner-entries.js.map +1 -1
- package/lib/module/components/planner/planner-grid-navigation.js +34 -2
- package/lib/module/components/planner/planner-grid-navigation.js.map +1 -1
- package/lib/module/components/planner/planner-weeks.js +95 -0
- package/lib/module/components/planner/planner-weeks.js.map +1 -0
- package/lib/module/components/select/index.js +127 -23
- package/lib/module/components/select/index.js.map +1 -1
- package/lib/module/components/slide-button/index.js +610 -0
- package/lib/module/components/slide-button/index.js.map +1 -0
- package/lib/module/components/slide-button/slide-button-track.js +98 -0
- package/lib/module/components/slide-button/slide-button-track.js.map +1 -0
- package/lib/module/icons/index.js +553 -1934
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/primitives/portal.js +15 -1
- package/lib/module/primitives/portal.js.map +1 -1
- package/lib/module/utils/date.js +10 -3
- package/lib/module/utils/date.js.map +1 -1
- package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +12 -0
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/button-group/index.d.ts +9 -0
- package/lib/typescript/src/components/button-group/index.d.ts.map +1 -1
- package/lib/typescript/src/components/image-generation/dot-field.d.ts +61 -0
- package/lib/typescript/src/components/image-generation/dot-field.d.ts.map +1 -0
- package/lib/typescript/src/components/image-generation/index.d.ts +126 -0
- package/lib/typescript/src/components/image-generation/index.d.ts.map +1 -0
- package/lib/typescript/src/components/kpi/index.d.ts.map +1 -1
- package/lib/typescript/src/components/menu/index.d.ts.map +1 -1
- package/lib/typescript/src/components/panelside/index.d.ts +194 -10
- package/lib/typescript/src/components/panelside/index.d.ts.map +1 -1
- package/lib/typescript/src/components/planner/index.d.ts +65 -4
- package/lib/typescript/src/components/planner/index.d.ts.map +1 -1
- package/lib/typescript/src/components/planner/planner-entries.d.ts +18 -0
- package/lib/typescript/src/components/planner/planner-entries.d.ts.map +1 -1
- package/lib/typescript/src/components/planner/planner-grid-navigation.d.ts +7 -1
- package/lib/typescript/src/components/planner/planner-grid-navigation.d.ts.map +1 -1
- package/lib/typescript/src/components/planner/planner-weeks.d.ts +50 -0
- package/lib/typescript/src/components/planner/planner-weeks.d.ts.map +1 -0
- package/lib/typescript/src/components/select/index.d.ts +75 -2
- package/lib/typescript/src/components/select/index.d.ts.map +1 -1
- package/lib/typescript/src/components/slide-button/index.d.ts +317 -0
- package/lib/typescript/src/components/slide-button/index.d.ts.map +1 -0
- package/lib/typescript/src/components/slide-button/slide-button-track.d.ts +70 -0
- package/lib/typescript/src/components/slide-button/slide-button-track.d.ts.map +1 -0
- package/lib/typescript/src/icons/index.d.ts +136 -189
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/primitives/portal.d.ts.map +1 -1
- package/lib/typescript/src/utils/date.d.ts +1 -1
- package/lib/typescript/src/utils/date.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/components/bottom-sheet/index.tsx +97 -17
- package/src/components/button/index.tsx +10 -2
- package/src/components/button-group/index.tsx +1 -0
- package/src/components/image-generation/dot-field.ts +226 -0
- package/src/components/image-generation/index.tsx +488 -0
- package/src/components/kpi/index.tsx +2 -4
- package/src/components/menu/index.tsx +10 -15
- package/src/components/panelside/index.tsx +498 -33
- package/src/components/planner/index.tsx +516 -38
- package/src/components/planner/planner-entries.ts +33 -0
- package/src/components/planner/planner-grid-navigation.ts +37 -2
- package/src/components/planner/planner-weeks.ts +90 -0
- package/src/components/select/index.tsx +158 -31
- package/src/components/slide-button/index.tsx +681 -0
- package/src/components/slide-button/slide-button-track.ts +100 -0
- package/src/icons/index.tsx +338 -1327
- package/src/index.ts +30 -0
- package/src/primitives/portal.tsx +15 -1
- package/src/utils/date.ts +13 -3
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SlideButton — drag across to confirm, with the distance drawn on the button.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <SlideButton onComplete={ship}>
|
|
8
|
+
* <SlideButton.Label>Slide to ship</SlideButton.Label>
|
|
9
|
+
* </SlideButton>
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* For an action worth a moment's deliberation, where a hold is the wrong
|
|
13
|
+
* shape. A hold asks for time and shows a clock; a slide asks for a movement
|
|
14
|
+
* and shows a distance — so the reader can go as fast as they like, and still
|
|
15
|
+
* cannot arrive by tapping. Pair it with [ProgressButton](../progress-button)
|
|
16
|
+
* rather than choosing between them: the hold suits an action that should feel
|
|
17
|
+
* expensive, the slide one that should feel deliberate.
|
|
18
|
+
*
|
|
19
|
+
* ## The far end is the promise
|
|
20
|
+
*
|
|
21
|
+
* Nothing fires until the thumb clears `threshold`, which defaults to nine
|
|
22
|
+
* tenths of the rail. Released short, it springs home and the fill goes with
|
|
23
|
+
* it. Released short but travelling, it is honoured — a flick that had
|
|
24
|
+
* plainly committed is not worth refusing on a technicality, and the velocity
|
|
25
|
+
* is projected forward to decide.
|
|
26
|
+
*
|
|
27
|
+
* ## How it is drawn
|
|
28
|
+
*
|
|
29
|
+
* A track, a fill that follows the thumb, and a label that fades as the thumb
|
|
30
|
+
* reaches it. The label fades rather than sliding out of the way because the
|
|
31
|
+
* thumb is about to be where the label is, and two things moving toward each
|
|
32
|
+
* other at different speeds reads as a collision.
|
|
33
|
+
*
|
|
34
|
+
* The thumb is translated and the fill's width animated, both on the UI thread
|
|
35
|
+
* off one shared value, so a drag never re-renders React.
|
|
36
|
+
*
|
|
37
|
+
* ## Sliding without a finger
|
|
38
|
+
*
|
|
39
|
+
* A drag is not available to a screen reader, so the rail is also a button:
|
|
40
|
+
* it takes an `activate` accessibility action and completes on it. This is not
|
|
41
|
+
* a lesser path bolted on — a confirmation control that can only be reached by
|
|
42
|
+
* dragging is a confirmation control some people cannot use.
|
|
43
|
+
*/
|
|
44
|
+
import { Children, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
45
|
+
import { StyleSheet, View } from 'react-native';
|
|
46
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
47
|
+
import Animated, { cancelAnimation, runOnJS, useAnimatedStyle, useReducedMotion, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
48
|
+
import { tv } from 'tailwind-variants';
|
|
49
|
+
import { useCSSVariable } from 'uniwind';
|
|
50
|
+
import { useDirectionSign } from "../../hooks/use-direction.js";
|
|
51
|
+
import { CheckIcon, ChevronRightIcon, IconColorProvider } from "../../icons/index.js";
|
|
52
|
+
import { Text, textChildren } from "../../primitives/text.js";
|
|
53
|
+
import { impactKnock, selectionTick } from "../../utils/haptics.js";
|
|
54
|
+
import { DEFAULT_AUTO_RESET_DELAY, OVERSHOOT_FRICTION, VELOCITY_LOOKAHEAD, resolveThreshold } from "./slide-button-track.js";
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* How the handle settles when it is let go, in either direction.
|
|
58
|
+
*
|
|
59
|
+
* Clamped, because the rail has hard ends and the release carries the drag's
|
|
60
|
+
* own velocity into the spring. Unclamped, a fast flick overshoots past the
|
|
61
|
+
* end, disappears behind the rail's clip and comes back — which reads as the
|
|
62
|
+
* control having been thrown rather than moved, and is worst on exactly the
|
|
63
|
+
* gesture people make when they are confident.
|
|
64
|
+
*/
|
|
65
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
66
|
+
const SPRING = {
|
|
67
|
+
damping: 22,
|
|
68
|
+
stiffness: 220,
|
|
69
|
+
mass: 0.7,
|
|
70
|
+
overshootClamping: true
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/** How long the completed drawing takes to leave again on a reset. */
|
|
74
|
+
const DONE_EXIT = 140;
|
|
75
|
+
|
|
76
|
+
/** How long the reduced-motion snap takes, in place of a spring. */
|
|
77
|
+
const REDUCED_SNAP = 160;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The thumb is neutral, and the rail around it carries the variant.
|
|
81
|
+
*
|
|
82
|
+
* Drawn in the accent it was the loudest thing on the control, which put the
|
|
83
|
+
* eye on the handle rather than on the distance — and the distance is the
|
|
84
|
+
* question the button is asking. Neutral, it reads as a physical thing being
|
|
85
|
+
* moved across a coloured track, which is what it is.
|
|
86
|
+
*/
|
|
87
|
+
const THUMB_GLYPH = '--color-muted-foreground';
|
|
88
|
+
const slideButtonVariants = tv({
|
|
89
|
+
slots: {
|
|
90
|
+
/*
|
|
91
|
+
* A pill, and the same secondary ground ProgressButton rests on, so the
|
|
92
|
+
* two read as one pair of controls rather than two unrelated ones. The
|
|
93
|
+
* radius is also the shape of the fill's leading edge as it comes out of
|
|
94
|
+
* the corner.
|
|
95
|
+
*/
|
|
96
|
+
root: 'relative flex-row items-center overflow-hidden rounded-full border border-transparent bg-secondary',
|
|
97
|
+
/**
|
|
98
|
+
* The ground the handle has covered.
|
|
99
|
+
*
|
|
100
|
+
* Inset on every side by the same padding the handle sits in, so at rest
|
|
101
|
+
* it is exactly zero wide and there is nothing to see — a trail with a
|
|
102
|
+
* sliver of colour in it before anything has been dragged is a control
|
|
103
|
+
* that looks part-finished.
|
|
104
|
+
*/
|
|
105
|
+
fill: 'absolute rounded-full',
|
|
106
|
+
/** The label, centred in the rail rather than in the space beside it. */
|
|
107
|
+
label: 'text-center font-medium',
|
|
108
|
+
/**
|
|
109
|
+
* The draggable handle. Wider than it is tall, so it reads as something to
|
|
110
|
+
* push rather than as a dot that happens to be on a track — and the extra
|
|
111
|
+
* width is what gives the chevron room to sit in without crowding the
|
|
112
|
+
* curve at either end.
|
|
113
|
+
*/
|
|
114
|
+
thumb: 'absolute items-center justify-center rounded-full bg-card shadow-sm',
|
|
115
|
+
/** What the thumb holds — a chevron at rest, a tick once it has arrived. */
|
|
116
|
+
thumbContent: 'items-center justify-center'
|
|
117
|
+
},
|
|
118
|
+
variants: {
|
|
119
|
+
variant: {
|
|
120
|
+
secondary: {
|
|
121
|
+
label: 'text-secondary-foreground',
|
|
122
|
+
fill: 'bg-foreground/10'
|
|
123
|
+
},
|
|
124
|
+
destructive: {
|
|
125
|
+
label: 'text-destructive',
|
|
126
|
+
fill: 'bg-destructive/20'
|
|
127
|
+
},
|
|
128
|
+
success: {
|
|
129
|
+
label: 'text-success',
|
|
130
|
+
fill: 'bg-success/20'
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
size: {
|
|
134
|
+
// Matched to ProgressButton's boxes so the two line up in a column, and
|
|
135
|
+
// `min-h-*` for the same reason: the label's glyphs grow with the system
|
|
136
|
+
// text size and the box has to grow with them.
|
|
137
|
+
sm: {
|
|
138
|
+
root: 'min-h-11 p-1',
|
|
139
|
+
label: 'text-[14px]'
|
|
140
|
+
},
|
|
141
|
+
md: {
|
|
142
|
+
root: 'min-h-[52px] p-1',
|
|
143
|
+
label: 'text-[16px]'
|
|
144
|
+
},
|
|
145
|
+
lg: {
|
|
146
|
+
root: 'min-h-14 p-1',
|
|
147
|
+
label: 'text-[18px]'
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
fullWidth: {
|
|
151
|
+
true: {
|
|
152
|
+
root: 'w-full'
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
disabled: {
|
|
156
|
+
true: {
|
|
157
|
+
root: 'opacity-[0.64]'
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
defaultVariants: {
|
|
162
|
+
/*
|
|
163
|
+
* `secondary`, where ProgressButton's default is `primary`.
|
|
164
|
+
*
|
|
165
|
+
* The handle here is neutral and the rail carries the variant, so what
|
|
166
|
+
* `primary` had left to say was a wash of the accent behind the handle —
|
|
167
|
+
* and in a theme whose primary is close to its foreground that is the same
|
|
168
|
+
* drawing as `secondary`. A variant nobody can tell from another one is not
|
|
169
|
+
* a choice, so it is gone rather than kept for symmetry.
|
|
170
|
+
*/
|
|
171
|
+
variant: 'secondary',
|
|
172
|
+
size: 'md'
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
/** How a slide button looks. */
|
|
177
|
+
|
|
178
|
+
/** How big a slide button is. */
|
|
179
|
+
|
|
180
|
+
/** The thumb's box, per size. A stadium, so the two differ. */
|
|
181
|
+
const THUMB_SIZE = {
|
|
182
|
+
sm: {
|
|
183
|
+
width: 60,
|
|
184
|
+
height: 36
|
|
185
|
+
},
|
|
186
|
+
md: {
|
|
187
|
+
width: 74,
|
|
188
|
+
height: 44
|
|
189
|
+
},
|
|
190
|
+
lg: {
|
|
191
|
+
width: 82,
|
|
192
|
+
height: 48
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/** The rail's own padding — the gap the thumb sits inside. */
|
|
197
|
+
const RAIL_INSET = 4;
|
|
198
|
+
const SlideButtonContext = /*#__PURE__*/createContext(null);
|
|
199
|
+
function useSlideButtonContext(component) {
|
|
200
|
+
const context = useContext(SlideButtonContext);
|
|
201
|
+
if (!context) {
|
|
202
|
+
throw new Error(`${component} must be used within a <SlideButton>`);
|
|
203
|
+
}
|
|
204
|
+
return context;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** The slide's progress and whether it has completed, for a custom part. */
|
|
208
|
+
export function useSlideButton() {
|
|
209
|
+
const {
|
|
210
|
+
progress,
|
|
211
|
+
completed
|
|
212
|
+
} = useSlideButtonContext('useSlideButton');
|
|
213
|
+
return {
|
|
214
|
+
progress,
|
|
215
|
+
completed
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function SlideButtonRoot({
|
|
219
|
+
className,
|
|
220
|
+
variant = 'secondary',
|
|
221
|
+
size = 'md',
|
|
222
|
+
fullWidth,
|
|
223
|
+
threshold: thresholdProp,
|
|
224
|
+
onComplete,
|
|
225
|
+
onCompletedChange,
|
|
226
|
+
completed: completedProp,
|
|
227
|
+
autoReset = false,
|
|
228
|
+
autoResetDelay = DEFAULT_AUTO_RESET_DELAY,
|
|
229
|
+
disabled = false,
|
|
230
|
+
haptics = false,
|
|
231
|
+
accessibilityActionLabel = 'Confirm',
|
|
232
|
+
accessibilityState,
|
|
233
|
+
children,
|
|
234
|
+
...props
|
|
235
|
+
}, ref) {
|
|
236
|
+
const reducedMotion = useReducedMotion();
|
|
237
|
+
const sign = useDirectionSign();
|
|
238
|
+
const progress = useSharedValue(0);
|
|
239
|
+
const done = useSharedValue(0);
|
|
240
|
+
const armed = useSharedValue(false);
|
|
241
|
+
const origin = useSharedValue(0);
|
|
242
|
+
|
|
243
|
+
/*
|
|
244
|
+
* The rail's measurements live in shared values, not in the render's
|
|
245
|
+
* closure.
|
|
246
|
+
*
|
|
247
|
+
* A gesture built over plain numbers is a new gesture the first time the rail
|
|
248
|
+
* is measured and again every time anything else changes — and re-attaching a
|
|
249
|
+
* handler mid-drag is how a live touch gets dropped. Built over shared values
|
|
250
|
+
* it is constructed once and reads the current numbers when it runs.
|
|
251
|
+
*/
|
|
252
|
+
const travel = useSharedValue(0);
|
|
253
|
+
const threshold = useSharedValue(resolveThreshold(thresholdProp));
|
|
254
|
+
const active = useSharedValue(false);
|
|
255
|
+
const [internalCompleted, setInternalCompleted] = useState(false);
|
|
256
|
+
const controlled = completedProp !== undefined;
|
|
257
|
+
const completed = controlled ? completedProp : internalCompleted;
|
|
258
|
+
const thumbWidth = THUMB_SIZE[size].width;
|
|
259
|
+
useEffect(() => {
|
|
260
|
+
threshold.value = resolveThreshold(thresholdProp);
|
|
261
|
+
}, [threshold, thresholdProp]);
|
|
262
|
+
useEffect(() => {
|
|
263
|
+
active.value = !disabled && !completed;
|
|
264
|
+
}, [active, completed, disabled]);
|
|
265
|
+
|
|
266
|
+
/*
|
|
267
|
+
* Read from the gesture through `runOnJS`, so they have to be current
|
|
268
|
+
* without the gesture being rebuilt to see them.
|
|
269
|
+
*/
|
|
270
|
+
const completedRef = useRef(completed);
|
|
271
|
+
completedRef.current = completed;
|
|
272
|
+
const onCompleteRef = useRef(onComplete);
|
|
273
|
+
onCompleteRef.current = onComplete;
|
|
274
|
+
const onCompletedChangeRef = useRef(onCompletedChange);
|
|
275
|
+
onCompletedChangeRef.current = onCompletedChange;
|
|
276
|
+
const hapticsRef = useRef(haptics);
|
|
277
|
+
hapticsRef.current = haptics;
|
|
278
|
+
const finish = useCallback(() => {
|
|
279
|
+
if (completedRef.current) return;
|
|
280
|
+
completedRef.current = true;
|
|
281
|
+
setInternalCompleted(true);
|
|
282
|
+
onCompletedChangeRef.current?.(true);
|
|
283
|
+
onCompleteRef.current?.();
|
|
284
|
+
if (hapticsRef.current) impactKnock();
|
|
285
|
+
}, []);
|
|
286
|
+
const tick = useCallback(() => {
|
|
287
|
+
if (hapticsRef.current) selectionTick();
|
|
288
|
+
}, []);
|
|
289
|
+
const reset = useCallback(() => {
|
|
290
|
+
completedRef.current = false;
|
|
291
|
+
setInternalCompleted(false);
|
|
292
|
+
onCompletedChangeRef.current?.(false);
|
|
293
|
+
}, []);
|
|
294
|
+
|
|
295
|
+
/** The screen-reader path: no drag, so the whole travel is granted at once. */
|
|
296
|
+
const activate = useCallback(() => {
|
|
297
|
+
if (disabled || completedRef.current) return;
|
|
298
|
+
progress.value = reducedMotion ? withTiming(1, {
|
|
299
|
+
duration: REDUCED_SNAP
|
|
300
|
+
}) : withSpring(1, SPRING);
|
|
301
|
+
finish();
|
|
302
|
+
}, [disabled, finish, progress, reducedMotion]);
|
|
303
|
+
|
|
304
|
+
/*
|
|
305
|
+
* Built once. The arithmetic is written out here rather than called from
|
|
306
|
+
* `slide-button-track`: a pan handler is the one place in the library that
|
|
307
|
+
* cannot afford a surprise, and a worklet reaching across a module boundary
|
|
308
|
+
* for a helper that reaches across again is a chain with more ways to fail
|
|
309
|
+
* than the three lines are long. The module holds the definition and the
|
|
310
|
+
* tests hold this to it.
|
|
311
|
+
*/
|
|
312
|
+
const gesture = useMemo(() => Gesture.Pan()
|
|
313
|
+
/*
|
|
314
|
+
* A drag has to travel before it takes the touch, or a slide button
|
|
315
|
+
* inside a scroller steals every vertical flick that starts on it.
|
|
316
|
+
*/.activeOffsetX([-12, 12]).failOffsetY([-14, 14]).onBegin(() => {
|
|
317
|
+
'worklet';
|
|
318
|
+
|
|
319
|
+
origin.value = progress.value * travel.value;
|
|
320
|
+
armed.value = false;
|
|
321
|
+
}).onUpdate(event => {
|
|
322
|
+
'worklet';
|
|
323
|
+
|
|
324
|
+
if (!active.value || travel.value <= 0) return;
|
|
325
|
+
|
|
326
|
+
// Every raw pixel goes through `sign`: in a right-to-left subtree the
|
|
327
|
+
// rail runs the other way, and the gesture reports screen space.
|
|
328
|
+
const moved = origin.value + event.translationX * sign;
|
|
329
|
+
const span = travel.value;
|
|
330
|
+
|
|
331
|
+
// The finger is followed exactly inside the rail, and let go of
|
|
332
|
+
// gradually past either end — a thumb that lags reads as a slow app,
|
|
333
|
+
// and one that stops dead reads as a broken control.
|
|
334
|
+
let at = moved;
|
|
335
|
+
if (moved < 0) at = moved / OVERSHOOT_FRICTION;else if (moved > span) at = span + (moved - span) / OVERSHOOT_FRICTION;
|
|
336
|
+
const next = Math.min(1, Math.max(0, at / span));
|
|
337
|
+
progress.value = next;
|
|
338
|
+
const reached = next >= threshold.value;
|
|
339
|
+
if (reached !== armed.value) {
|
|
340
|
+
armed.value = reached;
|
|
341
|
+
// Once per crossing, not once per frame — the arming is the event
|
|
342
|
+
// worth feeling, and a tick every frame is a rattle.
|
|
343
|
+
if (reached) runOnJS(tick)();
|
|
344
|
+
}
|
|
345
|
+
}).onEnd(event => {
|
|
346
|
+
'worklet';
|
|
347
|
+
|
|
348
|
+
armed.value = false;
|
|
349
|
+
if (!active.value || travel.value <= 0) return;
|
|
350
|
+
|
|
351
|
+
// Where it got to, plus where its speed was about to carry it.
|
|
352
|
+
const carried = event.velocityX * sign * VELOCITY_LOOKAHEAD / travel.value;
|
|
353
|
+
const committed = progress.value + carried >= threshold.value;
|
|
354
|
+
|
|
355
|
+
// The velocity is handed to the spring rather than merely consulted,
|
|
356
|
+
// so the thumb keeps the speed it already had instead of restarting
|
|
357
|
+
// from rest.
|
|
358
|
+
const velocity = event.velocityX * sign;
|
|
359
|
+
progress.value = withSpring(committed ? 1 : 0, {
|
|
360
|
+
...SPRING,
|
|
361
|
+
velocity
|
|
362
|
+
});
|
|
363
|
+
if (committed) runOnJS(finish)();
|
|
364
|
+
}), [active, armed, finish, origin, progress, sign, threshold, tick, travel]);
|
|
365
|
+
|
|
366
|
+
/*
|
|
367
|
+
* A controlled completion arrives without a drag behind it, and so does a
|
|
368
|
+
* reset — so the thumb is put where the state says it should be rather than
|
|
369
|
+
* left wherever the finger left it.
|
|
370
|
+
*/
|
|
371
|
+
useEffect(() => {
|
|
372
|
+
progress.value = reducedMotion ? withTiming(completed ? 1 : 0, {
|
|
373
|
+
duration: REDUCED_SNAP
|
|
374
|
+
}) : withSpring(completed ? 1 : 0, SPRING);
|
|
375
|
+
}, [completed, progress, reducedMotion]);
|
|
376
|
+
useEffect(() => {
|
|
377
|
+
done.value = completed ? reducedMotion ? withTiming(1, {
|
|
378
|
+
duration: REDUCED_SNAP
|
|
379
|
+
}) : withSpring(1, SPRING) : withTiming(0, {
|
|
380
|
+
duration: DONE_EXIT
|
|
381
|
+
});
|
|
382
|
+
}, [completed, done, reducedMotion]);
|
|
383
|
+
useEffect(() => {
|
|
384
|
+
if (!autoReset || !completed) return;
|
|
385
|
+
const timer = setTimeout(reset, autoResetDelay);
|
|
386
|
+
return () => clearTimeout(timer);
|
|
387
|
+
}, [autoReset, autoResetDelay, completed, reset]);
|
|
388
|
+
useEffect(() => () => {
|
|
389
|
+
cancelAnimation(progress);
|
|
390
|
+
cancelAnimation(done);
|
|
391
|
+
}, [done, progress]);
|
|
392
|
+
const onLayout = useCallback(event => {
|
|
393
|
+
travel.value = Math.max(0, event.nativeEvent.layout.width - thumbWidth - RAIL_INSET * 2);
|
|
394
|
+
}, [thumbWidth, travel]);
|
|
395
|
+
const slots = slideButtonVariants({
|
|
396
|
+
variant,
|
|
397
|
+
size,
|
|
398
|
+
fullWidth,
|
|
399
|
+
disabled
|
|
400
|
+
});
|
|
401
|
+
const context = useMemo(() => ({
|
|
402
|
+
progress,
|
|
403
|
+
travel,
|
|
404
|
+
done,
|
|
405
|
+
completed,
|
|
406
|
+
slots,
|
|
407
|
+
variant,
|
|
408
|
+
size
|
|
409
|
+
}), [progress, travel, done, completed, slots, variant, size]);
|
|
410
|
+
|
|
411
|
+
/*
|
|
412
|
+
* A caller who wrote no thumb still gets one. The thumb is the control — a
|
|
413
|
+
* slide button without it is a label in a box — so it is appended rather
|
|
414
|
+
* than left to the caller to remember.
|
|
415
|
+
*/
|
|
416
|
+
const hasThumb = Children.toArray(children).some(child => /*#__PURE__*/isValidElement(child) && child.type === SlideButtonThumb);
|
|
417
|
+
return /*#__PURE__*/_jsx(SlideButtonContext.Provider, {
|
|
418
|
+
value: context,
|
|
419
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
420
|
+
ref: ref,
|
|
421
|
+
accessible: true,
|
|
422
|
+
accessibilityRole: "button",
|
|
423
|
+
accessibilityHint: "Slide to confirm",
|
|
424
|
+
accessibilityState: {
|
|
425
|
+
...accessibilityState,
|
|
426
|
+
disabled,
|
|
427
|
+
checked: completed
|
|
428
|
+
}
|
|
429
|
+
// A drag cannot be performed by a screen reader, so the same outcome is
|
|
430
|
+
// offered as an action it can perform.
|
|
431
|
+
,
|
|
432
|
+
accessibilityActions: [{
|
|
433
|
+
name: 'activate',
|
|
434
|
+
label: accessibilityActionLabel
|
|
435
|
+
}],
|
|
436
|
+
onAccessibilityAction: activate,
|
|
437
|
+
onLayout: onLayout
|
|
438
|
+
// After the spread, so a caller's own `onLayout` or accessibility state
|
|
439
|
+
// cannot take the measurement the control runs on.
|
|
440
|
+
,
|
|
441
|
+
...props,
|
|
442
|
+
className: slots.root({
|
|
443
|
+
className
|
|
444
|
+
}),
|
|
445
|
+
children: [/*#__PURE__*/_jsx(SlideButtonFill, {}), textChildren(children, text => /*#__PURE__*/_jsx(SlideButtonLabel, {
|
|
446
|
+
children: text
|
|
447
|
+
})), hasThumb ? null : /*#__PURE__*/_jsx(SlideButtonThumb, {}), /*#__PURE__*/_jsx(GestureDetector, {
|
|
448
|
+
gesture: gesture,
|
|
449
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
450
|
+
style: StyleSheet.absoluteFill
|
|
451
|
+
})
|
|
452
|
+
})]
|
|
453
|
+
})
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/** The travelled part of the rail. Drawn by the root; not a public part. */
|
|
458
|
+
function SlideButtonFill() {
|
|
459
|
+
const {
|
|
460
|
+
progress,
|
|
461
|
+
travel,
|
|
462
|
+
slots,
|
|
463
|
+
size
|
|
464
|
+
} = useSlideButtonContext('SlideButton.Fill');
|
|
465
|
+
const sign = useDirectionSign();
|
|
466
|
+
const overlap = THUMB_SIZE[size].width / 2;
|
|
467
|
+
|
|
468
|
+
/*
|
|
469
|
+
* The trail runs from the handle's own starting edge to somewhere under the
|
|
470
|
+
* handle, and it is zero wide until something has been dragged.
|
|
471
|
+
*
|
|
472
|
+
* Both ends are load-bearing, and both were wrong once.
|
|
473
|
+
*
|
|
474
|
+
* Its leading end is rounded, like the rail. Stopped exactly at the handle's
|
|
475
|
+
* tail that cap met the handle's own cap, and the two facing curves left a
|
|
476
|
+
* lens of bare track between them — two pills on a rail rather than a track
|
|
477
|
+
* being filled in, most obviously at the far end where the reader is looking.
|
|
478
|
+
* Carrying the extra half-handle-width keeps that cap under the handle at
|
|
479
|
+
* every point of the travel: always ahead of the tail, never past the centre.
|
|
480
|
+
*
|
|
481
|
+
* The other end is why the whole width is scaled rather than offset. Adding a
|
|
482
|
+
* constant put a slice of colour beside the handle on a button nobody had
|
|
483
|
+
* touched.
|
|
484
|
+
*/
|
|
485
|
+
const style = useAnimatedStyle(() => ({
|
|
486
|
+
width: progress.value * (travel.value + overlap)
|
|
487
|
+
}));
|
|
488
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
489
|
+
pointerEvents: "none",
|
|
490
|
+
className: slots.fill(),
|
|
491
|
+
style: [{
|
|
492
|
+
top: RAIL_INSET,
|
|
493
|
+
bottom: RAIL_INSET,
|
|
494
|
+
[sign === 1 ? 'left' : 'right']: RAIL_INSET
|
|
495
|
+
}, style]
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* What the button says.
|
|
500
|
+
*
|
|
501
|
+
* Centred in the whole rail rather than in the space beside the thumb, and it
|
|
502
|
+
* does not move or fade — the thumb simply passes over it, and the rail's own
|
|
503
|
+
* clip takes the rest.
|
|
504
|
+
*
|
|
505
|
+
* Fading it out was worse in a way that only shows on a device: the label
|
|
506
|
+
* disappears while there is still most of a rail left to cross, so the button
|
|
507
|
+
* spends the second half of the gesture saying nothing at all. Covered
|
|
508
|
+
* instead, the text is legible right up to the moment the handle reaches it,
|
|
509
|
+
* which is also the moment the reader no longer needs it.
|
|
510
|
+
*/
|
|
511
|
+
function SlideButtonLabel({
|
|
512
|
+
className,
|
|
513
|
+
style,
|
|
514
|
+
children,
|
|
515
|
+
...props
|
|
516
|
+
}) {
|
|
517
|
+
const {
|
|
518
|
+
slots
|
|
519
|
+
} = useSlideButtonContext('SlideButton.Label');
|
|
520
|
+
return /*#__PURE__*/_jsx(View, {
|
|
521
|
+
pointerEvents: "none",
|
|
522
|
+
className: "flex-1 items-center justify-center",
|
|
523
|
+
style: style,
|
|
524
|
+
...props,
|
|
525
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
526
|
+
className: slots.label({
|
|
527
|
+
className
|
|
528
|
+
}),
|
|
529
|
+
children: children
|
|
530
|
+
})
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* The disc the finger moves.
|
|
535
|
+
*
|
|
536
|
+
* Translated rather than laid out at a position, so a drag costs no layout
|
|
537
|
+
* pass. It sits absolutely at the rail's leading inset and travels from there.
|
|
538
|
+
*/
|
|
539
|
+
function SlideButtonThumb({
|
|
540
|
+
className,
|
|
541
|
+
style,
|
|
542
|
+
children,
|
|
543
|
+
...props
|
|
544
|
+
}) {
|
|
545
|
+
const {
|
|
546
|
+
progress,
|
|
547
|
+
travel,
|
|
548
|
+
done,
|
|
549
|
+
completed,
|
|
550
|
+
slots,
|
|
551
|
+
size
|
|
552
|
+
} = useSlideButtonContext('SlideButton.Thumb');
|
|
553
|
+
const sign = useDirectionSign();
|
|
554
|
+
const box = THUMB_SIZE[size];
|
|
555
|
+
const tint = useCSSVariable(THUMB_GLYPH);
|
|
556
|
+
const glyphColor = typeof tint === 'string' ? tint : undefined;
|
|
557
|
+
const slide = useAnimatedStyle(() => ({
|
|
558
|
+
transform: [{
|
|
559
|
+
translateX: progress.value * travel.value * sign
|
|
560
|
+
}]
|
|
561
|
+
}));
|
|
562
|
+
const chevronStyle = useAnimatedStyle(() => ({
|
|
563
|
+
opacity: 1 - done.value
|
|
564
|
+
}));
|
|
565
|
+
const checkStyle = useAnimatedStyle(() => ({
|
|
566
|
+
opacity: done.value,
|
|
567
|
+
transform: [{
|
|
568
|
+
scale: 0.7 + done.value * 0.3
|
|
569
|
+
}]
|
|
570
|
+
}));
|
|
571
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
572
|
+
pointerEvents: "none",
|
|
573
|
+
className: slots.thumb({
|
|
574
|
+
className
|
|
575
|
+
}),
|
|
576
|
+
style: [{
|
|
577
|
+
width: box.width,
|
|
578
|
+
height: box.height,
|
|
579
|
+
[sign === 1 ? 'left' : 'right']: RAIL_INSET
|
|
580
|
+
}, slide, style],
|
|
581
|
+
...props,
|
|
582
|
+
children: /*#__PURE__*/_jsxs(IconColorProvider, {
|
|
583
|
+
color: glyphColor,
|
|
584
|
+
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
585
|
+
className: slots.thumbContent(),
|
|
586
|
+
style: chevronStyle,
|
|
587
|
+
children: children ?? /*#__PURE__*/_jsx(ChevronRightIcon, {
|
|
588
|
+
size: 20
|
|
589
|
+
})
|
|
590
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
591
|
+
className: slots.thumbContent(),
|
|
592
|
+
style: [StyleSheet.absoluteFill, checkStyle],
|
|
593
|
+
accessibilityElementsHidden: !completed,
|
|
594
|
+
importantForAccessibility: completed ? 'auto' : 'no-hide-descendants',
|
|
595
|
+
children: /*#__PURE__*/_jsx(CheckIcon, {
|
|
596
|
+
size: 20
|
|
597
|
+
})
|
|
598
|
+
})]
|
|
599
|
+
})
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
SlideButtonLabel.displayName = 'SlideButton.Label';
|
|
603
|
+
SlideButtonThumb.displayName = 'SlideButton.Thumb';
|
|
604
|
+
const SlideButtonWithRef = /*#__PURE__*/forwardRef(SlideButtonRoot);
|
|
605
|
+
SlideButtonWithRef.displayName = 'SlideButton';
|
|
606
|
+
export const SlideButton = Object.assign(SlideButtonWithRef, {
|
|
607
|
+
Label: SlideButtonLabel,
|
|
608
|
+
Thumb: SlideButtonThumb
|
|
609
|
+
});
|
|
610
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Children","createContext","forwardRef","isValidElement","useCallback","useContext","useEffect","useMemo","useRef","useState","StyleSheet","View","Gesture","GestureDetector","Animated","cancelAnimation","runOnJS","useAnimatedStyle","useReducedMotion","useSharedValue","withSpring","withTiming","tv","useCSSVariable","useDirectionSign","CheckIcon","ChevronRightIcon","IconColorProvider","Text","textChildren","impactKnock","selectionTick","DEFAULT_AUTO_RESET_DELAY","OVERSHOOT_FRICTION","VELOCITY_LOOKAHEAD","resolveThreshold","jsx","_jsx","jsxs","_jsxs","SPRING","damping","stiffness","mass","overshootClamping","DONE_EXIT","REDUCED_SNAP","THUMB_GLYPH","slideButtonVariants","slots","root","fill","label","thumb","thumbContent","variants","variant","secondary","destructive","success","size","sm","md","lg","fullWidth","true","disabled","defaultVariants","THUMB_SIZE","width","height","RAIL_INSET","SlideButtonContext","useSlideButtonContext","component","context","Error","useSlideButton","progress","completed","SlideButtonRoot","className","threshold","thresholdProp","onComplete","onCompletedChange","completedProp","autoReset","autoResetDelay","haptics","accessibilityActionLabel","accessibilityState","children","props","ref","reducedMotion","sign","done","armed","origin","travel","active","internalCompleted","setInternalCompleted","controlled","undefined","thumbWidth","value","completedRef","current","onCompleteRef","onCompletedChangeRef","hapticsRef","finish","tick","reset","activate","duration","gesture","Pan","activeOffsetX","failOffsetY","onBegin","onUpdate","event","moved","translationX","span","at","next","Math","min","max","reached","onEnd","carried","velocityX","committed","velocity","timer","setTimeout","clearTimeout","onLayout","nativeEvent","layout","hasThumb","toArray","some","child","type","SlideButtonThumb","Provider","accessible","accessibilityRole","accessibilityHint","checked","accessibilityActions","name","onAccessibilityAction","SlideButtonFill","text","SlideButtonLabel","style","absoluteFill","overlap","pointerEvents","top","bottom","box","tint","glyphColor","slide","transform","translateX","chevronStyle","opacity","checkStyle","scale","color","accessibilityElementsHidden","importantForAccessibility","displayName","SlideButtonWithRef","SlideButton","Object","assign","Label","Thumb"],"sourceRoot":"../../../../src","sources":["components/slide-button/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,QAAQ,EACRC,aAAa,EACbC,UAAU,EACVC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAEH,OAAO;AACd,SAASC,UAAU,EAAEC,IAAI,QAAgD,cAAc;AACvF,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,OAAOC,QAAQ,IACbC,eAAe,EACfC,OAAO,EACPC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QAEL,yBAAyB;AAChC,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,gBAAgB,QAAQ,8BAA2B;AAC5D,SAASC,SAAS,EAAEC,gBAAgB,EAAEC,iBAAiB,QAAQ,sBAAa;AAC5E,SAASC,IAAI,EAAEC,YAAY,QAAQ,0BAAuB;AAC1D,SAASC,WAAW,EAAEC,aAAa,QAAQ,wBAAqB;AAChE,SACEC,wBAAwB,EACxBC,kBAAkB,EAClBC,kBAAkB,EAClBC,gBAAgB,QACX,yBAAsB;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AASA,MAAMC,MAAM,GAAG;EACbC,OAAO,EAAE,EAAE;EACXC,SAAS,EA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