@stylhero/native 0.0.0-stage → 0.1.0

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 (48) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +21 -0
  3. package/README.md +85 -2
  4. package/dist/components/Badge.d.ts +11 -0
  5. package/dist/components/Badge.js +31 -0
  6. package/dist/components/Badge.js.map +1 -0
  7. package/dist/components/Button.d.ts +24 -0
  8. package/dist/components/Button.js +59 -0
  9. package/dist/components/Button.js.map +1 -0
  10. package/dist/components/Card.d.ts +17 -0
  11. package/dist/components/Card.js +22 -0
  12. package/dist/components/Card.js.map +1 -0
  13. package/dist/components/IconButton.d.ts +13 -0
  14. package/dist/components/IconButton.js +28 -0
  15. package/dist/components/IconButton.js.map +1 -0
  16. package/dist/components/ListItem.d.ts +24 -0
  17. package/dist/components/ListItem.js +34 -0
  18. package/dist/components/ListItem.js.map +1 -0
  19. package/dist/components/Stack.d.ts +14 -0
  20. package/dist/components/Stack.js +19 -0
  21. package/dist/components/Stack.js.map +1 -0
  22. package/dist/components/Text.d.ts +15 -0
  23. package/dist/components/Text.js +28 -0
  24. package/dist/components/Text.js.map +1 -0
  25. package/dist/components/TextField.d.ts +24 -0
  26. package/dist/components/TextField.js +40 -0
  27. package/dist/components/TextField.js.map +1 -0
  28. package/dist/index.d.ts +10 -0
  29. package/dist/index.js +11 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/theme/ThemeProvider.d.ts +33 -0
  32. package/dist/theme/ThemeProvider.js +45 -0
  33. package/dist/theme/ThemeProvider.js.map +1 -0
  34. package/dist/theme/tokens.d.ts +152 -0
  35. package/dist/theme/tokens.js +150 -0
  36. package/dist/theme/tokens.js.map +1 -0
  37. package/package.json +63 -4
  38. package/src/components/Badge.tsx +54 -0
  39. package/src/components/Button.tsx +128 -0
  40. package/src/components/Card.tsx +72 -0
  41. package/src/components/IconButton.tsx +59 -0
  42. package/src/components/ListItem.tsx +104 -0
  43. package/src/components/Stack.tsx +35 -0
  44. package/src/components/Text.tsx +46 -0
  45. package/src/components/TextField.tsx +123 -0
  46. package/src/index.ts +18 -0
  47. package/src/theme/ThemeProvider.tsx +87 -0
  48. package/src/theme/tokens.ts +163 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@stylhero/native` are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+ While the version is 0.x, a minor release may contain breaking changes; they are
8
+ always listed under **Changed** or **Removed**.
9
+
10
+ New entries are generated with [Changesets](https://changesets.dev) (see
11
+ `.changeset/README.md`). Version headings are written without brackets
12
+ (`## 0.1.0 - 2026-11-27`) so `changeset version` inserts new releases right below
13
+ "Unreleased".
14
+
15
+ ## Unreleased
16
+
17
+ ## 0.1.0 - 2026-11-27
18
+
19
+ First release.
20
+
21
+ ### Added
22
+
23
+ - `ThemeProvider` and `useTheme`: a typed theme generated from the same `tokens.json` as `@stylhero/ui` (colors in light and dark, type, spacing, radii, shadows). `colorScheme` is `"system"` (default), `"light"` or `"dark"`, and an optional `fonts` resolver maps token families and weights to loaded font names.
24
+ - Components: `Text` (token variants and tones), `Stack`, `Button` (`primary`, `secondary`, `ghost`, `danger`; `sm`/`md`/`lg`; `loading`, `icon`, `fullWidth`, `numberOfLines`), `IconButton`, `Badge`, `Card` (title, subtitle, action, footer, `elevated`/`outlined`, pressable), `TextField` (label, hint, error, leading/trailing slots, `announceError`) and `ListItem`.
25
+ - Accessibility built in: 44×44pt touch targets, roles and states for screen readers, headings marked as headers, font scaling with wrapping button labels, labelled form fields whose errors are announced, and the `lineStrong` border token (3:1 contrast) on inputs.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Oscar Ruíz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,86 @@
1
- # Temporary Holding Version
1
+ # @stylhero/native
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Stylhero for React Native and Expo. Same `tokens.json` as [`@stylhero/ui`](../ui), so a web app and a mobile app built with Stylhero share colors, type, spacing, radii and shadows automatically.
4
+
5
+ Requires React 19 and React Native 0.78+. Card shadows use the `boxShadow` style, which needs the New Architecture (the default since RN 0.76 / Expo SDK 52).
6
+
7
+ ## Use it
8
+
9
+ ```bash
10
+ npm install @stylhero/native
11
+ ```
12
+
13
+ ```tsx
14
+ import { ThemeProvider, Card, Badge, Button, Text } from "@stylhero/native";
15
+
16
+ export default function App() {
17
+ return (
18
+ <ThemeProvider>{/* follows the device light/dark setting */}
19
+ <Card title="Budget 1440p build" subtitle="$1,500" action={<Badge tone="success">Compatible</Badge>}>
20
+ <Text>8 parts, ~140 FPS in Cyberpunk 2077</Text>
21
+ <Button onPress={save}>Save build</Button>
22
+ </Card>
23
+ </ThemeProvider>
24
+ );
25
+ }
26
+ ```
27
+
28
+ ### Fonts
29
+
30
+ Without configuration the components use the system font. To use Plus Jakarta Sans, load it (e.g. with `@expo-google-fonts/plus-jakarta-sans`) and map token families + weights to the loaded names:
31
+
32
+ ```tsx
33
+ const jakarta = { "400": "PlusJakartaSans_400Regular", "500": "PlusJakartaSans_500Medium",
34
+ "600": "PlusJakartaSans_600SemiBold", "700": "PlusJakartaSans_700Bold", "800": "PlusJakartaSans_800ExtraBold" };
35
+
36
+ <ThemeProvider fonts={(family, weight) => (family === "mono" ? undefined : jakarta[weight])}>
37
+ ```
38
+
39
+ Define the resolver outside the component (or memoize it) so the theme isn't rebuilt every render.
40
+
41
+ ### Theme in your own components
42
+
43
+ ```tsx
44
+ const theme = useTheme();
45
+ <View style={{ padding: theme.spacing[4], backgroundColor: theme.colors.surfaceRaised, borderRadius: theme.radius.lg }}>
46
+ <RNText style={[theme.text("h3"), { color: theme.colors.ink }]}>…</RNText>
47
+ </View>
48
+ ```
49
+
50
+ ## Components
51
+
52
+ | Component | Notes |
53
+ | --- | --- |
54
+ | `ThemeProvider`, `useTheme` | `colorScheme="system" \| "light" \| "dark"`, optional `fonts` resolver |
55
+ | `Text` | Variants from tokens (`display`, `h1`–`h3`, `body`, `small`, `label`, `mono`, `strong`) and tones |
56
+ | `Stack` | Flex row/column with token gaps and padding |
57
+ | `Button` | `primary`, `secondary`, `ghost`, `danger`; `sm`/`md`/`lg`; `loading`; `icon`; `fullWidth` |
58
+ | `IconButton` | Icon-only; `accessibilityLabel` is required |
59
+ | `Badge` | `neutral`, `primary`, `info`, `accent`, `success`, `danger` |
60
+ | `Card` | Title, subtitle, action slot, footer; `elevated` or `outlined`; whole card pressable with `onPress` |
61
+ | `TextField` | Label, hint, error, leading/trailing slots, disabled |
62
+ | `ListItem` | Title, subtitle, leading/trailing slots, chevron; pressable rows |
63
+
64
+ ## Accessibility
65
+
66
+ Built in, not opt-in:
67
+
68
+ - **Touch targets:** every pressable is at least 44×44pt. Small buttons keep their look and get the extra area through `hitSlop`.
69
+ - **Roles and state:** buttons expose `button` with `disabled` and `busy`; `h1`–`h3` and `display` expose `header` so screen reader users can jump between sections.
70
+ - **Font scaling:** text follows the user's font size setting (headings up to 1.5×, body up to 2×). Buttons use `minHeight` and wrapping labels, so they grow instead of clipping.
71
+ - **Forms:** `TextField` is labelled by its visible label; the hint or error is the accessibility hint; errors set `aria-invalid`, use a polite live region on Android, and are announced on iOS. If your screen moves focus to the first invalid field (or shows an error summary), pass `announceError={false}` so errors aren't read twice. The border uses `lineStrong`, which keeps 3:1 contrast (WCAG 1.4.11).
72
+ - **Long labels:** `Button` labels wrap instead of being cut off at large text sizes; pass `numberOfLines` to cap them.
73
+ - **Rows read as one element:** `ListItem` and pressable `Card` combine title and subtitle into one label; decorative chevrons are hidden from screen readers.
74
+ - **Contrast:** the color pairs are checked against WCAG AA when tokens are built (see `ui/scripts/build-tokens.mjs`).
75
+
76
+ ## Develop
77
+
78
+ ```bash
79
+ npm install
80
+ npm run tokens # regenerate src/theme/tokens.ts from ../tokens.json
81
+ npm test # Jest + React Native Testing Library
82
+ npm run typecheck
83
+ npm run build # tokens + tsc -> dist/
84
+ ```
85
+
86
+ `src/theme/tokens.ts` is generated: edit `tokens.json` at the repo root and run `npm run tokens`. CI fails if the generated file is out of date.
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from "react";
2
+ import { type StyleProp, type ViewProps, type ViewStyle } from "react-native";
3
+ export type BadgeTone = "neutral" | "primary" | "info" | "accent" | "success" | "danger";
4
+ export type BadgeProps = Omit<ViewProps, "children" | "style"> & {
5
+ children: string;
6
+ tone?: BadgeTone;
7
+ icon?: ReactNode;
8
+ style?: StyleProp<ViewStyle>;
9
+ };
10
+ /** Small status label, e.g. "Compatible" or "Out of stock". */
11
+ export declare function Badge({ children, tone, icon, style, ...props }: BadgeProps): import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { View } from "react-native";
3
+ import { useTheme } from "../theme/ThemeProvider";
4
+ import { Text } from "./Text";
5
+ const tones = {
6
+ neutral: ["surfaceSunken", "inkMuted"],
7
+ primary: ["primarySoft", "primary"],
8
+ info: ["skySoft", "primary"],
9
+ accent: ["accentSoft", "accentInk"],
10
+ success: ["successSoft", "success"],
11
+ danger: ["dangerSoft", "danger"],
12
+ };
13
+ /** Small status label, e.g. "Compatible" or "Out of stock". */
14
+ export function Badge({ children, tone = "neutral", icon, style, ...props }) {
15
+ const theme = useTheme();
16
+ const [bg, fg] = tones[tone];
17
+ return (_jsxs(View, { accessible: true, accessibilityLabel: children, style: [
18
+ {
19
+ flexDirection: "row",
20
+ alignItems: "center",
21
+ alignSelf: "flex-start",
22
+ gap: theme.spacing[1],
23
+ paddingVertical: 2,
24
+ paddingHorizontal: theme.spacing[2],
25
+ borderRadius: theme.radius.sm,
26
+ backgroundColor: theme.colors[bg],
27
+ },
28
+ style,
29
+ ], ...props, children: [icon, _jsx(Text, { variant: "label", style: { color: theme.colors[fg], letterSpacing: 0 }, maxFontSizeMultiplier: 1.5, children: children })] }));
30
+ }
31
+ //# sourceMappingURL=Badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAkD,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAW9B,MAAM,KAAK,GAAwD;IACjE,OAAO,EAAE,CAAC,eAAe,EAAE,UAAU,CAAC;IACtC,OAAO,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC;IACnC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC5B,MAAM,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;IACnC,OAAO,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC;IACnC,MAAM,EAAE,CAAC,YAAY,EAAE,QAAQ,CAAC;CACjC,CAAC;AAEF,+DAA+D;AAC/D,MAAM,UAAU,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAc;IACrF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,CACL,MAAC,IAAI,IACH,UAAU,QACV,kBAAkB,EAAE,QAAQ,EAC5B,KAAK,EAAE;YACL;gBACE,aAAa,EAAE,KAAK;gBACpB,UAAU,EAAE,QAAQ;gBACpB,SAAS,EAAE,YAAY;gBACvB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;gBACrB,eAAe,EAAE,CAAC;gBAClB,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;gBACnC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE;gBAC7B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;aAClC;YACD,KAAK;SACN,KACG,KAAK,aAER,IAAI,EACL,KAAC,IAAI,IAAC,OAAO,EAAC,OAAO,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,EAAE,qBAAqB,EAAE,GAAG,YACnG,QAAQ,GACJ,IACF,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { ComponentRef, ReactElement, ReactNode, Ref } from "react";
2
+ import { View, type PressableProps, type StyleProp, type ViewStyle } from "react-native";
3
+ export type ButtonVariant = "primary" | "secondary" | "ghost" | "danger";
4
+ export type ButtonSize = "sm" | "md" | "lg";
5
+ export type ButtonProps = Omit<PressableProps, "children" | "style"> & {
6
+ ref?: Ref<ComponentRef<typeof View>>;
7
+ children: string;
8
+ variant?: ButtonVariant;
9
+ size?: ButtonSize;
10
+ /** Shows a spinner, keeps the width, and blocks presses. Announced as busy. */
11
+ loading?: boolean;
12
+ fullWidth?: boolean;
13
+ /** Icon shown before the label (e.g. a lucide-react-native icon). */
14
+ icon?: ReactNode;
15
+ /**
16
+ * Caps the label's lines. Unset by default so long labels wrap instead of
17
+ * being cut off when the user picks a large text size.
18
+ */
19
+ numberOfLines?: number;
20
+ style?: StyleProp<ViewStyle>;
21
+ };
22
+ /** Minimum touch target (WCAG 2.5.5 / Apple HIG 44pt). */
23
+ export declare const MIN_TOUCH_TARGET = 44;
24
+ export declare function Button({ ref, children, variant, size, loading, fullWidth, icon, numberOfLines, disabled, style, hitSlop, accessibilityLabel, ...props }: ButtonProps): ReactElement;
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ActivityIndicator, Pressable, } from "react-native";
3
+ import { useTheme } from "../theme/ThemeProvider";
4
+ import { Text } from "./Text";
5
+ const heights = { sm: 32, md: 40, lg: 48 };
6
+ /** Minimum touch target (WCAG 2.5.5 / Apple HIG 44pt). */
7
+ export const MIN_TOUCH_TARGET = 44;
8
+ function palette(theme, variant, pressed) {
9
+ const c = theme.colors;
10
+ switch (variant) {
11
+ case "primary":
12
+ return { bg: pressed ? c.primaryHover : c.primary, fg: c.onPrimary, border: "transparent" };
13
+ case "secondary":
14
+ return { bg: pressed ? c.surfaceSunken : c.surfaceRaised, fg: c.ink, border: c.line };
15
+ case "ghost":
16
+ return { bg: pressed ? c.primarySoft : "transparent", fg: c.primary, border: "transparent" };
17
+ case "danger":
18
+ return { bg: c.danger, fg: c.surfaceRaised, border: "transparent", opacity: pressed ? 0.9 : 1 };
19
+ }
20
+ }
21
+ export function Button({ ref, children, variant = "primary", size = "md", loading = false, fullWidth, icon, numberOfLines, disabled, style, hitSlop, accessibilityLabel, ...props }) {
22
+ const theme = useTheme();
23
+ const height = heights[size];
24
+ const inactive = Boolean(disabled) || loading;
25
+ // Small buttons keep their look but get an invisible touch area of at least 44pt.
26
+ const slop = hitSlop ?? Math.max(0, Math.ceil((MIN_TOUCH_TARGET - height) / 2));
27
+ return (_jsx(Pressable, { ref: ref, accessibilityRole: "button", accessibilityLabel: accessibilityLabel ?? children, accessibilityState: { disabled: inactive, busy: loading }, disabled: inactive, hitSlop: slop, style: ({ pressed }) => {
28
+ const p = palette(theme, variant, pressed && !inactive);
29
+ return [
30
+ {
31
+ // minHeight, not height: the label grows with the user's font size setting
32
+ minHeight: height,
33
+ minWidth: height,
34
+ maxWidth: "100%",
35
+ paddingVertical: theme.spacing[1],
36
+ paddingHorizontal: size === "sm" ? theme.spacing[3] : size === "lg" ? theme.spacing[6] : theme.spacing[4],
37
+ flexDirection: "row",
38
+ alignItems: "center",
39
+ justifyContent: "center",
40
+ gap: theme.spacing[2],
41
+ backgroundColor: p.bg,
42
+ borderColor: p.border,
43
+ borderWidth: 1,
44
+ borderRadius: theme.radius.md,
45
+ opacity: disabled ? 0.5 : loading ? 0.8 : p.opacity ?? 1,
46
+ alignSelf: fullWidth ? "stretch" : "flex-start",
47
+ },
48
+ style,
49
+ ];
50
+ }, ...props, children: ({ pressed }) => {
51
+ const p = palette(theme, variant, pressed && !inactive);
52
+ return (_jsxs(_Fragment, { children: [loading ? _jsx(ActivityIndicator, { size: "small", color: p.fg, testID: "button-spinner" }) : icon, _jsx(Text, { variant: "body", numberOfLines: numberOfLines, style: [
53
+ theme.text("body", "700"),
54
+ // flexShrink lets the label wrap inside the button instead of overflowing it
55
+ { color: p.fg, fontSize: size === "sm" ? 13 : size === "lg" ? 16 : 15, flexShrink: 1, textAlign: "center" },
56
+ ], children: children })] }));
57
+ } }));
58
+ }
59
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sourceRoot":"","s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C,MAAM,EAAE,KAAK,CAAC;4BACzB,6EAA6E;4BAC7E,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE;yBAC5G,YAEA,QAAQ,GACJ,IACN,CACJ,CAAC;QACJ,CAAC,GACS,CACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from "react";
2
+ import { type StyleProp, type ViewProps, type ViewStyle } from "react-native";
3
+ export type CardProps = Omit<ViewProps, "style"> & {
4
+ title?: string;
5
+ subtitle?: string;
6
+ /** Top-right slot next to the title, e.g. a Badge or IconButton. */
7
+ action?: ReactNode;
8
+ /** Bottom row, right-aligned, e.g. Buttons. */
9
+ footer?: ReactNode;
10
+ /** "outlined" drops the shadow. */
11
+ variant?: "elevated" | "outlined";
12
+ /** Makes the whole card one button. Give it an accessibilityLabel if the title isn't enough. */
13
+ onPress?: () => void;
14
+ children?: ReactNode;
15
+ style?: StyleProp<ViewStyle>;
16
+ };
17
+ export declare function Card({ title, subtitle, action, footer, variant, onPress, children, style, accessibilityLabel, ...props }: CardProps): import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Pressable, View } from "react-native";
3
+ import { useTheme } from "../theme/ThemeProvider";
4
+ import { Text } from "./Text";
5
+ export function Card({ title, subtitle, action, footer, variant = "elevated", onPress, children, style, accessibilityLabel, ...props }) {
6
+ const theme = useTheme();
7
+ const base = {
8
+ gap: theme.spacing[3],
9
+ padding: theme.spacing[6],
10
+ backgroundColor: theme.colors.surfaceRaised,
11
+ borderWidth: 1,
12
+ borderColor: theme.colors.line,
13
+ borderRadius: theme.radius.lg,
14
+ boxShadow: variant === "elevated" ? theme.shadows.card : undefined,
15
+ };
16
+ const content = (_jsxs(_Fragment, { children: [(title || subtitle || action) && (_jsxs(View, { style: { flexDirection: "row", alignItems: "flex-start", gap: theme.spacing[3] }, children: [_jsxs(View, { style: { flex: 1, gap: 2 }, children: [title ? _jsx(Text, { variant: "h3", children: title }) : null, subtitle ? _jsx(Text, { variant: "small", children: subtitle }) : null] }), action] })), children, footer ? (_jsx(View, { style: { flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-end", gap: theme.spacing[2], marginTop: theme.spacing[2] }, children: footer })) : null] }));
17
+ if (onPress) {
18
+ return (_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: accessibilityLabel ?? ([title, subtitle].filter(Boolean).join(", ") || undefined), onPress: onPress, style: ({ pressed }) => [base, pressed && { backgroundColor: theme.colors.surfaceSunken }, style], ...props, children: content }));
19
+ }
20
+ return (_jsx(View, { style: [base, style], accessibilityLabel: accessibilityLabel, ...props, children: content }));
21
+ }
22
+ //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAkD,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAiB9B,MAAM,UAAU,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,kBAAkB,EAAE,GAAG,KAAK,EAAa;IAC/I,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,IAAI,GAAc;QACtB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACrB,OAAO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F,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CACL,KAAC,SAAS,IACR,iBAAiB,EAAC,QAAQ,EAC1B,kBAAkB,EAAE,kBAAkB,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,EACrG,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,KAC7F,KAAK,YAER,OAAO,GACE,CACb,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,kBAAkB,EAAE,kBAAkB,KAAM,KAAK,YAC1E,OAAO,GACH,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { ComponentRef, ReactElement, ReactNode, Ref } from "react";
2
+ import { View, type PressableProps, type StyleProp, type ViewStyle } from "react-native";
3
+ export type IconButtonProps = Omit<PressableProps, "children" | "style" | "accessibilityLabel"> & {
4
+ ref?: Ref<ComponentRef<typeof View>>;
5
+ /** Required: an icon has no visible text, so screen readers need this. */
6
+ accessibilityLabel: string;
7
+ children: ReactNode;
8
+ size?: "sm" | "md";
9
+ variant?: "ghost" | "secondary";
10
+ style?: StyleProp<ViewStyle>;
11
+ };
12
+ /** Square button holding only an icon. Always at least 44pt to touch. */
13
+ export declare function IconButton({ ref, children, size, variant, disabled, style, hitSlop, ...props }: IconButtonProps): ReactElement;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Pressable } from "react-native";
3
+ import { useTheme } from "../theme/ThemeProvider";
4
+ import { MIN_TOUCH_TARGET } from "./Button";
5
+ /** Square button holding only an icon. Always at least 44pt to touch. */
6
+ export function IconButton({ ref, children, size = "md", variant = "ghost", disabled, style, hitSlop, ...props }) {
7
+ const theme = useTheme();
8
+ const dim = size === "sm" ? 32 : 40;
9
+ return (_jsx(Pressable, { ref: ref, accessibilityRole: "button", accessibilityState: { disabled: Boolean(disabled) }, disabled: disabled, hitSlop: hitSlop ?? Math.ceil((MIN_TOUCH_TARGET - dim) / 2), style: ({ pressed }) => [
10
+ {
11
+ width: dim,
12
+ height: dim,
13
+ alignItems: "center",
14
+ justifyContent: "center",
15
+ borderRadius: theme.radius.md,
16
+ borderWidth: 1,
17
+ borderColor: variant === "secondary" ? theme.colors.line : "transparent",
18
+ backgroundColor: pressed
19
+ ? theme.colors.surfaceSunken
20
+ : variant === "secondary"
21
+ ? theme.colors.surfaceRaised
22
+ : "transparent",
23
+ opacity: disabled ? 0.5 : 1,
24
+ },
25
+ style,
26
+ ], ...props, children: children }));
27
+ }
28
+ //# sourceMappingURL=IconButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../src/components/IconButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAA6D,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAY5C,yEAAyE;AACzE,MAAM,UAAU,UAAU,CAAC,EACzB,GAAG,EACH,QAAQ,EACR,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,OAAO,EACjB,QAAQ,EACR,KAAK,EACL,OAAO,EACP,GAAG,KAAK,EACQ;IAChB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,GAAG,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACpC,OAAO,CACL,KAAC,SAAS,IACR,GAAG,EAAE,GAAG,EACR,iBAAiB,EAAC,QAAQ,EAC1B,kBAAkB,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,EACnD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAC3D,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;YACtB;gBACE,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,GAAG;gBACX,UAAU,EAAE,QAAQ;gBACpB,cAAc,EAAE,QAAQ;gBACxB,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE;gBAC7B,WAAW,EAAE,CAAC;gBACd,WAAW,EAAE,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa;gBACxE,eAAe,EAAE,OAAO;oBACtB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa;oBAC5B,CAAC,CAAC,OAAO,KAAK,WAAW;wBACvB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa;wBAC5B,CAAC,CAAC,aAAa;gBACnB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;aAC5B;YACD,KAAK;SACN,KACG,KAAK,YAER,QAAQ,GACC,CACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { ReactNode } from "react";
2
+ import { type StyleProp, type ViewStyle } from "react-native";
3
+ export type ListItemProps = {
4
+ title: string;
5
+ subtitle?: string;
6
+ /** Left slot: icon, Avatar, or product image. */
7
+ leading?: ReactNode;
8
+ /** Right slot: price, Badge, Switch... */
9
+ trailing?: ReactNode;
10
+ /** Shows a ">" hint that the row opens something. Defaults to true when pressable. */
11
+ chevron?: boolean;
12
+ onPress?: () => void;
13
+ disabled?: boolean;
14
+ /** Overrides the spoken label (defaults to "title, subtitle"). */
15
+ accessibilityLabel?: string;
16
+ accessibilityHint?: string;
17
+ testID?: string;
18
+ style?: StyleProp<ViewStyle>;
19
+ };
20
+ /**
21
+ * One row of a list. Read by screen readers as a single element, so a row
22
+ * like "RTX 4070, 12 GB, $549" is one swipe instead of three.
23
+ */
24
+ export declare function ListItem({ title, subtitle, leading, trailing, chevron, onPress, disabled, accessibilityLabel, accessibilityHint, testID, style, }: ListItemProps): import("react").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Pressable, View } from "react-native";
3
+ import { useTheme } from "../theme/ThemeProvider";
4
+ import { Text } from "./Text";
5
+ /**
6
+ * One row of a list. Read by screen readers as a single element, so a row
7
+ * like "RTX 4070, 12 GB, $549" is one swipe instead of three.
8
+ */
9
+ export function ListItem({ title, subtitle, leading, trailing, chevron, onPress, disabled, accessibilityLabel, accessibilityHint, testID, style, }) {
10
+ const theme = useTheme();
11
+ const showChevron = chevron ?? Boolean(onPress);
12
+ const label = accessibilityLabel ?? [title, subtitle].filter(Boolean).join(", ");
13
+ const row = (pressed) => [
14
+ {
15
+ flexDirection: "row",
16
+ alignItems: "center",
17
+ gap: theme.spacing[3],
18
+ minHeight: 56,
19
+ paddingVertical: theme.spacing[2],
20
+ paddingHorizontal: theme.spacing[4],
21
+ backgroundColor: pressed ? theme.colors.surfaceSunken : "transparent",
22
+ opacity: disabled ? 0.5 : 1,
23
+ },
24
+ style,
25
+ ];
26
+ const content = (_jsxs(_Fragment, { children: [leading, _jsxs(View, { style: { flex: 1, gap: 2 }, children: [_jsx(Text, { variant: "body", numberOfLines: 2, children: title }), subtitle ? (_jsx(Text, { variant: "small", numberOfLines: 2, children: subtitle })) : null] }), trailing, showChevron ? (
27
+ // h3 size, but variant "body" so the chevron never gets the "header" role
28
+ _jsx(Text, { variant: "body", tone: "muted", style: theme.text("h3"), importantForAccessibility: "no", accessibilityElementsHidden: true, children: "›" })) : null] }));
29
+ if (onPress) {
30
+ return (_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: label, accessibilityHint: accessibilityHint, accessibilityState: { disabled: Boolean(disabled) }, disabled: disabled, onPress: onPress, testID: testID, style: ({ pressed }) => row(pressed && !disabled), children: content }));
31
+ }
32
+ return (_jsx(View, { accessible: true, accessibilityLabel: label, accessibilityHint: accessibilityHint, testID: testID, style: row(false), children: content }));
33
+ }
34
+ //# sourceMappingURL=ListItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItem.js","sourceRoot":"","sources":["../../src/components/ListItem.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAkC,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAoB9B;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,MAAM,EACN,KAAK,GACS;IACd,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,WAAW,GAAG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,KAAK,GAAG,kBAAkB,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjF,MAAM,GAAG,GAAG,CAAC,OAAgB,EAAwB,EAAE,CAAC;QACtD;YACE,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YACrB,SAAS,EAAE,EAAE;YACb,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YACjC,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CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,YAEhD,OAAO,GACE,CACb,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,IAAI,IAAC,UAAU,QAAC,kBAAkB,EAAE,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,YAChH,OAAO,GACH,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type ViewProps, type ViewStyle } from "react-native";
2
+ import type { SpacingToken } from "../theme/tokens";
3
+ export type StackProps = ViewProps & {
4
+ direction?: "column" | "row";
5
+ /** Spacing token between children. */
6
+ gap?: SpacingToken;
7
+ align?: ViewStyle["alignItems"];
8
+ justify?: ViewStyle["justifyContent"];
9
+ wrap?: boolean;
10
+ /** Spacing token around the content. */
11
+ padding?: SpacingToken;
12
+ };
13
+ /** Flex layout with token-based gaps. */
14
+ export declare function Stack({ direction, gap, align, justify, wrap, padding, style, ...props }: StackProps): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { View } from "react-native";
3
+ import { useTheme } from "../theme/ThemeProvider";
4
+ /** Flex layout with token-based gaps. */
5
+ export function Stack({ direction = "column", gap, align, justify, wrap, padding, style, ...props }) {
6
+ const { spacing } = useTheme();
7
+ return (_jsx(View, { style: [
8
+ {
9
+ flexDirection: direction,
10
+ gap: gap ? spacing[gap] : undefined,
11
+ alignItems: align,
12
+ justifyContent: justify,
13
+ flexWrap: wrap ? "wrap" : undefined,
14
+ padding: padding ? spacing[padding] : undefined,
15
+ },
16
+ style,
17
+ ], ...props }));
18
+ }
19
+ //# sourceMappingURL=Stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../src/components/Stack.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkC,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAclD,yCAAyC;AACzC,MAAM,UAAU,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,EAAc;IAC7G,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC/B,OAAO,CACL,KAAC,IAAI,IACH,KAAK,EAAE;YACL;gBACE,aAAa,EAAE,SAAS;gBACxB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;gBACnC,UAAU,EAAE,KAAK;gBACjB,cAAc,EAAE,OAAO;gBACvB,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBACnC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;aAChD;YACD,KAAK;SACN,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { type TextProps as RNTextProps } from "react-native";
2
+ import type { TypographyToken } from "../theme/tokens";
3
+ export type TextVariant = TypographyToken | "strong";
4
+ export type TextTone = "ink" | "muted" | "primary" | "success" | "danger";
5
+ export type TextProps = RNTextProps & {
6
+ /** Type style from tokens.json. "strong" is body in bold ink. */
7
+ variant?: TextVariant;
8
+ tone?: TextTone;
9
+ };
10
+ /**
11
+ * Themed text. Headings get the "header" role so screen readers can jump
12
+ * between them, and cap font scaling at 1.5x so big titles don't overflow;
13
+ * body text scales up to 2x with the user's font size setting.
14
+ */
15
+ export declare function Text({ variant, tone, style, ...props }: TextProps): import("react").JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Text as RNText } from "react-native";
3
+ import { useTheme } from "../theme/ThemeProvider";
4
+ const toneColor = {
5
+ ink: "ink",
6
+ muted: "inkMuted",
7
+ primary: "primary",
8
+ success: "success",
9
+ danger: "danger",
10
+ };
11
+ const headings = new Set(["display", "h1", "h2", "h3"]);
12
+ /**
13
+ * Themed text. Headings get the "header" role so screen readers can jump
14
+ * between them, and cap font scaling at 1.5x so big titles don't overflow;
15
+ * body text scales up to 2x with the user's font size setting.
16
+ */
17
+ export function Text({ variant = "body", tone, style, ...props }) {
18
+ const theme = useTheme();
19
+ const isHeading = headings.has(variant);
20
+ const base = variant === "strong" ? theme.text("body", "700") : theme.text(variant);
21
+ return (_jsx(RNText, { accessibilityRole: isHeading ? "header" : undefined, maxFontSizeMultiplier: isHeading ? 1.5 : 2, style: [
22
+ base,
23
+ { color: theme.colors[toneColor[tone ?? (variant === "small" ? "muted" : "ink")]] },
24
+ variant === "label" && { textTransform: "uppercase" },
25
+ style,
26
+ ], ...props }));
27
+ }
28
+ //# sourceMappingURL=Text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,MAAM,EAAiC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAYlD,MAAM,SAAS,GAAiC;IAC9C,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAc,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAErE;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAa;IACzE,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpF,OAAO,CACL,KAAC,MAAM,IACL,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EACnD,qBAAqB,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAC1C,KAAK,EAAE;YACL,IAAI;YACJ,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACnF,OAAO,KAAK,OAAO,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE;YACrD,KAAK;SACN,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type ComponentRef, type ReactElement, type ReactNode, type Ref } from "react";
2
+ import { TextInput, type StyleProp, type TextInputProps, type ViewStyle } from "react-native";
3
+ export type TextFieldProps = Omit<TextInputProps, "style" | "editable"> & {
4
+ ref?: Ref<ComponentRef<typeof TextInput>>;
5
+ /** Visible label, also read by screen readers. */
6
+ label: string;
7
+ /** Help text under the field. Replaced by `error` when there is one. */
8
+ hint?: string;
9
+ /** Error message. Turns the border red and is announced when it appears. */
10
+ error?: string;
11
+ /**
12
+ * Announce a new `error` to screen readers (iOS announcement, Android live
13
+ * region). Default true. Set it to false when the screen already moves focus
14
+ * to the first invalid field or shows its own error summary, so the error
15
+ * isn't read twice. The error is still in the field's hint either way.
16
+ */
17
+ announceError?: boolean;
18
+ disabled?: boolean;
19
+ /** Icon or text before / after the input, e.g. a search icon or "$". */
20
+ leading?: ReactNode;
21
+ trailing?: ReactNode;
22
+ style?: StyleProp<ViewStyle>;
23
+ };
24
+ export declare function TextField({ ref, label, hint, error, announceError, disabled, leading, trailing, style, onFocus, onBlur, accessibilityHint, ...props }: TextFieldProps): ReactElement;
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { AccessibilityInfo, Platform, TextInput, View, } from "react-native";
4
+ import { useTheme } from "../theme/ThemeProvider";
5
+ import { Text } from "./Text";
6
+ export function TextField({ ref, label, hint, error, announceError = true, disabled, leading, trailing, style, onFocus, onBlur, accessibilityHint, ...props }) {
7
+ const theme = useTheme();
8
+ const [focused, setFocused] = useState(false);
9
+ const message = error ?? hint;
10
+ // iOS has no live regions, so announce a new error explicitly.
11
+ const lastError = useRef(undefined);
12
+ useEffect(() => {
13
+ if (announceError && error && error !== lastError.current && Platform.OS === "ios") {
14
+ AccessibilityInfo.announceForAccessibility(`${label}: ${error}`);
15
+ }
16
+ lastError.current = error;
17
+ }, [announceError, error, label]);
18
+ const borderColor = error ? theme.colors.danger : focused ? theme.colors.primary : theme.colors.lineStrong;
19
+ return (_jsxs(View, { style: [{ gap: theme.spacing[2] }, style], children: [_jsx(Text, { style: [theme.text("small", "600"), { color: theme.colors.ink }], importantForAccessibility: "no", accessibilityElementsHidden: true, children: label }), _jsxs(View, { style: {
20
+ flexDirection: "row",
21
+ alignItems: "center",
22
+ minHeight: 44,
23
+ paddingHorizontal: theme.spacing[3],
24
+ gap: theme.spacing[2],
25
+ backgroundColor: theme.colors.surfaceRaised,
26
+ borderWidth: focused || error ? 2 : 1,
27
+ // keep the text from shifting when the border thickens
28
+ margin: focused || error ? 0 : 1,
29
+ borderColor,
30
+ borderRadius: theme.radius.md,
31
+ opacity: disabled ? 0.6 : 1,
32
+ }, children: [leading, _jsx(TextInput, { ref: ref, accessibilityLabel: label, accessibilityHint: accessibilityHint ?? message, accessibilityState: { disabled: Boolean(disabled) }, "aria-invalid": error ? true : undefined, editable: !disabled, placeholderTextColor: theme.colors.inkMuted, selectionColor: theme.colors.primary, maxFontSizeMultiplier: 2, onFocus: (e) => {
33
+ setFocused(true);
34
+ onFocus?.(e);
35
+ }, onBlur: (e) => {
36
+ setFocused(false);
37
+ onBlur?.(e);
38
+ }, style: [theme.text("body"), { flex: 1, color: theme.colors.ink, paddingVertical: theme.spacing[2] }], ...props }), trailing] }), message ? (_jsx(Text, { variant: "small", tone: error ? "danger" : "muted", accessibilityLiveRegion: error && announceError ? "polite" : "none", importantForAccessibility: error ? "yes" : "no", children: message })) : null] }));
39
+ }
40
+ //# sourceMappingURL=TextField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../src/components/TextField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkE,MAAM,OAAO,CAAC;AACpH,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,IAAI,GAIL,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAwB9B,MAAM,UAAU,SAAS,CAAC,EACxB,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,EACL,aAAa,GAAG,IAAI,EACpB,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,KAAK,EACL,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,GAAG,KAAK,EACO;IACf,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,KAAK,IAAI,IAAI,CAAC;IAE9B,+DAA+D;IAC/D,MA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