panelui-native 0.51.1 → 0.53.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 (45) hide show
  1. package/README.md +2 -1
  2. package/lib/module/components/candlestick-chart/index.js +1161 -0
  3. package/lib/module/components/candlestick-chart/index.js.map +1 -0
  4. package/lib/module/components/combobox/index.js +73 -7
  5. package/lib/module/components/combobox/index.js.map +1 -1
  6. package/lib/module/components/context-menu/index.js +529 -0
  7. package/lib/module/components/context-menu/index.js.map +1 -0
  8. package/lib/module/components/menu/index.js +18 -10
  9. package/lib/module/components/menu/index.js.map +1 -1
  10. package/lib/module/components/popover/index.js +71 -7
  11. package/lib/module/components/popover/index.js.map +1 -1
  12. package/lib/module/components/sortable/index.js +159 -23
  13. package/lib/module/components/sortable/index.js.map +1 -1
  14. package/lib/module/components/tabs/index.js +56 -15
  15. package/lib/module/components/tabs/index.js.map +1 -1
  16. package/lib/module/components/time-picker/index.js +295 -31
  17. package/lib/module/components/time-picker/index.js.map +1 -1
  18. package/lib/module/index.js +3 -1
  19. package/lib/module/index.js.map +1 -1
  20. package/lib/typescript/src/components/candlestick-chart/index.d.ts +278 -0
  21. package/lib/typescript/src/components/candlestick-chart/index.d.ts.map +1 -0
  22. package/lib/typescript/src/components/combobox/index.d.ts.map +1 -1
  23. package/lib/typescript/src/components/context-menu/index.d.ts +270 -0
  24. package/lib/typescript/src/components/context-menu/index.d.ts.map +1 -0
  25. package/lib/typescript/src/components/menu/index.d.ts +20 -20
  26. package/lib/typescript/src/components/menu/index.d.ts.map +1 -1
  27. package/lib/typescript/src/components/popover/index.d.ts +51 -1
  28. package/lib/typescript/src/components/popover/index.d.ts.map +1 -1
  29. package/lib/typescript/src/components/sortable/index.d.ts +13 -3
  30. package/lib/typescript/src/components/sortable/index.d.ts.map +1 -1
  31. package/lib/typescript/src/components/tabs/index.d.ts +34 -2
  32. package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
  33. package/lib/typescript/src/components/time-picker/index.d.ts.map +1 -1
  34. package/lib/typescript/src/index.d.ts +3 -1
  35. package/lib/typescript/src/index.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/components/candlestick-chart/index.tsx +1360 -0
  38. package/src/components/combobox/index.tsx +84 -6
  39. package/src/components/context-menu/index.tsx +658 -0
  40. package/src/components/menu/index.tsx +17 -10
  41. package/src/components/popover/index.tsx +94 -6
  42. package/src/components/sortable/index.tsx +208 -22
  43. package/src/components/tabs/index.tsx +82 -16
  44. package/src/components/time-picker/index.tsx +330 -35
  45. package/src/index.ts +27 -0
@@ -0,0 +1,529 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * ContextMenu — the actions that belong to a piece of content, opened on it.
5
+ *
6
+ * A `Menu` hangs off a control that exists to be pressed: a ⋯ button, a toolbar
7
+ * item, something whose whole job is to open the menu. A context menu has no
8
+ * such control. The target is the content itself — a message, a note, a photo,
9
+ * a row — and the actions are reached by pressing and holding it.
10
+ *
11
+ * ```tsx
12
+ * <ContextMenu>
13
+ * <ContextMenu.Trigger>
14
+ * <Message>Would you like an interactive todo list?</Message>
15
+ * </ContextMenu.Trigger>
16
+ * <ContextMenu.Content>
17
+ * <ContextMenu.Item icon={<Share2 size={16} />}>Share</ContextMenu.Item>
18
+ * <ContextMenu.Item icon={<Copy size={16} />}>Copy</ContextMenu.Item>
19
+ * <ContextMenu.Separator />
20
+ * <ContextMenu.Item variant="destructive" icon={<Flag size={16} />}>
21
+ * Report
22
+ * </ContextMenu.Item>
23
+ * </ContextMenu.Content>
24
+ * </ContextMenu>
25
+ * ```
26
+ *
27
+ * ## It is a Menu, and deliberately so
28
+ *
29
+ * The rows here *are* `Menu`'s rows — the same components, not a second set
30
+ * styled to match. `ContextMenu.Item` and `Menu.Item` are one implementation,
31
+ * so the destructive colour, the press-in scale, the indicator column and the
32
+ * dismiss-on-select rule cannot drift apart between the two ways of reaching
33
+ * them. The panel is `Menu`'s panel, which is `Popover`'s, so `presentation`,
34
+ * submenus and edge-flipping all arrive already working.
35
+ *
36
+ * What this component owns is the two things a menu opened on content needs and
37
+ * a menu opened from a button does not: the long press, and where the panel
38
+ * goes.
39
+ *
40
+ * ## Anchored to the finger, not to the target
41
+ *
42
+ * A toolbar menu is placed against its trigger, because the trigger is small
43
+ * and its position is the only sensible answer. A context menu's target is
44
+ * often most of the screen — a whole message, a whole card — and the middle of
45
+ * it is not where the finger was. So the anchor is the press point by default,
46
+ * and the panel unfolds from it the way a popover unfolds from a button.
47
+ *
48
+ * `anchor="target"` places it against the target's bounds instead, which is the
49
+ * better answer for something small and list-shaped, where the panel lining up
50
+ * with the row reads as belonging to it.
51
+ *
52
+ * ## Why the gesture is not a Pressable
53
+ *
54
+ * The target usually has a press of its own — open the thread, play the video,
55
+ * follow the link — and the two must not both fire. React Native's `Pressable`
56
+ * decides between them after the fact, and the tap can still get through on the
57
+ * way to a long press; the recogniser here is asked for the arbitration up
58
+ * front instead, so a hold that opens the menu never also counts as a press.
59
+ *
60
+ * It is also what lets the target be anything at all. A cloned `onLongPress`
61
+ * needs a child that takes one, which rules out exactly the plain views —
62
+ * bubbles, cards, images — that content-native actions are usually attached to.
63
+ */
64
+ import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
65
+ import { View } from 'react-native';
66
+ import { Gesture, GestureDetector } from 'react-native-gesture-handler';
67
+ import Animated, { FadeOut, runOnJS, useAnimatedStyle, useReducedMotion, useSharedValue, withSpring } from 'react-native-reanimated';
68
+ import { useCSSVariable } from 'uniwind';
69
+ import { Portal } from "../../primitives/portal.js";
70
+ import { Menu } from "../menu/index.js";
71
+ import { usePopoverAnchor } from "../popover/index.js";
72
+ import { cn } from "../../utils/cn.js";
73
+ import { selectionTick } from "../../utils/haptics.js";
74
+
75
+ /**
76
+ * How long the target is held before the menu opens.
77
+ *
78
+ * Long enough not to fire while a finger is on its way to a scroll, short
79
+ * enough that nobody wonders whether the hold is working. The platforms sit
80
+ * either side of this; it is the value the rest of this library holds at.
81
+ */
82
+ import { jsx as _jsx } from "react/jsx-runtime";
83
+ const DEFAULT_DELAY = 350;
84
+
85
+ /**
86
+ * How far the finger may travel during the hold before it stops counting.
87
+ *
88
+ * Generous rather than tight, and the reason is what the target usually sits
89
+ * in: a scroller. A threshold small enough to feel precise cancels the menu for
90
+ * anyone whose thumb drifts while holding still, and the gesture it is being
91
+ * told apart from — a scroll — has moved a great deal further than this by the
92
+ * time it matters.
93
+ */
94
+ const DEFAULT_SLOP = 12;
95
+
96
+ /**
97
+ * Extra height on every row.
98
+ *
99
+ * A context menu is opened by a hold and read with the hand still over it, at
100
+ * whatever angle the phone happened to be held at. A menu dropped from a button
101
+ * is aimed at deliberately; this one is landed on. The rows are taller than
102
+ * `Menu`'s for that reason alone, and it is the only measurement that differs.
103
+ */
104
+ const ROW_CLASS = 'py-4 ps-4 pe-3.5';
105
+
106
+ /**
107
+ * Floor for the panel's width.
108
+ *
109
+ * A context menu has no trigger to take a width from, and a column of one-word
110
+ * verbs left to size itself lands somewhere around a thumb's width — too narrow
111
+ * to aim at, and too narrow to read as a panel belonging to the whole piece of
112
+ * content it was opened on.
113
+ */
114
+ const DEFAULT_MIN_WIDTH = 280;
115
+
116
+ /**
117
+ * The colour an icon falls back to before the stylesheet has been read.
118
+ *
119
+ * A general-purpose icon set defaults an unset colour to `currentColor`, which
120
+ * React Native cannot resolve and refuses to paint. A neutral mid grey is
121
+ * legible on either a light or a dark panel for the frame or two it lasts.
122
+ */
123
+ const ICON_FALLBACK = '#737373';
124
+ function useTint(variable, fallback) {
125
+ const raw = useCSSVariable(variable);
126
+ return typeof raw === 'string' ? raw : fallback;
127
+ }
128
+
129
+ /**
130
+ * Paints a row's glyph to match its label, without the caller saying so twice.
131
+ *
132
+ * The icons on these rows come from whatever set the app already uses, and a
133
+ * general-purpose one has no idea what an overlay's foreground is — left alone
134
+ * it paints `currentColor`, which React Native will not draw at all. Setting it
135
+ * here means a destructive row's icon turns red along with its label, which is
136
+ * the one place the two disagreeing would matter.
137
+ *
138
+ * An explicit colour on the element still wins: a brand mark that carries its
139
+ * own colours is not something to overrule.
140
+ */
141
+ function useGlyph(variant) {
142
+ const foreground = useTint('--color-overlay-foreground', ICON_FALLBACK);
143
+ const destructive = useTint('--color-destructive', ICON_FALLBACK);
144
+ const tint = variant === 'destructive' ? destructive : foreground;
145
+ return useCallback(icon => {
146
+ if (! /*#__PURE__*/isValidElement(icon)) return icon;
147
+ const element = icon;
148
+ if (element.props.color !== undefined) return element;
149
+ return /*#__PURE__*/cloneElement(element, {
150
+ color: tint
151
+ });
152
+ }, [tint]);
153
+ }
154
+
155
+ /** The target's frame in window coordinates, taken as the menu opens. */
156
+
157
+ const ContextMenuContext = /*#__PURE__*/createContext(null);
158
+ function useContextMenu(part) {
159
+ const context = useContext(ContextMenuContext);
160
+ if (!context) throw new Error(`${part} must be used inside <ContextMenu>.`);
161
+ return context;
162
+ }
163
+
164
+ /**
165
+ * Whether a `ContextMenu.Preview` appears anywhere in the declared tree.
166
+ *
167
+ * Sniffed from the elements rather than reported by the preview when it mounts,
168
+ * because the answer is needed *before* it does: the trigger has to know at the
169
+ * moment of the hold whether the panel will be sharing the screen with a lifted
170
+ * copy of the target, and by the time a child of the panel exists the anchor has
171
+ * already been set.
172
+ */
173
+ function declaresPreview(children) {
174
+ let found = false;
175
+ Children.forEach(children, child => {
176
+ if (found || ! /*#__PURE__*/isValidElement(child)) return;
177
+ if (child.type === ContextMenuPreview) {
178
+ found = true;
179
+ return;
180
+ }
181
+ const inner = child.props.children;
182
+ if (inner && declaresPreview(inner)) found = true;
183
+ });
184
+ return found;
185
+ }
186
+
187
+ /**
188
+ * The root takes exactly what `Menu`'s root takes — `open`, `onOpenChange`,
189
+ * `defaultOpen`, `presentation` and `haptics` — because it *is* that root.
190
+ */
191
+
192
+ /**
193
+ * The root. Provides the menu's own context and the popover underneath it.
194
+ *
195
+ * It renders a `Menu`, which is not a shortcut — it is the point. Everything a
196
+ * menu is, this is, and the parts below are the only difference.
197
+ */
198
+ function ContextMenuRoot({
199
+ children,
200
+ ...props
201
+ }) {
202
+ const [target, setTarget] = useState(null);
203
+ const [content, setContent] = useState(null);
204
+ const hasPreview = useMemo(() => declaresPreview(children), [children]);
205
+ const context = useMemo(() => ({
206
+ target,
207
+ setTarget,
208
+ content,
209
+ setContent,
210
+ hasPreview
211
+ }), [target, content, hasPreview]);
212
+ return /*#__PURE__*/_jsx(ContextMenuContext.Provider, {
213
+ value: context,
214
+ children: /*#__PURE__*/_jsx(Menu, {
215
+ ...props,
216
+ children: children
217
+ })
218
+ });
219
+ }
220
+
221
+ /** Which rectangle the panel is placed against. */
222
+
223
+ /**
224
+ * Wraps the content and opens the menu when it is held.
225
+ *
226
+ * The wrapper is a plain view and lays out like one, stretching as a view does
227
+ * rather than shrinking to its child. That is the opposite of what a tooltip's
228
+ * trigger wants, and for the opposite reason: a tooltip names a control and
229
+ * belongs over it, while the things held here — a bubble, a card, a row — are
230
+ * usually meant to fill their place in the layout, and a wrapper that collapsed
231
+ * around them would change it.
232
+ *
233
+ * It is also the rect measured under `anchor="target"`, which is why that
234
+ * anchoring lines the panel up with the row rather than with the text in it.
235
+ */
236
+ function ContextMenuTrigger({
237
+ className,
238
+ children,
239
+ anchor = 'point',
240
+ delay = DEFAULT_DELAY,
241
+ slop = DEFAULT_SLOP,
242
+ onPress,
243
+ haptics = false,
244
+ disabled = false,
245
+ ...props
246
+ }) {
247
+ const {
248
+ setOpen,
249
+ anchorTo
250
+ } = usePopoverAnchor('ContextMenu.Trigger');
251
+ const {
252
+ setTarget,
253
+ setContent,
254
+ hasPreview
255
+ } = useContextMenu('ContextMenu.Trigger');
256
+ const ref = useRef(null);
257
+
258
+ /*
259
+ * A preview overrules `anchor`, and has to.
260
+ *
261
+ * The panel is placed outside whatever rectangle it is given, so anchoring to
262
+ * the target is what keeps it clear of the lifted copy of that target. Anchor
263
+ * to the press instead and the panel opens over the very thing the preview
264
+ * exists to show.
265
+ */
266
+ const against = hasPreview ? 'target' : anchor;
267
+
268
+ /*
269
+ * Both branches end up doing the same thing — set an anchor, then open — and
270
+ * differ only in which rectangle they set. A point is a zero-sized rect,
271
+ * which the popover places a panel against exactly as it does a trigger's
272
+ * bounds; there is no separate code path for it downstream.
273
+ *
274
+ * The target is measured either way, because the preview draws at that rect
275
+ * whatever the panel is placed against.
276
+ */
277
+ const openAt = useCallback((x, y) => {
278
+ // Ticked here rather than in the gesture callback so it fires once the
279
+ // hold has been accepted, which is the moment there is something to
280
+ // confirm — and on the same side of the bridge as the opening.
281
+ if (haptics) selectionTick();
282
+
283
+ // Measured on opening rather than on layout: the target may have
284
+ // scrolled since, and a stale rect anchors the panel to where it was.
285
+ ref.current?.measureInWindow((mx, my, width, height) => {
286
+ setTarget({
287
+ x: mx,
288
+ y: my,
289
+ width,
290
+ height
291
+ });
292
+ setContent(children);
293
+
294
+ /*
295
+ * The panel is placed outside the rectangle it is given, so under a
296
+ * preview that rectangle has to be the target's *lifted* bounds rather
297
+ * than its resting ones. The lift grows the target about its middle,
298
+ * and anchoring to the smaller rect left the panel overlapping the
299
+ * last few points of it — where the lifted copy, drawn over the panel,
300
+ * simply hid the row underneath.
301
+ */
302
+ const grown = hasPreview ? (PREVIEW_SCALE - 1) / 2 : 0;
303
+ anchorTo(against === 'point' ? {
304
+ x,
305
+ y,
306
+ width: 0,
307
+ height: 0
308
+ } : {
309
+ x: mx - width * grown,
310
+ y: my - height * grown,
311
+ width: width * (1 + grown * 2),
312
+ height: height * (1 + grown * 2)
313
+ });
314
+ setOpen(true);
315
+ });
316
+ }, [against, anchorTo, setOpen, haptics, setTarget, setContent, children, hasPreview]);
317
+ const gesture = useMemo(() => {
318
+ /*
319
+ * The hold and the tap are given to the recogniser as alternatives, so it
320
+ * decides between them rather than both firing. That is the whole reason
321
+ * this is a gesture and not a `Pressable`: the target below usually has a
322
+ * press of its own, and a hold that opened the menu must not also count as
323
+ * one.
324
+ *
325
+ * `absoluteX`/`absoluteY` are window coordinates, which is the space the
326
+ * popover places panels in — so the press point needs no conversion.
327
+ */
328
+ const hold = Gesture.LongPress().minDuration(delay).maxDistance(slop).enabled(!disabled).onStart(event => {
329
+ runOnJS(openAt)(event.absoluteX, event.absoluteY);
330
+ });
331
+ const tap = Gesture.Tap().enabled(!disabled && !!onPress).onEnd((_event, success) => {
332
+ if (success && onPress) runOnJS(onPress)();
333
+ });
334
+ return Gesture.Exclusive(hold, tap);
335
+ }, [delay, slop, disabled, onPress, openAt]);
336
+ return /*#__PURE__*/_jsx(GestureDetector, {
337
+ gesture: gesture,
338
+ children: /*#__PURE__*/_jsx(View, {
339
+ ref: ref,
340
+ collapsable: false,
341
+ className: className,
342
+ ...props,
343
+ children: children
344
+ })
345
+ });
346
+ }
347
+
348
+ /** How far the lifted target grows. Enough to read as off the page. */
349
+ const PREVIEW_SCALE = 1.04;
350
+
351
+ /** Coming off the page. Soft, because the target is large and close to the eye. */
352
+ const PREVIEW_SPRING = {
353
+ damping: 20,
354
+ stiffness: 220,
355
+ mass: 0.7
356
+ };
357
+ /**
358
+ * The target, lifted off the page while its actions are up.
359
+ *
360
+ * Declared inside `ContextMenu.Content`, but not drawn there — it floats over
361
+ * the dimmed screen at the place the target was measured, and the panel is
362
+ * anchored to that same rectangle so the two never overlap. Its presence is
363
+ * what switches the anchor: a panel placed at the press point would open across
364
+ * the very content the preview exists to hold up.
365
+ *
366
+ * What it draws is the trigger's own children, rendered a second time. That
367
+ * keeps the lift honest — it is the content itself coming forward, at the size
368
+ * and in the place it already occupied — and it is why a target that should not
369
+ * simply be repeated can pass its own `children` instead.
370
+ *
371
+ * It takes no touches. The actions are in the panel; the lifted content is
372
+ * there to say what they are about, and a second live copy of a pressable card
373
+ * would be a second place to press.
374
+ */
375
+ function ContextMenuPreview({
376
+ children,
377
+ className
378
+ }) {
379
+ const {
380
+ target,
381
+ content
382
+ } = useContextMenu('ContextMenu.Preview');
383
+ const lift = useSharedValue(0);
384
+ const reduced = useReducedMotion();
385
+ useEffect(() => {
386
+ lift.value = reduced ? 1 : withSpring(1, PREVIEW_SPRING);
387
+ }, [lift, reduced]);
388
+ const style = useAnimatedStyle(() => ({
389
+ opacity: lift.value,
390
+ transform: [{
391
+ scale: 1 + lift.value * (PREVIEW_SCALE - 1)
392
+ }]
393
+ }));
394
+ if (!target) return null;
395
+ return /*#__PURE__*/_jsx(Portal, {
396
+ children: /*#__PURE__*/_jsx(Animated.View, {
397
+ pointerEvents: "none",
398
+ exiting: reduced ? undefined : FadeOut.duration(140),
399
+ style: [style, {
400
+ position: 'absolute',
401
+ left: target.x,
402
+ top: target.y,
403
+ width: target.width
404
+ }],
405
+ className: className,
406
+ children: children ?? content
407
+ })
408
+ });
409
+ }
410
+ ContextMenuPreview.displayName = 'ContextMenu.Preview';
411
+ /**
412
+ * One row: the verb at the leading edge, its glyph at the trailing one.
413
+ *
414
+ * The other way round is right for a menu dropped from a button, where the
415
+ * glyphs form a column the eye runs down to find the row it wants. A context
416
+ * menu is not read that way. It appears under the hand that opened it, already
417
+ * over the content, and what is being scanned is the *words* — so the words
418
+ * start at the edge, flush with one another, and the glyph sits at the far side
419
+ * confirming the row rather than introducing it.
420
+ *
421
+ * It is still `Menu.Item` underneath, handed the glyph as its trailing slot. So
422
+ * the press-in fill, the destructive colour and the dismiss-on-select rule are
423
+ * one implementation shared with `Menu`, and only the arrangement differs.
424
+ */
425
+ function ContextMenuItem({
426
+ className,
427
+ icon,
428
+ variant,
429
+ ...props
430
+ }) {
431
+ const glyph = useGlyph(variant);
432
+ return /*#__PURE__*/_jsx(Menu.Item, {
433
+ variant: variant,
434
+ className: cn(ROW_CLASS, className),
435
+ trailing: icon ? glyph(icon) : undefined,
436
+ ...props
437
+ });
438
+ }
439
+ ContextMenuItem.displayName = 'ContextMenu.Item';
440
+
441
+ /**
442
+ * A row carrying a state. Its tick stays at the leading edge, where `Menu` puts
443
+ * it, because a tick is not a glyph naming the row — it is the answer to it,
444
+ * and a column of them is what makes a set of choices readable as one.
445
+ */
446
+ function ContextMenuCheckboxItem({
447
+ className,
448
+ ...props
449
+ }) {
450
+ return /*#__PURE__*/_jsx(Menu.CheckboxItem, {
451
+ className: cn(ROW_CLASS, className),
452
+ ...props
453
+ });
454
+ }
455
+ ContextMenuCheckboxItem.displayName = 'ContextMenu.CheckboxItem';
456
+
457
+ /**
458
+ * Everything `Menu.Content` takes. The four listed here are the ones whose
459
+ * defaults differ, and they are listed so the difference is visible.
460
+ */
461
+
462
+ /**
463
+ * The panel, with the defaults a context menu wants rather than a popover's.
464
+ *
465
+ * It unfolds down and from the press rather than being centred on it —
466
+ * centring is right for a panel under a button, and wrong for one at a
467
+ * fingertip, where it would put half the panel back under the hand that opened
468
+ * it. Near the bottom of the screen `Popover` flips it above the press and
469
+ * clamps it into the safe area, so the one case where down does not work
470
+ * answers itself.
471
+ *
472
+ * The gap to the anchor is small, so the panel reads as coming out of the press
473
+ * rather than floating near it.
474
+ *
475
+ * The screen dims behind it, which a popover does not do. A context menu is
476
+ * modal in practice — the content underneath is what the actions are *about*,
477
+ * so nothing else on the screen is available while it is up, and the dim is
478
+ * what says so.
479
+ */
480
+ function ContextMenuContent({
481
+ placement = 'bottom',
482
+ align = 'start',
483
+ offset = 8,
484
+ minWidth = DEFAULT_MIN_WIDTH,
485
+ scrim = true,
486
+ children,
487
+ ...props
488
+ }) {
489
+ // The panel is portalled, so it mounts outside this provider's subtree.
490
+ // Re-provided here so `ContextMenu.Preview`, which is declared among these
491
+ // rows, can still reach the rectangle the trigger measured.
492
+ const context = useContextMenu('ContextMenu.Content');
493
+ return /*#__PURE__*/_jsx(Menu.Content, {
494
+ placement: placement,
495
+ align: align,
496
+ offset: offset,
497
+ minWidth: minWidth,
498
+ scrim: scrim,
499
+ ...props,
500
+ children: /*#__PURE__*/_jsx(ContextMenuContext.Provider, {
501
+ value: context,
502
+ children: children
503
+ })
504
+ });
505
+ }
506
+
507
+ /*
508
+ * Everything not listed here is Menu's, passed straight through. The three that
509
+ * are listed are wrappers rather than second implementations — they set a class
510
+ * or move a slot and hand the row back to `Menu.Item`, so the press-in fill,
511
+ * the destructive colour and the dismiss-on-select rule stay in one place and
512
+ * cannot drift between the two ways of reaching a list of verbs.
513
+ */
514
+ export const ContextMenu = Object.assign(ContextMenuRoot, {
515
+ Trigger: ContextMenuTrigger,
516
+ Content: ContextMenuContent,
517
+ Preview: ContextMenuPreview,
518
+ Background: Menu.Background,
519
+ Label: Menu.Label,
520
+ Item: ContextMenuItem,
521
+ CheckboxItem: ContextMenuCheckboxItem,
522
+ RadioGroup: Menu.RadioGroup,
523
+ RadioItem: Menu.RadioItem,
524
+ Separator: Menu.Separator,
525
+ Sub: Menu.Sub,
526
+ SubTrigger: Menu.SubTrigger,
527
+ SubContent: Menu.SubContent
528
+ });
529
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Children","cloneElement","createContext","isValidElement","useCallback","useContext","useEffect","useMemo","useRef","useState","View","Gesture","GestureDetector","Animated","FadeOut","runOnJS","useAnimatedStyle","useReducedMotion","useSharedValue","withSpring","useCSSVariable","Portal","Menu","usePopoverAnchor","cn","selectionTick","jsx","_jsx","DEFAULT_DELAY","DEFAULT_SLOP","ROW_CLASS","DEFAULT_MIN_WIDTH","ICON_FALLBACK","useTint","variable","fallback","raw","useGlyph","variant","foreground","destructive","tint","icon","element","props","color","undefined","ContextMenuContext","useContextMenu","part","context","Error","declaresPreview","children","found","forEach","child","type","ContextMenuPreview","inner","ContextMenuRoot","target","setTarget","content","setContent","hasPreview","Provider","value","ContextMenuTrigger","className","anchor","delay","slop","onPress","haptics","disabled","setOpen","anchorTo","ref","against","openAt","x","y","current","measureInWindow","mx","my","width","height","grown","PREVIEW_SCALE","gesture","hold","LongPress","minDuration","maxDistance","enabled","onStart","event","absoluteX","absoluteY","tap","Tap","onEnd","_event","success","Exclusive","collapsable","PREVIEW_SPRING","damping","stiffness","mass","lift","reduced","style","opacity","transform","scale","pointerEvents","exiting","duration","position","left","top","displayName","ContextMenuItem","glyph","Item","trailing","ContextMenuCheckboxItem","CheckboxItem","ContextMenuContent","placement","align","offset","minWidth","scrim","Content","ContextMenu","Object","assign","Trigger","Preview","Background","Label","RadioGroup","RadioItem","Separator","Sub","SubTrigger","SubContent"],"sourceRoot":"../../../../src","sources":["components/context-menu/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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,QAAQ,EACRC,YAAY,EACZC,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAGH,OAAO;AACd,SAASC,IAAI,QAAwB,cAAc;AACnD,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,OAAOC,QAAQ,IACbC,OAAO,EACPC,OAAO,EACPC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACL,yBAAyB;AAChC,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,MAAM,QAAQ,4BAAyB;AAChD,SACEC,IAAI,QAKC,kBAAS;AAChB,SAASC,gBAAgB,QAAQ,qBAAY;AAC7C,SAASC,EAAE,QAAQ,mBAAgB;AACnC,SAASC,aAAa,QAAQ,wBAAqB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,MAAMC,aAAa,GAAG,GAAG;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAY,GAAG,EAAE;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;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BqE,OAAO,EAAEN,kBAAkB;EAC3BW,OAAO,EAAEpF,kBAAkB;EAC3BqF,UAAU,EAAEzH,IAAI,CAACyH,UAAU;EAC3BC,KAAK,EAAE1H,IAAI,CAAC0H,KAAK;EACjBjB,IAAI,EAAEF,eAAe;EACrBK,YAAY,EAAED,uBAAuB;EACrCgB,UAAU,EAAE3H,IAAI,CAAC2H,UAAU;EAC3BC,SAAS,EAAE5H,IAAI,CAAC4H,SAAS;EACzBC,SAAS,EAAE7H,IAAI,CAAC6H,SAAS;EACzBC,GAAG,EAAE9H,IAAI,CAAC8H,GAAG;EACbC,UAAU,EAAE/H,IAAI,CAAC+H,UAAU;EAC3BC,UAAU,EAAEhI,IAAI,CAACgI;AACnB,CAAC,CAAC","ignoreList":[]}
@@ -294,7 +294,7 @@ function MenuContent({
294
294
  * `overflow-hidden` on the panel is what keeps whatever that is inside the
295
295
  * corner radius.
296
296
  */
297
- function MenuBackground({
297
+ export function MenuBackground({
298
298
  className,
299
299
  children,
300
300
  ...props
@@ -312,7 +312,7 @@ function MenuBackground({
312
312
  });
313
313
  }
314
314
  /** Non-interactive heading over a run of rows. */
315
- function MenuLabel({
315
+ export function MenuLabel({
316
316
  className,
317
317
  inset,
318
318
  children,
@@ -337,7 +337,7 @@ function MenuLabel({
337
337
  });
338
338
  }
339
339
  /** Hairline between two runs of rows. */
340
- function MenuSeparator({
340
+ export function MenuSeparator({
341
341
  className,
342
342
  ...props
343
343
  }) {
@@ -360,7 +360,7 @@ function MenuSeparator({
360
360
  * that a row which is disabled or which opts out via `closeOnSelect` behaves
361
361
  * the same either way.
362
362
  */
363
- function MenuItem({
363
+ export function MenuItem({
364
364
  className,
365
365
  children,
366
366
  icon,
@@ -472,7 +472,7 @@ function MenuIndicatorSpacer() {
472
472
  * deliberately so: a set of toggles is nearly always set more than one at a
473
473
  * time, and closing after each one turns three taps into six.
474
474
  */
475
- function MenuCheckboxItem({
475
+ export function MenuCheckboxItem({
476
476
  checked = false,
477
477
  onCheckedChange,
478
478
  onSelect,
@@ -505,7 +505,7 @@ function MenuCheckboxItem({
505
505
  }
506
506
  const MenuRadioContext = /*#__PURE__*/createContext(null);
507
507
  /** A run of rows of which exactly one is chosen. */
508
- function MenuRadioGroup({
508
+ export function MenuRadioGroup({
509
509
  value,
510
510
  onValueChange,
511
511
  className,
@@ -527,7 +527,7 @@ function MenuRadioGroup({
527
527
  });
528
528
  }
529
529
  /** One option inside a `Menu.RadioGroup`. */
530
- function MenuRadioItem({
530
+ export function MenuRadioItem({
531
531
  value,
532
532
  indicator = 'check',
533
533
  onSelect,
@@ -583,7 +583,7 @@ function useMenuSub(component) {
583
583
  return context;
584
584
  }
585
585
  /** Groups a `Menu.SubTrigger` with the rows it reveals. */
586
- function MenuSub({
586
+ export function MenuSub({
587
587
  children,
588
588
  defaultOpen = false,
589
589
  open,
@@ -611,7 +611,7 @@ function MenuSub({
611
611
  * point down once open, so the row states which way its rows will appear
612
612
  * rather than only that it has some.
613
613
  */
614
- function MenuSubTrigger({
614
+ export function MenuSubTrigger({
615
615
  className,
616
616
  children,
617
617
  icon,
@@ -678,7 +678,7 @@ function MenuSubTrigger({
678
678
  * would otherwise report the animated height back, and the panel would settle
679
679
  * at whatever it happened to measure on the first frame.
680
680
  */
681
- function MenuSubContent({
681
+ export function MenuSubContent({
682
682
  className,
683
683
  children,
684
684
  ...props
@@ -727,6 +727,14 @@ MenuSeparator.displayName = 'Menu.Separator';
727
727
  MenuSub.displayName = 'Menu.Sub';
728
728
  MenuSubTrigger.displayName = 'Menu.SubTrigger';
729
729
  MenuSubContent.displayName = 'Menu.SubContent';
730
+
731
+ /*
732
+ * The parts above are exported individually as well as hung off `Menu`, and the
733
+ * reason is `ContextMenu`: it presents these same components as its own rows, so
734
+ * the emitted type declarations for it have to be able to name them. `Menu` is
735
+ * still the only thing the package exports, so nothing about how these are
736
+ * reached from outside has changed.
737
+ */
730
738
  export const Menu = Object.assign(MenuRoot, {
731
739
  Trigger: MenuTrigger,
732
740
  Content: MenuContent,