laif-ds 0.2.39 → 0.2.40
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/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +5 -5
- package/dist/components/ui/button.js +7 -7
- package/dist/components/ui/date-picker.js +66 -62
- package/dist/components/ui/dialog.js +36 -35
- package/dist/components/ui/form-composer.js +246 -0
- package/dist/components/ui/input.js +76 -75
- package/dist/components/ui/textarea.js +9 -9
- package/dist/index.d.ts +29 -1
- package/dist/index.js +250 -248
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
package/dist/_virtual/index4.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getDefaultExportFromCjs as
|
|
3
|
-
import { __require as
|
|
4
|
-
var t =
|
|
5
|
-
const
|
|
2
|
+
import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
|
|
3
|
+
import { __require as r } from "../node_modules/extend/index.js";
|
|
4
|
+
var t = r();
|
|
5
|
+
const x = /* @__PURE__ */ e(t);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
x as default
|
|
8
8
|
};
|
package/dist/_virtual/index5.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getDefaultExportFromCjs as
|
|
3
|
-
import { __require as
|
|
4
|
-
var t =
|
|
5
|
-
const
|
|
2
|
+
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
3
|
+
import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
|
|
4
|
+
var t = e();
|
|
5
|
+
const a = /* @__PURE__ */ r(t);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
a as default
|
|
8
8
|
};
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { jsx as r, jsxs as u } from "react/jsx-runtime";
|
|
3
3
|
import { Root as f } from "../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
4
4
|
import { cva as m } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Icon as
|
|
5
|
+
import { cn as l } from "../../lib/utils.js";
|
|
6
|
+
import { Icon as c } from "./icon.js";
|
|
7
7
|
const v = m(
|
|
8
|
-
"cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all focus-visible:ring-d-ring/50 focus-visible:ring-[3px] aria-invalid:ring-d-destructive/20 aria-invalid:border-d-destructive transition-all duration-200 ease-out transform-gpu active:scale-[0.98] active:shadow-sm overflow-
|
|
8
|
+
"cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all focus-visible:ring-d-ring/50 focus-visible:ring-[3px] aria-invalid:ring-d-destructive/20 aria-invalid:border-d-destructive transition-all duration-200 ease-out transform-gpu active:scale-[0.98] active:shadow-sm overflow-x-clip overflow-y-visible relative group disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-d-ring",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
@@ -48,14 +48,14 @@ function w({
|
|
|
48
48
|
i,
|
|
49
49
|
{
|
|
50
50
|
"data-slot": "button",
|
|
51
|
-
className:
|
|
51
|
+
className: l(v({ variant: a, size: e, className: o })),
|
|
52
52
|
...t
|
|
53
53
|
}
|
|
54
54
|
) : /* @__PURE__ */ u(
|
|
55
55
|
i,
|
|
56
56
|
{
|
|
57
57
|
"data-slot": "button",
|
|
58
|
-
className:
|
|
58
|
+
className: l(v({ variant: a, size: e, className: o }), "relative"),
|
|
59
59
|
...t,
|
|
60
60
|
children: [
|
|
61
61
|
b ? /* @__PURE__ */ u(
|
|
@@ -90,7 +90,7 @@ function w({
|
|
|
90
90
|
]
|
|
91
91
|
}
|
|
92
92
|
) : s && /* @__PURE__ */ r(
|
|
93
|
-
|
|
93
|
+
c,
|
|
94
94
|
{
|
|
95
95
|
name: s,
|
|
96
96
|
size: e === "default" ? "md" : e === "sm" ? "xs" : "sm"
|
|
@@ -98,7 +98,7 @@ function w({
|
|
|
98
98
|
),
|
|
99
99
|
t.children,
|
|
100
100
|
n && /* @__PURE__ */ r(
|
|
101
|
-
|
|
101
|
+
c,
|
|
102
102
|
{
|
|
103
103
|
name: n,
|
|
104
104
|
size: e === "default" ? "md" : e === "sm" ? "xs" : "sm"
|
|
@@ -1,88 +1,92 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { buttonVariants as
|
|
4
|
-
import { Calendar as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Popover as
|
|
7
|
-
import { cn as
|
|
8
|
-
import * as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
import { jsxs as d, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { buttonVariants as N } from "./button.js";
|
|
4
|
+
import { Calendar as k } from "./calendar.js";
|
|
5
|
+
import { Icon as v } from "./icon.js";
|
|
6
|
+
import { Popover as I, PopoverTrigger as E, PopoverContent as R } from "./popover.js";
|
|
7
|
+
import { cn as T } from "../../lib/utils.js";
|
|
8
|
+
import * as x from "react";
|
|
9
|
+
import { useEffect as V } from "react";
|
|
10
|
+
import { formatDate as m } from "../../node_modules/date-fns/format.js";
|
|
11
|
+
import { isSameDay as q } from "../../node_modules/date-fns/isSameDay.js";
|
|
12
|
+
function U({
|
|
13
|
+
value: e,
|
|
14
|
+
onChange: c,
|
|
15
|
+
placeholder: b = "Seleziona data",
|
|
16
|
+
dateFormat: f = "dd/MM/yyyy",
|
|
16
17
|
className: y,
|
|
17
|
-
buttonVariant:
|
|
18
|
-
disabled:
|
|
19
|
-
size:
|
|
20
|
-
firstDate:
|
|
21
|
-
lastDate:
|
|
22
|
-
availableDates:
|
|
23
|
-
locale:
|
|
24
|
-
initialCalendarMonth:
|
|
25
|
-
customCalendarProps:
|
|
18
|
+
buttonVariant: j = "default",
|
|
19
|
+
disabled: t = !1,
|
|
20
|
+
size: i = "default",
|
|
21
|
+
firstDate: a,
|
|
22
|
+
lastDate: p,
|
|
23
|
+
availableDates: l,
|
|
24
|
+
locale: C,
|
|
25
|
+
initialCalendarMonth: u,
|
|
26
|
+
customCalendarProps: P
|
|
26
27
|
}) {
|
|
27
|
-
const [
|
|
28
|
-
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
c(e), l(e || m);
|
|
32
|
-
}, [e]);
|
|
33
|
-
const P = (r) => {
|
|
34
|
-
c(r), r && l(r), d && d(r);
|
|
28
|
+
const [r, h] = x.useState(e), [S, g] = x.useState(
|
|
29
|
+
u
|
|
30
|
+
), w = (n) => {
|
|
31
|
+
h(n), n && g(n), c && c(n);
|
|
35
32
|
};
|
|
36
|
-
let
|
|
37
|
-
return
|
|
38
|
-
(
|
|
39
|
-
(
|
|
33
|
+
let s = [];
|
|
34
|
+
return a && s.push({ before: a }), p && s.push({ after: p }), l?.length && s.push(
|
|
35
|
+
(n) => !l.some(
|
|
36
|
+
(M) => q(M, n)
|
|
40
37
|
)
|
|
41
|
-
),
|
|
42
|
-
|
|
38
|
+
), t && (s = [!0]), V(() => {
|
|
39
|
+
h(r), g(r || u);
|
|
40
|
+
}, [r]), /* @__PURE__ */ d(I, { open: t ? !1 : void 0, children: [
|
|
41
|
+
/* @__PURE__ */ o(E, { asChild: !0, children: /* @__PURE__ */ o(
|
|
43
42
|
"div",
|
|
44
43
|
{
|
|
45
|
-
className:
|
|
46
|
-
|
|
47
|
-
"border-d-
|
|
48
|
-
!
|
|
49
|
-
|
|
44
|
+
className: T(
|
|
45
|
+
N({ variant: j, size: i }),
|
|
46
|
+
"border-d-border/50 text-d-foreground hover:border-d-ring focus-visible:border-d-ring focus-visible:ring-d-ring/50 ring-offset-background data-[placeholder]:text-d-muted-foreground flex items-center justify-between border !bg-transparent px-3 py-2 font-normal whitespace-nowrap focus-visible:outline-none [&>span]:line-clamp-1",
|
|
47
|
+
!r && "text-d-muted-foreground",
|
|
48
|
+
t && "cursor-not-allowed opacity-50",
|
|
50
49
|
y,
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
i === "sm" && "text-xs",
|
|
51
|
+
i === "lg" && "text-lg"
|
|
53
52
|
),
|
|
54
|
-
"aria-disabled":
|
|
53
|
+
"aria-disabled": t,
|
|
55
54
|
role: "button",
|
|
56
|
-
tabIndex:
|
|
57
|
-
onClick:
|
|
55
|
+
tabIndex: t ? -1 : 0,
|
|
56
|
+
onClick: t ? void 0 : () => {
|
|
58
57
|
},
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
58
|
+
children: /* @__PURE__ */ d("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
59
|
+
/* @__PURE__ */ o(
|
|
60
|
+
v,
|
|
62
61
|
{
|
|
63
62
|
name: "Calendar",
|
|
64
|
-
size:
|
|
63
|
+
size: i === "default" ? "md" : i === "sm" ? "xs" : "sm"
|
|
65
64
|
}
|
|
66
65
|
),
|
|
67
|
-
e
|
|
66
|
+
e && typeof e == "object" && "from" in e ? /* @__PURE__ */ d("span", { children: [
|
|
67
|
+
e.from && m(e.from, f),
|
|
68
|
+
e.from && e.to && " - ",
|
|
69
|
+
e.to && m(e.to, f)
|
|
70
|
+
] }) : r ? /* @__PURE__ */ o("span", { children: m(r, f) }) : /* @__PURE__ */ o("span", { className: "text-d-muted-foreground", children: b })
|
|
68
71
|
] })
|
|
69
72
|
}
|
|
70
73
|
) }),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
|
|
74
|
+
/* @__PURE__ */ o(R, { className: "w-auto p-0", children: /* @__PURE__ */ o(
|
|
75
|
+
k,
|
|
73
76
|
{
|
|
74
|
-
...
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
...P || {
|
|
78
|
+
mode: "single",
|
|
79
|
+
selected: r,
|
|
80
|
+
onSelect: w
|
|
81
|
+
},
|
|
78
82
|
autoFocus: !0,
|
|
79
|
-
disabled:
|
|
80
|
-
locale:
|
|
81
|
-
defaultMonth:
|
|
83
|
+
disabled: s,
|
|
84
|
+
locale: C,
|
|
85
|
+
defaultMonth: S
|
|
82
86
|
}
|
|
83
87
|
) })
|
|
84
88
|
] });
|
|
85
89
|
}
|
|
86
90
|
export {
|
|
87
|
-
|
|
91
|
+
U as DatePicker
|
|
88
92
|
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs as
|
|
3
|
-
import { Root as c, Content as
|
|
2
|
+
import { jsx as a, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
import { Root as c, Content as u, Close as l, Description as f, Title as m, Trigger as p, Portal as x, Overlay as v } from "../../node_modules/@radix-ui/react-dialog/dist/index.js";
|
|
4
4
|
import { cn as o } from "../../lib/utils.js";
|
|
5
5
|
import D from "../../node_modules/lucide-react/dist/esm/icons/x.js";
|
|
6
|
-
function
|
|
6
|
+
function k({
|
|
7
7
|
...t
|
|
8
8
|
}) {
|
|
9
9
|
return /* @__PURE__ */ a(c, { "data-slot": "dialog", ...t });
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function T({
|
|
12
12
|
...t
|
|
13
13
|
}) {
|
|
14
|
-
return /* @__PURE__ */ a(
|
|
14
|
+
return /* @__PURE__ */ a(p, { "data-slot": "dialog-trigger", ...t });
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function b({
|
|
17
17
|
...t
|
|
18
18
|
}) {
|
|
19
|
-
return /* @__PURE__ */ a(
|
|
19
|
+
return /* @__PURE__ */ a(x, { "data-slot": "dialog-portal", ...t });
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function j({
|
|
22
22
|
...t
|
|
23
23
|
}) {
|
|
24
24
|
return /* @__PURE__ */ a(l, { "data-slot": "dialog-close", ...t });
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function h({
|
|
27
27
|
className: t,
|
|
28
28
|
...e
|
|
29
29
|
}) {
|
|
30
30
|
return /* @__PURE__ */ a(
|
|
31
|
-
|
|
31
|
+
v,
|
|
32
32
|
{
|
|
33
33
|
"data-slot": "dialog-overlay",
|
|
34
34
|
className: o(
|
|
@@ -39,36 +39,37 @@ function b({
|
|
|
39
39
|
}
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function O({
|
|
43
43
|
className: t,
|
|
44
44
|
children: e,
|
|
45
45
|
size: r = "default",
|
|
46
|
+
closeOnOverlay: d = !0,
|
|
46
47
|
...i
|
|
47
48
|
}) {
|
|
48
|
-
const
|
|
49
|
+
const g = {
|
|
49
50
|
sm: "sm:max-w-sm",
|
|
50
51
|
default: "sm:max-w-lg",
|
|
51
52
|
lg: "sm:max-w-2xl",
|
|
52
53
|
xl: "sm:max-w-3xl"
|
|
53
54
|
}[r];
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */ a(
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
55
|
+
return /* @__PURE__ */ s(b, { "data-slot": "dialog-portal", children: [
|
|
56
|
+
/* @__PURE__ */ a(h, {}),
|
|
57
|
+
/* @__PURE__ */ s(
|
|
58
|
+
u,
|
|
58
59
|
{
|
|
59
60
|
"data-slot": "dialog-content",
|
|
60
|
-
onPointerDownOutside: (
|
|
61
|
-
|
|
61
|
+
onPointerDownOutside: (n) => {
|
|
62
|
+
n.target?.closest("[data-command-portal]") && n.preventDefault(), d || n.preventDefault();
|
|
62
63
|
},
|
|
63
64
|
className: o(
|
|
64
65
|
"bg-d-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-d-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200",
|
|
65
|
-
|
|
66
|
+
g,
|
|
66
67
|
t
|
|
67
68
|
),
|
|
68
69
|
...i,
|
|
69
70
|
children: [
|
|
70
71
|
e,
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ s(l, { className: "ring-offset-d-background focus:ring-d-ring data-[state=open]:bg-d-accent data-[state=open]:text-d-secondary-foreground absolute top-4 right-4 rounded-md p-1.5 bg-d-muted/30 hover:bg-d-muted/60 cursor-pointer transition-all hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [
|
|
72
73
|
/* @__PURE__ */ a(D, {}),
|
|
73
74
|
/* @__PURE__ */ a("span", { className: "sr-only", children: "Close" })
|
|
74
75
|
] })
|
|
@@ -77,7 +78,7 @@ function j({
|
|
|
77
78
|
)
|
|
78
79
|
] });
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
+
function P({ className: t, ...e }) {
|
|
81
82
|
return /* @__PURE__ */ a(
|
|
82
83
|
"div",
|
|
83
84
|
{
|
|
@@ -87,7 +88,7 @@ function O({ className: t, ...e }) {
|
|
|
87
88
|
}
|
|
88
89
|
);
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function _({ className: t, ...e }) {
|
|
91
92
|
return /* @__PURE__ */ a(
|
|
92
93
|
"div",
|
|
93
94
|
{
|
|
@@ -100,12 +101,12 @@ function P({ className: t, ...e }) {
|
|
|
100
101
|
}
|
|
101
102
|
);
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function F({
|
|
104
105
|
className: t,
|
|
105
106
|
...e
|
|
106
107
|
}) {
|
|
107
108
|
return /* @__PURE__ */ a(
|
|
108
|
-
|
|
109
|
+
m,
|
|
109
110
|
{
|
|
110
111
|
"data-slot": "dialog-title",
|
|
111
112
|
className: o("text-lg leading-none font-semibold", t),
|
|
@@ -113,7 +114,7 @@ function _({
|
|
|
113
114
|
}
|
|
114
115
|
);
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
+
function H({
|
|
117
118
|
className: t,
|
|
118
119
|
...e
|
|
119
120
|
}) {
|
|
@@ -127,14 +128,14 @@ function F({
|
|
|
127
128
|
);
|
|
128
129
|
}
|
|
129
130
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
k as Dialog,
|
|
132
|
+
j as DialogClose,
|
|
133
|
+
O as DialogContent,
|
|
134
|
+
H as DialogDescription,
|
|
135
|
+
_ as DialogFooter,
|
|
136
|
+
P as DialogHeader,
|
|
137
|
+
h as DialogOverlay,
|
|
138
|
+
b as DialogPortal,
|
|
139
|
+
F as DialogTitle,
|
|
140
|
+
T as DialogTrigger
|
|
140
141
|
};
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { cn as o } from "../../lib/utils.js";
|
|
4
|
+
import { Controller as w } from "../../node_modules/react-hook-form/dist/index.esm.js";
|
|
5
|
+
import { AppSelect as m } from "./app-select.js";
|
|
6
|
+
import { Button as V } from "./button.js";
|
|
7
|
+
import { Checkbox as j } from "./checkbox.js";
|
|
8
|
+
import { DatePicker as F } from "./date-picker.js";
|
|
9
|
+
import { Input as I } from "./input.js";
|
|
10
|
+
import { Label as t } from "./label.js";
|
|
11
|
+
import { RadioGroup as R, RadioGroupItem as A } from "./radio-group.js";
|
|
12
|
+
import { Slider as B } from "./slider.js";
|
|
13
|
+
import { Switch as $ } from "./switch.js";
|
|
14
|
+
import { Textarea as D } from "./textarea.js";
|
|
15
|
+
import { Typo as i } from "./typo.js";
|
|
16
|
+
const U = ({
|
|
17
|
+
items: h,
|
|
18
|
+
cols: v = "2",
|
|
19
|
+
form: b,
|
|
20
|
+
submitText: g = "Invia",
|
|
21
|
+
onSubmit: x,
|
|
22
|
+
isSubmitting: p = !1
|
|
23
|
+
}) => {
|
|
24
|
+
const {
|
|
25
|
+
control: C,
|
|
26
|
+
handleSubmit: N,
|
|
27
|
+
formState: { errors: y, isValid: f, isDirty: S }
|
|
28
|
+
} = b, k = (e) => {
|
|
29
|
+
const c = y[e.name]?.message, d = c ? String(c) : void 0;
|
|
30
|
+
return /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
31
|
+
w,
|
|
32
|
+
{
|
|
33
|
+
name: e.name,
|
|
34
|
+
control: C,
|
|
35
|
+
render: ({ field: r }) => {
|
|
36
|
+
const s = /* @__PURE__ */ l("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
37
|
+
/* @__PURE__ */ a(t, { children: e.label }),
|
|
38
|
+
d && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: d })
|
|
39
|
+
] });
|
|
40
|
+
switch (e.component) {
|
|
41
|
+
case "input":
|
|
42
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
43
|
+
s,
|
|
44
|
+
/* @__PURE__ */ a(
|
|
45
|
+
I,
|
|
46
|
+
{
|
|
47
|
+
...r,
|
|
48
|
+
placeholder: e.placeholder,
|
|
49
|
+
className: o(d && "border-d-destructive"),
|
|
50
|
+
disabled: e.disabled
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] });
|
|
54
|
+
case "textarea":
|
|
55
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
56
|
+
s,
|
|
57
|
+
/* @__PURE__ */ a(
|
|
58
|
+
D,
|
|
59
|
+
{
|
|
60
|
+
...r,
|
|
61
|
+
placeholder: e.placeholder,
|
|
62
|
+
className: o(d && "border-d-destructive"),
|
|
63
|
+
disabled: e.disabled
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] });
|
|
67
|
+
case "radio":
|
|
68
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
69
|
+
s,
|
|
70
|
+
/* @__PURE__ */ a(
|
|
71
|
+
R,
|
|
72
|
+
{
|
|
73
|
+
value: r.value != null ? String(r.value) : "",
|
|
74
|
+
onValueChange: (n) => r.onChange(n),
|
|
75
|
+
className: "space-y-2",
|
|
76
|
+
disabled: e.disabled,
|
|
77
|
+
children: (e.options ?? []).map((n) => {
|
|
78
|
+
const u = `${e.name}-${n.value}`;
|
|
79
|
+
return /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
80
|
+
/* @__PURE__ */ a(
|
|
81
|
+
A,
|
|
82
|
+
{
|
|
83
|
+
id: u,
|
|
84
|
+
value: String(n.value),
|
|
85
|
+
disabled: e.disabled
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ a(
|
|
89
|
+
t,
|
|
90
|
+
{
|
|
91
|
+
htmlFor: u,
|
|
92
|
+
className: o("cursor-pointer", e.disabled && "cursor-not-allowed opacity-60"),
|
|
93
|
+
children: n.label
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
] }, n.value);
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] });
|
|
101
|
+
case "select":
|
|
102
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
103
|
+
s,
|
|
104
|
+
/* @__PURE__ */ a(
|
|
105
|
+
m,
|
|
106
|
+
{
|
|
107
|
+
...r,
|
|
108
|
+
onValueChange: (n) => r.onChange(n),
|
|
109
|
+
options: e.options ?? [],
|
|
110
|
+
placeholder: e.placeholder,
|
|
111
|
+
disabled: e.disabled
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] });
|
|
115
|
+
case "multiselect":
|
|
116
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
117
|
+
s,
|
|
118
|
+
/* @__PURE__ */ a(
|
|
119
|
+
m,
|
|
120
|
+
{
|
|
121
|
+
...r,
|
|
122
|
+
multiple: !0,
|
|
123
|
+
onValueChange: (n) => r.onChange(n),
|
|
124
|
+
options: e.options ?? [],
|
|
125
|
+
placeholder: e.placeholder,
|
|
126
|
+
disabled: e.disabled
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] });
|
|
130
|
+
case "datepicker":
|
|
131
|
+
return /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
132
|
+
s,
|
|
133
|
+
/* @__PURE__ */ a(
|
|
134
|
+
F,
|
|
135
|
+
{
|
|
136
|
+
value: r.value,
|
|
137
|
+
onChange: e.disabled || e.calendarRange ? void 0 : (n) => r.onChange(n),
|
|
138
|
+
placeholder: e.placeholder,
|
|
139
|
+
disabled: e.disabled,
|
|
140
|
+
customCalendarProps: e.disabled ? {
|
|
141
|
+
disabled: !0,
|
|
142
|
+
mode: "single"
|
|
143
|
+
} : e.calendarRange ? {
|
|
144
|
+
mode: "range",
|
|
145
|
+
selected: r.value,
|
|
146
|
+
onSelect: (n) => r.onChange(n)
|
|
147
|
+
} : void 0
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] });
|
|
151
|
+
case "checkbox":
|
|
152
|
+
return /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
|
|
153
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
154
|
+
/* @__PURE__ */ a(
|
|
155
|
+
j,
|
|
156
|
+
{
|
|
157
|
+
...r,
|
|
158
|
+
id: e.name,
|
|
159
|
+
onCheckedChange: (n) => r.onChange(n),
|
|
160
|
+
defaultChecked: !!e.defaultValue,
|
|
161
|
+
disabled: e.disabled
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
/* @__PURE__ */ a(
|
|
165
|
+
t,
|
|
166
|
+
{
|
|
167
|
+
htmlFor: e.name,
|
|
168
|
+
className: o("cursor-pointer", e.disabled && "cursor-not-allowed opacity-60"),
|
|
169
|
+
children: e.label
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
d && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: d })
|
|
173
|
+
] }),
|
|
174
|
+
e.caption && /* @__PURE__ */ a(
|
|
175
|
+
i,
|
|
176
|
+
{
|
|
177
|
+
variant: "caption",
|
|
178
|
+
className: "text-d-muted-foreground",
|
|
179
|
+
children: e.caption
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] });
|
|
183
|
+
case "switch":
|
|
184
|
+
return /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
|
|
185
|
+
/* @__PURE__ */ l("div", { className: "flex items-center justify-between", children: [
|
|
186
|
+
/* @__PURE__ */ l("div", { children: [
|
|
187
|
+
/* @__PURE__ */ a(t, { htmlFor: e.name, children: e.label }),
|
|
188
|
+
e.caption && /* @__PURE__ */ a(i, { variant: "caption", className: "text-d-muted-foreground mt-0.5", children: e.caption })
|
|
189
|
+
] }),
|
|
190
|
+
/* @__PURE__ */ a(
|
|
191
|
+
$,
|
|
192
|
+
{
|
|
193
|
+
id: e.name,
|
|
194
|
+
checked: !!r.value,
|
|
195
|
+
onCheckedChange: (n) => r.onChange(n),
|
|
196
|
+
disabled: e.disabled
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
] }),
|
|
200
|
+
d && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: d })
|
|
201
|
+
] });
|
|
202
|
+
case "slider":
|
|
203
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
204
|
+
s,
|
|
205
|
+
/* @__PURE__ */ a(
|
|
206
|
+
B,
|
|
207
|
+
{
|
|
208
|
+
value: Array.isArray(r.value) ? r.value : [r.value || e.min || 0],
|
|
209
|
+
onValueChange: (n) => r.onChange(n[0]),
|
|
210
|
+
min: e.min ?? 0,
|
|
211
|
+
max: e.max ?? 100,
|
|
212
|
+
step: e.step ?? 1,
|
|
213
|
+
disabled: e.disabled,
|
|
214
|
+
showValues: !0
|
|
215
|
+
}
|
|
216
|
+
),
|
|
217
|
+
e.caption && /* @__PURE__ */ a(i, { variant: "caption", className: "text-d-muted-foreground mt-1", children: e.caption })
|
|
218
|
+
] });
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
) });
|
|
223
|
+
};
|
|
224
|
+
return /* @__PURE__ */ l("form", { onSubmit: N((e) => x?.(e)), children: [
|
|
225
|
+
/* @__PURE__ */ a("div", { className: o("grid gap-4", `grid-cols-${v}`), children: h.map((e, c) => /* @__PURE__ */ a(
|
|
226
|
+
"div",
|
|
227
|
+
{
|
|
228
|
+
className: o(c === h.length - 1 && "col-span-full"),
|
|
229
|
+
children: k(e)
|
|
230
|
+
},
|
|
231
|
+
e.name
|
|
232
|
+
)) }),
|
|
233
|
+
/* @__PURE__ */ a("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ a(
|
|
234
|
+
V,
|
|
235
|
+
{
|
|
236
|
+
type: "submit",
|
|
237
|
+
disabled: !f || !S || p,
|
|
238
|
+
isLoading: p,
|
|
239
|
+
children: g
|
|
240
|
+
}
|
|
241
|
+
) })
|
|
242
|
+
] });
|
|
243
|
+
};
|
|
244
|
+
export {
|
|
245
|
+
U as FormComposer
|
|
246
|
+
};
|