@plexui/react-native 0.2.24 → 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.
@@ -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";
@@ -118,7 +118,7 @@ export function List({ children, header, description, footer, error, surface = "
118
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
119
119
  * tiled row draws none).
120
120
  */
121
- 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, }) {
122
122
  const theme = useTheme();
123
123
  const { last, top, bottom } = useContext(PlaceContext);
124
124
  // A menu opened from the row finds the row (Android lights it over the dim of the screen)
@@ -201,7 +201,7 @@ export function ListItem({ label, description, leading, leadingColor, value, val
201
201
  const drawn = theme.isAndroid && !nativeRipple;
202
202
  return (_jsx(Pressable, { ref: frameNode, collapsable: false, ...described.props, ...(switchRow ? spaceToggles(toggle) : null),
203
203
  // A row that toggles its control is not a second element for a screen reader or a Tab stop: the control is
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, 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)] }) })) }));
205
205
  }
206
206
  // A row that only shows (a detail, a value) is one element named by `accessibilityLabel` when it has one; with a
207
207
  // control at its end it stays a group, so the control is still reached
@@ -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
  }
@@ -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.24",
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",
@@ -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"
@@ -340,6 +340,11 @@ export type ListItemProps = {
340
340
  onPress?: () => void
341
341
  /** A touch and hold on the row (half a second): a ContextMenu around the row sets it. */
342
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
343
348
  disabled?: boolean
344
349
  /** A row in red, as a destructive action row. */
345
350
  destructive?: boolean
@@ -375,6 +380,7 @@ export function ListItem({
375
380
  disclosure,
376
381
  onPress,
377
382
  onLongPress,
383
+ longPressLabel,
378
384
  disabled = false,
379
385
  destructive = false,
380
386
  accessibilityLabel,
@@ -490,10 +496,7 @@ export function ListItem({
490
496
  aria-checked={switchRow ? checked : undefined}
491
497
  disabled={disabled || (press == null && onLongPress == null)}
492
498
  onPress={press}
493
- onLongPress={onLongPress}
494
- delayLongPress={onLongPress ? 500 : undefined}
495
- accessibilityActions={onLongPress ? [{ name: "longpress" }] : undefined}
496
- onAccessibilityAction={onLongPress ? (event) => event.nativeEvent.actionName === "longpress" && onLongPress() : undefined}
499
+ {...holdProps({ run: onLongPress, label: longPressLabel }, null)}
497
500
  onPressIn={drawn ? ripple.start : undefined}
498
501
  onPressOut={drawn ? ripple.end : undefined}
499
502
  android_ripple={nativeRipple ? { color: highlight, foreground: true } : undefined}
@@ -502,9 +505,11 @@ export function ListItem({
502
505
  >
503
506
  {({ pressed }) => (
504
507
  <RowHoldContext.Provider value={disabled ? null : theme.isAndroid ? hold : setHeld}>
505
- {ripple.layer}
506
- {theme.isAndroid ? null : <RowHighlight on={(pressed || held) && lit} last={last} />}
507
- {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>
508
513
  </RowHoldContext.Provider>
509
514
  )}
510
515
  </Pressable>
@@ -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
@@ -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
+ }