@nori-ui/core 1.7.0 → 1.9.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 (63) hide show
  1. package/dist/chunk-BOMPFNM4.js +165 -0
  2. package/dist/chunk-BOMPFNM4.js.map +1 -0
  3. package/dist/chunk-BVLOX4A3.js +256 -0
  4. package/dist/chunk-BVLOX4A3.js.map +1 -0
  5. package/dist/{chunk-PLQPBMG2.js → chunk-BXZGCOKT.js} +2 -2
  6. package/dist/{chunk-PLQPBMG2.js.map → chunk-BXZGCOKT.js.map} +1 -1
  7. package/dist/{chunk-RI4Y2C5U.js → chunk-KLK7OMFT.js} +3 -3
  8. package/dist/{chunk-RI4Y2C5U.js.map → chunk-KLK7OMFT.js.map} +1 -1
  9. package/dist/chunk-OHWRTHGL.js +495 -0
  10. package/dist/chunk-OHWRTHGL.js.map +1 -0
  11. package/dist/{chunk-V5QSMDZL.js → chunk-QB6RH6UU.js} +3 -3
  12. package/dist/{chunk-V5QSMDZL.js.map → chunk-QB6RH6UU.js.map} +1 -1
  13. package/dist/chunk-S763GTIZ.js +350 -0
  14. package/dist/chunk-S763GTIZ.js.map +1 -0
  15. package/dist/chunk-UJRVWGK7.js +3 -0
  16. package/dist/chunk-UJRVWGK7.js.map +1 -0
  17. package/dist/chunk-VFUV6XJR.js +257 -0
  18. package/dist/chunk-VFUV6XJR.js.map +1 -0
  19. package/dist/client.cjs +2860 -1386
  20. package/dist/client.cjs.map +1 -1
  21. package/dist/client.d.cts +5 -0
  22. package/dist/client.d.ts +5 -0
  23. package/dist/client.js +23 -17
  24. package/dist/client.js.map +1 -1
  25. package/dist/components/Accordion/index.js +2 -2
  26. package/dist/components/Carousel/index.cjs +297 -0
  27. package/dist/components/Carousel/index.cjs.map +1 -0
  28. package/dist/components/Carousel/index.d.cts +67 -0
  29. package/dist/components/Carousel/index.d.ts +67 -0
  30. package/dist/components/Carousel/index.js +5 -0
  31. package/dist/components/Carousel/index.js.map +1 -0
  32. package/dist/components/Command/index.cjs +1371 -0
  33. package/dist/components/Command/index.cjs.map +1 -0
  34. package/dist/components/Command/index.d.cts +89 -0
  35. package/dist/components/Command/index.d.ts +89 -0
  36. package/dist/components/Command/index.js +11 -0
  37. package/dist/components/Command/index.js.map +1 -0
  38. package/dist/components/Dialog/index.js +2 -1
  39. package/dist/components/HoverCard/index.cjs +894 -0
  40. package/dist/components/HoverCard/index.cjs.map +1 -0
  41. package/dist/components/HoverCard/index.d.cts +66 -0
  42. package/dist/components/HoverCard/index.d.ts +66 -0
  43. package/dist/components/HoverCard/index.js +9 -0
  44. package/dist/components/HoverCard/index.js.map +1 -0
  45. package/dist/components/InputOTP/index.cjs +580 -0
  46. package/dist/components/InputOTP/index.cjs.map +1 -0
  47. package/dist/components/InputOTP/index.d.cts +49 -0
  48. package/dist/components/InputOTP/index.d.ts +49 -0
  49. package/dist/components/InputOTP/index.js +7 -0
  50. package/dist/components/InputOTP/index.js.map +1 -0
  51. package/dist/components/Sidebar/index.cjs +675 -0
  52. package/dist/components/Sidebar/index.cjs.map +1 -0
  53. package/dist/components/Sidebar/index.d.cts +109 -0
  54. package/dist/components/Sidebar/index.d.ts +109 -0
  55. package/dist/components/Sidebar/index.js +7 -0
  56. package/dist/components/Sidebar/index.js.map +1 -0
  57. package/dist/components/Switch/index.js +2 -2
  58. package/dist/index.cjs +2860 -1386
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.d.cts +5 -0
  61. package/dist/index.d.ts +5 -0
  62. package/dist/index.js +23 -17
  63. package/package.json +1 -1
@@ -0,0 +1,675 @@
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
+ // src/theme/px.ts
11
+ function px(value) {
12
+ if (typeof value === "number") {
13
+ return value;
14
+ }
15
+ const n = Number.parseFloat(value);
16
+ return Number.isFinite(n) ? n : 0;
17
+ }
18
+ __name(px, "px");
19
+
20
+ // ../tokens/build/theme.ts
21
+ var theme = {
22
+ color: {
23
+ danger: "#ef4444",
24
+ info: "#3b82f6",
25
+ neutral: {
26
+ "100": "#f4f4f5",
27
+ "200": "#e4e4e7",
28
+ "300": "#d4d4d8",
29
+ "400": "#a1a1aa",
30
+ "50": "#fafafa",
31
+ "500": "#71717a",
32
+ "600": "#52525b",
33
+ "700": "#3f3f46",
34
+ "800": "#27272a",
35
+ "900": "#18181b"
36
+ },
37
+ primary: {
38
+ "100": "#ccfbf1",
39
+ "200": "#99f6e4",
40
+ "300": "#5eead4",
41
+ "400": "#2dd4bf",
42
+ "50": "#f0fdfa",
43
+ "500": "#14b8a6",
44
+ "600": "#0d9488",
45
+ "700": "#0f766e",
46
+ "800": "#115e59",
47
+ "900": "#134e4a"
48
+ },
49
+ success: "#22c55e",
50
+ warning: "#f59e0b"
51
+ },
52
+ fontFamily: {
53
+ body: "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
54
+ display: "ui-serif, Georgia, 'Times New Roman', serif",
55
+ mono: "ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
56
+ },
57
+ fontSize: {
58
+ "2xl": "24px",
59
+ "3xl": "30px",
60
+ "4xl": "36px",
61
+ lg: "18px",
62
+ md: "16px",
63
+ sm: "14px",
64
+ xl: "20px",
65
+ xs: "12px"
66
+ },
67
+ fontWeight: {
68
+ bold: "700",
69
+ medium: "500",
70
+ regular: "400",
71
+ semibold: "600"
72
+ },
73
+ lineHeight: {
74
+ normal: "1.4",
75
+ relaxed: "1.6",
76
+ tight: "1.2"
77
+ },
78
+ radius: {
79
+ "2xl": "16px",
80
+ full: "9999px",
81
+ lg: "8px",
82
+ md: "6px",
83
+ none: "0px",
84
+ sm: "4px",
85
+ xl: "12px"
86
+ },
87
+ semantic: {
88
+ background: {
89
+ default: "#fafafa",
90
+ elevated: "#ffffff",
91
+ subtle: "#f4f4f5"
92
+ },
93
+ border: {
94
+ default: "#e4e4e7",
95
+ strong: "#d4d4d8"
96
+ },
97
+ interactive: {
98
+ destructive: "#ef4444",
99
+ primary: "#0d9488",
100
+ primaryHover: "#0f766e",
101
+ primaryPressed: "#115e59"
102
+ },
103
+ text: {
104
+ default: "#18181b",
105
+ inverted: "#fafafa",
106
+ muted: "#52525b"
107
+ }
108
+ },
109
+ shadow: {
110
+ lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",
111
+ md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",
112
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)"
113
+ },
114
+ spacing: {
115
+ "0": "0px",
116
+ "1": "4px",
117
+ "10": "40px",
118
+ "12": "48px",
119
+ "16": "64px",
120
+ "2": "8px",
121
+ "20": "80px",
122
+ "24": "96px",
123
+ "3": "12px",
124
+ "4": "16px",
125
+ "5": "20px",
126
+ "6": "24px",
127
+ "8": "32px"
128
+ }
129
+ };
130
+ var themeDark = {
131
+ color: {
132
+ danger: "#ef4444",
133
+ info: "#3b82f6",
134
+ neutral: {
135
+ "100": "#f4f4f5",
136
+ "200": "#e4e4e7",
137
+ "300": "#d4d4d8",
138
+ "400": "#a1a1aa",
139
+ "50": "#fafafa",
140
+ "500": "#71717a",
141
+ "600": "#52525b",
142
+ "700": "#3f3f46",
143
+ "800": "#27272a",
144
+ "900": "#18181b"
145
+ },
146
+ primary: {
147
+ "100": "#ccfbf1",
148
+ "200": "#99f6e4",
149
+ "300": "#5eead4",
150
+ "400": "#2dd4bf",
151
+ "50": "#f0fdfa",
152
+ "500": "#14b8a6",
153
+ "600": "#0d9488",
154
+ "700": "#0f766e",
155
+ "800": "#115e59",
156
+ "900": "#134e4a"
157
+ },
158
+ success: "#22c55e",
159
+ warning: "#f59e0b"
160
+ },
161
+ fontFamily: {
162
+ body: "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
163
+ display: "ui-serif, Georgia, 'Times New Roman', serif",
164
+ mono: "ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
165
+ },
166
+ fontSize: {
167
+ "2xl": "24px",
168
+ "3xl": "30px",
169
+ "4xl": "36px",
170
+ lg: "18px",
171
+ md: "16px",
172
+ sm: "14px",
173
+ xl: "20px",
174
+ xs: "12px"
175
+ },
176
+ fontWeight: {
177
+ bold: "700",
178
+ medium: "500",
179
+ regular: "400",
180
+ semibold: "600"
181
+ },
182
+ lineHeight: {
183
+ normal: "1.4",
184
+ relaxed: "1.6",
185
+ tight: "1.2"
186
+ },
187
+ radius: {
188
+ "2xl": "16px",
189
+ full: "9999px",
190
+ lg: "8px",
191
+ md: "6px",
192
+ none: "0px",
193
+ sm: "4px",
194
+ xl: "12px"
195
+ },
196
+ semantic: {
197
+ background: {
198
+ default: "#18181b",
199
+ elevated: "#3f3f46",
200
+ subtle: "#27272a"
201
+ },
202
+ border: {
203
+ default: "#3f3f46",
204
+ strong: "#52525b"
205
+ },
206
+ interactive: {
207
+ destructive: "#ef4444",
208
+ primary: "#2dd4bf",
209
+ primaryHover: "#5eead4",
210
+ primaryPressed: "#99f6e4"
211
+ },
212
+ text: {
213
+ default: "#fafafa",
214
+ inverted: "#18181b",
215
+ muted: "#a1a1aa"
216
+ }
217
+ },
218
+ shadow: {
219
+ lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",
220
+ md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",
221
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)"
222
+ },
223
+ spacing: {
224
+ "0": "0px",
225
+ "1": "4px",
226
+ "10": "40px",
227
+ "12": "48px",
228
+ "16": "64px",
229
+ "2": "8px",
230
+ "20": "80px",
231
+ "24": "96px",
232
+ "3": "12px",
233
+ "4": "16px",
234
+ "5": "20px",
235
+ "6": "24px",
236
+ "8": "32px"
237
+ }
238
+ };
239
+ var defaultTheme = {
240
+ light: theme,
241
+ dark: themeDark
242
+ };
243
+ var ThemeContext = react.createContext(defaultTheme);
244
+ ThemeContext.displayName = "ThemeContext";
245
+ var ColorSchemeOverrideContext = react.createContext(null);
246
+ ColorSchemeOverrideContext.displayName = "ColorSchemeOverrideContext";
247
+ var isWeb = reactNative.Platform.OS === "web";
248
+ function readWebScheme() {
249
+ if (typeof document === "undefined") {
250
+ return "light";
251
+ }
252
+ const root = document.documentElement;
253
+ if (root.classList.contains("dark")) {
254
+ return "dark";
255
+ }
256
+ if (root.getAttribute("data-theme") === "dark") {
257
+ return "dark";
258
+ }
259
+ return "light";
260
+ }
261
+ __name(readWebScheme, "readWebScheme");
262
+ function useColorScheme() {
263
+ const override = react.useContext(ColorSchemeOverrideContext);
264
+ const [scheme, setScheme] = react.useState(() => {
265
+ if (isWeb) {
266
+ return readWebScheme();
267
+ }
268
+ return reactNative.Appearance.getColorScheme() ?? "light";
269
+ });
270
+ react.useEffect(() => {
271
+ if (isWeb) {
272
+ const root = document.documentElement;
273
+ const update = /* @__PURE__ */ __name(() => setScheme(readWebScheme()), "update");
274
+ const observer = new MutationObserver(update);
275
+ observer.observe(root, { attributes: true, attributeFilter: ["class", "data-theme"] });
276
+ update();
277
+ return () => observer.disconnect();
278
+ }
279
+ const sub = reactNative.Appearance.addChangeListener(({ colorScheme }) => {
280
+ setScheme(colorScheme ?? "light");
281
+ });
282
+ return () => sub.remove();
283
+ }, []);
284
+ return override ?? scheme;
285
+ }
286
+ __name(useColorScheme, "useColorScheme");
287
+
288
+ // src/theme/use-theme-colors.ts
289
+ function useThemeColors() {
290
+ const scheme = useColorScheme();
291
+ const themePair = react.useContext(ThemeContext);
292
+ return scheme === "dark" ? themePair.dark : themePair.light;
293
+ }
294
+ __name(useThemeColors, "useThemeColors");
295
+
296
+ // src/utils/cn.ts
297
+ function cn(...inputs) {
298
+ const out = [];
299
+ for (const input of inputs) {
300
+ append(out, input);
301
+ }
302
+ return out.join(" ");
303
+ }
304
+ __name(cn, "cn");
305
+ function append(out, input) {
306
+ if (!input) {
307
+ return;
308
+ }
309
+ if (typeof input === "string") {
310
+ if (input.length > 0) {
311
+ out.push(input);
312
+ }
313
+ return;
314
+ }
315
+ if (typeof input === "number") {
316
+ return;
317
+ }
318
+ if (Array.isArray(input)) {
319
+ for (const inner of input) {
320
+ append(out, inner);
321
+ }
322
+ return;
323
+ }
324
+ if (typeof input === "object") {
325
+ for (const key of Object.keys(input)) {
326
+ if (input[key]) {
327
+ out.push(key);
328
+ }
329
+ }
330
+ }
331
+ }
332
+ __name(append, "append");
333
+ var SidebarContext = react.createContext(null);
334
+ function useSidebarContext(caller) {
335
+ const ctx = react.useContext(SidebarContext);
336
+ if (!ctx) {
337
+ throw new Error(`<${caller}> must be rendered inside <Sidebar>.`);
338
+ }
339
+ return ctx;
340
+ }
341
+ __name(useSidebarContext, "useSidebarContext");
342
+ var EXPANDED_WIDTH = 240;
343
+ var COLLAPSED_WIDTH = 56;
344
+ var SidebarRoot = /* @__PURE__ */ __name(({
345
+ collapsed,
346
+ defaultCollapsed = false,
347
+ onCollapsedChange,
348
+ side = "left",
349
+ variant = "standard",
350
+ children,
351
+ className,
352
+ testID
353
+ }) => {
354
+ const [inner, setInner] = react.useState(defaultCollapsed);
355
+ const isControlled = collapsed !== void 0;
356
+ const current = isControlled ? collapsed : inner;
357
+ const navId = react.useId();
358
+ const colors = useThemeColors();
359
+ const setCollapsed = react.useCallback(
360
+ (next) => {
361
+ if (!isControlled) {
362
+ setInner(next);
363
+ }
364
+ onCollapsedChange?.(next);
365
+ },
366
+ [isControlled, onCollapsedChange]
367
+ );
368
+ const toggleCollapsed = react.useCallback(() => {
369
+ setCollapsed(!current);
370
+ }, [current, setCollapsed]);
371
+ const ctxValue = {
372
+ collapsed: current,
373
+ setCollapsed,
374
+ toggleCollapsed,
375
+ navId
376
+ };
377
+ const width = current ? COLLAPSED_WIDTH : EXPANDED_WIDTH;
378
+ const containerStyle = reactNative.Platform.OS === "web" ? {
379
+ position: "fixed",
380
+ top: 0,
381
+ bottom: 0,
382
+ [side]: 0,
383
+ width,
384
+ transitionProperty: "width",
385
+ transitionDuration: "200ms",
386
+ transitionTimingFunction: "cubic-bezier(0.16, 1, 0.3, 1)",
387
+ display: "flex",
388
+ flexDirection: "column",
389
+ overflow: "hidden",
390
+ zIndex: 40
391
+ } : {
392
+ width,
393
+ flexDirection: "column",
394
+ overflow: "hidden"
395
+ };
396
+ const variantStyle = reactNative.Platform.OS === "web" ? variant === "floating" ? {
397
+ margin: 8,
398
+ borderRadius: colors.radius.lg,
399
+ top: 8,
400
+ bottom: 8,
401
+ height: "auto"
402
+ } : variant === "inset" ? {
403
+ boxShadow: "4px 0 16px rgba(0,0,0,0.08)"
404
+ } : {} : {};
405
+ const rootStyle = {
406
+ ...containerStyle,
407
+ ...variantStyle,
408
+ backgroundColor: colors.semantic.background.elevated,
409
+ borderRightWidth: variant !== "floating" ? 1 : 0,
410
+ borderRightColor: colors.semantic.border.default
411
+ };
412
+ if (reactNative.Platform.OS === "web") {
413
+ return /* @__PURE__ */ jsxRuntime.jsx(SidebarContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsxRuntime.jsx(
414
+ "nav",
415
+ {
416
+ id: navId,
417
+ "aria-label": "Sidebar",
418
+ "data-collapsed": current,
419
+ "data-side": side,
420
+ "data-variant": variant,
421
+ "data-testid": testID,
422
+ className: cn(
423
+ "nori-sidebar flex flex-col overflow-hidden transition-[width] duration-200",
424
+ className
425
+ ),
426
+ style: rootStyle,
427
+ children
428
+ }
429
+ ) });
430
+ }
431
+ return /* @__PURE__ */ jsxRuntime.jsx(SidebarContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: rootStyle, testID, accessibilityRole: "menu", accessibilityLabel: "Sidebar", children }) });
432
+ }, "SidebarRoot");
433
+ var SidebarHeader = /* @__PURE__ */ __name(({ children, className, testID }) => {
434
+ const colors = useThemeColors();
435
+ const style = {
436
+ padding: px(colors.spacing["4"]),
437
+ borderBottomWidth: 1,
438
+ borderBottomColor: colors.semantic.border.default,
439
+ flexDirection: "row",
440
+ alignItems: "center",
441
+ gap: px(colors.spacing["2"]),
442
+ overflow: "hidden"
443
+ };
444
+ if (reactNative.Platform.OS === "web") {
445
+ return /* @__PURE__ */ jsxRuntime.jsx(
446
+ "div",
447
+ {
448
+ "data-testid": testID,
449
+ className: cn("nori-sidebar-header", className),
450
+ style,
451
+ children
452
+ }
453
+ );
454
+ }
455
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style, testID, children });
456
+ }, "SidebarHeader");
457
+ var SidebarContent = /* @__PURE__ */ __name(({ children, className, testID }) => {
458
+ const style = { flex: 1, overflow: "hidden" };
459
+ if (reactNative.Platform.OS === "web") {
460
+ return /* @__PURE__ */ jsxRuntime.jsx(
461
+ "div",
462
+ {
463
+ "data-testid": testID,
464
+ className: cn("nori-sidebar-content", className),
465
+ style: { flex: 1, overflowY: "auto", overflowX: "hidden" },
466
+ children
467
+ }
468
+ );
469
+ }
470
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style, testID, contentContainerStyle: { flexGrow: 1 }, children });
471
+ }, "SidebarContent");
472
+ var SidebarFooter = /* @__PURE__ */ __name(({ children, className, testID }) => {
473
+ const colors = useThemeColors();
474
+ const style = {
475
+ padding: px(colors.spacing["4"]),
476
+ borderTopWidth: 1,
477
+ borderTopColor: colors.semantic.border.default,
478
+ overflow: "hidden"
479
+ };
480
+ if (reactNative.Platform.OS === "web") {
481
+ return /* @__PURE__ */ jsxRuntime.jsx(
482
+ "div",
483
+ {
484
+ "data-testid": testID,
485
+ className: cn("nori-sidebar-footer", className),
486
+ style,
487
+ children
488
+ }
489
+ );
490
+ }
491
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style, testID, children });
492
+ }, "SidebarFooter");
493
+ var SidebarGroup = /* @__PURE__ */ __name(({ children, className, testID }) => {
494
+ const colors = useThemeColors();
495
+ const style = {
496
+ paddingTop: px(colors.spacing["2"]),
497
+ paddingBottom: px(colors.spacing["2"])
498
+ };
499
+ if (reactNative.Platform.OS === "web") {
500
+ return /* @__PURE__ */ jsxRuntime.jsx(
501
+ "div",
502
+ {
503
+ "data-testid": testID,
504
+ className: cn("nori-sidebar-group", className),
505
+ style,
506
+ children
507
+ }
508
+ );
509
+ }
510
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style, testID, children });
511
+ }, "SidebarGroup");
512
+ var SidebarGroupLabel = /* @__PURE__ */ __name(({ children, className, testID }) => {
513
+ const ctx = useSidebarContext("Sidebar.GroupLabel");
514
+ const colors = useThemeColors();
515
+ if (ctx.collapsed) {
516
+ return null;
517
+ }
518
+ const style = {
519
+ paddingHorizontal: px(colors.spacing["4"]),
520
+ paddingVertical: px(colors.spacing["1"])
521
+ };
522
+ const textStyle = {
523
+ fontSize: 11,
524
+ fontWeight: "600",
525
+ letterSpacing: 0.5,
526
+ textTransform: "uppercase",
527
+ color: colors.semantic.text.muted
528
+ };
529
+ if (reactNative.Platform.OS === "web") {
530
+ return /* @__PURE__ */ jsxRuntime.jsx(
531
+ "div",
532
+ {
533
+ "data-testid": testID,
534
+ className: cn("nori-sidebar-group-label", className),
535
+ style,
536
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: textStyle, children })
537
+ }
538
+ );
539
+ }
540
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style, testID, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children }) });
541
+ }, "SidebarGroupLabel");
542
+ var SidebarMenu = /* @__PURE__ */ __name(({ children, className, testID }) => {
543
+ const colors = useThemeColors();
544
+ const style = {
545
+ paddingHorizontal: px(colors.spacing["2"]),
546
+ gap: px(colors.spacing["1"])
547
+ };
548
+ if (reactNative.Platform.OS === "web") {
549
+ return /* @__PURE__ */ jsxRuntime.jsx(
550
+ "ul",
551
+ {
552
+ "data-testid": testID,
553
+ className: cn("nori-sidebar-menu", className),
554
+ style: {
555
+ ...style,
556
+ listStyle: "none",
557
+ margin: 0,
558
+ padding: `0 ${colors.spacing["2"]}px`
559
+ },
560
+ children
561
+ }
562
+ );
563
+ }
564
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style, testID, children });
565
+ }, "SidebarMenu");
566
+ var SidebarMenuItem = /* @__PURE__ */ __name(({
567
+ icon,
568
+ active = false,
569
+ disabled = false,
570
+ onPress,
571
+ children,
572
+ className,
573
+ testID
574
+ }) => {
575
+ const ctx = useSidebarContext("Sidebar.MenuItem");
576
+ const colors = useThemeColors();
577
+ const itemStyle = {
578
+ flexDirection: "row",
579
+ alignItems: "center",
580
+ borderRadius: px(colors.radius.md),
581
+ paddingHorizontal: px(colors.spacing["3"]),
582
+ paddingVertical: px(colors.spacing["2"]),
583
+ gap: px(colors.spacing["3"]),
584
+ opacity: disabled ? 0.5 : 1,
585
+ ...ctx.collapsed ? { justifyContent: "center", paddingHorizontal: px(colors.spacing["2"]) } : {}
586
+ };
587
+ const activeBg = colors.semantic.interactive.primary;
588
+ const labelStr = typeof children === "string" ? children : void 0;
589
+ const labelTextStyle = {
590
+ fontSize: 14,
591
+ fontWeight: active ? "600" : "400",
592
+ color: active ? colors.semantic.text.default : colors.semantic.text.muted,
593
+ flex: 1
594
+ };
595
+ if (reactNative.Platform.OS === "web") {
596
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { style: { listStyle: "none" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
597
+ "button",
598
+ {
599
+ type: "button",
600
+ "data-testid": testID,
601
+ "aria-current": active ? "page" : void 0,
602
+ "aria-disabled": disabled,
603
+ title: ctx.collapsed && labelStr ? labelStr : void 0,
604
+ disabled,
605
+ onClick: disabled ? void 0 : onPress,
606
+ className: cn("nori-sidebar-menu-item", className),
607
+ style: {
608
+ display: "flex",
609
+ alignItems: "center",
610
+ gap: colors.spacing["3"],
611
+ width: "100%",
612
+ textAlign: "left",
613
+ border: "none",
614
+ cursor: disabled ? "not-allowed" : "pointer",
615
+ borderRadius: colors.radius.md,
616
+ padding: ctx.collapsed ? `${colors.spacing["2"]}px` : `${colors.spacing["2"]}px ${colors.spacing["3"]}px`,
617
+ justifyContent: ctx.collapsed ? "center" : "flex-start",
618
+ background: active ? `${activeBg}1a` : "transparent",
619
+ opacity: disabled ? 0.5 : 1
620
+ },
621
+ children: [
622
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nori-sidebar-menu-item-icon", "aria-hidden": "true", children: icon }),
623
+ !ctx.collapsed && /* @__PURE__ */ jsxRuntime.jsx(
624
+ "span",
625
+ {
626
+ style: {
627
+ fontSize: 14,
628
+ fontWeight: active ? 600 : 400,
629
+ color: active ? colors.semantic.text.default : colors.semantic.text.muted,
630
+ flex: 1,
631
+ overflow: "hidden",
632
+ whiteSpace: "nowrap",
633
+ textOverflow: "ellipsis"
634
+ },
635
+ children
636
+ }
637
+ )
638
+ ]
639
+ }
640
+ ) });
641
+ }
642
+ return /* @__PURE__ */ jsxRuntime.jsxs(
643
+ reactNative.Pressable,
644
+ {
645
+ testID,
646
+ onPress: disabled ? void 0 : onPress,
647
+ disabled,
648
+ accessibilityRole: "menuitem",
649
+ accessibilityState: { selected: active, disabled },
650
+ style: ({ pressed }) => [
651
+ itemStyle,
652
+ active ? { backgroundColor: `${activeBg}1a` } : {},
653
+ pressed && { opacity: 0.7 }
654
+ ],
655
+ children: [
656
+ icon && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { children: icon }),
657
+ !ctx.collapsed && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: labelTextStyle, numberOfLines: 1, children })
658
+ ]
659
+ }
660
+ );
661
+ }, "SidebarMenuItem");
662
+ var Sidebar = Object.assign(SidebarRoot, {
663
+ Header: SidebarHeader,
664
+ Content: SidebarContent,
665
+ Footer: SidebarFooter,
666
+ Group: SidebarGroup,
667
+ GroupLabel: SidebarGroupLabel,
668
+ Menu: SidebarMenu,
669
+ MenuItem: SidebarMenuItem
670
+ });
671
+
672
+ exports.Sidebar = Sidebar;
673
+ exports.useSidebarContext = useSidebarContext;
674
+ //# sourceMappingURL=index.cjs.map
675
+ //# sourceMappingURL=index.cjs.map