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