@object-ui/plugin-detail 3.0.3 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/.turbo/turbo-build.log +45 -8
  2. package/dist/AddressField-C07oUOY6.js +96 -0
  3. package/dist/AutoNumberField-BxnFqllo.js +8 -0
  4. package/dist/AvatarField-VThNABzo.js +82 -0
  5. package/dist/BooleanField-CGHKBzAi.js +37 -0
  6. package/dist/CodeField-Co_muhRR.js +21 -0
  7. package/dist/ColorField-DLid_tFz.js +42 -0
  8. package/dist/CurrencyField-Bw-LqANM.js +43 -0
  9. package/dist/DateField-BNHAzMB2.js +21 -0
  10. package/dist/DateTimeField-DjAyn_DQ.js +28 -0
  11. package/dist/EmailField-xoNcSppb.js +31 -0
  12. package/dist/FileField-DbNJwjU2.js +133 -0
  13. package/dist/FormulaField-CJkkwIK8.js +9 -0
  14. package/dist/GeolocationField-C1AnS6VV.js +123 -0
  15. package/dist/GridField-DATAHIKf.js +30 -0
  16. package/dist/ImageField-CEKJpyJp.js +90 -0
  17. package/dist/LocationField-jDWXjlpx.js +31 -0
  18. package/dist/LookupField-DQ08L9UQ.js +96 -0
  19. package/dist/MasterDetailField-Dbk529Ea.js +108 -0
  20. package/dist/NumberField-BVroN9aV.js +26 -0
  21. package/dist/ObjectField-CT3l_IHW.js +48 -0
  22. package/dist/PasswordField-DweVLEE0.js +38 -0
  23. package/dist/PercentField-ZpWUK97K.js +63 -0
  24. package/dist/PhoneField-mw-9fqZ_.js +31 -0
  25. package/dist/QRCodeField-Cbb9ck59.js +77 -0
  26. package/dist/RatingField-CSqgLS6t.js +47 -0
  27. package/dist/RichTextField-BpfBOd99.js +38 -0
  28. package/dist/SelectField-B9Ei-5jl.js +26 -0
  29. package/dist/SignatureField-DgGpHnQ8.js +85 -0
  30. package/dist/SliderField-C6HvOHd8.js +30 -0
  31. package/dist/SummaryField-ugYPYxjP.js +9 -0
  32. package/dist/TextAreaField-BK3RgzY3.js +39 -0
  33. package/dist/TextField-Bvzx3atT.js +32 -0
  34. package/dist/TimeField-Cuz9-Uai.js +21 -0
  35. package/dist/UrlField-B6XHTV73.js +33 -0
  36. package/dist/UserField-ooTul2d6.js +49 -0
  37. package/dist/VectorField-CKg9jdGa.js +25 -0
  38. package/dist/index-CnlyRfY_.js +59461 -0
  39. package/dist/index.js +30 -55026
  40. package/dist/index.umd.cjs +41 -30
  41. package/dist/plugin-detail.css +1 -1
  42. package/dist/src/ActivityTimeline.d.ts +20 -0
  43. package/dist/src/ActivityTimeline.d.ts.map +1 -0
  44. package/dist/src/CommentAttachment.d.ts +25 -0
  45. package/dist/src/CommentAttachment.d.ts.map +1 -0
  46. package/dist/src/CommentInput.d.ts +24 -0
  47. package/dist/src/CommentInput.d.ts.map +1 -0
  48. package/dist/src/DetailSection.d.ts +6 -0
  49. package/dist/src/DetailSection.d.ts.map +1 -1
  50. package/dist/src/DetailView.d.ts +4 -0
  51. package/dist/src/DetailView.d.ts.map +1 -1
  52. package/dist/src/DetailView.stories.d.ts +8 -0
  53. package/dist/src/DetailView.stories.d.ts.map +1 -1
  54. package/dist/src/DiffView.d.ts +24 -0
  55. package/dist/src/DiffView.d.ts.map +1 -0
  56. package/dist/src/FieldChangeItem.d.ts +21 -0
  57. package/dist/src/FieldChangeItem.d.ts.map +1 -0
  58. package/dist/src/InlineCreateRelated.d.ts +32 -0
  59. package/dist/src/InlineCreateRelated.d.ts.map +1 -0
  60. package/dist/src/MentionAutocomplete.d.ts +43 -0
  61. package/dist/src/MentionAutocomplete.d.ts.map +1 -0
  62. package/dist/src/PointInTimeRestore.d.ts +28 -0
  63. package/dist/src/PointInTimeRestore.d.ts.map +1 -0
  64. package/dist/src/ReactionPicker.d.ts +25 -0
  65. package/dist/src/ReactionPicker.d.ts.map +1 -0
  66. package/dist/src/RecordActivityTimeline.d.ts +49 -0
  67. package/dist/src/RecordActivityTimeline.d.ts.map +1 -0
  68. package/dist/src/RecordChatterPanel.d.ts +48 -0
  69. package/dist/src/RecordChatterPanel.d.ts.map +1 -0
  70. package/dist/src/RecordComments.d.ts +20 -0
  71. package/dist/src/RecordComments.d.ts.map +1 -0
  72. package/dist/src/RecordNavigationEnhanced.d.ts +18 -0
  73. package/dist/src/RecordNavigationEnhanced.d.ts.map +1 -0
  74. package/dist/src/RelatedList.d.ts +4 -0
  75. package/dist/src/RelatedList.d.ts.map +1 -1
  76. package/dist/src/RelationshipGraph.d.ts +23 -0
  77. package/dist/src/RelationshipGraph.d.ts.map +1 -0
  78. package/dist/src/RichTextCommentInput.d.ts +24 -0
  79. package/dist/src/RichTextCommentInput.d.ts.map +1 -0
  80. package/dist/src/SubscriptionToggle.d.ts +22 -0
  81. package/dist/src/SubscriptionToggle.d.ts.map +1 -0
  82. package/dist/src/ThreadedReplies.d.ts +26 -0
  83. package/dist/src/ThreadedReplies.d.ts.map +1 -0
  84. package/dist/src/autoLayout.d.ts +34 -0
  85. package/dist/src/autoLayout.d.ts.map +1 -0
  86. package/dist/src/index.d.ts +36 -0
  87. package/dist/src/index.d.ts.map +1 -1
  88. package/dist/src/useDetailTranslation.d.ts +34 -0
  89. package/dist/src/useDetailTranslation.d.ts.map +1 -0
  90. package/package.json +8 -7
  91. package/src/ActivityTimeline.tsx +184 -0
  92. package/src/CommentAttachment.tsx +192 -0
  93. package/src/CommentInput.tsx +81 -0
  94. package/src/DetailSection.tsx +74 -9
  95. package/src/DetailView.stories.tsx +76 -0
  96. package/src/DetailView.tsx +270 -27
  97. package/src/DiffView.tsx +231 -0
  98. package/src/FieldChangeItem.tsx +46 -0
  99. package/src/InlineCreateRelated.tsx +291 -0
  100. package/src/MentionAutocomplete.tsx +123 -0
  101. package/src/PointInTimeRestore.tsx +261 -0
  102. package/src/ReactionPicker.tsx +106 -0
  103. package/src/RecordActivityTimeline.tsx +429 -0
  104. package/src/RecordChatterPanel.tsx +202 -0
  105. package/src/RecordComments.tsx +215 -0
  106. package/src/RecordNavigationEnhanced.tsx +211 -0
  107. package/src/RelatedList.tsx +37 -8
  108. package/src/RelationshipGraph.tsx +286 -0
  109. package/src/RichTextCommentInput.tsx +348 -0
  110. package/src/SubscriptionToggle.tsx +60 -0
  111. package/src/ThreadedReplies.tsx +161 -0
  112. package/src/__tests__/ActivityTimeline.test.tsx +119 -0
  113. package/src/__tests__/ActivityTimelineFiltering.test.tsx +143 -0
  114. package/src/__tests__/CommentInput.test.tsx +57 -0
  115. package/src/__tests__/DetailSection.test.tsx +320 -0
  116. package/src/__tests__/DetailView.test.tsx +415 -1
  117. package/src/__tests__/FieldChangeItem.test.tsx +119 -0
  118. package/src/__tests__/MentionAutocomplete.test.tsx +97 -0
  119. package/src/__tests__/ReactionPicker.test.tsx +113 -0
  120. package/src/__tests__/RecordActivityTimeline.test.tsx +395 -0
  121. package/src/__tests__/RecordChatterPanel.test.tsx +227 -0
  122. package/src/__tests__/RecordComments.test.tsx +96 -0
  123. package/src/__tests__/RecordCommentsPinSearch.test.tsx +133 -0
  124. package/src/__tests__/RelatedList.test.tsx +66 -0
  125. package/src/__tests__/SubscriptionToggle.test.tsx +84 -0
  126. package/src/__tests__/ThreadedReplies.test.tsx +212 -0
  127. package/src/__tests__/autoLayout.test.ts +184 -0
  128. package/src/__tests__/phase12-features.test.tsx +583 -0
  129. package/src/autoLayout.ts +111 -0
  130. package/src/index.tsx +46 -0
  131. package/src/useDetailTranslation.ts +103 -0
@@ -0,0 +1,123 @@
1
+ import { jsxs as a, jsx as i } from "react/jsx-runtime";
2
+ import v from "react";
3
+ import { M as g, B as s, t as N, L as h, I as p } from "./index-CnlyRfY_.js";
4
+ function F({ value: x, onChange: r, field: y, readonly: o, ...n }) {
5
+ const [d, l] = v.useState(!1), t = x || {}, c = (e, m) => {
6
+ r({
7
+ ...t,
8
+ [e]: m ? Number(m) : void 0
9
+ });
10
+ }, f = () => {
11
+ if (!navigator.geolocation) {
12
+ console.error("Geolocation is not supported by this browser");
13
+ return;
14
+ }
15
+ l(!0), navigator.geolocation.getCurrentPosition(
16
+ (e) => {
17
+ r({
18
+ latitude: e.coords.latitude,
19
+ longitude: e.coords.longitude,
20
+ accuracy: e.coords.accuracy
21
+ }), l(!1);
22
+ },
23
+ (e) => {
24
+ console.error("Error getting location:", e.message), l(!1);
25
+ },
26
+ {
27
+ enableHighAccuracy: !0,
28
+ timeout: 5e3,
29
+ maximumAge: 0
30
+ }
31
+ );
32
+ }, b = (e) => !e.latitude || !e.longitude ? "-" : `${e.latitude.toFixed(6)}, ${e.longitude.toFixed(6)}`, u = () => {
33
+ if (!t.latitude || !t.longitude) return;
34
+ const e = `https://www.google.com/maps?q=${t.latitude},${t.longitude}`;
35
+ window.open(e, "_blank");
36
+ };
37
+ return o ? /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
38
+ /* @__PURE__ */ i(g, { className: "w-4 h-4 text-muted-foreground" }),
39
+ /* @__PURE__ */ i("span", { className: "text-sm", children: b(t) }),
40
+ t.latitude && t.longitude && /* @__PURE__ */ i(
41
+ s,
42
+ {
43
+ type: "button",
44
+ variant: "link",
45
+ size: "sm",
46
+ onClick: u,
47
+ className: "p-0 h-auto",
48
+ children: "View on map"
49
+ }
50
+ )
51
+ ] }) : /* @__PURE__ */ a("div", { className: "space-y-3", children: [
52
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
53
+ /* @__PURE__ */ a(
54
+ s,
55
+ {
56
+ type: "button",
57
+ variant: "outline",
58
+ size: "sm",
59
+ onClick: f,
60
+ disabled: o || d,
61
+ children: [
62
+ /* @__PURE__ */ i(N, { className: "w-4 h-4 mr-2" }),
63
+ d ? "Getting location..." : "Use Current Location"
64
+ ]
65
+ }
66
+ ),
67
+ t.latitude && t.longitude && /* @__PURE__ */ a(
68
+ s,
69
+ {
70
+ type: "button",
71
+ variant: "link",
72
+ size: "sm",
73
+ onClick: u,
74
+ children: [
75
+ /* @__PURE__ */ i(g, { className: "w-4 h-4 mr-2" }),
76
+ "View on map"
77
+ ]
78
+ }
79
+ )
80
+ ] }),
81
+ /* @__PURE__ */ a("div", { className: "grid grid-cols-2 gap-3", children: [
82
+ /* @__PURE__ */ a("div", { children: [
83
+ /* @__PURE__ */ i(h, { htmlFor: "latitude", className: "text-xs", children: "Latitude" }),
84
+ /* @__PURE__ */ i(
85
+ p,
86
+ {
87
+ id: "latitude",
88
+ type: "number",
89
+ value: t.latitude ?? "",
90
+ onChange: (e) => c("latitude", e.target.value),
91
+ placeholder: "37.7749",
92
+ disabled: o || n.disabled,
93
+ step: "any",
94
+ className: n.className
95
+ }
96
+ )
97
+ ] }),
98
+ /* @__PURE__ */ a("div", { children: [
99
+ /* @__PURE__ */ i(h, { htmlFor: "longitude", className: "text-xs", children: "Longitude" }),
100
+ /* @__PURE__ */ i(
101
+ p,
102
+ {
103
+ id: "longitude",
104
+ type: "number",
105
+ value: t.longitude ?? "",
106
+ onChange: (e) => c("longitude", e.target.value),
107
+ placeholder: "-122.4194",
108
+ disabled: o || n.disabled,
109
+ step: "any"
110
+ }
111
+ )
112
+ ] })
113
+ ] }),
114
+ t.accuracy && /* @__PURE__ */ a("p", { className: "text-xs text-muted-foreground", children: [
115
+ "Accuracy: ±",
116
+ t.accuracy.toFixed(0),
117
+ "m"
118
+ ] })
119
+ ] });
120
+ }
121
+ export {
122
+ F as GeolocationField
123
+ };
@@ -0,0 +1,30 @@
1
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
+ import { o as i } from "./index-CnlyRfY_.js";
3
+ import "react";
4
+ function f({ value: r, field: l, readonly: m, ...s }) {
5
+ const o = (l || s.schema)?.columns || [];
6
+ return !r || !Array.isArray(r) ? /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "-" }) : m ? /* @__PURE__ */ e("div", { className: i("text-sm", s.className), children: /* @__PURE__ */ t("span", { className: "text-foreground", children: [
7
+ r.length,
8
+ " rows"
9
+ ] }) }) : /* @__PURE__ */ t("div", { className: i("border border-border rounded-lg overflow-hidden", s.className), children: [
10
+ /* @__PURE__ */ e("div", { className: "overflow-auto max-h-60", children: /* @__PURE__ */ t("table", { className: "w-full text-sm", children: [
11
+ /* @__PURE__ */ e("thead", { className: "bg-muted border-b border-border", children: /* @__PURE__ */ e("tr", { children: o.map((d, n) => /* @__PURE__ */ e(
12
+ "th",
13
+ {
14
+ className: "px-3 py-2 text-left text-xs font-medium text-muted-foreground",
15
+ children: d.label || d.name
16
+ },
17
+ n
18
+ )) }) }),
19
+ /* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: r.slice(0, 5).map((d, n) => /* @__PURE__ */ e("tr", { className: "hover:bg-muted/50 transition-colors", children: o.map((a, c) => /* @__PURE__ */ e("td", { className: "px-3 py-2 text-foreground", children: d[a.name] != null ? String(d[a.name]) : "-" }, c)) }, n)) })
20
+ ] }) }),
21
+ r.length > 5 && /* @__PURE__ */ t("div", { className: "bg-muted px-3 py-2 text-xs text-muted-foreground border-t border-border", children: [
22
+ "Showing 5 of ",
23
+ r.length,
24
+ " rows"
25
+ ] })
26
+ ] });
27
+ }
28
+ export {
29
+ f as GridField
30
+ };
@@ -0,0 +1,90 @@
1
+ import { jsx as a, jsxs as l } from "react/jsx-runtime";
2
+ import { useRef as b } from "react";
3
+ import { B as g, X as j, p as z } from "./index-CnlyRfY_.js";
4
+ function R({ value: s, onChange: n, field: u, readonly: h, ...d }) {
5
+ const p = b(null), m = u || d.schema, o = m?.multiple || !1, f = m?.accept ? m.accept.join(",") : "image/*";
6
+ if (h) {
7
+ if (!s) return /* @__PURE__ */ a("span", { className: "text-sm", children: "-" });
8
+ const r = Array.isArray(s) ? s : [s];
9
+ return /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2", children: r.map((e, c) => /* @__PURE__ */ a(
10
+ "img",
11
+ {
12
+ src: e.url || "",
13
+ alt: e.name || `Image ${c + 1}`,
14
+ className: "size-20 rounded-md object-cover border border-gray-200"
15
+ },
16
+ c
17
+ )) });
18
+ }
19
+ const i = s ? Array.isArray(s) ? s : [s] : [], y = (r) => {
20
+ const e = Array.from(r.target.files || []);
21
+ if (e.length === 0) return;
22
+ const c = e.map((t) => ({
23
+ name: t.name,
24
+ original_name: t.name,
25
+ size: t.size,
26
+ mime_type: t.type,
27
+ // In a real implementation, this would upload the image and return a URL
28
+ url: URL.createObjectURL(t)
29
+ }));
30
+ n(o ? [...i, ...c] : c[0]);
31
+ }, N = (r) => {
32
+ if (o) {
33
+ const e = i.filter((c, t) => t !== r);
34
+ n(e.length > 0 ? e : null);
35
+ } else
36
+ n(null);
37
+ };
38
+ return /* @__PURE__ */ l("div", { className: d.className, children: [
39
+ /* @__PURE__ */ a(
40
+ "input",
41
+ {
42
+ ref: p,
43
+ type: "file",
44
+ multiple: o,
45
+ accept: f,
46
+ onChange: y,
47
+ className: "hidden"
48
+ }
49
+ ),
50
+ /* @__PURE__ */ l("div", { className: "space-y-2", children: [
51
+ i.length > 0 && /* @__PURE__ */ a("div", { className: "grid grid-cols-4 gap-2", children: i.map((r, e) => /* @__PURE__ */ l("div", { className: "relative group", children: [
52
+ /* @__PURE__ */ a(
53
+ "img",
54
+ {
55
+ src: r.url || "",
56
+ alt: r.name || `Image ${e + 1}`,
57
+ className: "size-20 rounded-md object-cover border border-gray-200"
58
+ }
59
+ ),
60
+ /* @__PURE__ */ a(
61
+ g,
62
+ {
63
+ type: "button",
64
+ variant: "destructive",
65
+ size: "sm",
66
+ onClick: () => N(e),
67
+ className: "absolute top-1 right-1 h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity",
68
+ children: /* @__PURE__ */ a(j, { className: "size-3" })
69
+ }
70
+ )
71
+ ] }, e)) }),
72
+ /* @__PURE__ */ l(
73
+ g,
74
+ {
75
+ type: "button",
76
+ variant: "outline",
77
+ onClick: () => p.current?.click(),
78
+ className: "w-full",
79
+ children: [
80
+ /* @__PURE__ */ a(z, { className: "size-4 mr-2" }),
81
+ i.length > 0 ? "Add More Images" : "Upload Image"
82
+ ]
83
+ }
84
+ )
85
+ ] })
86
+ ] });
87
+ }
88
+ export {
89
+ R as ImageField
90
+ };
@@ -0,0 +1,31 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { I as u } from "./index-CnlyRfY_.js";
3
+ import "react";
4
+ function x({ value: t, onChange: i, field: d, readonly: n, ...a }) {
5
+ const m = d || a.schema, s = t && typeof t == "object" ? `${t.latitude || 0}, ${t.longitude || 0}` : "";
6
+ return n ? /* @__PURE__ */ r("span", { className: "text-sm", children: s || "-" }) : /* @__PURE__ */ r(
7
+ u,
8
+ {
9
+ type: "text",
10
+ value: s,
11
+ onChange: (p) => {
12
+ const o = p.target.value;
13
+ if (!o.trim()) {
14
+ i(null);
15
+ return;
16
+ }
17
+ const l = o.split(",").map((e) => e.trim());
18
+ if (l.length === 2) {
19
+ const e = parseFloat(l[0]), c = parseFloat(l[1]);
20
+ !isNaN(e) && !isNaN(c) && i({ latitude: e, longitude: c });
21
+ }
22
+ },
23
+ placeholder: m?.placeholder || "latitude, longitude",
24
+ disabled: n || a.disabled,
25
+ className: a.className
26
+ }
27
+ );
28
+ }
29
+ export {
30
+ x as LocationField
31
+ };
@@ -0,0 +1,96 @@
1
+ import { jsx as l, jsxs as r } from "react/jsx-runtime";
2
+ import { useState as y } from "react";
3
+ import { h as u, X as D, D as j, i as k, B, j as C, k as O, l as F, m as I, I as L } from "./index-CnlyRfY_.js";
4
+ function R({ value: s, onChange: n, field: x, readonly: g, ...b }) {
5
+ const [N, f] = y(!1), [h, v] = y(""), c = x || b.schema, o = c?.options || [], i = c.multiple || !1, d = c.display_field || "label", p = o.filter(
6
+ (e) => e.label.toLowerCase().includes(h.toLowerCase())
7
+ ), t = i ? (Array.isArray(s) ? s : []).map(
8
+ (e) => o.find((a) => a.value === e)
9
+ ).filter(Boolean) : s ? [o.find((e) => e.value === s)].filter(Boolean) : [], w = (e) => {
10
+ if (i) {
11
+ const a = Array.isArray(s) ? s : [], m = a.includes(e.value);
12
+ n(m ? a.filter((A) => A !== e.value) : [...a, e.value]);
13
+ } else
14
+ n(e.value), f(!1);
15
+ }, S = (e) => {
16
+ if (i) {
17
+ const a = Array.isArray(s) ? s : [];
18
+ n(a.filter((m) => m !== e));
19
+ } else
20
+ n(null);
21
+ };
22
+ return g ? t.length ? i ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1", children: t.map((e, a) => /* @__PURE__ */ l(u, { variant: "outline", children: e?.[d] || e?.label }, a)) }) : /* @__PURE__ */ l("span", { className: "text-sm", children: t[0]?.[d] || t[0]?.label }) : /* @__PURE__ */ l("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ r("div", { className: "space-y-2", children: [
23
+ t.length > 0 && /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1", children: t.map((e, a) => /* @__PURE__ */ r(
24
+ u,
25
+ {
26
+ variant: "outline",
27
+ className: "gap-1",
28
+ children: [
29
+ e?.[d] || e?.label,
30
+ /* @__PURE__ */ l(
31
+ "button",
32
+ {
33
+ onClick: () => S(e?.value),
34
+ className: "ml-1 hover:text-destructive",
35
+ type: "button",
36
+ "aria-label": `Remove ${e?.[d] || e?.label}`,
37
+ children: /* @__PURE__ */ l(D, { className: "size-3" })
38
+ }
39
+ )
40
+ ]
41
+ },
42
+ a
43
+ )) }),
44
+ /* @__PURE__ */ r(j, { open: N, onOpenChange: f, children: [
45
+ /* @__PURE__ */ l(k, { asChild: !0, children: /* @__PURE__ */ r(
46
+ B,
47
+ {
48
+ variant: "outline",
49
+ className: "w-full justify-start text-left font-normal",
50
+ type: "button",
51
+ children: [
52
+ /* @__PURE__ */ l(C, { className: "mr-2 size-4" }),
53
+ t.length === 0 ? c?.placeholder || "Select..." : i ? `${t.length} selected` : "Change selection"
54
+ ]
55
+ }
56
+ ) }),
57
+ /* @__PURE__ */ r(O, { className: "max-w-md", children: [
58
+ /* @__PURE__ */ l(F, { children: /* @__PURE__ */ r(I, { children: [
59
+ c?.label || "Select",
60
+ " ",
61
+ i && "(multiple)"
62
+ ] }) }),
63
+ /* @__PURE__ */ r("div", { className: "space-y-4", children: [
64
+ /* @__PURE__ */ l(
65
+ L,
66
+ {
67
+ placeholder: "Search...",
68
+ value: h,
69
+ onChange: (e) => v(e.target.value),
70
+ className: "w-full"
71
+ }
72
+ ),
73
+ /* @__PURE__ */ l("div", { className: "max-h-64 overflow-y-auto space-y-1", children: p.length === 0 ? /* @__PURE__ */ l("p", { className: "text-sm text-gray-500 text-center py-4", children: "No options found" }) : p.map((e) => {
74
+ const a = i ? (Array.isArray(s) ? s : []).includes(e.value) : s === e.value;
75
+ return /* @__PURE__ */ r(
76
+ "button",
77
+ {
78
+ onClick: () => w(e),
79
+ className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-gray-100 flex items-center justify-between ${a ? "bg-blue-50 text-blue-700" : ""}`,
80
+ type: "button",
81
+ children: [
82
+ /* @__PURE__ */ l("span", { children: e.label }),
83
+ a && /* @__PURE__ */ l(u, { variant: "default", className: "ml-2", children: "Selected" })
84
+ ]
85
+ },
86
+ e.value
87
+ );
88
+ }) })
89
+ ] })
90
+ ] })
91
+ ] })
92
+ ] });
93
+ }
94
+ export {
95
+ R as LookupField
96
+ };
@@ -0,0 +1,108 @@
1
+ import { jsxs as t, jsx as s } from "react/jsx-runtime";
2
+ import { B as d, n as c, o, h as f, X as g, P as v } from "./index-CnlyRfY_.js";
3
+ import "react";
4
+ function j({
5
+ value: m,
6
+ onChange: n,
7
+ field: h,
8
+ readonly: u,
9
+ className: r,
10
+ ...l
11
+ }) {
12
+ const a = m || [], b = h || l.schema, x = () => {
13
+ const e = {
14
+ id: `new-${Date.now()}`,
15
+ label: "New Related Record"
16
+ };
17
+ n([...a, e]);
18
+ }, p = (e) => {
19
+ n(a.filter((N) => N.id !== e));
20
+ }, i = (e) => {
21
+ console.log("View detail:", e);
22
+ };
23
+ return u ? /* @__PURE__ */ t("div", { className: o("space-y-2", r), children: [
24
+ a.length === 0 ? /* @__PURE__ */ s("span", { className: "text-sm text-muted-foreground", children: "No related records" }) : a.map((e) => /* @__PURE__ */ t(
25
+ "div",
26
+ {
27
+ className: "flex items-center justify-between p-2 border rounded hover:bg-muted/50",
28
+ children: [
29
+ /* @__PURE__ */ s("span", { className: "text-sm", children: e.label }),
30
+ /* @__PURE__ */ s(
31
+ d,
32
+ {
33
+ type: "button",
34
+ variant: "ghost",
35
+ size: "sm",
36
+ onClick: () => i(e),
37
+ children: /* @__PURE__ */ s(c, { className: "w-4 h-4" })
38
+ }
39
+ )
40
+ ]
41
+ },
42
+ e.id
43
+ )),
44
+ /* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: [
45
+ a.length,
46
+ " ",
47
+ a.length === 1 ? "record" : "records"
48
+ ] })
49
+ ] }) : /* @__PURE__ */ t("div", { className: o("space-y-3", r), children: [
50
+ /* @__PURE__ */ t("div", { className: "space-y-2", children: [
51
+ a.map((e) => /* @__PURE__ */ t(
52
+ "div",
53
+ {
54
+ className: "flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",
55
+ children: [
56
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-2 flex-1", children: [
57
+ /* @__PURE__ */ s(f, { variant: "outline", children: e.id }),
58
+ /* @__PURE__ */ s("span", { className: "text-sm flex-1", children: e.label })
59
+ ] }),
60
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: [
61
+ /* @__PURE__ */ s(
62
+ d,
63
+ {
64
+ type: "button",
65
+ variant: "ghost",
66
+ size: "sm",
67
+ onClick: () => i(e),
68
+ children: /* @__PURE__ */ s(c, { className: "w-4 h-4" })
69
+ }
70
+ ),
71
+ /* @__PURE__ */ s(
72
+ d,
73
+ {
74
+ type: "button",
75
+ variant: "ghost",
76
+ size: "sm",
77
+ onClick: () => p(e.id),
78
+ disabled: l.disabled,
79
+ children: /* @__PURE__ */ s(g, { className: "w-4 h-4" })
80
+ }
81
+ )
82
+ ] })
83
+ ]
84
+ },
85
+ e.id
86
+ )),
87
+ a.length === 0 && /* @__PURE__ */ s("div", { className: "text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20", children: "No related records" })
88
+ ] }),
89
+ /* @__PURE__ */ t(
90
+ d,
91
+ {
92
+ type: "button",
93
+ variant: "outline",
94
+ className: "w-full",
95
+ onClick: x,
96
+ disabled: l.disabled,
97
+ children: [
98
+ /* @__PURE__ */ s(v, { className: "w-4 h-4 mr-2" }),
99
+ "Add ",
100
+ b?.label || "Record"
101
+ ]
102
+ }
103
+ )
104
+ ] });
105
+ }
106
+ export {
107
+ j as MasterDetailField
108
+ };
@@ -0,0 +1,26 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { I as c } from "./index-CnlyRfY_.js";
3
+ import "react";
4
+ function f({ value: e, onChange: p, field: l, readonly: t, ...n }) {
5
+ if (t)
6
+ return /* @__PURE__ */ a("span", { className: "text-sm", children: e ?? "-" });
7
+ const r = l || n.schema, o = r?.precision, { inputType: u, ...s } = n;
8
+ return /* @__PURE__ */ a(
9
+ c,
10
+ {
11
+ ...s,
12
+ type: "number",
13
+ value: e ?? "",
14
+ onChange: (m) => {
15
+ const i = m.target.value;
16
+ p(i === "" ? null : Number(i));
17
+ },
18
+ placeholder: r?.placeholder,
19
+ disabled: t || s.disabled,
20
+ step: o ? Math.pow(10, -o) : "any"
21
+ }
22
+ );
23
+ }
24
+ export {
25
+ f as NumberField
26
+ };
@@ -0,0 +1,48 @@
1
+ import { jsx as s, jsxs as x } from "react/jsx-runtime";
2
+ import { useState as g, useEffect as S } from "react";
3
+ import { o as m, T as y } from "./index-CnlyRfY_.js";
4
+ function j({ value: r, onChange: o, field: u, readonly: c, ...t }) {
5
+ const N = u || t.schema, h = () => r == null ? "" : JSON.stringify(r, null, 2), [e, n] = g(h), [i, d] = g(null);
6
+ return S(() => {
7
+ try {
8
+ if (r == null) {
9
+ n("");
10
+ return;
11
+ }
12
+ const l = e ? JSON.parse(e) : null;
13
+ JSON.stringify(l) !== JSON.stringify(r) && n(JSON.stringify(r, null, 2));
14
+ } catch {
15
+ n(JSON.stringify(r, null, 2));
16
+ }
17
+ }, [r, e]), c ? r ? /* @__PURE__ */ s("pre", { className: m("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", t.className), children: JSON.stringify(r, null, 2) }) : /* @__PURE__ */ s("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ x("div", { className: "space-y-1", children: [
18
+ /* @__PURE__ */ s(
19
+ y,
20
+ {
21
+ value: e,
22
+ onChange: (l) => {
23
+ const a = l.target.value;
24
+ if (n(a), d(null), !a.trim()) {
25
+ o(null);
26
+ return;
27
+ }
28
+ try {
29
+ const f = JSON.parse(a);
30
+ o(f);
31
+ } catch {
32
+ d("Invalid JSON");
33
+ }
34
+ },
35
+ placeholder: N?.placeholder || `{
36
+ "key": "value"
37
+ }`,
38
+ disabled: c || t.disabled,
39
+ className: m("font-mono text-xs", i ? "border-red-500 focus-visible:ring-red-500" : "", t.className),
40
+ rows: 6
41
+ }
42
+ ),
43
+ i && /* @__PURE__ */ s("p", { className: "text-xs text-red-500", children: i })
44
+ ] });
45
+ }
46
+ export {
47
+ j as ObjectField
48
+ };
@@ -0,0 +1,38 @@
1
+ import { jsx as s, jsxs as m } from "react/jsx-runtime";
2
+ import { useState as h } from "react";
3
+ import { I as u, B as f, E as g, g as x } from "./index-CnlyRfY_.js";
4
+ function N({ value: o, onChange: l, field: n, readonly: a, className: i, ...t }) {
5
+ const [e, c] = h(!1), p = n || t.schema;
6
+ if (a)
7
+ return /* @__PURE__ */ s("span", { className: "text-sm", children: "••••••••" });
8
+ const { inputType: y, ...r } = t;
9
+ return /* @__PURE__ */ m("div", { className: "relative", children: [
10
+ /* @__PURE__ */ s(
11
+ u,
12
+ {
13
+ ...r,
14
+ type: e ? "text" : "password",
15
+ value: o || "",
16
+ onChange: (d) => l(d.target.value),
17
+ placeholder: p?.placeholder,
18
+ disabled: a || r.disabled,
19
+ className: `pr-10 ${i || ""}`
20
+ }
21
+ ),
22
+ /* @__PURE__ */ s(
23
+ f,
24
+ {
25
+ type: "button",
26
+ variant: "ghost",
27
+ size: "sm",
28
+ className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
29
+ onClick: () => c(!e),
30
+ tabIndex: -1,
31
+ children: e ? /* @__PURE__ */ s(g, { className: "size-4 text-gray-500" }) : /* @__PURE__ */ s(x, { className: "size-4 text-gray-500" })
32
+ }
33
+ )
34
+ ] });
35
+ }
36
+ export {
37
+ N as PasswordField
38
+ };
@@ -0,0 +1,63 @@
1
+ import { jsx as i, jsxs as d } from "react/jsx-runtime";
2
+ import { I as g, f as y } from "./index-CnlyRfY_.js";
3
+ import "react";
4
+ function S({ value: e, onChange: s, field: o, readonly: n, errorMessage: u, className: p, ...a }) {
5
+ const m = o || a.schema, r = m?.precision ?? 2;
6
+ if (n)
7
+ return e == null ? /* @__PURE__ */ i("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ d("span", { className: "text-sm font-medium tabular-nums", children: [
8
+ (e * 100).toFixed(r),
9
+ "%"
10
+ ] });
11
+ const h = e != null ? e * 100 : "", f = e != null ? e * 100 : 0, x = (t) => {
12
+ if (t.target.value === "") {
13
+ s(null);
14
+ return;
15
+ }
16
+ const l = parseFloat(t.target.value), c = isNaN(l) ? null : l / 100;
17
+ s(c);
18
+ }, b = (t) => {
19
+ if (n || a.disabled) return;
20
+ if (!Array.isArray(t) || t.length === 0) {
21
+ s(null);
22
+ return;
23
+ }
24
+ const l = t[0], c = typeof l == "number" ? l / 100 : null;
25
+ s(c);
26
+ }, N = Math.pow(10, -r);
27
+ return /* @__PURE__ */ d("div", { className: "space-y-2", children: [
28
+ /* @__PURE__ */ d("div", { className: "relative", children: [
29
+ /* @__PURE__ */ i(
30
+ g,
31
+ {
32
+ ...a,
33
+ type: "number",
34
+ value: h,
35
+ onChange: x,
36
+ placeholder: m?.placeholder || "0",
37
+ disabled: n || a.disabled,
38
+ className: `pr-8 ${p || ""}`,
39
+ step: Math.pow(10, -r).toFixed(r),
40
+ "aria-invalid": !!u
41
+ }
42
+ ),
43
+ /* @__PURE__ */ i("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500", children: "%" })
44
+ ] }),
45
+ /* @__PURE__ */ i(
46
+ y,
47
+ {
48
+ value: [f],
49
+ onValueChange: b,
50
+ min: 0,
51
+ max: 100,
52
+ step: N,
53
+ disabled: n || a.disabled,
54
+ className: "w-full",
55
+ "aria-label": "Percentage",
56
+ "data-testid": "percent-slider"
57
+ }
58
+ )
59
+ ] });
60
+ }
61
+ export {
62
+ S as PercentField
63
+ };