@nivaro/react 0.3.68 → 0.3.70

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.
@@ -1,38 +1,38 @@
1
1
  import { jsx as i, jsxs as h } from "react/jsx-runtime";
2
- import { ExternalLink as Je } from "lucide-react";
3
- import { memo as Ke, useContext as Ve, useRef as j, useEffect as re, useState as He, useLayoutEffect as $e } from "react";
4
- import { useDrilldown as Ge, useParentDraft as We, RelationPathDataContext as Ye, useApiFetchConfig as ze, fieldDrilldownConfig as V } from "../../context.js";
5
- import { getFieldInterface as Qe } from "../../lib/field-interfaces.js";
6
- import { precisionOf as Ue } from "../../lib/format-value.js";
2
+ import { ExternalLink as Ve } from "lucide-react";
3
+ import { memo as He, useContext as Ue, useRef as j, useEffect as re, useState as $e, useLayoutEffect as Ge } from "react";
4
+ import { useDrilldown as We, useParentDraft as Ye, RelationPathDataContext as ze, useApiFetchConfig as Qe, fieldDrilldownConfig as V } from "../../context.js";
5
+ import { getFieldInterface as Ce } from "../../lib/field-interfaces.js";
6
+ import { precisionOf as Xe } from "../../lib/format-value.js";
7
7
  import { resolveOptionFilterTokens as oe } from "../../lib/option-filter-tokens.js";
8
- import { counterOf as Ce } from "../../lib/placement-behaviour.js";
9
- import { choiceLabel as Xe } from "../../lib/utils.js";
10
- import { Badge as Ze } from "../ui/badge.js";
8
+ import { showsFileDownloads as ne, showsFileUsage as ie, counterOf as Ze } from "../../lib/placement-behaviour.js";
9
+ import { choiceLabel as Oe } from "../../lib/utils.js";
10
+ import { Badge as et } from "../ui/badge.js";
11
11
  import { Input as B } from "../ui/input.js";
12
- import { Label as Oe } from "../ui/label.js";
13
- import { NumberDraftInput as et } from "../ui/number-draft-input.js";
14
- import { SimpleSelect as tt } from "../ui/SimpleSelect.js";
15
- import { Switch as rt } from "../ui/switch.js";
16
- import { Textarea as me } from "../ui/textarea.js";
17
- import { CatalogPickerField as ot } from "./CatalogPickerField.js";
18
- import { columnMaxLength as pe } from "./column-length.js";
19
- import { useFieldAffordances as nt } from "./FieldAffordances.js";
20
- import { ProgressField as ne, RatingScaleField as ie, DurationReadOnly as it, ChecklistReadOnly as at, ColorPackField as ae, PhoneField as le, EmailField as lt, AddressAutocompleteField as st } from "./FieldPack.js";
21
- import { FilePickerField as ct, FileM2MField as dt } from "./FilePickerField.js";
12
+ import { Label as tt } from "../ui/label.js";
13
+ import { NumberDraftInput as rt } from "../ui/number-draft-input.js";
14
+ import { SimpleSelect as ot } from "../ui/SimpleSelect.js";
15
+ import { Switch as nt } from "../ui/switch.js";
16
+ import { Textarea as ye } from "../ui/textarea.js";
17
+ import { CatalogPickerField as it } from "./CatalogPickerField.js";
18
+ import { columnMaxLength as _e } from "./column-length.js";
19
+ import { useFieldAffordances as at } from "./FieldAffordances.js";
20
+ import { ProgressField as ae, RatingScaleField as le, DurationReadOnly as lt, ChecklistReadOnly as st, ColorPackField as se, PhoneField as ce, EmailField as ct, AddressAutocompleteField as dt } from "./FieldPack.js";
21
+ import { FilePickerField as ut, FileM2MField as mt } from "./FilePickerField.js";
22
22
  import { formatDisplayValue as L } from "./GroupSection.js";
23
- import { parseJson as f, toLocalDatetime as ut } from "./helpers.js";
24
- import { InlineGridField as mt } from "./InlineGridField.js";
25
- import { InlineTableField as pt } from "./InlineTableField.js";
26
- import { checkNumberEntry as yt } from "./line-qty.js";
27
- import { M2MSingleSelectCombobox as ft, M2MCombobox as _t } from "./M2MCombobox.js";
28
- import { MembershipSetField as bt } from "./MembershipSetField.js";
29
- import { PlanGridField as xt } from "./PlanGrid.js";
30
- import { smartParseDate as ht, CountdownChip as gt, DurationField as vt, FiscalPeriodField as wt, ChecklistField as Nt, RepeaterField as kt, RangeSliderField as Ft, DateRangeField as At, AddressField as Rt, maskFor as St, applyInputMask as se } from "./PolishFields.js";
31
- import { useQuickCreateFollow as jt, QuickCreateButton as It } from "./QuickCreateButton.js";
32
- import { RelationCombobox as Dt } from "./RelationCombobox.js";
33
- import { RelationGroupedCombobox as Mt } from "./RelationGroupedCombobox.js";
34
- import { RichTextEditor as Pt } from "./RichTextEditor.js";
35
- function Lt({
23
+ import { parseJson as _, toLocalDatetime as pt } from "./helpers.js";
24
+ import { InlineGridField as yt } from "./InlineGridField.js";
25
+ import { InlineTableField as _t } from "./InlineTableField.js";
26
+ import { checkNumberEntry as ft } from "./line-qty.js";
27
+ import { M2MSingleSelectCombobox as bt, M2MCombobox as xt } from "./M2MCombobox.js";
28
+ import { MembershipSetField as ht } from "./MembershipSetField.js";
29
+ import { PlanGridField as gt } from "./PlanGrid.js";
30
+ import { smartParseDate as vt, CountdownChip as wt, DurationField as Nt, FiscalPeriodField as kt, ChecklistField as Ft, RepeaterField as At, RangeSliderField as Rt, DateRangeField as St, AddressField as jt, maskFor as Dt, applyInputMask as de } from "./PolishFields.js";
31
+ import { useQuickCreateFollow as It, QuickCreateButton as Mt } from "./QuickCreateButton.js";
32
+ import { RelationCombobox as Pt } from "./RelationCombobox.js";
33
+ import { RelationGroupedCombobox as Lt } from "./RelationGroupedCombobox.js";
34
+ import { RichTextEditor as Bt } from "./RichTextEditor.js";
35
+ function Et({
36
36
  plugin: m,
37
37
  props: e
38
38
  }) {
@@ -48,14 +48,14 @@ function Lt({
48
48
  (c = (d = a.current) == null ? void 0 : d.update) == null || c.call(d, e);
49
49
  }, [e]), /* @__PURE__ */ i("div", { ref: n, "data-custom-interface": m.interface });
50
50
  }
51
- function ce(m) {
52
- const e = m.validation_rules, n = Array.isArray(e) ? e : f(typeof e == "string" ? e : null);
51
+ function ue(m) {
52
+ const e = m.validation_rules, n = Array.isArray(e) ? e : _(typeof e == "string" ? e : null);
53
53
  if (!Array.isArray(n)) return {};
54
54
  const a = (d) => {
55
55
  const c = /* @__PURE__ */ new Date();
56
56
  c.setDate(c.getDate() + d);
57
- const _ = (v) => String(v).padStart(2, "0");
58
- return `${c.getFullYear()}-${_(c.getMonth() + 1)}-${_(c.getDate())}`;
57
+ const f = (v) => String(v).padStart(2, "0");
58
+ return `${c.getFullYear()}-${f(c.getMonth() + 1)}-${f(c.getDate())}`;
59
59
  }, p = {};
60
60
  for (const d of n) {
61
61
  const c = Number(d == null ? void 0 : d.value);
@@ -63,20 +63,20 @@ function ce(m) {
63
63
  }
64
64
  return p;
65
65
  }
66
- function de(m) {
67
- const e = pe(m), n = f(m.options), a = Number(n == null ? void 0 : n.max_length);
66
+ function me(m) {
67
+ const e = _e(m), n = _(m.options), a = Number(n == null ? void 0 : n.max_length);
68
68
  return Number.isFinite(a) && a > 0 ? e != null ? Math.min(e, a) : a : e ?? void 0;
69
69
  }
70
- function ye(m, e) {
70
+ function fe(m, e) {
71
71
  const n = j(null), a = j(m), p = j(m);
72
- p.current = m, $e(() => {
72
+ p.current = m, Ge(() => {
73
73
  const c = n.current;
74
74
  !c || m === a.current || (a.current = m, c.value !== m && (c.value = m));
75
75
  }, [m]);
76
76
  const d = (c) => {
77
77
  c !== a.current && (e(c), a.current = c, queueMicrotask(() => {
78
- const _ = n.current;
79
- !_ || a.current !== c || p.current === c || (a.current = p.current, _.value = p.current);
78
+ const f = n.current;
79
+ !f || a.current !== c || p.current === c || (a.current = p.current, f.value = p.current);
80
80
  }));
81
81
  };
82
82
  return {
@@ -86,52 +86,52 @@ function ye(m, e) {
86
86
  onBlur: (c) => d(c.target.value)
87
87
  };
88
88
  }
89
- function Bt({
89
+ function Tt({
90
90
  value: m,
91
91
  commit: e,
92
92
  ...n
93
93
  }) {
94
- const a = ye(m, e);
94
+ const a = fe(m, e);
95
95
  return /* @__PURE__ */ i(B, { ...n, ...a });
96
96
  }
97
- function ue({
97
+ function pe({
98
98
  value: m,
99
99
  commit: e,
100
100
  ...n
101
101
  }) {
102
- const a = ye(m, e);
103
- return /* @__PURE__ */ i(me, { ...n, ...a });
102
+ const a = fe(m, e);
103
+ return /* @__PURE__ */ i(ye, { ...n, ...a });
104
104
  }
105
- const xr = Ke(function({
105
+ const gr = He(function({
106
106
  field: e,
107
107
  value: n,
108
108
  onChange: a,
109
109
  relations: p,
110
110
  collection: d,
111
111
  itemId: c,
112
- cascadeFilter: _,
112
+ cascadeFilter: f,
113
113
  requiredParentLabel: v,
114
114
  narrowedBy: u,
115
115
  onCountChange: N,
116
116
  displayOnly: H,
117
- prefillParentId: fe,
118
- pinnedOption: $
117
+ prefillParentId: be,
118
+ pinnedOption: U
119
119
  }) {
120
- var z, Q, U, C, X, Z, O, ee, te;
121
- const I = Ge(), M = nt(), k = We();
122
- jt(k);
123
- const K = Ve(Ye), D = k, b = (() => {
120
+ var Y, z, Q, C, X, Z, O, ee, te;
121
+ const D = We(), M = at(), k = Ye();
122
+ It(k);
123
+ const K = Ue(ze), I = k, b = (() => {
124
124
  try {
125
- return ze();
125
+ return Qe();
126
126
  } catch {
127
127
  return null;
128
128
  }
129
- })(), s = e.interface ?? "", G = j(Qe(s)).current;
130
- if (G)
129
+ })(), s = e.interface ?? "", $ = j(Ce(s)).current;
130
+ if ($)
131
131
  return /* @__PURE__ */ i(
132
- Lt,
132
+ Et,
133
133
  {
134
- plugin: G,
134
+ plugin: $,
135
135
  props: {
136
136
  value: n,
137
137
  onChange: a,
@@ -143,27 +143,29 @@ const xr = Ke(function({
143
143
  }
144
144
  );
145
145
  if (s === "file-image" || s === "file") {
146
- const r = f(e.options);
146
+ const r = _(e.options);
147
147
  return /* @__PURE__ */ i(
148
- ct,
148
+ ut,
149
149
  {
150
150
  value: n,
151
151
  onChange: a,
152
152
  disabled: e.readonly,
153
153
  allowUpload: (r == null ? void 0 : r.allow_upload) !== !1,
154
- allowPick: (r == null ? void 0 : r.allow_pick) !== !1
154
+ allowPick: (r == null ? void 0 : r.allow_pick) !== !1,
155
+ showUsage: ie(e._overrides),
156
+ showDownloads: ne(e._overrides)
155
157
  }
156
158
  );
157
159
  }
158
- const W = !s || s.startsWith("relation-") || s === "select-multiple-m2m" || s.endsWith("-m2o") || s.endsWith("-m2m"), F = W ? p.find(
160
+ const G = !s || s.startsWith("relation-") || s === "select-multiple-m2m" || s.endsWith("-m2o") || s.endsWith("-m2m"), F = G ? p.find(
159
161
  (r) => r.many_collection === d && r.many_field === e.field && !r.junction_field
160
162
  ) : null;
161
163
  if (F != null && F.one_collection) {
162
164
  if (s === "relation-grouped") {
163
- const y = f(e.options);
165
+ const y = _(e.options);
164
166
  if (y != null && y.group_field && (y != null && y.option_field))
165
167
  return /* @__PURE__ */ i(
166
- Mt,
168
+ Lt,
167
169
  {
168
170
  collection: F.one_collection,
169
171
  value: n,
@@ -172,18 +174,18 @@ const xr = Ke(function({
172
174
  optionField: y.option_field,
173
175
  disabled: e.readonly,
174
176
  placeholder: e.placeholder ?? void 0,
175
- extraFilter: _,
176
- pinned: $,
177
+ extraFilter: f,
178
+ pinned: U,
177
179
  narrowedBy: u
178
180
  }
179
181
  );
180
182
  }
181
- const r = I && n != null && n !== "" ? V(e) : null, o = f(e.options), l = oe(
183
+ const r = D && n != null && n !== "" ? V(e) : null, o = _(e.options), l = oe(
182
184
  o != null && o.option_filter && typeof o.option_filter == "object" ? o.option_filter : void 0,
183
185
  k == null ? void 0 : k.draft,
184
186
  c
185
- ), t = l ? _ ? { _and: [l, _] } : l : _, x = /* @__PURE__ */ i(
186
- Dt,
187
+ ), t = l ? f ? { _and: [l, f] } : l : f, x = /* @__PURE__ */ i(
188
+ Pt,
187
189
  {
188
190
  fieldKey: e.field,
189
191
  missPlacement: (M == null ? void 0 : M.layoutId) != null && M.pickerMisses !== !1 ? { layoutId: Number(M.layoutId), collection: d, field: e.field } : null,
@@ -197,7 +199,7 @@ const xr = Ke(function({
197
199
  optionSort: typeof (o == null ? void 0 : o.option_sort) == "string" && o.option_sort ? o.option_sort : void 0,
198
200
  requiredParent: v ?? void 0,
199
201
  narrowedBy: u,
200
- pinned: $,
202
+ pinned: U,
201
203
  facets: Array.isArray(o == null ? void 0 : o.picker_facets) ? o.picker_facets.map((y) => ({
202
204
  ...y,
203
205
  // Facet filters support the same '$parent.<field>' tokens (and
@@ -211,7 +213,7 @@ const xr = Ke(function({
211
213
  return !r && !w ? x : /* @__PURE__ */ h("div", { className: "flex items-center gap-1.5", children: [
212
214
  /* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: x }),
213
215
  w && /* @__PURE__ */ i(
214
- It,
216
+ Mt,
215
217
  {
216
218
  targetCollection: F.one_collection,
217
219
  config: w,
@@ -225,19 +227,19 @@ const xr = Ke(function({
225
227
  {
226
228
  type: "button",
227
229
  title: "Open detail panel",
228
- onClick: () => I == null ? void 0 : I.open({
230
+ onClick: () => D == null ? void 0 : D.open({
229
231
  collection: F.one_collection,
230
232
  itemId: String(n),
231
233
  layoutId: r.layout_id,
232
234
  width: r.width
233
235
  }),
234
236
  className: "shrink-0 rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-nvr-cyan dark:hover:bg-slate-800",
235
- children: /* @__PURE__ */ i(Je, { className: "h-3.5 w-3.5" })
237
+ children: /* @__PURE__ */ i(Ve, { className: "h-3.5 w-3.5" })
236
238
  }
237
239
  )
238
240
  ] });
239
241
  }
240
- const E = W && !F ? (() => {
242
+ const E = G && !F ? (() => {
241
243
  const r = p.find(
242
244
  (l) => l.one_collection === d && (l.one_field === e.field || l.junction_field != null && l.many_collection === e.field)
243
245
  );
@@ -250,9 +252,9 @@ const xr = Ke(function({
250
252
  })() : null;
251
253
  if (E) {
252
254
  if (s === "files-m2m") {
253
- const l = f(e.options);
255
+ const l = _(e.options);
254
256
  return /* @__PURE__ */ i(
255
- dt,
257
+ mt,
256
258
  {
257
259
  relation: E,
258
260
  parentId: c,
@@ -260,30 +262,32 @@ const xr = Ke(function({
260
262
  disabled: e.readonly,
261
263
  allowUpload: (l == null ? void 0 : l.allow_upload) !== !1,
262
264
  allowPick: (l == null ? void 0 : l.allow_pick) !== !1,
263
- pendingSave: (l == null ? void 0 : l.pending_save) === !0
265
+ pendingSave: (l == null ? void 0 : l.pending_save) === !0,
266
+ showUsage: ie(e._overrides),
267
+ showDownloads: ne(e._overrides)
264
268
  }
265
269
  );
266
270
  }
267
- const r = f(e.options), o = typeof (r == null ? void 0 : r.option_sort) == "string" && r.option_sort ? r.option_sort : void 0;
271
+ const r = _(e.options), o = typeof (r == null ? void 0 : r.option_sort) == "string" && r.option_sort ? r.option_sort : void 0;
268
272
  return (r == null ? void 0 : r.max_values) === 1 ? /* @__PURE__ */ i(
269
- ft,
273
+ bt,
270
274
  {
271
275
  relation: E,
272
276
  parentId: c,
273
277
  allRelations: p,
274
- extraFilter: _,
278
+ extraFilter: f,
275
279
  optionSort: o,
276
280
  requiredParent: v ?? void 0,
277
281
  onCountChange: N,
278
282
  readOnly: H
279
283
  }
280
284
  ) : /* @__PURE__ */ i(
281
- _t,
285
+ xt,
282
286
  {
283
287
  relation: E,
284
288
  parentId: c,
285
289
  allRelations: p,
286
- extraFilter: _,
290
+ extraFilter: f,
287
291
  optionSort: o,
288
292
  requiredParent: v ?? void 0,
289
293
  onCountChange: N,
@@ -292,14 +296,14 @@ const xr = Ke(function({
292
296
  );
293
297
  }
294
298
  if (e.readonly && s !== "inline-table") {
295
- if (s === "relation-path" && n != null && n !== "" && I) {
299
+ if (s === "relation-path" && n != null && n !== "" && D) {
296
300
  const l = V(e), t = K == null ? void 0 : K[e.field];
297
301
  if (l && (t != null && t.target_collection) && t.ids.length > 0)
298
302
  return /* @__PURE__ */ i("div", { className: "min-h-[36px] flex items-center", children: /* @__PURE__ */ i(
299
303
  "button",
300
304
  {
301
305
  type: "button",
302
- onClick: () => I.open({
306
+ onClick: () => D.open({
303
307
  collection: t.target_collection,
304
308
  itemId: t.ids[0],
305
309
  layoutId: l.layout_id,
@@ -311,7 +315,7 @@ const xr = Ke(function({
311
315
  }
312
316
  ) });
313
317
  }
314
- const r = (z = e.options) == null ? void 0 : z.__live_delta;
318
+ const r = (Y = e.options) == null ? void 0 : Y.__live_delta;
315
319
  if (r && Number.isFinite(Number(r.live))) {
316
320
  const l = Number(r.original), t = Number(r.live) - (Number.isFinite(l) ? l : 0), x = Math.round(t * 100) / 100;
317
321
  return /* @__PURE__ */ h("div", { className: "flex min-h-[36px] flex-wrap items-center gap-x-2 gap-y-0.5", children: [
@@ -330,29 +334,29 @@ const xr = Ke(function({
330
334
  )
331
335
  ] });
332
336
  }
333
- if (s === "progress") return /* @__PURE__ */ i(ne, { value: n, onChange: a, readOnly: !0 });
337
+ if (s === "progress") return /* @__PURE__ */ i(ae, { value: n, onChange: a, readOnly: !0 });
334
338
  if (s === "rating") {
335
- const l = (Q = f(e.options)) == null ? void 0 : Q.rating_max;
336
- return /* @__PURE__ */ i(ie, { value: n, onChange: a, max: l ?? 5, readOnly: !0 });
339
+ const l = (z = _(e.options)) == null ? void 0 : z.rating_max;
340
+ return /* @__PURE__ */ i(le, { value: n, onChange: a, max: l ?? 5, readOnly: !0 });
337
341
  }
338
- if (s === "duration") return /* @__PURE__ */ i(it, { value: n });
339
- if (s === "checklist") return /* @__PURE__ */ i(at, { value: n });
342
+ if (s === "duration") return /* @__PURE__ */ i(lt, { value: n });
343
+ if (s === "checklist") return /* @__PURE__ */ i(st, { value: n });
340
344
  if (s === "color")
341
- return /* @__PURE__ */ i(ae, { field: e, value: n, onChange: a, readOnly: !0 });
342
- if (s === "phone") return /* @__PURE__ */ i(le, { value: n, onChange: a, readOnly: !0 });
343
- const o = n == null ? /* @__PURE__ */ i("span", { className: "text-muted-foreground italic text-sm", children: "—" }) : typeof n == "boolean" ? /* @__PURE__ */ i(Ze, { variant: n ? "default" : "secondary", children: n ? "Yes" : "No" }) : /* @__PURE__ */ i("span", { className: "text-sm tabular-nums", children: L(n, e) });
345
+ return /* @__PURE__ */ i(se, { field: e, value: n, onChange: a, readOnly: !0 });
346
+ if (s === "phone") return /* @__PURE__ */ i(ce, { value: n, onChange: a, readOnly: !0 });
347
+ const o = n == null ? /* @__PURE__ */ i("span", { className: "text-muted-foreground italic text-sm", children: "—" }) : typeof n == "boolean" ? /* @__PURE__ */ i(et, { variant: n ? "default" : "secondary", children: n ? "Yes" : "No" }) : /* @__PURE__ */ i("span", { className: "text-sm tabular-nums", children: L(n, e) });
344
348
  return /* @__PURE__ */ i("div", { className: "min-h-[36px] flex items-center", children: o });
345
349
  }
346
350
  const g = n == null ? "" : String(n);
347
351
  if (e.type === "boolean")
348
352
  return /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
349
- /* @__PURE__ */ i(rt, { checked: !!n, onCheckedChange: a }),
350
- /* @__PURE__ */ i(Oe, { className: "font-normal text-sm", children: n ? "Yes" : "No" })
353
+ /* @__PURE__ */ i(nt, { checked: !!n, onCheckedChange: a }),
354
+ /* @__PURE__ */ i(tt, { className: "font-normal text-sm", children: n ? "Yes" : "No" })
351
355
  ] });
352
356
  if (e.type === "datetime" || s === "datetime") {
353
- const r = f(e.options);
357
+ const r = _(e.options);
354
358
  if ((r == null ? void 0 : r.date_mode) === "date") {
355
- const o = ce(e);
359
+ const o = ue(e);
356
360
  return /* @__PURE__ */ i(
357
361
  B,
358
362
  {
@@ -369,14 +373,14 @@ const xr = Ke(function({
369
373
  B,
370
374
  {
371
375
  type: "datetime-local",
372
- value: ut(n),
376
+ value: pt(n),
373
377
  onChange: (o) => a(o.target.value ? new Date(o.target.value).toISOString() : null),
374
378
  placeholder: e.placeholder ?? void 0
375
379
  }
376
380
  );
377
381
  }
378
382
  if (e.type === "date" || s === "date") {
379
- const r = ((U = f(e.options)) == null ? void 0 : U.countdown) === !0, o = ce(e);
383
+ const r = ((Q = _(e.options)) == null ? void 0 : Q.countdown) === !0, o = ue(e);
380
384
  return /* @__PURE__ */ h("div", { className: "flex items-center", children: [
381
385
  /* @__PURE__ */ i(
382
386
  B,
@@ -387,14 +391,14 @@ const xr = Ke(function({
387
391
  max: o.max,
388
392
  onChange: (l) => a(l.target.value || null),
389
393
  onPaste: (l) => {
390
- const t = ht(l.clipboardData.getData("text"));
394
+ const t = vt(l.clipboardData.getData("text"));
391
395
  t && (l.preventDefault(), a(t));
392
396
  },
393
397
  placeholder: e.placeholder ?? void 0,
394
398
  className: "flex-1"
395
399
  }
396
400
  ),
397
- r && /* @__PURE__ */ i(gt, { value: g.slice(0, 10) })
401
+ r && /* @__PURE__ */ i(wt, { value: g.slice(0, 10) })
398
402
  ] });
399
403
  }
400
404
  if ([
@@ -415,10 +419,10 @@ const xr = Ke(function({
415
419
  ].includes(e.type)) {
416
420
  const r = ["integer", "bigInteger", "int", "bigint", "smallint", "tinyint"].includes(
417
421
  e.type
418
- ), o = r ? 0 : Ue(e.options, -1), l = r ? "1" : o >= 0 ? String(10 ** -o) : "any", t = yt(n, { type: e.type, label: e.label || "Value" }), x = t.ok ? null : t.message;
422
+ ), o = r ? 0 : Xe(e.options, -1), l = r ? "1" : o >= 0 ? String(10 ** -o) : "any", t = ft(n, { type: e.type, label: e.label || "Value" }), x = t.ok ? null : t.message;
419
423
  return /* @__PURE__ */ h("div", { children: [
420
424
  /* @__PURE__ */ i(
421
- et,
425
+ rt,
422
426
  {
423
427
  type: "number",
424
428
  "aria-invalid": x ? !0 : void 0,
@@ -440,7 +444,7 @@ const xr = Ke(function({
440
444
  }
441
445
  if (e.type === "json" || s === "code")
442
446
  return /* @__PURE__ */ i(
443
- me,
447
+ ye,
444
448
  {
445
449
  className: "font-mono text-xs",
446
450
  rows: 4,
@@ -457,10 +461,10 @@ const xr = Ke(function({
457
461
  );
458
462
  if (s === "textarea")
459
463
  return /* @__PURE__ */ i(
460
- ue,
464
+ pe,
461
465
  {
462
466
  rows: 4,
463
- maxLength: de(e),
467
+ maxLength: me(e),
464
468
  value: g,
465
469
  commit: a,
466
470
  placeholder: e.placeholder ?? void 0
@@ -468,7 +472,7 @@ const xr = Ke(function({
468
472
  );
469
473
  if (s === "wysiwyg" || s === "markdown")
470
474
  return /* @__PURE__ */ i(
471
- ue,
475
+ pe,
472
476
  {
473
477
  rows: 6,
474
478
  value: g,
@@ -479,13 +483,13 @@ const xr = Ke(function({
479
483
  );
480
484
  if (s === "input-rich-text-html" || s === "rich_text" || e.type === "rich_text" || s === "extension-editorjs")
481
485
  return /* @__PURE__ */ i(
482
- Pt,
486
+ Bt,
483
487
  {
484
488
  value: g,
485
489
  onChange: a,
486
490
  placeholder: e.placeholder ?? void 0,
487
491
  disabled: e.readonly,
488
- pastePlain: ((C = f(e.options)) == null ? void 0 : C.paste_plain) === !0
492
+ pastePlain: ((C = _(e.options)) == null ? void 0 : C.paste_plain) === !0
489
493
  }
490
494
  );
491
495
  if (s === "inline-grid" || s === "relation-list" || s === "list-o2m") {
@@ -503,7 +507,7 @@ const xr = Ke(function({
503
507
  }
504
508
  })() : e.options ?? {}).layout_slug ?? null;
505
509
  return /* @__PURE__ */ i(
506
- mt,
510
+ yt,
507
511
  {
508
512
  relatedCollection: o,
509
513
  manyField: l,
@@ -530,10 +534,10 @@ const xr = Ke(function({
530
534
  } catch {
531
535
  return {};
532
536
  }
533
- })() : e.options ?? {}, x = t.layout_id ?? null, w = !!t.show_row_revisions, y = !!t.row_comments, q = t.allow_revision_restore !== !1, be = t.save_mode ?? "immediate", xe = !!t.show_line_numbers, he = t.enable_reorder !== !1, ge = Array.isArray(t.parent_cascades) ? t.parent_cascades : void 0, ve = Array.isArray(t.row_rules) ? t.row_rules : void 0, we = Array.isArray(t.column_presets) ? t.column_presets : void 0, Ne = typeof t.default_preset == "string" && t.default_preset ? t.default_preset : void 0, ke = Array.isArray(t.drawer_relations) ? t.drawer_relations : void 0, Fe = Array.isArray(t.parent_context_fields) ? t.parent_context_fields : void 0, Ae = Array.isArray(t.unique_by) ? t.unique_by : void 0, Re = typeof t.sort_field == "string" && t.sort_field ? t.sort_field : void 0, Se = t.sort_dir === "desc" ? "desc" : "asc", je = t.freeze_first_column === !0, Ie = typeof t.section_group_by == "string" && t.section_group_by.includes(".") ? t.section_group_by : void 0, De = t.row_filter && typeof t.row_filter == "object" ? t.row_filter : void 0, Me = t.allocate_drawer && typeof t.allocate_drawer == "object" ? t.allocate_drawer : void 0, Pe = t.auto_allocate && typeof t.auto_allocate == "object" ? t.auto_allocate : void 0, Le = Array.isArray(t.row_bulk_actions) ? t.row_bulk_actions : void 0, Be = typeof t.upload_template == "string" && t.upload_template ? t.upload_template : void 0, Ee = t.row_match_panel ?? void 0, Te = t.row_defaults && typeof t.row_defaults == "object" ? t.row_defaults : void 0, qe = t.submission_errors === !0 ? {} : t.submission_errors && typeof t.submission_errors == "object" ? t.submission_errors : void 0, R = t.membership_set;
537
+ })() : e.options ?? {}, x = t.layout_id ?? null, w = !!t.show_row_revisions, y = !!t.row_comments, q = t.allow_revision_restore !== !1, he = t.save_mode ?? "immediate", ge = !!t.show_line_numbers, ve = t.enable_reorder !== !1, we = Array.isArray(t.parent_cascades) ? t.parent_cascades : void 0, Ne = Array.isArray(t.row_rules) ? t.row_rules : void 0, ke = Array.isArray(t.column_presets) ? t.column_presets : void 0, Fe = typeof t.default_preset == "string" && t.default_preset ? t.default_preset : void 0, Ae = Array.isArray(t.drawer_relations) ? t.drawer_relations : void 0, Re = Array.isArray(t.parent_context_fields) ? t.parent_context_fields : void 0, Se = Array.isArray(t.unique_by) ? t.unique_by : void 0, je = typeof t.sort_field == "string" && t.sort_field ? t.sort_field : void 0, De = t.sort_dir === "desc" ? "desc" : "asc", Ie = t.freeze_first_column === !0, Me = typeof t.section_group_by == "string" && t.section_group_by.includes(".") ? t.section_group_by : void 0, Pe = t.row_filter && typeof t.row_filter == "object" ? t.row_filter : void 0, Le = t.allocate_drawer && typeof t.allocate_drawer == "object" ? t.allocate_drawer : void 0, Be = t.auto_allocate && typeof t.auto_allocate == "object" ? t.auto_allocate : void 0, Ee = Array.isArray(t.row_bulk_actions) ? t.row_bulk_actions : void 0, Te = typeof t.upload_template == "string" && t.upload_template ? t.upload_template : void 0, qe = t.row_match_panel ?? void 0, Je = t.row_defaults && typeof t.row_defaults == "object" ? t.row_defaults : void 0, Ke = t.submission_errors === !0 ? {} : t.submission_errors && typeof t.submission_errors == "object" ? t.submission_errors : void 0, R = t.membership_set;
534
538
  if (R != null && R.key_field && (R != null && R.value_field))
535
539
  return /* @__PURE__ */ i(
536
- bt,
540
+ ht,
537
541
  {
538
542
  relatedCollection: o,
539
543
  manyField: l,
@@ -545,7 +549,7 @@ const xr = Ke(function({
545
549
  const S = t.catalog_mode;
546
550
  if (S != null && S.item_field && (S != null && S.section_by))
547
551
  return /* @__PURE__ */ i(
548
- ot,
552
+ it,
549
553
  {
550
554
  relatedCollection: o,
551
555
  manyField: l,
@@ -560,7 +564,7 @@ const xr = Ke(function({
560
564
  if (A != null && A.key_field && (A != null && A.category_field) && Array.isArray(A.value_fields)) {
561
565
  const J = t.spread_remaining;
562
566
  return /* @__PURE__ */ i(
563
- xt,
567
+ gt,
564
568
  {
565
569
  relatedCollection: o,
566
570
  manyField: l,
@@ -577,7 +581,7 @@ const xr = Ke(function({
577
581
  );
578
582
  }
579
583
  return /* @__PURE__ */ i(
580
- pt,
584
+ _t,
581
585
  {
582
586
  relatedCollection: o,
583
587
  manyField: l,
@@ -587,27 +591,27 @@ const xr = Ke(function({
587
591
  showRowRevisions: w,
588
592
  rowComments: y,
589
593
  allowRevisionRestore: q,
590
- saveMode: be,
591
- showLineNumbers: xe,
592
- enableReorder: he,
593
- parentCascades: ge,
594
- rowRules: ve,
595
- columnPresets: we,
596
- defaultPreset: Ne,
597
- drawerRelations: ke,
598
- parentContextFields: Fe,
599
- uniqueBy: Ae,
600
- sortField: Re,
601
- sortDir: Se,
602
- sectionGroupBy: Ie,
603
- freezeFirstColumn: je,
604
- rowFilter: De,
605
- rowDefaults: Te,
606
- allocateDrawer: Me,
607
- autoAllocate: Pe,
608
- rowBulkActions: Le,
609
- uploadTemplate: Be,
610
- rowMatchPanel: Ee,
594
+ saveMode: he,
595
+ showLineNumbers: ge,
596
+ enableReorder: ve,
597
+ parentCascades: we,
598
+ rowRules: Ne,
599
+ columnPresets: ke,
600
+ defaultPreset: Fe,
601
+ drawerRelations: Ae,
602
+ parentContextFields: Re,
603
+ uniqueBy: Se,
604
+ sortField: je,
605
+ sortDir: De,
606
+ sectionGroupBy: Me,
607
+ freezeFirstColumn: Ie,
608
+ rowFilter: Pe,
609
+ rowDefaults: Je,
610
+ allocateDrawer: Le,
611
+ autoAllocate: Be,
612
+ rowBulkActions: Ee,
613
+ uploadTemplate: Te,
614
+ rowMatchPanel: qe,
611
615
  lineSla: t.line_sla ?? null,
612
616
  editorMode: t.editor_mode === "split" ? "split" : "drawer",
613
617
  rowLints: Array.isArray(t.row_lints) ? t.row_lints : null,
@@ -615,8 +619,8 @@ const xr = Ke(function({
615
619
  sumCap: t.sum_cap && typeof t.sum_cap == "object" ? t.sum_cap : null,
616
620
  spreadRemaining: t.spread_remaining && typeof t.spread_remaining == "object" ? t.spread_remaining : null,
617
621
  compareSeries: t.compare_series && typeof t.compare_series == "object" && typeof t.compare_series.endpoint == "string" ? t.compare_series : null,
618
- submissionErrors: qe,
619
- prefillParentId: fe,
622
+ submissionErrors: Ke,
623
+ prefillParentId: be,
620
624
  parentFieldKey: e.field,
621
625
  readOnly: e.readonly,
622
626
  emptyLabel: e.label || void 0
@@ -626,19 +630,19 @@ const xr = Ke(function({
626
630
  }
627
631
  return /* @__PURE__ */ i("p", { className: "text-[12px] text-slate-400 py-1", children: "Inline table editing not available in embedded form" });
628
632
  }
629
- if (s === "color") return /* @__PURE__ */ i(ae, { field: e, value: n, onChange: a });
633
+ if (s === "color") return /* @__PURE__ */ i(se, { field: e, value: n, onChange: a });
630
634
  if (s === "rating") {
631
- const r = (X = f(e.options)) == null ? void 0 : X.rating_max;
632
- return /* @__PURE__ */ i(ie, { value: n, onChange: a, max: r ?? 5 });
635
+ const r = (X = _(e.options)) == null ? void 0 : X.rating_max;
636
+ return /* @__PURE__ */ i(le, { value: n, onChange: a, max: r ?? 5 });
633
637
  }
634
- if (s === "progress") return /* @__PURE__ */ i(ne, { value: n, onChange: a });
638
+ if (s === "progress") return /* @__PURE__ */ i(ae, { value: n, onChange: a });
635
639
  if (s === "phone")
636
- return /* @__PURE__ */ i(le, { value: n, onChange: a, placeholder: e.placeholder ?? void 0 });
640
+ return /* @__PURE__ */ i(ce, { value: n, onChange: a, placeholder: e.placeholder ?? void 0 });
637
641
  if (s === "email")
638
- return /* @__PURE__ */ i(lt, { value: n, onChange: a, placeholder: e.placeholder ?? void 0 });
642
+ return /* @__PURE__ */ i(ct, { value: n, onChange: a, placeholder: e.placeholder ?? void 0 });
639
643
  if (s === "address-autocomplete")
640
644
  return /* @__PURE__ */ i(
641
- st,
645
+ dt,
642
646
  {
643
647
  field: e,
644
648
  value: n,
@@ -649,38 +653,38 @@ const xr = Ke(function({
649
653
  placeholder: e.placeholder ?? void 0
650
654
  }
651
655
  );
652
- if (s === "duration") return /* @__PURE__ */ i(vt, { value: n, onChange: a });
653
- if (s === "fiscal_period") return /* @__PURE__ */ i(wt, { value: n, onChange: a });
654
- if (s === "checklist") return /* @__PURE__ */ i(Nt, { value: n, onChange: a });
656
+ if (s === "duration") return /* @__PURE__ */ i(Nt, { value: n, onChange: a });
657
+ if (s === "fiscal_period") return /* @__PURE__ */ i(kt, { value: n, onChange: a });
658
+ if (s === "checklist") return /* @__PURE__ */ i(Ft, { value: n, onChange: a });
655
659
  if (s === "repeater" || e.repeater_schema && e.type === "json")
656
- return /* @__PURE__ */ i(kt, { field: e, value: n, onChange: a });
660
+ return /* @__PURE__ */ i(At, { field: e, value: n, onChange: a });
657
661
  if (s === "range_slider") {
658
- const r = (Z = f(e.options)) == null ? void 0 : Z.range_end_field;
662
+ const r = (Z = _(e.options)) == null ? void 0 : Z.range_end_field;
659
663
  return /* @__PURE__ */ i(
660
- Ft,
664
+ Rt,
661
665
  {
662
666
  field: e,
663
667
  value: n,
664
668
  onChange: a,
665
- pairedValue: r ? (O = D == null ? void 0 : D.draft) == null ? void 0 : O[r] : void 0
669
+ pairedValue: r ? (O = I == null ? void 0 : I.draft) == null ? void 0 : O[r] : void 0
666
670
  }
667
671
  );
668
672
  }
669
673
  if (s === "date_range") {
670
- const r = (ee = f(e.options)) == null ? void 0 : ee.range_end_field;
674
+ const r = (ee = _(e.options)) == null ? void 0 : ee.range_end_field;
671
675
  return /* @__PURE__ */ i(
672
- At,
676
+ St,
673
677
  {
674
678
  field: e,
675
679
  value: n,
676
680
  onChange: a,
677
- pairedValue: r ? (te = D == null ? void 0 : D.draft) == null ? void 0 : te[r] : void 0
681
+ pairedValue: r ? (te = I == null ? void 0 : I.draft) == null ? void 0 : te[r] : void 0
678
682
  }
679
683
  );
680
684
  }
681
685
  if (s === "address")
682
686
  return /* @__PURE__ */ i(
683
- Rt,
687
+ jt,
684
688
  {
685
689
  field: e,
686
690
  value: n,
@@ -690,55 +694,55 @@ const xr = Ke(function({
690
694
  }
691
695
  );
692
696
  if (s === "tags")
693
- return /* @__PURE__ */ i(Et, { field: e, value: n, onChange: a });
697
+ return /* @__PURE__ */ i(qt, { field: e, value: n, onChange: a });
694
698
  if (s === "select-dropdown" || s === "radio-buttons") {
695
699
  const r = (() => {
696
- const o = f(e.options);
700
+ const o = _(e.options);
697
701
  return (o == null ? void 0 : o.choices) ?? [];
698
702
  })();
699
703
  if (r.length > 0)
700
704
  return /* @__PURE__ */ i(
701
- tt,
705
+ ot,
702
706
  {
703
707
  value: g,
704
708
  onChange: (o) => a(o || null),
705
709
  options: [
706
710
  { value: "", label: "— Select —" },
707
- ...r.map((o) => ({ value: o.value, label: Xe(o.text) }))
711
+ ...r.map((o) => ({ value: o.value, label: Oe(o.text) }))
708
712
  ],
709
713
  ariaLabel: e.label ?? e.field,
710
714
  className: "h-9 rounded-md text-sm"
711
715
  }
712
716
  );
713
717
  }
714
- const T = St(e), _e = pe(e), P = (() => {
715
- const r = f(e.options);
718
+ const T = Dt(e), xe = _e(e), P = (() => {
719
+ const r = _(e.options);
716
720
  if (Number.isFinite(Number(r == null ? void 0 : r.max_length))) return Number(r == null ? void 0 : r.max_length);
717
- const o = f(e.validation_rules), l = Array.isArray(o) ? o.find((t) => (t == null ? void 0 : t.type) === "max") : null;
718
- return l && Number.isFinite(Number(l.value)) ? Number(l.value) : _e;
719
- })(), Y = T ? /* @__PURE__ */ i(
721
+ const o = _(e.validation_rules), l = Array.isArray(o) ? o.find((t) => (t == null ? void 0 : t.type) === "max") : null;
722
+ return l && Number.isFinite(Number(l.value)) ? Number(l.value) : xe;
723
+ })(), W = T ? /* @__PURE__ */ i(
720
724
  B,
721
725
  {
722
- value: se(T, g).display,
726
+ value: de(T, g).display,
723
727
  onChange: (r) => {
724
- const { clean: o } = se(T, r.target.value);
728
+ const { clean: o } = de(T, r.target.value);
725
729
  a(o || null);
726
730
  },
727
731
  placeholder: e.placeholder ?? T ?? void 0
728
732
  }
729
733
  ) : /* @__PURE__ */ i(
730
- Bt,
734
+ Tt,
731
735
  {
732
- maxLength: de(e),
736
+ maxLength: me(e),
733
737
  value: g,
734
738
  commit: (r) => a(r || null),
735
739
  placeholder: e.placeholder ?? void 0
736
740
  }
737
741
  );
738
- if (P != null && P > 0 && !Ce(e._overrides)) {
742
+ if (P != null && P > 0 && !Ze(e._overrides)) {
739
743
  const r = g.length;
740
744
  return /* @__PURE__ */ h("div", { children: [
741
- Y,
745
+ W,
742
746
  r >= P * 0.6 && /* @__PURE__ */ h(
743
747
  "p",
744
748
  {
@@ -752,14 +756,14 @@ const xr = Ke(function({
752
756
  )
753
757
  ] });
754
758
  }
755
- return Y;
759
+ return W;
756
760
  });
757
- function Et({
761
+ function qt({
758
762
  field: m,
759
763
  value: e,
760
764
  onChange: n
761
765
  }) {
762
- const [a, p] = He(""), d = (() => {
766
+ const [a, p] = $e(""), d = (() => {
763
767
  if (Array.isArray(e)) return e.map(String);
764
768
  if (typeof e == "string" && e.trim().startsWith("["))
765
769
  try {
@@ -770,11 +774,11 @@ function Et({
770
774
  }
771
775
  return typeof e == "string" && e.trim() !== "" ? [e] : [];
772
776
  })(), c = (() => {
773
- const u = f(m.options);
777
+ const u = _(m.options);
774
778
  return Array.isArray(u == null ? void 0 : u.tag_options) ? u.tag_options.map(String) : [];
775
- })(), _ = (u) => n(u.length > 0 ? JSON.stringify(u) : null), v = (u) => {
779
+ })(), f = (u) => n(u.length > 0 ? JSON.stringify(u) : null), v = (u) => {
776
780
  const N = u.trim();
777
- !N || d.includes(N) || (_([...d, N]), p(""));
781
+ !N || d.includes(N) || (f([...d, N]), p(""));
778
782
  };
779
783
  return /* @__PURE__ */ h("div", { className: "rounded-md border border-input bg-background px-2 py-1.5", children: [
780
784
  /* @__PURE__ */ h("div", { className: "flex flex-wrap items-center gap-1", children: [
@@ -789,7 +793,7 @@ function Et({
789
793
  {
790
794
  type: "button",
791
795
  "aria-label": `Remove ${u}`,
792
- onClick: () => _(d.filter((N) => N !== u)),
796
+ onClick: () => f(d.filter((N) => N !== u)),
793
797
  className: "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200",
794
798
  children: "×"
795
799
  }
@@ -804,7 +808,7 @@ function Et({
804
808
  value: a,
805
809
  onChange: (u) => p(u.target.value),
806
810
  onKeyDown: (u) => {
807
- (u.key === "Enter" || u.key === ",") && (u.preventDefault(), v(a)), u.key === "Backspace" && a === "" && d.length > 0 && _(d.slice(0, -1));
811
+ (u.key === "Enter" || u.key === ",") && (u.preventDefault(), v(a)), u.key === "Backspace" && a === "" && d.length > 0 && f(d.slice(0, -1));
808
812
  },
809
813
  onBlur: () => v(a),
810
814
  placeholder: d.length === 0 ? "Type and press Enter…" : "",
@@ -828,7 +832,7 @@ function Et({
828
832
  ] });
829
833
  }
830
834
  export {
831
- xr as FieldRenderer,
835
+ gr as FieldRenderer,
832
836
  oe as resolveOptionFilterTokens,
833
- ye as useKeptText
837
+ fe as useKeptText
834
838
  };