@nori-ui/core 1.3.0 → 1.4.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.
@@ -0,0 +1,443 @@
1
+ import { Slot } from './chunk-ZIBNLXIV.js';
2
+ import { cn } from './chunk-CHXHRJNZ.js';
3
+ import { px } from './chunk-5A2QOOVN.js';
4
+ import { useThemeColors } from './chunk-R5JMDDCB.js';
5
+ import { __name } from './chunk-WCQVDF3K.js';
6
+ import { createContext, useState, useCallback, useId, useRef, isValidElement, useEffect, useContext } from 'react';
7
+ import { Text, Pressable, View, Platform, Modal } from 'react-native';
8
+ import { jsx } from 'nativewind/jsx-runtime';
9
+
10
+ var SIZE_PERCENT = {
11
+ sm: "25%",
12
+ md: "50%",
13
+ lg: "75%",
14
+ full: "100%"
15
+ };
16
+ var SheetContext = createContext(null);
17
+ var useSheetContext = /* @__PURE__ */ __name((label) => {
18
+ const ctx = useContext(SheetContext);
19
+ if (!ctx) {
20
+ throw new Error(`<${label}> must be rendered inside a <Sheet>.`);
21
+ }
22
+ return ctx;
23
+ }, "useSheetContext");
24
+ var SheetRoot = /* @__PURE__ */ __name(({
25
+ open,
26
+ defaultOpen = false,
27
+ onOpenChange,
28
+ side = "bottom",
29
+ size = "md",
30
+ dismissible = true,
31
+ children
32
+ }) => {
33
+ const [inner, setInner] = useState(defaultOpen);
34
+ const isControlled = open !== void 0;
35
+ const current = isControlled ? open : inner;
36
+ const setOpen = useCallback(
37
+ (next) => {
38
+ if (!isControlled) {
39
+ setInner(next);
40
+ }
41
+ onOpenChange?.(next);
42
+ },
43
+ [isControlled, onOpenChange]
44
+ );
45
+ const baseId = useId();
46
+ const triggerRef = useRef(null);
47
+ const ctxValue = {
48
+ open: current,
49
+ setOpen,
50
+ titleId: `${baseId}-title`,
51
+ descriptionId: `${baseId}-description`,
52
+ triggerRef,
53
+ side,
54
+ size,
55
+ dismissible
56
+ };
57
+ return /* @__PURE__ */ jsx(SheetContext.Provider, { value: ctxValue, children });
58
+ }, "SheetRoot");
59
+ var SheetTrigger = /* @__PURE__ */ __name(({ asChild = true, children, className, testID }) => {
60
+ const ctx = useSheetContext("SheetTrigger");
61
+ const onPress = useCallback(() => ctx.setOpen(true), [ctx]);
62
+ if (asChild && isValidElement(children)) {
63
+ const child = children;
64
+ const fire = /* @__PURE__ */ __name((existing) => (event) => {
65
+ existing?.(event);
66
+ ctx.setOpen(true);
67
+ }, "fire");
68
+ return /* @__PURE__ */ jsx(
69
+ Slot,
70
+ {
71
+ ref: (node) => {
72
+ ctx.triggerRef.current = node;
73
+ },
74
+ onClick: fire(child.props.onClick),
75
+ onPress: fire(child.props.onPress),
76
+ ...testID !== void 0 ? { "data-testid": testID } : {},
77
+ ...className !== void 0 ? { className } : {},
78
+ children: child
79
+ }
80
+ );
81
+ }
82
+ return /* @__PURE__ */ jsx(
83
+ Pressable,
84
+ {
85
+ ref: (node) => {
86
+ ctx.triggerRef.current = node;
87
+ },
88
+ onPress,
89
+ ...testID !== void 0 ? { testID } : {},
90
+ ...className !== void 0 ? { className } : {},
91
+ children: wrapStringChildren(children)
92
+ }
93
+ );
94
+ }, "SheetTrigger");
95
+ var SheetHeader = /* @__PURE__ */ __name(({ children, className }) => {
96
+ const colors = useThemeColors();
97
+ return /* @__PURE__ */ jsx(
98
+ View,
99
+ {
100
+ className: cn("flex-col gap-1", className),
101
+ style: {
102
+ flexDirection: "column",
103
+ gap: px(colors.spacing["1"]),
104
+ paddingHorizontal: px(colors.spacing["6"]),
105
+ paddingTop: px(colors.spacing["6"]),
106
+ paddingBottom: px(colors.spacing["2"])
107
+ },
108
+ children
109
+ }
110
+ );
111
+ }, "SheetHeader");
112
+ var SheetTitle = /* @__PURE__ */ __name(({ children, className }) => {
113
+ const ctx = useSheetContext("SheetTitle");
114
+ const colors = useThemeColors();
115
+ return /* @__PURE__ */ jsx(
116
+ Text,
117
+ {
118
+ nativeID: ctx.titleId,
119
+ id: ctx.titleId,
120
+ role: "heading",
121
+ "aria-level": 2,
122
+ className: cn("text-lg font-semibold text-semantic-text-default", className),
123
+ style: {
124
+ color: colors.semantic.text.default,
125
+ fontFamily: colors.fontFamily.display,
126
+ fontSize: px(colors.fontSize.lg),
127
+ fontWeight: colors.fontWeight.semibold
128
+ },
129
+ children
130
+ }
131
+ );
132
+ }, "SheetTitle");
133
+ var SheetDescription = /* @__PURE__ */ __name(({ children, className }) => {
134
+ const ctx = useSheetContext("SheetDescription");
135
+ const colors = useThemeColors();
136
+ return /* @__PURE__ */ jsx(
137
+ Text,
138
+ {
139
+ nativeID: ctx.descriptionId,
140
+ id: ctx.descriptionId,
141
+ className: cn("text-sm text-semantic-text-muted", className),
142
+ style: {
143
+ color: colors.semantic.text.muted,
144
+ fontFamily: colors.fontFamily.body,
145
+ fontSize: px(colors.fontSize.sm),
146
+ lineHeight: px(colors.fontSize.sm) * Number(colors.lineHeight.normal)
147
+ },
148
+ children
149
+ }
150
+ );
151
+ }, "SheetDescription");
152
+ var SheetBody = /* @__PURE__ */ __name(({ children, className }) => {
153
+ const colors = useThemeColors();
154
+ return /* @__PURE__ */ jsx(
155
+ View,
156
+ {
157
+ className: cn("flex-1", className),
158
+ style: {
159
+ flex: 1,
160
+ paddingHorizontal: px(colors.spacing["6"]),
161
+ paddingVertical: px(colors.spacing["4"])
162
+ },
163
+ children
164
+ }
165
+ );
166
+ }, "SheetBody");
167
+ var SheetFooter = /* @__PURE__ */ __name(({ children, className }) => {
168
+ const colors = useThemeColors();
169
+ return /* @__PURE__ */ jsx(
170
+ View,
171
+ {
172
+ className: cn("flex-row items-center justify-end gap-2", className),
173
+ style: {
174
+ flexDirection: "row",
175
+ alignItems: "center",
176
+ justifyContent: "flex-end",
177
+ gap: px(colors.spacing["2"]),
178
+ paddingHorizontal: px(colors.spacing["6"]),
179
+ paddingBottom: px(colors.spacing["6"]),
180
+ paddingTop: px(colors.spacing["2"])
181
+ },
182
+ children
183
+ }
184
+ );
185
+ }, "SheetFooter");
186
+ var SheetClose = /* @__PURE__ */ __name(({
187
+ asChild = true,
188
+ children,
189
+ className,
190
+ testID,
191
+ accessibilityLabel = "Close"
192
+ }) => {
193
+ const ctx = useSheetContext("SheetClose");
194
+ const onPress = useCallback(() => ctx.setOpen(false), [ctx]);
195
+ if (asChild && isValidElement(children)) {
196
+ const child = children;
197
+ const fire = /* @__PURE__ */ __name((existing) => (event) => {
198
+ existing?.(event);
199
+ ctx.setOpen(false);
200
+ }, "fire");
201
+ return /* @__PURE__ */ jsx(
202
+ Slot,
203
+ {
204
+ onClick: fire(child.props.onClick),
205
+ onPress: fire(child.props.onPress),
206
+ ...testID !== void 0 ? { "data-testid": testID } : {},
207
+ ...className !== void 0 ? { className } : {},
208
+ children: child
209
+ }
210
+ );
211
+ }
212
+ return /* @__PURE__ */ jsx(
213
+ Pressable,
214
+ {
215
+ onPress,
216
+ role: "button",
217
+ accessibilityRole: "button",
218
+ accessibilityLabel,
219
+ "aria-label": accessibilityLabel,
220
+ ...testID !== void 0 ? { testID } : {},
221
+ ...className !== void 0 ? { className } : {},
222
+ children: wrapStringChildren(children)
223
+ }
224
+ );
225
+ }, "SheetClose");
226
+ function wrapStringChildren(children) {
227
+ if (typeof children === "string" || typeof children === "number") {
228
+ return /* @__PURE__ */ jsx(Text, { children });
229
+ }
230
+ return children;
231
+ }
232
+ __name(wrapStringChildren, "wrapStringChildren");
233
+ var SCRIM_COLOR = "rgba(0, 0, 0, 0.40)";
234
+ var FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
235
+ var SheetPanel = /* @__PURE__ */ __name(({ children, className, testID }) => {
236
+ const ctx = useSheetContext("SheetPanel");
237
+ const colors = useThemeColors();
238
+ const panelRef = useRef(null);
239
+ const overlayDomRef = useRef(null);
240
+ const [entered, setEntered] = useState(false);
241
+ useEffect(() => {
242
+ if (Platform.OS !== "web") {
243
+ setEntered(true);
244
+ return;
245
+ }
246
+ if (!ctx.open) {
247
+ setEntered(false);
248
+ return;
249
+ }
250
+ const id = requestAnimationFrame(() => setEntered(true));
251
+ return () => cancelAnimationFrame(id);
252
+ }, [ctx.open]);
253
+ useEffect(() => {
254
+ if (Platform.OS !== "web") {
255
+ return;
256
+ }
257
+ const node = overlayDomRef.current;
258
+ if (!node) {
259
+ return;
260
+ }
261
+ node.style.transitionProperty = "background-color";
262
+ node.style.transitionDuration = "200ms";
263
+ node.style.transitionTimingFunction = "ease-out";
264
+ node.style.backgroundColor = entered ? SCRIM_COLOR : "rgba(0,0,0,0)";
265
+ }, [entered]);
266
+ useEffect(() => {
267
+ if (!ctx.open || Platform.OS !== "web" || typeof document === "undefined") {
268
+ return;
269
+ }
270
+ const previouslyFocused = document.activeElement;
271
+ const prevBodyOverflow = document.body.style.overflow;
272
+ document.body.style.overflow = "hidden";
273
+ const focusFirst = /* @__PURE__ */ __name(() => {
274
+ const node = panelRef.current;
275
+ if (!node) {
276
+ return;
277
+ }
278
+ const focusable = node.querySelectorAll(FOCUSABLE_SELECTOR);
279
+ const first = focusable[0];
280
+ if (first) {
281
+ first.focus();
282
+ } else {
283
+ node.setAttribute("tabindex", "-1");
284
+ node.focus();
285
+ }
286
+ }, "focusFirst");
287
+ focusFirst();
288
+ const onKeyDown = /* @__PURE__ */ __name((event) => {
289
+ if (event.key === "Escape") {
290
+ event.preventDefault();
291
+ ctx.setOpen(false);
292
+ return;
293
+ }
294
+ if (event.key !== "Tab") {
295
+ return;
296
+ }
297
+ const node = panelRef.current;
298
+ if (!node) {
299
+ return;
300
+ }
301
+ const focusable = Array.from(node.querySelectorAll(FOCUSABLE_SELECTOR)).filter(
302
+ (el) => el.offsetParent !== null || el === document.activeElement
303
+ );
304
+ if (focusable.length === 0) {
305
+ event.preventDefault();
306
+ return;
307
+ }
308
+ const first = focusable[0];
309
+ const last = focusable[focusable.length - 1];
310
+ if (!first || !last) {
311
+ return;
312
+ }
313
+ if (event.shiftKey) {
314
+ if (document.activeElement === first || !node.contains(document.activeElement)) {
315
+ event.preventDefault();
316
+ last.focus();
317
+ }
318
+ } else if (document.activeElement === last) {
319
+ event.preventDefault();
320
+ first.focus();
321
+ }
322
+ }, "onKeyDown");
323
+ document.addEventListener("keydown", onKeyDown);
324
+ return () => {
325
+ document.removeEventListener("keydown", onKeyDown);
326
+ document.body.style.overflow = prevBodyOverflow;
327
+ const restoreTo = ctx.triggerRef.current ?? previouslyFocused;
328
+ restoreTo?.focus?.();
329
+ };
330
+ }, [ctx.open, ctx.setOpen, ctx.triggerRef]);
331
+ const onBackdropPress = useCallback(() => {
332
+ if (ctx.dismissible) {
333
+ ctx.setOpen(false);
334
+ }
335
+ }, [ctx]);
336
+ const isHorizontal = ctx.side === "left" || ctx.side === "right";
337
+ const dim = typeof ctx.size === "number" ? ctx.size : SIZE_PERCENT[ctx.size];
338
+ const panelStyle = {
339
+ position: "absolute",
340
+ backgroundColor: colors.semantic.background.elevated,
341
+ ...isHorizontal ? { top: 0, bottom: 0 } : { left: 0, right: 0 },
342
+ ...ctx.side === "bottom" && { bottom: 0 },
343
+ ...ctx.side === "top" && { top: 0 },
344
+ ...ctx.side === "left" && { left: 0 },
345
+ ...ctx.side === "right" && { right: 0 }
346
+ };
347
+ const translateStyle = Platform.OS === "web" ? {
348
+ transform: entered ? "translateX(0) translateY(0)" : translateOffscreen(ctx.side),
349
+ transitionProperty: "transform",
350
+ transitionDuration: "280ms",
351
+ transitionTimingFunction: "cubic-bezier(0.16, 1, 0.3, 1)"
352
+ } : {};
353
+ const overlayStyle = {
354
+ position: Platform.OS === "web" ? "fixed" : "absolute",
355
+ top: 0,
356
+ left: 0,
357
+ right: 0,
358
+ bottom: 0,
359
+ ...Platform.OS === "web" ? { zIndex: 50 } : { backgroundColor: SCRIM_COLOR }
360
+ };
361
+ const sizeStyle = isHorizontal ? { width: dim, height: "100%" } : { height: dim, width: "100%" };
362
+ return /* @__PURE__ */ jsx(
363
+ Modal,
364
+ {
365
+ visible: ctx.open,
366
+ transparent: true,
367
+ animationType: Platform.OS === "web" ? "none" : ctx.side === "bottom" || ctx.side === "top" ? "slide" : "fade",
368
+ onRequestClose: () => ctx.setOpen(false),
369
+ children: /* @__PURE__ */ jsx(
370
+ Pressable,
371
+ {
372
+ accessibilityRole: "none",
373
+ "aria-hidden": true,
374
+ ref: (node) => {
375
+ overlayDomRef.current = node;
376
+ },
377
+ style: overlayStyle,
378
+ onPress: onBackdropPress,
379
+ children: /* @__PURE__ */ jsx(
380
+ Pressable,
381
+ {
382
+ onPress: (event) => event.stopPropagation?.(),
383
+ ref: (node) => {
384
+ panelRef.current = node;
385
+ },
386
+ role: "dialog",
387
+ accessibilityRole: "none",
388
+ "aria-modal": true,
389
+ "aria-labelledby": ctx.titleId,
390
+ "aria-describedby": ctx.descriptionId,
391
+ "data-side": ctx.side,
392
+ ...testID !== void 0 ? { testID } : {},
393
+ className: cn("bg-semantic-background-elevated", className),
394
+ style: [
395
+ panelStyle,
396
+ sizeStyle,
397
+ translateStyle,
398
+ {
399
+ shadowColor: "#000",
400
+ shadowOffset: { width: 0, height: -2 },
401
+ shadowOpacity: 0.15,
402
+ shadowRadius: 20,
403
+ elevation: 24,
404
+ ...ctx.side === "bottom" ? { borderTopLeftRadius: 16, borderTopRightRadius: 16 } : {},
405
+ ...ctx.side === "top" ? { borderBottomLeftRadius: 16, borderBottomRightRadius: 16 } : {}
406
+ }
407
+ ],
408
+ children
409
+ }
410
+ )
411
+ }
412
+ )
413
+ }
414
+ );
415
+ }, "SheetPanel");
416
+ var Sheet = Object.assign(SheetRoot, {
417
+ Trigger: SheetTrigger,
418
+ Panel: SheetPanel,
419
+ Header: SheetHeader,
420
+ Title: SheetTitle,
421
+ Description: SheetDescription,
422
+ Body: SheetBody,
423
+ Footer: SheetFooter,
424
+ Close: SheetClose
425
+ });
426
+ var Drawer = Sheet;
427
+ function translateOffscreen(side) {
428
+ switch (side) {
429
+ case "bottom":
430
+ return "translateY(100%)";
431
+ case "top":
432
+ return "translateY(-100%)";
433
+ case "left":
434
+ return "translateX(-100%)";
435
+ case "right":
436
+ return "translateX(100%)";
437
+ }
438
+ }
439
+ __name(translateOffscreen, "translateOffscreen");
440
+
441
+ export { Drawer, Sheet, SheetBody, SheetClose, SheetDescription, SheetFooter, SheetHeader, SheetPanel, SheetTitle, SheetTrigger };
442
+ //# sourceMappingURL=chunk-BNDUQNG7.js.map
443
+ //# sourceMappingURL=chunk-BNDUQNG7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Sheet/Sheet.shared.tsx","../src/components/Sheet/Sheet.tsx"],"names":["RNText","useRef","useState","useCallback","jsx","Pressable"],"mappings":";;;;;;;;;AA6EO,IAAM,YAAA,GAA2D;AAAA,EACpE,EAAA,EAAI,KAAA;AAAA,EACJ,EAAA,EAAI,KAAA;AAAA,EACJ,EAAA,EAAI,KAAA;AAAA,EACJ,IAAA,EAAM;AACV,CAAA;AAWO,IAAM,YAAA,GAAe,cAAwC,IAAI,CAAA;AAEjE,IAAM,eAAA,2BAAmB,KAAA,KAAqC;AACjE,EAAA,MAAM,GAAA,GAAM,WAAW,YAAY,CAAA;AACnC,EAAA,IAAI,CAAC,GAAA,EAAK;AACN,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,CAAA,EAAI,KAAK,CAAA,oCAAA,CAAsC,CAAA;AAAA,EACnE;AACA,EAAA,OAAO,GAAA;AACX,CAAA,EAN+B,iBAAA,CAAA;AAUxB,IAAM,4BAAY,MAAA,CAAA,CAAC;AAAA,EACtB,IAAA;AAAA,EACA,WAAA,GAAc,KAAA;AAAA,EACd,YAAA;AAAA,EACA,IAAA,GAAO,QAAA;AAAA,EACP,IAAA,GAAO,IAAA;AAAA,EACP,WAAA,GAAc,IAAA;AAAA,EACd;AACJ,CAAA,KAAkB;AACd,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAkB,WAAW,CAAA;AACvD,EAAA,MAAM,eAAe,IAAA,KAAS,MAAA;AAC9B,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,YAAA;AAAA,EACT,KAAA,EAAO,UAAA;AAAA,EACP,MAAA,EAAQ,WAAA;AAAA,EACR,KAAA,EAAO,UAAA;AAAA,EACP,WAAA,EAAa,gBAAA;AAAA,EACb,IAAA,EAAM,SAAA;AAAA,EACN,MAAA,EAAQ,WAAA;AAAA,EACR,KAAA,EAAO;AACX,CAAC;AAEM,IAAM,MAAA,GAAS;AAItB,SAAS,mBAAmB,IAAA,EAAyB;AACjD,EAAA,QAAQ,IAAA;AAAM,IACV,KAAK,QAAA;AACD,MAAA,OAAO,kBAAA;AAAA,IACX,KAAK,KAAA;AACD,MAAA,OAAO,mBAAA;AAAA,IACX,KAAK,MAAA;AACD,MAAA,OAAO,mBAAA;AAAA,IACX,KAAK,OAAA;AACD,MAAA,OAAO,kBAAA;AAAA;AAEnB;AAXS,MAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA","file":"chunk-BNDUQNG7.js","sourcesContent":["'use client';\n\n/**\n * Shared Sheet internals — context, types, root, trigger, and structural\n * subcomponents (Header, Title, Description, Body, Footer, Close).\n *\n * Imported by both `Sheet.tsx` (native) and `Sheet.web.tsx` (web) to avoid\n * duplication. The panel surface (`SheetPanel`) is platform-specific and\n * lives in each of those files.\n */\n\nimport {\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useCallback,\n useContext,\n useId,\n useRef,\n useState,\n} from 'react';\nimport { Pressable, Text as RNText, View } from 'react-native';\nimport { Slot } from '../../slot';\nimport { px } from '../../theme/px';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport type SheetSide = 'top' | 'right' | 'bottom' | 'left';\n\nexport type SheetSize = 'sm' | 'md' | 'lg' | 'full' | number;\n\nexport type SheetProps = {\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. @defaultValue false */\n defaultOpen?: boolean;\n /** Fires with the new open state. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Edge the sheet slides in from.\n * @defaultValue 'bottom'\n */\n side?: SheetSide;\n /**\n * Panel size: preset key or an explicit pixel value.\n * - 'sm' → 25% of viewport height/width\n * - 'md' → 50%\n * - 'lg' → 75%\n * - 'full' → 100%\n * - number → explicit px value\n * @defaultValue 'md'\n */\n size?: SheetSize;\n /**\n * Whether tapping the backdrop closes the sheet.\n * @defaultValue true\n */\n dismissible?: boolean;\n children?: ReactNode;\n};\n\nexport type SheetContextValue = {\n open: boolean;\n setOpen: (next: boolean) => void;\n titleId: string;\n descriptionId: string;\n triggerRef: { current: HTMLElement | null };\n side: SheetSide;\n size: SheetSize;\n dismissible: boolean;\n};\n\n// ─── Size helpers ─────────────────────────────────────────────────────────────\n\nexport const SIZE_PERCENT: Record<Exclude<SheetSize, number>, string> = {\n sm: '25%',\n md: '50%',\n lg: '75%',\n full: '100%',\n};\n\nexport function resolveSizeValue(size: SheetSize): string | number {\n if (typeof size === 'number') {\n return size;\n }\n return SIZE_PERCENT[size];\n}\n\n// ─── Context ──────────────────────────────────────────────────────────────────\n\nexport const SheetContext = createContext<SheetContextValue | null>(null);\n\nexport const useSheetContext = (label: string): SheetContextValue => {\n const ctx = useContext(SheetContext);\n if (!ctx) {\n throw new Error(`<${label}> must be rendered inside a <Sheet>.`);\n }\n return ctx;\n};\n\n// ─── Root ─────────────────────────────────────────────────────────────────────\n\nexport const SheetRoot = ({\n open,\n defaultOpen = false,\n onOpenChange,\n side = 'bottom',\n size = 'md',\n dismissible = true,\n children,\n}: SheetProps) => {\n const [inner, setInner] = useState<boolean>(defaultOpen);\n const isControlled = open !== undefined;\n const current = isControlled ? open : inner;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) {\n setInner(next);\n }\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange]\n );\n\n const baseId = useId();\n const triggerRef = useRef<HTMLElement | null>(null);\n\n const ctxValue: SheetContextValue = {\n open: current,\n setOpen,\n titleId: `${baseId}-title`,\n descriptionId: `${baseId}-description`,\n triggerRef,\n side,\n size,\n dismissible,\n };\n\n return <SheetContext.Provider value={ctxValue}>{children}</SheetContext.Provider>;\n};\n\n// ─── Trigger ──────────────────────────────────────────────────────────────────\n\nexport type SheetTriggerProps = {\n /** Render the child as the trigger (Slot pattern). @defaultValue true */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\nexport const SheetTrigger = ({ asChild = true, children, className, testID }: SheetTriggerProps) => {\n const ctx = useSheetContext('SheetTrigger');\n const onPress = useCallback(() => ctx.setOpen(true), [ctx]);\n\n if (asChild && isValidElement(children)) {\n const child = children as ReactElement<Record<string, unknown>>;\n const fire = (existing: ((e: unknown) => void) | undefined) => (event: unknown) => {\n existing?.(event);\n ctx.setOpen(true);\n };\n return (\n <Slot\n ref={(node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }}\n onClick={fire(child.props.onClick as ((e: unknown) => void) | undefined)}\n onPress={fire(child.props.onPress as ((e: unknown) => void) | undefined)}\n {...(testID !== undefined ? { 'data-testid': testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {child}\n </Slot>\n );\n }\n\n return (\n <Pressable\n ref={(node) => {\n ctx.triggerRef.current = node as unknown as HTMLElement | null;\n }}\n onPress={onPress}\n {...(testID !== undefined ? { testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {wrapStringChildren(children)}\n </Pressable>\n );\n};\n\n// ─── Header ───────────────────────────────────────────────────────────────────\n\nexport type SheetHeaderProps = { children?: ReactNode; className?: string };\n\nexport const SheetHeader = ({ children, className }: SheetHeaderProps) => {\n const colors = useThemeColors();\n return (\n <View\n className={cn('flex-col gap-1', className)}\n style={{\n flexDirection: 'column',\n gap: px(colors.spacing['1']),\n paddingHorizontal: px(colors.spacing['6']),\n paddingTop: px(colors.spacing['6']),\n paddingBottom: px(colors.spacing['2']),\n }}\n >\n {children}\n </View>\n );\n};\n\n// ─── Title ────────────────────────────────────────────────────────────────────\n\nexport type SheetTitleProps = { children?: ReactNode; className?: string };\n\nexport const SheetTitle = ({ children, className }: SheetTitleProps) => {\n const ctx = useSheetContext('SheetTitle');\n const colors = useThemeColors();\n return (\n <RNText\n nativeID={ctx.titleId}\n id={ctx.titleId}\n role=\"heading\"\n aria-level={2}\n className={cn('text-lg font-semibold text-semantic-text-default', className)}\n style={{\n color: colors.semantic.text.default,\n fontFamily: colors.fontFamily.display,\n fontSize: px(colors.fontSize.lg),\n fontWeight: colors.fontWeight.semibold as '600',\n }}\n >\n {children}\n </RNText>\n );\n};\n\n// ─── Description ─────────────────────────────────────────────────────────────\n\nexport type SheetDescriptionProps = { children?: ReactNode; className?: string };\n\nexport const SheetDescription = ({ children, className }: SheetDescriptionProps) => {\n const ctx = useSheetContext('SheetDescription');\n const colors = useThemeColors();\n return (\n <RNText\n nativeID={ctx.descriptionId}\n id={ctx.descriptionId}\n className={cn('text-sm text-semantic-text-muted', className)}\n style={{\n color: colors.semantic.text.muted,\n fontFamily: colors.fontFamily.body,\n fontSize: px(colors.fontSize.sm),\n lineHeight: px(colors.fontSize.sm) * Number(colors.lineHeight.normal),\n }}\n >\n {children}\n </RNText>\n );\n};\n\n// ─── Body ─────────────────────────────────────────────────────────────────────\n\nexport type SheetBodyProps = { children?: ReactNode; className?: string };\n\nexport const SheetBody = ({ children, className }: SheetBodyProps) => {\n const colors = useThemeColors();\n return (\n <View\n className={cn('flex-1', className)}\n style={{\n flex: 1,\n paddingHorizontal: px(colors.spacing['6']),\n paddingVertical: px(colors.spacing['4']),\n }}\n >\n {children}\n </View>\n );\n};\n\n// ─── Footer ───────────────────────────────────────────────────────────────────\n\nexport type SheetFooterProps = { children?: ReactNode; className?: string };\n\nexport const SheetFooter = ({ children, className }: SheetFooterProps) => {\n const colors = useThemeColors();\n return (\n <View\n className={cn('flex-row items-center justify-end gap-2', className)}\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-end',\n gap: px(colors.spacing['2']),\n paddingHorizontal: px(colors.spacing['6']),\n paddingBottom: px(colors.spacing['6']),\n paddingTop: px(colors.spacing['2']),\n }}\n >\n {children}\n </View>\n );\n};\n\n// ─── Close ────────────────────────────────────────────────────────────────────\n\nexport type SheetCloseProps = {\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n testID?: string;\n accessibilityLabel?: string;\n};\n\nexport const SheetClose = ({\n asChild = true,\n children,\n className,\n testID,\n accessibilityLabel = 'Close',\n}: SheetCloseProps) => {\n const ctx = useSheetContext('SheetClose');\n const onPress = useCallback(() => ctx.setOpen(false), [ctx]);\n\n if (asChild && isValidElement(children)) {\n const child = children as ReactElement<Record<string, unknown>>;\n const fire = (existing: ((e: unknown) => void) | undefined) => (event: unknown) => {\n existing?.(event);\n ctx.setOpen(false);\n };\n return (\n <Slot\n onClick={fire(child.props.onClick as ((e: unknown) => void) | undefined)}\n onPress={fire(child.props.onPress as ((e: unknown) => void) | undefined)}\n {...(testID !== undefined ? { 'data-testid': testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {child}\n </Slot>\n );\n }\n\n return (\n <Pressable\n onPress={onPress}\n role=\"button\"\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n aria-label={accessibilityLabel}\n {...(testID !== undefined ? { testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {wrapStringChildren(children)}\n </Pressable>\n );\n};\n\n// ─── Utilities ────────────────────────────────────────────────────────────────\n\nexport function wrapStringChildren(children: ReactNode): ReactNode {\n if (typeof children === 'string' || typeof children === 'number') {\n return <RNText>{children}</RNText>;\n }\n return children;\n}\n\nexport type SheetPanelProps = {\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n","'use client';\n\n/**\n * Sheet — default (native) implementation.\n *\n * Metro resolves `.native.tsx` over `.tsx` so on native builds, `Sheet.native.tsx`\n * wins. On web, `Sheet.web.tsx` wins. This file serves as the fallback for\n * environments that don't apply platform extensions (plain Node / jest node project).\n *\n * Shared context, types, and structural subcomponents live in `Sheet.shared.tsx`.\n * The `SheetPanel` here uses RN Modal with Platform.OS guards for web CSS\n * transitions and native slide animation.\n */\n\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Modal, Platform, Pressable } from 'react-native';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\nimport {\n SheetBody,\n SheetClose,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n type SheetPanelProps,\n SheetRoot,\n type SheetSide,\n SheetTitle,\n SheetTrigger,\n SIZE_PERCENT,\n useSheetContext,\n} from './Sheet.shared';\n\nexport {\n SheetBody,\n SheetClose,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n type SheetPanelProps,\n type SheetProps,\n type SheetSide,\n type SheetSize,\n SheetTitle,\n SheetTrigger,\n} from './Sheet.shared';\n\n// ─── Panel ────────────────────────────────────────────────────────────────────\n\nconst SCRIM_COLOR = 'rgba(0, 0, 0, 0.40)';\n\nconst FOCUSABLE_SELECTOR =\n 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nexport const SheetPanel = ({ children, className, testID }: SheetPanelProps) => {\n const ctx = useSheetContext('SheetPanel');\n const colors = useThemeColors();\n const panelRef = useRef<HTMLDivElement | null>(null);\n const overlayDomRef = useRef<HTMLElement | null>(null);\n\n const [entered, setEntered] = useState(false);\n\n useEffect(() => {\n if (Platform.OS !== 'web') {\n setEntered(true);\n return;\n }\n if (!ctx.open) {\n setEntered(false);\n return;\n }\n const id = requestAnimationFrame(() => setEntered(true));\n return () => cancelAnimationFrame(id);\n }, [ctx.open]);\n\n useEffect(() => {\n if (Platform.OS !== 'web') {\n return;\n }\n const node = overlayDomRef.current;\n if (!node) {\n return;\n }\n node.style.transitionProperty = 'background-color';\n node.style.transitionDuration = '200ms';\n node.style.transitionTimingFunction = 'ease-out';\n node.style.backgroundColor = entered ? SCRIM_COLOR : 'rgba(0,0,0,0)';\n }, [entered]);\n\n useEffect(() => {\n if (!ctx.open || Platform.OS !== 'web' || typeof document === 'undefined') {\n return;\n }\n const previouslyFocused = document.activeElement as HTMLElement | null;\n const prevBodyOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n\n const focusFirst = () => {\n const node = panelRef.current;\n if (!node) {\n return;\n }\n const focusable = node.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR);\n const first = focusable[0];\n if (first) {\n first.focus();\n } else {\n node.setAttribute('tabindex', '-1');\n node.focus();\n }\n };\n focusFirst();\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n ctx.setOpen(false);\n return;\n }\n if (event.key !== 'Tab') {\n return;\n }\n const node = panelRef.current;\n if (!node) {\n return;\n }\n const focusable = Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).filter(\n (el) => el.offsetParent !== null || el === document.activeElement\n );\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (!first || !last) {\n return;\n }\n if (event.shiftKey) {\n if (document.activeElement === first || !node.contains(document.activeElement)) {\n event.preventDefault();\n last.focus();\n }\n } else if (document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n document.body.style.overflow = prevBodyOverflow;\n const restoreTo = ctx.triggerRef.current ?? previouslyFocused;\n restoreTo?.focus?.();\n };\n }, [ctx.open, ctx.setOpen, ctx.triggerRef]);\n\n const onBackdropPress = useCallback(() => {\n if (ctx.dismissible) {\n ctx.setOpen(false);\n }\n }, [ctx]);\n\n const isHorizontal = ctx.side === 'left' || ctx.side === 'right';\n const dim = typeof ctx.size === 'number' ? ctx.size : SIZE_PERCENT[ctx.size];\n\n const panelStyle: ViewStyle = {\n position: 'absolute',\n backgroundColor: colors.semantic.background.elevated,\n ...(isHorizontal ? { top: 0, bottom: 0 } : { left: 0, right: 0 }),\n ...(ctx.side === 'bottom' && { bottom: 0 }),\n ...(ctx.side === 'top' && { top: 0 }),\n ...(ctx.side === 'left' && { left: 0 }),\n ...(ctx.side === 'right' && { right: 0 }),\n };\n\n const translateStyle: ViewStyle =\n Platform.OS === 'web'\n ? ({\n transform: entered ? 'translateX(0) translateY(0)' : translateOffscreen(ctx.side),\n transitionProperty: 'transform',\n transitionDuration: '280ms',\n transitionTimingFunction: 'cubic-bezier(0.16, 1, 0.3, 1)',\n } as unknown as ViewStyle)\n : {};\n\n const overlayStyle: ViewStyle = {\n position: Platform.OS === 'web' ? ('fixed' as unknown as 'absolute') : 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n ...(Platform.OS === 'web' ? ({ zIndex: 50 } as ViewStyle) : { backgroundColor: SCRIM_COLOR }),\n };\n\n const sizeStyle = isHorizontal\n ? { width: dim, height: '100%' as unknown as number }\n : { height: dim, width: '100%' as unknown as number };\n\n return (\n <Modal\n visible={ctx.open}\n transparent\n animationType={\n Platform.OS === 'web' ? 'none' : ctx.side === 'bottom' || ctx.side === 'top' ? 'slide' : 'fade'\n }\n onRequestClose={() => ctx.setOpen(false)}\n >\n <Pressable\n accessibilityRole=\"none\"\n aria-hidden={true}\n ref={(node) => {\n overlayDomRef.current = node as unknown as HTMLElement | null;\n }}\n style={overlayStyle}\n onPress={onBackdropPress}\n >\n <Pressable\n onPress={(event) => event.stopPropagation?.()}\n ref={(node) => {\n panelRef.current = node as unknown as HTMLDivElement | null;\n }}\n role=\"dialog\"\n accessibilityRole=\"none\"\n aria-modal={true}\n aria-labelledby={ctx.titleId}\n aria-describedby={ctx.descriptionId}\n data-side={ctx.side}\n {...(testID !== undefined ? { testID } : {})}\n className={cn('bg-semantic-background-elevated', className)}\n style={[\n panelStyle,\n sizeStyle as ViewStyle,\n translateStyle,\n {\n shadowColor: '#000',\n shadowOffset: { width: 0, height: -2 },\n shadowOpacity: 0.15,\n shadowRadius: 20,\n elevation: 24,\n ...(ctx.side === 'bottom' ? { borderTopLeftRadius: 16, borderTopRightRadius: 16 } : {}),\n ...(ctx.side === 'top' ? { borderBottomLeftRadius: 16, borderBottomRightRadius: 16 } : {}),\n },\n ]}\n >\n {children}\n </Pressable>\n </Pressable>\n </Modal>\n );\n};\n\n// ─── Compound export ──────────────────────────────────────────────────────────\n\nexport const Sheet = Object.assign(SheetRoot, {\n Trigger: SheetTrigger,\n Panel: SheetPanel,\n Header: SheetHeader,\n Title: SheetTitle,\n Description: SheetDescription,\n Body: SheetBody,\n Footer: SheetFooter,\n Close: SheetClose,\n});\n\nexport const Drawer = Sheet;\n\n// ─── Helpers ──────────────────────────────────────────────────────────────────\n\nfunction translateOffscreen(side: SheetSide): string {\n switch (side) {\n case 'bottom':\n return 'translateY(100%)';\n case 'top':\n return 'translateY(-100%)';\n case 'left':\n return 'translateX(-100%)';\n case 'right':\n return 'translateX(100%)';\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { AnimatedView } from './chunk-RGJ3NBKE.js';
2
1
  import { useAnimatedNumber } from './chunk-RB3YBWQ4.js';
2
+ import { AnimatedView } from './chunk-RGJ3NBKE.js';
3
3
  import { Slot } from './chunk-ZIBNLXIV.js';
4
4
  import { cn } from './chunk-CHXHRJNZ.js';
5
5
  import { px } from './chunk-5A2QOOVN.js';
@@ -179,5 +179,5 @@ var Switch = /* @__PURE__ */ __name(({
179
179
  }, "Switch");
180
180
 
181
181
  export { Switch };
182
- //# sourceMappingURL=chunk-SJZTETUT.js.map
183
- //# sourceMappingURL=chunk-SJZTETUT.js.map
182
+ //# sourceMappingURL=chunk-VMAGFYHG.js.map
183
+ //# sourceMappingURL=chunk-VMAGFYHG.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Switch/Switch.tsx"],"names":["RNText"],"mappings":";;;;;;;;;;;AA0CA,IAAM,eAAA,GAA6B,EAAE,aAAA,EAAe,KAAA,EAAO,YAAY,QAAA,EAAS;AAGhF,IAAM,UAAA,GAAwB;AAAA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K,OAAA;AAAA,cAC5B,UAAA,EAAY,OAAO,UAAA,CAAW,IAAA;AAAA,cAC9B,QAAA,EAAU,EAAA,CAAG,MAAA,CAAO,QAAA,CAAS,EAAE;AAAA,aACnC;AAAA,YAEC,QAAA,EAAA;AAAA;AAAA,SACL,GACA,IAAA;AAAA,QACH;AAAA;AAAA;AAAA,GACL;AAER,CAAA,EApLsB,QAAA","file":"chunk-SJZTETUT.js","sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { useCallback, useState } from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Pressable, Text as RNText, View } from 'react-native';\nimport { AnimatedView } from '../../animation/animated-view';\nimport { useAnimatedNumber } from '../../animation/use-animated-number';\nimport { Slot } from '../../slot';\nimport { px } from '../../theme/px';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\n\nexport type SwitchProps = {\n checked?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n onChange?: (next: boolean) => void;\n label?: string;\n className?: string;\n testID?: string;\n asChild?: boolean;\n children?: ReactNode;\n /** DOM id / nativeID forwarded to the Pressable — used by Field.Control */\n id?: string;\n /** HTML name attribute (web only) */\n name?: string;\n /** aria-labelledby forwarded to the Pressable */\n 'aria-labelledby'?: string;\n /** React Native accessibilityLabelledBy forwarded to the Pressable */\n accessibilityLabelledBy?: string;\n /** aria-describedby forwarded to the Pressable */\n 'aria-describedby'?: string;\n /** React Native accessibilityDescribedBy forwarded to the Pressable */\n accessibilityDescribedBy?: string;\n /** Marks the control as invalid — set by Field.Control when there is an error */\n 'aria-invalid'?: boolean;\n /** Marks the control as required — set by Field.Control */\n 'aria-required'?: boolean;\n};\n\n// Layout-only base; row gap is theme-driven inside the component.\nconst ROW_LAYOUT_BASE: ViewStyle = { flexDirection: 'row', alignItems: 'center' };\n// Switch track + thumb are tightly coupled — width 40, height 24, thumb\n// 20×20, travel 18px. Component-density literals — not from theme.\nconst TRACK_BASE: ViewStyle = {\n width: 40,\n height: 24,\n borderRadius: 12,\n // Relative so the absolutely-positioned thumb anchors against the\n // track (not the page). The thumb's `left` value transitions between\n // 2 (off) and 18 (on) — see thumb style below.\n position: 'relative',\n};\nconst THUMB_BASE_STYLE: ViewStyle = {\n width: 20,\n height: 20,\n borderRadius: 10,\n // Web: boxShadow (the modern CSS-style replacement for the legacy RN\n // `shadow*` props that react-native-web has deprecated).\n // Native: elevation (Android) — RN ignores boxShadow there.\n ...({ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.15)' } as ViewStyle),\n elevation: 2,\n};\n\n/**\n * Switch — a toggle control with role=\"switch\". Supports controlled + uncontrolled,\n * disabled state, asChild (via Slot), and a visible label that doubles as the\n * accessibility label.\n */\nexport const Switch = ({\n checked,\n defaultChecked = false,\n disabled,\n onChange,\n label,\n className,\n testID,\n asChild,\n children,\n id,\n name,\n 'aria-labelledby': ariaLabelledBy,\n accessibilityLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n accessibilityDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n}: SwitchProps) => {\n const colors = useThemeColors();\n const [inner, setInner] = useState<boolean>(defaultChecked);\n const isControlled = checked !== undefined;\n const value = isControlled ? Boolean(checked) : inner;\n // Pulled up here (above the asChild early-return) so the hook is\n // called on every render path, not conditionally. The slide isn't\n // used in the asChild branch, but the wasted work is tiny.\n const slide = useAnimatedNumber('left', value ? 18 : 2);\n\n const toggle = useCallback(() => {\n if (disabled) {\n return;\n }\n const next = !value;\n if (!isControlled) {\n setInner(next);\n }\n onChange?.(next);\n }, [disabled, value, isControlled, onChange]);\n\n const ariaChecked: 'true' | 'false' = value ? 'true' : 'false';\n\n const commonProps: Record<string, unknown> = {\n role: 'switch',\n 'aria-checked': ariaChecked,\n accessibilityRole: 'switch' as const,\n accessibilityState: { checked: value, disabled: Boolean(disabled) },\n testID,\n };\n if (id !== undefined) {\n commonProps.id = id;\n commonProps.nativeID = id;\n }\n if (name !== undefined) {\n commonProps.name = name;\n }\n if (disabled) {\n commonProps['aria-disabled'] = true;\n }\n if (label !== undefined) {\n commonProps['aria-label'] = label;\n commonProps.accessibilityLabel = label;\n }\n if (ariaLabelledBy !== undefined) {\n commonProps['aria-labelledby'] = ariaLabelledBy;\n commonProps.accessibilityLabelledBy = ariaLabelledBy;\n }\n if (accessibilityLabelledBy !== undefined) {\n commonProps.accessibilityLabelledBy = accessibilityLabelledBy;\n }\n if (ariaDescribedBy !== undefined) {\n commonProps['aria-describedby'] = ariaDescribedBy;\n commonProps.accessibilityDescribedBy = ariaDescribedBy;\n }\n if (accessibilityDescribedBy !== undefined) {\n commonProps.accessibilityDescribedBy = accessibilityDescribedBy;\n }\n if (ariaInvalid) {\n commonProps['aria-invalid'] = true;\n }\n if (ariaRequired) {\n commonProps['aria-required'] = true;\n }\n\n if (asChild) {\n const slotProps: Record<string, unknown> = {\n role: 'switch',\n 'aria-checked': ariaChecked,\n onClick: toggle,\n };\n if (disabled) {\n slotProps['aria-disabled'] = true;\n }\n if (label !== undefined) {\n slotProps['aria-label'] = label;\n }\n if (testID !== undefined) {\n slotProps['data-testid'] = testID;\n }\n if (className !== undefined) {\n slotProps.className = className;\n }\n return <Slot {...slotProps}>{children}</Slot>;\n }\n\n const trackClasses = cn(\n 'w-10 h-6 rounded-full justify-center px-0.5 transition-colors',\n value ? 'bg-semantic-interactive-primary' : 'bg-neutral-300 dark:bg-neutral-700',\n disabled ? 'opacity-60' : undefined\n );\n // Position is set inline below (absolute + animated `left`), so no\n // self-start/self-end classes here — they'd fight the inline position.\n const thumbClasses = cn('w-5 h-5 rounded-full bg-white dark:bg-neutral-100 shadow-sm');\n\n const trackStyle = [\n TRACK_BASE,\n {\n backgroundColor: value ? colors.semantic.interactive.primary : colors.color.neutral['600'],\n // Subtle 180ms color transition between off → on. Web only;\n // native has no equivalent for the track tint in v1.\n ...({ transitionProperty: 'background-color', transitionDuration: '180ms' } as ViewStyle),\n },\n disabled ? { opacity: 0.6 } : null,\n ];\n // Thumb stays a near-white disc — we deliberately don't go to a dark\n // grey on dark mode because the thumb needs to read as the \"moveable\n // puck\" against the track in both schemes.\n //\n // Animation: thumb slides between left:2 (off) and left:18 (on) —\n // track width 40 - padding 2 - thumb 20 = 18 px travel. The\n // useAnimatedNumber hook picks the right engine per platform (web\n // CSS transition / reanimated spring / RN Animated). The hook is\n // called once at the top of the function — see the `slide` above.\n const thumbStyle = [\n THUMB_BASE_STYLE,\n {\n backgroundColor: colors.color.neutral['50'],\n position: 'absolute' as const,\n top: 2,\n } as ViewStyle,\n slide as ViewStyle,\n ];\n\n // Whole-row Pressable so clicking the label toggles the switch. The\n // visible track is a non-interactive View — one role=\"switch\" per\n // logical control, not two competing hit-areas.\n const rowStyle: ViewStyle = { ...ROW_LAYOUT_BASE, gap: px(colors.spacing['2']) };\n\n return (\n <Pressable\n onPress={toggle}\n {...commonProps}\n className={cn('flex-row items-center gap-2', className)}\n style={rowStyle}\n >\n <View className={trackClasses} style={trackStyle}>\n {/*\n * Animated.View — the slide style fragment from\n * `useAnimatedNumber` contains an `Animated.Value` on\n * native; a plain `View` would render the value as 0\n * (no animation). On web, the same fragment is plain\n * CSS and `Animated.View` falls through to a regular\n * div via react-native-web.\n */}\n <AnimatedView className={thumbClasses} style={thumbStyle} />\n </View>\n {label ? (\n <RNText\n className=\"text-md text-semantic-text-default\"\n style={{\n color: colors.semantic.text.default,\n fontFamily: colors.fontFamily.body,\n fontSize: px(colors.fontSize.md),\n }}\n >\n {label}\n </RNText>\n ) : null}\n {children}\n </Pressable>\n );\n};\n"]}
1
+ {"version":3,"sources":["../src/components/Switch/Switch.tsx"],"names":["RNText"],"mappings":";;;;;;;;;;;AA0CA,IAAM,eAAA,GAA6B,EAAE,aAAA,EAAe,KAAA,EAAO,YAAY,QAAA,EAAS;AAGhF,IAAM,UAAA,GAAwB;AAAA,EAC1B,KAAA,EAAO,EAAA;AAAA,EACP,MAAA,EAAQ,EAAA;AAAA,EACR,YAAA,EAAc,EAAA;AAAA;AA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,MAAA,CAAO,QAAA,CAAS,EAAE;AAAA,aACnC;AAAA,YAEC,QAAA,EAAA;AAAA;AAAA,SACL,GACA,IAAA;AAAA,QACH;AAAA;AAAA;AAAA,GACL;AAER,CAAA,EApLsB,QAAA","file":"chunk-VMAGFYHG.js","sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { useCallback, useState } from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Pressable, Text as RNText, View } from 'react-native';\nimport { AnimatedView } from '../../animation/animated-view';\nimport { useAnimatedNumber } from '../../animation/use-animated-number';\nimport { Slot } from '../../slot';\nimport { px } from '../../theme/px';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\n\nexport type SwitchProps = {\n checked?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n onChange?: (next: boolean) => void;\n label?: string;\n className?: string;\n testID?: string;\n asChild?: boolean;\n children?: ReactNode;\n /** DOM id / nativeID forwarded to the Pressable — used by Field.Control */\n id?: string;\n /** HTML name attribute (web only) */\n name?: string;\n /** aria-labelledby forwarded to the Pressable */\n 'aria-labelledby'?: string;\n /** React Native accessibilityLabelledBy forwarded to the Pressable */\n accessibilityLabelledBy?: string;\n /** aria-describedby forwarded to the Pressable */\n 'aria-describedby'?: string;\n /** React Native accessibilityDescribedBy forwarded to the Pressable */\n accessibilityDescribedBy?: string;\n /** Marks the control as invalid — set by Field.Control when there is an error */\n 'aria-invalid'?: boolean;\n /** Marks the control as required — set by Field.Control */\n 'aria-required'?: boolean;\n};\n\n// Layout-only base; row gap is theme-driven inside the component.\nconst ROW_LAYOUT_BASE: ViewStyle = { flexDirection: 'row', alignItems: 'center' };\n// Switch track + thumb are tightly coupled — width 40, height 24, thumb\n// 20×20, travel 18px. Component-density literals — not from theme.\nconst TRACK_BASE: ViewStyle = {\n width: 40,\n height: 24,\n borderRadius: 12,\n // Relative so the absolutely-positioned thumb anchors against the\n // track (not the page). The thumb's `left` value transitions between\n // 2 (off) and 18 (on) — see thumb style below.\n position: 'relative',\n};\nconst THUMB_BASE_STYLE: ViewStyle = {\n width: 20,\n height: 20,\n borderRadius: 10,\n // Web: boxShadow (the modern CSS-style replacement for the legacy RN\n // `shadow*` props that react-native-web has deprecated).\n // Native: elevation (Android) — RN ignores boxShadow there.\n ...({ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.15)' } as ViewStyle),\n elevation: 2,\n};\n\n/**\n * Switch — a toggle control with role=\"switch\". Supports controlled + uncontrolled,\n * disabled state, asChild (via Slot), and a visible label that doubles as the\n * accessibility label.\n */\nexport const Switch = ({\n checked,\n defaultChecked = false,\n disabled,\n onChange,\n label,\n className,\n testID,\n asChild,\n children,\n id,\n name,\n 'aria-labelledby': ariaLabelledBy,\n accessibilityLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n accessibilityDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n}: SwitchProps) => {\n const colors = useThemeColors();\n const [inner, setInner] = useState<boolean>(defaultChecked);\n const isControlled = checked !== undefined;\n const value = isControlled ? Boolean(checked) : inner;\n // Pulled up here (above the asChild early-return) so the hook is\n // called on every render path, not conditionally. The slide isn't\n // used in the asChild branch, but the wasted work is tiny.\n const slide = useAnimatedNumber('left', value ? 18 : 2);\n\n const toggle = useCallback(() => {\n if (disabled) {\n return;\n }\n const next = !value;\n if (!isControlled) {\n setInner(next);\n }\n onChange?.(next);\n }, [disabled, value, isControlled, onChange]);\n\n const ariaChecked: 'true' | 'false' = value ? 'true' : 'false';\n\n const commonProps: Record<string, unknown> = {\n role: 'switch',\n 'aria-checked': ariaChecked,\n accessibilityRole: 'switch' as const,\n accessibilityState: { checked: value, disabled: Boolean(disabled) },\n testID,\n };\n if (id !== undefined) {\n commonProps.id = id;\n commonProps.nativeID = id;\n }\n if (name !== undefined) {\n commonProps.name = name;\n }\n if (disabled) {\n commonProps['aria-disabled'] = true;\n }\n if (label !== undefined) {\n commonProps['aria-label'] = label;\n commonProps.accessibilityLabel = label;\n }\n if (ariaLabelledBy !== undefined) {\n commonProps['aria-labelledby'] = ariaLabelledBy;\n commonProps.accessibilityLabelledBy = ariaLabelledBy;\n }\n if (accessibilityLabelledBy !== undefined) {\n commonProps.accessibilityLabelledBy = accessibilityLabelledBy;\n }\n if (ariaDescribedBy !== undefined) {\n commonProps['aria-describedby'] = ariaDescribedBy;\n commonProps.accessibilityDescribedBy = ariaDescribedBy;\n }\n if (accessibilityDescribedBy !== undefined) {\n commonProps.accessibilityDescribedBy = accessibilityDescribedBy;\n }\n if (ariaInvalid) {\n commonProps['aria-invalid'] = true;\n }\n if (ariaRequired) {\n commonProps['aria-required'] = true;\n }\n\n if (asChild) {\n const slotProps: Record<string, unknown> = {\n role: 'switch',\n 'aria-checked': ariaChecked,\n onClick: toggle,\n };\n if (disabled) {\n slotProps['aria-disabled'] = true;\n }\n if (label !== undefined) {\n slotProps['aria-label'] = label;\n }\n if (testID !== undefined) {\n slotProps['data-testid'] = testID;\n }\n if (className !== undefined) {\n slotProps.className = className;\n }\n return <Slot {...slotProps}>{children}</Slot>;\n }\n\n const trackClasses = cn(\n 'w-10 h-6 rounded-full justify-center px-0.5 transition-colors',\n value ? 'bg-semantic-interactive-primary' : 'bg-neutral-300 dark:bg-neutral-700',\n disabled ? 'opacity-60' : undefined\n );\n // Position is set inline below (absolute + animated `left`), so no\n // self-start/self-end classes here — they'd fight the inline position.\n const thumbClasses = cn('w-5 h-5 rounded-full bg-white dark:bg-neutral-100 shadow-sm');\n\n const trackStyle = [\n TRACK_BASE,\n {\n backgroundColor: value ? colors.semantic.interactive.primary : colors.color.neutral['600'],\n // Subtle 180ms color transition between off → on. Web only;\n // native has no equivalent for the track tint in v1.\n ...({ transitionProperty: 'background-color', transitionDuration: '180ms' } as ViewStyle),\n },\n disabled ? { opacity: 0.6 } : null,\n ];\n // Thumb stays a near-white disc — we deliberately don't go to a dark\n // grey on dark mode because the thumb needs to read as the \"moveable\n // puck\" against the track in both schemes.\n //\n // Animation: thumb slides between left:2 (off) and left:18 (on) —\n // track width 40 - padding 2 - thumb 20 = 18 px travel. The\n // useAnimatedNumber hook picks the right engine per platform (web\n // CSS transition / reanimated spring / RN Animated). The hook is\n // called once at the top of the function — see the `slide` above.\n const thumbStyle = [\n THUMB_BASE_STYLE,\n {\n backgroundColor: colors.color.neutral['50'],\n position: 'absolute' as const,\n top: 2,\n } as ViewStyle,\n slide as ViewStyle,\n ];\n\n // Whole-row Pressable so clicking the label toggles the switch. The\n // visible track is a non-interactive View — one role=\"switch\" per\n // logical control, not two competing hit-areas.\n const rowStyle: ViewStyle = { ...ROW_LAYOUT_BASE, gap: px(colors.spacing['2']) };\n\n return (\n <Pressable\n onPress={toggle}\n {...commonProps}\n className={cn('flex-row items-center gap-2', className)}\n style={rowStyle}\n >\n <View className={trackClasses} style={trackStyle}>\n {/*\n * Animated.View — the slide style fragment from\n * `useAnimatedNumber` contains an `Animated.Value` on\n * native; a plain `View` would render the value as 0\n * (no animation). On web, the same fragment is plain\n * CSS and `Animated.View` falls through to a regular\n * div via react-native-web.\n */}\n <AnimatedView className={thumbClasses} style={thumbStyle} />\n </View>\n {label ? (\n <RNText\n className=\"text-md text-semantic-text-default\"\n style={{\n color: colors.semantic.text.default,\n fontFamily: colors.fontFamily.body,\n fontSize: px(colors.fontSize.md),\n }}\n >\n {label}\n </RNText>\n ) : null}\n {children}\n </Pressable>\n );\n};\n"]}
@@ -1,5 +1,5 @@
1
- import { AnimatedView } from './chunk-RGJ3NBKE.js';
2
1
  import { useAnimatedNumber } from './chunk-RB3YBWQ4.js';
2
+ import { AnimatedView } from './chunk-RGJ3NBKE.js';
3
3
  import { defaultSemanticIcons } from './chunk-7Z4NMNX6.js';
4
4
  import { cn } from './chunk-CHXHRJNZ.js';
5
5
  import { px } from './chunk-5A2QOOVN.js';
@@ -446,5 +446,5 @@ var Accordion = Object.assign(AccordionRoot, {
446
446
  });
447
447
 
448
448
  export { Accordion };
449
- //# sourceMappingURL=chunk-OCHEPOOO.js.map
450
- //# sourceMappingURL=chunk-OCHEPOOO.js.map
449
+ //# sourceMappingURL=chunk-Y4ZRSW35.js.map
450
+ //# sourceMappingURL=chunk-Y4ZRSW35.js.map