@marktiderman/genesis-ui-native 2.0.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 (129) hide show
  1. package/dist/chunk-BAU4YQZV.js +760 -0
  2. package/dist/chunk-BAU4YQZV.js.map +1 -0
  3. package/dist/chunk-DGUM43GV.js +10 -0
  4. package/dist/chunk-DGUM43GV.js.map +1 -0
  5. package/dist/chunk-HNIEFTEL.js +43 -0
  6. package/dist/chunk-HNIEFTEL.js.map +1 -0
  7. package/dist/chunk-N4WHTQIO.js +20 -0
  8. package/dist/chunk-N4WHTQIO.js.map +1 -0
  9. package/dist/chunk-OHZD7KRO.js +11 -0
  10. package/dist/chunk-OHZD7KRO.js.map +1 -0
  11. package/dist/chunk-PTJ2KCLM.js +160 -0
  12. package/dist/chunk-PTJ2KCLM.js.map +1 -0
  13. package/dist/chunk-TXJT55JC.js +2213 -0
  14. package/dist/chunk-TXJT55JC.js.map +1 -0
  15. package/dist/chunk-ULS7I6ZS.js +183 -0
  16. package/dist/chunk-ULS7I6ZS.js.map +1 -0
  17. package/dist/chunk-ZVF6PONU.js +522 -0
  18. package/dist/chunk-ZVF6PONU.js.map +1 -0
  19. package/dist/components/index.d.ts +908 -0
  20. package/dist/components/index.js +8 -0
  21. package/dist/components/index.js.map +1 -0
  22. package/dist/data/index.d.ts +117 -0
  23. package/dist/data/index.js +770 -0
  24. package/dist/data/index.js.map +1 -0
  25. package/dist/hooks/index.d.ts +31 -0
  26. package/dist/hooks/index.js +5 -0
  27. package/dist/hooks/index.js.map +1 -0
  28. package/dist/index.d.ts +11 -0
  29. package/dist/index.js +11 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/layouts/index.d.ts +364 -0
  32. package/dist/layouts/index.js +8 -0
  33. package/dist/layouts/index.js.map +1 -0
  34. package/dist/utils.d.ts +5 -0
  35. package/dist/utils.js +4 -0
  36. package/dist/utils.js.map +1 -0
  37. package/package.json +127 -0
  38. package/src/components/__tests__/accordion.test.tsx +122 -0
  39. package/src/components/__tests__/chip-group.test.tsx +45 -0
  40. package/src/components/__tests__/combobox.test.tsx +97 -0
  41. package/src/components/__tests__/drawer.test.tsx +98 -0
  42. package/src/components/__tests__/empty-state.test.tsx +66 -0
  43. package/src/components/__tests__/header-card.test.tsx +31 -0
  44. package/src/components/__tests__/layout.test.tsx +109 -0
  45. package/src/components/__tests__/list-item.test.tsx +31 -0
  46. package/src/components/__tests__/number-input.test.tsx +46 -0
  47. package/src/components/__tests__/pagination.test.tsx +43 -0
  48. package/src/components/__tests__/search-bar.test.tsx +41 -0
  49. package/src/components/__tests__/segmented-empty-alert.test.tsx +79 -0
  50. package/src/components/__tests__/slider.test.tsx +134 -0
  51. package/src/components/__tests__/stepper.test.tsx +25 -0
  52. package/src/components/__tests__/toast.test.tsx +63 -0
  53. package/src/components/accordion.tsx +223 -0
  54. package/src/components/alert.tsx +131 -0
  55. package/src/components/avatar.tsx +68 -0
  56. package/src/components/badge.tsx +80 -0
  57. package/src/components/button.tsx +118 -0
  58. package/src/components/card.tsx +120 -0
  59. package/src/components/checkbox.tsx +60 -0
  60. package/src/components/chip-group.tsx +127 -0
  61. package/src/components/combobox.tsx +137 -0
  62. package/src/components/date-time-picker.tsx +127 -0
  63. package/src/components/dialog.tsx +131 -0
  64. package/src/components/drawer.tsx +131 -0
  65. package/src/components/dropdown-menu.tsx +133 -0
  66. package/src/components/empty-state.tsx +161 -0
  67. package/src/components/header-card.tsx +116 -0
  68. package/src/components/index.ts +259 -0
  69. package/src/components/inline-alert.tsx +150 -0
  70. package/src/components/input.tsx +51 -0
  71. package/src/components/label.tsx +35 -0
  72. package/src/components/layout/box.tsx +115 -0
  73. package/src/components/layout/flex.ts +24 -0
  74. package/src/components/layout/grid.tsx +73 -0
  75. package/src/components/layout/index.ts +27 -0
  76. package/src/components/layout/inline.tsx +63 -0
  77. package/src/components/layout/spacing.ts +116 -0
  78. package/src/components/layout/stack.tsx +58 -0
  79. package/src/components/list-item.tsx +108 -0
  80. package/src/components/number-input.tsx +119 -0
  81. package/src/components/pagination.tsx +132 -0
  82. package/src/components/popover.tsx +198 -0
  83. package/src/components/progress.tsx +50 -0
  84. package/src/components/radio-group.tsx +92 -0
  85. package/src/components/refresh-control.tsx +73 -0
  86. package/src/components/search-bar.tsx +128 -0
  87. package/src/components/section-list.tsx +54 -0
  88. package/src/components/segmented-control.tsx +79 -0
  89. package/src/components/select.tsx +178 -0
  90. package/src/components/separator.tsx +31 -0
  91. package/src/components/sheet.tsx +192 -0
  92. package/src/components/skeleton.tsx +104 -0
  93. package/src/components/slider.tsx +223 -0
  94. package/src/components/stepper.tsx +96 -0
  95. package/src/components/switch.tsx +35 -0
  96. package/src/components/tabs.tsx +147 -0
  97. package/src/components/text.tsx +62 -0
  98. package/src/components/textarea.tsx +52 -0
  99. package/src/components/toast.tsx +228 -0
  100. package/src/components/toggle.tsx +85 -0
  101. package/src/components/tooltip.tsx +104 -0
  102. package/src/data/NativeDataFilters.tsx +100 -0
  103. package/src/data/NativeDataPageShell.tsx +111 -0
  104. package/src/data/NativeDetailPanel.tsx +130 -0
  105. package/src/data/NativeEmptyState.tsx +46 -0
  106. package/src/data/NativeResourceForm.tsx +157 -0
  107. package/src/data/NativeResourceFormField.tsx +280 -0
  108. package/src/data/NativeResourcePage.tsx +505 -0
  109. package/src/data/index.ts +9 -0
  110. package/src/hooks/index.ts +16 -0
  111. package/src/hooks/use-genesis-extension.ts +81 -0
  112. package/src/hooks/use-reduced-motion.ts +32 -0
  113. package/src/hooks/use-theme-mode.ts +31 -0
  114. package/src/index.ts +5 -0
  115. package/src/layouts/__tests__/auth.test.tsx +150 -0
  116. package/src/layouts/__tests__/nav-bar.test.tsx +86 -0
  117. package/src/layouts/__tests__/notifications-page.test.tsx +94 -0
  118. package/src/layouts/__tests__/screen-container.test.tsx +79 -0
  119. package/src/layouts/__tests__/settings-page.test.tsx +107 -0
  120. package/src/layouts/__tests__/settings-sub-page.test.tsx +53 -0
  121. package/src/layouts/auth.tsx +352 -0
  122. package/src/layouts/index.ts +61 -0
  123. package/src/layouts/nav-bar.tsx +200 -0
  124. package/src/layouts/notifications-page.tsx +274 -0
  125. package/src/layouts/screen-container.tsx +213 -0
  126. package/src/layouts/settings-page.tsx +195 -0
  127. package/src/layouts/settings-sub-page.tsx +183 -0
  128. package/src/nativewind.d.ts +40 -0
  129. package/src/utils.ts +6 -0
@@ -0,0 +1,259 @@
1
+ export { NativeText, textVariants } from "./text";
2
+ export type { NativeTextProps, TextPreset } from "./text";
3
+
4
+ export { NativeButton, buttonVariants, buttonTextVariants } from "./button";
5
+ export type { NativeButtonProps } from "./button";
6
+
7
+ export {
8
+ NativeCard,
9
+ NativeCardHeader,
10
+ NativeCardTitle,
11
+ NativeCardDescription,
12
+ NativeCardContent,
13
+ NativeCardFooter,
14
+ } from "./card";
15
+ export type { NativeCardProps, NativeCardTitleProps } from "./card";
16
+
17
+ export { NativeHeaderCard } from "./header-card";
18
+ export type { NativeHeaderCardProps } from "./header-card";
19
+
20
+ // --- C2 Tier-1 primitives (PRD-07 Phase C2) ---
21
+
22
+ export { NativeToastProvider, useToast } from "./toast";
23
+ export type {
24
+ NativeToastOptions,
25
+ NativeToastProviderProps,
26
+ NativeToastVariant,
27
+ } from "./toast";
28
+
29
+ export { NativeSheet } from "./sheet";
30
+ export type { NativeSheetProps } from "./sheet";
31
+
32
+ export {
33
+ NativePopover,
34
+ NativePopoverTrigger,
35
+ NativePopoverContent,
36
+ } from "./popover";
37
+ export type {
38
+ NativePopoverProps,
39
+ NativePopoverTriggerProps,
40
+ NativePopoverContentProps,
41
+ } from "./popover";
42
+
43
+ export { NativeDrawer } from "./drawer";
44
+ export type { NativeDrawerProps } from "./drawer";
45
+
46
+ export {
47
+ NativeAccordion,
48
+ NativeAccordionItem,
49
+ NativeAccordionTrigger,
50
+ NativeAccordionContent,
51
+ } from "./accordion";
52
+ export type {
53
+ NativeAccordionProps,
54
+ NativeAccordionItemProps,
55
+ NativeAccordionTriggerProps,
56
+ NativeAccordionContentProps,
57
+ NativeAccordionType,
58
+ } from "./accordion";
59
+
60
+ export { NativeCombobox } from "./combobox";
61
+ export type { NativeComboboxProps, NativeComboboxOption } from "./combobox";
62
+
63
+ export { NativeDatePicker, NativeTimePicker } from "./date-time-picker";
64
+ export type {
65
+ NativeDatePickerProps,
66
+ NativeTimePickerProps,
67
+ } from "./date-time-picker";
68
+
69
+ export { NativeNumberInput } from "./number-input";
70
+ export type { NativeNumberInputProps } from "./number-input";
71
+
72
+ // --- C3 Tier-2 primitives (PRD-07 Phase C3) ---
73
+
74
+ export { NativeStepper } from "./stepper";
75
+ export type { NativeStepperProps, NativeStepperStep } from "./stepper";
76
+
77
+ export { NativeSlider, NativeRangeSlider } from "./slider";
78
+ export type {
79
+ NativeSliderProps,
80
+ NativeRangeSliderProps,
81
+ } from "./slider";
82
+
83
+ export { NativeSegmentedControl } from "./segmented-control";
84
+ export type {
85
+ NativeSegmentedControlProps,
86
+ NativeSegmentedControlOption,
87
+ } from "./segmented-control";
88
+
89
+ export { NativeChip, NativeChipGroup } from "./chip-group";
90
+ export type {
91
+ NativeChipProps,
92
+ NativeChipGroupProps,
93
+ NativeChipGroupMode,
94
+ } from "./chip-group";
95
+
96
+ export { NativePagination } from "./pagination";
97
+ export type { NativePaginationProps } from "./pagination";
98
+
99
+ export { NativeEmptyState } from "./empty-state";
100
+ export type {
101
+ NativeEmptyStateProps,
102
+ NativeEmptyStateVariant,
103
+ } from "./empty-state";
104
+
105
+ export { NativeInlineAlert, NativeBanner } from "./inline-alert";
106
+ export type {
107
+ NativeInlineAlertProps,
108
+ NativeBannerProps,
109
+ NativeInlineAlertVariant,
110
+ } from "./inline-alert";
111
+
112
+ // --- C4 composite patterns (PRD-07 Phase C4) ---
113
+
114
+ export { NativeListItem, NativeListItemDivider } from "./list-item";
115
+ export type { NativeListItemProps } from "./list-item";
116
+
117
+ export { NativeSectionListHeader } from "./section-list";
118
+ export type { NativeSectionListHeaderProps } from "./section-list";
119
+
120
+ export { NativeSearchBar } from "./search-bar";
121
+ export type { NativeSearchBarProps } from "./search-bar";
122
+
123
+ export { NativeRefreshControl } from "./refresh-control";
124
+ export type { NativeRefreshControlProps } from "./refresh-control";
125
+
126
+ export { NativeBadge, badgeVariants, badgeTextVariants } from "./badge";
127
+ export type { NativeBadgeProps } from "./badge";
128
+
129
+ export { NativeInput } from "./input";
130
+ export type { NativeInputProps } from "./input";
131
+
132
+ export { NativeSeparator } from "./separator";
133
+ export type { NativeSeparatorProps } from "./separator";
134
+
135
+ export { NativeSkeleton } from "./skeleton";
136
+ export type { NativeSkeletonProps } from "./skeleton";
137
+
138
+ export {
139
+ NativeAlert,
140
+ NativeAlertTitle,
141
+ NativeAlertDescription,
142
+ alertVariants,
143
+ } from "./alert";
144
+ export type {
145
+ NativeAlertProps,
146
+ NativeAlertTitleProps,
147
+ NativeAlertDescriptionProps,
148
+ } from "./alert";
149
+
150
+ export { NativeAvatar } from "./avatar";
151
+ export type { NativeAvatarProps } from "./avatar";
152
+
153
+ export { NativeProgress } from "./progress";
154
+ export type { NativeProgressProps } from "./progress";
155
+
156
+ // --- New components ---
157
+
158
+ export { NativeCheckbox } from "./checkbox";
159
+ export type { NativeCheckboxProps } from "./checkbox";
160
+
161
+ export {
162
+ NativeDialog,
163
+ NativeDialogContent,
164
+ NativeDialogHeader,
165
+ NativeDialogTitle,
166
+ NativeDialogDescription,
167
+ NativeDialogFooter,
168
+ } from "./dialog";
169
+ export type {
170
+ NativeDialogProps,
171
+ NativeDialogContentProps,
172
+ NativeDialogHeaderProps,
173
+ NativeDialogTitleProps,
174
+ NativeDialogDescriptionProps,
175
+ NativeDialogFooterProps,
176
+ } from "./dialog";
177
+
178
+ export {
179
+ NativeDropdownMenu,
180
+ NativeDropdownMenuTrigger,
181
+ NativeDropdownMenuContent,
182
+ NativeDropdownMenuItem,
183
+ } from "./dropdown-menu";
184
+ export type {
185
+ NativeDropdownMenuProps,
186
+ NativeDropdownMenuTriggerProps,
187
+ NativeDropdownMenuContentProps,
188
+ NativeDropdownMenuItemProps,
189
+ } from "./dropdown-menu";
190
+
191
+ export { NativeLabel } from "./label";
192
+ export type { NativeLabelProps } from "./label";
193
+
194
+ export { NativeRadioGroup, NativeRadioGroupItem } from "./radio-group";
195
+ export type {
196
+ NativeRadioGroupProps,
197
+ NativeRadioGroupItemProps,
198
+ } from "./radio-group";
199
+
200
+ export {
201
+ NativeSelect,
202
+ NativeSelectTrigger,
203
+ NativeSelectContent,
204
+ NativeSelectItem,
205
+ } from "./select";
206
+ export type {
207
+ NativeSelectProps,
208
+ NativeSelectTriggerProps,
209
+ NativeSelectContentProps,
210
+ NativeSelectItemProps,
211
+ } from "./select";
212
+
213
+ export { NativeSwitch } from "./switch";
214
+ export type { NativeSwitchProps } from "./switch";
215
+
216
+ export {
217
+ NativeTabs,
218
+ NativeTabsList,
219
+ NativeTabsTrigger,
220
+ NativeTabsContent,
221
+ } from "./tabs";
222
+ export type {
223
+ NativeTabsProps,
224
+ NativeTabsListProps,
225
+ NativeTabsTriggerProps,
226
+ NativeTabsContentProps,
227
+ } from "./tabs";
228
+
229
+ export { NativeTextarea } from "./textarea";
230
+ export type { NativeTextareaProps } from "./textarea";
231
+
232
+ export { NativeToggle, toggleVariants } from "./toggle";
233
+ export type { NativeToggleProps } from "./toggle";
234
+
235
+ export {
236
+ NativeTooltip,
237
+ NativeTooltipTrigger,
238
+ NativeTooltipContent,
239
+ } from "./tooltip";
240
+ export type {
241
+ NativeTooltipProps,
242
+ NativeTooltipTriggerProps,
243
+ NativeTooltipContentProps,
244
+ } from "./tooltip";
245
+
246
+ // --- Layout primitives (promoted from Sanctiv incubator, PRD-46 WC-A4) ---
247
+
248
+ export { Stack, Inline, Box, Grid, spaceScale, spacingClass } from "./layout";
249
+ export type {
250
+ StackProps,
251
+ InlineProps,
252
+ BoxProps,
253
+ BoxBackground,
254
+ GridProps,
255
+ SpaceToken,
256
+ SpacingPrefix,
257
+ FlexAlign,
258
+ FlexJustify,
259
+ } from "./layout";
@@ -0,0 +1,150 @@
1
+ /**
2
+ * InlineAlert + Banner — non-blocking system messaging.
3
+ *
4
+ * NativeInlineAlert: contextual message that lives inline with related
5
+ * content (e.g., between form fields).
6
+ *
7
+ * NativeBanner: top-of-screen system message (e.g., "You're offline").
8
+ * Persists until the user dismisses or the condition clears. Use
9
+ * sparingly — for transient confirmation use <NativeToast>; for
10
+ * blocking issues use <NativeDialog>.
11
+ *
12
+ * Both share variants: info / success / warning / destructive.
13
+ *
14
+ * @stability Beta
15
+ */
16
+ import { Pressable, Text, View } from "react-native";
17
+ import { cn } from "../utils";
18
+
19
+ export type NativeInlineAlertVariant =
20
+ | "info"
21
+ | "success"
22
+ | "warning"
23
+ | "destructive";
24
+
25
+ interface BaseProps {
26
+ variant?: NativeInlineAlertVariant;
27
+ title?: string;
28
+ description?: string;
29
+ /** Optional icon node rendered to the left of the text. */
30
+ icon?: React.ReactNode;
31
+ /** When provided, renders an "✕" dismiss button with this label. */
32
+ onDismiss?: () => void;
33
+ className?: string;
34
+ testID?: string;
35
+ }
36
+
37
+ const variantClasses: Record<NativeInlineAlertVariant, string> = {
38
+ info: "bg-secondary border-border",
39
+ success: "bg-primary/10 border-primary/30",
40
+ warning: "bg-warning/10 border-warning/30",
41
+ destructive: "bg-destructive/10 border-destructive/30",
42
+ };
43
+
44
+ const titleClasses: Record<NativeInlineAlertVariant, string> = {
45
+ info: "text-foreground",
46
+ success: "text-primary",
47
+ warning: "text-warning",
48
+ destructive: "text-destructive",
49
+ };
50
+
51
+ export interface NativeInlineAlertProps extends BaseProps {}
52
+
53
+ export function NativeInlineAlert({
54
+ variant = "info",
55
+ title,
56
+ description,
57
+ icon,
58
+ onDismiss,
59
+ className,
60
+ testID,
61
+ }: NativeInlineAlertProps) {
62
+ return (
63
+ <View
64
+ testID={testID ?? `inline-alert-${variant}`}
65
+ accessibilityRole="alert"
66
+ className={cn(
67
+ "flex-row gap-3 rounded-md border p-3",
68
+ variantClasses[variant],
69
+ className
70
+ )}
71
+ >
72
+ {icon ? <View className="pt-0.5">{icon}</View> : null}
73
+ <View className="flex-1">
74
+ {title ? (
75
+ <Text className={cn("text-sm font-semibold", titleClasses[variant])}>
76
+ {title}
77
+ </Text>
78
+ ) : null}
79
+ {description ? (
80
+ <Text className="mt-0.5 text-sm text-foreground/80">
81
+ {description}
82
+ </Text>
83
+ ) : null}
84
+ </View>
85
+ {onDismiss ? (
86
+ <Pressable
87
+ testID={testID ? `${testID}-dismiss` : undefined}
88
+ accessibilityRole="button"
89
+ accessibilityLabel="Dismiss"
90
+ onPress={onDismiss}
91
+ hitSlop={8}
92
+ className="min-h-[24px] min-w-[24px] items-center justify-center"
93
+ >
94
+ <Text className="text-base text-muted-foreground">✕</Text>
95
+ </Pressable>
96
+ ) : null}
97
+ </View>
98
+ );
99
+ }
100
+
101
+ export interface NativeBannerProps extends BaseProps {}
102
+
103
+ export function NativeBanner({
104
+ variant = "info",
105
+ title,
106
+ description,
107
+ icon,
108
+ onDismiss,
109
+ className,
110
+ testID,
111
+ }: NativeBannerProps) {
112
+ return (
113
+ <View
114
+ testID={testID ?? `banner-${variant}`}
115
+ accessibilityRole="alert"
116
+ accessibilityLiveRegion="polite"
117
+ className={cn(
118
+ "flex-row items-start gap-3 border-b px-4 py-3",
119
+ variantClasses[variant],
120
+ className
121
+ )}
122
+ >
123
+ {icon ? <View className="pt-0.5">{icon}</View> : null}
124
+ <View className="flex-1">
125
+ {title ? (
126
+ <Text className={cn("text-sm font-semibold", titleClasses[variant])}>
127
+ {title}
128
+ </Text>
129
+ ) : null}
130
+ {description ? (
131
+ <Text className="mt-0.5 text-sm text-foreground/80">
132
+ {description}
133
+ </Text>
134
+ ) : null}
135
+ </View>
136
+ {onDismiss ? (
137
+ <Pressable
138
+ testID={testID ? `${testID}-dismiss` : undefined}
139
+ accessibilityRole="button"
140
+ accessibilityLabel="Dismiss"
141
+ onPress={onDismiss}
142
+ hitSlop={8}
143
+ className="min-h-[24px] min-w-[24px] items-center justify-center"
144
+ >
145
+ <Text className="text-base text-muted-foreground">✕</Text>
146
+ </Pressable>
147
+ ) : null}
148
+ </View>
149
+ );
150
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Input — single-line text field.
3
+ *
4
+ * @stability Stable
5
+ */
6
+ import { Text, TextInput, type TextInputProps, View } from "react-native";
7
+ import { cn } from "../utils";
8
+
9
+ export interface NativeInputProps extends TextInputProps {
10
+ className?: string;
11
+ inputClassName?: string;
12
+ label?: string;
13
+ error?: string;
14
+ }
15
+
16
+ function NativeInput({
17
+ className,
18
+ inputClassName,
19
+ label,
20
+ error,
21
+ editable = true,
22
+ placeholderTextColor,
23
+ ...props
24
+ }: NativeInputProps) {
25
+ return (
26
+ <View className={cn("gap-1.5", className)}>
27
+ {label ? (
28
+ <Text className="text-sm font-medium text-foreground">
29
+ {label}
30
+ </Text>
31
+ ) : null}
32
+ <TextInput
33
+ className={cn(
34
+ "h-10 rounded-md border border-input bg-background px-3 text-base text-foreground",
35
+ !editable && "opacity-50",
36
+ error && "border-destructive",
37
+ inputClassName
38
+ )}
39
+ editable={editable}
40
+ placeholderTextColor={placeholderTextColor ?? "#A1A1AA"}
41
+ accessibilityLabel={label}
42
+ {...props}
43
+ />
44
+ {error ? (
45
+ <Text className="text-sm text-destructive">{error}</Text>
46
+ ) : null}
47
+ </View>
48
+ );
49
+ }
50
+
51
+ export { NativeInput };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Label — form-control label, paired via htmlFor / nativeID.
3
+ *
4
+ * @stability Stable
5
+ */
6
+ import { Text, type TextProps } from "react-native";
7
+ import { cn } from "../utils";
8
+
9
+ export interface NativeLabelProps extends TextProps {
10
+ children: React.ReactNode;
11
+ disabled?: boolean;
12
+ }
13
+
14
+ function NativeLabel({
15
+ className,
16
+ children,
17
+ disabled,
18
+ ...props
19
+ }: NativeLabelProps) {
20
+ return (
21
+ <Text
22
+ className={cn(
23
+ "text-sm font-medium text-foreground",
24
+ disabled && "opacity-70",
25
+ className
26
+ )}
27
+ accessibilityState={disabled ? { disabled } : undefined}
28
+ {...props}
29
+ >
30
+ {children}
31
+ </Text>
32
+ );
33
+ }
34
+
35
+ export { NativeLabel };
@@ -0,0 +1,115 @@
1
+ /**
2
+ * <Box> — the spacing/surface container primitive. Owns padding, margin, and
3
+ * a token-named background. Every spacing prop resolves through a design
4
+ * token (no raw px); `bg` maps to a brand surface token rather than a hex.
5
+ *
6
+ * Variant props (not 30-prop configuration) + a `className` escape hatch.
7
+ * Tokens only — pure NativeWind v4 className strings, no inline pixel styles.
8
+ *
9
+ * @stability Beta
10
+ */
11
+
12
+ import { View, type ViewProps } from "react-native";
13
+ import { cn } from "../../utils";
14
+ import { type SpaceToken, spacingClass } from "./spacing";
15
+
16
+ /**
17
+ * Token-named surfaces — map to the SEMANTIC Genesis surface tokens (never a
18
+ * consumer-specific brand color or raw hex), so any tenant's theme drives the
19
+ * actual color. `surface` = a raised card surface, `canvas` = the page
20
+ * background, `inverse` = the inverted (foreground) surface.
21
+ */
22
+ export type BoxBackground = "transparent" | "surface" | "canvas" | "inverse";
23
+
24
+ const backgroundClasses: Record<BoxBackground, string> = {
25
+ transparent: "bg-transparent",
26
+ surface: "bg-card",
27
+ canvas: "bg-background",
28
+ inverse: "bg-foreground",
29
+ };
30
+
31
+ export interface BoxProps extends ViewProps {
32
+ /** Padding on all sides. */
33
+ p?: SpaceToken;
34
+ /** Horizontal padding (left + right). */
35
+ px?: SpaceToken;
36
+ /** Vertical padding (top + bottom). */
37
+ py?: SpaceToken;
38
+ /** Top padding. */
39
+ pt?: SpaceToken;
40
+ /** Bottom padding. */
41
+ pb?: SpaceToken;
42
+ /** Left padding. */
43
+ pl?: SpaceToken;
44
+ /** Right padding. */
45
+ pr?: SpaceToken;
46
+ /** Margin on all sides. */
47
+ m?: SpaceToken;
48
+ /** Horizontal margin (left + right). */
49
+ mx?: SpaceToken;
50
+ /** Vertical margin (top + bottom). */
51
+ my?: SpaceToken;
52
+ /** Top margin. */
53
+ mt?: SpaceToken;
54
+ /** Bottom margin. */
55
+ mb?: SpaceToken;
56
+ /** Left margin. */
57
+ ml?: SpaceToken;
58
+ /** Right margin. */
59
+ mr?: SpaceToken;
60
+ /** Token-named background surface. */
61
+ bg?: BoxBackground;
62
+ }
63
+
64
+ /**
65
+ * Render a `View` whose padding/margin/background all resolve from tokens.
66
+ * @stability Beta
67
+ */
68
+ function Box({
69
+ p,
70
+ px,
71
+ py,
72
+ pt,
73
+ pb,
74
+ pl,
75
+ pr,
76
+ m,
77
+ mx,
78
+ my,
79
+ mt,
80
+ mb,
81
+ ml,
82
+ mr,
83
+ bg,
84
+ className,
85
+ children,
86
+ ...props
87
+ }: BoxProps) {
88
+ return (
89
+ <View
90
+ className={cn(
91
+ p != null && spacingClass("p", p),
92
+ px != null && spacingClass("px", px),
93
+ py != null && spacingClass("py", py),
94
+ pt != null && spacingClass("pt", pt),
95
+ pb != null && spacingClass("pb", pb),
96
+ pl != null && spacingClass("pl", pl),
97
+ pr != null && spacingClass("pr", pr),
98
+ m != null && spacingClass("m", m),
99
+ mx != null && spacingClass("mx", mx),
100
+ my != null && spacingClass("my", my),
101
+ mt != null && spacingClass("mt", mt),
102
+ mb != null && spacingClass("mb", mb),
103
+ ml != null && spacingClass("ml", ml),
104
+ mr != null && spacingClass("mr", mr),
105
+ bg != null && backgroundClasses[bg],
106
+ className,
107
+ )}
108
+ {...props}
109
+ >
110
+ {children}
111
+ </View>
112
+ );
113
+ }
114
+
115
+ export { Box };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Shared flexbox alignment vocabulary for the row/column layout primitives
3
+ * (Stack / Inline). Kept as a tiny token map so Stack and Inline express the
4
+ * SAME `align` / `justify` props with one source of truth — variant props,
5
+ * not 30-prop configuration.
6
+ */
7
+
8
+ export type FlexAlign = "start" | "center" | "end" | "stretch";
9
+ export type FlexJustify = "start" | "center" | "end" | "between" | "around";
10
+
11
+ export const alignClasses: Record<FlexAlign, string> = {
12
+ start: "items-start",
13
+ center: "items-center",
14
+ end: "items-end",
15
+ stretch: "items-stretch",
16
+ };
17
+
18
+ export const justifyClasses: Record<FlexJustify, string> = {
19
+ start: "justify-start",
20
+ center: "justify-center",
21
+ end: "justify-end",
22
+ between: "justify-between",
23
+ around: "justify-around",
24
+ };
@@ -0,0 +1,73 @@
1
+ /**
2
+ * <Grid> — equal-column layout primitive. React Native has no CSS grid, so
3
+ * this composes a row-major grid out of flexbox: children are chunked into
4
+ * rows of `columns`, each row is a `flex-row` whose cells are `flex-1`
5
+ * (equal width). Both the inter-row and inter-column gutters come from one
6
+ * `gap` design token. The final row is padded with empty flex cells so
7
+ * columns stay aligned (a 5th item in a 3-col grid doesn't stretch full-width).
8
+ *
9
+ * Tokens only — pure NativeWind v4 className strings, no inline pixel styles
10
+ * and no percentage-width math that would overflow once gap is applied.
11
+ *
12
+ * @stability Beta
13
+ */
14
+
15
+ import { Children, type ReactNode } from "react";
16
+ import { View, type ViewProps } from "react-native";
17
+ import { cn } from "../../utils";
18
+ import { type SpaceToken, spacingClass } from "./spacing";
19
+
20
+ export interface GridProps extends ViewProps {
21
+ /** Number of equal-width columns. Defaults to 2. Floored to >= 1. */
22
+ columns?: number;
23
+ /** Gutter between rows and columns — resolved from the spacing token. */
24
+ gap?: SpaceToken;
25
+ }
26
+
27
+ /** Split `items` into row-major chunks of at most `size` entries each. */
28
+ function chunk<T>(items: T[], size: number): T[][] {
29
+ const rows: T[][] = [];
30
+ for (let i = 0; i < items.length; i += size) {
31
+ rows.push(items.slice(i, i + size));
32
+ }
33
+ return rows;
34
+ }
35
+
36
+ /**
37
+ * Render an equal-column grid by chunking children into `flex-1` rows with a token gutter.
38
+ * @stability Beta
39
+ */
40
+ function Grid({
41
+ columns = 2,
42
+ gap = "md",
43
+ className,
44
+ children,
45
+ ...props
46
+ }: GridProps) {
47
+ // Normalize non-finite input (NaN / Infinity) to 1 before chunking — a
48
+ // bad `columns` would otherwise empty the first row or blow up padding.
49
+ const cols = Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1;
50
+ const items = Children.toArray(children);
51
+ const rows = chunk(items, cols);
52
+ const gapClass = spacingClass("gap", gap);
53
+
54
+ return (
55
+ <View className={cn("flex-col", gapClass, className)} {...props}>
56
+ {rows.map((row, rowIndex) => (
57
+ <View key={`row-${rowIndex}`} className={cn("flex-row", gapClass)}>
58
+ {row.map((child, cellIndex) => (
59
+ <View key={`cell-${cellIndex}`} className="flex-1">
60
+ {child as ReactNode}
61
+ </View>
62
+ ))}
63
+ {/* Pad the final short row so columns stay aligned. */}
64
+ {Array.from({ length: cols - row.length }).map((_, padIndex) => (
65
+ <View key={`pad-${padIndex}`} className="flex-1" />
66
+ ))}
67
+ </View>
68
+ ))}
69
+ </View>
70
+ );
71
+ }
72
+
73
+ export { Grid };