@marktiderman/genesis-ui-native 3.5.1 → 3.7.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.
- package/README.md +115 -7
- package/dist/{chunk-ONH2PCGH.js → chunk-3KFUS7O6.js} +9 -15
- package/dist/chunk-3KFUS7O6.js.map +1 -0
- package/dist/{chunk-LBVD7XXL.js → chunk-7NDKIIOT.js} +627 -20
- package/dist/chunk-7NDKIIOT.js.map +1 -0
- package/dist/chunk-CAI7LGN6.js +39 -0
- package/dist/chunk-CAI7LGN6.js.map +1 -0
- package/dist/{chunk-ABVSSJNT.js → chunk-GBNIBHSU.js} +198 -168
- package/dist/chunk-GBNIBHSU.js.map +1 -0
- package/dist/chunk-IXC3LO2K.js +410 -0
- package/dist/chunk-IXC3LO2K.js.map +1 -0
- package/dist/{chunk-GHYUNNNU.js → chunk-KH2RVAI5.js} +174 -93
- package/dist/chunk-KH2RVAI5.js.map +1 -0
- package/dist/{chunk-6KWEAGRD.js → chunk-O4BMDV7I.js} +110 -17
- package/dist/chunk-O4BMDV7I.js.map +1 -0
- package/dist/chunk-RTYO24SC.js +105 -0
- package/dist/chunk-RTYO24SC.js.map +1 -0
- package/dist/{chunk-D5RKSPMH.js → chunk-YWDDDYDI.js} +4 -3
- package/dist/chunk-YWDDDYDI.js.map +1 -0
- package/dist/components/index.d.ts +382 -10
- package/dist/components/index.js +6 -5
- package/dist/data/index.d.ts +68 -4
- package/dist/data/index.js +231 -30
- package/dist/data/index.js.map +1 -1
- package/dist/hooks/index.d.ts +90 -2
- package/dist/hooks/index.js +3 -3
- package/dist/icons/lucide.d.ts +1 -1
- package/dist/icons/lucide.js +7 -1
- package/dist/icons/lucide.js.map +1 -1
- package/dist/{inbox-page-BEarNEIP.d.ts → inbox-page-B7_Oi2fS.d.ts} +2 -44
- package/dist/index.d.ts +8 -5
- package/dist/index.js +9 -8
- package/dist/layouts/index.d.ts +40 -51
- package/dist/layouts/index.js +6 -4
- package/dist/{native-modules-PwnGltOU.d.ts → native-modules-DEJJQhDx.d.ts} +55 -1
- package/package.json +101 -4
- package/src/__tests__/doctor-rules.test.ts +87 -0
- package/src/__tests__/native-modules-lists.test.tsx +1 -0
- package/src/components/__tests__/button-haptic.test.tsx +52 -0
- package/src/components/__tests__/composer-bar.test.tsx +79 -0
- package/src/components/__tests__/gallery-card.test.tsx +59 -0
- package/src/components/__tests__/gallery-grid.test.tsx +160 -0
- package/src/components/__tests__/lightbox-resnap.test.tsx +50 -0
- package/src/components/__tests__/lightbox-zoom.test.ts +33 -0
- package/src/components/__tests__/lightbox.test.tsx +141 -0
- package/src/components/__tests__/live-indicator.test.tsx +72 -0
- package/src/components/__tests__/rating.test.tsx +82 -0
- package/src/components/__tests__/thread-list.test.tsx +219 -0
- package/src/components/button.tsx +18 -1
- package/src/components/composer-bar.tsx +276 -0
- package/src/components/drawer.tsx +15 -9
- package/src/components/gallery-card.tsx +109 -0
- package/src/components/gallery-grid.tsx +285 -0
- package/src/components/gallery-layout.ts +2 -0
- package/src/components/gallery-types.ts +2 -0
- package/src/components/index.ts +44 -0
- package/src/components/lightbox-zoom.tsx +282 -0
- package/src/components/lightbox.tsx +342 -0
- package/src/components/live-indicator.tsx +139 -0
- package/src/components/rating.tsx +128 -0
- package/src/components/skeleton.tsx +9 -4
- package/src/components/thread-list.tsx +457 -0
- package/src/components/toast.tsx +7 -4
- package/src/data/NativeConflictSheet.tsx +181 -0
- package/src/data/NativeResourceForm.tsx +15 -1
- package/src/data/index.ts +2 -0
- package/src/data/resource-view/NativeRecordView.tsx +85 -8
- package/src/data/resource-view/NativeResourceView.tsx +79 -32
- package/src/data/resource-view/__tests__/native-record-view.test.tsx +95 -1
- package/src/data/resource-view/__tests__/native-resource-gallery.test.tsx +125 -0
- package/src/hooks/__tests__/use-haptics.test.tsx +146 -0
- package/src/hooks/__tests__/use-motion.test.tsx +106 -0
- package/src/hooks/__tests__/use-thread-jump.test.tsx +88 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/use-haptics.ts +64 -0
- package/src/hooks/use-motion.ts +128 -0
- package/src/hooks/use-press-feedback.ts +87 -0
- package/src/hooks/use-thread-jump.ts +110 -0
- package/src/icon-names.ts +6 -0
- package/src/icons/lucide.ts +12 -0
- package/src/layouts/__tests__/inbox-page.test.tsx +6 -0
- package/src/layouts/__tests__/thread-page.test.tsx +114 -14
- package/src/layouts/inbox-page.tsx +6 -55
- package/src/layouts/index.ts +2 -0
- package/src/layouts/thread-page.tsx +326 -262
- package/src/native-modules.tsx +20 -2
- package/dist/chunk-6KWEAGRD.js.map +0 -1
- package/dist/chunk-7PCWEY6R.js +0 -27
- package/dist/chunk-7PCWEY6R.js.map +0 -1
- package/dist/chunk-ABVSSJNT.js.map +0 -1
- package/dist/chunk-D5RKSPMH.js.map +0 -1
- package/dist/chunk-GHYUNNNU.js.map +0 -1
- package/dist/chunk-LBVD7XXL.js.map +0 -1
- package/dist/chunk-ONH2PCGH.js.map +0 -1
- package/dist/chunk-Z3AQYVUA.js +0 -36
- package/dist/chunk-Z3AQYVUA.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useThemeRoles } from './chunk-
|
|
1
|
+
import { useHaptics, useGenesisModules, useThemeRoles, useMotion } from './chunk-RTYO24SC.js';
|
|
2
2
|
import { cn } from './chunk-OHZD7KRO.js';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
|
-
import { Text, Pressable, ActivityIndicator, View, Platform, RefreshControl, TextInput } from 'react-native';
|
|
4
|
+
import { Text, Pressable, ActivityIndicator, View, Platform, RefreshControl, TextInput, Animated, Easing } from 'react-native';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
|
-
import { createContext, useContext, useMemo, createElement } from 'react';
|
|
7
6
|
import { nativeColors } from '@marktiderman/genesis-design-system/tokens/native';
|
|
7
|
+
import { useEffect, useRef } from 'react';
|
|
8
8
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
9
9
|
|
|
10
10
|
var textVariants = cva("text-foreground", {
|
|
@@ -92,9 +92,16 @@ function NativeButton({
|
|
|
92
92
|
disabled,
|
|
93
93
|
loading,
|
|
94
94
|
accessibilityState,
|
|
95
|
+
haptic,
|
|
95
96
|
...props
|
|
96
97
|
}) {
|
|
97
98
|
const isDisabled = disabled || loading;
|
|
99
|
+
const play = useHaptics();
|
|
100
|
+
const press = haptic && haptic !== "select" && onPress ? () => {
|
|
101
|
+
play(haptic);
|
|
102
|
+
onPress();
|
|
103
|
+
} : onPress;
|
|
104
|
+
const tick = haptic === "select" && onPress ? () => play("select") : void 0;
|
|
98
105
|
return /* @__PURE__ */ jsxs(
|
|
99
106
|
Pressable,
|
|
100
107
|
{
|
|
@@ -103,7 +110,8 @@ function NativeButton({
|
|
|
103
110
|
isDisabled && "opacity-50",
|
|
104
111
|
className
|
|
105
112
|
),
|
|
106
|
-
onPress,
|
|
113
|
+
onPress: press,
|
|
114
|
+
onPressIn: tick,
|
|
107
115
|
disabled: isDisabled,
|
|
108
116
|
accessibilityRole: "button",
|
|
109
117
|
accessibilityState: { ...accessibilityState, disabled: isDisabled, busy: loading },
|
|
@@ -130,16 +138,6 @@ function NativeButton({
|
|
|
130
138
|
}
|
|
131
139
|
);
|
|
132
140
|
}
|
|
133
|
-
var EMPTY = Object.freeze({});
|
|
134
|
-
var GenesisModulesContext = createContext(EMPTY);
|
|
135
|
-
function GenesisModulesProvider({ modules, children }) {
|
|
136
|
-
const outer = useContext(GenesisModulesContext);
|
|
137
|
-
const value = useMemo(() => outer === EMPTY ? modules : { ...outer, ...modules }, [outer, modules]);
|
|
138
|
-
return createElement(GenesisModulesContext.Provider, { value }, children);
|
|
139
|
-
}
|
|
140
|
-
function useGenesisModules() {
|
|
141
|
-
return useContext(GenesisModulesContext);
|
|
142
|
-
}
|
|
143
141
|
var defaults = {
|
|
144
142
|
"first-run": { title: "Nothing here yet", tone: "text-muted-foreground" },
|
|
145
143
|
"no-results": { title: "No results", tone: "text-muted-foreground" },
|
|
@@ -229,11 +227,13 @@ function NativeEmptyState({
|
|
|
229
227
|
var SF_SYMBOLS = {
|
|
230
228
|
"arrow-left": "arrow.left",
|
|
231
229
|
"arrow-up": "arrow.up",
|
|
230
|
+
aperture: "camera.aperture",
|
|
232
231
|
bell: "bell",
|
|
233
232
|
calendar: "calendar",
|
|
234
233
|
camera: "camera",
|
|
235
234
|
"camera-flip": "arrow.triangle.2.circlepath.camera",
|
|
236
235
|
check: "checkmark",
|
|
236
|
+
clapperboard: "movieclapper",
|
|
237
237
|
"chevron-down": "chevron.down",
|
|
238
238
|
"chevron-left": "chevron.left",
|
|
239
239
|
"chevron-right": "chevron.right",
|
|
@@ -249,6 +249,7 @@ var SF_SYMBOLS = {
|
|
|
249
249
|
"external-link": "arrow.up.right.square",
|
|
250
250
|
file: "doc",
|
|
251
251
|
filter: "line.3.horizontal.decrease",
|
|
252
|
+
"folder-plus": "folder.badge.plus",
|
|
252
253
|
heart: "heart",
|
|
253
254
|
home: "house",
|
|
254
255
|
image: "photo",
|
|
@@ -256,6 +257,7 @@ var SF_SYMBOLS = {
|
|
|
256
257
|
lock: "lock",
|
|
257
258
|
"log-out": "rectangle.portrait.and.arrow.right",
|
|
258
259
|
mail: "envelope",
|
|
260
|
+
maximize: "arrow.up.left.and.arrow.down.right",
|
|
259
261
|
menu: "line.3.horizontal",
|
|
260
262
|
message: "bubble.left",
|
|
261
263
|
mic: "mic",
|
|
@@ -266,10 +268,12 @@ var SF_SYMBOLS = {
|
|
|
266
268
|
pin: "pin",
|
|
267
269
|
play: "play.fill",
|
|
268
270
|
plus: "plus",
|
|
271
|
+
radio: "dot.radiowaves.left.and.right",
|
|
269
272
|
refresh: "arrow.clockwise",
|
|
270
273
|
reply: "arrowshape.turn.up.left",
|
|
271
274
|
search: "magnifyingglass",
|
|
272
275
|
settings: "gearshape",
|
|
276
|
+
"settings-2": "slider.horizontal.3",
|
|
273
277
|
share: "square.and.arrow.up",
|
|
274
278
|
smile: "face.smiling",
|
|
275
279
|
star: "star",
|
|
@@ -499,6 +503,95 @@ function NativeInput({
|
|
|
499
503
|
error ? /* @__PURE__ */ jsx(Text, { className: "text-sm text-destructive", children: error }) : null
|
|
500
504
|
] });
|
|
501
505
|
}
|
|
506
|
+
var LOW = 0.3;
|
|
507
|
+
var HIGH = 1;
|
|
508
|
+
var STILL = 0.6;
|
|
509
|
+
function sizeStyles({ width, height, size }) {
|
|
510
|
+
const w = width ?? size;
|
|
511
|
+
const h = height ?? size;
|
|
512
|
+
const styles = [];
|
|
513
|
+
if (w !== void 0) styles.push({ width: w });
|
|
514
|
+
if (h !== void 0) styles.push({ height: h });
|
|
515
|
+
return styles;
|
|
516
|
+
}
|
|
517
|
+
function skeletonClass({ className, circle }) {
|
|
518
|
+
return cn("rounded-md bg-muted", circle && "rounded-full", className);
|
|
519
|
+
}
|
|
520
|
+
function NativeSkeleton(props) {
|
|
521
|
+
const { reanimated } = useGenesisModules();
|
|
522
|
+
return reanimated ? /* @__PURE__ */ jsx(ReanimatedSkeleton, { ...props, reanimated }) : /* @__PURE__ */ jsx(AnimatedSkeleton, { ...props });
|
|
523
|
+
}
|
|
524
|
+
function ReanimatedSkeleton({ reanimated: R, ...props }) {
|
|
525
|
+
const motion = useMotion();
|
|
526
|
+
const reduceMotion = motion.reduced;
|
|
527
|
+
const PULSE_MS = motion.duration.pulse;
|
|
528
|
+
const opacity = R.useSharedValue(LOW);
|
|
529
|
+
useEffect(() => {
|
|
530
|
+
R.cancelAnimation(opacity);
|
|
531
|
+
if (reduceMotion) {
|
|
532
|
+
opacity.value = STILL;
|
|
533
|
+
return void 0;
|
|
534
|
+
}
|
|
535
|
+
opacity.value = LOW;
|
|
536
|
+
opacity.value = R.withRepeat(R.withTiming(HIGH, { duration: PULSE_MS, easing: R.Easing.inOut(R.Easing.ease) }), -1, true);
|
|
537
|
+
return () => R.cancelAnimation(opacity);
|
|
538
|
+
}, [reduceMotion]);
|
|
539
|
+
const animatedStyle = R.useAnimatedStyle(() => {
|
|
540
|
+
"worklet";
|
|
541
|
+
return { opacity: opacity.value };
|
|
542
|
+
});
|
|
543
|
+
const AnimatedView = R.default.View;
|
|
544
|
+
return /* @__PURE__ */ jsx(
|
|
545
|
+
AnimatedView,
|
|
546
|
+
{
|
|
547
|
+
className: skeletonClass(props),
|
|
548
|
+
style: [animatedStyle, ...sizeStyles(props)],
|
|
549
|
+
testID: props.testID,
|
|
550
|
+
accessibilityElementsHidden: true,
|
|
551
|
+
importantForAccessibility: "no-hide-descendants"
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
function AnimatedSkeleton(props) {
|
|
556
|
+
const opacity = useRef(new Animated.Value(LOW)).current;
|
|
557
|
+
const motion = useMotion();
|
|
558
|
+
const reduceMotion = motion.reduced;
|
|
559
|
+
const PULSE_MS = motion.duration.pulse;
|
|
560
|
+
useEffect(() => {
|
|
561
|
+
if (reduceMotion) {
|
|
562
|
+
opacity.setValue(STILL);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
const animation = Animated.loop(
|
|
566
|
+
Animated.sequence([
|
|
567
|
+
Animated.timing(opacity, {
|
|
568
|
+
toValue: HIGH,
|
|
569
|
+
duration: PULSE_MS,
|
|
570
|
+
easing: Easing.inOut(Easing.ease),
|
|
571
|
+
useNativeDriver: true
|
|
572
|
+
}),
|
|
573
|
+
Animated.timing(opacity, {
|
|
574
|
+
toValue: LOW,
|
|
575
|
+
duration: PULSE_MS,
|
|
576
|
+
easing: Easing.inOut(Easing.ease),
|
|
577
|
+
useNativeDriver: true
|
|
578
|
+
})
|
|
579
|
+
])
|
|
580
|
+
);
|
|
581
|
+
animation.start();
|
|
582
|
+
return () => animation.stop();
|
|
583
|
+
}, [opacity, reduceMotion]);
|
|
584
|
+
return /* @__PURE__ */ jsx(
|
|
585
|
+
Animated.View,
|
|
586
|
+
{
|
|
587
|
+
className: skeletonClass(props),
|
|
588
|
+
style: [{ opacity }, ...sizeStyles(props)],
|
|
589
|
+
testID: props.testID,
|
|
590
|
+
accessibilityElementsHidden: true,
|
|
591
|
+
importantForAccessibility: "no-hide-descendants"
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
}
|
|
502
595
|
var ALL_EDGES = ["top", "bottom", "left", "right"];
|
|
503
596
|
function NativeLoadingState({
|
|
504
597
|
label,
|
|
@@ -539,6 +632,6 @@ function NativeLoadingState({
|
|
|
539
632
|
);
|
|
540
633
|
}
|
|
541
634
|
|
|
542
|
-
export {
|
|
543
|
-
//# sourceMappingURL=chunk-
|
|
544
|
-
//# sourceMappingURL=chunk-
|
|
635
|
+
export { NATIVE_ICON_NAMES, NativeBadge, NativeButton, NativeEmptyState, NativeIcon, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, NativeSkeleton, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants };
|
|
636
|
+
//# sourceMappingURL=chunk-O4BMDV7I.js.map
|
|
637
|
+
//# sourceMappingURL=chunk-O4BMDV7I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/text.tsx","../src/components/button.tsx","../src/components/empty-state.tsx","../src/icon-names.ts","../src/components/icon.tsx","../src/components/list-item.tsx","../src/components/section-list.tsx","../src/components/refresh-control.tsx","../src/components/badge.tsx","../src/components/input.tsx","../src/components/skeleton.tsx","../src/components/loading-state.tsx"],"names":["RNText","cva","jsx","jsxs","Text","View","Pressable","Platform","ActivityIndicator"],"mappings":";;;;;;;;;AASA,IAAM,YAAA,GAAe,IAAI,iBAAA,EAAmB;AAAA,EAC1C,QAAA,EAAU;AAAA,IACR,MAAA,EAAQ;AAAA,MACN,EAAA,EAAI,8BAAA;AAAA,MACJ,EAAA,EAAI,8BAAA;AAAA,MACJ,EAAA,EAAI,iCAAA;AAAA,MACJ,EAAA,EAAI,iCAAA;AAAA,MACJ,IAAA,EAAM,iCAAA;AAAA,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P,SAAA,EAAW,EAAA,CAAG,kDAAA,EAAoD,SAAS,CAAA;AAAA,MAE1E,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"chunk-O4BMDV7I.js","sourcesContent":["/**\n * Text — typography primitive with semantic presets (h1, h2, body, caption, etc.).\n *\n * @stability Stable\n */\nimport { type VariantProps, cva } from \"class-variance-authority\";\nimport { Text as RNText, type TextProps } from \"react-native\";\nimport { cn } from \"../utils\";\n\nconst textVariants = cva(\"text-foreground\", {\n variants: {\n preset: {\n h1: \"text-3xl font-bold leading-9\",\n h2: \"text-2xl font-bold leading-8\",\n h3: \"text-xl font-semibold leading-7\",\n h4: \"text-lg font-semibold leading-7\",\n body: \"text-base font-normal leading-6\",\n \"body-sm\": \"text-sm font-normal leading-5\",\n caption: \"text-xs font-normal leading-4\",\n label: \"text-sm font-medium leading-5\",\n },\n },\n defaultVariants: {\n preset: \"body\",\n },\n});\n\n// `className` is declared explicitly here — not inherited from react-native's\n// `TextProps` via NativeWind's global augmentation, which does not resolve across\n// the RN / nativewind / react-native-css-interop version matrix. Mirrors every\n// other ui-native primitive (Button, Tooltip, ChipGroup, …); the implementation\n// already consumes `className` below.\nexport interface NativeTextProps\n extends TextProps,\n VariantProps<typeof textVariants> {\n /** NativeWind utility class string applied to the underlying Text. */\n className?: string;\n}\n\n/**\n * Allowed `preset` values on {@link NativeText}. Re-exported as a named type\n * so consumer brand packages can build preset-driven typography APIs without\n * having to reach into `NativeTextProps['preset']` themselves.\n *\n * Example (consumer):\n * ```ts\n * import type { TextPreset } from \"@marktiderman/genesis-ui-native\";\n * function Heading({ as }: { as: TextPreset }) { ... }\n * ```\n */\nexport type TextPreset = NonNullable<NativeTextProps[\"preset\"]>;\n\nfunction NativeText({\n className,\n preset,\n children,\n ...props\n}: NativeTextProps) {\n return (\n <RNText\n className={cn(textVariants({ preset }), className)}\n {...props}\n >\n {children}\n </RNText>\n );\n}\n\nexport { NativeText, textVariants };\n","/**\n * Button — primary touch target. Variants: default, secondary, outline, ghost, destructive.\n *\n * @stability Stable\n */\nimport { type VariantProps, cva } from \"class-variance-authority\";\nimport { ActivityIndicator, Pressable, Text, type AccessibilityState } from \"react-native\";\nimport { useHaptics, type HapticKind } from \"../hooks/use-haptics\";\nimport { cn } from \"../utils\";\n\nconst buttonVariants = cva(\n \"flex-row items-center justify-center rounded-md\",\n {\n variants: {\n variant: {\n default: \"bg-primary\",\n secondary: \"bg-secondary\",\n outline: \"border border-input bg-transparent\",\n ghost: \"bg-transparent\",\n destructive: \"bg-destructive\",\n },\n size: {\n sm: \"h-9 px-3 gap-1.5\",\n md: \"h-10 px-4 gap-2\",\n lg: \"h-11 px-8 gap-2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n }\n);\n\nconst buttonTextVariants = cva(\"font-medium text-center\", {\n variants: {\n variant: {\n default: \"text-primary-foreground\",\n secondary: \"text-secondary-foreground\",\n outline: \"text-foreground\",\n ghost: \"text-foreground\",\n destructive: \"text-destructive-foreground\",\n },\n size: {\n sm: \"text-sm\",\n md: \"text-sm\",\n lg: \"text-base\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n});\n\nexport interface NativeButtonProps\n extends VariantProps<typeof buttonVariants> {\n className?: string;\n textClassName?: string;\n children: React.ReactNode;\n onPress?: () => void;\n disabled?: boolean;\n loading?: boolean;\n testID?: string;\n /** What a screen reader says, when the text alone isn't enough (\"Vote for Dark mode\"). Default: the text. */\n accessibilityLabel?: string;\n accessibilityHint?: string;\n /** Merged with the button's own `disabled` and `busy`: `{ selected: true }` for a vote cast, a filter on. */\n accessibilityState?: AccessibilityState;\n /**\n * A haptic through `GenesisModules.haptics` (`light` for a vote, `success` for a save): it plays\n * when the press counts, except `select`, which ticks on press-in as `usePressFeedback` does. Default none.\n */\n haptic?: HapticKind | undefined;\n}\n\nfunction NativeButton({\n className,\n textClassName,\n variant,\n size,\n children,\n onPress,\n disabled,\n loading,\n accessibilityState,\n haptic,\n ...props\n}: NativeButtonProps) {\n const isDisabled = disabled || loading;\n const play = useHaptics();\n const press =\n haptic && haptic !== \"select\" && onPress\n ? () => {\n play(haptic);\n onPress();\n }\n : onPress;\n const tick = haptic === \"select\" && onPress ? () => play(\"select\") : undefined;\n\n return (\n <Pressable\n className={cn(\n buttonVariants({ variant, size }),\n isDisabled && \"opacity-50\",\n className\n )}\n onPress={press}\n onPressIn={tick}\n disabled={isDisabled}\n accessibilityRole=\"button\"\n accessibilityState={{ ...accessibilityState, disabled: isDisabled, busy: loading }}\n {...props}\n >\n {loading ? (\n <ActivityIndicator\n size=\"small\"\n color={\n variant === \"outline\" || variant === \"ghost\"\n ? undefined\n : \"white\"\n }\n />\n ) : null}\n {typeof children === \"string\" ? (\n <Text\n className={cn(\n buttonTextVariants({ variant, size }),\n textClassName\n )}\n >\n {children}\n </Text>\n ) : (\n children\n )}\n </Pressable>\n );\n}\n\nexport { NativeButton, buttonVariants, buttonTextVariants };\n","/**\n * EmptyState — what to show when a list / screen has no data.\n *\n * Three semantic variants drive default messaging:\n * - \"first-run\": user has never had data here. Optimistic.\n * - \"no-results\": user filtered/searched and got nothing. Suggest reset.\n * - \"error\": fetching failed. Suggest retry.\n *\n * The variant only sets sensible defaults for `title` and tone — pass\n * your own `title`, `body`, `primaryAction`, `secondaryAction`, etc. to\n * override. Mirrors the @marktiderman/genesis-ui web `<EmptyState>` API where\n * possible (illustration vs icon slot, primary/secondary actions).\n *\n * @stability Beta\n */\nimport { Text, View } from \"react-native\";\nimport { cn } from \"../utils\";\n\nexport type NativeEmptyStateVariant = \"first-run\" | \"no-results\" | \"error\";\n\n/**\n * Action descriptor for primary/secondary CTAs. Either pass a structured\n * object (renders a Pressable button via the consumer's button slot) or\n * pass an arbitrary node via `action` for maximum flexibility.\n */\nexport interface NativeEmptyStateAction {\n label: string;\n onPress: () => void;\n testID?: string;\n}\n\nexport interface NativeEmptyStateProps {\n /** Variant drives default tone + default title. Default \"first-run\". */\n variant?: NativeEmptyStateVariant;\n /** Headline. Falls back to a variant-specific default. */\n title?: string;\n /** Body copy shown below the title. (Alias: `description`.) */\n body?: string;\n /**\n * @deprecated Prefer `body`. `description` remains for back-compat with\n * the original C3 API; both are accepted but `body` wins if both passed.\n */\n description?: string;\n /** Optional illustration (artwork node) above the title. */\n illustration?: React.ReactNode;\n /** Optional icon node above the title (use either icon or illustration). */\n icon?: React.ReactNode;\n /**\n * Primary CTA. When provided, the consumer is responsible for rendering\n * the button itself (we accept a node, not a label) so brand + token\n * styling is honored. The web API takes a `{label, onPress}` descriptor;\n * on native, prefer to pass a `<NativeButton>` directly to avoid\n * cross-package coupling.\n */\n primaryAction?: React.ReactNode;\n /** Secondary CTA, rendered below the primary. */\n secondaryAction?: React.ReactNode;\n /**\n * Free-form action slot. Equivalent to `primaryAction`; accepted for\n * back-compat with the C3 API. If both `action` and `primaryAction` are\n * passed, `primaryAction` wins.\n */\n action?: React.ReactNode;\n /**\n * Developer-facing error details. Only rendered when __DEV__ is true at\n * runtime (we infer by reading `process.env.NODE_ENV !== \"production\"`).\n */\n details?: string;\n className?: string;\n testID?: string;\n}\n\nconst defaults: Record<NativeEmptyStateVariant, { title: string; tone: string }> = {\n \"first-run\": { title: \"Nothing here yet\", tone: \"text-muted-foreground\" },\n \"no-results\": { title: \"No results\", tone: \"text-muted-foreground\" },\n error: { title: \"Something went wrong\", tone: \"text-destructive\" },\n};\n\nexport function NativeEmptyState({\n variant = \"first-run\",\n title,\n body,\n description,\n illustration,\n icon,\n primaryAction,\n secondaryAction,\n action,\n details,\n className,\n testID,\n}: NativeEmptyStateProps) {\n const meta = defaults[variant];\n const resolvedBody = body ?? description;\n const resolvedPrimary = primaryAction ?? action;\n // Read NODE_ENV defensively — some bundlers don't define `process` at\n // runtime (e.g., RN classic), so we guard via globalThis. The `details`\n // slot is dev-only; we explicitly enumerate non-production values so an\n // undefined NODE_ENV doesn't accidentally leak diagnostic strings.\n const proc = (globalThis as { process?: { env?: { NODE_ENV?: string } } })\n .process;\n const nodeEnv = proc?.env?.NODE_ENV;\n const isDev = nodeEnv === \"development\" || nodeEnv === \"test\";\n\n return (\n <View\n testID={testID ?? `empty-state-${variant}`}\n accessibilityRole=\"summary\"\n className={cn(\n \"items-center justify-center gap-3 px-8 py-12\",\n className\n )}\n >\n {illustration ? <View accessibilityElementsHidden>{illustration}</View> : null}\n {icon && !illustration ? (\n <View accessibilityElementsHidden>{icon}</View>\n ) : null}\n <Text\n testID={testID ? `${testID}-title` : undefined}\n className={cn(\n \"text-center text-lg font-semibold\",\n variant === \"error\" ? \"text-destructive\" : \"text-foreground\"\n )}\n >\n {title ?? meta.title}\n </Text>\n {resolvedBody ? (\n <Text\n testID={testID ? `${testID}-body` : undefined}\n className={cn(\"max-w-sm text-center text-sm\", meta.tone)}\n >\n {resolvedBody}\n </Text>\n ) : null}\n {resolvedPrimary ? (\n <View\n testID={testID ? `${testID}-primary-action` : undefined}\n className=\"mt-2\"\n >\n {resolvedPrimary}\n </View>\n ) : null}\n {secondaryAction ? (\n <View\n testID={testID ? `${testID}-secondary-action` : undefined}\n className=\"mt-1\"\n >\n {secondaryAction}\n </View>\n ) : null}\n {details && isDev ? (\n <Text\n testID={testID ? `${testID}-details` : undefined}\n className=\"mt-2 max-w-sm text-center text-xs text-muted-foreground\"\n >\n {details}\n </Text>\n ) : null}\n </View>\n );\n}\n","/**\n * The semantic icon names Genesis components ask for, and the SF Symbol each\n * one draws on iOS. Components say \"settings\" or \"bell\", never a library's\n * own name; `lucideIcons` (`/icons/lucide`) maps the same names for Android,\n * web and the SF Symbol fallback.\n *\n * @stability Beta\n */\nexport const SF_SYMBOLS = {\n \"arrow-left\": \"arrow.left\",\n \"arrow-up\": \"arrow.up\",\n aperture: \"camera.aperture\",\n bell: \"bell\",\n calendar: \"calendar\",\n camera: \"camera\",\n \"camera-flip\": \"arrow.triangle.2.circlepath.camera\",\n check: \"checkmark\",\n clapperboard: \"movieclapper\",\n \"chevron-down\": \"chevron.down\",\n \"chevron-left\": \"chevron.left\",\n \"chevron-right\": \"chevron.right\",\n \"chevron-up\": \"chevron.up\",\n clock: \"clock\",\n close: \"xmark\",\n compose: \"square.and.pencil\",\n copy: \"doc.on.doc\",\n download: \"square.and.arrow.down\",\n edit: \"pencil\",\n error: \"xmark.circle\",\n expand: \"arrow.up.left.and.arrow.down.right\",\n \"external-link\": \"arrow.up.right.square\",\n file: \"doc\",\n filter: \"line.3.horizontal.decrease\",\n \"folder-plus\": \"folder.badge.plus\",\n heart: \"heart\",\n home: \"house\",\n image: \"photo\",\n info: \"info.circle\",\n lock: \"lock\",\n \"log-out\": \"rectangle.portrait.and.arrow.right\",\n mail: \"envelope\",\n maximize: \"arrow.up.left.and.arrow.down.right\",\n menu: \"line.3.horizontal\",\n message: \"bubble.left\",\n mic: \"mic\",\n minus: \"minus\",\n more: \"ellipsis\",\n paperclip: \"paperclip\",\n pause: \"pause.fill\",\n pin: \"pin\",\n play: \"play.fill\",\n plus: \"plus\",\n radio: \"dot.radiowaves.left.and.right\",\n refresh: \"arrow.clockwise\",\n reply: \"arrowshape.turn.up.left\",\n search: \"magnifyingglass\",\n settings: \"gearshape\",\n \"settings-2\": \"slider.horizontal.3\",\n share: \"square.and.arrow.up\",\n smile: \"face.smiling\",\n star: \"star\",\n stop: \"stop.fill\",\n success: \"checkmark.circle\",\n trash: \"trash\",\n user: \"person\",\n video: \"video\",\n volume: \"speaker.wave.2.fill\",\n \"volume-off\": \"speaker.slash.fill\",\n warning: \"exclamationmark.triangle\",\n} as const;\n\n/** A semantic icon name: what the icon is for. */\nexport type NativeIconName = keyof typeof SF_SYMBOLS;\n\n/** Every semantic icon name. */\nexport const NATIVE_ICON_NAMES = Object.keys(SF_SYMBOLS) as NativeIconName[];\n","/**\n * NativeIcon — an icon by what it is for (\"settings\", \"bell\"), not by a\n * library's name. On iOS it draws the SF Symbol (expo-symbols' `SymbolView`,\n * passed as `modules.symbol`); on Android and web, and as the SF Symbol's\n * fallback, it draws the icon set given as `modules.icons` (`lucideIcons`\n * from `@marktiderman/genesis-ui-native/icons/lucide`). With neither, it\n * keeps the icon's space empty and warns once in development.\n *\n * Decorative by default (hidden from screen readers). Give `label` when the\n * icon carries meaning on its own, such as an icon-only button's content.\n *\n * @stability Beta\n */\nimport { Platform, View, type ColorValue } from \"react-native\";\nimport { useThemeRoles } from \"../hooks/use-theme-roles\";\nimport { SF_SYMBOLS, type NativeIconName } from \"../icon-names\";\nimport { useGenesisModules } from \"../native-modules\";\n\nexport interface NativeIconProps {\n name: NativeIconName;\n /** Points. Default 20. */\n size?: number;\n /** Default the theme's label color. */\n color?: ColorValue;\n /** iOS SF Symbol weight. */\n weight?: \"ultraLight\" | \"thin\" | \"light\" | \"regular\" | \"medium\" | \"semibold\" | \"bold\" | \"heavy\" | \"black\";\n /** Read by screen readers. Without it the icon is decorative and hidden from them. */\n label?: string;\n testID?: string;\n}\n\ndeclare const __DEV__: boolean | undefined;\nconst warned = new Set<string>();\n\nfunction warnOnce(name: string) {\n if (typeof __DEV__ === \"undefined\" || !__DEV__ || warned.has(name)) return;\n warned.add(name);\n console.warn(\n `[genesis] NativeIcon \"${name}\" has nothing to draw with: pass modules.icons (lucideIcons from \"@marktiderman/genesis-ui-native/icons/lucide\") and, for SF Symbols on iOS, modules.symbol (SymbolView from \"expo-symbols\") to GenesisModulesProvider.`,\n );\n}\n\nexport function NativeIcon({ name, size = 20, color, weight, label, testID }: NativeIconProps) {\n const { symbol: SymbolView, icons } = useGenesisModules();\n const roles = useThemeRoles();\n const tint = color ?? roles.label;\n const a11y = label\n ? { accessible: true, accessibilityRole: \"image\" as const, accessibilityLabel: label }\n : { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: \"no-hide-descendants\" as const };\n const Fallback = icons?.[name];\n const fallback = Fallback ? <Fallback size={size} color={tint} testID={testID ? `${testID}-fallback` : undefined} /> : null;\n\n if (Platform.OS === \"ios\" && SymbolView) {\n return (\n <View {...a11y} testID={testID} style={{ width: size, height: size }}>\n <SymbolView name={SF_SYMBOLS[name]} size={size} tintColor={tint} weight={weight} fallback={fallback} style={{ width: size, height: size }} />\n </View>\n );\n }\n if (!fallback) warnOnce(name);\n return (\n <View {...a11y} testID={testID} style={{ width: size, height: size, alignItems: \"center\", justifyContent: \"center\" }}>\n {fallback}\n </View>\n );\n}\n","/**\n * ListItem — recurring row in a list (settings, contacts, results).\n *\n * Slots: leading (avatar / icon), title, subtitle, trailing\n * (chevron / accessory / action). Supports pressable variants with\n * automatic divider rendering between adjacent items via a wrapper\n * pattern (see <NativeListItemDivider>).\n *\n * For platform-default chevrons, pass `showChevron`; the chevron uses\n * the muted-foreground token.\n *\n * @stability Beta\n */\nimport { Platform, Pressable, Text, View } from \"react-native\";\nimport { cn } from \"../utils\";\nimport { useThemeRoles } from \"../hooks/use-theme-roles\";\nimport { useGenesisModules } from \"../native-modules\";\nimport { NativeIcon } from \"./icon\";\n\nexport interface NativeListItemProps {\n title: string;\n subtitle?: string;\n /** Slot rendered to the left of the title (avatar / icon). */\n leading?: React.ReactNode;\n /** Slot rendered to the right of the title (badge / accessory). */\n trailing?: React.ReactNode;\n /** When true, renders a chevron-right at the end. */\n showChevron?: boolean;\n /** When provided, the row becomes pressable. */\n onPress?: () => void;\n disabled?: boolean;\n className?: string;\n testID?: string;\n}\n\nexport function NativeListItem({\n title,\n subtitle,\n leading,\n trailing,\n showChevron,\n onPress,\n disabled,\n className,\n testID,\n}: NativeListItemProps) {\n const inner = (\n <>\n {leading ? <View className=\"mr-3\">{leading}</View> : null}\n <View className=\"flex-1\">\n <Text className=\"text-base text-foreground\" numberOfLines={1}>\n {title}\n </Text>\n {subtitle ? (\n <Text\n className=\"mt-0.5 text-xs text-muted-foreground\"\n numberOfLines={2}\n >\n {subtitle}\n </Text>\n ) : null}\n </View>\n {trailing ? <View className=\"ml-3\">{trailing}</View> : null}\n {showChevron ? <Chevron /> : null}\n </>\n );\n\n if (onPress) {\n return (\n <Pressable\n testID={testID ?? \"native-list-item\"}\n accessibilityRole=\"button\"\n accessibilityLabel={subtitle ? `${title}, ${subtitle}` : title}\n accessibilityState={{ disabled }}\n disabled={disabled}\n onPress={onPress}\n className={cn(\n \"min-h-[44px] flex-row items-center bg-background px-4 py-3\",\n disabled && \"opacity-50\",\n className\n )}\n >\n {inner}\n </Pressable>\n );\n }\n\n return (\n <View\n testID={testID ?? \"native-list-item\"}\n accessibilityLabel={subtitle ? `${title}, ${subtitle}` : title}\n className={cn(\n \"min-h-[44px] flex-row items-center bg-background px-4 py-3\",\n className\n )}\n >\n {inner}\n </View>\n );\n}\n\n/**\n * The drill-in chevron: an SF Symbol on iOS or the app's icon set\n * (`modules.symbol` / `modules.icons`) when given, else a text \"›\".\n */\nfunction Chevron() {\n const { symbol, icons } = useGenesisModules();\n const roles = useThemeRoles();\n if ((Platform.OS === \"ios\" && symbol) || icons?.[\"chevron-right\"]) {\n return (\n <View className=\"ml-2\">\n <NativeIcon name=\"chevron-right\" size={14} weight=\"semibold\" color={roles.tertiaryLabel} testID=\"native-list-item-chevron\" />\n </View>\n );\n }\n return (\n <Text\n accessibilityElementsHidden\n className=\"ml-2 text-base text-muted-foreground\"\n >\n ›\n </Text>\n );\n}\n\nexport function NativeListItemDivider({ className }: { className?: string }) {\n return <View className={cn(\"h-px bg-border\", className)} />;\n}\n","/**\n * SectionList header pattern — opinionated header style for\n * react-native SectionList rows.\n *\n * The full SectionList API stays with React Native; Genesis ships the\n * header component so consumers can pass it as `renderSectionHeader`\n * and get a consistent visual: muted background, uppercase tracking,\n * sticky-friendly padding.\n *\n * Pattern:\n *\n * <SectionList\n * sections={...}\n * renderItem={({ item }) => <NativeListItem title={item.label} />}\n * renderSectionHeader={({ section }) => (\n * <NativeSectionListHeader title={section.title} />\n * )}\n * />\n *\n * @stability Beta\n */\nimport { Text, View } from \"react-native\";\nimport { cn } from \"../utils\";\n\nexport interface NativeSectionListHeaderProps {\n title: string;\n /** Optional trailing content (e.g., a count badge). */\n trailing?: React.ReactNode;\n className?: string;\n testID?: string;\n}\n\nexport function NativeSectionListHeader({\n title,\n trailing,\n className,\n testID,\n}: NativeSectionListHeaderProps) {\n return (\n <View\n testID={testID ?? \"native-section-header\"}\n accessibilityRole=\"header\"\n className={cn(\n \"flex-row items-center justify-between border-b border-border bg-muted px-4 py-2\",\n className\n )}\n >\n <Text className=\"text-xs font-semibold uppercase tracking-wider text-muted-foreground\">\n {title}\n </Text>\n {trailing}\n </View>\n );\n}\n","/**\n * RefreshControl wrapper — token-aware tint over RN's RefreshControl.\n *\n * Use as the `refreshControl` prop on ScrollView / FlatList / SectionList.\n * The tint defaults to the theme's `tint` role; consumers can override\n * per-call. We re-export RN's\n * RefreshControl shape so the API mirrors what consumers already know.\n *\n * @stability Beta\n */\nimport { RefreshControl } from \"react-native\";\nimport { useThemeRoles } from \"../hooks/use-theme-roles\";\n\nexport interface NativeRefreshControlProps {\n refreshing: boolean;\n onRefresh: () => void;\n /** Hex / RGB color override. Falls back to the theme primary. */\n tintColor?: string;\n /** Title shown under the iOS spinner. */\n title?: string;\n /** Color of the iOS title text. */\n titleColor?: string;\n /** Android colors prop (an array of progress colors). */\n colors?: string[];\n /** Android progress background. */\n progressBackgroundColor?: string;\n testID?: string;\n}\n\n/**\n * Pull to refresh, tinted with the theme's `tint` role. Works under any Genesis root.\n */\n// The tint comes from `useThemeRoles`, not `useGenesisTheme` from `providers/native`: that is\n// another context, which the native app shell's `GenesisThemeProvider` never mounts, so it threw there.\nexport function NativeRefreshControl({ tintColor, colors, testID, ...rest }: NativeRefreshControlProps) {\n const tint = useThemeRoles().tint;\n const androidTint = typeof tint === \"string\" ? [tint] : undefined;\n return <RefreshControl {...rest} tintColor={tintColor ?? (tint as string)} colors={colors ?? androidTint} testID={testID ?? \"native-refresh-control\"} />;\n}\n","/**\n * Badge — compact status / count / category tag.\n *\n * @stability Stable\n */\nimport { type VariantProps, cva } from \"class-variance-authority\";\nimport { Text, View } from \"react-native\";\nimport { cn } from \"../utils\";\n\nconst badgeVariants = cva(\n \"flex-row items-center self-start rounded-full border px-2.5 py-0.5\",\n {\n variants: {\n variant: {\n default: \"border-transparent bg-primary\",\n secondary: \"border-transparent bg-secondary\",\n destructive: \"border-transparent bg-destructive\",\n outline: \"border-border bg-transparent\",\n success: \"border-transparent bg-success/15\",\n warning: \"border-transparent bg-warning/15\",\n info: \"border-transparent bg-info/15\",\n muted: \"border-transparent bg-muted\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n);\n\nconst badgeTextVariants = cva(\"text-xs font-medium\", {\n variants: {\n variant: {\n default: \"text-primary-foreground\",\n secondary: \"text-secondary-foreground\",\n destructive: \"text-destructive-foreground\",\n outline: \"text-foreground\",\n // AA-safe status text on the /15 tint. The bare status token\n // (text-success ~2.2:1) fails WCAG AA. The `-dark` stop is optional in\n // the brand schema (only `status.*.DEFAULT` is required) AND regresses\n // dark mode — a dark shade on the dark-surface tint drops to ~1.7–2.6:1.\n // Instead use the semantic Tailwind ramp (always present, brand-\n // independent, same hues as the Genesis status tokens) with a `dark:`\n // stop. Measured: light /15 tint emerald-700 4.76 / amber-800 6.32 /\n // blue-700 5.64; dark-surface tint emerald-300 ≥8.2 / amber-200 ≥10.8 /\n // blue-300 ≥8.2 — AA in both modes across the static preset and the\n // themeFromBrand() runtime dark map.\n success: \"text-emerald-700 dark:text-emerald-300\",\n warning: \"text-amber-800 dark:text-amber-200\",\n info: \"text-blue-700 dark:text-blue-300\",\n muted: \"text-muted-foreground\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n});\n\nexport interface NativeBadgeProps\n extends VariantProps<typeof badgeVariants> {\n className?: string;\n textClassName?: string;\n children: React.ReactNode;\n accessibilityLabel?: string;\n testID?: string;\n}\n\nfunction NativeBadge({\n className,\n textClassName,\n variant,\n children,\n ...props\n}: NativeBadgeProps) {\n return (\n <View className={cn(badgeVariants({ variant }), className)} accessibilityRole=\"text\" {...props}>\n {typeof children === \"string\" ? (\n <Text\n className={cn(badgeTextVariants({ variant }), textClassName)}\n >\n {children}\n </Text>\n ) : (\n children\n )}\n </View>\n );\n}\n\nexport { NativeBadge, badgeVariants, badgeTextVariants };\n","/**\n * Input — single-line text field.\n *\n * @stability Stable\n */\nimport { Text, TextInput, type TextInputProps, View } from \"react-native\";\nimport { nativeColors } from \"@marktiderman/genesis-design-system/tokens/native\";\nimport { cn } from \"../utils\";\n\nexport interface NativeInputProps extends TextInputProps {\n className?: string;\n inputClassName?: string;\n label?: string;\n error?: string;\n}\n\nfunction NativeInput({\n className,\n inputClassName,\n label,\n error,\n editable = true,\n placeholderTextColor,\n ...props\n}: NativeInputProps) {\n return (\n <View className={cn(\"gap-1.5\", className)}>\n {label ? (\n <Text className=\"text-sm font-medium text-foreground\">\n {label}\n </Text>\n ) : null}\n <TextInput\n className={cn(\n \"h-10 rounded-md border border-input bg-background px-3 text-base text-foreground\",\n !editable && \"opacity-50\",\n error && \"border-destructive\",\n inputClassName\n )}\n editable={editable}\n placeholderTextColor={placeholderTextColor ?? nativeColors.neutral[400]}\n accessibilityLabel={label}\n {...props}\n />\n {error ? (\n <Text className=\"text-sm text-destructive\">{error}</Text>\n ) : null}\n </View>\n );\n}\n\nexport { NativeInput };\n","/**\n * Skeleton — loading placeholder block.\n *\n * Pulses with Reanimated 4 when the app passes it (`modules.reanimated` on\n * `GenesisModulesProvider`), else with React Native's Animated. While Reduce\n * Motion is on it holds still at a legible opacity.\n *\n * @stability Stable\n */\nimport { useEffect, useRef } from \"react\";\nimport { Animated, Easing } from \"react-native\";\nimport { cn } from \"../utils\";\nimport { useMotion } from \"../hooks/use-motion\";\nimport { useGenesisModules, type GenesisReanimatedModule } from \"../native-modules\";\n\nexport interface NativeSkeletonProps {\n className?: string;\n /**\n * Width of the skeleton. Use className for NativeWind sizing instead\n * when possible (e.g. className=\"w-24 h-4\").\n */\n width?: number;\n height?: number;\n /** Shorthand that sets both width and height (useful for circle skeletons). */\n size?: number;\n circle?: boolean;\n testID?: string;\n}\n\nconst LOW = 0.3;\nconst HIGH = 1;\n// Held still under Reduce Motion (visual-regression flow\n// `screenshot-reduced-motion.yaml`; Apple HIG / WCAG 2.3.3).\nconst STILL = 0.6;\n\nfunction sizeStyles({ width, height, size }: NativeSkeletonProps): Array<{ width?: number; height?: number }> {\n const w = width ?? size;\n const h = height ?? size;\n const styles: Array<{ width?: number; height?: number }> = [];\n if (w !== undefined) styles.push({ width: w });\n if (h !== undefined) styles.push({ height: h });\n return styles;\n}\n\nfunction skeletonClass({ className, circle }: NativeSkeletonProps) {\n return cn(\"rounded-md bg-muted\", circle && \"rounded-full\", className);\n}\n\nfunction NativeSkeleton(props: NativeSkeletonProps) {\n const { reanimated } = useGenesisModules();\n return reanimated ? <ReanimatedSkeleton {...props} reanimated={reanimated} /> : <AnimatedSkeleton {...props} />;\n}\n\nfunction ReanimatedSkeleton({ reanimated: R, ...props }: NativeSkeletonProps & { reanimated: GenesisReanimatedModule }) {\n // One pulse cycle from the shared motion tokens; under Reduce Motion it holds still (a zero-length repeat would flash).\n const motion = useMotion();\n const reduceMotion = motion.reduced;\n const PULSE_MS = motion.duration.pulse;\n const opacity = R.useSharedValue(LOW);\n useEffect(() => {\n R.cancelAnimation(opacity);\n if (reduceMotion) {\n opacity.value = STILL;\n return undefined;\n }\n opacity.value = LOW;\n opacity.value = R.withRepeat(R.withTiming(HIGH, { duration: PULSE_MS, easing: R.Easing.inOut(R.Easing.ease) }), -1, true);\n return () => R.cancelAnimation(opacity);\n // `R` and `opacity` are stable for the component's life.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [reduceMotion]);\n const animatedStyle = R.useAnimatedStyle(() => {\n \"worklet\";\n return { opacity: opacity.value };\n });\n const AnimatedView = R.default.View;\n return (\n <AnimatedView\n className={skeletonClass(props)}\n style={[animatedStyle, ...sizeStyles(props)]}\n testID={props.testID}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n />\n );\n}\n\nfunction AnimatedSkeleton(props: NativeSkeletonProps) {\n const opacity = useRef(new Animated.Value(LOW)).current;\n // One pulse cycle from the shared motion tokens; under Reduce Motion it holds still (a zero-length repeat would flash).\n const motion = useMotion();\n const reduceMotion = motion.reduced;\n const PULSE_MS = motion.duration.pulse;\n\n useEffect(() => {\n if (reduceMotion) {\n opacity.setValue(STILL);\n return;\n }\n const animation = Animated.loop(\n Animated.sequence([\n Animated.timing(opacity, {\n toValue: HIGH,\n duration: PULSE_MS,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n Animated.timing(opacity, {\n toValue: LOW,\n duration: PULSE_MS,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n ])\n );\n animation.start();\n return () => animation.stop();\n }, [opacity, reduceMotion]);\n\n return (\n <Animated.View\n className={skeletonClass(props)}\n style={[{ opacity }, ...sizeStyles(props)] as any[]}\n testID={props.testID}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n />\n );\n}\n\nexport { NativeSkeleton };\n","/**\n * LoadingState — a centred spinner for a screen (or part of one) that is\n * waiting: a redirect while the session loads, the first fetch of a page.\n *\n * Use it instead of a hand-rolled `<View><ActivityIndicator /></View>`: the\n * spinner takes the theme tint, screen readers hear one \"Loading\" progress\n * bar (or your `label`), and the full-screen form sits inside the safe area\n * on the screen background. For content-shaped placeholders (a list about to\n * appear) use `NativeSkeleton`; for known progress use `NativeProgress`.\n *\n * if (!session) return <NativeLoadingState />; // whole screen\n * <NativeLoadingState fullScreen={false} label=\"Loading more\" size=\"small\" />\n *\n * `ScreenContainer loading` renders the inline form in place of its body.\n *\n * @stability Beta\n */\nimport { ActivityIndicator, View, type ColorValue } from \"react-native\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport { cn } from \"../utils\";\nimport { useThemeRoles } from \"../hooks/use-theme-roles\";\nimport { NativeText } from \"./text\";\n\nexport type NativeLoadingStateEdge = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nexport interface NativeLoadingStateProps {\n /** Text shown under the spinner. It is also what screen readers announce. */\n label?: string;\n /** What screen readers announce when no `label` is shown. Default `\"Loading\"`. */\n accessibilityLabel?: string;\n /** Spinner size. Default `\"large\"`. */\n size?: \"small\" | \"large\";\n /**\n * `true` (default): fill the screen on the theme background, inside the\n * safe area. `false`: a padded, centred block that fills its parent, for a\n * screen body, a section or a list footer.\n */\n fullScreen?: boolean;\n /** Safe-area edges when `fullScreen`. Default all four. */\n safeAreaEdges?: NativeLoadingStateEdge[];\n /** Spinner color. Defaults to the theme tint. */\n color?: ColorValue;\n className?: string;\n /** testID on the root; the spinner is `${testID}-spinner`, the label `${testID}-label`. Default `\"loading-state\"`. */\n testID?: string;\n}\n\nconst ALL_EDGES: NativeLoadingStateEdge[] = [\"top\", \"bottom\", \"left\", \"right\"];\n\nexport function NativeLoadingState({\n label,\n accessibilityLabel,\n size = \"large\",\n fullScreen = true,\n safeAreaEdges = ALL_EDGES,\n color,\n className,\n testID = \"loading-state\",\n}: NativeLoadingStateProps) {\n const roles = useThemeRoles();\n const spoken = label ?? accessibilityLabel ?? \"Loading\";\n\n const content = (\n <View\n testID={fullScreen ? `${testID}-content` : testID}\n className={cn(\"items-center justify-center gap-3 px-4 py-8\", !fullScreen && \"flex-grow\", !fullScreen && className)}\n accessible\n accessibilityRole=\"progressbar\"\n accessibilityLabel={spoken}\n accessibilityState={{ busy: true }}\n >\n <ActivityIndicator testID={`${testID}-spinner`} size={size} color={(color ?? roles.tint) as string} />\n {label ? (\n <NativeText testID={`${testID}-label`} preset=\"body-sm\" className=\"text-muted-foreground text-center\">\n {label}\n </NativeText>\n ) : null}\n </View>\n );\n\n if (!fullScreen) return content;\n\n return (\n <SafeAreaView\n testID={testID}\n edges={safeAreaEdges}\n className={cn(\"flex-1 items-center justify-center bg-background\", className)}\n >\n {content}\n </SafeAreaView>\n );\n}\n"]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { createContext, useContext, useMemo, createElement, useCallback, useState, useEffect } from 'react';
|
|
2
|
+
import { AccessibilityInfo, Appearance, Platform, PlatformColor } from 'react-native';
|
|
3
|
+
import { resolveMotion } from '@marktiderman/genesis-design-system/tokens/motion';
|
|
4
|
+
import { resolveThemeRoles } from '@marktiderman/genesis-design-system';
|
|
5
|
+
|
|
6
|
+
// src/native-modules.tsx
|
|
7
|
+
var EMPTY = Object.freeze({});
|
|
8
|
+
var GenesisModulesContext = createContext(EMPTY);
|
|
9
|
+
function GenesisModulesProvider({ modules, children }) {
|
|
10
|
+
const outer = useContext(GenesisModulesContext);
|
|
11
|
+
const value = useMemo(() => outer === EMPTY ? modules : { ...outer, ...modules }, [outer, modules]);
|
|
12
|
+
return createElement(GenesisModulesContext.Provider, { value }, children);
|
|
13
|
+
}
|
|
14
|
+
function useGenesisModules() {
|
|
15
|
+
return useContext(GenesisModulesContext);
|
|
16
|
+
}
|
|
17
|
+
function playHaptic(haptics, kind) {
|
|
18
|
+
if (!haptics) return;
|
|
19
|
+
try {
|
|
20
|
+
const as = (s) => s;
|
|
21
|
+
const styles = haptics.ImpactFeedbackStyle;
|
|
22
|
+
const notes = haptics.NotificationFeedbackType;
|
|
23
|
+
const p = kind === "light" ? haptics.impactAsync(as(styles.Light)) : kind === "medium" ? haptics.impactAsync(as(styles.Medium)) : kind === "heavy" ? haptics.impactAsync(as(styles.Heavy ?? styles.Medium)) : kind === "select" ? haptics.selectionAsync() : haptics.notificationAsync(as(kind === "success" ? notes.Success : kind === "warning" ? notes.Warning : notes.Error));
|
|
24
|
+
void p?.catch?.(() => void 0);
|
|
25
|
+
} catch {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function useHaptics() {
|
|
29
|
+
const { haptics } = useGenesisModules();
|
|
30
|
+
return useCallback((kind) => playHaptic(haptics, kind), [haptics]);
|
|
31
|
+
}
|
|
32
|
+
var lastKnown = false;
|
|
33
|
+
function useReducedMotion() {
|
|
34
|
+
const [reduced, setReduced] = useState(lastKnown);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
let mounted = true;
|
|
37
|
+
const set = (v) => {
|
|
38
|
+
lastKnown = v;
|
|
39
|
+
if (mounted) setReduced(v);
|
|
40
|
+
};
|
|
41
|
+
AccessibilityInfo.isReduceMotionEnabled().then(set).catch(() => {
|
|
42
|
+
});
|
|
43
|
+
const sub = AccessibilityInfo.addEventListener("reduceMotionChanged", set);
|
|
44
|
+
return () => {
|
|
45
|
+
mounted = false;
|
|
46
|
+
sub?.remove?.();
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
49
|
+
return reduced;
|
|
50
|
+
}
|
|
51
|
+
function useMotion(options = {}) {
|
|
52
|
+
const reducedMotion = useReducedMotion();
|
|
53
|
+
const level = options.level ?? "calm";
|
|
54
|
+
return useMemo(() => resolveMotion(level, { reducedMotion }), [level, reducedMotion]);
|
|
55
|
+
}
|
|
56
|
+
function motionSpring(motion, name, velocity) {
|
|
57
|
+
"worklet";
|
|
58
|
+
const s = motion.spring[name];
|
|
59
|
+
return typeof velocity === "number" && !motion.reduced ? { damping: s.damping, stiffness: s.stiffness, mass: s.mass, velocity } : { damping: s.damping, stiffness: s.stiffness, mass: s.mass };
|
|
60
|
+
}
|
|
61
|
+
function motionTiming(motion, duration, Easing, easing = "out") {
|
|
62
|
+
"worklet";
|
|
63
|
+
const [x1, y1, x2, y2] = motion.easing[easing];
|
|
64
|
+
const curve = Easing?.bezier ? Easing.bezier(x1, y1, x2, y2) : void 0;
|
|
65
|
+
return curve === void 0 ? { duration: motion.duration[duration] } : { duration: motion.duration[duration], easing: curve };
|
|
66
|
+
}
|
|
67
|
+
function animateMotion(R, motion, toValue, how) {
|
|
68
|
+
if (motion.reduced) return toValue;
|
|
69
|
+
if (how.spring !== void 0) {
|
|
70
|
+
if (R.withSpring) return R.withSpring(toValue, motionSpring(motion, how.spring, how.velocity));
|
|
71
|
+
return R.withTiming(toValue, motionTiming(motion, "base", R.Easing));
|
|
72
|
+
}
|
|
73
|
+
return R.withTiming(toValue, motionTiming(motion, how.duration, R.Easing, how.easing));
|
|
74
|
+
}
|
|
75
|
+
function useThemeMode() {
|
|
76
|
+
const [scheme, setScheme] = useState(
|
|
77
|
+
Appearance.getColorScheme()
|
|
78
|
+
);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const sub = Appearance.addChangeListener(({ colorScheme }) => {
|
|
81
|
+
setScheme(colorScheme);
|
|
82
|
+
});
|
|
83
|
+
return () => sub.remove();
|
|
84
|
+
}, []);
|
|
85
|
+
return scheme === "dark" ? "dark" : "light";
|
|
86
|
+
}
|
|
87
|
+
function useThemeRoles(options = {}) {
|
|
88
|
+
const scheme = useThemeMode();
|
|
89
|
+
const { tint, materialYou = false } = options;
|
|
90
|
+
const androidDynamic = materialYou && Platform.OS === "android" && Number(Platform.Version) >= 31;
|
|
91
|
+
return useMemo(
|
|
92
|
+
() => resolveThemeRoles({
|
|
93
|
+
target: Platform.OS === "ios" ? "ios" : "android",
|
|
94
|
+
scheme,
|
|
95
|
+
platformColor: (name) => PlatformColor(name),
|
|
96
|
+
tint,
|
|
97
|
+
androidDynamic
|
|
98
|
+
}),
|
|
99
|
+
[scheme, tint, androidDynamic]
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { GenesisModulesProvider, animateMotion, motionSpring, motionTiming, playHaptic, useGenesisModules, useHaptics, useMotion, useReducedMotion, useThemeMode, useThemeRoles };
|
|
104
|
+
//# sourceMappingURL=chunk-RTYO24SC.js.map
|
|
105
|
+
//# sourceMappingURL=chunk-RTYO24SC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/native-modules.tsx","../src/hooks/use-haptics.ts","../src/hooks/use-reduced-motion.ts","../src/hooks/use-motion.ts","../src/hooks/use-theme-mode.ts","../src/hooks/use-theme-roles.ts"],"names":["useMemo","useState","useEffect"],"mappings":";;;;;;AAwMA,IAAM,KAAA,GAAwB,MAAA,CAAO,MAAA,CAAO,EAAE,CAAA;AAC9C,IAAM,qBAAA,GAAwB,cAA8B,KAAK,CAAA;AAc1D,SAAS,sBAAA,CAAuB,EAAE,OAAA,EAAS,QAAA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MACA,aAAA,EAAe,CAAC,IAAA,KAAS,aAAA,CAAc,IAAI,CAAA;AAAA,MAC3C,IAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,IACH,CAAC,MAAA,EAAQ,IAAA,EAAM,cAAc;AAAA,GAC/B;AACF","file":"chunk-RTYO24SC.js","sourcesContent":["/**\n * GenesisModulesProvider — the native modules an app opts in to, passed in\n * once near the root. Genesis never `require()`s these itself: an app that\n * has a module installed imports it and hands it over, and every component\n * that could use it falls back to plain React Native when it isn't here.\n *\n * import { FlashList } from \"@shopify/flash-list\";\n * import { Image } from \"expo-image\";\n * import * as Reanimated from \"react-native-reanimated\";\n * import * as GlassEffect from \"expo-glass-effect\";\n * import { SymbolView } from \"expo-symbols\";\n * import DateTimePicker from \"@expo/ui/community/datetime-picker\";\n * import { lucideIcons } from \"@marktiderman/genesis-ui-native/icons/lucide\";\n * import { DarkTheme, DefaultTheme, ThemeProvider } from \"expo-router\";\n *\n * // At module scope, not inline:\n * const modules = { list: FlashList, image: Image, reanimated: Reanimated, glass: GlassEffect,\n * symbol: SymbolView, icons: lucideIcons, datePicker: DateTimePicker,\n * navigation: { ThemeProvider, DefaultTheme, DarkTheme } };\n * <GenesisModulesProvider modules={modules}>…</GenesisModulesProvider>\n *\n * (`GenesisNativeApp` from `@marktiderman/genesis-native` takes the same\n * object as its `modules` prop and mounts this for you.)\n *\n * | Module | Used by | Without it |\n * | ------------------------------ | ---------------------------------------- | ----------------------------- |\n * | `list` (FlashList v2) | NativeResourcePage, NotificationsPage | FlatList / SectionList |\n * | `image` (expo-image) | NativeAvatar, NativeImage | React Native `Image` |\n * | `reanimated` (Reanimated 4) | Toast, Drawer, Skeleton | React Native `Animated` |\n * | `glass` (expo-glass-effect) | Toast, NativeGlassSurface, update banner | the solid surface |\n * | `symbol` (expo-symbols) | NativeIcon on iOS | `icons` (lucide) |\n * | `icons` (a lucide icon set) | NativeIcon on Android, web, and as the SF Symbol fallback | a blank space of the icon's size |\n * | `datePicker` (@expo/ui) | NativeDatePicker, NativeTimePicker | @react-native-community/datetimepicker |\n * | `keyboardAvoidingView` (react-native-keyboard-controller's `KeyboardAvoidingView`) | ThreadPage: the composer follows the keyboard frame by frame (`translate-with-padding`) | React Native `KeyboardAvoidingView` |\n * | `haptics` (expo-haptics) | useHaptics, usePressFeedback, NativeComposerBar (send) | no haptics |\n * | `navigation` (React Navigation's theming: from `expo-router` in an Expo Router app, which bundles its own copy; `@react-navigation/native` otherwise) | GenesisNativeApp: headers and tab bars in the brand's light and dark colors | React Navigation's default (light) theme |\n *\n * The props below are written structurally (no import of the optional\n * packages), so this package builds and type-checks without any of them.\n *\n * @stability Beta\n */\nimport { createContext, createElement, useContext, useMemo, type ComponentType, type ReactNode } from \"react\";\nimport type { GenesisHapticsModule } from \"./hooks/use-haptics\";\nimport type { ColorValue } from \"react-native\";\nimport type { NativeIconName } from \"./icon-names\";\n\n/** The FlatList props Genesis lists pass; FlashList v2 takes the same ones. */\nexport interface GenesisListProps<T> {\n data: readonly T[];\n renderItem: (info: { item: T; index: number }) => ReactNode;\n keyExtractor?: (item: T, index: number) => string;\n getItemType?: (item: T, index: number) => string | number | undefined;\n stickyHeaderIndices?: number[];\n /** FlashList v2's: `offset` moves sticky headers down from the list's top (under a native header). */\n stickyHeaderConfig?: { offset?: number };\n ListHeaderComponent?: ReactNode | ComponentType<unknown> | null;\n ListEmptyComponent?: ReactNode | ComponentType<unknown> | null;\n contentContainerStyle?: Record<string, unknown>;\n refreshing?: boolean;\n onRefresh?: () => void;\n refreshControl?: ReactNode;\n testID?: string;\n}\n\n/** `FlashList` from `@shopify/flash-list` v2 (New Architecture only; no `estimatedItemSize`). */\nexport type GenesisListComponent = ComponentType<GenesisListProps<any>>;\n\n/** The expo-image `Image` props Genesis passes. */\nexport interface GenesisImageProps {\n source: { uri: string } | number | null;\n style?: unknown;\n contentFit?: \"cover\" | \"contain\" | \"fill\" | \"none\" | \"scale-down\";\n cachePolicy?: \"none\" | \"disk\" | \"memory\" | \"memory-disk\";\n placeholder?: unknown;\n placeholderContentFit?: \"cover\" | \"contain\" | \"fill\" | \"none\" | \"scale-down\";\n transition?: number | null;\n recyclingKey?: string | null;\n priority?: \"low\" | \"normal\" | \"high\" | null;\n onError?: (event: unknown) => void;\n onLoad?: (event: unknown) => void;\n accessible?: boolean;\n accessibilityLabel?: string;\n testID?: string;\n}\n\n/** `Image` from `expo-image`. */\nexport type GenesisImageComponent = ComponentType<GenesisImageProps>;\n\n/** `import * as Reanimated from \"react-native-reanimated\"` (v4). Only what Genesis calls is listed. */\nexport interface GenesisReanimatedModule {\n default: { View: ComponentType<any> };\n useSharedValue: <V>(initial: V) => { value: V };\n useAnimatedStyle: (updater: () => Record<string, unknown>, deps?: unknown[]) => Record<string, unknown>;\n withTiming: (toValue: number, config?: { duration?: number; easing?: unknown; reduceMotion?: unknown }, callback?: (finished?: boolean) => void) => number;\n /** Optional so older injected modules and test fakes still fit; `animateMotion` falls back to `withTiming`. */\n withSpring?: (toValue: number, config?: { damping?: number; stiffness?: number; mass?: number; velocity?: number; reduceMotion?: unknown }, callback?: (finished?: boolean) => void) => number;\n withRepeat: (animation: number, numberOfReps?: number, reverse?: boolean, callback?: unknown, reduceMotion?: unknown) => number;\n cancelAnimation: (value: { value: unknown }) => void;\n Easing: { inOut: (easing: unknown) => unknown; ease: unknown; out: (easing: unknown) => unknown; cubic: unknown; bezier?: (x1: number, y1: number, x2: number, y2: number) => unknown };\n ReduceMotion?: { System: unknown; Always: unknown; Never: unknown };\n}\n\n/** `import * as GlassEffect from \"expo-glass-effect\"`. */\nexport interface GenesisGlassModule {\n GlassView: ComponentType<{\n style?: unknown;\n glassEffectStyle?: \"regular\" | \"clear\" | \"none\";\n tintColor?: string;\n isInteractive?: boolean;\n colorScheme?: \"auto\" | \"light\" | \"dark\";\n children?: ReactNode;\n testID?: string;\n pointerEvents?: \"box-none\" | \"none\" | \"box-only\" | \"auto\";\n }>;\n isLiquidGlassAvailable: () => boolean;\n isGlassEffectAPIAvailable: () => boolean;\n}\n\n/** The expo-symbols `SymbolView` props Genesis passes. */\nexport interface GenesisSymbolProps {\n name: string;\n size?: number;\n tintColor?: ColorValue;\n type?: \"monochrome\" | \"hierarchical\" | \"palette\" | \"multicolor\";\n weight?: string;\n fallback?: ReactNode;\n style?: unknown;\n accessible?: boolean;\n accessibilityLabel?: string;\n testID?: string;\n}\n\n/** `SymbolView` from `expo-symbols`. */\nexport type GenesisSymbolComponent = ComponentType<GenesisSymbolProps>;\n\n/** A lucide-style icon component: `size`, `color`, `strokeWidth`. */\nexport type GenesisIconComponent = ComponentType<{ size?: number; color?: ColorValue; fill?: ColorValue; strokeWidth?: number; testID?: string }>;\n\n/** Icon components by semantic name (`lucideIcons` from `/icons/lucide` is one). Missing names draw nothing. */\nexport type GenesisIconSet = Partial<Record<NativeIconName, GenesisIconComponent>>;\n\n/** The `@expo/ui/community/datetime-picker` props Genesis passes (a drop-in for the community picker). */\nexport interface GenesisDatePickerProps {\n value: Date;\n mode: \"date\" | \"time\";\n display?: \"default\" | \"compact\" | \"spinner\" | \"inline\";\n presentation?: \"inline\" | \"dialog\";\n disabled?: boolean;\n onValueChange?: (event: unknown, date: Date) => void;\n onDismiss?: () => void;\n style?: unknown;\n testID?: string;\n}\n\n/** The default export of `@expo/ui/community/datetime-picker`. */\nexport type GenesisDatePickerComponent = ComponentType<GenesisDatePickerProps>;\n\n/** A React Navigation theme (`ReactNavigation.Theme`): the colors Genesis sets, and the fonts it keeps. */\nexport interface GenesisNavigationTheme {\n dark: boolean;\n colors: { primary: ColorValue; background: ColorValue; card: ColorValue; text: ColorValue; border: ColorValue; notification: ColorValue };\n fonts?: unknown;\n}\n\n/**\n * React Navigation's theming. In an Expo Router app take it from `expo-router`: it bundles its own\n * React Navigation, and its navigators read that copy's theme, not `@react-navigation/native`'s.\n */\nexport interface GenesisNavigationModule {\n ThemeProvider: ComponentType<{ value: any; children: ReactNode }>;\n DefaultTheme: GenesisNavigationTheme;\n DarkTheme: GenesisNavigationTheme;\n}\n\n/** Every optional native module Genesis components can use. Each is optional on its own. */\n/** react-native-keyboard-controller's `KeyboardAvoidingView`, written structurally (the same shape as genesis-chat's). */\nexport type KeyboardAvoidingLike = ComponentType<{\n behavior?: \"height\" | \"padding\" | \"position\" | \"translate-with-padding\";\n keyboardVerticalOffset?: number;\n automaticOffset?: boolean;\n children?: ReactNode;\n testID?: string;\n}>;\n\nexport interface GenesisModules {\n list?: GenesisListComponent;\n image?: GenesisImageComponent;\n reanimated?: GenesisReanimatedModule;\n glass?: GenesisGlassModule;\n symbol?: GenesisSymbolComponent;\n icons?: GenesisIconSet;\n datePicker?: GenesisDatePickerComponent;\n navigation?: GenesisNavigationModule;\n /** react-native-keyboard-controller's `KeyboardAvoidingView` (it takes `behavior: \"translate-with-padding\"`). */\n keyboardAvoidingView?: KeyboardAvoidingLike;\n /** expo-haptics (`import * as Haptics from \"expo-haptics\"`): `useHaptics`, `usePressFeedback`, and the primitives that answer a touch. Without it, no haptics. */\n haptics?: GenesisHapticsModule;\n}\n\nconst EMPTY: GenesisModules = Object.freeze({});\nconst GenesisModulesContext = createContext<GenesisModules>(EMPTY);\n\nexport interface GenesisModulesProviderProps {\n modules: GenesisModules;\n children: ReactNode;\n}\n\n/**\n * Pass the optional native modules the app has installed. Nested providers\n * merge: an inner one adds to or replaces what an outer one gave. Define the\n * `modules` object once at module scope (as the starter's\n * `src/lib/native-modules.ts` does): a new inline object on every render\n * re-renders every component that reads it.\n */\nexport function GenesisModulesProvider({ modules, children }: GenesisModulesProviderProps) {\n const outer = useContext(GenesisModulesContext);\n const value = useMemo(() => (outer === EMPTY ? modules : { ...outer, ...modules }), [outer, modules]);\n return createElement(GenesisModulesContext.Provider, { value }, children);\n}\n\n/** The modules given to the nearest `GenesisModulesProvider`; `{}` without one. */\nexport function useGenesisModules(): GenesisModules {\n return useContext(GenesisModulesContext);\n}\n","/**\n * Haptics, one way in: the app passes expo-haptics once, as `GenesisModules.haptics`, and every\n * Genesis primitive (and the app's own pieces) plays the same kinds of feedback through\n * `useHaptics()`. Without the module nothing plays, and nothing throws.\n *\n * import * as Haptics from \"expo-haptics\";\n * <GenesisModulesProvider modules={{ haptics: Haptics }}>\n *\n * const haptic = useHaptics();\n * haptic(\"select\");\n *\n * Kinds follow the platforms' own vocabulary: a light, medium or heavy impact (a press, a swipe\n * passing its threshold, a long press opening a menu), a selection tick (a picker or a tab\n * changing), and a success, warning or error notification. The OS's own haptics setting applies;\n * Reduce Motion doesn't turn haptics off (they're not motion).\n *\n * @stability Beta\n */\nimport { useCallback } from \"react\";\nimport { useGenesisModules } from \"../native-modules\";\n\n/** What a haptic says. */\nexport type HapticKind = \"light\" | \"medium\" | \"heavy\" | \"select\" | \"success\" | \"warning\" | \"error\";\n\n/**\n * `import * as Haptics from \"expo-haptics\"`: the parts Genesis calls, written structurally (the\n * same shape as genesis-chat's `HapticsLike`, so one module serves both).\n */\nexport interface GenesisHapticsModule {\n impactAsync(style?: never): Promise<void>;\n selectionAsync(): Promise<void>;\n notificationAsync(type?: never): Promise<void>;\n ImpactFeedbackStyle: { Light: unknown; Medium: unknown; Heavy?: unknown };\n NotificationFeedbackType: { Success: unknown; Warning: unknown; Error: unknown };\n}\n\n/** Plays a haptic on the module given; never throws and never rejects. No module, no haptic. */\nexport function playHaptic(haptics: GenesisHapticsModule | undefined, kind: HapticKind): void {\n if (!haptics) return;\n try {\n const as = (s: unknown) => s as never;\n const styles = haptics.ImpactFeedbackStyle;\n const notes = haptics.NotificationFeedbackType;\n const p =\n kind === \"light\"\n ? haptics.impactAsync(as(styles.Light))\n : kind === \"medium\"\n ? haptics.impactAsync(as(styles.Medium))\n : kind === \"heavy\"\n ? haptics.impactAsync(as(styles.Heavy ?? styles.Medium))\n : kind === \"select\"\n ? haptics.selectionAsync()\n : haptics.notificationAsync(as(kind === \"success\" ? notes.Success : kind === \"warning\" ? notes.Warning : notes.Error));\n void p?.catch?.(() => undefined);\n } catch {\n // A haptic is never worth an error.\n }\n}\n\n/** A function that plays a haptic through the app's `GenesisModules.haptics`. Stable across renders. */\nexport function useHaptics(): (kind: HapticKind) => void {\n const { haptics } = useGenesisModules();\n return useCallback((kind: HapticKind) => playHaptic(haptics, kind), [haptics]);\n}\n","/**\n * useReducedMotion — subscribe to the OS reduce-motion preference.\n *\n * Returns `true` when the user has enabled reduce-motion at the OS level,\n * and follows the setting while the app runs (Reanimated's own hook reads it\n * once at launch). Components that animate (Sheet, Drawer, Toast, Skeleton)\n * honor it by skipping non-essential transitions and snapping into the\n * final state.\n *\n * @stability Beta\n */\nimport { useEffect, useState } from \"react\";\nimport { AccessibilityInfo } from \"react-native\";\n\n// The last answer anyone got: a component mounting later (a toast, an open\n// drawer) starts from it instead of animating for a frame before it hears.\nlet lastKnown = false;\n\n/** Tests only: forget the last answer. Not exported from the package. */\nexport function __resetReducedMotion() {\n lastKnown = false;\n}\n\nexport function useReducedMotion(): boolean {\n const [reduced, setReduced] = useState(lastKnown);\n\n useEffect(() => {\n let mounted = true;\n const set = (v: boolean) => {\n lastKnown = v;\n if (mounted) setReduced(v);\n };\n AccessibilityInfo.isReduceMotionEnabled()\n .then(set)\n // Some runtimes (web, older Android) reject when the accessibility\n // manager isn't wired up: treat that as \"no preference\".\n .catch(() => {});\n const sub = AccessibilityInfo.addEventListener(\"reduceMotionChanged\", set);\n return () => {\n mounted = false;\n sub?.remove?.();\n };\n }, []);\n\n return reduced;\n}\n","/**\n * useMotion — the shared motion tokens (genesis-design-system's\n * `resolveMotion`), with the OS's reduce-motion setting applied.\n *\n * Every Genesis primitive that moves reads its durations, easings and springs\n * from here instead of its own constants, so motion is defined once for web\n * and native. Under Reduce Motion every duration is 0 and `animateMotion`\n * returns the final value, so a component lands without moving.\n *\n * The brand's motion level isn't read from a provider yet: pass `level` (a\n * brand whose design system chose `none` passes `\"none\"`). Without it,\n * `calm`.\n *\n * On the JS thread (an effect, a PanResponder), `animateMotion`:\n *\n * ```tsx\n * const motion = useMotion();\n * const { reanimated: R } = useGenesisModules();\n * opacity.value = animateMotion(R, motion, 1, { duration: \"fast\", easing: \"decelerate\" });\n * ```\n *\n * Inside a worklet (a gesture's `onEnd`, an animated scroll handler), build\n * the config with the worklet-safe `motionSpring` / `motionTiming` and call\n * Reanimated yourself:\n *\n * ```tsx\n * .onEnd((e) => { x.value = withSpring(0, motionSpring(motion, \"snappy\", e.velocityX)); })\n * opacity.value = withTiming(1, motionTiming(motion, \"fast\", Easing, \"decelerate\"));\n * ```\n *\n * A repeating animation checks `motion.reduced` first: a zero-length repeat\n * would flash every frame.\n *\n * @stability Beta\n */\nimport { useMemo } from \"react\";\nimport {\n resolveMotion,\n type MotionDurations,\n type MotionEasings,\n type MotionLevel,\n type MotionSprings,\n type MotionTokens,\n} from \"@marktiderman/genesis-design-system/tokens/motion\";\nimport type { GenesisReanimatedModule } from \"../native-modules\";\nimport { useReducedMotion } from \"./use-reduced-motion\";\n\nexport interface UseMotionOptions {\n /** The brand's motion level. Default `calm`; `none` holds everything still, like Reduce Motion. */\n level?: MotionLevel;\n}\n\nexport function useMotion(options: UseMotionOptions = {}): MotionTokens {\n const reducedMotion = useReducedMotion();\n const level = options.level ?? \"calm\";\n return useMemo(() => resolveMotion(level, { reducedMotion }), [level, reducedMotion]);\n}\n\n/** How to get there: a named spring (keeps a gesture's velocity), or a named duration and easing. */\nexport type MotionHow =\n | { spring: keyof MotionSprings; velocity?: number; duration?: never; easing?: never }\n | { duration: keyof MotionDurations; easing?: keyof MotionEasings; spring?: never; velocity?: never };\n\n/** What `motionSpring` gives `withSpring`. */\nexport interface MotionSpringConfig {\n damping: number;\n stiffness: number;\n mass: number;\n velocity?: number;\n}\n\n/** What `motionTiming` gives `withTiming`. */\nexport interface MotionTimingConfig {\n duration: number;\n easing?: unknown;\n}\n\n/**\n * A `withSpring` config from a named spring. Worklet-safe (plain data in,\n * plain data out). Under reduced motion it's the stiff, critically damped\n * spring that settles in a few frames; to not move at all, check\n * `motion.reduced` and assign the value.\n */\nexport function motionSpring(motion: MotionTokens, name: keyof MotionSprings, velocity?: number): MotionSpringConfig {\n \"worklet\";\n const s = motion.spring[name];\n return typeof velocity === \"number\" && !motion.reduced\n ? { damping: s.damping, stiffness: s.stiffness, mass: s.mass, velocity }\n : { damping: s.damping, stiffness: s.stiffness, mass: s.mass };\n}\n\n/**\n * A `withTiming` config from a named duration and easing. Pass Reanimated's\n * `Easing` (`R.Easing`, or `Easing` imported in a worklet) so the token's\n * curve is used; a module without `Easing.bezier` gets Reanimated's default\n * curve. Worklet-safe.\n */\nexport function motionTiming(\n motion: MotionTokens,\n duration: keyof MotionDurations,\n Easing: Pick<GenesisReanimatedModule[\"Easing\"], \"bezier\"> | undefined,\n easing: keyof MotionEasings = \"out\",\n): MotionTimingConfig {\n \"worklet\";\n const [x1, y1, x2, y2] = motion.easing[easing];\n const curve = Easing?.bezier ? Easing.bezier(x1, y1, x2, y2) : undefined;\n return curve === undefined ? { duration: motion.duration[duration] } : { duration: motion.duration[duration], easing: curve };\n}\n\n/**\n * A Reanimated animation to `toValue` with the motion tokens, for a shared\n * value on the JS thread: `x.value = animateMotion(R, motion, 0, { spring: \"smooth\" })`.\n * Under reduced motion it returns `toValue` itself, so nothing moves.\n *\n * It takes no completion callback: Reanimated runs one on the UI thread, so\n * it must be a worklet, and the reduced path couldn't keep that promise. To\n * act when an animation ends, call `withSpring` / `withTiming` yourself with\n * `motionSpring` / `motionTiming` and a worklet callback. A module without\n * `withSpring` (an older one, a test fake) gets a `withTiming` at `base`.\n */\nexport function animateMotion(R: GenesisReanimatedModule, motion: MotionTokens, toValue: number, how: MotionHow): number {\n if (motion.reduced) return toValue;\n if (how.spring !== undefined) {\n if (R.withSpring) return R.withSpring(toValue, motionSpring(motion, how.spring, how.velocity));\n return R.withTiming(toValue, motionTiming(motion, \"base\", R.Easing));\n }\n return R.withTiming(toValue, motionTiming(motion, how.duration, R.Easing, how.easing));\n}\n","/**\n * useThemeMode — read the active color scheme (light / dark / unset).\n *\n * Wraps RN's `Appearance.getColorScheme()` + `Appearance.addChangeListener`\n * with a stable React hook so consumers don't have to wire it themselves.\n *\n * Use this in tokens-aware components when you need to choose between\n * light/dark variants OUTSIDE of Tailwind's `dark:` modifier (e.g., to pick\n * an asset, run an extra-color computation, or set StatusBar style).\n *\n * @stability Beta\n */\nimport { useEffect, useState } from \"react\";\nimport { Appearance, type ColorSchemeName } from \"react-native\";\n\nexport type ThemeMode = \"light\" | \"dark\";\n\nexport function useThemeMode(): ThemeMode {\n const [scheme, setScheme] = useState<ColorSchemeName>(\n Appearance.getColorScheme(),\n );\n\n useEffect(() => {\n const sub = Appearance.addChangeListener(({ colorScheme }) => {\n setScheme(colorScheme);\n });\n return () => sub.remove();\n }, []);\n\n return scheme === \"dark\" ? \"dark\" : \"light\";\n}\n","/**\n * useThemeRoles — the theme roles (background, label, separator, tint…) as\n * colors for this platform and color scheme.\n *\n * On iOS every neutral role is a system color through `PlatformColor`, so a\n * screen follows light and dark mode, increased contrast and accessibility\n * settings like the system apps. On Android the roles are the Genesis tokens\n * for the current scheme, or Material You colors on Android 12+ with\n * `materialYou`. A brand sets `tint`.\n *\n * Use it for `style` props and anything Tailwind classes don't reach, such as\n * navigation header and tab bar options.\n *\n * @stability Beta\n */\nimport { useMemo } from \"react\";\nimport { Platform, PlatformColor, type ColorValue } from \"react-native\";\nimport { resolveThemeRoles, type ThemeRole } from \"@marktiderman/genesis-design-system\";\nimport { useThemeMode } from \"./use-theme-mode\";\n\nexport type ThemeRoleColors = Record<ThemeRole, ColorValue>;\n\nexport interface UseThemeRolesOptions {\n /** The brand's primary color. */\n tint?: string;\n /** On Android 12+, use Material You dynamic colors for the neutral roles (and the tint, unless `tint` is set). Ignored elsewhere. */\n materialYou?: boolean;\n}\n\nexport function useThemeRoles(options: UseThemeRolesOptions = {}): ThemeRoleColors {\n const scheme = useThemeMode();\n const { tint, materialYou = false } = options;\n const androidDynamic = materialYou && Platform.OS === \"android\" && Number(Platform.Version) >= 31;\n return useMemo(\n () =>\n resolveThemeRoles<ColorValue>({\n target: Platform.OS === \"ios\" ? \"ios\" : \"android\",\n scheme,\n platformColor: (name) => PlatformColor(name),\n tint,\n androidDynamic,\n }),\n [scheme, tint, androidDynamic],\n );\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export { JUMP_SETTLE_MS, useThreadJump } from '@marktiderman/genesis-core/conversation';
|
|
1
2
|
import { createContext, createElement, useContext } from 'react';
|
|
2
3
|
|
|
3
|
-
// src/hooks/
|
|
4
|
+
// src/hooks/index.ts
|
|
4
5
|
var BrandExtensionsContext = createContext(
|
|
5
6
|
void 0
|
|
6
7
|
);
|
|
@@ -20,5 +21,5 @@ function useGenesisExtension(key) {
|
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export { BrandExtensionsProvider, useGenesisExtension };
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-YWDDDYDI.js.map
|
|
25
|
+
//# sourceMappingURL=chunk-YWDDDYDI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-genesis-extension.ts"],"names":[],"mappings":";;;;AAkDA,IAAM,sBAAA,GAAyB,aAAA;AAAA,EAC7B;AACF,CAAA;AAOO,SAAS,uBAAA,CAAwB;AAAA,EACtC,KAAA;AAAA,EACA;AACF,CAAA,EAAiC;AAC/B,EAAA,OAAO,aAAA;AAAA,IACL,sBAAA,CAAuB,QAAA;AAAA,IACvB,EAAE,KAAA,EAAM;AAAA,IACR;AAAA,GACF;AACF;AAOO,SAAS,oBACd,GAAA,EACgC;AAChC,EAAA,MAAM,GAAA,GAAM,WAAW,sBAAsB,CAAA;AAC7C,EAAA,OAAO,MAAM,GAAG,CAAA;AAClB","file":"chunk-YWDDDYDI.js","sourcesContent":["/**\n * useGenesisExtension — read a brand-package `extensions[<key>]` token scale.\n *\n * Brand packages declare domain-specific token categories under the\n * `extensions` slot of the canonical schema (PRD-07 D8 design decision).\n * Genesis primitives don't read these — only consumer composites do — so\n * this hook is the canonical accessor.\n *\n * Resolution order:\n * 1. `BrandExtensionsContext` value (set via <BrandExtensionsProvider>)\n * 2. `undefined` — the extension key isn't declared\n *\n * Consumers wire the provider once at app root; calls anywhere downstream\n * read by key.\n *\n * <BrandExtensionsProvider value={brand.extensions}>\n * <App />\n * </BrandExtensionsProvider>\n *\n * const moodTokens = useGenesisExtension(\"mood\");\n * // moodTokens?.[500] etc. — shape is consumer-defined\n *\n * Type contract: the canonical `BrandExtensions` interface lives in\n * `@marktiderman/genesis-design-system` (declaration-merging surface). At\n * runtime, consumers may pass a partially-populated object whose keys\n * match their own augmented `BrandExtensions`. We intentionally accept\n * `Partial<BrandExtensions>` here so the provider works with brand\n * packages that haven't declared extensions yet (a common case in newly\n * scaffolded apps).\n *\n * @stability Beta\n */\nimport {\n createContext,\n createElement,\n useContext,\n type ReactNode,\n} from \"react\";\nimport type { BrandExtensions } from \"@marktiderman/genesis-design-system\";\n\n/**\n * Runtime shape passed to `<BrandExtensionsProvider>`. Consumers augment\n * the canonical `BrandExtensions` interface (in design-system) via TS\n * declaration merging; the provider accepts the resulting record.\n *\n * `Partial<>` so brand packages that have no extensions can still wrap\n * their app in the provider without TS errors.\n */\nexport type BrandExtensionsValue = Partial<BrandExtensions>;\n\nconst BrandExtensionsContext = createContext<BrandExtensionsValue | undefined>(\n undefined,\n);\n\nexport interface BrandExtensionsProviderProps {\n value?: BrandExtensionsValue;\n children: ReactNode;\n}\n\nexport function BrandExtensionsProvider({\n value,\n children,\n}: BrandExtensionsProviderProps) {\n return createElement(\n BrandExtensionsContext.Provider,\n { value },\n children,\n );\n}\n\n/**\n * Read an extension scale by key. Returns `undefined` when the provider\n * isn't mounted OR when the key isn't declared on the brand. The return\n * type follows the consumer's augmented `BrandExtensions[K]`.\n */\nexport function useGenesisExtension<K extends keyof BrandExtensions>(\n key: K,\n): BrandExtensions[K] | undefined {\n const ctx = useContext(BrandExtensionsContext);\n return ctx?.[key];\n}\n"]}
|