@nori-ui/core 1.2.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.
Files changed (56) hide show
  1. package/dist/chunk-2PESUXE3.js +3 -0
  2. package/dist/chunk-2PESUXE3.js.map +1 -0
  3. package/dist/{chunk-WDNDTSNX.js → chunk-4I37QSEM.js} +3 -3
  4. package/dist/{chunk-WDNDTSNX.js.map → chunk-4I37QSEM.js.map} +1 -1
  5. package/dist/chunk-BNDUQNG7.js +443 -0
  6. package/dist/chunk-BNDUQNG7.js.map +1 -0
  7. package/dist/chunk-H7MFAFV4.js +303 -0
  8. package/dist/chunk-H7MFAFV4.js.map +1 -0
  9. package/dist/chunk-KCLWPSV5.js +134 -0
  10. package/dist/chunk-KCLWPSV5.js.map +1 -0
  11. package/dist/{chunk-7D2BHQ6M.js → chunk-L5X4SYJ4.js} +3 -3
  12. package/dist/chunk-L5X4SYJ4.js.map +1 -0
  13. package/dist/{chunk-XBNVKPJN.js → chunk-XXBN6CIK.js} +3 -3
  14. package/dist/{chunk-XBNVKPJN.js.map → chunk-XXBN6CIK.js.map} +1 -1
  15. package/dist/chunk-ZPUYNM37.js +3 -0
  16. package/dist/chunk-ZPUYNM37.js.map +1 -0
  17. package/dist/client.cjs +879 -21
  18. package/dist/client.cjs.map +1 -1
  19. package/dist/client.d.cts +4 -1
  20. package/dist/client.d.ts +4 -1
  21. package/dist/client.js +18 -13
  22. package/dist/client.js.map +1 -1
  23. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  24. package/dist/components/Breadcrumb/index.js +3 -2
  25. package/dist/components/ContextMenu/index.cjs +1150 -0
  26. package/dist/components/ContextMenu/index.cjs.map +1 -0
  27. package/dist/components/ContextMenu/index.d.cts +38 -0
  28. package/dist/components/ContextMenu/index.d.ts +38 -0
  29. package/dist/components/ContextMenu/index.js +10 -0
  30. package/dist/components/ContextMenu/index.js.map +1 -0
  31. package/dist/components/DatePicker/index.cjs.map +1 -1
  32. package/dist/components/DatePicker/index.js +3 -2
  33. package/dist/components/DropdownMenu/index.cjs +1032 -0
  34. package/dist/components/DropdownMenu/index.cjs.map +1 -0
  35. package/dist/components/DropdownMenu/index.d.cts +97 -0
  36. package/dist/components/DropdownMenu/index.d.ts +97 -0
  37. package/dist/components/DropdownMenu/index.js +10 -0
  38. package/dist/components/DropdownMenu/index.js.map +1 -0
  39. package/dist/components/Popover/index.cjs +1 -0
  40. package/dist/components/Popover/index.cjs.map +1 -1
  41. package/dist/components/Popover/index.d.cts +22 -1
  42. package/dist/components/Popover/index.d.ts +22 -1
  43. package/dist/components/Popover/index.js +2 -1
  44. package/dist/components/Sheet/index.cjs +855 -0
  45. package/dist/components/Sheet/index.cjs.map +1 -0
  46. package/dist/components/Sheet/index.d.cts +104 -0
  47. package/dist/components/Sheet/index.d.ts +104 -0
  48. package/dist/components/Sheet/index.js +8 -0
  49. package/dist/components/Sheet/index.js.map +1 -0
  50. package/dist/index.cjs +879 -21
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.cts +4 -1
  53. package/dist/index.d.ts +4 -1
  54. package/dist/index.js +18 -13
  55. package/package.json +1 -1
  56. package/dist/chunk-7D2BHQ6M.js.map +0 -1
@@ -0,0 +1,855 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var reactNative = require('react-native');
5
+ var jsxRuntime = require('nativewind/jsx-runtime');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+
10
+ // ../tokens/build/theme.ts
11
+ var theme = {
12
+ color: {
13
+ danger: "#ef4444",
14
+ info: "#3b82f6",
15
+ neutral: {
16
+ "100": "#f4f4f5",
17
+ "200": "#e4e4e7",
18
+ "300": "#d4d4d8",
19
+ "400": "#a1a1aa",
20
+ "50": "#fafafa",
21
+ "500": "#71717a",
22
+ "600": "#52525b",
23
+ "700": "#3f3f46",
24
+ "800": "#27272a",
25
+ "900": "#18181b"
26
+ },
27
+ primary: {
28
+ "100": "#ccfbf1",
29
+ "200": "#99f6e4",
30
+ "300": "#5eead4",
31
+ "400": "#2dd4bf",
32
+ "50": "#f0fdfa",
33
+ "500": "#14b8a6",
34
+ "600": "#0d9488",
35
+ "700": "#0f766e",
36
+ "800": "#115e59",
37
+ "900": "#134e4a"
38
+ },
39
+ success: "#22c55e",
40
+ warning: "#f59e0b"
41
+ },
42
+ fontFamily: {
43
+ body: "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
44
+ display: "ui-serif, Georgia, 'Times New Roman', serif",
45
+ mono: "ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
46
+ },
47
+ fontSize: {
48
+ "2xl": "24px",
49
+ "3xl": "30px",
50
+ "4xl": "36px",
51
+ lg: "18px",
52
+ md: "16px",
53
+ sm: "14px",
54
+ xl: "20px",
55
+ xs: "12px"
56
+ },
57
+ fontWeight: {
58
+ bold: "700",
59
+ medium: "500",
60
+ regular: "400",
61
+ semibold: "600"
62
+ },
63
+ lineHeight: {
64
+ normal: "1.4",
65
+ relaxed: "1.6",
66
+ tight: "1.2"
67
+ },
68
+ radius: {
69
+ "2xl": "16px",
70
+ full: "9999px",
71
+ lg: "8px",
72
+ md: "6px",
73
+ none: "0px",
74
+ sm: "4px",
75
+ xl: "12px"
76
+ },
77
+ semantic: {
78
+ background: {
79
+ default: "#fafafa",
80
+ elevated: "#ffffff",
81
+ subtle: "#f4f4f5"
82
+ },
83
+ border: {
84
+ default: "#e4e4e7",
85
+ strong: "#d4d4d8"
86
+ },
87
+ interactive: {
88
+ destructive: "#ef4444",
89
+ primary: "#0d9488",
90
+ primaryHover: "#0f766e",
91
+ primaryPressed: "#115e59"
92
+ },
93
+ text: {
94
+ default: "#18181b",
95
+ inverted: "#fafafa",
96
+ muted: "#52525b"
97
+ }
98
+ },
99
+ shadow: {
100
+ lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",
101
+ md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",
102
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)"
103
+ },
104
+ spacing: {
105
+ "0": "0px",
106
+ "1": "4px",
107
+ "10": "40px",
108
+ "12": "48px",
109
+ "16": "64px",
110
+ "2": "8px",
111
+ "20": "80px",
112
+ "24": "96px",
113
+ "3": "12px",
114
+ "4": "16px",
115
+ "5": "20px",
116
+ "6": "24px",
117
+ "8": "32px"
118
+ }
119
+ };
120
+ var themeDark = {
121
+ color: {
122
+ danger: "#ef4444",
123
+ info: "#3b82f6",
124
+ neutral: {
125
+ "100": "#f4f4f5",
126
+ "200": "#e4e4e7",
127
+ "300": "#d4d4d8",
128
+ "400": "#a1a1aa",
129
+ "50": "#fafafa",
130
+ "500": "#71717a",
131
+ "600": "#52525b",
132
+ "700": "#3f3f46",
133
+ "800": "#27272a",
134
+ "900": "#18181b"
135
+ },
136
+ primary: {
137
+ "100": "#ccfbf1",
138
+ "200": "#99f6e4",
139
+ "300": "#5eead4",
140
+ "400": "#2dd4bf",
141
+ "50": "#f0fdfa",
142
+ "500": "#14b8a6",
143
+ "600": "#0d9488",
144
+ "700": "#0f766e",
145
+ "800": "#115e59",
146
+ "900": "#134e4a"
147
+ },
148
+ success: "#22c55e",
149
+ warning: "#f59e0b"
150
+ },
151
+ fontFamily: {
152
+ body: "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
153
+ display: "ui-serif, Georgia, 'Times New Roman', serif",
154
+ mono: "ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
155
+ },
156
+ fontSize: {
157
+ "2xl": "24px",
158
+ "3xl": "30px",
159
+ "4xl": "36px",
160
+ lg: "18px",
161
+ md: "16px",
162
+ sm: "14px",
163
+ xl: "20px",
164
+ xs: "12px"
165
+ },
166
+ fontWeight: {
167
+ bold: "700",
168
+ medium: "500",
169
+ regular: "400",
170
+ semibold: "600"
171
+ },
172
+ lineHeight: {
173
+ normal: "1.4",
174
+ relaxed: "1.6",
175
+ tight: "1.2"
176
+ },
177
+ radius: {
178
+ "2xl": "16px",
179
+ full: "9999px",
180
+ lg: "8px",
181
+ md: "6px",
182
+ none: "0px",
183
+ sm: "4px",
184
+ xl: "12px"
185
+ },
186
+ semantic: {
187
+ background: {
188
+ default: "#18181b",
189
+ elevated: "#3f3f46",
190
+ subtle: "#27272a"
191
+ },
192
+ border: {
193
+ default: "#3f3f46",
194
+ strong: "#52525b"
195
+ },
196
+ interactive: {
197
+ destructive: "#ef4444",
198
+ primary: "#2dd4bf",
199
+ primaryHover: "#5eead4",
200
+ primaryPressed: "#99f6e4"
201
+ },
202
+ text: {
203
+ default: "#fafafa",
204
+ inverted: "#18181b",
205
+ muted: "#a1a1aa"
206
+ }
207
+ },
208
+ shadow: {
209
+ lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",
210
+ md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",
211
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)"
212
+ },
213
+ spacing: {
214
+ "0": "0px",
215
+ "1": "4px",
216
+ "10": "40px",
217
+ "12": "48px",
218
+ "16": "64px",
219
+ "2": "8px",
220
+ "20": "80px",
221
+ "24": "96px",
222
+ "3": "12px",
223
+ "4": "16px",
224
+ "5": "20px",
225
+ "6": "24px",
226
+ "8": "32px"
227
+ }
228
+ };
229
+ var defaultTheme = {
230
+ light: theme,
231
+ dark: themeDark
232
+ };
233
+ var ThemeContext = react.createContext(defaultTheme);
234
+ ThemeContext.displayName = "ThemeContext";
235
+ var ColorSchemeOverrideContext = react.createContext(null);
236
+ ColorSchemeOverrideContext.displayName = "ColorSchemeOverrideContext";
237
+ var isWeb = reactNative.Platform.OS === "web";
238
+ function readWebScheme() {
239
+ if (typeof document === "undefined") {
240
+ return "light";
241
+ }
242
+ const root = document.documentElement;
243
+ if (root.classList.contains("dark")) {
244
+ return "dark";
245
+ }
246
+ if (root.getAttribute("data-theme") === "dark") {
247
+ return "dark";
248
+ }
249
+ return "light";
250
+ }
251
+ __name(readWebScheme, "readWebScheme");
252
+ function useColorScheme() {
253
+ const override = react.useContext(ColorSchemeOverrideContext);
254
+ const [scheme, setScheme] = react.useState(() => {
255
+ if (isWeb) {
256
+ return readWebScheme();
257
+ }
258
+ return reactNative.Appearance.getColorScheme() ?? "light";
259
+ });
260
+ react.useEffect(() => {
261
+ if (isWeb) {
262
+ const root = document.documentElement;
263
+ const update = /* @__PURE__ */ __name(() => setScheme(readWebScheme()), "update");
264
+ const observer = new MutationObserver(update);
265
+ observer.observe(root, { attributes: true, attributeFilter: ["class", "data-theme"] });
266
+ update();
267
+ return () => observer.disconnect();
268
+ }
269
+ const sub = reactNative.Appearance.addChangeListener(({ colorScheme }) => {
270
+ setScheme(colorScheme ?? "light");
271
+ });
272
+ return () => sub.remove();
273
+ }, []);
274
+ return override ?? scheme;
275
+ }
276
+ __name(useColorScheme, "useColorScheme");
277
+
278
+ // src/theme/use-theme-colors.ts
279
+ function useThemeColors() {
280
+ const scheme = useColorScheme();
281
+ const themePair = react.useContext(ThemeContext);
282
+ return scheme === "dark" ? themePair.dark : themePair.light;
283
+ }
284
+ __name(useThemeColors, "useThemeColors");
285
+
286
+ // src/utils/cn.ts
287
+ function cn(...inputs) {
288
+ const out = [];
289
+ for (const input of inputs) {
290
+ append(out, input);
291
+ }
292
+ return out.join(" ");
293
+ }
294
+ __name(cn, "cn");
295
+ function append(out, input) {
296
+ if (!input) {
297
+ return;
298
+ }
299
+ if (typeof input === "string") {
300
+ if (input.length > 0) {
301
+ out.push(input);
302
+ }
303
+ return;
304
+ }
305
+ if (typeof input === "number") {
306
+ return;
307
+ }
308
+ if (Array.isArray(input)) {
309
+ for (const inner of input) {
310
+ append(out, inner);
311
+ }
312
+ return;
313
+ }
314
+ if (typeof input === "object") {
315
+ for (const key of Object.keys(input)) {
316
+ if (input[key]) {
317
+ out.push(key);
318
+ }
319
+ }
320
+ }
321
+ }
322
+ __name(append, "append");
323
+
324
+ // src/slot/compose-refs.ts
325
+ function composeRefs(...refs) {
326
+ return (node) => {
327
+ for (const ref of refs) {
328
+ if (ref == null) {
329
+ continue;
330
+ }
331
+ if (typeof ref === "function") {
332
+ ref(node);
333
+ } else {
334
+ ref.current = node;
335
+ }
336
+ }
337
+ };
338
+ }
339
+ __name(composeRefs, "composeRefs");
340
+ var Slot = react.forwardRef(/* @__PURE__ */ __name(function Slot2(props, forwardedRef) {
341
+ const { children, ...slotProps } = props;
342
+ if (!react.isValidElement(children)) {
343
+ return null;
344
+ }
345
+ const child = react.Children.only(children);
346
+ const merged = mergeProps(slotProps, child.props);
347
+ const childRef = child.ref;
348
+ if (forwardedRef || childRef) {
349
+ merged.ref = composeRefs(forwardedRef, childRef);
350
+ }
351
+ return react.cloneElement(child, merged);
352
+ }, "Slot"));
353
+ Slot.displayName = "Slot";
354
+ function mergeProps(outer, inner) {
355
+ const merged = { ...outer };
356
+ for (const key of Object.keys(inner)) {
357
+ const outerValue = outer[key];
358
+ const innerValue = inner[key];
359
+ if (key === "className" || key === "class") {
360
+ merged[key] = joinClass(outerValue, innerValue);
361
+ continue;
362
+ }
363
+ if (key === "style") {
364
+ merged[key] = {
365
+ ...outerValue,
366
+ ...innerValue
367
+ };
368
+ continue;
369
+ }
370
+ if (isEventHandler(key, outerValue, innerValue)) {
371
+ merged[key] = composeHandlers(outerValue, innerValue);
372
+ continue;
373
+ }
374
+ merged[key] = innerValue;
375
+ }
376
+ return merged;
377
+ }
378
+ __name(mergeProps, "mergeProps");
379
+ function joinClass(outer, inner) {
380
+ const a = typeof outer === "string" ? outer : "";
381
+ const b = typeof inner === "string" ? inner : "";
382
+ const joined = [a, b].filter(Boolean).join(" ");
383
+ return joined.length > 0 ? joined : void 0;
384
+ }
385
+ __name(joinClass, "joinClass");
386
+ function isEventHandler(key, outer, inner) {
387
+ if (!key.startsWith("on") || key.length < 3) {
388
+ return false;
389
+ }
390
+ if (key[2] !== key[2]?.toUpperCase()) {
391
+ return false;
392
+ }
393
+ return typeof outer === "function" && typeof inner === "function";
394
+ }
395
+ __name(isEventHandler, "isEventHandler");
396
+ function composeHandlers(outer, inner) {
397
+ return (...args) => {
398
+ outer(...args);
399
+ inner(...args);
400
+ };
401
+ }
402
+ __name(composeHandlers, "composeHandlers");
403
+
404
+ // src/theme/px.ts
405
+ function px(value) {
406
+ if (typeof value === "number") {
407
+ return value;
408
+ }
409
+ const n = Number.parseFloat(value);
410
+ return Number.isFinite(n) ? n : 0;
411
+ }
412
+ __name(px, "px");
413
+ var SIZE_PERCENT = {
414
+ sm: "25%",
415
+ md: "50%",
416
+ lg: "75%",
417
+ full: "100%"
418
+ };
419
+ var SheetContext = react.createContext(null);
420
+ var useSheetContext = /* @__PURE__ */ __name((label) => {
421
+ const ctx = react.useContext(SheetContext);
422
+ if (!ctx) {
423
+ throw new Error(`<${label}> must be rendered inside a <Sheet>.`);
424
+ }
425
+ return ctx;
426
+ }, "useSheetContext");
427
+ var SheetRoot = /* @__PURE__ */ __name(({
428
+ open,
429
+ defaultOpen = false,
430
+ onOpenChange,
431
+ side = "bottom",
432
+ size = "md",
433
+ dismissible = true,
434
+ children
435
+ }) => {
436
+ const [inner, setInner] = react.useState(defaultOpen);
437
+ const isControlled = open !== void 0;
438
+ const current = isControlled ? open : inner;
439
+ const setOpen = react.useCallback(
440
+ (next) => {
441
+ if (!isControlled) {
442
+ setInner(next);
443
+ }
444
+ onOpenChange?.(next);
445
+ },
446
+ [isControlled, onOpenChange]
447
+ );
448
+ const baseId = react.useId();
449
+ const triggerRef = react.useRef(null);
450
+ const ctxValue = {
451
+ open: current,
452
+ setOpen,
453
+ titleId: `${baseId}-title`,
454
+ descriptionId: `${baseId}-description`,
455
+ triggerRef,
456
+ side,
457
+ size,
458
+ dismissible
459
+ };
460
+ return /* @__PURE__ */ jsxRuntime.jsx(SheetContext.Provider, { value: ctxValue, children });
461
+ }, "SheetRoot");
462
+ var SheetTrigger = /* @__PURE__ */ __name(({ asChild = true, children, className, testID }) => {
463
+ const ctx = useSheetContext("SheetTrigger");
464
+ const onPress = react.useCallback(() => ctx.setOpen(true), [ctx]);
465
+ if (asChild && react.isValidElement(children)) {
466
+ const child = children;
467
+ const fire = /* @__PURE__ */ __name((existing) => (event) => {
468
+ existing?.(event);
469
+ ctx.setOpen(true);
470
+ }, "fire");
471
+ return /* @__PURE__ */ jsxRuntime.jsx(
472
+ Slot,
473
+ {
474
+ ref: (node) => {
475
+ ctx.triggerRef.current = node;
476
+ },
477
+ onClick: fire(child.props.onClick),
478
+ onPress: fire(child.props.onPress),
479
+ ...testID !== void 0 ? { "data-testid": testID } : {},
480
+ ...className !== void 0 ? { className } : {},
481
+ children: child
482
+ }
483
+ );
484
+ }
485
+ return /* @__PURE__ */ jsxRuntime.jsx(
486
+ reactNative.Pressable,
487
+ {
488
+ ref: (node) => {
489
+ ctx.triggerRef.current = node;
490
+ },
491
+ onPress,
492
+ ...testID !== void 0 ? { testID } : {},
493
+ ...className !== void 0 ? { className } : {},
494
+ children: wrapStringChildren(children)
495
+ }
496
+ );
497
+ }, "SheetTrigger");
498
+ var SheetHeader = /* @__PURE__ */ __name(({ children, className }) => {
499
+ const colors = useThemeColors();
500
+ return /* @__PURE__ */ jsxRuntime.jsx(
501
+ reactNative.View,
502
+ {
503
+ className: cn("flex-col gap-1", className),
504
+ style: {
505
+ flexDirection: "column",
506
+ gap: px(colors.spacing["1"]),
507
+ paddingHorizontal: px(colors.spacing["6"]),
508
+ paddingTop: px(colors.spacing["6"]),
509
+ paddingBottom: px(colors.spacing["2"])
510
+ },
511
+ children
512
+ }
513
+ );
514
+ }, "SheetHeader");
515
+ var SheetTitle = /* @__PURE__ */ __name(({ children, className }) => {
516
+ const ctx = useSheetContext("SheetTitle");
517
+ const colors = useThemeColors();
518
+ return /* @__PURE__ */ jsxRuntime.jsx(
519
+ reactNative.Text,
520
+ {
521
+ nativeID: ctx.titleId,
522
+ id: ctx.titleId,
523
+ role: "heading",
524
+ "aria-level": 2,
525
+ className: cn("text-lg font-semibold text-semantic-text-default", className),
526
+ style: {
527
+ color: colors.semantic.text.default,
528
+ fontFamily: colors.fontFamily.display,
529
+ fontSize: px(colors.fontSize.lg),
530
+ fontWeight: colors.fontWeight.semibold
531
+ },
532
+ children
533
+ }
534
+ );
535
+ }, "SheetTitle");
536
+ var SheetDescription = /* @__PURE__ */ __name(({ children, className }) => {
537
+ const ctx = useSheetContext("SheetDescription");
538
+ const colors = useThemeColors();
539
+ return /* @__PURE__ */ jsxRuntime.jsx(
540
+ reactNative.Text,
541
+ {
542
+ nativeID: ctx.descriptionId,
543
+ id: ctx.descriptionId,
544
+ className: cn("text-sm text-semantic-text-muted", className),
545
+ style: {
546
+ color: colors.semantic.text.muted,
547
+ fontFamily: colors.fontFamily.body,
548
+ fontSize: px(colors.fontSize.sm),
549
+ lineHeight: px(colors.fontSize.sm) * Number(colors.lineHeight.normal)
550
+ },
551
+ children
552
+ }
553
+ );
554
+ }, "SheetDescription");
555
+ var SheetBody = /* @__PURE__ */ __name(({ children, className }) => {
556
+ const colors = useThemeColors();
557
+ return /* @__PURE__ */ jsxRuntime.jsx(
558
+ reactNative.View,
559
+ {
560
+ className: cn("flex-1", className),
561
+ style: {
562
+ flex: 1,
563
+ paddingHorizontal: px(colors.spacing["6"]),
564
+ paddingVertical: px(colors.spacing["4"])
565
+ },
566
+ children
567
+ }
568
+ );
569
+ }, "SheetBody");
570
+ var SheetFooter = /* @__PURE__ */ __name(({ children, className }) => {
571
+ const colors = useThemeColors();
572
+ return /* @__PURE__ */ jsxRuntime.jsx(
573
+ reactNative.View,
574
+ {
575
+ className: cn("flex-row items-center justify-end gap-2", className),
576
+ style: {
577
+ flexDirection: "row",
578
+ alignItems: "center",
579
+ justifyContent: "flex-end",
580
+ gap: px(colors.spacing["2"]),
581
+ paddingHorizontal: px(colors.spacing["6"]),
582
+ paddingBottom: px(colors.spacing["6"]),
583
+ paddingTop: px(colors.spacing["2"])
584
+ },
585
+ children
586
+ }
587
+ );
588
+ }, "SheetFooter");
589
+ var SheetClose = /* @__PURE__ */ __name(({
590
+ asChild = true,
591
+ children,
592
+ className,
593
+ testID,
594
+ accessibilityLabel = "Close"
595
+ }) => {
596
+ const ctx = useSheetContext("SheetClose");
597
+ const onPress = react.useCallback(() => ctx.setOpen(false), [ctx]);
598
+ if (asChild && react.isValidElement(children)) {
599
+ const child = children;
600
+ const fire = /* @__PURE__ */ __name((existing) => (event) => {
601
+ existing?.(event);
602
+ ctx.setOpen(false);
603
+ }, "fire");
604
+ return /* @__PURE__ */ jsxRuntime.jsx(
605
+ Slot,
606
+ {
607
+ onClick: fire(child.props.onClick),
608
+ onPress: fire(child.props.onPress),
609
+ ...testID !== void 0 ? { "data-testid": testID } : {},
610
+ ...className !== void 0 ? { className } : {},
611
+ children: child
612
+ }
613
+ );
614
+ }
615
+ return /* @__PURE__ */ jsxRuntime.jsx(
616
+ reactNative.Pressable,
617
+ {
618
+ onPress,
619
+ role: "button",
620
+ accessibilityRole: "button",
621
+ accessibilityLabel,
622
+ "aria-label": accessibilityLabel,
623
+ ...testID !== void 0 ? { testID } : {},
624
+ ...className !== void 0 ? { className } : {},
625
+ children: wrapStringChildren(children)
626
+ }
627
+ );
628
+ }, "SheetClose");
629
+ function wrapStringChildren(children) {
630
+ if (typeof children === "string" || typeof children === "number") {
631
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { children });
632
+ }
633
+ return children;
634
+ }
635
+ __name(wrapStringChildren, "wrapStringChildren");
636
+ var SCRIM_COLOR = "rgba(0, 0, 0, 0.40)";
637
+ var FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
638
+ var SheetPanel = /* @__PURE__ */ __name(({ children, className, testID }) => {
639
+ const ctx = useSheetContext("SheetPanel");
640
+ const colors = useThemeColors();
641
+ const panelRef = react.useRef(null);
642
+ const overlayDomRef = react.useRef(null);
643
+ const [entered, setEntered] = react.useState(false);
644
+ react.useEffect(() => {
645
+ if (reactNative.Platform.OS !== "web") {
646
+ setEntered(true);
647
+ return;
648
+ }
649
+ if (!ctx.open) {
650
+ setEntered(false);
651
+ return;
652
+ }
653
+ const id = requestAnimationFrame(() => setEntered(true));
654
+ return () => cancelAnimationFrame(id);
655
+ }, [ctx.open]);
656
+ react.useEffect(() => {
657
+ if (reactNative.Platform.OS !== "web") {
658
+ return;
659
+ }
660
+ const node = overlayDomRef.current;
661
+ if (!node) {
662
+ return;
663
+ }
664
+ node.style.transitionProperty = "background-color";
665
+ node.style.transitionDuration = "200ms";
666
+ node.style.transitionTimingFunction = "ease-out";
667
+ node.style.backgroundColor = entered ? SCRIM_COLOR : "rgba(0,0,0,0)";
668
+ }, [entered]);
669
+ react.useEffect(() => {
670
+ if (!ctx.open || reactNative.Platform.OS !== "web" || typeof document === "undefined") {
671
+ return;
672
+ }
673
+ const previouslyFocused = document.activeElement;
674
+ const prevBodyOverflow = document.body.style.overflow;
675
+ document.body.style.overflow = "hidden";
676
+ const focusFirst = /* @__PURE__ */ __name(() => {
677
+ const node = panelRef.current;
678
+ if (!node) {
679
+ return;
680
+ }
681
+ const focusable = node.querySelectorAll(FOCUSABLE_SELECTOR);
682
+ const first = focusable[0];
683
+ if (first) {
684
+ first.focus();
685
+ } else {
686
+ node.setAttribute("tabindex", "-1");
687
+ node.focus();
688
+ }
689
+ }, "focusFirst");
690
+ focusFirst();
691
+ const onKeyDown = /* @__PURE__ */ __name((event) => {
692
+ if (event.key === "Escape") {
693
+ event.preventDefault();
694
+ ctx.setOpen(false);
695
+ return;
696
+ }
697
+ if (event.key !== "Tab") {
698
+ return;
699
+ }
700
+ const node = panelRef.current;
701
+ if (!node) {
702
+ return;
703
+ }
704
+ const focusable = Array.from(node.querySelectorAll(FOCUSABLE_SELECTOR)).filter(
705
+ (el) => el.offsetParent !== null || el === document.activeElement
706
+ );
707
+ if (focusable.length === 0) {
708
+ event.preventDefault();
709
+ return;
710
+ }
711
+ const first = focusable[0];
712
+ const last = focusable[focusable.length - 1];
713
+ if (!first || !last) {
714
+ return;
715
+ }
716
+ if (event.shiftKey) {
717
+ if (document.activeElement === first || !node.contains(document.activeElement)) {
718
+ event.preventDefault();
719
+ last.focus();
720
+ }
721
+ } else if (document.activeElement === last) {
722
+ event.preventDefault();
723
+ first.focus();
724
+ }
725
+ }, "onKeyDown");
726
+ document.addEventListener("keydown", onKeyDown);
727
+ return () => {
728
+ document.removeEventListener("keydown", onKeyDown);
729
+ document.body.style.overflow = prevBodyOverflow;
730
+ const restoreTo = ctx.triggerRef.current ?? previouslyFocused;
731
+ restoreTo?.focus?.();
732
+ };
733
+ }, [ctx.open, ctx.setOpen, ctx.triggerRef]);
734
+ const onBackdropPress = react.useCallback(() => {
735
+ if (ctx.dismissible) {
736
+ ctx.setOpen(false);
737
+ }
738
+ }, [ctx]);
739
+ const isHorizontal = ctx.side === "left" || ctx.side === "right";
740
+ const dim = typeof ctx.size === "number" ? ctx.size : SIZE_PERCENT[ctx.size];
741
+ const panelStyle = {
742
+ position: "absolute",
743
+ backgroundColor: colors.semantic.background.elevated,
744
+ ...isHorizontal ? { top: 0, bottom: 0 } : { left: 0, right: 0 },
745
+ ...ctx.side === "bottom" && { bottom: 0 },
746
+ ...ctx.side === "top" && { top: 0 },
747
+ ...ctx.side === "left" && { left: 0 },
748
+ ...ctx.side === "right" && { right: 0 }
749
+ };
750
+ const translateStyle = reactNative.Platform.OS === "web" ? {
751
+ transform: entered ? "translateX(0) translateY(0)" : translateOffscreen(ctx.side),
752
+ transitionProperty: "transform",
753
+ transitionDuration: "280ms",
754
+ transitionTimingFunction: "cubic-bezier(0.16, 1, 0.3, 1)"
755
+ } : {};
756
+ const overlayStyle = {
757
+ position: reactNative.Platform.OS === "web" ? "fixed" : "absolute",
758
+ top: 0,
759
+ left: 0,
760
+ right: 0,
761
+ bottom: 0,
762
+ ...reactNative.Platform.OS === "web" ? { zIndex: 50 } : { backgroundColor: SCRIM_COLOR }
763
+ };
764
+ const sizeStyle = isHorizontal ? { width: dim, height: "100%" } : { height: dim, width: "100%" };
765
+ return /* @__PURE__ */ jsxRuntime.jsx(
766
+ reactNative.Modal,
767
+ {
768
+ visible: ctx.open,
769
+ transparent: true,
770
+ animationType: reactNative.Platform.OS === "web" ? "none" : ctx.side === "bottom" || ctx.side === "top" ? "slide" : "fade",
771
+ onRequestClose: () => ctx.setOpen(false),
772
+ children: /* @__PURE__ */ jsxRuntime.jsx(
773
+ reactNative.Pressable,
774
+ {
775
+ accessibilityRole: "none",
776
+ "aria-hidden": true,
777
+ ref: (node) => {
778
+ overlayDomRef.current = node;
779
+ },
780
+ style: overlayStyle,
781
+ onPress: onBackdropPress,
782
+ children: /* @__PURE__ */ jsxRuntime.jsx(
783
+ reactNative.Pressable,
784
+ {
785
+ onPress: (event) => event.stopPropagation?.(),
786
+ ref: (node) => {
787
+ panelRef.current = node;
788
+ },
789
+ role: "dialog",
790
+ accessibilityRole: "none",
791
+ "aria-modal": true,
792
+ "aria-labelledby": ctx.titleId,
793
+ "aria-describedby": ctx.descriptionId,
794
+ "data-side": ctx.side,
795
+ ...testID !== void 0 ? { testID } : {},
796
+ className: cn("bg-semantic-background-elevated", className),
797
+ style: [
798
+ panelStyle,
799
+ sizeStyle,
800
+ translateStyle,
801
+ {
802
+ shadowColor: "#000",
803
+ shadowOffset: { width: 0, height: -2 },
804
+ shadowOpacity: 0.15,
805
+ shadowRadius: 20,
806
+ elevation: 24,
807
+ ...ctx.side === "bottom" ? { borderTopLeftRadius: 16, borderTopRightRadius: 16 } : {},
808
+ ...ctx.side === "top" ? { borderBottomLeftRadius: 16, borderBottomRightRadius: 16 } : {}
809
+ }
810
+ ],
811
+ children
812
+ }
813
+ )
814
+ }
815
+ )
816
+ }
817
+ );
818
+ }, "SheetPanel");
819
+ var Sheet = Object.assign(SheetRoot, {
820
+ Trigger: SheetTrigger,
821
+ Panel: SheetPanel,
822
+ Header: SheetHeader,
823
+ Title: SheetTitle,
824
+ Description: SheetDescription,
825
+ Body: SheetBody,
826
+ Footer: SheetFooter,
827
+ Close: SheetClose
828
+ });
829
+ var Drawer = Sheet;
830
+ function translateOffscreen(side) {
831
+ switch (side) {
832
+ case "bottom":
833
+ return "translateY(100%)";
834
+ case "top":
835
+ return "translateY(-100%)";
836
+ case "left":
837
+ return "translateX(-100%)";
838
+ case "right":
839
+ return "translateX(100%)";
840
+ }
841
+ }
842
+ __name(translateOffscreen, "translateOffscreen");
843
+
844
+ exports.Drawer = Drawer;
845
+ exports.Sheet = Sheet;
846
+ exports.SheetBody = SheetBody;
847
+ exports.SheetClose = SheetClose;
848
+ exports.SheetDescription = SheetDescription;
849
+ exports.SheetFooter = SheetFooter;
850
+ exports.SheetHeader = SheetHeader;
851
+ exports.SheetPanel = SheetPanel;
852
+ exports.SheetTitle = SheetTitle;
853
+ exports.SheetTrigger = SheetTrigger;
854
+ //# sourceMappingURL=index.cjs.map
855
+ //# sourceMappingURL=index.cjs.map