@pactor-app/ui 0.1.0 → 1.0.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,3222 @@
1
+ import {
2
+ Icon
3
+ } from "./chunk-UR3I4WXQ.js";
4
+ import {
5
+ Alert,
6
+ AlertDescription,
7
+ AlertDialog,
8
+ AlertDialogAction,
9
+ AlertDialogCancel,
10
+ AlertDialogContent,
11
+ AlertDialogDescription,
12
+ AlertDialogFooter,
13
+ AlertDialogHeader,
14
+ AlertDialogTitle,
15
+ AlertDialogTrigger,
16
+ AlertTitle,
17
+ AspectRatio,
18
+ Avatar,
19
+ AvatarFallback,
20
+ AvatarImage,
21
+ Badge,
22
+ Breadcrumb,
23
+ BreadcrumbItem,
24
+ BreadcrumbLink,
25
+ BreadcrumbList,
26
+ BreadcrumbPage,
27
+ BreadcrumbSeparator,
28
+ ButtonGroup,
29
+ Calendar,
30
+ Carousel,
31
+ CarouselContent,
32
+ CarouselItem,
33
+ CarouselNext,
34
+ CarouselPrevious,
35
+ ChartContainer,
36
+ Checkbox,
37
+ Collapsible,
38
+ CollapsibleContent,
39
+ CollapsibleTrigger,
40
+ Combobox,
41
+ ComboboxContent,
42
+ ComboboxTrigger,
43
+ Command,
44
+ CommandEmpty,
45
+ CommandGroup,
46
+ CommandInput,
47
+ CommandItem,
48
+ CommandList,
49
+ ContextMenu,
50
+ ContextMenuContent,
51
+ ContextMenuItem,
52
+ ContextMenuTrigger,
53
+ DropdownMenu,
54
+ DropdownMenuContent,
55
+ DropdownMenuItem,
56
+ DropdownMenuSub,
57
+ DropdownMenuSubContent,
58
+ DropdownMenuSubTrigger,
59
+ DropdownMenuTrigger,
60
+ Empty,
61
+ EmptyContent,
62
+ EmptyDescription,
63
+ EmptyHeader,
64
+ EmptyTitle,
65
+ Field,
66
+ FieldDescription,
67
+ FieldError,
68
+ FieldLabel,
69
+ HoverCard,
70
+ HoverCardContent,
71
+ HoverCardTrigger,
72
+ Input,
73
+ InputGroup,
74
+ InputOTP,
75
+ InputOTPGroup,
76
+ InputOTPSlot,
77
+ Item,
78
+ ItemActions,
79
+ ItemContent,
80
+ ItemDescription,
81
+ ItemMedia,
82
+ ItemTitle,
83
+ Kbd,
84
+ Label,
85
+ Menubar,
86
+ MenubarContent,
87
+ MenubarItem,
88
+ MenubarMenu,
89
+ MenubarTrigger,
90
+ NavigationMenu,
91
+ NavigationMenuContent,
92
+ NavigationMenuItem,
93
+ NavigationMenuLink,
94
+ NavigationMenuList,
95
+ NavigationMenuTrigger,
96
+ Pagination,
97
+ PaginationContent,
98
+ PaginationEllipsis,
99
+ PaginationItem,
100
+ PaginationLink,
101
+ PaginationNext,
102
+ PaginationPrevious,
103
+ Panel,
104
+ PanelGroup,
105
+ Progress,
106
+ ProgressIndicator,
107
+ ProgressTrack,
108
+ RadioGroup,
109
+ RadioGroupItem,
110
+ ResizableHandle,
111
+ ScrollArea,
112
+ Select,
113
+ SelectContent,
114
+ SelectItem,
115
+ SelectTrigger,
116
+ SelectValue,
117
+ Separator,
118
+ Sheet,
119
+ SheetContent,
120
+ SheetHeader,
121
+ SheetTitle,
122
+ Skeleton,
123
+ Slider,
124
+ SliderControl,
125
+ SliderIndicator,
126
+ SliderThumb,
127
+ SliderTrack,
128
+ Spinner,
129
+ Switch,
130
+ Table,
131
+ TableBody,
132
+ TableCell,
133
+ TableHead,
134
+ TableHeader,
135
+ TableRow,
136
+ Tabs,
137
+ TabsContent,
138
+ TabsList,
139
+ TabsTrigger,
140
+ Textarea,
141
+ Toaster,
142
+ Toggle,
143
+ ToggleGroup,
144
+ ToggleGroupItem,
145
+ Tooltip,
146
+ TooltipContent,
147
+ TooltipTrigger,
148
+ Typography,
149
+ chartColor,
150
+ navigationMenuTriggerStyle,
151
+ toast
152
+ } from "./chunk-TUXCPXPA.js";
153
+ import {
154
+ Button,
155
+ Dialog,
156
+ DialogContent,
157
+ DialogDescription,
158
+ DialogHeader,
159
+ DialogTitle,
160
+ DialogTrigger,
161
+ Drawer,
162
+ DrawerContent,
163
+ DrawerHeader,
164
+ DrawerTitle
165
+ } from "./chunk-F3H23KYG.js";
166
+ import {
167
+ Accordion,
168
+ AccordionContent,
169
+ AccordionItem,
170
+ AccordionTrigger,
171
+ Card,
172
+ CardContent,
173
+ CardHeader,
174
+ CardTitle,
175
+ Popover,
176
+ PopoverContent,
177
+ PopoverTrigger
178
+ } from "./chunk-GL7IO22L.js";
179
+ import {
180
+ cn
181
+ } from "./chunk-RQHJBTEU.js";
182
+
183
+ // src/components/register.ts
184
+ import { Registry } from "@pactor-app/core";
185
+
186
+ // src/components/components/Accordion/index.tsx
187
+ import { useRenderer } from "@pactor-app/runtime";
188
+ import { jsx, jsxs } from "react/jsx-runtime";
189
+ function Accordion2({
190
+ items = [],
191
+ multiple,
192
+ className,
193
+ style
194
+ }) {
195
+ const { renderChildren } = useRenderer();
196
+ return /* @__PURE__ */ jsx(
197
+ Accordion,
198
+ {
199
+ type: multiple ? "multiple" : "single",
200
+ className,
201
+ style,
202
+ children: items.map((item) => /* @__PURE__ */ jsxs(AccordionItem, { value: item.key, children: [
203
+ /* @__PURE__ */ jsx(AccordionTrigger, { children: item.title }),
204
+ /* @__PURE__ */ jsx(AccordionContent, { children: renderChildren(item.children) })
205
+ ] }, item.key))
206
+ }
207
+ );
208
+ }
209
+
210
+ // src/components/components/Alert/index.tsx
211
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
212
+ var variantMap = {
213
+ success: "success",
214
+ info: "info",
215
+ warning: "warning",
216
+ error: "destructive"
217
+ };
218
+ function Alert2({ message, description, variant = "info", className, style }) {
219
+ return /* @__PURE__ */ jsxs2(Alert, { variant: variantMap[variant], className, style, children: [
220
+ message ? /* @__PURE__ */ jsx2(AlertTitle, { children: message }) : null,
221
+ description ? /* @__PURE__ */ jsx2(AlertDescription, { children: description }) : null
222
+ ] });
223
+ }
224
+
225
+ // src/components/components/AlertDialog/index.tsx
226
+ import { useI18n, useRenderer as useRenderer2 } from "@pactor-app/runtime";
227
+ import { useState } from "react";
228
+
229
+ // src/components/components/trigger-render.tsx
230
+ import { jsx as jsx3 } from "react/jsx-runtime";
231
+ function triggerWrapper(slot) {
232
+ return /* @__PURE__ */ jsx3("span", { "data-slot": slot });
233
+ }
234
+
235
+ // src/components/components/AlertDialog/index.tsx
236
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
237
+ function AlertDialog2({
238
+ title,
239
+ description,
240
+ confirmText,
241
+ cancelText,
242
+ open,
243
+ onConfirm,
244
+ onCancel,
245
+ trigger,
246
+ className,
247
+ style
248
+ }) {
249
+ const { renderChildren } = useRenderer2();
250
+ const { t } = useI18n();
251
+ const [innerOpen, setInnerOpen] = useState(false);
252
+ const controlled = open !== void 0;
253
+ const visible = controlled ? open : innerOpen;
254
+ return /* @__PURE__ */ jsxs3(
255
+ AlertDialog,
256
+ {
257
+ open: visible,
258
+ onOpenChange: (next) => {
259
+ if (!controlled) {
260
+ setInnerOpen(next);
261
+ }
262
+ },
263
+ children: [
264
+ trigger ? /* @__PURE__ */ jsx4(
265
+ AlertDialogTrigger,
266
+ {
267
+ nativeButton: false,
268
+ render: triggerWrapper("alert-dialog-trigger-wrap"),
269
+ children: renderChildren([trigger])
270
+ }
271
+ ) : null,
272
+ /* @__PURE__ */ jsxs3(AlertDialogContent, { className, style, children: [
273
+ /* @__PURE__ */ jsxs3(AlertDialogHeader, { children: [
274
+ /* @__PURE__ */ jsx4(AlertDialogTitle, { children: title ?? "" }),
275
+ description ? /* @__PURE__ */ jsx4(AlertDialogDescription, { children: description }) : null
276
+ ] }),
277
+ /* @__PURE__ */ jsxs3(AlertDialogFooter, { children: [
278
+ /* @__PURE__ */ jsx4(AlertDialogCancel, { onClick: () => onCancel?.(), children: cancelText ?? t("pactor.alertDialog.cancel") }),
279
+ /* @__PURE__ */ jsx4(AlertDialogAction, { onClick: () => onConfirm?.(), children: confirmText ?? t("pactor.alertDialog.confirm") })
280
+ ] })
281
+ ] })
282
+ ]
283
+ }
284
+ );
285
+ }
286
+
287
+ // src/components/components/AspectRatio/index.tsx
288
+ import { jsx as jsx5 } from "react/jsx-runtime";
289
+ function AspectRatio2({ ratio = 1, children, className, style }) {
290
+ return /* @__PURE__ */ jsx5(AspectRatio, { ratio, className, style, children });
291
+ }
292
+
293
+ // src/components/components/Avatar/index.tsx
294
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
295
+ function Avatar2({ src, alt, fallback, className, style }) {
296
+ return /* @__PURE__ */ jsxs4(Avatar, { className, style, children: [
297
+ src ? /* @__PURE__ */ jsx6(AvatarImage, { src, alt: alt ?? "" }) : null,
298
+ fallback ? /* @__PURE__ */ jsx6(AvatarFallback, { children: fallback }) : null
299
+ ] });
300
+ }
301
+
302
+ // src/components/components/Badge/index.tsx
303
+ import { jsx as jsx7 } from "react/jsx-runtime";
304
+ function Badge2({ text, variant = "default", className, style }) {
305
+ return /* @__PURE__ */ jsx7(Badge, { variant, className, style, children: text });
306
+ }
307
+
308
+ // src/components/components/Breadcrumb/index.tsx
309
+ import { Fragment } from "react";
310
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
311
+ function Breadcrumb2({ items = [], className, style }) {
312
+ return /* @__PURE__ */ jsx8(Breadcrumb, { className, style, children: /* @__PURE__ */ jsx8(BreadcrumbList, { children: items.map((item, index) => {
313
+ const isLast = index === items.length - 1;
314
+ return /* @__PURE__ */ jsxs5(Fragment, { children: [
315
+ index > 0 ? /* @__PURE__ */ jsx8(BreadcrumbSeparator, {}) : null,
316
+ /* @__PURE__ */ jsx8(BreadcrumbItem, { children: isLast || !item.href ? /* @__PURE__ */ jsx8(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ jsx8(BreadcrumbLink, { href: item.href, children: item.label }) })
317
+ ] }, `${item.label}-${index}`);
318
+ }) }) });
319
+ }
320
+
321
+ // src/components/components/Button/index.tsx
322
+ import { Loader2 } from "lucide-react";
323
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
324
+ var variantMap2 = {
325
+ default: "outline",
326
+ primary: "default",
327
+ dashed: "outline",
328
+ link: "link",
329
+ text: "ghost"
330
+ };
331
+ var sizeMap = {
332
+ small: "sm",
333
+ middle: "default",
334
+ large: "lg"
335
+ };
336
+ function Button2({
337
+ text,
338
+ variant = "default",
339
+ danger,
340
+ size = "middle",
341
+ loading,
342
+ disabled,
343
+ submit,
344
+ onClick,
345
+ className,
346
+ style,
347
+ children
348
+ }) {
349
+ const textual = variant === "link" || variant === "text";
350
+ return /* @__PURE__ */ jsxs6(
351
+ Button,
352
+ {
353
+ type: submit ? "submit" : "button",
354
+ variant: danger && !textual ? "destructive" : variantMap2[variant],
355
+ size: sizeMap[size],
356
+ disabled: disabled ?? loading,
357
+ "aria-busy": loading || void 0,
358
+ onClick: () => onClick?.(),
359
+ style,
360
+ className: cn(
361
+ variant === "dashed" && "border-dashed",
362
+ danger && textual && "text-destructive hover:text-destructive",
363
+ className
364
+ ),
365
+ children: [
366
+ loading ? /* @__PURE__ */ jsx9(Loader2, { "aria-hidden": true, className: "animate-spin" }) : null,
367
+ text ?? children
368
+ ]
369
+ }
370
+ );
371
+ }
372
+
373
+ // src/components/components/ButtonGroup/index.tsx
374
+ import { jsx as jsx10 } from "react/jsx-runtime";
375
+ function ButtonGroup2({ className, style, children }) {
376
+ return /* @__PURE__ */ jsx10(ButtonGroup, { className, style, children });
377
+ }
378
+
379
+ // src/components/components/Calendar/index.tsx
380
+ import { format, isValid, parseISO } from "date-fns";
381
+ import { useEffect } from "react";
382
+
383
+ // src/components/components/Form/context.ts
384
+ import { createContext, useContext } from "react";
385
+ var FormReactContext = createContext(null);
386
+ var FormContextProvider = FormReactContext.Provider;
387
+ function useFormContext() {
388
+ return useContext(FormReactContext);
389
+ }
390
+ function formItemClass(layout) {
391
+ switch (layout) {
392
+ case "horizontal":
393
+ return "mb-4 flex items-baseline gap-2";
394
+ case "inline":
395
+ return "flex items-center gap-2";
396
+ default:
397
+ return "mb-4 flex flex-col gap-1.5";
398
+ }
399
+ }
400
+
401
+ // src/components/components/Calendar/index.tsx
402
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
403
+ function parseValue(value) {
404
+ if (typeof value !== "string" || value === "") return void 0;
405
+ const date = parseISO(value);
406
+ return isValid(date) ? date : void 0;
407
+ }
408
+ function Calendar2({
409
+ name,
410
+ label,
411
+ rules,
412
+ mode = "single",
413
+ value,
414
+ disabled,
415
+ onChange,
416
+ className,
417
+ style
418
+ }) {
419
+ const form = useFormContext();
420
+ const inForm = form?.inForm === true && typeof name === "string" && name !== "";
421
+ useEffect(() => {
422
+ if (inForm && form && name) {
423
+ form.registerField(name, rules, value);
424
+ return () => form.unregisterField(name);
425
+ }
426
+ return void 0;
427
+ });
428
+ const current = inForm && form && name ? form.values[name] : value;
429
+ const handleSelect = (date) => {
430
+ const next = date ? format(date, "yyyy-MM-dd") : void 0;
431
+ if (inForm && form && name) {
432
+ form.setValue(name, next);
433
+ }
434
+ onChange?.(next);
435
+ };
436
+ const calendar = /* @__PURE__ */ jsx11(
437
+ Calendar,
438
+ {
439
+ mode,
440
+ selected: parseValue(current),
441
+ onSelect: handleSelect,
442
+ disabled: disabled === true ? true : void 0,
443
+ className: cn(!inForm && className),
444
+ style: inForm ? void 0 : style
445
+ }
446
+ );
447
+ if (inForm && form && name) {
448
+ const error = form.errors[name];
449
+ return /* @__PURE__ */ jsxs7(
450
+ "div",
451
+ {
452
+ "data-slot": "form-item",
453
+ className: cn(formItemClass(form.layout), className),
454
+ style,
455
+ children: [
456
+ label ? /* @__PURE__ */ jsx11("label", { className: "shrink-0 text-sm leading-none font-medium whitespace-nowrap", children: label }) : null,
457
+ calendar,
458
+ error ? /* @__PURE__ */ jsx11("div", { "data-slot": "form-error", className: "text-sm text-destructive", children: error }) : null
459
+ ]
460
+ }
461
+ );
462
+ }
463
+ return calendar;
464
+ }
465
+
466
+ // src/components/components/Card/index.tsx
467
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
468
+ function Card2({ title, bordered = true, className, style, children }) {
469
+ return /* @__PURE__ */ jsxs8(
470
+ Card,
471
+ {
472
+ className: cn("gap-4 py-4", !bordered && "border-transparent shadow-none", className),
473
+ style,
474
+ children: [
475
+ title ? /* @__PURE__ */ jsx12(CardHeader, { className: "px-4", children: /* @__PURE__ */ jsx12(CardTitle, { children: title }) }) : null,
476
+ /* @__PURE__ */ jsx12(CardContent, { className: "px-4", children })
477
+ ]
478
+ }
479
+ );
480
+ }
481
+
482
+ // src/components/components/Carousel/index.tsx
483
+ import { useRenderer as useRenderer3 } from "@pactor-app/runtime";
484
+ import { useEffect as useEffect2, useState as useState2 } from "react";
485
+ import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
486
+ function isDslNode(item) {
487
+ return typeof item.type === "string";
488
+ }
489
+ function Carousel2({
490
+ items = [],
491
+ loop,
492
+ autoplay,
493
+ className,
494
+ style
495
+ }) {
496
+ const { renderChildren } = useRenderer3();
497
+ const [api, setApi] = useState2();
498
+ useEffect2(() => {
499
+ if (!api || !autoplay) return;
500
+ const interval = typeof autoplay === "number" ? autoplay : 3e3;
501
+ const timer = setInterval(() => {
502
+ if (api.canScrollNext()) {
503
+ api.scrollNext();
504
+ } else if (loop) {
505
+ api.scrollTo(0);
506
+ }
507
+ }, interval);
508
+ return () => clearInterval(timer);
509
+ }, [api, autoplay, loop]);
510
+ return /* @__PURE__ */ jsxs9(
511
+ Carousel,
512
+ {
513
+ opts: { loop: loop === true },
514
+ setApi,
515
+ className,
516
+ style,
517
+ children: [
518
+ /* @__PURE__ */ jsx13(CarouselContent, { children: items.map((item, index) => /* @__PURE__ */ jsx13(CarouselItem, { children: isDslNode(item) ? renderChildren([item]) : /* @__PURE__ */ jsx13(
519
+ "img",
520
+ {
521
+ src: item.src,
522
+ alt: item.alt ?? "",
523
+ className: "w-full rounded-md object-cover"
524
+ }
525
+ ) }, index)) }),
526
+ /* @__PURE__ */ jsx13(CarouselPrevious, {}),
527
+ /* @__PURE__ */ jsx13(CarouselNext, {})
528
+ ]
529
+ }
530
+ );
531
+ }
532
+
533
+ // src/components/components/Checkbox/index.tsx
534
+ import { useEffect as useEffect3, useId } from "react";
535
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
536
+ function Checkbox2({
537
+ name,
538
+ label,
539
+ rules,
540
+ value,
541
+ disabled,
542
+ onChange,
543
+ className,
544
+ style
545
+ }) {
546
+ const form = useFormContext();
547
+ const controlId = useId();
548
+ const inForm = form?.inForm === true && typeof name === "string" && name !== "";
549
+ useEffect3(() => {
550
+ if (inForm && form && name) {
551
+ form.registerField(name, rules, value);
552
+ return () => form.unregisterField(name);
553
+ }
554
+ return void 0;
555
+ });
556
+ const current = inForm && form && name ? form.values[name] : value;
557
+ const checked = current === true;
558
+ const handleChange = (next) => {
559
+ if (inForm && form && name) {
560
+ form.setValue(name, next);
561
+ }
562
+ onChange?.(next);
563
+ };
564
+ const control = /* @__PURE__ */ jsxs10(
565
+ "span",
566
+ {
567
+ className: cn("inline-flex items-center gap-2", !inForm && className),
568
+ style: inForm ? void 0 : style,
569
+ children: [
570
+ /* @__PURE__ */ jsx14(
571
+ Checkbox,
572
+ {
573
+ id: controlId,
574
+ checked,
575
+ disabled,
576
+ name: inForm ? name : void 0,
577
+ onCheckedChange: handleChange
578
+ }
579
+ ),
580
+ label ? /* @__PURE__ */ jsx14("label", { htmlFor: controlId, className: "text-sm leading-none font-medium", children: label }) : null
581
+ ]
582
+ }
583
+ );
584
+ if (inForm && form && name) {
585
+ return /* @__PURE__ */ jsxs10(
586
+ "div",
587
+ {
588
+ "data-slot": "form-item",
589
+ className: cn("mb-4", className),
590
+ style,
591
+ children: [
592
+ control,
593
+ form.errors[name] ? /* @__PURE__ */ jsx14("div", { "data-slot": "form-error", className: "mt-1.5 text-sm text-destructive", children: form.errors[name] }) : null
594
+ ]
595
+ }
596
+ );
597
+ }
598
+ return control;
599
+ }
600
+
601
+ // src/components/components/Collapsible/index.tsx
602
+ import { useState as useState3 } from "react";
603
+ import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
604
+ function Collapsible2({
605
+ title,
606
+ open,
607
+ children,
608
+ className,
609
+ style
610
+ }) {
611
+ const [innerOpen, setInnerOpen] = useState3(false);
612
+ const controlled = open !== void 0;
613
+ return /* @__PURE__ */ jsxs11(
614
+ Collapsible,
615
+ {
616
+ open: controlled ? open : innerOpen,
617
+ onOpenChange: (next) => {
618
+ if (!controlled) {
619
+ setInnerOpen(next);
620
+ }
621
+ },
622
+ className,
623
+ style,
624
+ children: [
625
+ title ? /* @__PURE__ */ jsx15(CollapsibleTrigger, { children: title }) : null,
626
+ /* @__PURE__ */ jsx15(CollapsibleContent, { children })
627
+ ]
628
+ }
629
+ );
630
+ }
631
+
632
+ // src/components/components/Combobox/index.tsx
633
+ import { useEffect as useEffect4, useId as useId2, useState as useState4 } from "react";
634
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
635
+ function Combobox2({
636
+ name,
637
+ label,
638
+ rules,
639
+ options = [],
640
+ value,
641
+ placeholder,
642
+ searchable = true,
643
+ disabled,
644
+ onChange,
645
+ className,
646
+ style
647
+ }) {
648
+ const form = useFormContext();
649
+ const controlId = useId2();
650
+ const inForm = form?.inForm === true && typeof name === "string" && name !== "";
651
+ const [open, setOpen] = useState4(false);
652
+ useEffect4(() => {
653
+ if (inForm && form && name) {
654
+ form.registerField(name, rules, value);
655
+ return () => form.unregisterField(name);
656
+ }
657
+ return void 0;
658
+ });
659
+ const [innerValue, setInnerValue] = useState4(value);
660
+ useEffect4(() => {
661
+ if (!inForm) setInnerValue(value);
662
+ }, [inForm, value]);
663
+ const current = inForm && form && name ? form.values[name] : innerValue;
664
+ const selected = options.find((option) => option.value === current);
665
+ const handleSelect = (option) => {
666
+ if (option.disabled) return;
667
+ if (inForm && form && name) {
668
+ form.setValue(name, option.value);
669
+ } else {
670
+ setInnerValue(option.value);
671
+ }
672
+ onChange?.(option.value);
673
+ setOpen(false);
674
+ };
675
+ const control = /* @__PURE__ */ jsxs12(Combobox, { open, onOpenChange: setOpen, children: [
676
+ /* @__PURE__ */ jsx16(
677
+ ComboboxTrigger,
678
+ {
679
+ id: controlId,
680
+ type: "button",
681
+ disabled,
682
+ className: cn(!selected && "text-muted-foreground", !inForm && className),
683
+ style: inForm ? void 0 : style,
684
+ children: selected ? selected.label : placeholder ?? ""
685
+ }
686
+ ),
687
+ /* @__PURE__ */ jsx16(ComboboxContent, { children: /* @__PURE__ */ jsxs12(Command, { children: [
688
+ searchable ? /* @__PURE__ */ jsx16(CommandInput, { placeholder }) : null,
689
+ /* @__PURE__ */ jsxs12(CommandList, { children: [
690
+ /* @__PURE__ */ jsx16(CommandEmpty, { children: "\u65E0\u5339\u914D\u7ED3\u679C" }),
691
+ /* @__PURE__ */ jsx16(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsx16(
692
+ CommandItem,
693
+ {
694
+ value: String(option.value),
695
+ keywords: [option.label],
696
+ disabled: option.disabled,
697
+ "data-checked": option.value === current ? "" : void 0,
698
+ onSelect: () => handleSelect(option),
699
+ children: option.label
700
+ },
701
+ String(option.value)
702
+ )) })
703
+ ] })
704
+ ] }) })
705
+ ] });
706
+ if (inForm && form && name) {
707
+ const error = form.errors[name];
708
+ return /* @__PURE__ */ jsxs12(
709
+ "div",
710
+ {
711
+ "data-slot": "form-item",
712
+ className: cn(formItemClass(form.layout), className),
713
+ style,
714
+ children: [
715
+ label ? /* @__PURE__ */ jsx16(
716
+ "label",
717
+ {
718
+ htmlFor: controlId,
719
+ className: "shrink-0 text-sm leading-none font-medium whitespace-nowrap",
720
+ children: label
721
+ }
722
+ ) : null,
723
+ control,
724
+ error ? /* @__PURE__ */ jsx16("div", { "data-slot": "form-error", className: "text-sm text-destructive", children: error }) : null
725
+ ]
726
+ }
727
+ );
728
+ }
729
+ return control;
730
+ }
731
+
732
+ // src/components/components/Command/index.tsx
733
+ import { useI18n as useI18n2 } from "@pactor-app/runtime";
734
+ import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
735
+ function Command2({
736
+ groups = [],
737
+ placeholder,
738
+ emptyText,
739
+ onSelect,
740
+ className,
741
+ style
742
+ }) {
743
+ const { t } = useI18n2();
744
+ return /* @__PURE__ */ jsxs13(Command, { className, style, children: [
745
+ /* @__PURE__ */ jsx17(CommandInput, { placeholder }),
746
+ /* @__PURE__ */ jsxs13(CommandList, { children: [
747
+ /* @__PURE__ */ jsx17(CommandEmpty, { children: emptyText ?? t("pactor.command.empty") }),
748
+ groups.map((group, index) => /* @__PURE__ */ jsx17(CommandGroup, { heading: group.heading, children: group.items.map((item) => /* @__PURE__ */ jsxs13(
749
+ CommandItem,
750
+ {
751
+ value: item.value,
752
+ keywords: [item.label],
753
+ disabled: item.disabled,
754
+ onSelect: (value) => onSelect?.(value),
755
+ children: [
756
+ item.icon ? /* @__PURE__ */ jsx17(Icon, { name: item.icon, size: "sm" }) : null,
757
+ item.label
758
+ ]
759
+ },
760
+ item.value
761
+ )) }, group.heading ?? index))
762
+ ] })
763
+ ] });
764
+ }
765
+
766
+ // src/components/components/Chart/index.tsx
767
+ import {
768
+ Area,
769
+ AreaChart,
770
+ Bar,
771
+ BarChart,
772
+ CartesianGrid,
773
+ Cell,
774
+ Legend,
775
+ Line,
776
+ LineChart,
777
+ Pie,
778
+ PieChart,
779
+ Tooltip as Tooltip2,
780
+ XAxis,
781
+ YAxis
782
+ } from "recharts";
783
+ import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
784
+ function Chart({
785
+ chartType,
786
+ data = [],
787
+ xKey,
788
+ yKeys = [],
789
+ colors,
790
+ className,
791
+ style
792
+ }) {
793
+ const series = yKeys.length > 0 ? yKeys : ["value"];
794
+ return /* @__PURE__ */ jsx18(
795
+ "div",
796
+ {
797
+ "data-slot": "chart",
798
+ "data-chart-type": chartType,
799
+ className: cn("w-full", className),
800
+ style,
801
+ children: /* @__PURE__ */ jsx18(ChartContainer, { children: chartType === "pie" ? /* @__PURE__ */ jsxs14(PieChart, { children: [
802
+ /* @__PURE__ */ jsx18(Tooltip2, {}),
803
+ /* @__PURE__ */ jsx18(Legend, {}),
804
+ /* @__PURE__ */ jsx18(
805
+ Pie,
806
+ {
807
+ data,
808
+ dataKey: series[0],
809
+ nameKey: xKey,
810
+ innerRadius: 0,
811
+ outerRadius: "80%",
812
+ isAnimationActive: false,
813
+ children: data.map((_, index) => /* @__PURE__ */ jsx18(Cell, { fill: chartColor(index, colors) }, index))
814
+ }
815
+ )
816
+ ] }) : chartType === "line" ? /* @__PURE__ */ jsxs14(LineChart, { data, children: [
817
+ /* @__PURE__ */ jsx18(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
818
+ /* @__PURE__ */ jsx18(XAxis, { dataKey: xKey }),
819
+ /* @__PURE__ */ jsx18(YAxis, {}),
820
+ /* @__PURE__ */ jsx18(Tooltip2, {}),
821
+ series.length > 1 ? /* @__PURE__ */ jsx18(Legend, {}) : null,
822
+ series.map((key, index) => /* @__PURE__ */ jsx18(
823
+ Line,
824
+ {
825
+ type: "monotone",
826
+ dataKey: key,
827
+ name: key,
828
+ stroke: chartColor(index, colors),
829
+ isAnimationActive: false
830
+ },
831
+ key
832
+ ))
833
+ ] }) : chartType === "area" ? /* @__PURE__ */ jsxs14(AreaChart, { data, children: [
834
+ /* @__PURE__ */ jsx18(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
835
+ /* @__PURE__ */ jsx18(XAxis, { dataKey: xKey }),
836
+ /* @__PURE__ */ jsx18(YAxis, {}),
837
+ /* @__PURE__ */ jsx18(Tooltip2, {}),
838
+ series.length > 1 ? /* @__PURE__ */ jsx18(Legend, {}) : null,
839
+ series.map((key, index) => /* @__PURE__ */ jsx18(
840
+ Area,
841
+ {
842
+ type: "monotone",
843
+ dataKey: key,
844
+ name: key,
845
+ stroke: chartColor(index, colors),
846
+ fill: chartColor(index, colors),
847
+ fillOpacity: 0.3,
848
+ isAnimationActive: false
849
+ },
850
+ key
851
+ ))
852
+ ] }) : /* @__PURE__ */ jsxs14(BarChart, { data, children: [
853
+ /* @__PURE__ */ jsx18(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
854
+ /* @__PURE__ */ jsx18(XAxis, { dataKey: xKey }),
855
+ /* @__PURE__ */ jsx18(YAxis, {}),
856
+ /* @__PURE__ */ jsx18(Tooltip2, {}),
857
+ series.length > 1 ? /* @__PURE__ */ jsx18(Legend, {}) : null,
858
+ series.map((key, index) => /* @__PURE__ */ jsx18(
859
+ Bar,
860
+ {
861
+ dataKey: key,
862
+ name: key,
863
+ fill: chartColor(index, colors),
864
+ isAnimationActive: false
865
+ },
866
+ key
867
+ ))
868
+ ] }) })
869
+ }
870
+ );
871
+ }
872
+
873
+ // src/components/components/Content/index.tsx
874
+ import { jsx as jsx19 } from "react/jsx-runtime";
875
+ function Content({ className, style, children }) {
876
+ return /* @__PURE__ */ jsx19(
877
+ "main",
878
+ {
879
+ "data-slot": "layout-content",
880
+ className: cn("min-h-0 min-w-0 flex-1", className),
881
+ style,
882
+ children
883
+ }
884
+ );
885
+ }
886
+
887
+ // src/components/components/ContextMenu/index.tsx
888
+ import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
889
+ function ContextMenu2({
890
+ items = [],
891
+ onSelect,
892
+ children,
893
+ className,
894
+ style
895
+ }) {
896
+ return /* @__PURE__ */ jsxs15(ContextMenu, { children: [
897
+ /* @__PURE__ */ jsx20(ContextMenuTrigger, { children }),
898
+ /* @__PURE__ */ jsx20(ContextMenuContent, { className, style, children: items.map((item) => /* @__PURE__ */ jsxs15(
899
+ ContextMenuItem,
900
+ {
901
+ variant: item.danger ? "destructive" : "default",
902
+ disabled: item.disabled,
903
+ onClick: () => onSelect?.(item.value),
904
+ children: [
905
+ item.icon ? /* @__PURE__ */ jsx20(Icon, { name: item.icon, size: "sm" }) : null,
906
+ item.label
907
+ ]
908
+ },
909
+ item.value
910
+ )) })
911
+ ] });
912
+ }
913
+
914
+ // src/components/components/DataTable/index.tsx
915
+ import { useI18n as useI18n3, useRenderer as useRenderer4 } from "@pactor-app/runtime";
916
+ import { ArrowDown, ArrowUp, ArrowUpDown } from "lucide-react";
917
+ import { useMemo, useState as useState5 } from "react";
918
+ import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
919
+ function renderCellValue(value) {
920
+ if (value === void 0 || value === null) {
921
+ return "";
922
+ }
923
+ if (typeof value === "object") {
924
+ return JSON.stringify(value);
925
+ }
926
+ return String(value);
927
+ }
928
+ function compareValues(a, b) {
929
+ if (typeof a === "number" && typeof b === "number") {
930
+ return a - b;
931
+ }
932
+ return String(a ?? "").localeCompare(String(b ?? ""));
933
+ }
934
+ function DataTable({
935
+ columns = [],
936
+ rows = [],
937
+ rowKey = "id",
938
+ pagination,
939
+ sort,
940
+ onSort,
941
+ onPageChange,
942
+ className,
943
+ style
944
+ }) {
945
+ const { renderChildren } = useRenderer4();
946
+ const { t } = useI18n3();
947
+ const [sortState, setSortState] = useState5(sort);
948
+ const [filters, setFilters] = useState5({});
949
+ const [current, setCurrent] = useState5(1);
950
+ const viewRows = useMemo(() => {
951
+ const activeFilters = Object.entries(filters).filter(
952
+ ([, keyword]) => keyword !== ""
953
+ );
954
+ const filtered = activeFilters.length === 0 ? rows : rows.filter(
955
+ (row) => activeFilters.every(
956
+ ([key2, keyword]) => renderCellValue(row[key2]).toLowerCase().includes(keyword.toLowerCase())
957
+ )
958
+ );
959
+ if (!sortState) {
960
+ return filtered;
961
+ }
962
+ const { key, order } = sortState;
963
+ const factor = order === "asc" ? 1 : -1;
964
+ return filtered.map((row, index) => ({ row, index })).sort(
965
+ (a, b) => factor * compareValues(a.row[key], b.row[key]) || a.index - b.index
966
+ ).map((entry) => entry.row);
967
+ }, [rows, filters, sortState]);
968
+ const pageSize = pagination === false ? void 0 : pagination?.pageSize;
969
+ const total = viewRows.length;
970
+ const pageCount = pageSize !== void 0 && pageSize > 0 ? Math.max(1, Math.ceil(total / pageSize)) : 1;
971
+ const pageRows = pageSize !== void 0 && pageSize > 0 ? viewRows.slice((current - 1) * pageSize, current * pageSize) : viewRows;
972
+ const toggleSort = (column) => {
973
+ const order = sortState?.key === column.key && sortState.order === "asc" ? "desc" : "asc";
974
+ const next = { key: column.key, order };
975
+ setSortState(next);
976
+ setCurrent(1);
977
+ onSort?.(next);
978
+ };
979
+ const changeFilter = (key, keyword) => {
980
+ setFilters((previous) => ({ ...previous, [key]: keyword }));
981
+ setCurrent(1);
982
+ };
983
+ const goToPage = (page) => {
984
+ setCurrent(page);
985
+ onPageChange?.(page);
986
+ };
987
+ return /* @__PURE__ */ jsxs16("div", { "data-slot": "data-table", className: cn("relative", className), style, children: [
988
+ /* @__PURE__ */ jsxs16(Table, { children: [
989
+ /* @__PURE__ */ jsx21(TableHeader, { children: /* @__PURE__ */ jsx21(TableRow, { className: "hover:bg-transparent", children: columns.map((column, index) => {
990
+ const sorted = sortState?.key === column.key;
991
+ return /* @__PURE__ */ jsx21(TableHead, { children: /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
992
+ column.sortable ? /* @__PURE__ */ jsxs16(
993
+ "button",
994
+ {
995
+ type: "button",
996
+ "data-slot": "data-table-sort",
997
+ "data-column": column.key,
998
+ "aria-label": column.title ?? column.key,
999
+ className: "inline-flex items-center gap-1 font-medium hover:text-foreground",
1000
+ onClick: () => toggleSort(column),
1001
+ children: [
1002
+ column.title,
1003
+ sorted ? sortState.order === "asc" ? /* @__PURE__ */ jsx21(ArrowUp, { "aria-hidden": true, className: "size-3.5" }) : /* @__PURE__ */ jsx21(ArrowDown, { "aria-hidden": true, className: "size-3.5" }) : /* @__PURE__ */ jsx21(
1004
+ ArrowUpDown,
1005
+ {
1006
+ "aria-hidden": true,
1007
+ className: "size-3.5 text-muted-foreground"
1008
+ }
1009
+ )
1010
+ ]
1011
+ }
1012
+ ) : /* @__PURE__ */ jsx21("span", { children: column.title }),
1013
+ column.filterable ? /* @__PURE__ */ jsx21(
1014
+ Input,
1015
+ {
1016
+ "data-slot": "data-table-filter",
1017
+ "data-column": column.key,
1018
+ "aria-label": column.title ?? column.key,
1019
+ value: filters[column.key] ?? "",
1020
+ className: "h-7 text-xs",
1021
+ onChange: (event) => changeFilter(column.key, event.target.value)
1022
+ }
1023
+ ) : null
1024
+ ] }) }, column.key ?? String(index));
1025
+ }) }) }),
1026
+ /* @__PURE__ */ jsx21(TableBody, { children: pageRows.length === 0 ? /* @__PURE__ */ jsx21(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx21(TableCell, { colSpan: Math.max(1, columns.length), children: /* @__PURE__ */ jsx21(
1027
+ "div",
1028
+ {
1029
+ "data-slot": "table-empty",
1030
+ className: "py-8 text-center text-muted-foreground",
1031
+ children: t("pactor.table.empty")
1032
+ }
1033
+ ) }) }) : pageRows.map((row, rowIndex) => {
1034
+ const key = row[rowKey];
1035
+ return /* @__PURE__ */ jsx21(
1036
+ TableRow,
1037
+ {
1038
+ children: columns.map((column, columnIndex) => {
1039
+ const template = column.children ?? column.renderChildren;
1040
+ return /* @__PURE__ */ jsx21(TableCell, { children: template ? renderChildren(template, { row, rowIndex }) : renderCellValue(row[column.key]) }, column.key ?? String(columnIndex));
1041
+ })
1042
+ },
1043
+ key === void 0 || key === null ? rowIndex : String(key)
1044
+ );
1045
+ }) })
1046
+ ] }),
1047
+ pageSize !== void 0 && pageSize > 0 ? /* @__PURE__ */ jsx21("div", { "data-slot": "table-pagination", className: "mt-3 flex justify-end gap-1", children: Array.from({ length: pageCount }, (_, index) => index + 1).map(
1048
+ (page) => /* @__PURE__ */ jsx21(
1049
+ Button,
1050
+ {
1051
+ type: "button",
1052
+ size: "sm",
1053
+ variant: page === current ? "default" : "outline",
1054
+ "aria-current": page === current ? "page" : void 0,
1055
+ onClick: () => goToPage(page),
1056
+ children: page
1057
+ },
1058
+ page
1059
+ )
1060
+ ) }) : null
1061
+ ] });
1062
+ }
1063
+
1064
+ // src/components/components/Dialog/index.tsx
1065
+ import { useRenderer as useRenderer5 } from "@pactor-app/runtime";
1066
+ import { useState as useState6 } from "react";
1067
+ import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
1068
+ function Dialog2({
1069
+ title,
1070
+ description,
1071
+ open,
1072
+ onClose,
1073
+ trigger,
1074
+ children,
1075
+ className,
1076
+ style
1077
+ }) {
1078
+ const { renderChildren } = useRenderer5();
1079
+ const [innerOpen, setInnerOpen] = useState6(false);
1080
+ const controlled = open !== void 0;
1081
+ const visible = controlled ? open : innerOpen;
1082
+ return /* @__PURE__ */ jsxs17(
1083
+ Dialog,
1084
+ {
1085
+ open: visible,
1086
+ onOpenChange: (next) => {
1087
+ if (!controlled) {
1088
+ setInnerOpen(next);
1089
+ }
1090
+ if (!next) {
1091
+ onClose?.();
1092
+ }
1093
+ },
1094
+ children: [
1095
+ trigger ? /* @__PURE__ */ jsx22(
1096
+ DialogTrigger,
1097
+ {
1098
+ nativeButton: false,
1099
+ render: triggerWrapper("dialog-trigger-wrap"),
1100
+ children: renderChildren([trigger])
1101
+ }
1102
+ ) : null,
1103
+ /* @__PURE__ */ jsxs17(DialogContent, { className, style, children: [
1104
+ title || description ? /* @__PURE__ */ jsxs17(DialogHeader, { children: [
1105
+ title ? /* @__PURE__ */ jsx22(DialogTitle, { children: title }) : null,
1106
+ description ? /* @__PURE__ */ jsx22(DialogDescription, { children: description }) : null
1107
+ ] }) : null,
1108
+ children
1109
+ ] })
1110
+ ]
1111
+ }
1112
+ );
1113
+ }
1114
+
1115
+ // src/components/components/Drawer/index.tsx
1116
+ import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
1117
+ function Drawer2({
1118
+ title,
1119
+ open,
1120
+ placement = "right",
1121
+ onClose,
1122
+ children,
1123
+ className,
1124
+ style
1125
+ }) {
1126
+ return /* @__PURE__ */ jsx23(
1127
+ Drawer,
1128
+ {
1129
+ direction: placement,
1130
+ open: open ?? false,
1131
+ onOpenChange: (next) => {
1132
+ if (!next) {
1133
+ onClose?.();
1134
+ }
1135
+ },
1136
+ children: /* @__PURE__ */ jsxs18(DrawerContent, { className, style, children: [
1137
+ title ? /* @__PURE__ */ jsx23(DrawerHeader, { children: /* @__PURE__ */ jsx23(DrawerTitle, { children: title }) }) : null,
1138
+ /* @__PURE__ */ jsx23("div", { className: "flex-1 overflow-auto p-4", children })
1139
+ ] })
1140
+ }
1141
+ );
1142
+ }
1143
+
1144
+ // src/components/components/DropdownMenu/index.tsx
1145
+ import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
1146
+ function DropdownMenu2({
1147
+ items = [],
1148
+ onSelect,
1149
+ children,
1150
+ className,
1151
+ style
1152
+ }) {
1153
+ return /* @__PURE__ */ jsxs19(DropdownMenu, { children: [
1154
+ /* @__PURE__ */ jsx24(
1155
+ DropdownMenuTrigger,
1156
+ {
1157
+ nativeButton: false,
1158
+ render: triggerWrapper("dropdown-menu-trigger-wrap"),
1159
+ children
1160
+ }
1161
+ ),
1162
+ /* @__PURE__ */ jsx24(DropdownMenuContent, { className, style, children: items.map((item) => /* @__PURE__ */ jsxs19(
1163
+ DropdownMenuItem,
1164
+ {
1165
+ variant: item.danger ? "destructive" : "default",
1166
+ disabled: item.disabled,
1167
+ onClick: () => onSelect?.(item.value),
1168
+ children: [
1169
+ item.icon ? /* @__PURE__ */ jsx24(Icon, { name: item.icon, size: "sm" }) : null,
1170
+ item.label
1171
+ ]
1172
+ },
1173
+ item.value
1174
+ )) })
1175
+ ] });
1176
+ }
1177
+
1178
+ // src/components/components/Empty/index.tsx
1179
+ import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
1180
+ function Empty2({ title, description, children, className, style }) {
1181
+ return /* @__PURE__ */ jsxs20(Empty, { className, style, children: [
1182
+ /* @__PURE__ */ jsxs20(EmptyHeader, { children: [
1183
+ title ? /* @__PURE__ */ jsx25(EmptyTitle, { children: title }) : null,
1184
+ description ? /* @__PURE__ */ jsx25(EmptyDescription, { children: description }) : null
1185
+ ] }),
1186
+ children ? /* @__PURE__ */ jsx25(EmptyContent, { children }) : null
1187
+ ] });
1188
+ }
1189
+
1190
+ // src/components/components/Field/index.tsx
1191
+ import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
1192
+ function Field2({ label, description, error, children, className, style }) {
1193
+ return /* @__PURE__ */ jsxs21(Field, { className, style, children: [
1194
+ label ? /* @__PURE__ */ jsx26(FieldLabel, { children: label }) : null,
1195
+ children,
1196
+ description ? /* @__PURE__ */ jsx26(FieldDescription, { children: description }) : null,
1197
+ error ? /* @__PURE__ */ jsx26(FieldError, { match: true, children: error }) : null
1198
+ ] });
1199
+ }
1200
+
1201
+ // src/components/components/Flex/index.tsx
1202
+ import { jsx as jsx27 } from "react/jsx-runtime";
1203
+ var gapClass = {
1204
+ small: "gap-2",
1205
+ middle: "gap-4",
1206
+ large: "gap-6"
1207
+ };
1208
+ var justifyClass = {
1209
+ start: "justify-start",
1210
+ center: "justify-center",
1211
+ end: "justify-end",
1212
+ "space-between": "justify-between",
1213
+ "space-around": "justify-around",
1214
+ "space-evenly": "justify-evenly"
1215
+ };
1216
+ var alignClass = {
1217
+ start: "items-start",
1218
+ center: "items-center",
1219
+ end: "items-end",
1220
+ baseline: "items-baseline",
1221
+ stretch: "items-stretch"
1222
+ };
1223
+ function Flex({
1224
+ direction = "horizontal",
1225
+ gap,
1226
+ justify,
1227
+ align,
1228
+ className,
1229
+ style,
1230
+ children
1231
+ }) {
1232
+ return /* @__PURE__ */ jsx27(
1233
+ "div",
1234
+ {
1235
+ "data-slot": "flex",
1236
+ className: cn(
1237
+ "flex",
1238
+ direction === "vertical" && "flex-col",
1239
+ typeof gap === "string" && gapClass[gap],
1240
+ justify && justifyClass[justify],
1241
+ align && alignClass[align],
1242
+ className
1243
+ ),
1244
+ style: typeof gap === "number" || style ? { ...typeof gap === "number" ? { gap } : {}, ...style } : void 0,
1245
+ children
1246
+ }
1247
+ );
1248
+ }
1249
+
1250
+ // src/components/components/Footer/index.tsx
1251
+ import { jsx as jsx28 } from "react/jsx-runtime";
1252
+ function Footer({ className, style, children }) {
1253
+ return /* @__PURE__ */ jsx28(
1254
+ "footer",
1255
+ {
1256
+ "data-slot": "layout-footer",
1257
+ className: cn(
1258
+ "shrink-0 border-t px-4 py-3 text-center text-sm text-muted-foreground",
1259
+ className
1260
+ ),
1261
+ style,
1262
+ children
1263
+ }
1264
+ );
1265
+ }
1266
+
1267
+ // src/components/components/Form/index.tsx
1268
+ import { useRenderer as useRenderer6 } from "@pactor-app/runtime";
1269
+ import {
1270
+ useCallback,
1271
+ useEffect as useEffect5,
1272
+ useMemo as useMemo2,
1273
+ useRef,
1274
+ useState as useState7
1275
+ } from "react";
1276
+ import { jsx as jsx29 } from "react/jsx-runtime";
1277
+ function isEmpty(value) {
1278
+ return value === void 0 || value === null || value === "";
1279
+ }
1280
+ function Form({
1281
+ name = "default",
1282
+ layout = "vertical",
1283
+ initialValues,
1284
+ className,
1285
+ style,
1286
+ children,
1287
+ onSubmit,
1288
+ onValuesChange
1289
+ }) {
1290
+ const { context } = useRenderer6();
1291
+ const [values, setValues] = useState7(() => ({
1292
+ ...initialValues
1293
+ }));
1294
+ const [errors, setErrors] = useState7({});
1295
+ const fieldRulesRef = useRef(/* @__PURE__ */ new Map());
1296
+ const mergedInitialFieldsRef = useRef(/* @__PURE__ */ new Set());
1297
+ const setValuesBatch = useCallback((partial) => {
1298
+ setValues((prev) => ({ ...prev, ...partial }));
1299
+ }, []);
1300
+ useEffect5(() => {
1301
+ context.forms.register(name, { setValues: setValuesBatch });
1302
+ return () => {
1303
+ context.forms.unregister(name);
1304
+ };
1305
+ }, [context, name, setValuesBatch]);
1306
+ const formContext = useMemo2(
1307
+ () => ({
1308
+ inForm: true,
1309
+ layout,
1310
+ values,
1311
+ errors,
1312
+ setValue(name2, value) {
1313
+ const next = { ...values, [name2]: value };
1314
+ setValues(next);
1315
+ setErrors((prev) => {
1316
+ if (!(name2 in prev)) {
1317
+ return prev;
1318
+ }
1319
+ const rest = { ...prev };
1320
+ delete rest[name2];
1321
+ return rest;
1322
+ });
1323
+ onValuesChange?.({ [name2]: value }, next);
1324
+ },
1325
+ setValues: setValuesBatch,
1326
+ registerField(name2, rules, initialValue) {
1327
+ fieldRulesRef.current.set(name2, rules);
1328
+ if (initialValue !== void 0 && !mergedInitialFieldsRef.current.has(name2)) {
1329
+ mergedInitialFieldsRef.current.add(name2);
1330
+ setValues((prev) => ({ ...prev, [name2]: initialValue }));
1331
+ }
1332
+ },
1333
+ unregisterField(name2) {
1334
+ fieldRulesRef.current.delete(name2);
1335
+ }
1336
+ }),
1337
+ [layout, values, errors, onValuesChange, setValuesBatch]
1338
+ );
1339
+ const handleSubmit = (event) => {
1340
+ event.preventDefault();
1341
+ const nextErrors = {};
1342
+ for (const [name2, rules] of fieldRulesRef.current) {
1343
+ for (const rule of rules ?? []) {
1344
+ if (rule.required && isEmpty(values[name2])) {
1345
+ nextErrors[name2] = rule.message ?? context.i18n.t("pactor.form.required");
1346
+ break;
1347
+ }
1348
+ }
1349
+ }
1350
+ setErrors(nextErrors);
1351
+ if (Object.keys(nextErrors).length > 0) {
1352
+ return;
1353
+ }
1354
+ context.state.set("form", values);
1355
+ onSubmit?.(values);
1356
+ };
1357
+ return /* @__PURE__ */ jsx29(FormContextProvider, { value: formContext, children: /* @__PURE__ */ jsx29(
1358
+ "form",
1359
+ {
1360
+ "data-slot": "form",
1361
+ className: cn(layout === "inline" && "flex flex-wrap items-center gap-3", className),
1362
+ style,
1363
+ onSubmit: handleSubmit,
1364
+ children
1365
+ }
1366
+ ) });
1367
+ }
1368
+
1369
+ // src/components/components/Grid/index.tsx
1370
+ import { Children } from "react";
1371
+ import { jsx as jsx30 } from "react/jsx-runtime";
1372
+ function Grid({ columns = 1, gap, className, style, children }) {
1373
+ const cols = Math.max(1, columns);
1374
+ return /* @__PURE__ */ jsx30(
1375
+ "div",
1376
+ {
1377
+ "data-slot": "grid",
1378
+ "data-columns": cols,
1379
+ className: cn("grid", className),
1380
+ style: {
1381
+ gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))`,
1382
+ ...gap !== void 0 ? { gap } : {},
1383
+ ...style
1384
+ },
1385
+ children: Children.map(children, (child, index) => /* @__PURE__ */ jsx30("div", { "data-slot": "grid-item", children: child }, index))
1386
+ }
1387
+ );
1388
+ }
1389
+
1390
+ // src/components/components/Header/index.tsx
1391
+ import { useI18n as useI18n4 } from "@pactor-app/runtime";
1392
+ import { ChevronDownIcon } from "lucide-react";
1393
+ import { Fragment as Fragment2, jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
1394
+ var menuItemClass = "flex items-center gap-1 rounded-md px-3 py-2 text-sm transition-colors text-muted-foreground hover:bg-accent/50 hover:text-foreground";
1395
+ function Header({
1396
+ logo,
1397
+ title,
1398
+ brandPosition = "left",
1399
+ dropdown,
1400
+ menu,
1401
+ user,
1402
+ locales,
1403
+ onMenuSelect,
1404
+ onDropdownSelect,
1405
+ onUserSelect,
1406
+ onLocaleChange,
1407
+ className,
1408
+ style,
1409
+ children
1410
+ }) {
1411
+ const hasBrand = logo !== void 0 || title !== void 0;
1412
+ const brandLeft = hasBrand && brandPosition === "left";
1413
+ const brandRight = hasBrand && brandPosition === "right";
1414
+ const dropdownLeft = dropdown !== void 0 && (dropdown.position ?? "left") === "left";
1415
+ const dropdownRight = dropdown !== void 0 && dropdown.position === "right";
1416
+ const hasMenu = menu !== void 0 && menu.length > 0;
1417
+ const hasLocales = locales !== void 0 && locales.length > 0;
1418
+ const hasUser = user !== void 0;
1419
+ const rootClass = cn(
1420
+ "flex h-14 shrink-0 items-center gap-4 border-b bg-background px-4",
1421
+ className
1422
+ );
1423
+ if (!hasBrand && !dropdown && !hasMenu && !hasUser && !hasLocales) {
1424
+ return /* @__PURE__ */ jsx31("header", { "data-slot": "layout-header", className: rootClass, style, children });
1425
+ }
1426
+ const brandNode = hasBrand && /* @__PURE__ */ jsxs22("div", { "data-slot": "header-brand", className: "flex items-center gap-2", children: [
1427
+ logo !== void 0 && /* @__PURE__ */ jsx31(
1428
+ "img",
1429
+ {
1430
+ "data-slot": "header-brand-logo",
1431
+ src: logo,
1432
+ alt: title ?? "",
1433
+ className: "h-8 w-8 shrink-0 object-contain"
1434
+ }
1435
+ ),
1436
+ title !== void 0 && /* @__PURE__ */ jsx31("span", { "data-slot": "header-brand-title", className: "text-base font-semibold", children: title })
1437
+ ] });
1438
+ const dropdownNode = dropdown !== void 0 && /* @__PURE__ */ jsx31(HeaderDropdownArea, { dropdown, onSelect: onDropdownSelect });
1439
+ const showLeft = brandLeft || dropdownLeft || hasMenu;
1440
+ const showRight = dropdownRight || brandRight || hasLocales || hasUser;
1441
+ return /* @__PURE__ */ jsxs22("header", { "data-slot": "layout-header", className: rootClass, style, children: [
1442
+ showLeft && /* @__PURE__ */ jsxs22("div", { "data-slot": "header-left", className: "flex items-center gap-4", children: [
1443
+ brandLeft && brandNode,
1444
+ dropdownLeft && dropdownNode,
1445
+ hasMenu && /* @__PURE__ */ jsx31(HeaderMenuArea, { items: menu, onSelect: onMenuSelect })
1446
+ ] }),
1447
+ /* @__PURE__ */ jsx31("div", { "data-slot": "header-center", className: "flex flex-1 items-center gap-4", children }),
1448
+ showRight && /* @__PURE__ */ jsxs22("div", { "data-slot": "header-right", className: "flex items-center gap-4", children: [
1449
+ dropdownRight && dropdownNode,
1450
+ brandRight && brandNode,
1451
+ hasLocales && /* @__PURE__ */ jsx31(HeaderLocalesArea, { locales, onSelect: onLocaleChange }),
1452
+ hasUser && /* @__PURE__ */ jsx31(HeaderUserArea, { user, onSelect: onUserSelect })
1453
+ ] })
1454
+ ] });
1455
+ }
1456
+ function HeaderDropdownArea({
1457
+ dropdown,
1458
+ onSelect
1459
+ }) {
1460
+ return /* @__PURE__ */ jsxs22(DropdownMenu, { children: [
1461
+ /* @__PURE__ */ jsxs22(
1462
+ DropdownMenuTrigger,
1463
+ {
1464
+ "data-slot": "header-dropdown",
1465
+ className: cn(menuItemClass, "outline-hidden"),
1466
+ children: [
1467
+ dropdown.label,
1468
+ /* @__PURE__ */ jsx31(ChevronDownIcon, { className: "size-3.5", "aria-hidden": "true" })
1469
+ ]
1470
+ }
1471
+ ),
1472
+ /* @__PURE__ */ jsx31(DropdownMenuContent, { children: dropdown.items.map((item) => /* @__PURE__ */ jsxs22(
1473
+ DropdownMenuItem,
1474
+ {
1475
+ disabled: item.disabled,
1476
+ onClick: () => onSelect?.(item.value),
1477
+ children: [
1478
+ item.icon ? /* @__PURE__ */ jsx31(Icon, { name: item.icon, size: "sm" }) : null,
1479
+ item.label
1480
+ ]
1481
+ },
1482
+ item.value
1483
+ )) })
1484
+ ] });
1485
+ }
1486
+ function HeaderMenuArea({
1487
+ items,
1488
+ onSelect
1489
+ }) {
1490
+ return /* @__PURE__ */ jsx31("nav", { "data-slot": "header-menu", className: "flex items-center gap-1", children: items.map(
1491
+ (item) => item.children !== void 0 && item.children.length > 0 ? /* @__PURE__ */ jsxs22(DropdownMenu, { children: [
1492
+ /* @__PURE__ */ jsxs22(
1493
+ DropdownMenuTrigger,
1494
+ {
1495
+ "data-slot": "header-menu-item",
1496
+ "data-key": item.key,
1497
+ className: cn(menuItemClass, "outline-hidden"),
1498
+ children: [
1499
+ item.icon ? /* @__PURE__ */ jsx31(Icon, { name: item.icon, size: "sm" }) : null,
1500
+ item.label,
1501
+ /* @__PURE__ */ jsx31(ChevronDownIcon, { className: "size-3.5", "aria-hidden": "true" })
1502
+ ]
1503
+ }
1504
+ ),
1505
+ /* @__PURE__ */ jsx31(DropdownMenuContent, { children: item.children.map((child) => /* @__PURE__ */ jsx31(HeaderMenuEntry, { item: child, onSelect }, child.key)) })
1506
+ ] }, item.key) : /* @__PURE__ */ jsxs22(
1507
+ "button",
1508
+ {
1509
+ type: "button",
1510
+ "data-slot": "header-menu-item",
1511
+ "data-key": item.key,
1512
+ className: menuItemClass,
1513
+ onClick: () => onSelect?.(item.key),
1514
+ children: [
1515
+ item.icon ? /* @__PURE__ */ jsx31(Icon, { name: item.icon, size: "sm" }) : null,
1516
+ item.label
1517
+ ]
1518
+ },
1519
+ item.key
1520
+ )
1521
+ ) });
1522
+ }
1523
+ function HeaderMenuEntry({
1524
+ item,
1525
+ onSelect
1526
+ }) {
1527
+ if (item.children !== void 0 && item.children.length > 0) {
1528
+ return /* @__PURE__ */ jsxs22(DropdownMenuSub, { children: [
1529
+ /* @__PURE__ */ jsxs22(DropdownMenuSubTrigger, { "data-key": item.key, children: [
1530
+ item.icon ? /* @__PURE__ */ jsx31(Icon, { name: item.icon, size: "sm" }) : null,
1531
+ item.label
1532
+ ] }),
1533
+ /* @__PURE__ */ jsx31(DropdownMenuSubContent, { children: item.children.map((child) => /* @__PURE__ */ jsx31(HeaderMenuEntry, { item: child, onSelect }, child.key)) })
1534
+ ] });
1535
+ }
1536
+ return /* @__PURE__ */ jsxs22(DropdownMenuItem, { "data-key": item.key, onClick: () => onSelect?.(item.key), children: [
1537
+ item.icon ? /* @__PURE__ */ jsx31(Icon, { name: item.icon, size: "sm" }) : null,
1538
+ item.label
1539
+ ] });
1540
+ }
1541
+ function HeaderUserArea({
1542
+ user,
1543
+ onSelect
1544
+ }) {
1545
+ const identity = /* @__PURE__ */ jsxs22(Fragment2, { children: [
1546
+ /* @__PURE__ */ jsxs22(Avatar, { className: "size-7", children: [
1547
+ user.avatar !== void 0 && /* @__PURE__ */ jsx31(AvatarImage, { src: user.avatar, alt: user.name }),
1548
+ /* @__PURE__ */ jsx31(AvatarFallback, { children: user.name.charAt(0) })
1549
+ ] }),
1550
+ /* @__PURE__ */ jsx31("span", { className: "text-sm", children: user.name })
1551
+ ] });
1552
+ if (user.items === void 0 || user.items.length === 0) {
1553
+ return /* @__PURE__ */ jsx31("div", { "data-slot": "header-user", className: "flex items-center gap-2", children: identity });
1554
+ }
1555
+ return /* @__PURE__ */ jsxs22(DropdownMenu, { children: [
1556
+ /* @__PURE__ */ jsx31(
1557
+ DropdownMenuTrigger,
1558
+ {
1559
+ "data-slot": "header-user",
1560
+ className: "flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors outline-hidden hover:bg-accent/50",
1561
+ children: identity
1562
+ }
1563
+ ),
1564
+ /* @__PURE__ */ jsx31(DropdownMenuContent, { align: "end", children: user.items.map((item) => /* @__PURE__ */ jsxs22(DropdownMenuItem, { onClick: () => onSelect?.(item.value), children: [
1565
+ item.icon ? /* @__PURE__ */ jsx31(Icon, { name: item.icon, size: "sm" }) : null,
1566
+ item.label
1567
+ ] }, item.value)) })
1568
+ ] });
1569
+ }
1570
+ function HeaderLocalesArea({
1571
+ locales,
1572
+ onSelect
1573
+ }) {
1574
+ const { locale } = useI18n4();
1575
+ const current = locales.find((option) => option.value === locale);
1576
+ return /* @__PURE__ */ jsxs22(DropdownMenu, { children: [
1577
+ /* @__PURE__ */ jsxs22(
1578
+ DropdownMenuTrigger,
1579
+ {
1580
+ "data-slot": "header-locales",
1581
+ className: cn(menuItemClass, "outline-hidden"),
1582
+ children: [
1583
+ current?.label ?? locale,
1584
+ /* @__PURE__ */ jsx31(ChevronDownIcon, { className: "size-3.5", "aria-hidden": "true" })
1585
+ ]
1586
+ }
1587
+ ),
1588
+ /* @__PURE__ */ jsx31(DropdownMenuContent, { align: "end", children: locales.map((option) => /* @__PURE__ */ jsx31(
1589
+ DropdownMenuItem,
1590
+ {
1591
+ onClick: () => onSelect?.(option.value),
1592
+ children: option.label
1593
+ },
1594
+ option.value
1595
+ )) })
1596
+ ] });
1597
+ }
1598
+
1599
+ // src/components/components/HoverCard/index.tsx
1600
+ import { useRenderer as useRenderer7 } from "@pactor-app/runtime";
1601
+ import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
1602
+ function isDslNode2(value) {
1603
+ return typeof value === "object" && value !== null && typeof value.type === "string";
1604
+ }
1605
+ function HoverCard2({ content, children, className, style }) {
1606
+ const { renderChildren } = useRenderer7();
1607
+ return /* @__PURE__ */ jsxs23(HoverCard, { children: [
1608
+ /* @__PURE__ */ jsx32(HoverCardTrigger, { render: triggerWrapper("hover-card-trigger-wrap"), children }),
1609
+ /* @__PURE__ */ jsx32(HoverCardContent, { className, style, children: isDslNode2(content) ? renderChildren([content]) : content })
1610
+ ] });
1611
+ }
1612
+
1613
+ // src/components/components/Input/index.tsx
1614
+ import { useEffect as useEffect6, useId as useId3 } from "react";
1615
+ import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
1616
+ function Input2({
1617
+ name,
1618
+ label,
1619
+ rules,
1620
+ value,
1621
+ type = "text",
1622
+ placeholder,
1623
+ disabled,
1624
+ onChange,
1625
+ className,
1626
+ style
1627
+ }) {
1628
+ const form = useFormContext();
1629
+ const controlId = useId3();
1630
+ const inForm = form?.inForm === true && typeof name === "string" && name !== "";
1631
+ useEffect6(() => {
1632
+ if (inForm && form && name) {
1633
+ form.registerField(name, rules, value);
1634
+ return () => form.unregisterField(name);
1635
+ }
1636
+ return void 0;
1637
+ });
1638
+ if (inForm && form && name) {
1639
+ const fieldValue = form.values[name];
1640
+ const error = form.errors[name];
1641
+ return /* @__PURE__ */ jsxs24(
1642
+ "div",
1643
+ {
1644
+ "data-slot": "form-item",
1645
+ className: cn(formItemClass(form.layout), className),
1646
+ style,
1647
+ children: [
1648
+ label ? /* @__PURE__ */ jsx33(
1649
+ "label",
1650
+ {
1651
+ htmlFor: controlId,
1652
+ className: "shrink-0 text-sm leading-none font-medium whitespace-nowrap",
1653
+ children: label
1654
+ }
1655
+ ) : null,
1656
+ /* @__PURE__ */ jsx33(
1657
+ Input,
1658
+ {
1659
+ id: controlId,
1660
+ type,
1661
+ value: typeof fieldValue === "string" ? fieldValue : "",
1662
+ placeholder,
1663
+ disabled,
1664
+ onChange: (event) => {
1665
+ form.setValue(name, event.target.value);
1666
+ onChange?.(event.target.value);
1667
+ }
1668
+ }
1669
+ ),
1670
+ error ? /* @__PURE__ */ jsx33("div", { "data-slot": "form-error", className: "text-sm text-destructive", children: error }) : null
1671
+ ]
1672
+ }
1673
+ );
1674
+ }
1675
+ return /* @__PURE__ */ jsx33(
1676
+ Input,
1677
+ {
1678
+ type,
1679
+ value: value ?? "",
1680
+ placeholder,
1681
+ disabled,
1682
+ className,
1683
+ style,
1684
+ onChange: (event) => onChange?.(event.target.value)
1685
+ }
1686
+ );
1687
+ }
1688
+
1689
+ // src/components/components/InputGroup/index.tsx
1690
+ import { jsx as jsx34 } from "react/jsx-runtime";
1691
+ function InputGroup2({ className, style, children }) {
1692
+ return /* @__PURE__ */ jsx34(InputGroup, { className, style, children });
1693
+ }
1694
+
1695
+ // src/components/components/InputOTP/index.tsx
1696
+ import { useEffect as useEffect7, useState as useState8 } from "react";
1697
+ import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
1698
+ function InputOTP2({
1699
+ name,
1700
+ label,
1701
+ rules,
1702
+ length = 6,
1703
+ value,
1704
+ disabled,
1705
+ onChange,
1706
+ onComplete,
1707
+ className,
1708
+ style
1709
+ }) {
1710
+ const form = useFormContext();
1711
+ const inForm = form?.inForm === true && typeof name === "string" && name !== "";
1712
+ useEffect7(() => {
1713
+ if (inForm && form && name) {
1714
+ form.registerField(name, rules, value);
1715
+ return () => form.unregisterField(name);
1716
+ }
1717
+ return void 0;
1718
+ });
1719
+ const [innerValue, setInnerValue] = useState8(typeof value === "string" ? value : "");
1720
+ useEffect7(() => {
1721
+ if (!inForm) setInnerValue(typeof value === "string" ? value : "");
1722
+ }, [inForm, value]);
1723
+ const current = inForm && form && name ? typeof form.values[name] === "string" ? form.values[name] : "" : innerValue;
1724
+ const handleChange = (next) => {
1725
+ if (inForm && form && name) {
1726
+ form.setValue(name, next);
1727
+ } else {
1728
+ setInnerValue(next);
1729
+ }
1730
+ onChange?.(next);
1731
+ if (next.length === length) {
1732
+ onComplete?.(next);
1733
+ }
1734
+ };
1735
+ const control = /* @__PURE__ */ jsx35(
1736
+ InputOTP,
1737
+ {
1738
+ maxLength: length,
1739
+ value: current,
1740
+ onChange: handleChange,
1741
+ disabled,
1742
+ children: /* @__PURE__ */ jsx35(InputOTPGroup, { children: Array.from({ length }, (_, index) => /* @__PURE__ */ jsx35(InputOTPSlot, { index }, index)) })
1743
+ }
1744
+ );
1745
+ if (inForm && form && name) {
1746
+ const error = form.errors[name];
1747
+ return /* @__PURE__ */ jsxs25(
1748
+ "div",
1749
+ {
1750
+ "data-slot": "form-item",
1751
+ className: cn(formItemClass(form.layout), className),
1752
+ style,
1753
+ children: [
1754
+ label ? /* @__PURE__ */ jsx35("label", { className: "shrink-0 text-sm leading-none font-medium whitespace-nowrap", children: label }) : null,
1755
+ control,
1756
+ error ? /* @__PURE__ */ jsx35("div", { "data-slot": "form-error", className: "text-sm text-destructive", children: error }) : null
1757
+ ]
1758
+ }
1759
+ );
1760
+ }
1761
+ return /* @__PURE__ */ jsx35("div", { "data-slot": "input-otp-field", className: cn("inline-block", className), style, children: control });
1762
+ }
1763
+
1764
+ // src/components/components/Item/index.tsx
1765
+ import { useRenderer as useRenderer8 } from "@pactor-app/runtime";
1766
+ import { jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
1767
+ function Item2({
1768
+ title,
1769
+ description,
1770
+ media,
1771
+ actions,
1772
+ className,
1773
+ style
1774
+ }) {
1775
+ const { renderChildren } = useRenderer8();
1776
+ const mediaNodes = media === void 0 ? [] : Array.isArray(media) ? media : [media];
1777
+ return /* @__PURE__ */ jsxs26(Item, { className, style, children: [
1778
+ mediaNodes.length > 0 ? /* @__PURE__ */ jsx36(ItemMedia, { children: renderChildren(mediaNodes) }) : null,
1779
+ /* @__PURE__ */ jsxs26(ItemContent, { children: [
1780
+ title ? /* @__PURE__ */ jsx36(ItemTitle, { children: title }) : null,
1781
+ description ? /* @__PURE__ */ jsx36(ItemDescription, { children: description }) : null
1782
+ ] }),
1783
+ actions && actions.length > 0 ? /* @__PURE__ */ jsx36(ItemActions, { children: renderChildren(actions) }) : null
1784
+ ] });
1785
+ }
1786
+
1787
+ // src/components/components/Kbd/index.tsx
1788
+ import { jsx as jsx37 } from "react/jsx-runtime";
1789
+ function Kbd2({ text, className, style }) {
1790
+ return /* @__PURE__ */ jsx37(Kbd, { className, style, children: text });
1791
+ }
1792
+
1793
+ // src/components/components/Label/index.tsx
1794
+ import { jsx as jsx38 } from "react/jsx-runtime";
1795
+ function Label2({ text, htmlFor, className, style }) {
1796
+ return /* @__PURE__ */ jsx38(Label, { htmlFor, className, style, children: text });
1797
+ }
1798
+
1799
+ // src/components/components/Layout/index.tsx
1800
+ import { isDslSourceRef } from "@pactor-app/core";
1801
+ import { useRenderer as useRenderer9 } from "@pactor-app/runtime";
1802
+ import { jsx as jsx39 } from "react/jsx-runtime";
1803
+ function Layout({ direction, className, style, dslChildren }) {
1804
+ const { renderChildren, context } = useRenderer9();
1805
+ const hasSider = Array.isArray(dslChildren) ? dslChildren.some(
1806
+ (child) => !isDslSourceRef(child) && resolveRootType(child, context) === "Sider"
1807
+ ) : false;
1808
+ const dir = direction ?? (hasSider ? "horizontal" : "vertical");
1809
+ return /* @__PURE__ */ jsx39(
1810
+ "div",
1811
+ {
1812
+ "data-slot": "layout",
1813
+ "data-direction": dir,
1814
+ className: cn(
1815
+ "flex min-h-0 w-full h-full flex-1",
1816
+ dir === "vertical" ? "flex-col" : "flex-row",
1817
+ className
1818
+ ),
1819
+ style,
1820
+ children: renderChildren(dslChildren)
1821
+ }
1822
+ );
1823
+ }
1824
+ function resolveRootType(node, context) {
1825
+ if (node.component !== void 0) {
1826
+ const def = context.pageComponents[node.component];
1827
+ return def !== void 0 && "type" in def ? def.type : void 0;
1828
+ }
1829
+ return node.type;
1830
+ }
1831
+
1832
+ // src/components/components/Link/index.tsx
1833
+ import { jsx as jsx40 } from "react/jsx-runtime";
1834
+ function Link({ href, text, target, className, style, children }) {
1835
+ return /* @__PURE__ */ jsx40(
1836
+ "a",
1837
+ {
1838
+ "data-slot": "link",
1839
+ href,
1840
+ target,
1841
+ rel: target === "_blank" ? "noreferrer" : void 0,
1842
+ className: cn("text-primary underline-offset-4 hover:underline", className),
1843
+ style,
1844
+ children: text ?? children
1845
+ }
1846
+ );
1847
+ }
1848
+
1849
+ // src/components/components/Menu/index.tsx
1850
+ import { jsx as jsx41, jsxs as jsxs27 } from "react/jsx-runtime";
1851
+ function Menu({
1852
+ items = [],
1853
+ mode = "inline",
1854
+ selectedKey,
1855
+ onSelect,
1856
+ className,
1857
+ style
1858
+ }) {
1859
+ return /* @__PURE__ */ jsx41(
1860
+ "nav",
1861
+ {
1862
+ "data-slot": "menu",
1863
+ "data-mode": mode,
1864
+ className: cn(
1865
+ mode === "horizontal" ? "flex items-center gap-1" : "flex flex-col gap-0.5 p-2",
1866
+ className
1867
+ ),
1868
+ style,
1869
+ children: items.map((item) => /* @__PURE__ */ jsx41(
1870
+ MenuEntry,
1871
+ {
1872
+ item,
1873
+ mode,
1874
+ depth: 0,
1875
+ selectedKey,
1876
+ onSelect
1877
+ },
1878
+ item.key
1879
+ ))
1880
+ }
1881
+ );
1882
+ }
1883
+ function MenuEntry({
1884
+ item,
1885
+ mode,
1886
+ depth,
1887
+ selectedKey,
1888
+ onSelect
1889
+ }) {
1890
+ const selected = item.key === selectedKey;
1891
+ return /* @__PURE__ */ jsxs27("div", { "data-slot": "menu-entry", "data-key": item.key, children: [
1892
+ /* @__PURE__ */ jsxs27(
1893
+ "button",
1894
+ {
1895
+ type: "button",
1896
+ "data-slot": "menu-item",
1897
+ "aria-current": selected ? "page" : void 0,
1898
+ className: cn(
1899
+ "flex w-full items-center gap-2 rounded-md text-sm transition-colors",
1900
+ mode === "horizontal" ? "px-3 py-2" : "px-3 py-2 text-left",
1901
+ selected ? "bg-accent font-medium text-accent-foreground" : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"
1902
+ ),
1903
+ style: mode === "inline" && depth > 0 ? { paddingLeft: 12 + depth * 16 } : void 0,
1904
+ onClick: () => onSelect?.(item.key),
1905
+ children: [
1906
+ item.icon ? /* @__PURE__ */ jsx41(Icon, { name: item.icon, size: "sm" }) : null,
1907
+ item.label
1908
+ ]
1909
+ }
1910
+ ),
1911
+ item.children?.map((child) => /* @__PURE__ */ jsx41(
1912
+ MenuEntry,
1913
+ {
1914
+ item: child,
1915
+ mode,
1916
+ depth: depth + 1,
1917
+ selectedKey,
1918
+ onSelect
1919
+ },
1920
+ child.key
1921
+ ))
1922
+ ] });
1923
+ }
1924
+
1925
+ // src/components/components/Menubar/index.tsx
1926
+ import { jsx as jsx42, jsxs as jsxs28 } from "react/jsx-runtime";
1927
+ function Menubar2({ menus = [], onSelect, className, style }) {
1928
+ return /* @__PURE__ */ jsx42(Menubar, { className, style, children: menus.map((menu) => /* @__PURE__ */ jsxs28(MenubarMenu, { children: [
1929
+ /* @__PURE__ */ jsx42(MenubarTrigger, { children: menu.label }),
1930
+ /* @__PURE__ */ jsx42(MenubarContent, { children: menu.items.map((item) => /* @__PURE__ */ jsxs28(
1931
+ MenubarItem,
1932
+ {
1933
+ disabled: item.disabled,
1934
+ onClick: () => onSelect?.(item.value),
1935
+ children: [
1936
+ item.icon ? /* @__PURE__ */ jsx42(Icon, { name: item.icon, size: "sm" }) : null,
1937
+ item.label
1938
+ ]
1939
+ },
1940
+ item.value
1941
+ )) })
1942
+ ] }, menu.label)) });
1943
+ }
1944
+
1945
+ // src/components/components/NavigationMenu/index.tsx
1946
+ import { Fragment as Fragment3, jsx as jsx43, jsxs as jsxs29 } from "react/jsx-runtime";
1947
+ function NavigationMenu2({ items = [], className, style }) {
1948
+ return /* @__PURE__ */ jsx43(NavigationMenu, { className, style, children: /* @__PURE__ */ jsx43(NavigationMenuList, { children: items.map((item, index) => /* @__PURE__ */ jsx43(NavigationMenuItem, { value: `item-${index}`, children: item.children && item.children.length > 0 ? /* @__PURE__ */ jsxs29(Fragment3, { children: [
1949
+ /* @__PURE__ */ jsxs29(
1950
+ NavigationMenuTrigger,
1951
+ {
1952
+ className: item.icon !== void 0 ? "gap-2" : void 0,
1953
+ children: [
1954
+ item.icon ? /* @__PURE__ */ jsx43(Icon, { name: item.icon, size: "sm" }) : null,
1955
+ item.label
1956
+ ]
1957
+ }
1958
+ ),
1959
+ /* @__PURE__ */ jsx43(NavigationMenuContent, { children: /* @__PURE__ */ jsx43("ul", { className: "grid w-64 gap-1", children: item.children.map((child) => /* @__PURE__ */ jsx43("li", { children: /* @__PURE__ */ jsxs29(NavigationMenuLink, { href: child.href, children: [
1960
+ /* @__PURE__ */ jsxs29(
1961
+ "span",
1962
+ {
1963
+ className: child.icon !== void 0 ? "flex items-center gap-2 font-medium" : "font-medium",
1964
+ children: [
1965
+ child.icon ? /* @__PURE__ */ jsx43(Icon, { name: child.icon, size: "sm" }) : null,
1966
+ child.label
1967
+ ]
1968
+ }
1969
+ ),
1970
+ child.description ? /* @__PURE__ */ jsx43("span", { className: "text-muted-foreground", children: child.description }) : null
1971
+ ] }) }, child.href)) }) })
1972
+ ] }) : /* @__PURE__ */ jsxs29(
1973
+ NavigationMenuLink,
1974
+ {
1975
+ href: item.href,
1976
+ className: cn(
1977
+ navigationMenuTriggerStyle(),
1978
+ item.icon !== void 0 && "gap-2"
1979
+ ),
1980
+ children: [
1981
+ item.icon ? /* @__PURE__ */ jsx43(Icon, { name: item.icon, size: "sm" }) : null,
1982
+ item.label
1983
+ ]
1984
+ }
1985
+ ) }, `${item.label}-${index}`)) }) });
1986
+ }
1987
+
1988
+ // src/components/components/Page/index.tsx
1989
+ import { jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
1990
+ function Page({ title, className, style, children }) {
1991
+ return /* @__PURE__ */ jsxs30("div", { "data-slot": "page", className: cn("p-6", className), style, children: [
1992
+ title ? /* @__PURE__ */ jsx44("h2", { "data-slot": "page-title", className: "mb-5 text-xl font-semibold", children: title }) : null,
1993
+ /* @__PURE__ */ jsx44("div", { "data-slot": "page-content", className: "space-y-5", children })
1994
+ ] });
1995
+ }
1996
+
1997
+ // src/components/components/Pagination/index.tsx
1998
+ import { useState as useState9 } from "react";
1999
+ import { jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
2000
+ function pageItems(current, count) {
2001
+ if (count <= 7) {
2002
+ return Array.from({ length: count }, (_, i) => i + 1);
2003
+ }
2004
+ if (current <= 4) {
2005
+ return [1, 2, 3, 4, 5, "ellipsis", count];
2006
+ }
2007
+ if (current >= count - 3) {
2008
+ return [1, "ellipsis", count - 4, count - 3, count - 2, count - 1, count];
2009
+ }
2010
+ return [1, "ellipsis", current - 1, current, current + 1, "ellipsis", count];
2011
+ }
2012
+ function Pagination2({
2013
+ total = 0,
2014
+ pageSize = 10,
2015
+ page,
2016
+ onChange,
2017
+ className,
2018
+ style
2019
+ }) {
2020
+ const [innerPage, setInnerPage] = useState9(1);
2021
+ const pageCount = Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
2022
+ const current = Math.min(Math.max(1, page ?? innerPage), pageCount);
2023
+ const goTo = (next) => {
2024
+ const target = Math.min(Math.max(1, next), pageCount);
2025
+ if (target === current) {
2026
+ return;
2027
+ }
2028
+ if (page === void 0) {
2029
+ setInnerPage(target);
2030
+ }
2031
+ onChange?.(target);
2032
+ };
2033
+ return /* @__PURE__ */ jsx45(Pagination, { className, style, children: /* @__PURE__ */ jsxs31(PaginationContent, { children: [
2034
+ /* @__PURE__ */ jsx45(PaginationItem, { children: /* @__PURE__ */ jsx45(
2035
+ PaginationPrevious,
2036
+ {
2037
+ href: "#",
2038
+ disabled: current <= 1,
2039
+ onClick: (e) => {
2040
+ e.preventDefault();
2041
+ goTo(current - 1);
2042
+ }
2043
+ }
2044
+ ) }),
2045
+ pageItems(current, pageCount).map((item, index) => /* @__PURE__ */ jsx45(PaginationItem, { children: item === "ellipsis" ? /* @__PURE__ */ jsx45(PaginationEllipsis, {}) : /* @__PURE__ */ jsx45(
2046
+ PaginationLink,
2047
+ {
2048
+ href: "#",
2049
+ isActive: item === current,
2050
+ onClick: (e) => {
2051
+ e.preventDefault();
2052
+ goTo(item);
2053
+ },
2054
+ children: item
2055
+ }
2056
+ ) }, item === "ellipsis" ? `ellipsis-${index}` : item)),
2057
+ /* @__PURE__ */ jsx45(PaginationItem, { children: /* @__PURE__ */ jsx45(
2058
+ PaginationNext,
2059
+ {
2060
+ href: "#",
2061
+ disabled: current >= pageCount,
2062
+ onClick: (e) => {
2063
+ e.preventDefault();
2064
+ goTo(current + 1);
2065
+ }
2066
+ }
2067
+ ) })
2068
+ ] }) });
2069
+ }
2070
+
2071
+ // src/components/components/Popover/index.tsx
2072
+ import { useRenderer as useRenderer10 } from "@pactor-app/runtime";
2073
+ import { jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
2074
+ function isDslNode3(value) {
2075
+ return typeof value === "object" && value !== null && typeof value.type === "string";
2076
+ }
2077
+ function Popover2({ content, children, className, style }) {
2078
+ const { renderChildren } = useRenderer10();
2079
+ return /* @__PURE__ */ jsxs32(Popover, { children: [
2080
+ /* @__PURE__ */ jsx46(
2081
+ PopoverTrigger,
2082
+ {
2083
+ nativeButton: false,
2084
+ render: triggerWrapper("popover-trigger-wrap"),
2085
+ children
2086
+ }
2087
+ ),
2088
+ /* @__PURE__ */ jsx46(PopoverContent, { className, style, children: isDslNode3(content) ? renderChildren([content]) : content })
2089
+ ] });
2090
+ }
2091
+
2092
+ // src/components/components/Progress/index.tsx
2093
+ import { jsx as jsx47 } from "react/jsx-runtime";
2094
+ function Progress2({ value, className, style }) {
2095
+ const resolved = typeof value === "number" && Number.isFinite(value) ? Math.min(100, Math.max(0, value)) : null;
2096
+ return /* @__PURE__ */ jsx47(Progress, { value: resolved, className, style, children: /* @__PURE__ */ jsx47(ProgressTrack, { children: /* @__PURE__ */ jsx47(ProgressIndicator, {}) }) });
2097
+ }
2098
+
2099
+ // src/components/components/RadioGroup/index.tsx
2100
+ import { useEffect as useEffect8, useId as useId4 } from "react";
2101
+
2102
+ // src/components/components/Form/form-item.tsx
2103
+ import { jsx as jsx48, jsxs as jsxs33 } from "react/jsx-runtime";
2104
+ function FieldShell({
2105
+ layout,
2106
+ label,
2107
+ htmlFor,
2108
+ error,
2109
+ className,
2110
+ style,
2111
+ children
2112
+ }) {
2113
+ return /* @__PURE__ */ jsxs33(
2114
+ "div",
2115
+ {
2116
+ "data-slot": "form-item",
2117
+ className: cn(formItemClass(layout), className),
2118
+ style,
2119
+ children: [
2120
+ label ? /* @__PURE__ */ jsx48(
2121
+ "label",
2122
+ {
2123
+ htmlFor,
2124
+ className: "shrink-0 text-sm leading-none font-medium whitespace-nowrap",
2125
+ children: label
2126
+ }
2127
+ ) : null,
2128
+ children,
2129
+ error ? /* @__PURE__ */ jsx48("div", { "data-slot": "form-error", className: "text-sm text-destructive", children: error }) : null
2130
+ ]
2131
+ }
2132
+ );
2133
+ }
2134
+
2135
+ // src/components/components/RadioGroup/index.tsx
2136
+ import { jsx as jsx49, jsxs as jsxs34 } from "react/jsx-runtime";
2137
+ function RadioGroup2({
2138
+ name,
2139
+ label,
2140
+ rules,
2141
+ options = [],
2142
+ value,
2143
+ disabled,
2144
+ onChange,
2145
+ className,
2146
+ style
2147
+ }) {
2148
+ const form = useFormContext();
2149
+ const controlId = useId4();
2150
+ const inForm = form?.inForm === true && typeof name === "string" && name !== "";
2151
+ useEffect8(() => {
2152
+ if (inForm && form && name) {
2153
+ form.registerField(name, rules, value);
2154
+ return () => form.unregisterField(name);
2155
+ }
2156
+ return void 0;
2157
+ });
2158
+ const current = inForm && form && name ? form.values[name] : value;
2159
+ const handleChange = (next) => {
2160
+ if (inForm && form && name) {
2161
+ form.setValue(name, next);
2162
+ }
2163
+ onChange?.(next);
2164
+ };
2165
+ const groupValue = current ?? "";
2166
+ const group = /* @__PURE__ */ jsx49(
2167
+ RadioGroup,
2168
+ {
2169
+ value: groupValue,
2170
+ onValueChange: handleChange,
2171
+ disabled,
2172
+ name: inForm ? name : void 0,
2173
+ className: cn(!inForm && className),
2174
+ style: inForm ? void 0 : style,
2175
+ children: options.map((option, index) => {
2176
+ const optionId = `${controlId}-${index}`;
2177
+ return /* @__PURE__ */ jsxs34("span", { className: "inline-flex items-center gap-2", children: [
2178
+ /* @__PURE__ */ jsx49(
2179
+ RadioGroupItem,
2180
+ {
2181
+ id: optionId,
2182
+ value: option.value,
2183
+ disabled: option.disabled
2184
+ }
2185
+ ),
2186
+ /* @__PURE__ */ jsx49("label", { htmlFor: optionId, className: "text-sm leading-none font-medium", children: option.label })
2187
+ ] }, String(option.value));
2188
+ })
2189
+ }
2190
+ );
2191
+ if (inForm && form && name) {
2192
+ return /* @__PURE__ */ jsx49(
2193
+ FieldShell,
2194
+ {
2195
+ layout: form.layout,
2196
+ label,
2197
+ error: form.errors[name],
2198
+ className,
2199
+ style,
2200
+ children: group
2201
+ }
2202
+ );
2203
+ }
2204
+ return group;
2205
+ }
2206
+
2207
+ // src/components/components/Resizable/index.tsx
2208
+ import { useRenderer as useRenderer11 } from "@pactor-app/runtime";
2209
+ import { Fragment as Fragment4 } from "react";
2210
+ import { jsx as jsx50, jsxs as jsxs35 } from "react/jsx-runtime";
2211
+ function Resizable({
2212
+ panels = [],
2213
+ direction = "horizontal",
2214
+ className,
2215
+ style
2216
+ }) {
2217
+ const { renderChildren } = useRenderer11();
2218
+ return /* @__PURE__ */ jsx50(PanelGroup, { orientation: direction, className, style, children: panels.map((panel, index) => /* @__PURE__ */ jsxs35(Fragment4, { children: [
2219
+ index > 0 ? /* @__PURE__ */ jsx50(ResizableHandle, { withHandle: true }) : null,
2220
+ /* @__PURE__ */ jsx50(
2221
+ Panel,
2222
+ {
2223
+ defaultSize: typeof panel.defaultSize === "number" ? `${panel.defaultSize}%` : void 0,
2224
+ children: renderChildren(panel.children)
2225
+ }
2226
+ )
2227
+ ] }, index)) });
2228
+ }
2229
+
2230
+ // src/components/components/ScrollArea/index.tsx
2231
+ import { jsx as jsx51 } from "react/jsx-runtime";
2232
+ function ScrollArea2({
2233
+ maxHeight,
2234
+ maxWidth,
2235
+ className,
2236
+ style,
2237
+ children
2238
+ }) {
2239
+ return /* @__PURE__ */ jsx51(
2240
+ ScrollArea,
2241
+ {
2242
+ className,
2243
+ style: { maxHeight, maxWidth, ...style },
2244
+ children
2245
+ }
2246
+ );
2247
+ }
2248
+
2249
+ // src/components/components/Select/index.tsx
2250
+ import { useI18n as useI18n5 } from "@pactor-app/runtime";
2251
+ import { useEffect as useEffect9, useId as useId5 } from "react";
2252
+ import { jsx as jsx52, jsxs as jsxs36 } from "react/jsx-runtime";
2253
+ function Select2({
2254
+ name,
2255
+ label,
2256
+ rules,
2257
+ options = [],
2258
+ value,
2259
+ placeholder,
2260
+ disabled,
2261
+ allowClear,
2262
+ onChange,
2263
+ className,
2264
+ style
2265
+ }) {
2266
+ const form = useFormContext();
2267
+ const { t } = useI18n5();
2268
+ const controlId = useId5();
2269
+ const inForm = form?.inForm === true && typeof name === "string" && name !== "";
2270
+ useEffect9(() => {
2271
+ if (inForm && form && name) {
2272
+ form.registerField(name, rules, value);
2273
+ return () => form.unregisterField(name);
2274
+ }
2275
+ return void 0;
2276
+ });
2277
+ const current = inForm && form && name ? form.values[name] : value;
2278
+ const selectedValue = current === void 0 || current === null || current === "" ? null : current;
2279
+ const handleChange = (next) => {
2280
+ if (inForm && form && name) {
2281
+ form.setValue(name, next ?? void 0);
2282
+ }
2283
+ onChange?.(next ?? void 0);
2284
+ };
2285
+ const inFormRoot = inForm === true;
2286
+ const select = /* @__PURE__ */ jsxs36(
2287
+ "span",
2288
+ {
2289
+ className: cn("inline-flex items-center gap-1", !inFormRoot && className),
2290
+ style: inFormRoot ? void 0 : style,
2291
+ children: [
2292
+ /* @__PURE__ */ jsxs36(
2293
+ Select,
2294
+ {
2295
+ items: options,
2296
+ value: selectedValue,
2297
+ onValueChange: handleChange,
2298
+ disabled,
2299
+ name: inForm ? name : void 0,
2300
+ children: [
2301
+ /* @__PURE__ */ jsx52(SelectTrigger, { id: controlId, children: /* @__PURE__ */ jsx52(SelectValue, { placeholder }) }),
2302
+ /* @__PURE__ */ jsx52(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx52(
2303
+ SelectItem,
2304
+ {
2305
+ value: option.value,
2306
+ disabled: option.disabled,
2307
+ children: option.label
2308
+ },
2309
+ String(option.value)
2310
+ )) })
2311
+ ]
2312
+ }
2313
+ ),
2314
+ allowClear && selectedValue !== null && !disabled ? /* @__PURE__ */ jsx52(
2315
+ "button",
2316
+ {
2317
+ type: "button",
2318
+ "aria-label": t("pactor.select.clear"),
2319
+ className: "cursor-pointer text-muted-foreground hover:text-foreground",
2320
+ onClick: () => {
2321
+ if (inForm && form && name) {
2322
+ form.setValue(name, void 0);
2323
+ }
2324
+ onChange?.(void 0);
2325
+ },
2326
+ children: "\xD7"
2327
+ }
2328
+ ) : null
2329
+ ]
2330
+ }
2331
+ );
2332
+ if (inForm && form && name) {
2333
+ const error = form.errors[name];
2334
+ return /* @__PURE__ */ jsxs36(
2335
+ "div",
2336
+ {
2337
+ "data-slot": "form-item",
2338
+ className: cn(formItemClass(form.layout), className),
2339
+ style,
2340
+ children: [
2341
+ label ? /* @__PURE__ */ jsx52(
2342
+ "label",
2343
+ {
2344
+ htmlFor: controlId,
2345
+ className: "shrink-0 text-sm leading-none font-medium whitespace-nowrap",
2346
+ children: label
2347
+ }
2348
+ ) : null,
2349
+ select,
2350
+ error ? /* @__PURE__ */ jsx52("div", { "data-slot": "form-error", className: "text-sm text-destructive", children: error }) : null
2351
+ ]
2352
+ }
2353
+ );
2354
+ }
2355
+ return select;
2356
+ }
2357
+
2358
+ // src/components/components/Separator/index.tsx
2359
+ import { jsx as jsx53 } from "react/jsx-runtime";
2360
+ function Separator2({ orientation = "horizontal", className, style }) {
2361
+ return /* @__PURE__ */ jsx53(Separator, { orientation, className, style });
2362
+ }
2363
+
2364
+ // src/components/components/Sheet/index.tsx
2365
+ import { jsx as jsx54, jsxs as jsxs37 } from "react/jsx-runtime";
2366
+ function Sheet2({
2367
+ title,
2368
+ open,
2369
+ side = "right",
2370
+ onClose,
2371
+ children,
2372
+ className,
2373
+ style
2374
+ }) {
2375
+ return /* @__PURE__ */ jsx54(
2376
+ Sheet,
2377
+ {
2378
+ open: open ?? false,
2379
+ onOpenChange: (next) => {
2380
+ if (!next) {
2381
+ onClose?.();
2382
+ }
2383
+ },
2384
+ children: /* @__PURE__ */ jsxs37(SheetContent, { side, className, style, children: [
2385
+ title ? /* @__PURE__ */ jsx54(SheetHeader, { children: /* @__PURE__ */ jsx54(SheetTitle, { children: title }) }) : null,
2386
+ /* @__PURE__ */ jsx54("div", { className: "flex-1 overflow-auto px-4", children })
2387
+ ] })
2388
+ }
2389
+ );
2390
+ }
2391
+
2392
+ // src/components/components/Sidebar/index.tsx
2393
+ import { useI18n as useI18n6 } from "@pactor-app/runtime";
2394
+ import { ChevronLeft, ChevronRight } from "lucide-react";
2395
+ import { useState as useState10 } from "react";
2396
+ import { jsx as jsx55, jsxs as jsxs38 } from "react/jsx-runtime";
2397
+ function Sidebar({
2398
+ brand,
2399
+ items = [],
2400
+ collapsible,
2401
+ onCollapse,
2402
+ className,
2403
+ style,
2404
+ children
2405
+ }) {
2406
+ const { t } = useI18n6();
2407
+ const [collapsed, setCollapsed] = useState10(false);
2408
+ const toggleCollapsed = () => {
2409
+ const next = !collapsed;
2410
+ setCollapsed(next);
2411
+ onCollapse?.(next);
2412
+ };
2413
+ return /* @__PURE__ */ jsxs38(
2414
+ "div",
2415
+ {
2416
+ "data-slot": "sidebar-layout",
2417
+ className: cn("flex min-h-screen w-full", className),
2418
+ style,
2419
+ children: [
2420
+ /* @__PURE__ */ jsxs38(
2421
+ "aside",
2422
+ {
2423
+ "data-slot": "sidebar",
2424
+ "data-collapsed": collapsed || void 0,
2425
+ className: cn(
2426
+ "flex shrink-0 flex-col border-r border-sidebar-border bg-sidebar text-sidebar-foreground transition-[width]",
2427
+ collapsed ? "w-14" : "w-60"
2428
+ ),
2429
+ children: [
2430
+ brand ? /* @__PURE__ */ jsxs38(
2431
+ "div",
2432
+ {
2433
+ "data-slot": "sidebar-brand",
2434
+ className: "flex h-14 shrink-0 items-center gap-2 border-b border-sidebar-border px-4",
2435
+ children: [
2436
+ brand.logo ? /* @__PURE__ */ jsx55(
2437
+ "img",
2438
+ {
2439
+ "data-slot": "sidebar-brand-logo",
2440
+ src: brand.logo,
2441
+ alt: brand.title,
2442
+ className: "size-6 shrink-0"
2443
+ }
2444
+ ) : null,
2445
+ collapsed ? null : /* @__PURE__ */ jsx55("span", { className: "truncate text-sm font-semibold", children: brand.title })
2446
+ ]
2447
+ }
2448
+ ) : null,
2449
+ collapsed ? null : /* @__PURE__ */ jsx55("nav", { "data-slot": "sidebar-nav", className: "min-h-0 flex-1 overflow-auto p-2", children: items.map((item, index) => /* @__PURE__ */ jsx55(SidebarEntry, { item, depth: 0 }, item.href ?? item.label ?? index)) }),
2450
+ collapsible ? /* @__PURE__ */ jsx55(
2451
+ "button",
2452
+ {
2453
+ type: "button",
2454
+ "data-slot": "sidebar-collapse-trigger",
2455
+ "aria-label": collapsed ? t("pactor.layout.expandSidebar") : t("pactor.layout.collapseSidebar"),
2456
+ className: "flex h-10 shrink-0 items-center justify-center border-t border-sidebar-border text-sidebar-foreground/60 hover:text-sidebar-foreground",
2457
+ onClick: toggleCollapsed,
2458
+ children: collapsed ? /* @__PURE__ */ jsx55(ChevronRight, { "aria-hidden": true, className: "size-4" }) : /* @__PURE__ */ jsx55(ChevronLeft, { "aria-hidden": true, className: "size-4" })
2459
+ }
2460
+ ) : null
2461
+ ]
2462
+ }
2463
+ ),
2464
+ /* @__PURE__ */ jsx55("main", { "data-slot": "sidebar-content", className: "min-w-0 flex-1", children })
2465
+ ]
2466
+ }
2467
+ );
2468
+ }
2469
+ function SidebarEntry({ item, depth }) {
2470
+ const entryClass = cn(
2471
+ "flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors",
2472
+ "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
2473
+ );
2474
+ const indentStyle = depth > 0 ? { paddingLeft: 12 + depth * 16 } : void 0;
2475
+ return /* @__PURE__ */ jsxs38("div", { "data-slot": "sidebar-entry", children: [
2476
+ item.href ? /* @__PURE__ */ jsxs38(
2477
+ "a",
2478
+ {
2479
+ "data-slot": "sidebar-item",
2480
+ href: item.href,
2481
+ className: entryClass,
2482
+ style: indentStyle,
2483
+ children: [
2484
+ item.icon ? /* @__PURE__ */ jsx55(Icon, { name: item.icon, size: "sm" }) : null,
2485
+ item.label
2486
+ ]
2487
+ }
2488
+ ) : /* @__PURE__ */ jsxs38("span", { "data-slot": "sidebar-item", className: entryClass, style: indentStyle, children: [
2489
+ item.icon ? /* @__PURE__ */ jsx55(Icon, { name: item.icon, size: "sm" }) : null,
2490
+ item.label
2491
+ ] }),
2492
+ item.children?.map((child, index) => /* @__PURE__ */ jsx55(
2493
+ SidebarEntry,
2494
+ {
2495
+ item: child,
2496
+ depth: depth + 1
2497
+ },
2498
+ child.href ?? child.label ?? index
2499
+ ))
2500
+ ] });
2501
+ }
2502
+
2503
+ // src/components/components/Sider/index.tsx
2504
+ import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2 } from "lucide-react";
2505
+ import { jsx as jsx56, jsxs as jsxs39 } from "react/jsx-runtime";
2506
+ function Sider({
2507
+ width = 200,
2508
+ collapsible,
2509
+ collapsed,
2510
+ collapsedWidth = 64,
2511
+ onCollapse,
2512
+ className,
2513
+ style,
2514
+ children
2515
+ }) {
2516
+ const current = collapsed ? collapsedWidth : width;
2517
+ return /* @__PURE__ */ jsxs39(
2518
+ "aside",
2519
+ {
2520
+ "data-slot": "layout-sider",
2521
+ "data-collapsed": collapsed || void 0,
2522
+ className: cn(
2523
+ "flex min-h-0 shrink-0 flex-col border-r bg-background transition-[width]",
2524
+ className
2525
+ ),
2526
+ style: { width: current, ...style },
2527
+ children: [
2528
+ /* @__PURE__ */ jsx56("div", { className: "min-h-0 flex-1 overflow-auto", children }),
2529
+ collapsible ? /* @__PURE__ */ jsx56(
2530
+ "button",
2531
+ {
2532
+ type: "button",
2533
+ "aria-label": collapsed ? "expand sider" : "collapse sider",
2534
+ className: "flex h-10 shrink-0 items-center justify-center border-t text-muted-foreground hover:text-foreground",
2535
+ onClick: () => onCollapse?.(!collapsed),
2536
+ children: collapsed ? /* @__PURE__ */ jsx56(ChevronRight2, { "aria-hidden": true, className: "size-4" }) : /* @__PURE__ */ jsx56(ChevronLeft2, { "aria-hidden": true, className: "size-4" })
2537
+ }
2538
+ ) : null
2539
+ ]
2540
+ }
2541
+ );
2542
+ }
2543
+
2544
+ // src/components/components/Skeleton/index.tsx
2545
+ import { jsx as jsx57 } from "react/jsx-runtime";
2546
+ var shapeDefaults = {
2547
+ line: { className: "h-4 w-full", style: {} },
2548
+ circle: { className: "rounded-full", style: { width: 40, height: 40 } },
2549
+ rect: { className: "h-24 w-full", style: {} }
2550
+ };
2551
+ function toSize(value) {
2552
+ return typeof value === "number" ? `${value}px` : value;
2553
+ }
2554
+ function Skeleton2({ shape = "line", width, height, className, style }) {
2555
+ const defaults = shapeDefaults[shape];
2556
+ return /* @__PURE__ */ jsx57(
2557
+ Skeleton,
2558
+ {
2559
+ className: cn(defaults.className, className),
2560
+ style: {
2561
+ ...defaults.style,
2562
+ width: toSize(width) ?? defaults.style.width,
2563
+ height: toSize(height) ?? defaults.style.height,
2564
+ ...style
2565
+ }
2566
+ }
2567
+ );
2568
+ }
2569
+
2570
+ // src/components/components/Slider/index.tsx
2571
+ import { useEffect as useEffect10 } from "react";
2572
+ import { jsx as jsx58, jsxs as jsxs40 } from "react/jsx-runtime";
2573
+ function Slider2({
2574
+ name,
2575
+ label,
2576
+ rules,
2577
+ value,
2578
+ min = 0,
2579
+ max = 100,
2580
+ step = 1,
2581
+ disabled,
2582
+ onChange,
2583
+ className,
2584
+ style
2585
+ }) {
2586
+ const form = useFormContext();
2587
+ const inForm = form?.inForm === true && typeof name === "string" && name !== "";
2588
+ useEffect10(() => {
2589
+ if (inForm && form && name) {
2590
+ form.registerField(name, rules, value);
2591
+ return () => form.unregisterField(name);
2592
+ }
2593
+ return void 0;
2594
+ });
2595
+ const current = inForm && form && name ? form.values[name] : value;
2596
+ const numberValue = typeof current === "number" ? current : min;
2597
+ const handleChange = (next) => {
2598
+ if (inForm && form && name) {
2599
+ form.setValue(name, next);
2600
+ }
2601
+ onChange?.(next);
2602
+ };
2603
+ const slider = /* @__PURE__ */ jsx58(
2604
+ Slider,
2605
+ {
2606
+ value: numberValue,
2607
+ min,
2608
+ max,
2609
+ step,
2610
+ disabled,
2611
+ name: inForm ? name : void 0,
2612
+ onValueChange: handleChange,
2613
+ className: inForm ? void 0 : className,
2614
+ style: inForm ? void 0 : style,
2615
+ children: /* @__PURE__ */ jsx58(SliderControl, { children: /* @__PURE__ */ jsxs40(SliderTrack, { children: [
2616
+ /* @__PURE__ */ jsx58(SliderIndicator, {}),
2617
+ /* @__PURE__ */ jsx58(SliderThumb, {})
2618
+ ] }) })
2619
+ }
2620
+ );
2621
+ if (inForm && form && name) {
2622
+ return /* @__PURE__ */ jsx58(
2623
+ FieldShell,
2624
+ {
2625
+ layout: form.layout,
2626
+ label,
2627
+ error: form.errors[name],
2628
+ className,
2629
+ style,
2630
+ children: slider
2631
+ }
2632
+ );
2633
+ }
2634
+ return slider;
2635
+ }
2636
+
2637
+ // src/components/components/Sonner/index.tsx
2638
+ import { useRenderer as useRenderer12 } from "@pactor-app/runtime";
2639
+ import { useEffect as useEffect11 } from "react";
2640
+ import { jsx as jsx59 } from "react/jsx-runtime";
2641
+ function Sonner({ className, style }) {
2642
+ const { context } = useRenderer12();
2643
+ useEffect11(() => {
2644
+ const { actions } = context;
2645
+ if (actions.has("toast")) {
2646
+ return;
2647
+ }
2648
+ actions.register("toast", (action) => {
2649
+ const params = action.params ?? {};
2650
+ toast(params["message"], {
2651
+ description: params["description"],
2652
+ variant: params["variant"]
2653
+ });
2654
+ return { ok: true };
2655
+ });
2656
+ }, [context]);
2657
+ return /* @__PURE__ */ jsx59("div", { "data-slot": "sonner", className, style, children: /* @__PURE__ */ jsx59(Toaster, {}) });
2658
+ }
2659
+
2660
+ // src/components/components/Spinner/index.tsx
2661
+ import { jsx as jsx60 } from "react/jsx-runtime";
2662
+ var sizeClass = {
2663
+ sm: "size-3",
2664
+ default: "size-4",
2665
+ lg: "size-6"
2666
+ };
2667
+ function Spinner2({ size = "default", className, style }) {
2668
+ return /* @__PURE__ */ jsx60(Spinner, { className: cn(sizeClass[size], className), style });
2669
+ }
2670
+
2671
+ // src/components/components/Statistic/index.tsx
2672
+ import { jsx as jsx61, jsxs as jsxs41 } from "react/jsx-runtime";
2673
+ function Statistic({ title, value, precision, suffix, className, style }) {
2674
+ const display = typeof value === "number" && precision !== void 0 ? value.toFixed(precision) : value;
2675
+ return /* @__PURE__ */ jsxs41("div", { "data-slot": "statistic", className: cn(className), style, children: [
2676
+ title ? /* @__PURE__ */ jsx61("div", { "data-slot": "statistic-title", className: "text-sm text-muted-foreground", children: title }) : null,
2677
+ /* @__PURE__ */ jsxs41("div", { "data-slot": "statistic-value", className: "text-2xl font-bold tabular-nums", children: [
2678
+ display,
2679
+ suffix ? /* @__PURE__ */ jsx61("span", { className: "ml-1 text-sm font-normal text-muted-foreground", children: suffix }) : null
2680
+ ] })
2681
+ ] });
2682
+ }
2683
+
2684
+ // src/components/components/Switch/index.tsx
2685
+ import { useEffect as useEffect12, useId as useId6 } from "react";
2686
+ import { jsx as jsx62, jsxs as jsxs42 } from "react/jsx-runtime";
2687
+ function Switch2({
2688
+ name,
2689
+ label,
2690
+ rules,
2691
+ value,
2692
+ disabled,
2693
+ onChange,
2694
+ className,
2695
+ style
2696
+ }) {
2697
+ const form = useFormContext();
2698
+ const controlId = useId6();
2699
+ const inForm = form?.inForm === true && typeof name === "string" && name !== "";
2700
+ useEffect12(() => {
2701
+ if (inForm && form && name) {
2702
+ form.registerField(name, rules, value);
2703
+ return () => form.unregisterField(name);
2704
+ }
2705
+ return void 0;
2706
+ });
2707
+ const current = inForm && form && name ? form.values[name] : value;
2708
+ const checked = current === true;
2709
+ const handleChange = (next) => {
2710
+ if (inForm && form && name) {
2711
+ form.setValue(name, next);
2712
+ }
2713
+ onChange?.(next);
2714
+ };
2715
+ const control = /* @__PURE__ */ jsxs42(
2716
+ "span",
2717
+ {
2718
+ className: cn("inline-flex items-center gap-2", !inForm && className),
2719
+ style: inForm ? void 0 : style,
2720
+ children: [
2721
+ /* @__PURE__ */ jsx62(
2722
+ Switch,
2723
+ {
2724
+ id: controlId,
2725
+ checked,
2726
+ disabled,
2727
+ name: inForm ? name : void 0,
2728
+ onCheckedChange: handleChange
2729
+ }
2730
+ ),
2731
+ label ? /* @__PURE__ */ jsx62("label", { htmlFor: controlId, className: "text-sm leading-none font-medium", children: label }) : null
2732
+ ]
2733
+ }
2734
+ );
2735
+ if (inForm && form && name) {
2736
+ return /* @__PURE__ */ jsxs42(
2737
+ "div",
2738
+ {
2739
+ "data-slot": "form-item",
2740
+ className: cn("mb-4", className),
2741
+ style,
2742
+ children: [
2743
+ control,
2744
+ form.errors[name] ? /* @__PURE__ */ jsx62("div", { "data-slot": "form-error", className: "mt-1.5 text-sm text-destructive", children: form.errors[name] }) : null
2745
+ ]
2746
+ }
2747
+ );
2748
+ }
2749
+ return control;
2750
+ }
2751
+
2752
+ // src/components/components/Table/index.tsx
2753
+ import { useI18n as useI18n7, useRenderer as useRenderer13 } from "@pactor-app/runtime";
2754
+ import { useState as useState11 } from "react";
2755
+ import { jsx as jsx63, jsxs as jsxs43 } from "react/jsx-runtime";
2756
+ function renderCellValue2(value) {
2757
+ if (value === void 0 || value === null) {
2758
+ return "";
2759
+ }
2760
+ if (typeof value === "object") {
2761
+ return JSON.stringify(value);
2762
+ }
2763
+ return String(value);
2764
+ }
2765
+ function Table2({
2766
+ columns = [],
2767
+ dataSource = [],
2768
+ rowKey = "id",
2769
+ loading,
2770
+ pagination,
2771
+ onChange,
2772
+ className,
2773
+ style
2774
+ }) {
2775
+ const { renderChildren } = useRenderer13();
2776
+ const { t } = useI18n7();
2777
+ const [current, setCurrent] = useState11(1);
2778
+ const pageSize = pagination === false ? void 0 : pagination?.pageSize;
2779
+ const total = dataSource.length;
2780
+ const pageCount = pageSize !== void 0 && pageSize > 0 ? Math.max(1, Math.ceil(total / pageSize)) : 1;
2781
+ const pageRows = pageSize !== void 0 && pageSize > 0 ? dataSource.slice((current - 1) * pageSize, current * pageSize) : dataSource;
2782
+ const goToPage = (page) => {
2783
+ setCurrent(page);
2784
+ onChange?.({ current: page, pageSize, total });
2785
+ };
2786
+ return /* @__PURE__ */ jsxs43("div", { "data-slot": "dsl-table", className: cn("relative", className), style, children: [
2787
+ loading ? /* @__PURE__ */ jsx63(
2788
+ "div",
2789
+ {
2790
+ "data-slot": "table-loading",
2791
+ className: "absolute inset-0 z-10 flex items-center justify-center bg-background/60 text-sm text-muted-foreground",
2792
+ children: t("pactor.table.loading")
2793
+ }
2794
+ ) : null,
2795
+ /* @__PURE__ */ jsxs43(Table, { children: [
2796
+ /* @__PURE__ */ jsx63(TableHeader, { children: /* @__PURE__ */ jsx63(TableRow, { className: "hover:bg-transparent", children: columns.map((column, index) => /* @__PURE__ */ jsx63(
2797
+ TableHead,
2798
+ {
2799
+ style: column.width !== void 0 ? { width: column.width } : void 0,
2800
+ children: column.title
2801
+ },
2802
+ column.dataIndex ?? String(index)
2803
+ )) }) }),
2804
+ /* @__PURE__ */ jsx63(TableBody, { children: pageRows.length === 0 ? /* @__PURE__ */ jsx63(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx63(TableCell, { colSpan: Math.max(1, columns.length), children: /* @__PURE__ */ jsx63(
2805
+ "div",
2806
+ {
2807
+ "data-slot": "table-empty",
2808
+ className: "py-8 text-center text-muted-foreground",
2809
+ children: t("pactor.table.empty")
2810
+ }
2811
+ ) }) }) : pageRows.map((row, rowIndex) => {
2812
+ const key = row[rowKey];
2813
+ return /* @__PURE__ */ jsx63(
2814
+ TableRow,
2815
+ {
2816
+ children: columns.map((column, columnIndex) => /* @__PURE__ */ jsx63(TableCell, { children: column.cell ? renderChildren([column.cell], { row, rowIndex }) : renderCellValue2(
2817
+ column.dataIndex === void 0 ? void 0 : row[column.dataIndex]
2818
+ ) }, column.dataIndex ?? String(columnIndex)))
2819
+ },
2820
+ key === void 0 || key === null ? rowIndex : String(key)
2821
+ );
2822
+ }) })
2823
+ ] }),
2824
+ pageSize !== void 0 && pageSize > 0 ? /* @__PURE__ */ jsx63("div", { "data-slot": "table-pagination", className: "mt-3 flex justify-end gap-1", children: Array.from({ length: pageCount }, (_, index) => index + 1).map(
2825
+ (page) => /* @__PURE__ */ jsx63(
2826
+ Button,
2827
+ {
2828
+ type: "button",
2829
+ size: "sm",
2830
+ variant: page === current ? "default" : "outline",
2831
+ "aria-current": page === current ? "page" : void 0,
2832
+ onClick: () => goToPage(page),
2833
+ children: page
2834
+ },
2835
+ page
2836
+ )
2837
+ ) }) : null
2838
+ ] });
2839
+ }
2840
+
2841
+ // src/components/components/Tabs/index.tsx
2842
+ import { useRenderer as useRenderer14 } from "@pactor-app/runtime";
2843
+ import { jsx as jsx64, jsxs as jsxs44 } from "react/jsx-runtime";
2844
+ function Tabs2({ items = [], activeKey, onChange, className, style }) {
2845
+ const { renderChildren } = useRenderer14();
2846
+ return /* @__PURE__ */ jsxs44(
2847
+ Tabs,
2848
+ {
2849
+ value: activeKey,
2850
+ defaultValue: activeKey === void 0 ? items[0]?.key : void 0,
2851
+ onValueChange: (key) => onChange?.(key),
2852
+ className,
2853
+ style,
2854
+ children: [
2855
+ /* @__PURE__ */ jsx64(TabsList, { children: items.map((item) => /* @__PURE__ */ jsx64(TabsTrigger, { value: item.key, children: item.label }, item.key)) }),
2856
+ items.map((item) => /* @__PURE__ */ jsx64(TabsContent, { value: item.key, children: renderChildren(item.children) }, item.key))
2857
+ ]
2858
+ }
2859
+ );
2860
+ }
2861
+
2862
+ // src/components/components/Text/index.tsx
2863
+ import { jsx as jsx65 } from "react/jsx-runtime";
2864
+ var typeClassMap = {
2865
+ default: "",
2866
+ secondary: "text-muted-foreground",
2867
+ success: "text-green-600 dark:text-green-400",
2868
+ warning: "text-amber-600 dark:text-amber-400",
2869
+ danger: "text-destructive"
2870
+ };
2871
+ function Text({
2872
+ text,
2873
+ type = "default",
2874
+ strong,
2875
+ delete: del,
2876
+ underline,
2877
+ italic,
2878
+ className,
2879
+ style,
2880
+ children
2881
+ }) {
2882
+ return /* @__PURE__ */ jsx65(
2883
+ "span",
2884
+ {
2885
+ "data-slot": "text",
2886
+ "data-type": type,
2887
+ className: cn(
2888
+ typeClassMap[type],
2889
+ strong && "font-semibold",
2890
+ del && "line-through",
2891
+ underline && "underline",
2892
+ italic && "italic",
2893
+ className
2894
+ ),
2895
+ style,
2896
+ children: text ?? children
2897
+ }
2898
+ );
2899
+ }
2900
+
2901
+ // src/components/components/Textarea/index.tsx
2902
+ import { useEffect as useEffect13, useId as useId7 } from "react";
2903
+ import { jsx as jsx66 } from "react/jsx-runtime";
2904
+ function Textarea2({
2905
+ name,
2906
+ label,
2907
+ rules,
2908
+ value,
2909
+ placeholder,
2910
+ rows,
2911
+ disabled,
2912
+ onChange,
2913
+ className,
2914
+ style
2915
+ }) {
2916
+ const form = useFormContext();
2917
+ const controlId = useId7();
2918
+ const inForm = form?.inForm === true && typeof name === "string" && name !== "";
2919
+ useEffect13(() => {
2920
+ if (inForm && form && name) {
2921
+ form.registerField(name, rules, value);
2922
+ return () => form.unregisterField(name);
2923
+ }
2924
+ return void 0;
2925
+ });
2926
+ if (inForm && form && name) {
2927
+ const fieldValue = form.values[name];
2928
+ return /* @__PURE__ */ jsx66(
2929
+ FieldShell,
2930
+ {
2931
+ layout: form.layout,
2932
+ label,
2933
+ htmlFor: controlId,
2934
+ error: form.errors[name],
2935
+ className,
2936
+ style,
2937
+ children: /* @__PURE__ */ jsx66(
2938
+ Textarea,
2939
+ {
2940
+ id: controlId,
2941
+ value: typeof fieldValue === "string" ? fieldValue : "",
2942
+ placeholder,
2943
+ rows,
2944
+ disabled,
2945
+ onChange: (event) => {
2946
+ form.setValue(name, event.target.value);
2947
+ onChange?.(event.target.value);
2948
+ }
2949
+ }
2950
+ )
2951
+ }
2952
+ );
2953
+ }
2954
+ return /* @__PURE__ */ jsx66(
2955
+ Textarea,
2956
+ {
2957
+ value: value ?? "",
2958
+ placeholder,
2959
+ rows,
2960
+ disabled,
2961
+ className,
2962
+ style,
2963
+ onChange: (event) => onChange?.(event.target.value)
2964
+ }
2965
+ );
2966
+ }
2967
+
2968
+ // src/components/components/Toggle/index.tsx
2969
+ import { jsx as jsx67 } from "react/jsx-runtime";
2970
+ function Toggle2({
2971
+ text,
2972
+ pressed,
2973
+ variant,
2974
+ size,
2975
+ disabled,
2976
+ onChange,
2977
+ className,
2978
+ style
2979
+ }) {
2980
+ return /* @__PURE__ */ jsx67(
2981
+ Toggle,
2982
+ {
2983
+ pressed,
2984
+ variant,
2985
+ size,
2986
+ disabled,
2987
+ onPressedChange: (next) => onChange?.(next),
2988
+ className,
2989
+ style,
2990
+ children: text
2991
+ }
2992
+ );
2993
+ }
2994
+
2995
+ // src/components/components/ToggleGroup/index.tsx
2996
+ import { jsx as jsx68 } from "react/jsx-runtime";
2997
+ function ToggleGroup2({
2998
+ options = [],
2999
+ value,
3000
+ multiple,
3001
+ disabled,
3002
+ onChange,
3003
+ className,
3004
+ style
3005
+ }) {
3006
+ const groupValue = value === void 0 ? void 0 : Array.isArray(value) ? value : [value];
3007
+ const handleChange = (next) => {
3008
+ if (multiple) {
3009
+ onChange?.(next);
3010
+ } else {
3011
+ const previous = groupValue ?? [];
3012
+ const added = next.find((item) => !previous.includes(item));
3013
+ onChange?.(added ?? void 0);
3014
+ }
3015
+ };
3016
+ return /* @__PURE__ */ jsx68(
3017
+ ToggleGroup,
3018
+ {
3019
+ value: groupValue,
3020
+ multiple,
3021
+ disabled,
3022
+ onValueChange: (next) => handleChange(next),
3023
+ className,
3024
+ style,
3025
+ children: options.map((option) => /* @__PURE__ */ jsx68(
3026
+ ToggleGroupItem,
3027
+ {
3028
+ value: option.value,
3029
+ disabled: option.disabled,
3030
+ children: option.label
3031
+ },
3032
+ option.value
3033
+ ))
3034
+ }
3035
+ );
3036
+ }
3037
+
3038
+ // src/components/components/Tooltip/index.tsx
3039
+ import { jsx as jsx69, jsxs as jsxs45 } from "react/jsx-runtime";
3040
+ function Tooltip3({ content, children, className, style }) {
3041
+ return /* @__PURE__ */ jsxs45(Tooltip, { children: [
3042
+ /* @__PURE__ */ jsx69(TooltipTrigger, { render: triggerWrapper("tooltip-trigger-wrap"), children }),
3043
+ /* @__PURE__ */ jsx69(TooltipContent, { className, style, children: content })
3044
+ ] });
3045
+ }
3046
+
3047
+ // src/components/components/Typography/index.tsx
3048
+ import { jsx as jsx70 } from "react/jsx-runtime";
3049
+ function Typography2({
3050
+ variant = "p",
3051
+ text,
3052
+ className,
3053
+ style
3054
+ }) {
3055
+ return /* @__PURE__ */ jsx70(Typography, { variant, className, style, children: text });
3056
+ }
3057
+
3058
+ // src/components/register.ts
3059
+ var shadcnComponents = {
3060
+ Page,
3061
+ Grid,
3062
+ Flex,
3063
+ Card: Card2,
3064
+ Button: Button2,
3065
+ Alert: Alert2,
3066
+ Statistic,
3067
+ Tabs: Tabs2,
3068
+ Table: Table2,
3069
+ Form,
3070
+ Input: Input2,
3071
+ Select: Select2,
3072
+ // Layout 需要原始 DSL 子树做方向推导(含 Sider 判定),以 withScope 注册
3073
+ Layout: { component: Layout, withScope: true },
3074
+ Header,
3075
+ Sider,
3076
+ Content,
3077
+ Footer,
3078
+ Menu,
3079
+ Link,
3080
+ Text,
3081
+ // 展示类扩展组件
3082
+ Badge: Badge2,
3083
+ Avatar: Avatar2,
3084
+ Skeleton: Skeleton2,
3085
+ Separator: Separator2,
3086
+ Kbd: Kbd2,
3087
+ Spinner: Spinner2,
3088
+ Empty: Empty2,
3089
+ AspectRatio: AspectRatio2,
3090
+ Progress: Progress2,
3091
+ // 表单类扩展组件
3092
+ Textarea: Textarea2,
3093
+ Checkbox: Checkbox2,
3094
+ RadioGroup: RadioGroup2,
3095
+ Switch: Switch2,
3096
+ Slider: Slider2,
3097
+ Label: Label2,
3098
+ Field: Field2,
3099
+ // 导航类扩展组件
3100
+ Breadcrumb: Breadcrumb2,
3101
+ Pagination: Pagination2,
3102
+ Menubar: Menubar2,
3103
+ NavigationMenu: NavigationMenu2,
3104
+ DropdownMenu: DropdownMenu2,
3105
+ ContextMenu: ContextMenu2,
3106
+ // 反馈与弹层类扩展组件
3107
+ Dialog: Dialog2,
3108
+ AlertDialog: AlertDialog2,
3109
+ Drawer: Drawer2,
3110
+ Sheet: Sheet2,
3111
+ Popover: Popover2,
3112
+ Sonner,
3113
+ Accordion: Accordion2,
3114
+ Collapsible: Collapsible2,
3115
+ Tooltip: Tooltip3,
3116
+ HoverCard: HoverCard2,
3117
+ // 复合类扩展组件(第三批)
3118
+ Calendar: Calendar2,
3119
+ InputOTP: InputOTP2,
3120
+ Combobox: Combobox2,
3121
+ Carousel: Carousel2,
3122
+ Command: Command2,
3123
+ Resizable,
3124
+ ScrollArea: ScrollArea2,
3125
+ Toggle: Toggle2,
3126
+ ToggleGroup: ToggleGroup2,
3127
+ ButtonGroup: ButtonGroup2,
3128
+ InputGroup: InputGroup2,
3129
+ Item: Item2,
3130
+ Typography: Typography2,
3131
+ // 页面级组合类扩展组件(第四批)
3132
+ Sidebar,
3133
+ DataTable,
3134
+ Chart,
3135
+ // 图标(lucide 白名单)
3136
+ Icon
3137
+ };
3138
+ function registerShadcnComponents(registry) {
3139
+ for (const [type, component] of Object.entries(shadcnComponents)) {
3140
+ registry.register(type, component);
3141
+ }
3142
+ }
3143
+ function createShadcnComponentRegistry() {
3144
+ const registry = new Registry("ComponentRegistry");
3145
+ registerShadcnComponents(registry);
3146
+ return registry;
3147
+ }
3148
+
3149
+ export {
3150
+ Accordion2 as Accordion,
3151
+ Alert2 as Alert,
3152
+ AlertDialog2 as AlertDialog,
3153
+ AspectRatio2 as AspectRatio,
3154
+ Avatar2 as Avatar,
3155
+ Badge2 as Badge,
3156
+ Breadcrumb2 as Breadcrumb,
3157
+ Button2 as Button,
3158
+ ButtonGroup2 as ButtonGroup,
3159
+ useFormContext,
3160
+ Calendar2 as Calendar,
3161
+ Card2 as Card,
3162
+ Carousel2 as Carousel,
3163
+ Checkbox2 as Checkbox,
3164
+ Collapsible2 as Collapsible,
3165
+ Combobox2 as Combobox,
3166
+ Command2 as Command,
3167
+ Chart,
3168
+ Content,
3169
+ ContextMenu2 as ContextMenu,
3170
+ DataTable,
3171
+ Dialog2 as Dialog,
3172
+ Drawer2 as Drawer,
3173
+ DropdownMenu2 as DropdownMenu,
3174
+ Empty2 as Empty,
3175
+ Field2 as Field,
3176
+ Flex,
3177
+ Footer,
3178
+ Form,
3179
+ Grid,
3180
+ Header,
3181
+ HoverCard2 as HoverCard,
3182
+ Input2 as Input,
3183
+ InputGroup2 as InputGroup,
3184
+ InputOTP2 as InputOTP,
3185
+ Item2 as Item,
3186
+ Kbd2 as Kbd,
3187
+ Label2 as Label,
3188
+ Layout,
3189
+ Link,
3190
+ Menu,
3191
+ Menubar2 as Menubar,
3192
+ NavigationMenu2 as NavigationMenu,
3193
+ Page,
3194
+ Pagination2 as Pagination,
3195
+ Popover2 as Popover,
3196
+ Progress2 as Progress,
3197
+ RadioGroup2 as RadioGroup,
3198
+ Resizable,
3199
+ ScrollArea2 as ScrollArea,
3200
+ Select2 as Select,
3201
+ Separator2 as Separator,
3202
+ Sheet2 as Sheet,
3203
+ Sidebar,
3204
+ Sider,
3205
+ Skeleton2 as Skeleton,
3206
+ Slider2 as Slider,
3207
+ Sonner,
3208
+ Spinner2 as Spinner,
3209
+ Statistic,
3210
+ Switch2 as Switch,
3211
+ Table2 as Table,
3212
+ Tabs2 as Tabs,
3213
+ Text,
3214
+ Textarea2 as Textarea,
3215
+ Toggle2 as Toggle,
3216
+ ToggleGroup2 as ToggleGroup,
3217
+ Tooltip3 as Tooltip,
3218
+ Typography2 as Typography,
3219
+ shadcnComponents,
3220
+ registerShadcnComponents,
3221
+ createShadcnComponentRegistry
3222
+ };