panelui-native 0.77.0 → 0.79.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.
Files changed (142) hide show
  1. package/lib/module/components/area-chart/index.js +32 -25
  2. package/lib/module/components/area-chart/index.js.map +1 -1
  3. package/lib/module/components/bottom-sheet/index.js +97 -15
  4. package/lib/module/components/bottom-sheet/index.js.map +1 -1
  5. package/lib/module/components/funnel-chart/index.js +15 -2
  6. package/lib/module/components/funnel-chart/index.js.map +1 -1
  7. package/lib/module/components/heatmap-chart/index.js +19 -27
  8. package/lib/module/components/heatmap-chart/index.js.map +1 -1
  9. package/lib/module/components/hex-chart/index.js +2 -0
  10. package/lib/module/components/hex-chart/index.js.map +1 -1
  11. package/lib/module/components/line-chart/index.js +38 -31
  12. package/lib/module/components/line-chart/index.js.map +1 -1
  13. package/lib/module/components/map/index.js +63 -39
  14. package/lib/module/components/map/index.js.map +1 -1
  15. package/lib/module/components/map/map-children.js +54 -0
  16. package/lib/module/components/map/map-children.js.map +1 -0
  17. package/lib/module/components/map/maplibre.js +31 -3
  18. package/lib/module/components/map/maplibre.js.map +1 -1
  19. package/lib/module/components/markdown-editor/index.js +288 -34
  20. package/lib/module/components/markdown-editor/index.js.map +1 -1
  21. package/lib/module/components/markdown-editor/markdown-transforms.js +272 -9
  22. package/lib/module/components/markdown-editor/markdown-transforms.js.map +1 -1
  23. package/lib/module/components/marquee/index.js +205 -46
  24. package/lib/module/components/marquee/index.js.map +1 -1
  25. package/lib/module/components/panelside/index.js +162 -34
  26. package/lib/module/components/panelside/index.js.map +1 -1
  27. package/lib/module/components/pie-chart/index.js +15 -2
  28. package/lib/module/components/pie-chart/index.js.map +1 -1
  29. package/lib/module/components/plot/index.js +42 -44
  30. package/lib/module/components/plot/index.js.map +1 -1
  31. package/lib/module/components/progress-button/index.js +617 -0
  32. package/lib/module/components/progress-button/index.js.map +1 -0
  33. package/lib/module/components/progress-button/progress-button-hold.js +91 -0
  34. package/lib/module/components/progress-button/progress-button-hold.js.map +1 -0
  35. package/lib/module/components/scatter-chart/index.js +6 -25
  36. package/lib/module/components/scatter-chart/index.js.map +1 -1
  37. package/lib/module/components/section-rail/index.js +40 -17
  38. package/lib/module/components/section-rail/index.js.map +1 -1
  39. package/lib/module/components/split-view/index.js +54 -10
  40. package/lib/module/components/split-view/index.js.map +1 -1
  41. package/lib/module/components/theme-selector/index.js +239 -0
  42. package/lib/module/components/theme-selector/index.js.map +1 -0
  43. package/lib/module/components/theme-selector/theme-preview.js +320 -0
  44. package/lib/module/components/theme-selector/theme-preview.js.map +1 -0
  45. package/lib/module/components/timeline/index.js +145 -14
  46. package/lib/module/components/timeline/index.js.map +1 -1
  47. package/lib/module/components/toast/index.js +45 -11
  48. package/lib/module/components/toast/index.js.map +1 -1
  49. package/lib/module/components/treemap-chart/index.js +63 -6
  50. package/lib/module/components/treemap-chart/index.js.map +1 -1
  51. package/lib/module/components/waterfall-chart/index.js +20 -4
  52. package/lib/module/components/waterfall-chart/index.js.map +1 -1
  53. package/lib/module/hooks/index.js +1 -0
  54. package/lib/module/hooks/index.js.map +1 -1
  55. package/lib/module/hooks/use-scroll-sections.js +44 -2
  56. package/lib/module/hooks/use-scroll-sections.js.map +1 -1
  57. package/lib/module/hooks/use-skeleton-handoff.js +58 -0
  58. package/lib/module/hooks/use-skeleton-handoff.js.map +1 -0
  59. package/lib/module/index.js +2 -0
  60. package/lib/module/index.js.map +1 -1
  61. package/lib/typescript/src/components/area-chart/index.d.ts +1 -1
  62. package/lib/typescript/src/components/area-chart/index.d.ts.map +1 -1
  63. package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
  64. package/lib/typescript/src/components/funnel-chart/index.d.ts.map +1 -1
  65. package/lib/typescript/src/components/heatmap-chart/index.d.ts.map +1 -1
  66. package/lib/typescript/src/components/hex-chart/index.d.ts.map +1 -1
  67. package/lib/typescript/src/components/line-chart/index.d.ts +1 -1
  68. package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -1
  69. package/lib/typescript/src/components/map/index.d.ts +8 -4
  70. package/lib/typescript/src/components/map/index.d.ts.map +1 -1
  71. package/lib/typescript/src/components/map/map-children.d.ts +41 -0
  72. package/lib/typescript/src/components/map/map-children.d.ts.map +1 -0
  73. package/lib/typescript/src/components/map/maplibre.d.ts +8 -4
  74. package/lib/typescript/src/components/map/maplibre.d.ts.map +1 -1
  75. package/lib/typescript/src/components/markdown-editor/index.d.ts +64 -5
  76. package/lib/typescript/src/components/markdown-editor/index.d.ts.map +1 -1
  77. package/lib/typescript/src/components/markdown-editor/markdown-transforms.d.ts +33 -5
  78. package/lib/typescript/src/components/markdown-editor/markdown-transforms.d.ts.map +1 -1
  79. package/lib/typescript/src/components/marquee/index.d.ts +55 -2
  80. package/lib/typescript/src/components/marquee/index.d.ts.map +1 -1
  81. package/lib/typescript/src/components/panelside/index.d.ts +79 -4
  82. package/lib/typescript/src/components/panelside/index.d.ts.map +1 -1
  83. package/lib/typescript/src/components/pie-chart/index.d.ts.map +1 -1
  84. package/lib/typescript/src/components/plot/index.d.ts +1 -3
  85. package/lib/typescript/src/components/plot/index.d.ts.map +1 -1
  86. package/lib/typescript/src/components/progress-button/index.d.ts +311 -0
  87. package/lib/typescript/src/components/progress-button/index.d.ts.map +1 -0
  88. package/lib/typescript/src/components/progress-button/progress-button-hold.d.ts +60 -0
  89. package/lib/typescript/src/components/progress-button/progress-button-hold.d.ts.map +1 -0
  90. package/lib/typescript/src/components/scatter-chart/index.d.ts +1 -1
  91. package/lib/typescript/src/components/scatter-chart/index.d.ts.map +1 -1
  92. package/lib/typescript/src/components/section-rail/index.d.ts.map +1 -1
  93. package/lib/typescript/src/components/split-view/index.d.ts +10 -1
  94. package/lib/typescript/src/components/split-view/index.d.ts.map +1 -1
  95. package/lib/typescript/src/components/theme-selector/index.d.ts +107 -0
  96. package/lib/typescript/src/components/theme-selector/index.d.ts.map +1 -0
  97. package/lib/typescript/src/components/theme-selector/theme-preview.d.ts +32 -0
  98. package/lib/typescript/src/components/theme-selector/theme-preview.d.ts.map +1 -0
  99. package/lib/typescript/src/components/timeline/index.d.ts +7 -0
  100. package/lib/typescript/src/components/timeline/index.d.ts.map +1 -1
  101. package/lib/typescript/src/components/toast/index.d.ts.map +1 -1
  102. package/lib/typescript/src/components/treemap-chart/index.d.ts.map +1 -1
  103. package/lib/typescript/src/components/waterfall-chart/index.d.ts.map +1 -1
  104. package/lib/typescript/src/hooks/index.d.ts +1 -0
  105. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  106. package/lib/typescript/src/hooks/use-scroll-sections.d.ts +1 -0
  107. package/lib/typescript/src/hooks/use-scroll-sections.d.ts.map +1 -1
  108. package/lib/typescript/src/hooks/use-skeleton-handoff.d.ts +11 -0
  109. package/lib/typescript/src/hooks/use-skeleton-handoff.d.ts.map +1 -0
  110. package/lib/typescript/src/index.d.ts +6 -4
  111. package/lib/typescript/src/index.d.ts.map +1 -1
  112. package/package.json +1 -1
  113. package/src/components/area-chart/index.tsx +49 -37
  114. package/src/components/bottom-sheet/index.tsx +109 -11
  115. package/src/components/funnel-chart/index.tsx +10 -2
  116. package/src/components/heatmap-chart/index.tsx +27 -22
  117. package/src/components/hex-chart/index.tsx +22 -6
  118. package/src/components/line-chart/index.tsx +57 -43
  119. package/src/components/map/index.tsx +63 -36
  120. package/src/components/map/map-children.ts +66 -0
  121. package/src/components/map/maplibre.ts +32 -4
  122. package/src/components/markdown-editor/index.tsx +413 -35
  123. package/src/components/markdown-editor/markdown-transforms.ts +274 -10
  124. package/src/components/marquee/index.tsx +254 -58
  125. package/src/components/panelside/index.tsx +179 -40
  126. package/src/components/pie-chart/index.tsx +10 -2
  127. package/src/components/plot/index.tsx +66 -50
  128. package/src/components/progress-button/index.tsx +684 -0
  129. package/src/components/progress-button/progress-button-hold.ts +88 -0
  130. package/src/components/scatter-chart/index.tsx +4 -25
  131. package/src/components/section-rail/index.tsx +39 -19
  132. package/src/components/split-view/index.tsx +53 -8
  133. package/src/components/theme-selector/index.tsx +281 -0
  134. package/src/components/theme-selector/theme-preview.tsx +205 -0
  135. package/src/components/timeline/index.tsx +143 -17
  136. package/src/components/toast/index.tsx +60 -11
  137. package/src/components/treemap-chart/index.tsx +65 -8
  138. package/src/components/waterfall-chart/index.tsx +14 -4
  139. package/src/hooks/index.ts +5 -0
  140. package/src/hooks/use-scroll-sections.ts +52 -3
  141. package/src/hooks/use-skeleton-handoff.ts +69 -0
  142. package/src/index.ts +25 -0
@@ -0,0 +1,617 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * ProgressButton — press and hold to confirm, with the wait drawn on the button.
5
+ *
6
+ * ```tsx
7
+ * <ProgressButton onComplete={wipe}>
8
+ * <ProgressButton.Label>Hold to erase</ProgressButton.Label>
9
+ * </ProgressButton>
10
+ * ```
11
+ *
12
+ * For the action a confirmation dialog exists to slow down. A dialog asks the
13
+ * question somewhere else and takes the answer as a tap — which is two taps,
14
+ * and two taps in a row is a rhythm a hand falls into. A hold cannot be
15
+ * completed by accident and cannot be completed by habit: it has to be
16
+ * sustained, and the fill says for how much longer.
17
+ *
18
+ * ## The fill is the promise
19
+ *
20
+ * Nothing fires until the fill reaches the end. There is no tolerance near the
21
+ * top, because a tolerance means the button sometimes commits after the reader
22
+ * has deliberately let go — which is the one failure a confirmation control
23
+ * cannot have. Released early, the fill drains back, in proportion to how far
24
+ * it got.
25
+ *
26
+ * ## How it is drawn
27
+ *
28
+ * The fill is a clipped copy of the button in inverted colours, growing from
29
+ * the leading edge. That is what keeps the label legible across the boundary:
30
+ * a single label under a translucent wash goes muddy in the middle of the
31
+ * wipe, exactly where the eye is. Two labels, each at full contrast on its own
32
+ * ground, never do.
33
+ *
34
+ * The clip is a view under `overflow: 'hidden'`, and its width is animated.
35
+ * Animating a width is normally a layout pass per frame; this view is
36
+ * absolutely positioned over the button and its copy of the label is pinned to
37
+ * the button's own width, so nothing it contains reflows as it grows.
38
+ *
39
+ * ## Reduced motion
40
+ *
41
+ * The wipe is replaced by a stepped fill that advances in fifths. The hold
42
+ * still has to be legible — a control that asks you to wait and shows nothing
43
+ * is a broken button — so this is a coarser indicator, not the absence of one.
44
+ */
45
+ import { Children, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
46
+ import { Pressable, View } from 'react-native';
47
+ import Animated, { Easing, cancelAnimation, runOnJS, runOnUI, useAnimatedReaction, useAnimatedStyle, useReducedMotion, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
48
+ import { tv } from 'tailwind-variants';
49
+ import { useCSSVariable } from 'uniwind';
50
+ import { CheckIcon, IconColorProvider } from "../../icons/index.js";
51
+ import { Text, textChildren } from "../../primitives/text.js";
52
+ import { impactKnock, selectionTick } from "../../utils/haptics.js";
53
+ import { DEFAULT_AUTO_RESET_DELAY, fillDuration, releaseDuration, resolveHoldDuration } from "./progress-button-hold.js";
54
+
55
+ /** How many steps the reduced-motion fill advances in. */
56
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
57
+ const REDUCED_STEPS = 5;
58
+
59
+ /**
60
+ * The arrival of the completed drawing.
61
+ *
62
+ * A spring rather than a timing, and slightly overshooting: the fill has just
63
+ * spent two seconds moving at a constant rate, and something that lands with a
64
+ * little weight is what tells the reader the waiting part is over.
65
+ */
66
+ const DONE_SPRING = {
67
+ damping: 14,
68
+ stiffness: 220,
69
+ mass: 0.6
70
+ };
71
+
72
+ /** How long the completed drawing takes to leave again on a reset. */
73
+ const DONE_EXIT = 140;
74
+
75
+ /**
76
+ * Which token the tick is drawn in, per variant.
77
+ *
78
+ * It sits on the finished fill, so it takes that fill's own foreground rather
79
+ * than the button's — the same pairing `fillLabel` uses, which is what keeps
80
+ * the contrast right in both themes without a hardcoded colour.
81
+ */
82
+ const DONE_TINT = {
83
+ primary: '--color-primary-foreground',
84
+ secondary: '--color-background',
85
+ destructive: '--color-destructive-solid-foreground',
86
+ success: '--color-success-solid-foreground'
87
+ };
88
+ const progressButtonVariants = tv({
89
+ slots: {
90
+ /*
91
+ * A pill, not the `rounded-lg` the other buttons take.
92
+ *
93
+ * The fill is clipped by this radius, so the shape of the button is also
94
+ * the shape of the wipe's leading edge as it comes out of the corner. On a
95
+ * small radius that edge emerges square from a rounded box, which reads as
96
+ * a rectangle sliding out from under the button rather than as the button
97
+ * filling up.
98
+ */
99
+ /*
100
+ * Every variant rests on the same secondary surface, and `variant` decides
101
+ * only what colour comes across it.
102
+ *
103
+ * Drawn as outlines they were four different buttons before anything had
104
+ * happened, and the one thing they all do — wait to be held — was the
105
+ * thing the drawing did not say. A solid ground says it: the button is
106
+ * unfilled, and the fill is what the hold produces.
107
+ *
108
+ * The variant is still legible at rest, because the label carries its
109
+ * colour. That is the half worth keeping — a destructive hold should not
110
+ * look like an ordinary one before it is touched — and it is also the half
111
+ * that survives the wipe, since the fill covers the ground the label was
112
+ * standing on and the second copy takes over.
113
+ */
114
+ root: 'relative overflow-hidden rounded-full border border-transparent bg-secondary',
115
+ /*
116
+ * The row inside the button. It is separate from `root` because the fill
117
+ * has to sit over the whole button including its padding — a wipe that
118
+ * stops at the text's own box leaves an unfilled margin down each side and
119
+ * reads as a progress bar someone put inside a button.
120
+ */
121
+ content: 'flex-row items-center justify-center gap-2',
122
+ label: 'min-w-0 shrink text-center font-medium',
123
+ /** The inverted copy, drawn on the filled ground. */
124
+ fill: '',
125
+ fillLabel: 'min-w-0 shrink text-center font-medium'
126
+ },
127
+ variants: {
128
+ variant: {
129
+ primary: {
130
+ label: 'text-primary',
131
+ fill: 'bg-primary',
132
+ fillLabel: 'text-primary-foreground'
133
+ },
134
+ secondary: {
135
+ label: 'text-secondary-foreground',
136
+ fill: 'bg-foreground',
137
+ fillLabel: 'text-background'
138
+ },
139
+ destructive: {
140
+ label: 'text-destructive',
141
+ fill: 'bg-destructive',
142
+ fillLabel: 'text-destructive-solid-foreground'
143
+ },
144
+ success: {
145
+ label: 'text-success',
146
+ fill: 'bg-success',
147
+ fillLabel: 'text-success-solid-foreground'
148
+ }
149
+ },
150
+ size: {
151
+ // Matched to Button's boxes, and `min-h-*` for the same reason: the
152
+ // label's glyphs grow with the system text size and the box has to grow
153
+ // with them.
154
+ // Wider than the equivalent Button, because the corner is a half-circle
155
+ // rather than a small radius: the curve eats into the side padding, and
156
+ // at Button's values the first and last glyphs sit against it.
157
+ sm: {
158
+ root: 'min-h-9',
159
+ content: 'min-h-9 gap-1.5 px-3.5 py-2',
160
+ label: 'text-[14px]',
161
+ fillLabel: 'text-[14px]'
162
+ },
163
+ md: {
164
+ root: 'min-h-11',
165
+ content: 'min-h-11 px-5 py-2.5',
166
+ label: 'text-[16px]',
167
+ fillLabel: 'text-[16px]'
168
+ },
169
+ lg: {
170
+ root: 'min-h-12',
171
+ content: 'min-h-12 px-7 py-2.5',
172
+ label: 'text-[18px]',
173
+ fillLabel: 'text-[18px]'
174
+ }
175
+ },
176
+ fullWidth: {
177
+ true: {
178
+ root: 'w-full'
179
+ }
180
+ },
181
+ disabled: {
182
+ true: {
183
+ root: 'opacity-[0.64]'
184
+ }
185
+ }
186
+ },
187
+ defaultVariants: {
188
+ variant: 'primary',
189
+ size: 'md'
190
+ }
191
+ });
192
+
193
+ /** How a progress button looks. */
194
+
195
+ /** How big a progress button is. */
196
+
197
+ const ProgressButtonContext = /*#__PURE__*/createContext(null);
198
+ function useProgressButtonContext(component) {
199
+ const context = useContext(ProgressButtonContext);
200
+ if (!context) throw new Error(`${component} must be used within a <ProgressButton>`);
201
+ return context;
202
+ }
203
+
204
+ /** How far through the hold this button is, for something rendered inside it. */
205
+ export function useProgressButton() {
206
+ const {
207
+ progress,
208
+ completed
209
+ } = useProgressButtonContext('useProgressButton');
210
+ return {
211
+ progress,
212
+ completed
213
+ };
214
+ }
215
+ const ProgressButtonRoot = /*#__PURE__*/forwardRef(function ProgressButtonRoot({
216
+ className,
217
+ variant = 'primary',
218
+ size = 'md',
219
+ fullWidth,
220
+ holdDuration,
221
+ onComplete,
222
+ onCompletedChange,
223
+ completed: completedProp,
224
+ autoReset = false,
225
+ autoResetDelay = DEFAULT_AUTO_RESET_DELAY,
226
+ disabled = false,
227
+ haptics = false,
228
+ accessibilityState,
229
+ children,
230
+ ...props
231
+ }, ref) {
232
+ const slots = progressButtonVariants({
233
+ variant,
234
+ size,
235
+ fullWidth,
236
+ disabled
237
+ });
238
+ const duration = resolveHoldDuration(holdDuration);
239
+ const reducedMotion = useReducedMotion();
240
+ const progress = useSharedValue(0);
241
+ const done = useSharedValue(0);
242
+ const [width, setWidth] = useState(0);
243
+ const [internalCompleted, setInternalCompleted] = useState(false);
244
+ const resetTimer = useRef(null);
245
+ const isControlled = completedProp !== undefined;
246
+ const completed = isControlled ? completedProp : internalCompleted;
247
+
248
+ /*
249
+ * The reaction below watches a shared value, and a shared value can reach the
250
+ * end for reasons other than a hold — a controlled button being told it is
251
+ * complete fills instantly. Read from a ref rather than from `completed` so
252
+ * the guard sees the current answer without the reaction being rebuilt.
253
+ */
254
+ const completedRef = useRef(completed);
255
+ completedRef.current = completed;
256
+ const finish = useCallback(() => {
257
+ // Already complete: the fill was set from outside, and firing the action
258
+ // again would run it a second time for something the reader did not do.
259
+ if (completedRef.current) return;
260
+ if (!isControlled) setInternalCompleted(true);
261
+ onCompletedChange?.(true);
262
+ onComplete?.();
263
+ if (haptics) impactKnock();
264
+ }, [isControlled, onComplete, onCompletedChange, haptics]);
265
+
266
+ /*
267
+ * Completion is read off the animation rather than timed alongside it.
268
+ *
269
+ * A `setTimeout` for `holdDuration` and a fill for `holdDuration` are two
270
+ * clocks that agree only while the app is idle: the moment the JS thread is
271
+ * busy the button fires before the fill arrives, or the fill sits full while
272
+ * nothing happens. The reaction fires on the frame the value actually
273
+ * reaches the end, which is the frame the reader saw it get there.
274
+ */
275
+ useAnimatedReaction(() => progress.value >= 1, (full, was) => {
276
+ if (full && !was) runOnJS(finish)();
277
+ });
278
+
279
+ /*
280
+ * Both directions are started on the UI thread, and that is not a detail.
281
+ *
282
+ * A shared value animated on the UI thread does not report back to
283
+ * JavaScript, so `progress.value` read from a press handler is the value
284
+ * from before the hold began — zero. The release computed from it either did
285
+ * nothing or, worse, `cancelAnimation` wrote that stale zero back and the
286
+ * fill vanished on touch-up instead of travelling home.
287
+ *
288
+ * `runOnUI` puts the read where the value actually lives.
289
+ */
290
+ const begin = useCallback(() => {
291
+ if (disabled || completed) return;
292
+ if (haptics) selectionTick();
293
+ runOnUI(() => {
294
+ 'worklet';
295
+
296
+ cancelAnimation(progress);
297
+ const from = progress.value;
298
+ if (from >= 1) return;
299
+ progress.value = withTiming(1, {
300
+ // The distance still ahead, at the fill's own rate — so a press that
301
+ // catches the fill on its way back carries on from there rather than
302
+ // restarting the clock.
303
+ duration: fillDuration(from, duration),
304
+ /*
305
+ * Linear. A fill is constant motion, and an eased one misreports the
306
+ * wait: it races the first half and crawls the second, or the reverse.
307
+ *
308
+ * Under reduced motion it steps instead, and is still a real
309
+ * indicator — what that setting is about is continuous movement, not
310
+ * the button saying how much longer to wait. Take that away and the
311
+ * control asks for a hold with nothing on screen to say why.
312
+ */
313
+ easing: reducedMotion ? Easing.steps(REDUCED_STEPS, true) : Easing.linear
314
+ });
315
+ })();
316
+ }, [disabled, completed, haptics, progress, reducedMotion, duration]);
317
+
318
+ /*
319
+ * The fill, played backwards.
320
+ *
321
+ * Same rate, same easing, same stepping under reduced motion — only the
322
+ * direction differs. Let go at nine tenths of a two-second hold and the fill
323
+ * takes 1.8 seconds to travel home, which is the 1.8 seconds it took to get
324
+ * there. A fill that vanishes has been deleted; a fill that travels back has
325
+ * been let go, and telling those apart is the whole reason the wait is drawn
326
+ * on the button.
327
+ *
328
+ * Every path that empties the fill goes through here — a hold let go, an
329
+ * `autoReset` landing, a controlled button told it is no longer complete.
330
+ * They were three separate assignments and two of them snapped.
331
+ */
332
+ const rewind = useCallback(() => {
333
+ runOnUI(() => {
334
+ 'worklet';
335
+
336
+ cancelAnimation(progress);
337
+ const from = progress.value;
338
+ if (from <= 0) {
339
+ progress.value = 0;
340
+ return;
341
+ }
342
+ progress.value = withTiming(0, {
343
+ duration: releaseDuration(from, duration),
344
+ easing: reducedMotion ? Easing.steps(REDUCED_STEPS, true) : Easing.linear
345
+ });
346
+ })();
347
+ }, [progress, duration, reducedMotion]);
348
+ const abandon = useCallback(() => {
349
+ /*
350
+ * A completed hold has nothing to abandon. Without this the fill drains on
351
+ * the release that follows a successful hold — the button empties, looks
352
+ * untouched, and then refuses every press after it, because `begin` bails
353
+ * on a completed button. That combination is a control that has silently
354
+ * stopped working.
355
+ */
356
+ if (completedRef.current) return;
357
+ rewind();
358
+ }, [rewind]);
359
+ const reset = useCallback(() => {
360
+ rewind();
361
+ if (!isControlled) setInternalCompleted(false);
362
+ onCompletedChange?.(false);
363
+ }, [rewind, isControlled, onCompletedChange]);
364
+ useEffect(() => {
365
+ if (!completed || !autoReset) return;
366
+ resetTimer.current = setTimeout(reset, autoResetDelay);
367
+ return () => {
368
+ if (resetTimer.current) clearTimeout(resetTimer.current);
369
+ resetTimer.current = null;
370
+ };
371
+ }, [completed, autoReset, autoResetDelay, reset]);
372
+
373
+ /*
374
+ * The fill follows the completed state, in both directions.
375
+ *
376
+ * A controlled button told it is complete fills without a hold, and one told
377
+ * it is no longer complete empties — otherwise the next hold would start from
378
+ * a bar that is already full.
379
+ */
380
+ useEffect(() => {
381
+ if (completed) {
382
+ cancelAnimation(progress);
383
+ progress.value = 1;
384
+ return;
385
+ }
386
+ rewind();
387
+ }, [completed, progress, rewind]);
388
+
389
+ /*
390
+ * And the completed drawing follows it too. Under reduced motion it is a
391
+ * swap: what that setting is about is movement, and a tick that grows is
392
+ * movement with nothing to report.
393
+ */
394
+ useEffect(() => {
395
+ if (reducedMotion) {
396
+ done.value = completed ? 1 : 0;
397
+ return;
398
+ }
399
+ done.value = completed ? withSpring(1, DONE_SPRING) : withTiming(0, {
400
+ duration: DONE_EXIT
401
+ });
402
+ }, [completed, done, reducedMotion]);
403
+ useEffect(() => () => {
404
+ cancelAnimation(progress);
405
+ cancelAnimation(done);
406
+ if (resetTimer.current) clearTimeout(resetTimer.current);
407
+ }, [progress, done]);
408
+ const onLayout = event => {
409
+ const next = Math.round(event.nativeEvent.layout.width);
410
+ setWidth(current => current === next ? current : next);
411
+ props.onLayout?.(event);
412
+ };
413
+
414
+ /*
415
+ * `slots` is rebuilt every render, so it is deliberately not a dependency —
416
+ * including it would make this memo re-run every time and hand every consumer
417
+ * a new object for no change. The variant and size it is derived from are the
418
+ * dependencies instead.
419
+ */
420
+ const context = useMemo(() => ({
421
+ progress,
422
+ done,
423
+ width,
424
+ completed,
425
+ variant,
426
+ size,
427
+ slots
428
+ }),
429
+ // eslint-disable-next-line react-hooks/exhaustive-deps
430
+ [progress, done, width, completed, variant, size]);
431
+
432
+ /*
433
+ * The completed drawing is part of the button rather than something every
434
+ * call site has to remember, so one is added unless the caller wrote their
435
+ * own. A hold that lands and shows nothing is the reader wondering whether it
436
+ * worked, which is the thing this control exists to remove.
437
+ */
438
+ const written = Children.toArray(children);
439
+ const hasDone = written.some(child => /*#__PURE__*/isValidElement(child) && child.type === ProgressButtonDone);
440
+ const body = /*#__PURE__*/_jsxs(_Fragment, {
441
+ children: [written.length > 0 ? written : /*#__PURE__*/_jsx(ProgressButtonLabel, {
442
+ children: "Hold to confirm"
443
+ }), hasDone ? null : /*#__PURE__*/_jsx(ProgressButtonDone, {})]
444
+ });
445
+ return /*#__PURE__*/_jsx(ProgressButtonContext.Provider, {
446
+ value: context,
447
+ children: /*#__PURE__*/_jsx(Pressable, {
448
+ ref: ref,
449
+ accessibilityRole: "button"
450
+ /*
451
+ * Spoken as what it is. A button whose label says "Hold to confirm"
452
+ * still announces as an ordinary button to anyone who cannot see the
453
+ * fill, and a single activation does nothing — so the hint carries the
454
+ * instruction and the state carries the outcome.
455
+ */,
456
+ accessibilityHint: "Press and hold to confirm",
457
+ accessibilityState: {
458
+ ...accessibilityState,
459
+ disabled,
460
+ checked: completed
461
+ },
462
+ disabled: disabled
463
+ /*
464
+ * The spread sits above the hold rather than below it. Underneath, a
465
+ * caller passing `onPressIn` — reasonably, to log a tap — would replace
466
+ * the gesture the whole control is, and the button would simply never
467
+ * fill.
468
+ */,
469
+ ...props,
470
+ onPressIn: begin,
471
+ onPressOut: abandon
472
+ // A few points of drift should not abandon a hold the reader is
473
+ // still making. Fingers move.
474
+ ,
475
+ pressRetentionOffset: 16,
476
+ onLayout: onLayout,
477
+ className: slots.root({
478
+ className
479
+ }),
480
+ children: body
481
+ })
482
+ });
483
+ });
484
+ /**
485
+ * What the button says, drawn twice.
486
+ *
487
+ * The second copy is the one inside the fill, in the inverted colour, pinned to
488
+ * the button's own width and clipped to however far the hold has got. Both are
489
+ * the same text at the same position, so the boundary between them falls in the
490
+ * middle of a glyph rather than between two differently laid-out lines.
491
+ */
492
+ function ProgressButtonLabel({
493
+ className,
494
+ children,
495
+ ...props
496
+ }) {
497
+ const {
498
+ progress,
499
+ width,
500
+ slots
501
+ } = useProgressButtonContext('ProgressButton.Label');
502
+ const fillStyle = useAnimatedStyle(() => ({
503
+ width: width * progress.value
504
+ }));
505
+ return /*#__PURE__*/_jsxs(View, {
506
+ ...props,
507
+ className: slots.content({
508
+ className
509
+ }),
510
+ children: [textChildren(children, text => /*#__PURE__*/_jsx(Text, {
511
+ className: slots.label(),
512
+ children: text
513
+ })), /*#__PURE__*/_jsx(Animated.View, {
514
+ pointerEvents: "none",
515
+ style: [{
516
+ position: 'absolute',
517
+ top: 0,
518
+ bottom: 0,
519
+ left: 0,
520
+ overflow: 'hidden'
521
+ }, fillStyle],
522
+ className: slots.fill(),
523
+ children: /*#__PURE__*/_jsx(View, {
524
+ style: {
525
+ width
526
+ },
527
+ className: slots.content(),
528
+ children: textChildren(children, text => /*#__PURE__*/_jsx(Text, {
529
+ className: slots.fillLabel(),
530
+ children: text
531
+ }))
532
+ })
533
+ })]
534
+ });
535
+ }
536
+ ProgressButtonLabel.displayName = 'ProgressButton.Label';
537
+ /**
538
+ * The drawing the button lands on.
539
+ *
540
+ * It sits over the finished fill rather than beside the label, so the button
541
+ * does not change width at the moment it completes — a control that resizes as
542
+ * it succeeds moves everything under it, and the reader's eye is on the button.
543
+ *
544
+ * One is added for you unless you write your own, because a hold that lands and
545
+ * shows nothing leaves the reader checking whether it worked.
546
+ */
547
+ function ProgressButtonDone({
548
+ className,
549
+ children,
550
+ ...props
551
+ }) {
552
+ const {
553
+ done,
554
+ completed,
555
+ variant,
556
+ slots
557
+ } = useProgressButtonContext('ProgressButton.Done');
558
+ const tint = useCSSVariable(DONE_TINT[variant]);
559
+
560
+ /*
561
+ * It carries the fill's own colour and covers the button edge to edge.
562
+ *
563
+ * The alternative — fading the label out from under it — takes the fill with
564
+ * it, because the fill is drawn inside the label so that the two copies of
565
+ * the text line up. The button would empty at the exact moment it succeeded,
566
+ * and the tick, drawn in the colour that reads against a full fill, would be
567
+ * left standing on nothing.
568
+ */
569
+ const style = useAnimatedStyle(() => ({
570
+ opacity: done.value
571
+ }));
572
+ // The tick arrives from slightly under full size. The ground it lands on
573
+ // does not: a background box that grows reads as the button resizing.
574
+ const markStyle = useAnimatedStyle(() => ({
575
+ transform: [{
576
+ scale: 0.7 + done.value * 0.3
577
+ }]
578
+ }));
579
+ return /*#__PURE__*/_jsx(Animated.View, {
580
+ ...props,
581
+ // Never takes the press: the button underneath still owns it, which is
582
+ // what lets a completed button be reset and held again.
583
+ pointerEvents: "none",
584
+ accessibilityElementsHidden: !completed,
585
+ importantForAccessibility: completed ? 'auto' : 'no-hide-descendants',
586
+ style: [{
587
+ position: 'absolute',
588
+ top: 0,
589
+ right: 0,
590
+ bottom: 0,
591
+ left: 0
592
+ }, style],
593
+ className: slots.fill({
594
+ className: slots.content({
595
+ className
596
+ })
597
+ }),
598
+ children: /*#__PURE__*/_jsx(Animated.View, {
599
+ style: markStyle,
600
+ className: slots.content(),
601
+ children: /*#__PURE__*/_jsx(IconColorProvider, {
602
+ color: typeof tint === 'string' ? tint : undefined,
603
+ children: children ?? /*#__PURE__*/_jsx(CheckIcon, {
604
+ size: 18
605
+ })
606
+ })
607
+ })
608
+ });
609
+ }
610
+ ProgressButtonDone.displayName = 'ProgressButton.Done';
611
+ ProgressButtonRoot.displayName = 'ProgressButton';
612
+ export const ProgressButton = Object.assign(ProgressButtonRoot, {
613
+ Label: ProgressButtonLabel,
614
+ Done: ProgressButtonDone
615
+ });
616
+ export { DEFAULT_AUTO_RESET_DELAY, DEFAULT_HOLD_DURATION, DEFAULT_RELEASE_DURATION, fillDuration, isComplete, releaseDuration, resolveHoldDuration } from "./progress-button-hold.js";
617
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Children","createContext","forwardRef","isValidElement","useCallback","useContext","useEffect","useMemo","useRef","useState","Pressable","View","Animated","Easing","cancelAnimation","runOnJS","runOnUI","useAnimatedReaction","useAnimatedStyle","useReducedMotion","useSharedValue","withSpring","withTiming","tv","useCSSVariable","CheckIcon","IconColorProvider","Text","textChildren","impactKnock","selectionTick","DEFAULT_AUTO_RESET_DELAY","fillDuration","releaseDuration","resolveHoldDuration","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","REDUCED_STEPS","DONE_SPRING","damping","stiffness","mass","DONE_EXIT","DONE_TINT","primary","secondary","destructive","success","progressButtonVariants","slots","root","content","label","fill","fillLabel","variants","variant","size","sm","md","lg","fullWidth","true","disabled","defaultVariants","ProgressButtonContext","useProgressButtonContext","component","context","Error","useProgressButton","progress","completed","ProgressButtonRoot","className","holdDuration","onComplete","onCompletedChange","completedProp","autoReset","autoResetDelay","haptics","accessibilityState","children","props","ref","duration","reducedMotion","done","width","setWidth","internalCompleted","setInternalCompleted","resetTimer","isControlled","undefined","completedRef","current","finish","value","full","was","begin","from","easing","steps","linear","rewind","abandon","reset","setTimeout","clearTimeout","onLayout","event","next","Math","round","nativeEvent","layout","written","toArray","hasDone","some","child","type","ProgressButtonDone","body","length","ProgressButtonLabel","Provider","accessibilityRole","accessibilityHint","checked","onPressIn","onPressOut","pressRetentionOffset","fillStyle","text","pointerEvents","style","position","top","bottom","left","overflow","displayName","tint","opacity","markStyle","transform","scale","accessibilityElementsHidden","importantForAccessibility","right","color","ProgressButton","Object","assign","Label","Done","DEFAULT_HOLD_DURATION","DEFAULT_RELEASE_DURATION","isComplete"],"sourceRoot":"../../../../src","sources":["components/progress-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;AACA,SACEA,QAAQ,EACRC,aAAa,EACbC,UAAU,EACVC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAEH,OAAO;AACd,SACEC,SAAS,EACTC,IAAI,QAIC,cAAc;AACrB,OAAOC,QAAQ,IACbC,MAAM,EACNC,eAAe,EACfC,OAAO,EACPC,OAAO,EACPC,mBAAmB,EACnBC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QAEL,yBAAyB;AAChC,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,SAAS,EAAEC,iBAAiB,QAAQ,sBAAa;AAC1D,SAASC,IAAI,EAAEC,YAAY,QAAQ,0BAAuB;AAC1D,SAASC,WAAW,EAAEC,aAAa,QAAQ,wBAAqB;AAChE,SACEC,wBAAwB,EACxBC,YAAY,EACZC,eAAe,EACfC,mBAAmB,QACd,2BAAwB;;AAE/B;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,MAAMC,aAAa,GAAG,CAAC;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAG;EAAEC,OAA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