@plexui/react-native 0.4.0 → 0.5.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.
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { isValidElement, useId, useLayoutEffect, useMemo, useState } from "react";
2
+ import { Children, cloneElement, isValidElement, useId, useLayoutEffect, useMemo, useState } from "react";
3
3
  import { InSheetContext } from "./context";
4
4
  import { Animated, Easing, PanResponder, Platform, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native";
5
5
  import { Pressable } from "../../internal/Pressable";
@@ -7,9 +7,10 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
7
7
  import { childrenOfType, flattenChildren } from "../../internal/children";
8
8
  import { useKeyboardHeight } from "../../internal/keyboard";
9
9
  import { iosDim, Overlay, ANDROID_DIM } from "../../internal/Overlay";
10
+ import { BarBackdrop, SoftBottomEdge } from "../../internal/BarBackdrop";
10
11
  import { withAlpha } from "../../theme/material";
11
12
  import { useTheme } from "../../theme/ThemeProvider";
12
- import { BarItemContext } from "../Button/Button";
13
+ import { BarItemContext, Button } from "../Button/Button";
13
14
  import { NavigationButton } from "../NavigationButton/NavigationButton";
14
15
  import { IconDefaultsProvider } from "../Icon/createIcon";
15
16
  import { Text } from "../Text/Text";
@@ -221,12 +222,13 @@ export function BottomSheetBase({ open, onOpenChange, title: titleProp, hero, ch
221
222
  // Android's sheet is as wide as the screen in portrait; in landscape 80% of it and 480dp at least
222
223
  const maxWidth = android && width > screen ? Math.max(width * 0.8, Math.min(480, width)) : undefined;
223
224
  const closeSize = theme.length("--dialog-sheet-close-size", 44);
224
- const margin = theme.length("--mobile-layout-margin", 16);
225
225
  // Android: content scrolled under the bar fades out under it; the footer's height sets the room under the content
226
226
  const [scrolled, setScrolled] = useState(false);
227
227
  // The Android bar's height: 69 with a title on one line, a line more when it wraps to a second
228
228
  const [androidBarHeight, setAndroidBarHeight] = useState(ANDROID_BAR_HEIGHT);
229
229
  const [footerHeight, setFooterHeight] = useState(0);
230
+ // iOS: the bar and the footer stand over the content, which scrolls under them (iOS 26's sheets)
231
+ const [iosBarHeight, setIosBarHeight] = useState(0);
230
232
  // Android's sheet has no handle: the whole sheet takes the drag. With a title its bar is the reference's sheet bar,
231
233
  // over the content: Close in a 46dp glass circle 12 under the top edge and 12 from the side (in line with the
232
234
  // content's cards), concentric with the sheet's corner, the title 17/22 Medium centered between the circles' places
@@ -238,13 +240,25 @@ export function BottomSheetBase({ open, onOpenChange, title: titleProp, hero, ch
238
240
  const header = android ? (androidBar ? (_jsxs(View, { onStartShouldSetResponderCapture: gesture.chrome, onLayout: (event) => setAndroidBarHeight(Math.max(ANDROID_BAR_HEIGHT, event.nativeEvent.layout.height)), style: [styles.androidBar, { paddingHorizontal: androidInline }], children: [_jsx(SheetBarFade, { fill: background, shown: scrolled }), _jsx(View, { style: styles.androidCircle, children: dismissible ? (_jsx(BarItemContext.Provider, { value: barItem, children: _jsx(NavigationButton, { action: "close", accessibilityLabel: closeLabel, onPress: close }) })) : null }), _jsx(View, { style: styles.androidHeading, children: title == null ? null : _jsx(Text, { nativeID: titleId, accessibilityRole: "header", weight: "medium", align: "center", numberOfLines: 2, color: m.onSurface, style: { fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }, children: title }) }), _jsx(View, { style: styles.androidCircle })] })) : (_jsx(View, { onStartShouldSetResponderCapture: gesture.chrome, style: styles.androidGrip }))) : dismissible || title != null ? (
239
241
  // The web's phone Sheet bar: one 44 row 16 under the top edge, Close at the leading edge and the title alone centered
240
242
  // The bar is the web's Toolbar: 16 above the row and --toolbar-padding-bottom under it
241
- _jsxs(View, { ...responder.panHandlers, style: [styles.iosBar, { paddingTop: theme.length("--dialog-sheet-action-inset-block", 16), paddingBottom: theme.length("--toolbar-padding-bottom", 10), paddingHorizontal: margin }], children: [_jsx(View, { style: { width: closeSize, height: closeSize }, children: dismissible ? _jsx(NavigationButton, { action: "close", accessibilityLabel: closeLabel, onPress: close }) : null }), _jsx(View, { style: [styles.iosHeading, { minHeight: closeSize }], children: title != null ? (_jsx(Text, { nativeID: titleId, accessibilityRole: "header", weight: "semibold", align: "center", style: { fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }, children: title })) : null }), _jsx(View, { style: { width: closeSize } })] })) : null;
243
+ // It stands over the content: scrolled under it, the content goes soft (the veil of the canvas over a blur), as
244
+ // under a soft Toolbar
245
+ _jsxs(View, { ...responder.panHandlers, onLayout: (event) => setIosBarHeight(event.nativeEvent.layout.height),
246
+ // iOS 26's sheets set Close and Back 20 from the top and the sides (Health, Files, Apple Account)
247
+ style: [styles.iosBar, { paddingTop: IOS_BAR_INSET, paddingBottom: theme.length("--toolbar-padding-bottom", 10), paddingHorizontal: IOS_BAR_INSET }], children: [scrolled ? (_jsx(BarBackdrop, { fill: withAlpha(background, parseFloat(String(theme.token("--page-bar-veil-opacity") ?? "55")) / 100), blur: theme.length("--page-bar-soft-blur", 10), edge: "bottom" })) : null, _jsx(View, { style: { width: closeSize, height: closeSize }, children: dismissible ? _jsx(NavigationButton, { action: "close", accessibilityLabel: closeLabel, onPress: close }) : null }), _jsx(View, { style: [styles.iosHeading, { minHeight: closeSize }], children: title != null ? (_jsx(Text, { nativeID: titleId, accessibilityRole: "header", weight: "semibold", align: "center", style: { fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }, children: title })) : null }), _jsx(View, { style: { width: closeSize } })] })) : null;
242
248
  const footer = childrenOfType(children, BottomSheetFooter)[0];
243
249
  const content = footer ? flattenChildren(children).filter((child) => !isFooter(child)) : children;
244
250
  // The content starts where the bar's soft edge ends (--page-bar-soft-tail under the bar, Dialog.module.css), and
245
251
  // ends 16 over a footer, or over the home indicator
246
252
  const bottom = keyboard || footer ? 16 : Math.max(16, insets.bottom);
247
- const iosContent = { paddingTop: theme.length("--page-bar-soft-tail", 32), paddingHorizontal: margin, paddingBottom: bottom };
253
+ const hasIosBar = !android && (dismissible || title != null);
254
+ const iosContent = {
255
+ paddingTop: (hasIosBar ? iosBarHeight : 0) + theme.length("--page-bar-soft-tail", 32),
256
+ // iOS 26's sheets set their fields and cards 20 from the sides, in line with Close (Health's Medication Name
257
+ // and its lists); the action at the foot stands further in, concentric with the screen's corners
258
+ paddingHorizontal: IOS_BAR_INSET,
259
+ // Over a footer: 16 above its actions, which stand over the content's end
260
+ paddingBottom: footer ? Math.max(0, footerHeight - keyboard) + 16 : bottom,
261
+ };
248
262
  // The sheet's way in and out, under the drag. Android's starts and ends 10 under the screen's edge, and leaves from
249
263
  // where a drag let it go: the drag shrinks with the progress, so the sheet goes from there to its place under the edge
250
264
  const slide = (progress) => android
@@ -284,7 +298,14 @@ export function BottomSheetBase({ open, onOpenChange, title: titleProp, hero, ch
284
298
  },
285
299
  scrollEventThrottle: 16,
286
300
  }
287
- : null), contentContainerStyle: [
301
+ : {
302
+ onScroll: (event) => {
303
+ const under = event.nativeEvent.contentOffset.y > 0;
304
+ if (under !== scrolled)
305
+ setScrolled(under);
306
+ },
307
+ scrollEventThrottle: 16,
308
+ }), contentContainerStyle: [
288
309
  android
289
310
  ? [
290
311
  styles.androidContent,
@@ -297,7 +318,7 @@ export function BottomSheetBase({ open, onOpenChange, title: titleProp, hero, ch
297
318
  ]
298
319
  : iosContent,
299
320
  contentStyle,
300
- ], keyboardShouldPersistTaps: "handled", bounces: false, children: [hero ? _jsx(SheetHero, { hero: hero, id: titleId }) : null, content] }), androidBar ? header : null, footer ? (_jsxs(View, { onStartShouldSetResponderCapture: android ? gesture.chrome : undefined, onLayout: android ? (event) => setFooterHeight(event.nativeEvent.layout.height) : undefined, style: [
321
+ ], keyboardShouldPersistTaps: "handled", bounces: false, children: [hero ? _jsx(SheetHero, { hero: hero, id: titleId }) : null, content] }), androidBar ? header : null, footer ? (_jsxs(View, { onStartShouldSetResponderCapture: android ? gesture.chrome : undefined, onLayout: (event) => setFooterHeight(event.nativeEvent.layout.height), style: [
301
322
  android
302
323
  ? [
303
324
  styles.androidFooter,
@@ -305,9 +326,13 @@ export function BottomSheetBase({ open, onOpenChange, title: titleProp, hero, ch
305
326
  // Over the sheet's color at 80%, faded in over its top 24dp, down over the gesture bar
306
327
  { paddingBottom: 12 + insets.bottom + keyboard, backgroundImage: `linear-gradient(to bottom, ${withAlpha(background, 0)}, ${withAlpha(background, 0.8)} 24px)` },
307
328
  ]
308
- : [styles.iosFooter, { paddingHorizontal: margin, paddingBottom: keyboard ? 16 : Math.max(16, insets.bottom) }],
329
+ : // iOS 26: the sheet's bottom corners are the screen's, so its actions stand as BottomActions does,
330
+ // concentric with them: 36 from the sides and from the bottom (Apple Account's Add Email: 38
331
+ // and 39), 52 tall, at least 2 over the home indicator; 16 over the keyboard
332
+ // It stands over the content's end, over the keyboard while it is up
333
+ [styles.iosFooter, { paddingHorizontal: IOS_ACTION_SIDE, paddingBottom: keyboard ? 16 + keyboard : Math.max(IOS_ACTION_SIDE, insets.bottom + 2) }],
309
334
  footer.props.style,
310
- ], children: [android ? null : (_jsx(View, { pointerEvents: "none", style: [styles.iosFooterEdge, { backgroundImage: `linear-gradient(${withAlpha(background, 0)}, ${background} 27px)` }] })), footer.props.children] })) : null] }), android && Platform.OS === "android" && dismissible ? (_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: closeLabel, onPress: close, style: [styles.scrimTarget, { bottom: height }] })) : null] }) })) }));
335
+ ], children: [android ? null : _jsx(SoftBottomEdge, { fill: background, top: 12, tail: 27, blur: theme.length("--toolbar-edge-blur-small", 3) }), android ? footer.props.children : iosActions(footer.props.children)] })) : null] }), android && Platform.OS === "android" && dismissible ? (_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: closeLabel, onPress: close, style: [styles.scrimTarget, { bottom: height }] })) : null] }) })) }));
311
336
  }
312
337
  /**
313
338
  * A sheet's hero header. iOS: a 56pt symbol, 12 over a centered Title 1 bold (28/34, 4 more over a 17/22 secondary
@@ -331,6 +356,24 @@ function SheetHero({ hero, id }) {
331
356
  const size = android ? 24 : theme.length("--bottom-sheet-hero-icon-size", 56);
332
357
  return (_jsxs(View, { style: [styles.hero, { paddingBottom: 24 }], children: [hero.icon != null ? (_jsx(View, { style: { marginBottom: android ? 16 : 12 }, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: _jsx(IconDefaultsProvider, { size: size, color: ink, children: hero.icon }) })) : null, _jsx(Text, { nativeID: id, accessibilityRole: "header", align: "center", weight: android ? "regular" : "bold", color: android ? m.onSurface : undefined, style: android ? { fontSize: 24, lineHeight: 32 } : { fontSize: theme.length("--bottom-sheet-hero-title-font-size", 28), lineHeight: theme.length("--bottom-sheet-hero-title-line-height", 34) }, children: hero.title }), hero.description != null ? (_jsx(Text, { align: "center", color: android ? m.onSurfaceVariant : theme.colors.labelSecondary, style: android ? { fontSize: 14, lineHeight: 20, marginTop: 16 } : { fontSize: 17, lineHeight: 22, marginTop: 4 }, children: hero.description })) : null] }));
333
358
  }
359
+ /** iOS 26's bottom action of a sheet: 36 from the sides, as BottomActions on a screen. */
360
+ const IOS_ACTION_SIDE = 36;
361
+ /** Close and Back in an iOS 26 sheet's bar: 20 from its top and sides. */
362
+ const IOS_BAR_INSET = 20;
363
+ const IOS_ACTION_HEIGHT = 52;
364
+ /** The footer's Buttons on iOS: blocks 52 tall, capsules, as BottomActions sets them; other elements stand as given. */
365
+ function iosActions(children) {
366
+ return Children.map(children, (child) => {
367
+ if (!isValidElement(child) || child.type !== Button)
368
+ return child;
369
+ const props = child.props;
370
+ return cloneElement(child, {
371
+ block: props.block ?? true,
372
+ size: props.size ?? "3xl",
373
+ style: [{ minHeight: IOS_ACTION_HEIGHT, borderRadius: IOS_ACTION_HEIGHT / 2 }, props.style],
374
+ });
375
+ });
376
+ }
334
377
  const isFooter = (child) => isValidElement(child) && child.type === BottomSheetFooter;
335
378
  /** The item of an Android sheet's bar: a 46dp glass circle solved against the sheet's color. */
336
379
  function useMemoBarItem(canvas) {
@@ -373,7 +416,7 @@ const styles = StyleSheet.create({
373
416
  sheet: { alignSelf: "stretch", overflow: "hidden", borderCurve: "continuous", marginHorizontal: "auto", width: "100%" },
374
417
  scroll: { flexGrow: 0, flexShrink: 1 },
375
418
  grow: { flexGrow: 1 },
376
- iosBar: { flexDirection: "row", alignItems: "center", gap: 8 },
419
+ iosBar: { position: "absolute", top: 0, left: 0, right: 0, zIndex: 1, flexDirection: "row", alignItems: "center", gap: 8 },
377
420
  iosHeading: { flex: 1, alignItems: "center", justifyContent: "center" },
378
421
  scrimTarget: { position: "absolute", top: 0, left: 0, right: 0 },
379
422
  // The bar: 46dp circles 12 under the top edge and 12 from the sides, 11 under them; with no title the top 8 of the
@@ -387,8 +430,7 @@ const styles = StyleSheet.create({
387
430
  // The content 12 from the sides (as a page's groups), 16 over the navigation bar; under a bar 13 under its circles
388
431
  // (71 from the sheet's top, 2 under the bar)
389
432
  androidContent: { paddingHorizontal: 12, paddingTop: 4, paddingBottom: 16 },
390
- iosFooter: { gap: 10, paddingTop: 12 },
391
- iosFooterEdge: { position: "absolute", top: -15, left: 0, right: 0, bottom: 0 },
433
+ iosFooter: { position: "absolute", left: 0, right: 0, bottom: 0, zIndex: 1, gap: 8, paddingTop: 12 },
392
434
  // Android's sheet actions: 48dp buttons 4 apart, 12 from the sides and above, 12 over the gesture bar, over the
393
435
  // content that scrolls under them
394
436
  androidFooter: { position: "absolute", left: 0, right: 0, bottom: 0, gap: 4, paddingHorizontal: 12, paddingTop: 12 },
@@ -5,6 +5,7 @@ import { useTheme } from "../../theme/ThemeProvider";
5
5
  import { Menu, MenuSurface, hasCheckedItems, measure } from "../Menu/Menu";
6
6
  /** A touch and hold opens the menu after half a second, as the web's ContextMenu (CONTEXT_MENU_LONG_PRESS). */
7
7
  export const CONTEXT_MENU_LONG_PRESS = 500;
8
+ const CARD = { shape: "card" };
8
9
  const ContextMenuContext = createContext(null);
9
10
  function useContextMenu(part) {
10
11
  const context = useContext(ContextMenuContext);
@@ -23,8 +24,9 @@ function ContextMenuRoot({ children, open: openProp, onOpenChange }) {
23
24
  const [own, setOwn] = useState(false);
24
25
  const open = openProp ?? own;
25
26
  const [anchor, setAnchor] = useState(null);
26
- const target = useRef({ node: null, preview: null });
27
+ const target = useRef({ node: null, preview: null, look: CARD });
27
28
  const [preview, setPreview] = useState(null);
29
+ const [look, setLook] = useState(CARD);
28
30
  const apply = useCallback((next) => {
29
31
  if (openProp === undefined)
30
32
  setOwn(next);
@@ -46,6 +48,7 @@ function ContextMenuRoot({ children, open: openProp, onOpenChange }) {
46
48
  return;
47
49
  setAnchor(box);
48
50
  setPreview(target.current.preview);
51
+ setLook(target.current.look);
49
52
  });
50
53
  // A turn of the screen moves the element: the menu closes, as iOS dismisses a context menu on rotation
51
54
  const sub = Dimensions.addEventListener("change", () => applyRef.current(false));
@@ -54,18 +57,13 @@ function ContextMenuRoot({ children, open: openProp, onOpenChange }) {
54
57
  sub.remove();
55
58
  };
56
59
  }, [open]);
57
- const setTarget = useCallback((node, next) => {
58
- target.current = { node, preview: next };
60
+ const setTarget = useCallback((node, next, nextLook) => {
61
+ target.current = { node, preview: next, look: nextLook };
59
62
  }, []);
60
- return _jsx(ContextMenuContext.Provider, { value: { open, setOpen, anchor, preview, setTarget }, children: children });
63
+ return _jsx(ContextMenuContext.Provider, { value: { open, setOpen, anchor, preview, look, setTarget }, children: children });
61
64
  }
62
65
  ContextMenuRoot.displayName = "ContextMenu";
63
- /**
64
- * The element the menu is for: a ListItem, a Pressable, a Button, anything with `onLongPress`. Its own press still
65
- * runs; a touch and hold opens the menu, and so does a right click on the web. The lifted preview on iOS is the
66
- * element drawn again from its props, so state the element keeps inside itself is not in it.
67
- */
68
- function ContextMenuTrigger({ children, style }) {
66
+ function ContextMenuTrigger({ children, style, radius, shape = "card" }) {
69
67
  const theme = useTheme();
70
68
  const { setOpen, setTarget, open, anchor } = useContextMenu("ContextMenu.Trigger");
71
69
  const child = isValidElement(children) ? children : null;
@@ -91,7 +89,7 @@ function ContextMenuTrigger({ children, style }) {
91
89
  // The preview is the element drawn again over the dimming, taking no presses
92
90
  const preview = child ? cloneElement(child, { onLongPress: undefined, onPress: undefined }) : null;
93
91
  const web = Platform.OS === "web";
94
- return (_jsx(View, { ref: (next) => setTarget(next, preview), collapsable: false,
92
+ return (_jsx(View, { ref: (next) => setTarget(next, preview, { radius, shape }), collapsable: false,
95
93
  // On iOS the element hides under its lifted preview while the menu is open, so it is not drawn twice; Android
96
94
  // keeps it lit in its place
97
95
  style: [{ opacity: open && anchor && !theme.isAndroid ? 0 : 1 }, style], ...(web
@@ -107,16 +105,18 @@ ContextMenuTrigger.displayName = "ContextMenu.Trigger";
107
105
  /** The menu: Menu's items, 250 wide on iOS. */
108
106
  function ContextMenuContent(props) {
109
107
  const theme = useTheme();
110
- const { open, setOpen, anchor, preview } = useContextMenu("ContextMenu.Content");
111
- // The preview keeps a row's corners to half its height, else the kit's 30 (--context-menu-preview-radius)
108
+ const { open, setOpen, anchor, preview, look } = useContextMenu("ContextMenu.Content");
109
+ // The preview keeps a row's corners to half its height, else the kit's 30 (--context-menu-preview-radius); a
110
+ // Trigger's `radius` is the element's own corners
112
111
  // Items that say `checked` make a set of options, with the checkmark's column, as in Menu
113
112
  const check = hasCheckedItems(props.children);
114
- const radius = Math.min(theme.length("--context-menu-preview-radius", 30), (anchor?.height ?? 60) / 2);
113
+ const half = (anchor?.height ?? 60) / 2;
114
+ const radius = Math.min(look.radius ?? theme.length("--context-menu-preview-radius", 30), half);
115
115
  if (theme.isAndroid) {
116
116
  // Android: Material's popup under the element at its end, the screen dimmed around it
117
- return _jsx(MenuSurface, { ...props, check: check, open: open && anchor != null, anchor: anchor, row: anchor ? { box: anchor, radius: { top: 0, bottom: 0 } } : null, cover: false, onClose: () => setOpen(false) });
117
+ return _jsx(MenuSurface, { ...props, check: check, open: open && anchor != null, anchor: anchor, row: anchor ? { box: anchor, radius: { top: look.radius ?? 0, bottom: look.radius ?? 0 } } : null, cover: false, onClose: () => setOpen(false) });
118
118
  }
119
- return _jsx(MenuSurface, { ...props, check: check, open: open && anchor != null, anchor: anchor, context: { preview, radius }, onClose: () => setOpen(false) });
119
+ return _jsx(MenuSurface, { ...props, check: check, open: open && anchor != null, anchor: anchor, context: { preview, radius, bare: look.shape === "element" }, onClose: () => setOpen(false) });
120
120
  }
121
121
  ContextMenuContent.displayName = "ContextMenu.Content";
122
122
  export const ContextMenu = Object.assign(ContextMenuRoot, {
@@ -206,7 +206,9 @@ export function fieldLook(theme, { variant, size, pill, startAdornment = false,
206
206
  const row = IOS_FIELD[size] ?? IOS_FIELD.md;
207
207
  const height = theme.length(`--control-size-${row.height}`, 44);
208
208
  const radius = pill ? height / 2 : theme.length(`--control-radius-${row.radius}`, IOS_RADIUS[row.radius]);
209
- const gutter = startAdornment ? 11 : 14;
209
+ // A tall capsule (50 and up) sets its text 20 in, as iOS 26's own (Mail's Add Account, Apple Account's Add Email
210
+ // Address); a smaller field keeps 14
211
+ const gutter = startAdornment ? 11 : pill && height >= 48 ? 20 : 14;
210
212
  const border = variant === "outline"
211
213
  ? state.invalid
212
214
  ? theme.color("--input-border-color-invalid")
@@ -340,7 +340,8 @@ function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check =
340
340
  height: box.height,
341
341
  transform: fitScale < 1 ? [{ scale: fitScale }] : undefined,
342
342
  borderRadius: context.radius,
343
- backgroundColor: theme.colors.groupedSurface,
343
+ // An element that draws its own shape lifts as it is: no card behind it and no clip of its own
344
+ ...(context.bare ? { overflow: "visible" } : { backgroundColor: theme.colors.groupedSurface }),
344
345
  boxShadow: String(theme.token("--context-menu-preview-shadow") ?? "0 0 32px rgba(0, 0, 0, 0.2)"),
345
346
  },
346
347
  ], children: context.preview })] })) : null, _jsx(Animated.View, { ref: panel, ...(web ? { tabIndex: -1 } : null), accessibilityRole: "menu", "aria-label": ariaLabel, ...keysOf(panel), onLayout: (event) => setSize({ width: event.nativeEvent.layout.width, height: event.nativeEvent.layout.height }), style: [
@@ -3,6 +3,12 @@ import { type AccessibilityActionEvent, type StyleProp, type ViewStyle } from "r
3
3
  import { type MenuContentProps } from "../Menu/Menu";
4
4
  /** A touch and hold opens the menu after half a second, as the web's ContextMenu (CONTEXT_MENU_LONG_PRESS). */
5
5
  export declare const CONTEXT_MENU_LONG_PRESS = 500;
6
+ /**
7
+ * `card`: the element on the preview's card (a grouped surface, clipped to the kit's 30 or half the element's height).
8
+ * `element`: an element that draws its own shape, such as a chat bubble, lifts as it is, with no card and no clip,
9
+ * its shadow following its `radius` (UIKit's UITargetedPreview with a clear background and a visible path).
10
+ */
11
+ export type ContextMenuPreviewShape = "card" | "element";
6
12
  export type ContextMenuProps = {
7
13
  children: ReactNode;
8
14
  /** Holds the menu open or closed. */
@@ -34,10 +40,19 @@ type Holdable = {
34
40
  * runs; a touch and hold opens the menu, and so does a right click on the web. The lifted preview on iOS is the
35
41
  * element drawn again from its props, so state the element keeps inside itself is not in it.
36
42
  */
37
- declare function ContextMenuTrigger({ children, style }: {
43
+ export type ContextMenuTriggerProps = {
38
44
  children: ReactElement<Holdable>;
39
45
  style?: StyleProp<ViewStyle>;
40
- }): import("react").JSX.Element;
46
+ /**
47
+ * The element's own corner radius. On iOS the lifted preview keeps these corners (and with `shape="element"` its
48
+ * shadow follows them); on Android the dimming is cut around the element at them. Unset: a card at the kit's 30
49
+ * (half the element's height at most) on iOS, square on Android.
50
+ */
51
+ radius?: number;
52
+ /** `card` (default) lifts the element on the preview's card; `element` lifts an element that draws its own shape as it is. */
53
+ shape?: ContextMenuPreviewShape;
54
+ };
55
+ declare function ContextMenuTrigger({ children, style, radius, shape }: ContextMenuTriggerProps): import("react").JSX.Element;
41
56
  declare namespace ContextMenuTrigger {
42
57
  var displayName: string;
43
58
  }
@@ -97,6 +97,7 @@ type SurfaceProps = MenuContentProps & {
97
97
  context?: {
98
98
  preview: ReactNode;
99
99
  radius: number;
100
+ bare?: boolean;
100
101
  };
101
102
  };
102
103
  /** The floating panel of a menu, placed under its anchor (over it when the screen ends first). */
@@ -26,7 +26,7 @@ export { OTPInput, type OTPInputProps } from "./components/OTPInput/OTPInput";
26
26
  export { PhoneInput, type CountryCode, type PhoneDetails, type PhoneInputProps } from "./components/PhoneInput/PhoneInput";
27
27
  export { Select, type SelectOption, type SelectProps } from "./components/Select/Select";
28
28
  export { Menu, type MenuContentProps, type MenuItemProps, type MenuProps } from "./components/Menu/Menu";
29
- export { ContextMenu, type ContextMenuContentProps, type ContextMenuProps } from "./components/ContextMenu/ContextMenu";
29
+ export { ContextMenu, type ContextMenuContentProps, type ContextMenuPreviewShape, type ContextMenuProps, type ContextMenuTriggerProps } from "./components/ContextMenu/ContextMenu";
30
30
  export { ScrollEdge, type ScrollEdgeProps } from "./components/ScrollEdge/ScrollEdge";
31
31
  export { DatePicker, type DatePickerDisplay, type DatePickerMode, type DatePickerProps } from "./components/DatePicker/DatePicker";
32
32
  export { ActionSheet, type ActionSheetAction, type ActionSheetProps } from "./components/ActionSheet/ActionSheet";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/react-native",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Plex UI components for React Native and Expo: iOS 26 and Material 3, on the shared @plexui/styles tokens",
5
5
  "license": "MIT",
6
6
  "homepage": "https://plexui.com",
@@ -1,4 +1,4 @@
1
- import { isValidElement, useId, useLayoutEffect, useMemo, useState, type ReactNode } from "react"
1
+ import { Children, cloneElement, isValidElement, useId, useLayoutEffect, useMemo, useState, type ReactElement, type ReactNode } from "react"
2
2
  import { InSheetContext } from "./context"
3
3
  import { Animated, Easing, PanResponder, Platform, ScrollView, StyleSheet, View, useWindowDimensions, type LayoutChangeEvent, type NativeScrollEvent, type NativeSyntheticEvent, type StyleProp, type ViewStyle } from "react-native"
4
4
  import { Pressable } from "../../internal/Pressable"
@@ -6,9 +6,10 @@ import { useSafeAreaInsets } from "react-native-safe-area-context"
6
6
  import { childrenOfType, flattenChildren } from "../../internal/children"
7
7
  import { useKeyboardHeight } from "../../internal/keyboard"
8
8
  import { iosDim, Overlay, ANDROID_DIM } from "../../internal/Overlay"
9
+ import { BarBackdrop, SoftBottomEdge } from "../../internal/BarBackdrop"
9
10
  import { withAlpha } from "../../theme/material"
10
11
  import { useTheme } from "../../theme/ThemeProvider"
11
- import { BarItemContext, type BarItemStyle } from "../Button/Button"
12
+ import { BarItemContext, Button, type BarItemStyle, type ButtonProps } from "../Button/Button"
12
13
  import { NavigationButton } from "../NavigationButton/NavigationButton"
13
14
  import { IconDefaultsProvider } from "../Icon/createIcon"
14
15
  import { Text } from "../Text/Text"
@@ -301,12 +302,13 @@ export function BottomSheetBase({
301
302
  // Android's sheet is as wide as the screen in portrait; in landscape 80% of it and 480dp at least
302
303
  const maxWidth = android && width > screen ? Math.max(width * 0.8, Math.min(480, width)) : undefined
303
304
  const closeSize = theme.length("--dialog-sheet-close-size", 44)
304
- const margin = theme.length("--mobile-layout-margin", 16)
305
305
  // Android: content scrolled under the bar fades out under it; the footer's height sets the room under the content
306
306
  const [scrolled, setScrolled] = useState(false)
307
307
  // The Android bar's height: 69 with a title on one line, a line more when it wraps to a second
308
308
  const [androidBarHeight, setAndroidBarHeight] = useState(ANDROID_BAR_HEIGHT)
309
309
  const [footerHeight, setFooterHeight] = useState(0)
310
+ // iOS: the bar and the footer stand over the content, which scrolls under them (iOS 26's sheets)
311
+ const [iosBarHeight, setIosBarHeight] = useState(0)
310
312
  // Android's sheet has no handle: the whole sheet takes the drag. With a title its bar is the reference's sheet bar,
311
313
  // over the content: Close in a 46dp glass circle 12 under the top edge and 12 from the side (in line with the
312
314
  // content's cards), concentric with the sheet's corner, the title 17/22 Medium centered between the circles' places
@@ -339,10 +341,17 @@ export function BottomSheetBase({
339
341
  ) : dismissible || title != null ? (
340
342
  // The web's phone Sheet bar: one 44 row 16 under the top edge, Close at the leading edge and the title alone centered
341
343
  // The bar is the web's Toolbar: 16 above the row and --toolbar-padding-bottom under it
344
+ // It stands over the content: scrolled under it, the content goes soft (the veil of the canvas over a blur), as
345
+ // under a soft Toolbar
342
346
  <View
343
347
  {...responder.panHandlers}
344
- style={[styles.iosBar, { paddingTop: theme.length("--dialog-sheet-action-inset-block", 16), paddingBottom: theme.length("--toolbar-padding-bottom", 10), paddingHorizontal: margin }]}
348
+ onLayout={(event) => setIosBarHeight(event.nativeEvent.layout.height)}
349
+ // iOS 26's sheets set Close and Back 20 from the top and the sides (Health, Files, Apple Account)
350
+ style={[styles.iosBar, { paddingTop: IOS_BAR_INSET, paddingBottom: theme.length("--toolbar-padding-bottom", 10), paddingHorizontal: IOS_BAR_INSET }]}
345
351
  >
352
+ {scrolled ? (
353
+ <BarBackdrop fill={withAlpha(background, parseFloat(String(theme.token("--page-bar-veil-opacity") ?? "55")) / 100)} blur={theme.length("--page-bar-soft-blur", 10)} edge="bottom" />
354
+ ) : null}
346
355
  <View style={{ width: closeSize, height: closeSize }}>
347
356
  {dismissible ? <NavigationButton action="close" accessibilityLabel={closeLabel} onPress={close} /> : null}
348
357
  </View>
@@ -361,7 +370,15 @@ export function BottomSheetBase({
361
370
  // The content starts where the bar's soft edge ends (--page-bar-soft-tail under the bar, Dialog.module.css), and
362
371
  // ends 16 over a footer, or over the home indicator
363
372
  const bottom = keyboard || footer ? 16 : Math.max(16, insets.bottom)
364
- const iosContent = { paddingTop: theme.length("--page-bar-soft-tail", 32), paddingHorizontal: margin, paddingBottom: bottom }
373
+ const hasIosBar = !android && (dismissible || title != null)
374
+ const iosContent = {
375
+ paddingTop: (hasIosBar ? iosBarHeight : 0) + theme.length("--page-bar-soft-tail", 32),
376
+ // iOS 26's sheets set their fields and cards 20 from the sides, in line with Close (Health's Medication Name
377
+ // and its lists); the action at the foot stands further in, concentric with the screen's corners
378
+ paddingHorizontal: IOS_BAR_INSET,
379
+ // Over a footer: 16 above its actions, which stand over the content's end
380
+ paddingBottom: footer ? Math.max(0, footerHeight - keyboard) + 16 : bottom,
381
+ }
365
382
  // The sheet's way in and out, under the drag. Android's starts and ends 10 under the screen's edge, and leaves from
366
383
  // where a drag let it go: the drag shrinks with the progress, so the sheet goes from there to its place under the edge
367
384
  const slide = (progress: Animated.Value) =>
@@ -426,7 +443,13 @@ export function BottomSheetBase({
426
443
  },
427
444
  scrollEventThrottle: 16,
428
445
  }
429
- : null)}
446
+ : {
447
+ onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => {
448
+ const under = event.nativeEvent.contentOffset.y > 0
449
+ if (under !== scrolled) setScrolled(under)
450
+ },
451
+ scrollEventThrottle: 16,
452
+ })}
430
453
  contentContainerStyle={[
431
454
  android
432
455
  ? [
@@ -452,7 +475,7 @@ export function BottomSheetBase({
452
475
  {footer ? (
453
476
  <View
454
477
  onStartShouldSetResponderCapture={android ? gesture.chrome : undefined}
455
- onLayout={android ? (event) => setFooterHeight(event.nativeEvent.layout.height) : undefined}
478
+ onLayout={(event) => setFooterHeight(event.nativeEvent.layout.height)}
456
479
  style={[
457
480
  android
458
481
  ? [
@@ -461,16 +484,18 @@ export function BottomSheetBase({
461
484
  // Over the sheet's color at 80%, faded in over its top 24dp, down over the gesture bar
462
485
  { paddingBottom: 12 + insets.bottom + keyboard, backgroundImage: `linear-gradient(to bottom, ${withAlpha(background, 0)}, ${withAlpha(background, 0.8)} 24px)` } as ViewStyle,
463
486
  ]
464
- : [styles.iosFooter, { paddingHorizontal: margin, paddingBottom: keyboard ? 16 : Math.max(16, insets.bottom) }],
487
+ : // iOS 26: the sheet's bottom corners are the screen's, so its actions stand as BottomActions does,
488
+ // concentric with them: 36 from the sides and from the bottom (Apple Account's Add Email: 38
489
+ // and 39), 52 tall, at least 2 over the home indicator; 16 over the keyboard
490
+ // It stands over the content's end, over the keyboard while it is up
491
+ [styles.iosFooter, { paddingHorizontal: IOS_ACTION_SIDE, paddingBottom: keyboard ? 16 + keyboard : Math.max(IOS_ACTION_SIDE, insets.bottom + 2) }],
465
492
  footer.props.style,
466
493
  ]}
467
494
  >
468
- {/* The content fades out under the footer: the panel color from 15 above it to its actions (the
469
- soft footer of Dialog.module.css) */}
470
- {android ? null : (
471
- <View pointerEvents="none" style={[styles.iosFooterEdge, { backgroundImage: `linear-gradient(${withAlpha(background, 0)}, ${background} 27px)` }]} />
472
- )}
473
- {footer.props.children}
495
+ {/* The content goes on under the footer into iOS 27.2's soft bottom edge: the panel's color from the
496
+ actions down, faded in over 27 above them, over a light blur (BottomActions' floating edge) */}
497
+ {android ? null : <SoftBottomEdge fill={background} top={12} tail={27} blur={theme.length("--toolbar-edge-blur-small", 3)} />}
498
+ {android ? footer.props.children : iosActions(footer.props.children)}
474
499
  </View>
475
500
  ) : null}
476
501
  </Animated.View>
@@ -543,6 +568,25 @@ function SheetHero({ hero, id }: { hero: BottomSheetHero; id: string }) {
543
568
  )
544
569
  }
545
570
 
571
+ /** iOS 26's bottom action of a sheet: 36 from the sides, as BottomActions on a screen. */
572
+ const IOS_ACTION_SIDE = 36
573
+ /** Close and Back in an iOS 26 sheet's bar: 20 from its top and sides. */
574
+ const IOS_BAR_INSET = 20
575
+ const IOS_ACTION_HEIGHT = 52
576
+
577
+ /** The footer's Buttons on iOS: blocks 52 tall, capsules, as BottomActions sets them; other elements stand as given. */
578
+ function iosActions(children: ReactNode) {
579
+ return Children.map(children, (child) => {
580
+ if (!isValidElement(child) || child.type !== Button) return child
581
+ const props = child.props as ButtonProps
582
+ return cloneElement(child as ReactElement<ButtonProps>, {
583
+ block: props.block ?? true,
584
+ size: props.size ?? "3xl",
585
+ style: [{ minHeight: IOS_ACTION_HEIGHT, borderRadius: IOS_ACTION_HEIGHT / 2 }, props.style],
586
+ })
587
+ })
588
+ }
589
+
546
590
  const isFooter = (child: ReactNode) => isValidElement(child) && child.type === BottomSheetFooter
547
591
 
548
592
  /** The item of an Android sheet's bar: a 46dp glass circle solved against the sheet's color. */
@@ -591,7 +635,7 @@ const styles = StyleSheet.create({
591
635
  sheet: { alignSelf: "stretch", overflow: "hidden", borderCurve: "continuous", marginHorizontal: "auto", width: "100%" },
592
636
  scroll: { flexGrow: 0, flexShrink: 1 },
593
637
  grow: { flexGrow: 1 },
594
- iosBar: { flexDirection: "row", alignItems: "center", gap: 8 },
638
+ iosBar: { position: "absolute", top: 0, left: 0, right: 0, zIndex: 1, flexDirection: "row", alignItems: "center", gap: 8 },
595
639
  iosHeading: { flex: 1, alignItems: "center", justifyContent: "center" },
596
640
  scrimTarget: { position: "absolute", top: 0, left: 0, right: 0 },
597
641
  // The bar: 46dp circles 12 under the top edge and 12 from the sides, 11 under them; with no title the top 8 of the
@@ -605,8 +649,7 @@ const styles = StyleSheet.create({
605
649
  // The content 12 from the sides (as a page's groups), 16 over the navigation bar; under a bar 13 under its circles
606
650
  // (71 from the sheet's top, 2 under the bar)
607
651
  androidContent: { paddingHorizontal: 12, paddingTop: 4, paddingBottom: 16 },
608
- iosFooter: { gap: 10, paddingTop: 12 },
609
- iosFooterEdge: { position: "absolute", top: -15, left: 0, right: 0, bottom: 0 },
652
+ iosFooter: { position: "absolute", left: 0, right: 0, bottom: 0, zIndex: 1, gap: 8, paddingTop: 12 },
610
653
  // Android's sheet actions: 48dp buttons 4 apart, 12 from the sides and above, 12 over the gesture bar, over the
611
654
  // content that scrolls under them
612
655
  androidFooter: { position: "absolute", left: 0, right: 0, bottom: 0, gap: 4, paddingHorizontal: 12, paddingTop: 12 },
@@ -11,9 +11,22 @@ type ContextMenuState = {
11
11
  setOpen: (next: boolean) => void
12
12
  anchor: MenuAnchor | null
13
13
  preview: ReactNode
14
- setTarget: (node: Measurable | null, preview: ReactNode) => void
14
+ look: PreviewLook
15
+ setTarget: (node: Measurable | null, preview: ReactNode, look: PreviewLook) => void
15
16
  }
16
17
 
18
+ /** How the held element lifts: its own corner radius, and whether it stands on the preview's card or on its own. */
19
+ type PreviewLook = { radius?: number; shape: ContextMenuPreviewShape }
20
+
21
+ /**
22
+ * `card`: the element on the preview's card (a grouped surface, clipped to the kit's 30 or half the element's height).
23
+ * `element`: an element that draws its own shape, such as a chat bubble, lifts as it is, with no card and no clip,
24
+ * its shadow following its `radius` (UIKit's UITargetedPreview with a clear background and a visible path).
25
+ */
26
+ export type ContextMenuPreviewShape = "card" | "element"
27
+
28
+ const CARD: PreviewLook = { shape: "card" }
29
+
17
30
  const ContextMenuContext = createContext<ContextMenuState | null>(null)
18
31
 
19
32
  function useContextMenu(part: string) {
@@ -40,8 +53,9 @@ function ContextMenuRoot({ children, open: openProp, onOpenChange }: ContextMenu
40
53
  const [own, setOwn] = useState(false)
41
54
  const open = openProp ?? own
42
55
  const [anchor, setAnchor] = useState<MenuAnchor | null>(null)
43
- const target = useRef<{ node: Measurable | null; preview: ReactNode }>({ node: null, preview: null })
56
+ const target = useRef<{ node: Measurable | null; preview: ReactNode; look: PreviewLook }>({ node: null, preview: null, look: CARD })
44
57
  const [preview, setPreview] = useState<ReactNode>(null)
58
+ const [look, setLook] = useState<PreviewLook>(CARD)
45
59
  const apply = useCallback(
46
60
  (next: boolean) => {
47
61
  if (openProp === undefined) setOwn(next)
@@ -64,6 +78,7 @@ function ContextMenuRoot({ children, open: openProp, onOpenChange }: ContextMenu
64
78
  if (!live) return
65
79
  setAnchor(box)
66
80
  setPreview(target.current.preview)
81
+ setLook(target.current.look)
67
82
  })
68
83
  // A turn of the screen moves the element: the menu closes, as iOS dismisses a context menu on rotation
69
84
  const sub = Dimensions.addEventListener("change", () => applyRef.current(false))
@@ -72,10 +87,10 @@ function ContextMenuRoot({ children, open: openProp, onOpenChange }: ContextMenu
72
87
  sub.remove()
73
88
  }
74
89
  }, [open])
75
- const setTarget = useCallback((node: Measurable | null, next: ReactNode) => {
76
- target.current = { node, preview: next }
90
+ const setTarget = useCallback((node: Measurable | null, next: ReactNode, nextLook: PreviewLook) => {
91
+ target.current = { node, preview: next, look: nextLook }
77
92
  }, [])
78
- return <ContextMenuContext.Provider value={{ open, setOpen, anchor, preview, setTarget }}>{children}</ContextMenuContext.Provider>
93
+ return <ContextMenuContext.Provider value={{ open, setOpen, anchor, preview, look, setTarget }}>{children}</ContextMenuContext.Provider>
79
94
  }
80
95
  ContextMenuRoot.displayName = "ContextMenu"
81
96
 
@@ -91,7 +106,20 @@ type Holdable = {
91
106
  * runs; a touch and hold opens the menu, and so does a right click on the web. The lifted preview on iOS is the
92
107
  * element drawn again from its props, so state the element keeps inside itself is not in it.
93
108
  */
94
- function ContextMenuTrigger({ children, style }: { children: ReactElement<Holdable>; style?: StyleProp<ViewStyle> }) {
109
+ export type ContextMenuTriggerProps = {
110
+ children: ReactElement<Holdable>
111
+ style?: StyleProp<ViewStyle>
112
+ /**
113
+ * The element's own corner radius. On iOS the lifted preview keeps these corners (and with `shape="element"` its
114
+ * shadow follows them); on Android the dimming is cut around the element at them. Unset: a card at the kit's 30
115
+ * (half the element's height at most) on iOS, square on Android.
116
+ */
117
+ radius?: number
118
+ /** `card` (default) lifts the element on the preview's card; `element` lifts an element that draws its own shape as it is. */
119
+ shape?: ContextMenuPreviewShape
120
+ }
121
+
122
+ function ContextMenuTrigger({ children, style, radius, shape = "card" }: ContextMenuTriggerProps) {
95
123
  const theme = useTheme()
96
124
  const { setOpen, setTarget, open, anchor } = useContextMenu("ContextMenu.Trigger")
97
125
  const child = isValidElement<Holdable>(children) ? children : null
@@ -117,7 +145,7 @@ function ContextMenuTrigger({ children, style }: { children: ReactElement<Holdab
117
145
  const web = Platform.OS === "web"
118
146
  return (
119
147
  <View
120
- ref={(next: unknown) => setTarget(next as Measurable | null, preview)}
148
+ ref={(next: unknown) => setTarget(next as Measurable | null, preview, { radius, shape })}
121
149
  collapsable={false}
122
150
  // On iOS the element hides under its lifted preview while the menu is open, so it is not drawn twice; Android
123
151
  // keeps it lit in its place
@@ -142,16 +170,18 @@ export type ContextMenuContentProps = Omit<MenuContentProps, "align">
142
170
  /** The menu: Menu's items, 250 wide on iOS. */
143
171
  function ContextMenuContent(props: ContextMenuContentProps) {
144
172
  const theme = useTheme()
145
- const { open, setOpen, anchor, preview } = useContextMenu("ContextMenu.Content")
146
- // The preview keeps a row's corners to half its height, else the kit's 30 (--context-menu-preview-radius)
173
+ const { open, setOpen, anchor, preview, look } = useContextMenu("ContextMenu.Content")
174
+ // The preview keeps a row's corners to half its height, else the kit's 30 (--context-menu-preview-radius); a
175
+ // Trigger's `radius` is the element's own corners
147
176
  // Items that say `checked` make a set of options, with the checkmark's column, as in Menu
148
177
  const check = hasCheckedItems(props.children)
149
- const radius = Math.min(theme.length("--context-menu-preview-radius", 30), (anchor?.height ?? 60) / 2)
178
+ const half = (anchor?.height ?? 60) / 2
179
+ const radius = Math.min(look.radius ?? theme.length("--context-menu-preview-radius", 30), half)
150
180
  if (theme.isAndroid) {
151
181
  // Android: Material's popup under the element at its end, the screen dimmed around it
152
- return <MenuSurface {...props} check={check} open={open && anchor != null} anchor={anchor} row={anchor ? { box: anchor, radius: { top: 0, bottom: 0 } } : null} cover={false} onClose={() => setOpen(false)} />
182
+ return <MenuSurface {...props} check={check} open={open && anchor != null} anchor={anchor} row={anchor ? { box: anchor, radius: { top: look.radius ?? 0, bottom: look.radius ?? 0 } } : null} cover={false} onClose={() => setOpen(false)} />
153
183
  }
154
- return <MenuSurface {...props} check={check} open={open && anchor != null} anchor={anchor} context={{ preview, radius }} onClose={() => setOpen(false)} />
184
+ return <MenuSurface {...props} check={check} open={open && anchor != null} anchor={anchor} context={{ preview, radius, bare: look.shape === "element" }} onClose={() => setOpen(false)} />
155
185
  }
156
186
  ContextMenuContent.displayName = "ContextMenu.Content"
157
187
 
@@ -267,7 +267,9 @@ export function fieldLook(
267
267
  const row = IOS_FIELD[size] ?? IOS_FIELD.md
268
268
  const height = theme.length(`--control-size-${row.height}`, 44)
269
269
  const radius = pill ? height / 2 : theme.length(`--control-radius-${row.radius}`, IOS_RADIUS[row.radius])
270
- const gutter = startAdornment ? 11 : 14
270
+ // A tall capsule (50 and up) sets its text 20 in, as iOS 26's own (Mail's Add Account, Apple Account's Add Email
271
+ // Address); a smaller field keeps 14
272
+ const gutter = startAdornment ? 11 : pill && height >= 48 ? 20 : 14
271
273
  const border =
272
274
  variant === "outline"
273
275
  ? state.invalid
@@ -230,7 +230,7 @@ type SurfaceProps = MenuContentProps & {
230
230
  * A context menu's touch and hold (ContextMenu): on iOS the screen dims and blurs but the element, drawn again
231
231
  * over the dimming as its lifted `preview`, and the menu stands 16 from it, by the third of the screen it is in.
232
232
  */
233
- context?: { preview: ReactNode; radius: number }
233
+ context?: { preview: ReactNode; radius: number; bare?: boolean }
234
234
  }
235
235
 
236
236
  /** The floating panel of a menu, placed under its anchor (over it when the screen ends first). */
@@ -424,7 +424,8 @@ function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check =
424
424
  height: box.height,
425
425
  transform: fitScale < 1 ? [{ scale: fitScale }] : undefined,
426
426
  borderRadius: context.radius,
427
- backgroundColor: theme.colors.groupedSurface,
427
+ // An element that draws its own shape lifts as it is: no card behind it and no clip of its own
428
+ ...(context.bare ? { overflow: "visible" as const } : { backgroundColor: theme.colors.groupedSurface }),
428
429
  boxShadow: String(theme.token("--context-menu-preview-shadow") ?? "0 0 32px rgba(0, 0, 0, 0.2)"),
429
430
  },
430
431
  ]}
package/src/index.ts CHANGED
@@ -83,7 +83,7 @@ export { OTPInput, type OTPInputProps } from "./components/OTPInput/OTPInput"
83
83
  export { PhoneInput, type CountryCode, type PhoneDetails, type PhoneInputProps } from "./components/PhoneInput/PhoneInput"
84
84
  export { Select, type SelectOption, type SelectProps } from "./components/Select/Select"
85
85
  export { Menu, type MenuContentProps, type MenuItemProps, type MenuProps } from "./components/Menu/Menu"
86
- export { ContextMenu, type ContextMenuContentProps, type ContextMenuProps } from "./components/ContextMenu/ContextMenu"
86
+ export { ContextMenu, type ContextMenuContentProps, type ContextMenuPreviewShape, type ContextMenuProps, type ContextMenuTriggerProps } from "./components/ContextMenu/ContextMenu"
87
87
  export { ScrollEdge, type ScrollEdgeProps } from "./components/ScrollEdge/ScrollEdge"
88
88
  export { DatePicker, type DatePickerDisplay, type DatePickerMode, type DatePickerProps } from "./components/DatePicker/DatePicker"
89
89
  export { ActionSheet, type ActionSheetAction, type ActionSheetProps } from "./components/ActionSheet/ActionSheet"