panelui-native 0.6.0 → 0.9.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 (181) hide show
  1. package/README.md +1 -1
  2. package/lib/module/components/accordion/index.js +7 -5
  3. package/lib/module/components/accordion/index.js.map +1 -1
  4. package/lib/module/components/alert/index.js +3 -6
  5. package/lib/module/components/alert/index.js.map +1 -1
  6. package/lib/module/components/attachment/index.js +219 -0
  7. package/lib/module/components/attachment/index.js.map +1 -0
  8. package/lib/module/components/bottom-sheet/index.js +82 -4
  9. package/lib/module/components/bottom-sheet/index.js.map +1 -1
  10. package/lib/module/components/button/index.js +36 -1
  11. package/lib/module/components/button/index.js.map +1 -1
  12. package/lib/module/components/dialog/index.js +6 -2
  13. package/lib/module/components/dialog/index.js.map +1 -1
  14. package/lib/module/components/empty-state/index.js +98 -22
  15. package/lib/module/components/empty-state/index.js.map +1 -1
  16. package/lib/module/components/inline-select/index.js +171 -46
  17. package/lib/module/components/inline-select/index.js.map +1 -1
  18. package/lib/module/components/input/index.js +28 -5
  19. package/lib/module/components/input/index.js.map +1 -1
  20. package/lib/module/components/input-group/index.js +0 -1
  21. package/lib/module/components/input-group/index.js.map +1 -1
  22. package/lib/module/components/item/index.js +359 -0
  23. package/lib/module/components/item/index.js.map +1 -0
  24. package/lib/module/components/label/index.js +5 -3
  25. package/lib/module/components/label/index.js.map +1 -1
  26. package/lib/module/components/line-chart/index.js +1024 -0
  27. package/lib/module/components/line-chart/index.js.map +1 -0
  28. package/lib/module/components/marker/index.js +190 -0
  29. package/lib/module/components/marker/index.js.map +1 -0
  30. package/lib/module/components/message/index.js +334 -0
  31. package/lib/module/components/message/index.js.map +1 -0
  32. package/lib/module/components/message-scroller/index.js +451 -0
  33. package/lib/module/components/message-scroller/index.js.map +1 -0
  34. package/lib/module/components/popover/index.js +500 -0
  35. package/lib/module/components/popover/index.js.map +1 -0
  36. package/lib/module/components/radio-group/index.js +104 -16
  37. package/lib/module/components/radio-group/index.js.map +1 -1
  38. package/lib/module/components/scroll-fade/index.js +119 -71
  39. package/lib/module/components/scroll-fade/index.js.map +1 -1
  40. package/lib/module/components/select/index.js +35 -6
  41. package/lib/module/components/select/index.js.map +1 -1
  42. package/lib/module/components/separator/index.js +91 -0
  43. package/lib/module/components/separator/index.js.map +1 -0
  44. package/lib/module/components/shimmer/index.js +111 -64
  45. package/lib/module/components/shimmer/index.js.map +1 -1
  46. package/lib/module/components/surface/index.js +24 -4
  47. package/lib/module/components/surface/index.js.map +1 -1
  48. package/lib/module/components/switch/index.js +20 -1
  49. package/lib/module/components/switch/index.js.map +1 -1
  50. package/lib/module/components/toast/index.js +7 -8
  51. package/lib/module/components/toast/index.js.map +1 -1
  52. package/lib/module/components/typography/index.js +3 -3
  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-breakpoint.js +2 -2
  56. package/lib/module/hooks/use-copy-to-clipboard.js +0 -2
  57. package/lib/module/hooks/use-copy-to-clipboard.js.map +1 -1
  58. package/lib/module/hooks/use-keyboard-avoidance.js +120 -0
  59. package/lib/module/hooks/use-keyboard-avoidance.js.map +1 -0
  60. package/lib/module/icons/index.js +73 -4
  61. package/lib/module/icons/index.js.map +1 -1
  62. package/lib/module/index.js +13 -1
  63. package/lib/module/index.js.map +1 -1
  64. package/lib/module/native/index.js +53 -0
  65. package/lib/module/native/index.js.map +1 -0
  66. package/lib/module/primitives/keyboard-avoider.js +40 -0
  67. package/lib/module/primitives/keyboard-avoider.js.map +1 -0
  68. package/lib/module/primitives/scrim.js +72 -0
  69. package/lib/module/primitives/scrim.js.map +1 -0
  70. package/lib/module/providers/panel-ui-provider.js +24 -4
  71. package/lib/module/providers/panel-ui-provider.js.map +1 -1
  72. package/lib/module/theme/use-theme.js +1 -1
  73. package/lib/typescript/src/components/accordion/index.d.ts +7 -5
  74. package/lib/typescript/src/components/accordion/index.d.ts.map +1 -1
  75. package/lib/typescript/src/components/alert/index.d.ts +3 -6
  76. package/lib/typescript/src/components/alert/index.d.ts.map +1 -1
  77. package/lib/typescript/src/components/attachment/index.d.ts +93 -0
  78. package/lib/typescript/src/components/attachment/index.d.ts.map +1 -0
  79. package/lib/typescript/src/components/bottom-sheet/index.d.ts +27 -2
  80. package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
  81. package/lib/typescript/src/components/button/index.d.ts +11 -0
  82. package/lib/typescript/src/components/button/index.d.ts.map +1 -1
  83. package/lib/typescript/src/components/dialog/index.d.ts +7 -1
  84. package/lib/typescript/src/components/dialog/index.d.ts.map +1 -1
  85. package/lib/typescript/src/components/empty-state/index.d.ts +156 -7
  86. package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -1
  87. package/lib/typescript/src/components/inline-select/index.d.ts +29 -6
  88. package/lib/typescript/src/components/inline-select/index.d.ts.map +1 -1
  89. package/lib/typescript/src/components/input/index.d.ts +13 -0
  90. package/lib/typescript/src/components/input/index.d.ts.map +1 -1
  91. package/lib/typescript/src/components/input-group/index.d.ts +0 -1
  92. package/lib/typescript/src/components/input-group/index.d.ts.map +1 -1
  93. package/lib/typescript/src/components/item/index.d.ts +286 -0
  94. package/lib/typescript/src/components/item/index.d.ts.map +1 -0
  95. package/lib/typescript/src/components/label/index.d.ts +5 -3
  96. package/lib/typescript/src/components/label/index.d.ts.map +1 -1
  97. package/lib/typescript/src/components/line-chart/index.d.ts +247 -0
  98. package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -0
  99. package/lib/typescript/src/components/marker/index.d.ts +137 -0
  100. package/lib/typescript/src/components/marker/index.d.ts.map +1 -0
  101. package/lib/typescript/src/components/message/index.d.ts +177 -0
  102. package/lib/typescript/src/components/message/index.d.ts.map +1 -0
  103. package/lib/typescript/src/components/message-scroller/index.d.ts +150 -0
  104. package/lib/typescript/src/components/message-scroller/index.d.ts.map +1 -0
  105. package/lib/typescript/src/components/popover/index.d.ts +130 -0
  106. package/lib/typescript/src/components/popover/index.d.ts.map +1 -0
  107. package/lib/typescript/src/components/radio-group/index.d.ts +32 -0
  108. package/lib/typescript/src/components/radio-group/index.d.ts.map +1 -1
  109. package/lib/typescript/src/components/scroll-fade/index.d.ts +18 -9
  110. package/lib/typescript/src/components/scroll-fade/index.d.ts.map +1 -1
  111. package/lib/typescript/src/components/select/index.d.ts +16 -1
  112. package/lib/typescript/src/components/select/index.d.ts.map +1 -1
  113. package/lib/typescript/src/components/separator/index.d.ts +47 -0
  114. package/lib/typescript/src/components/separator/index.d.ts.map +1 -0
  115. package/lib/typescript/src/components/shimmer/index.d.ts +38 -20
  116. package/lib/typescript/src/components/shimmer/index.d.ts.map +1 -1
  117. package/lib/typescript/src/components/surface/index.d.ts +51 -2
  118. package/lib/typescript/src/components/surface/index.d.ts.map +1 -1
  119. package/lib/typescript/src/components/switch/index.d.ts +10 -0
  120. package/lib/typescript/src/components/switch/index.d.ts.map +1 -1
  121. package/lib/typescript/src/components/toast/index.d.ts +4 -4
  122. package/lib/typescript/src/components/toast/index.d.ts.map +1 -1
  123. package/lib/typescript/src/hooks/index.d.ts +1 -0
  124. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  125. package/lib/typescript/src/hooks/use-breakpoint.d.ts +2 -2
  126. package/lib/typescript/src/hooks/use-copy-to-clipboard.d.ts +0 -2
  127. package/lib/typescript/src/hooks/use-copy-to-clipboard.d.ts.map +1 -1
  128. package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts +20 -0
  129. package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts.map +1 -0
  130. package/lib/typescript/src/icons/index.d.ts +10 -4
  131. package/lib/typescript/src/icons/index.d.ts.map +1 -1
  132. package/lib/typescript/src/index.d.ts +11 -1
  133. package/lib/typescript/src/index.d.ts.map +1 -1
  134. package/lib/typescript/src/native/index.d.ts +35 -0
  135. package/lib/typescript/src/native/index.d.ts.map +1 -0
  136. package/lib/typescript/src/primitives/keyboard-avoider.d.ts +22 -0
  137. package/lib/typescript/src/primitives/keyboard-avoider.d.ts.map +1 -0
  138. package/lib/typescript/src/primitives/scrim.d.ts +21 -0
  139. package/lib/typescript/src/primitives/scrim.d.ts.map +1 -0
  140. package/lib/typescript/src/providers/panel-ui-provider.d.ts +1 -1
  141. package/lib/typescript/src/providers/panel-ui-provider.d.ts.map +1 -1
  142. package/lib/typescript/src/theme/use-theme.d.ts +1 -1
  143. package/package.json +16 -3
  144. package/src/components/accordion/index.tsx +7 -5
  145. package/src/components/alert/index.tsx +3 -6
  146. package/src/components/attachment/index.tsx +279 -0
  147. package/src/components/bottom-sheet/index.tsx +102 -2
  148. package/src/components/button/index.tsx +52 -0
  149. package/src/components/dialog/index.tsx +10 -1
  150. package/src/components/empty-state/index.tsx +64 -19
  151. package/src/components/inline-select/index.tsx +191 -44
  152. package/src/components/input/index.tsx +39 -3
  153. package/src/components/input-group/index.tsx +0 -1
  154. package/src/components/item/index.tsx +387 -0
  155. package/src/components/label/index.tsx +5 -3
  156. package/src/components/line-chart/index.tsx +1224 -0
  157. package/src/components/marker/index.tsx +194 -0
  158. package/src/components/message/index.tsx +336 -0
  159. package/src/components/message-scroller/index.tsx +574 -0
  160. package/src/components/popover/index.tsx +599 -0
  161. package/src/components/radio-group/index.tsx +108 -17
  162. package/src/components/scroll-fade/index.tsx +163 -51
  163. package/src/components/select/index.tsx +54 -9
  164. package/src/components/separator/index.tsx +97 -0
  165. package/src/components/shimmer/index.tsx +151 -58
  166. package/src/components/surface/index.tsx +32 -5
  167. package/src/components/switch/index.tsx +27 -1
  168. package/src/components/toast/index.tsx +7 -8
  169. package/src/components/typography/index.tsx +3 -3
  170. package/src/hooks/index.ts +5 -0
  171. package/src/hooks/use-breakpoint.ts +2 -2
  172. package/src/hooks/use-copy-to-clipboard.ts +0 -2
  173. package/src/hooks/use-keyboard-avoidance.ts +140 -0
  174. package/src/icons/index.tsx +52 -4
  175. package/src/index.ts +92 -0
  176. package/src/native/index.ts +79 -0
  177. package/src/primitives/keyboard-avoider.tsx +49 -0
  178. package/src/primitives/scrim.tsx +95 -0
  179. package/src/providers/panel-ui-provider.tsx +30 -9
  180. package/src/theme/use-theme.ts +1 -1
  181. package/theme.css +63 -3
@@ -0,0 +1,500 @@
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
+ dismissible = true,
144
+ blur = false,
145
+ children,
146
+ ...props
147
+ }) {
148
+ const context = usePopover('Popover.Content');
149
+ const {
150
+ open,
151
+ setOpen,
152
+ trigger,
153
+ setPlacement,
154
+ setArrowOffset,
155
+ presentation
156
+ } = context;
157
+ const {
158
+ width: screenWidth,
159
+ height: screenHeight
160
+ } = useWindowDimensions();
161
+ const insets = useSafeAreaInsets();
162
+ const [size, setSize] = useState(null);
163
+
164
+ // Panel size changes with its content, so it is re-measured rather than
165
+ // measured once — a popover whose body grows should not stay the old size.
166
+ const onLayout = event => {
167
+ const {
168
+ width: w,
169
+ height: h
170
+ } = event.nativeEvent.layout;
171
+ setSize(current => current && Math.abs(current.width - w) < 1 && Math.abs(current.height - h) < 1 ? current : {
172
+ width: w,
173
+ height: h
174
+ });
175
+ props.onLayout?.(event);
176
+ };
177
+ const bounds = {
178
+ left: insets.left + SCREEN_MARGIN,
179
+ right: screenWidth - insets.right - SCREEN_MARGIN,
180
+ top: insets.top + SCREEN_MARGIN,
181
+ bottom: screenHeight - insets.bottom - SCREEN_MARGIN
182
+ };
183
+ const resolvedWidth = width === 'content-fit' ? undefined : width === 'trigger' ? trigger?.width : width === 'full' ? bounds.right - bounds.left : width;
184
+ const position = trigger && size ? place({
185
+ trigger,
186
+ size,
187
+ placement,
188
+ align,
189
+ offset,
190
+ alignOffset,
191
+ bounds
192
+ }) : null;
193
+
194
+ // Publish the side actually used and where the trigger centre landed, so the
195
+ // arrow points at the trigger even after a flip or a clamp.
196
+ const resolvedPlacement = position?.placement;
197
+ const resolvedArrow = position?.arrowOffset;
198
+ useEffect(() => {
199
+ if (resolvedPlacement) setPlacement(resolvedPlacement);
200
+ if (resolvedArrow !== undefined) setArrowOffset(resolvedArrow);
201
+ }, [resolvedPlacement, resolvedArrow, setPlacement, setArrowOffset]);
202
+
203
+ /*
204
+ * The entrance is driven by hand rather than by an `entering` preset, and the
205
+ * reason is the measuring frame. A layout animation fires on mount — which
206
+ * here is the frame *before* the panel knows where it goes, so the whole
207
+ * animation would play at the origin, invisibly, and the panel would then
208
+ * snap into place fully formed. Holding the values until a position exists
209
+ * is the only way to have the animation and the correct position both.
210
+ */
211
+ const appear = useSharedValue(0);
212
+ const settle = useSharedValue(0);
213
+ const reducedMotion = useReducedMotion();
214
+ const placed = !!position;
215
+ useEffect(() => {
216
+ if (!placed) {
217
+ appear.value = 0;
218
+ settle.value = 0;
219
+ return;
220
+ }
221
+ if (reducedMotion) {
222
+ appear.value = 1;
223
+ settle.value = 1;
224
+ return;
225
+ }
226
+ appear.value = withTiming(1, {
227
+ duration: 120
228
+ });
229
+ settle.value = withSpring(1, {
230
+ damping: 18,
231
+ stiffness: 250,
232
+ mass: 0.6
233
+ });
234
+ }, [placed, reducedMotion, appear, settle]);
235
+
236
+ // Starts slightly small and shifted towards the trigger, so the panel
237
+ // appears to unfold from it rather than fade in over it.
238
+ const origin = ENTRY_SHIFT[resolvedPlacement ?? placement];
239
+ const panelStyle = useAnimatedStyle(() => ({
240
+ opacity: appear.value,
241
+ transform: [{
242
+ translateX: origin.x * (1 - settle.value)
243
+ }, {
244
+ translateY: origin.y * (1 - settle.value)
245
+ }, {
246
+ scale: 0.94 + 0.06 * settle.value
247
+ }]
248
+ }));
249
+
250
+ // The sheet presentation hands off entirely to BottomSheet — it owns its own
251
+ // portal, backdrop and dismiss gesture, so there is nothing to anchor here.
252
+ // The context is re-provided inside so Popover.Close keeps closing it.
253
+ if (presentation === 'bottom-sheet') {
254
+ return /*#__PURE__*/_jsx(BottomSheet, {
255
+ open: open,
256
+ onOpenChange: setOpen,
257
+ children: /*#__PURE__*/_jsx(BottomSheet.Content, {
258
+ dismissible: dismissible,
259
+ className: className,
260
+ children: /*#__PURE__*/_jsx(PopoverContext.Provider, {
261
+ value: context,
262
+ children: children
263
+ })
264
+ })
265
+ });
266
+ }
267
+ if (!open || !trigger) return null;
268
+ return /*#__PURE__*/_jsx(Portal, {
269
+ children: /*#__PURE__*/_jsx(PopoverContext.Provider, {
270
+ value: context,
271
+ children: /*#__PURE__*/_jsxs(View, {
272
+ className: "absolute inset-0",
273
+ children: [blur ? /*#__PURE__*/_jsx(Scrim, {
274
+ blur: true,
275
+ intensity: 20,
276
+ dimClassName: "bg-black/30"
277
+ }) : null, /*#__PURE__*/_jsx(Pressable, {
278
+ accessibilityLabel: "Close",
279
+ className: "absolute inset-0",
280
+ onPress: dismissible ? () => setOpen(false) : undefined
281
+ }), /*#__PURE__*/_jsx(Animated.View, {
282
+ exiting: FadeOut.duration(120),
283
+ onLayout: onLayout,
284
+ accessibilityViewIsModal: true,
285
+ style: [{
286
+ position: 'absolute',
287
+ // Until it has measured itself the panel has no honest
288
+ // position, so it is laid out off-screen rather than at the
289
+ // origin — an invisible view at 0,0 still catches taps.
290
+ top: position?.top ?? -9999,
291
+ left: position?.left ?? -9999,
292
+ maxWidth: bounds.right - bounds.left,
293
+ width: resolvedWidth
294
+ }, panelStyle, props.style],
295
+ className: cn('gap-1.5 rounded-2xl border border-border bg-popover p-4 shadow-lg', className),
296
+ ...props,
297
+ children: children
298
+ })]
299
+ })
300
+ })
301
+ });
302
+ }
303
+ /**
304
+ * A small square rotated into a diamond, half-buried under the panel so only
305
+ * the point shows. It needs the panel to have a border for its own two visible
306
+ * edges to line up with — without one it reads as a floating lozenge.
307
+ *
308
+ * It points at the trigger's centre, which the panel resolves and publishes:
309
+ * when `align` shifts the panel off-centre, or a clamp slides it back on
310
+ * screen, the arrow stays over the trigger rather than over the panel's middle.
311
+ */
312
+ function PopoverArrow({
313
+ className,
314
+ style,
315
+ ...props
316
+ }) {
317
+ const {
318
+ trigger,
319
+ placement,
320
+ arrowOffset,
321
+ presentation
322
+ } = usePopover('Popover.Arrow');
323
+ // A sheet has no trigger edge to point at.
324
+ if (!trigger || presentation === 'bottom-sheet') return null;
325
+ const vertical = placement === 'top' || placement === 'bottom';
326
+ // The arrow sits on the edge facing the trigger, which is the opposite edge
327
+ // to the placement: a panel placed below has its arrow on top.
328
+ const edge = {
329
+ top: 'bottom',
330
+ bottom: 'top',
331
+ left: 'right',
332
+ right: 'left'
333
+ }[placement];
334
+ return /*#__PURE__*/_jsx(View, {
335
+ pointerEvents: "none",
336
+ accessibilityElementsHidden: true,
337
+ importantForAccessibility: "no-hide-descendants",
338
+ style: [{
339
+ position: 'absolute',
340
+ [edge]: -ARROW_SIZE / 2,
341
+ width: ARROW_SIZE,
342
+ height: ARROW_SIZE,
343
+ transform: [{
344
+ rotate: '45deg'
345
+ }],
346
+ // Centred on the trigger along the cross axis. `marginLeft/Top` backs
347
+ // it off by half its own size so `arrowOffset` lands on its centre.
348
+ ...(vertical ? {
349
+ left: arrowOffset,
350
+ marginLeft: -ARROW_SIZE / 2
351
+ } : {
352
+ top: arrowOffset,
353
+ marginTop: -ARROW_SIZE / 2
354
+ })
355
+ }, style]
356
+ // Only the two edges that face outwards are drawn; the other two sit
357
+ // under the panel and would show as a seam across it.
358
+ ,
359
+ 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),
360
+ ...props
361
+ });
362
+ }
363
+ const PopoverTitle = ({
364
+ className,
365
+ ...props
366
+ }) => /*#__PURE__*/_jsx(Text, {
367
+ size: "base",
368
+ weight: "semibold",
369
+ className: cn('text-popover-foreground', className),
370
+ ...props
371
+ });
372
+ PopoverTitle.displayName = 'Popover.Title';
373
+ const PopoverDescription = ({
374
+ className,
375
+ ...props
376
+ }) => /*#__PURE__*/_jsx(Text, {
377
+ size: "sm",
378
+ muted: true,
379
+ className: className,
380
+ ...props
381
+ });
382
+ PopoverDescription.displayName = 'Popover.Description';
383
+ /** Wraps its child and closes the popover on press. */
384
+ function PopoverClose({
385
+ children
386
+ }) {
387
+ const {
388
+ setOpen
389
+ } = usePopover('Popover.Close');
390
+ if (! /*#__PURE__*/isValidElement(children)) return children;
391
+ return /*#__PURE__*/cloneElement(children, {
392
+ onPress: (...args) => {
393
+ children.props.onPress?.(...args);
394
+ setOpen(false);
395
+ }
396
+ });
397
+ }
398
+
399
+ /* -------------------------------------------------------------------------- */
400
+ /* Placement */
401
+ /* -------------------------------------------------------------------------- */
402
+
403
+ /**
404
+ * Resolves the panel's window position.
405
+ *
406
+ * Two passes, in this order, because they answer different questions: the flip
407
+ * picks a *side* and only fires when the preferred one genuinely has less room
408
+ * than its opposite; the clamp then slides the panel along the other axis to
409
+ * keep it on screen. Doing the clamp first would let a panel be nudged inside
410
+ * the bounds and so look like it fits, hiding the fact that the wrong side was
411
+ * chosen.
412
+ */
413
+ function place({
414
+ trigger,
415
+ size,
416
+ placement,
417
+ align,
418
+ offset,
419
+ alignOffset,
420
+ bounds
421
+ }) {
422
+ const roomAfter = {
423
+ bottom: bounds.bottom - (trigger.y + trigger.height + offset),
424
+ top: trigger.y - offset - bounds.top,
425
+ right: bounds.right - (trigger.x + trigger.width + offset),
426
+ left: trigger.x - offset - bounds.left
427
+ };
428
+ const opposite = {
429
+ top: 'bottom',
430
+ bottom: 'top',
431
+ left: 'right',
432
+ right: 'left'
433
+ };
434
+ const needed = placement === 'top' || placement === 'bottom' ? size.height : size.width;
435
+ const resolved = roomAfter[placement] < needed && roomAfter[opposite[placement]] > roomAfter[placement] ? opposite[placement] : placement;
436
+ const clamp = (value, min, max) =>
437
+ // `max < min` when the panel is wider than the space it has; pinning to the
438
+ // start edge at least keeps its beginning readable.
439
+ Math.max(min, Math.min(value, Math.max(min, max)));
440
+
441
+ // The arrow points at the trigger's centre, not the panel's — those differ
442
+ // whenever `align` is not center, or the panel was clamped inside the screen.
443
+ // It is expressed relative to the panel origin and clamped so it can never
444
+ // slide off the panel edge.
445
+ if (resolved === 'top' || resolved === 'bottom') {
446
+ const top = resolved === 'bottom' ? trigger.y + trigger.height + offset : trigger.y - size.height - offset;
447
+ 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;
448
+ const clampedLeft = clamp(left, bounds.left, bounds.right - size.width);
449
+ const triggerCentreX = trigger.x + trigger.width / 2;
450
+ return {
451
+ placement: resolved,
452
+ top: clamp(top, bounds.top, bounds.bottom - size.height),
453
+ left: clampedLeft,
454
+ arrowOffset: clamp(triggerCentreX - clampedLeft, ARROW_SIZE, size.width - ARROW_SIZE)
455
+ };
456
+ }
457
+ const left = resolved === 'right' ? trigger.x + trigger.width + offset : trigger.x - size.width - offset;
458
+ 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;
459
+ const clampedTop = clamp(top, bounds.top, bounds.bottom - size.height);
460
+ const triggerCentreY = trigger.y + trigger.height / 2;
461
+ return {
462
+ placement: resolved,
463
+ top: clampedTop,
464
+ left: clamp(left, bounds.left, bounds.right - size.width),
465
+ arrowOffset: clamp(triggerCentreY - clampedTop, ARROW_SIZE, size.height - ARROW_SIZE)
466
+ };
467
+ }
468
+
469
+ /**
470
+ * Where the panel starts, relative to where it ends: towards the trigger, on
471
+ * whichever side was resolved. A preset like `ZoomIn` always grows from the
472
+ * centre, which reads the same whichever way the panel opened.
473
+ */
474
+ const ENTRY_SHIFT = {
475
+ bottom: {
476
+ x: 0,
477
+ y: -8
478
+ },
479
+ top: {
480
+ x: 0,
481
+ y: 8
482
+ },
483
+ right: {
484
+ x: -8,
485
+ y: 0
486
+ },
487
+ left: {
488
+ x: 8,
489
+ y: 0
490
+ }
491
+ };
492
+ export const Popover = Object.assign(PopoverRoot, {
493
+ Trigger: PopoverTrigger,
494
+ Content: PopoverContent,
495
+ Arrow: PopoverArrow,
496
+ Title: PopoverTitle,
497
+ Description: PopoverDescription,
498
+ Close: PopoverClose
499
+ });
500
+ //# 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","dismissible","blur","screenWidth","screenHeight","insets","size","setSize","onLayout","event","w","h","nativeEvent","layout","Math","abs","bounds","left","right","top","bottom","resolvedWidth","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","accessibilityViewIsModal","style","maxWidth","PopoverArrow","vertical","edge","pointerEvents","accessibilityElementsHidden","importantForAccessibility","rotate","marginLeft","marginTop","PopoverTitle","weight","displayName","PopoverDescription","muted","PopoverClose","roomAfter","opposite","needed","resolved","clamp","min","max","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,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAGH,OAAO;AACd,SACEC,SAAS,EACTC,mBAAmB,EACnBC,IAAI,QAGC,cAAc;AACrB,OAAOC,QAAQ,IACbC,OAAO,EACPC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,MAAM,QAAQ,4BAAyB;AAChD,SAASC,KAAK,QAAQ,2BAAwB;AAC9C,SAASC,WAAW,QAAQ,0BAAiB;AAC7C,SAASC,IAAI,QAAwB,0BAAuB;AAC5D,SAASC,EAAE,QAAQ,mBAAgB;;AAEnC;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,MAAMC,cAAc,GAAG,CAAC;AACxB;AACA,MAAMC,aAAa,GAAG,EAAE;AACxB;AACA,MAAMC,UAAU,GAAG,EAAE;AA6BrB,MAAMC,cAAc,gBAAG/B,aAAa,CAA6B,IAAI,CAAC;AAEtE,SAASgC,UAAUA,CAACC,SAAiB,EAAuB;EAC1D,MAAMC,OAAO,GAAG/B,UAAU,CAAC4B,cAAc,C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