@object-ui/fields 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.js +140 -114
- package/package.json +4 -4
- package/src/__tests__/cell-renderers.test.tsx +90 -0
- package/src/index.tsx +30 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import k, { useId as vt, useState as B, useRef as xe, useCallback as te, useEffect as ze } from "react";
|
|
2
2
|
import { ComponentRegistry as g } from "@object-ui/core";
|
|
3
3
|
import { Textarea as Z, Input as w, Checkbox as Ee, Label as E, Switch as _t, Select as wt, SelectTrigger as Ft, SelectValue as St, SelectContent as Ct, SelectItem as Pt, Badge as M, Dialog as Tt, DialogTrigger as Ot, Button as P, DialogContent as Rt, DialogHeader as kt, DialogTitle as At, Slider as De, Avatar as L, AvatarFallback as I, cn as z, AvatarImage as ve } from "@object-ui/components";
|
|
4
|
-
import { X as W, Search as $t, EyeOff as zt, Eye as Et, Upload as Me, ImageIcon as Dt, File as Mt, Image as Lt, Star as _e, MapPin as we, Crosshair as It, Eraser as Ut, QrCode as Fe, Copy as
|
|
4
|
+
import { X as W, Search as $t, EyeOff as zt, Eye as Et, Upload as Me, ImageIcon as Dt, File as Mt, Image as Lt, Star as _e, MapPin as we, Crosshair as It, Eraser as Ut, QrCode as Fe, Copy as pe, ExternalLink as Se, Plus as Vt, Check as he, Phone as Bt } from "lucide-react";
|
|
5
5
|
var re = { exports: {} }, H = {};
|
|
6
6
|
var Ce;
|
|
7
7
|
function Yt() {
|
|
@@ -138,7 +138,7 @@ function qt() {
|
|
|
138
138
|
function m(d, j, _, S, ee, ie) {
|
|
139
139
|
var C = _.ref;
|
|
140
140
|
return d = {
|
|
141
|
-
$$typeof:
|
|
141
|
+
$$typeof: h,
|
|
142
142
|
type: d,
|
|
143
143
|
key: j,
|
|
144
144
|
props: _,
|
|
@@ -168,7 +168,7 @@ function qt() {
|
|
|
168
168
|
value: ie
|
|
169
169
|
}), Object.freeze && (Object.freeze(d.props), Object.freeze(d)), d;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function p(d, j, _, S, ee, ie) {
|
|
172
172
|
var C = j.children;
|
|
173
173
|
if (C !== void 0)
|
|
174
174
|
if (S)
|
|
@@ -220,9 +220,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
220
220
|
u(d) ? d._store && (d._store.validated = 1) : typeof d == "object" && d !== null && d.$$typeof === $ && (d._payload.status === "fulfilled" ? u(d._payload.value) && d._payload.value._store && (d._payload.value._store.validated = 1) : d._store && (d._store.validated = 1));
|
|
221
221
|
}
|
|
222
222
|
function u(d) {
|
|
223
|
-
return typeof d == "object" && d !== null && d.$$typeof ===
|
|
223
|
+
return typeof d == "object" && d !== null && d.$$typeof === h;
|
|
224
224
|
}
|
|
225
|
-
var x = k,
|
|
225
|
+
var x = k, h = /* @__PURE__ */ Symbol.for("react.transitional.element"), v = /* @__PURE__ */ Symbol.for("react.portal"), R = /* @__PURE__ */ Symbol.for("react.fragment"), N = /* @__PURE__ */ Symbol.for("react.strict_mode"), T = /* @__PURE__ */ Symbol.for("react.profiler"), U = /* @__PURE__ */ Symbol.for("react.consumer"), Q = /* @__PURE__ */ Symbol.for("react.context"), K = /* @__PURE__ */ Symbol.for("react.forward_ref"), b = /* @__PURE__ */ Symbol.for("react.suspense"), F = /* @__PURE__ */ Symbol.for("react.suspense_list"), A = /* @__PURE__ */ Symbol.for("react.memo"), $ = /* @__PURE__ */ Symbol.for("react.lazy"), O = /* @__PURE__ */ Symbol.for("react.activity"), Y = /* @__PURE__ */ Symbol.for("react.client.reference"), q = x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, yt = Array.isArray, le = console.createTask ? console.createTask : function() {
|
|
226
226
|
return null;
|
|
227
227
|
};
|
|
228
228
|
x = {
|
|
@@ -236,7 +236,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
236
236
|
)(), ye = le(a(i)), Ne = {};
|
|
237
237
|
X.Fragment = R, X.jsx = function(d, j, _) {
|
|
238
238
|
var S = 1e4 > q.recentlyCreatedOwnerStacks++;
|
|
239
|
-
return
|
|
239
|
+
return p(
|
|
240
240
|
d,
|
|
241
241
|
j,
|
|
242
242
|
_,
|
|
@@ -246,7 +246,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
246
246
|
);
|
|
247
247
|
}, X.jsxs = function(d, j, _) {
|
|
248
248
|
var S = 1e4 > q.recentlyCreatedOwnerStacks++;
|
|
249
|
-
return
|
|
249
|
+
return p(
|
|
250
250
|
d,
|
|
251
251
|
j,
|
|
252
252
|
_,
|
|
@@ -303,8 +303,8 @@ function Ie({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
303
303
|
type: "number",
|
|
304
304
|
value: e ?? "",
|
|
305
305
|
onChange: (m) => {
|
|
306
|
-
const
|
|
307
|
-
r(
|
|
306
|
+
const p = m.target.value;
|
|
307
|
+
r(p === "" ? null : Number(p));
|
|
308
308
|
},
|
|
309
309
|
placeholder: i?.placeholder,
|
|
310
310
|
disabled: a || c.disabled,
|
|
@@ -320,7 +320,7 @@ function Ue({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
320
320
|
const i = n || s.schema, l = i?.widget, o = vt(), c = i?.name || o, m = i?.label || "Checkbox";
|
|
321
321
|
if (a)
|
|
322
322
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e ? "Yes" : "No" });
|
|
323
|
-
const { inputType:
|
|
323
|
+
const { inputType: p, ...f } = s;
|
|
324
324
|
return l === "checkbox" ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
325
325
|
/* @__PURE__ */ t.jsx(
|
|
326
326
|
Ee,
|
|
@@ -497,7 +497,7 @@ function We({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, cla
|
|
|
497
497
|
const o = n || l.schema, c = o?.currency || "USD", m = o?.precision ?? 2;
|
|
498
498
|
if (a)
|
|
499
499
|
return e == null ? /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ t.jsx("span", { className: "text-sm font-medium tabular-nums", children: tr(Number(e), c) });
|
|
500
|
-
const
|
|
500
|
+
const p = (f) => {
|
|
501
501
|
const u = parseFloat(f.target.value);
|
|
502
502
|
isNaN(u) || r(parseFloat(u.toFixed(m)));
|
|
503
503
|
};
|
|
@@ -513,7 +513,7 @@ function We({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, cla
|
|
|
513
513
|
const u = f.target.value === "" ? null : parseFloat(f.target.value);
|
|
514
514
|
r(u);
|
|
515
515
|
},
|
|
516
|
-
onBlur:
|
|
516
|
+
onBlur: p,
|
|
517
517
|
placeholder: o?.placeholder || "0.00",
|
|
518
518
|
disabled: a || l.disabled,
|
|
519
519
|
className: `pl-8 ${i || ""}`,
|
|
@@ -530,16 +530,16 @@ const rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
530
530
|
function Ge({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, ...i }) {
|
|
531
531
|
if (a)
|
|
532
532
|
return /* @__PURE__ */ t.jsx("div", { className: "text-sm whitespace-pre-wrap", children: e || "-" });
|
|
533
|
-
const l = n || i.schema, o = l?.rows || 4, c = l?.max_length, { inputType: m, ...
|
|
533
|
+
const l = n || i.schema, o = l?.rows || 4, c = l?.max_length, { inputType: m, ...p } = i;
|
|
534
534
|
return /* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
535
535
|
/* @__PURE__ */ t.jsx(
|
|
536
536
|
Z,
|
|
537
537
|
{
|
|
538
|
-
...
|
|
538
|
+
...p,
|
|
539
539
|
value: e || "",
|
|
540
540
|
onChange: (f) => r(f.target.value),
|
|
541
541
|
placeholder: l?.placeholder,
|
|
542
|
-
disabled: a ||
|
|
542
|
+
disabled: a || p.disabled,
|
|
543
543
|
rows: o,
|
|
544
544
|
maxLength: c,
|
|
545
545
|
"aria-invalid": !!s
|
|
@@ -601,11 +601,11 @@ const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
601
601
|
RichTextField: ce
|
|
602
602
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
603
603
|
function Qe({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
604
|
-
const [i, l] = B(!1), [o, c] = B(""), m = n || s.schema,
|
|
604
|
+
const [i, l] = B(!1), [o, c] = B(""), m = n || s.schema, p = m?.options || [], f = m.multiple || !1, u = m.display_field || "label", x = p.filter(
|
|
605
605
|
(N) => N.label.toLowerCase().includes(o.toLowerCase())
|
|
606
|
-
),
|
|
607
|
-
(N) =>
|
|
608
|
-
).filter(Boolean) : e ? [
|
|
606
|
+
), h = f ? (Array.isArray(e) ? e : []).map(
|
|
607
|
+
(N) => p.find((T) => T.value === N)
|
|
608
|
+
).filter(Boolean) : e ? [p.find((N) => N.value === e)].filter(Boolean) : [], v = (N) => {
|
|
609
609
|
if (f) {
|
|
610
610
|
const T = Array.isArray(e) ? e : [], U = T.includes(N.value);
|
|
611
611
|
r(U ? T.filter((Q) => Q !== N.value) : [...T, N.value]);
|
|
@@ -618,8 +618,8 @@ function Qe({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
618
618
|
} else
|
|
619
619
|
r(null);
|
|
620
620
|
};
|
|
621
|
-
return a ?
|
|
622
|
-
|
|
621
|
+
return a ? h.length ? f ? /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-1", children: h.map((N, T) => /* @__PURE__ */ t.jsx(M, { variant: "outline", children: N?.[u] || N?.label }, T)) }) : /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: h[0]?.[u] || h[0]?.label }) : /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
622
|
+
h.length > 0 && /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-1", children: h.map((N, T) => /* @__PURE__ */ t.jsxs(
|
|
623
623
|
M,
|
|
624
624
|
{
|
|
625
625
|
variant: "outline",
|
|
@@ -649,7 +649,7 @@ function Qe({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
649
649
|
type: "button",
|
|
650
650
|
children: [
|
|
651
651
|
/* @__PURE__ */ t.jsx($t, { className: "mr-2 size-4" }),
|
|
652
|
-
|
|
652
|
+
h.length === 0 ? m?.placeholder || "Select..." : f ? `${h.length} selected` : "Change selection"
|
|
653
653
|
]
|
|
654
654
|
}
|
|
655
655
|
) }),
|
|
@@ -746,20 +746,20 @@ function Ze({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, cla
|
|
|
746
746
|
(e * 100).toFixed(c),
|
|
747
747
|
"%"
|
|
748
748
|
] });
|
|
749
|
-
const m = e != null ? e * 100 : "",
|
|
750
|
-
if (
|
|
749
|
+
const m = e != null ? e * 100 : "", p = e != null ? e * 100 : 0, f = (h) => {
|
|
750
|
+
if (h.target.value === "") {
|
|
751
751
|
r(null);
|
|
752
752
|
return;
|
|
753
753
|
}
|
|
754
|
-
const v = parseFloat(
|
|
754
|
+
const v = parseFloat(h.target.value), R = isNaN(v) ? null : v / 100;
|
|
755
755
|
r(R);
|
|
756
|
-
}, u = (
|
|
756
|
+
}, u = (h) => {
|
|
757
757
|
if (a || l.disabled) return;
|
|
758
|
-
if (!Array.isArray(
|
|
758
|
+
if (!Array.isArray(h) || h.length === 0) {
|
|
759
759
|
r(null);
|
|
760
760
|
return;
|
|
761
761
|
}
|
|
762
|
-
const v =
|
|
762
|
+
const v = h[0], R = typeof v == "number" ? v / 100 : null;
|
|
763
763
|
r(R);
|
|
764
764
|
}, x = Math.pow(10, -c);
|
|
765
765
|
return /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
@@ -783,7 +783,7 @@ function Ze({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, cla
|
|
|
783
783
|
/* @__PURE__ */ t.jsx(
|
|
784
784
|
De,
|
|
785
785
|
{
|
|
786
|
-
value: [
|
|
786
|
+
value: [p],
|
|
787
787
|
onValueChange: u,
|
|
788
788
|
min: 0,
|
|
789
789
|
max: 100,
|
|
@@ -804,17 +804,17 @@ function Ke({ value: e, onChange: r, field: n, readonly: a, className: s, ...i }
|
|
|
804
804
|
const [l, o] = B(!1), c = n || i.schema;
|
|
805
805
|
if (a)
|
|
806
806
|
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "••••••••" });
|
|
807
|
-
const { inputType: m, ...
|
|
807
|
+
const { inputType: m, ...p } = i;
|
|
808
808
|
return /* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
809
809
|
/* @__PURE__ */ t.jsx(
|
|
810
810
|
w,
|
|
811
811
|
{
|
|
812
|
-
...
|
|
812
|
+
...p,
|
|
813
813
|
type: l ? "text" : "password",
|
|
814
814
|
value: e || "",
|
|
815
815
|
onChange: (f) => r(f.target.value),
|
|
816
816
|
placeholder: c?.placeholder,
|
|
817
|
-
disabled: a ||
|
|
817
|
+
disabled: a || p.disabled,
|
|
818
818
|
className: `pr-10 ${s || ""}`
|
|
819
819
|
}
|
|
820
820
|
),
|
|
@@ -837,7 +837,7 @@ const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
837
837
|
PasswordField: Ke
|
|
838
838
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
839
839
|
function et({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
840
|
-
const i = xe(null), l = n || s.schema, o = l?.multiple || !1, c = l?.accept ? l.accept.join(",") : void 0, m = l?.maxSize, [
|
|
840
|
+
const i = xe(null), l = n || s.schema, o = l?.multiple || !1, c = l?.accept ? l.accept.join(",") : void 0, m = l?.maxSize, [p, f] = B(!1), [u, x] = B([]), h = e ? Array.isArray(e) ? e : [e] : [], v = te((b) => {
|
|
841
841
|
if (b.length === 0) return;
|
|
842
842
|
const F = [], A = b.filter((O) => {
|
|
843
843
|
if (m && O.size > m) {
|
|
@@ -855,8 +855,8 @@ function et({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
855
855
|
// In a real implementation, this would upload the file and return a URL
|
|
856
856
|
url: URL.createObjectURL(O)
|
|
857
857
|
}));
|
|
858
|
-
r(o ? [...
|
|
859
|
-
}, [
|
|
858
|
+
r(o ? [...h, ...$] : $[0]);
|
|
859
|
+
}, [h, o, r, m]), R = te((b) => {
|
|
860
860
|
b.preventDefault(), b.stopPropagation(), f(!0);
|
|
861
861
|
}, []), N = te((b) => {
|
|
862
862
|
b.preventDefault(), b.stopPropagation(), f(!1);
|
|
@@ -883,7 +883,7 @@ function et({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
883
883
|
v(Array.from(b.target.files || []));
|
|
884
884
|
}, Q = (b) => {
|
|
885
885
|
if (o) {
|
|
886
|
-
const F =
|
|
886
|
+
const F = h.filter((A, $) => $ !== b);
|
|
887
887
|
r(F.length > 0 ? F : null);
|
|
888
888
|
} else
|
|
889
889
|
r(null);
|
|
@@ -912,7 +912,7 @@ function et({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
912
912
|
flex flex-col items-center justify-center gap-2 p-6
|
|
913
913
|
border-2 border-dashed rounded-lg cursor-pointer
|
|
914
914
|
transition-colors duration-200
|
|
915
|
-
${
|
|
915
|
+
${p ? "border-primary bg-primary/5 text-primary" : "border-muted-foreground/25 hover:border-primary/50 text-muted-foreground hover:text-foreground"}
|
|
916
916
|
`,
|
|
917
917
|
role: "button",
|
|
918
918
|
tabIndex: 0,
|
|
@@ -920,16 +920,16 @@ function et({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
920
920
|
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), i.current?.click());
|
|
921
921
|
},
|
|
922
922
|
children: [
|
|
923
|
-
/* @__PURE__ */ t.jsx(Me, { className: `size-8 ${
|
|
923
|
+
/* @__PURE__ */ t.jsx(Me, { className: `size-8 ${p ? "text-primary" : "text-muted-foreground"}` }),
|
|
924
924
|
/* @__PURE__ */ t.jsxs("div", { className: "text-center", children: [
|
|
925
|
-
/* @__PURE__ */ t.jsx("p", { className: "text-sm font-medium", children:
|
|
925
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-sm font-medium", children: p ? "Drop files here" : "Drag & drop files here" }),
|
|
926
926
|
/* @__PURE__ */ t.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: "or click to browse" })
|
|
927
927
|
] })
|
|
928
928
|
]
|
|
929
929
|
}
|
|
930
930
|
),
|
|
931
931
|
u.length > 0 && /* @__PURE__ */ t.jsx("div", { className: "space-y-0.5", children: u.map((b, F) => /* @__PURE__ */ t.jsx("p", { className: "text-xs text-destructive", children: b }, F)) }),
|
|
932
|
-
|
|
932
|
+
h.length > 0 && /* @__PURE__ */ t.jsx("div", { className: "space-y-1", children: h.map((b, F) => /* @__PURE__ */ t.jsxs(
|
|
933
933
|
"div",
|
|
934
934
|
{
|
|
935
935
|
className: "flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",
|
|
@@ -972,20 +972,20 @@ function tt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
972
972
|
if (a) {
|
|
973
973
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
974
974
|
const u = Array.isArray(e) ? e : [e];
|
|
975
|
-
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-2", children: u.map((x,
|
|
975
|
+
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-2", children: u.map((x, h) => /* @__PURE__ */ t.jsx(
|
|
976
976
|
"img",
|
|
977
977
|
{
|
|
978
978
|
src: x.url || "",
|
|
979
|
-
alt: x.name || `Image ${
|
|
979
|
+
alt: x.name || `Image ${h + 1}`,
|
|
980
980
|
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
981
981
|
},
|
|
982
|
-
|
|
982
|
+
h
|
|
983
983
|
)) });
|
|
984
984
|
}
|
|
985
|
-
const m = e ? Array.isArray(e) ? e : [e] : [],
|
|
985
|
+
const m = e ? Array.isArray(e) ? e : [e] : [], p = (u) => {
|
|
986
986
|
const x = Array.from(u.target.files || []);
|
|
987
987
|
if (x.length === 0) return;
|
|
988
|
-
const
|
|
988
|
+
const h = x.map((v) => ({
|
|
989
989
|
name: v.name,
|
|
990
990
|
original_name: v.name,
|
|
991
991
|
size: v.size,
|
|
@@ -993,10 +993,10 @@ function tt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
993
993
|
// In a real implementation, this would upload the image and return a URL
|
|
994
994
|
url: URL.createObjectURL(v)
|
|
995
995
|
}));
|
|
996
|
-
r(o ? [...m, ...
|
|
996
|
+
r(o ? [...m, ...h] : h[0]);
|
|
997
997
|
}, f = (u) => {
|
|
998
998
|
if (o) {
|
|
999
|
-
const x = m.filter((
|
|
999
|
+
const x = m.filter((h, v) => v !== u);
|
|
1000
1000
|
r(x.length > 0 ? x : null);
|
|
1001
1001
|
} else
|
|
1002
1002
|
r(null);
|
|
@@ -1009,7 +1009,7 @@ function tt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1009
1009
|
type: "file",
|
|
1010
1010
|
multiple: o,
|
|
1011
1011
|
accept: c,
|
|
1012
|
-
onChange:
|
|
1012
|
+
onChange: p,
|
|
1013
1013
|
className: "hidden"
|
|
1014
1014
|
}
|
|
1015
1015
|
),
|
|
@@ -1065,9 +1065,9 @@ function rt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1065
1065
|
r(null);
|
|
1066
1066
|
return;
|
|
1067
1067
|
}
|
|
1068
|
-
const
|
|
1069
|
-
if (
|
|
1070
|
-
const f = parseFloat(
|
|
1068
|
+
const p = m.split(",").map((f) => f.trim());
|
|
1069
|
+
if (p.length === 2) {
|
|
1070
|
+
const f = parseFloat(p[0]), u = parseFloat(p[1]);
|
|
1071
1071
|
!isNaN(f) && !isNaN(u) && r({ latitude: f, longitude: u });
|
|
1072
1072
|
}
|
|
1073
1073
|
};
|
|
@@ -1119,8 +1119,8 @@ function de({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1119
1119
|
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
1120
1120
|
const m = Array.isArray(e) ? e : [e];
|
|
1121
1121
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex -space-x-2", children: [
|
|
1122
|
-
m.slice(0, 3).map((
|
|
1123
|
-
const u =
|
|
1122
|
+
m.slice(0, 3).map((p, f) => {
|
|
1123
|
+
const u = p.name || p.username || "User", x = u.split(" ").map((h) => h[0]).join("").toUpperCase().slice(0, 2);
|
|
1124
1124
|
return /* @__PURE__ */ t.jsx(L, { className: "size-8 border-2 border-white", title: u, children: /* @__PURE__ */ t.jsx(I, { className: "bg-blue-500 text-white text-xs", children: x }) }, f);
|
|
1125
1125
|
}),
|
|
1126
1126
|
m.length > 3 && /* @__PURE__ */ t.jsx(L, { className: "size-8 border-2 border-white", children: /* @__PURE__ */ t.jsxs(I, { className: "bg-gray-200 text-gray-600 text-xs", children: [
|
|
@@ -1131,13 +1131,13 @@ function de({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1131
1131
|
}
|
|
1132
1132
|
const o = e ? Array.isArray(e) ? e : [e] : [], c = (m) => {
|
|
1133
1133
|
if (l) {
|
|
1134
|
-
const
|
|
1135
|
-
r(
|
|
1134
|
+
const p = o.filter((f, u) => u !== m);
|
|
1135
|
+
r(p.length > 0 ? p : null);
|
|
1136
1136
|
} else
|
|
1137
1137
|
r(null);
|
|
1138
1138
|
};
|
|
1139
1139
|
return /* @__PURE__ */ t.jsxs("div", { className: s.className, children: [
|
|
1140
|
-
o.length > 0 && /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: o.map((m,
|
|
1140
|
+
o.length > 0 && /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: o.map((m, p) => {
|
|
1141
1141
|
const f = m.name || m.username || "User", u = f.split(" ").map((x) => x[0]).join("").toUpperCase().slice(0, 2);
|
|
1142
1142
|
return /* @__PURE__ */ t.jsxs(M, { variant: "outline", className: "gap-2 pr-1", children: [
|
|
1143
1143
|
/* @__PURE__ */ t.jsx(L, { className: "size-5", children: /* @__PURE__ */ t.jsx(I, { className: "bg-blue-500 text-white text-xs", children: u }) }),
|
|
@@ -1146,12 +1146,12 @@ function de({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1146
1146
|
"button",
|
|
1147
1147
|
{
|
|
1148
1148
|
type: "button",
|
|
1149
|
-
onClick: () => c(
|
|
1149
|
+
onClick: () => c(p),
|
|
1150
1150
|
className: "ml-1 rounded-full hover:bg-gray-200 p-0.5",
|
|
1151
1151
|
children: /* @__PURE__ */ t.jsx(W, { className: "size-3" })
|
|
1152
1152
|
}
|
|
1153
1153
|
)
|
|
1154
|
-
] },
|
|
1154
|
+
] }, p);
|
|
1155
1155
|
}) }),
|
|
1156
1156
|
/* @__PURE__ */ t.jsx("div", { className: "text-sm text-gray-500 italic", children: "User selection component requires integration with user management system" })
|
|
1157
1157
|
] });
|
|
@@ -1161,7 +1161,7 @@ const Re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1161
1161
|
UserField: de
|
|
1162
1162
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1163
1163
|
function lt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
1164
|
-
const i = n || s.schema, l = () => e == null ? "" : JSON.stringify(e, null, 2), [o, c] = B(l), [m,
|
|
1164
|
+
const i = n || s.schema, l = () => e == null ? "" : JSON.stringify(e, null, 2), [o, c] = B(l), [m, p] = B(null);
|
|
1165
1165
|
if (ze(() => {
|
|
1166
1166
|
try {
|
|
1167
1167
|
if (e == null) {
|
|
@@ -1177,15 +1177,15 @@ function lt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1177
1177
|
return e ? /* @__PURE__ */ t.jsx("pre", { className: z("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", s.className), children: JSON.stringify(e, null, 2) }) : /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
1178
1178
|
const f = (u) => {
|
|
1179
1179
|
const x = u.target.value;
|
|
1180
|
-
if (c(x),
|
|
1180
|
+
if (c(x), p(null), !x.trim()) {
|
|
1181
1181
|
r(null);
|
|
1182
1182
|
return;
|
|
1183
1183
|
}
|
|
1184
1184
|
try {
|
|
1185
|
-
const
|
|
1186
|
-
r(
|
|
1185
|
+
const h = JSON.parse(x);
|
|
1186
|
+
r(h);
|
|
1187
1187
|
} catch {
|
|
1188
|
-
|
|
1188
|
+
p("Invalid JSON");
|
|
1189
1189
|
}
|
|
1190
1190
|
};
|
|
1191
1191
|
return /* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
|
|
@@ -1205,7 +1205,7 @@ function lt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1205
1205
|
m && /* @__PURE__ */ t.jsx("p", { className: "text-xs text-red-500", children: m })
|
|
1206
1206
|
] });
|
|
1207
1207
|
}
|
|
1208
|
-
const
|
|
1208
|
+
const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1209
1209
|
__proto__: null,
|
|
1210
1210
|
ObjectField: lt
|
|
1211
1211
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -1230,7 +1230,7 @@ function it({ value: e, field: r, ...n }) {
|
|
|
1230
1230
|
] })
|
|
1231
1231
|
] });
|
|
1232
1232
|
}
|
|
1233
|
-
const
|
|
1233
|
+
const hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1234
1234
|
__proto__: null,
|
|
1235
1235
|
VectorField: it
|
|
1236
1236
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -1331,7 +1331,7 @@ const jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1331
1331
|
SliderField: dt
|
|
1332
1332
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1333
1333
|
function ut({ value: e, onChange: r, field: n, readonly: a, className: s, ...i }) {
|
|
1334
|
-
const o = (n || i.schema)?.max ?? 5, c = e ?? 0, [m,
|
|
1334
|
+
const o = (n || i.schema)?.max ?? 5, c = e ?? 0, [m, p] = k.useState(null), f = m !== null ? m : c;
|
|
1335
1335
|
return a ? /* @__PURE__ */ t.jsxs("div", { className: z("flex items-center gap-1", s), children: [
|
|
1336
1336
|
Array.from({ length: o }, (u, x) => /* @__PURE__ */ t.jsx(
|
|
1337
1337
|
_e,
|
|
@@ -1351,8 +1351,8 @@ function ut({ value: e, onChange: r, field: n, readonly: a, className: s, ...i }
|
|
|
1351
1351
|
{
|
|
1352
1352
|
type: "button",
|
|
1353
1353
|
onClick: () => r(x + 1),
|
|
1354
|
-
onMouseEnter: () =>
|
|
1355
|
-
onMouseLeave: () =>
|
|
1354
|
+
onMouseEnter: () => p(x + 1),
|
|
1355
|
+
onMouseLeave: () => p(null),
|
|
1356
1356
|
className: "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",
|
|
1357
1357
|
disabled: a || i.disabled,
|
|
1358
1358
|
children: /* @__PURE__ */ t.jsx(
|
|
@@ -1406,11 +1406,11 @@ function ft({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1406
1406
|
console.error("File size must be less than 5MB");
|
|
1407
1407
|
return;
|
|
1408
1408
|
}
|
|
1409
|
-
const
|
|
1410
|
-
|
|
1411
|
-
r(
|
|
1412
|
-
},
|
|
1413
|
-
},
|
|
1409
|
+
const h = new FileReader();
|
|
1410
|
+
h.onloadend = () => {
|
|
1411
|
+
r(h.result);
|
|
1412
|
+
}, h.readAsDataURL(x);
|
|
1413
|
+
}, p = () => {
|
|
1414
1414
|
r("");
|
|
1415
1415
|
}, f = () => (c?.defaultName || c?.label || "User").split(" ").map((x) => x[0]).join("").toUpperCase().slice(0, 2);
|
|
1416
1416
|
return a ? /* @__PURE__ */ t.jsxs(L, { className: "w-16 h-16", children: [
|
|
@@ -1432,7 +1432,7 @@ function ft({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1432
1432
|
"button",
|
|
1433
1433
|
{
|
|
1434
1434
|
type: "button",
|
|
1435
|
-
onClick:
|
|
1435
|
+
onClick: p,
|
|
1436
1436
|
className: "absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",
|
|
1437
1437
|
children: /* @__PURE__ */ t.jsx(W, { className: "w-3 h-3" })
|
|
1438
1438
|
}
|
|
@@ -1568,7 +1568,7 @@ const _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1568
1568
|
__proto__: null,
|
|
1569
1569
|
AddressField: xt
|
|
1570
1570
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1571
|
-
function
|
|
1571
|
+
function pt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
1572
1572
|
const [i, l] = k.useState(!1), o = e || {}, c = (u, x) => {
|
|
1573
1573
|
r({
|
|
1574
1574
|
...o,
|
|
@@ -1596,14 +1596,14 @@ function ht({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1596
1596
|
maximumAge: 0
|
|
1597
1597
|
}
|
|
1598
1598
|
);
|
|
1599
|
-
},
|
|
1599
|
+
}, p = (u) => !u.latitude || !u.longitude ? "-" : `${u.latitude.toFixed(6)}, ${u.longitude.toFixed(6)}`, f = () => {
|
|
1600
1600
|
if (!o.latitude || !o.longitude) return;
|
|
1601
1601
|
const u = `https://www.google.com/maps?q=${o.latitude},${o.longitude}`;
|
|
1602
1602
|
window.open(u, "_blank");
|
|
1603
1603
|
};
|
|
1604
1604
|
return a ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1605
1605
|
/* @__PURE__ */ t.jsx(we, { className: "w-4 h-4 text-muted-foreground" }),
|
|
1606
|
-
/* @__PURE__ */ t.jsx("span", { className: "text-sm", children:
|
|
1606
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-sm", children: p(o) }),
|
|
1607
1607
|
o.latitude && o.longitude && /* @__PURE__ */ t.jsx(
|
|
1608
1608
|
P,
|
|
1609
1609
|
{
|
|
@@ -1687,18 +1687,18 @@ function ht({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1687
1687
|
}
|
|
1688
1688
|
const wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1689
1689
|
__proto__: null,
|
|
1690
|
-
GeolocationField:
|
|
1690
|
+
GeolocationField: pt
|
|
1691
1691
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1692
|
-
function
|
|
1692
|
+
function ht({ value: e, onChange: r, readonly: n }) {
|
|
1693
1693
|
const a = xe(null), [s, i] = k.useState(!1), [l, o] = k.useState(!e);
|
|
1694
1694
|
ze(() => {
|
|
1695
1695
|
if (e && a.current) {
|
|
1696
1696
|
const x = a.current.getContext("2d");
|
|
1697
1697
|
if (x) {
|
|
1698
|
-
const
|
|
1699
|
-
|
|
1700
|
-
x.drawImage(
|
|
1701
|
-
},
|
|
1698
|
+
const h = new Image();
|
|
1699
|
+
h.onload = () => {
|
|
1700
|
+
x.drawImage(h, 0, 0), o(!1);
|
|
1701
|
+
}, h.src = e;
|
|
1702
1702
|
}
|
|
1703
1703
|
}
|
|
1704
1704
|
}, [e]);
|
|
@@ -1707,19 +1707,19 @@ function pt({ value: e, onChange: r, readonly: n }) {
|
|
|
1707
1707
|
i(!0), o(!1);
|
|
1708
1708
|
const x = a.current;
|
|
1709
1709
|
if (!x) return;
|
|
1710
|
-
const
|
|
1711
|
-
if (!
|
|
1710
|
+
const h = x.getContext("2d");
|
|
1711
|
+
if (!h) return;
|
|
1712
1712
|
const v = x.getBoundingClientRect(), R = "touches" in u ? u.touches[0].clientX - v.left : u.clientX - v.left, N = "touches" in u ? u.touches[0].clientY - v.top : u.clientY - v.top;
|
|
1713
|
-
|
|
1713
|
+
h.beginPath(), h.moveTo(R, N);
|
|
1714
1714
|
}, m = (u) => {
|
|
1715
1715
|
if (!s || n) return;
|
|
1716
1716
|
const x = a.current;
|
|
1717
1717
|
if (!x) return;
|
|
1718
|
-
const
|
|
1719
|
-
if (!
|
|
1718
|
+
const h = x.getContext("2d");
|
|
1719
|
+
if (!h) return;
|
|
1720
1720
|
const v = x.getBoundingClientRect(), R = "touches" in u ? u.touches[0].clientX - v.left : u.clientX - v.left, N = "touches" in u ? u.touches[0].clientY - v.top : u.clientY - v.top;
|
|
1721
|
-
|
|
1722
|
-
},
|
|
1721
|
+
h.lineTo(R, N), h.strokeStyle = "#000", h.lineWidth = 2, h.lineCap = "round", h.lineJoin = "round", h.stroke();
|
|
1722
|
+
}, p = () => {
|
|
1723
1723
|
if (!s) return;
|
|
1724
1724
|
i(!1);
|
|
1725
1725
|
const u = a.current;
|
|
@@ -1742,11 +1742,11 @@ function pt({ value: e, onChange: r, readonly: n }) {
|
|
|
1742
1742
|
className: "w-full touch-none cursor-crosshair",
|
|
1743
1743
|
onMouseDown: c,
|
|
1744
1744
|
onMouseMove: m,
|
|
1745
|
-
onMouseUp:
|
|
1746
|
-
onMouseLeave:
|
|
1745
|
+
onMouseUp: p,
|
|
1746
|
+
onMouseLeave: p,
|
|
1747
1747
|
onTouchStart: c,
|
|
1748
1748
|
onTouchMove: m,
|
|
1749
|
-
onTouchEnd:
|
|
1749
|
+
onTouchEnd: p
|
|
1750
1750
|
}
|
|
1751
1751
|
) }),
|
|
1752
1752
|
/* @__PURE__ */ t.jsxs("div", { className: "flex justify-between items-center", children: [
|
|
@@ -1770,10 +1770,10 @@ function pt({ value: e, onChange: r, readonly: n }) {
|
|
|
1770
1770
|
}
|
|
1771
1771
|
const Fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1772
1772
|
__proto__: null,
|
|
1773
|
-
SignatureField:
|
|
1773
|
+
SignatureField: ht
|
|
1774
1774
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1775
1775
|
function gt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
1776
|
-
const [i, l] = k.useState(!1), o = n || s.schema, c = (
|
|
1776
|
+
const [i, l] = k.useState(!1), o = n || s.schema, c = (p) => `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(p)}`, m = () => {
|
|
1777
1777
|
e && navigator.clipboard.writeText(e);
|
|
1778
1778
|
};
|
|
1779
1779
|
return a ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
@@ -1799,7 +1799,7 @@ function gt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1799
1799
|
{
|
|
1800
1800
|
type: "text",
|
|
1801
1801
|
value: e || "",
|
|
1802
|
-
onChange: (
|
|
1802
|
+
onChange: (p) => r(p.target.value),
|
|
1803
1803
|
placeholder: o?.placeholder || "Enter text for QR code",
|
|
1804
1804
|
disabled: a || s.disabled,
|
|
1805
1805
|
className: s.className
|
|
@@ -1813,7 +1813,7 @@ function gt({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
|
1813
1813
|
variant: "outline",
|
|
1814
1814
|
size: "sm",
|
|
1815
1815
|
onClick: m,
|
|
1816
|
-
children: /* @__PURE__ */ t.jsx(
|
|
1816
|
+
children: /* @__PURE__ */ t.jsx(pe, { className: "w-4 h-4" })
|
|
1817
1817
|
}
|
|
1818
1818
|
),
|
|
1819
1819
|
/* @__PURE__ */ t.jsx(
|
|
@@ -1863,7 +1863,7 @@ function bt({
|
|
|
1863
1863
|
r([...l, f]);
|
|
1864
1864
|
}, m = (f) => {
|
|
1865
1865
|
r(l.filter((u) => u.id !== f));
|
|
1866
|
-
},
|
|
1866
|
+
}, p = (f) => {
|
|
1867
1867
|
console.log("View detail:", f);
|
|
1868
1868
|
};
|
|
1869
1869
|
return a ? /* @__PURE__ */ t.jsxs("div", { className: z("space-y-2", s), children: [
|
|
@@ -1879,7 +1879,7 @@ function bt({
|
|
|
1879
1879
|
type: "button",
|
|
1880
1880
|
variant: "ghost",
|
|
1881
1881
|
size: "sm",
|
|
1882
|
-
onClick: () =>
|
|
1882
|
+
onClick: () => p(f),
|
|
1883
1883
|
children: /* @__PURE__ */ t.jsx(Se, { className: "w-4 h-4" })
|
|
1884
1884
|
}
|
|
1885
1885
|
)
|
|
@@ -1910,7 +1910,7 @@ function bt({
|
|
|
1910
1910
|
type: "button",
|
|
1911
1911
|
variant: "ghost",
|
|
1912
1912
|
size: "sm",
|
|
1913
|
-
onClick: () =>
|
|
1913
|
+
onClick: () => p(f),
|
|
1914
1914
|
children: /* @__PURE__ */ t.jsx(Se, { className: "w-4 h-4" })
|
|
1915
1915
|
}
|
|
1916
1916
|
),
|
|
@@ -2070,7 +2070,7 @@ function Er({ value: e, field: r }) {
|
|
|
2070
2070
|
if (e == null)
|
|
2071
2071
|
return /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground/50 text-xs italic flex items-center justify-center", children: "—" });
|
|
2072
2072
|
const n = r?.name?.toLowerCase() || "";
|
|
2073
|
-
return n === "completed" || n === "is_completed" || n === "done" || n === "is_done" ? /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-center", children: e ? /* @__PURE__ */ t.jsx("div", { className: "size-5 rounded-full bg-green-500 flex items-center justify-center", role: "img", "aria-label": "Completed", "data-testid": "completion-indicator", children: /* @__PURE__ */ t.jsx(
|
|
2073
|
+
return n === "completed" || n === "is_completed" || n === "done" || n === "is_done" ? /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-center", children: e ? /* @__PURE__ */ t.jsx("div", { className: "size-5 rounded-full bg-green-500 flex items-center justify-center", role: "img", "aria-label": "Completed", "data-testid": "completion-indicator", children: /* @__PURE__ */ t.jsx(he, { className: "size-3 text-white" }) }) : /* @__PURE__ */ t.jsx("div", { className: "size-5 rounded-full border-2 border-muted-foreground/30", role: "img", "aria-label": "Not completed", "data-testid": "completion-indicator" }) }) : zr.has(n) && !e ? /* @__PURE__ */ t.jsxs(M, { variant: "destructive", className: "text-xs", "data-testid": "boolean-warning-badge", children: [
|
|
2074
2074
|
r?.label || ue(n),
|
|
2075
2075
|
" — Off"
|
|
2076
2076
|
] }) : /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ t.jsx(Ee, { checked: !!e, disabled: !0, className: "pointer-events-none" }) });
|
|
@@ -2108,13 +2108,39 @@ function Mr({ value: e }) {
|
|
|
2108
2108
|
] });
|
|
2109
2109
|
}
|
|
2110
2110
|
const Lr = {
|
|
2111
|
+
// Priority values
|
|
2111
2112
|
critical: "red",
|
|
2112
2113
|
urgent: "red",
|
|
2113
2114
|
high: "orange",
|
|
2114
2115
|
medium: "yellow",
|
|
2115
2116
|
normal: "blue",
|
|
2116
2117
|
low: "gray",
|
|
2117
|
-
none: "gray"
|
|
2118
|
+
none: "gray",
|
|
2119
|
+
// Status values
|
|
2120
|
+
paid: "green",
|
|
2121
|
+
completed: "green",
|
|
2122
|
+
done: "green",
|
|
2123
|
+
active: "green",
|
|
2124
|
+
approved: "green",
|
|
2125
|
+
resolved: "green",
|
|
2126
|
+
pending: "yellow",
|
|
2127
|
+
waiting: "yellow",
|
|
2128
|
+
on_hold: "yellow",
|
|
2129
|
+
shipped: "blue",
|
|
2130
|
+
in_progress: "blue",
|
|
2131
|
+
open: "blue",
|
|
2132
|
+
processing: "blue",
|
|
2133
|
+
draft: "gray",
|
|
2134
|
+
new: "gray",
|
|
2135
|
+
inactive: "gray",
|
|
2136
|
+
closed: "gray",
|
|
2137
|
+
cancelled: "red",
|
|
2138
|
+
canceled: "red",
|
|
2139
|
+
rejected: "red",
|
|
2140
|
+
failed: "red",
|
|
2141
|
+
overdue: "red",
|
|
2142
|
+
delivered: "purple",
|
|
2143
|
+
archived: "indigo"
|
|
2118
2144
|
}, Ir = {
|
|
2119
2145
|
gray: "bg-gray-100 text-gray-800 border-gray-300",
|
|
2120
2146
|
red: "bg-red-100 text-red-800 border-red-300",
|
|
@@ -2127,7 +2153,7 @@ const Lr = {
|
|
|
2127
2153
|
pink: "bg-pink-100 text-pink-800 border-pink-300"
|
|
2128
2154
|
};
|
|
2129
2155
|
function ke(e, r) {
|
|
2130
|
-
const n = e || (r ? Lr[String(r).toLowerCase()] : void 0);
|
|
2156
|
+
const n = e || (r ? Lr[String(r).toLowerCase().replace(/[\s-]/g, "_")] : void 0);
|
|
2131
2157
|
return Ir[n || ""] || "bg-muted text-muted-foreground border-border";
|
|
2132
2158
|
}
|
|
2133
2159
|
function se({ value: e, field: r }) {
|
|
@@ -2135,13 +2161,13 @@ function se({ value: e, field: r }) {
|
|
|
2135
2161
|
if (!e) return /* @__PURE__ */ t.jsx("span", { children: "-" });
|
|
2136
2162
|
if (Array.isArray(e))
|
|
2137
2163
|
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-1", children: e.map((o, c) => {
|
|
2138
|
-
const m = a.find((u) => u.value === o),
|
|
2164
|
+
const m = a.find((u) => u.value === o), p = m?.label || ue(String(o)), f = ke(m?.color, o);
|
|
2139
2165
|
return /* @__PURE__ */ t.jsx(
|
|
2140
2166
|
M,
|
|
2141
2167
|
{
|
|
2142
2168
|
variant: "outline",
|
|
2143
2169
|
className: f,
|
|
2144
|
-
children:
|
|
2170
|
+
children: p
|
|
2145
2171
|
},
|
|
2146
2172
|
c
|
|
2147
2173
|
);
|
|
@@ -2188,7 +2214,7 @@ function Ur({ value: e }) {
|
|
|
2188
2214
|
className: "opacity-0 group-hover/email:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
2189
2215
|
onClick: a,
|
|
2190
2216
|
"aria-label": "Copy email",
|
|
2191
|
-
children: r ? /* @__PURE__ */ t.jsx(
|
|
2217
|
+
children: r ? /* @__PURE__ */ t.jsx(he, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ t.jsx(pe, { className: "h-3 w-3 text-muted-foreground" })
|
|
2192
2218
|
}
|
|
2193
2219
|
)
|
|
2194
2220
|
] });
|
|
@@ -2241,7 +2267,7 @@ function Br({ value: e }) {
|
|
|
2241
2267
|
className: "opacity-0 group-hover/phone:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
2242
2268
|
onClick: a,
|
|
2243
2269
|
"aria-label": "Copy phone number",
|
|
2244
|
-
children: r ? /* @__PURE__ */ t.jsx(
|
|
2270
|
+
children: r ? /* @__PURE__ */ t.jsx(he, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ t.jsx(pe, { className: "h-3 w-3 text-muted-foreground" })
|
|
2245
2271
|
}
|
|
2246
2272
|
)
|
|
2247
2273
|
] });
|
|
@@ -2499,7 +2525,7 @@ function y(e) {
|
|
|
2499
2525
|
...n
|
|
2500
2526
|
}, m = k.useCallback((f) => {
|
|
2501
2527
|
o(f), i.onChange && i.onChange(f);
|
|
2502
|
-
}, [i]),
|
|
2528
|
+
}, [i]), p = n?.readonly || n?.readOnly || !1;
|
|
2503
2529
|
return /* @__PURE__ */ t.jsxs(
|
|
2504
2530
|
"div",
|
|
2505
2531
|
{
|
|
@@ -2514,7 +2540,7 @@ function y(e) {
|
|
|
2514
2540
|
value: l,
|
|
2515
2541
|
onChange: m,
|
|
2516
2542
|
field: c,
|
|
2517
|
-
readonly:
|
|
2543
|
+
readonly: p,
|
|
2518
2544
|
className: a
|
|
2519
2545
|
}
|
|
2520
2546
|
),
|
|
@@ -2560,8 +2586,8 @@ const jt = {
|
|
|
2560
2586
|
user: () => Promise.resolve().then(() => Re).then((e) => ({ default: e.UserField })),
|
|
2561
2587
|
owner: () => Promise.resolve().then(() => Re).then((e) => ({ default: e.UserField })),
|
|
2562
2588
|
// Complex data types
|
|
2563
|
-
object: () => Promise.resolve().then(() =>
|
|
2564
|
-
vector: () => Promise.resolve().then(() =>
|
|
2589
|
+
object: () => Promise.resolve().then(() => pr).then((e) => ({ default: e.ObjectField })),
|
|
2590
|
+
vector: () => Promise.resolve().then(() => hr).then((e) => ({ default: e.VectorField })),
|
|
2565
2591
|
grid: () => Promise.resolve().then(() => gr).then((e) => ({ default: e.GridField })),
|
|
2566
2592
|
// Additional field types from @objectstack/spec
|
|
2567
2593
|
color: () => Promise.resolve().then(() => br).then((e) => ({ default: e.ColorField })),
|
|
@@ -2589,7 +2615,7 @@ function Wr() {
|
|
|
2589
2615
|
});
|
|
2590
2616
|
}
|
|
2591
2617
|
function ns() {
|
|
2592
|
-
g.register("text", y(Le), { namespace: "field" }), g.register("textarea", y(Ge), { namespace: "field" }), g.register("number", y(Ie), { namespace: "field" }), g.register("boolean", y(Ue), { namespace: "field" }), g.register("select", y(Ve), { namespace: "field" }), g.register("date", y(Be), { namespace: "field" }), g.register("datetime", y(He), { namespace: "field" }), g.register("time", y(Xe), { namespace: "field" }), g.register("email", y(Ye), { namespace: "field" }), g.register("phone", y(qe), { namespace: "field" }), g.register("url", y(Je), { namespace: "field" }), g.register("currency", y(We), { namespace: "field" }), g.register("percent", y(Ze), { namespace: "field" }), g.register("password", y(Ke), { namespace: "field" }), g.register("markdown", y(ce), { namespace: "field" }), g.register("html", y(ce), { namespace: "field" }), g.register("lookup", y(Qe), { namespace: "field" }), g.register("master_detail", y(bt), { namespace: "field" }), g.register("file", y(et), { namespace: "field" }), g.register("image", y(tt), { namespace: "field" }), g.register("location", y(rt), { namespace: "field" }), g.register("formula", y(st), { namespace: "field" }), g.register("summary", y(nt), { namespace: "field" }), g.register("auto_number", y(at), { namespace: "field" }), g.register("user", y(de), { namespace: "field" }), g.register("owner", y(de), { namespace: "field" }), g.register("object", y(lt), { namespace: "field" }), g.register("vector", y(it), { namespace: "field" }), g.register("grid", y(ot), { namespace: "field" }), g.register("color", y(ct), { namespace: "field" }), g.register("slider", y(dt), { namespace: "field" }), g.register("rating", y(ut), { namespace: "field" }), g.register("code", y(mt), { namespace: "field" }), g.register("avatar", y(ft), { namespace: "field" }), g.register("address", y(xt), { namespace: "field" }), g.register("geolocation", y(
|
|
2618
|
+
g.register("text", y(Le), { namespace: "field" }), g.register("textarea", y(Ge), { namespace: "field" }), g.register("number", y(Ie), { namespace: "field" }), g.register("boolean", y(Ue), { namespace: "field" }), g.register("select", y(Ve), { namespace: "field" }), g.register("date", y(Be), { namespace: "field" }), g.register("datetime", y(He), { namespace: "field" }), g.register("time", y(Xe), { namespace: "field" }), g.register("email", y(Ye), { namespace: "field" }), g.register("phone", y(qe), { namespace: "field" }), g.register("url", y(Je), { namespace: "field" }), g.register("currency", y(We), { namespace: "field" }), g.register("percent", y(Ze), { namespace: "field" }), g.register("password", y(Ke), { namespace: "field" }), g.register("markdown", y(ce), { namespace: "field" }), g.register("html", y(ce), { namespace: "field" }), g.register("lookup", y(Qe), { namespace: "field" }), g.register("master_detail", y(bt), { namespace: "field" }), g.register("file", y(et), { namespace: "field" }), g.register("image", y(tt), { namespace: "field" }), g.register("location", y(rt), { namespace: "field" }), g.register("formula", y(st), { namespace: "field" }), g.register("summary", y(nt), { namespace: "field" }), g.register("auto_number", y(at), { namespace: "field" }), g.register("user", y(de), { namespace: "field" }), g.register("owner", y(de), { namespace: "field" }), g.register("object", y(lt), { namespace: "field" }), g.register("vector", y(it), { namespace: "field" }), g.register("grid", y(ot), { namespace: "field" }), g.register("color", y(ct), { namespace: "field" }), g.register("slider", y(dt), { namespace: "field" }), g.register("rating", y(ut), { namespace: "field" }), g.register("code", y(mt), { namespace: "field" }), g.register("avatar", y(ft), { namespace: "field" }), g.register("address", y(xt), { namespace: "field" }), g.register("geolocation", y(pt), { namespace: "field" }), g.register("signature", y(ht), { namespace: "field" }), g.register("qrcode", y(gt), { namespace: "field" });
|
|
2593
2619
|
}
|
|
2594
2620
|
Wr();
|
|
2595
2621
|
export {
|
|
@@ -2612,7 +2638,7 @@ export {
|
|
|
2612
2638
|
et as FileField,
|
|
2613
2639
|
Ae as FormulaCellRenderer,
|
|
2614
2640
|
st as FormulaField,
|
|
2615
|
-
|
|
2641
|
+
pt as GeolocationField,
|
|
2616
2642
|
ot as GridField,
|
|
2617
2643
|
qr as ImageCellRenderer,
|
|
2618
2644
|
tt as ImageField,
|
|
@@ -2633,7 +2659,7 @@ export {
|
|
|
2633
2659
|
ce as RichTextField,
|
|
2634
2660
|
se as SelectCellRenderer,
|
|
2635
2661
|
Ve as SelectField,
|
|
2636
|
-
|
|
2662
|
+
ht as SignatureField,
|
|
2637
2663
|
dt as SliderField,
|
|
2638
2664
|
nt as SummaryField,
|
|
2639
2665
|
Ge as TextAreaField,
|