@yomologic/react-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,1047 @@
1
+ // src/ui/button.tsx
2
+ import React from "react";
3
+
4
+ // src/lib/utils.ts
5
+ import { clsx } from "clsx";
6
+ function cn(...inputs) {
7
+ return clsx(inputs);
8
+ }
9
+
10
+ // src/ui/button.tsx
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ var Button = React.forwardRef(
13
+ ({
14
+ className,
15
+ variant = "primary",
16
+ size = "md",
17
+ isLoading = false,
18
+ leftIcon,
19
+ rightIcon,
20
+ children,
21
+ disabled,
22
+ ...props
23
+ }, ref) => {
24
+ const baseStyles = "inline-flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed";
25
+ const variants = {
26
+ primary: "[background-color:var(--color-primary)] text-white hover:[background-color:var(--color-primary-hover)] focus:[--tw-ring-color:var(--color-primary)]",
27
+ secondary: "[background-color:var(--color-secondary)] text-white hover:[background-color:var(--color-secondary-hover)] focus:[--tw-ring-color:var(--color-secondary)]",
28
+ outline: "border-2 [border-color:var(--color-primary)] [color:var(--color-primary)] hover:bg-blue-50 focus:[--tw-ring-color:var(--color-primary)]",
29
+ ghost: "text-gray-700 hover:bg-gray-100 focus:ring-gray-500",
30
+ danger: "[background-color:var(--color-error)] text-white hover:bg-red-700 focus:[--tw-ring-color:var(--color-error)]"
31
+ };
32
+ const sizes = {
33
+ sm: "[font-size:var(--button-text-sm)] [padding-left:var(--button-padding-sm-x)] [padding-right:var(--button-padding-sm-x)] [padding-top:var(--button-padding-sm-y)] [padding-bottom:var(--button-padding-sm-y)] gap-1.5",
34
+ md: "[font-size:var(--button-text-md)] [padding-left:var(--button-padding-md-x)] [padding-right:var(--button-padding-md-x)] [padding-top:var(--button-padding-md-y)] [padding-bottom:var(--button-padding-md-y)] gap-2",
35
+ lg: "[font-size:var(--button-text-lg)] [padding-left:var(--button-padding-lg-x)] [padding-right:var(--button-padding-lg-x)] [padding-top:var(--button-padding-lg-y)] [padding-bottom:var(--button-padding-lg-y)] gap-2.5"
36
+ };
37
+ const radiusStyle = "[border-radius:var(--button-radius)]";
38
+ const fontWeightStyle = "[font-weight:var(--button-font-weight)]";
39
+ return /* @__PURE__ */ jsxs(
40
+ "button",
41
+ {
42
+ ref,
43
+ className: cn(
44
+ baseStyles,
45
+ variants[variant],
46
+ sizes[size],
47
+ radiusStyle,
48
+ fontWeightStyle,
49
+ className
50
+ ),
51
+ disabled: disabled || isLoading,
52
+ ...props,
53
+ children: [
54
+ isLoading && /* @__PURE__ */ jsxs(
55
+ "svg",
56
+ {
57
+ className: "animate-spin h-4 w-4",
58
+ xmlns: "http://www.w3.org/2000/svg",
59
+ fill: "none",
60
+ viewBox: "0 0 24 24",
61
+ children: [
62
+ /* @__PURE__ */ jsx(
63
+ "circle",
64
+ {
65
+ className: "opacity-25",
66
+ cx: "12",
67
+ cy: "12",
68
+ r: "10",
69
+ stroke: "currentColor",
70
+ strokeWidth: "4"
71
+ }
72
+ ),
73
+ /* @__PURE__ */ jsx(
74
+ "path",
75
+ {
76
+ className: "opacity-75",
77
+ fill: "currentColor",
78
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
79
+ }
80
+ )
81
+ ]
82
+ }
83
+ ),
84
+ !isLoading && leftIcon && leftIcon,
85
+ children,
86
+ !isLoading && rightIcon && rightIcon
87
+ ]
88
+ }
89
+ );
90
+ }
91
+ );
92
+ Button.displayName = "Button";
93
+
94
+ // src/ui/input.tsx
95
+ import React2 from "react";
96
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
97
+ var Input = React2.forwardRef(
98
+ ({
99
+ className,
100
+ type = "text",
101
+ label,
102
+ error,
103
+ helperText,
104
+ leftIcon,
105
+ rightIcon,
106
+ fullWidth = false,
107
+ id,
108
+ ...props
109
+ }, ref) => {
110
+ const inputId = id || label?.toLowerCase().replace(/\s+/g, "-");
111
+ return /* @__PURE__ */ jsxs2("div", { className: cn("flex flex-col", fullWidth && "w-full"), children: [
112
+ label && /* @__PURE__ */ jsxs2(
113
+ "label",
114
+ {
115
+ htmlFor: inputId,
116
+ className: "block text-sm font-semibold text-gray-600 mb-1",
117
+ children: [
118
+ label,
119
+ props.required && /* @__PURE__ */ jsx2("span", { className: "text-red-500 ml-1", children: "*" })
120
+ ]
121
+ }
122
+ ),
123
+ /* @__PURE__ */ jsxs2("div", { className: "relative", children: [
124
+ leftIcon && /* @__PURE__ */ jsx2("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-gray-400", children: leftIcon }),
125
+ /* @__PURE__ */ jsx2(
126
+ "input",
127
+ {
128
+ ref,
129
+ type,
130
+ id: inputId,
131
+ className: cn(
132
+ "w-full px-3 py-2 border rounded-md transition-colors",
133
+ "text-gray-700 placeholder-gray-400",
134
+ "focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
135
+ "disabled:bg-gray-100 disabled:cursor-not-allowed disabled:text-gray-500",
136
+ error ? "border-red-500 focus:ring-red-500" : "border-gray-400",
137
+ leftIcon && "pl-10",
138
+ rightIcon && "pr-10",
139
+ className
140
+ ),
141
+ ...props
142
+ }
143
+ ),
144
+ rightIcon && /* @__PURE__ */ jsx2("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-gray-400", children: rightIcon })
145
+ ] }),
146
+ error && /* @__PURE__ */ jsx2("p", { className: "mt-1 text-sm text-red-600", children: error }),
147
+ helperText && !error && /* @__PURE__ */ jsx2("p", { className: "mt-1 text-sm text-gray-500", children: helperText })
148
+ ] });
149
+ }
150
+ );
151
+ Input.displayName = "Input";
152
+
153
+ // src/ui/card.tsx
154
+ import React3 from "react";
155
+ import { jsx as jsx3 } from "react/jsx-runtime";
156
+ var Card = React3.forwardRef(
157
+ ({
158
+ className,
159
+ variant = "default",
160
+ padding = "md",
161
+ hoverable = false,
162
+ children,
163
+ ...props
164
+ }, ref) => {
165
+ const baseStyles = "bg-white rounded-lg";
166
+ const variants = {
167
+ default: "border border-gray-200",
168
+ bordered: "border-2 border-gray-300",
169
+ elevated: "shadow-md"
170
+ };
171
+ const paddings = {
172
+ none: "",
173
+ sm: "p-3",
174
+ md: "p-4",
175
+ lg: "p-6"
176
+ };
177
+ const hoverStyles = hoverable ? "hover:shadow-lg transition-shadow cursor-pointer" : "";
178
+ return /* @__PURE__ */ jsx3(
179
+ "div",
180
+ {
181
+ ref,
182
+ className: cn(
183
+ baseStyles,
184
+ variants[variant],
185
+ paddings[padding],
186
+ hoverStyles,
187
+ className
188
+ ),
189
+ ...props,
190
+ children
191
+ }
192
+ );
193
+ }
194
+ );
195
+ Card.displayName = "Card";
196
+ var CardHeader = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
197
+ "div",
198
+ {
199
+ ref,
200
+ className: cn("flex flex-col space-y-1.5", className),
201
+ ...props
202
+ }
203
+ ));
204
+ CardHeader.displayName = "CardHeader";
205
+ var CardTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
206
+ "h3",
207
+ {
208
+ ref,
209
+ className: cn("text-lg font-semibold text-gray-800", className),
210
+ ...props
211
+ }
212
+ ));
213
+ CardTitle.displayName = "CardTitle";
214
+ var CardDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3("p", { ref, className: cn("text-sm text-gray-600", className), ...props }));
215
+ CardDescription.displayName = "CardDescription";
216
+ var CardContent = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3("div", { ref, className: cn("pt-0", className), ...props }));
217
+ CardContent.displayName = "CardContent";
218
+ var CardFooter = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
219
+ "div",
220
+ {
221
+ ref,
222
+ className: cn("flex items-center pt-4", className),
223
+ ...props
224
+ }
225
+ ));
226
+ CardFooter.displayName = "CardFooter";
227
+
228
+ // src/ui/badge.tsx
229
+ import React4 from "react";
230
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
231
+ var Badge = React4.forwardRef(
232
+ ({
233
+ className,
234
+ variant = "default",
235
+ size = "md",
236
+ dot = false,
237
+ children,
238
+ ...props
239
+ }, ref) => {
240
+ const baseStyles = "inline-flex items-center font-medium rounded-full";
241
+ const variants = {
242
+ default: "bg-gray-100 text-gray-800",
243
+ primary: "bg-blue-100 text-blue-800",
244
+ success: "bg-green-100 text-green-800",
245
+ warning: "bg-yellow-100 text-yellow-800",
246
+ danger: "bg-red-100 text-red-800",
247
+ info: "bg-cyan-100 text-cyan-800"
248
+ };
249
+ const sizes = {
250
+ sm: "text-xs px-2 py-0.5",
251
+ md: "text-sm px-2.5 py-1",
252
+ lg: "text-base px-3 py-1.5"
253
+ };
254
+ const dotVariants = {
255
+ default: "bg-gray-600",
256
+ primary: "bg-blue-600",
257
+ success: "bg-green-600",
258
+ warning: "bg-yellow-600",
259
+ danger: "bg-red-600",
260
+ info: "bg-cyan-600"
261
+ };
262
+ return /* @__PURE__ */ jsxs3(
263
+ "span",
264
+ {
265
+ ref,
266
+ className: cn(baseStyles, variants[variant], sizes[size], className),
267
+ ...props,
268
+ children: [
269
+ dot && /* @__PURE__ */ jsx4(
270
+ "span",
271
+ {
272
+ className: cn("w-2 h-2 rounded-full mr-1.5", dotVariants[variant])
273
+ }
274
+ ),
275
+ children
276
+ ]
277
+ }
278
+ );
279
+ }
280
+ );
281
+ Badge.displayName = "Badge";
282
+
283
+ // src/ui/checkbox.tsx
284
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
285
+ function Checkbox({
286
+ label,
287
+ checked = false,
288
+ onChange,
289
+ disabled = false,
290
+ className,
291
+ id
292
+ }) {
293
+ const checkboxId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
294
+ const handleChange = (e) => {
295
+ if (onChange) {
296
+ onChange(e.target.checked);
297
+ }
298
+ };
299
+ return /* @__PURE__ */ jsxs4("div", { className: cn("flex items-center", className), children: [
300
+ /* @__PURE__ */ jsx5(
301
+ "input",
302
+ {
303
+ type: "checkbox",
304
+ id: checkboxId,
305
+ checked,
306
+ onChange: handleChange,
307
+ disabled,
308
+ className: cn(
309
+ "h-4 w-4 rounded border-gray-400 text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
310
+ disabled && "cursor-not-allowed opacity-50"
311
+ )
312
+ }
313
+ ),
314
+ label && /* @__PURE__ */ jsx5(
315
+ "label",
316
+ {
317
+ htmlFor: checkboxId,
318
+ className: cn(
319
+ "ml-2 text-sm font-medium text-gray-600",
320
+ disabled && "cursor-not-allowed opacity-50",
321
+ !disabled && "cursor-pointer"
322
+ ),
323
+ children: label
324
+ }
325
+ )
326
+ ] });
327
+ }
328
+ function CheckboxGroup({
329
+ label,
330
+ name,
331
+ options,
332
+ value = [],
333
+ onChange,
334
+ className,
335
+ orientation = "vertical",
336
+ required = false,
337
+ disabled = false
338
+ }) {
339
+ const handleChange = (optionValue, checked) => {
340
+ if (onChange) {
341
+ if (checked) {
342
+ onChange([...value, optionValue]);
343
+ } else {
344
+ onChange(value.filter((v) => v !== optionValue));
345
+ }
346
+ }
347
+ };
348
+ return /* @__PURE__ */ jsxs4("div", { className, children: [
349
+ label && /* @__PURE__ */ jsxs4("label", { className: "block text-sm font-semibold text-gray-600 mb-1", children: [
350
+ label,
351
+ required && /* @__PURE__ */ jsx5("span", { className: "text-red-500 ml-1", children: "*" })
352
+ ] }),
353
+ /* @__PURE__ */ jsx5(
354
+ "div",
355
+ {
356
+ className: cn(
357
+ "space-y-2",
358
+ orientation === "horizontal" && "flex flex-wrap gap-4 space-y-0"
359
+ ),
360
+ children: options.map((option) => {
361
+ const isDisabled = disabled || option.disabled;
362
+ return /* @__PURE__ */ jsxs4("div", { className: "flex items-center", children: [
363
+ /* @__PURE__ */ jsx5(
364
+ "input",
365
+ {
366
+ type: "checkbox",
367
+ id: `${name}-${option.value}`,
368
+ name,
369
+ value: option.value,
370
+ checked: value.includes(option.value),
371
+ onChange: (e) => handleChange(option.value, e.target.checked),
372
+ disabled: isDisabled,
373
+ className: cn(
374
+ "h-4 w-4 rounded border-gray-400 text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
375
+ isDisabled && "cursor-not-allowed opacity-50"
376
+ )
377
+ }
378
+ ),
379
+ /* @__PURE__ */ jsx5(
380
+ "label",
381
+ {
382
+ htmlFor: `${name}-${option.value}`,
383
+ className: cn(
384
+ "ml-2 text-sm font-medium text-gray-600",
385
+ isDisabled && "cursor-not-allowed opacity-50",
386
+ !isDisabled && "cursor-pointer"
387
+ ),
388
+ children: option.label
389
+ }
390
+ )
391
+ ] }, option.value);
392
+ })
393
+ }
394
+ )
395
+ ] });
396
+ }
397
+
398
+ // src/ui/radio.tsx
399
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
400
+ function RadioGroup({
401
+ label,
402
+ name,
403
+ options,
404
+ value,
405
+ onChange,
406
+ className,
407
+ orientation = "vertical",
408
+ required = false,
409
+ disabled = false
410
+ }) {
411
+ const handleChange = (e) => {
412
+ if (onChange) {
413
+ onChange(e.target.value);
414
+ }
415
+ };
416
+ return /* @__PURE__ */ jsxs5("div", { className, children: [
417
+ label && /* @__PURE__ */ jsxs5("label", { className: "block text-sm font-semibold text-gray-600 mb-1", children: [
418
+ label,
419
+ required && /* @__PURE__ */ jsx6("span", { className: "text-red-500 ml-1", children: "*" })
420
+ ] }),
421
+ /* @__PURE__ */ jsx6(
422
+ "div",
423
+ {
424
+ className: cn(
425
+ orientation === "vertical" && "space-y-2",
426
+ orientation === "horizontal" && "flex flex-wrap gap-4"
427
+ ),
428
+ children: options.map((option) => {
429
+ const isDisabled = disabled || option.disabled;
430
+ return /* @__PURE__ */ jsxs5("div", { className: "flex items-center", children: [
431
+ /* @__PURE__ */ jsx6(
432
+ "input",
433
+ {
434
+ type: "radio",
435
+ id: `${name}-${option.value}`,
436
+ name,
437
+ value: option.value,
438
+ checked: value === option.value,
439
+ onChange: handleChange,
440
+ disabled: isDisabled,
441
+ className: cn(
442
+ "h-4 w-4 border-gray-400 text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
443
+ isDisabled && "cursor-not-allowed opacity-50"
444
+ )
445
+ }
446
+ ),
447
+ /* @__PURE__ */ jsx6(
448
+ "label",
449
+ {
450
+ htmlFor: `${name}-${option.value}`,
451
+ className: cn(
452
+ "ml-2 text-sm font-medium text-gray-600",
453
+ isDisabled && "cursor-not-allowed opacity-50",
454
+ !isDisabled && "cursor-pointer"
455
+ ),
456
+ children: option.label
457
+ }
458
+ )
459
+ ] }, option.value);
460
+ })
461
+ }
462
+ )
463
+ ] });
464
+ }
465
+
466
+ // src/ui/dropdown.tsx
467
+ import { useState, useRef, useEffect } from "react";
468
+ import { ChevronDown } from "lucide-react";
469
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
470
+ function Dropdown({
471
+ label,
472
+ placeholder = "Select an option",
473
+ options = [],
474
+ value,
475
+ onChange,
476
+ children,
477
+ disabled = false,
478
+ error,
479
+ helperText,
480
+ required = false,
481
+ className = ""
482
+ }) {
483
+ const [isOpen, setIsOpen] = useState(false);
484
+ const dropdownRef = useRef(null);
485
+ const getSelectedLabel = () => {
486
+ if (!value) return placeholder;
487
+ const selected = options.find((opt) => opt.value === value);
488
+ return selected ? selected.label : placeholder;
489
+ };
490
+ useEffect(() => {
491
+ const handleClickOutside = (event) => {
492
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
493
+ setIsOpen(false);
494
+ }
495
+ };
496
+ document.addEventListener("mousedown", handleClickOutside);
497
+ return () => document.removeEventListener("mousedown", handleClickOutside);
498
+ }, []);
499
+ const handleSelect = (optionValue) => {
500
+ onChange?.(optionValue);
501
+ setIsOpen(false);
502
+ };
503
+ const handleKeyDown = (e) => {
504
+ if (disabled) return;
505
+ if (e.key === "Enter" || e.key === " ") {
506
+ e.preventDefault();
507
+ setIsOpen(!isOpen);
508
+ } else if (e.key === "Escape") {
509
+ setIsOpen(false);
510
+ }
511
+ };
512
+ return /* @__PURE__ */ jsxs6("div", { className: `w-full ${className}`, children: [
513
+ label && /* @__PURE__ */ jsxs6("label", { className: "block text-sm font-semibold text-gray-600 mb-1", children: [
514
+ label,
515
+ required && /* @__PURE__ */ jsx7("span", { className: "text-red-500 ml-1", children: "*" })
516
+ ] }),
517
+ /* @__PURE__ */ jsxs6("div", { ref: dropdownRef, className: "relative", children: [
518
+ /* @__PURE__ */ jsxs6(
519
+ "button",
520
+ {
521
+ type: "button",
522
+ onClick: () => !disabled && setIsOpen(!isOpen),
523
+ onKeyDown: handleKeyDown,
524
+ disabled,
525
+ className: `
526
+ w-full px-4 py-2 text-left bg-white border rounded-lg
527
+ flex items-center justify-between
528
+ transition-all duration-200
529
+ ${error ? "border-red-500 focus:ring-2 focus:ring-red-200 focus:border-red-500" : "border-gray-400 focus:ring-2 focus:ring-blue-200 focus:border-blue-500"}
530
+ ${disabled ? "bg-gray-100 cursor-not-allowed opacity-60" : "hover:border-gray-400"}
531
+ ${!value ? "text-gray-400" : "text-gray-900"}
532
+ `,
533
+ children: [
534
+ /* @__PURE__ */ jsx7("span", { className: "truncate", children: getSelectedLabel() }),
535
+ /* @__PURE__ */ jsx7(
536
+ ChevronDown,
537
+ {
538
+ className: `w-5 h-5 text-gray-400 transition-transform duration-200 shrink-0 ml-2 ${isOpen ? "transform rotate-180" : ""}`
539
+ }
540
+ )
541
+ ]
542
+ }
543
+ ),
544
+ isOpen && !disabled && /* @__PURE__ */ jsx7(
545
+ "div",
546
+ {
547
+ className: "absolute z-50 w-full mt-1 bg-white border border-gray-400 rounded-lg shadow-lg max-h-60 overflow-auto",
548
+ role: "listbox",
549
+ children: children ? (
550
+ // Custom content
551
+ /* @__PURE__ */ jsx7("div", { onClick: () => setIsOpen(false), children })
552
+ ) : (
553
+ // Standard options
554
+ /* @__PURE__ */ jsx7("ul", { children: options.map((option) => /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsx7(
555
+ "button",
556
+ {
557
+ type: "button",
558
+ onClick: () => !option.disabled && handleSelect(option.value),
559
+ disabled: option.disabled,
560
+ className: `
561
+ w-full px-4 py-2 text-left text-sm
562
+ transition-colors duration-150
563
+ ${option.value === value ? "bg-blue-50 text-blue-700 font-medium" : "text-gray-900 hover:bg-gray-100"}
564
+ ${option.disabled ? "opacity-50 cursor-not-allowed" : ""}
565
+ `,
566
+ role: "option",
567
+ "aria-selected": option.value === value,
568
+ children: option.label
569
+ }
570
+ ) }, option.value)) })
571
+ )
572
+ }
573
+ )
574
+ ] }),
575
+ (helperText || error) && /* @__PURE__ */ jsx7(
576
+ "p",
577
+ {
578
+ className: `mt-1 text-xs ${error ? "text-red-600" : "text-gray-500"}`,
579
+ children: error || helperText
580
+ }
581
+ )
582
+ ] });
583
+ }
584
+
585
+ // src/ui/spinner.tsx
586
+ import React5 from "react";
587
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
588
+ var Spinner = React5.forwardRef(
589
+ ({ className, size = "md", color = "primary", label, ...props }, ref) => {
590
+ const sizes = {
591
+ sm: "h-4 w-4",
592
+ md: "h-8 w-8",
593
+ lg: "h-12 w-12",
594
+ xl: "h-16 w-16"
595
+ };
596
+ const colors = {
597
+ primary: "text-blue-600",
598
+ secondary: "text-gray-600",
599
+ white: "text-white"
600
+ };
601
+ return /* @__PURE__ */ jsxs7(
602
+ "div",
603
+ {
604
+ ref,
605
+ className: cn(
606
+ "flex flex-col items-center justify-center gap-2",
607
+ className
608
+ ),
609
+ ...props,
610
+ children: [
611
+ /* @__PURE__ */ jsxs7(
612
+ "svg",
613
+ {
614
+ className: cn("animate-spin", sizes[size], colors[color]),
615
+ xmlns: "http://www.w3.org/2000/svg",
616
+ fill: "none",
617
+ viewBox: "0 0 24 24",
618
+ children: [
619
+ /* @__PURE__ */ jsx8(
620
+ "circle",
621
+ {
622
+ className: "opacity-25",
623
+ cx: "12",
624
+ cy: "12",
625
+ r: "10",
626
+ stroke: "currentColor",
627
+ strokeWidth: "4"
628
+ }
629
+ ),
630
+ /* @__PURE__ */ jsx8(
631
+ "path",
632
+ {
633
+ className: "opacity-75",
634
+ fill: "currentColor",
635
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
636
+ }
637
+ )
638
+ ]
639
+ }
640
+ ),
641
+ label && /* @__PURE__ */ jsx8("p", { className: "text-sm text-gray-600", children: label })
642
+ ]
643
+ }
644
+ );
645
+ }
646
+ );
647
+ Spinner.displayName = "Spinner";
648
+
649
+ // src/ui/code-snippet.tsx
650
+ import { useState as useState2 } from "react";
651
+ import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
652
+ import { vscDarkPlus } from "react-syntax-highlighter/dist/esm/styles/prism";
653
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
654
+ function CodeSnippet({ code, language = "tsx" }) {
655
+ const [copied, setCopied] = useState2(false);
656
+ const [showTooltip, setShowTooltip] = useState2(false);
657
+ const handleCopy = async () => {
658
+ try {
659
+ await navigator.clipboard.writeText(code);
660
+ setCopied(true);
661
+ setTimeout(() => setCopied(false), 2e3);
662
+ } catch (err) {
663
+ console.error("Failed to copy:", err);
664
+ }
665
+ };
666
+ return /* @__PURE__ */ jsxs8("div", { className: "relative group", children: [
667
+ /* @__PURE__ */ jsxs8("div", { className: "absolute right-3 top-3 z-10", children: [
668
+ /* @__PURE__ */ jsx9(
669
+ "button",
670
+ {
671
+ onClick: handleCopy,
672
+ onMouseEnter: () => setShowTooltip(true),
673
+ onMouseLeave: () => setShowTooltip(false),
674
+ className: "p-2 rounded-md bg-gray-800 hover:bg-gray-700 text-gray-400 hover:text-gray-200 transition-all duration-200 border border-gray-700 hover:border-gray-600 shadow-lg",
675
+ "aria-label": "Copy code",
676
+ children: copied ? (
677
+ // Check icon
678
+ /* @__PURE__ */ jsx9(
679
+ "svg",
680
+ {
681
+ className: "w-4 h-4 text-green-400",
682
+ fill: "none",
683
+ stroke: "currentColor",
684
+ viewBox: "0 0 24 24",
685
+ children: /* @__PURE__ */ jsx9(
686
+ "path",
687
+ {
688
+ strokeLinecap: "round",
689
+ strokeLinejoin: "round",
690
+ strokeWidth: 2,
691
+ d: "M5 13l4 4L19 7"
692
+ }
693
+ )
694
+ }
695
+ )
696
+ ) : (
697
+ // Copy icon
698
+ /* @__PURE__ */ jsx9(
699
+ "svg",
700
+ {
701
+ className: "w-4 h-4",
702
+ fill: "none",
703
+ stroke: "currentColor",
704
+ viewBox: "0 0 24 24",
705
+ children: /* @__PURE__ */ jsx9(
706
+ "path",
707
+ {
708
+ strokeLinecap: "round",
709
+ strokeLinejoin: "round",
710
+ strokeWidth: 2,
711
+ d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
712
+ }
713
+ )
714
+ }
715
+ )
716
+ )
717
+ }
718
+ ),
719
+ showTooltip && !copied && /* @__PURE__ */ jsxs8("div", { className: "absolute right-0 top-full mt-2 px-2 py-1 bg-gray-800 text-white text-xs rounded shadow-lg whitespace-nowrap border border-gray-700", children: [
720
+ "Copy code",
721
+ /* @__PURE__ */ jsx9("div", { className: "absolute -top-1 right-3 w-2 h-2 bg-gray-800 border-l border-t border-gray-700 transform rotate-45" })
722
+ ] }),
723
+ copied && /* @__PURE__ */ jsxs8("div", { className: "absolute right-0 top-full mt-2 px-2 py-1 bg-green-600 text-white text-xs rounded shadow-lg whitespace-nowrap", children: [
724
+ "Copied!",
725
+ /* @__PURE__ */ jsx9("div", { className: "absolute -top-1 right-3 w-2 h-2 bg-green-600 transform rotate-45" })
726
+ ] })
727
+ ] }),
728
+ /* @__PURE__ */ jsx9("div", { className: "rounded-lg overflow-hidden border border-gray-800", children: /* @__PURE__ */ jsx9(
729
+ SyntaxHighlighter,
730
+ {
731
+ language,
732
+ style: vscDarkPlus,
733
+ customStyle: {
734
+ margin: 0,
735
+ padding: "1rem 3.5rem 1rem 1rem",
736
+ fontSize: "0.875rem",
737
+ lineHeight: "1.5",
738
+ background: "#1a1b26"
739
+ },
740
+ showLineNumbers: false,
741
+ children: code
742
+ }
743
+ ) })
744
+ ] });
745
+ }
746
+
747
+ // src/feedback/alert.tsx
748
+ import React6 from "react";
749
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
750
+ var Alert = React6.forwardRef(
751
+ ({
752
+ className,
753
+ variant = "info",
754
+ title,
755
+ dismissible = false,
756
+ onDismiss,
757
+ icon,
758
+ children,
759
+ ...props
760
+ }, ref) => {
761
+ const variants = {
762
+ info: "bg-blue-50 border-blue-200 text-blue-800",
763
+ success: "bg-green-50 border-green-200 text-green-800",
764
+ warning: "bg-yellow-50 border-yellow-200 text-yellow-800",
765
+ error: "bg-red-50 border-red-200 text-red-800"
766
+ };
767
+ const iconColors = {
768
+ info: "text-blue-500",
769
+ success: "text-green-500",
770
+ warning: "text-yellow-500",
771
+ error: "text-red-500"
772
+ };
773
+ const defaultIcons = {
774
+ info: /* @__PURE__ */ jsx10("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx10(
775
+ "path",
776
+ {
777
+ fillRule: "evenodd",
778
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",
779
+ clipRule: "evenodd"
780
+ }
781
+ ) }),
782
+ success: /* @__PURE__ */ jsx10("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx10(
783
+ "path",
784
+ {
785
+ fillRule: "evenodd",
786
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
787
+ clipRule: "evenodd"
788
+ }
789
+ ) }),
790
+ warning: /* @__PURE__ */ jsx10("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx10(
791
+ "path",
792
+ {
793
+ fillRule: "evenodd",
794
+ d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",
795
+ clipRule: "evenodd"
796
+ }
797
+ ) }),
798
+ error: /* @__PURE__ */ jsx10("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx10(
799
+ "path",
800
+ {
801
+ fillRule: "evenodd",
802
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",
803
+ clipRule: "evenodd"
804
+ }
805
+ ) })
806
+ };
807
+ return /* @__PURE__ */ jsx10(
808
+ "div",
809
+ {
810
+ ref,
811
+ className: cn(
812
+ "relative border rounded-lg p-4",
813
+ variants[variant],
814
+ className
815
+ ),
816
+ role: "alert",
817
+ ...props,
818
+ children: /* @__PURE__ */ jsxs9("div", { className: "flex items-start gap-3", children: [
819
+ /* @__PURE__ */ jsx10("div", { className: cn("flex-shrink-0", iconColors[variant]), children: icon || defaultIcons[variant] }),
820
+ /* @__PURE__ */ jsxs9("div", { className: "flex-1", children: [
821
+ title && /* @__PURE__ */ jsx10("h5", { className: "font-semibold mb-1", children: title }),
822
+ /* @__PURE__ */ jsx10("div", { className: "text-sm", children })
823
+ ] }),
824
+ dismissible && onDismiss && /* @__PURE__ */ jsx10(
825
+ "button",
826
+ {
827
+ type: "button",
828
+ onClick: onDismiss,
829
+ className: cn(
830
+ "flex-shrink-0 rounded-lg p-1.5 inline-flex focus:outline-none focus:ring-2",
831
+ iconColors[variant],
832
+ "hover:bg-black hover:bg-opacity-10"
833
+ ),
834
+ "aria-label": "Close",
835
+ children: /* @__PURE__ */ jsx10("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx10(
836
+ "path",
837
+ {
838
+ fillRule: "evenodd",
839
+ d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
840
+ clipRule: "evenodd"
841
+ }
842
+ ) })
843
+ }
844
+ )
845
+ ] })
846
+ }
847
+ );
848
+ }
849
+ );
850
+ Alert.displayName = "Alert";
851
+
852
+ // src/layout/container.tsx
853
+ import React7 from "react";
854
+ import { jsx as jsx11 } from "react/jsx-runtime";
855
+ var Container = React7.forwardRef(
856
+ ({
857
+ className,
858
+ maxWidth = "xl",
859
+ centered = true,
860
+ padding = true,
861
+ children,
862
+ ...props
863
+ }, ref) => {
864
+ const maxWidths = {
865
+ sm: "max-w-screen-sm",
866
+ md: "max-w-screen-md",
867
+ lg: "max-w-screen-lg",
868
+ xl: "max-w-screen-xl",
869
+ "2xl": "max-w-screen-2xl",
870
+ full: "max-w-full"
871
+ };
872
+ return /* @__PURE__ */ jsx11(
873
+ "div",
874
+ {
875
+ ref,
876
+ className: cn(
877
+ "w-full",
878
+ maxWidths[maxWidth],
879
+ centered && "mx-auto",
880
+ padding && "px-4 sm:px-6 lg:px-8",
881
+ className
882
+ ),
883
+ ...props,
884
+ children
885
+ }
886
+ );
887
+ }
888
+ );
889
+ Container.displayName = "Container";
890
+
891
+ // src/layout/section-layout.tsx
892
+ import React8 from "react";
893
+ import { Fragment, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
894
+ function SectionLayout({
895
+ children,
896
+ hasStickyPreview = false
897
+ }) {
898
+ if (!hasStickyPreview) {
899
+ return /* @__PURE__ */ jsx12(Fragment, { children });
900
+ }
901
+ const childArray = React8.Children.toArray(children);
902
+ if (childArray.length === 0) {
903
+ return null;
904
+ }
905
+ const stickyPreview = childArray[0];
906
+ const scrollableContent = childArray.slice(1);
907
+ return /* @__PURE__ */ jsxs10(Fragment, { children: [
908
+ stickyPreview,
909
+ scrollableContent.length > 0 && /* @__PURE__ */ jsx12("div", { className: "space-y-8", children: scrollableContent })
910
+ ] });
911
+ }
912
+
913
+ // src/layout/sidebar-nav.tsx
914
+ import { useState as useState3 } from "react";
915
+ import { Menu, X } from "lucide-react";
916
+ import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
917
+ function SidebarNav({
918
+ title,
919
+ subtitle,
920
+ items,
921
+ activeItem,
922
+ onItemClick,
923
+ footer,
924
+ position = "right"
925
+ }) {
926
+ const [mobileMenuOpen, setMobileMenuOpen] = useState3(false);
927
+ const isLeft = position === "left";
928
+ const handleItemClick = (itemId) => {
929
+ onItemClick(itemId);
930
+ setMobileMenuOpen(false);
931
+ };
932
+ return /* @__PURE__ */ jsxs11(Fragment2, { children: [
933
+ /* @__PURE__ */ jsx13("div", { className: "lg:hidden fixed top-0 left-0 right-0 z-50 bg-white border-b border-gray-200 px-4 py-3", children: /* @__PURE__ */ jsxs11(
934
+ "div",
935
+ {
936
+ className: `flex items-center ${isLeft ? "justify-between" : "justify-between flex-row-reverse"}`,
937
+ children: [
938
+ /* @__PURE__ */ jsx13(
939
+ "button",
940
+ {
941
+ onClick: () => setMobileMenuOpen(!mobileMenuOpen),
942
+ className: "p-2 rounded-lg hover:bg-gray-100 transition-colors",
943
+ "aria-label": "Toggle menu",
944
+ children: mobileMenuOpen ? /* @__PURE__ */ jsx13(X, { className: "w-6 h-6 text-gray-700" }) : /* @__PURE__ */ jsx13(Menu, { className: "w-6 h-6 text-gray-700" })
945
+ }
946
+ ),
947
+ /* @__PURE__ */ jsxs11("div", { children: [
948
+ /* @__PURE__ */ jsx13("h1", { className: "text-lg font-bold text-gray-900", children: title }),
949
+ subtitle && /* @__PURE__ */ jsx13("p", { className: "text-xs text-gray-500", children: subtitle })
950
+ ] })
951
+ ]
952
+ }
953
+ ) }),
954
+ mobileMenuOpen && /* @__PURE__ */ jsx13(
955
+ "div",
956
+ {
957
+ className: "fixed inset-0 bg-black/50 lg:hidden",
958
+ style: { zIndex: 35 },
959
+ onClick: () => setMobileMenuOpen(false)
960
+ }
961
+ ),
962
+ /* @__PURE__ */ jsxs11(
963
+ "aside",
964
+ {
965
+ className: `
966
+ fixed top-0 h-screen w-64 bg-white z-40
967
+ transition-transform duration-300 ease-in-out overflow-y-auto
968
+ ${isLeft ? "left-0 border-r" : "right-0 border-l"} border-gray-200
969
+ lg:translate-x-0
970
+ ${mobileMenuOpen ? "translate-x-0" : `${isLeft ? "-translate-x-full" : "translate-x-full"} lg:translate-x-0`}
971
+ `,
972
+ children: [
973
+ /* @__PURE__ */ jsxs11("div", { className: "hidden lg:block p-6 border-b border-gray-200", children: [
974
+ /* @__PURE__ */ jsx13("h1", { className: "text-xl font-bold text-gray-900", children: title }),
975
+ subtitle && /* @__PURE__ */ jsx13("p", { className: "text-xs text-gray-500 mt-1", children: subtitle })
976
+ ] }),
977
+ /* @__PURE__ */ jsx13("div", { className: "lg:hidden h-[57px]", "aria-hidden": "true" }),
978
+ /* @__PURE__ */ jsx13("nav", { className: "p-4", children: /* @__PURE__ */ jsx13("ul", { className: "space-y-1", children: items.map((item) => /* @__PURE__ */ jsx13("li", { children: /* @__PURE__ */ jsxs11(
979
+ "button",
980
+ {
981
+ onClick: () => handleItemClick(item.id),
982
+ className: `
983
+ w-full flex items-center gap-3 px-4 py-3 rounded-lg text-sm font-medium transition-colors
984
+ ${activeItem === item.id ? "bg-blue-50 text-blue-700" : "text-gray-700 hover:bg-gray-50"}
985
+ `,
986
+ children: [
987
+ item.icon && /* @__PURE__ */ jsx13("span", { className: "shrink-0", children: item.icon }),
988
+ /* @__PURE__ */ jsx13("span", { children: item.label })
989
+ ]
990
+ }
991
+ ) }, item.id)) }) }),
992
+ footer && /* @__PURE__ */ jsx13("div", { className: "p-4 border-t border-gray-200 mt-auto", children: footer })
993
+ ]
994
+ }
995
+ )
996
+ ] });
997
+ }
998
+
999
+ // src/shared/empty-state.tsx
1000
+ import React10 from "react";
1001
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
1002
+ var EmptyState = React10.forwardRef(
1003
+ ({ className, icon, title, description, action, ...props }, ref) => {
1004
+ return /* @__PURE__ */ jsxs12(
1005
+ "div",
1006
+ {
1007
+ ref,
1008
+ className: cn(
1009
+ "flex flex-col items-center justify-center text-center py-12 px-4",
1010
+ className
1011
+ ),
1012
+ ...props,
1013
+ children: [
1014
+ icon && /* @__PURE__ */ jsx14("div", { className: "mb-4 text-gray-400", children: icon }),
1015
+ /* @__PURE__ */ jsx14("h3", { className: "text-lg font-semibold text-gray-900 mb-2", children: title }),
1016
+ description && /* @__PURE__ */ jsx14("p", { className: "text-sm text-gray-500 mb-6 max-w-sm", children: description }),
1017
+ action && /* @__PURE__ */ jsx14("div", { children: action })
1018
+ ]
1019
+ }
1020
+ );
1021
+ }
1022
+ );
1023
+ EmptyState.displayName = "EmptyState";
1024
+ export {
1025
+ Alert,
1026
+ Badge,
1027
+ Button,
1028
+ Card,
1029
+ CardContent,
1030
+ CardDescription,
1031
+ CardFooter,
1032
+ CardHeader,
1033
+ CardTitle,
1034
+ Checkbox,
1035
+ CheckboxGroup,
1036
+ CodeSnippet,
1037
+ Container,
1038
+ Dropdown,
1039
+ EmptyState,
1040
+ Input,
1041
+ RadioGroup,
1042
+ SectionLayout,
1043
+ SidebarNav,
1044
+ Spinner,
1045
+ cn
1046
+ };
1047
+ //# sourceMappingURL=index.mjs.map