@plexui/react-native 0.2.26 → 0.2.27

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.
@@ -107,6 +107,19 @@ declare namespace TabBarRoot {
107
107
  export declare const TabBar: typeof TabBarRoot & {
108
108
  Item: typeof TabBarItem;
109
109
  };
110
+ /**
111
+ * Where the tab bar's capsule stands, for what floats over it (a screen's floating buttons a set gap above it, a
112
+ * scroll that ends over it): `capsuleHeight`, and `bottom`, from the screen's bottom edge to the capsule's. iOS 26: the
113
+ * 54pt tabs in a capsule 4 above and below (62), 21 over the screen's bottom (or over the home indicator); Android:
114
+ * 56dp, 8 over the gesture bar. The bar itself (its soft edge) reaches higher. Pass the bar's `safeArea`.
115
+ */
116
+ export declare function useTabBarMetrics({ safeArea, minimized }?: {
117
+ safeArea?: boolean;
118
+ minimized?: boolean;
119
+ }): {
120
+ capsuleHeight: number;
121
+ bottom: number;
122
+ };
110
123
  /**
111
124
  * Minimizes a TabBar while the screen scrolls down and expands it when it scrolls back up, as iOS 26
112
125
  * `tabBarMinimizeBehavior(.onScrollDown)`: pass `onScroll` to the ScrollView and `minimized` and
@@ -16,6 +16,12 @@ export type TextLinkProps = {
16
16
  onPress?: (event: GestureResponderEvent) => void;
17
17
  /** The weight of the link's text; it takes the text's own around it by default (`--link-font-weight: inherit`). */
18
18
  weight?: FontWeightName;
19
+ /**
20
+ * A small action of its own outside running text (Restore Purchases under a store's plans): on iOS the text alone
21
+ * at the subheadline (15/20, regular) in the link color with a 44pt target and the system's pressed fade; on Android
22
+ * Material's small text button. @default false
23
+ */
24
+ standalone?: boolean;
19
25
  accessibilityLabel?: string;
20
26
  testID?: string;
21
27
  style?: StyleProp<TextStyle>;
@@ -27,4 +33,4 @@ export type TextLinkProps = {
27
33
  * row in the Plex Android look (the text's ink at 11%, white at 5% at night). With `href` it is a `link` and opens the
28
34
  * URL (an `<a>` on the web, a new tab for an external one); with only `onPress` it is a `button`.
29
35
  */
30
- export declare function TextLink({ children, href, primary, underline, forceExternal, onPress, weight, accessibilityLabel, testID, style }: TextLinkProps): import("react").JSX.Element;
36
+ export declare function TextLink({ children, href, primary, underline, forceExternal, onPress, weight, standalone, accessibilityLabel, testID, style }: TextLinkProps): import("react").JSX.Element;
@@ -10,7 +10,7 @@ export { Glass, type GlassProps } from "./internal/Glass";
10
10
  export { BarItemContext, type BarItemStyle } from "./components/Button/Button";
11
11
  export { NavigationButton, type NavigationAction, type NavigationButtonProps } from "./components/NavigationButton/NavigationButton";
12
12
  export { Toolbar, type ToolbarBackground, type ToolbarContentProps, type ToolbarPlacement, type ToolbarProps, type ToolbarTitleAlign, type ToolbarTitleProps, type ToolbarTitleStyle, } from "./components/Toolbar/Toolbar";
13
- export { TabBar, useTabBarMinimize, type TabBarBackground, type TabBarBadgeColor, type TabBarItemProps, type TabBarProminent, type TabBarProps, type TabBarSearch, } from "./components/TabBar/TabBar";
13
+ export { TabBar, useTabBarMetrics, useTabBarMinimize, type TabBarBackground, type TabBarBadgeColor, type TabBarItemProps, type TabBarProminent, type TabBarProps, type TabBarSearch, } from "./components/TabBar/TabBar";
14
14
  export { SegmentedControl, type SegmentedControlBadgeProp, type SegmentedControlOptionProps, type SegmentedControlProps, } from "./components/SegmentedControl/SegmentedControl";
15
15
  export { Switch, type SwitchProps } from "./components/Switch/Switch";
16
16
  export { Checkbox, type CheckboxProps } from "./components/Checkbox/Checkbox";
@@ -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, useListMetrics, type ListItemProps, type ListProps } from "./components/List/List";
40
+ export { List, ListItem, ListStack, useListMetrics, type ListItemProps, type ListProps, type ListStackProps } 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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/react-native",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
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",
@@ -1,6 +1,7 @@
1
1
  import { holdProps } from "../../internal/row"
2
2
  import { useEffect, useState, type ReactNode } from "react"
3
3
  import { Animated, Easing, Platform, StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
4
+ import { useAndroidGlass } from "../../internal/BarBackdrop"
4
5
  import { Pressable } from "../../internal/Pressable"
5
6
  import ChevronDownSm from "../../icons/plex/ChevronDownSm"
6
7
  import CloseBold from "../../icons/plex/CloseBold"
@@ -37,10 +38,16 @@ export type ChipProps = {
37
38
  accessibilityLabel?: string
38
39
  /**
39
40
  * iOS: `tag`, a capsule of the gray fill 40pt tall (a tag cloud in a sheet, as Maps' Filters), or `glass`, a glass
40
- * capsule 44pt tall (a filter in a row over content, as Maps' filters under its search). Android draws its chip with
41
- * either. @default "tag"
41
+ * capsule 44pt tall (a filter in a row over content, as Maps' filters under its search). Android draws Material's
42
+ * chip with either; with `glass` it stands on a glass of its size (the bar circles'), readable over content.
43
+ * @default "tag"
42
44
  */
43
45
  appearance?: "tag" | "glass"
46
+ /**
47
+ * iOS: `sm`, a step under the regular chip, as a filter row a step under Maps' 44: 36pt tall, the label 15/20, the
48
+ * insides in proportion, the target still 44. Android keeps Material's 32dp chip. @default "md"
49
+ */
50
+ size?: "md" | "sm"
44
51
  /** An input chip: called when the reader takes the value back (a cross on Android; see `removeStyle` on iOS). */
45
52
  onRemove?: () => void
46
53
  /** The remove action's name, for screen readers. @default "Remove" */
@@ -85,6 +92,7 @@ export function Chip({
85
92
  expanded,
86
93
  accessibilityLabel,
87
94
  appearance = "tag",
95
+ size = "md",
88
96
  onRemove,
89
97
  removeLabel = "Remove",
90
98
  removeStyle = "token",
@@ -179,13 +187,14 @@ export function Chip({
179
187
  }, [blend, blends, selected])
180
188
  const fillPaint = blends ? blend.interpolate({ inputRange: [0, 1], outputRange: [androidFill.off, androidFill.on] }) : fill
181
189
  const labelPaint = blends ? blend.interpolate({ inputRange: [0, 1], outputRange: [androidColor.off, androidColor.on] }) : color
182
- const height = android ? 32 : glass ? 44 : 40
183
- const label = android ? { fontSize: 14, lineHeight: 18 } : { fontSize: 17, lineHeight: 22 }
190
+ const small = !android && size === "sm"
191
+ const height = android ? 32 : small ? 36 : glass ? 44 : 40
192
+ const label = android ? { fontSize: 14, lineHeight: 18 } : small ? { fontSize: 15, lineHeight: 20 } : { fontSize: 17, lineHeight: 22 }
184
193
  const leading = icon
185
- // iOS: a 17pt symbol draws about 20 (the label's size)
186
- const iconSize = android ? 18 : 20
194
+ // iOS: a 17pt symbol draws about 20 (the label's size), a 15pt one about 17
195
+ const iconSize = android ? 18 : small ? 17 : 20
187
196
  // A menu chip's chevron: Material's 18dp arrow_drop_down, iOS's small chevron.down at the label's weight
188
- const trailing = trailingIcon ?? (menu ? android ? <MaterialArrowDropDown size={18} /> : <ChevronDownSm size={16} /> : null)
197
+ const trailing = trailingIcon ?? (menu ? android ? <MaterialArrowDropDown size={18} /> : <ChevronDownSm size={small ? 14 : 16} /> : null)
189
198
  const leadingColor = color
190
199
  // A symbol alone (Maps' filter button before its chips): a circle as tall as the chip, named by accessibilityLabel
191
200
  const symbolOnly = leading != null && (children == null || children === "") && trailing == null && !onRemove
@@ -202,6 +211,11 @@ export function Chip({
202
211
  // iOS's glass filter: a glass capsule (its rim and sheen), filled with the accent once chosen
203
212
  const glassLayer =
204
213
  glass && !selected ? <Glass pointerEvents="none" radius={radius} style={[StyleSheet.absoluteFill, { top: inset, bottom: inset }]} /> : null
214
+ // Android's chip over content (`glass`): it stands on a glass of its size, the Android bar circles' (a see-through
215
+ // card with a rim and a soft shadow), Material's fill and label over it
216
+ const androidGlass = useAndroidGlass("bar")
217
+ const androidBacking =
218
+ android && appearance === "glass" ? <View pointerEvents="none" style={[StyleSheet.absoluteFill, androidGlass, { top: inset, bottom: inset, borderRadius: radius }]} /> : null
205
219
  const layer = glassLayer ?? (
206
220
  <Animated.View pointerEvents="none" style={[StyleSheet.absoluteFill, { top: inset, bottom: inset, borderRadius: radius, backgroundColor: fillPaint, borderCurve: "continuous" }]}>
207
221
  {/* Android's press: the list selector over the chip, 6% black and 5% white at night (the dark theme's); over a
@@ -217,9 +231,9 @@ export function Chip({
217
231
  minHeight: target,
218
232
  paddingVertical: inset + (height - label.lineHeight) / 2,
219
233
  // Android: 12 at the sides, 8 before an icon and 6 after it
220
- paddingLeft: symbolOnly ? (height - iconSize) / 2 : leading != null ? (android ? 8 : 12) : android ? 12 : 16,
234
+ paddingLeft: symbolOnly ? (height - iconSize) / 2 : leading != null ? (android ? 8 : small ? 10 : 12) : android ? 12 : small ? 14 : 16,
221
235
  // Android: 8 after a trailing icon (Compose's FilterChip), iOS 12
222
- paddingRight: symbolOnly ? (height - iconSize) / 2 : cross ? 0 : trailing != null ? (android ? 8 : 12) : android ? 12 : 16,
236
+ paddingRight: symbolOnly ? (height - iconSize) / 2 : cross ? 0 : trailing != null ? (android ? 8 : small ? 10 : 12) : android ? 12 : small ? 14 : 16,
223
237
  gap: 6,
224
238
  opacity: !android && pressed ? 0.7 : 1,
225
239
  }
@@ -260,6 +274,8 @@ export function Chip({
260
274
  // Android dims a disabled chip, its fill with it, to half (as its other disabled controls)
261
275
  const dim = android && disabled ? styles.dim : null
262
276
  const handlers = {
277
+ // A symbol alone keeps the target's width past its circle (36 on iOS's small chip, 32 on Android's)
278
+ hitSlop: symbolOnly && height < target ? { left: (target - height) / 2, right: (target - height) / 2 } : undefined,
263
279
  ...(filter ? spaceToggles(press) : {}),
264
280
  // A menu chip is a button that opens its menu, even when it shows a chosen filter
265
281
  accessibilityRole: filter && !menu ? ("checkbox" as const) : ("button" as const),
@@ -305,6 +321,7 @@ export function Chip({
305
321
  if (cross) {
306
322
  return (
307
323
  <View testID={testID} style={[styles.chip, { minHeight: target }, dim, style]}>
324
+ {androidBacking}
308
325
  {layer}
309
326
  {interactive ? (
310
327
  <Pressable {...handlers} style={[styles.part, box]}>
@@ -328,6 +345,7 @@ export function Chip({
328
345
  if (!interactive) {
329
346
  return (
330
347
  <View testID={testID} style={[styles.chip, styles.part, box, dim, style]}>
348
+ {androidBacking}
331
349
  {layer}
332
350
  {body}
333
351
  </View>
@@ -335,6 +353,7 @@ export function Chip({
335
353
  }
336
354
  return (
337
355
  <Pressable {...handlers} testID={testID} style={[styles.chip, styles.part, box, dim, style]}>
356
+ {androidBacking}
338
357
  {layer}
339
358
  {body}
340
359
  </Pressable>
@@ -1,9 +1,10 @@
1
- import { useId, useState, type ReactNode } from "react"
1
+ import { createContext, useContext, useId, useState, type ReactNode } from "react"
2
2
  import { Animated, KeyboardAvoidingView, Platform, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native"
3
3
  import { Pressable } from "../../internal/Pressable"
4
4
  import { useSafeAreaInsets } from "react-native-safe-area-context"
5
5
  import { Glass } from "../../internal/Glass"
6
6
  import { useRipple } from "../../internal/ripple"
7
+ import { buttonColors } from "../Button/Button"
7
8
  import { useKeyboardHeight } from "../../internal/keyboard"
8
9
  import { androidDialogMotion, canTransformGlass, glassOpacity, iosDim, Overlay, ANDROID_DIALOG, ANDROID_DIM } from "../../internal/Overlay"
9
10
  import { withAlpha, dangerText } from "../../theme/material"
@@ -41,16 +42,33 @@ export type DialogProps = {
41
42
  mobileLayout?: "inline" | "stacked"
42
43
  /** A tap outside, Android's back and Escape close it: Android's dialogs do, an iOS alert does not. @default Android true, iOS false */
43
44
  dismissible?: boolean
45
+ /**
46
+ * The colors of the main action: `accent`, as iOS fills an alert's preferred action and Android writes its dialog
47
+ * buttons; `primary`, the main button's own (the solid primary button's fill and label on iOS, the primary ghost
48
+ * button's text on Android), for an app whose main actions are in its ink. @default "accent"
49
+ */
50
+ actionColor?: "accent" | "primary"
44
51
  testID?: string
45
52
  }
46
53
 
54
+ /** The dialog's `actionColor`, for its action buttons. */
55
+ const ActionColorContext = createContext<"accent" | "primary">("accent")
56
+
47
57
  /**
48
58
  * A dialog that asks for a decision: on iOS the alert of iOS 26 (UIAlertController `.alert`: 320 wide, glass, radius
49
59
  * 34, capsule actions 48 tall, `--dialog-alert-*`, Dialog.module.css), on Android a flat alert (at most 356 wide,
50
60
  * radius 21, a Medium 20 title over 16 text, text buttons in the accent at the end, Android's dialog animation). The
51
61
  * web Dialog's `mobileVariant="alert"` as one call; a sheet is `BottomSheet`.
52
62
  */
53
- export function Dialog({ open, onOpenChange, title, description, actions = [], children, mobileLayout, dismissible, testID }: DialogProps) {
63
+ export function Dialog({ actionColor = "accent", ...props }: DialogProps) {
64
+ return (
65
+ <ActionColorContext.Provider value={actionColor}>
66
+ <DialogView {...props} />
67
+ </ActionColorContext.Provider>
68
+ )
69
+ }
70
+
71
+ function DialogView({ open, onOpenChange, title, description, actions = [], children, mobileLayout, dismissible, testID }: Omit<DialogProps, "actionColor">) {
54
72
  const theme = useTheme()
55
73
  const close = () => onOpenChange(false)
56
74
  const run = (action: DialogAction) => {
@@ -386,18 +404,23 @@ function IOSAction({ theme, action, run, type, grow }: { theme: Theme; action: D
386
404
  // a preferredAction (iOS 27.2: 0082f7 on every row); disabled, the phone's disabled fill (Button.module.css). A
387
405
  // destructive one keeps the alert's fill and its red label
388
406
  const accent = action.preferred && action.variant !== "destructive"
407
+ const primary = useContext(ActionColorContext) === "primary"
389
408
  const height = theme.length("--dialog-alert-action-height", 48)
390
409
  const fill = accent
391
410
  ? action.disabled
392
411
  ? theme.color("--button-mobile-disabled-background", theme.color("--color-background-disabled"))
393
- : theme.color("--toolbar-prominent-background")
412
+ : primary
413
+ ? theme.color("--color-background-primary-solid")
414
+ : theme.color("--toolbar-prominent-background")
394
415
  : theme.color("--dialog-alert-fill")
395
416
  const text = action.disabled
396
417
  ? theme.color("--mobile-label-tertiary")
397
418
  : action.variant === "destructive"
398
419
  ? theme.color("--color-text-danger")
399
420
  : accent
400
- ? theme.color("--toolbar-prominent-color")
421
+ ? primary
422
+ ? theme.color("--color-text-primary-solid")
423
+ : theme.color("--toolbar-prominent-color")
401
424
  : theme.colors.text
402
425
  const lit = accent && !action.disabled
403
426
  return (
@@ -412,7 +435,7 @@ function IOSAction({ theme, action, run, type, grow }: { theme: Theme; action: D
412
435
  {
413
436
  minHeight: height,
414
437
  borderRadius: height / 2,
415
- backgroundColor: lit && pressed ? theme.color("--toolbar-prominent-background-active") : fill,
438
+ backgroundColor: lit && pressed ? theme.color(primary ? "--color-background-primary-solid-active" : "--toolbar-prominent-background-active") : fill,
416
439
  opacity: pressed && !lit ? 0.7 : 1,
417
440
  },
418
441
  grow ? styles.grow : null,
@@ -506,7 +529,8 @@ function AndroidDialog({ theme, title, description, actions, run, ids, children,
506
529
  * ripple of the label's color at 10% from the touch point, clipped to its 20dp pill (the platform's on a device).
507
530
  */
508
531
  function AndroidDialogButton({ theme, action, run, onWidth }: { theme: Theme; action: DialogAction; run: (action: DialogAction) => void; onWidth: (width: number) => void }) {
509
- const color = action.variant === "destructive" ? dangerText(theme) : theme.material.primary
532
+ const primary = useContext(ActionColorContext) === "primary"
533
+ const color = action.variant === "destructive" ? dangerText(theme) : primary ? buttonColors(theme, "primary", "ghost", false, false).text : theme.material.primary
510
534
  const press = withAlpha(color, 0.1)
511
535
  const nativeRipple = Platform.OS === "android"
512
536
  const ripple = useRipple(press, !nativeRipple, theme.reducedMotion)
@@ -1,5 +1,5 @@
1
1
  import { Children, cloneElement, createContext, isValidElement, useContext, type ReactNode } from "react"
2
- import { StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
2
+ import { StyleSheet, View, type StyleProp, type TextStyle, type ViewStyle } from "react-native"
3
3
  import { space } from "../../internal/spacing"
4
4
  import { useTheme } from "../../theme/ThemeProvider"
5
5
  import type { Theme } from "../../theme/types"
@@ -95,7 +95,16 @@ function EmptyMessageIcon({ children, color = "secondary", size }: { children: R
95
95
  }
96
96
  EmptyMessageIcon.displayName = "EmptyMessage.Icon"
97
97
 
98
- function EmptyMessageTitle({ children, color }: { children: ReactNode; color?: Tone }) {
98
+ function EmptyMessageTitle({
99
+ children,
100
+ color,
101
+ style,
102
+ }: {
103
+ children: ReactNode
104
+ color?: Tone
105
+ /** Over the title's own type: a brand's display face at its size and line (`fontFamily`, `fontSize`, `lineHeight`). */
106
+ style?: StyleProp<TextStyle>
107
+ }) {
99
108
  const { theme, size, align } = useEmpty("EmptyMessage.Title")
100
109
  const compact = size === "sm"
101
110
  // Android's empty view: the title Medium 20 (16 in the compact message)
@@ -113,7 +122,7 @@ function EmptyMessageTitle({ children, color }: { children: ReactNode; color?: T
113
122
  color={color && color !== "secondary" ? toneColor(theme, color) : undefined}
114
123
  // `left` is the start: React Native turns it to the right in a right-to-left layout. `auto` took the alignment of
115
124
  // the page around it on the web, where a centered page left a start-aligned message centered
116
- style={{ fontSize: type.fontSize, lineHeight: type.lineHeight, textAlign: align === "center" ? "center" : "left", marginBottom: compact ? space(theme, 1) : 0 }}
125
+ style={[{ fontSize: type.fontSize, lineHeight: type.lineHeight, textAlign: align === "center" ? "center" : "left", marginBottom: compact ? space(theme, 1) : 0 }, style]}
117
126
  >
118
127
  {children}
119
128
  </Text>
@@ -1,6 +1,7 @@
1
1
  import { createContext, useCallback, useContext, useEffect, useRef, useState, type ComponentRef, type ReactNode, type Ref } from "react"
2
2
  import { Animated, Easing, PixelRatio, Platform, StyleSheet, Text as NativeText, TextInput, View, processColor, type PressableProps, type StyleProp, type TextInputProps, type ViewProps, type ViewStyle } from "react-native"
3
3
  import { Pressable } from "../../internal/Pressable"
4
+ import { Text } from "../Text/Text"
4
5
  import XCircleFilled from "../../icons/plex/XCircleFilled"
5
6
  import { useAndroidGlass } from "../../internal/BarBackdrop"
6
7
  import { FieldStack, FloatLabelContext } from "../../internal/fieldStack"
@@ -896,6 +897,13 @@ export type TextFieldProps = InputProps & {
896
897
  /** Shown under the field in place of the description, and marks it invalid. */
897
898
  errorMessage?: ReactNode
898
899
  required?: boolean
900
+ /** Content at the end of the label's line on iOS, or of the help's line on Android (where the label floats). */
901
+ labelAction?: ReactNode
902
+ /**
903
+ * Shows the count of characters against `maxLength` (`3/15`): Material's counter at the end of the help's line on
904
+ * Android, at the end of the label's line on iOS.
905
+ */
906
+ counter?: boolean
899
907
  }
900
908
 
901
909
  /**
@@ -903,11 +911,39 @@ export type TextFieldProps = InputProps & {
903
911
  * description or error under it (15/20, 4pt below, `--mobile-field-error-*`); Android is the outlined field with its
904
912
  * floating label (on the line of an outlined field) and the help under it (14, 14dp in).
905
913
  */
906
- export function TextField({ label, description, errorMessage, required, invalid, ...input }: TextFieldProps) {
914
+ export function TextField({ label, description, errorMessage, required, invalid, labelAction, counter = false, ...input }: TextFieldProps) {
907
915
  const theme = useTheme()
916
+ const [typed, setTyped] = useState((input.defaultValue ?? "").length)
917
+ const count = input.value != null ? input.value.length : typed
918
+ const counterText =
919
+ counter && input.maxLength != null ? (
920
+ <Text
921
+ color="secondary"
922
+ accessibilityLabel={`${count} of ${input.maxLength}`}
923
+ style={[
924
+ theme.isAndroid ? styles.androidCounter : styles.iosCounter,
925
+ { opacity: input.disabled ? 0.5 : 1 },
926
+ theme.isAndroid ? { color: theme.colors.textSecondary } : null,
927
+ ]}
928
+ >
929
+ {count}/{input.maxLength}
930
+ </Text>
931
+ ) : null
932
+ const end =
933
+ labelAction != null && counterText != null ? (
934
+ <View style={styles.endRow}>
935
+ {labelAction}
936
+ {counterText}
937
+ </View>
938
+ ) : (
939
+ labelAction ?? counterText
940
+ )
941
+ // The count follows every edit, so a counter shown later reads the text as it is
942
+ const field: InputProps = { ...input, onChangeText: (next: string) => (setTyped(next.length), input.onChangeText?.(next)) }
908
943
  return (
909
944
  <FieldStack
910
945
  label={label}
946
+ labelAction={end ?? undefined}
911
947
  required={required}
912
948
  description={description}
913
949
  errorMessage={errorMessage}
@@ -919,10 +955,10 @@ export function TextField({ label, description, errorMessage, required, invalid,
919
955
  >
920
956
  {({ described, invalid: bad, shake }) =>
921
957
  theme.isAndroid ? (
922
- <InputField {...input} {...described} label={label} required={required} invalid={bad} shift={shake} />
958
+ <InputField {...field} {...described} label={label} required={required} invalid={bad} shift={shake} />
923
959
  ) : (
924
960
  <InputField
925
- {...input}
961
+ {...field}
926
962
  {...described}
927
963
  accessibilityLabel={input.accessibilityLabel ?? (typeof label === "string" ? label : undefined)}
928
964
  required={required}
@@ -940,6 +976,10 @@ const ROW_START: AdornmentPlace = { side: "start", row: true }
940
976
  const ROW_END: AdornmentPlace = { side: "end", row: true }
941
977
 
942
978
  const styles = StyleSheet.create({
979
+ // Material's counter: the help's type, at the end of its line, 16 from the help and 14 in from the field's end
980
+ androidCounter: { fontSize: 14, lineHeight: 18, paddingStart: 16, paddingEnd: 14, paddingTop: 6, fontVariant: ["tabular-nums"] },
981
+ iosCounter: { fontSize: 15, lineHeight: 20, fontVariant: ["tabular-nums"] },
982
+ endRow: { flexDirection: "row", alignItems: "center", gap: 8 },
943
983
  adornmentButton: { alignItems: "center", justifyContent: "center" },
944
984
  // Centered in the 48dp target
945
985
  adornmentPressed: { position: "absolute", top: 4, start: 4, width: 40, height: 40, borderRadius: 20 },
@@ -1,6 +1,8 @@
1
1
  import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState, type ComponentRef, type ReactElement, type ReactNode } from "react"
2
2
  import { Animated, Easing, Platform, StyleSheet, View, type GestureResponderEvent, type LayoutChangeEvent, type StyleProp, type TextStyle, type ViewStyle } from "react-native"
3
+ import { useSafeAreaInsets } from "react-native-safe-area-context"
3
4
  import { Pressable } from "../../internal/Pressable"
5
+ import CheckMd from "../../icons/plex/CheckMd"
4
6
  import Disclosure from "../../icons/plex/Disclosure"
5
7
  import ExclamationMarkCircle from "../../icons/plex/ExclamationMarkCircle"
6
8
  import { describedBy, spaceToggles, useDescription, useHint } from "../../internal/a11y"
@@ -316,6 +318,51 @@ export function List({
316
318
  )
317
319
  }
318
320
 
321
+ export type ListStackProps = {
322
+ /** The sections (`List`) and any blocks between them (a note, a button). */
323
+ children: ReactNode
324
+ /** The space between two blocks that are not both sections, as the screen's own. @default 0 */
325
+ gap?: number
326
+ /**
327
+ * Keeps the room under the last section (iOS 35 over the home indicator, Android at least 16 over the system's bar).
328
+ * Off for a stack that is not the screen's end. @default true
329
+ */
330
+ end?: boolean
331
+ style?: StyleProp<ViewStyle>
332
+ testID?: string
333
+ }
334
+
335
+ /**
336
+ * Sections one under another, as SwiftUI's Form and the web's stacked FieldGroups space them: on iOS 35 rows to rows,
337
+ * less what a footer's block (17.33) and a header's (18.67, a prominent one 18, after a footer 11.33) take; on Android
338
+ * 12 apart, none after a footer. Blocks that are not sections keep `gap`; the stack ends with the last section's room.
339
+ */
340
+ export function ListStack({ children, gap = 0, end = true, style, testID }: ListStackProps) {
341
+ const theme = useTheme()
342
+ const insets = useSafeAreaInsets()
343
+ const items = flattenChildren(children)
344
+ const section = (node: ReactNode): ListProps | null => (isValidElement(node) && node.type === List ? (node.props as ListProps) : null)
345
+ const space = (before: ListProps | null, after: ListProps | null) => {
346
+ if (before == null || after == null) return gap
347
+ const footer = before.footer != null || before.error != null
348
+ const header = after.header != null || after.description != null || after.action != null
349
+ if (theme.isAndroid) return footer ? 0 : 12
350
+ const prominent = after.headerProminence === "increased"
351
+ return 35 - (footer ? 17.33 : 0) - (header ? (prominent ? 18 : footer ? 11.33 : 18.67) : 0)
352
+ }
353
+ const last = section(items[items.length - 1])
354
+ const bottom = !end ? 0 : theme.isAndroid ? Math.max(16, insets.bottom) : last != null ? 35 + insets.bottom : insets.bottom
355
+ return (
356
+ <View style={[{ paddingBottom: bottom }, style]} testID={testID}>
357
+ {items.map((child, index) => (
358
+ <View key={isValidElement(child) && child.key != null ? child.key : index} style={index > 0 ? { marginTop: space(section(items[index - 1]), section(child)) } : null}>
359
+ {child}
360
+ </View>
361
+ ))}
362
+ </View>
363
+ )
364
+ }
365
+
319
366
  export type ListItemProps = {
320
367
  /** The row's text, as @plexui/ui's NavigationRow `label`. */
321
368
  label: ReactNode
@@ -348,6 +395,12 @@ export type ListItemProps = {
348
395
  * control stays the one element for a screen reader, named by the label when it has no name of its own.
349
396
  */
350
397
  trailing?: ReactNode
398
+ /**
399
+ * A row of a list to pick one from (countries with their codes, a sound): `true` draws the check at its end (the
400
+ * accent's checkmark), `false` keeps the check's room, so the values of every row stand in one column and a pick
401
+ * moves no text. Read as selected. Leave `trailing` out.
402
+ */
403
+ selected?: boolean
351
404
  /**
352
405
  * An error under the row, as the web's FieldError in a form row: on iOS a line of its own across the row, 4 under the
353
406
  * label, 15/20 in the danger color after a 16pt exclamation mark; on Android under the label, 13sp in the error color.
@@ -401,7 +454,8 @@ export function ListItem({
401
454
  value,
402
455
  valuePlacement = "end",
403
456
  valueColor,
404
- trailing,
457
+ trailing: trailingProp,
458
+ selected,
405
459
  error,
406
460
  checked: checkedProp,
407
461
  defaultChecked,
@@ -421,6 +475,7 @@ export function ListItem({
421
475
  // A menu opened from the row finds the row (Android lights it over the dim of the screen)
422
476
  const frameNode = useRef<unknown>(null)
423
477
  const frame = useMemo<RowFrame>(() => ({ node: frameNode, radius: { top, bottom } }), [top, bottom])
478
+ const trailing = trailingProp ?? (selected === undefined ? undefined : <CheckSlot selected={selected} />)
424
479
  const switchRow = checkedProp !== undefined || defaultChecked !== undefined || onCheckedChange !== undefined
425
480
  const [own, setOwn] = useState(defaultChecked ?? false)
426
481
  const checked = checkedProp ?? own
@@ -538,8 +593,10 @@ export function ListItem({
538
593
  tabIndex={endOwnsFocus ? -1 : undefined}
539
594
  accessibilityRole={endOwnsFocus ? undefined : switchRow ? "switch" : "button"}
540
595
  accessibilityLabel={endOwnsFocus ? undefined : name}
541
- accessibilityState={endOwnsFocus ? undefined : switchRow ? { checked, disabled } : { disabled }}
596
+ accessibilityState={endOwnsFocus ? undefined : switchRow ? { checked, disabled } : { disabled, ...(selected !== undefined ? { selected } : null) }}
542
597
  aria-checked={switchRow ? checked : undefined}
598
+ // React Native Web drops a button's selected state: the web reads a chosen row as a pressed button
599
+ {...(Platform.OS === "web" && !endOwnsFocus && !switchRow && selected !== undefined ? ({ "aria-pressed": selected } as object) : null)}
543
600
  disabled={disabled || (press == null && onLongPress == null)}
544
601
  onPress={press}
545
602
  {...holdProps({ run: onLongPress, label: longPressLabel }, null)}
@@ -583,6 +640,17 @@ export function ListItem({
583
640
  )
584
641
  }
585
642
 
643
+ /** The check of a choice row, or its empty room: the accent's checkmark, 20 on iOS (a 17pt symbol), 24 on Android. */
644
+ function CheckSlot({ selected }: { selected: boolean }) {
645
+ const theme = useTheme()
646
+ const size = theme.isAndroid ? 24 : 20
647
+ return (
648
+ <View style={{ width: size, height: size }} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
649
+ {selected ? <CheckMd size={size} color={theme.isAndroid ? theme.material.primary : theme.colors.accent} /> : null}
650
+ </View>
651
+ )
652
+ }
653
+
586
654
  /** A Button among a List's rows: the row is the button (`ListActionContext`), the hairline under it from the text's start. */
587
655
  function ActionRow({ children }: { children: ReactNode }) {
588
656
  const theme = useTheme()
@@ -10,6 +10,12 @@ export type ScrollEdgeProps = {
10
10
  scrolled?: boolean
11
11
  /** The color of the screen it fades into (a grouped screen's canvas). @default the theme's background */
12
12
  canvasColor?: string
13
+ /**
14
+ * Top edge under a floating row (filters, tabs): where the fade ends, from the screen's top. Only what went under the
15
+ * row is muted, the content below it stays sharp: pass the row's bottom. On Android, too, the edge then is the row's
16
+ * (iOS 27.2's), not the status bar's alone.
17
+ */
18
+ fadeEnd?: number
13
19
  testID?: string
14
20
  style?: StyleProp<ViewStyle>
15
21
  }
@@ -21,13 +27,17 @@ export type ScrollEdgeProps = {
21
27
  * the screen's color that grows to 46% at the screen's edge. On Android the top edge is the soft edge of its top bar
22
28
  * over the status bar alone, the bottom one draws nothing. Lay it over the screen, after the scroll view.
23
29
  */
24
- export function ScrollEdge({ edge = "top", scrolled = false, canvasColor, testID, style }: ScrollEdgeProps) {
30
+ export function ScrollEdge({ edge = "top", scrolled = false, canvasColor, fadeEnd, testID, style }: ScrollEdgeProps) {
25
31
  const theme = useTheme()
26
32
  const insets = useSafeAreaInsets()
27
33
  const canvas = canvasColor ?? theme.colors.background
28
34
  const top = edge === "top"
29
35
  if (top && !scrolled) return null
30
- if (theme.isAndroid) {
36
+ const height = StyleSheet.flatten(style)?.height
37
+ // A row under the status bar (a height or a fade's end given): Android takes iOS's edge for it, as a row over
38
+ // content reads on neither platform under the status bar's edge alone
39
+ const row = top && (fadeEnd != null || typeof height === "number")
40
+ if (theme.isAndroid && !row) {
31
41
  if (!top) return null
32
42
  return (
33
43
  <View pointerEvents="none" testID={testID} style={[{ position: "absolute", top: 0, left: 0, right: 0, height: insets.top }, style]}>
@@ -36,14 +46,15 @@ export function ScrollEdge({ edge = "top", scrolled = false, canvasColor, testID
36
46
  )
37
47
  }
38
48
  // The safe area at that edge, or the height the style gives the top edge (a bar's row of buttons under the status
39
- // bar): the content is blurred in full down to it, and the veil and the blur ease out over the 34 past it
40
- const height = StyleSheet.flatten(style)?.height
41
- const reach = top && typeof height === "number" ? height + FULL_BLUR_SHORTFALL : insets.top
49
+ // bar): the content is blurred in full down to it, and the veil and the blur ease out over the 34 past it. A fade's
50
+ // end is where the veil's 34 end, so the content under it shows clear
51
+ const reach =
52
+ top && fadeEnd != null ? fadeEnd - FADE_PAST - FULL_BLUR_SHORTFALL : top && typeof height === "number" ? height + FULL_BLUR_SHORTFALL : insets.top
42
53
  return (
43
54
  <View
44
55
  pointerEvents="none"
45
56
  testID={testID}
46
- style={[{ position: "absolute", left: 0, right: 0 }, top ? { top: 0, height: insets.top } : { bottom: 0, height: insets.bottom }, style]}
57
+ style={[{ position: "absolute", left: 0, right: 0 }, top ? { top: 0, height: fadeEnd ?? insets.top } : { bottom: 0, height: insets.bottom }, style]}
47
58
  >
48
59
  {top ? <SoftBottomVeil fill={canvas} bottom={reach} /> : <SoftBottomVeil fill={canvas} top={0} />}
49
60
  </View>
@@ -52,3 +63,5 @@ export function ScrollEdge({ edge = "top", scrolled = false, canvasColor, testID
52
63
 
53
64
  /** The veil's blur is full 6 short of the edge it is turned over at (12 to 40 into its 34): a given height adds them. */
54
65
  const FULL_BLUR_SHORTFALL = 6
66
+ /** From the height where the blur is whole, the fade runs on 28 more (the 34 of the veil less its shortfall). */
67
+ const FADE_PAST = 28
@@ -884,6 +884,21 @@ export const TabBar = Object.assign(TabBarRoot, { Item: TabBarItem })
884
884
  /** A scroll of at least this many points in one direction minimizes or expands the bar, as on the web. */
885
885
  const MINIMIZE_AFTER = 8
886
886
 
887
+ /**
888
+ * Where the tab bar's capsule stands, for what floats over it (a screen's floating buttons a set gap above it, a
889
+ * scroll that ends over it): `capsuleHeight`, and `bottom`, from the screen's bottom edge to the capsule's. iOS 26: the
890
+ * 54pt tabs in a capsule 4 above and below (62), 21 over the screen's bottom (or over the home indicator); Android:
891
+ * 56dp, 8 over the gesture bar. The bar itself (its soft edge) reaches higher. Pass the bar's `safeArea`.
892
+ */
893
+ export function useTabBarMetrics({ safeArea = true, minimized = false }: { safeArea?: boolean; minimized?: boolean } = {}): { capsuleHeight: number; bottom: number } {
894
+ const theme = useTheme()
895
+ const insets = useSafeAreaInsets()
896
+ if (theme.isAndroid) return { capsuleHeight: 56, bottom: 8 + (safeArea ? insets.bottom : 0) }
897
+ const padBottom = minimized ? theme.length("--tab-bar-minimized-padding-bottom", 28) : theme.length("--tab-bar-padding-bottom", 21)
898
+ const capsuleHeight = minimized ? theme.length("--tab-bar-minimized-size", 48) : theme.length("--tab-bar-item-height", 54) + 2 * theme.length("--tab-bar-capsule-padding-block", 4)
899
+ return { capsuleHeight, bottom: safeArea ? Math.max(padBottom, insets.bottom - 13) : padBottom }
900
+ }
901
+
887
902
  /**
888
903
  * Minimizes a TabBar while the screen scrolls down and expands it when it scrolls back up, as iOS 26
889
904
  * `tabBarMinimizeBehavior(.onScrollDown)`: pass `onScroll` to the ScrollView and `minimized` and