@plexui/react-native 0.2.7 → 0.2.8

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 (66) hide show
  1. package/dist/es/components/ActionSheet/ActionSheet.js +2 -1
  2. package/dist/es/components/Alert/Alert.js +2 -1
  3. package/dist/es/components/Avatar/Avatar.js +2 -1
  4. package/dist/es/components/Badge/Badge.js +2 -1
  5. package/dist/es/components/BottomActions/BottomActions.js +3 -3
  6. package/dist/es/components/BottomSheet/BottomSheet.js +2 -1
  7. package/dist/es/components/Button/Button.js +2 -1
  8. package/dist/es/components/Card/Card.js +2 -1
  9. package/dist/es/components/Checkbox/Checkbox.js +2 -1
  10. package/dist/es/components/Chip/Chip.js +2 -1
  11. package/dist/es/components/DatePicker/Calendar.js +2 -1
  12. package/dist/es/components/DatePicker/DatePicker.js +2 -1
  13. package/dist/es/components/DatePicker/TimeDial.js +2 -1
  14. package/dist/es/components/DatePicker/Wheel.js +2 -1
  15. package/dist/es/components/Dialog/Dialog.js +2 -1
  16. package/dist/es/components/Input/Input.js +2 -1
  17. package/dist/es/components/InputGroup/InputGroup.js +2 -1
  18. package/dist/es/components/List/List.js +31 -8
  19. package/dist/es/components/Menu/Menu.js +2 -1
  20. package/dist/es/components/RadioGroup/RadioGroup.js +2 -1
  21. package/dist/es/components/SegmentedControl/SegmentedControl.js +52 -54
  22. package/dist/es/components/Select/Select.js +2 -1
  23. package/dist/es/components/Stepper/Stepper.js +2 -1
  24. package/dist/es/components/Switch/Switch.js +2 -1
  25. package/dist/es/components/TabBar/TabBar.js +2 -1
  26. package/dist/es/components/TagInput/TagInput.js +2 -1
  27. package/dist/es/components/Tip/Tip.js +2 -1
  28. package/dist/es/components/Toast/Toast.js +2 -1
  29. package/dist/es/internal/Pressable.js +10 -0
  30. package/dist/es/theme/material.js +11 -2
  31. package/dist/types/components/BottomActions/BottomActions.d.ts +10 -1
  32. package/dist/types/components/SegmentedControl/SegmentedControl.d.ts +11 -2
  33. package/dist/types/index.d.ts +1 -1
  34. package/dist/types/internal/Pressable.d.ts +3 -0
  35. package/package.json +1 -1
  36. package/src/components/ActionSheet/ActionSheet.tsx +2 -1
  37. package/src/components/Alert/Alert.tsx +2 -1
  38. package/src/components/Avatar/Avatar.tsx +2 -1
  39. package/src/components/Badge/Badge.tsx +2 -1
  40. package/src/components/BottomActions/BottomActions.tsx +14 -2
  41. package/src/components/BottomSheet/BottomSheet.tsx +2 -1
  42. package/src/components/Button/Button.tsx +2 -13
  43. package/src/components/Card/Card.tsx +2 -1
  44. package/src/components/Checkbox/Checkbox.tsx +2 -1
  45. package/src/components/Chip/Chip.tsx +2 -1
  46. package/src/components/DatePicker/Calendar.tsx +2 -1
  47. package/src/components/DatePicker/DatePicker.tsx +2 -1
  48. package/src/components/DatePicker/TimeDial.tsx +2 -1
  49. package/src/components/DatePicker/Wheel.tsx +2 -1
  50. package/src/components/Dialog/Dialog.tsx +2 -1
  51. package/src/components/Input/Input.tsx +2 -17
  52. package/src/components/InputGroup/InputGroup.tsx +2 -1
  53. package/src/components/List/List.tsx +39 -9
  54. package/src/components/Menu/Menu.tsx +2 -1
  55. package/src/components/RadioGroup/RadioGroup.tsx +2 -1
  56. package/src/components/SegmentedControl/SegmentedControl.tsx +68 -48
  57. package/src/components/Select/Select.tsx +2 -1
  58. package/src/components/Stepper/Stepper.tsx +2 -1
  59. package/src/components/Switch/Switch.tsx +2 -1
  60. package/src/components/TabBar/TabBar.tsx +2 -13
  61. package/src/components/TagInput/TagInput.tsx +2 -1
  62. package/src/components/Tip/Tip.tsx +2 -1
  63. package/src/components/Toast/Toast.tsx +2 -1
  64. package/src/index.ts +1 -1
  65. package/src/internal/Pressable.tsx +17 -0
  66. package/src/theme/material.ts +9 -2
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useId, useRef, useState } from "react";
3
- import { Animated, Platform, Pressable, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native";
3
+ import { Animated, Platform, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { useSafeAreaInsets } from "react-native-safe-area-context";
5
6
  import { FloatingPanel } from "../../internal/FloatingPanel";
6
7
  import { Glass } from "../../internal/Glass";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cloneElement, isValidElement, useState } from "react";
3
- import { Pressable, StyleSheet, View } from "react-native";
3
+ import { StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import CheckCircle from "../../icons/plex/CheckCircle";
5
6
  import InfoCircle from "../../icons/plex/InfoCircle";
6
7
  import Warning from "../../icons/plex/Warning";
@@ -1,6 +1,7 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Children, isValidElement, useId, useState } from "react";
3
- import { Animated, Easing, Platform, Pressable, StyleSheet, View } from "react-native";
3
+ import { Animated, Easing, Platform, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import Svg, { Circle, Defs, LinearGradient, Stop } from "react-native-svg";
5
6
  import { useTheme } from "../../theme/ThemeProvider";
6
7
  import { Text } from "../Text/Text";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useLayoutEffect, useRef, useState } from "react";
3
- import { Animated, Pressable, StyleSheet, Text as NativeText, View } from "react-native";
3
+ import { Animated, StyleSheet, Text as NativeText, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import CloseBold from "../../icons/plex/CloseBold";
5
6
  import { flattenChildren } from "../../internal/children";
6
7
  import { curves } from "../../internal/motion";
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Children, cloneElement, isValidElement } from "react";
3
3
  import { StyleSheet, View } from "react-native";
4
4
  import { useSafeAreaInsets } from "react-native-safe-area-context";
5
- import { ANDROID_FADE_ALPHA, ANDROID_FADE_STOPS, SoftBottomEdge } from "../../internal/BarBackdrop";
5
+ import { ANDROID_FADE_ALPHA, ANDROID_FADE_STOPS, SoftBottomEdge, TabBarFade } from "../../internal/BarBackdrop";
6
6
  import { withAlpha } from "../../theme/material";
7
7
  import { useTheme } from "../../theme/ThemeProvider";
8
8
  import { Button } from "../Button/Button";
@@ -13,7 +13,7 @@ import { Button } from "../Button/Button";
13
13
  * action stands under it, 8 apart. Android: the Plex Android look's 48dp full-width button, 16dp from the sides and
14
14
  * 16 above the gesture bar. Each Button inside is a block of the size `3xl` unless it sets its own.
15
15
  */
16
- export function BottomActions({ children, floating = false, canvasColor, testID, style }) {
16
+ export function BottomActions({ children, floating = false, background = "soft", canvasColor, testID, style }) {
17
17
  const theme = useTheme();
18
18
  const insets = useSafeAreaInsets();
19
19
  const android = theme.isAndroid;
@@ -40,7 +40,7 @@ export function BottomActions({ children, floating = false, canvasColor, testID,
40
40
  style: [{ minHeight: height, borderRadius: height / 2 }, props.style],
41
41
  });
42
42
  });
43
- return (_jsxs(View, { testID: testID, pointerEvents: "box-none", style: [styles.bar, { paddingHorizontal: side, paddingTop, paddingBottom: bottom, gap: 8 }, floating ? styles.floating : null, style], children: [floating ? (android ? (_jsx(SoftBottomEdge, { fill: withAlpha(canvas, ANDROID_FADE_ALPHA), top: paddingTop - 13 + 60, tail: 60, blur: 0, stops: ANDROID_FADE_STOPS })) : (_jsx(SoftBottomEdge, { fill: canvas, top: paddingTop, tail: 27, blur: theme.length("--toolbar-edge-blur-small", 3) }))) : null, actions] }));
43
+ return (_jsxs(View, { testID: testID, pointerEvents: "box-none", style: [styles.bar, { paddingHorizontal: side, paddingTop, paddingBottom: bottom, gap: 8 }, floating ? styles.floating : null, style], children: [floating ? (android ? (_jsx(SoftBottomEdge, { fill: withAlpha(canvas, ANDROID_FADE_ALPHA), top: paddingTop - 13 + 60, tail: 60, blur: 0, stops: ANDROID_FADE_STOPS })) : background === "fade" ? (_jsx(TabBarFade, { fill: canvas, top: paddingTop })) : (_jsx(SoftBottomEdge, { fill: canvas, top: paddingTop, tail: 27, blur: theme.length("--toolbar-edge-blur-small", 3) }))) : null, actions] }));
44
44
  }
45
45
  const styles = StyleSheet.create({
46
46
  bar: { alignSelf: "stretch" },
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { isValidElement, useId, useLayoutEffect, useMemo, useState } from "react";
3
- import { Animated, Easing, PanResponder, Platform, Pressable, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native";
3
+ import { Animated, Easing, PanResponder, Platform, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { useSafeAreaInsets } from "react-native-safe-area-context";
5
6
  import { childrenOfType, flattenChildren } from "../../internal/children";
6
7
  import { useKeyboardHeight } from "../../internal/keyboard";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createContext, Fragment, isValidElement, useContext, useEffect, useState } from "react";
3
- import { ActivityIndicator, Animated, Easing, Platform, Pressable, StyleSheet, View, } from "react-native";
3
+ import { ActivityIndicator, Animated, Easing, Platform, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import Svg, { Circle } from "react-native-svg";
5
6
  import { flattenChildren } from "../../internal/children";
6
7
  import { Glass } from "../../internal/Glass";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cloneElement, createContext, isValidElement, useContext } from "react";
3
- import { Image, Platform, Pressable, StyleSheet, View } from "react-native";
3
+ import { Image, Platform, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { flattenChildren } from "../../internal/children";
5
6
  import { space } from "../../internal/spacing";
6
7
  import { controlHighlight, withAlpha } from "../../theme/material";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useContext, useEffect, useState } from "react";
3
- import { Animated, Easing, Pressable, StyleSheet, View } from "react-native";
3
+ import { Animated, Easing, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import Svg, { Path } from "react-native-svg";
5
6
  import CheckMd from "../../icons/plex/CheckMd";
6
7
  import Minus from "../../icons/plex/Minus";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from "react";
3
- import { Animated, Easing, Platform, Pressable, StyleSheet, View } from "react-native";
3
+ import { Animated, Easing, Platform, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import ChevronDownSm from "../../icons/plex/ChevronDownSm";
5
6
  import CloseBold from "../../icons/plex/CloseBold";
6
7
  import XCircleFilled from "../../icons/plex/XCircleFilled";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from "react";
3
- import { Platform, Pressable, StyleSheet, View } from "react-native";
3
+ import { Platform, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import ChevronLeftLg from "../../icons/plex/ChevronLeftLg";
5
6
  import ChevronRightLg from "../../icons/plex/ChevronRightLg";
6
7
  import { isRTL } from "../../internal/direction";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useContext, useEffect, useRef, useState } from "react";
3
- import { Pressable, StyleSheet, View, useWindowDimensions } from "react-native";
3
+ import { StyleSheet, View, useWindowDimensions } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { RowEndContext, RowHoldContext, rowHold } from "../../internal/row";
5
6
  import { withAlpha } from "../../theme/material";
6
7
  import { useTheme } from "../../theme/ThemeProvider";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef, useState } from "react";
3
- import { Platform, Pressable, StyleSheet, View } from "react-native";
3
+ import { Platform, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import Svg, { Circle, Line } from "react-native-svg";
5
6
  import { useTheme } from "../../theme/ThemeProvider";
6
7
  import { Text } from "../Text/Text";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from "react";
3
- import { Animated, Platform, Pressable, ScrollView, StyleSheet, View } from "react-native";
3
+ import { Animated, Platform, ScrollView, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { withAlpha } from "../../theme/material";
5
6
  import { useTheme } from "../../theme/ThemeProvider";
6
7
  /** iOS: a row of UIDatePicker's wheels, 32 apart (the band of iOS 27.2, 32 tall). Android: a NumberPicker's 48dp rows. */
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useId, useState } from "react";
3
- import { Animated, KeyboardAvoidingView, Platform, Pressable, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native";
3
+ import { Animated, KeyboardAvoidingView, Platform, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { useSafeAreaInsets } from "react-native-safe-area-context";
5
6
  import { Glass } from "../../internal/Glass";
6
7
  import { useRipple } from "../../internal/ripple";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
3
- import { Animated, Easing, PixelRatio, Platform, Pressable, StyleSheet, Text as NativeText, TextInput, View, processColor, } from "react-native";
3
+ import { Animated, Easing, PixelRatio, Platform, StyleSheet, Text as NativeText, TextInput, View, processColor } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import XCircleFilled from "../../icons/plex/XCircleFilled";
5
6
  import { useAndroidGlass } from "../../internal/BarBackdrop";
6
7
  import { FieldStack, FloatLabelContext } from "../../internal/fieldStack";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createContext, isValidElement, useContext } from "react";
3
- import { Pressable, StyleSheet, View } from "react-native";
3
+ import { StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { flattenChildren } from "../../internal/children";
5
6
  import { RowEndContext } from "../../internal/row";
6
7
  import { useTheme } from "../../theme/ThemeProvider";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { cloneElement, createContext, isValidElement, useCallback, useContext, useMemo, useRef, useState } from "react";
3
- import { Platform, Pressable, StyleSheet, View } from "react-native";
2
+ import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
3
+ import { Animated, Easing, Platform, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import Disclosure from "../../icons/plex/Disclosure";
5
6
  import ExclamationMarkCircle from "../../icons/plex/ExclamationMarkCircle";
6
7
  import { spaceToggles, useDescription } from "../../internal/a11y";
@@ -162,7 +163,7 @@ export function ListItem({ label, description, leading, leadingColor, value, val
162
163
  const nativeRipple = theme.isAndroid && Platform.OS === "android";
163
164
  // iOS lights a held choice row, not a switch row, as the web's phone rows
164
165
  const lit = !switchRow && control?.kind !== "switch";
165
- const row = (pressed) => theme.isAndroid ? styles.androidRow : iosRow(theme, pressed && lit, last, description != null || error != null);
166
+ const row = theme.isAndroid ? styles.androidRow : iosRow(theme, last, description != null || error != null);
166
167
  // A finger on the control at the end holds the row, as one on the row's text does
167
168
  const [held, setHeld] = useState(false);
168
169
  // Android's press is the list selector's ripple from the touch point, clipped to the row (and the card's corners):
@@ -191,12 +192,12 @@ export function ListItem({ label, description, leading, leadingColor, value, val
191
192
  const drawn = theme.isAndroid && !nativeRipple;
192
193
  return (_jsx(Pressable, { ref: frameNode, collapsable: false, ...described.props, ...(switchRow ? spaceToggles(toggle) : null),
193
194
  // A row that toggles its control is not a second element for a screen reader or a Tab stop: the control is
194
- accessible: endOwnsFocus ? false : undefined, focusable: endOwnsFocus ? false : undefined, tabIndex: endOwnsFocus ? -1 : undefined, accessibilityRole: endOwnsFocus ? undefined : switchRow ? "switch" : "button", accessibilityLabel: endOwnsFocus ? undefined : name, accessibilityState: endOwnsFocus ? undefined : switchRow ? { checked, disabled } : { disabled }, "aria-checked": switchRow ? checked : undefined, disabled: disabled, onPress: press, onLongPress: onLongPress, delayLongPress: onLongPress ? 500 : undefined, accessibilityActions: onLongPress ? [{ name: "longpress" }] : undefined, onAccessibilityAction: onLongPress ? (event) => event.nativeEvent.actionName === "longpress" && onLongPress() : undefined, onPressIn: drawn ? ripple.start : undefined, onPressOut: drawn ? ripple.end : undefined, android_ripple: nativeRipple ? { color: highlight, foreground: true } : undefined, testID: testID, style: ({ pressed }) => row(pressed || held), children: ({ pressed }) => (_jsxs(RowHoldContext.Provider, { value: disabled ? null : theme.isAndroid ? hold : setHeld, children: [ripple.layer, content(pressed || held)] })) }));
195
+ accessible: endOwnsFocus ? false : undefined, focusable: endOwnsFocus ? false : undefined, tabIndex: endOwnsFocus ? -1 : undefined, accessibilityRole: endOwnsFocus ? undefined : switchRow ? "switch" : "button", accessibilityLabel: endOwnsFocus ? undefined : name, accessibilityState: endOwnsFocus ? undefined : switchRow ? { checked, disabled } : { disabled }, "aria-checked": switchRow ? checked : undefined, disabled: disabled, onPress: press, onLongPress: onLongPress, delayLongPress: onLongPress ? 500 : undefined, accessibilityActions: onLongPress ? [{ name: "longpress" }] : undefined, onAccessibilityAction: onLongPress ? (event) => event.nativeEvent.actionName === "longpress" && onLongPress() : undefined, onPressIn: drawn ? ripple.start : undefined, onPressOut: drawn ? ripple.end : undefined, android_ripple: nativeRipple ? { color: highlight, foreground: true } : undefined, testID: testID, style: row, children: ({ pressed }) => (_jsxs(RowHoldContext.Provider, { value: disabled ? null : theme.isAndroid ? hold : setHeld, children: [ripple.layer, theme.isAndroid ? null : _jsx(RowHighlight, { on: (pressed || held) && lit, last: last }), content(pressed || held)] })) }));
195
196
  }
196
197
  // A row that only shows (a detail, a value) is one element named by `accessibilityLabel` when it has one; with a
197
198
  // control at its end it stays a group, so the control is still reached
198
199
  const named = accessibilityLabel != null && trailing == null && found == null;
199
- return (_jsx(View, { ref: frameNode, collapsable: false, testID: testID, accessible: named || undefined, accessibilityLabel: accessibilityLabel, accessibilityRole: named && Platform.OS !== "web" ? "text" : undefined, role: named && Platform.OS === "web" ? "group" : undefined, style: row(false), children: content(false) }));
200
+ return (_jsx(View, { ref: frameNode, collapsable: false, testID: testID, accessible: named || undefined, accessibilityLabel: accessibilityLabel, accessibilityRole: named && Platform.OS !== "web" ? "text" : undefined, role: named && Platform.OS === "web" ? "group" : undefined, style: row, children: content(false) }));
200
201
  }
201
202
  /** A Button among a List's rows: the row is the button (`ListActionContext`), the hairline under it from the text's start. */
202
203
  function ActionRow({ children }) {
@@ -283,19 +284,41 @@ function endControl(found, own, setOwn, rowDisabled, name) {
283
284
  }
284
285
  /** A row's least height: 52, 70 with a description (`--field-row-description-min-height`), as the web's NavigationRow. */
285
286
  const iosMinHeight = (theme, described) => described ? theme.length("--field-row-description-min-height", 70) : theme.length("--field-row-min-height", 52);
286
- function iosRow(theme, pressed, last, described) {
287
+ function iosRow(theme, last, described) {
287
288
  const inset = theme.length("--list-row-inset", 20);
288
289
  return {
289
290
  flexDirection: "row",
290
291
  alignItems: "center",
291
292
  minHeight: iosMinHeight(theme, described),
292
293
  paddingStart: inset,
293
- backgroundColor: pressed ? theme.color("--field-row-press-background") : undefined,
294
- // The press fills the row to the group's rounded ends
294
+ // The press is RowHighlight's, under the content; the row's rounded end clips it to the group's
295
295
  borderBottomLeftRadius: last ? theme.length("--field-group-radius", 26) : 0,
296
296
  borderBottomRightRadius: last ? theme.length("--field-group-radius", 26) : 0,
297
297
  };
298
298
  }
299
+ /**
300
+ * iOS's press on a row: the row lights at once under a finger and, when it lifts, the light fades out over 0.3s, as
301
+ * UIKit deselects a cell (the system gray 4 of `--field-row-press-background`); at once with reduced motion.
302
+ */
303
+ function RowHighlight({ on, last }) {
304
+ const theme = useTheme();
305
+ const opacity = useRef(new Animated.Value(0)).current;
306
+ useEffect(() => {
307
+ if (on || theme.reducedMotion) {
308
+ opacity.stopAnimation();
309
+ opacity.setValue(on ? 1 : 0);
310
+ return;
311
+ }
312
+ const fade = Animated.timing(opacity, { toValue: 0, duration: 300, easing: Easing.out(Easing.quad), useNativeDriver: Platform.OS !== "web" });
313
+ fade.start();
314
+ return () => fade.stop();
315
+ }, [on, opacity, theme.reducedMotion]);
316
+ const radius = last ? theme.length("--field-group-radius", 26) : 0;
317
+ return (_jsx(Animated.View, { pointerEvents: "none", style: [
318
+ StyleSheet.absoluteFill,
319
+ { opacity, backgroundColor: theme.color("--field-row-press-background"), borderBottomLeftRadius: radius, borderBottomRightRadius: radius },
320
+ ] }));
321
+ }
299
322
  /**
300
323
  * Whether a row's value goes under its label: `below`, or `auto` when the label and the value do not fit beside each
301
324
  * other on one line. As the web's NavigationRow measures them unwrapped in the end layout's limits, a hidden probe
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Children, cloneElement, createContext, Fragment, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
3
- import { Animated, Easing, I18nManager, PanResponder, Platform, Pressable, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native";
3
+ import { Animated, Easing, I18nManager, PanResponder, Platform, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { useSafeAreaInsets } from "react-native-safe-area-context";
5
6
  import Svg, { Path } from "react-native-svg";
6
7
  import ArrowLeftLg from "../../icons/plex/ArrowLeftLg";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createContext, useContext, useEffect, useState } from "react";
3
- import { Animated, Platform, Pressable, StyleSheet, View } from "react-native";
3
+ import { Animated, Platform, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import CheckMd from "../../icons/plex/CheckMd";
5
6
  import { useDescription } from "../../internal/a11y";
6
7
  import { ControlLabel } from "../../internal/ControlLabel";
@@ -1,6 +1,7 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { createContext, isValidElement, useContext, useEffect, useRef, useState } from "react";
3
- import { Animated, Easing, Pressable, StyleSheet, View } from "react-native";
3
+ import { Animated, Easing, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { childrenOfType, isRenderable, textOf } from "../../internal/children";
5
6
  import { Glass } from "../../internal/Glass";
6
7
  import { curves } from "../../internal/motion";
@@ -29,7 +30,7 @@ function iosLook(theme, size, material, inBar, inRow) {
29
30
  glass: true,
30
31
  fill: theme.color("--segmented-control-mobile-glass-background"),
31
32
  thumb: theme.color("--segmented-control-mobile-thumb-background"),
32
- duration: 400,
33
+ duration: 300,
33
34
  };
34
35
  }
35
36
  return {
@@ -47,43 +48,6 @@ function iosLook(theme, size, material, inBar, inRow) {
47
48
  duration: 250,
48
49
  };
49
50
  }
50
- /**
51
- * The curve the large control's lens lands on (touch.css `--tabs-thumb-transition-easing`, iOS 27.2 frame by frame):
52
- * CSS `linear()` stops, each [progress, time], read between them as the browser does.
53
- */
54
- const LENS_STOPS = [
55
- [0, 0],
56
- [0.2, 0.03],
57
- [0.33, 0.0625],
58
- [0.45, 0.1],
59
- [0.538, 0.1225],
60
- [0.623, 0.1625],
61
- [0.69, 0.2],
62
- [0.747, 0.2425],
63
- [0.793, 0.2875],
64
- [0.83, 0.325],
65
- [0.862, 0.3675],
66
- [0.887, 0.41],
67
- [0.908, 0.45],
68
- [0.925, 0.4925],
69
- [0.943, 0.535],
70
- [0.956, 0.58],
71
- [0.975, 0.66],
72
- [0.981, 0.7],
73
- [0.989, 0.7475],
74
- [0.994, 0.825],
75
- [1, 1],
76
- ];
77
- const lensEasing = (t) => {
78
- if (t <= 0)
79
- return 0;
80
- if (t >= 1)
81
- return 1;
82
- const after = LENS_STOPS.findIndex(([, at]) => at >= t);
83
- const [fromValue, fromAt] = LENS_STOPS[after - 1];
84
- const [toValue, toAt] = LENS_STOPS[after];
85
- return fromValue + ((toValue - fromValue) * (t - fromAt)) / (toAt - fromAt);
86
- };
87
51
  /** A Toolbar.Row tells the control in it that it is in a row, not in the bar's own row. */
88
52
  export const SegmentedControlRowContext = createContext({ inRow: false });
89
53
  function SegmentedControlTab(_) {
@@ -106,7 +70,7 @@ const optionName = (option) => {
106
70
  * iOS 26 apps (48pt; 40 in a Toolbar.Row), its thumb sliding to the selection; on Android a segmented capsule, white
107
71
  * with a sliding pill of the accent. Props follow @plexui/ui (`SegmentedControl` and `SegmentedControl.Tab`).
108
72
  */
109
- function SegmentedControlRoot({ value, onChange, onClick, "aria-label": ariaLabel, size = "md", disabled = false, block = false, mobileMaterial, mobileSegmentWidth = "equal", style, testID, children, }) {
73
+ function SegmentedControlRoot({ value, onChange, onClick, "aria-label": ariaLabel, size = "md", disabled = false, block = false, mobileMaterial, mobileSegmentWidth = "equal", showBadges = false, style, testID, children, }) {
110
74
  const theme = useTheme();
111
75
  const options = childrenOfType(children, SegmentedControlTab).map((child) => child.props);
112
76
  const select = (option) => {
@@ -119,11 +83,13 @@ function SegmentedControlRoot({ value, onChange, onClick, "aria-label": ariaLabe
119
83
  if (option)
120
84
  select(option);
121
85
  });
122
- const common = { options, value, select, keys, disabled, block, equal: mobileSegmentWidth === "equal" };
86
+ // Drawn counts differ from tab to tab, so each segment takes its own width with them, as a messenger's folder tabs
87
+ const counted = showBadges && options.some((option) => option.badge != null);
88
+ const common = { options, value, select, keys, disabled, block, equal: mobileSegmentWidth === "equal" && !counted, showBadges };
123
89
  return (_jsx(View, { accessibilityRole: "tablist", "aria-label": ariaLabel, accessibilityState: { disabled }, testID: testID, style: [block ? styles.block : styles.hug, style], children: theme.isAndroid ? _jsx(AndroidControl, { ...common, size: size }) : _jsx(IOSControl, { ...common, size: size, material: mobileMaterial }) }));
124
90
  }
125
91
  SegmentedControlRoot.displayName = "SegmentedControl";
126
- function IOSControl({ options, value, select, keys, disabled, block, equal, size, material }) {
92
+ function IOSControl({ options, value, select, keys, disabled, block, equal, showBadges, size, material }) {
127
93
  const theme = useTheme();
128
94
  const inBar = !!useContext(BarItemContext);
129
95
  const { inRow } = useContext(SegmentedControlRowContext);
@@ -133,6 +99,9 @@ function IOSControl({ options, value, select, keys, disabled, block, equal, size
133
99
  const [widths, setWidths] = useState({});
134
100
  const widest = Math.max(0, ...options.map((option) => labels[option.value] ?? 0));
135
101
  const optionRadius = look.height / 2 - look.gutter;
102
+ // A drawn count ends a label in a capsule of its own: the thumb keeps 10 beside the label and the capsule, so the
103
+ // capsule does not touch the thumb's end
104
+ const gutter = showBadges && options.some((option) => option.badge != null) ? Math.max(look.optionGutter, 10) : look.optionGutter;
136
105
  // The large glass control held down, as the phone CSS ports it: the capsule grows 7% and whitens, the held label
137
106
  // fades to 20%, with no capsule of its own under the finger
138
107
  const largeGlass = look.glass && look.height >= 40;
@@ -156,13 +125,14 @@ function IOSControl({ options, value, select, keys, disabled, block, equal, size
156
125
  placed.current = true;
157
126
  return;
158
127
  }
159
- // The large control's lens lands in 400ms on touch.css's own curve; the small one eases (CSS `ease`) in 250
160
- const easing = look.glass && look.height >= 40 ? lensEasing : Easing.bezier(0.25, 0.1, 0.25, 1);
128
+ // The thumb eases (CSS `ease`): in 300ms on the large control, 250 on the small one. The lens's own curve (fast,
129
+ // then a long settle) reads as a jump and a crawl when no lens is drawn over it (owner, 24.11)
130
+ const easing = Easing.bezier(0.25, 0.1, 0.25, 1);
161
131
  Animated.parallel([
162
132
  Animated.timing(x, { toValue: selectedX, duration: look.duration, easing, useNativeDriver: false }),
163
133
  Animated.timing(width, { toValue: selectedWidth, duration: look.duration, easing, useNativeDriver: false }),
164
134
  ]).start();
165
- }, [selectedX, selectedWidth, look.duration, look.glass, look.height, theme.reducedMotion, x, width]);
135
+ }, [selectedX, selectedWidth, look.duration, theme.reducedMotion, x, width]);
166
136
  // The segments take the capsule's whole height, so a press anywhere on it lands (the thumb keeps its inset); a
167
137
  // minimum, so text a person enlarges is not cut
168
138
  const track = {
@@ -185,12 +155,12 @@ function IOSControl({ options, value, select, keys, disabled, block, equal, size
185
155
  setWidths((prev) => (prev[option.value] === w ? prev : { ...prev, [option.value]: w }));
186
156
  }, style: [
187
157
  styles.option,
188
- { paddingHorizontal: look.optionGutter, borderRadius: look.height / 2 },
189
- block ? styles.grow : equal && widest ? { width: widest + 2 * look.optionGutter } : null,
190
- ], children: _jsx(View, { onLayout: (event) => {
158
+ { paddingHorizontal: gutter, borderRadius: look.height / 2 },
159
+ block ? styles.grow : equal && widest ? { width: widest + 2 * gutter } : null,
160
+ ], children: _jsxs(View, { onLayout: (event) => {
191
161
  const w = Math.ceil(event.nativeEvent.layout.width);
192
162
  setLabels((prev) => (prev[option.value] === w ? prev : { ...prev, [option.value]: w }));
193
- }, style: [styles.label, held === option.value ? styles.heldLabel : null], children: symbolOnly ? (_jsx(IconDefaultsProvider, { size: 20, color: color, children: option.icon })) : (_jsx(Text, { numberOfLines: 1, maxFontSizeMultiplier: maxScale, color: color, weight: isSelected ? look.selectedWeight : look.weight, style: { fontSize: look.fontSize, lineHeight: look.lineHeight }, children: option.children })) }) }, option.value));
163
+ }, style: [styles.label, held === option.value ? styles.heldLabel : null], children: [symbolOnly ? (_jsx(IconDefaultsProvider, { size: 20, color: color, children: option.icon })) : (_jsx(Text, { numberOfLines: 1, maxFontSizeMultiplier: maxScale, color: color, weight: isSelected ? look.selectedWeight : look.weight, style: { fontSize: look.fontSize, lineHeight: look.lineHeight }, children: option.children })), showBadges ? _jsx(SegmentCount, { badge: option.badge, selected: isSelected, off: off }) : null] }) }, option.value));
194
164
  })] }));
195
165
  if (look.glass) {
196
166
  // The glass keeps the control's fill over it: one flat layer, no sheen (touch.css)
@@ -212,7 +182,7 @@ const ANDROID_MOVE = { duration: 320, easing: curves.easeOutQuint };
212
182
  * its label in the accent, the others in the secondary gray. The pill slides to a new selection and takes its width.
213
183
  * In a bar's row of controls the capsule takes the height of the circles beside it (46dp).
214
184
  */
215
- function AndroidControl({ options, value, select, keys, disabled, block, equal, size }) {
185
+ function AndroidControl({ options, value, select, keys, disabled, block, equal, showBadges, size }) {
216
186
  const theme = useTheme();
217
187
  const m = theme.material;
218
188
  const bar = useContext(BarItemContext);
@@ -248,13 +218,13 @@ function AndroidControl({ options, value, select, keys, disabled, block, equal,
248
218
  styles.androidRow,
249
219
  { height, borderRadius: height / 2, backgroundColor: barSurface(m, theme.scheme), boxShadow: barShadow(theme.scheme) },
250
220
  block ? styles.stretch : null,
251
- ], children: [frame ? (_jsx(Animated.View, { pointerEvents: "none", style: [styles.androidPill, { height: inner, borderRadius: inner / 2, backgroundColor: withAlpha(m.primary, 0.12), left: x, width }] })) : null, options.map((option) => (_jsx(AndroidSegment, { option: option, selected: option.value === value, off: disabled || !!option.disabled, framed: frame, height: inner,
221
+ ], children: [frame ? (_jsx(Animated.View, { pointerEvents: "none", style: [styles.androidPill, { height: inner, borderRadius: inner / 2, backgroundColor: withAlpha(m.primary, 0.12), left: x, width }] })) : null, options.map((option) => (_jsx(AndroidSegment, { option: option, selected: option.value === value, off: disabled || !!option.disabled, framed: frame, showBadges: showBadges, height: inner,
252
222
  // In a filled row equal segments share the width and the others take their label and share what is left; a
253
223
  // control that hugs its segments gives equal ones the widest one's width
254
224
  size: block ? (equal ? styles.grow : styles.share) : widest ? { minWidth: widest } : null, keys: keys, select: select, onWidth: (w) => setWidths((prev) => (prev[option.value] === w ? prev : { ...prev, [option.value]: w })) }, option.value)))] }));
255
225
  }
256
226
  /** One segment of the capsule: its label turns from the gray to the accent as the pill comes, and back as it goes. */
257
- function AndroidSegment({ option, selected, off, framed, height, size, keys, select, onWidth }) {
227
+ function AndroidSegment({ option, selected, off, framed, showBadges, height, size, keys, select, onWidth }) {
258
228
  const theme = useTheme();
259
229
  const m = theme.material;
260
230
  const [tint] = useState(() => new Animated.Value(selected ? 1 : 0));
@@ -280,7 +250,32 @@ function AndroidSegment({ option, selected, off, framed, height, size, keys, sel
280
250
  selected && !framed ? { backgroundColor: withAlpha(m.primary, 0.12) } : null,
281
251
  ], children: [isRenderable(option.icon) ? (_jsx(IconDefaultsProvider, { size: 20, color: color, children: option.icon })) : null, isRenderable(option.children) ? (
282
252
  // An Animated text, so its color can blend: the face, size and tracking of the kit's Text
283
- _jsx(Animated.Text, { numberOfLines: 1, style: [textStyle(theme, { weight: "medium" }), { fontSize: 14, lineHeight: 20, letterSpacing: theme.tracking(14), color: label }], children: option.children })) : null] }));
253
+ _jsx(Animated.Text, { numberOfLines: 1, style: [textStyle(theme, { weight: "medium" }), { fontSize: 14, lineHeight: 20, letterSpacing: theme.tracking(14), color: label }], children: option.children })) : null, showBadges ? _jsx(SegmentCount, { badge: option.badge, selected: selected, off: off }) : null] }));
254
+ }
255
+ /**
256
+ * A tab's count drawn after its label (`showBadges`): a capsule 18 tall, the digits 12 semibold in the screen's color.
257
+ * iOS: the label's color on the selected segment, so it reads on the thumb, the secondary label on the others.
258
+ * Android: the accent on the selected segment, as its label, the gray on the others.
259
+ */
260
+ function SegmentCount({ badge, selected, off }) {
261
+ const theme = useTheme();
262
+ const text = badge != null ? badgeText(badge) : undefined;
263
+ if (!text)
264
+ return null;
265
+ // iOS: the label's color in a capsule, the bar's ink in it; Android: the segment's own ink, the selected one's
266
+ // container in it (onSecondaryContainer on secondaryContainer), the others' onSurfaceVariant on the surface, so the
267
+ // small digits keep their contrast
268
+ const fill = off
269
+ ? theme.color("--alpha-20")
270
+ : theme.isAndroid
271
+ ? selected
272
+ ? theme.material.onSecondaryContainer
273
+ : theme.material.onSurfaceVariant
274
+ : selected
275
+ ? theme.colors.text
276
+ : theme.colors.labelSecondary;
277
+ const ink = theme.isAndroid ? (selected ? theme.material.secondaryContainer : theme.material.surface) : theme.colors.background;
278
+ return (_jsx(View, { "aria-hidden": true, style: [styles.count, { backgroundColor: fill }], children: _jsx(Text, { numberOfLines: 1, weight: "semibold", color: ink, style: styles.countText, children: text }) }));
284
279
  }
285
280
  export const SegmentedControl = Object.assign(SegmentedControlRoot, { Tab: SegmentedControlTab, Option: SegmentedControlTab });
286
281
  const styles = StyleSheet.create({
@@ -291,6 +286,9 @@ const styles = StyleSheet.create({
291
286
  stretch: { alignSelf: "stretch" },
292
287
  heldControl: { transform: [{ scale: 1.07 }] },
293
288
  heldLabel: { opacity: 0.2 },
289
+ // 18 tall, taller with a larger text size: the capsule grows round its digits
290
+ count: { minWidth: 18, minHeight: 18, paddingHorizontal: 5, borderRadius: 999, alignItems: "center", justifyContent: "center" },
291
+ countText: { fontSize: 12, lineHeight: 16, fontVariant: ["tabular-nums"] },
294
292
  thumb: { position: "absolute", borderCurve: "continuous" },
295
293
  option: { alignItems: "center", justifyContent: "center", minWidth: 0 },
296
294
  label: { flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 8 },
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useContext, useEffect, useLayoutEffect, useState } from "react";
3
- import { Platform, Pressable, StyleSheet, View } from "react-native";
3
+ import { Platform, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import Svg, { Path } from "react-native-svg";
5
6
  import ChevronUpDown from "../../icons/plex/ChevronUpDown";
6
7
  import { spaceToggles } from "../../internal/a11y";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
3
- import { Animated, Platform, Pressable, StyleSheet, View } from "react-native";
3
+ import { Animated, Platform, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import Minus from "../../icons/plex/Minus";
5
6
  import Plus from "../../icons/plex/Plus";
6
7
  import RemoveTrash from "../../icons/plex/RemoveTrash";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useContext, useEffect, useState } from "react";
3
- import { Animated, Easing, Pressable, StyleSheet, View } from "react-native";
3
+ import { Animated, Easing, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { spaceToggles, useDescription } from "../../internal/a11y";
5
6
  import { ControlLabel } from "../../internal/ControlLabel";
6
7
  import { RowEndContext, RowHoldContext, rowHold } from "../../internal/row";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
3
- import { Animated, Easing, Pressable, StyleSheet, View, } from "react-native";
3
+ import { Animated, Easing, StyleSheet, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { useSafeAreaInsets } from "react-native-safe-area-context";
5
6
  import Search from "../../icons/plex/Search";
6
7
  import { BarBackdrop, SoftBottomEdge, TabBarFade, ANDROID_FADE_ALPHA, ANDROID_FADE_STOPS, glassBarBlur, useAndroidGlass } from "../../internal/BarBackdrop";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useContext, useRef, useState } from "react";
3
- import { Pressable, StyleSheet, TextInput, View } from "react-native";
3
+ import { StyleSheet, TextInput, View } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import X from "../../icons/plex/X";
5
6
  import { RowEndContext } from "../../internal/row";
6
7
  import { dangerText, withAlpha } from "../../theme/material";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { cloneElement, isValidElement, useState } from "react";
3
- import { Pressable, StyleSheet, View, useWindowDimensions } from "react-native";
3
+ import { StyleSheet, View, useWindowDimensions } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import Svg, { Path } from "react-native-svg";
5
6
  import X from "../../icons/plex/X";
6
7
  import { flattenChildren, isRenderable, textOf } from "../../internal/children";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
3
- import { AccessibilityInfo, Animated, Easing, PanResponder, PixelRatio, Platform, Pressable, StyleSheet, View, useWindowDimensions } from "react-native";
3
+ import { AccessibilityInfo, Animated, Easing, PanResponder, PixelRatio, Platform, StyleSheet, View, useWindowDimensions } from "react-native";
4
+ import { Pressable } from "../../internal/Pressable";
4
5
  import { useSafeAreaInsets } from "react-native-safe-area-context";
5
6
  import CheckCircle from "../../icons/plex/CheckCircle";
6
7
  import InfoCircle from "../../icons/plex/InfoCircle";
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { Platform, Pressable as NativePressable } from "react-native";
4
+ // A press target takes no text selection on the web: a drag or a long press over a row, a button or a segment selects
5
+ // nothing, as on iOS and Android, where a control's label is never selectable
6
+ const NO_SELECT = Platform.OS === "web" ? { userSelect: "none" } : null;
7
+ /** react-native's Pressable that selects no text on the web; every pressable control of the kit is drawn with it. */
8
+ export const Pressable = forwardRef(function Pressable({ style, ...props }, ref) {
9
+ return (_jsx(NativePressable, { ref: ref, ...props, style: typeof style === "function" ? (state) => [NO_SELECT, style(state)] : [NO_SELECT, style] }));
10
+ });
@@ -224,12 +224,21 @@ export const elevationShadow = {
224
224
  };
225
225
  /** A color with its alpha multiplied: a state layer or a disabled container. */
226
226
  export function withAlpha(color, alpha) {
227
- // `#rrggbb(aa)`, `rgb()` or `rgba()`, with or without spaces; any other form is returned as it is
227
+ // `#rgb(a)`, `#rrggbb(aa)`, `rgb()`, `rgba()`, `white` or `black`; any other form is returned as it is
228
228
  const c = channels(color);
229
229
  return c ? `rgba(${c[0]}, ${c[1]}, ${c[2]}, ${Math.round(c[3] * alpha * 1000) / 1000})` : color;
230
230
  }
231
- /** The channels of a `#rrggbb(aa)` or `rgb(a)()` color, alpha 0–1; undefined for any other form. */
231
+ /** The channels of a `#rgb(a)`, `#rrggbb(aa)`, `rgb(a)()`, `white` or `black` color, alpha 0–1; undefined for any other form. */
232
232
  function channels(color) {
233
+ // `#rgb(a)` reads as `#rrggbb(aa)`; `white` and `black`, the names a canvas is likeliest to be given
234
+ if (color === "white")
235
+ return [255, 255, 255, 1];
236
+ if (color === "black")
237
+ return [0, 0, 0, 1];
238
+ if (color.startsWith("#") && (color.length === 4 || color.length === 5)) {
239
+ const [r, g, b, a = "f"] = color.slice(1);
240
+ return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255];
241
+ }
233
242
  if (color.startsWith("#") && (color.length === 7 || color.length === 9)) {
234
243
  const a = color.length === 9 ? parseInt(color.slice(7, 9), 16) / 255 : 1;
235
244
  return [parseInt(color.slice(1, 3), 16), parseInt(color.slice(3, 5), 16), parseInt(color.slice(5, 7), 16), a];