@plexui/react-native 0.2.25 → 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 (52) 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 +10 -6
  5. package/dist/es/components/Card/Card.js +9 -2
  6. package/dist/es/components/Checkbox/Checkbox.js +2 -2
  7. package/dist/es/components/Indicator/CircularProgress.js +11 -5
  8. package/dist/es/components/List/List.js +44 -9
  9. package/dist/es/components/Menu/Menu.js +15 -5
  10. package/dist/es/components/PageControl/PageControl.js +7 -3
  11. package/dist/es/components/RadioGroup/RadioGroup.js +2 -2
  12. package/dist/es/components/RollingNumber/RollingNumber.js +7 -7
  13. package/dist/es/components/Select/Select.js +4 -2
  14. package/dist/es/components/Switch/Switch.js +2 -2
  15. package/dist/es/components/TextLink/TextLink.js +5 -0
  16. package/dist/es/index.js +1 -1
  17. package/dist/es/internal/a11y.js +12 -0
  18. package/dist/es/internal/row.js +13 -0
  19. package/dist/es/theme/ThemeProvider.js +4 -2
  20. package/dist/es/theme/material.js +2 -0
  21. package/dist/types/components/BottomActions/BottomActions.d.ts +6 -1
  22. package/dist/types/components/Button/Button.d.ts +5 -0
  23. package/dist/types/components/Card/Card.d.ts +5 -1
  24. package/dist/types/components/Indicator/CircularProgress.d.ts +10 -2
  25. package/dist/types/components/List/List.d.ts +11 -1
  26. package/dist/types/components/Menu/Menu.d.ts +10 -4
  27. package/dist/types/components/RollingNumber/RollingNumber.d.ts +3 -1
  28. package/dist/types/index.d.ts +1 -1
  29. package/dist/types/internal/a11y.d.ts +22 -0
  30. package/dist/types/internal/row.d.ts +21 -2
  31. package/dist/types/theme/ThemeProvider.d.ts +3 -2
  32. package/dist/types/theme/material.d.ts +2 -0
  33. package/package.json +1 -1
  34. package/src/components/BottomActions/BottomActions.tsx +7 -2
  35. package/src/components/BottomSheet/BottomSheet.tsx +9 -4
  36. package/src/components/Button/Button.tsx +19 -4
  37. package/src/components/Card/Card.tsx +8 -3
  38. package/src/components/Checkbox/Checkbox.tsx +2 -1
  39. package/src/components/Indicator/CircularProgress.tsx +27 -11
  40. package/src/components/List/List.tsx +55 -5
  41. package/src/components/Menu/Menu.tsx +27 -11
  42. package/src/components/PageControl/PageControl.tsx +7 -3
  43. package/src/components/RadioGroup/RadioGroup.tsx +2 -1
  44. package/src/components/RollingNumber/RollingNumber.tsx +10 -8
  45. package/src/components/Select/Select.tsx +4 -1
  46. package/src/components/Switch/Switch.tsx +2 -1
  47. package/src/components/TextLink/TextLink.tsx +6 -0
  48. package/src/index.ts +1 -1
  49. package/src/internal/a11y.ts +13 -0
  50. package/src/internal/row.ts +14 -2
  51. package/src/theme/ThemeProvider.tsx +7 -4
  52. package/src/theme/material.ts +2 -0
package/dist/es/index.js CHANGED
@@ -38,7 +38,7 @@ export { Badge } from "./components/Badge/Badge";
38
38
  export { BottomActions } from "./components/BottomActions/BottomActions";
39
39
  export { IntroHeader } from "./components/IntroHeader/IntroHeader";
40
40
  export { Card, cardColors } from "./components/Card/Card";
41
- export { List, ListItem } from "./components/List/List";
41
+ export { List, ListItem, useListMetrics } from "./components/List/List";
42
42
  export { Chip } from "./components/Chip/Chip";
43
43
  export { Skeleton } from "./components/Skeleton/Skeleton";
44
44
  export { Progress, progressSegments } from "./components/Progress/Progress";
@@ -1,6 +1,18 @@
1
1
  import { useId } from "react";
2
2
  import { Platform } from "react-native";
3
3
  import { textOf } from "./children";
4
+ /**
5
+ * A hint (what a press does) for a screen reader: `accessibilityHint` on a phone; on the web, where React Native Web
6
+ * drops that prop, the id of an unseen text (`nodeProps`, the text's `nativeID`) that `aria-describedby` points at.
7
+ */
8
+ export function useHint(hint) {
9
+ const id = useId();
10
+ if (hint == null || hint === "")
11
+ return { id: undefined, props: {} };
12
+ return { id: Platform.OS === "web" ? id : undefined, props: Platform.OS === "web" ? { "aria-describedby": id } : { accessibilityHint: hint } };
13
+ }
14
+ /** Ids for `aria-describedby`, the empty ones left out. */
15
+ export const describedBy = (...ids) => ids.filter(Boolean).join(" ") || undefined;
4
16
  /**
5
17
  * The description of a control for a screen reader: read after its label and state, as VoiceOver and TalkBack
6
18
  * read a hint, and tied to the text by `aria-describedby` on the web. Give `id` to the description's text as its
@@ -1,4 +1,5 @@
1
1
  import { createContext } from "react";
2
+ import { Platform } from "react-native";
2
3
  /**
3
4
  * Inside the end of a List row. On iOS a control there takes the row's look, as the web's controls in a `[data-row]` do.
4
5
  * A pop-up shows its value in the row's type with the menu picker's chevrons and no field of its own; a field is the
@@ -50,3 +51,15 @@ export function holdProps(own, row, actions = [], onAction) {
50
51
  },
51
52
  };
52
53
  }
54
+ /**
55
+ * The row's hint on the control that takes the row's focus, kept with the control's own description: a phone reads
56
+ * both as one hint; on the web the control is described by its description and the row's unseen hint text.
57
+ */
58
+ export function rowHint(row, described) {
59
+ if (row?.hint == null)
60
+ return null;
61
+ if (Platform.OS === "web")
62
+ return row.hintId != null ? { "aria-describedby": [described.id, row.hintId].filter(Boolean).join(" ") } : null;
63
+ const own = described.props.accessibilityHint;
64
+ return { accessibilityHint: own ? `${own}. ${row.hint}` : row.hint };
65
+ }
@@ -196,8 +196,10 @@ export function ThemeProvider({ scheme, platform, selectionColor, brand, fonts:
196
196
  // The phone layers of the CSS apply up to 767px: a tablet keeps the touch sizes. Only the bands of the CSS matter.
197
197
  const band = width >= 414 ? 414 : 393;
198
198
  const highDensity = PixelRatio.get() >= 1.5;
199
- const own = brandOverrides(brand);
200
- const overrides = parent?.overrides || own ? { ...parent?.overrides, ...own } : undefined;
199
+ const own = brandOverrides(brand ?? undefined);
200
+ // `brand={null}` starts again from Plex UI's tokens rather than from the parent's brand
201
+ const inherited = brand === null ? undefined : parent?.overrides;
202
+ const overrides = inherited || own ? { ...inherited, ...own } : undefined;
201
203
  const overridesKey = JSON.stringify(overrides ?? null);
202
204
  const resolver = useMemo(() => {
203
205
  const context = { width: band, highDensity, reducedMotion };
@@ -219,6 +219,8 @@ export const elevationShadow = {
219
219
  bar: "0 2px 8px rgba(0, 0, 0, 0.06)",
220
220
  /** The same over a dark screen, where a light shadow does not show: the controls stand apart by their fill. */
221
221
  barDark: "0 2px 8px rgba(0, 0, 0, 0.3)",
222
+ /** Level 1: an elevated card. */
223
+ level1: "0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15)",
222
224
  level2: "0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.3)",
223
225
  level3: "0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15)",
224
226
  };
@@ -24,6 +24,11 @@ export type BottomActionsProps = {
24
24
  background?: BottomActionsBackground;
25
25
  /** The color the floating edge fades into: the screen's (a grouped screen's gray). @default the theme's background */
26
26
  canvasColor?: string;
27
+ /**
28
+ * No main action: the lone Button takes the second action's look (iOS 26's glass capsule, Android's ghost button),
29
+ * as a step whose rows move on by themselves keeps only its way past ("Skip"). @default false
30
+ */
31
+ secondary?: boolean;
27
32
  testID?: string;
28
33
  style?: StyleProp<ViewStyle>;
29
34
  };
@@ -34,4 +39,4 @@ export type BottomActionsProps = {
34
39
  * action stands under it, 8 apart. Android: the Plex Android look's 48dp full-width button, 16dp from the sides and
35
40
  * 16 above the gesture bar. Each Button inside is a block of the size `3xl` unless it sets its own.
36
41
  */
37
- export declare function BottomActions({ children, floating, background, canvasColor, testID, style }: BottomActionsProps): import("react").JSX.Element;
42
+ export declare function BottomActions({ children, floating, background, canvasColor, secondary, testID, style }: BottomActionsProps): import("react").JSX.Element;
@@ -29,6 +29,11 @@ export type ButtonProps = Omit<PressableProps, "children" | "style"> & {
29
29
  uniform?: boolean;
30
30
  /** Takes the whole width. */
31
31
  block?: boolean;
32
+ /**
33
+ * 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
34
+ * longer language or at a large text size) wrap within the button, which grows from its height. @default 1
35
+ */
36
+ labelLines?: number;
32
37
  selected?: boolean;
33
38
  loading?: boolean;
34
39
  disabled?: boolean;
@@ -1,7 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type ImageSourcePropType, type StyleProp, type ViewStyle } from "react-native";
3
3
  import type { Theme } from "../../theme/types";
4
- export type CardVariant = "outline" | "solid" | "ghost";
4
+ export type CardVariant = "outline" | "solid" | "ghost" | "elevated";
5
5
  export type CardSize = "sm" | "md" | "lg";
6
6
  /** A fill of the palette: the accent, the Plex primary, or a semantic color. */
7
7
  export type CardColor = "accent" | "primary" | "info" | "success" | "warning" | "caution" | "danger" | "discovery";
@@ -31,6 +31,10 @@ export type CardProps = {
31
31
  */
32
32
  export declare function cardSurface(theme: Theme, variant: CardVariant): {
33
33
  backgroundColor: string;
34
+ boxShadow?: undefined;
35
+ } | {
36
+ backgroundColor: string;
37
+ boxShadow: string;
34
38
  };
35
39
  /**
36
40
  * A card, as @plexui/ui's Card with its parts (`Card.Header`, `.Title`, `.Description`, `.Content`, `.Footer`,
@@ -8,8 +8,16 @@ export type CircularProgressProps = {
8
8
  progress?: number;
9
9
  /** Size of the indicator, in pixels. @default 28 */
10
10
  size?: number;
11
- /** Stroke width of the ring, in pixels of its 20px drawing, between 1 and 4. @default 2 */
11
+ /** Stroke width of the ring, in pixels of its 20px drawing, between 1 and 4 (with `ring="edge"`, in pixels of `size`). @default 2 */
12
12
  strokeWidth?: number;
13
+ /**
14
+ * Where the ring stands in its box: `"inset"`, the web's drawing (a ring of radius 8 in 20, so 28 across draws a
15
+ * ring of about 24); `"edge"`, the ring's outside on the box's edge, `size` the ring's own size.
16
+ * @default "inset"
17
+ */
18
+ ring?: "inset" | "edge";
19
+ /** How long a new value takes to draw, in ms. @default 300 on iOS, 200 on Android */
20
+ duration?: number;
13
21
  /** Color of the active progress track (stroke): a color or a token, such as `"var(--gray-1000)"`. */
14
22
  trackActiveColor?: string;
15
23
  /** Color of the base track (background stroke): a color or a token, such as `"var(--alpha-15)"`. */
@@ -31,4 +39,4 @@ export declare function getSimulatedProgress(maxTime: number, elapsedTime: numbe
31
39
  * of its own for this, so both draw the Plex ring; a new value moves the arc in 300ms (ease) on iOS, as the web's
32
40
  * transition, and in Android's determinate radial progress time (200ms, decelerating); at once with reduced motion.
33
41
  */
34
- export declare function CircularProgress({ maxDuration, done, progress: progressProp, size, strokeWidth, trackActiveColor, trackColor, "aria-label": ariaLabel, accessibilityLabel, testID, style, }: CircularProgressProps): import("react").JSX.Element;
42
+ export declare function CircularProgress({ maxDuration, done, progress: progressProp, size, strokeWidth, ring, duration, trackActiveColor, trackColor, "aria-label": ariaLabel, accessibilityLabel, testID, style, }: CircularProgressProps): import("react").JSX.Element;
@@ -44,6 +44,14 @@ export type ListProps = {
44
44
  };
45
45
  /** Whether a control stands in a List's rows (a FloatingLabelInput is a row there, a List of its own elsewhere). */
46
46
  export declare function useInList(): boolean;
47
+ /**
48
+ * Where a List's rows start their text inside the card and how round the card is, for a card built beside a List
49
+ * that must line up with it: iOS `--list-row-inset` (20) and `--field-group-radius` (26), Android 21 and 16.
50
+ */
51
+ export declare function useListMetrics(): {
52
+ rowInset: number;
53
+ radius: number;
54
+ };
47
55
  /**
48
56
  * A section of rows. iOS 26: a section of an inset grouped list, as @plexui/ui's FieldGroup on a phone
49
57
  * (`--field-group-radius` 26, the grouped secondary surface, rows 20 in from its edges, hairlines between rows from
@@ -117,6 +125,8 @@ export type ListItemProps = {
117
125
  /** A row in red, as a destructive action row. */
118
126
  destructive?: boolean;
119
127
  accessibilityLabel?: string;
128
+ /** What a press does, read after the name ("Edit date of birth"): on the row, or on the control that takes its focus. */
129
+ accessibilityHint?: string;
120
130
  testID?: string;
121
131
  };
122
132
  /**
@@ -131,7 +141,7 @@ export type ListItemProps = {
131
141
  * 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
132
142
  * tiled row draws none).
133
143
  */
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;
144
+ export declare function ListItem({ label, description, leading, leadingColor, value, valuePlacement, valueColor, trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, longPressLabel, disabled, destructive, accessibilityLabel, accessibilityHint, testID, }: ListItemProps): import("react").JSX.Element;
135
145
  export type StackedRowProps = {
136
146
  /** The label over the value; none for a row whose placeholder names the field (`hideLabel`). */
137
147
  label?: ReactNode;
@@ -63,6 +63,16 @@ export type MenuContentProps = {
63
63
  align?: "start" | "end";
64
64
  /** @default 250 on iOS; on Android the popup fits its items, 196 to 288 */
65
65
  width?: number;
66
+ /**
67
+ * Several options to pick: a press on an item with `checked` checks or unchecks it and the menu stays open; its items
68
+ * read as checkboxes. @default false
69
+ */
70
+ multiple?: boolean;
71
+ /**
72
+ * The menu opens over its trigger, as Android's popup and the web's phone menu; `false` opens it under the trigger,
73
+ * its top at the trigger's bottom edge, as Material's dropdown menu under a chip. @default true
74
+ */
75
+ cover?: boolean;
66
76
  "aria-label"?: string;
67
77
  testID?: string;
68
78
  };
@@ -76,10 +86,6 @@ type SurfaceProps = MenuContentProps & {
76
86
  anchor: MenuAnchor | null;
77
87
  onClose: () => void;
78
88
  check?: boolean;
79
- /** Select's `multiple`: a press checks or unchecks an option and the menu stays open. */
80
- multiple?: boolean;
81
- /** The menu opens over its trigger, as Android's popup and the web's phone menu (a dropdown field's list opens under it). @default true */
82
- cover?: boolean;
83
89
  /** The List row the menu opens from: on Android the screen dims around it and the popup stands under it. */
84
90
  row?: MenuRow | null;
85
91
  /** Opened from a bar's button: on Android the header menu, in the bar's glass. */
@@ -9,6 +9,8 @@ export type RollingNumberProps = Omit<TextProps, "children"> & {
9
9
  format?: Intl.NumberFormatOptions;
10
10
  /** The style of the row of characters. */
11
11
  containerStyle?: StyleProp<ViewStyle>;
12
+ /** How long a change takes, in ms. @default `--rolling-number-duration` (600) on iOS, 320 on Android */
13
+ duration?: number;
12
14
  };
13
15
  type Character = {
14
16
  character: string;
@@ -32,5 +34,5 @@ export declare const rollingNumberParts: (value: number, locales?: Intl.LocalesA
32
34
  * 0.3 of the font size while the new one comes in, in 320ms (ease-out quint), up for a larger number. With reduced
33
35
  * motion it changes at once. A screen reader reads the written number.
34
36
  */
35
- export declare function RollingNumber({ value, locales, format, containerStyle, style, size, variant, weight, mono, testID, accessibilityLabel, ...text }: RollingNumberProps): import("react").JSX.Element;
37
+ export declare function RollingNumber({ value, locales, format, containerStyle, duration, style, size, variant, weight, mono, testID, accessibilityLabel, ...text }: RollingNumberProps): import("react").JSX.Element;
36
38
  export {};
@@ -37,7 +37,7 @@ export { Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVari
37
37
  export { BottomActions, type BottomActionsBackground, type BottomActionsProps } from "./components/BottomActions/BottomActions";
38
38
  export { IntroHeader, type IntroHeaderAlign, type IntroHeaderProps } from "./components/IntroHeader/IntroHeader";
39
39
  export { Card, cardColors, type CardColor, type CardMediaProps, type CardProps, type CardSize, type CardVariant } from "./components/Card/Card";
40
- export { List, ListItem, type ListItemProps, type ListProps } from "./components/List/List";
40
+ export { List, ListItem, useListMetrics, type ListItemProps, type ListProps } from "./components/List/List";
41
41
  export { Chip, type ChipProps } from "./components/Chip/Chip";
42
42
  export { Skeleton, type SkeletonProps } from "./components/Skeleton/Skeleton";
43
43
  export { Progress, progressSegments, type ProgressColor, type ProgressProps, type ProgressSegment, type ProgressSize } from "./components/Progress/Progress";
@@ -1,4 +1,26 @@
1
1
  import { type ReactNode } from "react";
2
+ /**
3
+ * A hint (what a press does) for a screen reader: `accessibilityHint` on a phone; on the web, where React Native Web
4
+ * drops that prop, the id of an unseen text (`nodeProps`, the text's `nativeID`) that `aria-describedby` points at.
5
+ */
6
+ export declare function useHint(hint: string | undefined): {
7
+ id: undefined;
8
+ props: {
9
+ "aria-describedby"?: undefined;
10
+ accessibilityHint?: undefined;
11
+ };
12
+ } | {
13
+ id: string | undefined;
14
+ props: {
15
+ "aria-describedby": string;
16
+ accessibilityHint?: undefined;
17
+ } | {
18
+ accessibilityHint: string;
19
+ "aria-describedby"?: undefined;
20
+ };
21
+ };
22
+ /** Ids for `aria-describedby`, the empty ones left out. */
23
+ export declare const describedBy: (...ids: (string | undefined)[]) => string | undefined;
2
24
  /**
3
25
  * The description of a control for a screen reader: read after its label and state, as VoiceOver and TalkBack
4
26
  * read a hint, and tied to the text by `aria-describedby` on the web. Give `id` to the description's text as its
@@ -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
  /**
@@ -65,9 +65,12 @@ export declare function rowHold(hold: ((held: boolean, event?: GestureResponderE
65
65
  onPressOut: () => void;
66
66
  } | null;
67
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. */
68
69
  export type RowAction = {
69
- run: () => void;
70
+ run?: () => void;
70
71
  label?: string;
72
+ hint?: string;
73
+ hintId?: string;
71
74
  };
72
75
  /**
73
76
  * Set by a row with `onLongPress`: a control at its end that takes its own touches (a checkbox, a switch, a choice)
@@ -112,4 +115,20 @@ export declare function holdProps(own: {
112
115
  }[];
113
116
  onAccessibilityAction: (event: AccessibilityActionEvent) => void;
114
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;
115
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.25",
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
@@ -380,13 +385,19 @@ function Spinner({ color }: { color: string }) {
380
385
  }
381
386
 
382
387
  /** Strings and numbers in a row make one label ("Pressed {count}"); an element (an icon) stands on its own. */
383
- function renderChildren(children: ReactNode, metrics: Metrics) {
388
+ function renderChildren(children: ReactNode, metrics: Metrics, lines = 1) {
384
389
  const out: ReactNode[] = []
385
390
  let label: (string | number)[] = []
386
391
  const flush = () => {
387
392
  if (!label.length) return
388
393
  out.push(
389
- <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
+ >
390
401
  {label.join("")}
391
402
  </Text>,
392
403
  )
@@ -432,6 +443,7 @@ function ListActionButton({
432
443
  disabled = false,
433
444
  loading = false,
434
445
  inert: inertProp = loading,
446
+ labelLines,
435
447
  children,
436
448
  style,
437
449
  onPressIn,
@@ -470,7 +482,7 @@ function ListActionButton({
470
482
  const trailingIcon = row && parts.length > 1 && isValidElement(parts[parts.length - 1])
471
483
  const content = parts.map((part, index) =>
472
484
  typeof part === "string" || typeof part === "number" ? (
473
- <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]}>
474
486
  {part}
475
487
  </Text>
476
488
  ) : (
@@ -524,6 +536,7 @@ function ButtonBody({
524
536
  mobileMaterial,
525
537
  uniform = false,
526
538
  block = false,
539
+ labelLines = 1,
527
540
  selected = false,
528
541
  loading = false,
529
542
  disabled = false,
@@ -732,7 +745,7 @@ function ButtonBody({
732
745
  const content = (
733
746
  <TextColorProvider value={ink}>
734
747
  <IconDefaultsProvider size={metrics.iconSize} color={ink}>
735
- <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>
736
749
  {spinner}
737
750
  </IconDefaultsProvider>
738
751
  </TextColorProvider>
@@ -780,4 +793,6 @@ const styles = StyleSheet.create({
780
793
  row: { flexDirection: "row", alignItems: "center", justifyContent: "center" },
781
794
  fromTop: { alignSelf: "stretch", transformOrigin: "top" },
782
795
  grow: { flexGrow: 1, flexShrink: 1 },
796
+ wraps: { flexShrink: 1, minWidth: 0, textAlign: "center" },
797
+ shrinks: { flexShrink: 1, minWidth: 0, maxWidth: "100%" },
783
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 { RowActionContext, RowEndContext, RowHoldContext, RowStartContext, holdProps, 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"
@@ -186,6 +186,7 @@ export function Checkbox({
186
186
  disabled={disabled}
187
187
  {...rowHold(hold)}
188
188
  {...holdProps({}, inRow || atRowStart ? rowAction : null)}
189
+ {...rowHint(rowAction, described)}
189
190
  onPress={toggle}
190
191
  testID={testID}
191
192
  style={[