@object-ui/fields 3.1.2 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddressField-B6fPb2Fs.js +3 -0
- package/dist/AddressField-Ctsxkj35.cjs +1 -0
- package/dist/AutoNumberField-DXIYJfiB.js +3 -0
- package/dist/AutoNumberField-f76XU1bR.cjs +1 -0
- package/dist/AvatarField-BHpex3Wa.js +3 -0
- package/dist/AvatarField-CXOdYavl.cjs +1 -0
- package/dist/BooleanField-Bs0urhsx.js +3 -0
- package/dist/BooleanField-DeexI_O2.cjs +1 -0
- package/dist/CodeField-DDOMH8E8.cjs +1 -0
- package/dist/CodeField-tRACqngO.js +3 -0
- package/dist/ColorField-Bar6bOJw.js +3 -0
- package/dist/ColorField-CM9CxZ9h.cjs +1 -0
- package/dist/CurrencyField-CezTX_rA.cjs +1 -0
- package/dist/CurrencyField-D4VwXI9k.js +3 -0
- package/dist/DateField-DDUllj7w.cjs +1 -0
- package/dist/DateField-DjGiK6BH.js +3 -0
- package/dist/DateTimeField-DBh-dYdR.js +3 -0
- package/dist/DateTimeField-DDqgVN3b.cjs +1 -0
- package/dist/EmailField-B-3nY8Pr.cjs +1 -0
- package/dist/EmailField-Cp6yJlpH.js +3 -0
- package/dist/FileField-C1bcL7tu.cjs +1 -0
- package/dist/FileField-DUgt6ai3.js +3 -0
- package/dist/FormulaField-BLV1KgkQ.js +3 -0
- package/dist/FormulaField-CsbQIZ7S.cjs +1 -0
- package/dist/GeolocationField-BbIRH51u.js +3 -0
- package/dist/GeolocationField-UFu9VR-x.cjs +1 -0
- package/dist/GridField-2m74haE0.cjs +1 -0
- package/dist/GridField-O3Jd1NuJ.js +3 -0
- package/dist/ImageField-Cna7g6KL.cjs +1 -0
- package/dist/ImageField-rc1Nzcvb.js +3 -0
- package/dist/LocationField-DpRe9QlH.cjs +1 -0
- package/dist/LocationField-QZPPYo0J.js +3 -0
- package/dist/LookupField-BX4sK8NG.js +904 -0
- package/dist/LookupField-C9rPrHi_.cjs +1 -0
- package/dist/MasterDetailField-BXncIT1s.js +3 -0
- package/dist/MasterDetailField-TNP2825Z.cjs +1 -0
- package/dist/NumberField-DCHTzmDG.js +3 -0
- package/dist/NumberField-SqRwbcY8.cjs +1 -0
- package/dist/ObjectField-BEUHpn_X.js +3 -0
- package/dist/ObjectField-BWZwaFIG.cjs +1 -0
- package/dist/PasswordField-BZ_OeQyw.js +3 -0
- package/dist/PasswordField-kLp-ZyPm.cjs +1 -0
- package/dist/PercentField-B2t2knlc.js +3 -0
- package/dist/PercentField-BzhD6tQm.cjs +1 -0
- package/dist/PhoneField-CirvuysP.cjs +1 -0
- package/dist/PhoneField-CkrCFmcO.js +3 -0
- package/dist/QRCodeField-C4OOLCbE.cjs +1 -0
- package/dist/QRCodeField-CQoGow8y.js +3 -0
- package/dist/RatingField-CZG8SgQ8.cjs +1 -0
- package/dist/RatingField-DecDJkou.js +3 -0
- package/dist/RichTextField-Bog2i4NN.cjs +1 -0
- package/dist/RichTextField-b-8QbNCJ.js +3 -0
- package/dist/SelectField-CAa6c0cB.cjs +1 -0
- package/dist/SelectField-DMy5IxRc.js +3 -0
- package/dist/SignatureField-BvTPE7Dn.js +3 -0
- package/dist/SignatureField-jsb-0AYp.cjs +1 -0
- package/dist/SliderField-B7WvKFv7.js +3 -0
- package/dist/SliderField-DRjEJSxK.cjs +1 -0
- package/dist/SummaryField-DA16Edq3.cjs +1 -0
- package/dist/SummaryField-DVSVfKmY.js +3 -0
- package/dist/TextAreaField--ut87UiB.js +3 -0
- package/dist/TextAreaField-Cxp3DFC6.cjs +1 -0
- package/dist/TextField-CkEDGbkQ.js +3 -0
- package/dist/TextField-aLAzBaLZ.cjs +1 -0
- package/dist/TimeField-D0lF0y_I.cjs +1 -0
- package/dist/TimeField-DA_S6lQV.js +3 -0
- package/dist/UrlField-D0ugmD3f.cjs +1 -0
- package/dist/UrlField-DCnXHR1A.js +3 -0
- package/dist/UserField-DGlorzyG.cjs +1 -0
- package/dist/UserField-V0GmvyGV.js +3 -0
- package/dist/VectorField-BSD85ntU.cjs +1 -0
- package/dist/VectorField-CVi5yrrc.js +3 -0
- package/dist/fields/src/index.d.ts +8 -0
- package/dist/fields/src/record-picker-dialog.stories.d.ts +25 -0
- package/dist/fields/src/record-picker.test.d.ts +1 -0
- package/dist/fields/src/widgets/LookupField.d.ts +13 -2
- package/dist/fields/src/widgets/RecordPickerDialog.d.ts +166 -0
- package/dist/fields/src/widgets/_cell-renderer-bridge.d.ts +3 -0
- package/dist/index.cjs +4 -9
- package/dist/index.js +2229 -2682
- package/dist/jsx-runtime-DHCF5ANT.cjs +6 -0
- package/dist/jsx-runtime-MxADXuRH.js +189 -0
- package/package.json +8 -7
- package/src/__tests__/cell-renderers.test.tsx +133 -4
- package/src/complex-widgets.test.tsx +426 -2
- package/src/index.tsx +76 -22
- package/src/record-picker-dialog.stories.tsx +160 -0
- package/src/record-picker.test.tsx +1696 -0
- package/src/widgets/LookupField.tsx +485 -80
- package/src/widgets/RecordPickerDialog.tsx +1182 -0
- package/src/widgets/_cell-renderer-bridge.ts +19 -0
package/dist/index.js
CHANGED
|
@@ -1,2690 +1,2237 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
r(u);
|
|
515
|
-
},
|
|
516
|
-
onBlur: p,
|
|
517
|
-
placeholder: o?.placeholder || "0.00",
|
|
518
|
-
disabled: a || l.disabled,
|
|
519
|
-
className: `pl-8 ${i || ""}`,
|
|
520
|
-
step: Math.pow(10, -m).toFixed(m),
|
|
521
|
-
"aria-invalid": !!s
|
|
522
|
-
}
|
|
523
|
-
)
|
|
524
|
-
] });
|
|
525
|
-
}
|
|
526
|
-
const rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
527
|
-
__proto__: null,
|
|
528
|
-
CurrencyField: We
|
|
529
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
530
|
-
function Ge({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, ...i }) {
|
|
531
|
-
if (a)
|
|
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, ...p } = i;
|
|
534
|
-
return /* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
535
|
-
/* @__PURE__ */ t.jsx(
|
|
536
|
-
Z,
|
|
537
|
-
{
|
|
538
|
-
...p,
|
|
539
|
-
value: e || "",
|
|
540
|
-
onChange: (f) => r(f.target.value),
|
|
541
|
-
placeholder: l?.placeholder,
|
|
542
|
-
disabled: a || p.disabled,
|
|
543
|
-
rows: o,
|
|
544
|
-
maxLength: c,
|
|
545
|
-
"aria-invalid": !!s
|
|
546
|
-
}
|
|
547
|
-
),
|
|
548
|
-
c && /* @__PURE__ */ t.jsxs(
|
|
549
|
-
"div",
|
|
550
|
-
{
|
|
551
|
-
className: "absolute bottom-2 right-2 text-xs text-gray-400",
|
|
552
|
-
"aria-live": "polite",
|
|
553
|
-
"aria-label": `Character count: ${(e || "").length} of ${c}`,
|
|
554
|
-
children: [
|
|
555
|
-
(e || "").length,
|
|
556
|
-
"/",
|
|
557
|
-
c
|
|
558
|
-
]
|
|
559
|
-
}
|
|
560
|
-
)
|
|
561
|
-
] });
|
|
562
|
-
}
|
|
563
|
-
const sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
564
|
-
__proto__: null,
|
|
565
|
-
TextAreaField: Ge
|
|
566
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
567
|
-
function ce({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, ...i }) {
|
|
568
|
-
if (a)
|
|
569
|
-
return /* @__PURE__ */ t.jsx(
|
|
570
|
-
"div",
|
|
571
|
-
{
|
|
572
|
-
className: "text-sm prose prose-sm max-w-none",
|
|
573
|
-
children: e || "-"
|
|
574
|
-
}
|
|
575
|
-
);
|
|
576
|
-
const l = n || i.schema, o = l?.rows || 8, c = l?.format || "markdown";
|
|
577
|
-
return /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
578
|
-
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between text-xs text-gray-500", children: [
|
|
579
|
-
/* @__PURE__ */ t.jsxs("span", { children: [
|
|
580
|
-
"Format: ",
|
|
581
|
-
c
|
|
582
|
-
] }),
|
|
583
|
-
/* @__PURE__ */ t.jsx("span", { className: "italic", children: "Rich text editor (basic)" })
|
|
584
|
-
] }),
|
|
585
|
-
/* @__PURE__ */ t.jsx(
|
|
586
|
-
Z,
|
|
587
|
-
{
|
|
588
|
-
value: e || "",
|
|
589
|
-
onChange: (m) => r(m.target.value),
|
|
590
|
-
placeholder: l?.placeholder || "Enter text...",
|
|
591
|
-
disabled: a || i.disabled,
|
|
592
|
-
rows: o,
|
|
593
|
-
className: `font-mono text-sm ${i.className || ""}`,
|
|
594
|
-
"aria-invalid": !!s
|
|
595
|
-
}
|
|
596
|
-
)
|
|
597
|
-
] });
|
|
598
|
-
}
|
|
599
|
-
const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
600
|
-
__proto__: null,
|
|
601
|
-
RichTextField: ce
|
|
602
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
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, p = m?.options || [], f = m.multiple || !1, u = m.display_field || "label", x = p.filter(
|
|
605
|
-
(N) => N.label.toLowerCase().includes(o.toLowerCase())
|
|
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
|
-
if (f) {
|
|
610
|
-
const T = Array.isArray(e) ? e : [], U = T.includes(N.value);
|
|
611
|
-
r(U ? T.filter((Q) => Q !== N.value) : [...T, N.value]);
|
|
612
|
-
} else
|
|
613
|
-
r(N.value), l(!1);
|
|
614
|
-
}, R = (N) => {
|
|
615
|
-
if (f) {
|
|
616
|
-
const T = Array.isArray(e) ? e : [];
|
|
617
|
-
r(T.filter((U) => U !== N));
|
|
618
|
-
} else
|
|
619
|
-
r(null);
|
|
620
|
-
};
|
|
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
|
-
M,
|
|
624
|
-
{
|
|
625
|
-
variant: "outline",
|
|
626
|
-
className: "gap-1",
|
|
627
|
-
children: [
|
|
628
|
-
N?.[u] || N?.label,
|
|
629
|
-
/* @__PURE__ */ t.jsx(
|
|
630
|
-
"button",
|
|
631
|
-
{
|
|
632
|
-
onClick: () => R(N?.value),
|
|
633
|
-
className: "ml-1 hover:text-destructive",
|
|
634
|
-
type: "button",
|
|
635
|
-
"aria-label": `Remove ${N?.[u] || N?.label}`,
|
|
636
|
-
children: /* @__PURE__ */ t.jsx(W, { className: "size-3" })
|
|
637
|
-
}
|
|
638
|
-
)
|
|
639
|
-
]
|
|
640
|
-
},
|
|
641
|
-
T
|
|
642
|
-
)) }),
|
|
643
|
-
/* @__PURE__ */ t.jsxs(Tt, { open: i, onOpenChange: l, children: [
|
|
644
|
-
/* @__PURE__ */ t.jsx(Ot, { asChild: !0, children: /* @__PURE__ */ t.jsxs(
|
|
645
|
-
P,
|
|
646
|
-
{
|
|
647
|
-
variant: "outline",
|
|
648
|
-
className: "w-full justify-start text-left font-normal",
|
|
649
|
-
type: "button",
|
|
650
|
-
children: [
|
|
651
|
-
/* @__PURE__ */ t.jsx($t, { className: "mr-2 size-4" }),
|
|
652
|
-
h.length === 0 ? m?.placeholder || "Select..." : f ? `${h.length} selected` : "Change selection"
|
|
653
|
-
]
|
|
654
|
-
}
|
|
655
|
-
) }),
|
|
656
|
-
/* @__PURE__ */ t.jsxs(Rt, { className: "max-w-md", children: [
|
|
657
|
-
/* @__PURE__ */ t.jsx(kt, { children: /* @__PURE__ */ t.jsxs(At, { children: [
|
|
658
|
-
m?.label || "Select",
|
|
659
|
-
" ",
|
|
660
|
-
f && "(multiple)"
|
|
661
|
-
] }) }),
|
|
662
|
-
/* @__PURE__ */ t.jsxs("div", { className: "space-y-4", children: [
|
|
663
|
-
/* @__PURE__ */ t.jsx(
|
|
664
|
-
w,
|
|
665
|
-
{
|
|
666
|
-
placeholder: "Search...",
|
|
667
|
-
value: o,
|
|
668
|
-
onChange: (N) => c(N.target.value),
|
|
669
|
-
className: "w-full"
|
|
670
|
-
}
|
|
671
|
-
),
|
|
672
|
-
/* @__PURE__ */ t.jsx("div", { className: "max-h-64 overflow-y-auto space-y-1", children: x.length === 0 ? /* @__PURE__ */ t.jsx("p", { className: "text-sm text-gray-500 text-center py-4", children: "No options found" }) : x.map((N) => {
|
|
673
|
-
const T = f ? (Array.isArray(e) ? e : []).includes(N.value) : e === N.value;
|
|
674
|
-
return /* @__PURE__ */ t.jsxs(
|
|
675
|
-
"button",
|
|
676
|
-
{
|
|
677
|
-
onClick: () => v(N),
|
|
678
|
-
className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-gray-100 flex items-center justify-between ${T ? "bg-blue-50 text-blue-700" : ""}`,
|
|
679
|
-
type: "button",
|
|
680
|
-
children: [
|
|
681
|
-
/* @__PURE__ */ t.jsx("span", { children: N.label }),
|
|
682
|
-
T && /* @__PURE__ */ t.jsx(M, { variant: "default", className: "ml-2", children: "Selected" })
|
|
683
|
-
]
|
|
684
|
-
},
|
|
685
|
-
N.value
|
|
686
|
-
);
|
|
687
|
-
}) })
|
|
688
|
-
] })
|
|
689
|
-
] })
|
|
690
|
-
] })
|
|
691
|
-
] });
|
|
692
|
-
}
|
|
693
|
-
const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
694
|
-
__proto__: null,
|
|
695
|
-
LookupField: Qe
|
|
696
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
697
|
-
function He({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
698
|
-
if (a) {
|
|
699
|
-
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
700
|
-
const o = new Date(e);
|
|
701
|
-
return /* @__PURE__ */ t.jsxs("span", { className: "text-sm", children: [
|
|
702
|
-
o.toLocaleDateString(),
|
|
703
|
-
" ",
|
|
704
|
-
o.toLocaleTimeString()
|
|
705
|
-
] });
|
|
706
|
-
}
|
|
707
|
-
const { inputType: i, ...l } = s;
|
|
708
|
-
return /* @__PURE__ */ t.jsx(
|
|
709
|
-
w,
|
|
710
|
-
{
|
|
711
|
-
...l,
|
|
712
|
-
type: "datetime-local",
|
|
713
|
-
value: e || "",
|
|
714
|
-
onChange: (o) => r(o.target.value),
|
|
715
|
-
disabled: a || l.disabled
|
|
716
|
-
}
|
|
717
|
-
);
|
|
718
|
-
}
|
|
719
|
-
const ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
720
|
-
__proto__: null,
|
|
721
|
-
DateTimeField: He
|
|
722
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
723
|
-
function Xe({ value: e, onChange: r, field: n, readonly: a, ...s }) {
|
|
724
|
-
if (a)
|
|
725
|
-
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: e || "-" });
|
|
726
|
-
const { inputType: i, ...l } = s;
|
|
727
|
-
return /* @__PURE__ */ t.jsx(
|
|
728
|
-
w,
|
|
729
|
-
{
|
|
730
|
-
...l,
|
|
731
|
-
type: "time",
|
|
732
|
-
value: e || "",
|
|
733
|
-
onChange: (o) => r(o.target.value),
|
|
734
|
-
disabled: a || l.disabled
|
|
735
|
-
}
|
|
736
|
-
);
|
|
737
|
-
}
|
|
738
|
-
const lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
739
|
-
__proto__: null,
|
|
740
|
-
TimeField: Xe
|
|
741
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
742
|
-
function Ze({ value: e, onChange: r, field: n, readonly: a, errorMessage: s, className: i, ...l }) {
|
|
743
|
-
const o = n || l.schema, c = o?.precision ?? 2;
|
|
744
|
-
if (a)
|
|
745
|
-
return e == null ? /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" }) : /* @__PURE__ */ t.jsxs("span", { className: "text-sm font-medium tabular-nums", children: [
|
|
746
|
-
(e * 100).toFixed(c),
|
|
747
|
-
"%"
|
|
748
|
-
] });
|
|
749
|
-
const m = e != null ? e * 100 : "", p = e != null ? e * 100 : 0, f = (h) => {
|
|
750
|
-
if (h.target.value === "") {
|
|
751
|
-
r(null);
|
|
752
|
-
return;
|
|
753
|
-
}
|
|
754
|
-
const v = parseFloat(h.target.value), R = isNaN(v) ? null : v / 100;
|
|
755
|
-
r(R);
|
|
756
|
-
}, u = (h) => {
|
|
757
|
-
if (a || l.disabled) return;
|
|
758
|
-
if (!Array.isArray(h) || h.length === 0) {
|
|
759
|
-
r(null);
|
|
760
|
-
return;
|
|
761
|
-
}
|
|
762
|
-
const v = h[0], R = typeof v == "number" ? v / 100 : null;
|
|
763
|
-
r(R);
|
|
764
|
-
}, x = Math.pow(10, -c);
|
|
765
|
-
return /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
766
|
-
/* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
767
|
-
/* @__PURE__ */ t.jsx(
|
|
768
|
-
w,
|
|
769
|
-
{
|
|
770
|
-
...l,
|
|
771
|
-
type: "number",
|
|
772
|
-
value: m,
|
|
773
|
-
onChange: f,
|
|
774
|
-
placeholder: o?.placeholder || "0",
|
|
775
|
-
disabled: a || l.disabled,
|
|
776
|
-
className: `pr-8 ${i || ""}`,
|
|
777
|
-
step: Math.pow(10, -c).toFixed(c),
|
|
778
|
-
"aria-invalid": !!s
|
|
779
|
-
}
|
|
780
|
-
),
|
|
781
|
-
/* @__PURE__ */ t.jsx("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500", children: "%" })
|
|
782
|
-
] }),
|
|
783
|
-
/* @__PURE__ */ t.jsx(
|
|
784
|
-
De,
|
|
785
|
-
{
|
|
786
|
-
value: [p],
|
|
787
|
-
onValueChange: u,
|
|
788
|
-
min: 0,
|
|
789
|
-
max: 100,
|
|
790
|
-
step: x,
|
|
791
|
-
disabled: a || l.disabled,
|
|
792
|
-
className: "w-full",
|
|
793
|
-
"aria-label": "Percentage",
|
|
794
|
-
"data-testid": "percent-slider"
|
|
795
|
-
}
|
|
796
|
-
)
|
|
797
|
-
] });
|
|
798
|
-
}
|
|
799
|
-
const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
800
|
-
__proto__: null,
|
|
801
|
-
PercentField: Ze
|
|
802
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
803
|
-
function Ke({ value: e, onChange: r, field: n, readonly: a, className: s, ...i }) {
|
|
804
|
-
const [l, o] = B(!1), c = n || i.schema;
|
|
805
|
-
if (a)
|
|
806
|
-
return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "••••••••" });
|
|
807
|
-
const { inputType: m, ...p } = i;
|
|
808
|
-
return /* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
809
|
-
/* @__PURE__ */ t.jsx(
|
|
810
|
-
w,
|
|
811
|
-
{
|
|
812
|
-
...p,
|
|
813
|
-
type: l ? "text" : "password",
|
|
814
|
-
value: e || "",
|
|
815
|
-
onChange: (f) => r(f.target.value),
|
|
816
|
-
placeholder: c?.placeholder,
|
|
817
|
-
disabled: a || p.disabled,
|
|
818
|
-
className: `pr-10 ${s || ""}`
|
|
819
|
-
}
|
|
820
|
-
),
|
|
821
|
-
/* @__PURE__ */ t.jsx(
|
|
822
|
-
P,
|
|
823
|
-
{
|
|
824
|
-
type: "button",
|
|
825
|
-
variant: "ghost",
|
|
826
|
-
size: "sm",
|
|
827
|
-
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
828
|
-
onClick: () => o(!l),
|
|
829
|
-
tabIndex: -1,
|
|
830
|
-
children: l ? /* @__PURE__ */ t.jsx(zt, { className: "size-4 text-gray-500" }) : /* @__PURE__ */ t.jsx(Et, { className: "size-4 text-gray-500" })
|
|
831
|
-
}
|
|
832
|
-
)
|
|
833
|
-
] });
|
|
834
|
-
}
|
|
835
|
-
const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
836
|
-
__proto__: null,
|
|
837
|
-
PasswordField: Ke
|
|
838
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
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, [p, f] = B(!1), [u, x] = B([]), h = e ? Array.isArray(e) ? e : [e] : [], v = te((b) => {
|
|
841
|
-
if (b.length === 0) return;
|
|
842
|
-
const F = [], A = b.filter((O) => {
|
|
843
|
-
if (m && O.size > m) {
|
|
844
|
-
const Y = (m / 1048576).toFixed(1);
|
|
845
|
-
return F.push(`"${O.name}" exceeds max size (${Y} MB)`), !1;
|
|
846
|
-
}
|
|
847
|
-
return !0;
|
|
848
|
-
});
|
|
849
|
-
if (x(F), A.length === 0) return;
|
|
850
|
-
const $ = A.map((O) => ({
|
|
851
|
-
name: O.name,
|
|
852
|
-
original_name: O.name,
|
|
853
|
-
size: O.size,
|
|
854
|
-
mime_type: O.type,
|
|
855
|
-
// In a real implementation, this would upload the file and return a URL
|
|
856
|
-
url: URL.createObjectURL(O)
|
|
857
|
-
}));
|
|
858
|
-
r(o ? [...h, ...$] : $[0]);
|
|
859
|
-
}, [h, o, r, m]), R = te((b) => {
|
|
860
|
-
b.preventDefault(), b.stopPropagation(), f(!0);
|
|
861
|
-
}, []), N = te((b) => {
|
|
862
|
-
b.preventDefault(), b.stopPropagation(), f(!1);
|
|
863
|
-
}, []), T = te((b) => {
|
|
864
|
-
b.preventDefault(), b.stopPropagation(), f(!1);
|
|
865
|
-
const F = Array.from(b.dataTransfer.files);
|
|
866
|
-
if (c) {
|
|
867
|
-
const A = c.split(",").map((O) => O.trim().toLowerCase()), $ = F.filter((O) => {
|
|
868
|
-
const Y = O.name.split("."), q = Y.length > 1 ? "." + Y.pop()?.toLowerCase() : "";
|
|
869
|
-
return A.some(
|
|
870
|
-
(V) => V === O.type || q && V === q || V.endsWith("/*") && O.type.startsWith(V.replace("/*", "/"))
|
|
871
|
-
);
|
|
872
|
-
});
|
|
873
|
-
v($);
|
|
874
|
-
} else
|
|
875
|
-
v(F);
|
|
876
|
-
}, [c, v]);
|
|
877
|
-
if (a) {
|
|
878
|
-
if (!e) return /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: "-" });
|
|
879
|
-
const b = Array.isArray(e) ? e : [e];
|
|
880
|
-
return /* @__PURE__ */ t.jsx("div", { className: "flex flex-wrap gap-2", children: b.map((F, A) => /* @__PURE__ */ t.jsx("span", { className: "text-sm truncate max-w-xs", children: F.name || F.original_name || "File" }, A)) });
|
|
881
|
-
}
|
|
882
|
-
const U = (b) => {
|
|
883
|
-
v(Array.from(b.target.files || []));
|
|
884
|
-
}, Q = (b) => {
|
|
885
|
-
if (o) {
|
|
886
|
-
const F = h.filter((A, $) => $ !== b);
|
|
887
|
-
r(F.length > 0 ? F : null);
|
|
888
|
-
} else
|
|
889
|
-
r(null);
|
|
890
|
-
}, K = (b) => (b.mime_type || "").startsWith("image/");
|
|
891
|
-
return /* @__PURE__ */ t.jsxs("div", { className: s.className, children: [
|
|
892
|
-
/* @__PURE__ */ t.jsx(
|
|
893
|
-
"input",
|
|
894
|
-
{
|
|
895
|
-
ref: i,
|
|
896
|
-
type: "file",
|
|
897
|
-
multiple: o,
|
|
898
|
-
accept: c,
|
|
899
|
-
onChange: U,
|
|
900
|
-
className: "hidden"
|
|
901
|
-
}
|
|
902
|
-
),
|
|
903
|
-
/* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
904
|
-
/* @__PURE__ */ t.jsxs(
|
|
905
|
-
"div",
|
|
906
|
-
{
|
|
907
|
-
onDragOver: R,
|
|
908
|
-
onDragLeave: N,
|
|
909
|
-
onDrop: T,
|
|
910
|
-
onClick: () => i.current?.click(),
|
|
911
|
-
className: `
|
|
1
|
+
import { t as e } from "./jsx-runtime-MxADXuRH.js";
|
|
2
|
+
import { i as t, r as n, t as r } from "./LookupField-BX4sK8NG.js";
|
|
3
|
+
import i, { useCallback as a, useEffect as o, useId as s, useRef as c, useState as l } from "react";
|
|
4
|
+
import { ComponentRegistry as u } from "@object-ui/core";
|
|
5
|
+
import { Avatar as d, AvatarFallback as f, AvatarImage as p, Badge as m, Button as h, Checkbox as g, Input as _, Label as v, Select as y, SelectContent as ee, SelectItem as te, SelectTrigger as b, SelectValue as x, Slider as S, Switch as C, Textarea as w, cn as T } from "@object-ui/components";
|
|
6
|
+
import { Check as E, Copy as D, Crosshair as ne, Eraser as re, ExternalLink as ie, Eye as ae, EyeOff as oe, File as se, Image as ce, ImageIcon as le, MapPin as O, Phone as ue, Plus as de, QrCode as fe, Star as pe, Upload as me, X as k } from "lucide-react";
|
|
7
|
+
//#region src/widgets/TextField.tsx
|
|
8
|
+
var A = e();
|
|
9
|
+
function j({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
10
|
+
let a = n || i.schema;
|
|
11
|
+
if (r) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
12
|
+
className: "text-sm",
|
|
13
|
+
children: e || "-"
|
|
14
|
+
});
|
|
15
|
+
let o = a?.rows, { inputType: s, ...c } = i;
|
|
16
|
+
return o && o > 1 ? /* @__PURE__ */ (0, A.jsx)(w, {
|
|
17
|
+
...c,
|
|
18
|
+
value: e || "",
|
|
19
|
+
onChange: (e) => t(e.target.value),
|
|
20
|
+
placeholder: a?.placeholder,
|
|
21
|
+
disabled: r || c.disabled
|
|
22
|
+
}) : /* @__PURE__ */ (0, A.jsx)(_, {
|
|
23
|
+
...c,
|
|
24
|
+
type: a?.type === "password" ? "password" : "text",
|
|
25
|
+
value: e || "",
|
|
26
|
+
onChange: (e) => t(e.target.value),
|
|
27
|
+
placeholder: a?.placeholder,
|
|
28
|
+
disabled: r || c.disabled
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/widgets/NumberField.tsx
|
|
33
|
+
function M({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
34
|
+
if (r) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
35
|
+
className: "text-sm",
|
|
36
|
+
children: e ?? "-"
|
|
37
|
+
});
|
|
38
|
+
let a = n || i.schema, o = a?.precision, { inputType: s, ...c } = i;
|
|
39
|
+
return /* @__PURE__ */ (0, A.jsx)(_, {
|
|
40
|
+
...c,
|
|
41
|
+
type: "number",
|
|
42
|
+
value: e ?? "",
|
|
43
|
+
onChange: (e) => {
|
|
44
|
+
let n = e.target.value;
|
|
45
|
+
t(n === "" ? null : Number(n));
|
|
46
|
+
},
|
|
47
|
+
placeholder: a?.placeholder,
|
|
48
|
+
disabled: r || c.disabled,
|
|
49
|
+
step: o ? 10 ** -o : "any"
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/widgets/BooleanField.tsx
|
|
54
|
+
function N({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
55
|
+
let a = n || i.schema, o = a?.widget, c = s(), l = a?.name || c, u = a?.label || "Checkbox";
|
|
56
|
+
if (r) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
57
|
+
className: "text-sm",
|
|
58
|
+
children: e ? "Yes" : "No"
|
|
59
|
+
});
|
|
60
|
+
let { inputType: d, ...f } = i;
|
|
61
|
+
return o === "checkbox" ? /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
62
|
+
className: "flex items-center space-x-2",
|
|
63
|
+
children: [/* @__PURE__ */ (0, A.jsx)(g, {
|
|
64
|
+
...f,
|
|
65
|
+
id: l,
|
|
66
|
+
checked: !!e,
|
|
67
|
+
onCheckedChange: (e) => t(!!e),
|
|
68
|
+
disabled: r || f.disabled
|
|
69
|
+
}), /* @__PURE__ */ (0, A.jsx)(v, {
|
|
70
|
+
htmlFor: l,
|
|
71
|
+
children: u
|
|
72
|
+
})]
|
|
73
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
74
|
+
className: "flex items-center space-x-2",
|
|
75
|
+
children: [/* @__PURE__ */ (0, A.jsx)(C, {
|
|
76
|
+
...f,
|
|
77
|
+
id: l,
|
|
78
|
+
checked: !!e,
|
|
79
|
+
onCheckedChange: t,
|
|
80
|
+
disabled: r || f.disabled
|
|
81
|
+
}), /* @__PURE__ */ (0, A.jsx)(v, {
|
|
82
|
+
htmlFor: l,
|
|
83
|
+
children: u
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/widgets/SelectField.tsx
|
|
89
|
+
function P({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
90
|
+
let a = n || i.schema, o = a?.options || [];
|
|
91
|
+
return r ? /* @__PURE__ */ (0, A.jsx)("span", {
|
|
92
|
+
className: "text-sm",
|
|
93
|
+
children: o.find((t) => t.value === e)?.label || e || "-"
|
|
94
|
+
}) : /* @__PURE__ */ (0, A.jsxs)(y, {
|
|
95
|
+
...i,
|
|
96
|
+
value: e,
|
|
97
|
+
onValueChange: t,
|
|
98
|
+
disabled: r || i.disabled,
|
|
99
|
+
children: [/* @__PURE__ */ (0, A.jsx)(b, {
|
|
100
|
+
className: i.className,
|
|
101
|
+
id: i.id,
|
|
102
|
+
children: /* @__PURE__ */ (0, A.jsx)(x, { placeholder: a?.placeholder || "Select an option" })
|
|
103
|
+
}), /* @__PURE__ */ (0, A.jsx)(ee, {
|
|
104
|
+
position: "popper",
|
|
105
|
+
children: o.map((e) => /* @__PURE__ */ (0, A.jsx)(te, {
|
|
106
|
+
value: e.value,
|
|
107
|
+
children: e.label
|
|
108
|
+
}, e.value))
|
|
109
|
+
})]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/widgets/DateField.tsx
|
|
114
|
+
function F({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
115
|
+
if (r) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
116
|
+
className: "text-sm",
|
|
117
|
+
children: e ? new Date(e).toLocaleDateString() : "-"
|
|
118
|
+
});
|
|
119
|
+
let { inputType: a, ...o } = i;
|
|
120
|
+
return /* @__PURE__ */ (0, A.jsx)(_, {
|
|
121
|
+
...o,
|
|
122
|
+
type: "date",
|
|
123
|
+
value: e || "",
|
|
124
|
+
onChange: (e) => t(e.target.value),
|
|
125
|
+
disabled: r || o.disabled
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/widgets/EmailField.tsx
|
|
130
|
+
function I({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
131
|
+
let o = n || a.schema;
|
|
132
|
+
if (r) return e ? /* @__PURE__ */ (0, A.jsx)("a", {
|
|
133
|
+
href: `mailto:${e}`,
|
|
134
|
+
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
135
|
+
children: e
|
|
136
|
+
}) : /* @__PURE__ */ (0, A.jsx)("span", {
|
|
137
|
+
className: "text-sm",
|
|
138
|
+
children: "-"
|
|
139
|
+
});
|
|
140
|
+
let { inputType: s, ...c } = a;
|
|
141
|
+
return /* @__PURE__ */ (0, A.jsx)(_, {
|
|
142
|
+
...c,
|
|
143
|
+
type: "email",
|
|
144
|
+
value: e || "",
|
|
145
|
+
onChange: (e) => t(e.target.value),
|
|
146
|
+
placeholder: o?.placeholder || "email@example.com",
|
|
147
|
+
disabled: r || c.disabled,
|
|
148
|
+
"aria-invalid": !!i
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/widgets/PhoneField.tsx
|
|
153
|
+
function L({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
154
|
+
let o = n || a.schema;
|
|
155
|
+
if (r) return e ? /* @__PURE__ */ (0, A.jsx)("a", {
|
|
156
|
+
href: `tel:${e}`,
|
|
157
|
+
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
158
|
+
children: e
|
|
159
|
+
}) : /* @__PURE__ */ (0, A.jsx)("span", {
|
|
160
|
+
className: "text-sm",
|
|
161
|
+
children: "-"
|
|
162
|
+
});
|
|
163
|
+
let { inputType: s, ...c } = a;
|
|
164
|
+
return /* @__PURE__ */ (0, A.jsx)(_, {
|
|
165
|
+
...c,
|
|
166
|
+
type: "tel",
|
|
167
|
+
value: e || "",
|
|
168
|
+
onChange: (e) => t(e.target.value),
|
|
169
|
+
placeholder: o?.placeholder || "(555) 123-4567",
|
|
170
|
+
disabled: r || c.disabled,
|
|
171
|
+
"aria-invalid": !!i
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/widgets/UrlField.tsx
|
|
176
|
+
function R({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
177
|
+
let o = n || a.schema;
|
|
178
|
+
if (r) return e ? e.startsWith("http://") || e.startsWith("https://") ? /* @__PURE__ */ (0, A.jsx)("a", {
|
|
179
|
+
href: e,
|
|
180
|
+
target: "_blank",
|
|
181
|
+
rel: "noopener noreferrer",
|
|
182
|
+
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
183
|
+
children: e
|
|
184
|
+
}) : /* @__PURE__ */ (0, A.jsx)("span", {
|
|
185
|
+
className: "text-sm",
|
|
186
|
+
children: e
|
|
187
|
+
}) : /* @__PURE__ */ (0, A.jsx)("span", {
|
|
188
|
+
className: "text-sm",
|
|
189
|
+
children: "-"
|
|
190
|
+
});
|
|
191
|
+
let { inputType: s, ...c } = a;
|
|
192
|
+
return /* @__PURE__ */ (0, A.jsx)(_, {
|
|
193
|
+
...c,
|
|
194
|
+
type: "url",
|
|
195
|
+
value: e || "",
|
|
196
|
+
onChange: (e) => t(e.target.value),
|
|
197
|
+
placeholder: o?.placeholder || "https://example.com",
|
|
198
|
+
disabled: r || c.disabled,
|
|
199
|
+
"aria-invalid": !!i
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/widgets/CurrencyField.tsx
|
|
204
|
+
function he(e, t = "USD") {
|
|
205
|
+
try {
|
|
206
|
+
return new Intl.NumberFormat("en-US", {
|
|
207
|
+
style: "currency",
|
|
208
|
+
currency: t
|
|
209
|
+
}).format(e);
|
|
210
|
+
} catch {
|
|
211
|
+
return `${t} ${e.toFixed(2)}`;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function z({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
215
|
+
let s = n || o.schema, c = s?.currency || "USD", l = s?.precision ?? 2;
|
|
216
|
+
if (r) return e == null ? /* @__PURE__ */ (0, A.jsx)("span", {
|
|
217
|
+
className: "text-sm",
|
|
218
|
+
children: "-"
|
|
219
|
+
}) : /* @__PURE__ */ (0, A.jsx)("span", {
|
|
220
|
+
className: "text-sm font-medium tabular-nums",
|
|
221
|
+
children: he(Number(e), c)
|
|
222
|
+
});
|
|
223
|
+
let u = (e) => {
|
|
224
|
+
let n = parseFloat(e.target.value);
|
|
225
|
+
isNaN(n) || t(parseFloat(n.toFixed(l)));
|
|
226
|
+
};
|
|
227
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
228
|
+
className: "relative",
|
|
229
|
+
children: [/* @__PURE__ */ (0, A.jsx)("span", {
|
|
230
|
+
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
231
|
+
children: c === "USD" ? "$" : c
|
|
232
|
+
}), /* @__PURE__ */ (0, A.jsx)(_, {
|
|
233
|
+
...o,
|
|
234
|
+
type: "number",
|
|
235
|
+
value: e ?? "",
|
|
236
|
+
onChange: (e) => {
|
|
237
|
+
t(e.target.value === "" ? null : parseFloat(e.target.value));
|
|
238
|
+
},
|
|
239
|
+
onBlur: u,
|
|
240
|
+
placeholder: s?.placeholder || "0.00",
|
|
241
|
+
disabled: r || o.disabled,
|
|
242
|
+
className: `pl-8 ${a || ""}`,
|
|
243
|
+
step: (10 ** -l).toFixed(l),
|
|
244
|
+
"aria-invalid": !!i
|
|
245
|
+
})]
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/widgets/TextAreaField.tsx
|
|
250
|
+
function ge({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
251
|
+
if (r) return /* @__PURE__ */ (0, A.jsx)("div", {
|
|
252
|
+
className: "text-sm whitespace-pre-wrap",
|
|
253
|
+
children: e || "-"
|
|
254
|
+
});
|
|
255
|
+
let o = n || a.schema, s = o?.rows || 4, c = o?.max_length, { inputType: l, ...u } = a;
|
|
256
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
257
|
+
className: "relative",
|
|
258
|
+
children: [/* @__PURE__ */ (0, A.jsx)(w, {
|
|
259
|
+
...u,
|
|
260
|
+
value: e || "",
|
|
261
|
+
onChange: (e) => t(e.target.value),
|
|
262
|
+
placeholder: o?.placeholder,
|
|
263
|
+
disabled: r || u.disabled,
|
|
264
|
+
rows: s,
|
|
265
|
+
maxLength: c,
|
|
266
|
+
"aria-invalid": !!i
|
|
267
|
+
}), c && /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
268
|
+
className: "absolute bottom-2 right-2 text-xs text-gray-400",
|
|
269
|
+
"aria-live": "polite",
|
|
270
|
+
"aria-label": `Character count: ${(e || "").length} of ${c}`,
|
|
271
|
+
children: [
|
|
272
|
+
(e || "").length,
|
|
273
|
+
"/",
|
|
274
|
+
c
|
|
275
|
+
]
|
|
276
|
+
})]
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/widgets/RichTextField.tsx
|
|
281
|
+
function B({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
282
|
+
if (r) return /* @__PURE__ */ (0, A.jsx)("div", {
|
|
283
|
+
className: "text-sm prose prose-sm max-w-none",
|
|
284
|
+
children: e || "-"
|
|
285
|
+
});
|
|
286
|
+
let o = n || a.schema, s = o?.rows || 8;
|
|
287
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
288
|
+
className: "space-y-2",
|
|
289
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
290
|
+
className: "flex items-center justify-between text-xs text-gray-500",
|
|
291
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("span", { children: ["Format: ", o?.format || "markdown"] }), /* @__PURE__ */ (0, A.jsx)("span", {
|
|
292
|
+
className: "italic",
|
|
293
|
+
children: "Rich text editor (basic)"
|
|
294
|
+
})]
|
|
295
|
+
}), /* @__PURE__ */ (0, A.jsx)(w, {
|
|
296
|
+
value: e || "",
|
|
297
|
+
onChange: (e) => t(e.target.value),
|
|
298
|
+
placeholder: o?.placeholder || "Enter text...",
|
|
299
|
+
disabled: r || a.disabled,
|
|
300
|
+
rows: s,
|
|
301
|
+
className: `font-mono text-sm ${a.className || ""}`,
|
|
302
|
+
"aria-invalid": !!i
|
|
303
|
+
})]
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region src/widgets/DateTimeField.tsx
|
|
308
|
+
function _e({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
309
|
+
if (r) {
|
|
310
|
+
if (!e) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
311
|
+
className: "text-sm",
|
|
312
|
+
children: "-"
|
|
313
|
+
});
|
|
314
|
+
let t = new Date(e);
|
|
315
|
+
return /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
316
|
+
className: "text-sm",
|
|
317
|
+
children: [
|
|
318
|
+
t.toLocaleDateString(),
|
|
319
|
+
" ",
|
|
320
|
+
t.toLocaleTimeString()
|
|
321
|
+
]
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
let { inputType: a, ...o } = i;
|
|
325
|
+
return /* @__PURE__ */ (0, A.jsx)(_, {
|
|
326
|
+
...o,
|
|
327
|
+
type: "datetime-local",
|
|
328
|
+
value: e || "",
|
|
329
|
+
onChange: (e) => t(e.target.value),
|
|
330
|
+
disabled: r || o.disabled
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/widgets/TimeField.tsx
|
|
335
|
+
function ve({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
336
|
+
if (r) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
337
|
+
className: "text-sm",
|
|
338
|
+
children: e || "-"
|
|
339
|
+
});
|
|
340
|
+
let { inputType: a, ...o } = i;
|
|
341
|
+
return /* @__PURE__ */ (0, A.jsx)(_, {
|
|
342
|
+
...o,
|
|
343
|
+
type: "time",
|
|
344
|
+
value: e || "",
|
|
345
|
+
onChange: (e) => t(e.target.value),
|
|
346
|
+
disabled: r || o.disabled
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/widgets/PercentField.tsx
|
|
351
|
+
function ye({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
352
|
+
let s = n || o.schema, c = s?.precision ?? 2;
|
|
353
|
+
if (r) return e == null ? /* @__PURE__ */ (0, A.jsx)("span", {
|
|
354
|
+
className: "text-sm",
|
|
355
|
+
children: "-"
|
|
356
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
357
|
+
className: "text-sm font-medium tabular-nums",
|
|
358
|
+
children: [(e * 100).toFixed(c), "%"]
|
|
359
|
+
});
|
|
360
|
+
let l = e == null ? "" : e * 100, u = e == null ? 0 : e * 100, d = (e) => {
|
|
361
|
+
if (e.target.value === "") {
|
|
362
|
+
t(null);
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
let n = parseFloat(e.target.value);
|
|
366
|
+
t(isNaN(n) ? null : n / 100);
|
|
367
|
+
}, f = (e) => {
|
|
368
|
+
if (r || o.disabled) return;
|
|
369
|
+
if (!Array.isArray(e) || e.length === 0) {
|
|
370
|
+
t(null);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
let n = e[0];
|
|
374
|
+
t(typeof n == "number" ? n / 100 : null);
|
|
375
|
+
}, p = 10 ** -c;
|
|
376
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
377
|
+
className: "space-y-2",
|
|
378
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
379
|
+
className: "relative",
|
|
380
|
+
children: [/* @__PURE__ */ (0, A.jsx)(_, {
|
|
381
|
+
...o,
|
|
382
|
+
type: "number",
|
|
383
|
+
value: l,
|
|
384
|
+
onChange: d,
|
|
385
|
+
placeholder: s?.placeholder || "0",
|
|
386
|
+
disabled: r || o.disabled,
|
|
387
|
+
className: `pr-8 ${a || ""}`,
|
|
388
|
+
step: (10 ** -c).toFixed(c),
|
|
389
|
+
"aria-invalid": !!i
|
|
390
|
+
}), /* @__PURE__ */ (0, A.jsx)("span", {
|
|
391
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
392
|
+
children: "%"
|
|
393
|
+
})]
|
|
394
|
+
}), /* @__PURE__ */ (0, A.jsx)(S, {
|
|
395
|
+
value: [u],
|
|
396
|
+
onValueChange: f,
|
|
397
|
+
min: 0,
|
|
398
|
+
max: 100,
|
|
399
|
+
step: p,
|
|
400
|
+
disabled: r || o.disabled,
|
|
401
|
+
className: "w-full",
|
|
402
|
+
"aria-label": "Percentage",
|
|
403
|
+
"data-testid": "percent-slider"
|
|
404
|
+
})]
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/widgets/PasswordField.tsx
|
|
409
|
+
function be({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
410
|
+
let [o, s] = l(!1), c = n || a.schema;
|
|
411
|
+
if (r) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
412
|
+
className: "text-sm",
|
|
413
|
+
children: "••••••••"
|
|
414
|
+
});
|
|
415
|
+
let { inputType: u, ...d } = a;
|
|
416
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
417
|
+
className: "relative",
|
|
418
|
+
children: [/* @__PURE__ */ (0, A.jsx)(_, {
|
|
419
|
+
...d,
|
|
420
|
+
type: o ? "text" : "password",
|
|
421
|
+
value: e || "",
|
|
422
|
+
onChange: (e) => t(e.target.value),
|
|
423
|
+
placeholder: c?.placeholder,
|
|
424
|
+
disabled: r || d.disabled,
|
|
425
|
+
className: `pr-10 ${i || ""}`
|
|
426
|
+
}), /* @__PURE__ */ (0, A.jsx)(h, {
|
|
427
|
+
type: "button",
|
|
428
|
+
variant: "ghost",
|
|
429
|
+
size: "sm",
|
|
430
|
+
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
431
|
+
onClick: () => s(!o),
|
|
432
|
+
tabIndex: -1,
|
|
433
|
+
children: o ? /* @__PURE__ */ (0, A.jsx)(oe, { className: "size-4 text-gray-500" }) : /* @__PURE__ */ (0, A.jsx)(ae, { className: "size-4 text-gray-500" })
|
|
434
|
+
})]
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/widgets/FileField.tsx
|
|
439
|
+
function xe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
440
|
+
let o = c(null), s = n || i.schema, u = s?.multiple || !1, d = s?.accept ? s.accept.join(",") : void 0, f = s?.maxSize, [p, m] = l(!1), [g, _] = l([]), v = e ? Array.isArray(e) ? e : [e] : [], y = a((e) => {
|
|
441
|
+
if (e.length === 0) return;
|
|
442
|
+
let n = [], r = e.filter((e) => {
|
|
443
|
+
if (f && e.size > f) {
|
|
444
|
+
let t = (f / (1024 * 1024)).toFixed(1);
|
|
445
|
+
return n.push(`"${e.name}" exceeds max size (${t} MB)`), !1;
|
|
446
|
+
}
|
|
447
|
+
return !0;
|
|
448
|
+
});
|
|
449
|
+
if (_(n), r.length === 0) return;
|
|
450
|
+
let i = r.map((e) => ({
|
|
451
|
+
name: e.name,
|
|
452
|
+
original_name: e.name,
|
|
453
|
+
size: e.size,
|
|
454
|
+
mime_type: e.type,
|
|
455
|
+
url: URL.createObjectURL(e)
|
|
456
|
+
}));
|
|
457
|
+
t(u ? [...v, ...i] : i[0]);
|
|
458
|
+
}, [
|
|
459
|
+
v,
|
|
460
|
+
u,
|
|
461
|
+
t,
|
|
462
|
+
f
|
|
463
|
+
]), ee = a((e) => {
|
|
464
|
+
e.preventDefault(), e.stopPropagation(), m(!0);
|
|
465
|
+
}, []), te = a((e) => {
|
|
466
|
+
e.preventDefault(), e.stopPropagation(), m(!1);
|
|
467
|
+
}, []), b = a((e) => {
|
|
468
|
+
e.preventDefault(), e.stopPropagation(), m(!1);
|
|
469
|
+
let t = Array.from(e.dataTransfer.files);
|
|
470
|
+
if (d) {
|
|
471
|
+
let e = d.split(",").map((e) => e.trim().toLowerCase());
|
|
472
|
+
y(t.filter((t) => {
|
|
473
|
+
let n = t.name.split("."), r = n.length > 1 ? "." + n.pop()?.toLowerCase() : "";
|
|
474
|
+
return e.some((e) => e === t.type || r && e === r || e.endsWith("/*") && t.type.startsWith(e.replace("/*", "/")));
|
|
475
|
+
}));
|
|
476
|
+
} else y(t);
|
|
477
|
+
}, [d, y]);
|
|
478
|
+
if (r) return e ? /* @__PURE__ */ (0, A.jsx)("div", {
|
|
479
|
+
className: "flex flex-wrap gap-2",
|
|
480
|
+
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ (0, A.jsx)("span", {
|
|
481
|
+
className: "text-sm truncate max-w-xs",
|
|
482
|
+
children: e.name || e.original_name || "File"
|
|
483
|
+
}, t))
|
|
484
|
+
}) : /* @__PURE__ */ (0, A.jsx)("span", {
|
|
485
|
+
className: "text-sm",
|
|
486
|
+
children: "-"
|
|
487
|
+
});
|
|
488
|
+
let x = (e) => {
|
|
489
|
+
y(Array.from(e.target.files || []));
|
|
490
|
+
}, S = (e) => {
|
|
491
|
+
if (u) {
|
|
492
|
+
let n = v.filter((t, n) => n !== e);
|
|
493
|
+
t(n.length > 0 ? n : null);
|
|
494
|
+
} else t(null);
|
|
495
|
+
}, C = (e) => (e.mime_type || "").startsWith("image/");
|
|
496
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
497
|
+
className: i.className,
|
|
498
|
+
children: [/* @__PURE__ */ (0, A.jsx)("input", {
|
|
499
|
+
ref: o,
|
|
500
|
+
type: "file",
|
|
501
|
+
multiple: u,
|
|
502
|
+
accept: d,
|
|
503
|
+
onChange: x,
|
|
504
|
+
className: "hidden"
|
|
505
|
+
}), /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
506
|
+
className: "space-y-2",
|
|
507
|
+
children: [
|
|
508
|
+
/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
509
|
+
onDragOver: ee,
|
|
510
|
+
onDragLeave: te,
|
|
511
|
+
onDrop: b,
|
|
512
|
+
onClick: () => o.current?.click(),
|
|
513
|
+
className: `
|
|
912
514
|
flex flex-col items-center justify-center gap-2 p-6
|
|
913
515
|
border-2 border-dashed rounded-lg cursor-pointer
|
|
914
516
|
transition-colors duration-200
|
|
915
517
|
${p ? "border-primary bg-primary/5 text-primary" : "border-muted-foreground/25 hover:border-primary/50 text-muted-foreground hover:text-foreground"}
|
|
916
518
|
`,
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
},
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
},
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
}
|
|
2023
|
-
function
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
}
|
|
2036
|
-
|
|
2037
|
-
function
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
519
|
+
role: "button",
|
|
520
|
+
tabIndex: 0,
|
|
521
|
+
onKeyDown: (e) => {
|
|
522
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), o.current?.click());
|
|
523
|
+
},
|
|
524
|
+
children: [/* @__PURE__ */ (0, A.jsx)(me, { className: `size-8 ${p ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
525
|
+
className: "text-center",
|
|
526
|
+
children: [/* @__PURE__ */ (0, A.jsx)("p", {
|
|
527
|
+
className: "text-sm font-medium",
|
|
528
|
+
children: p ? "Drop files here" : "Drag & drop files here"
|
|
529
|
+
}), /* @__PURE__ */ (0, A.jsx)("p", {
|
|
530
|
+
className: "text-xs text-muted-foreground mt-1",
|
|
531
|
+
children: "or click to browse"
|
|
532
|
+
})]
|
|
533
|
+
})]
|
|
534
|
+
}),
|
|
535
|
+
g.length > 0 && /* @__PURE__ */ (0, A.jsx)("div", {
|
|
536
|
+
className: "space-y-0.5",
|
|
537
|
+
children: g.map((e, t) => /* @__PURE__ */ (0, A.jsx)("p", {
|
|
538
|
+
className: "text-xs text-destructive",
|
|
539
|
+
children: e
|
|
540
|
+
}, t))
|
|
541
|
+
}),
|
|
542
|
+
v.length > 0 && /* @__PURE__ */ (0, A.jsx)("div", {
|
|
543
|
+
className: "space-y-1",
|
|
544
|
+
children: v.map((e, t) => /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
545
|
+
className: "flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",
|
|
546
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
547
|
+
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
548
|
+
children: [
|
|
549
|
+
C(e) && e.url ? /* @__PURE__ */ (0, A.jsx)("img", {
|
|
550
|
+
src: e.url,
|
|
551
|
+
alt: e.name,
|
|
552
|
+
className: "size-8 object-cover rounded flex-shrink-0"
|
|
553
|
+
}) : C(e) ? /* @__PURE__ */ (0, A.jsx)(le, { className: "size-4 text-muted-foreground flex-shrink-0" }) : /* @__PURE__ */ (0, A.jsx)(se, { className: "size-4 text-muted-foreground flex-shrink-0" }),
|
|
554
|
+
/* @__PURE__ */ (0, A.jsx)("span", {
|
|
555
|
+
className: "text-sm truncate",
|
|
556
|
+
children: e.name || e.original_name || "File"
|
|
557
|
+
}),
|
|
558
|
+
e.size && /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
559
|
+
className: "text-xs text-muted-foreground",
|
|
560
|
+
children: [
|
|
561
|
+
"(",
|
|
562
|
+
(e.size / 1024).toFixed(1),
|
|
563
|
+
" KB)"
|
|
564
|
+
]
|
|
565
|
+
})
|
|
566
|
+
]
|
|
567
|
+
}), /* @__PURE__ */ (0, A.jsx)(h, {
|
|
568
|
+
type: "button",
|
|
569
|
+
variant: "ghost",
|
|
570
|
+
size: "sm",
|
|
571
|
+
onClick: (e) => {
|
|
572
|
+
e.stopPropagation(), S(t);
|
|
573
|
+
},
|
|
574
|
+
className: "h-6 w-6 p-0",
|
|
575
|
+
children: /* @__PURE__ */ (0, A.jsx)(k, { className: "size-3" })
|
|
576
|
+
})]
|
|
577
|
+
}, t))
|
|
578
|
+
})
|
|
579
|
+
]
|
|
580
|
+
})]
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
//#endregion
|
|
584
|
+
//#region src/widgets/ImageField.tsx
|
|
585
|
+
function Se({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
586
|
+
let a = c(null), o = n || i.schema, s = o?.multiple || !1, l = o?.accept ? o.accept.join(",") : "image/*";
|
|
587
|
+
if (r) return e ? /* @__PURE__ */ (0, A.jsx)("div", {
|
|
588
|
+
className: "flex flex-wrap gap-2",
|
|
589
|
+
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ (0, A.jsx)("img", {
|
|
590
|
+
src: e.url || "",
|
|
591
|
+
alt: e.name || `Image ${t + 1}`,
|
|
592
|
+
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
593
|
+
}, t))
|
|
594
|
+
}) : /* @__PURE__ */ (0, A.jsx)("span", {
|
|
595
|
+
className: "text-sm",
|
|
596
|
+
children: "-"
|
|
597
|
+
});
|
|
598
|
+
let u = e ? Array.isArray(e) ? e : [e] : [], d = (e) => {
|
|
599
|
+
let n = Array.from(e.target.files || []);
|
|
600
|
+
if (n.length === 0) return;
|
|
601
|
+
let r = n.map((e) => ({
|
|
602
|
+
name: e.name,
|
|
603
|
+
original_name: e.name,
|
|
604
|
+
size: e.size,
|
|
605
|
+
mime_type: e.type,
|
|
606
|
+
url: URL.createObjectURL(e)
|
|
607
|
+
}));
|
|
608
|
+
t(s ? [...u, ...r] : r[0]);
|
|
609
|
+
}, f = (e) => {
|
|
610
|
+
if (s) {
|
|
611
|
+
let n = u.filter((t, n) => n !== e);
|
|
612
|
+
t(n.length > 0 ? n : null);
|
|
613
|
+
} else t(null);
|
|
614
|
+
};
|
|
615
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
616
|
+
className: i.className,
|
|
617
|
+
children: [/* @__PURE__ */ (0, A.jsx)("input", {
|
|
618
|
+
ref: a,
|
|
619
|
+
type: "file",
|
|
620
|
+
multiple: s,
|
|
621
|
+
accept: l,
|
|
622
|
+
onChange: d,
|
|
623
|
+
className: "hidden"
|
|
624
|
+
}), /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
625
|
+
className: "space-y-2",
|
|
626
|
+
children: [u.length > 0 && /* @__PURE__ */ (0, A.jsx)("div", {
|
|
627
|
+
className: "grid grid-cols-4 gap-2",
|
|
628
|
+
children: u.map((e, t) => /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
629
|
+
className: "relative group",
|
|
630
|
+
children: [/* @__PURE__ */ (0, A.jsx)("img", {
|
|
631
|
+
src: e.url || "",
|
|
632
|
+
alt: e.name || `Image ${t + 1}`,
|
|
633
|
+
className: "size-20 rounded-md object-cover border border-gray-200"
|
|
634
|
+
}), /* @__PURE__ */ (0, A.jsx)(h, {
|
|
635
|
+
type: "button",
|
|
636
|
+
variant: "destructive",
|
|
637
|
+
size: "sm",
|
|
638
|
+
onClick: () => f(t),
|
|
639
|
+
className: "absolute top-1 right-1 h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
640
|
+
children: /* @__PURE__ */ (0, A.jsx)(k, { className: "size-3" })
|
|
641
|
+
})]
|
|
642
|
+
}, t))
|
|
643
|
+
}), /* @__PURE__ */ (0, A.jsxs)(h, {
|
|
644
|
+
type: "button",
|
|
645
|
+
variant: "outline",
|
|
646
|
+
onClick: () => a.current?.click(),
|
|
647
|
+
className: "w-full",
|
|
648
|
+
children: [/* @__PURE__ */ (0, A.jsx)(ce, { className: "size-4 mr-2" }), u.length > 0 ? "Add More Images" : "Upload Image"]
|
|
649
|
+
})]
|
|
650
|
+
})]
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region src/widgets/LocationField.tsx
|
|
655
|
+
function Ce({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
656
|
+
let a = n || i.schema, o = e && typeof e == "object" ? `${e.latitude || 0}, ${e.longitude || 0}` : "";
|
|
657
|
+
return r ? /* @__PURE__ */ (0, A.jsx)("span", {
|
|
658
|
+
className: "text-sm",
|
|
659
|
+
children: o || "-"
|
|
660
|
+
}) : /* @__PURE__ */ (0, A.jsx)(_, {
|
|
661
|
+
type: "text",
|
|
662
|
+
value: o,
|
|
663
|
+
onChange: (e) => {
|
|
664
|
+
let n = e.target.value;
|
|
665
|
+
if (!n.trim()) {
|
|
666
|
+
t(null);
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
let r = n.split(",").map((e) => e.trim());
|
|
670
|
+
if (r.length === 2) {
|
|
671
|
+
let e = parseFloat(r[0]), n = parseFloat(r[1]);
|
|
672
|
+
!isNaN(e) && !isNaN(n) && t({
|
|
673
|
+
latitude: e,
|
|
674
|
+
longitude: n
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
placeholder: a?.placeholder || "latitude, longitude",
|
|
679
|
+
disabled: r || i.disabled,
|
|
680
|
+
className: i.className
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
//#endregion
|
|
684
|
+
//#region src/widgets/FormulaField.tsx
|
|
685
|
+
function we({ value: e, field: t, ...n }) {
|
|
686
|
+
let r = (t || n.schema)?.return_type || "text", i = "-";
|
|
687
|
+
return e != null && (i = r === "number" || r === "currency" ? typeof e == "number" ? e.toFixed(2) : String(e) : r === "boolean" ? e ? "Yes" : "No" : r === "date" ? new Date(e).toLocaleDateString() : String(e)), /* @__PURE__ */ (0, A.jsx)("span", {
|
|
688
|
+
className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
|
|
689
|
+
children: i
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
//#endregion
|
|
693
|
+
//#region src/widgets/SummaryField.tsx
|
|
694
|
+
function Te({ value: e, field: t, ...n }) {
|
|
695
|
+
let r = (t || n.schema)?.summary_type || "count", i = "-";
|
|
696
|
+
return e != null && (i = r === "count" ? String(e) : [
|
|
697
|
+
"sum",
|
|
698
|
+
"avg",
|
|
699
|
+
"min",
|
|
700
|
+
"max"
|
|
701
|
+
].includes(r) && typeof e == "number" ? e.toFixed(2) : String(e)), /* @__PURE__ */ (0, A.jsx)("span", {
|
|
702
|
+
className: `text-sm font-medium tabular-nums text-gray-700 ${n.className || ""}`,
|
|
703
|
+
children: i
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
//#endregion
|
|
707
|
+
//#region src/widgets/AutoNumberField.tsx
|
|
708
|
+
function Ee({ value: e, field: t, ...n }) {
|
|
709
|
+
let r = e == null ? "-" : String(e);
|
|
710
|
+
return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
711
|
+
className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
|
|
712
|
+
children: r
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
//#endregion
|
|
716
|
+
//#region src/widgets/UserField.tsx
|
|
717
|
+
function V({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
718
|
+
let a = (n || i.schema)?.multiple || !1;
|
|
719
|
+
if (r) {
|
|
720
|
+
if (!e) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
721
|
+
className: "text-sm",
|
|
722
|
+
children: "-"
|
|
723
|
+
});
|
|
724
|
+
let t = Array.isArray(e) ? e : [e];
|
|
725
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
726
|
+
className: "flex -space-x-2",
|
|
727
|
+
children: [t.slice(0, 3).map((e, t) => {
|
|
728
|
+
let n = e.name || e.username || "User";
|
|
729
|
+
return /* @__PURE__ */ (0, A.jsx)(d, {
|
|
730
|
+
className: "size-8 border-2 border-white",
|
|
731
|
+
title: n,
|
|
732
|
+
children: /* @__PURE__ */ (0, A.jsx)(f, {
|
|
733
|
+
className: "bg-blue-500 text-white text-xs",
|
|
734
|
+
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
735
|
+
})
|
|
736
|
+
}, t);
|
|
737
|
+
}), t.length > 3 && /* @__PURE__ */ (0, A.jsx)(d, {
|
|
738
|
+
className: "size-8 border-2 border-white",
|
|
739
|
+
children: /* @__PURE__ */ (0, A.jsxs)(f, {
|
|
740
|
+
className: "bg-gray-200 text-gray-600 text-xs",
|
|
741
|
+
children: ["+", t.length - 3]
|
|
742
|
+
})
|
|
743
|
+
})]
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
let o = e ? Array.isArray(e) ? e : [e] : [], s = (e) => {
|
|
747
|
+
if (a) {
|
|
748
|
+
let n = o.filter((t, n) => n !== e);
|
|
749
|
+
t(n.length > 0 ? n : null);
|
|
750
|
+
} else t(null);
|
|
751
|
+
};
|
|
752
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
753
|
+
className: i.className,
|
|
754
|
+
children: [o.length > 0 && /* @__PURE__ */ (0, A.jsx)("div", {
|
|
755
|
+
className: "flex flex-wrap gap-2 mb-2",
|
|
756
|
+
children: o.map((e, t) => {
|
|
757
|
+
let n = e.name || e.username || "User";
|
|
758
|
+
return /* @__PURE__ */ (0, A.jsxs)(m, {
|
|
759
|
+
variant: "outline",
|
|
760
|
+
className: "gap-2 pr-1",
|
|
761
|
+
children: [
|
|
762
|
+
/* @__PURE__ */ (0, A.jsx)(d, {
|
|
763
|
+
className: "size-5",
|
|
764
|
+
children: /* @__PURE__ */ (0, A.jsx)(f, {
|
|
765
|
+
className: "bg-blue-500 text-white text-xs",
|
|
766
|
+
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
767
|
+
})
|
|
768
|
+
}),
|
|
769
|
+
/* @__PURE__ */ (0, A.jsx)("span", {
|
|
770
|
+
className: "text-sm",
|
|
771
|
+
children: n
|
|
772
|
+
}),
|
|
773
|
+
/* @__PURE__ */ (0, A.jsx)("button", {
|
|
774
|
+
type: "button",
|
|
775
|
+
onClick: () => s(t),
|
|
776
|
+
className: "ml-1 rounded-full hover:bg-gray-200 p-0.5",
|
|
777
|
+
children: /* @__PURE__ */ (0, A.jsx)(k, { className: "size-3" })
|
|
778
|
+
})
|
|
779
|
+
]
|
|
780
|
+
}, t);
|
|
781
|
+
})
|
|
782
|
+
}), /* @__PURE__ */ (0, A.jsx)("div", {
|
|
783
|
+
className: "text-sm text-gray-500 italic",
|
|
784
|
+
children: "User selection component requires integration with user management system"
|
|
785
|
+
})]
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
//#endregion
|
|
789
|
+
//#region src/widgets/ObjectField.tsx
|
|
790
|
+
function De({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
791
|
+
let a = n || i.schema, [s, c] = l(() => e == null ? "" : JSON.stringify(e, null, 2)), [u, d] = l(null);
|
|
792
|
+
return o(() => {
|
|
793
|
+
try {
|
|
794
|
+
if (e == null) {
|
|
795
|
+
c("");
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
let t = s ? JSON.parse(s) : null;
|
|
799
|
+
JSON.stringify(t) !== JSON.stringify(e) && c(JSON.stringify(e, null, 2));
|
|
800
|
+
} catch {
|
|
801
|
+
c(JSON.stringify(e, null, 2));
|
|
802
|
+
}
|
|
803
|
+
}, [e, s]), r ? e ? /* @__PURE__ */ (0, A.jsx)("pre", {
|
|
804
|
+
className: T("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40", i.className),
|
|
805
|
+
children: JSON.stringify(e, null, 2)
|
|
806
|
+
}) : /* @__PURE__ */ (0, A.jsx)("span", {
|
|
807
|
+
className: "text-sm",
|
|
808
|
+
children: "-"
|
|
809
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
810
|
+
className: "space-y-1",
|
|
811
|
+
children: [/* @__PURE__ */ (0, A.jsx)(w, {
|
|
812
|
+
value: s,
|
|
813
|
+
onChange: (e) => {
|
|
814
|
+
let n = e.target.value;
|
|
815
|
+
if (c(n), d(null), !n.trim()) {
|
|
816
|
+
t(null);
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
try {
|
|
820
|
+
t(JSON.parse(n));
|
|
821
|
+
} catch {
|
|
822
|
+
d("Invalid JSON");
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
placeholder: a?.placeholder || "{\n \"key\": \"value\"\n}",
|
|
826
|
+
disabled: r || i.disabled,
|
|
827
|
+
className: T("font-mono text-xs", u ? "border-red-500 focus-visible:ring-red-500" : "", i.className),
|
|
828
|
+
rows: 6
|
|
829
|
+
}), u && /* @__PURE__ */ (0, A.jsx)("p", {
|
|
830
|
+
className: "text-xs text-red-500",
|
|
831
|
+
children: u
|
|
832
|
+
})]
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/widgets/VectorField.tsx
|
|
837
|
+
function Oe({ value: e, field: t, ...n }) {
|
|
838
|
+
let r = (t || n.schema)?.dimensions || (Array.isArray(e) ? e.length : 0);
|
|
839
|
+
if (!e || !Array.isArray(e)) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
840
|
+
className: "text-sm text-gray-500",
|
|
841
|
+
children: "-"
|
|
842
|
+
});
|
|
843
|
+
let i = e.slice(0, 3).map((e) => {
|
|
844
|
+
let t = Number(e);
|
|
845
|
+
return isNaN(t) ? "0" : t.toFixed(4);
|
|
846
|
+
}).join(", ");
|
|
847
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
848
|
+
className: `text-sm ${n.className || ""}`,
|
|
849
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("span", {
|
|
850
|
+
className: "font-mono text-gray-700",
|
|
851
|
+
children: [
|
|
852
|
+
"[",
|
|
853
|
+
i,
|
|
854
|
+
"...]"
|
|
855
|
+
]
|
|
856
|
+
}), /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
857
|
+
className: "text-gray-500 ml-2",
|
|
858
|
+
children: [
|
|
859
|
+
"(",
|
|
860
|
+
r,
|
|
861
|
+
"D)"
|
|
862
|
+
]
|
|
863
|
+
})]
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
//#endregion
|
|
867
|
+
//#region src/widgets/GridField.tsx
|
|
868
|
+
function ke({ value: e, field: t, readonly: n, ...r }) {
|
|
869
|
+
let i = (t || r.schema)?.columns || [];
|
|
870
|
+
return !e || !Array.isArray(e) ? /* @__PURE__ */ (0, A.jsx)("span", {
|
|
871
|
+
className: "text-sm text-muted-foreground",
|
|
872
|
+
children: "-"
|
|
873
|
+
}) : n ? /* @__PURE__ */ (0, A.jsx)("div", {
|
|
874
|
+
className: T("text-sm", r.className),
|
|
875
|
+
children: /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
876
|
+
className: "text-foreground",
|
|
877
|
+
children: [e.length, " rows"]
|
|
878
|
+
})
|
|
879
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
880
|
+
className: T("border border-border rounded-lg overflow-hidden", r.className),
|
|
881
|
+
children: [/* @__PURE__ */ (0, A.jsx)("div", {
|
|
882
|
+
className: "overflow-auto max-h-60",
|
|
883
|
+
children: /* @__PURE__ */ (0, A.jsxs)("table", {
|
|
884
|
+
className: "w-full text-sm",
|
|
885
|
+
children: [/* @__PURE__ */ (0, A.jsx)("thead", {
|
|
886
|
+
className: "bg-muted border-b border-border",
|
|
887
|
+
children: /* @__PURE__ */ (0, A.jsx)("tr", { children: i.map((e, t) => /* @__PURE__ */ (0, A.jsx)("th", {
|
|
888
|
+
className: "px-3 py-2 text-left text-xs font-medium text-muted-foreground",
|
|
889
|
+
children: e.label || e.name
|
|
890
|
+
}, t)) })
|
|
891
|
+
}), /* @__PURE__ */ (0, A.jsx)("tbody", {
|
|
892
|
+
className: "divide-y divide-border",
|
|
893
|
+
children: e.slice(0, 5).map((e, t) => /* @__PURE__ */ (0, A.jsx)("tr", {
|
|
894
|
+
className: "hover:bg-muted/50 transition-colors",
|
|
895
|
+
children: i.map((t, n) => /* @__PURE__ */ (0, A.jsx)("td", {
|
|
896
|
+
className: "px-3 py-2 text-foreground",
|
|
897
|
+
children: e[t.name] == null ? "-" : String(e[t.name])
|
|
898
|
+
}, n))
|
|
899
|
+
}, t))
|
|
900
|
+
})]
|
|
901
|
+
})
|
|
902
|
+
}), e.length > 5 && /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
903
|
+
className: "bg-muted px-3 py-2 text-xs text-muted-foreground border-t border-border",
|
|
904
|
+
children: [
|
|
905
|
+
"Showing 5 of ",
|
|
906
|
+
e.length,
|
|
907
|
+
" rows"
|
|
908
|
+
]
|
|
909
|
+
})]
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
//#endregion
|
|
913
|
+
//#region src/widgets/ColorField.tsx
|
|
914
|
+
function Ae({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
915
|
+
let a = n || i.schema;
|
|
916
|
+
return r ? /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
917
|
+
className: "flex items-center gap-2",
|
|
918
|
+
children: [/* @__PURE__ */ (0, A.jsx)("div", {
|
|
919
|
+
className: "w-6 h-6 rounded border border-input",
|
|
920
|
+
style: { backgroundColor: e || "#000000" }
|
|
921
|
+
}), /* @__PURE__ */ (0, A.jsx)("span", {
|
|
922
|
+
className: "text-sm",
|
|
923
|
+
children: e || "-"
|
|
924
|
+
})]
|
|
925
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
926
|
+
className: "flex items-center gap-2",
|
|
927
|
+
children: [/* @__PURE__ */ (0, A.jsx)("input", {
|
|
928
|
+
type: "color",
|
|
929
|
+
value: e || "#000000",
|
|
930
|
+
onChange: (e) => t(e.target.value),
|
|
931
|
+
disabled: r || i.disabled,
|
|
932
|
+
className: "w-10 h-10 rounded border border-input cursor-pointer"
|
|
933
|
+
}), /* @__PURE__ */ (0, A.jsx)(_, {
|
|
934
|
+
type: "text",
|
|
935
|
+
value: e || "",
|
|
936
|
+
onChange: (e) => t(e.target.value),
|
|
937
|
+
placeholder: a?.placeholder || "#000000",
|
|
938
|
+
disabled: r || i.disabled,
|
|
939
|
+
className: i.className,
|
|
940
|
+
pattern: "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
|
|
941
|
+
})]
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region src/widgets/SliderField.tsx
|
|
946
|
+
function je({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
947
|
+
let a = n || i.schema, o = a?.min ?? 0, s = a?.max ?? 100, c = a?.step ?? 1;
|
|
948
|
+
return r ? /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
949
|
+
className: "flex items-center gap-2",
|
|
950
|
+
children: [/* @__PURE__ */ (0, A.jsx)("span", {
|
|
951
|
+
className: "text-sm font-medium",
|
|
952
|
+
children: e ?? o
|
|
953
|
+
}), /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
954
|
+
className: "text-xs text-muted-foreground",
|
|
955
|
+
children: ["/ ", s]
|
|
956
|
+
})]
|
|
957
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
958
|
+
className: "flex items-center gap-4",
|
|
959
|
+
children: [/* @__PURE__ */ (0, A.jsx)(S, {
|
|
960
|
+
value: [e ?? o],
|
|
961
|
+
onValueChange: (e) => t(e[0]),
|
|
962
|
+
min: o,
|
|
963
|
+
max: s,
|
|
964
|
+
step: c,
|
|
965
|
+
disabled: r || i.disabled,
|
|
966
|
+
className: i.className
|
|
967
|
+
}), /* @__PURE__ */ (0, A.jsx)("span", {
|
|
968
|
+
className: "text-sm font-medium w-12 text-right",
|
|
969
|
+
children: e ?? o
|
|
970
|
+
})]
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
//#endregion
|
|
974
|
+
//#region src/widgets/RatingField.tsx
|
|
975
|
+
function Me({ value: e, onChange: t, field: n, readonly: r, className: a, ...o }) {
|
|
976
|
+
let s = (n || o.schema)?.max ?? 5, c = e ?? 0, [l, u] = i.useState(null), d = l === null ? c : l;
|
|
977
|
+
return r ? /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
978
|
+
className: T("flex items-center gap-1", a),
|
|
979
|
+
children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ (0, A.jsx)(pe, { className: `w-5 h-5 ${t < c ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}` }, t)), /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
980
|
+
className: "ml-2 text-sm text-muted-foreground",
|
|
981
|
+
children: [
|
|
982
|
+
c,
|
|
983
|
+
" / ",
|
|
984
|
+
s
|
|
985
|
+
]
|
|
986
|
+
})]
|
|
987
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
988
|
+
className: T("flex items-center gap-1", a),
|
|
989
|
+
children: [Array.from({ length: s }, (e, n) => /* @__PURE__ */ (0, A.jsx)("button", {
|
|
990
|
+
type: "button",
|
|
991
|
+
onClick: () => t(n + 1),
|
|
992
|
+
onMouseEnter: () => u(n + 1),
|
|
993
|
+
onMouseLeave: () => u(null),
|
|
994
|
+
className: "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",
|
|
995
|
+
disabled: r || o.disabled,
|
|
996
|
+
children: /* @__PURE__ */ (0, A.jsx)(pe, { className: `w-5 h-5 transition-colors ${n < d ? "fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500" : "text-muted-foreground hover:text-yellow-400"}` })
|
|
997
|
+
}, n)), /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
998
|
+
className: "ml-2 text-sm text-muted-foreground",
|
|
999
|
+
children: [
|
|
1000
|
+
c,
|
|
1001
|
+
" / ",
|
|
1002
|
+
s
|
|
1003
|
+
]
|
|
1004
|
+
})]
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
//#endregion
|
|
1008
|
+
//#region src/widgets/CodeField.tsx
|
|
1009
|
+
function Ne({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1010
|
+
let a = n || i.schema, o = a?.language ?? "javascript";
|
|
1011
|
+
return r ? /* @__PURE__ */ (0, A.jsx)("pre", {
|
|
1012
|
+
className: T("text-sm bg-muted p-2 rounded overflow-x-auto border", i.className),
|
|
1013
|
+
children: /* @__PURE__ */ (0, A.jsx)("code", { children: e || "-" })
|
|
1014
|
+
}) : /* @__PURE__ */ (0, A.jsx)(w, {
|
|
1015
|
+
value: e || "",
|
|
1016
|
+
onChange: (e) => t(e.target.value),
|
|
1017
|
+
placeholder: a?.placeholder || `// Write ${o} code here...`,
|
|
1018
|
+
disabled: r || i.disabled,
|
|
1019
|
+
className: T("font-mono text-sm", i.className),
|
|
1020
|
+
rows: 12,
|
|
1021
|
+
spellCheck: !1
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
//#endregion
|
|
1025
|
+
//#region src/widgets/AvatarField.tsx
|
|
1026
|
+
function Pe({ value: e, onChange: t, field: n, readonly: r, ...a }) {
|
|
1027
|
+
let [o, s] = i.useState(!1), c = i.useRef(null), l = n || a.schema, u = (e) => {
|
|
1028
|
+
let n = e.target.files?.[0];
|
|
1029
|
+
if (!n) return;
|
|
1030
|
+
if (!n.type.startsWith("image/")) {
|
|
1031
|
+
console.error("Please select an image file");
|
|
1032
|
+
return;
|
|
1033
|
+
}
|
|
1034
|
+
if (n.size > 5 * 1024 * 1024) {
|
|
1035
|
+
console.error("File size must be less than 5MB");
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
let r = new FileReader();
|
|
1039
|
+
r.onloadend = () => {
|
|
1040
|
+
t(r.result);
|
|
1041
|
+
}, r.readAsDataURL(n);
|
|
1042
|
+
}, m = () => {
|
|
1043
|
+
t("");
|
|
1044
|
+
}, g = () => (l?.defaultName || l?.label || "User").split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
1045
|
+
return r ? /* @__PURE__ */ (0, A.jsxs)(d, {
|
|
1046
|
+
className: "w-16 h-16",
|
|
1047
|
+
children: [e && /* @__PURE__ */ (0, A.jsx)(p, {
|
|
1048
|
+
src: e,
|
|
1049
|
+
alt: l?.label
|
|
1050
|
+
}), /* @__PURE__ */ (0, A.jsx)(f, { children: g() })]
|
|
1051
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1052
|
+
className: "flex items-center gap-4",
|
|
1053
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1054
|
+
className: "relative",
|
|
1055
|
+
onMouseEnter: () => s(!0),
|
|
1056
|
+
onMouseLeave: () => s(!1),
|
|
1057
|
+
children: [/* @__PURE__ */ (0, A.jsxs)(d, {
|
|
1058
|
+
className: "w-16 h-16",
|
|
1059
|
+
children: [e && /* @__PURE__ */ (0, A.jsx)(p, {
|
|
1060
|
+
src: e,
|
|
1061
|
+
alt: l?.label
|
|
1062
|
+
}), /* @__PURE__ */ (0, A.jsx)(f, { children: g() })]
|
|
1063
|
+
}), !r && o && e && /* @__PURE__ */ (0, A.jsx)("button", {
|
|
1064
|
+
type: "button",
|
|
1065
|
+
onClick: m,
|
|
1066
|
+
className: "absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",
|
|
1067
|
+
children: /* @__PURE__ */ (0, A.jsx)(k, { className: "w-3 h-3" })
|
|
1068
|
+
})]
|
|
1069
|
+
}), /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1070
|
+
className: "flex flex-col gap-2",
|
|
1071
|
+
children: [
|
|
1072
|
+
/* @__PURE__ */ (0, A.jsx)("input", {
|
|
1073
|
+
ref: c,
|
|
1074
|
+
type: "file",
|
|
1075
|
+
accept: "image/*",
|
|
1076
|
+
onChange: u,
|
|
1077
|
+
className: "hidden"
|
|
1078
|
+
}),
|
|
1079
|
+
/* @__PURE__ */ (0, A.jsxs)(h, {
|
|
1080
|
+
type: "button",
|
|
1081
|
+
variant: "outline",
|
|
1082
|
+
size: "sm",
|
|
1083
|
+
onClick: () => c.current?.click(),
|
|
1084
|
+
disabled: r || a.disabled,
|
|
1085
|
+
children: [
|
|
1086
|
+
/* @__PURE__ */ (0, A.jsx)(me, { className: "w-4 h-4 mr-2" }),
|
|
1087
|
+
e ? "Change" : "Upload",
|
|
1088
|
+
" Avatar"
|
|
1089
|
+
]
|
|
1090
|
+
}),
|
|
1091
|
+
/* @__PURE__ */ (0, A.jsx)("p", {
|
|
1092
|
+
className: "text-xs text-muted-foreground",
|
|
1093
|
+
children: "PNG, JPG up to 5MB"
|
|
1094
|
+
})
|
|
1095
|
+
]
|
|
1096
|
+
})]
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
//#endregion
|
|
1100
|
+
//#region src/widgets/AddressField.tsx
|
|
1101
|
+
function Fe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
1102
|
+
let a = e || {}, o = (e, n) => {
|
|
1103
|
+
t({
|
|
1104
|
+
...a,
|
|
1105
|
+
[e]: n
|
|
1106
|
+
});
|
|
1107
|
+
};
|
|
1108
|
+
return r ? /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1109
|
+
className: "text-sm",
|
|
1110
|
+
children: ((e) => [
|
|
1111
|
+
e.street,
|
|
1112
|
+
e.city,
|
|
1113
|
+
[e.state, e.zipCode].filter(Boolean).join(" "),
|
|
1114
|
+
e.country
|
|
1115
|
+
].filter(Boolean).join(", ") || "-")(a)
|
|
1116
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1117
|
+
className: "space-y-3",
|
|
1118
|
+
children: [
|
|
1119
|
+
/* @__PURE__ */ (0, A.jsxs)("div", { children: [/* @__PURE__ */ (0, A.jsx)(v, {
|
|
1120
|
+
htmlFor: "street",
|
|
1121
|
+
className: "text-xs",
|
|
1122
|
+
children: "Street Address"
|
|
1123
|
+
}), /* @__PURE__ */ (0, A.jsx)(_, {
|
|
1124
|
+
id: "street",
|
|
1125
|
+
type: "text",
|
|
1126
|
+
value: a.street || "",
|
|
1127
|
+
onChange: (e) => o("street", e.target.value),
|
|
1128
|
+
placeholder: "123 Main St",
|
|
1129
|
+
disabled: r || i.disabled,
|
|
1130
|
+
className: i.className
|
|
1131
|
+
})] }),
|
|
1132
|
+
/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1133
|
+
className: "grid grid-cols-2 gap-3",
|
|
1134
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("div", { children: [/* @__PURE__ */ (0, A.jsx)(v, {
|
|
1135
|
+
htmlFor: "city",
|
|
1136
|
+
className: "text-xs",
|
|
1137
|
+
children: "City"
|
|
1138
|
+
}), /* @__PURE__ */ (0, A.jsx)(_, {
|
|
1139
|
+
id: "city",
|
|
1140
|
+
type: "text",
|
|
1141
|
+
value: a.city || "",
|
|
1142
|
+
onChange: (e) => o("city", e.target.value),
|
|
1143
|
+
placeholder: "San Francisco",
|
|
1144
|
+
disabled: r || i.disabled
|
|
1145
|
+
})] }), /* @__PURE__ */ (0, A.jsxs)("div", { children: [/* @__PURE__ */ (0, A.jsx)(v, {
|
|
1146
|
+
htmlFor: "state",
|
|
1147
|
+
className: "text-xs",
|
|
1148
|
+
children: "State / Province"
|
|
1149
|
+
}), /* @__PURE__ */ (0, A.jsx)(_, {
|
|
1150
|
+
id: "state",
|
|
1151
|
+
type: "text",
|
|
1152
|
+
value: a.state || "",
|
|
1153
|
+
onChange: (e) => o("state", e.target.value),
|
|
1154
|
+
placeholder: "CA",
|
|
1155
|
+
disabled: r || i.disabled
|
|
1156
|
+
})] })]
|
|
1157
|
+
}),
|
|
1158
|
+
/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1159
|
+
className: "grid grid-cols-2 gap-3",
|
|
1160
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("div", { children: [/* @__PURE__ */ (0, A.jsx)(v, {
|
|
1161
|
+
htmlFor: "zipCode",
|
|
1162
|
+
className: "text-xs",
|
|
1163
|
+
children: "ZIP / Postal Code"
|
|
1164
|
+
}), /* @__PURE__ */ (0, A.jsx)(_, {
|
|
1165
|
+
id: "zipCode",
|
|
1166
|
+
type: "text",
|
|
1167
|
+
value: a.zipCode || "",
|
|
1168
|
+
onChange: (e) => o("zipCode", e.target.value),
|
|
1169
|
+
placeholder: "94102",
|
|
1170
|
+
disabled: r || i.disabled
|
|
1171
|
+
})] }), /* @__PURE__ */ (0, A.jsxs)("div", { children: [/* @__PURE__ */ (0, A.jsx)(v, {
|
|
1172
|
+
htmlFor: "country",
|
|
1173
|
+
className: "text-xs",
|
|
1174
|
+
children: "Country"
|
|
1175
|
+
}), /* @__PURE__ */ (0, A.jsx)(_, {
|
|
1176
|
+
id: "country",
|
|
1177
|
+
type: "text",
|
|
1178
|
+
value: a.country || "",
|
|
1179
|
+
onChange: (e) => o("country", e.target.value),
|
|
1180
|
+
placeholder: "United States",
|
|
1181
|
+
disabled: r || i.disabled
|
|
1182
|
+
})] })]
|
|
1183
|
+
})
|
|
1184
|
+
]
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
//#endregion
|
|
1188
|
+
//#region src/widgets/GeolocationField.tsx
|
|
1189
|
+
function Ie({ value: e, onChange: t, field: n, readonly: r, ...a }) {
|
|
1190
|
+
let [o, s] = i.useState(!1), c = e || {}, l = (e, n) => {
|
|
1191
|
+
t({
|
|
1192
|
+
...c,
|
|
1193
|
+
[e]: n ? Number(n) : void 0
|
|
1194
|
+
});
|
|
1195
|
+
}, u = () => {
|
|
1196
|
+
if (!navigator.geolocation) {
|
|
1197
|
+
console.error("Geolocation is not supported by this browser");
|
|
1198
|
+
return;
|
|
1199
|
+
}
|
|
1200
|
+
s(!0), navigator.geolocation.getCurrentPosition((e) => {
|
|
1201
|
+
t({
|
|
1202
|
+
latitude: e.coords.latitude,
|
|
1203
|
+
longitude: e.coords.longitude,
|
|
1204
|
+
accuracy: e.coords.accuracy
|
|
1205
|
+
}), s(!1);
|
|
1206
|
+
}, (e) => {
|
|
1207
|
+
console.error("Error getting location:", e.message), s(!1);
|
|
1208
|
+
}, {
|
|
1209
|
+
enableHighAccuracy: !0,
|
|
1210
|
+
timeout: 5e3,
|
|
1211
|
+
maximumAge: 0
|
|
1212
|
+
});
|
|
1213
|
+
}, d = (e) => !e.latitude || !e.longitude ? "-" : `${e.latitude.toFixed(6)}, ${e.longitude.toFixed(6)}`, f = () => {
|
|
1214
|
+
if (!c.latitude || !c.longitude) return;
|
|
1215
|
+
let e = `https://www.google.com/maps?q=${c.latitude},${c.longitude}`;
|
|
1216
|
+
window.open(e, "_blank");
|
|
1217
|
+
};
|
|
1218
|
+
return r ? /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1219
|
+
className: "flex items-center gap-2",
|
|
1220
|
+
children: [
|
|
1221
|
+
/* @__PURE__ */ (0, A.jsx)(O, { className: "w-4 h-4 text-muted-foreground" }),
|
|
1222
|
+
/* @__PURE__ */ (0, A.jsx)("span", {
|
|
1223
|
+
className: "text-sm",
|
|
1224
|
+
children: d(c)
|
|
1225
|
+
}),
|
|
1226
|
+
c.latitude && c.longitude && /* @__PURE__ */ (0, A.jsx)(h, {
|
|
1227
|
+
type: "button",
|
|
1228
|
+
variant: "link",
|
|
1229
|
+
size: "sm",
|
|
1230
|
+
onClick: f,
|
|
1231
|
+
className: "p-0 h-auto",
|
|
1232
|
+
children: "View on map"
|
|
1233
|
+
})
|
|
1234
|
+
]
|
|
1235
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1236
|
+
className: "space-y-3",
|
|
1237
|
+
children: [
|
|
1238
|
+
/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1239
|
+
className: "flex items-center gap-2",
|
|
1240
|
+
children: [/* @__PURE__ */ (0, A.jsxs)(h, {
|
|
1241
|
+
type: "button",
|
|
1242
|
+
variant: "outline",
|
|
1243
|
+
size: "sm",
|
|
1244
|
+
onClick: u,
|
|
1245
|
+
disabled: r || o,
|
|
1246
|
+
children: [/* @__PURE__ */ (0, A.jsx)(ne, { className: "w-4 h-4 mr-2" }), o ? "Getting location..." : "Use Current Location"]
|
|
1247
|
+
}), c.latitude && c.longitude && /* @__PURE__ */ (0, A.jsxs)(h, {
|
|
1248
|
+
type: "button",
|
|
1249
|
+
variant: "link",
|
|
1250
|
+
size: "sm",
|
|
1251
|
+
onClick: f,
|
|
1252
|
+
children: [/* @__PURE__ */ (0, A.jsx)(O, { className: "w-4 h-4 mr-2" }), "View on map"]
|
|
1253
|
+
})]
|
|
1254
|
+
}),
|
|
1255
|
+
/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1256
|
+
className: "grid grid-cols-2 gap-3",
|
|
1257
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("div", { children: [/* @__PURE__ */ (0, A.jsx)(v, {
|
|
1258
|
+
htmlFor: "latitude",
|
|
1259
|
+
className: "text-xs",
|
|
1260
|
+
children: "Latitude"
|
|
1261
|
+
}), /* @__PURE__ */ (0, A.jsx)(_, {
|
|
1262
|
+
id: "latitude",
|
|
1263
|
+
type: "number",
|
|
1264
|
+
value: c.latitude ?? "",
|
|
1265
|
+
onChange: (e) => l("latitude", e.target.value),
|
|
1266
|
+
placeholder: "37.7749",
|
|
1267
|
+
disabled: r || a.disabled,
|
|
1268
|
+
step: "any",
|
|
1269
|
+
className: a.className
|
|
1270
|
+
})] }), /* @__PURE__ */ (0, A.jsxs)("div", { children: [/* @__PURE__ */ (0, A.jsx)(v, {
|
|
1271
|
+
htmlFor: "longitude",
|
|
1272
|
+
className: "text-xs",
|
|
1273
|
+
children: "Longitude"
|
|
1274
|
+
}), /* @__PURE__ */ (0, A.jsx)(_, {
|
|
1275
|
+
id: "longitude",
|
|
1276
|
+
type: "number",
|
|
1277
|
+
value: c.longitude ?? "",
|
|
1278
|
+
onChange: (e) => l("longitude", e.target.value),
|
|
1279
|
+
placeholder: "-122.4194",
|
|
1280
|
+
disabled: r || a.disabled,
|
|
1281
|
+
step: "any"
|
|
1282
|
+
})] })]
|
|
1283
|
+
}),
|
|
1284
|
+
c.accuracy && /* @__PURE__ */ (0, A.jsxs)("p", {
|
|
1285
|
+
className: "text-xs text-muted-foreground",
|
|
1286
|
+
children: [
|
|
1287
|
+
"Accuracy: ±",
|
|
1288
|
+
c.accuracy.toFixed(0),
|
|
1289
|
+
"m"
|
|
1290
|
+
]
|
|
1291
|
+
})
|
|
1292
|
+
]
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
//#endregion
|
|
1296
|
+
//#region src/widgets/SignatureField.tsx
|
|
1297
|
+
function Le({ value: e, onChange: t, readonly: n }) {
|
|
1298
|
+
let r = c(null), [a, s] = i.useState(!1), [l, u] = i.useState(!e);
|
|
1299
|
+
o(() => {
|
|
1300
|
+
if (e && r.current) {
|
|
1301
|
+
let t = r.current.getContext("2d");
|
|
1302
|
+
if (t) {
|
|
1303
|
+
let n = new Image();
|
|
1304
|
+
n.onload = () => {
|
|
1305
|
+
t.drawImage(n, 0, 0), u(!1);
|
|
1306
|
+
}, n.src = e;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
}, [e]);
|
|
1310
|
+
let d = (e) => {
|
|
1311
|
+
if (n) return;
|
|
1312
|
+
s(!0), u(!1);
|
|
1313
|
+
let t = r.current;
|
|
1314
|
+
if (!t) return;
|
|
1315
|
+
let i = t.getContext("2d");
|
|
1316
|
+
if (!i) return;
|
|
1317
|
+
let a = t.getBoundingClientRect(), o = "touches" in e ? e.touches[0].clientX - a.left : e.clientX - a.left, c = "touches" in e ? e.touches[0].clientY - a.top : e.clientY - a.top;
|
|
1318
|
+
i.beginPath(), i.moveTo(o, c);
|
|
1319
|
+
}, f = (e) => {
|
|
1320
|
+
if (!a || n) return;
|
|
1321
|
+
let t = r.current;
|
|
1322
|
+
if (!t) return;
|
|
1323
|
+
let i = t.getContext("2d");
|
|
1324
|
+
if (!i) return;
|
|
1325
|
+
let o = t.getBoundingClientRect(), s = "touches" in e ? e.touches[0].clientX - o.left : e.clientX - o.left, c = "touches" in e ? e.touches[0].clientY - o.top : e.clientY - o.top;
|
|
1326
|
+
i.lineTo(s, c), i.strokeStyle = "#000", i.lineWidth = 2, i.lineCap = "round", i.lineJoin = "round", i.stroke();
|
|
1327
|
+
}, p = () => {
|
|
1328
|
+
if (!a) return;
|
|
1329
|
+
s(!1);
|
|
1330
|
+
let e = r.current;
|
|
1331
|
+
e && t(e.toDataURL("image/png"));
|
|
1332
|
+
};
|
|
1333
|
+
return n && e ? /* @__PURE__ */ (0, A.jsx)("div", {
|
|
1334
|
+
className: "border rounded p-2 bg-white",
|
|
1335
|
+
children: /* @__PURE__ */ (0, A.jsx)("img", {
|
|
1336
|
+
src: e,
|
|
1337
|
+
alt: "Signature",
|
|
1338
|
+
loading: "lazy",
|
|
1339
|
+
className: "max-w-full h-auto"
|
|
1340
|
+
})
|
|
1341
|
+
}) : n && !e ? /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1342
|
+
className: "text-sm text-muted-foreground",
|
|
1343
|
+
children: "No signature"
|
|
1344
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1345
|
+
className: "space-y-2",
|
|
1346
|
+
children: [/* @__PURE__ */ (0, A.jsx)("div", {
|
|
1347
|
+
className: "border rounded bg-white",
|
|
1348
|
+
children: /* @__PURE__ */ (0, A.jsx)("canvas", {
|
|
1349
|
+
ref: r,
|
|
1350
|
+
width: 400,
|
|
1351
|
+
height: 200,
|
|
1352
|
+
className: "w-full touch-none cursor-crosshair",
|
|
1353
|
+
onMouseDown: d,
|
|
1354
|
+
onMouseMove: f,
|
|
1355
|
+
onMouseUp: p,
|
|
1356
|
+
onMouseLeave: p,
|
|
1357
|
+
onTouchStart: d,
|
|
1358
|
+
onTouchMove: f,
|
|
1359
|
+
onTouchEnd: p
|
|
1360
|
+
})
|
|
1361
|
+
}), /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1362
|
+
className: "flex justify-between items-center",
|
|
1363
|
+
children: [/* @__PURE__ */ (0, A.jsx)("p", {
|
|
1364
|
+
className: "text-xs text-muted-foreground",
|
|
1365
|
+
children: l ? "Sign above" : "Signature captured"
|
|
1366
|
+
}), /* @__PURE__ */ (0, A.jsxs)(h, {
|
|
1367
|
+
type: "button",
|
|
1368
|
+
variant: "outline",
|
|
1369
|
+
size: "sm",
|
|
1370
|
+
onClick: () => {
|
|
1371
|
+
let e = r.current;
|
|
1372
|
+
if (!e) return;
|
|
1373
|
+
let n = e.getContext("2d");
|
|
1374
|
+
n && (n.clearRect(0, 0, e.width, e.height), u(!0), t(""));
|
|
1375
|
+
},
|
|
1376
|
+
disabled: n || l,
|
|
1377
|
+
children: [/* @__PURE__ */ (0, A.jsx)(re, { className: "w-4 h-4 mr-2" }), "Clear"]
|
|
1378
|
+
})]
|
|
1379
|
+
})]
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
//#endregion
|
|
1383
|
+
//#region src/widgets/QRCodeField.tsx
|
|
1384
|
+
function Re({ value: e, onChange: t, field: n, readonly: r, ...a }) {
|
|
1385
|
+
let [o, s] = i.useState(!1), c = n || a.schema;
|
|
1386
|
+
return r ? /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1387
|
+
className: "flex items-center gap-3",
|
|
1388
|
+
children: [/* @__PURE__ */ (0, A.jsx)("span", {
|
|
1389
|
+
className: "text-sm flex-1 truncate",
|
|
1390
|
+
children: e || "-"
|
|
1391
|
+
}), e && /* @__PURE__ */ (0, A.jsxs)(h, {
|
|
1392
|
+
type: "button",
|
|
1393
|
+
variant: "outline",
|
|
1394
|
+
size: "sm",
|
|
1395
|
+
onClick: () => s(!o),
|
|
1396
|
+
children: [
|
|
1397
|
+
/* @__PURE__ */ (0, A.jsx)(fe, { className: "w-4 h-4 mr-2" }),
|
|
1398
|
+
o ? "Hide" : "Show",
|
|
1399
|
+
" QR"
|
|
1400
|
+
]
|
|
1401
|
+
})]
|
|
1402
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1403
|
+
className: "space-y-3",
|
|
1404
|
+
children: [
|
|
1405
|
+
/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1406
|
+
className: "flex items-center gap-2",
|
|
1407
|
+
children: [/* @__PURE__ */ (0, A.jsx)(_, {
|
|
1408
|
+
type: "text",
|
|
1409
|
+
value: e || "",
|
|
1410
|
+
onChange: (e) => t(e.target.value),
|
|
1411
|
+
placeholder: c?.placeholder || "Enter text for QR code",
|
|
1412
|
+
disabled: r || a.disabled,
|
|
1413
|
+
className: a.className
|
|
1414
|
+
}), e && /* @__PURE__ */ (0, A.jsxs)(A.Fragment, { children: [/* @__PURE__ */ (0, A.jsx)(h, {
|
|
1415
|
+
type: "button",
|
|
1416
|
+
variant: "outline",
|
|
1417
|
+
size: "sm",
|
|
1418
|
+
onClick: () => {
|
|
1419
|
+
e && navigator.clipboard.writeText(e);
|
|
1420
|
+
},
|
|
1421
|
+
children: /* @__PURE__ */ (0, A.jsx)(D, { className: "w-4 h-4" })
|
|
1422
|
+
}), /* @__PURE__ */ (0, A.jsx)(h, {
|
|
1423
|
+
type: "button",
|
|
1424
|
+
variant: "outline",
|
|
1425
|
+
size: "sm",
|
|
1426
|
+
onClick: () => s(!o),
|
|
1427
|
+
children: /* @__PURE__ */ (0, A.jsx)(fe, { className: "w-4 h-4" })
|
|
1428
|
+
})] })]
|
|
1429
|
+
}),
|
|
1430
|
+
o && e && /* @__PURE__ */ (0, A.jsx)("div", {
|
|
1431
|
+
className: "border rounded p-4 bg-white flex justify-center",
|
|
1432
|
+
children: /* @__PURE__ */ (0, A.jsx)("img", {
|
|
1433
|
+
src: ((e) => `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(e)}`)(e),
|
|
1434
|
+
alt: "QR Code",
|
|
1435
|
+
className: "w-48 h-48"
|
|
1436
|
+
})
|
|
1437
|
+
}),
|
|
1438
|
+
e && /* @__PURE__ */ (0, A.jsxs)("p", {
|
|
1439
|
+
className: "text-xs text-muted-foreground",
|
|
1440
|
+
children: [
|
|
1441
|
+
"QR code contains: ",
|
|
1442
|
+
e.length,
|
|
1443
|
+
" characters"
|
|
1444
|
+
]
|
|
1445
|
+
})
|
|
1446
|
+
]
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
//#endregion
|
|
1450
|
+
//#region src/widgets/MasterDetailField.tsx
|
|
1451
|
+
function ze({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
1452
|
+
let o = e || [], s = n || a.schema, c = () => {
|
|
1453
|
+
let e = {
|
|
1454
|
+
id: `new-${Date.now()}`,
|
|
1455
|
+
label: "New Related Record"
|
|
1456
|
+
};
|
|
1457
|
+
t([...o, e]);
|
|
1458
|
+
}, l = (e) => {
|
|
1459
|
+
t(o.filter((t) => t.id !== e));
|
|
1460
|
+
}, u = (e) => {
|
|
1461
|
+
console.log("View detail:", e);
|
|
1462
|
+
};
|
|
1463
|
+
return r ? /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1464
|
+
className: T("space-y-2", i),
|
|
1465
|
+
children: [o.length === 0 ? /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1466
|
+
className: "text-sm text-muted-foreground",
|
|
1467
|
+
children: "No related records"
|
|
1468
|
+
}) : o.map((e) => /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1469
|
+
className: "flex items-center justify-between p-2 border rounded hover:bg-muted/50",
|
|
1470
|
+
children: [/* @__PURE__ */ (0, A.jsx)("span", {
|
|
1471
|
+
className: "text-sm",
|
|
1472
|
+
children: e.label
|
|
1473
|
+
}), /* @__PURE__ */ (0, A.jsx)(h, {
|
|
1474
|
+
type: "button",
|
|
1475
|
+
variant: "ghost",
|
|
1476
|
+
size: "sm",
|
|
1477
|
+
onClick: () => u(e),
|
|
1478
|
+
children: /* @__PURE__ */ (0, A.jsx)(ie, { className: "w-4 h-4" })
|
|
1479
|
+
})]
|
|
1480
|
+
}, e.id)), /* @__PURE__ */ (0, A.jsxs)("p", {
|
|
1481
|
+
className: "text-xs text-muted-foreground",
|
|
1482
|
+
children: [
|
|
1483
|
+
o.length,
|
|
1484
|
+
" ",
|
|
1485
|
+
o.length === 1 ? "record" : "records"
|
|
1486
|
+
]
|
|
1487
|
+
})]
|
|
1488
|
+
}) : /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1489
|
+
className: T("space-y-3", i),
|
|
1490
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1491
|
+
className: "space-y-2",
|
|
1492
|
+
children: [o.map((e) => /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1493
|
+
className: "flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",
|
|
1494
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1495
|
+
className: "flex items-center gap-2 flex-1",
|
|
1496
|
+
children: [/* @__PURE__ */ (0, A.jsx)(m, {
|
|
1497
|
+
variant: "outline",
|
|
1498
|
+
children: e.id
|
|
1499
|
+
}), /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1500
|
+
className: "text-sm flex-1",
|
|
1501
|
+
children: e.label
|
|
1502
|
+
})]
|
|
1503
|
+
}), /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1504
|
+
className: "flex items-center gap-1",
|
|
1505
|
+
children: [/* @__PURE__ */ (0, A.jsx)(h, {
|
|
1506
|
+
type: "button",
|
|
1507
|
+
variant: "ghost",
|
|
1508
|
+
size: "sm",
|
|
1509
|
+
onClick: () => u(e),
|
|
1510
|
+
children: /* @__PURE__ */ (0, A.jsx)(ie, { className: "w-4 h-4" })
|
|
1511
|
+
}), /* @__PURE__ */ (0, A.jsx)(h, {
|
|
1512
|
+
type: "button",
|
|
1513
|
+
variant: "ghost",
|
|
1514
|
+
size: "sm",
|
|
1515
|
+
onClick: () => l(e.id),
|
|
1516
|
+
disabled: a.disabled,
|
|
1517
|
+
children: /* @__PURE__ */ (0, A.jsx)(k, { className: "w-4 h-4" })
|
|
1518
|
+
})]
|
|
1519
|
+
})]
|
|
1520
|
+
}, e.id)), o.length === 0 && /* @__PURE__ */ (0, A.jsx)("div", {
|
|
1521
|
+
className: "text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20",
|
|
1522
|
+
children: "No related records"
|
|
1523
|
+
})]
|
|
1524
|
+
}), /* @__PURE__ */ (0, A.jsxs)(h, {
|
|
1525
|
+
type: "button",
|
|
1526
|
+
variant: "outline",
|
|
1527
|
+
className: "w-full",
|
|
1528
|
+
onClick: c,
|
|
1529
|
+
disabled: a.disabled,
|
|
1530
|
+
children: [
|
|
1531
|
+
/* @__PURE__ */ (0, A.jsx)(de, { className: "w-4 h-4 mr-2" }),
|
|
1532
|
+
"Add ",
|
|
1533
|
+
s?.label || "Record"
|
|
1534
|
+
]
|
|
1535
|
+
})]
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
//#endregion
|
|
1539
|
+
//#region src/index.tsx
|
|
1540
|
+
function H(e) {
|
|
1541
|
+
if (e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean") return e;
|
|
1542
|
+
if (e instanceof Date) return e.toISOString();
|
|
1543
|
+
if (Array.isArray(e)) return e.map((e) => {
|
|
1544
|
+
if (typeof e == "object" && e) {
|
|
1545
|
+
let t = e;
|
|
1546
|
+
return String(t.name || t.label || t.id || t._id || "[Object]");
|
|
1547
|
+
}
|
|
1548
|
+
return String(e);
|
|
1549
|
+
}).join(", ");
|
|
1550
|
+
if (typeof e == "object") {
|
|
1551
|
+
let t = e;
|
|
1552
|
+
return "$numberDecimal" in t ? Number(t.$numberDecimal) : "$oid" in t ? String(t.$oid) : "$date" in t ? String(t.$date) : String(t.name || t.label || t.id || t._id || "[Object]");
|
|
1553
|
+
}
|
|
1554
|
+
return String(e);
|
|
1555
|
+
}
|
|
1556
|
+
function Be(e, t = "USD") {
|
|
1557
|
+
try {
|
|
1558
|
+
return new Intl.NumberFormat("en-US", {
|
|
1559
|
+
style: "currency",
|
|
1560
|
+
currency: t
|
|
1561
|
+
}).format(e);
|
|
1562
|
+
} catch {
|
|
1563
|
+
return `${t} ${e.toFixed(2)}`;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
function Ve(e, t = "USD") {
|
|
1567
|
+
try {
|
|
1568
|
+
return new Intl.NumberFormat("en-US", {
|
|
1569
|
+
style: "currency",
|
|
1570
|
+
currency: t,
|
|
1571
|
+
notation: "compact",
|
|
1572
|
+
maximumFractionDigits: 1
|
|
1573
|
+
}).format(e).replace(/\.0(?=[KMBT])/, "");
|
|
1574
|
+
} catch {
|
|
1575
|
+
return `${t} ${e}`;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
function He(e, t = 0) {
|
|
1579
|
+
return `${(e > -1 && e < 1 ? e * 100 : e).toFixed(t)}%`;
|
|
1580
|
+
}
|
|
1581
|
+
function U(e) {
|
|
1582
|
+
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
1583
|
+
}
|
|
1584
|
+
function Ue(e) {
|
|
1585
|
+
if (!e) return "-";
|
|
1586
|
+
let t = typeof e == "string" ? new Date(e) : e;
|
|
1587
|
+
if (isNaN(t.getTime())) return "-";
|
|
1588
|
+
let n = /* @__PURE__ */ new Date(), r = new Date(n.getFullYear(), n.getMonth(), n.getDate()), i = new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime() - r.getTime(), a = Math.round(i / (1e3 * 60 * 60 * 24));
|
|
1589
|
+
if (a === 0) return "Today";
|
|
1590
|
+
if (a === 1) return "Tomorrow";
|
|
1591
|
+
if (a === -1) return "Yesterday";
|
|
1592
|
+
if (a < -1) {
|
|
1593
|
+
let e = Math.abs(a);
|
|
1594
|
+
return e <= 7 ? `Overdue ${e}d` : W(t);
|
|
1595
|
+
}
|
|
1596
|
+
return a > 1 && a <= 7 ? `In ${a} days` : W(t);
|
|
1597
|
+
}
|
|
1598
|
+
function W(e, t) {
|
|
1599
|
+
if (!e) return "-";
|
|
1600
|
+
let n = typeof e == "string" ? new Date(e) : e;
|
|
1601
|
+
return isNaN(n.getTime()) ? "-" : t === "short" ? `${n.toLocaleDateString("en-US", { month: "short" })} ${n.getDate()}, '${String(n.getFullYear()).slice(-2)}` : t === "relative" ? Ue(n) : n.toLocaleDateString(void 0, {
|
|
1602
|
+
year: "numeric",
|
|
1603
|
+
month: "short",
|
|
1604
|
+
day: "numeric"
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
function We(e) {
|
|
1608
|
+
if (!e) return "-";
|
|
1609
|
+
let t = typeof e == "string" ? new Date(e) : e;
|
|
1610
|
+
return isNaN(t.getTime()) ? "-" : t.toLocaleDateString(void 0, {
|
|
1611
|
+
year: "numeric",
|
|
1612
|
+
month: "short",
|
|
1613
|
+
day: "numeric",
|
|
1614
|
+
hour: "2-digit",
|
|
1615
|
+
minute: "2-digit"
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
function G({ value: e }) {
|
|
1619
|
+
let t = H(e);
|
|
1620
|
+
return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1621
|
+
className: "truncate",
|
|
1622
|
+
children: t != null && t !== "" ? String(t) : "-"
|
|
1623
|
+
});
|
|
1624
|
+
}
|
|
1625
|
+
function Ge({ value: e, field: t }) {
|
|
1626
|
+
if (e == null) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1627
|
+
className: "text-muted-foreground",
|
|
1628
|
+
children: "-"
|
|
1629
|
+
});
|
|
1630
|
+
let n = H(e), r = t.precision ?? 0, i = Number(n);
|
|
1631
|
+
return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1632
|
+
className: "tabular-nums",
|
|
1633
|
+
children: isNaN(i) ? String(n) : new Intl.NumberFormat("en-US", {
|
|
1634
|
+
minimumFractionDigits: r,
|
|
1635
|
+
maximumFractionDigits: r
|
|
1636
|
+
}).format(i)
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1639
|
+
function Ke({ value: e, field: t }) {
|
|
1640
|
+
if (e == null) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1641
|
+
className: "text-muted-foreground",
|
|
1642
|
+
children: "-"
|
|
1643
|
+
});
|
|
1644
|
+
let n = H(e), r = t.currency || "USD", i = Number(n);
|
|
1645
|
+
return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1646
|
+
className: "tabular-nums font-medium whitespace-nowrap",
|
|
1647
|
+
children: isNaN(i) ? String(n) : Be(i, r)
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
var qe = /progress|completion/;
|
|
1651
|
+
function Je({ value: e, field: t }) {
|
|
1652
|
+
if (e == null) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1653
|
+
className: "text-muted-foreground",
|
|
1654
|
+
children: "-"
|
|
1655
|
+
});
|
|
1656
|
+
let n = H(e), r = t.precision ?? 0, i = Number(n);
|
|
1657
|
+
if (isNaN(i)) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1658
|
+
className: "tabular-nums whitespace-nowrap",
|
|
1659
|
+
children: String(n)
|
|
1660
|
+
});
|
|
1661
|
+
let a = qe.test(t?.name?.toLowerCase() || ""), o = a ? i : i > -1 && i < 1 ? i * 100 : i, s = a ? `${i.toFixed(r)}%` : He(i, r), c = Math.max(0, Math.min(100, o));
|
|
1662
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1663
|
+
className: "flex items-center gap-2",
|
|
1664
|
+
children: [/* @__PURE__ */ (0, A.jsx)("div", {
|
|
1665
|
+
className: "h-1.5 w-16 rounded-full bg-muted overflow-hidden flex-shrink-0",
|
|
1666
|
+
role: "progressbar",
|
|
1667
|
+
"aria-valuenow": c,
|
|
1668
|
+
"aria-valuemin": 0,
|
|
1669
|
+
"aria-valuemax": 100,
|
|
1670
|
+
children: /* @__PURE__ */ (0, A.jsx)("div", {
|
|
1671
|
+
className: "h-full rounded-full bg-primary transition-all",
|
|
1672
|
+
style: { width: `${c}%` }
|
|
1673
|
+
})
|
|
1674
|
+
}), /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1675
|
+
className: "tabular-nums whitespace-nowrap",
|
|
1676
|
+
children: s
|
|
1677
|
+
})]
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
var Ye = new Set([
|
|
1681
|
+
"active",
|
|
1682
|
+
"is_active",
|
|
1683
|
+
"enabled",
|
|
1684
|
+
"is_enabled",
|
|
1685
|
+
"verified",
|
|
1686
|
+
"is_verified"
|
|
2068
1687
|
]);
|
|
2069
|
-
function
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
1688
|
+
function Xe({ value: e, field: t }) {
|
|
1689
|
+
if (e == null) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1690
|
+
className: "text-muted-foreground/50 text-xs italic flex items-center justify-center",
|
|
1691
|
+
children: "—"
|
|
1692
|
+
});
|
|
1693
|
+
let n = t?.name?.toLowerCase() || "";
|
|
1694
|
+
return n === "completed" || n === "is_completed" || n === "done" || n === "is_done" ? /* @__PURE__ */ (0, A.jsx)("div", {
|
|
1695
|
+
className: "flex items-center justify-center",
|
|
1696
|
+
children: e ? /* @__PURE__ */ (0, A.jsx)("div", {
|
|
1697
|
+
className: "size-5 rounded-full bg-green-500 flex items-center justify-center",
|
|
1698
|
+
role: "img",
|
|
1699
|
+
"aria-label": "Completed",
|
|
1700
|
+
"data-testid": "completion-indicator",
|
|
1701
|
+
children: /* @__PURE__ */ (0, A.jsx)(E, { className: "size-3 text-white" })
|
|
1702
|
+
}) : /* @__PURE__ */ (0, A.jsx)("div", {
|
|
1703
|
+
className: "size-5 rounded-full border-2 border-muted-foreground/30",
|
|
1704
|
+
role: "img",
|
|
1705
|
+
"aria-label": "Not completed",
|
|
1706
|
+
"data-testid": "completion-indicator"
|
|
1707
|
+
})
|
|
1708
|
+
}) : Ye.has(n) && !e ? /* @__PURE__ */ (0, A.jsxs)(m, {
|
|
1709
|
+
variant: "destructive",
|
|
1710
|
+
className: "text-xs",
|
|
1711
|
+
"data-testid": "boolean-warning-badge",
|
|
1712
|
+
children: [t?.label || U(n), " — Off"]
|
|
1713
|
+
}) : /* @__PURE__ */ (0, A.jsx)("div", {
|
|
1714
|
+
className: "flex items-center justify-center",
|
|
1715
|
+
children: /* @__PURE__ */ (0, A.jsx)(g, {
|
|
1716
|
+
checked: !!e,
|
|
1717
|
+
disabled: !0,
|
|
1718
|
+
className: "pointer-events-none"
|
|
1719
|
+
})
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
function Ze({ value: e, field: t }) {
|
|
1723
|
+
if (!e) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1724
|
+
className: "text-muted-foreground",
|
|
1725
|
+
children: "-"
|
|
1726
|
+
});
|
|
1727
|
+
let n = H(e), r = W(n, t.format || "relative"), i = typeof n == "string" ? new Date(n) : n, a = i instanceof Date && !isNaN(i.getTime()), o = /* @__PURE__ */ new Date();
|
|
1728
|
+
o.setHours(0, 0, 0, 0);
|
|
1729
|
+
let s = a && i < o, c = a ? i.toISOString() : String(n);
|
|
1730
|
+
return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1731
|
+
className: `tabular-nums${s ? " text-red-600" : ""}`,
|
|
1732
|
+
title: c,
|
|
1733
|
+
children: r
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
function Qe({ value: e }) {
|
|
1737
|
+
if (!e) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1738
|
+
className: "text-muted-foreground",
|
|
1739
|
+
children: "-"
|
|
1740
|
+
});
|
|
1741
|
+
let t = H(e), n = typeof t == "string" ? new Date(t) : t;
|
|
1742
|
+
if (!(n instanceof Date) || isNaN(n.getTime())) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1743
|
+
className: "text-muted-foreground",
|
|
1744
|
+
children: "-"
|
|
1745
|
+
});
|
|
1746
|
+
let r = n.toLocaleDateString(void 0, {
|
|
1747
|
+
month: "numeric",
|
|
1748
|
+
day: "numeric",
|
|
1749
|
+
year: "numeric"
|
|
1750
|
+
}), i = n.toLocaleTimeString(void 0, {
|
|
1751
|
+
hour: "numeric",
|
|
1752
|
+
minute: "2-digit",
|
|
1753
|
+
hour12: !0
|
|
1754
|
+
}).toLowerCase();
|
|
1755
|
+
return /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
1756
|
+
className: "tabular-nums text-sm whitespace-nowrap",
|
|
1757
|
+
children: [/* @__PURE__ */ (0, A.jsx)("span", { children: r }), /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1758
|
+
className: "ml-2 text-muted-foreground",
|
|
1759
|
+
children: i
|
|
1760
|
+
})]
|
|
1761
|
+
});
|
|
1762
|
+
}
|
|
1763
|
+
var $e = {
|
|
1764
|
+
critical: "red",
|
|
1765
|
+
urgent: "red",
|
|
1766
|
+
high: "orange",
|
|
1767
|
+
medium: "yellow",
|
|
1768
|
+
normal: "blue",
|
|
1769
|
+
low: "gray",
|
|
1770
|
+
none: "gray",
|
|
1771
|
+
paid: "green",
|
|
1772
|
+
completed: "green",
|
|
1773
|
+
done: "green",
|
|
1774
|
+
active: "green",
|
|
1775
|
+
approved: "green",
|
|
1776
|
+
resolved: "green",
|
|
1777
|
+
pending: "yellow",
|
|
1778
|
+
waiting: "yellow",
|
|
1779
|
+
on_hold: "yellow",
|
|
1780
|
+
shipped: "blue",
|
|
1781
|
+
in_progress: "blue",
|
|
1782
|
+
open: "blue",
|
|
1783
|
+
processing: "blue",
|
|
1784
|
+
draft: "gray",
|
|
1785
|
+
new: "gray",
|
|
1786
|
+
inactive: "gray",
|
|
1787
|
+
closed: "gray",
|
|
1788
|
+
cancelled: "red",
|
|
1789
|
+
canceled: "red",
|
|
1790
|
+
rejected: "red",
|
|
1791
|
+
failed: "red",
|
|
1792
|
+
overdue: "red",
|
|
1793
|
+
delivered: "purple",
|
|
1794
|
+
archived: "indigo"
|
|
1795
|
+
}, et = {
|
|
1796
|
+
gray: "bg-gray-100 text-gray-800 border-gray-300",
|
|
1797
|
+
red: "bg-red-100 text-red-800 border-red-300",
|
|
1798
|
+
orange: "bg-orange-100 text-orange-800 border-orange-300",
|
|
1799
|
+
yellow: "bg-yellow-100 text-yellow-800 border-yellow-300",
|
|
1800
|
+
green: "bg-green-100 text-green-800 border-green-300",
|
|
1801
|
+
blue: "bg-blue-100 text-blue-800 border-blue-300",
|
|
1802
|
+
indigo: "bg-indigo-100 text-indigo-800 border-indigo-300",
|
|
1803
|
+
purple: "bg-purple-100 text-purple-800 border-purple-300",
|
|
1804
|
+
pink: "bg-pink-100 text-pink-800 border-pink-300"
|
|
2154
1805
|
};
|
|
2155
|
-
function
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
}
|
|
2222
|
-
function
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
}
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
}
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
}
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
}
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
}
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
}
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
phone: () => Promise.resolve().then(() => Kt).then((e) => ({ default: e.PhoneField })),
|
|
2567
|
-
url: () => Promise.resolve().then(() => er).then((e) => ({ default: e.UrlField })),
|
|
2568
|
-
// Specialized fields
|
|
2569
|
-
currency: () => Promise.resolve().then(() => rr).then((e) => ({ default: e.CurrencyField })),
|
|
2570
|
-
percent: () => Promise.resolve().then(() => ir).then((e) => ({ default: e.PercentField })),
|
|
2571
|
-
password: () => Promise.resolve().then(() => or).then((e) => ({ default: e.PasswordField })),
|
|
2572
|
-
markdown: () => Promise.resolve().then(() => Oe).then((e) => ({ default: e.RichTextField })),
|
|
2573
|
-
html: () => Promise.resolve().then(() => Oe).then((e) => ({ default: e.RichTextField })),
|
|
2574
|
-
lookup: () => Promise.resolve().then(() => nr).then((e) => ({ default: e.LookupField })),
|
|
2575
|
-
master_detail: () => Promise.resolve().then(() => Cr).then((e) => ({ default: e.MasterDetailField })),
|
|
2576
|
-
// File fields
|
|
2577
|
-
file: () => Promise.resolve().then(() => cr).then((e) => ({ default: e.FileField })),
|
|
2578
|
-
image: () => Promise.resolve().then(() => dr).then((e) => ({ default: e.ImageField })),
|
|
2579
|
-
// Location field
|
|
2580
|
-
location: () => Promise.resolve().then(() => ur).then((e) => ({ default: e.LocationField })),
|
|
2581
|
-
// Computed/Read-only fields
|
|
2582
|
-
formula: () => Promise.resolve().then(() => mr).then((e) => ({ default: e.FormulaField })),
|
|
2583
|
-
summary: () => Promise.resolve().then(() => fr).then((e) => ({ default: e.SummaryField })),
|
|
2584
|
-
auto_number: () => Promise.resolve().then(() => xr).then((e) => ({ default: e.AutoNumberField })),
|
|
2585
|
-
// User fields
|
|
2586
|
-
user: () => Promise.resolve().then(() => Re).then((e) => ({ default: e.UserField })),
|
|
2587
|
-
owner: () => Promise.resolve().then(() => Re).then((e) => ({ default: e.UserField })),
|
|
2588
|
-
// Complex data types
|
|
2589
|
-
object: () => Promise.resolve().then(() => pr).then((e) => ({ default: e.ObjectField })),
|
|
2590
|
-
vector: () => Promise.resolve().then(() => hr).then((e) => ({ default: e.VectorField })),
|
|
2591
|
-
grid: () => Promise.resolve().then(() => gr).then((e) => ({ default: e.GridField })),
|
|
2592
|
-
// Additional field types from @objectstack/spec
|
|
2593
|
-
color: () => Promise.resolve().then(() => br).then((e) => ({ default: e.ColorField })),
|
|
2594
|
-
slider: () => Promise.resolve().then(() => jr).then((e) => ({ default: e.SliderField })),
|
|
2595
|
-
rating: () => Promise.resolve().then(() => yr).then((e) => ({ default: e.RatingField })),
|
|
2596
|
-
code: () => Promise.resolve().then(() => Nr).then((e) => ({ default: e.CodeField })),
|
|
2597
|
-
avatar: () => Promise.resolve().then(() => vr).then((e) => ({ default: e.AvatarField })),
|
|
2598
|
-
address: () => Promise.resolve().then(() => _r).then((e) => ({ default: e.AddressField })),
|
|
2599
|
-
geolocation: () => Promise.resolve().then(() => wr).then((e) => ({ default: e.GeolocationField })),
|
|
2600
|
-
signature: () => Promise.resolve().then(() => Fr).then((e) => ({ default: e.SignatureField })),
|
|
2601
|
-
qrcode: () => Promise.resolve().then(() => Sr).then((e) => ({ default: e.QRCodeField }))
|
|
2602
|
-
};
|
|
2603
|
-
function Jr(e) {
|
|
2604
|
-
const r = jt[e];
|
|
2605
|
-
if (!r) {
|
|
2606
|
-
console.warn(`Unknown field type: ${e}`);
|
|
2607
|
-
return;
|
|
2608
|
-
}
|
|
2609
|
-
const n = k.lazy(r);
|
|
2610
|
-
g.register(e, n, { namespace: "field" });
|
|
2611
|
-
}
|
|
2612
|
-
function Wr() {
|
|
2613
|
-
Object.keys(jt).forEach((e) => {
|
|
2614
|
-
Jr(e);
|
|
2615
|
-
});
|
|
2616
|
-
}
|
|
2617
|
-
function ns() {
|
|
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" });
|
|
2619
|
-
}
|
|
2620
|
-
Wr();
|
|
2621
|
-
export {
|
|
2622
|
-
xt as AddressField,
|
|
2623
|
-
at as AutoNumberField,
|
|
2624
|
-
ft as AvatarField,
|
|
2625
|
-
Er as BooleanCellRenderer,
|
|
2626
|
-
Ue as BooleanField,
|
|
2627
|
-
mt as CodeField,
|
|
2628
|
-
ct as ColorField,
|
|
2629
|
-
kr as CurrencyCellRenderer,
|
|
2630
|
-
We as CurrencyField,
|
|
2631
|
-
Dr as DateCellRenderer,
|
|
2632
|
-
Be as DateField,
|
|
2633
|
-
Mr as DateTimeCellRenderer,
|
|
2634
|
-
He as DateTimeField,
|
|
2635
|
-
Ur as EmailCellRenderer,
|
|
2636
|
-
Ye as EmailField,
|
|
2637
|
-
Yr as FileCellRenderer,
|
|
2638
|
-
et as FileField,
|
|
2639
|
-
Ae as FormulaCellRenderer,
|
|
2640
|
-
st as FormulaField,
|
|
2641
|
-
pt as GeolocationField,
|
|
2642
|
-
ot as GridField,
|
|
2643
|
-
qr as ImageCellRenderer,
|
|
2644
|
-
tt as ImageField,
|
|
2645
|
-
rt as LocationField,
|
|
2646
|
-
ne as LookupCellRenderer,
|
|
2647
|
-
Qe as LookupField,
|
|
2648
|
-
bt as MasterDetailField,
|
|
2649
|
-
Rr as NumberCellRenderer,
|
|
2650
|
-
Ie as NumberField,
|
|
2651
|
-
lt as ObjectField,
|
|
2652
|
-
Ke as PasswordField,
|
|
2653
|
-
$r as PercentCellRenderer,
|
|
2654
|
-
Ze as PercentField,
|
|
2655
|
-
Br as PhoneCellRenderer,
|
|
2656
|
-
qe as PhoneField,
|
|
2657
|
-
gt as QRCodeField,
|
|
2658
|
-
ut as RatingField,
|
|
2659
|
-
ce as RichTextField,
|
|
2660
|
-
se as SelectCellRenderer,
|
|
2661
|
-
Ve as SelectField,
|
|
2662
|
-
ht as SignatureField,
|
|
2663
|
-
dt as SliderField,
|
|
2664
|
-
nt as SummaryField,
|
|
2665
|
-
Ge as TextAreaField,
|
|
2666
|
-
D as TextCellRenderer,
|
|
2667
|
-
Le as TextField,
|
|
2668
|
-
Xe as TimeField,
|
|
2669
|
-
Vr as UrlCellRenderer,
|
|
2670
|
-
Je as UrlField,
|
|
2671
|
-
ae as UserCellRenderer,
|
|
2672
|
-
de as UserField,
|
|
2673
|
-
it as VectorField,
|
|
2674
|
-
ss as buildValidationRules,
|
|
2675
|
-
$e as evaluateCondition,
|
|
2676
|
-
Zr as formatCompactCurrency,
|
|
2677
|
-
Pr as formatCurrency,
|
|
2678
|
-
me as formatDate,
|
|
2679
|
-
Kr as formatDateTime,
|
|
2680
|
-
rs as formatFileSize,
|
|
2681
|
-
Tr as formatPercent,
|
|
2682
|
-
Or as formatRelativeDate,
|
|
2683
|
-
es as getCellRenderer,
|
|
2684
|
-
ue as humanizeLabel,
|
|
2685
|
-
ts as mapFieldTypeToFormType,
|
|
2686
|
-
Wr as registerAllFields,
|
|
2687
|
-
Jr as registerField,
|
|
2688
|
-
G as registerFieldRenderer,
|
|
2689
|
-
ns as registerFields
|
|
1806
|
+
function tt(e, t) {
|
|
1807
|
+
return et[e || (t ? $e[String(t).toLowerCase().replace(/[\s-]/g, "_")] : void 0) || ""] || "bg-muted text-muted-foreground border-border";
|
|
1808
|
+
}
|
|
1809
|
+
function K({ value: e, field: t }) {
|
|
1810
|
+
let n = t.options || [];
|
|
1811
|
+
if (!e) return /* @__PURE__ */ (0, A.jsx)("span", { children: "-" });
|
|
1812
|
+
if (Array.isArray(e)) return /* @__PURE__ */ (0, A.jsx)("div", {
|
|
1813
|
+
className: "flex flex-wrap gap-1",
|
|
1814
|
+
children: e.map((e, t) => {
|
|
1815
|
+
let r = n.find((t) => t.value === e), i = r?.label || U(String(e));
|
|
1816
|
+
return /* @__PURE__ */ (0, A.jsx)(m, {
|
|
1817
|
+
variant: "outline",
|
|
1818
|
+
className: tt(r?.color, e),
|
|
1819
|
+
children: i
|
|
1820
|
+
}, t);
|
|
1821
|
+
})
|
|
1822
|
+
});
|
|
1823
|
+
let r = n.find((t) => t.value === e), i = r?.label || U(String(e));
|
|
1824
|
+
return /* @__PURE__ */ (0, A.jsx)(m, {
|
|
1825
|
+
variant: "outline",
|
|
1826
|
+
className: tt(r?.color, e),
|
|
1827
|
+
children: i
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
function nt({ value: e }) {
|
|
1831
|
+
if (!e) return /* @__PURE__ */ (0, A.jsx)("span", { children: "-" });
|
|
1832
|
+
let t = String(H(e) ?? ""), [n, r] = i.useState(!1);
|
|
1833
|
+
return /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
1834
|
+
className: "inline-flex items-center gap-1 group/email",
|
|
1835
|
+
children: [/* @__PURE__ */ (0, A.jsx)(h, {
|
|
1836
|
+
variant: "link",
|
|
1837
|
+
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
1838
|
+
asChild: !0,
|
|
1839
|
+
children: /* @__PURE__ */ (0, A.jsx)("a", {
|
|
1840
|
+
href: `mailto:${t}`,
|
|
1841
|
+
onClick: (e) => e.stopPropagation(),
|
|
1842
|
+
children: t
|
|
1843
|
+
})
|
|
1844
|
+
}), /* @__PURE__ */ (0, A.jsx)("button", {
|
|
1845
|
+
type: "button",
|
|
1846
|
+
className: "opacity-0 group-hover/email:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
1847
|
+
onClick: (e) => {
|
|
1848
|
+
e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(t).then(() => {
|
|
1849
|
+
r(!0), setTimeout(() => r(!1), 2e3);
|
|
1850
|
+
}).catch(() => {});
|
|
1851
|
+
},
|
|
1852
|
+
"aria-label": "Copy email",
|
|
1853
|
+
children: n ? /* @__PURE__ */ (0, A.jsx)(E, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ (0, A.jsx)(D, { className: "h-3 w-3 text-muted-foreground" })
|
|
1854
|
+
})]
|
|
1855
|
+
});
|
|
1856
|
+
}
|
|
1857
|
+
function rt({ value: e }) {
|
|
1858
|
+
if (!e) return /* @__PURE__ */ (0, A.jsx)("span", { children: "-" });
|
|
1859
|
+
let t = String(H(e) ?? "");
|
|
1860
|
+
return /* @__PURE__ */ (0, A.jsx)(h, {
|
|
1861
|
+
variant: "link",
|
|
1862
|
+
className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
|
|
1863
|
+
asChild: !0,
|
|
1864
|
+
children: /* @__PURE__ */ (0, A.jsx)("a", {
|
|
1865
|
+
href: t,
|
|
1866
|
+
target: "_blank",
|
|
1867
|
+
rel: "noopener noreferrer",
|
|
1868
|
+
onClick: (e) => e.stopPropagation(),
|
|
1869
|
+
children: t
|
|
1870
|
+
})
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
function it({ value: e }) {
|
|
1874
|
+
if (!e) return /* @__PURE__ */ (0, A.jsx)("span", { children: "-" });
|
|
1875
|
+
let t = String(H(e) ?? ""), [n, r] = i.useState(!1);
|
|
1876
|
+
return /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
1877
|
+
className: "inline-flex items-center gap-1 group/phone",
|
|
1878
|
+
children: [/* @__PURE__ */ (0, A.jsxs)("a", {
|
|
1879
|
+
href: `tel:${t}`,
|
|
1880
|
+
className: "inline-flex items-center gap-1 text-blue-600 hover:text-blue-800",
|
|
1881
|
+
onClick: (e) => e.stopPropagation(),
|
|
1882
|
+
children: [/* @__PURE__ */ (0, A.jsx)(ue, { className: "h-3 w-3" }), t]
|
|
1883
|
+
}), /* @__PURE__ */ (0, A.jsx)("button", {
|
|
1884
|
+
type: "button",
|
|
1885
|
+
className: "opacity-0 group-hover/phone:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
|
|
1886
|
+
onClick: (e) => {
|
|
1887
|
+
e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(t).then(() => {
|
|
1888
|
+
r(!0), setTimeout(() => r(!1), 2e3);
|
|
1889
|
+
}).catch(() => {});
|
|
1890
|
+
},
|
|
1891
|
+
"aria-label": "Copy phone number",
|
|
1892
|
+
children: n ? /* @__PURE__ */ (0, A.jsx)(E, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ (0, A.jsx)(D, { className: "h-3 w-3 text-muted-foreground" })
|
|
1893
|
+
})]
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
function at({ value: e, field: t }) {
|
|
1897
|
+
if (!e) return /* @__PURE__ */ (0, A.jsx)("span", { children: "-" });
|
|
1898
|
+
if (t.multiple, Array.isArray(e)) {
|
|
1899
|
+
let t = e.length;
|
|
1900
|
+
return /* @__PURE__ */ (0, A.jsxs)("span", {
|
|
1901
|
+
className: "text-sm text-gray-600",
|
|
1902
|
+
children: [
|
|
1903
|
+
t,
|
|
1904
|
+
" ",
|
|
1905
|
+
t === 1 ? "file" : "files"
|
|
1906
|
+
]
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1910
|
+
className: "text-sm truncate",
|
|
1911
|
+
children: e.name || e.original_name || "File"
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1914
|
+
function ot({ value: e }) {
|
|
1915
|
+
return e ? Array.isArray(e) ? /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1916
|
+
className: "flex -space-x-2",
|
|
1917
|
+
children: [e.slice(0, 3).map((e, t) => /* @__PURE__ */ (0, A.jsx)("img", {
|
|
1918
|
+
src: e.url || "",
|
|
1919
|
+
alt: e.name || `Image ${t + 1}`,
|
|
1920
|
+
className: "size-8 rounded-md border-2 border-white object-cover"
|
|
1921
|
+
}, t)), e.length > 3 && /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1922
|
+
className: "size-8 rounded-md border-2 border-white bg-gray-100 flex items-center justify-center text-xs font-medium text-gray-600",
|
|
1923
|
+
children: ["+", e.length - 3]
|
|
1924
|
+
})]
|
|
1925
|
+
}) : /* @__PURE__ */ (0, A.jsx)("img", {
|
|
1926
|
+
src: e.url || "",
|
|
1927
|
+
alt: e.name || "Image",
|
|
1928
|
+
className: "size-10 rounded-md object-cover"
|
|
1929
|
+
}) : /* @__PURE__ */ (0, A.jsx)("span", { children: "-" });
|
|
1930
|
+
}
|
|
1931
|
+
function q({ value: e, field: t }) {
|
|
1932
|
+
if (e == null || e === "") return /* @__PURE__ */ (0, A.jsx)("span", { children: "-" });
|
|
1933
|
+
let n = t.options || [], r = (e) => {
|
|
1934
|
+
if (n.length > 0) {
|
|
1935
|
+
let t = n.find((t) => String(t.value) === String(e));
|
|
1936
|
+
if (t) return t.label;
|
|
1937
|
+
}
|
|
1938
|
+
return String(e);
|
|
1939
|
+
};
|
|
1940
|
+
return Array.isArray(e) ? /* @__PURE__ */ (0, A.jsx)("div", {
|
|
1941
|
+
className: "flex flex-wrap gap-1",
|
|
1942
|
+
children: e.map((e, t) => {
|
|
1943
|
+
let n;
|
|
1944
|
+
return n = typeof e == "object" && e ? e.name || e.label || e.id || e._id || String(e) : r(e), /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1945
|
+
className: "inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",
|
|
1946
|
+
children: n
|
|
1947
|
+
}, t);
|
|
1948
|
+
})
|
|
1949
|
+
}) : typeof e == "object" && e ? /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1950
|
+
className: "truncate",
|
|
1951
|
+
children: e.name || e.label || e.id || e._id || "[Object]"
|
|
1952
|
+
}) : /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1953
|
+
className: "truncate",
|
|
1954
|
+
children: r(e)
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
function J({ value: e }) {
|
|
1958
|
+
let t = H(e);
|
|
1959
|
+
return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1960
|
+
className: "text-gray-700 font-mono text-sm",
|
|
1961
|
+
children: t == null ? "-" : String(t)
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
function Y({ value: e }) {
|
|
1965
|
+
if (!e) return /* @__PURE__ */ (0, A.jsx)("span", { children: "-" });
|
|
1966
|
+
if (typeof e != "object") return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1967
|
+
className: "truncate",
|
|
1968
|
+
children: String(e)
|
|
1969
|
+
});
|
|
1970
|
+
if (Array.isArray(e)) return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1971
|
+
className: "flex -space-x-2",
|
|
1972
|
+
children: [e.slice(0, 3).map((e, t) => {
|
|
1973
|
+
if (typeof e != "object" || !e) return /* @__PURE__ */ (0, A.jsx)("span", {
|
|
1974
|
+
className: "truncate text-sm",
|
|
1975
|
+
children: String(e)
|
|
1976
|
+
}, t);
|
|
1977
|
+
let n = e.name || e.username || "User";
|
|
1978
|
+
return /* @__PURE__ */ (0, A.jsx)(d, {
|
|
1979
|
+
className: "size-8 border-2 border-white",
|
|
1980
|
+
title: n,
|
|
1981
|
+
children: /* @__PURE__ */ (0, A.jsx)(f, {
|
|
1982
|
+
className: "bg-blue-500 text-white text-xs",
|
|
1983
|
+
children: n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
1984
|
+
})
|
|
1985
|
+
}, t);
|
|
1986
|
+
}), e.length > 3 && /* @__PURE__ */ (0, A.jsx)(d, {
|
|
1987
|
+
className: "size-8 border-2 border-white",
|
|
1988
|
+
children: /* @__PURE__ */ (0, A.jsxs)(f, {
|
|
1989
|
+
className: "bg-gray-200 text-gray-600 text-xs",
|
|
1990
|
+
children: ["+", e.length - 3]
|
|
1991
|
+
})
|
|
1992
|
+
})]
|
|
1993
|
+
});
|
|
1994
|
+
let t = e.name || e.username || "User";
|
|
1995
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
1996
|
+
className: "flex items-center gap-2",
|
|
1997
|
+
children: [/* @__PURE__ */ (0, A.jsx)(d, {
|
|
1998
|
+
className: "size-8",
|
|
1999
|
+
children: /* @__PURE__ */ (0, A.jsx)(f, {
|
|
2000
|
+
className: "bg-blue-500 text-white text-xs",
|
|
2001
|
+
children: t.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2)
|
|
2002
|
+
})
|
|
2003
|
+
}), /* @__PURE__ */ (0, A.jsx)("span", {
|
|
2004
|
+
className: "truncate",
|
|
2005
|
+
children: t
|
|
2006
|
+
})]
|
|
2007
|
+
});
|
|
2008
|
+
}
|
|
2009
|
+
var X = /* @__PURE__ */ new Map();
|
|
2010
|
+
function Z(e, t) {
|
|
2011
|
+
X.set(e, t);
|
|
2012
|
+
}
|
|
2013
|
+
function st(e) {
|
|
2014
|
+
return X.has(e) ? X.get(e) : {
|
|
2015
|
+
text: G,
|
|
2016
|
+
textarea: G,
|
|
2017
|
+
markdown: G,
|
|
2018
|
+
html: G,
|
|
2019
|
+
number: Ge,
|
|
2020
|
+
currency: Ke,
|
|
2021
|
+
percent: Je,
|
|
2022
|
+
boolean: Xe,
|
|
2023
|
+
date: Ze,
|
|
2024
|
+
datetime: Qe,
|
|
2025
|
+
time: G,
|
|
2026
|
+
select: K,
|
|
2027
|
+
status: K,
|
|
2028
|
+
lookup: q,
|
|
2029
|
+
master_detail: q,
|
|
2030
|
+
email: nt,
|
|
2031
|
+
url: rt,
|
|
2032
|
+
phone: it,
|
|
2033
|
+
file: at,
|
|
2034
|
+
image: ot,
|
|
2035
|
+
formula: J,
|
|
2036
|
+
summary: J,
|
|
2037
|
+
auto_number: G,
|
|
2038
|
+
user: Y,
|
|
2039
|
+
owner: Y,
|
|
2040
|
+
password: () => /* @__PURE__ */ (0, A.jsx)("span", { children: "••••••" }),
|
|
2041
|
+
location: G,
|
|
2042
|
+
object: () => /* @__PURE__ */ (0, A.jsx)("span", {
|
|
2043
|
+
className: "text-gray-500 italic",
|
|
2044
|
+
children: "[Object]"
|
|
2045
|
+
}),
|
|
2046
|
+
vector: () => /* @__PURE__ */ (0, A.jsx)("span", {
|
|
2047
|
+
className: "text-gray-500 italic",
|
|
2048
|
+
children: "[Vector]"
|
|
2049
|
+
}),
|
|
2050
|
+
grid: () => /* @__PURE__ */ (0, A.jsx)("span", {
|
|
2051
|
+
className: "text-gray-500 italic",
|
|
2052
|
+
children: "[Grid]"
|
|
2053
|
+
})
|
|
2054
|
+
}[e] || G;
|
|
2055
|
+
}
|
|
2056
|
+
Z("lookup", q), Z("master_detail", q), Z("select", K), Z("status", K), Z("user", Y), Z("owner", Y), n(st);
|
|
2057
|
+
function ct(e) {
|
|
2058
|
+
return {
|
|
2059
|
+
text: "field:text",
|
|
2060
|
+
textarea: "field:textarea",
|
|
2061
|
+
markdown: "field:markdown",
|
|
2062
|
+
html: "field:html",
|
|
2063
|
+
number: "field:number",
|
|
2064
|
+
currency: "field:currency",
|
|
2065
|
+
percent: "field:percent",
|
|
2066
|
+
date: "field:date",
|
|
2067
|
+
datetime: "field:datetime",
|
|
2068
|
+
time: "field:time",
|
|
2069
|
+
boolean: "field:boolean",
|
|
2070
|
+
select: "field:select",
|
|
2071
|
+
lookup: "field:lookup",
|
|
2072
|
+
master_detail: "field:master_detail",
|
|
2073
|
+
email: "field:email",
|
|
2074
|
+
phone: "field:phone",
|
|
2075
|
+
url: "field:url",
|
|
2076
|
+
file: "field:file",
|
|
2077
|
+
image: "field:image",
|
|
2078
|
+
password: "field:password",
|
|
2079
|
+
location: "field:location",
|
|
2080
|
+
formula: "field:formula",
|
|
2081
|
+
summary: "field:summary",
|
|
2082
|
+
auto_number: "field:auto_number"
|
|
2083
|
+
}[e] || "field:text";
|
|
2084
|
+
}
|
|
2085
|
+
function lt(e) {
|
|
2086
|
+
if (e < 0 || !Number.isFinite(e) || e === 0) return "0 B";
|
|
2087
|
+
let t = [
|
|
2088
|
+
"B",
|
|
2089
|
+
"KB",
|
|
2090
|
+
"MB",
|
|
2091
|
+
"GB",
|
|
2092
|
+
"TB"
|
|
2093
|
+
], n = e, r = 0;
|
|
2094
|
+
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r++;
|
|
2095
|
+
return `${n.toFixed(r > 0 ? 1 : 0)} ${t[r]}`;
|
|
2096
|
+
}
|
|
2097
|
+
function ut(e) {
|
|
2098
|
+
let t = {};
|
|
2099
|
+
return e.required && (t.required = typeof e.required_message == "string" ? e.required_message : `${e.label || e.name} is required`), e.min_length && (t.minLength = {
|
|
2100
|
+
value: e.min_length,
|
|
2101
|
+
message: e.min_length_message || `Minimum length is ${e.min_length} characters`
|
|
2102
|
+
}), e.max_length && (t.maxLength = {
|
|
2103
|
+
value: e.max_length,
|
|
2104
|
+
message: e.max_length_message || `Maximum length is ${e.max_length} characters`
|
|
2105
|
+
}), e.min !== void 0 && (t.min = {
|
|
2106
|
+
value: e.min,
|
|
2107
|
+
message: e.min_message || `Minimum value is ${e.min}`
|
|
2108
|
+
}), e.max !== void 0 && (t.max = {
|
|
2109
|
+
value: e.max,
|
|
2110
|
+
message: e.max_message || `Maximum value is ${e.max}`
|
|
2111
|
+
}), e.pattern && (t.pattern = {
|
|
2112
|
+
value: typeof e.pattern == "string" ? new RegExp(e.pattern) : e.pattern,
|
|
2113
|
+
message: e.pattern_message || "Invalid format"
|
|
2114
|
+
}), e.type === "email" && (t.pattern = {
|
|
2115
|
+
value: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
2116
|
+
message: "Please enter a valid email address"
|
|
2117
|
+
}), e.type === "url" && (t.pattern = {
|
|
2118
|
+
value: /^https?:\/\/.+/,
|
|
2119
|
+
message: "Please enter a valid URL"
|
|
2120
|
+
}), e.validate && (t.validate = e.validate), Object.keys(t).length > 0 ? t : void 0;
|
|
2121
|
+
}
|
|
2122
|
+
function Q(e, t) {
|
|
2123
|
+
if (!e) return !0;
|
|
2124
|
+
if (e.field && e.value !== void 0) {
|
|
2125
|
+
let n = t[e.field];
|
|
2126
|
+
if (e.operator === "=" || e.operator === "==") return n === e.value;
|
|
2127
|
+
if (e.operator === "!=") return n !== e.value;
|
|
2128
|
+
if (e.operator === ">") return n > e.value;
|
|
2129
|
+
if (e.operator === ">=") return n >= e.value;
|
|
2130
|
+
if (e.operator === "<") return n < e.value;
|
|
2131
|
+
if (e.operator === "<=") return n <= e.value;
|
|
2132
|
+
if (e.operator === "in") return Array.isArray(e.value) && e.value.includes(n);
|
|
2133
|
+
}
|
|
2134
|
+
return e.and && Array.isArray(e.and) ? e.and.every((e) => Q(e, t)) : e.or && Array.isArray(e.or) ? e.or.some((e) => Q(e, t)) : !0;
|
|
2135
|
+
}
|
|
2136
|
+
function $(e) {
|
|
2137
|
+
let t = ({ schema: t, className: n, value: r, ...a }) => {
|
|
2138
|
+
let [o, s] = i.useState(r ?? t?.value ?? ""), c = {
|
|
2139
|
+
name: t?.name || "field",
|
|
2140
|
+
label: t?.label,
|
|
2141
|
+
type: t?.type,
|
|
2142
|
+
placeholder: t?.placeholder,
|
|
2143
|
+
required: t?.required,
|
|
2144
|
+
readonly: t?.readonly || t?.readOnly,
|
|
2145
|
+
help: t?.help,
|
|
2146
|
+
description: t?.description,
|
|
2147
|
+
defaultValue: t?.defaultValue || t?.value,
|
|
2148
|
+
...t
|
|
2149
|
+
}, l = i.useCallback((e) => {
|
|
2150
|
+
s(e), a.onChange && a.onChange(e);
|
|
2151
|
+
}, [a]), u = t?.readonly || t?.readOnly || !1;
|
|
2152
|
+
return /* @__PURE__ */ (0, A.jsxs)("div", {
|
|
2153
|
+
className: "grid w-full items-center gap-1.5",
|
|
2154
|
+
"data-obj-id": t?.id,
|
|
2155
|
+
"data-obj-type": t?.type,
|
|
2156
|
+
children: [
|
|
2157
|
+
t?.label && /* @__PURE__ */ (0, A.jsx)("label", {
|
|
2158
|
+
htmlFor: t.id,
|
|
2159
|
+
className: t.required ? "after:content-['*'] after:ml-0.5 after:text-red-500" : "",
|
|
2160
|
+
children: t.label
|
|
2161
|
+
}),
|
|
2162
|
+
/* @__PURE__ */ (0, A.jsx)(e, {
|
|
2163
|
+
value: o,
|
|
2164
|
+
onChange: l,
|
|
2165
|
+
field: c,
|
|
2166
|
+
readonly: u,
|
|
2167
|
+
className: n
|
|
2168
|
+
}),
|
|
2169
|
+
t?.description && /* @__PURE__ */ (0, A.jsx)("p", {
|
|
2170
|
+
className: "text-sm text-gray-500",
|
|
2171
|
+
children: t.description
|
|
2172
|
+
})
|
|
2173
|
+
]
|
|
2174
|
+
});
|
|
2175
|
+
};
|
|
2176
|
+
return t.displayName = `FieldRenderer(${e.displayName || e.name || "Component"})`, t;
|
|
2177
|
+
}
|
|
2178
|
+
var dt = {
|
|
2179
|
+
text: () => import("./TextField-CkEDGbkQ.js").then((e) => ({ default: e.TextField })),
|
|
2180
|
+
textarea: () => import("./TextAreaField--ut87UiB.js").then((e) => ({ default: e.TextAreaField })),
|
|
2181
|
+
number: () => import("./NumberField-DCHTzmDG.js").then((e) => ({ default: e.NumberField })),
|
|
2182
|
+
boolean: () => import("./BooleanField-Bs0urhsx.js").then((e) => ({ default: e.BooleanField })),
|
|
2183
|
+
select: () => import("./SelectField-DMy5IxRc.js").then((e) => ({ default: e.SelectField })),
|
|
2184
|
+
date: () => import("./DateField-DjGiK6BH.js").then((e) => ({ default: e.DateField })),
|
|
2185
|
+
datetime: () => import("./DateTimeField-DBh-dYdR.js").then((e) => ({ default: e.DateTimeField })),
|
|
2186
|
+
time: () => import("./TimeField-DA_S6lQV.js").then((e) => ({ default: e.TimeField })),
|
|
2187
|
+
email: () => import("./EmailField-Cp6yJlpH.js").then((e) => ({ default: e.EmailField })),
|
|
2188
|
+
phone: () => import("./PhoneField-CkrCFmcO.js").then((e) => ({ default: e.PhoneField })),
|
|
2189
|
+
url: () => import("./UrlField-DCnXHR1A.js").then((e) => ({ default: e.UrlField })),
|
|
2190
|
+
currency: () => import("./CurrencyField-D4VwXI9k.js").then((e) => ({ default: e.CurrencyField })),
|
|
2191
|
+
percent: () => import("./PercentField-B2t2knlc.js").then((e) => ({ default: e.PercentField })),
|
|
2192
|
+
password: () => import("./PasswordField-BZ_OeQyw.js").then((e) => ({ default: e.PasswordField })),
|
|
2193
|
+
markdown: () => import("./RichTextField-b-8QbNCJ.js").then((e) => ({ default: e.RichTextField })),
|
|
2194
|
+
html: () => import("./RichTextField-b-8QbNCJ.js").then((e) => ({ default: e.RichTextField })),
|
|
2195
|
+
lookup: () => import("./LookupField-BX4sK8NG.js").then((e) => e.n).then((e) => ({ default: e.LookupField })),
|
|
2196
|
+
master_detail: () => import("./MasterDetailField-BXncIT1s.js").then((e) => ({ default: e.MasterDetailField })),
|
|
2197
|
+
file: () => import("./FileField-DUgt6ai3.js").then((e) => ({ default: e.FileField })),
|
|
2198
|
+
image: () => import("./ImageField-rc1Nzcvb.js").then((e) => ({ default: e.ImageField })),
|
|
2199
|
+
location: () => import("./LocationField-QZPPYo0J.js").then((e) => ({ default: e.LocationField })),
|
|
2200
|
+
formula: () => import("./FormulaField-BLV1KgkQ.js").then((e) => ({ default: e.FormulaField })),
|
|
2201
|
+
summary: () => import("./SummaryField-DVSVfKmY.js").then((e) => ({ default: e.SummaryField })),
|
|
2202
|
+
auto_number: () => import("./AutoNumberField-DXIYJfiB.js").then((e) => ({ default: e.AutoNumberField })),
|
|
2203
|
+
user: () => import("./UserField-V0GmvyGV.js").then((e) => ({ default: e.UserField })),
|
|
2204
|
+
owner: () => import("./UserField-V0GmvyGV.js").then((e) => ({ default: e.UserField })),
|
|
2205
|
+
object: () => import("./ObjectField-BEUHpn_X.js").then((e) => ({ default: e.ObjectField })),
|
|
2206
|
+
vector: () => import("./VectorField-CVi5yrrc.js").then((e) => ({ default: e.VectorField })),
|
|
2207
|
+
grid: () => import("./GridField-O3Jd1NuJ.js").then((e) => ({ default: e.GridField })),
|
|
2208
|
+
color: () => import("./ColorField-Bar6bOJw.js").then((e) => ({ default: e.ColorField })),
|
|
2209
|
+
slider: () => import("./SliderField-B7WvKFv7.js").then((e) => ({ default: e.SliderField })),
|
|
2210
|
+
rating: () => import("./RatingField-DecDJkou.js").then((e) => ({ default: e.RatingField })),
|
|
2211
|
+
code: () => import("./CodeField-tRACqngO.js").then((e) => ({ default: e.CodeField })),
|
|
2212
|
+
avatar: () => import("./AvatarField-BHpex3Wa.js").then((e) => ({ default: e.AvatarField })),
|
|
2213
|
+
address: () => import("./AddressField-B6fPb2Fs.js").then((e) => ({ default: e.AddressField })),
|
|
2214
|
+
geolocation: () => import("./GeolocationField-BbIRH51u.js").then((e) => ({ default: e.GeolocationField })),
|
|
2215
|
+
signature: () => import("./SignatureField-BvTPE7Dn.js").then((e) => ({ default: e.SignatureField })),
|
|
2216
|
+
qrcode: () => import("./QRCodeField-CQoGow8y.js").then((e) => ({ default: e.QRCodeField }))
|
|
2690
2217
|
};
|
|
2218
|
+
function ft(e) {
|
|
2219
|
+
let t = dt[e];
|
|
2220
|
+
if (!t) {
|
|
2221
|
+
console.warn(`Unknown field type: ${e}`);
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2224
|
+
let n = i.lazy(t);
|
|
2225
|
+
u.register(e, n, { namespace: "field" });
|
|
2226
|
+
}
|
|
2227
|
+
function pt() {
|
|
2228
|
+
Object.keys(dt).forEach((e) => {
|
|
2229
|
+
ft(e);
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
function mt() {
|
|
2233
|
+
u.register("text", $(j), { namespace: "field" }), u.register("textarea", $(ge), { namespace: "field" }), u.register("number", $(M), { namespace: "field" }), u.register("boolean", $(N), { namespace: "field" }), u.register("select", $(P), { namespace: "field" }), u.register("date", $(F), { namespace: "field" }), u.register("datetime", $(_e), { namespace: "field" }), u.register("time", $(ve), { namespace: "field" }), u.register("email", $(I), { namespace: "field" }), u.register("phone", $(L), { namespace: "field" }), u.register("url", $(R), { namespace: "field" }), u.register("currency", $(z), { namespace: "field" }), u.register("percent", $(ye), { namespace: "field" }), u.register("password", $(be), { namespace: "field" }), u.register("markdown", $(B), { namespace: "field" }), u.register("html", $(B), { namespace: "field" }), u.register("lookup", $(r), { namespace: "field" }), u.register("master_detail", $(ze), { namespace: "field" }), u.register("file", $(xe), { namespace: "field" }), u.register("image", $(Se), { namespace: "field" }), u.register("location", $(Ce), { namespace: "field" }), u.register("formula", $(we), { namespace: "field" }), u.register("summary", $(Te), { namespace: "field" }), u.register("auto_number", $(Ee), { namespace: "field" }), u.register("user", $(V), { namespace: "field" }), u.register("owner", $(V), { namespace: "field" }), u.register("object", $(De), { namespace: "field" }), u.register("vector", $(Oe), { namespace: "field" }), u.register("grid", $(ke), { namespace: "field" }), u.register("color", $(Ae), { namespace: "field" }), u.register("slider", $(je), { namespace: "field" }), u.register("rating", $(Me), { namespace: "field" }), u.register("code", $(Ne), { namespace: "field" }), u.register("avatar", $(Pe), { namespace: "field" }), u.register("address", $(Fe), { namespace: "field" }), u.register("geolocation", $(Ie), { namespace: "field" }), u.register("signature", $(Le), { namespace: "field" }), u.register("qrcode", $(Re), { namespace: "field" });
|
|
2234
|
+
}
|
|
2235
|
+
pt();
|
|
2236
|
+
//#endregion
|
|
2237
|
+
export { Fe as AddressField, Ee as AutoNumberField, Pe as AvatarField, Xe as BooleanCellRenderer, N as BooleanField, Ne as CodeField, Ae as ColorField, Ke as CurrencyCellRenderer, z as CurrencyField, Ze as DateCellRenderer, F as DateField, Qe as DateTimeCellRenderer, _e as DateTimeField, nt as EmailCellRenderer, I as EmailField, at as FileCellRenderer, xe as FileField, J as FormulaCellRenderer, we as FormulaField, Ie as GeolocationField, ke as GridField, ot as ImageCellRenderer, Se as ImageField, Ce as LocationField, q as LookupCellRenderer, r as LookupField, ze as MasterDetailField, Ge as NumberCellRenderer, M as NumberField, De as ObjectField, be as PasswordField, Je as PercentCellRenderer, ye as PercentField, it as PhoneCellRenderer, L as PhoneField, Re as QRCodeField, Me as RatingField, t as RecordPickerDialog, B as RichTextField, K as SelectCellRenderer, P as SelectField, Le as SignatureField, je as SliderField, Te as SummaryField, ge as TextAreaField, G as TextCellRenderer, j as TextField, ve as TimeField, rt as UrlCellRenderer, R as UrlField, Y as UserCellRenderer, V as UserField, Oe as VectorField, ut as buildValidationRules, H as coerceToSafeValue, Q as evaluateCondition, Ve as formatCompactCurrency, Be as formatCurrency, W as formatDate, We as formatDateTime, lt as formatFileSize, He as formatPercent, Ue as formatRelativeDate, st as getCellRenderer, U as humanizeLabel, ct as mapFieldTypeToFormType, pt as registerAllFields, ft as registerField, Z as registerFieldRenderer, mt as registerFields };
|