panelui-native 0.7.0 → 0.12.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 (161) hide show
  1. package/README.md +5 -3
  2. package/lib/module/components/attachment/index.js +219 -0
  3. package/lib/module/components/attachment/index.js.map +1 -0
  4. package/lib/module/components/bottom-sheet/index.js +53 -3
  5. package/lib/module/components/bottom-sheet/index.js.map +1 -1
  6. package/lib/module/components/button/index.js +19 -1
  7. package/lib/module/components/button/index.js.map +1 -1
  8. package/lib/module/components/dialog/index.js +6 -2
  9. package/lib/module/components/dialog/index.js.map +1 -1
  10. package/lib/module/components/empty-state/index.js +94 -17
  11. package/lib/module/components/empty-state/index.js.map +1 -1
  12. package/lib/module/components/frame/index.js +128 -15
  13. package/lib/module/components/frame/index.js.map +1 -1
  14. package/lib/module/components/input/index.js +107 -15
  15. package/lib/module/components/input/index.js.map +1 -1
  16. package/lib/module/components/line-chart/index.js +1024 -0
  17. package/lib/module/components/line-chart/index.js.map +1 -0
  18. package/lib/module/components/marker/index.js +190 -0
  19. package/lib/module/components/marker/index.js.map +1 -0
  20. package/lib/module/components/message/index.js +24 -8
  21. package/lib/module/components/message/index.js.map +1 -1
  22. package/lib/module/components/message-scroller/index.js +451 -0
  23. package/lib/module/components/message-scroller/index.js.map +1 -0
  24. package/lib/module/components/popover/index.js +511 -0
  25. package/lib/module/components/popover/index.js.map +1 -0
  26. package/lib/module/components/progress/index.js +52 -2
  27. package/lib/module/components/progress/index.js.map +1 -1
  28. package/lib/module/components/radio-group/index.js +132 -17
  29. package/lib/module/components/radio-group/index.js.map +1 -1
  30. package/lib/module/components/section-rail/index.js +355 -0
  31. package/lib/module/components/section-rail/index.js.map +1 -0
  32. package/lib/module/components/select/index.js +245 -56
  33. package/lib/module/components/select/index.js.map +1 -1
  34. package/lib/module/components/separator/index.js +91 -0
  35. package/lib/module/components/separator/index.js.map +1 -0
  36. package/lib/module/components/slider/index.js +355 -0
  37. package/lib/module/components/slider/index.js.map +1 -0
  38. package/lib/module/components/surface/index.js +21 -2
  39. package/lib/module/components/surface/index.js.map +1 -1
  40. package/lib/module/components/switch/index.js +10 -1
  41. package/lib/module/components/switch/index.js.map +1 -1
  42. package/lib/module/components/tabs/index.js +186 -16
  43. package/lib/module/components/tabs/index.js.map +1 -1
  44. package/lib/module/components/toggle-button/index.js +297 -0
  45. package/lib/module/components/toggle-button/index.js.map +1 -0
  46. package/lib/module/hooks/index.js +1 -0
  47. package/lib/module/hooks/index.js.map +1 -1
  48. package/lib/module/hooks/use-keyboard-avoidance.js +57 -8
  49. package/lib/module/hooks/use-keyboard-avoidance.js.map +1 -1
  50. package/lib/module/hooks/use-scroll-sections.js +89 -0
  51. package/lib/module/hooks/use-scroll-sections.js.map +1 -0
  52. package/lib/module/icons/index.js +69 -0
  53. package/lib/module/icons/index.js.map +1 -1
  54. package/lib/module/index.js +11 -2
  55. package/lib/module/index.js.map +1 -1
  56. package/lib/module/native/index.js.map +1 -1
  57. package/lib/module/primitives/keyboard-avoider.js +2 -0
  58. package/lib/module/primitives/keyboard-avoider.js.map +1 -1
  59. package/lib/module/primitives/scrim.js +72 -0
  60. package/lib/module/primitives/scrim.js.map +1 -0
  61. package/lib/module/utils/haptics.js +57 -0
  62. package/lib/module/utils/haptics.js.map +1 -0
  63. package/lib/typescript/src/components/attachment/index.d.ts +93 -0
  64. package/lib/typescript/src/components/attachment/index.d.ts.map +1 -0
  65. package/lib/typescript/src/components/bottom-sheet/index.d.ts +6 -1
  66. package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
  67. package/lib/typescript/src/components/button/index.d.ts +9 -4
  68. package/lib/typescript/src/components/button/index.d.ts.map +1 -1
  69. package/lib/typescript/src/components/dialog/index.d.ts +7 -1
  70. package/lib/typescript/src/components/dialog/index.d.ts.map +1 -1
  71. package/lib/typescript/src/components/empty-state/index.d.ts +152 -2
  72. package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -1
  73. package/lib/typescript/src/components/frame/index.d.ts +47 -7
  74. package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
  75. package/lib/typescript/src/components/input/index.d.ts +113 -2
  76. package/lib/typescript/src/components/input/index.d.ts.map +1 -1
  77. package/lib/typescript/src/components/line-chart/index.d.ts +247 -0
  78. package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -0
  79. package/lib/typescript/src/components/marker/index.d.ts +137 -0
  80. package/lib/typescript/src/components/marker/index.d.ts.map +1 -0
  81. package/lib/typescript/src/components/message/index.d.ts +8 -1
  82. package/lib/typescript/src/components/message/index.d.ts.map +1 -1
  83. package/lib/typescript/src/components/message-scroller/index.d.ts +150 -0
  84. package/lib/typescript/src/components/message-scroller/index.d.ts.map +1 -0
  85. package/lib/typescript/src/components/popover/index.d.ts +136 -0
  86. package/lib/typescript/src/components/popover/index.d.ts.map +1 -0
  87. package/lib/typescript/src/components/progress/index.d.ts +33 -0
  88. package/lib/typescript/src/components/progress/index.d.ts.map +1 -1
  89. package/lib/typescript/src/components/radio-group/index.d.ts +39 -0
  90. package/lib/typescript/src/components/radio-group/index.d.ts.map +1 -1
  91. package/lib/typescript/src/components/section-rail/index.d.ts +115 -0
  92. package/lib/typescript/src/components/section-rail/index.d.ts.map +1 -0
  93. package/lib/typescript/src/components/select/index.d.ts +46 -7
  94. package/lib/typescript/src/components/select/index.d.ts.map +1 -1
  95. package/lib/typescript/src/components/separator/index.d.ts +47 -0
  96. package/lib/typescript/src/components/separator/index.d.ts.map +1 -0
  97. package/lib/typescript/src/components/slider/index.d.ts +203 -0
  98. package/lib/typescript/src/components/slider/index.d.ts.map +1 -0
  99. package/lib/typescript/src/components/surface/index.d.ts +51 -2
  100. package/lib/typescript/src/components/surface/index.d.ts.map +1 -1
  101. package/lib/typescript/src/components/switch/index.d.ts.map +1 -1
  102. package/lib/typescript/src/components/tabs/index.d.ts +46 -4
  103. package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
  104. package/lib/typescript/src/components/toggle-button/index.d.ts +244 -0
  105. package/lib/typescript/src/components/toggle-button/index.d.ts.map +1 -0
  106. package/lib/typescript/src/hooks/index.d.ts +1 -0
  107. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  108. package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts +10 -1
  109. package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts.map +1 -1
  110. package/lib/typescript/src/hooks/use-scroll-sections.d.ts +31 -0
  111. package/lib/typescript/src/hooks/use-scroll-sections.d.ts.map +1 -0
  112. package/lib/typescript/src/icons/index.d.ts +6 -0
  113. package/lib/typescript/src/icons/index.d.ts.map +1 -1
  114. package/lib/typescript/src/index.d.ts +13 -4
  115. package/lib/typescript/src/index.d.ts.map +1 -1
  116. package/lib/typescript/src/native/index.d.ts +16 -1
  117. package/lib/typescript/src/native/index.d.ts.map +1 -1
  118. package/lib/typescript/src/primitives/keyboard-avoider.d.ts +8 -1
  119. package/lib/typescript/src/primitives/keyboard-avoider.d.ts.map +1 -1
  120. package/lib/typescript/src/primitives/scrim.d.ts +21 -0
  121. package/lib/typescript/src/primitives/scrim.d.ts.map +1 -0
  122. package/lib/typescript/src/utils/haptics.d.ts +12 -0
  123. package/lib/typescript/src/utils/haptics.d.ts.map +1 -0
  124. package/package.json +9 -1
  125. package/src/components/attachment/index.tsx +279 -0
  126. package/src/components/bottom-sheet/index.tsx +58 -2
  127. package/src/components/button/index.tsx +26 -5
  128. package/src/components/dialog/index.tsx +10 -1
  129. package/src/components/empty-state/index.tsx +60 -14
  130. package/src/components/frame/index.tsx +175 -29
  131. package/src/components/input/index.tsx +122 -16
  132. package/src/components/line-chart/index.tsx +1224 -0
  133. package/src/components/marker/index.tsx +194 -0
  134. package/src/components/message/index.tsx +29 -5
  135. package/src/components/message-scroller/index.tsx +574 -0
  136. package/src/components/popover/index.tsx +624 -0
  137. package/src/components/progress/index.tsx +81 -1
  138. package/src/components/radio-group/index.tsx +156 -18
  139. package/src/components/section-rail/index.tsx +459 -0
  140. package/src/components/select/index.tsx +265 -52
  141. package/src/components/separator/index.tsx +97 -0
  142. package/src/components/slider/index.tsx +371 -0
  143. package/src/components/surface/index.tsx +29 -3
  144. package/src/components/switch/index.tsx +8 -1
  145. package/src/components/tabs/index.tsx +208 -28
  146. package/src/components/toggle-button/index.tsx +374 -0
  147. package/src/hooks/index.ts +5 -0
  148. package/src/hooks/use-keyboard-avoidance.ts +73 -7
  149. package/src/hooks/use-scroll-sections.ts +127 -0
  150. package/src/icons/index.tsx +48 -0
  151. package/src/index.ts +97 -6
  152. package/src/native/index.ts +13 -1
  153. package/src/primitives/keyboard-avoider.tsx +9 -1
  154. package/src/primitives/scrim.tsx +95 -0
  155. package/src/utils/haptics.ts +63 -0
  156. package/theme.css +64 -2
  157. package/lib/module/components/inline-select/index.js +0 -284
  158. package/lib/module/components/inline-select/index.js.map +0 -1
  159. package/lib/typescript/src/components/inline-select/index.d.ts +0 -48
  160. package/lib/typescript/src/components/inline-select/index.d.ts.map +0 -1
  161. package/src/components/inline-select/index.tsx +0 -332
@@ -0,0 +1,511 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Popover — a panel anchored to the thing that opened it.
5
+ *
6
+ * A dialog takes the screen and asks to be dealt with; a popover stays next to
7
+ * its trigger and keeps the context around it visible. That difference is the
8
+ * whole reason both exist, and it is why this one is positioned rather than
9
+ * centred.
10
+ *
11
+ * ```tsx
12
+ * <Popover>
13
+ * <Popover.Trigger>
14
+ * <Button variant="outline">Options</Button>
15
+ * </Popover.Trigger>
16
+ * <Popover.Content placement="bottom" align="end">
17
+ * <Popover.Title>Export</Popover.Title>
18
+ * <Popover.Description>Choose a format.</Popover.Description>
19
+ * </Popover.Content>
20
+ * </Popover>
21
+ * ```
22
+ *
23
+ * Placement is a preference, not a promise. The trigger is measured in window
24
+ * coordinates when it is pressed, the panel measures itself on its first
25
+ * layout, and the two are reconciled against the safe area: a panel that would
26
+ * run off the bottom flips above the trigger, and one that would run off the
27
+ * side slides back inside. So `placement="bottom"` means *below, if below
28
+ * fits* — which is the only behaviour that survives a trigger near an edge.
29
+ *
30
+ * The first frame is rendered transparent, because the panel's own size is not
31
+ * known until it has laid out once. Without that it would appear at the origin
32
+ * and jump into place.
33
+ */
34
+ import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
35
+ import { Pressable, useWindowDimensions, View } from 'react-native';
36
+ import Animated, { FadeOut, useAnimatedStyle, useReducedMotion, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
37
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
38
+ import { Portal } from "../../primitives/portal.js";
39
+ import { Scrim } from "../../primitives/scrim.js";
40
+ import { BottomSheet } from "../bottom-sheet/index.js";
41
+ import { Text } from "../../primitives/text.js";
42
+ import { cn } from "../../utils/cn.js";
43
+
44
+ /** Gap between the trigger and the panel. */
45
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
46
+ const DEFAULT_OFFSET = 8;
47
+ /** Smallest gap allowed between the panel and the edge of the safe area. */
48
+ const SCREEN_MARGIN = 12;
49
+ /** Side of the arrow square before it is rotated 45°. */
50
+ const ARROW_SIZE = 12;
51
+ const PopoverContext = /*#__PURE__*/createContext(null);
52
+ function usePopover(component) {
53
+ const context = useContext(PopoverContext);
54
+ if (!context) {
55
+ throw new Error(`${component} must be used within a <Popover>`);
56
+ }
57
+ return context;
58
+ }
59
+ function PopoverRoot({
60
+ children,
61
+ open,
62
+ onOpenChange,
63
+ defaultOpen = false,
64
+ presentation = 'popover'
65
+ }) {
66
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
67
+ const [trigger, setTrigger] = useState(null);
68
+ const [placement, setPlacement] = useState('bottom');
69
+ const [arrowOffset, setArrowOffset] = useState(0);
70
+ const isControlled = open !== undefined;
71
+ const resolvedOpen = isControlled ? open : internalOpen;
72
+ const setOpen = useCallback(next => {
73
+ if (!isControlled) setInternalOpen(next);
74
+ onOpenChange?.(next);
75
+ }, [isControlled, onOpenChange]);
76
+ const context = useMemo(() => ({
77
+ open: resolvedOpen,
78
+ setOpen,
79
+ trigger,
80
+ setTrigger,
81
+ placement,
82
+ setPlacement,
83
+ arrowOffset,
84
+ setArrowOffset,
85
+ presentation
86
+ }), [resolvedOpen, setOpen, trigger, placement, arrowOffset, presentation]);
87
+ return /*#__PURE__*/_jsx(PopoverContext.Provider, {
88
+ value: context,
89
+ children: children
90
+ });
91
+ }
92
+ /**
93
+ * Wraps its child and toggles the popover on press.
94
+ *
95
+ * The child is wrapped in a view rather than given a ref directly: the ref has
96
+ * to survive whatever the child is — a Button, a plain Pressable, an icon —
97
+ * and only a wrapper we own is guaranteed to be measurable.
98
+ */
99
+ function PopoverTrigger({
100
+ children
101
+ }) {
102
+ const {
103
+ open,
104
+ setOpen,
105
+ setTrigger
106
+ } = usePopover('Popover.Trigger');
107
+ const ref = useRef(null);
108
+ const measureThenToggle = (...args) => {
109
+ if (/*#__PURE__*/isValidElement(children)) children.props.onPress?.(...args);
110
+ if (open) {
111
+ setOpen(false);
112
+ return;
113
+ }
114
+
115
+ // Measured on every open rather than on layout: the trigger may have
116
+ // scrolled since it was laid out, and a stale rect anchors the panel to
117
+ // where the trigger used to be.
118
+ ref.current?.measureInWindow((x, y, width, height) => {
119
+ setTrigger({
120
+ x,
121
+ y,
122
+ width,
123
+ height
124
+ });
125
+ setOpen(true);
126
+ });
127
+ };
128
+ return /*#__PURE__*/_jsx(View, {
129
+ ref: ref,
130
+ collapsable: false,
131
+ children: /*#__PURE__*/isValidElement(children) ? /*#__PURE__*/cloneElement(children, {
132
+ onPress: measureThenToggle
133
+ }) : children
134
+ });
135
+ }
136
+ function PopoverContent({
137
+ className,
138
+ placement = 'bottom',
139
+ align = 'center',
140
+ offset = DEFAULT_OFFSET,
141
+ alignOffset = 0,
142
+ width = 'content-fit',
143
+ minWidth,
144
+ dismissible = true,
145
+ blur = false,
146
+ children,
147
+ onLayout: onLayoutProp,
148
+ style,
149
+ ...props
150
+ }) {
151
+ const context = usePopover('Popover.Content');
152
+ const {
153
+ open,
154
+ setOpen,
155
+ trigger,
156
+ setPlacement,
157
+ setArrowOffset,
158
+ presentation
159
+ } = context;
160
+ const {
161
+ width: screenWidth,
162
+ height: screenHeight
163
+ } = useWindowDimensions();
164
+ const insets = useSafeAreaInsets();
165
+ const [size, setSize] = useState(null);
166
+
167
+ // Panel size changes with its content, so it is re-measured rather than
168
+ // measured once — a popover whose body grows should not stay the old size.
169
+ const onLayout = event => {
170
+ const {
171
+ width: w,
172
+ height: h
173
+ } = event.nativeEvent.layout;
174
+ setSize(current => current && Math.abs(current.width - w) < 1 && Math.abs(current.height - h) < 1 ? current : {
175
+ width: w,
176
+ height: h
177
+ });
178
+ onLayoutProp?.(event);
179
+ };
180
+ const bounds = {
181
+ left: insets.left + SCREEN_MARGIN,
182
+ right: screenWidth - insets.right - SCREEN_MARGIN,
183
+ top: insets.top + SCREEN_MARGIN,
184
+ bottom: screenHeight - insets.bottom - SCREEN_MARGIN
185
+ };
186
+ const available = bounds.right - bounds.left;
187
+ const requestedWidth = width === 'content-fit' ? undefined : width === 'trigger' ? trigger?.width : width === 'full' ? available : width;
188
+
189
+ // The floor never wins past the space there actually is — a panel wider than
190
+ // the screen is worse than a cramped one.
191
+ const resolvedWidth = minWidth !== undefined && requestedWidth !== undefined ? Math.min(Math.max(requestedWidth, minWidth), available) : requestedWidth;
192
+ const position = trigger && size ? place({
193
+ trigger,
194
+ size,
195
+ placement,
196
+ align,
197
+ offset,
198
+ alignOffset,
199
+ bounds
200
+ }) : null;
201
+
202
+ // Publish the side actually used and where the trigger centre landed, so the
203
+ // arrow points at the trigger even after a flip or a clamp.
204
+ const resolvedPlacement = position?.placement;
205
+ const resolvedArrow = position?.arrowOffset;
206
+ useEffect(() => {
207
+ if (resolvedPlacement) setPlacement(resolvedPlacement);
208
+ if (resolvedArrow !== undefined) setArrowOffset(resolvedArrow);
209
+ }, [resolvedPlacement, resolvedArrow, setPlacement, setArrowOffset]);
210
+
211
+ /*
212
+ * The entrance is driven by hand rather than by an `entering` preset, and the
213
+ * reason is the measuring frame. A layout animation fires on mount — which
214
+ * here is the frame *before* the panel knows where it goes, so the whole
215
+ * animation would play at the origin, invisibly, and the panel would then
216
+ * snap into place fully formed. Holding the values until a position exists
217
+ * is the only way to have the animation and the correct position both.
218
+ */
219
+ const appear = useSharedValue(0);
220
+ const settle = useSharedValue(0);
221
+ const reducedMotion = useReducedMotion();
222
+ const placed = !!position;
223
+ useEffect(() => {
224
+ if (!placed) {
225
+ appear.value = 0;
226
+ settle.value = 0;
227
+ return;
228
+ }
229
+ if (reducedMotion) {
230
+ appear.value = 1;
231
+ settle.value = 1;
232
+ return;
233
+ }
234
+ appear.value = withTiming(1, {
235
+ duration: 120
236
+ });
237
+ settle.value = withSpring(1, {
238
+ damping: 18,
239
+ stiffness: 250,
240
+ mass: 0.6
241
+ });
242
+ }, [placed, reducedMotion, appear, settle]);
243
+
244
+ // Starts slightly small and shifted towards the trigger, so the panel
245
+ // appears to unfold from it rather than fade in over it.
246
+ const origin = ENTRY_SHIFT[resolvedPlacement ?? placement];
247
+ const panelStyle = useAnimatedStyle(() => ({
248
+ opacity: appear.value,
249
+ transform: [{
250
+ translateX: origin.x * (1 - settle.value)
251
+ }, {
252
+ translateY: origin.y * (1 - settle.value)
253
+ }, {
254
+ scale: 0.94 + 0.06 * settle.value
255
+ }]
256
+ }));
257
+
258
+ // The sheet presentation hands off entirely to BottomSheet — it owns its own
259
+ // portal, backdrop and dismiss gesture, so there is nothing to anchor here.
260
+ // The context is re-provided inside so Popover.Close keeps closing it.
261
+ if (presentation === 'bottom-sheet') {
262
+ return /*#__PURE__*/_jsx(BottomSheet, {
263
+ open: open,
264
+ onOpenChange: setOpen,
265
+ children: /*#__PURE__*/_jsx(BottomSheet.Content, {
266
+ dismissible: dismissible,
267
+ className: className,
268
+ children: /*#__PURE__*/_jsx(PopoverContext.Provider, {
269
+ value: context,
270
+ children: children
271
+ })
272
+ })
273
+ });
274
+ }
275
+ if (!open || !trigger) return null;
276
+ return /*#__PURE__*/_jsx(Portal, {
277
+ children: /*#__PURE__*/_jsx(PopoverContext.Provider, {
278
+ value: context,
279
+ children: /*#__PURE__*/_jsxs(View, {
280
+ className: "absolute inset-0",
281
+ children: [blur ? /*#__PURE__*/_jsx(Scrim, {
282
+ blur: true,
283
+ intensity: 20,
284
+ dimClassName: "bg-black/30"
285
+ }) : null, /*#__PURE__*/_jsx(Pressable, {
286
+ accessibilityLabel: "Close",
287
+ className: "absolute inset-0",
288
+ onPress: dismissible ? () => setOpen(false) : undefined
289
+ }), /*#__PURE__*/_jsx(Animated.View, {
290
+ exiting: FadeOut.duration(120),
291
+ onLayout: onLayout,
292
+ style: {
293
+ position: 'absolute',
294
+ // Until it has measured itself the panel has no honest position,
295
+ // so it is laid out off-screen rather than at the origin — an
296
+ // invisible view at 0,0 still catches taps.
297
+ top: position?.top ?? -9999,
298
+ left: position?.left ?? -9999,
299
+ maxWidth: bounds.right - bounds.left,
300
+ width: resolvedWidth
301
+ },
302
+ children: /*#__PURE__*/_jsx(Animated.View, {
303
+ accessibilityViewIsModal: true,
304
+ style: [panelStyle, style],
305
+ className: cn('gap-1.5 rounded-2xl border border-border bg-popover p-4 shadow-lg', className),
306
+ ...props,
307
+ children: children
308
+ })
309
+ })]
310
+ })
311
+ })
312
+ });
313
+ }
314
+ /**
315
+ * A small square rotated into a diamond, half-buried under the panel so only
316
+ * the point shows. It needs the panel to have a border for its own two visible
317
+ * edges to line up with — without one it reads as a floating lozenge.
318
+ *
319
+ * It points at the trigger's centre, which the panel resolves and publishes:
320
+ * when `align` shifts the panel off-centre, or a clamp slides it back on
321
+ * screen, the arrow stays over the trigger rather than over the panel's middle.
322
+ */
323
+ function PopoverArrow({
324
+ className,
325
+ style,
326
+ ...props
327
+ }) {
328
+ const {
329
+ trigger,
330
+ placement,
331
+ arrowOffset,
332
+ presentation
333
+ } = usePopover('Popover.Arrow');
334
+ // A sheet has no trigger edge to point at.
335
+ if (!trigger || presentation === 'bottom-sheet') return null;
336
+ const vertical = placement === 'top' || placement === 'bottom';
337
+ // The arrow sits on the edge facing the trigger, which is the opposite edge
338
+ // to the placement: a panel placed below has its arrow on top.
339
+ const edge = {
340
+ top: 'bottom',
341
+ bottom: 'top',
342
+ left: 'right',
343
+ right: 'left'
344
+ }[placement];
345
+ return /*#__PURE__*/_jsx(View, {
346
+ pointerEvents: "none",
347
+ accessibilityElementsHidden: true,
348
+ importantForAccessibility: "no-hide-descendants",
349
+ style: [{
350
+ position: 'absolute',
351
+ [edge]: -ARROW_SIZE / 2,
352
+ width: ARROW_SIZE,
353
+ height: ARROW_SIZE,
354
+ transform: [{
355
+ rotate: '45deg'
356
+ }],
357
+ // Centred on the trigger along the cross axis. `marginLeft/Top` backs
358
+ // it off by half its own size so `arrowOffset` lands on its centre.
359
+ ...(vertical ? {
360
+ left: arrowOffset,
361
+ marginLeft: -ARROW_SIZE / 2
362
+ } : {
363
+ top: arrowOffset,
364
+ marginTop: -ARROW_SIZE / 2
365
+ })
366
+ }, style]
367
+ // Only the two edges that face outwards are drawn; the other two sit
368
+ // under the panel and would show as a seam across it.
369
+ ,
370
+ className: cn('border-border bg-popover', placement === 'bottom' && 'border-l border-t', placement === 'top' && 'border-b border-r', placement === 'right' && 'border-b border-l', placement === 'left' && 'border-r border-t', className),
371
+ ...props
372
+ });
373
+ }
374
+ const PopoverTitle = ({
375
+ className,
376
+ ...props
377
+ }) => /*#__PURE__*/_jsx(Text, {
378
+ size: "base",
379
+ weight: "semibold",
380
+ className: cn('text-popover-foreground', className),
381
+ ...props
382
+ });
383
+ PopoverTitle.displayName = 'Popover.Title';
384
+ const PopoverDescription = ({
385
+ className,
386
+ ...props
387
+ }) => /*#__PURE__*/_jsx(Text, {
388
+ size: "sm",
389
+ muted: true,
390
+ className: className,
391
+ ...props
392
+ });
393
+ PopoverDescription.displayName = 'Popover.Description';
394
+ /** Wraps its child and closes the popover on press. */
395
+ function PopoverClose({
396
+ children
397
+ }) {
398
+ const {
399
+ setOpen
400
+ } = usePopover('Popover.Close');
401
+ if (! /*#__PURE__*/isValidElement(children)) return children;
402
+ return /*#__PURE__*/cloneElement(children, {
403
+ onPress: (...args) => {
404
+ children.props.onPress?.(...args);
405
+ setOpen(false);
406
+ }
407
+ });
408
+ }
409
+
410
+ /* -------------------------------------------------------------------------- */
411
+ /* Placement */
412
+ /* -------------------------------------------------------------------------- */
413
+
414
+ /**
415
+ * Resolves the panel's window position.
416
+ *
417
+ * Two passes, in this order, because they answer different questions: the flip
418
+ * picks a *side* and only fires when the preferred one genuinely has less room
419
+ * than its opposite; the clamp then slides the panel along the other axis to
420
+ * keep it on screen. Doing the clamp first would let a panel be nudged inside
421
+ * the bounds and so look like it fits, hiding the fact that the wrong side was
422
+ * chosen.
423
+ */
424
+ function place({
425
+ trigger,
426
+ size,
427
+ placement,
428
+ align,
429
+ offset,
430
+ alignOffset,
431
+ bounds
432
+ }) {
433
+ const roomAfter = {
434
+ bottom: bounds.bottom - (trigger.y + trigger.height + offset),
435
+ top: trigger.y - offset - bounds.top,
436
+ right: bounds.right - (trigger.x + trigger.width + offset),
437
+ left: trigger.x - offset - bounds.left
438
+ };
439
+ const opposite = {
440
+ top: 'bottom',
441
+ bottom: 'top',
442
+ left: 'right',
443
+ right: 'left'
444
+ };
445
+ const needed = placement === 'top' || placement === 'bottom' ? size.height : size.width;
446
+ const resolved = roomAfter[placement] < needed && roomAfter[opposite[placement]] > roomAfter[placement] ? opposite[placement] : placement;
447
+ const clamp = (value, min, max) =>
448
+ // `max < min` when the panel is wider than the space it has; pinning to the
449
+ // start edge at least keeps its beginning readable.
450
+ Math.max(min, Math.min(value, Math.max(min, max)));
451
+
452
+ // The arrow points at the trigger's centre, not the panel's — those differ
453
+ // whenever `align` is not center, or the panel was clamped inside the screen.
454
+ // It is expressed relative to the panel origin and clamped so it can never
455
+ // slide off the panel edge.
456
+ if (resolved === 'top' || resolved === 'bottom') {
457
+ const top = resolved === 'bottom' ? trigger.y + trigger.height + offset : trigger.y - size.height - offset;
458
+ const left = align === 'start' ? trigger.x + alignOffset : align === 'end' ? trigger.x + trigger.width - size.width + alignOffset : trigger.x + trigger.width / 2 - size.width / 2 + alignOffset;
459
+ const clampedLeft = clamp(left, bounds.left, bounds.right - size.width);
460
+ const triggerCentreX = trigger.x + trigger.width / 2;
461
+ return {
462
+ placement: resolved,
463
+ top: clamp(top, bounds.top, bounds.bottom - size.height),
464
+ left: clampedLeft,
465
+ arrowOffset: clamp(triggerCentreX - clampedLeft, ARROW_SIZE, size.width - ARROW_SIZE)
466
+ };
467
+ }
468
+ const left = resolved === 'right' ? trigger.x + trigger.width + offset : trigger.x - size.width - offset;
469
+ const top = align === 'start' ? trigger.y + alignOffset : align === 'end' ? trigger.y + trigger.height - size.height + alignOffset : trigger.y + trigger.height / 2 - size.height / 2 + alignOffset;
470
+ const clampedTop = clamp(top, bounds.top, bounds.bottom - size.height);
471
+ const triggerCentreY = trigger.y + trigger.height / 2;
472
+ return {
473
+ placement: resolved,
474
+ top: clampedTop,
475
+ left: clamp(left, bounds.left, bounds.right - size.width),
476
+ arrowOffset: clamp(triggerCentreY - clampedTop, ARROW_SIZE, size.height - ARROW_SIZE)
477
+ };
478
+ }
479
+
480
+ /**
481
+ * Where the panel starts, relative to where it ends: towards the trigger, on
482
+ * whichever side was resolved. A preset like `ZoomIn` always grows from the
483
+ * centre, which reads the same whichever way the panel opened.
484
+ */
485
+ const ENTRY_SHIFT = {
486
+ bottom: {
487
+ x: 0,
488
+ y: -8
489
+ },
490
+ top: {
491
+ x: 0,
492
+ y: 8
493
+ },
494
+ right: {
495
+ x: -8,
496
+ y: 0
497
+ },
498
+ left: {
499
+ x: 8,
500
+ y: 0
501
+ }
502
+ };
503
+ export const Popover = Object.assign(PopoverRoot, {
504
+ Trigger: PopoverTrigger,
505
+ Content: PopoverContent,
506
+ Arrow: PopoverArrow,
507
+ Title: PopoverTitle,
508
+ Description: PopoverDescription,
509
+ Close: PopoverClose
510
+ });
511
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cloneElement","createContext","isValidElement","useCallback","useContext","useEffect","useMemo","useRef","useState","Pressable","useWindowDimensions","View","Animated","FadeOut","useAnimatedStyle","useReducedMotion","useSharedValue","withSpring","withTiming","useSafeAreaInsets","Portal","Scrim","BottomSheet","Text","cn","jsx","_jsx","jsxs","_jsxs","DEFAULT_OFFSET","SCREEN_MARGIN","ARROW_SIZE","PopoverContext","usePopover","component","context","Error","PopoverRoot","children","open","onOpenChange","defaultOpen","presentation","internalOpen","setInternalOpen","trigger","setTrigger","placement","setPlacement","arrowOffset","setArrowOffset","isControlled","undefined","resolvedOpen","setOpen","next","Provider","value","PopoverTrigger","ref","measureThenToggle","args","props","onPress","current","measureInWindow","x","y","width","height","collapsable","PopoverContent","className","align","offset","alignOffset","minWidth","dismissible","blur","onLayout","onLayoutProp","style","screenWidth","screenHeight","insets","size","setSize","event","w","h","nativeEvent","layout","Math","abs","bounds","left","right","top","bottom","available","requestedWidth","resolvedWidth","min","max","position","place","resolvedPlacement","resolvedArrow","appear","settle","reducedMotion","placed","duration","damping","stiffness","mass","origin","ENTRY_SHIFT","panelStyle","opacity","transform","translateX","translateY","scale","Content","intensity","dimClassName","accessibilityLabel","exiting","maxWidth","accessibilityViewIsModal","PopoverArrow","vertical","edge","pointerEvents","accessibilityElementsHidden","importantForAccessibility","rotate","marginLeft","marginTop","PopoverTitle","weight","displayName","PopoverDescription","muted","PopoverClose","roomAfter","opposite","needed","resolved","clamp","clampedLeft","triggerCentreX","clampedTop","triggerCentreY","Popover","Object","assign","Trigger","Arrow","Title","Description","Close"],"sourceRoot":"../../../../src","sources":["components/popover/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,SACEA,YAAY,EACZC,aAA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MAAM,CAACC,MAAM,CAACxH,WAAW,EAAE;EAChDyH,OAAO,EAAEpG,cAAc;EACvBkE,OAAO,EAAErD,cAAc;EACvBwF,KAAK,EAAE5B,YAAY;EACnB6B,KAAK,EAAEpB,YAAY;EACnBqB,WAAW,EAAElB,kBAAkB;EAC/BmB,KAAK,EAAEjB;AACT,CAAC,CAAC","ignoreList":[]}
@@ -4,7 +4,9 @@ import { forwardRef, useEffect } from 'react';
4
4
  import { View } from 'react-native';
5
5
  import Animated, { Easing, cancelAnimation, interpolate, useAnimatedStyle, useSharedValue, withRepeat, withSpring, withTiming } from 'react-native-reanimated';
6
6
  import { tv } from 'tailwind-variants';
7
- import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { Text } from "../../primitives/text.js";
8
+ import { cn } from "../../utils/cn.js";
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
10
  const SPRING = {
9
11
  damping: 20,
10
12
  stiffness: 180,
@@ -14,6 +16,8 @@ const SPRING = {
14
16
  const INDETERMINATE_WIDTH = 0.4;
15
17
  const progressVariants = tv({
16
18
  slots: {
19
+ root: 'w-full gap-2',
20
+ header: 'flex-row items-center justify-between',
17
21
  track: 'w-full overflow-hidden rounded-full',
18
22
  indicator: 'h-full rounded-full'
19
23
  },
@@ -65,16 +69,37 @@ function clamp(value) {
65
69
  return value;
66
70
  }
67
71
 
72
+ /** The right-hand caption: an explicit override, an Intl fraction, or a percent. */
73
+ function formatValue(value, valueLabel, formatOptions) {
74
+ if (valueLabel != null) return valueLabel;
75
+ if (formatOptions) {
76
+ try {
77
+ return new Intl.NumberFormat(undefined, formatOptions).format(value / 100);
78
+ } catch {
79
+ // Some engines ship a partial Intl; fall through to the plain percent.
80
+ }
81
+ }
82
+ return `${Math.round(value)}%`;
83
+ }
84
+
68
85
  /**
69
86
  * Determinate or indeterminate progress bar. The fill width (determinate) and
70
87
  * the sliding bar (indeterminate) are both driven on the UI thread, so updates
71
88
  * never re-render past the value change itself.
89
+ *
90
+ * Pass `label` or `showValueLabel` to caption the bar with a header row; the
91
+ * bare track renders when neither is set, so existing call sites are untouched.
72
92
  */
73
93
  export const Progress = /*#__PURE__*/forwardRef(({
74
94
  className,
75
95
  indicatorClassName,
96
+ headerClassName,
76
97
  value = 0,
77
98
  indeterminate = false,
99
+ label,
100
+ showValueLabel = false,
101
+ valueLabel,
102
+ formatOptions,
78
103
  color,
79
104
  size,
80
105
  ...props
@@ -113,9 +138,14 @@ export const Progress = /*#__PURE__*/forwardRef(({
113
138
  }]
114
139
  };
115
140
  });
116
- return /*#__PURE__*/_jsx(View, {
141
+
142
+ // The value label is meaningless while looping, so it is dropped there.
143
+ const showValue = showValueLabel && !indeterminate;
144
+ const hasHeader = label != null || showValue;
145
+ const track = /*#__PURE__*/_jsx(View, {
117
146
  ref: ref,
118
147
  accessibilityRole: "progressbar",
148
+ accessibilityLabel: label,
119
149
  accessibilityValue: indeterminate ? undefined : {
120
150
  min: 0,
121
151
  max: 100,
@@ -133,6 +163,26 @@ export const Progress = /*#__PURE__*/forwardRef(({
133
163
  })
134
164
  })
135
165
  });
166
+ if (!hasHeader) return track;
167
+ return /*#__PURE__*/_jsxs(View, {
168
+ className: slots.root(),
169
+ children: [/*#__PURE__*/_jsxs(View, {
170
+ className: slots.header({
171
+ className: headerClassName
172
+ }),
173
+ children: [label != null ? /*#__PURE__*/_jsx(Text, {
174
+ size: "sm",
175
+ weight: "medium",
176
+ numberOfLines: 1,
177
+ children: label
178
+ }) : /*#__PURE__*/_jsx(View, {}), showValue ? /*#__PURE__*/_jsx(Text, {
179
+ size: "sm",
180
+ muted: true,
181
+ className: cn(label == null && 'ml-auto'),
182
+ children: formatValue(clamp(value), valueLabel, formatOptions)
183
+ }) : null]
184
+ }), track]
185
+ });
136
186
  });
137
187
  Progress.displayName = 'Progress';
138
188
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","useEffect","View","Animated","Easing","cancelAnimation","interpolate","useAnimatedStyle","useSharedValue","withRepeat","withSpring","withTiming","tv","jsx","_jsx","SPRING","damping","stiffness","mass","INDETERMINATE_WIDTH","progressVariants","slots","track","indicator","variants","color","primary","success","warning","destructive","info","size","sm","md","lg","defaultVariants","clamp","value","Progress","className","indicatorClassName","indeterminate","props","ref","trackWidth","progress","slide","target","duration","easing","inOut","ease","undefined","onLayout","event","nativeEvent","layout","width","determinateStyle","indeterminateStyle","barWidth","transform","translateX","accessibilityRole","accessibilityValue","min","max","now","children","style","displayName"],"sourceRoot":"../../../../src","sources":["components/progress/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7C,SAASC,IAAI,QAAgD,cAAc;AAC3E,OAAOC,QAAQ,IACbC,MAAM,EACNC,eAAe,EACfC,WAAW,EACXC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,SAASC,EAAE,QAA2B,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1D,MAAMC,MAAM,GAAG;EAAEC,OAAO,EAAE,EAAE;EAAEC,SAAS,EAAE,GAAG;EAAEC,IAAI,EAAE;AAAI,CAAU;AAClE;AACA,MAAMC,mBAAmB,GAAG,GAAG;AAE/B,MAAMC,gBAAgB,GAAGR,EAAE,CAAC;EAC1BS,KAAK,EAAE;IACLC,KAAK,EAAE,qCAAqC;IAC5CC,SAAS,EAAE;EACb,CAAC;EACDC,QAAQ,EAAE;IACRC,KAAK,EAAE;MACLC,OAAO,EAAE;QAAEJ,KAAK,EAAE,eAAe;QAAEC,SAAS,EAAE;MAAa,CAAC;MAC5DI,OAAO,EAAE;QAAEL,KAAK,EAAE,eAAe;QAAEC,SAAS,EAAE;MAAa,CAAC;MAC5DK,OAAO,EAAE;QAAEN,KAAK,EAAE,eAAe;QAAEC,SAAS,EAAE;MAAa,CAAC;MAC5DM,WAAW,EAAE;QAAEP,KAAK,EAAE,mBAAmB;QAAEC,SAAS,EA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,CACnE;IACDE,SAAS,EAAElB,KAAK,CAACC,KAAK,CAAC;MAAEiB;IAAU,CAAC,CAAE;IACtCc,QAAQ,EAAEA,QAAS;IAAA,GACfX,KAAK;IAAA0B,QAAA,eAETtD,IAAA,CAACX,QAAQ,CAACD,IAAI;MACZmE,KAAK,EAAE5B,aAAa,GAAGkB,kBAAkB,GAAGD,gBAAiB;MAC7DnB,SAAS,EAAElB,KAAK,CAACE,SAAS,CAAC;QAAEgB,SAAS,EAAEC;MAAmB,CAAC;IAAE,CAC/D;EAAC,CACE,CAAC;AAEX,CACF,CAAC;AAEDF,QAAQ,CAACgC,WAAW,GAAG,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","useEffect","View","Animated","Easing","cancelAnimation","interpolate","useAnimatedStyle","useSharedValue","withRepeat","withSpring","withTiming","tv","Text","cn","jsx","_jsx","jsxs","_jsxs","SPRING","damping","stiffness","mass","INDETERMINATE_WIDTH","progressVariants","slots","root","header","track","indicator","variants","color","primary","success","warning","destructive","info","size","sm","md","lg","defaultVariants","clamp","value","formatValue","valueLabel","formatOptions","Intl","NumberFormat","undefined","format","Math","round","Progress","className","indicatorClassName","headerClassName","indeterminate","label","showValueLabel","props","ref","trackWidth","progress","slide","target","duration","easing","inOut","ease","onLayout","event","nativeEvent","layout","width","determinateStyle","indeterminateStyle","barWidth","transform","translateX","showValue","hasHeader","accessibilityRole","accessibilityLabel","accessibilityValue","min","max","now","children","style","weight","numberOfLines","muted","displayName"],"sourceRoot":"../../../../src","sources":["components/progress/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7C,SAASC,IAAI,QAAgD,cAAc;AAC3E,OAAOC,QAAQ,IACbC,MAAM,EACNC,eAAe,EACfC,WAAW,EACXC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,IAAI,QAA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