@jztack/ui-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 (100) hide show
  1. package/README.md +128 -2
  2. package/dist/Alert.d.ts +20 -0
  3. package/dist/Alert.js +14 -0
  4. package/dist/AppBar.d.ts +21 -0
  5. package/dist/AppBar.js +16 -0
  6. package/dist/Avatar.d.ts +21 -0
  7. package/dist/Avatar.js +23 -0
  8. package/dist/Badge.d.ts +15 -0
  9. package/dist/Badge.js +27 -0
  10. package/dist/BottomTabBar.d.ts +26 -0
  11. package/dist/BottomTabBar.js +39 -0
  12. package/dist/Button.d.ts +21 -0
  13. package/dist/Button.js +63 -0
  14. package/dist/Card.d.ts +37 -0
  15. package/dist/Card.js +41 -0
  16. package/dist/Checkbox.d.ts +11 -0
  17. package/dist/Checkbox.js +11 -0
  18. package/dist/ConfirmActionModal.d.ts +27 -0
  19. package/dist/ConfirmActionModal.js +43 -0
  20. package/dist/DeleteButton.d.ts +20 -0
  21. package/dist/DeleteButton.js +41 -0
  22. package/dist/Dialog.d.ts +10 -0
  23. package/dist/Dialog.js +10 -0
  24. package/dist/DropdownMenu.d.ts +25 -0
  25. package/dist/DropdownMenu.js +57 -0
  26. package/dist/EmptyState.d.ts +13 -0
  27. package/dist/EmptyState.js +10 -0
  28. package/dist/ErrorBoundary.d.ts +33 -0
  29. package/dist/ErrorBoundary.js +37 -0
  30. package/dist/Field.d.ts +24 -0
  31. package/dist/Field.js +20 -0
  32. package/dist/FormFields.d.ts +37 -0
  33. package/dist/FormFields.js +24 -0
  34. package/dist/FormPanel.d.ts +20 -0
  35. package/dist/FormPanel.js +14 -0
  36. package/dist/Input.d.ts +30 -0
  37. package/dist/Input.js +52 -0
  38. package/dist/OptionList.d.ts +25 -0
  39. package/dist/OptionList.js +15 -0
  40. package/dist/PageHeader.d.ts +13 -0
  41. package/dist/PageHeader.js +10 -0
  42. package/dist/Primitives.d.ts +636 -0
  43. package/dist/Primitives.js +5 -0
  44. package/dist/Progress.d.ts +8 -0
  45. package/dist/Progress.js +42 -0
  46. package/dist/RadioGroup.d.ts +15 -0
  47. package/dist/RadioGroup.js +11 -0
  48. package/dist/ScrollOverflowContainer.d.ts +14 -0
  49. package/dist/ScrollOverflowContainer.js +83 -0
  50. package/dist/SegmentedControl.d.ts +19 -0
  51. package/dist/SegmentedControl.js +15 -0
  52. package/dist/Select.d.ts +9 -0
  53. package/dist/Select.js +27 -0
  54. package/dist/Select.web.d.ts +10 -0
  55. package/dist/Select.web.js +41 -0
  56. package/dist/SelectTypes.d.ts +17 -0
  57. package/dist/SelectTypes.js +1 -0
  58. package/dist/Separator.d.ts +6 -0
  59. package/dist/Separator.js +9 -0
  60. package/dist/Sheet.d.ts +31 -0
  61. package/dist/Sheet.js +43 -0
  62. package/dist/Skeleton.d.ts +11 -0
  63. package/dist/Skeleton.js +30 -0
  64. package/dist/StartupScreen.d.ts +9 -0
  65. package/dist/StartupScreen.js +9 -0
  66. package/dist/StateViews.d.ts +13 -0
  67. package/dist/StateViews.js +14 -0
  68. package/dist/Switch.d.ts +13 -0
  69. package/dist/Switch.js +42 -0
  70. package/dist/Table.d.ts +22 -0
  71. package/dist/Table.js +17 -0
  72. package/dist/TextField.d.ts +22 -0
  73. package/dist/TextField.js +116 -0
  74. package/dist/Toast.d.ts +34 -0
  75. package/dist/Toast.js +92 -0
  76. package/dist/ToastHost.d.ts +6 -0
  77. package/dist/ToastHost.js +4 -0
  78. package/dist/ToastHost.web.d.ts +7 -0
  79. package/dist/ToastHost.web.js +11 -0
  80. package/dist/Toggle.d.ts +16 -0
  81. package/dist/Toggle.js +7 -0
  82. package/dist/ToggleGroup.d.ts +27 -0
  83. package/dist/ToggleGroup.js +27 -0
  84. package/dist/haptics.d.ts +45 -0
  85. package/dist/haptics.js +96 -0
  86. package/dist/index.d.ts +41 -0
  87. package/dist/index.js +46 -0
  88. package/dist/shadows.d.ts +28 -0
  89. package/dist/shadows.js +19 -0
  90. package/dist/theme.d.ts +23 -0
  91. package/dist/theme.js +19 -0
  92. package/dist/useDismissOnEscape.d.ts +7 -0
  93. package/dist/useDismissOnEscape.js +10 -0
  94. package/dist/useDismissOnEscape.web.d.ts +2 -0
  95. package/dist/useDismissOnEscape.web.js +14 -0
  96. package/dist/useResponsive.d.ts +28 -0
  97. package/dist/useResponsive.js +23 -0
  98. package/dist/useTextFieldCurrency.d.ts +9 -0
  99. package/dist/useTextFieldCurrency.js +45 -0
  100. package/package.json +52 -3
@@ -0,0 +1,20 @@
1
+ export interface DeleteButtonProps {
2
+ /** Resting label, e.g. "Delete vendor". */
3
+ label: string;
4
+ /** Armed label, e.g. "Confirm delete". */
5
+ confirmLabel: string;
6
+ /** e.g. "Keep". */
7
+ cancelLabel: string;
8
+ /** e.g. "Deleting…". */
9
+ busyLabel?: string;
10
+ onDelete: () => Promise<void>;
11
+ testID?: string;
12
+ }
13
+ /**
14
+ * Two-step inline confirm for row-level deletes — one half of the mandatory
15
+ * destructive standard (decisions log, Dec 4, 2026; the other half is
16
+ * ConfirmActionModal for high-impact actions). Wedding Ops' semantics
17
+ * verbatim: first tap arms, second executes; disarms on cancel/blur; a
18
+ * failed delete surfaces the error inline and stays armed for retry.
19
+ */
20
+ export declare function DeleteButton({ label, confirmLabel, cancelLabel, busyLabel, onDelete, testID, }: DeleteButtonProps): import("react").JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Button } from './Button';
4
+ import { FormError } from './Field';
5
+ import { Box, Text } from './Primitives';
6
+ /**
7
+ * Two-step inline confirm for row-level deletes — one half of the mandatory
8
+ * destructive standard (decisions log, Dec 4, 2026; the other half is
9
+ * ConfirmActionModal for high-impact actions). Wedding Ops' semantics
10
+ * verbatim: first tap arms, second executes; disarms on cancel/blur; a
11
+ * failed delete surfaces the error inline and stays armed for retry.
12
+ */
13
+ export function DeleteButton({ label, confirmLabel, cancelLabel, busyLabel, onDelete, testID, }) {
14
+ const [armed, setArmed] = useState(false);
15
+ const [busy, setBusy] = useState(false);
16
+ const [error, setError] = useState(null);
17
+ const handleConfirm = async () => {
18
+ setBusy(true);
19
+ setError(null);
20
+ try {
21
+ await onDelete();
22
+ setArmed(false);
23
+ }
24
+ catch (e) {
25
+ setError(e instanceof Error ? e.message : '');
26
+ }
27
+ finally {
28
+ setBusy(false);
29
+ }
30
+ };
31
+ if (!armed) {
32
+ return (_jsx(Box, { testID: testID, children: _jsx(Button, { variant: "ghost", onPress: () => setArmed(true), testID: testID ? `${testID}-arm` : undefined, children: _jsx(Text, { variant: "button", color: "danger", children: label }) }) }));
33
+ }
34
+ return (_jsxs(Box, { testID: testID, children: [_jsxs(Box, { flexDirection: "row", style: { gap: 12 }, children: [_jsx(Box, { flex: 1, children: _jsx(Button, { variant: "destructive", isLoading: busy, disabled: busy, onPress: handleConfirm, onBlur: () => {
35
+ if (!busy)
36
+ setArmed(false);
37
+ }, testID: testID ? `${testID}-confirm` : undefined, children: busy && busyLabel ? busyLabel : confirmLabel }) }), _jsx(Box, { flex: 1, children: _jsx(Button, { variant: "ghost", disabled: busy, onPress: () => {
38
+ setArmed(false);
39
+ setError(null);
40
+ }, testID: testID ? `${testID}-cancel` : undefined, children: cancelLabel }) })] }), error ? (_jsx(Box, { mt: "s", children: _jsx(FormError, { message: error }) })) : null] }));
41
+ }
@@ -0,0 +1,10 @@
1
+ import { type SheetBaseProps } from './Sheet';
2
+ export interface DialogProps extends Omit<SheetBaseProps, 'presentation' | 'testID'> {
3
+ testID?: string;
4
+ }
5
+ /**
6
+ * Dialog (DESIGN §2.1 #7): the web compound collapses onto the Sheet
7
+ * substrate with the centered presentation at all widths — presentation is
8
+ * what distinguishes Dialog from Sheet on native, exactly as on web.
9
+ */
10
+ export declare function Dialog(props: DialogProps): import("react").JSX.Element;
package/dist/Dialog.js ADDED
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { SheetBase } from './Sheet';
3
+ /**
4
+ * Dialog (DESIGN §2.1 #7): the web compound collapses onto the Sheet
5
+ * substrate with the centered presentation at all widths — presentation is
6
+ * what distinguishes Dialog from Sheet on native, exactly as on web.
7
+ */
8
+ export function Dialog(props) {
9
+ return _jsx(SheetBase, { ...props, presentation: "center", testID: props.testID ?? 'dialog' });
10
+ }
@@ -0,0 +1,25 @@
1
+ import type React from 'react';
2
+ export interface DropdownMenuItem {
3
+ key: string;
4
+ label: string;
5
+ icon?: React.ReactNode;
6
+ destructive?: boolean;
7
+ disabled?: boolean;
8
+ }
9
+ export interface DropdownMenuProps {
10
+ /** The trigger node; the menu toggles when it is pressed. */
11
+ trigger: React.ReactNode;
12
+ items: DropdownMenuItem[];
13
+ onSelect: (key: string) => void;
14
+ disabled?: boolean;
15
+ /** Cancel row label for the phone presentation (copy via props, R9). */
16
+ cancelLabel?: string;
17
+ testID?: string;
18
+ }
19
+ /**
20
+ * DropdownMenu (DESIGN §2.1 #8): Radix's anchored popover has no RN
21
+ * equivalent, so the twin takes a data API. On ≥tablet the menu anchors
22
+ * under the measured trigger inside a transparent Modal; on phone it
23
+ * presents as the Sheet list (OptionList). Item min-height 40px.
24
+ */
25
+ export declare function DropdownMenu({ trigger, items, onSelect, disabled, cancelLabel, testID, }: DropdownMenuProps): React.JSX.Element;
@@ -0,0 +1,57 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef, useState } from 'react';
3
+ import { Modal, Pressable, ScrollView } from 'react-native';
4
+ import { OptionList } from './OptionList';
5
+ import { Box, Text } from './Primitives';
6
+ import { useDismissOnEscape } from './useDismissOnEscape';
7
+ import { useResponsive } from './useResponsive';
8
+ /**
9
+ * DropdownMenu (DESIGN §2.1 #8): Radix's anchored popover has no RN
10
+ * equivalent, so the twin takes a data API. On ≥tablet the menu anchors
11
+ * under the measured trigger inside a transparent Modal; on phone it
12
+ * presents as the Sheet list (OptionList). Item min-height 40px.
13
+ */
14
+ export function DropdownMenu({ trigger, items, onSelect, disabled = false, cancelLabel = 'Cancel', testID = 'dropdown-menu', }) {
15
+ const [open, setOpen] = useState(false);
16
+ const [anchor, setAnchor] = useState(null);
17
+ const triggerRef = useRef(null);
18
+ const { isPhone } = useResponsive();
19
+ const close = () => setOpen(false);
20
+ useDismissOnEscape(open && !isPhone, close);
21
+ const handleTriggerPress = () => {
22
+ if (disabled)
23
+ return;
24
+ if (isPhone) {
25
+ setOpen(true);
26
+ return;
27
+ }
28
+ // Open immediately; the anchor refines when the measure lands. Gating
29
+ // the open on the measure callback would wedge the menu shut wherever
30
+ // the host node cannot measure (web refs, test renderers).
31
+ setAnchor(null);
32
+ setOpen(true);
33
+ const node = triggerRef.current;
34
+ if (node && typeof node.measureInWindow === 'function') {
35
+ node.measureInWindow((x, y, width, height) => {
36
+ setAnchor({ x, y, width, height });
37
+ });
38
+ }
39
+ };
40
+ const handleSelect = (key) => {
41
+ close();
42
+ onSelect(key);
43
+ };
44
+ return (_jsxs(_Fragment, { children: [_jsx(Pressable, { ref: (node) => {
45
+ triggerRef.current = node;
46
+ }, onPress: handleTriggerPress, disabled: disabled, accessibilityRole: "button", accessibilityState: { disabled, expanded: open }, testID: `${testID}-trigger`, children: trigger }), isPhone ? (_jsx(OptionList, { open: open, onClose: close, items: items.map((item) => ({
47
+ value: item.key,
48
+ label: item.label,
49
+ destructive: item.destructive,
50
+ disabled: item.disabled,
51
+ })), onSelect: handleSelect, cancelLabel: cancelLabel, itemMinHeight: 40, testID: `${testID}-list` })) : (_jsx(Modal, { visible: open, transparent: true, animationType: "fade", onRequestClose: close, testID: `${testID}-modal`, children: _jsx(Pressable, { style: { flex: 1 }, onPress: close, testID: `${testID}-backdrop`, children: _jsx(Box, { position: "absolute", style: {
52
+ top: anchor ? anchor.y + anchor.height + 4 : 0,
53
+ left: anchor ? anchor.x : 0,
54
+ minWidth: anchor ? anchor.width : undefined,
55
+ maxWidth: 280,
56
+ }, children: _jsx(Pressable, { onPress: (e) => e.stopPropagation?.(), children: _jsx(Box, { bg: "card", borderRadius: "lg", borderWidth: 1, borderColor: "border", p: "xs", style: { elevation: 8 }, testID: `${testID}-card`, children: _jsx(ScrollView, { children: items.map((item) => (_jsx(Pressable, { disabled: item.disabled, onPress: () => handleSelect(item.key), accessibilityRole: "button", accessibilityState: { disabled: !!item.disabled }, testID: `${testID}-item-${item.key}`, children: _jsxs(Box, { flexDirection: "row", alignItems: "center", minHeight: 40, px: "s", borderRadius: "md", opacity: item.disabled ? 0.5 : 1, children: [item.icon ? _jsx(Box, { mr: "s", children: item.icon }) : null, _jsx(Text, { variant: "body", color: item.destructive ? 'danger' : 'foreground', children: item.label })] }) }, item.key))) }) }) }) }) }) }))] }));
57
+ }
@@ -0,0 +1,13 @@
1
+ import type { LucideIcon } from 'lucide-react-native';
2
+ import type React from 'react';
3
+ export interface EmptyStateProps {
4
+ /** A lucide-react-native icon component, rendered in the medallion. */
5
+ icon?: LucideIcon;
6
+ title: string;
7
+ description?: string;
8
+ action?: React.ReactNode;
9
+ testID?: string;
10
+ }
11
+ /** EmptyState (DESIGN §2.2): the web prop spec — a superset of mobile-web's
12
+ * message-only StateViews.EmptyState. Copy arrives via props (R9). */
13
+ export declare function EmptyState({ icon: Icon, title, description, action, testID }: EmptyStateProps): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTheme } from '@shopify/restyle';
3
+ import { Card } from './Card';
4
+ import { Box, Text } from './Primitives';
5
+ /** EmptyState (DESIGN §2.2): the web prop spec — a superset of mobile-web's
6
+ * message-only StateViews.EmptyState. Copy arrives via props (R9). */
7
+ export function EmptyState({ icon: Icon, title, description, action, testID }) {
8
+ const theme = useTheme();
9
+ return (_jsx(Card, { testID: testID, children: _jsxs(Box, { alignItems: "center", py: "m", children: [Icon ? (_jsx(Box, { bg: "accent-bg", borderRadius: "full", p: "m", mb: "m", alignItems: "center", justifyContent: "center", children: _jsx(Icon, { size: 24, color: theme.colors.accent }) })) : null, _jsx(Text, { variant: "title", textAlign: "center", children: title }), description ? (_jsx(Text, { variant: "bodySecondary", textAlign: "center", mt: "xs", children: description })) : null, action ? _jsx(Box, { mt: "m", children: action }) : null] }) }));
10
+ }
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ export interface ErrorBoundaryProps {
3
+ children: React.ReactNode;
4
+ /** Full fallback override. */
5
+ fallback?: React.ReactNode;
6
+ title?: string;
7
+ description?: string;
8
+ homeLabel?: string;
9
+ refreshLabel?: string;
10
+ onHome?: () => void;
11
+ onRefresh?: () => void;
12
+ /** Render the caught error's message (the app decides — its env check). */
13
+ showDetails?: boolean;
14
+ onError?: (error: Error, info: React.ErrorInfo) => void;
15
+ }
16
+ interface ErrorBoundaryState {
17
+ error: Error | null;
18
+ }
19
+ /**
20
+ * ErrorBoundary (DESIGN §2.2): the web prop spec, replacing mobile-web's
21
+ * ErrorBoundaryFallback (react-error-boundary FallbackProps shape). The
22
+ * app's recovery policy (when to reset vs reload) stays in the app and
23
+ * plugs into onError/onRefresh. The old fallback's hard-coded monospace
24
+ * fontFamily is dropped — tokens carries no RN font family.
25
+ */
26
+ export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
27
+ state: ErrorBoundaryState;
28
+ static getDerivedStateFromError(error: Error): ErrorBoundaryState;
29
+ componentDidCatch(error: Error, info: React.ErrorInfo): void;
30
+ private handleRefresh;
31
+ render(): React.ReactNode;
32
+ }
33
+ export {};
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { Button } from './Button';
4
+ import { Box, Text } from './Primitives';
5
+ const DEFAULT_TITLE = 'Something went wrong';
6
+ const DEFAULT_DESCRIPTION = 'The app hit an unexpected error.';
7
+ /**
8
+ * ErrorBoundary (DESIGN §2.2): the web prop spec, replacing mobile-web's
9
+ * ErrorBoundaryFallback (react-error-boundary FallbackProps shape). The
10
+ * app's recovery policy (when to reset vs reload) stays in the app and
11
+ * plugs into onError/onRefresh. The old fallback's hard-coded monospace
12
+ * fontFamily is dropped — tokens carries no RN font family.
13
+ */
14
+ export class ErrorBoundary extends React.Component {
15
+ state = { error: null };
16
+ static getDerivedStateFromError(error) {
17
+ return { error };
18
+ }
19
+ componentDidCatch(error, info) {
20
+ this.props.onError?.(error, info);
21
+ }
22
+ handleRefresh = () => {
23
+ if (this.props.onRefresh) {
24
+ this.props.onRefresh();
25
+ }
26
+ this.setState({ error: null });
27
+ };
28
+ render() {
29
+ const { error } = this.state;
30
+ if (!error)
31
+ return this.props.children;
32
+ if (this.props.fallback)
33
+ return this.props.fallback;
34
+ const { title = DEFAULT_TITLE, description = DEFAULT_DESCRIPTION, homeLabel, refreshLabel, onHome, showDetails, } = this.props;
35
+ return (_jsx(Box, { flex: 1, justifyContent: "center", alignItems: "center", bg: "background", p: "l", testID: "error-boundary-fallback", children: _jsxs(Box, { p: "l", borderRadius: "lg", borderWidth: 1, borderColor: "danger", bg: "danger-bg", width: "100%", maxWidth: 500, alignItems: "center", children: [_jsx(Text, { variant: "header", color: "danger-foreground", mb: "s", textAlign: "center", children: title }), _jsx(Text, { variant: "body", color: "danger-foreground", mb: "m", textAlign: "center", children: description }), showDetails ? (_jsx(Box, { p: "m", bg: "card", borderRadius: "md", borderWidth: 1, borderColor: "border", width: "100%", mb: "l", children: _jsx(Text, { variant: "caption", color: "foreground", children: error.message }) })) : null, _jsxs(Box, { style: { gap: 16 }, width: "100%", children: [refreshLabel ? _jsx(Button, { onPress: this.handleRefresh, children: refreshLabel }) : null, homeLabel && onHome ? (_jsx(Button, { variant: "outline", onPress: onHome, children: homeLabel })) : null] })] }) }));
36
+ }
37
+ }
@@ -0,0 +1,24 @@
1
+ import type React from 'react';
2
+ export interface FieldProps {
3
+ label: string;
4
+ hint?: string;
5
+ error?: string;
6
+ required?: boolean;
7
+ /** Label press focuses the control (the wrappers pass their ref focus). */
8
+ onLabelPress?: () => void;
9
+ children: React.ReactNode;
10
+ testID?: string;
11
+ }
12
+ /**
13
+ * Field (DESIGN §2.2): label + control + hint/error composition. There is
14
+ * no htmlFor/aria-describedby on native — the label press focuses the
15
+ * control through the wrapper's ref wiring, and the error is announced via
16
+ * an assertive live region.
17
+ */
18
+ export declare function Field({ label, hint, error, required, onLabelPress, children, testID, }: FieldProps): React.JSX.Element;
19
+ export interface FormErrorProps {
20
+ message: string | null;
21
+ }
22
+ /** Form-level error, built on the danger Alert styling; renders nothing
23
+ * when there is no message (Wedding Ops behaviour, DESIGN §2.2). */
24
+ export declare function FormError({ message }: FormErrorProps): React.JSX.Element | null;
package/dist/Field.js ADDED
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Alert } from './Alert';
3
+ import { Label } from './Input';
4
+ import { Box, Text } from './Primitives';
5
+ /**
6
+ * Field (DESIGN §2.2): label + control + hint/error composition. There is
7
+ * no htmlFor/aria-describedby on native — the label press focuses the
8
+ * control through the wrapper's ref wiring, and the error is announced via
9
+ * an assertive live region.
10
+ */
11
+ export function Field({ label, hint, error, required, onLabelPress, children, testID, }) {
12
+ return (_jsxs(Box, { my: "s", testID: testID, children: [_jsx(Box, { mb: "xs", children: _jsx(Label, { onPress: onLabelPress, children: required ? `${label} *` : label }) }), children, error ? (_jsx(Text, { variant: "error", mt: "xs", accessibilityRole: "alert", accessibilityLiveRegion: "assertive", children: error })) : hint ? (_jsx(Text, { variant: "bodySecondary", mt: "xs", children: hint })) : null] }));
13
+ }
14
+ /** Form-level error, built on the danger Alert styling; renders nothing
15
+ * when there is no message (Wedding Ops behaviour, DESIGN §2.2). */
16
+ export function FormError({ message }) {
17
+ if (!message)
18
+ return null;
19
+ return _jsx(Alert, { tone: "danger", description: message });
20
+ }
@@ -0,0 +1,37 @@
1
+ import type React from 'react';
2
+ import { type InputProps, type TextareaProps } from './Input';
3
+ import { type SelectProps } from './Select';
4
+ /** SelectField = Field + twin Select (DESIGN §2.2). */
5
+ export interface SelectFieldProps extends SelectProps {
6
+ hint?: string;
7
+ error?: string;
8
+ required?: boolean;
9
+ }
10
+ export declare function SelectField({ hint, error, required, label, testID, ...selectProps }: SelectFieldProps): React.JSX.Element;
11
+ /** TextAreaField = Field + twin Textarea, with label-press focus wiring. */
12
+ export interface TextAreaFieldProps extends TextareaProps {
13
+ label: string;
14
+ hint?: string;
15
+ error?: string;
16
+ required?: boolean;
17
+ }
18
+ export declare function TextAreaField({ label, hint, error, required, testID, ...inputProps }: TextAreaFieldProps): React.JSX.Element;
19
+ /** InputField = Field + twin Input, with label-press focus wiring. */
20
+ export interface InputFieldProps extends InputProps {
21
+ label: string;
22
+ hint?: string;
23
+ error?: string;
24
+ required?: boolean;
25
+ }
26
+ export declare function InputField({ label, hint, error, required, testID, ...inputProps }: InputFieldProps): React.JSX.Element;
27
+ export interface CheckboxFieldProps {
28
+ label: string;
29
+ hint?: string;
30
+ checked: boolean;
31
+ onCheckedChange?: (checked: boolean) => void;
32
+ disabled?: boolean;
33
+ testID?: string;
34
+ }
35
+ /** The row is the tap target (standards), which solves the Checkbox's
36
+ * small hit area — the same rule as web §3.4. */
37
+ export declare function CheckboxField({ label, hint, checked, onCheckedChange, disabled, testID, }: CheckboxFieldProps): React.JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef } from 'react';
3
+ import { Pressable } from 'react-native';
4
+ import { Checkbox } from './Checkbox';
5
+ import { Field } from './Field';
6
+ import { Input, Textarea } from './Input';
7
+ import { Box, Text } from './Primitives';
8
+ import { Select } from './Select';
9
+ export function SelectField({ hint, error, required, label, testID, ...selectProps }) {
10
+ return (_jsx(Field, { label: label ?? '', hint: hint, error: error, required: required, testID: testID, children: _jsx(Select, { label: undefined, testID: testID ? `${testID}-select` : undefined, ...selectProps }) }));
11
+ }
12
+ export function TextAreaField({ label, hint, error, required, testID, ...inputProps }) {
13
+ const ref = useRef(null);
14
+ return (_jsx(Field, { label: label, hint: hint, error: error, required: required, onLabelPress: () => ref.current?.focus(), testID: testID, children: _jsx(Textarea, { ref: ref, testID: testID ? `${testID}-input` : undefined, ...inputProps }) }));
15
+ }
16
+ export function InputField({ label, hint, error, required, testID, ...inputProps }) {
17
+ const ref = useRef(null);
18
+ return (_jsx(Field, { label: label, hint: hint, error: error, required: required, onLabelPress: () => ref.current?.focus(), testID: testID, children: _jsx(Input, { ref: ref, testID: testID ? `${testID}-input` : undefined, ...inputProps }) }));
19
+ }
20
+ /** The row is the tap target (standards), which solves the Checkbox's
21
+ * small hit area — the same rule as web §3.4. */
22
+ export function CheckboxField({ label, hint, checked, onCheckedChange, disabled, testID, }) {
23
+ return (_jsx(Pressable, { onPress: () => onCheckedChange?.(!checked), disabled: disabled, accessibilityRole: "checkbox", accessibilityState: { checked, disabled: !!disabled }, testID: testID, children: _jsxs(Box, { flexDirection: "row", alignItems: "center", minHeight: 48, opacity: disabled ? 0.5 : 1, children: [_jsx(Checkbox, { checked: checked, disabled: disabled }), _jsxs(Box, { flex: 1, ml: "s", children: [_jsx(Text, { variant: "body", children: label }), hint ? _jsx(Text, { variant: "bodySecondary", children: hint }) : null] })] }) }));
24
+ }
@@ -0,0 +1,20 @@
1
+ import type React from 'react';
2
+ export interface FormPanelProps {
3
+ title?: string;
4
+ children: React.ReactNode;
5
+ testID?: string;
6
+ }
7
+ /** Card + heading + spaced stack (Wedding Ops pattern, DESIGN §2.2). */
8
+ export declare function FormPanel({ title, children, testID }: FormPanelProps): React.JSX.Element;
9
+ export interface FormActionsProps {
10
+ saving?: boolean;
11
+ onSubmit?: () => void;
12
+ onCancel?: () => void;
13
+ saveLabel: string;
14
+ cancelLabel: string;
15
+ savingLabel: string;
16
+ testID?: string;
17
+ }
18
+ /** Submit (flex-1, 48px, busy label while saving) + cancel — all labels are
19
+ * props (Wedding Ops hard-coded them; the twin does not, R9). */
20
+ export declare function FormActions({ saving, onSubmit, onCancel, saveLabel, cancelLabel, savingLabel, testID, }: FormActionsProps): React.JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from './Button';
3
+ import { Card } from './Card';
4
+ import { SectionHeading } from './PageHeader';
5
+ import { Box } from './Primitives';
6
+ /** Card + heading + spaced stack (Wedding Ops pattern, DESIGN §2.2). */
7
+ export function FormPanel({ title, children, testID }) {
8
+ return (_jsxs(Card, { testID: testID, children: [title ? (_jsx(Box, { mb: "m", children: _jsx(SectionHeading, { children: title }) })) : null, _jsx(Box, { style: { gap: 16 }, children: children })] }));
9
+ }
10
+ /** Submit (flex-1, 48px, busy label while saving) + cancel — all labels are
11
+ * props (Wedding Ops hard-coded them; the twin does not, R9). */
12
+ export function FormActions({ saving = false, onSubmit, onCancel, saveLabel, cancelLabel, savingLabel, testID, }) {
13
+ return (_jsxs(Box, { flexDirection: "row", style: { gap: 12 }, testID: testID, children: [onCancel ? (_jsx(Box, { flex: 1, children: _jsx(Button, { variant: "secondary", onPress: onCancel, disabled: saving, children: cancelLabel }) })) : null, _jsx(Box, { flex: 1, children: _jsx(Button, { onPress: onSubmit, isLoading: saving, disabled: saving, children: saving ? savingLabel : saveLabel }) })] }));
14
+ }
@@ -0,0 +1,30 @@
1
+ import type React from 'react';
2
+ import { type StyleProp, TextInput, type TextInputProps, type TextStyle } from 'react-native';
3
+ export interface LabelProps {
4
+ children: React.ReactNode;
5
+ /** Focuses the wired control (the Field passes its ref handler). */
6
+ onPress?: () => void;
7
+ style?: StyleProp<TextStyle>;
8
+ testID?: string;
9
+ }
10
+ /** Presentational label (DESIGN §2.1 #10): no htmlFor on native; the Field
11
+ * wires label presses to control focus. */
12
+ export declare function Label({ children, onPress, style, testID }: LabelProps): React.JSX.Element;
13
+ export interface InputProps extends TextInputProps {
14
+ /** React 19 ref-as-prop, forwarded to the underlying TextInput (the
15
+ * Field's label-press focus wiring uses it). */
16
+ ref?: React.Ref<React.ComponentRef<typeof TextInput>>;
17
+ }
18
+ /**
19
+ * Bare input (DESIGN §2.1 #9): minHeight 48 and an explicit 16px font size
20
+ * on the control itself — RN-Web in a mobile browser has the same iOS
21
+ * focus-zoom hazard as DOM inputs, and the 15px `body` type role must not
22
+ * leak into the control.
23
+ */
24
+ export declare function Input({ style, ref, ...rest }: InputProps): React.JSX.Element;
25
+ export interface TextareaProps extends TextInputProps {
26
+ /** Rows-equivalent minimum height driver. Default 4 → minHeight 96. */
27
+ minRows?: number;
28
+ ref?: React.Ref<React.ComponentRef<typeof TextInput>>;
29
+ }
30
+ export declare function Textarea({ style, minRows, ref, ...rest }: TextareaProps): React.JSX.Element;
package/dist/Input.js ADDED
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTheme } from '@shopify/restyle';
3
+ import { TextInput } from 'react-native';
4
+ import { Text } from './Primitives';
5
+ /** Presentational label (DESIGN §2.1 #10): no htmlFor on native; the Field
6
+ * wires label presses to control focus. */
7
+ export function Label({ children, onPress, style, testID }) {
8
+ return (_jsx(Text, { variant: "subtitle", onPress: onPress, style: style, testID: testID, children: children }));
9
+ }
10
+ /**
11
+ * Bare input (DESIGN §2.1 #9): minHeight 48 and an explicit 16px font size
12
+ * on the control itself — RN-Web in a mobile browser has the same iOS
13
+ * focus-zoom hazard as DOM inputs, and the 15px `body` type role must not
14
+ * leak into the control.
15
+ */
16
+ export function Input({ style, ref, ...rest }) {
17
+ const theme = useTheme();
18
+ const { colors, spacing, borderRadii } = theme;
19
+ const inputStyle = {
20
+ width: '100%',
21
+ minHeight: 48,
22
+ backgroundColor: colors.card,
23
+ borderRadius: borderRadii.lg,
24
+ borderWidth: spacing.hairline,
25
+ borderColor: colors.border,
26
+ paddingHorizontal: spacing.m,
27
+ paddingVertical: spacing.sm,
28
+ fontSize: 16,
29
+ lineHeight: theme.textVariants.body?.lineHeight,
30
+ color: colors.foreground,
31
+ };
32
+ return (_jsx(TextInput, { ref: ref, placeholderTextColor: colors['foreground-secondary'], style: [inputStyle, style], ...rest }));
33
+ }
34
+ export function Textarea({ style, minRows = 4, ref, ...rest }) {
35
+ const theme = useTheme();
36
+ const { colors, spacing, borderRadii } = theme;
37
+ const inputStyle = {
38
+ width: '100%',
39
+ minHeight: minRows * 24,
40
+ backgroundColor: colors.card,
41
+ borderRadius: borderRadii.lg,
42
+ borderWidth: spacing.hairline,
43
+ borderColor: colors.border,
44
+ paddingHorizontal: spacing.m,
45
+ paddingVertical: spacing.sm,
46
+ fontSize: 16,
47
+ lineHeight: theme.textVariants.body?.lineHeight,
48
+ color: colors.foreground,
49
+ textAlignVertical: 'top',
50
+ };
51
+ return (_jsx(TextInput, { ref: ref, multiline: true, placeholderTextColor: colors['foreground-secondary'], style: [inputStyle, style], ...rest }));
52
+ }
@@ -0,0 +1,25 @@
1
+ export interface OptionListItem {
2
+ value: string;
3
+ label: string;
4
+ destructive?: boolean;
5
+ disabled?: boolean;
6
+ }
7
+ export interface OptionListProps {
8
+ open: boolean;
9
+ onClose: () => void;
10
+ title?: string;
11
+ items: OptionListItem[];
12
+ selectedValue?: string;
13
+ onSelect: (value: string) => void;
14
+ /** Bottom cancel row label (copy via props, R9). Default 'Cancel'. */
15
+ cancelLabel?: string;
16
+ /** Row min height: 48 for form selects, 40 for menus (DESIGN §2.1). */
17
+ itemMinHeight?: number;
18
+ testID?: string;
19
+ }
20
+ /**
21
+ * Internal substrate (not exported from the package index): TWJS's
22
+ * DropdownModal evolved onto the Sheet pattern. Backs the native Select
23
+ * list and DropdownMenu's phone presentation.
24
+ */
25
+ export declare function OptionList({ open, onClose, title, items, selectedValue, onSelect, cancelLabel, itemMinHeight, testID, }: OptionListProps): import("react").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Pressable, ScrollView } from 'react-native';
3
+ import { Box, Text } from './Primitives';
4
+ import { Sheet } from './Sheet';
5
+ /**
6
+ * Internal substrate (not exported from the package index): TWJS's
7
+ * DropdownModal evolved onto the Sheet pattern. Backs the native Select
8
+ * list and DropdownMenu's phone presentation.
9
+ */
10
+ export function OptionList({ open, onClose, title, items, selectedValue, onSelect, cancelLabel = 'Cancel', itemMinHeight = 48, testID = 'option-list', }) {
11
+ return (_jsxs(Sheet, { open: open, onOpenChange: (next) => (next ? undefined : onClose()), testID: testID, children: [title ? (_jsx(Box, { borderBottomWidth: 1, borderColor: "border", pb: "s", mb: "s", children: _jsx(Text, { variant: "title", children: title }) })) : null, _jsx(ScrollView, { children: items.map((item) => {
12
+ const isSelected = item.value === selectedValue;
13
+ return (_jsx(Pressable, { disabled: item.disabled, onPress: () => onSelect(item.value), accessibilityRole: "button", accessibilityState: { selected: isSelected, disabled: !!item.disabled }, testID: `${testID}-item-${item.value}`, children: _jsx(Box, { py: "s", px: "m", my: "xxs", minHeight: itemMinHeight, justifyContent: "center", borderRadius: "lg", bg: isSelected ? 'background-secondary' : 'transparent', opacity: item.disabled ? 0.5 : 1, children: _jsx(Text, { variant: "body", fontWeight: isSelected ? '700' : '400', color: item.destructive ? 'danger' : isSelected ? 'primary' : 'foreground', children: item.label }) }) }, item.value));
14
+ }) }), _jsx(Pressable, { onPress: onClose, testID: `${testID}-cancel`, accessibilityRole: "button", children: _jsx(Box, { borderTopWidth: 1, borderColor: "border", mt: "s", pt: "s", minHeight: 48, justifyContent: "center", children: _jsx(Text, { variant: "body", fontWeight: "700", color: "danger", textAlign: "center", children: cancelLabel }) }) })] }));
15
+ }
@@ -0,0 +1,13 @@
1
+ import type React from 'react';
2
+ export interface PageHeaderProps {
3
+ title: string;
4
+ description?: string;
5
+ actions?: React.ReactNode;
6
+ testID?: string;
7
+ }
8
+ /** Same API as web (DESIGN §2.2): title / description / actions are
9
+ * platform-neutral; type roles are canonical contract tokens. */
10
+ export declare function PageHeader({ title, description, actions, testID }: PageHeaderProps): React.JSX.Element;
11
+ export declare function SectionHeading({ children }: {
12
+ children: React.ReactNode;
13
+ }): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from './Primitives';
3
+ /** Same API as web (DESIGN §2.2): title / description / actions are
4
+ * platform-neutral; type roles are canonical contract tokens. */
5
+ export function PageHeader({ title, description, actions, testID }) {
6
+ return (_jsxs(Box, { flexDirection: "row", alignItems: "flex-start", justifyContent: "space-between", testID: testID, children: [_jsxs(Box, { flex: 1, children: [_jsx(Text, { variant: "header", children: title }), description ? (_jsx(Text, { variant: "bodySecondary", mt: "xxs", children: description })) : null] }), actions ? _jsx(Box, { ml: "s", children: actions }) : null] }));
7
+ }
8
+ export function SectionHeading({ children }) {
9
+ return _jsx(Text, { variant: "title", children: children });
10
+ }