@plexui/react-native 0.2.24 → 0.2.26

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 (62) hide show
  1. package/README.md +3 -0
  2. package/dist/es/components/BottomActions/BottomActions.js +2 -2
  3. package/dist/es/components/BottomSheet/BottomSheet.js +7 -3
  4. package/dist/es/components/Button/Button.js +22 -28
  5. package/dist/es/components/Card/Card.js +9 -2
  6. package/dist/es/components/Checkbox/Checkbox.js +4 -2
  7. package/dist/es/components/Chip/Chip.js +8 -7
  8. package/dist/es/components/Indicator/CircularProgress.js +11 -5
  9. package/dist/es/components/List/List.js +45 -10
  10. package/dist/es/components/Menu/Menu.js +15 -5
  11. package/dist/es/components/PageControl/PageControl.js +7 -3
  12. package/dist/es/components/RadioGroup/RadioGroup.js +5 -3
  13. package/dist/es/components/RollingNumber/RollingNumber.js +7 -7
  14. package/dist/es/components/Select/Select.js +4 -2
  15. package/dist/es/components/Switch/Switch.js +4 -2
  16. package/dist/es/components/TextLink/TextLink.js +5 -0
  17. package/dist/es/icons/plex/VerifiedFilled.js +3 -0
  18. package/dist/es/icons/plex/index.js +1 -0
  19. package/dist/es/index.js +1 -1
  20. package/dist/es/internal/a11y.js +12 -0
  21. package/dist/es/internal/row.js +40 -0
  22. package/dist/es/theme/ThemeProvider.js +4 -2
  23. package/dist/es/theme/material.js +2 -0
  24. package/dist/types/components/BottomActions/BottomActions.d.ts +6 -1
  25. package/dist/types/components/Button/Button.d.ts +6 -1
  26. package/dist/types/components/Card/Card.d.ts +5 -1
  27. package/dist/types/components/Chip/Chip.d.ts +5 -1
  28. package/dist/types/components/Indicator/CircularProgress.d.ts +10 -2
  29. package/dist/types/components/List/List.d.ts +16 -1
  30. package/dist/types/components/Menu/Menu.d.ts +10 -4
  31. package/dist/types/components/RadioGroup/RadioGroup.d.ts +5 -1
  32. package/dist/types/components/RollingNumber/RollingNumber.d.ts +3 -1
  33. package/dist/types/icons/plex/VerifiedFilled.d.ts +2 -0
  34. package/dist/types/icons/plex/index.d.ts +1 -0
  35. package/dist/types/index.d.ts +1 -1
  36. package/dist/types/internal/a11y.d.ts +22 -0
  37. package/dist/types/internal/row.d.ts +69 -1
  38. package/dist/types/theme/ThemeProvider.d.ts +3 -2
  39. package/dist/types/theme/material.d.ts +2 -0
  40. package/package.json +1 -1
  41. package/src/components/BottomActions/BottomActions.tsx +7 -2
  42. package/src/components/BottomSheet/BottomSheet.tsx +9 -4
  43. package/src/components/Button/Button.tsx +31 -26
  44. package/src/components/Card/Card.tsx +8 -3
  45. package/src/components/Checkbox/Checkbox.tsx +5 -1
  46. package/src/components/Chip/Chip.tsx +17 -5
  47. package/src/components/Indicator/CircularProgress.tsx +27 -11
  48. package/src/components/List/List.tsx +67 -12
  49. package/src/components/Menu/Menu.tsx +27 -11
  50. package/src/components/PageControl/PageControl.tsx +7 -3
  51. package/src/components/RadioGroup/RadioGroup.tsx +10 -2
  52. package/src/components/RollingNumber/RollingNumber.tsx +10 -8
  53. package/src/components/Select/Select.tsx +4 -1
  54. package/src/components/Switch/Switch.tsx +5 -1
  55. package/src/components/TextLink/TextLink.tsx +6 -0
  56. package/src/icons/plex/VerifiedFilled.ts +4 -0
  57. package/src/icons/plex/index.ts +1 -0
  58. package/src/index.ts +1 -1
  59. package/src/internal/a11y.ts +13 -0
  60. package/src/internal/row.ts +49 -1
  61. package/src/theme/ThemeProvider.tsx +7 -4
  62. package/src/theme/material.ts +2 -0
@@ -1,4 +1,4 @@
1
- import type { GestureResponderEvent } from "react-native";
1
+ import { type GestureResponderEvent } from "react-native";
2
2
  /** The end of a List row, as its control sees it. */
3
3
  export type RowEnd = {
4
4
  /**
@@ -64,3 +64,71 @@ 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
+ /** A row's touch and hold (`run`, named by `label`) and its press's hint, for the control that takes the row's focus. */
69
+ export type RowAction = {
70
+ run?: () => void;
71
+ label?: string;
72
+ hint?: string;
73
+ hintId?: string;
74
+ };
75
+ /**
76
+ * Set by a row with `onLongPress`: a control at its end that takes its own touches (a checkbox, a switch, a choice)
77
+ * holds for the row, and a screen reader, which reaches the control and never the row, finds the action there.
78
+ */
79
+ export declare const RowActionContext: import("react").Context<RowAction | null>;
80
+ type AccessibilityActionEvent = {
81
+ nativeEvent: {
82
+ actionName: string;
83
+ };
84
+ };
85
+ /**
86
+ * A control's touch and hold: its own `onLongPress`, or its row's. Half a second, as UIKit's and a ContextMenu's;
87
+ * a screen reader's `longpress` action named by `label` (VoiceOver reads it, "Show meaning", not the bare name).
88
+ * Merges the control's own actions (`actions`, handled by `onAction`).
89
+ */
90
+ export declare function holdProps(own: {
91
+ run?: () => void;
92
+ label?: string;
93
+ }, row: RowAction | null, actions?: {
94
+ name: string;
95
+ label?: string;
96
+ }[], onAction?: (event: AccessibilityActionEvent) => void): {
97
+ accessibilityActions: {
98
+ name: string;
99
+ label?: string;
100
+ }[];
101
+ onAccessibilityAction: ((event: AccessibilityActionEvent) => void) | undefined;
102
+ onLongPress?: undefined;
103
+ delayLongPress?: undefined;
104
+ } | {
105
+ accessibilityActions?: undefined;
106
+ onAccessibilityAction?: undefined;
107
+ onLongPress?: undefined;
108
+ delayLongPress?: undefined;
109
+ } | {
110
+ onLongPress: () => void;
111
+ delayLongPress: number;
112
+ accessibilityActions: {
113
+ name: string;
114
+ label?: string;
115
+ }[];
116
+ onAccessibilityAction: (event: AccessibilityActionEvent) => void;
117
+ };
118
+ /**
119
+ * The row's hint on the control that takes the row's focus, kept with the control's own description: a phone reads
120
+ * both as one hint; on the web the control is described by its description and the row's unseen hint text.
121
+ */
122
+ export declare function rowHint(row: RowAction | null, described: {
123
+ id?: string;
124
+ props: {
125
+ accessibilityHint?: string;
126
+ };
127
+ }): {
128
+ "aria-describedby": string;
129
+ accessibilityHint?: undefined;
130
+ } | {
131
+ accessibilityHint: string;
132
+ "aria-describedby"?: undefined;
133
+ } | null;
134
+ export {};
@@ -20,9 +20,10 @@ export type ThemeProviderProps = {
20
20
  selectionColor?: SelectionColor;
21
21
  /**
22
22
  * The product's brand: colors, faces and radii over the Plex UI defaults. A nested ThemeProvider keeps its
23
- * parent's brand and lays its own over it.
23
+ * parent's brand and lays its own over it; `null` draws its subtree in Plex UI's own colors and radii, not the
24
+ * parent's brand (a stand-in for a system prompt, which is in the system's colors, never the app's). Faces stay.
24
25
  */
25
- brand?: BrandTheme;
26
+ brand?: BrandTheme | null;
26
27
  /**
27
28
  * Faces of the kit (a nested ThemeProvider takes its parent's). Without them the platform's own face is used; see
28
29
  * `interFonts` and `robotoFonts`. Faces per drawn platform, `{ ios, android }`, take the one of `platform`: the
@@ -73,6 +73,8 @@ export declare const elevationShadow: {
73
73
  readonly bar: "0 2px 8px rgba(0, 0, 0, 0.06)";
74
74
  /** The same over a dark screen, where a light shadow does not show: the controls stand apart by their fill. */
75
75
  readonly barDark: "0 2px 8px rgba(0, 0, 0, 0.3)";
76
+ /** Level 1: an elevated card. */
77
+ readonly level1: "0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15)";
76
78
  readonly level2: "0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.3)";
77
79
  readonly level3: "0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15)";
78
80
  };
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.26",
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",
@@ -31,6 +31,11 @@ export type BottomActionsProps = {
31
31
  background?: BottomActionsBackground
32
32
  /** The color the floating edge fades into: the screen's (a grouped screen's gray). @default the theme's background */
33
33
  canvasColor?: string
34
+ /**
35
+ * No main action: the lone Button takes the second action's look (iOS 26's glass capsule, Android's ghost button),
36
+ * as a step whose rows move on by themselves keeps only its way past ("Skip"). @default false
37
+ */
38
+ secondary?: boolean
34
39
  testID?: string
35
40
  style?: StyleProp<ViewStyle>
36
41
  }
@@ -42,7 +47,7 @@ export type BottomActionsProps = {
42
47
  * action stands under it, 8 apart. Android: the Plex Android look's 48dp full-width button, 16dp from the sides and
43
48
  * 16 above the gesture bar. Each Button inside is a block of the size `3xl` unless it sets its own.
44
49
  */
45
- export function BottomActions({ children, floating = false, background = "soft", canvasColor, testID, style }: BottomActionsProps) {
50
+ export function BottomActions({ children, floating = false, background = "soft", canvasColor, secondary = false, testID, style }: BottomActionsProps) {
46
51
  const theme = useTheme()
47
52
  const insets = useSafeAreaInsets()
48
53
  const android = theme.isAndroid
@@ -57,7 +62,7 @@ export function BottomActions({ children, floating = false, background = "soft",
57
62
  const props = child.props as ButtonProps
58
63
  // The second action: iOS 26's glass capsule of the main one's size, Android's ghost button
59
64
  const second =
60
- index > 0 && props.variant === undefined
65
+ (index > 0 || secondary) && props.variant === undefined
61
66
  ? android
62
67
  ? { variant: "ghost" as const, color: props.color ?? ("secondary" as const) }
63
68
  : { variant: "soft" as const, color: props.color ?? ("secondary" as const), mobileMaterial: props.mobileMaterial ?? ("glass" as const) }
@@ -275,6 +275,8 @@ export function BottomSheetBase({
275
275
  const margin = theme.length("--mobile-layout-margin", 16)
276
276
  // Android: content scrolled under the bar fades out under it; the footer's height sets the room under the content
277
277
  const [scrolled, setScrolled] = useState(false)
278
+ // The Android bar's height: 69 with a title on one line, a line more when it wraps to a second
279
+ const [androidBarHeight, setAndroidBarHeight] = useState(ANDROID_BAR_HEIGHT)
278
280
  const [footerHeight, setFooterHeight] = useState(0)
279
281
  // Android's sheet has no handle: the whole sheet takes the drag. With a title its bar is the reference's sheet bar,
280
282
  // over the content: Close in a 46dp glass circle 12 under the top edge and 12 from the side (in line with the
@@ -284,7 +286,7 @@ export function BottomSheetBase({
284
286
  const barItem = useMemoBarItem(background)
285
287
  const header = android ? (
286
288
  title != null ? (
287
- <View onStartShouldSetResponderCapture={gesture.chrome} style={styles.androidBar}>
289
+ <View onStartShouldSetResponderCapture={gesture.chrome} onLayout={(event) => setAndroidBarHeight(Math.max(ANDROID_BAR_HEIGHT, event.nativeEvent.layout.height))} style={styles.androidBar}>
288
290
  <SheetBarFade fill={background} shown={scrolled} />
289
291
  <View style={styles.androidCircle}>
290
292
  {dismissible ? (
@@ -294,7 +296,7 @@ export function BottomSheetBase({
294
296
  ) : null}
295
297
  </View>
296
298
  <View style={styles.androidHeading}>
297
- <Text nativeID={titleId} accessibilityRole="header" weight="medium" align="center" numberOfLines={1} color={m.onSurface} style={{ fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }}>
299
+ <Text nativeID={titleId} accessibilityRole="header" weight="medium" align="center" numberOfLines={2} color={m.onSurface} style={{ fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }}>
298
300
  {title}
299
301
  </Text>
300
302
  </View>
@@ -399,7 +401,8 @@ export function BottomSheetBase({
399
401
  styles.androidContent,
400
402
  // A screen whose gutter is Material's compact 16 sets it with --bottom-sheet-android-padding-inline
401
403
  { paddingHorizontal: androidInline },
402
- title != null ? styles.androidContentUnderBar : null,
404
+ // 2 under the bar: 71 under a one-line title
405
+ title != null ? { paddingTop: androidBarHeight + 2 } : null,
403
406
  // Over a footer: 8 above its height, which reaches over the sheet's bottom padding
404
407
  footer ? { paddingBottom: 8 + Math.max(0, footerHeight - insets.bottom - keyboard) } : null,
405
408
  ]
@@ -493,6 +496,9 @@ function SheetBarFade({ fill, shown }: { fill: string; shown: boolean }) {
493
496
  */
494
497
  export const BottomSheet = Object.assign(BottomSheetRoot, { Footer: BottomSheetFooter })
495
498
 
499
+ /** An Android sheet's bar: Close's 46dp circle 12 under the top edge and 11 over the bar's end. */
500
+ const ANDROID_BAR_HEIGHT = 12 + 46 + 11
501
+
496
502
  const styles = StyleSheet.create({
497
503
  bottom: { flex: 1, justifyContent: "flex-end", alignItems: "center" },
498
504
  sheet: { alignSelf: "stretch", overflow: "hidden", borderCurve: "continuous", marginHorizontal: "auto", width: "100%" },
@@ -511,7 +517,6 @@ const styles = StyleSheet.create({
511
517
  // The content 12 from the sides (as a page's groups), 16 over the navigation bar; under a bar 13 under its circles
512
518
  // (71 from the sheet's top, 2 under the bar)
513
519
  androidContent: { paddingHorizontal: 12, paddingTop: 4, paddingBottom: 16 },
514
- androidContentUnderBar: { paddingTop: 12 + 46 + 13 },
515
520
  iosFooter: { gap: 10, paddingTop: 12 },
516
521
  iosFooterEdge: { position: "absolute", top: -15, left: 0, right: 0, bottom: 0 },
517
522
  // Android's sheet actions: 48dp buttons 4 apart, 12 from the sides and above, 12 over the gesture bar, over the
@@ -42,6 +42,11 @@ export type ButtonProps = Omit<PressableProps, "children" | "style"> & {
42
42
  uniform?: boolean
43
43
  /** Takes the whole width. */
44
44
  block?: boolean
45
+ /**
46
+ * The most lines a text label takes before it ends in an ellipsis: 2 lets a long label ("Get 3 months for €35.99" in a
47
+ * longer language or at a large text size) wrap within the button, which grows from its height. @default 1
48
+ */
49
+ labelLines?: number
45
50
  selected?: boolean
46
51
  loading?: boolean
47
52
  disabled?: boolean
@@ -206,13 +211,17 @@ function iosPress(theme: Theme, variant: ButtonVariant, colors: Colors): Colors
206
211
  return { ...colors, pressed, pressedText: lighten(theme, colors.text) }
207
212
  }
208
213
 
209
- export function buttonColors(theme: Theme, color: ButtonColor, variant: ButtonVariant, disabled: boolean, selected: boolean, uniform = false): Colors {
214
+ export function buttonColors(theme: Theme, color: ButtonColor, variant: ButtonVariant, disabled: boolean, selected: boolean): Colors {
210
215
  const c = (name: string) => theme.color(`--color-${name}`)
211
216
  if (disabled) {
212
217
  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) }
218
+ // Material 3's disabled button: the container the on-surface color at 12% (a filled or a tonal one; none for a
219
+ // text button, an outlined one's outline at 12%), the label at 38%, whatever the button's color, so it reads as
220
+ // disabled on a dark surface too
221
+ const onSurface = theme.material.onSurface
222
+ const veil = withAlpha(onSurface, 0.12)
223
+ const flat = variant === "ghost" || variant === "outline"
224
+ return { background: flat ? "transparent" : veil, pressed: flat ? "transparent" : veil, text: withAlpha(onSurface, 0.38), border: variant === "outline" ? veil : undefined }
216
225
  }
217
226
  // The phone CSS: the tertiary label in every style (iOS 27's disabled content-area button), the fill of a gray
218
227
  // button behind a solid or soft one
@@ -376,13 +385,19 @@ function Spinner({ color }: { color: string }) {
376
385
  }
377
386
 
378
387
  /** Strings and numbers in a row make one label ("Pressed {count}"); an element (an icon) stands on its own. */
379
- function renderChildren(children: ReactNode, metrics: Metrics) {
388
+ function renderChildren(children: ReactNode, metrics: Metrics, lines = 1) {
380
389
  const out: ReactNode[] = []
381
390
  let label: (string | number)[] = []
382
391
  const flush = () => {
383
392
  if (!label.length) return
384
393
  out.push(
385
- <Text key={`label-${out.length}`} numberOfLines={1} weight={metrics.weight} style={{ fontSize: metrics.fontSize, lineHeight: metrics.lineHeight }}>
394
+ <Text
395
+ key={`label-${out.length}`}
396
+ numberOfLines={lines}
397
+ weight={metrics.weight}
398
+ // A label on more lines than one shrinks to the button and centers its lines
399
+ style={[{ fontSize: metrics.fontSize, lineHeight: metrics.lineHeight }, lines > 1 ? styles.wraps : null]}
400
+ >
386
401
  {label.join("")}
387
402
  </Text>,
388
403
  )
@@ -428,6 +443,7 @@ function ListActionButton({
428
443
  disabled = false,
429
444
  loading = false,
430
445
  inert: inertProp = loading,
446
+ labelLines,
431
447
  children,
432
448
  style,
433
449
  onPressIn,
@@ -466,7 +482,7 @@ function ListActionButton({
466
482
  const trailingIcon = row && parts.length > 1 && isValidElement(parts[parts.length - 1])
467
483
  const content = parts.map((part, index) =>
468
484
  typeof part === "string" || typeof part === "number" ? (
469
- <Text key={`label-${index}`} weight={android && !row ? "medium" : "regular"} numberOfLines={row ? undefined : 1} style={[type, trailingIcon && index < parts.length - 1 ? styles.grow : null]}>
485
+ <Text key={`label-${index}`} weight={android && !row ? "medium" : "regular"} numberOfLines={labelLines ?? (row ? undefined : 1)} style={[type, trailingIcon && index < parts.length - 1 ? styles.grow : null, labelLines != null && labelLines > 1 && !row ? styles.shrinks : null]}>
470
486
  {part}
471
487
  </Text>
472
488
  ) : (
@@ -520,6 +536,7 @@ function ButtonBody({
520
536
  mobileMaterial,
521
537
  uniform = false,
522
538
  block = false,
539
+ labelLines = 1,
523
540
  selected = false,
524
541
  loading = false,
525
542
  disabled = false,
@@ -569,7 +586,7 @@ function ButtonBody({
569
586
  // its buttons on glass and its plain ones; the token alone gives the Regular of the plain button
570
587
  weight: theme.isIOS && variant !== "ghost" ? "medium" : base.weight,
571
588
  }
572
- const colors = barColors(theme, buttonColors(theme, color, variant, disabled, selected, uniform), { bar, prominent: accentAction, neutral, disabled, selected, flat: mobileMaterial === "flat" })
589
+ const colors = barColors(theme, buttonColors(theme, color, variant, disabled, selected), { bar, prominent: accentAction, neutral, disabled, selected, flat: mobileMaterial === "flat" })
573
590
  // 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
591
  // A disabled glass button keeps its glass, as the phone CSS's
575
592
  const wantsGlass = bar ? mobileMaterial !== "flat" && neutral && !selected && !bar.inGroup : mobileMaterial === "glass" && neutral
@@ -652,22 +669,8 @@ function ButtonBody({
652
669
  const background = pressed && theme.isIOS ? colors.pressed : colors.background
653
670
  // A glass button keeps its own press: only its glass changes
654
671
  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])
672
+ // Material 3's disabled label is the on-surface color at 38% (buttonColors), drawn as it is
673
+ const ink = text
671
674
  // Android's loading, both ways in 320ms on an ease-out quint: the label rises 24dp, flattens to 60% toward the
672
675
  // button's top and fades out, as the spinner rises 24dp into its place and fades in
673
676
  const [swap] = useState(() => new Animated.Value(loading ? 1 : 0))
@@ -726,7 +729,7 @@ function ButtonBody({
726
729
  // The label scales from the button's top edge: on Android its row spans the button's height
727
730
  const labelMotion = android
728
731
  ? {
729
- opacity: Animated.multiply(dim, swap.interpolate({ inputRange: [0, 1], outputRange: [1, 0] })),
732
+ opacity: swap.interpolate({ inputRange: [0, 1], outputRange: [1, 0] }),
730
733
  transform: [{ translateY: swap.interpolate({ inputRange: [0, 1], outputRange: [0, -24] }) }, { scaleY: swap.interpolate({ inputRange: [0, 1], outputRange: [1, 0.6] }) }],
731
734
  }
732
735
  : { opacity: loading ? 0 : 1 }
@@ -742,7 +745,7 @@ function ButtonBody({
742
745
  const content = (
743
746
  <TextColorProvider value={ink}>
744
747
  <IconDefaultsProvider size={metrics.iconSize} color={ink}>
745
- <Animated.View style={[styles.row, android ? styles.fromTop : null, { gap: metrics.gap }, labelMotion]}>{renderChildren(children, metrics)}</Animated.View>
748
+ <Animated.View style={[styles.row, android ? styles.fromTop : null, labelLines > 1 ? styles.shrinks : null, { gap: metrics.gap }, labelMotion]}>{renderChildren(children, metrics, labelLines)}</Animated.View>
746
749
  {spinner}
747
750
  </IconDefaultsProvider>
748
751
  </TextColorProvider>
@@ -790,4 +793,6 @@ const styles = StyleSheet.create({
790
793
  row: { flexDirection: "row", alignItems: "center", justifyContent: "center" },
791
794
  fromTop: { alignSelf: "stretch", transformOrigin: "top" },
792
795
  grow: { flexGrow: 1, flexShrink: 1 },
796
+ wraps: { flexShrink: 1, minWidth: 0, textAlign: "center" },
797
+ shrinks: { flexShrink: 1, minWidth: 0, maxWidth: "100%" },
793
798
  })
@@ -3,14 +3,14 @@ import { Image, Platform, StyleSheet, View, type ImageSourcePropType, type Style
3
3
  import { Pressable } from "../../internal/Pressable"
4
4
  import { flattenChildren } from "../../internal/children"
5
5
  import { space } from "../../internal/spacing"
6
- import { controlHighlight, withAlpha } from "../../theme/material"
6
+ import { barShadow, controlHighlight, elevationShadow, withAlpha } from "../../theme/material"
7
7
  import { useTheme } from "../../theme/ThemeProvider"
8
8
  import type { Theme } from "../../theme/types"
9
9
  import { materialType } from "../../theme/typography"
10
10
  import { IconDefaultsProvider } from "../Icon/createIcon"
11
11
  import { Text, TextColorProvider } from "../Text/Text"
12
12
 
13
- export type CardVariant = "outline" | "solid" | "ghost"
13
+ export type CardVariant = "outline" | "solid" | "ghost" | "elevated"
14
14
  export type CardSize = "sm" | "md" | "lg"
15
15
  /** A fill of the palette: the accent, the Plex primary, or a semantic color. */
16
16
  export type CardColor = "accent" | "primary" | "info" | "success" | "warning" | "caution" | "danger" | "discovery"
@@ -60,6 +60,8 @@ export function cardSurface(theme: Theme, variant: CardVariant) {
60
60
  // from those cards on the page
61
61
  if (variant === "outline") return { backgroundColor: theme.colors.groupedSurface }
62
62
  if (variant === "solid") return { backgroundColor: theme.material.surfaceContainerHigh }
63
+ // Material's elevated card: the low container lifted at level 1
64
+ if (variant === "elevated") return { backgroundColor: theme.material.surfaceContainerLow, boxShadow: elevationShadow.level1 }
63
65
  return { backgroundColor: "transparent" }
64
66
  }
65
67
  // On a phone an outline card is a section of an inset grouped list (no border, the section's fill: the grouped
@@ -67,6 +69,9 @@ export function cardSurface(theme: Theme, variant: CardVariant) {
67
69
  // sections (Card.module.css, touch.css)
68
70
  if (variant === "outline") return { backgroundColor: theme.colors.groupedSurface }
69
71
  if (variant === "solid") return { backgroundColor: theme.color("--card-solid-section-background", theme.colors.surfaceSecondary) }
72
+ // Lifted off the page by the soft shadow of a floating control (2 down, 8 across, 6% black; 30% on a dark screen),
73
+ // so a card laid over another reads as on top
74
+ if (variant === "elevated") return { backgroundColor: theme.colors.groupedSurface, boxShadow: barShadow(theme.scheme) }
70
75
  return { backgroundColor: "transparent" }
71
76
  }
72
77
 
@@ -100,7 +105,7 @@ function CardRoot({ children, variant = "outline", size = "md", color, onPress,
100
105
  ? cloneElement(child as ReactElement<CardMediaProps & EdgeProps>, { first: index === 0, last: index === parts.length - 1 })
101
106
  : child,
102
107
  )
103
- const box = [styles.card, { padding, gap, borderRadius: radius }, ghost && !tint ? styles.ghost : null, tint ? { backgroundColor: tint.fill } : cardSurface(theme, variant), style]
108
+ const box = [styles.card, { padding, gap, borderRadius: radius }, ghost && !tint ? styles.ghost : null, tint ? { backgroundColor: tint.fill, ...(variant === "elevated" ? { boxShadow: cardSurface(theme, variant).boxShadow } : null) } : cardSurface(theme, variant), style]
104
109
  const content = tint ? (
105
110
  <Context.Provider value={{ padding, inset, radius, theme, ink: tint.ink }}>
106
111
  <TextColorProvider value={tint.ink}>
@@ -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, rowHint, 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,8 @@ export function Checkbox({
183
185
  aria-invalid={invalid || undefined}
184
186
  disabled={disabled}
185
187
  {...rowHold(hold)}
188
+ {...holdProps({}, inRow || atRowStart ? rowAction : null)}
189
+ {...rowHint(rowAction, described)}
186
190
  onPress={toggle}
187
191
  testID={testID}
188
192
  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
  }
@@ -15,8 +15,16 @@ export type CircularProgressProps = {
15
15
  progress?: number
16
16
  /** Size of the indicator, in pixels. @default 28 */
17
17
  size?: number
18
- /** Stroke width of the ring, in pixels of its 20px drawing, between 1 and 4. @default 2 */
18
+ /** Stroke width of the ring, in pixels of its 20px drawing, between 1 and 4 (with `ring="edge"`, in pixels of `size`). @default 2 */
19
19
  strokeWidth?: number
20
+ /**
21
+ * Where the ring stands in its box: `"inset"`, the web's drawing (a ring of radius 8 in 20, so 28 across draws a
22
+ * ring of about 24); `"edge"`, the ring's outside on the box's edge, `size` the ring's own size.
23
+ * @default "inset"
24
+ */
25
+ ring?: "inset" | "edge"
26
+ /** How long a new value takes to draw, in ms. @default 300 on iOS, 200 on Android */
27
+ duration?: number
20
28
  /** Color of the active progress track (stroke): a color or a token, such as `"var(--gray-1000)"`. */
21
29
  trackActiveColor?: string
22
30
  /** Color of the base track (background stroke): a color or a token, such as `"var(--alpha-15)"`. */
@@ -89,6 +97,8 @@ export function CircularProgress({
89
97
  progress: progressProp,
90
98
  size = 28,
91
99
  strokeWidth,
100
+ ring = "inset",
101
+ duration,
92
102
  trackActiveColor,
93
103
  trackColor,
94
104
  "aria-label": ariaLabel,
@@ -100,11 +110,17 @@ export function CircularProgress({
100
110
  const simulated = useSimulatedProgress(maxDuration, progressProp !== undefined || done)
101
111
  const progress = Math.max(0, Math.min(100, progressProp ?? simulated))
102
112
  const shown = useTweenedNumber(progress, {
103
- duration: theme.isAndroid ? 200 : 300,
113
+ duration: duration ?? (theme.isAndroid ? 200 : 300),
104
114
  easing: theme.isAndroid ? curves.decelerate : cssEase,
105
115
  reducedMotion: theme.reducedMotion,
106
116
  })
107
- const stroke = strokeWidth ? Math.min(4, strokeWidth) : 2
117
+ const edge = ring === "edge"
118
+ const stroke = edge ? Math.min(size / 2, strokeWidth ?? 2) : strokeWidth ? Math.min(4, strokeWidth) : 2
119
+ // The drawing: 20 units with a ring of 8 inset, or the box itself with the ring's outside on its edge
120
+ const box = edge ? size : 20
121
+ const center = box / 2
122
+ const radius = edge ? Math.max(0, (size - stroke) / 2) : 8
123
+ const dash = edge ? 2 * Math.PI * radius : DASH
108
124
  // The web's `light-dark(#deede9, var(--green-a50))`: a light green, the green at 15% at night
109
125
  const track = resolve(theme, trackColor, theme.scheme === "dark" ? theme.color("--green-a50") : "#DEEDE9")
110
126
  const active = resolve(theme, trackActiveColor, theme.color("--green-500"))
@@ -120,20 +136,20 @@ export function CircularProgress({
120
136
  testID={testID}
121
137
  style={[{ width: size, height: size }, style]}
122
138
  >
123
- <Svg width={size} height={size} viewBox="0 0 20 20">
124
- <Circle cx={10} cy={10} r={8} fill="none" stroke={track} strokeWidth={stroke} />
139
+ <Svg width={size} height={size} viewBox={`0 0 ${box} ${box}`}>
140
+ <Circle cx={center} cy={center} r={radius} fill="none" stroke={track} strokeWidth={stroke} />
125
141
  <Circle
126
- cx={10}
127
- cy={10}
128
- r={8}
142
+ cx={center}
143
+ cy={center}
144
+ r={radius}
129
145
  fill="none"
130
146
  stroke={active}
131
147
  strokeWidth={stroke}
132
148
  strokeLinecap="round"
133
- strokeDasharray={[DASH, DASH]}
134
- strokeDashoffset={DASH - DASH * (shown / 100)}
149
+ strokeDasharray={[dash, dash]}
150
+ strokeDashoffset={dash - dash * (shown / 100)}
135
151
  // The dash starts at 12 o'clock, as the web's ring turned back a quarter
136
- transform="rotate(-90 10 10)"
152
+ transform={`rotate(-90 ${center} ${center})`}
137
153
  />
138
154
  </Svg>
139
155
  </View>