@plexui/react-native 0.2.23 → 0.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/es/components/BottomActions/BottomActions.js +6 -1
  2. package/dist/es/components/BottomSheet/BottomSheet.js +5 -0
  3. package/dist/es/components/Button/Button.js +12 -22
  4. package/dist/es/components/Checkbox/Checkbox.js +4 -2
  5. package/dist/es/components/Chip/Chip.js +8 -7
  6. package/dist/es/components/List/List.js +15 -6
  7. package/dist/es/components/RadioGroup/RadioGroup.js +5 -3
  8. package/dist/es/components/Switch/Switch.js +4 -2
  9. package/dist/es/components/Toast/Toast.js +4 -3
  10. package/dist/es/icons/plex/VerifiedFilled.js +3 -0
  11. package/dist/es/icons/plex/index.js +1 -0
  12. package/dist/es/internal/row.js +27 -0
  13. package/dist/types/components/Button/Button.d.ts +1 -1
  14. package/dist/types/components/Chip/Chip.d.ts +5 -1
  15. package/dist/types/components/List/List.d.ts +6 -1
  16. package/dist/types/components/RadioGroup/RadioGroup.d.ts +5 -1
  17. package/dist/types/icons/plex/VerifiedFilled.d.ts +2 -0
  18. package/dist/types/icons/plex/index.d.ts +1 -0
  19. package/dist/types/internal/row.d.ts +49 -0
  20. package/package.json +1 -1
  21. package/src/components/BottomActions/BottomActions.tsx +9 -1
  22. package/src/components/BottomSheet/BottomSheet.tsx +5 -0
  23. package/src/components/Button/Button.tsx +12 -22
  24. package/src/components/Checkbox/Checkbox.tsx +4 -1
  25. package/src/components/Chip/Chip.tsx +17 -5
  26. package/src/components/List/List.tsx +25 -11
  27. package/src/components/RadioGroup/RadioGroup.tsx +9 -2
  28. package/src/components/Switch/Switch.tsx +4 -1
  29. package/src/components/Toast/Toast.tsx +8 -3
  30. package/src/icons/plex/VerifiedFilled.ts +4 -0
  31. package/src/icons/plex/index.ts +1 -0
  32. package/src/internal/row.ts +36 -0
@@ -33,12 +33,17 @@ export function BottomActions({ children, floating = false, background = "soft",
33
33
  ? { variant: "ghost", color: props.color ?? "secondary" }
34
34
  : { variant: "soft", color: props.color ?? "secondary", mobileMaterial: props.mobileMaterial ?? "glass" }
35
35
  : null;
36
- return cloneElement(child, {
36
+ const button = cloneElement(child, {
37
37
  ...second,
38
38
  block: props.block ?? true,
39
39
  size: props.size ?? "3xl",
40
40
  style: [{ minHeight: height, borderRadius: height / 2 }, props.style],
41
41
  });
42
+ // A disabled button's fill is see-through (the gray of iOS's disabled button): floating over the content it stands
43
+ // on the screen's color, so the rows under it do not show through
44
+ if (!floating || !props.disabled || android)
45
+ return button;
46
+ return (_jsx(View, { style: { borderRadius: height / 2, backgroundColor: canvas, alignSelf: (props.block ?? true) ? "stretch" : "flex-start" }, children: button }, child.key ?? index));
42
47
  });
43
48
  return (_jsxs(View, { testID: testID, pointerEvents: "box-none", style: [styles.bar, { paddingHorizontal: side, paddingTop, paddingBottom: bottom, gap: 8 }, floating ? styles.floating : null, style], children: [floating ? (android ? (_jsx(SoftBottomEdge, { fill: withAlpha(canvas, ANDROID_FADE_ALPHA), top: paddingTop - 13 + 60, tail: 60, blur: 0, stops: ANDROID_FADE_STOPS })) : background === "fade" ? (_jsx(TabBarFade, { fill: canvas, top: paddingTop })) : (_jsx(SoftBottomEdge, { fill: canvas, top: paddingTop, tail: 27, blur: theme.length("--toolbar-edge-blur-small", 3) }))) : null, actions] }));
44
49
  }
@@ -175,6 +175,8 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
175
175
  const [drag] = useState(() => new Animated.Value(0));
176
176
  const close = () => onOpenChange(false);
177
177
  const android = theme.isAndroid;
178
+ // Android's content and actions 12 from the sheet's sides, as a page's groups; a token for a screen at another gutter
179
+ const androidInline = theme.length("--bottom-sheet-android-padding-inline", 12);
178
180
  const reduced = theme.reducedMotion;
179
181
  // One responder for the sheet's life, told the latest props after each render: a responder made again mid-drag
180
182
  // would lose the drag
@@ -278,6 +280,8 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
278
280
  android
279
281
  ? [
280
282
  styles.androidContent,
283
+ // A screen whose gutter is Material's compact 16 sets it with --bottom-sheet-android-padding-inline
284
+ { paddingHorizontal: androidInline },
281
285
  title != null ? styles.androidContentUnderBar : null,
282
286
  // Over a footer: 8 above its height, which reaches over the sheet's bottom padding
283
287
  footer ? { paddingBottom: 8 + Math.max(0, footerHeight - insets.bottom - keyboard) } : null,
@@ -288,6 +292,7 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
288
292
  android
289
293
  ? [
290
294
  styles.androidFooter,
295
+ { paddingHorizontal: androidInline },
291
296
  // Over the sheet's color at 80%, faded in over its top 24dp, down over the gesture bar
292
297
  { paddingBottom: 12 + insets.bottom + keyboard, backgroundImage: `linear-gradient(to bottom, ${withAlpha(background, 0)}, ${withAlpha(background, 0.8)} 24px)` },
293
298
  ]
@@ -81,13 +81,17 @@ function iosPress(theme, variant, colors) {
81
81
  const pressed = variant === "solid" ? lighten(theme, colors.background) : variant === "ghost" ? colors.background : withAlpha(colors.background, 0.7);
82
82
  return { ...colors, pressed, pressedText: lighten(theme, colors.text) };
83
83
  }
84
- export function buttonColors(theme, color, variant, disabled, selected, uniform = false) {
84
+ export function buttonColors(theme, color, variant, disabled, selected) {
85
85
  const c = (name) => theme.color(`--color-${name}`);
86
86
  if (disabled) {
87
87
  if (theme.isAndroid) {
88
- // Android dims a disabled button's label to half and keeps its fill
89
- const enabled = buttonColors(theme, color, variant, false, selected, uniform);
90
- return { ...enabled, pressed: enabled.background, text: withAlpha(enabled.text, 0.5) };
88
+ // Material 3's disabled button: the container the on-surface color at 12% (a filled or a tonal one; none for a
89
+ // text button, an outlined one's outline at 12%), the label at 38%, whatever the button's color, so it reads as
90
+ // disabled on a dark surface too
91
+ const onSurface = theme.material.onSurface;
92
+ const veil = withAlpha(onSurface, 0.12);
93
+ const flat = variant === "ghost" || variant === "outline";
94
+ return { background: flat ? "transparent" : veil, pressed: flat ? "transparent" : veil, text: withAlpha(onSurface, 0.38), border: variant === "outline" ? veil : undefined };
91
95
  }
92
96
  // The phone CSS: the tertiary label in every style (iOS 27's disabled content-area button), the fill of a gray
93
97
  // button behind a solid or soft one
@@ -355,7 +359,7 @@ function ButtonBody({ color = "primary", variant = "solid", size = "md", shape =
355
359
  // its buttons on glass and its plain ones; the token alone gives the Regular of the plain button
356
360
  weight: theme.isIOS && variant !== "ghost" ? "medium" : base.weight,
357
361
  };
358
- const colors = barColors(theme, buttonColors(theme, color, variant, disabled, selected, uniform), { bar, prominent: accentAction, neutral, disabled, selected, flat: mobileMaterial === "flat" });
362
+ const colors = barColors(theme, buttonColors(theme, color, variant, disabled, selected), { bar, prominent: accentAction, neutral, disabled, selected, flat: mobileMaterial === "flat" });
359
363
  // In a bar every neutral soft or ghost button is glass, as on iOS 26, unless it asks to stay flat or is selected.
360
364
  // A disabled glass button keeps its glass, as the phone CSS's
361
365
  const wantsGlass = bar ? mobileMaterial !== "flat" && neutral && !selected && !bar.inGroup : mobileMaterial === "glass" && neutral;
@@ -432,22 +436,8 @@ function ButtonBody({ color = "primary", variant = "solid", size = "md", shape =
432
436
  const background = pressed && theme.isIOS ? colors.pressed : colors.background;
433
437
  // A glass button keeps its own press: only its glass changes
434
438
  const text = pressed && !inert && theme.isIOS && !glass && colors.pressedText ? colors.pressedText : colors.text;
435
- // Android fades a button on its own between enabled and disabled in 300ms on its default curve: its fill stays and
436
- // its label goes to half, so the label keeps its enabled color under an opacity. A bar's buttons change at once
437
- const fades = android && !bar;
438
- const ink = fades && disabled ? buttonColors(theme, color, variant, false, selected, uniform).text : text;
439
- const [dim] = useState(() => new Animated.Value(fades && disabled ? 0.5 : 1));
440
- useEffect(() => {
441
- const to = fades && disabled ? 0.5 : 1;
442
- if (still || !fades) {
443
- dim.stopAnimation();
444
- dim.setValue(to);
445
- return;
446
- }
447
- const animation = Animated.timing(dim, { toValue: to, duration: 300, easing: curves.accelerateDecelerate, useNativeDriver: false });
448
- animation.start();
449
- return () => animation.stop();
450
- }, [dim, disabled, fades, still]);
439
+ // Material 3's disabled label is the on-surface color at 38% (buttonColors), drawn as it is
440
+ const ink = text;
451
441
  // Android's loading, both ways in 320ms on an ease-out quint: the label rises 24dp, flattens to 60% toward the
452
442
  // button's top and fades out, as the spinner rises 24dp into its place and fades in
453
443
  const [swap] = useState(() => new Animated.Value(loading ? 1 : 0));
@@ -506,7 +496,7 @@ function ButtonBody({ color = "primary", variant = "solid", size = "md", shape =
506
496
  // The label scales from the button's top edge: on Android its row spans the button's height
507
497
  const labelMotion = android
508
498
  ? {
509
- opacity: Animated.multiply(dim, swap.interpolate({ inputRange: [0, 1], outputRange: [1, 0] })),
499
+ opacity: swap.interpolate({ inputRange: [0, 1], outputRange: [1, 0] }),
510
500
  transform: [{ translateY: swap.interpolate({ inputRange: [0, 1], outputRange: [0, -24] }) }, { scaleY: swap.interpolate({ inputRange: [0, 1], outputRange: [1, 0.6] }) }],
511
501
  }
512
502
  : { opacity: loading ? 0 : 1 };
@@ -7,7 +7,7 @@ import CheckMd from "../../icons/plex/CheckMd";
7
7
  import Minus from "../../icons/plex/Minus";
8
8
  import { spaceToggles, useDescription } from "../../internal/a11y";
9
9
  import { ControlLabel, controlLabelLine } from "../../internal/ControlLabel";
10
- import { RowEndContext, RowHoldContext, RowStartContext, rowHold } from "../../internal/row";
10
+ import { RowActionContext, RowEndContext, RowHoldContext, RowStartContext, holdProps, rowHold } from "../../internal/row";
11
11
  import { androidGray, withAlpha } from "../../theme/material";
12
12
  import { useTheme } from "../../theme/ThemeProvider";
13
13
  import { ANDROID_ROW_END, iosCheckmarkColor, selectionColor } from "../Switch/Switch";
@@ -35,6 +35,8 @@ export function Checkbox({ checked: checkedProp, defaultChecked = false, onCheck
35
35
  const atRowStart = useContext(RowStartContext) && label == null && description == null;
36
36
  const inRow = useContext(RowEndContext) != null && label == null && description == null && !atRowStart;
37
37
  const hold = useContext(RowHoldContext);
38
+ // A row's touch and hold, held here, where the row's touches and its screen reader focus are
39
+ const rowAction = useContext(RowActionContext);
38
40
  const [own, setOwn] = useState(defaultChecked);
39
41
  const state = checkedProp ?? own;
40
42
  const on = state !== false;
@@ -124,7 +126,7 @@ export function Checkbox({ checked: checkedProp, defaultChecked = false, onCheck
124
126
  const targetSize = theme.isAndroid ? 48 : theme.length("--checkbox-target-size", 44);
125
127
  const described = useDescription(description);
126
128
  const text = _jsx(ControlLabel, { label: label, description: description, disabled: disabled, descriptionId: described.id });
127
- return (_jsxs(Pressable, { ...described.props, ...spaceToggles(toggle), accessibilityRole: "checkbox", accessibilityLabel: accessibilityLabel ?? (typeof label === "string" ? label : undefined), accessibilityState: { checked: state === "indeterminate" ? "mixed" : state, disabled }, "aria-checked": state === "indeterminate" ? "mixed" : state, "aria-invalid": invalid || undefined, disabled: disabled, ...rowHold(hold), onPress: toggle, testID: testID, style: [
129
+ return (_jsxs(Pressable, { ...described.props, ...spaceToggles(toggle), accessibilityRole: "checkbox", accessibilityLabel: accessibilityLabel ?? (typeof label === "string" ? label : undefined), accessibilityState: { checked: state === "indeterminate" ? "mixed" : state, disabled }, "aria-checked": state === "indeterminate" ? "mixed" : state, "aria-invalid": invalid || undefined, disabled: disabled, ...rowHold(hold), ...holdProps({}, inRow || atRowStart ? rowAction : null), onPress: toggle, testID: testID, style: [
128
130
  styles.row,
129
131
  hasText ? styles.top : null,
130
132
  // Android's gap is in the target's margins
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { holdProps } from "../../internal/row";
2
3
  import { useEffect, useState } from "react";
3
4
  import { Animated, Easing, Platform, StyleSheet, View } from "react-native";
4
5
  import { Pressable } from "../../internal/Pressable";
@@ -21,7 +22,7 @@ import { Text, textStyle } from "../Text/Text";
21
22
  */
22
23
  /** The chosen token's way to let go, so that choosing another lets it go */
23
24
  let disarmToken = null;
24
- export function Chip({ children, selected: selectedProp, defaultSelected, onSelectedChange, onPress, icon, trailingIcon, menu, expanded, accessibilityLabel, appearance = "tag", onRemove, removeLabel = "Remove", removeStyle = "token", disabled = false, testID, style, }) {
25
+ export function Chip({ children, selected: selectedProp, defaultSelected, onSelectedChange, onPress, icon, trailingIcon, menu, expanded, accessibilityLabel, appearance = "tag", onRemove, removeLabel = "Remove", removeStyle = "token", onLongPress, longPressLabel, disabled = false, testID, style, }) {
25
26
  const theme = useTheme();
26
27
  const [own, setOwn] = useState(defaultSelected ?? false);
27
28
  // iOS's token: an input chip with no cross, chosen by a first press and removed by a second (or by Delete); it is
@@ -147,7 +148,7 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
147
148
  const body = (_jsxs(_Fragment, { children: [leading != null ? (_jsx(View, { children: _jsx(IconDefaultsProvider, { size: iconSize, color: leadingColor, children: leading }) })) : null, symbolOnly ? null : android ? (
148
149
  // Text's own face and tracking, in a color that blends
149
150
  _jsx(Animated.Text, { numberOfLines: 1, selectable: false, style: [textStyle(theme, { weight: "regular" }), { fontSize: label.fontSize, lineHeight: label.lineHeight, letterSpacing: theme.tracking(label.fontSize), color: labelPaint }], children: children })) : (_jsx(Text, { color: color, weight: "regular", numberOfLines: 1, selectable: false, style: { fontSize: label.fontSize, lineHeight: label.lineHeight }, children: children })), trailing != null ? (_jsx(View, { children: _jsx(IconDefaultsProvider, { size: iconSize, color: leadingColor, children: trailing }) })) : null] }));
150
- const interactive = filter || !!onPress || token;
151
+ const interactive = filter || !!onPress || !!onLongPress || token;
151
152
  // Android dims a disabled chip, its fill with it, to half (as its other disabled controls)
152
153
  const dim = android && disabled ? styles.dim : null;
153
154
  const handlers = {
@@ -172,11 +173,6 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
172
173
  // A token: VoiceOver's action and a keyboard's Delete remove it; leaving it lets the selection go
173
174
  ...(token
174
175
  ? {
175
- accessibilityActions: [{ name: "delete", label: removeLabel }],
176
- onAccessibilityAction: (event) => {
177
- if (event.nativeEvent.actionName === "delete" && !disabled)
178
- onRemove?.();
179
- },
180
176
  onBlur: () => armed && setArmed(false),
181
177
  onKeyDown: (event) => {
182
178
  if ((event.nativeEvent.key === "Backspace" || event.nativeEvent.key === "Delete") && !disabled)
@@ -185,6 +181,11 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
185
181
  "aria-keyshortcuts": "Delete Backspace",
186
182
  }
187
183
  : {}),
184
+ // A token's delete action for VoiceOver, and a hold of its own (what a word means), named for a screen reader
185
+ ...holdProps({ run: disabled ? undefined : onLongPress, label: longPressLabel }, null, token ? [{ name: "delete", label: removeLabel }] : [], (event) => {
186
+ if (event.nativeEvent.actionName === "delete" && !disabled)
187
+ onRemove?.();
188
+ }),
188
189
  onPressIn: () => setPressed(true),
189
190
  onPressOut: () => setPressed(false),
190
191
  };
@@ -9,7 +9,7 @@ import { useRipple } from "../../internal/ripple";
9
9
  import { flattenChildren, textOf } from "../../internal/children";
10
10
  import { cssBox } from "../../internal/cssBox";
11
11
  import { mirrored, useRTL } from "../../internal/direction";
12
- import { RowEndContext, RowFrameContext, RowHoldContext, RowStartContext } from "../../internal/row";
12
+ import { RowActionContext, RowEndContext, RowFrameContext, RowHoldContext, RowStartContext, holdProps } from "../../internal/row";
13
13
  import { accentText, controlHighlight, dangerText, divider, withAlpha } from "../../theme/material";
14
14
  import { useTheme } from "../../theme/ThemeProvider";
15
15
  import { Button, ListActionContext } from "../Button/Button";
@@ -62,6 +62,8 @@ export function List({ children, header, description, footer, error, surface = "
62
62
  .map((row) => (row.type === Button ? _jsx(ActionRow, { children: row }, row.key ?? undefined) : row));
63
63
  const options = useMemo(() => ({ columns }), [columns]);
64
64
  const increased = headerProminence === "increased";
65
+ // Android's footer 13 into the card's width, as the Settings app; a token for a screen that keeps text at its gutter
66
+ const footerInset = theme.length("--list-android-footer-inset", 13);
65
67
  const fill = surface === "plain" ? theme.color("--field-group-background", theme.colors.surfaceSecondary) : theme.colors.groupedSurface;
66
68
  // The card's corners: Android's 16dp card (a header or description inside it stands over the first row), iOS's group
67
69
  const corner = surface === "plain" && theme.isAndroid ? 0 : theme.isAndroid ? ANDROID_CARD_RADIUS : theme.length("--field-group-radius", 26);
@@ -78,7 +80,7 @@ export function List({ children, header, description, footer, error, surface = "
78
80
  // too), and its header is a band of the grouped canvas across them, 14sp Medium in the secondary label 16 in
79
81
  const plain = surface === "plain";
80
82
  const band = theme.colors.groupedBackground;
81
- return (_jsxs(View, { testID: testID, style: style, children: [_jsxs(View, { style: plain ? { backgroundColor: theme.colors.groupedSurface } : [styles.androidCard, { backgroundColor: fill }], children: [header == null && action == null ? null : plain ? (_jsxs(View, { style: [styles.androidBand, action != null ? styles.androidBandRow : null, { backgroundColor: band }], children: [header != null ? (_jsx(Text, { accessibilityRole: "header", color: theme.colors.labelSecondary, weight: "medium", numberOfLines: 1, style: [styles.androidBandText, action != null ? styles.grow : null], children: header })) : (_jsx(View, { style: styles.grow })), action != null ? _jsx(ListActionContext.Provider, { value: "header", children: headerAction(action, styles.androidBandText, theme.colors.labelSecondary) }) : null] })) : action != null ? (_jsxs(View, { style: styles.androidHeaderRow, children: [header != null ? (_jsx(Text, { accessibilityRole: "header", color: increased ? theme.colors.text : accentText(theme), weight: "medium", style: [styles.androidHeaderTitle, increased ? styles.androidHeaderIncreased : null], children: header })) : (_jsx(View, { style: styles.grow })), _jsx(ListActionContext.Provider, { value: "header", children: headerAction(action, styles.androidHeaderTitleType, theme.colors.labelSecondary) })] })) : (_jsx(Text, { accessibilityRole: "header", color: increased ? theme.colors.text : accentText(theme), weight: "medium", style: [styles.androidHeader, increased ? styles.androidHeaderIncreased : null], children: header })), description != null ? (_jsx(Text, { color: theme.colors.labelSecondary, style: [styles.androidDescriptionLine, plain ? styles.androidDescriptionPlain : header == null ? styles.androidDescriptionAlone : null], children: description })) : null, _jsx(View, { accessibilityRole: "list", "aria-label": label, children: _jsx(ListOptionsContext.Provider, { value: options, children: body }) })] }), error != null ? (_jsx(Text, { color: dangerText(theme), accessibilityLiveRegion: "polite", style: [styles.androidFooter, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null], children: error })) : footer != null ? (_jsx(Text, { color: theme.colors.labelSecondary, style: [styles.androidFooter, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null], children: footer })) : null] }));
83
+ return (_jsxs(View, { testID: testID, style: style, children: [_jsxs(View, { style: plain ? { backgroundColor: theme.colors.groupedSurface } : [styles.androidCard, { backgroundColor: fill }], children: [header == null && action == null ? null : plain ? (_jsxs(View, { style: [styles.androidBand, action != null ? styles.androidBandRow : null, { backgroundColor: band }], children: [header != null ? (_jsx(Text, { accessibilityRole: "header", color: theme.colors.labelSecondary, weight: "medium", numberOfLines: 1, style: [styles.androidBandText, action != null ? styles.grow : null], children: header })) : (_jsx(View, { style: styles.grow })), action != null ? _jsx(ListActionContext.Provider, { value: "header", children: headerAction(action, styles.androidBandText, theme.colors.labelSecondary) }) : null] })) : action != null ? (_jsxs(View, { style: styles.androidHeaderRow, children: [header != null ? (_jsx(Text, { accessibilityRole: "header", color: increased ? theme.colors.text : accentText(theme), weight: "medium", style: [styles.androidHeaderTitle, increased ? styles.androidHeaderIncreased : null], children: header })) : (_jsx(View, { style: styles.grow })), _jsx(ListActionContext.Provider, { value: "header", children: headerAction(action, styles.androidHeaderTitleType, theme.colors.labelSecondary) })] })) : (_jsx(Text, { accessibilityRole: "header", color: increased ? theme.colors.text : accentText(theme), weight: "medium", style: [styles.androidHeader, increased ? styles.androidHeaderIncreased : null], children: header })), description != null ? (_jsx(Text, { color: theme.colors.labelSecondary, style: [styles.androidDescriptionLine, plain ? styles.androidDescriptionPlain : header == null ? styles.androidDescriptionAlone : null], children: description })) : null, _jsx(View, { accessibilityRole: "list", "aria-label": label, children: _jsx(ListOptionsContext.Provider, { value: options, children: body }) })] }), error != null ? (_jsx(Text, { color: dangerText(theme), accessibilityLiveRegion: "polite", style: [styles.androidFooter, { paddingHorizontal: footerInset }, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null], children: error })) : footer != null ? (_jsx(Text, { color: theme.colors.labelSecondary, style: [styles.androidFooter, { paddingHorizontal: footerInset }, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null], children: footer })) : null] }));
82
84
  }
83
85
  const inset = theme.length("--list-row-inset", 20);
84
86
  const footerBox = cssBox(theme, "--field-group-footer-padding", [8, inset, 6, inset]);
@@ -116,7 +118,7 @@ export function List({ children, header, description, footer, error, surface = "
116
118
  * in (a multi-select list); a 1px divider from the text's start to the card's end, none under a row with a tile (a
117
119
  * tiled row draws none).
118
120
  */
119
- export function ListItem({ label, description, leading, leadingColor, value, valuePlacement = "end", valueColor, trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, disabled = false, destructive = false, accessibilityLabel, testID, }) {
121
+ export function ListItem({ label, description, leading, leadingColor, value, valuePlacement = "end", valueColor, trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, longPressLabel, disabled = false, destructive = false, accessibilityLabel, testID, }) {
120
122
  const theme = useTheme();
121
123
  const { last, top, bottom } = useContext(PlaceContext);
122
124
  // A menu opened from the row finds the row (Android lights it over the dim of the screen)
@@ -199,7 +201,7 @@ export function ListItem({ label, description, leading, leadingColor, value, val
199
201
  const drawn = theme.isAndroid && !nativeRipple;
200
202
  return (_jsx(Pressable, { ref: frameNode, collapsable: false, ...described.props, ...(switchRow ? spaceToggles(toggle) : null),
201
203
  // A row that toggles its control is not a second element for a screen reader or a Tab stop: the control is
202
- accessible: endOwnsFocus ? false : undefined, focusable: endOwnsFocus ? false : undefined, tabIndex: endOwnsFocus ? -1 : undefined, accessibilityRole: endOwnsFocus ? undefined : switchRow ? "switch" : "button", accessibilityLabel: endOwnsFocus ? undefined : name, accessibilityState: endOwnsFocus ? undefined : switchRow ? { checked, disabled } : { disabled }, "aria-checked": switchRow ? checked : undefined, disabled: disabled || (press == null && onLongPress == null), onPress: press, onLongPress: onLongPress, delayLongPress: onLongPress ? 500 : undefined, accessibilityActions: onLongPress ? [{ name: "longpress" }] : undefined, onAccessibilityAction: onLongPress ? (event) => event.nativeEvent.actionName === "longpress" && onLongPress() : undefined, onPressIn: drawn ? ripple.start : undefined, onPressOut: drawn ? ripple.end : undefined, android_ripple: nativeRipple ? { color: highlight, foreground: true } : undefined, testID: testID, style: row, children: ({ pressed }) => (_jsxs(RowHoldContext.Provider, { value: disabled ? null : theme.isAndroid ? hold : setHeld, children: [ripple.layer, theme.isAndroid ? null : _jsx(RowHighlight, { on: (pressed || held) && lit, last: last }), content(pressed || held)] })) }));
204
+ accessible: endOwnsFocus ? false : undefined, focusable: endOwnsFocus ? false : undefined, tabIndex: endOwnsFocus ? -1 : undefined, accessibilityRole: endOwnsFocus ? undefined : switchRow ? "switch" : "button", accessibilityLabel: endOwnsFocus ? undefined : name, accessibilityState: endOwnsFocus ? undefined : switchRow ? { checked, disabled } : { disabled }, "aria-checked": switchRow ? checked : undefined, disabled: disabled || (press == null && onLongPress == null), onPress: press, ...holdProps({ run: onLongPress, label: longPressLabel }, null), onPressIn: drawn ? ripple.start : undefined, onPressOut: drawn ? ripple.end : undefined, android_ripple: nativeRipple ? { color: highlight, foreground: true } : undefined, testID: testID, style: row, children: ({ pressed }) => (_jsx(RowHoldContext.Provider, { value: disabled ? null : theme.isAndroid ? hold : setHeld, children: _jsxs(RowActionContext.Provider, { value: disabled || onLongPress == null ? null : { run: onLongPress, label: longPressLabel }, children: [ripple.layer, theme.isAndroid ? null : _jsx(RowHighlight, { on: (pressed || held) && lit, last: last }), content(pressed || held)] }) })) }));
203
205
  }
204
206
  // A row that only shows (a detail, a value) is one element named by `accessibilityLabel` when it has one; with a
205
207
  // control at its end it stays a group, so the control is still reached
@@ -371,6 +373,9 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
371
373
  : Math.max(description != null ? descriptionPadding : theme.length("--field-row-text-padding-block", 12), (iosMinHeight(theme, description != null) - labelType.lineHeight - (description != null ? descriptionLine : 0)) / 2);
372
374
  // A field at the end fills the room after the label (`RowEnd.fill`)
373
375
  const [fill, setFill] = useState(false);
376
+ // A picture wider than the tile (a photo, an avatar) keeps its own size: it starts at the row's inset, where the
377
+ // header and the footer stand, and the text follows 14 past it, as UIKit's image to text padding
378
+ const [wide, setWide] = useState(false);
374
379
  // In a List with `columns` a field's value starts at one column, 40% into the row (`--field-row-column-width`)
375
380
  // A switch, a checkbox and a radio stay at the row's edge
376
381
  const columns = useContext(ListOptionsContext)?.columns === true && trailing != null;
@@ -388,9 +393,13 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
388
393
  });
389
394
  return (_jsxs(_Fragment, { children: [leading != null ? (_jsx(View, { style: [
390
395
  styles.tile,
391
- { width: tile, height: tile, marginStart: theme.length("--field-row-icon-offset", -2), marginEnd: theme.length("--field-row-icon-gap", 14) },
396
+ { minWidth: tile, minHeight: tile, marginStart: wide ? 0 : theme.length("--field-row-icon-offset", -2), marginEnd: theme.length("--field-row-icon-gap", 14) },
392
397
  leadingColor ? { backgroundColor: leadingColor, borderRadius: theme.length("--field-row-icon-radius", 7) } : null,
393
- ], 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: [
398
+ ], onLayout: (event) => {
399
+ const next = event.nativeEvent.layout.width > tile + 0.5;
400
+ if (next !== wide)
401
+ setWide(next);
402
+ }, 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: [
394
403
  error != null ? styles.iosColumn : styles.iosMain,
395
404
  { minHeight: iosMinHeight(theme, description != null || error != null), paddingEnd: inset },
396
405
  error != null
@@ -6,7 +6,7 @@ import CheckMd from "../../icons/plex/CheckMd";
6
6
  import { useDescription } from "../../internal/a11y";
7
7
  import { ControlLabel } from "../../internal/ControlLabel";
8
8
  import { isRTL, nextKey } from "../../internal/direction";
9
- import { RowEndContext, RowHoldContext, RowStartContext, rowHold } from "../../internal/row";
9
+ import { RowActionContext, RowEndContext, RowHoldContext, RowStartContext, holdProps, rowHold } from "../../internal/row";
10
10
  import { mix } from "../../theme/material";
11
11
  import { useTheme } from "../../theme/ThemeProvider";
12
12
  import { ANDROID_ROW_END, androidEaseInOut, iosCheckmarkColor, selectionColor } from "../Switch/Switch";
@@ -37,7 +37,7 @@ function RadioGroupRoot({ value: valueProp, defaultValue, onChange, "aria-label"
37
37
  return (_jsx(RadioContext.Provider, { value: { value, select, disabled, items }, children: _jsx(View, { accessibilityRole: "radiogroup", "aria-label": ariaLabel, testID: testID, style: [direction === "row" ? styles.rowGroup : styles.colGroup, style], children: children }) }));
38
38
  }
39
39
  RadioGroupRoot.displayName = "RadioGroup";
40
- function RadioGroupItem({ value, children, description, disabled: itemDisabled = false, orientation = "left", "aria-label": ariaLabel, testID }) {
40
+ function RadioGroupItem({ value, children, description, disabled: itemDisabled = false, orientation = "left", onLongPress, longPressLabel, "aria-label": ariaLabel, testID }) {
41
41
  const theme = useTheme();
42
42
  const context = useContext(RadioContext);
43
43
  if (!context)
@@ -51,6 +51,8 @@ function RadioGroupItem({ value, children, description, disabled: itemDisabled =
51
51
  // Or at its start (a list with the marks first): the mark alone, as wide as its ring or its checkmark's column
52
52
  const atStart = useContext(RowStartContext) && !hasText;
53
53
  const hold = useContext(RowHoldContext);
54
+ // A row's touch and hold, held here, where the row's touches and its screen reader focus are
55
+ const rowAction = useContext(RowActionContext);
54
56
  // The radio button runs 0 to 1 in 200ms on Android's default ease-in-out: the first half fills the ring inward
55
57
  // in its gray, the second shrinks the fill to the dot while it turns the on color; unchoosing runs it back. A
56
58
  // disabled option snaps. Android only: iOS shows a list row's checkmark, which does not animate
@@ -88,7 +90,7 @@ function RadioGroupItem({ value, children, description, disabled: itemDisabled =
88
90
  const size = theme.length("--radio-group-indicator-size", 22);
89
91
  mark = (_jsx(View, { style: { width: size, height: size, alignItems: "center", justifyContent: "center" }, children: selected ? _jsx(CheckMd, { size: 26, color: disabled ? theme.colors.textDisabled : iosCheckmarkColor(theme) }) : null }));
90
92
  }
91
- return (_jsxs(Pressable, { ...described.props, ...radioKeys(context, value, disabled, selected), accessibilityRole: "radio", accessibilityLabel: ariaLabel ?? (typeof children === "string" ? children : undefined), accessibilityState: { checked: selected, disabled }, "aria-checked": selected, disabled: disabled, ...rowHold(hold), onPress: () => !selected && context.select(value), testID: testID, style: [
93
+ return (_jsxs(Pressable, { ...described.props, ...radioKeys(context, value, disabled, selected), accessibilityRole: "radio", accessibilityLabel: ariaLabel ?? (typeof children === "string" ? children : undefined), accessibilityState: { checked: selected, disabled }, "aria-checked": selected, disabled: disabled, ...rowHold(hold), ...holdProps({ run: disabled ? undefined : onLongPress, label: longPressLabel }, inRow || atStart ? rowAction : null), onPress: () => !selected && context.select(value), testID: testID, style: [
92
94
  styles.item,
93
95
  // Android's gap is in the target's margins
94
96
  { gap: theme.isAndroid ? 0 : theme.length("--radio-group-item-gap", 6) + 5, minHeight: theme.isAndroid ? 48 : theme.length("--radio-group-target-size", 44) },
@@ -4,7 +4,7 @@ import { Animated, Easing, StyleSheet, View } from "react-native";
4
4
  import { Pressable } from "../../internal/Pressable";
5
5
  import { spaceToggles, useDescription } from "../../internal/a11y";
6
6
  import { ControlLabel } from "../../internal/ControlLabel";
7
- import { RowEndContext, RowHoldContext, rowHold } from "../../internal/row";
7
+ import { RowActionContext, RowEndContext, RowHoldContext, holdProps, rowHold } from "../../internal/row";
8
8
  import { androidGray } from "../../theme/material";
9
9
  import { useTheme } from "../../theme/ThemeProvider";
10
10
  /**
@@ -59,6 +59,8 @@ export function Switch({ checked: checkedProp, defaultChecked = false, onChecked
59
59
  // At the end of an Android List row with no text of its own: Android's switch stands 22dp from the row's end
60
60
  const rowEnd = useContext(RowEndContext) != null;
61
61
  const hold = useContext(RowHoldContext);
62
+ // A row's touch and hold, held here, where the row's touches and its screen reader focus are
63
+ const rowAction = useContext(RowActionContext);
62
64
  const toggle = () => {
63
65
  if (disabled)
64
66
  return;
@@ -72,7 +74,7 @@ export function Switch({ checked: checkedProp, defaultChecked = false, onChecked
72
74
  // Disabled, the switch and its text fade to half (as a switch row's), each on its own
73
75
  const control = (pressed) => theme.isAndroid ? (_jsx(View, { style: [disabled ? styles.dim : null, rowEnd && !hasText ? styles.androidRowEnd : null], children: _jsx(AndroidTrack, { theme: theme, checked: checked, disabled: disabled, color: color, progress: progress }) })) : (_jsx(IOSTrack, { theme: theme, checked: checked, disabled: disabled, color: color, progress: progress, held: pressed && !disabled }));
74
76
  const text = _jsx(ControlLabel, { control: "switch", label: label, description: description, disabled: disabled, descriptionId: described.id });
75
- return (_jsx(Pressable, { ...described.props, ...spaceToggles(toggle), accessibilityRole: "switch", accessibilityLabel: accessibilityLabel ?? (typeof label === "string" ? label : undefined), accessibilityState: { checked, disabled }, "aria-checked": checked, disabled: disabled, ...rowHold(hold), onPress: toggle, testID: testID,
77
+ return (_jsx(Pressable, { ...described.props, ...spaceToggles(toggle), accessibilityRole: "switch", accessibilityLabel: accessibilityLabel ?? (typeof label === "string" ? label : undefined), accessibilityState: { checked, disabled }, "aria-checked": checked, disabled: disabled, ...rowHold(hold), ...holdProps({}, rowEnd ? rowAction : null), onPress: toggle, testID: testID,
76
78
  // Android's switch row: 50dp, the text ending 11dp before the switch's 37dp view
77
79
  style: [styles.row, { gap: theme.isAndroid ? 11 : theme.length("--switch-label-gap", 8), minHeight: theme.isAndroid ? 50 : 44 }, style], children: ({ pressed }) => (_jsxs(_Fragment, { children: [labelPosition === "start" && hasText ? _jsx(View, { style: styles.grow, children: text }) : null, control(pressed), labelPosition === "end" && hasText ? _jsx(View, { style: styles.grow, children: text }) : null] })) }));
78
80
  }
@@ -361,9 +361,9 @@ function ToastView({ item, theme, hidden, replaced = false }) {
361
361
  const titleWeight = Platform.OS === "web" ? fontWeight(theme.token(described ? "--font-weight-semibold" : "--font-weight-medium")) : undefined;
362
362
  return (_jsx(Animated.View, { ...responder.panHandlers, accessibilityRole: "alert", pointerEvents: touches,
363
363
  // An offset, not a transform: a transform would stop the glass's blur on the web
364
- style: [styles.iosWrap, { top: Animated.add(progress.interpolate({ inputRange: [0, 1], outputRange: [-24, 0] }), drag), display, opacity: glassOpacity(progress, !leaving) }], children: _jsxs(Glass, { radius: described ? 24 : 21.5, elevation: "raised", fillToken: "--toast-mobile-background", style: styles.iosToast, children: [icon != null && icon !== false ? _jsx(View, { style: styles.iosIcon, children: icon }) : null, _jsxs(View, { style: [styles.iosText, item.action ? { minWidth: 8 * 15 } : null], children: [_jsx(Text, { weight: described ? "semibold" : "medium", style: { fontSize: 15, lineHeight: 17, fontWeight: titleWeight }, children: item.title }), described ? (
365
- // The web toast's description is the opaque secondary gray, not the phone's 50% label
366
- _jsx(Text, { color: theme.colors.textSecondary, style: { fontSize: 15, lineHeight: 18 }, children: item.description })) : null] }), item.action ? (_jsx(Pressable, { accessibilityRole: "button", disabled: leaving, onPress: act,
364
+ style: [styles.iosWrap, { top: Animated.add(progress.interpolate({ inputRange: [0, 1], outputRange: [-24, 0] }), drag), display, opacity: glassOpacity(progress, !leaving) }], children: _jsxs(Glass, { radius: described ? 24 : 21.5, elevation: "raised", fillToken: "--toast-mobile-background", style: styles.iosToast, children: [_jsxs(View, { style: styles.iosMessage, children: [icon != null && icon !== false ? _jsx(View, { style: styles.iosIcon, children: icon }) : null, _jsxs(View, { style: [styles.iosText, item.action ? { minWidth: 8 * 15 } : null], children: [_jsx(Text, { weight: described ? "semibold" : "medium", style: { fontSize: 15, lineHeight: 17, fontWeight: titleWeight }, children: item.title }), described ? (
365
+ // The web toast's description is the opaque secondary gray, not the phone's 50% label
366
+ _jsx(Text, { color: theme.colors.textSecondary, style: { fontSize: 15, lineHeight: 18 }, children: item.description })) : null] })] }), item.action ? (_jsx(Pressable, { accessibilityRole: "button", disabled: leaving, onPress: act,
367
367
  // A 34pt capsule in a 44pt target
368
368
  hitSlop: 5, style: ({ pressed }) => [styles.iosAction, { backgroundColor: theme.color("--color-background-primary-solid"), opacity: pressed ? 0.7 : 1 }], children: _jsx(Text, { weight: "regular", color: theme.color("--color-text-primary-solid"), style: { fontSize: 15, lineHeight: 20 }, children: item.action.label }) })) : null] }) }));
369
369
  }
@@ -378,6 +378,7 @@ const styles = StyleSheet.create({
378
378
  // 12/14 of padding inside sonner's 1px border, transparent on a phone
379
379
  iosToast: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 10, paddingVertical: 13, paddingHorizontal: 15 },
380
380
  iosIcon: { width: 16, height: 16, marginStart: -3, marginEnd: 4, justifyContent: "center", alignItems: "flex-start" },
381
+ iosMessage: { flexDirection: "row", alignItems: "center", gap: 10, flexShrink: 1, minWidth: 0 },
381
382
  iosText: { flexShrink: 1, minWidth: 0 },
382
383
  iosAction: { minHeight: 34, paddingVertical: 7, paddingHorizontal: 14, borderRadius: 9999, alignItems: "center", justifyContent: "center" },
383
384
  // Android's toast card: a 16dp-cornered card at least 48 tall, the text 16 in (56 past a 24dp icon at 16)
@@ -0,0 +1,3 @@
1
+ // Generated by scripts/build-icons.mjs. Do not edit.
2
+ import { createIcon } from "../../components/Icon/createIcon";
3
+ export default createIcon("VerifiedFilled", "0 0 24 24", [["path", { "d": "M12.01 2.011a3.2 3.2 0 0 1 2.113 .797l.154 .145l.698 .698a1.2 1.2 0 0 0 .71 .341l.135 .008h1a3.2 3.2 0 0 1 3.195 3.018l.005 .182v1c0 .27 .092 .533 .258 .743l.09 .1l.697 .698a3.2 3.2 0 0 1 .147 4.382l-.145 .154l-.698 .698a1.2 1.2 0 0 0 -.341 .71l-.008 .135v1a3.2 3.2 0 0 1 -3.018 3.195l-.182 .005h-1a1.2 1.2 0 0 0 -.743 .258l-.1 .09l-.698 .697a3.2 3.2 0 0 1 -4.382 .147l-.154 -.145l-.698 -.698a1.2 1.2 0 0 0 -.71 -.341l-.135 -.008h-1a3.2 3.2 0 0 1 -3.195 -3.018l-.005 -.182v-1a1.2 1.2 0 0 0 -.258 -.743l-.09 -.1l-.697 -.698a3.2 3.2 0 0 1 -.147 -4.382l.145 -.154l.698 -.698a1.2 1.2 0 0 0 .341 -.71l.008 -.135v-1l.005 -.182a3.2 3.2 0 0 1 3.013 -3.013l.182 -.005h1a1.2 1.2 0 0 0 .743 -.258l.1 -.09l.698 -.697a3.2 3.2 0 0 1 2.269 -.944zm3.697 7.282a1 1 0 0 0 -1.414 0l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.32 1.497l2 2l.094 .083a1 1 0 0 0 1.32 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z", "fill": 0 }]]);
@@ -630,6 +630,7 @@ export { default as VariationV41 } from "./VariationV41";
630
630
  export { default as VariationV42 } from "./VariationV42";
631
631
  export { default as VariationV43 } from "./VariationV43";
632
632
  export { default as VariationV44 } from "./VariationV44";
633
+ export { default as VerifiedFilled } from "./VerifiedFilled";
633
634
  export { default as VersionsV1 } from "./VersionsV1";
634
635
  export { default as Video } from "./Video";
635
636
  export { default as VideoCaption } from "./VideoCaption";
@@ -23,3 +23,30 @@ export function rowHold(hold) {
23
23
  // The touch goes with the hold: Android's row ripples from it
24
24
  return hold ? { onPressIn: (event) => hold(true, event), onPressOut: () => hold(false) } : null;
25
25
  }
26
+ /**
27
+ * Set by a row with `onLongPress`: a control at its end that takes its own touches (a checkbox, a switch, a choice)
28
+ * holds for the row, and a screen reader, which reaches the control and never the row, finds the action there.
29
+ */
30
+ export const RowActionContext = createContext(null);
31
+ /**
32
+ * A control's touch and hold: its own `onLongPress`, or its row's. Half a second, as UIKit's and a ContextMenu's;
33
+ * a screen reader's `longpress` action named by `label` (VoiceOver reads it, "Show meaning", not the bare name).
34
+ * Merges the control's own actions (`actions`, handled by `onAction`).
35
+ */
36
+ export function holdProps(own, row, actions = [], onAction) {
37
+ const run = own.run ?? row?.run;
38
+ if (run == null)
39
+ return actions.length > 0 ? { accessibilityActions: actions, onAccessibilityAction: onAction } : {};
40
+ const label = own.run != null ? own.label : row?.label;
41
+ return {
42
+ onLongPress: run,
43
+ delayLongPress: 500,
44
+ accessibilityActions: [...actions, { name: "longpress", ...(label != null ? { label } : null) }],
45
+ onAccessibilityAction: (event) => {
46
+ if (event.nativeEvent.actionName === "longpress")
47
+ run();
48
+ else
49
+ onAction?.(event);
50
+ },
51
+ };
52
+ }
@@ -122,7 +122,7 @@ type Colors = {
122
122
  pressedText?: string;
123
123
  border?: string;
124
124
  };
125
- export declare function buttonColors(theme: Theme, color: ButtonColor, variant: ButtonVariant, disabled: boolean, selected: boolean, uniform?: boolean): Colors;
125
+ export declare function buttonColors(theme: Theme, color: ButtonColor, variant: ButtonVariant, disabled: boolean, selected: boolean): Colors;
126
126
  /** On Android a pressed button shows a layer of its label color at 10% (the native ripple on a device). */
127
127
  export declare function useMaterialPress(theme: Theme): boolean;
128
128
  /**
@@ -42,7 +42,11 @@ export type ChipProps = {
42
42
  */
43
43
  removeStyle?: "token" | "button";
44
44
  disabled?: boolean;
45
+ /** A touch and hold on the chip (half a second): what a word means, say. */
46
+ onLongPress?: () => void;
47
+ /** The name a screen reader gives the hold's action ("Show meaning"). */
48
+ longPressLabel?: string;
45
49
  testID?: string;
46
50
  style?: StyleProp<ViewStyle>;
47
51
  };
48
- export declare function Chip({ children, selected: selectedProp, defaultSelected, onSelectedChange, onPress, icon, trailingIcon, menu, expanded, accessibilityLabel, appearance, onRemove, removeLabel, removeStyle, disabled, testID, style, }: ChipProps): import("react").JSX.Element;
52
+ export declare function Chip({ children, selected: selectedProp, defaultSelected, onSelectedChange, onPress, icon, trailingIcon, menu, expanded, accessibilityLabel, appearance, onRemove, removeLabel, removeStyle, onLongPress, longPressLabel, disabled, testID, style, }: ChipProps): import("react").JSX.Element;
@@ -108,6 +108,11 @@ export type ListItemProps = {
108
108
  onPress?: () => void;
109
109
  /** A touch and hold on the row (half a second): a ContextMenu around the row sets it. */
110
110
  onLongPress?: () => void;
111
+ /**
112
+ * The name a screen reader gives the hold's action ("Show meaning"), or it reads the bare action. A control at the
113
+ * row's end that takes the row's focus (a checkbox, a switch, a choice) carries the action and holds for the row.
114
+ */
115
+ longPressLabel?: string;
111
116
  disabled?: boolean;
112
117
  /** A row in red, as a destructive action row. */
113
118
  destructive?: boolean;
@@ -126,7 +131,7 @@ export type ListItemProps = {
126
131
  * in (a multi-select list); a 1px divider from the text's start to the card's end, none under a row with a tile (a
127
132
  * tiled row draws none).
128
133
  */
129
- export declare function ListItem({ label, description, leading, leadingColor, value, valuePlacement, valueColor, trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, disabled, destructive, accessibilityLabel, testID, }: ListItemProps): import("react").JSX.Element;
134
+ export declare function ListItem({ label, description, leading, leadingColor, value, valuePlacement, valueColor, trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, longPressLabel, disabled, destructive, accessibilityLabel, testID, }: ListItemProps): import("react").JSX.Element;
130
135
  export type StackedRowProps = {
131
136
  /** The label over the value; none for a row whose placeholder names the field (`hideLabel`). */
132
137
  label?: ReactNode;
@@ -19,6 +19,10 @@ export type RadioGroupItemProps = {
19
19
  disabled?: boolean;
20
20
  /** Where the mark stands against the label. @default "left" */
21
21
  orientation?: "left" | "right";
22
+ /** A touch and hold on the option (half a second): what a term means, say. */
23
+ onLongPress?: () => void;
24
+ /** The name a screen reader gives the hold's action ("Show meaning"). */
25
+ longPressLabel?: string;
22
26
  "aria-label"?: string;
23
27
  testID?: string;
24
28
  };
@@ -47,7 +51,7 @@ declare function RadioGroupRoot<T extends string>({ value: valueProp, defaultVal
47
51
  declare namespace RadioGroupRoot {
48
52
  var displayName: string;
49
53
  }
50
- declare function RadioGroupItem({ value, children, description, disabled: itemDisabled, orientation, "aria-label": ariaLabel, testID }: RadioGroupItemProps): import("react").JSX.Element;
54
+ declare function RadioGroupItem({ value, children, description, disabled: itemDisabled, orientation, onLongPress, longPressLabel, "aria-label": ariaLabel, testID }: RadioGroupItemProps): import("react").JSX.Element;
51
55
  declare namespace RadioGroupItem {
52
56
  var displayName: string;
53
57
  }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("../..").IconComponent;
2
+ export default _default;
@@ -628,6 +628,7 @@ export { default as VariationV41 } from "./VariationV41";
628
628
  export { default as VariationV42 } from "./VariationV42";
629
629
  export { default as VariationV43 } from "./VariationV43";
630
630
  export { default as VariationV44 } from "./VariationV44";
631
+ export { default as VerifiedFilled } from "./VerifiedFilled";
631
632
  export { default as VersionsV1 } from "./VersionsV1";
632
633
  export { default as Video } from "./Video";
633
634
  export { default as VideoCaption } from "./VideoCaption";
@@ -64,3 +64,52 @@ export declare function rowHold(hold: ((held: boolean, event?: GestureResponderE
64
64
  onPressIn: (event: GestureResponderEvent) => void;
65
65
  onPressOut: () => void;
66
66
  } | null;
67
+ /** A List row's touch and hold, for the control at its end, which takes the row's touches and its screen reader focus. */
68
+ export type RowAction = {
69
+ run: () => void;
70
+ label?: string;
71
+ };
72
+ /**
73
+ * Set by a row with `onLongPress`: a control at its end that takes its own touches (a checkbox, a switch, a choice)
74
+ * holds for the row, and a screen reader, which reaches the control and never the row, finds the action there.
75
+ */
76
+ export declare const RowActionContext: import("react").Context<RowAction | null>;
77
+ type AccessibilityActionEvent = {
78
+ nativeEvent: {
79
+ actionName: string;
80
+ };
81
+ };
82
+ /**
83
+ * A control's touch and hold: its own `onLongPress`, or its row's. Half a second, as UIKit's and a ContextMenu's;
84
+ * a screen reader's `longpress` action named by `label` (VoiceOver reads it, "Show meaning", not the bare name).
85
+ * Merges the control's own actions (`actions`, handled by `onAction`).
86
+ */
87
+ export declare function holdProps(own: {
88
+ run?: () => void;
89
+ label?: string;
90
+ }, row: RowAction | null, actions?: {
91
+ name: string;
92
+ label?: string;
93
+ }[], onAction?: (event: AccessibilityActionEvent) => void): {
94
+ accessibilityActions: {
95
+ name: string;
96
+ label?: string;
97
+ }[];
98
+ onAccessibilityAction: ((event: AccessibilityActionEvent) => void) | undefined;
99
+ onLongPress?: undefined;
100
+ delayLongPress?: undefined;
101
+ } | {
102
+ accessibilityActions?: undefined;
103
+ onAccessibilityAction?: undefined;
104
+ onLongPress?: undefined;
105
+ delayLongPress?: undefined;
106
+ } | {
107
+ onLongPress: () => void;
108
+ delayLongPress: number;
109
+ accessibilityActions: {
110
+ name: string;
111
+ label?: string;
112
+ }[];
113
+ onAccessibilityAction: (event: AccessibilityActionEvent) => void;
114
+ };
115
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/react-native",
3
- "version": "0.2.23",
3
+ "version": "0.2.25",
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",
@@ -62,12 +62,20 @@ export function BottomActions({ children, floating = false, background = "soft",
62
62
  ? { variant: "ghost" as const, color: props.color ?? ("secondary" as const) }
63
63
  : { variant: "soft" as const, color: props.color ?? ("secondary" as const), mobileMaterial: props.mobileMaterial ?? ("glass" as const) }
64
64
  : null
65
- return cloneElement(child as ReactElement<ButtonProps>, {
65
+ const button = cloneElement(child as ReactElement<ButtonProps>, {
66
66
  ...second,
67
67
  block: props.block ?? true,
68
68
  size: props.size ?? "3xl",
69
69
  style: [{ minHeight: height, borderRadius: height / 2 }, props.style],
70
70
  })
71
+ // A disabled button's fill is see-through (the gray of iOS's disabled button): floating over the content it stands
72
+ // on the screen's color, so the rows under it do not show through
73
+ if (!floating || !props.disabled || android) return button
74
+ return (
75
+ <View key={child.key ?? index} style={{ borderRadius: height / 2, backgroundColor: canvas, alignSelf: (props.block ?? true) ? "stretch" : "flex-start" }}>
76
+ {button}
77
+ </View>
78
+ )
71
79
  })
72
80
  return (
73
81
  <View
@@ -230,6 +230,8 @@ export function BottomSheetBase({
230
230
  const [drag] = useState(() => new Animated.Value(0))
231
231
  const close = () => onOpenChange(false)
232
232
  const android = theme.isAndroid
233
+ // Android's content and actions 12 from the sheet's sides, as a page's groups; a token for a screen at another gutter
234
+ const androidInline = theme.length("--bottom-sheet-android-padding-inline", 12)
233
235
  const reduced = theme.reducedMotion
234
236
  // One responder for the sheet's life, told the latest props after each render: a responder made again mid-drag
235
237
  // would lose the drag
@@ -395,6 +397,8 @@ export function BottomSheetBase({
395
397
  android
396
398
  ? [
397
399
  styles.androidContent,
400
+ // A screen whose gutter is Material's compact 16 sets it with --bottom-sheet-android-padding-inline
401
+ { paddingHorizontal: androidInline },
398
402
  title != null ? styles.androidContentUnderBar : null,
399
403
  // Over a footer: 8 above its height, which reaches over the sheet's bottom padding
400
404
  footer ? { paddingBottom: 8 + Math.max(0, footerHeight - insets.bottom - keyboard) } : null,
@@ -417,6 +421,7 @@ export function BottomSheetBase({
417
421
  android
418
422
  ? [
419
423
  styles.androidFooter,
424
+ { paddingHorizontal: androidInline },
420
425
  // Over the sheet's color at 80%, faded in over its top 24dp, down over the gesture bar
421
426
  { paddingBottom: 12 + insets.bottom + keyboard, backgroundImage: `linear-gradient(to bottom, ${withAlpha(background, 0)}, ${withAlpha(background, 0.8)} 24px)` } as ViewStyle,
422
427
  ]
@@ -206,13 +206,17 @@ function iosPress(theme: Theme, variant: ButtonVariant, colors: Colors): Colors
206
206
  return { ...colors, pressed, pressedText: lighten(theme, colors.text) }
207
207
  }
208
208
 
209
- export function buttonColors(theme: Theme, color: ButtonColor, variant: ButtonVariant, disabled: boolean, selected: boolean, uniform = false): Colors {
209
+ export function buttonColors(theme: Theme, color: ButtonColor, variant: ButtonVariant, disabled: boolean, selected: boolean): Colors {
210
210
  const c = (name: string) => theme.color(`--color-${name}`)
211
211
  if (disabled) {
212
212
  if (theme.isAndroid) {
213
- // Android dims a disabled button's label to half and keeps its fill
214
- const enabled = buttonColors(theme, color, variant, false, selected, uniform)
215
- return { ...enabled, pressed: enabled.background, text: withAlpha(enabled.text, 0.5) }
213
+ // Material 3's disabled button: the container the on-surface color at 12% (a filled or a tonal one; none for a
214
+ // text button, an outlined one's outline at 12%), the label at 38%, whatever the button's color, so it reads as
215
+ // disabled on a dark surface too
216
+ const onSurface = theme.material.onSurface
217
+ const veil = withAlpha(onSurface, 0.12)
218
+ const flat = variant === "ghost" || variant === "outline"
219
+ return { background: flat ? "transparent" : veil, pressed: flat ? "transparent" : veil, text: withAlpha(onSurface, 0.38), border: variant === "outline" ? veil : undefined }
216
220
  }
217
221
  // The phone CSS: the tertiary label in every style (iOS 27's disabled content-area button), the fill of a gray
218
222
  // button behind a solid or soft one
@@ -569,7 +573,7 @@ function ButtonBody({
569
573
  // its buttons on glass and its plain ones; the token alone gives the Regular of the plain button
570
574
  weight: theme.isIOS && variant !== "ghost" ? "medium" : base.weight,
571
575
  }
572
- const colors = barColors(theme, buttonColors(theme, color, variant, disabled, selected, uniform), { bar, prominent: accentAction, neutral, disabled, selected, flat: mobileMaterial === "flat" })
576
+ const colors = barColors(theme, buttonColors(theme, color, variant, disabled, selected), { bar, prominent: accentAction, neutral, disabled, selected, flat: mobileMaterial === "flat" })
573
577
  // In a bar every neutral soft or ghost button is glass, as on iOS 26, unless it asks to stay flat or is selected.
574
578
  // A disabled glass button keeps its glass, as the phone CSS's
575
579
  const wantsGlass = bar ? mobileMaterial !== "flat" && neutral && !selected && !bar.inGroup : mobileMaterial === "glass" && neutral
@@ -652,22 +656,8 @@ function ButtonBody({
652
656
  const background = pressed && theme.isIOS ? colors.pressed : colors.background
653
657
  // A glass button keeps its own press: only its glass changes
654
658
  const text = pressed && !inert && theme.isIOS && !glass && colors.pressedText ? colors.pressedText : colors.text
655
- // Android fades a button on its own between enabled and disabled in 300ms on its default curve: its fill stays and
656
- // its label goes to half, so the label keeps its enabled color under an opacity. A bar's buttons change at once
657
- const fades = android && !bar
658
- const ink = fades && disabled ? buttonColors(theme, color, variant, false, selected, uniform).text : text
659
- const [dim] = useState(() => new Animated.Value(fades && disabled ? 0.5 : 1))
660
- useEffect(() => {
661
- const to = fades && disabled ? 0.5 : 1
662
- if (still || !fades) {
663
- dim.stopAnimation()
664
- dim.setValue(to)
665
- return
666
- }
667
- const animation = Animated.timing(dim, { toValue: to, duration: 300, easing: curves.accelerateDecelerate, useNativeDriver: false })
668
- animation.start()
669
- return () => animation.stop()
670
- }, [dim, disabled, fades, still])
659
+ // Material 3's disabled label is the on-surface color at 38% (buttonColors), drawn as it is
660
+ const ink = text
671
661
  // Android's loading, both ways in 320ms on an ease-out quint: the label rises 24dp, flattens to 60% toward the
672
662
  // button's top and fades out, as the spinner rises 24dp into its place and fades in
673
663
  const [swap] = useState(() => new Animated.Value(loading ? 1 : 0))
@@ -726,7 +716,7 @@ function ButtonBody({
726
716
  // The label scales from the button's top edge: on Android its row spans the button's height
727
717
  const labelMotion = android
728
718
  ? {
729
- opacity: Animated.multiply(dim, swap.interpolate({ inputRange: [0, 1], outputRange: [1, 0] })),
719
+ opacity: swap.interpolate({ inputRange: [0, 1], outputRange: [1, 0] }),
730
720
  transform: [{ translateY: swap.interpolate({ inputRange: [0, 1], outputRange: [0, -24] }) }, { scaleY: swap.interpolate({ inputRange: [0, 1], outputRange: [1, 0.6] }) }],
731
721
  }
732
722
  : { opacity: loading ? 0 : 1 }
@@ -6,7 +6,7 @@ import CheckMd from "../../icons/plex/CheckMd"
6
6
  import Minus from "../../icons/plex/Minus"
7
7
  import { spaceToggles, useDescription } from "../../internal/a11y"
8
8
  import { ControlLabel, controlLabelLine } from "../../internal/ControlLabel"
9
- import { RowEndContext, RowHoldContext, RowStartContext, rowHold } from "../../internal/row"
9
+ import { RowActionContext, RowEndContext, RowHoldContext, RowStartContext, holdProps, rowHold } from "../../internal/row"
10
10
  import { androidGray, withAlpha } from "../../theme/material"
11
11
  import { useTheme } from "../../theme/ThemeProvider"
12
12
  import { ANDROID_ROW_END, iosCheckmarkColor, selectionColor } from "../Switch/Switch"
@@ -68,6 +68,8 @@ export function Checkbox({
68
68
  const atRowStart = useContext(RowStartContext) && label == null && description == null
69
69
  const inRow = useContext(RowEndContext) != null && label == null && description == null && !atRowStart
70
70
  const hold = useContext(RowHoldContext)
71
+ // A row's touch and hold, held here, where the row's touches and its screen reader focus are
72
+ const rowAction = useContext(RowActionContext)
71
73
  const [own, setOwn] = useState(defaultChecked)
72
74
  const state = checkedProp ?? own
73
75
  const on = state !== false
@@ -183,6 +185,7 @@ export function Checkbox({
183
185
  aria-invalid={invalid || undefined}
184
186
  disabled={disabled}
185
187
  {...rowHold(hold)}
188
+ {...holdProps({}, inRow || atRowStart ? rowAction : null)}
186
189
  onPress={toggle}
187
190
  testID={testID}
188
191
  style={[
@@ -1,3 +1,4 @@
1
+ import { holdProps } from "../../internal/row"
1
2
  import { useEffect, useState, type ReactNode } from "react"
2
3
  import { Animated, Easing, Platform, StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
3
4
  import { Pressable } from "../../internal/Pressable"
@@ -54,6 +55,10 @@ export type ChipProps = {
54
55
  */
55
56
  removeStyle?: "token" | "button"
56
57
  disabled?: boolean
58
+ /** A touch and hold on the chip (half a second): what a word means, say. */
59
+ onLongPress?: () => void
60
+ /** The name a screen reader gives the hold's action ("Show meaning"). */
61
+ longPressLabel?: string
57
62
  testID?: string
58
63
  style?: StyleProp<ViewStyle>
59
64
  }
@@ -83,6 +88,8 @@ export function Chip({
83
88
  onRemove,
84
89
  removeLabel = "Remove",
85
90
  removeStyle = "token",
91
+ onLongPress,
92
+ longPressLabel,
86
93
  disabled = false,
87
94
  testID,
88
95
  style,
@@ -249,7 +256,7 @@ export function Chip({
249
256
  ) : null}
250
257
  </>
251
258
  )
252
- const interactive = filter || !!onPress || token
259
+ const interactive = filter || !!onPress || !!onLongPress || token
253
260
  // Android dims a disabled chip, its fill with it, to half (as its other disabled controls)
254
261
  const dim = android && disabled ? styles.dim : null
255
262
  const handlers = {
@@ -274,10 +281,6 @@ export function Chip({
274
281
  // A token: VoiceOver's action and a keyboard's Delete remove it; leaving it lets the selection go
275
282
  ...(token
276
283
  ? {
277
- accessibilityActions: [{ name: "delete", label: removeLabel }],
278
- onAccessibilityAction: (event: { nativeEvent: { actionName: string } }) => {
279
- if (event.nativeEvent.actionName === "delete" && !disabled) onRemove?.()
280
- },
281
284
  onBlur: () => armed && setArmed(false),
282
285
  onKeyDown: (event: { nativeEvent: { key?: string } }) => {
283
286
  if ((event.nativeEvent.key === "Backspace" || event.nativeEvent.key === "Delete") && !disabled) onRemove?.()
@@ -285,6 +288,15 @@ export function Chip({
285
288
  "aria-keyshortcuts": "Delete Backspace",
286
289
  }
287
290
  : {}),
291
+ // A token's delete action for VoiceOver, and a hold of its own (what a word means), named for a screen reader
292
+ ...holdProps(
293
+ { run: disabled ? undefined : onLongPress, label: longPressLabel },
294
+ null,
295
+ token ? [{ name: "delete", label: removeLabel }] : [],
296
+ (event) => {
297
+ if (event.nativeEvent.actionName === "delete" && !disabled) onRemove?.()
298
+ },
299
+ ),
288
300
  onPressIn: () => setPressed(true),
289
301
  onPressOut: () => setPressed(false),
290
302
  }
@@ -8,7 +8,7 @@ import { useRipple } from "../../internal/ripple"
8
8
  import { flattenChildren, textOf } from "../../internal/children"
9
9
  import { cssBox } from "../../internal/cssBox"
10
10
  import { mirrored, useRTL } from "../../internal/direction"
11
- import { RowEndContext, RowFrameContext, RowHoldContext, RowStartContext, type RowEnd, type RowFrame } from "../../internal/row"
11
+ import { RowActionContext, RowEndContext, RowFrameContext, RowHoldContext, RowStartContext, holdProps, type RowEnd, type RowFrame } from "../../internal/row"
12
12
  import { accentText, controlHighlight, dangerText, divider, withAlpha } from "../../theme/material"
13
13
  import { useTheme } from "../../theme/ThemeProvider"
14
14
  import type { Theme } from "../../theme/types"
@@ -130,6 +130,8 @@ export function List({
130
130
  .map((row) => (row.type === Button ? <ActionRow key={row.key ?? undefined}>{row}</ActionRow> : row))
131
131
  const options = useMemo(() => ({ columns }), [columns])
132
132
  const increased = headerProminence === "increased"
133
+ // Android's footer 13 into the card's width, as the Settings app; a token for a screen that keeps text at its gutter
134
+ const footerInset = theme.length("--list-android-footer-inset", 13)
133
135
  const fill = surface === "plain" ? theme.color("--field-group-background", theme.colors.surfaceSecondary) : theme.colors.groupedSurface
134
136
  // The card's corners: Android's 16dp card (a header or description inside it stands over the first row), iOS's group
135
137
  const corner = surface === "plain" && theme.isAndroid ? 0 : theme.isAndroid ? ANDROID_CARD_RADIUS : theme.length("--field-group-radius", 26)
@@ -196,11 +198,11 @@ export function List({
196
198
  </View>
197
199
  </View>
198
200
  {error != null ? (
199
- <Text color={dangerText(theme)} accessibilityLiveRegion="polite" style={[styles.androidFooter, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null]}>
201
+ <Text color={dangerText(theme)} accessibilityLiveRegion="polite" style={[styles.androidFooter, { paddingHorizontal: footerInset }, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null]}>
200
202
  {error}
201
203
  </Text>
202
204
  ) : footer != null ? (
203
- <Text color={theme.colors.labelSecondary} style={[styles.androidFooter, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null]}>
205
+ <Text color={theme.colors.labelSecondary} style={[styles.androidFooter, { paddingHorizontal: footerInset }, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null]}>
204
206
  {footer}
205
207
  </Text>
206
208
  ) : null}
@@ -338,6 +340,11 @@ export type ListItemProps = {
338
340
  onPress?: () => void
339
341
  /** A touch and hold on the row (half a second): a ContextMenu around the row sets it. */
340
342
  onLongPress?: () => void
343
+ /**
344
+ * The name a screen reader gives the hold's action ("Show meaning"), or it reads the bare action. A control at the
345
+ * row's end that takes the row's focus (a checkbox, a switch, a choice) carries the action and holds for the row.
346
+ */
347
+ longPressLabel?: string
341
348
  disabled?: boolean
342
349
  /** A row in red, as a destructive action row. */
343
350
  destructive?: boolean
@@ -373,6 +380,7 @@ export function ListItem({
373
380
  disclosure,
374
381
  onPress,
375
382
  onLongPress,
383
+ longPressLabel,
376
384
  disabled = false,
377
385
  destructive = false,
378
386
  accessibilityLabel,
@@ -488,10 +496,7 @@ export function ListItem({
488
496
  aria-checked={switchRow ? checked : undefined}
489
497
  disabled={disabled || (press == null && onLongPress == null)}
490
498
  onPress={press}
491
- onLongPress={onLongPress}
492
- delayLongPress={onLongPress ? 500 : undefined}
493
- accessibilityActions={onLongPress ? [{ name: "longpress" }] : undefined}
494
- onAccessibilityAction={onLongPress ? (event) => event.nativeEvent.actionName === "longpress" && onLongPress() : undefined}
499
+ {...holdProps({ run: onLongPress, label: longPressLabel }, null)}
495
500
  onPressIn={drawn ? ripple.start : undefined}
496
501
  onPressOut={drawn ? ripple.end : undefined}
497
502
  android_ripple={nativeRipple ? { color: highlight, foreground: true } : undefined}
@@ -500,9 +505,11 @@ export function ListItem({
500
505
  >
501
506
  {({ pressed }) => (
502
507
  <RowHoldContext.Provider value={disabled ? null : theme.isAndroid ? hold : setHeld}>
503
- {ripple.layer}
504
- {theme.isAndroid ? null : <RowHighlight on={(pressed || held) && lit} last={last} />}
505
- {content(pressed || held)}
508
+ <RowActionContext.Provider value={disabled || onLongPress == null ? null : { run: onLongPress, label: longPressLabel }}>
509
+ {ripple.layer}
510
+ {theme.isAndroid ? null : <RowHighlight on={(pressed || held) && lit} last={last} />}
511
+ {content(pressed || held)}
512
+ </RowActionContext.Provider>
506
513
  </RowHoldContext.Provider>
507
514
  )}
508
515
  </Pressable>
@@ -801,6 +808,9 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
801
808
  )
802
809
  // A field at the end fills the room after the label (`RowEnd.fill`)
803
810
  const [fill, setFill] = useState(false)
811
+ // A picture wider than the tile (a photo, an avatar) keeps its own size: it starts at the row's inset, where the
812
+ // header and the footer stand, and the text follows 14 past it, as UIKit's image to text padding
813
+ const [wide, setWide] = useState(false)
804
814
  // In a List with `columns` a field's value starts at one column, 40% into the row (`--field-row-column-width`)
805
815
  // A switch, a checkbox and a radio stay at the row's edge
806
816
  const columns = useContext(ListOptionsContext)?.columns === true && trailing != null
@@ -822,9 +832,13 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
822
832
  <View
823
833
  style={[
824
834
  styles.tile,
825
- { width: tile, height: tile, marginStart: theme.length("--field-row-icon-offset", -2), marginEnd: theme.length("--field-row-icon-gap", 14) },
835
+ { minWidth: tile, minHeight: tile, marginStart: wide ? 0 : theme.length("--field-row-icon-offset", -2), marginEnd: theme.length("--field-row-icon-gap", 14) },
826
836
  leadingColor ? { backgroundColor: leadingColor, borderRadius: theme.length("--field-row-icon-radius", 7) } : null,
827
837
  ]}
838
+ onLayout={(event) => {
839
+ const next = event.nativeEvent.layout.width > tile + 0.5
840
+ if (next !== wide) setWide(next)
841
+ }}
828
842
  >
829
843
  <IconDefaultsProvider size={leadingColor ? 20 : theme.length("--field-row-icon-symbol-size", 24)} color={leadingColor ? "#ffffff" : disabled ? theme.colors.labelTertiary : theme.colors.accent}>
830
844
  {leading}
@@ -5,7 +5,7 @@ import CheckMd from "../../icons/plex/CheckMd"
5
5
  import { useDescription } from "../../internal/a11y"
6
6
  import { ControlLabel } from "../../internal/ControlLabel"
7
7
  import { isRTL, nextKey } from "../../internal/direction"
8
- import { RowEndContext, RowHoldContext, RowStartContext, rowHold } from "../../internal/row"
8
+ import { RowActionContext, RowEndContext, RowHoldContext, RowStartContext, holdProps, rowHold } from "../../internal/row"
9
9
  import { mix } from "../../theme/material"
10
10
  import { useTheme } from "../../theme/ThemeProvider"
11
11
  import { ANDROID_ROW_END, androidEaseInOut, iosCheckmarkColor, selectionColor } from "../Switch/Switch"
@@ -30,6 +30,10 @@ export type RadioGroupItemProps = {
30
30
  disabled?: boolean
31
31
  /** Where the mark stands against the label. @default "left" */
32
32
  orientation?: "left" | "right"
33
+ /** A touch and hold on the option (half a second): what a term means, say. */
34
+ onLongPress?: () => void
35
+ /** The name a screen reader gives the hold's action ("Show meaning"). */
36
+ longPressLabel?: string
33
37
  "aria-label"?: string
34
38
  testID?: string
35
39
  }
@@ -72,7 +76,7 @@ function RadioGroupRoot<T extends string>({ value: valueProp, defaultValue, onCh
72
76
  }
73
77
  RadioGroupRoot.displayName = "RadioGroup"
74
78
 
75
- function RadioGroupItem({ value, children, description, disabled: itemDisabled = false, orientation = "left", "aria-label": ariaLabel, testID }: RadioGroupItemProps) {
79
+ function RadioGroupItem({ value, children, description, disabled: itemDisabled = false, orientation = "left", onLongPress, longPressLabel, "aria-label": ariaLabel, testID }: RadioGroupItemProps) {
76
80
  const theme = useTheme()
77
81
  const context = useContext(RadioContext)
78
82
  if (!context) throw new Error("RadioGroup.Item must be inside a RadioGroup")
@@ -85,6 +89,8 @@ function RadioGroupItem({ value, children, description, disabled: itemDisabled =
85
89
  // Or at its start (a list with the marks first): the mark alone, as wide as its ring or its checkmark's column
86
90
  const atStart = useContext(RowStartContext) && !hasText
87
91
  const hold = useContext(RowHoldContext)
92
+ // A row's touch and hold, held here, where the row's touches and its screen reader focus are
93
+ const rowAction = useContext(RowActionContext)
88
94
  // The radio button runs 0 to 1 in 200ms on Android's default ease-in-out: the first half fills the ring inward
89
95
  // in its gray, the second shrinks the fill to the dot while it turns the on color; unchoosing runs it back. A
90
96
  // disabled option snaps. Android only: iOS shows a list row's checkmark, which does not animate
@@ -143,6 +149,7 @@ function RadioGroupItem({ value, children, description, disabled: itemDisabled =
143
149
  aria-checked={selected}
144
150
  disabled={disabled}
145
151
  {...rowHold(hold)}
152
+ {...holdProps({ run: disabled ? undefined : onLongPress, label: longPressLabel }, inRow || atStart ? rowAction : null)}
146
153
  onPress={() => !selected && context.select(value)}
147
154
  testID={testID}
148
155
  style={[
@@ -3,7 +3,7 @@ import { Animated, Easing, StyleSheet, View, type StyleProp, type ViewStyle } fr
3
3
  import { Pressable } from "../../internal/Pressable"
4
4
  import { spaceToggles, useDescription } from "../../internal/a11y"
5
5
  import { ControlLabel } from "../../internal/ControlLabel"
6
- import { RowEndContext, RowHoldContext, rowHold } from "../../internal/row"
6
+ import { RowActionContext, RowEndContext, RowHoldContext, holdProps, rowHold } from "../../internal/row"
7
7
  import { androidGray } from "../../theme/material"
8
8
  import { useTheme } from "../../theme/ThemeProvider"
9
9
  import type { SelectionColor, Theme } from "../../theme/types"
@@ -97,6 +97,8 @@ export function Switch({
97
97
  // At the end of an Android List row with no text of its own: Android's switch stands 22dp from the row's end
98
98
  const rowEnd = useContext(RowEndContext) != null
99
99
  const hold = useContext(RowHoldContext)
100
+ // A row's touch and hold, held here, where the row's touches and its screen reader focus are
101
+ const rowAction = useContext(RowActionContext)
100
102
  const toggle = () => {
101
103
  if (disabled) return
102
104
  if (checkedProp === undefined) setOwn(!checked)
@@ -125,6 +127,7 @@ export function Switch({
125
127
  aria-checked={checked}
126
128
  disabled={disabled}
127
129
  {...rowHold(hold)}
130
+ {...holdProps({}, rowEnd ? rowAction : null)}
128
131
  onPress={toggle}
129
132
  testID={testID}
130
133
  // Android's switch row: 50dp, the text ending 11dp before the switch's 37dp view
@@ -460,9 +460,12 @@ function ToastView({ item, theme, hidden, replaced = false }: { item: ToastT; th
460
460
  <Glass radius={described ? 24 : 21.5} elevation="raised" fillToken="--toast-mobile-background" style={styles.iosToast}>
461
461
  {/* sonner's 16pt icon box, 3 into the padding and 4 before the gap, holds the 20pt symbol over its edges: the
462
462
  message starts 42 from the toast's edge, and a line of text alone keeps the toast 43 high */}
463
- {icon != null && icon !== false ? <View style={styles.iosIcon}>{icon}</View> : null}
464
- {/* Beside a button the message keeps 8em, and a button that would leave it less wraps under it */}
465
- <View style={[styles.iosText, item.action ? { minWidth: 8 * 15 } : null]}>
463
+ {/* The symbol and the message are one piece of the row, so a long message wraps its own lines beside the
464
+ symbol, as the web's; only a button wraps, under them */}
465
+ <View style={styles.iosMessage}>
466
+ {icon != null && icon !== false ? <View style={styles.iosIcon}>{icon}</View> : null}
467
+ {/* Beside a button the message keeps 8em, and a button that would leave it less wraps under it */}
468
+ <View style={[styles.iosText, item.action ? { minWidth: 8 * 15 } : null]}>
466
469
  <Text weight={described ? "semibold" : "medium"} style={{ fontSize: 15, lineHeight: 17, fontWeight: titleWeight }}>
467
470
  {item.title}
468
471
  </Text>
@@ -472,6 +475,7 @@ function ToastView({ item, theme, hidden, replaced = false }: { item: ToastT; th
472
475
  {item.description}
473
476
  </Text>
474
477
  ) : null}
478
+ </View>
475
479
  </View>
476
480
  {item.action ? (
477
481
  <Pressable
@@ -504,6 +508,7 @@ const styles = StyleSheet.create({
504
508
  // 12/14 of padding inside sonner's 1px border, transparent on a phone
505
509
  iosToast: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 10, paddingVertical: 13, paddingHorizontal: 15 },
506
510
  iosIcon: { width: 16, height: 16, marginStart: -3, marginEnd: 4, justifyContent: "center", alignItems: "flex-start" },
511
+ iosMessage: { flexDirection: "row", alignItems: "center", gap: 10, flexShrink: 1, minWidth: 0 },
507
512
  iosText: { flexShrink: 1, minWidth: 0 },
508
513
  iosAction: { minHeight: 34, paddingVertical: 7, paddingHorizontal: 14, borderRadius: 9999, alignItems: "center", justifyContent: "center" },
509
514
  // Android's toast card: a 16dp-cornered card at least 48 tall, the text 16 in (56 past a 24dp icon at 16)
@@ -0,0 +1,4 @@
1
+ // Generated by scripts/build-icons.mjs. Do not edit.
2
+ import { createIcon } from "../../components/Icon/createIcon"
3
+
4
+ export default createIcon("VerifiedFilled", "0 0 24 24", [["path",{"d":"M12.01 2.011a3.2 3.2 0 0 1 2.113 .797l.154 .145l.698 .698a1.2 1.2 0 0 0 .71 .341l.135 .008h1a3.2 3.2 0 0 1 3.195 3.018l.005 .182v1c0 .27 .092 .533 .258 .743l.09 .1l.697 .698a3.2 3.2 0 0 1 .147 4.382l-.145 .154l-.698 .698a1.2 1.2 0 0 0 -.341 .71l-.008 .135v1a3.2 3.2 0 0 1 -3.018 3.195l-.182 .005h-1a1.2 1.2 0 0 0 -.743 .258l-.1 .09l-.698 .697a3.2 3.2 0 0 1 -4.382 .147l-.154 -.145l-.698 -.698a1.2 1.2 0 0 0 -.71 -.341l-.135 -.008h-1a3.2 3.2 0 0 1 -3.195 -3.018l-.005 -.182v-1a1.2 1.2 0 0 0 -.258 -.743l-.09 -.1l-.697 -.698a3.2 3.2 0 0 1 -.147 -4.382l.145 -.154l.698 -.698a1.2 1.2 0 0 0 .341 -.71l.008 -.135v-1l.005 -.182a3.2 3.2 0 0 1 3.013 -3.013l.182 -.005h1a1.2 1.2 0 0 0 .743 -.258l.1 -.09l.698 -.697a3.2 3.2 0 0 1 2.269 -.944zm3.697 7.282a1 1 0 0 0 -1.414 0l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.32 1.497l2 2l.094 .083a1 1 0 0 0 1.32 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z","fill":0}]])
@@ -630,6 +630,7 @@ export { default as VariationV41 } from "./VariationV41"
630
630
  export { default as VariationV42 } from "./VariationV42"
631
631
  export { default as VariationV43 } from "./VariationV43"
632
632
  export { default as VariationV44 } from "./VariationV44"
633
+ export { default as VerifiedFilled } from "./VerifiedFilled"
633
634
  export { default as VersionsV1 } from "./VersionsV1"
634
635
  export { default as Video } from "./Video"
635
636
  export { default as VideoCaption } from "./VideoCaption"
@@ -67,3 +67,39 @@ export function rowHold(hold: ((held: boolean, event?: GestureResponderEvent) =>
67
67
  // The touch goes with the hold: Android's row ripples from it
68
68
  return hold ? { onPressIn: (event: GestureResponderEvent) => hold(true, event), onPressOut: () => hold(false) } : null
69
69
  }
70
+
71
+ /** A List row's touch and hold, for the control at its end, which takes the row's touches and its screen reader focus. */
72
+ export type RowAction = { run: () => void; label?: string }
73
+
74
+ /**
75
+ * Set by a row with `onLongPress`: a control at its end that takes its own touches (a checkbox, a switch, a choice)
76
+ * holds for the row, and a screen reader, which reaches the control and never the row, finds the action there.
77
+ */
78
+ export const RowActionContext = createContext<RowAction | null>(null)
79
+
80
+ type AccessibilityActionEvent = { nativeEvent: { actionName: string } }
81
+
82
+ /**
83
+ * A control's touch and hold: its own `onLongPress`, or its row's. Half a second, as UIKit's and a ContextMenu's;
84
+ * a screen reader's `longpress` action named by `label` (VoiceOver reads it, "Show meaning", not the bare name).
85
+ * Merges the control's own actions (`actions`, handled by `onAction`).
86
+ */
87
+ export function holdProps(
88
+ own: { run?: () => void; label?: string },
89
+ row: RowAction | null,
90
+ actions: { name: string; label?: string }[] = [],
91
+ onAction?: (event: AccessibilityActionEvent) => void,
92
+ ) {
93
+ const run = own.run ?? row?.run
94
+ if (run == null) return actions.length > 0 ? { accessibilityActions: actions, onAccessibilityAction: onAction } : {}
95
+ const label = own.run != null ? own.label : row?.label
96
+ return {
97
+ onLongPress: run,
98
+ delayLongPress: 500,
99
+ accessibilityActions: [...actions, { name: "longpress", ...(label != null ? { label } : null) }],
100
+ onAccessibilityAction: (event: AccessibilityActionEvent) => {
101
+ if (event.nativeEvent.actionName === "longpress") run()
102
+ else onAction?.(event)
103
+ },
104
+ }
105
+ }