@nerds-with-charisma/revit-ui 0.3.0 → 0.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,898 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/native/index.ts
21
+ var native_exports = {};
22
+ __export(native_exports, {
23
+ Alert: () => Alert,
24
+ AlertDescription: () => AlertDescription,
25
+ AlertTitle: () => AlertTitle,
26
+ Button: () => Button,
27
+ Card: () => Card,
28
+ CardContent: () => CardContent,
29
+ CardDescription: () => CardDescription,
30
+ CardHeader: () => CardHeader,
31
+ CardTitle: () => CardTitle,
32
+ Heading: () => Heading,
33
+ Input: () => Input,
34
+ Label: () => Label,
35
+ RevitThemeProvider: () => RevitThemeProvider,
36
+ Tabs: () => Tabs,
37
+ TabsList: () => TabsList,
38
+ TabsTrigger: () => TabsTrigger,
39
+ Text: () => Text7,
40
+ getAlertStyles: () => getAlertStyles,
41
+ getButtonStyles: () => getButtonStyles,
42
+ getCardPadding: () => getCardPadding,
43
+ getCardStyles: () => getCardStyles,
44
+ getHeadingStyles: () => getHeadingStyles,
45
+ getInputStyles: () => getInputStyles,
46
+ getLabelStyles: () => getLabelStyles,
47
+ getTabsListStyles: () => getTabsListStyles,
48
+ getTabsTriggerStyles: () => getTabsTriggerStyles,
49
+ getTextStyles: () => getTextStyles,
50
+ getThemeColors: () => getThemeColors,
51
+ tokensToStyleSheet: () => tokensToStyleSheet,
52
+ useRevitTheme: () => useRevitTheme
53
+ });
54
+ module.exports = __toCommonJS(native_exports);
55
+
56
+ // src/native/components/Alert.tsx
57
+ var import_react_native2 = require("react-native");
58
+
59
+ // src/native/lib/mergeStyles.ts
60
+ var mergeStyles = (...styles) => styles.filter(Boolean);
61
+
62
+ // src/native/theme/tokensToStyles.ts
63
+ var import_react_native = require("react-native");
64
+
65
+ // src/native/lib/remToPx.ts
66
+ var remToPx = (value, base = 16) => {
67
+ const parsed = parseFloat(value);
68
+ if (Number.isNaN(parsed)) return base;
69
+ if (value.endsWith("rem")) return parsed * base;
70
+ return parsed;
71
+ };
72
+
73
+ // src/native/theme/tokensToStyles.ts
74
+ var getThemeColors = (tokens, scheme = "light") => scheme === "dark" ? tokens.colorsDark : tokens.colors;
75
+ var withAlpha = (hex, alpha) => {
76
+ const normalized = hex.replace("#", "");
77
+ const value = normalized.length === 3 ? normalized.split("").map((char) => char + char).join("") : normalized.slice(0, 6);
78
+ const r = parseInt(value.slice(0, 2), 16);
79
+ const g = parseInt(value.slice(2, 4), 16);
80
+ const b = parseInt(value.slice(4, 6), 16);
81
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
82
+ };
83
+ var buttonSizeStyles = (size) => {
84
+ switch (size) {
85
+ case "sm":
86
+ return { paddingHorizontal: 12, paddingVertical: 6, fontSize: 10 };
87
+ case "lg":
88
+ return { minWidth: 160, paddingHorizontal: 24, paddingVertical: 12, fontSize: 14 };
89
+ case "icon":
90
+ return { width: 36, height: 36, paddingHorizontal: 0, paddingVertical: 0 };
91
+ default:
92
+ return { paddingHorizontal: 16, paddingVertical: 8, fontSize: 12 };
93
+ }
94
+ };
95
+ var getButtonStyles = (colors, tokens, variant = "default", size = "default") => {
96
+ const pillRadius = remToPx(tokens.radius.pill);
97
+ const base = {
98
+ ...buttonSizeStyles(size),
99
+ alignItems: "center",
100
+ justifyContent: "center",
101
+ flexDirection: "row",
102
+ gap: 8,
103
+ borderRadius: size === "icon" ? pillRadius : pillRadius,
104
+ borderWidth: 2,
105
+ fontWeight: "600",
106
+ textTransform: variant === "link" ? "none" : "uppercase",
107
+ letterSpacing: variant === "link" ? 0 : 1.2
108
+ };
109
+ switch (variant) {
110
+ case "secondary":
111
+ return {
112
+ container: {
113
+ ...base,
114
+ backgroundColor: colors.secondary,
115
+ borderColor: colors.secondary
116
+ },
117
+ text: { color: colors.secondaryForeground }
118
+ };
119
+ case "outline":
120
+ return {
121
+ container: {
122
+ ...base,
123
+ backgroundColor: colors.card,
124
+ borderColor: colors.border
125
+ },
126
+ text: { color: colors.cardForeground }
127
+ };
128
+ case "ghost":
129
+ return {
130
+ container: {
131
+ ...base,
132
+ backgroundColor: "transparent",
133
+ borderColor: "transparent",
134
+ borderWidth: 0
135
+ },
136
+ text: { color: colors.foreground }
137
+ };
138
+ case "link":
139
+ return {
140
+ container: {
141
+ ...base,
142
+ backgroundColor: "transparent",
143
+ borderColor: "transparent",
144
+ borderWidth: 0,
145
+ borderRadius: 0,
146
+ paddingHorizontal: 0,
147
+ paddingVertical: 0
148
+ },
149
+ text: { color: colors.primary, textDecorationLine: "underline" }
150
+ };
151
+ case "destructive":
152
+ return {
153
+ container: {
154
+ ...base,
155
+ backgroundColor: colors.destructive,
156
+ borderColor: colors.destructive
157
+ },
158
+ text: { color: colors.destructiveForeground }
159
+ };
160
+ }
161
+ return {
162
+ container: {
163
+ ...base,
164
+ backgroundColor: colors.primary,
165
+ borderColor: colors.primary,
166
+ shadowColor: "#000000",
167
+ shadowOffset: { width: 0, height: 8 },
168
+ shadowOpacity: 0.07,
169
+ shadowRadius: 12,
170
+ elevation: 4
171
+ },
172
+ text: { color: colors.primaryForeground }
173
+ };
174
+ };
175
+ var getInputStyles = (colors, tokens, variant = "default", size = "default") => {
176
+ const radius = variant === "pill" ? remToPx(tokens.radius.pill) : remToPx(tokens.radius.md);
177
+ const sizeStyles = size === "sm" ? { height: 36, paddingHorizontal: 12, paddingVertical: 4, fontSize: 14 } : size === "md" ? { height: 44, paddingHorizontal: 16, paddingVertical: 8, fontSize: 16 } : { height: 48, paddingHorizontal: 20, paddingVertical: 12, fontSize: 16 };
178
+ return {
179
+ ...sizeStyles,
180
+ width: "100%",
181
+ borderWidth: 1,
182
+ borderColor: colors.border,
183
+ backgroundColor: variant === "filled" ? colors.muted : colors.card,
184
+ color: colors.foreground,
185
+ borderRadius: radius
186
+ };
187
+ };
188
+ var getCardStyles = (colors, tokens, variant = "default") => {
189
+ switch (variant) {
190
+ case "elevated":
191
+ return {
192
+ backgroundColor: colors.card,
193
+ borderRadius: remToPx(tokens.radius.xl),
194
+ shadowColor: "#000000",
195
+ shadowOffset: { width: 0, height: 24 },
196
+ shadowOpacity: 0.12,
197
+ shadowRadius: 48,
198
+ elevation: 8
199
+ };
200
+ case "frost":
201
+ return {
202
+ backgroundColor: withAlpha(colors.card, 0.85),
203
+ borderRadius: remToPx(tokens.radius.lg),
204
+ borderWidth: 1,
205
+ borderColor: withAlpha("#ffffff", 0.55)
206
+ };
207
+ case "outline":
208
+ return {
209
+ backgroundColor: "transparent",
210
+ borderRadius: remToPx(tokens.radius.lg),
211
+ borderWidth: 1,
212
+ borderColor: colors.border
213
+ };
214
+ default:
215
+ return {
216
+ backgroundColor: colors.card,
217
+ borderRadius: remToPx(tokens.radius.lg),
218
+ borderWidth: 1,
219
+ borderColor: colors.border,
220
+ shadowColor: "#000000",
221
+ shadowOffset: { width: 0, height: 18 },
222
+ shadowOpacity: 0.04,
223
+ shadowRadius: 40,
224
+ elevation: 3
225
+ };
226
+ }
227
+ };
228
+ var getCardPadding = (size = "default") => {
229
+ switch (size) {
230
+ case "sm":
231
+ return 16;
232
+ case "lg":
233
+ return 32;
234
+ default:
235
+ return 24;
236
+ }
237
+ };
238
+ var getAlertStyles = (colors, tokens, variant = "default") => {
239
+ const base = {
240
+ width: "100%",
241
+ borderRadius: remToPx(tokens.radius.lg),
242
+ borderWidth: 1,
243
+ paddingHorizontal: 16,
244
+ paddingVertical: 12
245
+ };
246
+ switch (variant) {
247
+ case "warning":
248
+ return {
249
+ ...base,
250
+ borderColor: withAlpha(colors.primary, 0.6),
251
+ backgroundColor: withAlpha(colors.primary, 0.15)
252
+ };
253
+ case "destructive":
254
+ return {
255
+ ...base,
256
+ borderColor: withAlpha(colors.destructive, 0.4),
257
+ backgroundColor: withAlpha(colors.destructive, 0.1)
258
+ };
259
+ default:
260
+ return {
261
+ ...base,
262
+ borderColor: colors.border,
263
+ backgroundColor: colors.card
264
+ };
265
+ }
266
+ };
267
+ var getLabelStyles = (colors, variant = "default") => {
268
+ if (variant === "eyebrow") {
269
+ return {
270
+ fontSize: 12,
271
+ fontWeight: "700",
272
+ textTransform: "uppercase",
273
+ letterSpacing: 3.5,
274
+ color: colors.brand.gold
275
+ };
276
+ }
277
+ return {
278
+ fontSize: 14,
279
+ fontWeight: "500",
280
+ lineHeight: 14,
281
+ color: colors.foreground
282
+ };
283
+ };
284
+ var getHeadingStyles = (colors, variant = "title") => {
285
+ switch (variant) {
286
+ case "page":
287
+ return { fontSize: 24, fontWeight: "600", letterSpacing: -0.5, color: colors.foreground };
288
+ case "section":
289
+ return { fontSize: 18, fontWeight: "600", letterSpacing: -0.25, color: colors.foreground };
290
+ case "eyebrow":
291
+ return {
292
+ fontSize: 12,
293
+ fontWeight: "700",
294
+ textTransform: "uppercase",
295
+ letterSpacing: 3.5,
296
+ color: colors.brand.gold
297
+ };
298
+ case "subtitle":
299
+ return { fontSize: 14, fontWeight: "400", color: colors.mutedForeground };
300
+ default:
301
+ return {
302
+ fontSize: 20,
303
+ fontWeight: "600",
304
+ lineHeight: 20,
305
+ letterSpacing: -0.25,
306
+ color: colors.foreground
307
+ };
308
+ }
309
+ };
310
+ var getTextStyles = (colors, variant = "body") => {
311
+ switch (variant) {
312
+ case "sm":
313
+ return { fontSize: 14, fontWeight: "400", color: colors.foreground };
314
+ case "muted":
315
+ return { fontSize: 14, fontWeight: "400", color: colors.mutedForeground };
316
+ case "lead":
317
+ return { fontSize: 18, fontWeight: "400", color: colors.foreground };
318
+ case "label":
319
+ return { fontSize: 14, fontWeight: "500", lineHeight: 14, color: colors.foreground };
320
+ case "destructive":
321
+ return { fontSize: 14, fontWeight: "400", color: colors.destructive };
322
+ default:
323
+ return { fontSize: 16, fontWeight: "400", color: colors.foreground };
324
+ }
325
+ };
326
+ var getTabsListStyles = (colors, tokens) => ({
327
+ flexDirection: "row",
328
+ alignItems: "center",
329
+ gap: 4,
330
+ borderRadius: remToPx(tokens.radius.pill),
331
+ borderWidth: 1,
332
+ borderColor: colors.border,
333
+ backgroundColor: colors.card,
334
+ padding: 4
335
+ });
336
+ var getTabsTriggerStyles = (colors, tokens, isActive) => ({
337
+ container: {
338
+ alignItems: "center",
339
+ justifyContent: "center",
340
+ borderRadius: remToPx(tokens.radius.pill),
341
+ paddingHorizontal: 16,
342
+ paddingVertical: 8,
343
+ backgroundColor: isActive ? colors.primary : "transparent"
344
+ },
345
+ text: {
346
+ fontSize: 11,
347
+ fontWeight: "600",
348
+ textTransform: "uppercase",
349
+ letterSpacing: 1.2,
350
+ color: isActive ? colors.primaryForeground : colors.foreground
351
+ }
352
+ });
353
+ var tokensToStyleSheet = (tokens, scheme = "light") => {
354
+ const colors = getThemeColors(tokens, scheme);
355
+ return import_react_native.StyleSheet.create({
356
+ screen: {
357
+ flex: 1,
358
+ backgroundColor: colors.background
359
+ },
360
+ foregroundText: {
361
+ color: colors.foreground
362
+ },
363
+ mutedText: {
364
+ color: colors.mutedForeground
365
+ },
366
+ destructiveText: {
367
+ color: colors.destructive
368
+ },
369
+ card: getCardStyles(colors, tokens, "default"),
370
+ cardElevated: getCardStyles(colors, tokens, "elevated"),
371
+ input: getInputStyles(colors, tokens),
372
+ button: getButtonStyles(colors, tokens).container,
373
+ buttonText: getButtonStyles(colors, tokens).text,
374
+ alert: getAlertStyles(colors, tokens),
375
+ tabsList: getTabsListStyles(colors, tokens)
376
+ });
377
+ };
378
+
379
+ // src/native/theme/useRevitTheme.tsx
380
+ var import_react = require("react");
381
+
382
+ // src/theme/tokens.revit.ts
383
+ var brand = {
384
+ yellow: "#FFE500",
385
+ yellowLight: "#FFF06E",
386
+ offBlack: "#2C2C2C",
387
+ pink: "#FF005C",
388
+ purple: "#BA00FF",
389
+ blue: "#00FFFB",
390
+ gold: "#B8A500",
391
+ brown: "#78350F",
392
+ umber: "#58483B",
393
+ mist: "#F2F2F7"
394
+ };
395
+ var light = {
396
+ background: "#ffffff",
397
+ foreground: brand.offBlack,
398
+ card: "#ffffff",
399
+ cardForeground: brand.offBlack,
400
+ popover: "#ffffff",
401
+ popoverForeground: brand.offBlack,
402
+ primary: brand.yellow,
403
+ primaryForeground: "#000000",
404
+ secondary: "#000000",
405
+ secondaryForeground: "#ffffff",
406
+ muted: brand.mist,
407
+ mutedForeground: brand.umber,
408
+ accent: brand.yellowLight,
409
+ accentForeground: "#000000",
410
+ destructive: "#FF002B",
411
+ destructiveForeground: "#ffffff",
412
+ border: brand.mist,
413
+ input: brand.mist,
414
+ ring: brand.yellow,
415
+ brand
416
+ };
417
+ var dark = {
418
+ background: "#0f172a",
419
+ foreground: "#ffffff",
420
+ card: "#0f172a",
421
+ cardForeground: "#ffffff",
422
+ popover: "#0f172a",
423
+ popoverForeground: "#ffffff",
424
+ primary: brand.yellow,
425
+ primaryForeground: "#000000",
426
+ secondary: brand.yellow,
427
+ secondaryForeground: "#000000",
428
+ muted: "#1e293b",
429
+ mutedForeground: "#cbd5e1",
430
+ accent: "#1e293b",
431
+ accentForeground: "#ffffff",
432
+ destructive: "#FF002B",
433
+ destructiveForeground: "#ffffff",
434
+ border: "#334155",
435
+ input: "#334155",
436
+ ring: brand.yellow,
437
+ brand
438
+ };
439
+ var revitTokens = {
440
+ colors: light,
441
+ colorsDark: dark,
442
+ radius: {
443
+ sm: "0.375rem",
444
+ md: "0.5rem",
445
+ lg: "1.25rem",
446
+ xl: "1.5rem",
447
+ pill: "9999px"
448
+ },
449
+ fontFamily: {
450
+ sans: "Afacad, ui-sans-serif, system-ui, sans-serif"
451
+ }
452
+ };
453
+
454
+ // src/native/theme/useRevitTheme.tsx
455
+ var import_jsx_runtime = require("react/jsx-runtime");
456
+ var RevitThemeContext = (0, import_react.createContext)(null);
457
+ var RevitThemeProvider = ({
458
+ children,
459
+ tokens = revitTokens,
460
+ scheme = "light"
461
+ }) => {
462
+ const value = (0, import_react.useMemo)(
463
+ () => ({
464
+ tokens,
465
+ scheme,
466
+ colors: getThemeColors(tokens, scheme),
467
+ styles: tokensToStyleSheet(tokens, scheme)
468
+ }),
469
+ [tokens, scheme]
470
+ );
471
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RevitThemeContext.Provider, { value, children });
472
+ };
473
+ var useRevitTheme = () => {
474
+ const context = (0, import_react.useContext)(RevitThemeContext);
475
+ if (!context) {
476
+ return {
477
+ tokens: revitTokens,
478
+ scheme: "light",
479
+ colors: getThemeColors(revitTokens, "light"),
480
+ styles: tokensToStyleSheet(revitTokens, "light")
481
+ };
482
+ }
483
+ return context;
484
+ };
485
+
486
+ // src/native/components/Alert.tsx
487
+ var import_jsx_runtime2 = require("react/jsx-runtime");
488
+ var Alert = ({
489
+ variant = "default",
490
+ icon,
491
+ style,
492
+ testID = "Alert",
493
+ children,
494
+ ...props
495
+ }) => {
496
+ const { tokens, colors } = useRevitTheme();
497
+ const alertColor = variant === "destructive" ? colors.destructive : variant === "warning" ? colors.foreground : colors.cardForeground;
498
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
499
+ import_react_native2.View,
500
+ {
501
+ testID,
502
+ accessibilityRole: "alert",
503
+ style: mergeStyles(
504
+ getAlertStyles(colors, tokens, variant),
505
+ icon ? { flexDirection: "row", alignItems: "flex-start", gap: 12 } : void 0,
506
+ style
507
+ ),
508
+ ...props,
509
+ children: [
510
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.View, { style: { marginTop: 2 }, children: icon }) : null,
511
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.View, { style: { flex: 1, gap: 4 }, children: typeof children === "string" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { style: { fontSize: 14, color: alertColor }, children }) : children })
512
+ ]
513
+ }
514
+ );
515
+ };
516
+ var AlertTitle = ({ style, testID = "AlertTitle", ...props }) => {
517
+ const { colors } = useRevitTheme();
518
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
519
+ import_react_native2.Text,
520
+ {
521
+ testID,
522
+ accessibilityRole: "header",
523
+ style: mergeStyles(
524
+ {
525
+ marginBottom: 4,
526
+ fontSize: 14,
527
+ fontWeight: "600",
528
+ letterSpacing: -0.15,
529
+ color: colors.foreground
530
+ },
531
+ style
532
+ ),
533
+ ...props
534
+ }
535
+ );
536
+ };
537
+ var AlertDescription = ({
538
+ style,
539
+ testID = "AlertDescription",
540
+ ...props
541
+ }) => {
542
+ const { colors } = useRevitTheme();
543
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
544
+ import_react_native2.Text,
545
+ {
546
+ testID,
547
+ style: mergeStyles({ fontSize: 14, color: colors.mutedForeground }, style),
548
+ ...props
549
+ }
550
+ );
551
+ };
552
+
553
+ // src/native/components/Button.tsx
554
+ var import_react_native3 = require("react-native");
555
+ var import_jsx_runtime3 = require("react/jsx-runtime");
556
+ var Button = ({
557
+ variant = "default",
558
+ size = "default",
559
+ loading = false,
560
+ disabled,
561
+ children,
562
+ style,
563
+ textStyle,
564
+ testID = "Button",
565
+ ...props
566
+ }) => {
567
+ const { tokens, colors } = useRevitTheme();
568
+ const styles = getButtonStyles(colors, tokens, variant, size);
569
+ const isDisabled = disabled || loading;
570
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
571
+ import_react_native3.Pressable,
572
+ {
573
+ testID,
574
+ accessibilityRole: "button",
575
+ disabled: isDisabled,
576
+ style: ({ pressed }) => mergeStyles(
577
+ styles.container,
578
+ isDisabled ? { opacity: 0.5 } : void 0,
579
+ pressed && !isDisabled ? { transform: [{ scale: 1.02 }] } : void 0,
580
+ style
581
+ ),
582
+ ...props,
583
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.ActivityIndicator, { color: styles.text.color, size: "small" }) : typeof children === "string" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: mergeStyles(styles.text, textStyle), children }) : children
584
+ }
585
+ );
586
+ };
587
+
588
+ // src/native/components/Card.tsx
589
+ var import_react_native4 = require("react-native");
590
+ var import_jsx_runtime4 = require("react/jsx-runtime");
591
+ var Card = ({
592
+ variant = "default",
593
+ size: _size = "default",
594
+ style,
595
+ testID = "Card",
596
+ ...props
597
+ }) => {
598
+ const { tokens, colors } = useRevitTheme();
599
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
600
+ import_react_native4.View,
601
+ {
602
+ testID,
603
+ style: mergeStyles(getCardStyles(colors, tokens, variant), style),
604
+ ...props
605
+ }
606
+ );
607
+ };
608
+ var CardHeader = ({
609
+ size = "default",
610
+ style,
611
+ testID = "CardHeader",
612
+ ...props
613
+ }) => {
614
+ const padding = getCardPadding(size);
615
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
616
+ import_react_native4.View,
617
+ {
618
+ testID,
619
+ style: mergeStyles({ flexDirection: "column", gap: 6, padding }, style),
620
+ ...props
621
+ }
622
+ );
623
+ };
624
+ var CardTitle = ({ style, testID = "CardTitle", ...props }) => {
625
+ const { colors } = useRevitTheme();
626
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
627
+ import_react_native4.Text,
628
+ {
629
+ testID,
630
+ accessibilityRole: "header",
631
+ style: mergeStyles(
632
+ {
633
+ fontSize: 20,
634
+ fontWeight: "600",
635
+ lineHeight: 20,
636
+ letterSpacing: -0.25,
637
+ color: colors.foreground
638
+ },
639
+ style
640
+ ),
641
+ ...props
642
+ }
643
+ );
644
+ };
645
+ var CardDescription = ({
646
+ style,
647
+ testID = "CardDescription",
648
+ ...props
649
+ }) => {
650
+ const { colors } = useRevitTheme();
651
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
652
+ import_react_native4.Text,
653
+ {
654
+ testID,
655
+ style: mergeStyles({ fontSize: 14, color: colors.mutedForeground }, style),
656
+ ...props
657
+ }
658
+ );
659
+ };
660
+ var CardContent = ({
661
+ size = "default",
662
+ style,
663
+ testID = "CardContent",
664
+ ...props
665
+ }) => {
666
+ const padding = getCardPadding(size);
667
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
668
+ import_react_native4.View,
669
+ {
670
+ testID,
671
+ style: mergeStyles({ paddingHorizontal: padding, paddingBottom: padding }, style),
672
+ ...props
673
+ }
674
+ );
675
+ };
676
+
677
+ // src/native/components/Heading.tsx
678
+ var import_react_native5 = require("react-native");
679
+ var import_jsx_runtime5 = require("react/jsx-runtime");
680
+ var accessibilityLevels = {
681
+ h1: "header",
682
+ h2: "header",
683
+ h3: "header",
684
+ h4: "header",
685
+ h5: "header",
686
+ h6: "header",
687
+ p: "text"
688
+ };
689
+ var defaultTag = {
690
+ page: "h1",
691
+ title: "h2",
692
+ section: "h3",
693
+ eyebrow: "h2",
694
+ subtitle: "p"
695
+ };
696
+ var Heading = ({
697
+ as,
698
+ variant = "title",
699
+ style,
700
+ testID = "Heading",
701
+ ...props
702
+ }) => {
703
+ const { colors } = useRevitTheme();
704
+ const tag = as ?? defaultTag[variant];
705
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
706
+ import_react_native5.Text,
707
+ {
708
+ testID,
709
+ accessibilityRole: accessibilityLevels[tag],
710
+ style: mergeStyles(getHeadingStyles(colors, variant), style),
711
+ ...props
712
+ }
713
+ );
714
+ };
715
+
716
+ // src/native/components/Input.tsx
717
+ var import_react_native6 = require("react-native");
718
+ var import_jsx_runtime6 = require("react/jsx-runtime");
719
+ var Input = ({
720
+ variant = "default",
721
+ size = "default",
722
+ editable = true,
723
+ style,
724
+ placeholderTextColor,
725
+ testID = "Input",
726
+ ...props
727
+ }) => {
728
+ const { tokens, colors } = useRevitTheme();
729
+ const inputStyles = getInputStyles(colors, tokens, variant, size);
730
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
731
+ import_react_native6.TextInput,
732
+ {
733
+ testID,
734
+ editable,
735
+ placeholderTextColor: placeholderTextColor ?? colors.mutedForeground,
736
+ style: mergeStyles(
737
+ inputStyles,
738
+ !editable ? { opacity: 0.5 } : void 0,
739
+ style
740
+ ),
741
+ ...props
742
+ }
743
+ );
744
+ };
745
+
746
+ // src/native/components/Label.tsx
747
+ var import_react_native7 = require("react-native");
748
+ var import_jsx_runtime7 = require("react/jsx-runtime");
749
+ var Label = ({
750
+ variant = "default",
751
+ style,
752
+ testID = "Label",
753
+ ...props
754
+ }) => {
755
+ const { colors } = useRevitTheme();
756
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
757
+ import_react_native7.Text,
758
+ {
759
+ testID,
760
+ accessibilityRole: "text",
761
+ style: mergeStyles(getLabelStyles(colors, variant), style),
762
+ ...props
763
+ }
764
+ );
765
+ };
766
+
767
+ // src/native/components/Tabs.tsx
768
+ var import_react2 = require("react");
769
+ var import_react_native8 = require("react-native");
770
+ var import_jsx_runtime8 = require("react/jsx-runtime");
771
+ var TabsContext = (0, import_react2.createContext)(null);
772
+ var useTabsContext = () => {
773
+ const context = (0, import_react2.useContext)(TabsContext);
774
+ if (!context) {
775
+ throw new Error("Tabs components must be used within Tabs");
776
+ }
777
+ return context;
778
+ };
779
+ var Tabs = ({
780
+ value,
781
+ defaultValue = "",
782
+ onValueChange,
783
+ children,
784
+ testID = "Tabs"
785
+ }) => {
786
+ const [internalValue, internalValueSetter] = (0, import_react2.useState)(defaultValue);
787
+ const currentValue = value ?? internalValue;
788
+ const contextValue = (0, import_react2.useMemo)(
789
+ () => ({
790
+ value: currentValue,
791
+ onValueChange: (nextValue) => {
792
+ if (value === void 0) {
793
+ internalValueSetter(nextValue);
794
+ }
795
+ onValueChange?.(nextValue);
796
+ }
797
+ }),
798
+ [currentValue, onValueChange, value]
799
+ );
800
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TabsContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native8.View, { testID, children }) });
801
+ };
802
+ var TabsList = ({ style, testID = "TabsList", ...props }) => {
803
+ const { tokens, colors } = useRevitTheme();
804
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
805
+ import_react_native8.View,
806
+ {
807
+ testID,
808
+ style: mergeStyles(getTabsListStyles(colors, tokens), style),
809
+ ...props
810
+ }
811
+ );
812
+ };
813
+ var TabsTrigger = ({
814
+ value,
815
+ disabled,
816
+ children,
817
+ style,
818
+ textStyle,
819
+ testID = "TabsTrigger",
820
+ ...props
821
+ }) => {
822
+ const { tokens, colors } = useRevitTheme();
823
+ const { value: activeValue, onValueChange } = useTabsContext();
824
+ const isActive = activeValue === value;
825
+ const styles = getTabsTriggerStyles(colors, tokens, isActive);
826
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
827
+ import_react_native8.Pressable,
828
+ {
829
+ testID,
830
+ accessibilityRole: "tab",
831
+ accessibilityState: { selected: isActive, disabled: Boolean(disabled) },
832
+ disabled,
833
+ onPress: () => onValueChange(value),
834
+ style: ({ pressed }) => mergeStyles(
835
+ styles.container,
836
+ pressed && !disabled ? { opacity: 0.9 } : void 0,
837
+ disabled ? { opacity: 0.5 } : void 0,
838
+ style
839
+ ),
840
+ ...props,
841
+ children: typeof children === "string" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native8.Text, { style: mergeStyles(styles.text, textStyle), children }) : children
842
+ }
843
+ );
844
+ };
845
+
846
+ // src/native/components/Text.tsx
847
+ var import_react_native9 = require("react-native");
848
+ var import_jsx_runtime9 = require("react/jsx-runtime");
849
+ var Text7 = ({
850
+ variant = "body",
851
+ style,
852
+ testID = "Text",
853
+ ...props
854
+ }) => {
855
+ const { colors } = useRevitTheme();
856
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
857
+ import_react_native9.Text,
858
+ {
859
+ testID,
860
+ style: mergeStyles(getTextStyles(colors, variant), style),
861
+ ...props
862
+ }
863
+ );
864
+ };
865
+ // Annotate the CommonJS export names for ESM import in node:
866
+ 0 && (module.exports = {
867
+ Alert,
868
+ AlertDescription,
869
+ AlertTitle,
870
+ Button,
871
+ Card,
872
+ CardContent,
873
+ CardDescription,
874
+ CardHeader,
875
+ CardTitle,
876
+ Heading,
877
+ Input,
878
+ Label,
879
+ RevitThemeProvider,
880
+ Tabs,
881
+ TabsList,
882
+ TabsTrigger,
883
+ Text,
884
+ getAlertStyles,
885
+ getButtonStyles,
886
+ getCardPadding,
887
+ getCardStyles,
888
+ getHeadingStyles,
889
+ getInputStyles,
890
+ getLabelStyles,
891
+ getTabsListStyles,
892
+ getTabsTriggerStyles,
893
+ getTextStyles,
894
+ getThemeColors,
895
+ tokensToStyleSheet,
896
+ useRevitTheme
897
+ });
898
+ //# sourceMappingURL=index.cjs.map