@object-ui/plugin-detail 3.1.3 → 3.1.4
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/.turbo/turbo-build.log +53 -49
- package/CHANGELOG.md +10 -0
- package/dist/AddressField-DBkEyMcG.js +93 -0
- package/dist/AutoNumberField-Baa191z-.js +14 -0
- package/dist/AvatarField-YGj51ozd.js +80 -0
- package/dist/BooleanField-CaA898Tk.js +40 -0
- package/dist/CodeField-BU51nl1L.js +22 -0
- package/dist/ColorField-Cnf6ZM7c.js +37 -0
- package/dist/CurrencyField-Wg-XOId2.js +51 -0
- package/dist/DateField-Cth1ky_m.js +21 -0
- package/dist/DateTimeField-B0m6FhHL.js +32 -0
- package/dist/EmailField-Do7qT_L_.js +28 -0
- package/dist/FileField-aRJAdbQb.js +151 -0
- package/dist/FormulaField-DTMkagFx.js +14 -0
- package/dist/GeolocationField-RqpHWTEv.js +113 -0
- package/dist/GridField-D4IH0cpo.js +51 -0
- package/dist/ImageField-BYCFajjr.js +75 -0
- package/dist/LocationField-Bi_ew9sd.js +35 -0
- package/dist/LookupField-BjwlDPtt.js +902 -0
- package/dist/MasterDetailField-I1A9oEGC.js +94 -0
- package/dist/NumberField-D_NucQlp.js +26 -0
- package/dist/ObjectField-CG-LaM65.js +52 -0
- package/dist/PasswordField-DBtluGJ1.js +35 -0
- package/dist/PercentField-B6sO_J3i.js +63 -0
- package/dist/PhoneField-CcQAWwR6.js +28 -0
- package/dist/QRCodeField-CEjWs-J5.js +72 -0
- package/dist/RatingField-B_Mnr63i.js +39 -0
- package/dist/RichTextField-qOEJl5Ai.js +32 -0
- package/dist/SelectField-C8hWu3gm.js +30 -0
- package/dist/SignatureField-CddhEK9u.js +92 -0
- package/dist/SliderField-Df5hMzNc.js +34 -0
- package/dist/SummaryField-DgiFm-Cr.js +19 -0
- package/dist/TextAreaField-DuriTqsD.js +36 -0
- package/dist/TextField-CGNSl7RU.js +29 -0
- package/dist/TimeField-YO58ctFg.js +21 -0
- package/dist/UrlField-1-BMM1jn.js +33 -0
- package/dist/UserField-B6GqxP_S.js +78 -0
- package/dist/VectorField-BkEjbSt0.js +36 -0
- package/dist/index.js +4092 -33
- package/dist/index.umd.cjs +85 -76
- package/dist/plugin-detail.css +3 -1
- package/dist/src-CXr1-vVl.js +77662 -0
- package/package.json +9 -9
- package/dist/AddressField-BtiTrEpf.js +0 -96
- package/dist/AutoNumberField-BxnFqllo.js +0 -8
- package/dist/AvatarField-CwlnWNSf.js +0 -82
- package/dist/BooleanField-DpMXU2ya.js +0 -37
- package/dist/CodeField-gwmcFihg.js +0 -21
- package/dist/ColorField-CWmF_zoW.js +0 -42
- package/dist/CurrencyField-BF3tYAgm.js +0 -43
- package/dist/DateField-a6Ka9ph2.js +0 -21
- package/dist/DateTimeField-C4wWOEiw.js +0 -28
- package/dist/EmailField-DJqiQ4sp.js +0 -31
- package/dist/FileField-ChjjCydz.js +0 -133
- package/dist/FormulaField-CJkkwIK8.js +0 -9
- package/dist/GeolocationField-BnkeUBek.js +0 -123
- package/dist/GridField-DoHqc2ON.js +0 -30
- package/dist/ImageField-Ld7SHA8N.js +0 -90
- package/dist/LocationField-Bgu-vMAE.js +0 -31
- package/dist/MasterDetailField-Bp5WBTzU.js +0 -108
- package/dist/NumberField-uBqVZ-gt.js +0 -26
- package/dist/ObjectField-BH1Md9gH.js +0 -48
- package/dist/PasswordField-D8GZjY7d.js +0 -38
- package/dist/PercentField-DyK8vg8M.js +0 -63
- package/dist/PhoneField-B3qJyLP0.js +0 -31
- package/dist/QRCodeField-CGiRTCZq.js +0 -77
- package/dist/RatingField-CWVaJNyf.js +0 -47
- package/dist/RichTextField-CusveP9T.js +0 -38
- package/dist/SelectField-UdDfsEZo.js +0 -26
- package/dist/SignatureField-DFvPKbuI.js +0 -85
- package/dist/SliderField-C-HvGV9e.js +0 -30
- package/dist/SummaryField-ugYPYxjP.js +0 -9
- package/dist/TextAreaField-C5KygUT3.js +0 -39
- package/dist/TextField-oUjuqQ1x.js +0 -32
- package/dist/TimeField-SsQ6rfk5.js +0 -21
- package/dist/UrlField-kd48Ip95.js +0 -33
- package/dist/UserField-BOjE_CAz.js +0 -49
- package/dist/VectorField-CKg9jdGa.js +0 -25
- package/dist/index-D2t9pLAg.js +0 -99948
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { $ as e, It as t, Z as n, hn as r, ht as i, q as a, un as o } from "./src-CXr1-vVl.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/MasterDetailField.tsx
|
|
5
|
+
var l = /* @__PURE__ */ r({ MasterDetailField: () => u });
|
|
6
|
+
function u({ value: r, onChange: l, field: u, readonly: d, className: f, ...p }) {
|
|
7
|
+
let m = r || [], h = u || p.schema, g = () => {
|
|
8
|
+
let e = {
|
|
9
|
+
id: `new-${Date.now()}`,
|
|
10
|
+
label: "New Related Record"
|
|
11
|
+
};
|
|
12
|
+
l([...m, e]);
|
|
13
|
+
}, _ = (e) => {
|
|
14
|
+
l(m.filter((t) => t.id !== e));
|
|
15
|
+
}, v = (e) => {
|
|
16
|
+
console.log("View detail:", e);
|
|
17
|
+
};
|
|
18
|
+
return d ? /* @__PURE__ */ c("div", {
|
|
19
|
+
className: o("space-y-2", f),
|
|
20
|
+
children: [m.length === 0 ? /* @__PURE__ */ s("span", {
|
|
21
|
+
className: "text-sm text-muted-foreground",
|
|
22
|
+
children: "No related records"
|
|
23
|
+
}) : m.map((e) => /* @__PURE__ */ c("div", {
|
|
24
|
+
className: "flex items-center justify-between p-2 border rounded hover:bg-muted/50",
|
|
25
|
+
children: [/* @__PURE__ */ s("span", {
|
|
26
|
+
className: "text-sm",
|
|
27
|
+
children: e.label
|
|
28
|
+
}), /* @__PURE__ */ s(n, {
|
|
29
|
+
type: "button",
|
|
30
|
+
variant: "ghost",
|
|
31
|
+
size: "sm",
|
|
32
|
+
onClick: () => v(e),
|
|
33
|
+
children: /* @__PURE__ */ s(t, { className: "w-4 h-4" })
|
|
34
|
+
})]
|
|
35
|
+
}, e.id)), /* @__PURE__ */ c("p", {
|
|
36
|
+
className: "text-xs text-muted-foreground",
|
|
37
|
+
children: [
|
|
38
|
+
m.length,
|
|
39
|
+
" ",
|
|
40
|
+
m.length === 1 ? "record" : "records"
|
|
41
|
+
]
|
|
42
|
+
})]
|
|
43
|
+
}) : /* @__PURE__ */ c("div", {
|
|
44
|
+
className: o("space-y-3", f),
|
|
45
|
+
children: [/* @__PURE__ */ c("div", {
|
|
46
|
+
className: "space-y-2",
|
|
47
|
+
children: [m.map((r) => /* @__PURE__ */ c("div", {
|
|
48
|
+
className: "flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",
|
|
49
|
+
children: [/* @__PURE__ */ c("div", {
|
|
50
|
+
className: "flex items-center gap-2 flex-1",
|
|
51
|
+
children: [/* @__PURE__ */ s(a, {
|
|
52
|
+
variant: "outline",
|
|
53
|
+
children: r.id
|
|
54
|
+
}), /* @__PURE__ */ s("span", {
|
|
55
|
+
className: "text-sm flex-1",
|
|
56
|
+
children: r.label
|
|
57
|
+
})]
|
|
58
|
+
}), /* @__PURE__ */ c("div", {
|
|
59
|
+
className: "flex items-center gap-1",
|
|
60
|
+
children: [/* @__PURE__ */ s(n, {
|
|
61
|
+
type: "button",
|
|
62
|
+
variant: "ghost",
|
|
63
|
+
size: "sm",
|
|
64
|
+
onClick: () => v(r),
|
|
65
|
+
children: /* @__PURE__ */ s(t, { className: "w-4 h-4" })
|
|
66
|
+
}), /* @__PURE__ */ s(n, {
|
|
67
|
+
type: "button",
|
|
68
|
+
variant: "ghost",
|
|
69
|
+
size: "sm",
|
|
70
|
+
onClick: () => _(r.id),
|
|
71
|
+
disabled: p.disabled,
|
|
72
|
+
children: /* @__PURE__ */ s(e, { className: "w-4 h-4" })
|
|
73
|
+
})]
|
|
74
|
+
})]
|
|
75
|
+
}, r.id)), m.length === 0 && /* @__PURE__ */ s("div", {
|
|
76
|
+
className: "text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20",
|
|
77
|
+
children: "No related records"
|
|
78
|
+
})]
|
|
79
|
+
}), /* @__PURE__ */ c(n, {
|
|
80
|
+
type: "button",
|
|
81
|
+
variant: "outline",
|
|
82
|
+
className: "w-full",
|
|
83
|
+
onClick: g,
|
|
84
|
+
disabled: p.disabled,
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ s(i, { className: "w-4 h-4 mr-2" }),
|
|
87
|
+
"Add ",
|
|
88
|
+
h?.label || "Record"
|
|
89
|
+
]
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { l as t };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { D as e, hn as t } from "./src-CXr1-vVl.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/NumberField.tsx
|
|
5
|
+
var r = /* @__PURE__ */ t({ NumberField: () => i });
|
|
6
|
+
function i({ value: t, onChange: r, field: i, readonly: a, ...o }) {
|
|
7
|
+
if (a) return /* @__PURE__ */ n("span", {
|
|
8
|
+
className: "text-sm",
|
|
9
|
+
children: t ?? "-"
|
|
10
|
+
});
|
|
11
|
+
let s = i || o.schema, c = s?.precision, { inputType: l, ...u } = o;
|
|
12
|
+
return /* @__PURE__ */ n(e, {
|
|
13
|
+
...u,
|
|
14
|
+
type: "number",
|
|
15
|
+
value: t ?? "",
|
|
16
|
+
onChange: (e) => {
|
|
17
|
+
let t = e.target.value;
|
|
18
|
+
r(t === "" ? null : Number(t));
|
|
19
|
+
},
|
|
20
|
+
placeholder: s?.placeholder,
|
|
21
|
+
disabled: a || u.disabled,
|
|
22
|
+
step: c ? 10 ** -c : "any"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { r as t };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { hn as e, t, un as n } from "./src-CXr1-vVl.js";
|
|
2
|
+
import { useEffect as r, useState as i } from "react";
|
|
3
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/ObjectField.tsx
|
|
5
|
+
var s = /* @__PURE__ */ e({ ObjectField: () => c });
|
|
6
|
+
function c({ value: e, onChange: s, field: c, readonly: l, ...u }) {
|
|
7
|
+
let d = c || u.schema, [f, p] = i(() => e == null ? "" : JSON.stringify(e, null, 2)), [m, h] = i(null);
|
|
8
|
+
return r(() => {
|
|
9
|
+
try {
|
|
10
|
+
if (e == null) {
|
|
11
|
+
p("");
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
let t = f ? JSON.parse(f) : null;
|
|
15
|
+
JSON.stringify(t) !== JSON.stringify(e) && p(JSON.stringify(e, null, 2));
|
|
16
|
+
} catch {
|
|
17
|
+
p(JSON.stringify(e, null, 2));
|
|
18
|
+
}
|
|
19
|
+
}, [e, f]), l ? e ? /* @__PURE__ */ a("pre", {
|
|
20
|
+
className: n("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", u.className),
|
|
21
|
+
children: JSON.stringify(e, null, 2)
|
|
22
|
+
}) : /* @__PURE__ */ a("span", {
|
|
23
|
+
className: "text-sm",
|
|
24
|
+
children: "-"
|
|
25
|
+
}) : /* @__PURE__ */ o("div", {
|
|
26
|
+
className: "space-y-1",
|
|
27
|
+
children: [/* @__PURE__ */ a(t, {
|
|
28
|
+
value: f,
|
|
29
|
+
onChange: (e) => {
|
|
30
|
+
let t = e.target.value;
|
|
31
|
+
if (p(t), h(null), !t.trim()) {
|
|
32
|
+
s(null);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
s(JSON.parse(t));
|
|
37
|
+
} catch {
|
|
38
|
+
h("Invalid JSON");
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
placeholder: d?.placeholder || "{\n \"key\": \"value\"\n}",
|
|
42
|
+
disabled: l || u.disabled,
|
|
43
|
+
className: n("font-mono text-xs", m ? "border-red-500 focus-visible:ring-red-500" : "", u.className),
|
|
44
|
+
rows: 6
|
|
45
|
+
}), m && /* @__PURE__ */ a("p", {
|
|
46
|
+
className: "text-xs text-red-500",
|
|
47
|
+
children: m
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { s as t };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { D as e, Ft as t, Pt as n, Z as r, hn as i } from "./src-CXr1-vVl.js";
|
|
2
|
+
import { useState as a } from "react";
|
|
3
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/PasswordField.tsx
|
|
5
|
+
var c = /* @__PURE__ */ i({ PasswordField: () => l });
|
|
6
|
+
function l({ value: i, onChange: c, field: l, readonly: u, className: d, ...f }) {
|
|
7
|
+
let [p, m] = a(!1), h = l || f.schema;
|
|
8
|
+
if (u) return /* @__PURE__ */ o("span", {
|
|
9
|
+
className: "text-sm",
|
|
10
|
+
children: "••••••••"
|
|
11
|
+
});
|
|
12
|
+
let { inputType: g, ..._ } = f;
|
|
13
|
+
return /* @__PURE__ */ s("div", {
|
|
14
|
+
className: "relative",
|
|
15
|
+
children: [/* @__PURE__ */ o(e, {
|
|
16
|
+
..._,
|
|
17
|
+
type: p ? "text" : "password",
|
|
18
|
+
value: i || "",
|
|
19
|
+
onChange: (e) => c(e.target.value),
|
|
20
|
+
placeholder: h?.placeholder,
|
|
21
|
+
disabled: u || _.disabled,
|
|
22
|
+
className: `pr-10 ${d || ""}`
|
|
23
|
+
}), /* @__PURE__ */ o(r, {
|
|
24
|
+
type: "button",
|
|
25
|
+
variant: "ghost",
|
|
26
|
+
size: "sm",
|
|
27
|
+
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
28
|
+
onClick: () => m(!p),
|
|
29
|
+
tabIndex: -1,
|
|
30
|
+
children: o(p ? t : n, { className: "size-4 text-gray-500" })
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { c as t };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { D as e, hn as t, p as n } from "./src-CXr1-vVl.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/PercentField.tsx
|
|
5
|
+
var a = /* @__PURE__ */ t({ PercentField: () => o });
|
|
6
|
+
function o({ value: t, onChange: a, field: o, readonly: s, errorMessage: c, className: l, ...u }) {
|
|
7
|
+
let d = o || u.schema, f = d?.precision ?? 2;
|
|
8
|
+
if (s) return t == null ? /* @__PURE__ */ r("span", {
|
|
9
|
+
className: "text-sm",
|
|
10
|
+
children: "-"
|
|
11
|
+
}) : /* @__PURE__ */ i("span", {
|
|
12
|
+
className: "text-sm font-medium tabular-nums",
|
|
13
|
+
children: [(t * 100).toFixed(f), "%"]
|
|
14
|
+
});
|
|
15
|
+
let p = t == null ? "" : t * 100, m = t == null ? 0 : t * 100, h = (e) => {
|
|
16
|
+
if (e.target.value === "") {
|
|
17
|
+
a(null);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
let t = parseFloat(e.target.value);
|
|
21
|
+
a(isNaN(t) ? null : t / 100);
|
|
22
|
+
}, g = (e) => {
|
|
23
|
+
if (s || u.disabled) return;
|
|
24
|
+
if (!Array.isArray(e) || e.length === 0) {
|
|
25
|
+
a(null);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let t = e[0];
|
|
29
|
+
a(typeof t == "number" ? t / 100 : null);
|
|
30
|
+
}, _ = 10 ** -f;
|
|
31
|
+
return /* @__PURE__ */ i("div", {
|
|
32
|
+
className: "space-y-2",
|
|
33
|
+
children: [/* @__PURE__ */ i("div", {
|
|
34
|
+
className: "relative",
|
|
35
|
+
children: [/* @__PURE__ */ r(e, {
|
|
36
|
+
...u,
|
|
37
|
+
type: "number",
|
|
38
|
+
value: p,
|
|
39
|
+
onChange: h,
|
|
40
|
+
placeholder: d?.placeholder || "0",
|
|
41
|
+
disabled: s || u.disabled,
|
|
42
|
+
className: `pr-8 ${l || ""}`,
|
|
43
|
+
step: (10 ** -f).toFixed(f),
|
|
44
|
+
"aria-invalid": !!c
|
|
45
|
+
}), /* @__PURE__ */ r("span", {
|
|
46
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
47
|
+
children: "%"
|
|
48
|
+
})]
|
|
49
|
+
}), /* @__PURE__ */ r(n, {
|
|
50
|
+
value: [m],
|
|
51
|
+
onValueChange: g,
|
|
52
|
+
min: 0,
|
|
53
|
+
max: 100,
|
|
54
|
+
step: _,
|
|
55
|
+
disabled: s || u.disabled,
|
|
56
|
+
className: "w-full",
|
|
57
|
+
"aria-label": "Percentage",
|
|
58
|
+
"data-testid": "percent-slider"
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { a as t };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { D as e, hn as t } from "./src-CXr1-vVl.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/PhoneField.tsx
|
|
5
|
+
var r = /* @__PURE__ */ t({ PhoneField: () => i });
|
|
6
|
+
function i({ value: t, onChange: r, field: i, readonly: a, errorMessage: o, ...s }) {
|
|
7
|
+
let c = i || s.schema;
|
|
8
|
+
if (a) return t ? /* @__PURE__ */ n("a", {
|
|
9
|
+
href: `tel:${t}`,
|
|
10
|
+
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
11
|
+
children: t
|
|
12
|
+
}) : /* @__PURE__ */ n("span", {
|
|
13
|
+
className: "text-sm",
|
|
14
|
+
children: "-"
|
|
15
|
+
});
|
|
16
|
+
let { inputType: l, ...u } = s;
|
|
17
|
+
return /* @__PURE__ */ n(e, {
|
|
18
|
+
...u,
|
|
19
|
+
type: "tel",
|
|
20
|
+
value: t || "",
|
|
21
|
+
onChange: (e) => r(e.target.value),
|
|
22
|
+
placeholder: c?.placeholder || "(555) 123-4567",
|
|
23
|
+
disabled: a || u.disabled,
|
|
24
|
+
"aria-invalid": !!o
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { r as t };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { D as e, Vt as t, Z as n, hn as r, mt as i } from "./src-CXr1-vVl.js";
|
|
2
|
+
import a from "react";
|
|
3
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/QRCodeField.tsx
|
|
5
|
+
var l = /* @__PURE__ */ r({ QRCodeField: () => u });
|
|
6
|
+
function u({ value: r, onChange: l, field: u, readonly: d, ...f }) {
|
|
7
|
+
let [p, m] = a.useState(!1), h = u || f.schema;
|
|
8
|
+
return d ? /* @__PURE__ */ c("div", {
|
|
9
|
+
className: "flex items-center gap-3",
|
|
10
|
+
children: [/* @__PURE__ */ s("span", {
|
|
11
|
+
className: "text-sm flex-1 truncate",
|
|
12
|
+
children: r || "-"
|
|
13
|
+
}), r && /* @__PURE__ */ c(n, {
|
|
14
|
+
type: "button",
|
|
15
|
+
variant: "outline",
|
|
16
|
+
size: "sm",
|
|
17
|
+
onClick: () => m(!p),
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ s(i, { className: "w-4 h-4 mr-2" }),
|
|
20
|
+
p ? "Hide" : "Show",
|
|
21
|
+
" QR"
|
|
22
|
+
]
|
|
23
|
+
})]
|
|
24
|
+
}) : /* @__PURE__ */ c("div", {
|
|
25
|
+
className: "space-y-3",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ c("div", {
|
|
28
|
+
className: "flex items-center gap-2",
|
|
29
|
+
children: [/* @__PURE__ */ s(e, {
|
|
30
|
+
type: "text",
|
|
31
|
+
value: r || "",
|
|
32
|
+
onChange: (e) => l(e.target.value),
|
|
33
|
+
placeholder: h?.placeholder || "Enter text for QR code",
|
|
34
|
+
disabled: d || f.disabled,
|
|
35
|
+
className: f.className
|
|
36
|
+
}), r && /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(n, {
|
|
37
|
+
type: "button",
|
|
38
|
+
variant: "outline",
|
|
39
|
+
size: "sm",
|
|
40
|
+
onClick: () => {
|
|
41
|
+
r && navigator.clipboard.writeText(r);
|
|
42
|
+
},
|
|
43
|
+
children: /* @__PURE__ */ s(t, { className: "w-4 h-4" })
|
|
44
|
+
}), /* @__PURE__ */ s(n, {
|
|
45
|
+
type: "button",
|
|
46
|
+
variant: "outline",
|
|
47
|
+
size: "sm",
|
|
48
|
+
onClick: () => m(!p),
|
|
49
|
+
children: /* @__PURE__ */ s(i, { className: "w-4 h-4" })
|
|
50
|
+
})] })]
|
|
51
|
+
}),
|
|
52
|
+
p && r && /* @__PURE__ */ s("div", {
|
|
53
|
+
className: "border rounded p-4 bg-white flex justify-center",
|
|
54
|
+
children: /* @__PURE__ */ s("img", {
|
|
55
|
+
src: ((e) => `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(e)}`)(r),
|
|
56
|
+
alt: "QR Code",
|
|
57
|
+
className: "w-48 h-48"
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
r && /* @__PURE__ */ c("p", {
|
|
61
|
+
className: "text-xs text-muted-foreground",
|
|
62
|
+
children: [
|
|
63
|
+
"QR code contains: ",
|
|
64
|
+
r.length,
|
|
65
|
+
" characters"
|
|
66
|
+
]
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { l as t };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { hn as e, rt as t, un as n } from "./src-CXr1-vVl.js";
|
|
2
|
+
import r from "react";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/RatingField.tsx
|
|
5
|
+
var o = /* @__PURE__ */ e({ RatingField: () => s });
|
|
6
|
+
function s({ value: e, onChange: o, field: s, readonly: c, className: l, ...u }) {
|
|
7
|
+
let d = (s || u.schema)?.max ?? 5, f = e ?? 0, [p, m] = r.useState(null), h = p === null ? f : p;
|
|
8
|
+
return c ? /* @__PURE__ */ a("div", {
|
|
9
|
+
className: n("flex items-center gap-1", l),
|
|
10
|
+
children: [Array.from({ length: d }, (e, n) => /* @__PURE__ */ i(t, { className: `w-5 h-5 ${n < f ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}` }, n)), /* @__PURE__ */ a("span", {
|
|
11
|
+
className: "ml-2 text-sm text-muted-foreground",
|
|
12
|
+
children: [
|
|
13
|
+
f,
|
|
14
|
+
" / ",
|
|
15
|
+
d
|
|
16
|
+
]
|
|
17
|
+
})]
|
|
18
|
+
}) : /* @__PURE__ */ a("div", {
|
|
19
|
+
className: n("flex items-center gap-1", l),
|
|
20
|
+
children: [Array.from({ length: d }, (e, n) => /* @__PURE__ */ i("button", {
|
|
21
|
+
type: "button",
|
|
22
|
+
onClick: () => o(n + 1),
|
|
23
|
+
onMouseEnter: () => m(n + 1),
|
|
24
|
+
onMouseLeave: () => m(null),
|
|
25
|
+
className: "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",
|
|
26
|
+
disabled: c || u.disabled,
|
|
27
|
+
children: /* @__PURE__ */ i(t, { className: `w-5 h-5 transition-colors ${n < h ? "fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500" : "text-muted-foreground hover:text-yellow-400"}` })
|
|
28
|
+
}, n)), /* @__PURE__ */ a("span", {
|
|
29
|
+
className: "ml-2 text-sm text-muted-foreground",
|
|
30
|
+
children: [
|
|
31
|
+
f,
|
|
32
|
+
" / ",
|
|
33
|
+
d
|
|
34
|
+
]
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { o as t };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { hn as e, t } from "./src-CXr1-vVl.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/RichTextField.tsx
|
|
5
|
+
var i = /* @__PURE__ */ e({ RichTextField: () => a });
|
|
6
|
+
function a({ value: e, onChange: i, field: a, readonly: o, errorMessage: s, ...c }) {
|
|
7
|
+
if (o) return /* @__PURE__ */ n("div", {
|
|
8
|
+
className: "text-sm prose prose-sm max-w-none",
|
|
9
|
+
children: e || "-"
|
|
10
|
+
});
|
|
11
|
+
let l = a || c.schema, u = l?.rows || 8;
|
|
12
|
+
return /* @__PURE__ */ r("div", {
|
|
13
|
+
className: "space-y-2",
|
|
14
|
+
children: [/* @__PURE__ */ r("div", {
|
|
15
|
+
className: "flex items-center justify-between text-xs text-gray-500",
|
|
16
|
+
children: [/* @__PURE__ */ r("span", { children: ["Format: ", l?.format || "markdown"] }), /* @__PURE__ */ n("span", {
|
|
17
|
+
className: "italic",
|
|
18
|
+
children: "Rich text editor (basic)"
|
|
19
|
+
})]
|
|
20
|
+
}), /* @__PURE__ */ n(t, {
|
|
21
|
+
value: e || "",
|
|
22
|
+
onChange: (e) => i(e.target.value),
|
|
23
|
+
placeholder: l?.placeholder || "Enter text...",
|
|
24
|
+
disabled: o || c.disabled,
|
|
25
|
+
rows: u,
|
|
26
|
+
className: `font-mono text-sm ${c.className || ""}`,
|
|
27
|
+
"aria-invalid": !!s
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { i as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { C as e, S as t, b as n, hn as r, x as i, y as a } from "./src-CXr1-vVl.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/SelectField.tsx
|
|
5
|
+
var c = /* @__PURE__ */ r({ SelectField: () => l });
|
|
6
|
+
function l({ value: r, onChange: c, field: l, readonly: u, ...d }) {
|
|
7
|
+
let f = l || d.schema, p = f?.options || [];
|
|
8
|
+
return u ? /* @__PURE__ */ o("span", {
|
|
9
|
+
className: "text-sm",
|
|
10
|
+
children: p.find((e) => e.value === r)?.label || r || "-"
|
|
11
|
+
}) : /* @__PURE__ */ s(a, {
|
|
12
|
+
...d,
|
|
13
|
+
value: r,
|
|
14
|
+
onValueChange: c,
|
|
15
|
+
disabled: u || d.disabled,
|
|
16
|
+
children: [/* @__PURE__ */ o(t, {
|
|
17
|
+
className: d.className,
|
|
18
|
+
id: d.id,
|
|
19
|
+
children: /* @__PURE__ */ o(e, { placeholder: f?.placeholder || "Select an option" })
|
|
20
|
+
}), /* @__PURE__ */ o(n, {
|
|
21
|
+
position: "popper",
|
|
22
|
+
children: p.map((e) => /* @__PURE__ */ o(i, {
|
|
23
|
+
value: e.value,
|
|
24
|
+
children: e.label
|
|
25
|
+
}, e.value))
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { c as t };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Lt as e, Z as t, hn as n } from "./src-CXr1-vVl.js";
|
|
2
|
+
import r, { useEffect as i, useRef as a } from "react";
|
|
3
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/SignatureField.tsx
|
|
5
|
+
var c = /* @__PURE__ */ n({ SignatureField: () => l });
|
|
6
|
+
function l({ value: n, onChange: c, readonly: l }) {
|
|
7
|
+
let u = a(null), [d, f] = r.useState(!1), [p, m] = r.useState(!n);
|
|
8
|
+
i(() => {
|
|
9
|
+
if (n && u.current) {
|
|
10
|
+
let e = u.current.getContext("2d");
|
|
11
|
+
if (e) {
|
|
12
|
+
let t = new Image();
|
|
13
|
+
t.onload = () => {
|
|
14
|
+
e.drawImage(t, 0, 0), m(!1);
|
|
15
|
+
}, t.src = n;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}, [n]);
|
|
19
|
+
let h = (e) => {
|
|
20
|
+
if (l) return;
|
|
21
|
+
f(!0), m(!1);
|
|
22
|
+
let t = u.current;
|
|
23
|
+
if (!t) return;
|
|
24
|
+
let n = t.getContext("2d");
|
|
25
|
+
if (!n) return;
|
|
26
|
+
let r = t.getBoundingClientRect(), i = "touches" in e ? e.touches[0].clientX - r.left : e.clientX - r.left, a = "touches" in e ? e.touches[0].clientY - r.top : e.clientY - r.top;
|
|
27
|
+
n.beginPath(), n.moveTo(i, a);
|
|
28
|
+
}, g = (e) => {
|
|
29
|
+
if (!d || l) return;
|
|
30
|
+
let t = u.current;
|
|
31
|
+
if (!t) return;
|
|
32
|
+
let n = t.getContext("2d");
|
|
33
|
+
if (!n) return;
|
|
34
|
+
let r = t.getBoundingClientRect(), i = "touches" in e ? e.touches[0].clientX - r.left : e.clientX - r.left, a = "touches" in e ? e.touches[0].clientY - r.top : e.clientY - r.top;
|
|
35
|
+
n.lineTo(i, a), n.strokeStyle = "#000", n.lineWidth = 2, n.lineCap = "round", n.lineJoin = "round", n.stroke();
|
|
36
|
+
}, _ = () => {
|
|
37
|
+
if (!d) return;
|
|
38
|
+
f(!1);
|
|
39
|
+
let e = u.current;
|
|
40
|
+
e && c(e.toDataURL("image/png"));
|
|
41
|
+
};
|
|
42
|
+
return l && n ? /* @__PURE__ */ o("div", {
|
|
43
|
+
className: "border rounded p-2 bg-white",
|
|
44
|
+
children: /* @__PURE__ */ o("img", {
|
|
45
|
+
src: n,
|
|
46
|
+
alt: "Signature",
|
|
47
|
+
loading: "lazy",
|
|
48
|
+
className: "max-w-full h-auto"
|
|
49
|
+
})
|
|
50
|
+
}) : l && !n ? /* @__PURE__ */ o("span", {
|
|
51
|
+
className: "text-sm text-muted-foreground",
|
|
52
|
+
children: "No signature"
|
|
53
|
+
}) : /* @__PURE__ */ s("div", {
|
|
54
|
+
className: "space-y-2",
|
|
55
|
+
children: [/* @__PURE__ */ o("div", {
|
|
56
|
+
className: "border rounded bg-white",
|
|
57
|
+
children: /* @__PURE__ */ o("canvas", {
|
|
58
|
+
ref: u,
|
|
59
|
+
width: 400,
|
|
60
|
+
height: 200,
|
|
61
|
+
className: "w-full touch-none cursor-crosshair",
|
|
62
|
+
onMouseDown: h,
|
|
63
|
+
onMouseMove: g,
|
|
64
|
+
onMouseUp: _,
|
|
65
|
+
onMouseLeave: _,
|
|
66
|
+
onTouchStart: h,
|
|
67
|
+
onTouchMove: g,
|
|
68
|
+
onTouchEnd: _
|
|
69
|
+
})
|
|
70
|
+
}), /* @__PURE__ */ s("div", {
|
|
71
|
+
className: "flex justify-between items-center",
|
|
72
|
+
children: [/* @__PURE__ */ o("p", {
|
|
73
|
+
className: "text-xs text-muted-foreground",
|
|
74
|
+
children: p ? "Sign above" : "Signature captured"
|
|
75
|
+
}), /* @__PURE__ */ s(t, {
|
|
76
|
+
type: "button",
|
|
77
|
+
variant: "outline",
|
|
78
|
+
size: "sm",
|
|
79
|
+
onClick: () => {
|
|
80
|
+
let e = u.current;
|
|
81
|
+
if (!e) return;
|
|
82
|
+
let t = e.getContext("2d");
|
|
83
|
+
t && (t.clearRect(0, 0, e.width, e.height), m(!0), c(""));
|
|
84
|
+
},
|
|
85
|
+
disabled: l || p,
|
|
86
|
+
children: [/* @__PURE__ */ o(e, { className: "w-4 h-4 mr-2" }), "Clear"]
|
|
87
|
+
})]
|
|
88
|
+
})]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { c as t };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { hn as e, p as t } from "./src-CXr1-vVl.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/SliderField.tsx
|
|
5
|
+
var i = /* @__PURE__ */ e({ SliderField: () => a });
|
|
6
|
+
function a({ value: e, onChange: i, field: a, readonly: o, ...s }) {
|
|
7
|
+
let c = a || s.schema, l = c?.min ?? 0, u = c?.max ?? 100, d = c?.step ?? 1;
|
|
8
|
+
return o ? /* @__PURE__ */ r("div", {
|
|
9
|
+
className: "flex items-center gap-2",
|
|
10
|
+
children: [/* @__PURE__ */ n("span", {
|
|
11
|
+
className: "text-sm font-medium",
|
|
12
|
+
children: e ?? l
|
|
13
|
+
}), /* @__PURE__ */ r("span", {
|
|
14
|
+
className: "text-xs text-muted-foreground",
|
|
15
|
+
children: ["/ ", u]
|
|
16
|
+
})]
|
|
17
|
+
}) : /* @__PURE__ */ r("div", {
|
|
18
|
+
className: "flex items-center gap-4",
|
|
19
|
+
children: [/* @__PURE__ */ n(t, {
|
|
20
|
+
value: [e ?? l],
|
|
21
|
+
onValueChange: (e) => i(e[0]),
|
|
22
|
+
min: l,
|
|
23
|
+
max: u,
|
|
24
|
+
step: d,
|
|
25
|
+
disabled: o || s.disabled,
|
|
26
|
+
className: s.className
|
|
27
|
+
}), /* @__PURE__ */ n("span", {
|
|
28
|
+
className: "text-sm font-medium w-12 text-right",
|
|
29
|
+
children: e ?? l
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { i as t };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { hn as e } from "./src-CXr1-vVl.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/SummaryField.tsx
|
|
5
|
+
var n = /* @__PURE__ */ e({ SummaryField: () => r });
|
|
6
|
+
function r({ value: e, field: n, ...r }) {
|
|
7
|
+
let i = (n || r.schema)?.summary_type || "count", a = "-";
|
|
8
|
+
return e != null && (a = i === "count" ? String(e) : [
|
|
9
|
+
"sum",
|
|
10
|
+
"avg",
|
|
11
|
+
"min",
|
|
12
|
+
"max"
|
|
13
|
+
].includes(i) && typeof e == "number" ? e.toFixed(2) : String(e)), /* @__PURE__ */ t("span", {
|
|
14
|
+
className: `text-sm font-medium tabular-nums text-gray-700 ${r.className || ""}`,
|
|
15
|
+
children: a
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { n as t };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { hn as e, t } from "./src-CXr1-vVl.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region ../fields/src/widgets/TextAreaField.tsx
|
|
5
|
+
var i = /* @__PURE__ */ e({ TextAreaField: () => a });
|
|
6
|
+
function a({ value: e, onChange: i, field: a, readonly: o, errorMessage: s, ...c }) {
|
|
7
|
+
if (o) return /* @__PURE__ */ n("div", {
|
|
8
|
+
className: "text-sm whitespace-pre-wrap",
|
|
9
|
+
children: e || "-"
|
|
10
|
+
});
|
|
11
|
+
let l = a || c.schema, u = l?.rows || 4, d = l?.max_length, { inputType: f, ...p } = c;
|
|
12
|
+
return /* @__PURE__ */ r("div", {
|
|
13
|
+
className: "relative",
|
|
14
|
+
children: [/* @__PURE__ */ n(t, {
|
|
15
|
+
...p,
|
|
16
|
+
value: e || "",
|
|
17
|
+
onChange: (e) => i(e.target.value),
|
|
18
|
+
placeholder: l?.placeholder,
|
|
19
|
+
disabled: o || p.disabled,
|
|
20
|
+
rows: u,
|
|
21
|
+
maxLength: d,
|
|
22
|
+
"aria-invalid": !!s
|
|
23
|
+
}), d && /* @__PURE__ */ r("div", {
|
|
24
|
+
className: "absolute bottom-2 right-2 text-xs text-gray-400",
|
|
25
|
+
"aria-live": "polite",
|
|
26
|
+
"aria-label": `Character count: ${(e || "").length} of ${d}`,
|
|
27
|
+
children: [
|
|
28
|
+
(e || "").length,
|
|
29
|
+
"/",
|
|
30
|
+
d
|
|
31
|
+
]
|
|
32
|
+
})]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { i as t };
|