@plexui/react-native 0.3.0 → 0.4.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.
@@ -99,7 +99,7 @@ export function ActionSheet({ open, onOpenChange, title, message, actions, cance
99
99
  const icons = actions.some((action) => action.icon);
100
100
  return (_jsxs(BottomSheetBase, { open: open, onOpenChange: onOpenChange, testID: testID, contentStyle: styles.androidList, "aria-label": typeof title === "string" ? title : undefined,
101
101
  // With reduced motion the exit is at once either way
102
- exit: quick && !theme.reducedMotion ? ANDROID_PICK_EXIT : undefined, onExited: runPicked, children: [title != null || message != null ? (_jsxs(View, { style: styles.androidHeader, children: [title != null ? (_jsx(Text, { nativeID: ids.title, accessibilityRole: "header", color: theme.colors.labelSecondary, style: styles.androidTitle, children: title })) : null, message != null ? (_jsx(Text, { nativeID: ids.message, color: theme.colors.labelSecondary, style: styles.androidMessage, children: message })) : null] })) : null, actions.map((action, index) => {
102
+ exit: quick && !theme.reducedMotion ? ANDROID_PICK_EXIT : undefined, onExited: runPicked, androidClose: false, children: [title != null || message != null ? (_jsxs(View, { style: styles.androidHeader, children: [title != null ? (_jsx(Text, { nativeID: ids.title, accessibilityRole: "header", color: theme.colors.labelSecondary, style: styles.androidTitle, children: title })) : null, message != null ? (_jsx(Text, { nativeID: ids.message, color: theme.colors.labelSecondary, style: styles.androidMessage, children: message })) : null] })) : null, actions.map((action, index) => {
103
103
  const color = action.destructive ? dangerText(theme) : m.onSurface;
104
104
  return (_jsxs(Pressable
105
105
  // Two actions may share a label: each keeps its place in `actions`
@@ -11,6 +11,7 @@ import { withAlpha } from "../../theme/material";
11
11
  import { useTheme } from "../../theme/ThemeProvider";
12
12
  import { BarItemContext } from "../Button/Button";
13
13
  import { NavigationButton } from "../NavigationButton/NavigationButton";
14
+ import { IconDefaultsProvider } from "../Icon/createIcon";
14
15
  import { Text } from "../Text/Text";
15
16
  /**
16
17
  * The actions of a sheet, pinned under its content, which scrolls above them: the web's `Dialog.Footer` (12 above,
@@ -168,8 +169,10 @@ function BottomSheetRoot(props) {
168
169
  return _jsx(BottomSheetBase, { ...props });
169
170
  }
170
171
  /** The sheet with an exit of its own (ActionSheet's item tap); not part of the public API. */
171
- export function BottomSheetBase({ open, onOpenChange, title, children, dismissible = true, "aria-label": ariaLabel, testID, contentStyle, closeLabel = "Close", detent = "content", exit, onExited, }) {
172
+ export function BottomSheetBase({ open, onOpenChange, title: titleProp, hero, children, dismissible = true, "aria-label": ariaLabel, testID, contentStyle, closeLabel = "Close", detent = "content", exit, onExited, androidClose = true, }) {
172
173
  const theme = useTheme();
174
+ // A hero names the sheet from its content: the bar keeps Close alone
175
+ const title = hero ? undefined : titleProp;
173
176
  const insets = useSafeAreaInsets();
174
177
  const { width, height: screen } = useWindowDimensions();
175
178
  const [height, setHeight] = useState(0);
@@ -209,7 +212,7 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
209
212
  const web = Platform.OS === "web";
210
213
  // The web names the dialog by its title; a phone keeps the modal view
211
214
  const a11y = web
212
- ? { role: "dialog", "aria-modal": true, "aria-labelledby": title != null ? titleId : undefined, "aria-label": title != null ? undefined : ariaLabel }
215
+ ? { role: "dialog", "aria-modal": true, "aria-labelledby": title != null || hero ? titleId : undefined, "aria-label": title != null || hero ? undefined : ariaLabel }
213
216
  : { accessibilityViewIsModal: true, "aria-label": ariaLabel };
214
217
  // Android's sheet stands under the status bar at most; the phone layer's 16 under the top inset
215
218
  const maxHeight = screen - insets.top - (android ? 0 : 16);
@@ -230,7 +233,9 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
230
233
  // (69 in all). Content scrolled under it shows through the sheet's color at
231
234
  // 63% over a light blur, let go over its last 32dp (12 past the bar), with no line
232
235
  const barItem = useMemoBarItem(background);
233
- const header = android ? (title != null ? (_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: _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 ? (
236
+ // Android's bar stands with a title, or with Close alone where the sheet can be closed (as iOS's)
237
+ const androidBar = android && (title != null || (dismissible && androidClose));
238
+ 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 ? (
234
239
  // The web's phone Sheet bar: one 44 row 16 under the top edge, Close at the leading edge and the title alone centered
235
240
  // The bar is the web's Toolbar: 16 above the row and --toolbar-padding-bottom under it
236
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;
@@ -264,7 +269,7 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
264
269
  opacity: reduced ? progress : undefined,
265
270
  transform: [{ translateY: reduced ? drag : slide(progress) }],
266
271
  },
267
- ], children: [android && title != null ? null : header, _jsx(ScrollView
272
+ ], children: [androidBar ? null : header, _jsxs(ScrollView
268
273
  // A sheet of a fixed height gives its content the room left, so a footer stays at its bottom
269
274
  , {
270
275
  // A sheet of a fixed height gives its content the room left, so a footer stays at its bottom
@@ -286,13 +291,13 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
286
291
  // A screen whose gutter is Material's compact 16 sets it with --bottom-sheet-android-padding-inline
287
292
  { paddingHorizontal: androidInline },
288
293
  // 2 under the bar: 71 under a one-line title
289
- title != null ? { paddingTop: androidBarHeight + 2 } : null,
294
+ androidBar ? { paddingTop: androidBarHeight + 2 } : null,
290
295
  // Over a footer: 8 above its height, which reaches over the sheet's bottom padding
291
296
  footer ? { paddingBottom: 8 + Math.max(0, footerHeight - insets.bottom - keyboard) } : null,
292
297
  ]
293
298
  : iosContent,
294
299
  contentStyle,
295
- ], keyboardShouldPersistTaps: "handled", bounces: false, children: content }), android && title != null ? header : null, footer ? (_jsxs(View, { onStartShouldSetResponderCapture: android ? gesture.chrome : undefined, onLayout: android ? (event) => setFooterHeight(event.nativeEvent.layout.height) : undefined, style: [
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: [
296
301
  android
297
302
  ? [
298
303
  styles.androidFooter,
@@ -304,6 +309,28 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
304
309
  footer.props.style,
305
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] }) })) }));
306
311
  }
312
+ /**
313
+ * 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
314
+ * description), 24 over the content, as Apple's setup sheets. Android: Material's dialog hero, a 24dp icon in the
315
+ * secondary color 16 over a centered headline small (24/32), 16 over a 14/20 onSurfaceVariant text, 24 over the content.
316
+ */
317
+ function SheetHero({ hero, id }) {
318
+ const theme = useTheme();
319
+ const android = theme.isAndroid;
320
+ const m = theme.material;
321
+ const tone = hero.tone ?? "accent";
322
+ const ink = tone === "accent"
323
+ ? android
324
+ ? m.secondary
325
+ : theme.colors.accent
326
+ : tone === "secondary"
327
+ ? android
328
+ ? m.onSurfaceVariant
329
+ : theme.colors.labelSecondary
330
+ : theme.color(`--color-text-${tone}-ghost`, theme.colors.accent);
331
+ const size = android ? 24 : theme.length("--bottom-sheet-hero-icon-size", 56);
332
+ 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
+ }
307
334
  const isFooter = (child) => isValidElement(child) && child.type === BottomSheetFooter;
308
335
  /** The item of an Android sheet's bar: a 46dp glass circle solved against the sheet's color. */
309
336
  function useMemoBarItem(canvas) {
@@ -356,6 +383,7 @@ const styles = StyleSheet.create({
356
383
  androidCircle: { width: 46, height: 46 },
357
384
  androidHeading: { flex: 1, minWidth: 0, alignItems: "center", justifyContent: "center" },
358
385
  androidGrip: { height: 8 },
386
+ hero: { alignItems: "center" },
359
387
  // The content 12 from the sides (as a page's groups), 16 over the navigation bar; under a bar 13 under its circles
360
388
  // (71 from the sheet's top, 2 under the bar)
361
389
  androidContent: { paddingHorizontal: 12, paddingTop: 4, paddingBottom: 16 },
@@ -365,22 +365,39 @@ function ButtonBody({ color = "primary", variant = "solid", size = "md", shape =
365
365
  // its buttons on glass and its plain ones; the token alone gives the Regular of the plain button
366
366
  weight: theme.isIOS && variant !== "ghost" ? "medium" : base.weight,
367
367
  };
368
- const colors = barColors(theme, buttonColors(theme, color, variant, disabled, selected), { bar, prominent: accentAction, neutral, disabled, selected, flat: mobileMaterial === "flat" });
368
+ const barred = barColors(theme, buttonColors(theme, color, variant, disabled, selected), { bar, prominent: accentAction, neutral, disabled, selected, flat: mobileMaterial === "flat" });
369
+ // Clear glass over a photo, a video or a color: the kit's #f5f5f5 label in both themes, on iOS clear glass and on
370
+ // Android (no glass) its gray at 17%, a little more when pressed
371
+ const clear = mobileMaterial === "clear" && neutral && !bar;
372
+ const clearLabel = clear ? theme.color("--mobile-glass-clear-label", "#f5f5f5") : "";
373
+ const colors = clear
374
+ ? {
375
+ ...barred,
376
+ text: disabled ? withAlpha(clearLabel, 0.4) : clearLabel,
377
+ pressedText: undefined,
378
+ background: theme.color("--mobile-glass-clear-background", "rgba(153, 153, 153, 0.17)"),
379
+ pressed: theme.color("--mobile-glass-clear-background-active", "rgba(153, 153, 153, 0.28)"),
380
+ border: undefined,
381
+ }
382
+ : barred;
369
383
  // In a bar every neutral soft or ghost button is glass, as on iOS 26, unless it asks to stay flat or is selected.
370
384
  // A disabled glass button keeps its glass, as the phone CSS's
371
385
  const wantsGlass = bar ? mobileMaterial !== "flat" && neutral && !selected && !bar.inGroup : mobileMaterial === "glass" && neutral;
372
- const glass = theme.isIOS && wantsGlass;
386
+ const glass = theme.isIOS && (wantsGlass || clear);
373
387
  // On Android the same button stands on a glass of its own, as the Android bar circles: a see-through card with a
374
388
  // rim and a soft shadow (the glass of a plain bar)
375
389
  const card = theme.isAndroid && !!bar && !bar.plain && (wantsGlass || (accentAction && disabled && !bar.inGroup));
376
390
  const androidGlass = useAndroidGlass("bar", bar?.canvas);
377
391
  if (glass && !bar) {
378
- // The Liquid Glass text button of the iOS 27 kit: Medium (`--button-glass-font-weight`), 17/22 at md and lg
392
+ // The Liquid Glass text button of the iOS 27 kit: Medium (`--button-glass-font-weight`), 17/22 at md and lg, 12 a side
379
393
  const glassWeight = theme.length("--button-glass-font-weight", 510);
380
394
  metrics.weight = glassWeight >= 590 ? "semibold" : glassWeight >= 500 ? "medium" : "regular";
381
395
  if (size === "md" || size === "lg") {
382
396
  metrics.fontSize = theme.length("--button-glass-font-size", metrics.fontSize);
383
397
  metrics.lineHeight = theme.length("--button-glass-line-height", metrics.lineHeight);
398
+ // 12 each side, where a bordered medium button's Subheadline label takes 14
399
+ if (!gutterSize)
400
+ metrics.gutter = theme.length("--button-glass-gutter", metrics.gutter);
384
401
  }
385
402
  }
386
403
  const nativeRipple = useMaterialPress(theme);
@@ -522,7 +539,7 @@ function ButtonBody({ color = "primary", variant = "solid", size = "md", shape =
522
539
  ...rest,
523
540
  };
524
541
  if (glass) {
525
- return (_jsx(Pressable, { ...pressable, style: [{ alignSelf: block ? "stretch" : "flex-start" }, style], children: _jsx(Glass, { interactive: !inert, elevation: bar?.raised ? "raised" : "regular", radius: metrics.radius, fillToken: pressed && !inert ? "--mobile-glass-background-active" : undefined, style: [body, { borderRadius: metrics.radius }], children: content }) }));
542
+ return (_jsx(Pressable, { ...pressable, style: [{ alignSelf: block ? "stretch" : "flex-start" }, style], children: _jsx(Glass, { interactive: !inert, clear: clear, elevation: bar?.raised ? "raised" : "regular", radius: metrics.radius, fillToken: pressed && !inert ? (clear ? "--mobile-glass-clear-background-active" : "--mobile-glass-background-active") : undefined, style: [body, { borderRadius: metrics.radius }], children: content }) }));
526
543
  }
527
544
  // The pressable is the body: the native ripple is drawn and clipped by the view that has the (animated) corners
528
545
  return (_jsxs(AnimatedPressable, { ...pressable, android_ripple: nativeRipple ? { color: pressLayer, foreground: true, ...(dot ? { borderless: true, radius: dot / 2 } : null) } : undefined, style: [body, card ? androidGlass : null, { borderRadius: corners }, scales ? { transform: [{ scale }] } : null, style], children: [layer, content] }));
@@ -443,6 +443,9 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
443
443
  // A picture wider than the tile (a photo, an avatar) keeps its own size: it starts at the row's inset, where the
444
444
  // header and the footer stand, and the text follows 14 past it, as UIKit's image to text padding
445
445
  const [wide, setWide] = useState(false);
446
+ // A picture taller than the tile (a 40 photo) keeps the cell's margins over and under it, 10 as UIKit's content
447
+ // configuration keeps them: a 40 photo makes a 60 row
448
+ const [tall, setTall] = useState(false);
446
449
  // In a List with `columns` a field's value starts at one column, 40% into the row (`--field-row-column-width`)
447
450
  // A switch, a checkbox and a radio stay at the row's edge
448
451
  const columns = useContext(ListOptionsContext)?.columns === true && trailing != null;
@@ -461,11 +464,15 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
461
464
  return (_jsxs(_Fragment, { children: [leading != null ? (_jsx(View, { style: [
462
465
  styles.tile,
463
466
  { minWidth: tile, minHeight: tile, marginStart: wide ? 0 : theme.length("--field-row-icon-offset", -2), marginEnd: theme.length("--field-row-icon-gap", 14) },
467
+ tall ? { marginVertical: theme.length("--field-row-picture-margin-block", 10) } : null,
464
468
  leadingColor ? { backgroundColor: leadingColor, borderRadius: theme.length("--field-row-icon-radius", 7) } : null,
465
469
  ], onLayout: (event) => {
466
470
  const next = event.nativeEvent.layout.width > tile + 0.5;
467
471
  if (next !== wide)
468
472
  setWide(next);
473
+ const taller = event.nativeEvent.layout.height > tile + 0.5;
474
+ if (taller !== tall)
475
+ setTall(taller);
469
476
  }, children: _jsx(IconDefaultsProvider, { size: leadingColor ? 20 : theme.length("--field-row-icon-symbol-size", 24), color: leadingColor ? "#ffffff" : disabled ? theme.colors.labelTertiary : theme.colors.accent, children: leading }) })) : null, _jsxs(View, { ref: ref, onLayout: onRowLayout, style: [
470
477
  error != null ? styles.iosColumn : styles.iosMain,
471
478
  { minHeight: iosMinHeight(theme, description != null || error != null), paddingEnd: inset },
@@ -492,6 +499,9 @@ function AndroidContent({ handPress, valueColor, theme, label, description, desc
492
499
  // A picture wider than the symbol's 24 (a photo, an avatar) keeps its own size from the rows' inset (21, where the
493
500
  // header and the footer stand), the text 16 past it, as Material's list item with a leading avatar; 0 for a symbol
494
501
  const [wide, setWide] = useState(0);
502
+ // A picture taller than the symbol's 24 (a 40 avatar) keeps 8 over and under it, Material's list item with a leading
503
+ // avatar: a 40 photo makes a 56 row
504
+ const [tall, setTall] = useState(false);
495
505
  // The text (and the divider) 21 in, or 64 after a symbol, a tile or a choice's mark (its 20dp circle 22 in)
496
506
  const textStart = leading == null ? ANDROID_INSET : wide > 0 && !tile && !leadingMark ? ANDROID_INSET + wide + 16 : 64;
497
507
  // A value that ends the row stands 17 from the end (a value row), 20 in a row with a tile (a tiled row)
@@ -506,13 +516,16 @@ function AndroidContent({ handPress, valueColor, theme, label, description, desc
506
516
  const columns = useContext(ListOptionsContext)?.columns === true && trailing != null;
507
517
  const startsColumn = columns && !edgeControl;
508
518
  const rowEnd = useMemo(() => ({ fill: setFill, press: handPress, align: startsColumn ? "start" : "end", valueColor }), [handPress, startsColumn, valueColor]);
509
- const parts = (_jsxs(_Fragment, { children: [leading == null ? null : leadingMark ? (_jsx(View, { style: styles.androidMark, children: leading })) : (_jsx(View, { style: tile ? [styles.androidTile, { backgroundColor: leadingColor, opacity: disabled ? 0.5 : 1 }] : [styles.androidIcon, wide > 0 ? styles.androidWide : null], onLayout: tile
519
+ const parts = (_jsxs(_Fragment, { children: [leading == null ? null : leadingMark ? (_jsx(View, { style: styles.androidMark, children: leading })) : (_jsx(View, { style: tile ? [styles.androidTile, { backgroundColor: leadingColor, opacity: disabled ? 0.5 : 1 }] : [styles.androidIcon, wide > 0 ? styles.androidWide : null, tall ? styles.androidTall : null], onLayout: tile
510
520
  ? undefined
511
521
  : (event) => {
512
522
  const width = event.nativeEvent.layout.width;
513
523
  const next = width > 24.5 ? width : 0;
514
524
  if (Math.abs(next - wide) > 0.5)
515
525
  setWide(next);
526
+ const taller = event.nativeEvent.layout.height > 24.5;
527
+ if (taller !== tall)
528
+ setTall(taller);
516
529
  }, children: _jsx(IconDefaultsProvider, { size: 24, color: tile ? "#ffffff" : symbol, children: leading }) })), _jsxs(View, { style: [
517
530
  columns ? [styles.androidTextHug, styles.column] : fill ? styles.androidTextHug : styles.androidText,
518
531
  // One line centred in the 50dp row (54 beside a text field: a card's input row); with a second line 12 above
@@ -557,6 +570,7 @@ const styles = StyleSheet.create({
557
570
  androidFooterPlain: { paddingHorizontal: ANDROID_INSET },
558
571
  androidRow: { flexDirection: "row", alignItems: "center", minHeight: 50, paddingStart: ANDROID_INSET, paddingEnd: ANDROID_INSET },
559
572
  // A 24dp symbol at 20, a 28dp tile at 18 with a 24dp symbol, or a choice's 20dp mark at 22: the text at 64
573
+ androidTall: { marginVertical: 8 },
560
574
  androidIcon: { minWidth: 24, minHeight: 24, alignItems: "center", justifyContent: "center", marginStart: -1, marginEnd: 20 },
561
575
  androidWide: { marginStart: 0, marginEnd: 16 },
562
576
  androidMark: { width: 20, alignItems: "center", justifyContent: "center", marginStart: 1, marginEnd: 22 },
@@ -213,18 +213,30 @@ function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check =
213
213
  const fitsBelow = below + height <= window.height - bottomEdge;
214
214
  const above = over ? box.y + box.height - height : box.y - gap - height;
215
215
  let top = size == null ? -window.height - 1000 : fitsBelow ? below : Math.max(topEdge, above);
216
- let previewTop = box.y;
216
+ // A preview wider than the screen less 16 a side is scaled down about its middle to fit, as iOS 27.2 shrinks a
217
+ // lifted cell or card, and one that would cross the 16 is moved in: `seen` is where it shows
218
+ const fit = 16;
219
+ const fitScale = context && box.width > window.width - fit * 2 ? (window.width - fit * 2) / box.width : 1;
220
+ const seenWidth = box.width * fitScale;
221
+ const seenHeight = box.height * fitScale;
222
+ const seen = {
223
+ x: context && box.width > 0 ? Math.max(fit, Math.min(box.x + (box.width - seenWidth) / 2, window.width - fit - seenWidth)) : box.x,
224
+ y: box.y + (box.height - seenHeight) / 2,
225
+ width: seenWidth,
226
+ height: seenHeight,
227
+ };
228
+ let previewTop = seen.y;
217
229
  if (context) {
218
230
  // iOS 27.2 places a context menu by where the element stands (ref-app menus-context): in the left third at its
219
231
  // left edge, in the right third at its right edge, else at its centre; 16 under it, or over it when the element
220
232
  // is in the lower half and the menu fits there (the web's ContextMenu, contextMenuPreview)
221
- const centre = box.x + box.width / 2;
222
- left = centre < window.width / 3 ? box.x : centre > (window.width * 2) / 3 ? box.x + box.width - measured : centre - measured / 2;
233
+ const centre = seen.x + seen.width / 2;
234
+ left = centre < window.width / 3 ? seen.x : centre > (window.width * 2) / 3 ? seen.x + seen.width - measured : centre - measured / 2;
223
235
  left = Math.max(margin, Math.min(left, window.width - measured - margin));
224
236
  const lift = 16;
225
- const overIt = box.y - lift - height;
226
- const underIt = box.y + box.height + lift;
227
- const lower = box.y + box.height / 2 > window.height / 2;
237
+ const overIt = seen.y - lift - height;
238
+ const underIt = seen.y + seen.height + lift;
239
+ const lower = seen.y + seen.height / 2 > window.height / 2;
228
240
  if (size != null) {
229
241
  if (lower && overIt >= topEdge)
230
242
  top = overIt;
@@ -232,8 +244,8 @@ function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check =
232
244
  // Where the menu does not fit under the element it lifts the element up with it, as iOS moves the preview, so
233
245
  // the menu never covers it
234
246
  const overflow = underIt + height - (window.height - bottomEdge);
235
- previewTop = overflow > 0 ? Math.max(topEdge, box.y - overflow) : box.y;
236
- top = Math.max(topEdge, Math.min(previewTop + box.height + lift, window.height - bottomEdge - height));
247
+ previewTop = overflow > 0 ? Math.max(topEdge, seen.y - overflow) : seen.y;
248
+ top = Math.max(topEdge, Math.min(previewTop + seen.height + lift, window.height - bottomEdge - height));
237
249
  }
238
250
  }
239
251
  }
@@ -320,11 +332,13 @@ function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check =
320
332
  web ? { backdropFilter: "blur(30px)", WebkitBackdropFilter: "blur(30px)" } : null,
321
333
  ] }), _jsx(View, { pointerEvents: "none", style: [
322
334
  styles.preview,
323
- swap ? { right: box.x } : { left: box.x },
335
+ // Drawn at its own size and scaled about its middle onto where it is seen
336
+ swap ? { right: seen.x + (seen.width - box.width) / 2 } : { left: seen.x + (seen.width - box.width) / 2 },
324
337
  {
325
- top: previewTop,
338
+ top: previewTop + (seen.height - box.height) / 2,
326
339
  width: box.width,
327
340
  height: box.height,
341
+ transform: fitScale < 1 ? [{ scale: fitScale }] : undefined,
328
342
  borderRadius: context.radius,
329
343
  backgroundColor: theme.colors.groupedSurface,
330
344
  boxShadow: String(theme.token("--context-menu-preview-shadow") ?? "0 0 32px rgba(0, 0, 0, 0.2)"),
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { cloneElement, isValidElement, useState } from "react";
3
- import { StyleSheet, View, useWindowDimensions } from "react-native";
3
+ import { ActivityIndicator, StyleSheet, View, useWindowDimensions } from "react-native";
4
4
  import { Pressable } from "../../internal/Pressable";
5
5
  import Svg, { Path } from "react-native-svg";
6
6
  import X from "../../icons/plex/X";
@@ -8,7 +8,7 @@ import { flattenChildren, isRenderable, textOf } from "../../internal/children";
8
8
  import { FloatingPanel } from "../../internal/FloatingPanel";
9
9
  import { anchorProps } from "../../internal/floating";
10
10
  import { Glass } from "../../internal/Glass";
11
- import { accentText, barSurface, controlHighlight, dangerText, elevationShadow } from "../../theme/material";
11
+ import { accentText, barSurface, controlHighlight, dangerText, elevationShadow, withAlpha } from "../../theme/material";
12
12
  import { useTheme } from "../../theme/ThemeProvider";
13
13
  import { Button } from "../Button/Button";
14
14
  import { IconDefaultsProvider } from "../Icon/createIcon";
@@ -66,37 +66,50 @@ function TipBody({ title, description, icon, actions, mobileActions = "rows", on
66
66
  const closable = onClose != null;
67
67
  const descriptionColor = android ? theme.colors.textSecondary : theme.color("--tip-description-color", theme.colors.textSecondary);
68
68
  const paddingBottom = !hasActions ? m.bottomNone : buttons ? m.bottomButtons : m.bottomRows;
69
+ // iOS's tip with button actions is TipKit's mini tip (its kit's Hint View): 22 over the title, 4 between the title
70
+ // and the message, 22 from the words to the action and 16 under it
71
+ const miniTip = !android && hasActions && buttons;
69
72
  const textStart = hasIcon ? m.iconFrame + m.iconGap : 0;
70
73
  return (_jsxs(View, { role: role, "aria-label": role ? textOf(title) || undefined : undefined, testID: testID, style: [
71
74
  styles.tip,
72
75
  {
73
76
  borderRadius: m.radius,
74
- paddingTop: m.top,
77
+ paddingTop: miniTip ? 22 : m.top,
75
78
  paddingHorizontal: m.inline,
76
79
  paddingBottom,
77
80
  columnGap: m.iconGap,
78
- rowGap: hasActions && buttons ? m.gapButtons : m.gap,
81
+ rowGap: miniTip ? 22 : hasActions && buttons ? m.gapButtons : m.gap,
79
82
  backgroundColor: background ?? theme.colors.groupedSurface,
80
83
  },
81
84
  style,
82
- ], children: [children, hasIcon ? (_jsx(View, { style: [styles.icon, { width: m.iconFrame, height: m.iconFrame }], children: _jsx(IconDefaultsProvider, { size: m.icon, color: descriptionColor, children: icon }) })) : null, _jsxs(View, { style: [styles.message, closable ? { paddingEnd: m.messageEnd } : null], children: [_jsx(Text, { variant: "headline", children: title }), isRenderable(description) ? (_jsx(TextColorProvider, { value: descriptionColor, children: _jsx(Text, { variant: "subheadline", color: descriptionColor, style: android ? styles.androidDescription : null, children: description }) })) : null] }), hasActions ? (_jsx(View, { style: [
85
+ ], children: [children, hasIcon ? (_jsx(View, { style: [styles.icon, { width: m.iconFrame, height: m.iconFrame }], children: _jsx(IconDefaultsProvider, { size: m.icon, color: descriptionColor, children: icon }) })) : null, _jsxs(View, { style: [styles.message, closable ? { paddingEnd: m.messageEnd } : null], children: [_jsx(Text, { variant: "headline", children: title }), isRenderable(description) ? (_jsx(TextColorProvider, { value: descriptionColor, children: _jsx(Text, { variant: "subheadline", color: descriptionColor, style: android ? styles.androidDescription : miniTip ? styles.miniDescription : null, children: description }) })) : null] }), hasActions ? (_jsx(View, { style: [
83
86
  styles.actions,
84
87
  buttons ? styles.buttons : android ? [styles.androidActions, { marginStart: textStart - ANDROID_TEXT_BUTTON_INSET }] : { paddingStart: textStart },
85
88
  ], children: items.map((item, index) => (buttons ? _jsx(ActionButton, { item: item }, index) : _jsx(ActionRow, { item: item }, index))) })) : null, closable ? (_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: closeLabel, onPress: onClose, style: [styles.close, { width: m.closeTarget, height: m.closeTarget, top: m.closeTop, end: m.closeEnd, borderRadius: m.closeTarget / 2 }], children: ({ pressed }) => (_jsx(View, { style: [styles.closeGlyph, android && pressed ? { backgroundColor: controlHighlight(theme.scheme), borderRadius: m.closeTarget / 2 } : null], children: _jsx(X, { size: m.closeIcon, color: android ? theme.colors.labelSecondary : theme.colors.labelTertiary, style: !android && pressed ? styles.pressed : undefined }) })) })) : null] }));
86
89
  }
87
- /** An action as a capsule across the tip, its Button's color and variant kept: 48 tall on iOS, 40dp on Android. */
90
+ /**
91
+ * An action as a capsule across the tip. On iOS it is TipKit's action (the kit's Hint View): 50 tall, a 17 Semibold
92
+ * label in the action's color (the accent for a primary one) on that color at 8% over the gray fill at 8%. On Android
93
+ * the Button keeps its color and variant, a 40dp capsule.
94
+ */
88
95
  function ActionButton({ item }) {
89
96
  const theme = useTheme();
90
97
  if (!isValidElement(item) || item.type !== Button)
91
98
  return _jsx(_Fragment, { children: item });
92
99
  const button = item;
93
- return cloneElement(button, {
94
- size: theme.isAndroid ? "lg" : "xl",
95
- pill: true,
96
- block: true,
97
- style: [button.props.style, theme.isAndroid ? null : { minHeight: 48 }],
98
- });
100
+ if (theme.isAndroid)
101
+ return cloneElement(button, { size: "lg", pill: true, block: true });
102
+ // The Button's look props stay here; its handlers, ref and accessibility props pass on to the capsule
103
+ /* eslint-disable @typescript-eslint/no-unused-vars */
104
+ const { color = "primary", children, disabled = false, loading = false, inert: inertProp = loading, variant, size, pill, shape, mobileMaterial, uniform, block, labelLines, selected, iconSize, gutterSize, opticallyAlign, style, accessibilityState, ...pressable } = button.props;
105
+ /* eslint-enable @typescript-eslint/no-unused-vars */
106
+ // As the Button: a loading or inert action takes no presses and keeps its look; a disabled one dims
107
+ const inert = disabled || inertProp;
108
+ const ink = color === "primary" ? theme.colors.accent : theme.color(`--color-text-${color}-ghost`, theme.colors.accent);
109
+ return (_jsxs(Pressable, { accessibilityRole: "button", ...pressable, accessibilityState: { ...accessibilityState, disabled: inert, busy: loading }, "aria-busy": loading, disabled: inert, style: ({ pressed }) => [styles.miniAction, { backgroundColor: MINI_GRAY, opacity: disabled ? 0.4 : 1 }, pressed && !inert ? styles.pressed : null], children: [_jsx(View, { pointerEvents: "none", style: [StyleSheet.absoluteFill, styles.miniActionTint, { backgroundColor: withAlpha(ink, 0.08) }] }), loading ? (_jsx(ActivityIndicator, { color: ink })) : (_jsx(Text, { variant: "body", weight: "semibold", numberOfLines: 2, style: styles.miniLabel, color: ink, children: children }))] }));
99
110
  }
111
+ /** The gray under a TipKit action's tint: the kit's rgba(116, 116, 128, 0.08). */
112
+ const MINI_GRAY = "rgba(116, 116, 128, 0.08)";
100
113
  /**
101
114
  * An action as a row of text in its Button's color under a separator, 46 tall, as iOS tips list them; on Android a
102
115
  * text button in the accent, as Material 3's rich tooltip sets its actions. Other elements stand as given.
@@ -182,6 +195,10 @@ const styles = StyleSheet.create({
182
195
  androidDescription: { marginTop: 2 },
183
196
  actions: { flexBasis: "100%", flexGrow: 1, flexDirection: "column" },
184
197
  buttons: { gap: 10 },
198
+ miniDescription: { marginTop: 4 },
199
+ miniAction: { minHeight: 50, paddingHorizontal: 20, paddingVertical: 14, borderRadius: 25, borderCurve: "continuous", alignItems: "center", justifyContent: "center", overflow: "hidden" },
200
+ miniActionTint: { borderRadius: 25 },
201
+ miniLabel: { lineHeight: 18, textAlign: "center" },
185
202
  androidActions: { flexDirection: "row", flexWrap: "wrap", gap: 8 },
186
203
  row: { minHeight: 46, paddingVertical: 12, borderTopWidth: 1, justifyContent: "center" },
187
204
  androidRow: { alignSelf: "flex-start", minHeight: 40, paddingHorizontal: 12, borderRadius: 20, justifyContent: "center" },
@@ -83,6 +83,11 @@ const lensMask = (width, height, radius) => {
83
83
  `<path filter="url(#e)" fill-rule="evenodd" d="M-20 -20H${f(width + 20)}V${f(height + 20)}H-20Z${hole}"/></svg>`;
84
84
  return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
85
85
  };
86
+ /** The clear glass where its tokens are not set: the kit's gray 153 at 17% over a light blur. */
87
+ const CLEAR_FILL = "rgba(153, 153, 153, 0.17)";
88
+ const CLEAR_FILTER = "blur(4px) brightness(1.08)";
89
+ /** Clear glass with no blur (Reduce Transparency, no blur module): a dark gray, as the clear glass over a dark photo. */
90
+ const CLEAR_OPAQUE = "#3a3a3c";
86
91
  /** The filter and the shadow of the glass surfaces of the phone layer, by their fill (mobile-materials.css, touch.css). */
87
92
  const SURFACES = {
88
93
  "--menu-mobile-background": { filter: "--menu-mobile-backdrop-filter", shadow: "--menu-shadow" },
@@ -101,7 +106,7 @@ const intensityOf = (radius) => Math.max(0, Math.min(100, Math.round(radius * 5)
101
106
  * over live content cannot be read (dark glass is white at 12%), and HIG materials turn opaque then. Material 3 has
102
107
  * no glass: on Android the components draw their tonal containers instead and do not use this.
103
108
  */
104
- export function Glass({ radius = 0, elevation = "regular", tint, interactive, fillToken, filterToken, shadowToken, blur, style, children, ...rest }) {
109
+ export function Glass({ radius = 0, elevation = "regular", tint, interactive, clear = false, fillToken, filterToken, shadowToken, blur, style, children, ...rest }) {
105
110
  const theme = useTheme();
106
111
  // The web lens's mask follows the glass's shape, so it needs the glass's size
107
112
  const [size, setSize] = useState(null);
@@ -109,17 +114,17 @@ export function Glass({ radius = 0, elevation = "regular", tint, interactive, fi
109
114
  const overrides = useThemeOverrides();
110
115
  const shape = { borderRadius: radius, borderCurve: "continuous" };
111
116
  const surface = fillToken ? SURFACES[fillToken] : undefined;
112
- const shadow = theme.token(shadowToken ?? surface?.shadow ?? (elevation === "raised" ? "--mobile-glass-shadow-raised" : "--mobile-glass-shadow"));
117
+ const shadow = theme.token(shadowToken ?? surface?.shadow ?? (clear ? "--mobile-glass-clear-shadow" : elevation === "raised" ? "--mobile-glass-shadow-raised" : "--mobile-glass-shadow"));
113
118
  const boxShadow = typeof shadow === "string" ? shadow : undefined;
114
119
  const native = liquidGlassModule();
115
120
  // iOS 26's own glass turns frostier by itself with Reduce Transparency
116
121
  if (native) {
117
122
  const { GlassView } = native;
118
- return (_jsx(GlassView, { ...rest, glassEffectStyle: "regular", colorScheme: theme.scheme, tintColor: tint, isInteractive: interactive, style: [shape, style], children: children }));
123
+ return (_jsx(GlassView, { ...rest, glassEffectStyle: clear ? "clear" : "regular", colorScheme: theme.scheme, tintColor: tint, isInteractive: interactive, style: [shape, style], children: children }));
119
124
  }
120
125
  const web = Platform.OS === "web";
121
- const fillName = fillToken ?? "--mobile-glass-background";
122
- const filterName = filterToken ?? surface?.filter ?? "--mobile-glass-backdrop-filter";
126
+ const fillName = fillToken ?? (clear ? "--mobile-glass-clear-background" : "--mobile-glass-background");
127
+ const filterName = filterToken ?? surface?.filter ?? (clear ? "--mobile-glass-clear-backdrop-filter" : "--mobile-glass-backdrop-filter");
123
128
  const dense = web && !theme.isAndroid ? WEB_DENSE[fillName] : undefined;
124
129
  const denseFill = dense != null && tint == null && overrides?.[fillName] == null;
125
130
  // Glass with a fill of its own and the plain glass's filter (the large segmented control) blurs as the plain glass
@@ -127,9 +132,9 @@ export function Glass({ radius = 0, elevation = "regular", tint, interactive, fi
127
132
  const plainFilter = web && !theme.isAndroid && dense == null && filterToken == null && filterName === "--mobile-glass-backdrop-filter" && overrides?.[filterName] == null;
128
133
  const denseFilter = (dense != null && filterToken == null && overrides?.[filterName] == null) || plainFilter;
129
134
  const webFilter = dense ?? WEB_DENSE["--mobile-glass-background"];
130
- const fill = tint ?? (denseFill ? theme.color(dense.fill, theme.scheme === "dark" ? dense.dark : dense.light) : theme.color(fillName));
135
+ const fill = tint ?? (denseFill ? theme.color(dense.fill, theme.scheme === "dark" ? dense.dark : dense.light) : theme.color(fillName, clear ? CLEAR_FILL : undefined));
131
136
  const filterValue = denseFilter ? (theme.token(webFilter.filter) ?? webFilter.blur) : theme.token(filterName);
132
- const filter = blur != null ? `blur(${blur}px)` : typeof filterValue === "string" ? filterValue : "blur(12px)";
137
+ const filter = blur != null ? `blur(${blur}px)` : typeof filterValue === "string" ? filterValue : clear ? CLEAR_FILTER : "blur(12px)";
133
138
  const module = web || Platform.OS !== "ios" ? null : blurModule();
134
139
  const opaque = reduceTransparency || (!web && module == null);
135
140
  if (web && !opaque) {
@@ -167,5 +172,7 @@ export function Glass({ radius = 0, elevation = "regular", tint, interactive, fi
167
172
  ] })) : null, children] }));
168
173
  }
169
174
  const radiusPx = Number(/blur\(\s*([\d.]+)px\s*\)/.exec(filter)?.[1] ?? 12);
170
- return (_jsxs(View, { ...rest, style: [shape, { boxShadow }, style], children: [_jsxs(View, { style: [StyleSheet.absoluteFill, shape, { overflow: "hidden" }], pointerEvents: "none", children: [opaque ? (_jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: theme.color("--mobile-surface-elevated-plain-primary", theme.colors.surfaceElevated) }] })) : module ? (_jsx(module.BlurView, { intensity: intensityOf(radiusPx), tint: theme.scheme === "dark" ? "systemChromeMaterialDark" : "systemChromeMaterialLight", style: StyleSheet.absoluteFill })) : null, _jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: fill }] })] }), children] }));
175
+ return (_jsxs(View, { ...rest, style: [shape, { boxShadow }, style], children: [_jsxs(View, { style: [StyleSheet.absoluteFill, shape, { overflow: "hidden" }], pointerEvents: "none", children: [opaque ? (
176
+ // Clear glass carries a light label over a photo or a color: opaque, it stands on a dark gray so the label reads
177
+ _jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: clear ? theme.color("--mobile-glass-clear-opaque-background", CLEAR_OPAQUE) : theme.color("--mobile-surface-elevated-plain-primary", theme.colors.surfaceElevated) }] })) : module ? (_jsx(module.BlurView, { intensity: intensityOf(radiusPx), tint: clear ? "systemUltraThinMaterial" : theme.scheme === "dark" ? "systemChromeMaterialDark" : "systemChromeMaterialLight", style: StyleSheet.absoluteFill })) : null, _jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: fill }] })] }), children] }));
171
178
  }
@@ -1,10 +1,29 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type StyleProp, type ViewStyle } from "react-native";
3
+ /** The tones of a hero's symbol. */
4
+ export type BottomSheetHeroTone = "accent" | "secondary" | "success" | "warning" | "danger";
5
+ export type BottomSheetHero = {
6
+ /** A symbol (an icon of the set, sized and colored by the sheet) or a drawing of the app's own, at its own size. */
7
+ icon?: ReactNode;
8
+ /** The sheet's title, large and centered under the symbol. */
9
+ title: ReactNode;
10
+ /** A line or two under the title. */
11
+ description?: ReactNode;
12
+ /** The symbol's color. @default "accent" */
13
+ tone?: BottomSheetHeroTone;
14
+ };
3
15
  export type BottomSheetProps = {
4
16
  open: boolean;
5
17
  onOpenChange: (open: boolean) => void;
6
18
  /** A title over the content, centered on iOS. */
7
19
  title?: ReactNode;
20
+ /**
21
+ * A hero header at the top of the content instead of a title in the bar, as a setup or a what's-new sheet: on iOS a
22
+ * 56pt symbol over a centered Title 1 bold (28/34) and an optional 17/22 description, the bar keeping only Close; on
23
+ * Android Material's hero icon (24dp, secondary) over a centered headline (24/32) and a 14/20 supporting text, Close
24
+ * in its bar's circle. It names the sheet.
25
+ */
26
+ hero?: BottomSheetHero;
8
27
  children?: ReactNode;
9
28
  /** A tap on the dim, a drag down, Close, Android's back and Escape close it. @default true */
10
29
  dismissible?: boolean;
@@ -43,10 +62,12 @@ type SheetExit = {
43
62
  exit?: number;
44
63
  /** Called once the sheet has left. */
45
64
  onExited?: () => void;
65
+ /** Android draws Close without a title (a plain list of choices, ActionSheet, does not). @default true */
66
+ androidClose?: boolean;
46
67
  };
47
68
  declare function BottomSheetRoot(props: BottomSheetProps): import("react").JSX.Element;
48
69
  /** The sheet with an exit of its own (ActionSheet's item tap); not part of the public API. */
49
- export declare function BottomSheetBase({ open, onOpenChange, title, children, dismissible, "aria-label": ariaLabel, testID, contentStyle, closeLabel, detent, exit, onExited, }: BottomSheetProps & SheetExit): import("react").JSX.Element;
70
+ export declare function BottomSheetBase({ open, onOpenChange, title: titleProp, hero, children, dismissible, "aria-label": ariaLabel, testID, contentStyle, closeLabel, detent, exit, onExited, androidClose, }: BottomSheetProps & SheetExit): import("react").JSX.Element;
50
71
  /**
51
72
  * A sheet from the bottom edge: on iOS 26 the sheet of the phone layer (`--dialog-sheet-radius` 38 on its top corners,
52
73
  * a bar 16 under its top edge with Close at the leading edge and the title centered, as the web's phone Sheet; no
@@ -23,8 +23,12 @@ export type ButtonProps = Omit<PressableProps, "children" | "style"> & {
23
23
  pill?: boolean;
24
24
  /** The shape on Android: a pill (default), as newer Android screens draw a button, or 8dp corners. */
25
25
  shape?: "round" | "square";
26
- /** The glass of iOS 26 for a neutral soft or ghost button. Android has no glass. */
27
- mobileMaterial?: "glass" | "flat";
26
+ /**
27
+ * The glass of iOS 26 for a neutral soft or ghost button, or its clear glass over a photo, a video or a color (a
28
+ * light frost and a #f5f5f5 label, in both themes). Android has no glass: a clear button there is a translucent
29
+ * gray with the same label.
30
+ */
31
+ mobileMaterial?: "glass" | "flat" | "clear";
28
32
  /** A button as wide and tall: an icon alone. */
29
33
  uniform?: boolean;
30
34
  /** Takes the whole width. */
@@ -30,7 +30,7 @@ export { ContextMenu, type ContextMenuContentProps, type ContextMenuProps } from
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";
33
- export { BottomSheet, type BottomSheetFooterProps, type BottomSheetProps } from "./components/BottomSheet/BottomSheet";
33
+ export { BottomSheet, type BottomSheetFooterProps, type BottomSheetHero, type BottomSheetHeroTone, type BottomSheetProps } from "./components/BottomSheet/BottomSheet";
34
34
  export { Dialog, type DialogAction, type DialogProps } from "./components/Dialog/Dialog";
35
35
  export { Toaster, toast, type ToasterProps, type ToastId, type ToastOptions, type ToastT, type ToastType } from "./components/Toast/Toast";
36
36
  export { Avatar, AvatarGroup, type AvatarColor, type AvatarGroupProps, type AvatarProps, type AvatarVariant } from "./components/Avatar/Avatar";
@@ -8,6 +8,12 @@ export type GlassProps = ViewProps & {
8
8
  tint?: string;
9
9
  /** Native glass reacts to touches (iOS 26 interactive glass). */
10
10
  interactive?: boolean;
11
+ /**
12
+ * iOS 26's clear glass, for controls over a photo, a video or a color: native `.clear` glass on iOS 26, elsewhere
13
+ * the kit's clear fill (`--mobile-glass-clear-background`, gray 153 at 17%) with a light blur, a 0.5 rim and a
14
+ * faint shadow (`--mobile-glass-clear-*`), the same in light and dark: what is under it decides how it reads.
15
+ */
16
+ clear?: boolean;
11
17
  /** A fill token for the glass instead of `--mobile-glass-background` (menus, alerts and toasts set their own). */
12
18
  fillToken?: string;
13
19
  /**
@@ -31,4 +37,4 @@ export type GlassProps = ViewProps & {
31
37
  * over live content cannot be read (dark glass is white at 12%), and HIG materials turn opaque then. Material 3 has
32
38
  * no glass: on Android the components draw their tonal containers instead and do not use this.
33
39
  */
34
- export declare function Glass({ radius, elevation, tint, interactive, fillToken, filterToken, shadowToken, blur, style, children, ...rest }: GlassProps): import("react").JSX.Element;
40
+ export declare function Glass({ radius, elevation, tint, interactive, clear, fillToken, filterToken, shadowToken, blur, style, children, ...rest }: GlassProps): import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/react-native",
3
- "version": "0.3.0",
3
+ "version": "0.4.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",
@@ -84,7 +84,7 @@
84
84
  "test": "npm run typecheck && npm run lint && npm run test:web --prefix example"
85
85
  },
86
86
  "dependencies": {
87
- "@plexui/styles": "^0.17.11",
87
+ "@plexui/styles": "^0.17.12",
88
88
  "libphonenumber-js": "^1.13.17"
89
89
  },
90
90
  "peerDependencies": {
@@ -129,6 +129,7 @@ export function ActionSheet({ open, onOpenChange, title, message, actions, cance
129
129
  // With reduced motion the exit is at once either way
130
130
  exit={quick && !theme.reducedMotion ? ANDROID_PICK_EXIT : undefined}
131
131
  onExited={runPicked}
132
+ androidClose={false}
132
133
  >
133
134
  {/* Android's plain sheet title: Regular 16 in its secondary gray (#757575, #7D7D7D at night), 16 around it; a
134
135
  message under it in 14 */}
@@ -10,13 +10,35 @@ import { withAlpha } from "../../theme/material"
10
10
  import { useTheme } from "../../theme/ThemeProvider"
11
11
  import { BarItemContext, type BarItemStyle } from "../Button/Button"
12
12
  import { NavigationButton } from "../NavigationButton/NavigationButton"
13
+ import { IconDefaultsProvider } from "../Icon/createIcon"
13
14
  import { Text } from "../Text/Text"
14
15
 
16
+ /** The tones of a hero's symbol. */
17
+ export type BottomSheetHeroTone = "accent" | "secondary" | "success" | "warning" | "danger"
18
+
19
+ export type BottomSheetHero = {
20
+ /** A symbol (an icon of the set, sized and colored by the sheet) or a drawing of the app's own, at its own size. */
21
+ icon?: ReactNode
22
+ /** The sheet's title, large and centered under the symbol. */
23
+ title: ReactNode
24
+ /** A line or two under the title. */
25
+ description?: ReactNode
26
+ /** The symbol's color. @default "accent" */
27
+ tone?: BottomSheetHeroTone
28
+ }
29
+
15
30
  export type BottomSheetProps = {
16
31
  open: boolean
17
32
  onOpenChange: (open: boolean) => void
18
33
  /** A title over the content, centered on iOS. */
19
34
  title?: ReactNode
35
+ /**
36
+ * A hero header at the top of the content instead of a title in the bar, as a setup or a what's-new sheet: on iOS a
37
+ * 56pt symbol over a centered Title 1 bold (28/34) and an optional 17/22 description, the bar keeping only Close; on
38
+ * Android Material's hero icon (24dp, secondary) over a centered headline (24/32) and a 14/20 supporting text, Close
39
+ * in its bar's circle. It names the sheet.
40
+ */
41
+ hero?: BottomSheetHero
20
42
  children?: ReactNode
21
43
  /** A tap on the dim, a drag down, Close, Android's back and Escape close it. @default true */
22
44
  dismissible?: boolean
@@ -203,6 +225,8 @@ type SheetExit = {
203
225
  exit?: number
204
226
  /** Called once the sheet has left. */
205
227
  onExited?: () => void
228
+ /** Android draws Close without a title (a plain list of choices, ActionSheet, does not). @default true */
229
+ androidClose?: boolean
206
230
  }
207
231
 
208
232
  function BottomSheetRoot(props: BottomSheetProps) {
@@ -213,7 +237,8 @@ function BottomSheetRoot(props: BottomSheetProps) {
213
237
  export function BottomSheetBase({
214
238
  open,
215
239
  onOpenChange,
216
- title,
240
+ title: titleProp,
241
+ hero,
217
242
  children,
218
243
  dismissible = true,
219
244
  "aria-label": ariaLabel,
@@ -223,8 +248,11 @@ export function BottomSheetBase({
223
248
  detent = "content",
224
249
  exit,
225
250
  onExited,
251
+ androidClose = true,
226
252
  }: BottomSheetProps & SheetExit) {
227
253
  const theme = useTheme()
254
+ // A hero names the sheet from its content: the bar keeps Close alone
255
+ const title = hero ? undefined : titleProp
228
256
  const insets = useSafeAreaInsets()
229
257
  const { width, height: screen } = useWindowDimensions()
230
258
  const [height, setHeight] = useState(0)
@@ -263,7 +291,7 @@ export function BottomSheetBase({
263
291
  const web = Platform.OS === "web"
264
292
  // The web names the dialog by its title; a phone keeps the modal view
265
293
  const a11y = web
266
- ? { role: "dialog" as const, "aria-modal": true, "aria-labelledby": title != null ? titleId : undefined, "aria-label": title != null ? undefined : ariaLabel }
294
+ ? { role: "dialog" as const, "aria-modal": true, "aria-labelledby": title != null || hero ? titleId : undefined, "aria-label": title != null || hero ? undefined : ariaLabel }
267
295
  : { accessibilityViewIsModal: true, "aria-label": ariaLabel }
268
296
  // Android's sheet stands under the status bar at most; the phone layer's 16 under the top inset
269
297
  const maxHeight = screen - insets.top - (android ? 0 : 16)
@@ -285,8 +313,10 @@ export function BottomSheetBase({
285
313
  // (69 in all). Content scrolled under it shows through the sheet's color at
286
314
  // 63% over a light blur, let go over its last 32dp (12 past the bar), with no line
287
315
  const barItem = useMemoBarItem(background)
316
+ // Android's bar stands with a title, or with Close alone where the sheet can be closed (as iOS's)
317
+ const androidBar = android && (title != null || (dismissible && androidClose))
288
318
  const header = android ? (
289
- title != null ? (
319
+ androidBar ? (
290
320
  <View onStartShouldSetResponderCapture={gesture.chrome} onLayout={(event) => setAndroidBarHeight(Math.max(ANDROID_BAR_HEIGHT, event.nativeEvent.layout.height))} style={[styles.androidBar, { paddingHorizontal: androidInline }]}>
291
321
  <SheetBarFade fill={background} shown={scrolled} />
292
322
  <View style={styles.androidCircle}>
@@ -297,9 +327,9 @@ export function BottomSheetBase({
297
327
  ) : null}
298
328
  </View>
299
329
  <View style={styles.androidHeading}>
300
- <Text nativeID={titleId} accessibilityRole="header" weight="medium" align="center" numberOfLines={2} color={m.onSurface} style={{ fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }}>
330
+ {title == null ? null : <Text nativeID={titleId} accessibilityRole="header" weight="medium" align="center" numberOfLines={2} color={m.onSurface} style={{ fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }}>
301
331
  {title}
302
- </Text>
332
+ </Text>}
303
333
  </View>
304
334
  <View style={styles.androidCircle} />
305
335
  </View>
@@ -380,7 +410,7 @@ export function BottomSheetBase({
380
410
  },
381
411
  ]}
382
412
  >
383
- {android && title != null ? null : header}
413
+ {androidBar ? null : header}
384
414
  {/* Content taller than the screen scrolls; on iOS the drag stays on the bar, on Android it starts at the
385
415
  content's top */}
386
416
  <ScrollView
@@ -404,7 +434,7 @@ export function BottomSheetBase({
404
434
  // A screen whose gutter is Material's compact 16 sets it with --bottom-sheet-android-padding-inline
405
435
  { paddingHorizontal: androidInline },
406
436
  // 2 under the bar: 71 under a one-line title
407
- title != null ? { paddingTop: androidBarHeight + 2 } : null,
437
+ androidBar ? { paddingTop: androidBarHeight + 2 } : null,
408
438
  // Over a footer: 8 above its height, which reaches over the sheet's bottom padding
409
439
  footer ? { paddingBottom: 8 + Math.max(0, footerHeight - insets.bottom - keyboard) } : null,
410
440
  ]
@@ -414,10 +444,11 @@ export function BottomSheetBase({
414
444
  keyboardShouldPersistTaps="handled"
415
445
  bounces={false}
416
446
  >
447
+ {hero ? <SheetHero hero={hero} id={titleId} /> : null}
417
448
  {content}
418
449
  </ScrollView>
419
450
  {/* Android's bar stands over the content, which scrolls under it */}
420
- {android && title != null ? header : null}
451
+ {androidBar ? header : null}
421
452
  {footer ? (
422
453
  <View
423
454
  onStartShouldSetResponderCapture={android ? gesture.chrome : undefined}
@@ -459,6 +490,59 @@ export function BottomSheetBase({
459
490
  )
460
491
  }
461
492
 
493
+ /**
494
+ * 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
495
+ * description), 24 over the content, as Apple's setup sheets. Android: Material's dialog hero, a 24dp icon in the
496
+ * secondary color 16 over a centered headline small (24/32), 16 over a 14/20 onSurfaceVariant text, 24 over the content.
497
+ */
498
+ function SheetHero({ hero, id }: { hero: BottomSheetHero; id: string }) {
499
+ const theme = useTheme()
500
+ const android = theme.isAndroid
501
+ const m = theme.material
502
+ const tone = hero.tone ?? "accent"
503
+ const ink =
504
+ tone === "accent"
505
+ ? android
506
+ ? m.secondary
507
+ : theme.colors.accent
508
+ : tone === "secondary"
509
+ ? android
510
+ ? m.onSurfaceVariant
511
+ : theme.colors.labelSecondary
512
+ : theme.color(`--color-text-${tone}-ghost`, theme.colors.accent)
513
+ const size = android ? 24 : theme.length("--bottom-sheet-hero-icon-size", 56)
514
+ return (
515
+ <View style={[styles.hero, { paddingBottom: 24 }]}>
516
+ {hero.icon != null ? (
517
+ <View style={{ marginBottom: android ? 16 : 12 }} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
518
+ <IconDefaultsProvider size={size} color={ink}>
519
+ {hero.icon}
520
+ </IconDefaultsProvider>
521
+ </View>
522
+ ) : null}
523
+ <Text
524
+ nativeID={id}
525
+ accessibilityRole="header"
526
+ align="center"
527
+ weight={android ? "regular" : "bold"}
528
+ color={android ? m.onSurface : undefined}
529
+ 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) }}
530
+ >
531
+ {hero.title}
532
+ </Text>
533
+ {hero.description != null ? (
534
+ <Text
535
+ align="center"
536
+ color={android ? m.onSurfaceVariant : theme.colors.labelSecondary}
537
+ style={android ? { fontSize: 14, lineHeight: 20, marginTop: 16 } : { fontSize: 17, lineHeight: 22, marginTop: 4 }}
538
+ >
539
+ {hero.description}
540
+ </Text>
541
+ ) : null}
542
+ </View>
543
+ )
544
+ }
545
+
462
546
  const isFooter = (child: ReactNode) => isValidElement(child) && child.type === BottomSheetFooter
463
547
 
464
548
  /** The item of an Android sheet's bar: a 46dp glass circle solved against the sheet's color. */
@@ -517,6 +601,7 @@ const styles = StyleSheet.create({
517
601
  androidCircle: { width: 46, height: 46 },
518
602
  androidHeading: { flex: 1, minWidth: 0, alignItems: "center", justifyContent: "center" },
519
603
  androidGrip: { height: 8 },
604
+ hero: { alignItems: "center" },
520
605
  // The content 12 from the sides (as a page's groups), 16 over the navigation bar; under a bar 13 under its circles
521
606
  // (71 from the sheet's top, 2 under the bar)
522
607
  androidContent: { paddingHorizontal: 12, paddingTop: 4, paddingBottom: 16 },
@@ -36,8 +36,12 @@ export type ButtonProps = Omit<PressableProps, "children" | "style"> & {
36
36
  pill?: boolean
37
37
  /** The shape on Android: a pill (default), as newer Android screens draw a button, or 8dp corners. */
38
38
  shape?: "round" | "square"
39
- /** The glass of iOS 26 for a neutral soft or ghost button. Android has no glass. */
40
- mobileMaterial?: "glass" | "flat"
39
+ /**
40
+ * The glass of iOS 26 for a neutral soft or ghost button, or its clear glass over a photo, a video or a color (a
41
+ * light frost and a #f5f5f5 label, in both themes). Android has no glass: a clear button there is a translucent
42
+ * gray with the same label.
43
+ */
44
+ mobileMaterial?: "glass" | "flat" | "clear"
41
45
  /** A button as wide and tall: an icon alone. */
42
46
  uniform?: boolean
43
47
  /** Takes the whole width. */
@@ -591,22 +595,38 @@ function ButtonBody({
591
595
  // its buttons on glass and its plain ones; the token alone gives the Regular of the plain button
592
596
  weight: theme.isIOS && variant !== "ghost" ? "medium" : base.weight,
593
597
  }
594
- const colors = barColors(theme, buttonColors(theme, color, variant, disabled, selected), { bar, prominent: accentAction, neutral, disabled, selected, flat: mobileMaterial === "flat" })
598
+ const barred = barColors(theme, buttonColors(theme, color, variant, disabled, selected), { bar, prominent: accentAction, neutral, disabled, selected, flat: mobileMaterial === "flat" })
599
+ // Clear glass over a photo, a video or a color: the kit's #f5f5f5 label in both themes, on iOS clear glass and on
600
+ // Android (no glass) its gray at 17%, a little more when pressed
601
+ const clear = mobileMaterial === "clear" && neutral && !bar
602
+ const clearLabel = clear ? theme.color("--mobile-glass-clear-label", "#f5f5f5") : ""
603
+ const colors: typeof barred = clear
604
+ ? {
605
+ ...barred,
606
+ text: disabled ? withAlpha(clearLabel, 0.4) : clearLabel,
607
+ pressedText: undefined,
608
+ background: theme.color("--mobile-glass-clear-background", "rgba(153, 153, 153, 0.17)"),
609
+ pressed: theme.color("--mobile-glass-clear-background-active", "rgba(153, 153, 153, 0.28)"),
610
+ border: undefined,
611
+ }
612
+ : barred
595
613
  // In a bar every neutral soft or ghost button is glass, as on iOS 26, unless it asks to stay flat or is selected.
596
614
  // A disabled glass button keeps its glass, as the phone CSS's
597
615
  const wantsGlass = bar ? mobileMaterial !== "flat" && neutral && !selected && !bar.inGroup : mobileMaterial === "glass" && neutral
598
- const glass = theme.isIOS && wantsGlass
616
+ const glass = theme.isIOS && (wantsGlass || clear)
599
617
  // On Android the same button stands on a glass of its own, as the Android bar circles: a see-through card with a
600
618
  // rim and a soft shadow (the glass of a plain bar)
601
619
  const card = theme.isAndroid && !!bar && !bar.plain && (wantsGlass || (accentAction && disabled && !bar.inGroup))
602
620
  const androidGlass = useAndroidGlass("bar", bar?.canvas)
603
621
  if (glass && !bar) {
604
- // The Liquid Glass text button of the iOS 27 kit: Medium (`--button-glass-font-weight`), 17/22 at md and lg
622
+ // The Liquid Glass text button of the iOS 27 kit: Medium (`--button-glass-font-weight`), 17/22 at md and lg, 12 a side
605
623
  const glassWeight = theme.length("--button-glass-font-weight", 510)
606
624
  metrics.weight = glassWeight >= 590 ? "semibold" : glassWeight >= 500 ? "medium" : "regular"
607
625
  if (size === "md" || size === "lg") {
608
626
  metrics.fontSize = theme.length("--button-glass-font-size", metrics.fontSize)
609
627
  metrics.lineHeight = theme.length("--button-glass-line-height", metrics.lineHeight)
628
+ // 12 each side, where a bordered medium button's Subheadline label takes 14
629
+ if (!gutterSize) metrics.gutter = theme.length("--button-glass-gutter", metrics.gutter)
610
630
  }
611
631
  }
612
632
  const nativeRipple = useMaterialPress(theme)
@@ -771,7 +791,7 @@ function ButtonBody({
771
791
  if (glass) {
772
792
  return (
773
793
  <Pressable {...pressable} style={[{ alignSelf: block ? "stretch" : "flex-start" }, style]}>
774
- <Glass interactive={!inert} elevation={bar?.raised ? "raised" : "regular"} radius={metrics.radius} fillToken={pressed && !inert ? "--mobile-glass-background-active" : undefined} style={[body, { borderRadius: metrics.radius }]}>
794
+ <Glass interactive={!inert} clear={clear} elevation={bar?.raised ? "raised" : "regular"} radius={metrics.radius} fillToken={pressed && !inert ? (clear ? "--mobile-glass-clear-background-active" : "--mobile-glass-background-active") : undefined} style={[body, { borderRadius: metrics.radius }]}>
775
795
  {content}
776
796
  </Glass>
777
797
  </Pressable>
@@ -928,6 +928,9 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
928
928
  // A picture wider than the tile (a photo, an avatar) keeps its own size: it starts at the row's inset, where the
929
929
  // header and the footer stand, and the text follows 14 past it, as UIKit's image to text padding
930
930
  const [wide, setWide] = useState(false)
931
+ // A picture taller than the tile (a 40 photo) keeps the cell's margins over and under it, 10 as UIKit's content
932
+ // configuration keeps them: a 40 photo makes a 60 row
933
+ const [tall, setTall] = useState(false)
931
934
  // In a List with `columns` a field's value starts at one column, 40% into the row (`--field-row-column-width`)
932
935
  // A switch, a checkbox and a radio stay at the row's edge
933
936
  const columns = useContext(ListOptionsContext)?.columns === true && trailing != null
@@ -950,11 +953,14 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
950
953
  style={[
951
954
  styles.tile,
952
955
  { minWidth: tile, minHeight: tile, marginStart: wide ? 0 : theme.length("--field-row-icon-offset", -2), marginEnd: theme.length("--field-row-icon-gap", 14) },
956
+ tall ? { marginVertical: theme.length("--field-row-picture-margin-block", 10) } : null,
953
957
  leadingColor ? { backgroundColor: leadingColor, borderRadius: theme.length("--field-row-icon-radius", 7) } : null,
954
958
  ]}
955
959
  onLayout={(event) => {
956
960
  const next = event.nativeEvent.layout.width > tile + 0.5
957
961
  if (next !== wide) setWide(next)
962
+ const taller = event.nativeEvent.layout.height > tile + 0.5
963
+ if (taller !== tall) setTall(taller)
958
964
  }}
959
965
  >
960
966
  <IconDefaultsProvider size={leadingColor ? 20 : theme.length("--field-row-icon-symbol-size", 24)} color={leadingColor ? "#ffffff" : disabled ? theme.colors.labelTertiary : theme.colors.accent}>
@@ -1070,6 +1076,9 @@ function AndroidContent({
1070
1076
  // A picture wider than the symbol's 24 (a photo, an avatar) keeps its own size from the rows' inset (21, where the
1071
1077
  // header and the footer stand), the text 16 past it, as Material's list item with a leading avatar; 0 for a symbol
1072
1078
  const [wide, setWide] = useState(0)
1079
+ // A picture taller than the symbol's 24 (a 40 avatar) keeps 8 over and under it, Material's list item with a leading
1080
+ // avatar: a 40 photo makes a 56 row
1081
+ const [tall, setTall] = useState(false)
1073
1082
  // The text (and the divider) 21 in, or 64 after a symbol, a tile or a choice's mark (its 20dp circle 22 in)
1074
1083
  const textStart = leading == null ? ANDROID_INSET : wide > 0 && !tile && !leadingMark ? ANDROID_INSET + wide + 16 : 64
1075
1084
  // A value that ends the row stands 17 from the end (a value row), 20 in a row with a tile (a tiled row)
@@ -1090,7 +1099,7 @@ function AndroidContent({
1090
1099
  <View style={styles.androidMark}>{leading}</View>
1091
1100
  ) : (
1092
1101
  <View
1093
- style={tile ? [styles.androidTile, { backgroundColor: leadingColor, opacity: disabled ? 0.5 : 1 }] : [styles.androidIcon, wide > 0 ? styles.androidWide : null]}
1102
+ style={tile ? [styles.androidTile, { backgroundColor: leadingColor, opacity: disabled ? 0.5 : 1 }] : [styles.androidIcon, wide > 0 ? styles.androidWide : null, tall ? styles.androidTall : null]}
1094
1103
  onLayout={
1095
1104
  tile
1096
1105
  ? undefined
@@ -1098,6 +1107,8 @@ function AndroidContent({
1098
1107
  const width = event.nativeEvent.layout.width
1099
1108
  const next = width > 24.5 ? width : 0
1100
1109
  if (Math.abs(next - wide) > 0.5) setWide(next)
1110
+ const taller = event.nativeEvent.layout.height > 24.5
1111
+ if (taller !== tall) setTall(taller)
1101
1112
  }
1102
1113
  }
1103
1114
  >
@@ -1198,6 +1209,7 @@ const styles = StyleSheet.create({
1198
1209
  androidFooterPlain: { paddingHorizontal: ANDROID_INSET },
1199
1210
  androidRow: { flexDirection: "row", alignItems: "center", minHeight: 50, paddingStart: ANDROID_INSET, paddingEnd: ANDROID_INSET },
1200
1211
  // A 24dp symbol at 20, a 28dp tile at 18 with a 24dp symbol, or a choice's 20dp mark at 22: the text at 64
1212
+ androidTall: { marginVertical: 8 },
1201
1213
  androidIcon: { minWidth: 24, minHeight: 24, alignItems: "center", justifyContent: "center", marginStart: -1, marginEnd: 20 },
1202
1214
  androidWide: { marginStart: 0, marginEnd: 16 },
1203
1215
  androidMark: { width: 20, alignItems: "center", justifyContent: "center", marginStart: 1, marginEnd: 22 },
@@ -286,26 +286,38 @@ function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check =
286
286
  const fitsBelow = below + height <= window.height - bottomEdge
287
287
  const above = over ? box.y + box.height - height : box.y - gap - height
288
288
  let top = size == null ? -window.height - 1000 : fitsBelow ? below : Math.max(topEdge, above)
289
- let previewTop = box.y
289
+ // A preview wider than the screen less 16 a side is scaled down about its middle to fit, as iOS 27.2 shrinks a
290
+ // lifted cell or card, and one that would cross the 16 is moved in: `seen` is where it shows
291
+ const fit = 16
292
+ const fitScale = context && box.width > window.width - fit * 2 ? (window.width - fit * 2) / box.width : 1
293
+ const seenWidth = box.width * fitScale
294
+ const seenHeight = box.height * fitScale
295
+ const seen = {
296
+ x: context && box.width > 0 ? Math.max(fit, Math.min(box.x + (box.width - seenWidth) / 2, window.width - fit - seenWidth)) : box.x,
297
+ y: box.y + (box.height - seenHeight) / 2,
298
+ width: seenWidth,
299
+ height: seenHeight,
300
+ }
301
+ let previewTop = seen.y
290
302
  if (context) {
291
303
  // iOS 27.2 places a context menu by where the element stands (ref-app menus-context): in the left third at its
292
304
  // left edge, in the right third at its right edge, else at its centre; 16 under it, or over it when the element
293
305
  // is in the lower half and the menu fits there (the web's ContextMenu, contextMenuPreview)
294
- const centre = box.x + box.width / 2
295
- left = centre < window.width / 3 ? box.x : centre > (window.width * 2) / 3 ? box.x + box.width - measured : centre - measured / 2
306
+ const centre = seen.x + seen.width / 2
307
+ left = centre < window.width / 3 ? seen.x : centre > (window.width * 2) / 3 ? seen.x + seen.width - measured : centre - measured / 2
296
308
  left = Math.max(margin, Math.min(left, window.width - measured - margin))
297
309
  const lift = 16
298
- const overIt = box.y - lift - height
299
- const underIt = box.y + box.height + lift
300
- const lower = box.y + box.height / 2 > window.height / 2
310
+ const overIt = seen.y - lift - height
311
+ const underIt = seen.y + seen.height + lift
312
+ const lower = seen.y + seen.height / 2 > window.height / 2
301
313
  if (size != null) {
302
314
  if (lower && overIt >= topEdge) top = overIt
303
315
  else {
304
316
  // Where the menu does not fit under the element it lifts the element up with it, as iOS moves the preview, so
305
317
  // the menu never covers it
306
318
  const overflow = underIt + height - (window.height - bottomEdge)
307
- previewTop = overflow > 0 ? Math.max(topEdge, box.y - overflow) : box.y
308
- top = Math.max(topEdge, Math.min(previewTop + box.height + lift, window.height - bottomEdge - height))
319
+ previewTop = overflow > 0 ? Math.max(topEdge, seen.y - overflow) : seen.y
320
+ top = Math.max(topEdge, Math.min(previewTop + seen.height + lift, window.height - bottomEdge - height))
309
321
  }
310
322
  }
311
323
  }
@@ -404,11 +416,13 @@ function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check =
404
416
  pointerEvents="none"
405
417
  style={[
406
418
  styles.preview,
407
- swap ? { right: box.x } : { left: box.x },
419
+ // Drawn at its own size and scaled about its middle onto where it is seen
420
+ swap ? { right: seen.x + (seen.width - box.width) / 2 } : { left: seen.x + (seen.width - box.width) / 2 },
408
421
  {
409
- top: previewTop,
422
+ top: previewTop + (seen.height - box.height) / 2,
410
423
  width: box.width,
411
424
  height: box.height,
425
+ transform: fitScale < 1 ? [{ scale: fitScale }] : undefined,
412
426
  borderRadius: context.radius,
413
427
  backgroundColor: theme.colors.groupedSurface,
414
428
  boxShadow: String(theme.token("--context-menu-preview-shadow") ?? "0 0 32px rgba(0, 0, 0, 0.2)"),
@@ -1,5 +1,5 @@
1
1
  import { cloneElement, isValidElement, useState, type ReactElement, type ReactNode } from "react"
2
- import { StyleSheet, View, useWindowDimensions, type GestureResponderEvent, type StyleProp, type ViewStyle } from "react-native"
2
+ import { ActivityIndicator, StyleSheet, View, useWindowDimensions, type GestureResponderEvent, type StyleProp, type ViewStyle } from "react-native"
3
3
  import { Pressable } from "../../internal/Pressable"
4
4
  import Svg, { Path } from "react-native-svg"
5
5
  import X from "../../icons/plex/X"
@@ -7,7 +7,7 @@ import { flattenChildren, isRenderable, textOf } from "../../internal/children"
7
7
  import { FloatingPanel } from "../../internal/FloatingPanel"
8
8
  import { anchorProps, type FloatingAlign, type FloatingSide } from "../../internal/floating"
9
9
  import { Glass } from "../../internal/Glass"
10
- import { accentText, barSurface, controlHighlight, dangerText, elevationShadow } from "../../theme/material"
10
+ import { accentText, barSurface, controlHighlight, dangerText, elevationShadow, withAlpha } from "../../theme/material"
11
11
  import { useTheme } from "../../theme/ThemeProvider"
12
12
  import type { Theme } from "../../theme/types"
13
13
  import { Button, type ButtonColor, type ButtonProps } from "../Button/Button"
@@ -116,6 +116,9 @@ function TipBody({ title, description, icon, actions, mobileActions = "rows", on
116
116
  const closable = onClose != null
117
117
  const descriptionColor = android ? theme.colors.textSecondary : theme.color("--tip-description-color", theme.colors.textSecondary)
118
118
  const paddingBottom = !hasActions ? m.bottomNone : buttons ? m.bottomButtons : m.bottomRows
119
+ // iOS's tip with button actions is TipKit's mini tip (its kit's Hint View): 22 over the title, 4 between the title
120
+ // and the message, 22 from the words to the action and 16 under it
121
+ const miniTip = !android && hasActions && buttons
119
122
  const textStart = hasIcon ? m.iconFrame + m.iconGap : 0
120
123
  return (
121
124
  <View
@@ -126,11 +129,11 @@ function TipBody({ title, description, icon, actions, mobileActions = "rows", on
126
129
  styles.tip,
127
130
  {
128
131
  borderRadius: m.radius,
129
- paddingTop: m.top,
132
+ paddingTop: miniTip ? 22 : m.top,
130
133
  paddingHorizontal: m.inline,
131
134
  paddingBottom,
132
135
  columnGap: m.iconGap,
133
- rowGap: hasActions && buttons ? m.gapButtons : m.gap,
136
+ rowGap: miniTip ? 22 : hasActions && buttons ? m.gapButtons : m.gap,
134
137
  backgroundColor: background ?? theme.colors.groupedSurface,
135
138
  },
136
139
  style,
@@ -148,7 +151,7 @@ function TipBody({ title, description, icon, actions, mobileActions = "rows", on
148
151
  <Text variant="headline">{title}</Text>
149
152
  {isRenderable(description) ? (
150
153
  <TextColorProvider value={descriptionColor}>
151
- <Text variant="subheadline" color={descriptionColor} style={android ? styles.androidDescription : null}>
154
+ <Text variant="subheadline" color={descriptionColor} style={android ? styles.androidDescription : miniTip ? styles.miniDescription : null}>
152
155
  {description}
153
156
  </Text>
154
157
  </TextColorProvider>
@@ -182,19 +185,68 @@ function TipBody({ title, description, icon, actions, mobileActions = "rows", on
182
185
  )
183
186
  }
184
187
 
185
- /** An action as a capsule across the tip, its Button's color and variant kept: 48 tall on iOS, 40dp on Android. */
188
+ /**
189
+ * An action as a capsule across the tip. On iOS it is TipKit's action (the kit's Hint View): 50 tall, a 17 Semibold
190
+ * label in the action's color (the accent for a primary one) on that color at 8% over the gray fill at 8%. On Android
191
+ * the Button keeps its color and variant, a 40dp capsule.
192
+ */
186
193
  function ActionButton({ item }: { item: ReactNode }) {
187
194
  const theme = useTheme()
188
195
  if (!isValidElement(item) || item.type !== Button) return <>{item}</>
189
196
  const button = item as ReactElement<ButtonProps>
190
- return cloneElement(button, {
191
- size: theme.isAndroid ? "lg" : "xl",
192
- pill: true,
193
- block: true,
194
- style: [button.props.style, theme.isAndroid ? null : { minHeight: 48 }],
195
- })
197
+ if (theme.isAndroid) return cloneElement(button, { size: "lg", pill: true, block: true })
198
+ // The Button's look props stay here; its handlers, ref and accessibility props pass on to the capsule
199
+ /* eslint-disable @typescript-eslint/no-unused-vars */
200
+ const {
201
+ color = "primary",
202
+ children,
203
+ disabled = false,
204
+ loading = false,
205
+ inert: inertProp = loading,
206
+ variant,
207
+ size,
208
+ pill,
209
+ shape,
210
+ mobileMaterial,
211
+ uniform,
212
+ block,
213
+ labelLines,
214
+ selected,
215
+ iconSize,
216
+ gutterSize,
217
+ opticallyAlign,
218
+ style,
219
+ accessibilityState,
220
+ ...pressable
221
+ } = button.props
222
+ /* eslint-enable @typescript-eslint/no-unused-vars */
223
+ // As the Button: a loading or inert action takes no presses and keeps its look; a disabled one dims
224
+ const inert = disabled || inertProp
225
+ const ink = color === "primary" ? theme.colors.accent : theme.color(`--color-text-${color}-ghost`, theme.colors.accent)
226
+ return (
227
+ <Pressable
228
+ accessibilityRole="button"
229
+ {...pressable}
230
+ accessibilityState={{ ...accessibilityState, disabled: inert, busy: loading }}
231
+ aria-busy={loading}
232
+ disabled={inert}
233
+ style={({ pressed }) => [styles.miniAction, { backgroundColor: MINI_GRAY, opacity: disabled ? 0.4 : 1 }, pressed && !inert ? styles.pressed : null]}
234
+ >
235
+ <View pointerEvents="none" style={[StyleSheet.absoluteFill, styles.miniActionTint, { backgroundColor: withAlpha(ink, 0.08) }]} />
236
+ {loading ? (
237
+ <ActivityIndicator color={ink} />
238
+ ) : (
239
+ <Text variant="body" weight="semibold" numberOfLines={2} style={styles.miniLabel} color={ink}>
240
+ {children as ReactNode}
241
+ </Text>
242
+ )}
243
+ </Pressable>
244
+ )
196
245
  }
197
246
 
247
+ /** The gray under a TipKit action's tint: the kit's rgba(116, 116, 128, 0.08). */
248
+ const MINI_GRAY = "rgba(116, 116, 128, 0.08)"
249
+
198
250
  /**
199
251
  * An action as a row of text in its Button's color under a separator, 46 tall, as iOS tips list them; on Android a
200
252
  * text button in the accent, as Material 3's rich tooltip sets its actions. Other elements stand as given.
@@ -398,6 +450,10 @@ const styles = StyleSheet.create({
398
450
  androidDescription: { marginTop: 2 },
399
451
  actions: { flexBasis: "100%", flexGrow: 1, flexDirection: "column" },
400
452
  buttons: { gap: 10 },
453
+ miniDescription: { marginTop: 4 },
454
+ miniAction: { minHeight: 50, paddingHorizontal: 20, paddingVertical: 14, borderRadius: 25, borderCurve: "continuous", alignItems: "center", justifyContent: "center", overflow: "hidden" },
455
+ miniActionTint: { borderRadius: 25 },
456
+ miniLabel: { lineHeight: 18, textAlign: "center" },
401
457
  androidActions: { flexDirection: "row", flexWrap: "wrap", gap: 8 },
402
458
  row: { minHeight: 46, paddingVertical: 12, borderTopWidth: 1, justifyContent: "center" },
403
459
  androidRow: { alignSelf: "flex-start", minHeight: 40, paddingHorizontal: 12, borderRadius: 20, justifyContent: "center" },
package/src/index.ts CHANGED
@@ -87,7 +87,7 @@ export { ContextMenu, type ContextMenuContentProps, type ContextMenuProps } from
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"
90
- export { BottomSheet, type BottomSheetFooterProps, type BottomSheetProps } from "./components/BottomSheet/BottomSheet"
90
+ export { BottomSheet, type BottomSheetFooterProps, type BottomSheetHero, type BottomSheetHeroTone, type BottomSheetProps } from "./components/BottomSheet/BottomSheet"
91
91
  export { Dialog, type DialogAction, type DialogProps } from "./components/Dialog/Dialog"
92
92
  export { Toaster, toast, type ToasterProps, type ToastId, type ToastOptions, type ToastT, type ToastType } from "./components/Toast/Toast"
93
93
 
@@ -13,6 +13,12 @@ export type GlassProps = ViewProps & {
13
13
  tint?: string
14
14
  /** Native glass reacts to touches (iOS 26 interactive glass). */
15
15
  interactive?: boolean
16
+ /**
17
+ * iOS 26's clear glass, for controls over a photo, a video or a color: native `.clear` glass on iOS 26, elsewhere
18
+ * the kit's clear fill (`--mobile-glass-clear-background`, gray 153 at 17%) with a light blur, a 0.5 rim and a
19
+ * faint shadow (`--mobile-glass-clear-*`), the same in light and dark: what is under it decides how it reads.
20
+ */
21
+ clear?: boolean
16
22
  /** A fill token for the glass instead of `--mobile-glass-background` (menus, alerts and toasts set their own). */
17
23
  fillToken?: string
18
24
  /**
@@ -116,6 +122,12 @@ const lensMask = (width: number, height: number, radius: number) => {
116
122
  return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`
117
123
  }
118
124
 
125
+ /** The clear glass where its tokens are not set: the kit's gray 153 at 17% over a light blur. */
126
+ const CLEAR_FILL = "rgba(153, 153, 153, 0.17)"
127
+ const CLEAR_FILTER = "blur(4px) brightness(1.08)"
128
+ /** Clear glass with no blur (Reduce Transparency, no blur module): a dark gray, as the clear glass over a dark photo. */
129
+ const CLEAR_OPAQUE = "#3a3a3c"
130
+
119
131
  /** The filter and the shadow of the glass surfaces of the phone layer, by their fill (mobile-materials.css, touch.css). */
120
132
  const SURFACES: Record<string, { filter: string; shadow: string }> = {
121
133
  "--menu-mobile-background": { filter: "--menu-mobile-backdrop-filter", shadow: "--menu-shadow" },
@@ -141,6 +153,7 @@ export function Glass({
141
153
  elevation = "regular",
142
154
  tint,
143
155
  interactive,
156
+ clear = false,
144
157
  fillToken,
145
158
  filterToken,
146
159
  shadowToken,
@@ -156,7 +169,7 @@ export function Glass({
156
169
  const overrides = useThemeOverrides()
157
170
  const shape: ViewStyle = { borderRadius: radius, borderCurve: "continuous" }
158
171
  const surface = fillToken ? SURFACES[fillToken] : undefined
159
- const shadow = theme.token(shadowToken ?? surface?.shadow ?? (elevation === "raised" ? "--mobile-glass-shadow-raised" : "--mobile-glass-shadow"))
172
+ const shadow = theme.token(shadowToken ?? surface?.shadow ?? (clear ? "--mobile-glass-clear-shadow" : elevation === "raised" ? "--mobile-glass-shadow-raised" : "--mobile-glass-shadow"))
160
173
  const boxShadow = typeof shadow === "string" ? shadow : undefined
161
174
  const native = liquidGlassModule()
162
175
  // iOS 26's own glass turns frostier by itself with Reduce Transparency
@@ -165,7 +178,7 @@ export function Glass({
165
178
  return (
166
179
  <GlassView
167
180
  {...rest}
168
- glassEffectStyle="regular"
181
+ glassEffectStyle={clear ? "clear" : "regular"}
169
182
  colorScheme={theme.scheme}
170
183
  tintColor={tint}
171
184
  isInteractive={interactive}
@@ -176,8 +189,8 @@ export function Glass({
176
189
  )
177
190
  }
178
191
  const web = Platform.OS === "web"
179
- const fillName = fillToken ?? "--mobile-glass-background"
180
- const filterName = filterToken ?? surface?.filter ?? "--mobile-glass-backdrop-filter"
192
+ const fillName = fillToken ?? (clear ? "--mobile-glass-clear-background" : "--mobile-glass-background")
193
+ const filterName = filterToken ?? surface?.filter ?? (clear ? "--mobile-glass-clear-backdrop-filter" : "--mobile-glass-backdrop-filter")
181
194
  const dense = web && !theme.isAndroid ? WEB_DENSE[fillName] : undefined
182
195
  const denseFill = dense != null && tint == null && overrides?.[fillName] == null
183
196
  // Glass with a fill of its own and the plain glass's filter (the large segmented control) blurs as the plain glass
@@ -185,9 +198,9 @@ export function Glass({
185
198
  const plainFilter = web && !theme.isAndroid && dense == null && filterToken == null && filterName === "--mobile-glass-backdrop-filter" && overrides?.[filterName] == null
186
199
  const denseFilter = (dense != null && filterToken == null && overrides?.[filterName] == null) || plainFilter
187
200
  const webFilter = dense ?? WEB_DENSE["--mobile-glass-background"]
188
- const fill = tint ?? (denseFill ? theme.color(dense.fill, theme.scheme === "dark" ? dense.dark : dense.light) : theme.color(fillName))
201
+ const fill = tint ?? (denseFill ? theme.color(dense.fill, theme.scheme === "dark" ? dense.dark : dense.light) : theme.color(fillName, clear ? CLEAR_FILL : undefined))
189
202
  const filterValue = denseFilter ? (theme.token(webFilter.filter) ?? webFilter.blur) : theme.token(filterName)
190
- const filter = blur != null ? `blur(${blur}px)` : typeof filterValue === "string" ? filterValue : "blur(12px)"
203
+ const filter = blur != null ? `blur(${blur}px)` : typeof filterValue === "string" ? filterValue : clear ? CLEAR_FILTER : "blur(12px)"
191
204
  const module = web || Platform.OS !== "ios" ? null : blurModule()
192
205
  const opaque = reduceTransparency || (!web && module == null)
193
206
  if (web && !opaque) {
@@ -243,11 +256,12 @@ export function Glass({
243
256
  <View {...rest} style={[shape, { boxShadow }, style]}>
244
257
  <View style={[StyleSheet.absoluteFill, shape, { overflow: "hidden" }]} pointerEvents="none">
245
258
  {opaque ? (
246
- <View style={[StyleSheet.absoluteFill, { backgroundColor: theme.color("--mobile-surface-elevated-plain-primary", theme.colors.surfaceElevated) }]} />
259
+ // Clear glass carries a light label over a photo or a color: opaque, it stands on a dark gray so the label reads
260
+ <View style={[StyleSheet.absoluteFill, { backgroundColor: clear ? theme.color("--mobile-glass-clear-opaque-background", CLEAR_OPAQUE) : theme.color("--mobile-surface-elevated-plain-primary", theme.colors.surfaceElevated) }]} />
247
261
  ) : module ? (
248
262
  <module.BlurView
249
263
  intensity={intensityOf(radiusPx)}
250
- tint={theme.scheme === "dark" ? "systemChromeMaterialDark" : "systemChromeMaterialLight"}
264
+ tint={clear ? "systemUltraThinMaterial" : theme.scheme === "dark" ? "systemChromeMaterialDark" : "systemChromeMaterialLight"}
251
265
  style={StyleSheet.absoluteFill}
252
266
  />
253
267
  ) : null}