@object-ui/fields 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +56 -0
- package/dist/fields/src/index.d.ts +143 -0
- package/dist/fields/src/widgets/BooleanField.d.ts +2 -0
- package/dist/fields/src/widgets/CurrencyField.d.ts +2 -0
- package/dist/fields/src/widgets/DateField.d.ts +2 -0
- package/dist/fields/src/widgets/EmailField.d.ts +2 -0
- package/dist/fields/src/widgets/LookupField.d.ts +6 -0
- package/dist/fields/src/widgets/NumberField.d.ts +2 -0
- package/dist/fields/src/widgets/PhoneField.d.ts +2 -0
- package/dist/fields/src/widgets/RichTextField.d.ts +7 -0
- package/dist/fields/src/widgets/SelectField.d.ts +2 -0
- package/dist/fields/src/widgets/TextAreaField.d.ts +2 -0
- package/dist/fields/src/widgets/TextField.d.ts +2 -0
- package/dist/fields/src/widgets/UrlField.d.ts +2 -0
- package/dist/fields/src/widgets/types.d.ts +9 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1060 -0
- package/package.json +52 -0
- package/src/index.tsx +775 -0
- package/src/widgets/BooleanField.tsx +40 -0
- package/src/widgets/CurrencyField.tsx +62 -0
- package/src/widgets/DateField.tsx +19 -0
- package/src/widgets/EmailField.tsx +29 -0
- package/src/widgets/LookupField.tsx +186 -0
- package/src/widgets/NumberField.tsx +27 -0
- package/src/widgets/PhoneField.tsx +29 -0
- package/src/widgets/RichTextField.tsx +42 -0
- package/src/widgets/SelectField.tsx +38 -0
- package/src/widgets/TextAreaField.tsx +41 -0
- package/src/widgets/TextField.tsx +36 -0
- package/src/widgets/UrlField.tsx +38 -0
- package/src/widgets/types.ts +11 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1060 @@
|
|
|
1
|
+
import Ee, { useState as ee } from "react";
|
|
2
|
+
import { Textarea as q, Input as _, Checkbox as Ce, Label as re, Switch as Se, Select as Te, SelectTrigger as Fe, SelectValue as Ae, SelectContent as Oe, SelectItem as Pe, Badge as w, Dialog as $e, DialogTrigger as De, Button as W, DialogContent as Ue, DialogHeader as Ie, DialogTitle as Me, Avatar as Y, AvatarFallback as z } from "@object-ui/components";
|
|
3
|
+
import { X as he, Search as Le, Check as Ye } from "lucide-react";
|
|
4
|
+
import { ComponentRegistry as x } from "@object-ui/core";
|
|
5
|
+
var A = { exports: {} }, C = {};
|
|
6
|
+
var te;
|
|
7
|
+
function ze() {
|
|
8
|
+
if (te) return C;
|
|
9
|
+
te = 1;
|
|
10
|
+
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
11
|
+
function n(s, l, i) {
|
|
12
|
+
var c = null;
|
|
13
|
+
if (i !== void 0 && (c = "" + i), l.key !== void 0 && (c = "" + l.key), "key" in l) {
|
|
14
|
+
i = {};
|
|
15
|
+
for (var m in l)
|
|
16
|
+
m !== "key" && (i[m] = l[m]);
|
|
17
|
+
} else i = l;
|
|
18
|
+
return l = i.ref, {
|
|
19
|
+
$$typeof: e,
|
|
20
|
+
type: s,
|
|
21
|
+
key: c,
|
|
22
|
+
ref: l !== void 0 ? l : null,
|
|
23
|
+
props: i
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return C.Fragment = t, C.jsx = n, C.jsxs = n, C;
|
|
27
|
+
}
|
|
28
|
+
var S = {};
|
|
29
|
+
var ae;
|
|
30
|
+
function Be() {
|
|
31
|
+
return ae || (ae = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
32
|
+
function e(a) {
|
|
33
|
+
if (a == null) return null;
|
|
34
|
+
if (typeof a == "function")
|
|
35
|
+
return a.$$typeof === Re ? null : a.displayName || a.name || null;
|
|
36
|
+
if (typeof a == "string") return a;
|
|
37
|
+
switch (a) {
|
|
38
|
+
case u:
|
|
39
|
+
return "Fragment";
|
|
40
|
+
case E:
|
|
41
|
+
return "Profiler";
|
|
42
|
+
case j:
|
|
43
|
+
return "StrictMode";
|
|
44
|
+
case Ne:
|
|
45
|
+
return "Suspense";
|
|
46
|
+
case ye:
|
|
47
|
+
return "SuspenseList";
|
|
48
|
+
case _e:
|
|
49
|
+
return "Activity";
|
|
50
|
+
}
|
|
51
|
+
if (typeof a == "object")
|
|
52
|
+
switch (typeof a.tag == "number" && console.error(
|
|
53
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
54
|
+
), a.$$typeof) {
|
|
55
|
+
case P:
|
|
56
|
+
return "Portal";
|
|
57
|
+
case be:
|
|
58
|
+
return a.displayName || "Context";
|
|
59
|
+
case $:
|
|
60
|
+
return (a._context.displayName || "Context") + ".Consumer";
|
|
61
|
+
case je:
|
|
62
|
+
var o = a.render;
|
|
63
|
+
return a = a.displayName, a || (a = o.displayName || o.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
|
|
64
|
+
case ve:
|
|
65
|
+
return o = a.displayName || null, o !== null ? o : e(a.type) || "Memo";
|
|
66
|
+
case D:
|
|
67
|
+
o = a._payload, a = a._init;
|
|
68
|
+
try {
|
|
69
|
+
return e(a(o));
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
function t(a) {
|
|
76
|
+
return "" + a;
|
|
77
|
+
}
|
|
78
|
+
function n(a) {
|
|
79
|
+
try {
|
|
80
|
+
t(a);
|
|
81
|
+
var o = !1;
|
|
82
|
+
} catch {
|
|
83
|
+
o = !0;
|
|
84
|
+
}
|
|
85
|
+
if (o) {
|
|
86
|
+
o = console;
|
|
87
|
+
var p = o.error, f = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
|
|
88
|
+
return p.call(
|
|
89
|
+
o,
|
|
90
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
91
|
+
f
|
|
92
|
+
), t(a);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function s(a) {
|
|
96
|
+
if (a === u) return "<>";
|
|
97
|
+
if (typeof a == "object" && a !== null && a.$$typeof === D)
|
|
98
|
+
return "<...>";
|
|
99
|
+
try {
|
|
100
|
+
var o = e(a);
|
|
101
|
+
return o ? "<" + o + ">" : "<...>";
|
|
102
|
+
} catch {
|
|
103
|
+
return "<...>";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function l() {
|
|
107
|
+
var a = U.A;
|
|
108
|
+
return a === null ? null : a.getOwner();
|
|
109
|
+
}
|
|
110
|
+
function i() {
|
|
111
|
+
return Error("react-stack-top-frame");
|
|
112
|
+
}
|
|
113
|
+
function c(a) {
|
|
114
|
+
if (J.call(a, "key")) {
|
|
115
|
+
var o = Object.getOwnPropertyDescriptor(a, "key").get;
|
|
116
|
+
if (o && o.isReactWarning) return !1;
|
|
117
|
+
}
|
|
118
|
+
return a.key !== void 0;
|
|
119
|
+
}
|
|
120
|
+
function m(a, o) {
|
|
121
|
+
function p() {
|
|
122
|
+
X || (X = !0, console.error(
|
|
123
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
124
|
+
o
|
|
125
|
+
));
|
|
126
|
+
}
|
|
127
|
+
p.isReactWarning = !0, Object.defineProperty(a, "key", {
|
|
128
|
+
get: p,
|
|
129
|
+
configurable: !0
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function d() {
|
|
133
|
+
var a = e(this.type);
|
|
134
|
+
return H[a] || (H[a] = !0, console.error(
|
|
135
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
136
|
+
)), a = this.props.ref, a !== void 0 ? a : null;
|
|
137
|
+
}
|
|
138
|
+
function b(a, o, p, f, F, M) {
|
|
139
|
+
var h = p.ref;
|
|
140
|
+
return a = {
|
|
141
|
+
$$typeof: T,
|
|
142
|
+
type: a,
|
|
143
|
+
key: o,
|
|
144
|
+
props: p,
|
|
145
|
+
_owner: f
|
|
146
|
+
}, (h !== void 0 ? h : null) !== null ? Object.defineProperty(a, "ref", {
|
|
147
|
+
enumerable: !1,
|
|
148
|
+
get: d
|
|
149
|
+
}) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
150
|
+
configurable: !1,
|
|
151
|
+
enumerable: !1,
|
|
152
|
+
writable: !0,
|
|
153
|
+
value: 0
|
|
154
|
+
}), Object.defineProperty(a, "_debugInfo", {
|
|
155
|
+
configurable: !1,
|
|
156
|
+
enumerable: !1,
|
|
157
|
+
writable: !0,
|
|
158
|
+
value: null
|
|
159
|
+
}), Object.defineProperty(a, "_debugStack", {
|
|
160
|
+
configurable: !1,
|
|
161
|
+
enumerable: !1,
|
|
162
|
+
writable: !0,
|
|
163
|
+
value: F
|
|
164
|
+
}), Object.defineProperty(a, "_debugTask", {
|
|
165
|
+
configurable: !1,
|
|
166
|
+
enumerable: !1,
|
|
167
|
+
writable: !0,
|
|
168
|
+
value: M
|
|
169
|
+
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
170
|
+
}
|
|
171
|
+
function g(a, o, p, f, F, M) {
|
|
172
|
+
var h = o.children;
|
|
173
|
+
if (h !== void 0)
|
|
174
|
+
if (f)
|
|
175
|
+
if (we(h)) {
|
|
176
|
+
for (f = 0; f < h.length; f++)
|
|
177
|
+
y(h[f]);
|
|
178
|
+
Object.freeze && Object.freeze(h);
|
|
179
|
+
} else
|
|
180
|
+
console.error(
|
|
181
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
182
|
+
);
|
|
183
|
+
else y(h);
|
|
184
|
+
if (J.call(o, "key")) {
|
|
185
|
+
h = e(a);
|
|
186
|
+
var k = Object.keys(o).filter(function(ke) {
|
|
187
|
+
return ke !== "key";
|
|
188
|
+
});
|
|
189
|
+
f = 0 < k.length ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}", K[h + f] || (k = 0 < k.length ? "{" + k.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
190
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
191
|
+
let props = %s;
|
|
192
|
+
<%s {...props} />
|
|
193
|
+
React keys must be passed directly to JSX without using spread:
|
|
194
|
+
let props = %s;
|
|
195
|
+
<%s key={someKey} {...props} />`,
|
|
196
|
+
f,
|
|
197
|
+
h,
|
|
198
|
+
k,
|
|
199
|
+
h
|
|
200
|
+
), K[h + f] = !0);
|
|
201
|
+
}
|
|
202
|
+
if (h = null, p !== void 0 && (n(p), h = "" + p), c(o) && (n(o.key), h = "" + o.key), "key" in o) {
|
|
203
|
+
p = {};
|
|
204
|
+
for (var L in o)
|
|
205
|
+
L !== "key" && (p[L] = o[L]);
|
|
206
|
+
} else p = o;
|
|
207
|
+
return h && m(
|
|
208
|
+
p,
|
|
209
|
+
typeof a == "function" ? a.displayName || a.name || "Unknown" : a
|
|
210
|
+
), b(
|
|
211
|
+
a,
|
|
212
|
+
h,
|
|
213
|
+
p,
|
|
214
|
+
l(),
|
|
215
|
+
F,
|
|
216
|
+
M
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
function y(a) {
|
|
220
|
+
R(a) ? a._store && (a._store.validated = 1) : typeof a == "object" && a !== null && a.$$typeof === D && (a._payload.status === "fulfilled" ? R(a._payload.value) && a._payload.value._store && (a._payload.value._store.validated = 1) : a._store && (a._store.validated = 1));
|
|
221
|
+
}
|
|
222
|
+
function R(a) {
|
|
223
|
+
return typeof a == "object" && a !== null && a.$$typeof === T;
|
|
224
|
+
}
|
|
225
|
+
var N = Ee, T = /* @__PURE__ */ Symbol.for("react.transitional.element"), P = /* @__PURE__ */ Symbol.for("react.portal"), u = /* @__PURE__ */ Symbol.for("react.fragment"), j = /* @__PURE__ */ Symbol.for("react.strict_mode"), E = /* @__PURE__ */ Symbol.for("react.profiler"), $ = /* @__PURE__ */ Symbol.for("react.consumer"), be = /* @__PURE__ */ Symbol.for("react.context"), je = /* @__PURE__ */ Symbol.for("react.forward_ref"), Ne = /* @__PURE__ */ Symbol.for("react.suspense"), ye = /* @__PURE__ */ Symbol.for("react.suspense_list"), ve = /* @__PURE__ */ Symbol.for("react.memo"), D = /* @__PURE__ */ Symbol.for("react.lazy"), _e = /* @__PURE__ */ Symbol.for("react.activity"), Re = /* @__PURE__ */ Symbol.for("react.client.reference"), U = N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, we = Array.isArray, I = console.createTask ? console.createTask : function() {
|
|
226
|
+
return null;
|
|
227
|
+
};
|
|
228
|
+
N = {
|
|
229
|
+
react_stack_bottom_frame: function(a) {
|
|
230
|
+
return a();
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
var X, H = {}, Q = N.react_stack_bottom_frame.bind(
|
|
234
|
+
N,
|
|
235
|
+
i
|
|
236
|
+
)(), Z = I(s(i)), K = {};
|
|
237
|
+
S.Fragment = u, S.jsx = function(a, o, p) {
|
|
238
|
+
var f = 1e4 > U.recentlyCreatedOwnerStacks++;
|
|
239
|
+
return g(
|
|
240
|
+
a,
|
|
241
|
+
o,
|
|
242
|
+
p,
|
|
243
|
+
!1,
|
|
244
|
+
f ? Error("react-stack-top-frame") : Q,
|
|
245
|
+
f ? I(s(a)) : Z
|
|
246
|
+
);
|
|
247
|
+
}, S.jsxs = function(a, o, p) {
|
|
248
|
+
var f = 1e4 > U.recentlyCreatedOwnerStacks++;
|
|
249
|
+
return g(
|
|
250
|
+
a,
|
|
251
|
+
o,
|
|
252
|
+
p,
|
|
253
|
+
!0,
|
|
254
|
+
f ? Error("react-stack-top-frame") : Q,
|
|
255
|
+
f ? I(s(a)) : Z
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
})()), S;
|
|
259
|
+
}
|
|
260
|
+
var ne;
|
|
261
|
+
function Ve() {
|
|
262
|
+
return ne || (ne = 1, process.env.NODE_ENV === "production" ? A.exports = ze() : A.exports = Be()), A.exports;
|
|
263
|
+
}
|
|
264
|
+
var r = Ve();
|
|
265
|
+
function se({ value: e, onChange: t, field: n, readonly: s, ...l }) {
|
|
266
|
+
if (s)
|
|
267
|
+
return /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: e || "-" });
|
|
268
|
+
const i = n.rows;
|
|
269
|
+
return i && i > 1 ? /* @__PURE__ */ r.jsx(
|
|
270
|
+
q,
|
|
271
|
+
{
|
|
272
|
+
value: e || "",
|
|
273
|
+
onChange: (c) => t(c.target.value),
|
|
274
|
+
placeholder: n.placeholder,
|
|
275
|
+
disabled: s,
|
|
276
|
+
className: l.className
|
|
277
|
+
}
|
|
278
|
+
) : /* @__PURE__ */ r.jsx(
|
|
279
|
+
_,
|
|
280
|
+
{
|
|
281
|
+
type: n.type === "password" ? "password" : "text",
|
|
282
|
+
value: e || "",
|
|
283
|
+
onChange: (c) => t(c.target.value),
|
|
284
|
+
placeholder: n.placeholder,
|
|
285
|
+
disabled: s,
|
|
286
|
+
className: l.className
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
function le({ value: e, onChange: t, field: n, readonly: s, ...l }) {
|
|
291
|
+
if (s)
|
|
292
|
+
return /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: e ?? "-" });
|
|
293
|
+
const i = n.precision;
|
|
294
|
+
return /* @__PURE__ */ r.jsx(
|
|
295
|
+
_,
|
|
296
|
+
{
|
|
297
|
+
type: "number",
|
|
298
|
+
value: e ?? "",
|
|
299
|
+
onChange: (c) => {
|
|
300
|
+
const m = c.target.value;
|
|
301
|
+
t(m === "" ? null : Number(m));
|
|
302
|
+
},
|
|
303
|
+
placeholder: n.placeholder,
|
|
304
|
+
disabled: s,
|
|
305
|
+
step: i ? Math.pow(10, -i) : "any",
|
|
306
|
+
className: l.className
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
function qe({ value: e, onChange: t, field: n, readonly: s, ...l }) {
|
|
311
|
+
return s ? /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: e ? "Yes" : "No" }) : n.widget === "checkbox" ? /* @__PURE__ */ r.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
312
|
+
/* @__PURE__ */ r.jsx(
|
|
313
|
+
Ce,
|
|
314
|
+
{
|
|
315
|
+
id: n.name,
|
|
316
|
+
checked: !!e,
|
|
317
|
+
onCheckedChange: (c) => t(!!c),
|
|
318
|
+
disabled: s,
|
|
319
|
+
className: l.className
|
|
320
|
+
}
|
|
321
|
+
),
|
|
322
|
+
/* @__PURE__ */ r.jsx(re, { htmlFor: n.name, children: n.label })
|
|
323
|
+
] }) : /* @__PURE__ */ r.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
324
|
+
/* @__PURE__ */ r.jsx(
|
|
325
|
+
Se,
|
|
326
|
+
{
|
|
327
|
+
id: n.name,
|
|
328
|
+
checked: !!e,
|
|
329
|
+
onCheckedChange: t,
|
|
330
|
+
disabled: s,
|
|
331
|
+
className: l.className
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
/* @__PURE__ */ r.jsx(re, { htmlFor: n.name, children: n.label })
|
|
335
|
+
] });
|
|
336
|
+
}
|
|
337
|
+
function We({ value: e, onChange: t, field: n, readonly: s, ...l }) {
|
|
338
|
+
const i = n.options || [];
|
|
339
|
+
if (s) {
|
|
340
|
+
const c = i.find((m) => m.value === e);
|
|
341
|
+
return /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: c?.label || e || "-" });
|
|
342
|
+
}
|
|
343
|
+
return /* @__PURE__ */ r.jsxs(
|
|
344
|
+
Te,
|
|
345
|
+
{
|
|
346
|
+
value: e,
|
|
347
|
+
onValueChange: t,
|
|
348
|
+
disabled: s,
|
|
349
|
+
children: [
|
|
350
|
+
/* @__PURE__ */ r.jsx(Fe, { className: l.className, children: /* @__PURE__ */ r.jsx(Ae, { placeholder: n.placeholder || "Select an option" }) }),
|
|
351
|
+
/* @__PURE__ */ r.jsx(Oe, { children: i.map((c) => /* @__PURE__ */ r.jsx(Pe, { value: c.value, children: c.label }, c.value)) })
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
function Ge({ value: e, onChange: t, field: n, readonly: s, ...l }) {
|
|
357
|
+
return s ? /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: e ? new Date(e).toLocaleDateString() : "-" }) : /* @__PURE__ */ r.jsx(
|
|
358
|
+
_,
|
|
359
|
+
{
|
|
360
|
+
type: "date",
|
|
361
|
+
value: e || "",
|
|
362
|
+
onChange: (i) => t(i.target.value),
|
|
363
|
+
disabled: s,
|
|
364
|
+
className: l.className
|
|
365
|
+
}
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
function ie({ value: e, onChange: t, field: n, readonly: s, errorMessage: l, ...i }) {
|
|
369
|
+
return s ? e ? /* @__PURE__ */ r.jsx(
|
|
370
|
+
"a",
|
|
371
|
+
{
|
|
372
|
+
href: `mailto:${e}`,
|
|
373
|
+
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
374
|
+
children: e
|
|
375
|
+
}
|
|
376
|
+
) : /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ r.jsx(
|
|
377
|
+
_,
|
|
378
|
+
{
|
|
379
|
+
type: "email",
|
|
380
|
+
value: e || "",
|
|
381
|
+
onChange: (c) => t(c.target.value),
|
|
382
|
+
placeholder: n.placeholder || "email@example.com",
|
|
383
|
+
disabled: s,
|
|
384
|
+
className: i.className,
|
|
385
|
+
"aria-invalid": !!l
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
function ce({ value: e, onChange: t, field: n, readonly: s, errorMessage: l, ...i }) {
|
|
390
|
+
return s ? e ? /* @__PURE__ */ r.jsx(
|
|
391
|
+
"a",
|
|
392
|
+
{
|
|
393
|
+
href: `tel:${e}`,
|
|
394
|
+
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
395
|
+
children: e
|
|
396
|
+
}
|
|
397
|
+
) : /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ r.jsx(
|
|
398
|
+
_,
|
|
399
|
+
{
|
|
400
|
+
type: "tel",
|
|
401
|
+
value: e || "",
|
|
402
|
+
onChange: (c) => t(c.target.value),
|
|
403
|
+
placeholder: n.placeholder || "(555) 123-4567",
|
|
404
|
+
disabled: s,
|
|
405
|
+
className: i.className,
|
|
406
|
+
"aria-invalid": !!l
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
function oe({ value: e, onChange: t, field: n, readonly: s, errorMessage: l, ...i }) {
|
|
411
|
+
return s ? e ? e.startsWith("http://") || e.startsWith("https://") ? /* @__PURE__ */ r.jsx(
|
|
412
|
+
"a",
|
|
413
|
+
{
|
|
414
|
+
href: e,
|
|
415
|
+
target: "_blank",
|
|
416
|
+
rel: "noopener noreferrer",
|
|
417
|
+
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
418
|
+
children: e
|
|
419
|
+
}
|
|
420
|
+
) : /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: e }) : /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ r.jsx(
|
|
421
|
+
_,
|
|
422
|
+
{
|
|
423
|
+
type: "url",
|
|
424
|
+
value: e || "",
|
|
425
|
+
onChange: (c) => t(c.target.value),
|
|
426
|
+
placeholder: n.placeholder || "https://example.com",
|
|
427
|
+
disabled: s,
|
|
428
|
+
className: i.className,
|
|
429
|
+
"aria-invalid": !!l
|
|
430
|
+
}
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
function Je(e, t = "USD") {
|
|
434
|
+
try {
|
|
435
|
+
return new Intl.NumberFormat("en-US", {
|
|
436
|
+
style: "currency",
|
|
437
|
+
currency: t
|
|
438
|
+
}).format(e);
|
|
439
|
+
} catch {
|
|
440
|
+
return `${t} ${e.toFixed(2)}`;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
function ue({ value: e, onChange: t, field: n, readonly: s, errorMessage: l, ...i }) {
|
|
444
|
+
const c = n, m = c.currency || "USD", d = c.precision ?? 2;
|
|
445
|
+
if (s)
|
|
446
|
+
return e == null ? /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ r.jsx("span", { className: "text-sm font-medium tabular-nums", children: Je(Number(e), m) });
|
|
447
|
+
const b = (g) => {
|
|
448
|
+
const y = parseFloat(g.target.value);
|
|
449
|
+
isNaN(y) || t(parseFloat(y.toFixed(d)));
|
|
450
|
+
};
|
|
451
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
452
|
+
/* @__PURE__ */ r.jsx("span", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500", children: m === "USD" ? "$" : m }),
|
|
453
|
+
/* @__PURE__ */ r.jsx(
|
|
454
|
+
_,
|
|
455
|
+
{
|
|
456
|
+
type: "number",
|
|
457
|
+
value: e ?? "",
|
|
458
|
+
onChange: (g) => {
|
|
459
|
+
const y = g.target.value === "" ? null : parseFloat(g.target.value);
|
|
460
|
+
t(y);
|
|
461
|
+
},
|
|
462
|
+
onBlur: b,
|
|
463
|
+
placeholder: n.placeholder || "0.00",
|
|
464
|
+
disabled: s,
|
|
465
|
+
className: `pl-8 ${i.className || ""}`,
|
|
466
|
+
step: Math.pow(10, -d).toFixed(d),
|
|
467
|
+
"aria-invalid": !!l
|
|
468
|
+
}
|
|
469
|
+
)
|
|
470
|
+
] });
|
|
471
|
+
}
|
|
472
|
+
function me({ value: e, onChange: t, field: n, readonly: s, errorMessage: l, ...i }) {
|
|
473
|
+
if (s)
|
|
474
|
+
return /* @__PURE__ */ r.jsx("div", { className: "text-sm whitespace-pre-wrap", children: e || "-" });
|
|
475
|
+
const c = n, m = c.rows || 4, d = c.max_length;
|
|
476
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
477
|
+
/* @__PURE__ */ r.jsx(
|
|
478
|
+
q,
|
|
479
|
+
{
|
|
480
|
+
value: e || "",
|
|
481
|
+
onChange: (b) => t(b.target.value),
|
|
482
|
+
placeholder: n.placeholder,
|
|
483
|
+
disabled: s,
|
|
484
|
+
rows: m,
|
|
485
|
+
maxLength: d,
|
|
486
|
+
className: i.className,
|
|
487
|
+
"aria-invalid": !!l
|
|
488
|
+
}
|
|
489
|
+
),
|
|
490
|
+
d && /* @__PURE__ */ r.jsxs(
|
|
491
|
+
"div",
|
|
492
|
+
{
|
|
493
|
+
className: "absolute bottom-2 right-2 text-xs text-gray-400",
|
|
494
|
+
"aria-live": "polite",
|
|
495
|
+
"aria-label": `Character count: ${(e || "").length} of ${d}`,
|
|
496
|
+
children: [
|
|
497
|
+
(e || "").length,
|
|
498
|
+
"/",
|
|
499
|
+
d
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
] });
|
|
504
|
+
}
|
|
505
|
+
function de({ value: e, onChange: t, field: n, readonly: s, errorMessage: l, ...i }) {
|
|
506
|
+
if (s)
|
|
507
|
+
return /* @__PURE__ */ r.jsx(
|
|
508
|
+
"div",
|
|
509
|
+
{
|
|
510
|
+
className: "text-sm prose prose-sm max-w-none",
|
|
511
|
+
children: e || "-"
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
const c = n, m = c.rows || 8, d = c.format || "markdown";
|
|
515
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "space-y-2", children: [
|
|
516
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center justify-between text-xs text-gray-500", children: [
|
|
517
|
+
/* @__PURE__ */ r.jsxs("span", { children: [
|
|
518
|
+
"Format: ",
|
|
519
|
+
d
|
|
520
|
+
] }),
|
|
521
|
+
/* @__PURE__ */ r.jsx("span", { className: "italic", children: "Rich text editor (basic)" })
|
|
522
|
+
] }),
|
|
523
|
+
/* @__PURE__ */ r.jsx(
|
|
524
|
+
q,
|
|
525
|
+
{
|
|
526
|
+
value: e || "",
|
|
527
|
+
onChange: (b) => t(b.target.value),
|
|
528
|
+
placeholder: n.placeholder || "Enter text...",
|
|
529
|
+
disabled: s,
|
|
530
|
+
rows: m,
|
|
531
|
+
className: `font-mono text-sm ${i.className || ""}`,
|
|
532
|
+
"aria-invalid": !!l
|
|
533
|
+
}
|
|
534
|
+
)
|
|
535
|
+
] });
|
|
536
|
+
}
|
|
537
|
+
function B({ value: e, onChange: t, field: n, readonly: s }) {
|
|
538
|
+
const [l, i] = ee(!1), [c, m] = ee(""), d = n, b = d.options || [], g = d.multiple || !1, y = d.display_field || "label", R = b.filter(
|
|
539
|
+
(u) => u.label.toLowerCase().includes(c.toLowerCase())
|
|
540
|
+
), N = g ? (Array.isArray(e) ? e : []).map(
|
|
541
|
+
(u) => b.find((j) => j.value === u)
|
|
542
|
+
).filter(Boolean) : e ? [b.find((u) => u.value === e)].filter(Boolean) : [], T = (u) => {
|
|
543
|
+
if (g) {
|
|
544
|
+
const j = Array.isArray(e) ? e : [], E = j.includes(u.value);
|
|
545
|
+
t(E ? j.filter(($) => $ !== u.value) : [...j, u.value]);
|
|
546
|
+
} else
|
|
547
|
+
t(u.value), i(!1);
|
|
548
|
+
}, P = (u) => {
|
|
549
|
+
if (g) {
|
|
550
|
+
const j = Array.isArray(e) ? e : [];
|
|
551
|
+
t(j.filter((E) => E !== u));
|
|
552
|
+
} else
|
|
553
|
+
t(null);
|
|
554
|
+
};
|
|
555
|
+
return s ? N.length ? g ? /* @__PURE__ */ r.jsx("div", { className: "flex flex-wrap gap-1", children: N.map((u, j) => /* @__PURE__ */ r.jsx(w, { variant: "outline", children: u?.[y] || u?.label }, j)) }) : /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: N[0]?.[y] || N[0]?.label }) : /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ r.jsxs("div", { className: "space-y-2", children: [
|
|
556
|
+
N.length > 0 && /* @__PURE__ */ r.jsx("div", { className: "flex flex-wrap gap-1", children: N.map((u, j) => /* @__PURE__ */ r.jsxs(
|
|
557
|
+
w,
|
|
558
|
+
{
|
|
559
|
+
variant: "outline",
|
|
560
|
+
className: "gap-1",
|
|
561
|
+
children: [
|
|
562
|
+
u?.[y] || u?.label,
|
|
563
|
+
/* @__PURE__ */ r.jsx(
|
|
564
|
+
"button",
|
|
565
|
+
{
|
|
566
|
+
onClick: () => P(u?.value),
|
|
567
|
+
className: "ml-1 hover:text-destructive",
|
|
568
|
+
type: "button",
|
|
569
|
+
"aria-label": `Remove ${u?.[y] || u?.label}`,
|
|
570
|
+
children: /* @__PURE__ */ r.jsx(he, { className: "size-3" })
|
|
571
|
+
}
|
|
572
|
+
)
|
|
573
|
+
]
|
|
574
|
+
},
|
|
575
|
+
j
|
|
576
|
+
)) }),
|
|
577
|
+
/* @__PURE__ */ r.jsxs($e, { open: l, onOpenChange: i, children: [
|
|
578
|
+
/* @__PURE__ */ r.jsx(De, { asChild: !0, children: /* @__PURE__ */ r.jsxs(
|
|
579
|
+
W,
|
|
580
|
+
{
|
|
581
|
+
variant: "outline",
|
|
582
|
+
className: "w-full justify-start text-left font-normal",
|
|
583
|
+
type: "button",
|
|
584
|
+
children: [
|
|
585
|
+
/* @__PURE__ */ r.jsx(Le, { className: "mr-2 size-4" }),
|
|
586
|
+
N.length === 0 ? n.placeholder || "Select..." : g ? `${N.length} selected` : "Change selection"
|
|
587
|
+
]
|
|
588
|
+
}
|
|
589
|
+
) }),
|
|
590
|
+
/* @__PURE__ */ r.jsxs(Ue, { className: "max-w-md", children: [
|
|
591
|
+
/* @__PURE__ */ r.jsx(Ie, { children: /* @__PURE__ */ r.jsxs(Me, { children: [
|
|
592
|
+
n.label || "Select",
|
|
593
|
+
" ",
|
|
594
|
+
g && "(multiple)"
|
|
595
|
+
] }) }),
|
|
596
|
+
/* @__PURE__ */ r.jsxs("div", { className: "space-y-4", children: [
|
|
597
|
+
/* @__PURE__ */ r.jsx(
|
|
598
|
+
_,
|
|
599
|
+
{
|
|
600
|
+
placeholder: "Search...",
|
|
601
|
+
value: c,
|
|
602
|
+
onChange: (u) => m(u.target.value),
|
|
603
|
+
className: "w-full"
|
|
604
|
+
}
|
|
605
|
+
),
|
|
606
|
+
/* @__PURE__ */ r.jsx("div", { className: "max-h-64 overflow-y-auto space-y-1", children: R.length === 0 ? /* @__PURE__ */ r.jsx("p", { className: "text-sm text-gray-500 text-center py-4", children: "No options found" }) : R.map((u) => {
|
|
607
|
+
const j = g ? (Array.isArray(e) ? e : []).includes(u.value) : e === u.value;
|
|
608
|
+
return /* @__PURE__ */ r.jsxs(
|
|
609
|
+
"button",
|
|
610
|
+
{
|
|
611
|
+
onClick: () => T(u),
|
|
612
|
+
className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-gray-100 flex items-center justify-between ${j ? "bg-blue-50 text-blue-700" : ""}`,
|
|
613
|
+
type: "button",
|
|
614
|
+
children: [
|
|
615
|
+
/* @__PURE__ */ r.jsx("span", { children: u.label }),
|
|
616
|
+
j && /* @__PURE__ */ r.jsx(w, { variant: "default", className: "ml-2", children: "Selected" })
|
|
617
|
+
]
|
|
618
|
+
},
|
|
619
|
+
u.value
|
|
620
|
+
);
|
|
621
|
+
}) })
|
|
622
|
+
] })
|
|
623
|
+
] })
|
|
624
|
+
] })
|
|
625
|
+
] });
|
|
626
|
+
}
|
|
627
|
+
function Xe(e, t = "USD") {
|
|
628
|
+
try {
|
|
629
|
+
return new Intl.NumberFormat("en-US", {
|
|
630
|
+
style: "currency",
|
|
631
|
+
currency: t
|
|
632
|
+
}).format(e);
|
|
633
|
+
} catch {
|
|
634
|
+
return `${t} ${e.toFixed(2)}`;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
function He(e, t = 2) {
|
|
638
|
+
return `${(e * 100).toFixed(t)}%`;
|
|
639
|
+
}
|
|
640
|
+
function Qe(e, t) {
|
|
641
|
+
if (!e) return "-";
|
|
642
|
+
const n = typeof e == "string" ? new Date(e) : e;
|
|
643
|
+
return isNaN(n.getTime()) ? "-" : n.toLocaleDateString("en-US", {
|
|
644
|
+
year: "numeric",
|
|
645
|
+
month: "short",
|
|
646
|
+
day: "numeric"
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
function Ze(e) {
|
|
650
|
+
if (!e) return "-";
|
|
651
|
+
const t = typeof e == "string" ? new Date(e) : e;
|
|
652
|
+
return isNaN(t.getTime()) ? "-" : t.toLocaleDateString("en-US", {
|
|
653
|
+
year: "numeric",
|
|
654
|
+
month: "short",
|
|
655
|
+
day: "numeric",
|
|
656
|
+
hour: "2-digit",
|
|
657
|
+
minute: "2-digit"
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
function v({ value: e }) {
|
|
661
|
+
return /* @__PURE__ */ r.jsx("span", { className: "truncate", children: e || "-" });
|
|
662
|
+
}
|
|
663
|
+
function Ke({ value: e, field: t }) {
|
|
664
|
+
if (e == null) return /* @__PURE__ */ r.jsx("span", { children: "-" });
|
|
665
|
+
const s = t.precision ?? 0, l = typeof e == "number" ? e.toFixed(s) : e;
|
|
666
|
+
return /* @__PURE__ */ r.jsx("span", { className: "tabular-nums", children: l });
|
|
667
|
+
}
|
|
668
|
+
function er({ value: e, field: t }) {
|
|
669
|
+
if (e == null) return /* @__PURE__ */ r.jsx("span", { children: "-" });
|
|
670
|
+
const s = t.currency || "USD", l = Xe(Number(e), s);
|
|
671
|
+
return /* @__PURE__ */ r.jsx("span", { className: "tabular-nums font-medium", children: l });
|
|
672
|
+
}
|
|
673
|
+
function rr({ value: e, field: t }) {
|
|
674
|
+
if (e == null) return /* @__PURE__ */ r.jsx("span", { children: "-" });
|
|
675
|
+
const s = t.precision ?? 2, l = He(Number(e), s);
|
|
676
|
+
return /* @__PURE__ */ r.jsx("span", { className: "tabular-nums", children: l });
|
|
677
|
+
}
|
|
678
|
+
function tr({ value: e }) {
|
|
679
|
+
return /* @__PURE__ */ r.jsx("div", { className: "flex items-center", children: e ? /* @__PURE__ */ r.jsxs(w, { variant: "outline", className: "bg-green-50 text-green-700 border-green-200 gap-1", children: [
|
|
680
|
+
/* @__PURE__ */ r.jsx(Ye, { className: "size-3" }),
|
|
681
|
+
"True"
|
|
682
|
+
] }) : /* @__PURE__ */ r.jsxs(w, { variant: "outline", className: "bg-gray-50 text-gray-500 border-gray-200 gap-1", children: [
|
|
683
|
+
/* @__PURE__ */ r.jsx(he, { className: "size-3" }),
|
|
684
|
+
"False"
|
|
685
|
+
] }) });
|
|
686
|
+
}
|
|
687
|
+
function ar({ value: e, field: t }) {
|
|
688
|
+
const s = Qe(e, t.format);
|
|
689
|
+
return /* @__PURE__ */ r.jsx("span", { className: "tabular-nums", children: s });
|
|
690
|
+
}
|
|
691
|
+
function nr({ value: e }) {
|
|
692
|
+
const t = Ze(e);
|
|
693
|
+
return /* @__PURE__ */ r.jsx("span", { className: "tabular-nums text-sm", children: t });
|
|
694
|
+
}
|
|
695
|
+
function O({ value: e, field: t }) {
|
|
696
|
+
const s = t.options || [];
|
|
697
|
+
if (!e) return /* @__PURE__ */ r.jsx("span", { children: "-" });
|
|
698
|
+
const l = (d) => {
|
|
699
|
+
const b = {
|
|
700
|
+
gray: "bg-gray-100 text-gray-800 border-gray-300",
|
|
701
|
+
red: "bg-red-100 text-red-800 border-red-300",
|
|
702
|
+
orange: "bg-orange-100 text-orange-800 border-orange-300",
|
|
703
|
+
yellow: "bg-yellow-100 text-yellow-800 border-yellow-300",
|
|
704
|
+
green: "bg-green-100 text-green-800 border-green-300",
|
|
705
|
+
blue: "bg-blue-100 text-blue-800 border-blue-300",
|
|
706
|
+
indigo: "bg-indigo-100 text-indigo-800 border-indigo-300",
|
|
707
|
+
purple: "bg-purple-100 text-purple-800 border-purple-300",
|
|
708
|
+
pink: "bg-pink-100 text-pink-800 border-pink-300"
|
|
709
|
+
};
|
|
710
|
+
return b[d || "blue"] || b.blue;
|
|
711
|
+
};
|
|
712
|
+
if (Array.isArray(e))
|
|
713
|
+
return /* @__PURE__ */ r.jsx("div", { className: "flex flex-wrap gap-1", children: e.map((d, b) => {
|
|
714
|
+
const g = s.find((N) => N.value === d), y = g?.label || d, R = l(g?.color);
|
|
715
|
+
return /* @__PURE__ */ r.jsx(
|
|
716
|
+
w,
|
|
717
|
+
{
|
|
718
|
+
variant: "outline",
|
|
719
|
+
className: R,
|
|
720
|
+
children: y
|
|
721
|
+
},
|
|
722
|
+
b
|
|
723
|
+
);
|
|
724
|
+
}) });
|
|
725
|
+
const i = s.find((d) => d.value === e), c = i?.label || e, m = l(i?.color);
|
|
726
|
+
return /* @__PURE__ */ r.jsx(
|
|
727
|
+
w,
|
|
728
|
+
{
|
|
729
|
+
variant: "outline",
|
|
730
|
+
className: m,
|
|
731
|
+
children: c
|
|
732
|
+
}
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
function sr({ value: e }) {
|
|
736
|
+
return e ? /* @__PURE__ */ r.jsx(
|
|
737
|
+
W,
|
|
738
|
+
{
|
|
739
|
+
variant: "link",
|
|
740
|
+
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
741
|
+
asChild: !0,
|
|
742
|
+
children: /* @__PURE__ */ r.jsx(
|
|
743
|
+
"a",
|
|
744
|
+
{
|
|
745
|
+
href: `mailto:${e}`,
|
|
746
|
+
onClick: (t) => t.stopPropagation(),
|
|
747
|
+
children: e
|
|
748
|
+
}
|
|
749
|
+
)
|
|
750
|
+
}
|
|
751
|
+
) : /* @__PURE__ */ r.jsx("span", { children: "-" });
|
|
752
|
+
}
|
|
753
|
+
function lr({ value: e }) {
|
|
754
|
+
return e ? /* @__PURE__ */ r.jsx(
|
|
755
|
+
W,
|
|
756
|
+
{
|
|
757
|
+
variant: "link",
|
|
758
|
+
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
759
|
+
asChild: !0,
|
|
760
|
+
children: /* @__PURE__ */ r.jsx(
|
|
761
|
+
"a",
|
|
762
|
+
{
|
|
763
|
+
href: e,
|
|
764
|
+
target: "_blank",
|
|
765
|
+
rel: "noopener noreferrer",
|
|
766
|
+
onClick: (t) => t.stopPropagation(),
|
|
767
|
+
children: e
|
|
768
|
+
}
|
|
769
|
+
)
|
|
770
|
+
}
|
|
771
|
+
) : /* @__PURE__ */ r.jsx("span", { children: "-" });
|
|
772
|
+
}
|
|
773
|
+
function ir({ value: e }) {
|
|
774
|
+
return e ? /* @__PURE__ */ r.jsx(
|
|
775
|
+
"a",
|
|
776
|
+
{
|
|
777
|
+
href: `tel:${e}`,
|
|
778
|
+
className: "text-blue-600 hover:text-blue-800",
|
|
779
|
+
onClick: (t) => t.stopPropagation(),
|
|
780
|
+
children: e
|
|
781
|
+
}
|
|
782
|
+
) : /* @__PURE__ */ r.jsx("span", { children: "-" });
|
|
783
|
+
}
|
|
784
|
+
function cr({ value: e, field: t }) {
|
|
785
|
+
if (!e) return /* @__PURE__ */ r.jsx("span", { children: "-" });
|
|
786
|
+
if (t.multiple, Array.isArray(e)) {
|
|
787
|
+
const l = e.length;
|
|
788
|
+
return /* @__PURE__ */ r.jsxs("span", { className: "text-sm text-gray-600", children: [
|
|
789
|
+
l,
|
|
790
|
+
" ",
|
|
791
|
+
l === 1 ? "file" : "files"
|
|
792
|
+
] });
|
|
793
|
+
}
|
|
794
|
+
const s = e.name || e.original_name || "File";
|
|
795
|
+
return /* @__PURE__ */ r.jsx("span", { className: "text-sm truncate", children: s });
|
|
796
|
+
}
|
|
797
|
+
function or({ value: e }) {
|
|
798
|
+
return e ? Array.isArray(e) ? /* @__PURE__ */ r.jsxs("div", { className: "flex -space-x-2", children: [
|
|
799
|
+
e.slice(0, 3).map((t, n) => /* @__PURE__ */ r.jsx(
|
|
800
|
+
"img",
|
|
801
|
+
{
|
|
802
|
+
src: t.url || "",
|
|
803
|
+
alt: t.name || `Image ${n + 1}`,
|
|
804
|
+
className: "size-8 rounded-md border-2 border-white object-cover"
|
|
805
|
+
},
|
|
806
|
+
n
|
|
807
|
+
)),
|
|
808
|
+
e.length > 3 && /* @__PURE__ */ r.jsxs("div", { className: "size-8 rounded-md border-2 border-white bg-gray-100 flex items-center justify-center text-xs font-medium text-gray-600", children: [
|
|
809
|
+
"+",
|
|
810
|
+
e.length - 3
|
|
811
|
+
] })
|
|
812
|
+
] }) : /* @__PURE__ */ r.jsx(
|
|
813
|
+
"img",
|
|
814
|
+
{
|
|
815
|
+
src: e.url || "",
|
|
816
|
+
alt: e.name || "Image",
|
|
817
|
+
className: "size-10 rounded-md object-cover"
|
|
818
|
+
}
|
|
819
|
+
) : /* @__PURE__ */ r.jsx("span", { children: "-" });
|
|
820
|
+
}
|
|
821
|
+
function ge({ value: e }) {
|
|
822
|
+
if (!e) return /* @__PURE__ */ r.jsx("span", { children: "-" });
|
|
823
|
+
if (Array.isArray(e))
|
|
824
|
+
return /* @__PURE__ */ r.jsx("div", { className: "flex flex-wrap gap-1", children: e.map((t, n) => {
|
|
825
|
+
const s = t.name || t.label || t._id || String(t);
|
|
826
|
+
return /* @__PURE__ */ r.jsx(
|
|
827
|
+
"span",
|
|
828
|
+
{
|
|
829
|
+
className: "inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",
|
|
830
|
+
children: s
|
|
831
|
+
},
|
|
832
|
+
n
|
|
833
|
+
);
|
|
834
|
+
}) });
|
|
835
|
+
if (typeof e == "object" && e !== null) {
|
|
836
|
+
const t = e.name || e.label || e._id || "[Object]";
|
|
837
|
+
return /* @__PURE__ */ r.jsx("span", { className: "truncate", children: t });
|
|
838
|
+
}
|
|
839
|
+
return /* @__PURE__ */ r.jsx("span", { className: "truncate", children: String(e) });
|
|
840
|
+
}
|
|
841
|
+
function pe({ value: e }) {
|
|
842
|
+
return /* @__PURE__ */ r.jsx("span", { className: "text-gray-700 font-mono text-sm", children: e != null ? String(e) : "-" });
|
|
843
|
+
}
|
|
844
|
+
function xe({ value: e }) {
|
|
845
|
+
if (!e) return /* @__PURE__ */ r.jsx("span", { children: "-" });
|
|
846
|
+
if (Array.isArray(e))
|
|
847
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "flex -space-x-2", children: [
|
|
848
|
+
e.slice(0, 3).map((s, l) => {
|
|
849
|
+
const i = s.name || s.username || "User", c = i.split(" ").map((m) => m[0]).join("").toUpperCase().slice(0, 2);
|
|
850
|
+
return /* @__PURE__ */ r.jsx(
|
|
851
|
+
Y,
|
|
852
|
+
{
|
|
853
|
+
className: "size-8 border-2 border-white",
|
|
854
|
+
title: i,
|
|
855
|
+
children: /* @__PURE__ */ r.jsx(z, { className: "bg-blue-500 text-white text-xs", children: c })
|
|
856
|
+
},
|
|
857
|
+
l
|
|
858
|
+
);
|
|
859
|
+
}),
|
|
860
|
+
e.length > 3 && /* @__PURE__ */ r.jsx(Y, { className: "size-8 border-2 border-white", children: /* @__PURE__ */ r.jsxs(z, { className: "bg-gray-200 text-gray-600 text-xs", children: [
|
|
861
|
+
"+",
|
|
862
|
+
e.length - 3
|
|
863
|
+
] }) })
|
|
864
|
+
] });
|
|
865
|
+
const t = e.name || e.username || "User", n = t.split(" ").map((s) => s[0]).join("").toUpperCase().slice(0, 2);
|
|
866
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
867
|
+
/* @__PURE__ */ r.jsx(Y, { className: "size-8", children: /* @__PURE__ */ r.jsx(z, { className: "bg-blue-500 text-white text-xs", children: n }) }),
|
|
868
|
+
/* @__PURE__ */ r.jsx("span", { className: "truncate", children: t })
|
|
869
|
+
] });
|
|
870
|
+
}
|
|
871
|
+
const V = /* @__PURE__ */ new Map();
|
|
872
|
+
function G(e, t) {
|
|
873
|
+
V.set(e, t);
|
|
874
|
+
}
|
|
875
|
+
function xr(e) {
|
|
876
|
+
return V.has(e) ? V.get(e) : {
|
|
877
|
+
text: v,
|
|
878
|
+
textarea: v,
|
|
879
|
+
markdown: v,
|
|
880
|
+
html: v,
|
|
881
|
+
number: Ke,
|
|
882
|
+
currency: er,
|
|
883
|
+
percent: rr,
|
|
884
|
+
boolean: tr,
|
|
885
|
+
date: ar,
|
|
886
|
+
datetime: nr,
|
|
887
|
+
time: v,
|
|
888
|
+
select: O,
|
|
889
|
+
lookup: O,
|
|
890
|
+
// Default fallback
|
|
891
|
+
master_detail: O,
|
|
892
|
+
// Default fallback
|
|
893
|
+
email: sr,
|
|
894
|
+
url: lr,
|
|
895
|
+
phone: ir,
|
|
896
|
+
file: cr,
|
|
897
|
+
image: or,
|
|
898
|
+
formula: pe,
|
|
899
|
+
summary: pe,
|
|
900
|
+
auto_number: v,
|
|
901
|
+
user: xe,
|
|
902
|
+
owner: xe,
|
|
903
|
+
password: () => /* @__PURE__ */ r.jsx("span", { children: "••••••" }),
|
|
904
|
+
location: v,
|
|
905
|
+
// Default fallback
|
|
906
|
+
object: () => /* @__PURE__ */ r.jsx("span", { className: "text-gray-500 italic", children: "[Object]" }),
|
|
907
|
+
vector: () => /* @__PURE__ */ r.jsx("span", { className: "text-gray-500 italic", children: "[Vector]" }),
|
|
908
|
+
grid: () => /* @__PURE__ */ r.jsx("span", { className: "text-gray-500 italic", children: "[Grid]" })
|
|
909
|
+
}[e] || v;
|
|
910
|
+
}
|
|
911
|
+
G("lookup", ge);
|
|
912
|
+
G("master_detail", ge);
|
|
913
|
+
G("select", O);
|
|
914
|
+
function fr(e) {
|
|
915
|
+
return {
|
|
916
|
+
// Text-based fields
|
|
917
|
+
text: "input",
|
|
918
|
+
textarea: "textarea",
|
|
919
|
+
markdown: "textarea",
|
|
920
|
+
// Markdown editor (fallback to textarea)
|
|
921
|
+
html: "textarea",
|
|
922
|
+
// Rich text editor (fallback to textarea)
|
|
923
|
+
// Numeric fields
|
|
924
|
+
number: "input",
|
|
925
|
+
currency: "input",
|
|
926
|
+
percent: "input",
|
|
927
|
+
// Date/Time fields
|
|
928
|
+
date: "date-picker",
|
|
929
|
+
datetime: "date-picker",
|
|
930
|
+
time: "input",
|
|
931
|
+
// Time picker (fallback to input with type="time")
|
|
932
|
+
// Boolean
|
|
933
|
+
boolean: "switch",
|
|
934
|
+
// Selection fields
|
|
935
|
+
select: "select",
|
|
936
|
+
lookup: "select",
|
|
937
|
+
master_detail: "select",
|
|
938
|
+
// Contact fields
|
|
939
|
+
email: "input",
|
|
940
|
+
phone: "input",
|
|
941
|
+
url: "input",
|
|
942
|
+
// File fields
|
|
943
|
+
file: "file-upload",
|
|
944
|
+
image: "file-upload",
|
|
945
|
+
// Special fields
|
|
946
|
+
password: "input",
|
|
947
|
+
location: "input",
|
|
948
|
+
// Location/map field (fallback to input)
|
|
949
|
+
// Auto-generated/computed fields (typically read-only)
|
|
950
|
+
formula: "input",
|
|
951
|
+
summary: "input",
|
|
952
|
+
auto_number: "input",
|
|
953
|
+
// Complex data types
|
|
954
|
+
object: "input",
|
|
955
|
+
// JSON object (fallback to input)
|
|
956
|
+
vector: "input",
|
|
957
|
+
// Vector/embedding data (fallback to input)
|
|
958
|
+
grid: "input"
|
|
959
|
+
// Grid/table data (fallback to input)
|
|
960
|
+
}[e] || "input";
|
|
961
|
+
}
|
|
962
|
+
function hr(e) {
|
|
963
|
+
if (e < 0 || !Number.isFinite(e) || e === 0)
|
|
964
|
+
return "0 B";
|
|
965
|
+
const t = ["B", "KB", "MB", "GB", "TB"];
|
|
966
|
+
let n = e, s = 0;
|
|
967
|
+
for (; n >= 1024 && s < t.length - 1; )
|
|
968
|
+
n /= 1024, s++;
|
|
969
|
+
return `${n.toFixed(s > 0 ? 1 : 0)} ${t[s]}`;
|
|
970
|
+
}
|
|
971
|
+
function gr(e) {
|
|
972
|
+
const t = {};
|
|
973
|
+
return e.required && (t.required = typeof e.required_message == "string" ? e.required_message : `${e.label || e.name} is required`), e.min_length && (t.minLength = {
|
|
974
|
+
value: e.min_length,
|
|
975
|
+
message: e.min_length_message || `Minimum length is ${e.min_length} characters`
|
|
976
|
+
}), e.max_length && (t.maxLength = {
|
|
977
|
+
value: e.max_length,
|
|
978
|
+
message: e.max_length_message || `Maximum length is ${e.max_length} characters`
|
|
979
|
+
}), e.min !== void 0 && (t.min = {
|
|
980
|
+
value: e.min,
|
|
981
|
+
message: e.min_message || `Minimum value is ${e.min}`
|
|
982
|
+
}), e.max !== void 0 && (t.max = {
|
|
983
|
+
value: e.max,
|
|
984
|
+
message: e.max_message || `Maximum value is ${e.max}`
|
|
985
|
+
}), e.pattern && (t.pattern = {
|
|
986
|
+
value: typeof e.pattern == "string" ? new RegExp(e.pattern) : e.pattern,
|
|
987
|
+
message: e.pattern_message || "Invalid format"
|
|
988
|
+
}), e.type === "email" && (t.pattern = {
|
|
989
|
+
value: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
990
|
+
message: "Please enter a valid email address"
|
|
991
|
+
}), e.type === "url" && (t.pattern = {
|
|
992
|
+
value: /^https?:\/\/.+/,
|
|
993
|
+
message: "Please enter a valid URL"
|
|
994
|
+
}), e.validate && (t.validate = e.validate), Object.keys(t).length > 0 ? t : void 0;
|
|
995
|
+
}
|
|
996
|
+
function fe(e, t) {
|
|
997
|
+
if (!e) return !0;
|
|
998
|
+
if (e.field && e.value !== void 0) {
|
|
999
|
+
const n = t[e.field];
|
|
1000
|
+
if (e.operator === "=" || e.operator === "==")
|
|
1001
|
+
return n === e.value;
|
|
1002
|
+
if (e.operator === "!=")
|
|
1003
|
+
return n !== e.value;
|
|
1004
|
+
if (e.operator === ">")
|
|
1005
|
+
return n > e.value;
|
|
1006
|
+
if (e.operator === ">=")
|
|
1007
|
+
return n >= e.value;
|
|
1008
|
+
if (e.operator === "<")
|
|
1009
|
+
return n < e.value;
|
|
1010
|
+
if (e.operator === "<=")
|
|
1011
|
+
return n <= e.value;
|
|
1012
|
+
if (e.operator === "in")
|
|
1013
|
+
return Array.isArray(e.value) && e.value.includes(n);
|
|
1014
|
+
}
|
|
1015
|
+
return e.and && Array.isArray(e.and) ? e.and.every((n) => fe(n, t)) : e.or && Array.isArray(e.or) ? e.or.some((n) => fe(n, t)) : !0;
|
|
1016
|
+
}
|
|
1017
|
+
function br() {
|
|
1018
|
+
x.register("text", se), x.register("textarea", me), x.register("number", le), x.register("boolean", qe), x.register("select", We), x.register("date", Ge), x.register("email", ie), x.register("phone", ce), x.register("url", oe), x.register("currency", ue), x.register("markdown", de), x.register("html", de), x.register("lookup", B), x.register("master_detail", B), x.register("field:text", se), x.register("field:textarea", me), x.register("field:number", le), x.register("field:email", ie), x.register("field:phone", ce), x.register("field:url", oe), x.register("field:currency", ue), x.register("field:lookup", B);
|
|
1019
|
+
}
|
|
1020
|
+
export {
|
|
1021
|
+
tr as BooleanCellRenderer,
|
|
1022
|
+
qe as BooleanField,
|
|
1023
|
+
er as CurrencyCellRenderer,
|
|
1024
|
+
ue as CurrencyField,
|
|
1025
|
+
ar as DateCellRenderer,
|
|
1026
|
+
Ge as DateField,
|
|
1027
|
+
nr as DateTimeCellRenderer,
|
|
1028
|
+
sr as EmailCellRenderer,
|
|
1029
|
+
ie as EmailField,
|
|
1030
|
+
cr as FileCellRenderer,
|
|
1031
|
+
pe as FormulaCellRenderer,
|
|
1032
|
+
or as ImageCellRenderer,
|
|
1033
|
+
ge as LookupCellRenderer,
|
|
1034
|
+
B as LookupField,
|
|
1035
|
+
Ke as NumberCellRenderer,
|
|
1036
|
+
le as NumberField,
|
|
1037
|
+
rr as PercentCellRenderer,
|
|
1038
|
+
ir as PhoneCellRenderer,
|
|
1039
|
+
ce as PhoneField,
|
|
1040
|
+
de as RichTextField,
|
|
1041
|
+
O as SelectCellRenderer,
|
|
1042
|
+
We as SelectField,
|
|
1043
|
+
me as TextAreaField,
|
|
1044
|
+
v as TextCellRenderer,
|
|
1045
|
+
se as TextField,
|
|
1046
|
+
lr as UrlCellRenderer,
|
|
1047
|
+
oe as UrlField,
|
|
1048
|
+
xe as UserCellRenderer,
|
|
1049
|
+
gr as buildValidationRules,
|
|
1050
|
+
fe as evaluateCondition,
|
|
1051
|
+
Xe as formatCurrency,
|
|
1052
|
+
Qe as formatDate,
|
|
1053
|
+
Ze as formatDateTime,
|
|
1054
|
+
hr as formatFileSize,
|
|
1055
|
+
He as formatPercent,
|
|
1056
|
+
xr as getCellRenderer,
|
|
1057
|
+
fr as mapFieldTypeToFormType,
|
|
1058
|
+
G as registerFieldRenderer,
|
|
1059
|
+
br as registerFields
|
|
1060
|
+
};
|