@object-ui/fields 3.3.0 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +151 -0
  2. package/README.md +24 -0
  3. package/dist/{LookupField-BHr7uTX1.cjs → LookupField-CiIjeL_i.cjs} +1 -1
  4. package/dist/{LookupField-B6MOSQVJ.js → LookupField-De-GqsfT.js} +176 -179
  5. package/dist/index.cjs +3 -3
  6. package/dist/index.js +633 -655
  7. package/package.json +34 -9
  8. package/src/__tests__/cell-renderers.test.tsx +39 -18
  9. package/src/__tests__/datetime-cell.test.tsx +2 -2
  10. package/src/__tests__/datetime-timezone.test.tsx +9 -9
  11. package/src/__tests__/validation-feedback.test.tsx +8 -8
  12. package/src/datetime-widgets.test.tsx +1 -1
  13. package/src/index.tsx +54 -28
  14. package/src/record-picker.test.tsx +30 -23
  15. package/src/remaining-widgets.test.tsx +1 -1
  16. package/src/widgets/AddressField.tsx +4 -3
  17. package/src/widgets/AutoNumberField.tsx +5 -3
  18. package/src/widgets/CodeField.tsx +2 -2
  19. package/src/widgets/ColorField.tsx +2 -2
  20. package/src/widgets/CurrencyField.tsx +2 -2
  21. package/src/widgets/DateField.tsx +2 -2
  22. package/src/widgets/DateTimeField.tsx +2 -2
  23. package/src/widgets/EmailField.tsx +2 -2
  24. package/src/widgets/FileField.tsx +2 -2
  25. package/src/widgets/FormulaField.tsx +14 -12
  26. package/src/widgets/GeolocationField.tsx +4 -3
  27. package/src/widgets/GridField.tsx +3 -3
  28. package/src/widgets/ImageField.tsx +2 -2
  29. package/src/widgets/LocationField.tsx +2 -2
  30. package/src/widgets/LookupField.tsx +3 -5
  31. package/src/widgets/NumberField.tsx +2 -2
  32. package/src/widgets/ObjectField.tsx +2 -2
  33. package/src/widgets/PercentField.tsx +2 -2
  34. package/src/widgets/PhoneField.tsx +2 -2
  35. package/src/widgets/QRCodeField.tsx +2 -2
  36. package/src/widgets/RichTextField.tsx +2 -2
  37. package/src/widgets/SelectField.tsx +9 -7
  38. package/src/widgets/SummaryField.tsx +12 -10
  39. package/src/widgets/TextAreaField.tsx +2 -2
  40. package/src/widgets/TextField.tsx +2 -2
  41. package/src/widgets/TimeField.tsx +2 -2
  42. package/src/widgets/UrlField.tsx +2 -2
  43. package/src/widgets/UserField.tsx +2 -2
  44. package/src/widgets/VectorField.tsx +2 -1
  45. package/dist/AddressField-Do46PdqT.cjs +0 -1
  46. package/dist/AutoNumberField-cS2tsxd-.cjs +0 -1
  47. package/dist/AvatarField-CxhGS3wF.cjs +0 -1
  48. package/dist/BooleanField-BgkbTHPY.cjs +0 -1
  49. package/dist/CodeField-DE3dLruS.cjs +0 -1
  50. package/dist/ColorField-DBTFFYpv.cjs +0 -1
  51. package/dist/CurrencyField-C28LkJts.cjs +0 -1
  52. package/dist/DateField-WGWwddDF.cjs +0 -1
  53. package/dist/DateTimeField-BYsZs8f7.cjs +0 -1
  54. package/dist/EmailField-1PW03WW8.cjs +0 -1
  55. package/dist/FileField-BqZkp1O6.cjs +0 -1
  56. package/dist/FormulaField-MZ9le4RE.cjs +0 -1
  57. package/dist/GeolocationField-onbAOdIe.cjs +0 -1
  58. package/dist/GridField-D4OWfaU4.cjs +0 -1
  59. package/dist/ImageField-BZf-AL2e.cjs +0 -1
  60. package/dist/LocationField-DhGJtUzZ.cjs +0 -1
  61. package/dist/MasterDetailField-YTAU1hzg.cjs +0 -1
  62. package/dist/NumberField-BCk42NjA.cjs +0 -1
  63. package/dist/ObjectField-iYK5eab_.cjs +0 -1
  64. package/dist/PasswordField-BAReSDz7.cjs +0 -1
  65. package/dist/PercentField-nzACEXtC.cjs +0 -1
  66. package/dist/PhoneField-CvbkGpN3.cjs +0 -1
  67. package/dist/QRCodeField-D8fov03S.cjs +0 -1
  68. package/dist/RatingField-DBgj9cgE.cjs +0 -1
  69. package/dist/RichTextField-7VwN6GcU.cjs +0 -1
  70. package/dist/SelectField-BUOTiYaS.cjs +0 -1
  71. package/dist/SignatureField-DW_Cz6t9.cjs +0 -1
  72. package/dist/SliderField-Bgi3-TAD.cjs +0 -1
  73. package/dist/SummaryField-Ed2wJBvs.cjs +0 -1
  74. package/dist/TextAreaField-O503xJff.cjs +0 -1
  75. package/dist/TextField-BrwtPIQC.cjs +0 -1
  76. package/dist/TimeField-Bhoxv2yp.cjs +0 -1
  77. package/dist/UrlField-VFO089Gr.cjs +0 -1
  78. package/dist/UserField-BRe9SCCk.cjs +0 -1
  79. package/dist/VectorField-ByrWkiud.cjs +0 -1
  80. /package/dist/{useFieldTranslation-BiQad4ar.cjs → useFieldTranslation-BYPwtuNZ.cjs} +0 -0
@@ -1,19 +1,19 @@
1
1
  import { t as e } from "./rolldown-runtime-CAFD8bLK.js";
2
2
  import { t } from "./useFieldTranslation-Bv3oUVgb.js";
3
3
  import { useCallback as n, useContext as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
4
- import { Badge as c, Button as l, Checkbox as u, Dialog as ee, DialogContent as te, DialogFooter as ne, DialogHeader as re, DialogTitle as d, Input as f, Label as p, Popover as ie, PopoverContent as ae, PopoverTrigger as oe, Select as se, SelectContent as ce, SelectItem as le, SelectTrigger as ue, SelectValue as de, Skeleton as m, Table as h, TableBody as g, TableCell as _, TableHead as fe, TableHeader as v, TableRow as y, cn as pe } from "@object-ui/components";
5
- import { AlertCircle as me, ArrowDown as b, ArrowUp as he, ArrowUpDown as ge, Check as x, ChevronLeft as S, ChevronRight as C, Loader2 as _e, Plus as ve, Search as ye, SlidersHorizontal as be, TableProperties as xe, X as Se } from "lucide-react";
6
- import { Fragment as Ce, jsx as w, jsxs as T } from "react/jsx-runtime";
4
+ import { Badge as c, Button as l, Checkbox as u, Dialog as ee, DialogContent as te, DialogFooter as ne, DialogHeader as re, DialogTitle as d, EmptyValue as ie, Input as f, Label as p, Popover as ae, PopoverContent as oe, PopoverTrigger as se, Select as ce, SelectContent as le, SelectItem as ue, SelectTrigger as de, SelectValue as fe, Skeleton as m, Table as h, TableBody as pe, TableCell as g, TableHead as me, TableHeader as _, TableRow as v, cn as he } from "@object-ui/components";
5
+ import { AlertCircle as ge, ArrowDown as y, ArrowUp as _e, ArrowUpDown as ve, Check as b, ChevronLeft as x, ChevronRight as S, Loader2 as ye, Plus as be, Search as xe, SlidersHorizontal as Se, TableProperties as C, X as Ce } from "lucide-react";
6
+ import { Fragment as we, jsx as w, jsxs as T } from "react/jsx-runtime";
7
7
  import { SchemaRendererContext as E } from "@object-ui/react";
8
8
  //#region src/widgets/RecordPickerDialog.tsx
9
- var D = 10, we = 60, O = 5;
9
+ var D = 10, Te = 60, O = 5;
10
10
  function k(e) {
11
11
  return typeof e == "string" ? { field: e } : e;
12
12
  }
13
13
  function A(e) {
14
14
  return e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase());
15
15
  }
16
- function Te(e) {
16
+ function Ee(e) {
17
17
  let t = {};
18
18
  for (let n of e) switch (n.operator) {
19
19
  case "eq":
@@ -46,7 +46,7 @@ function Te(e) {
46
46
  }
47
47
  return t;
48
48
  }
49
- function Ee(e, t) {
49
+ function De(e, t) {
50
50
  let n = {};
51
51
  for (let r of t) {
52
52
  let t = e[r.field];
@@ -54,13 +54,13 @@ function Ee(e, t) {
54
54
  }
55
55
  return n;
56
56
  }
57
- function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c = !1, dataSource: ie, objectName: ae, columns: oe, displayField: ve = "name", idField: xe = "id", pageSize: E = D, value: j, onSelect: M, onSelectRecords: N, lookupFilters: P, cellRenderer: F, filterColumns: De, renderFilterBar: Oe, renderGrid: ke }) {
58
- let [I, L] = s([]), [R, Ae] = s(!1), [z, B] = s(null), [V, H] = s(0), [je, Me] = s(""), [U, W] = s(1), G = o(null), [K, Ne] = s(null), [q, Pe] = s("asc"), [Fe, Ie] = s(/* @__PURE__ */ new Set()), Le = o(/* @__PURE__ */ new Map()), [J, Re] = s(-1), ze = o(null), [Be, Ve] = s(!1), [Y, He] = s({}), [Ue, We] = s({}), X = o(null), [Ge, Ke] = s(""), qe = a(() => oe && oe.length > 0 ? oe.map(k) : [{
59
- field: ve,
60
- label: A(ve)
61
- }], [oe, ve]), Z = a(() => {
62
- if (De && De.length > 0) return De;
63
- if (P && P.length > 0) return P.map((e) => {
57
+ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c = !1, dataSource: ie, objectName: ae, columns: oe, displayField: se = "name", idField: be = "id", pageSize: C = D, value: E, onSelect: j, onSelectRecords: M, lookupFilters: N, cellRenderer: Oe, filterColumns: P, renderFilterBar: ke, renderGrid: Ae }) {
58
+ let [F, je] = s([]), [I, L] = s(!1), [R, z] = s(null), [B, V] = s(0), [H, Me] = s(""), [U, W] = s(1), G = o(null), [K, Ne] = s(null), [q, Pe] = s("asc"), [Fe, Ie] = s(/* @__PURE__ */ new Set()), Le = o(/* @__PURE__ */ new Map()), [J, Re] = s(-1), ze = o(null), [Be, Ve] = s(!1), [Y, He] = s({}), [Ue, We] = s({}), X = o(null), [Ge, Ke] = s(""), qe = a(() => oe && oe.length > 0 ? oe.map(k) : [{
59
+ field: se,
60
+ label: A(se)
61
+ }], [oe, se]), Z = a(() => {
62
+ if (P && P.length > 0) return P;
63
+ if (N && N.length > 0) return N.map((e) => {
64
64
  let t = "text";
65
65
  return typeof e.value == "boolean" ? t = "boolean" : Array.isArray(e.value) ? t = "select" : typeof e.value == "number" || e.operator === "gt" || e.operator === "lt" || e.operator === "gte" || e.operator === "lte" ? t = "number" : (e.operator === "in" || e.operator === "notIn") && (t = "select"), {
66
66
  field: e.field,
@@ -81,59 +81,59 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
81
81
  }) } : {}
82
82
  };
83
83
  });
84
- }, [De, P]), Je = a(() => {
85
- let e = P?.length ? Te(P) : {}, t = Z?.length ? Ee(Y, Z) : {}, n = {
84
+ }, [P, N]), Je = a(() => {
85
+ let e = N?.length ? Ee(N) : {}, t = Z?.length ? De(Y, Z) : {}, n = {
86
86
  ...e,
87
87
  ...t
88
88
  };
89
89
  return Object.keys(n).length > 0 ? n : void 0;
90
90
  }, [
91
- P,
91
+ N,
92
92
  Z,
93
93
  Y
94
- ]), Q = Math.max(1, Math.ceil(V / E)), Ye = n(async (e, t = 1, n, r) => {
94
+ ]), Q = Math.max(1, Math.ceil(B / C)), Ye = n(async (e, t = 1, n, r) => {
95
95
  if (!(!ie || !ae)) {
96
- Ae(!0), B(null);
96
+ L(!0), z(null);
97
97
  try {
98
98
  let i = {
99
- $top: E,
100
- $skip: (t - 1) * E
99
+ $top: C,
100
+ $skip: (t - 1) * C
101
101
  };
102
102
  e && e.trim() && (i.$search = e.trim()), n && (i.$orderby = { [n.field]: n.direction });
103
103
  let a = r === void 0 ? Je : r;
104
104
  a && Object.keys(a).length > 0 && (i.$filter = a);
105
105
  let o = await ie.find(ae, i), s = o?.data ?? o ?? [];
106
- L(s), H(o?.total ?? s.length), Re(-1);
106
+ je(s), V(o?.total ?? s.length), Re(-1);
107
107
  } catch (e) {
108
- B(e instanceof Error ? e.message : String(e)), L([]);
108
+ z(e instanceof Error ? e.message : String(e)), je([]);
109
109
  } finally {
110
- Ae(!1);
110
+ L(!1);
111
111
  }
112
112
  }
113
113
  }, [
114
114
  ie,
115
115
  ae,
116
- E,
116
+ C,
117
117
  Je
118
118
  ]), Xe = a(() => K ? {
119
119
  field: K,
120
120
  direction: q
121
121
  } : null, [K, q]);
122
122
  i(() => {
123
- e || (Me(""), W(1), B(null), L([]), Ne(null), Pe("asc"), Re(-1), Ve(!1), He({}), We({}), Ke(""), Ie(new Set(c && Array.isArray(j) ? j : [])), Le.current.clear());
123
+ e || (Me(""), W(1), z(null), je([]), Ne(null), Pe("asc"), Re(-1), Ve(!1), He({}), We({}), Ke(""), Ie(new Set(c && Array.isArray(E) ? E : [])), Le.current.clear());
124
124
  }, [e]), i(() => {
125
- e && Ye(je || void 0, U, Xe);
125
+ e && Ye(H || void 0, U, Xe);
126
126
  }, [
127
127
  e,
128
128
  U,
129
129
  Xe,
130
130
  Je
131
131
  ]), i(() => {
132
- e && c && Ie(new Set(Array.isArray(j) ? j : []));
132
+ e && c && Ie(new Set(Array.isArray(E) ? E : []));
133
133
  }, [
134
134
  e,
135
135
  c,
136
- j
136
+ E
137
137
  ]);
138
138
  let Ze = n((e) => {
139
139
  Me(e), W(1), G.current && clearTimeout(G.current), G.current = setTimeout(() => {
@@ -145,12 +145,12 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
145
145
  }, []);
146
146
  let Qe = n((e) => {
147
147
  Ne((t) => t === e ? (Pe((e) => e === "asc" ? "desc" : "asc"), e) : (Pe("asc"), e)), W(1);
148
- }, []), $e = n((e) => e[xe] ?? e.id ?? e._id, [xe]), et = n((e) => {
148
+ }, []), $e = n((e) => e[be] ?? e.id ?? e._id, [be]), et = n((e) => {
149
149
  let t = $e(e);
150
- return c ? Fe.has(t) : j === t;
150
+ return c ? Fe.has(t) : E === t;
151
151
  }, [
152
152
  c,
153
- j,
153
+ E,
154
154
  Fe,
155
155
  $e
156
156
  ]), tt = n((e) => {
@@ -158,22 +158,22 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
158
158
  c ? Ie((t) => {
159
159
  let r = new Set(t);
160
160
  return r.has(n) ? (r.delete(n), Le.current.delete(n)) : (r.add(n), Le.current.set(n, e)), r;
161
- }) : (M(n), N?.([e]), t(!1));
161
+ }) : (j(n), M?.([e]), t(!1));
162
162
  }, [
163
163
  c,
164
164
  $e,
165
+ j,
165
166
  M,
166
- N,
167
167
  t
168
168
  ]), nt = n(() => {
169
169
  let e = Array.from(Fe);
170
- M(e);
170
+ j(e);
171
171
  let n = e.map((e) => Le.current.get(e)).filter(Boolean);
172
- N?.(n), t(!1);
172
+ M?.(n), t(!1);
173
173
  }, [
174
174
  Fe,
175
+ j,
175
176
  M,
176
- N,
177
177
  t
178
178
  ]), rt = n(() => {
179
179
  W((e) => Math.max(1, e - 1));
@@ -184,9 +184,9 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
184
184
  let t = parseInt(Ge, 10);
185
185
  !isNaN(t) && t >= 1 && t <= Q && W(t), Ke("");
186
186
  }, [Ge, Q]), ot = n((e) => {
187
- I.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), Re((e) => Math.min(e + 1, I.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), Re((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), J >= 0 && J < I.length && tt(I[J])));
187
+ F.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), Re((e) => Math.min(e + 1, F.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), Re((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), J >= 0 && J < F.length && tt(F[J])));
188
188
  }, [
189
- I,
189
+ F,
190
190
  J,
191
191
  tt
192
192
  ]);
@@ -198,8 +198,8 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
198
198
  }, [J]);
199
199
  let st = n((e, t) => {
200
200
  let n = e[t.field];
201
- if (t.type && F) {
202
- let e = F(t.type);
201
+ if (t.type && Oe) {
202
+ let e = Oe(t.type);
203
203
  if (e) return /* @__PURE__ */ w(e, {
204
204
  value: n,
205
205
  field: {
@@ -209,7 +209,7 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
209
209
  });
210
210
  }
211
211
  return n == null ? "" : typeof n == "object" ? n.$numberDecimal ? String(Number(n.$numberDecimal)) : n.$oid ? String(n.$oid) : n.$date ? new Date(n.$date).toLocaleDateString() : n.name || n.label ? String(n.name || n.label) : JSON.stringify(n) : typeof n == "boolean" ? n ? "Yes" : "No" : String(n);
212
- }, [F]), ct = n((e) => K === e ? w(q === "asc" ? he : b, { className: "ml-1 size-3" }) : /* @__PURE__ */ w(ge, { className: "ml-1 size-3 opacity-40" }), [K, q]), lt = n((e, t, n) => {
212
+ }, [Oe]), ct = n((e) => K === e ? w(q === "asc" ? _e : y, { className: "ml-1 size-3" }) : /* @__PURE__ */ w(ve, { className: "ml-1 size-3 opacity-40" }), [K, q]), lt = n((e, t, n) => {
213
213
  e.preventDefault(), e.stopPropagation(), X.current = {
214
214
  field: t,
215
215
  startX: e.clientX,
@@ -217,7 +217,7 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
217
217
  };
218
218
  let r = (e) => {
219
219
  if (!X.current) return;
220
- let t = e.clientX - X.current.startX, n = Math.max(we, X.current.startWidth + t);
220
+ let t = e.clientX - X.current.startX, n = Math.max(Te, X.current.startWidth + t);
221
221
  We((e) => ({
222
222
  ...e,
223
223
  [X.current.field]: n
@@ -241,13 +241,13 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
241
241
  children: [/* @__PURE__ */ w(p, {
242
242
  className: "text-xs text-muted-foreground",
243
243
  children: n
244
- }), /* @__PURE__ */ T(se, {
244
+ }), /* @__PURE__ */ T(ce, {
245
245
  value: t == null ? "" : String(t),
246
246
  onValueChange: (t) => $(e.field, t),
247
- children: [/* @__PURE__ */ w(ue, {
247
+ children: [/* @__PURE__ */ w(de, {
248
248
  className: "h-8 text-xs",
249
- children: /* @__PURE__ */ w(de, { placeholder: `Filter ${n}` })
250
- }), /* @__PURE__ */ w(ce, { children: e.options?.map((e) => /* @__PURE__ */ w(le, {
249
+ children: /* @__PURE__ */ w(fe, { placeholder: `Filter ${n}` })
250
+ }), /* @__PURE__ */ w(le, { children: e.options?.map((e) => /* @__PURE__ */ w(ue, {
251
251
  value: String(e.value),
252
252
  children: e.label
253
253
  }, String(e.value))) })]
@@ -325,15 +325,15 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
325
325
  /* @__PURE__ */ T("div", {
326
326
  className: "relative rounded-md border bg-muted/30 mb-3",
327
327
  children: [
328
- /* @__PURE__ */ w(ye, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
328
+ /* @__PURE__ */ w(xe, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
329
329
  /* @__PURE__ */ w(f, {
330
330
  placeholder: "Search...",
331
- value: je,
331
+ value: H,
332
332
  onChange: (e) => Ze(e.target.value),
333
333
  className: "pl-9 border-0 bg-transparent shadow-none focus-visible:ring-0",
334
334
  "data-testid": "record-picker-search"
335
335
  }),
336
- R && /* @__PURE__ */ w(_e, {
336
+ I && /* @__PURE__ */ w(ye, {
337
337
  className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
338
338
  "data-testid": "record-picker-loading-indicator"
339
339
  })
@@ -341,16 +341,16 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
341
341
  }),
342
342
  Z && Z.length > 0 && /* @__PURE__ */ w("div", {
343
343
  className: "py-2",
344
- children: Oe ? /* @__PURE__ */ w("div", {
344
+ children: ke ? /* @__PURE__ */ w("div", {
345
345
  "data-testid": "record-picker-filter-bar",
346
- children: Oe({
346
+ children: ke({
347
347
  filterColumns: Z,
348
348
  values: Y,
349
349
  onChange: $,
350
350
  onClear: ut,
351
351
  activeCount: dt
352
352
  })
353
- }) : /* @__PURE__ */ T(Ce, { children: [/* @__PURE__ */ T("div", {
353
+ }) : /* @__PURE__ */ T(we, { children: [/* @__PURE__ */ T("div", {
354
354
  className: "flex items-center gap-2",
355
355
  "data-testid": "record-picker-filter-bar",
356
356
  children: [/* @__PURE__ */ T(l, {
@@ -360,7 +360,7 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
360
360
  className: "gap-1.5 shrink-0",
361
361
  onClick: () => Ve((e) => !e),
362
362
  children: [
363
- /* @__PURE__ */ w(be, { className: "size-3.5" }),
363
+ /* @__PURE__ */ w(Se, { className: "size-3.5" }),
364
364
  "Filters",
365
365
  dt > 0 && /* @__PURE__ */ w("span", {
366
366
  className: "inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary",
@@ -373,7 +373,7 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
373
373
  size: "sm",
374
374
  className: "gap-1 text-xs",
375
375
  onClick: ut,
376
- children: [/* @__PURE__ */ w(Se, { className: "size-3" }), "Clear"]
376
+ children: [/* @__PURE__ */ w(Ce, { className: "size-3" }), "Clear"]
377
377
  })]
378
378
  }), Be && /* @__PURE__ */ w("div", {
379
379
  className: "mt-2 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 border rounded-md p-3 bg-muted/30",
@@ -381,34 +381,34 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
381
381
  children: Z.map((e) => /* @__PURE__ */ w("div", { children: ft(e) }, e.field))
382
382
  })] })
383
383
  }),
384
- z && /* @__PURE__ */ T("div", {
384
+ R && /* @__PURE__ */ T("div", {
385
385
  className: "flex flex-col items-center gap-2 py-4",
386
386
  role: "alert",
387
387
  children: [
388
- /* @__PURE__ */ w(me, { className: "size-5 text-destructive" }),
388
+ /* @__PURE__ */ w(ge, { className: "size-5 text-destructive" }),
389
389
  /* @__PURE__ */ w("p", {
390
390
  className: "text-sm text-destructive",
391
- children: z
391
+ children: R
392
392
  }),
393
393
  /* @__PURE__ */ w(l, {
394
394
  variant: "outline",
395
395
  size: "sm",
396
- onClick: () => Ye(je || void 0, U, Xe),
396
+ onClick: () => Ye(H || void 0, U, Xe),
397
397
  type: "button",
398
398
  children: "Retry"
399
399
  })
400
400
  ]
401
401
  }),
402
- ke ? /* @__PURE__ */ w("div", {
402
+ Ae ? /* @__PURE__ */ w("div", {
403
403
  className: "flex-1 min-h-0",
404
404
  "data-testid": "record-picker-grid-slot",
405
- children: ke({
405
+ children: Ae({
406
406
  columns: qe,
407
- records: I,
408
- loading: R,
409
- totalCount: V,
407
+ records: F,
408
+ loading: I,
409
+ totalCount: B,
410
410
  currentPage: U,
411
- pageSize: E,
411
+ pageSize: C,
412
412
  sortField: K,
413
413
  sortDirection: q,
414
414
  onSort: Qe,
@@ -416,48 +416,48 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
416
416
  onRowClick: tt,
417
417
  isSelected: et,
418
418
  multiple: c,
419
- idField: xe,
420
- cellRenderer: F
419
+ idField: be,
420
+ cellRenderer: Oe
421
421
  })
422
- }) : /* @__PURE__ */ T(Ce, { children: [
423
- R && I.length === 0 && !z && /* @__PURE__ */ w("div", {
422
+ }) : /* @__PURE__ */ T(we, { children: [
423
+ I && F.length === 0 && !R && /* @__PURE__ */ w("div", {
424
424
  className: "flex-1 overflow-hidden min-h-0 border rounded-md",
425
425
  role: "status",
426
426
  "aria-live": "polite",
427
427
  "data-testid": "record-picker-skeleton",
428
- children: /* @__PURE__ */ T(h, { children: [/* @__PURE__ */ w(v, { children: /* @__PURE__ */ T(y, {
428
+ children: /* @__PURE__ */ T(h, { children: [/* @__PURE__ */ w(_, { children: /* @__PURE__ */ T(v, {
429
429
  className: "bg-muted/40",
430
- children: [c && /* @__PURE__ */ w(fe, { className: "w-10" }), qe.map((e) => /* @__PURE__ */ w(fe, { children: /* @__PURE__ */ w(m, { className: "h-4 w-20" }) }, e.field))]
431
- }) }), /* @__PURE__ */ w(g, { children: Array.from({ length: O }, (e, t) => /* @__PURE__ */ T(y, { children: [c && /* @__PURE__ */ w(_, {
430
+ children: [c && /* @__PURE__ */ w(me, { className: "w-10" }), qe.map((e) => /* @__PURE__ */ w(me, { children: /* @__PURE__ */ w(m, { className: "h-4 w-20" }) }, e.field))]
431
+ }) }), /* @__PURE__ */ w(pe, { children: Array.from({ length: O }, (e, t) => /* @__PURE__ */ T(v, { children: [c && /* @__PURE__ */ w(g, {
432
432
  className: "w-10",
433
433
  children: /* @__PURE__ */ w(m, { className: "size-4 rounded" })
434
- }), qe.map((e) => /* @__PURE__ */ w(_, { children: /* @__PURE__ */ w(m, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
434
+ }), qe.map((e) => /* @__PURE__ */ w(g, { children: /* @__PURE__ */ w(m, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
435
435
  }),
436
- !R && !z && I.length === 0 && /* @__PURE__ */ w("div", {
436
+ !I && !R && F.length === 0 && /* @__PURE__ */ w("div", {
437
437
  className: "py-8 text-center",
438
438
  children: /* @__PURE__ */ w("p", {
439
439
  className: "text-sm text-muted-foreground",
440
440
  children: "No records found"
441
441
  })
442
442
  }),
443
- !z && I.length > 0 && /* @__PURE__ */ T("div", {
443
+ !R && F.length > 0 && /* @__PURE__ */ T("div", {
444
444
  className: "relative flex-1 overflow-auto min-h-0 border rounded-md",
445
445
  tabIndex: 0,
446
446
  onKeyDown: ot,
447
447
  role: "grid",
448
448
  "aria-label": "Records",
449
- children: [R && /* @__PURE__ */ w("div", {
449
+ children: [I && /* @__PURE__ */ w("div", {
450
450
  className: "absolute inset-0 z-10 flex items-center justify-center bg-background/60",
451
451
  "data-testid": "record-picker-loading-overlay",
452
- children: /* @__PURE__ */ w(_e, { className: "size-6 animate-spin text-muted-foreground" })
452
+ children: /* @__PURE__ */ w(ye, { className: "size-6 animate-spin text-muted-foreground" })
453
453
  }), /* @__PURE__ */ T(h, {
454
454
  style: Object.keys(Ue).length > 0 ? { tableLayout: "fixed" } : void 0,
455
- children: [/* @__PURE__ */ w(v, {
455
+ children: [/* @__PURE__ */ w(_, {
456
456
  className: "sticky top-0 z-[5] bg-muted/50 [&_tr]:border-b",
457
457
  "data-testid": "record-picker-sticky-header",
458
- children: /* @__PURE__ */ T(y, { children: [c && /* @__PURE__ */ w(fe, { className: "w-10" }), qe.map((e) => {
458
+ children: /* @__PURE__ */ T(v, { children: [c && /* @__PURE__ */ w(me, { className: "w-10" }), qe.map((e) => {
459
459
  let t = Ue[e.field];
460
- return /* @__PURE__ */ T(fe, {
460
+ return /* @__PURE__ */ T(me, {
461
461
  style: t ? {
462
462
  width: `${t}px`,
463
463
  minWidth: `${t}px`
@@ -481,20 +481,20 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
481
481
  })]
482
482
  }, e.field);
483
483
  })] })
484
- }), /* @__PURE__ */ w(g, {
484
+ }), /* @__PURE__ */ w(pe, {
485
485
  ref: ze,
486
- children: I.map((e, t) => {
486
+ children: F.map((e, t) => {
487
487
  let n = $e(e), r = et(e), i = t === J;
488
- return /* @__PURE__ */ T(y, {
488
+ return /* @__PURE__ */ T(v, {
489
489
  "data-row-index": t,
490
- className: pe("cursor-pointer transition-colors", pt(r, t), i && "ring-2 ring-primary ring-inset"),
490
+ className: he("cursor-pointer transition-colors", pt(r, t), i && "ring-2 ring-primary ring-inset"),
491
491
  onClick: () => tt(e),
492
492
  "data-testid": `record-row-${n}`,
493
493
  "aria-selected": r,
494
- children: [c && /* @__PURE__ */ w(_, {
494
+ children: [c && /* @__PURE__ */ w(g, {
495
495
  className: "w-10",
496
- children: r && /* @__PURE__ */ w(x, { className: "size-4 text-primary" })
497
- }), qe.map((t) => /* @__PURE__ */ w(_, {
496
+ children: r && /* @__PURE__ */ w(b, { className: "size-4 text-primary" })
497
+ }), qe.map((t) => /* @__PURE__ */ w(g, {
498
498
  className: "py-2.5",
499
499
  children: st(e, t)
500
500
  }, t.field))]
@@ -503,13 +503,13 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
503
503
  })]
504
504
  })]
505
505
  }),
506
- !z && V > 0 && /* @__PURE__ */ T("div", {
506
+ !R && B > 0 && /* @__PURE__ */ T("div", {
507
507
  className: "flex items-center justify-between text-sm text-muted-foreground border-t pt-3 mt-2 px-1",
508
508
  "data-testid": "record-picker-pagination",
509
509
  children: [/* @__PURE__ */ T("span", { children: [
510
- V,
510
+ B,
511
511
  " ",
512
- V === 1 ? "record" : "records",
512
+ B === 1 ? "record" : "records",
513
513
  Q > 1 && ` · Page ${U} of ${Q}`
514
514
  ] }), Q > 1 && /* @__PURE__ */ T("div", {
515
515
  className: "flex items-center gap-1.5",
@@ -522,7 +522,7 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
522
522
  disabled: U <= 1,
523
523
  type: "button",
524
524
  "aria-label": "Previous page",
525
- children: /* @__PURE__ */ w(S, { className: "size-4" })
525
+ children: /* @__PURE__ */ w(x, { className: "size-4" })
526
526
  }),
527
527
  /* @__PURE__ */ w(f, {
528
528
  className: "h-7 w-12 text-center text-xs px-1",
@@ -541,7 +541,7 @@ function j({ open: e, onOpenChange: t, title: r = "Select Record", multiple: c =
541
541
  disabled: U >= Q,
542
542
  type: "button",
543
543
  "aria-label": "Next page",
544
- children: /* @__PURE__ */ w(C, { className: "size-4" })
544
+ children: /* @__PURE__ */ w(S, { className: "size-4" })
545
545
  })
546
546
  ]
547
547
  })]
@@ -576,13 +576,13 @@ var M;
576
576
  function N(e) {
577
577
  M = e;
578
578
  }
579
- function P() {
579
+ function Oe() {
580
580
  return M;
581
581
  }
582
582
  //#endregion
583
583
  //#region src/widgets/LookupField.tsx
584
- var F = /* @__PURE__ */ e({ LookupField: () => L }), De = 50, Oe = E;
585
- function ke(e, t, n, r) {
584
+ var P = /* @__PURE__ */ e({ LookupField: () => I }), ke = 50, Ae = E;
585
+ function F(e, t, n, r) {
586
586
  let i = e[n] ?? e.id ?? e._id, a = e[t] ?? e.label ?? e.name ?? String(i), o = r ? e[r] : void 0;
587
587
  return {
588
588
  value: i,
@@ -591,7 +591,7 @@ function ke(e, t, n, r) {
591
591
  ...e
592
592
  };
593
593
  }
594
- function I(e) {
594
+ function je(e) {
595
595
  return {
596
596
  text: "text",
597
597
  number: "number",
@@ -604,12 +604,12 @@ function I(e) {
604
604
  boolean: "boolean"
605
605
  }[e];
606
606
  }
607
- function L({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
608
- let [re, d] = s(!1), [p, se] = s(""), { t: ce } = t(), [le, ue] = s([]), [de, m] = s(!1), [h, g] = s(null), [_, fe] = s(0), v = o(null), [y, pe] = s([]), [b, he] = s(-1), ge = o(null), x = ee || ne.schema, S = x?.field, C = S && typeof S == "object" && ("reference_to" in S || "reference" in S || "type" in S) ? S : x, be = C?.options || [], E = C?.multiple || !1, D = C?.display_field || C?.reference_field || "name", we = C?.description_field, O = C?.id_field || "id", k = C?.reference_to || C?.reference, A = C?.lookup_columns, Te = C?.lookup_page_size, Ee = C?.lookup_filters, M = a(() => {
607
+ function I({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
608
+ let [re, d] = s(!1), [p, ce] = s(""), { t: le } = t(), [ue, de] = s([]), [fe, m] = s(!1), [h, pe] = s(null), [g, me] = s(0), _ = o(null), [v, he] = s([]), [y, _e] = s(-1), ve = o(null), b = ee || ne.schema, x = b?.field, S = x && typeof x == "object" && ("reference_to" in x || "reference" in x || "type" in x) ? x : b, Se = S?.options || [], E = S?.multiple || !1, D = S?.display_field || S?.reference_field || "name", Te = S?.description_field, O = S?.id_field || "id", k = S?.reference_to || S?.reference, A = S?.lookup_columns, Ee = S?.lookup_page_size, De = S?.lookup_filters, M = a(() => {
609
609
  if (!A) return;
610
610
  let e = [];
611
611
  for (let t of A) if (typeof t == "object" && t.type) {
612
- let n = I(t.type);
612
+ let n = je(t.type);
613
613
  n && e.push({
614
614
  field: t.field,
615
615
  label: t.label,
@@ -617,55 +617,55 @@ function L({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
617
617
  });
618
618
  }
619
619
  return e.length > 0 ? e : void 0;
620
- }, [A]), N = r(Oe)?.dataSource ?? null, F = ne.dataSource ?? x?.dataSource ?? C?.dataSource ?? N, L = F != null && typeof F.find == "function" && !!k, R = ne.onCreateNew ?? x?.onCreateNew, [Ae, z] = s(!1), B = L ? le : be, V = a(() => {
621
- if (L || !p) return B;
620
+ }, [A]), N = r(Ae)?.dataSource ?? null, P = ne.dataSource ?? b?.dataSource ?? S?.dataSource ?? N, I = P != null && typeof P.find == "function" && !!k, L = ne.onCreateNew ?? b?.onCreateNew, [R, z] = s(!1), B = I ? ue : Se, V = a(() => {
621
+ if (I || !p) return B;
622
622
  let e = p.toLowerCase();
623
623
  return B.filter((t) => t.label.toLowerCase().includes(e) || t.description && t.description.toLowerCase().includes(e));
624
624
  }, [
625
- L,
625
+ I,
626
626
  B,
627
627
  p
628
628
  ]);
629
629
  i(() => {
630
- he(-1);
630
+ _e(-1);
631
631
  }, [V.length]);
632
632
  let H = n(async (e) => {
633
- if (!(!F || !k)) {
634
- m(!0), g(null);
633
+ if (!(!P || !k)) {
634
+ m(!0), pe(null);
635
635
  try {
636
- let t = { $top: De };
636
+ let t = { $top: ke };
637
637
  e && e.trim() && (t.$search = e.trim());
638
- let n = await F.find(k, t), r = n?.data ?? n ?? [];
639
- ue(r.map((e) => ke(e, D, O, we))), fe(n?.total ?? r.length);
638
+ let n = await P.find(k, t), r = n?.data ?? n ?? [];
639
+ de(r.map((e) => F(e, D, O, Te))), me(n?.total ?? r.length);
640
640
  } catch (e) {
641
- g(e instanceof Error ? e.message : String(e)), ue([]);
641
+ pe(e instanceof Error ? e.message : String(e)), de([]);
642
642
  } finally {
643
643
  m(!1);
644
644
  }
645
645
  }
646
646
  }, [
647
- F,
647
+ P,
648
648
  k,
649
649
  D,
650
650
  O,
651
- we
651
+ Te
652
652
  ]);
653
653
  i(() => {
654
- re && L && H(p || void 0), re || (se(""), g(null), he(-1));
654
+ re && I && H(p || void 0), re || (ce(""), pe(null), _e(-1));
655
655
  }, [re]);
656
- let je = n((e) => {
657
- se(e), L && (v.current && clearTimeout(v.current), v.current = setTimeout(() => {
656
+ let Me = n((e) => {
657
+ ce(e), I && (_.current && clearTimeout(_.current), _.current = setTimeout(() => {
658
658
  H(e || void 0);
659
659
  }, 300));
660
- }, [L, H]);
660
+ }, [I, H]);
661
661
  i(() => () => {
662
- v.current && clearTimeout(v.current);
662
+ _.current && clearTimeout(_.current);
663
663
  }, []);
664
- let Me = n((e) => be.find((t) => t.value === e) ?? le.find((t) => t.value === e) ?? y.find((t) => t.value === e), [
665
- be,
666
- le,
667
- y
668
- ]), U = E ? (Array.isArray(e) ? e : []).map(Me).filter(Boolean) : e ? [Me(e)].filter(Boolean) : [], W = n((t) => {
664
+ let U = n((e) => Se.find((t) => t.value === e) ?? ue.find((t) => t.value === e) ?? v.find((t) => t.value === e), [
665
+ Se,
666
+ ue,
667
+ v
668
+ ]), W = E ? (Array.isArray(e) ? e : []).map(U).filter(Boolean) : e ? [U(e)].filter(Boolean) : [], G = n((t) => {
669
669
  if (E) {
670
670
  let n = Array.isArray(e) ? e : [];
671
671
  n.includes(t.value) ? u(n.filter((e) => e !== t.value)) : u([...n, t.value]);
@@ -674,66 +674,63 @@ function L({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
674
674
  E,
675
675
  e,
676
676
  u
677
- ]), G = (t) => {
677
+ ]), K = (t) => {
678
678
  u(E ? (Array.isArray(e) ? e : []).filter((e) => e !== t) : null);
679
- }, K = n((e) => {
680
- pe(e.map((e) => ke(e, D, O, we)));
679
+ }, Ne = n((e) => {
680
+ he(e.map((e) => F(e, D, O, Te)));
681
681
  }, [
682
682
  D,
683
683
  O,
684
- we
685
- ]), Ne = n((e) => {
686
- e.key === "ArrowDown" ? (e.preventDefault(), he((e) => e < V.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), he((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), b >= 0 && b < V.length && W(V[b]));
684
+ Te
685
+ ]), q = n((e) => {
686
+ e.key === "ArrowDown" ? (e.preventDefault(), _e((e) => e < V.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), _e((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), y >= 0 && y < V.length && G(V[y]));
687
687
  }, [
688
688
  V,
689
- b,
690
- W
689
+ y,
690
+ G
691
691
  ]);
692
692
  return i(() => {
693
- b >= 0 && ge.current && ge.current.querySelector(`[data-lookup-index="${b}"]`)?.scrollIntoView({ block: "nearest" });
694
- }, [b]), te ? U.length ? E ? /* @__PURE__ */ w("div", {
693
+ y >= 0 && ve.current && ve.current.querySelector(`[data-lookup-index="${y}"]`)?.scrollIntoView({ block: "nearest" });
694
+ }, [y]), te ? W.length ? E ? /* @__PURE__ */ w("div", {
695
695
  className: "flex flex-wrap gap-1",
696
- children: U.map((e, t) => /* @__PURE__ */ w(c, {
696
+ children: W.map((e, t) => /* @__PURE__ */ w(c, {
697
697
  variant: "outline",
698
698
  children: e?.[D] || e?.label
699
699
  }, t))
700
700
  }) : /* @__PURE__ */ w("span", {
701
701
  className: "text-sm",
702
- children: U[0]?.[D] || U[0]?.label
703
- }) : /* @__PURE__ */ w("span", {
704
- className: "text-sm",
705
- children: "-"
706
- }) : /* @__PURE__ */ T("div", {
702
+ children: W[0]?.[D] || W[0]?.label
703
+ }) : /* @__PURE__ */ w(ie, {}) : /* @__PURE__ */ T("div", {
707
704
  className: "space-y-2",
708
705
  children: [
709
- U.length > 0 && /* @__PURE__ */ w("div", {
706
+ W.length > 0 && /* @__PURE__ */ w("div", {
710
707
  className: "flex flex-wrap gap-1",
711
- children: U.map((e, t) => /* @__PURE__ */ T(c, {
708
+ children: W.map((e, t) => /* @__PURE__ */ T(c, {
712
709
  variant: "outline",
713
710
  className: "gap-1",
714
711
  children: [e?.[D] || e?.label, /* @__PURE__ */ w("button", {
715
- onClick: () => G(e?.value),
712
+ onClick: () => K(e?.value),
716
713
  className: "ml-1 hover:text-destructive",
717
714
  type: "button",
718
715
  "aria-label": `Remove ${e?.[D] || e?.label}`,
719
- children: /* @__PURE__ */ w(Se, { className: "size-3" })
716
+ children: /* @__PURE__ */ w(Ce, { className: "size-3" })
720
717
  })]
721
718
  }, t))
722
719
  }),
723
720
  /* @__PURE__ */ T("div", {
724
721
  className: "flex items-center gap-1.5",
725
- children: [/* @__PURE__ */ T(ie, {
722
+ children: [/* @__PURE__ */ T(ae, {
726
723
  open: re,
727
724
  onOpenChange: d,
728
- children: [/* @__PURE__ */ w(oe, {
725
+ children: [/* @__PURE__ */ w(se, {
729
726
  asChild: !0,
730
727
  children: /* @__PURE__ */ T(l, {
731
728
  variant: "outline",
732
729
  className: "min-w-0 flex-1 justify-start text-left font-normal",
733
730
  type: "button",
734
- children: [/* @__PURE__ */ w(ye, { className: "mr-2 size-4" }), U.length === 0 ? x?.placeholder || ce("common.select") : E ? ce("table.selected", { count: U.length }) : ce("common.select")]
731
+ children: [/* @__PURE__ */ w(xe, { className: "mr-2 size-4" }), W.length === 0 ? b?.placeholder || le("common.select") : E ? le("table.selected", { count: W.length }) : le("common.select")]
735
732
  })
736
- }), /* @__PURE__ */ T(ae, {
733
+ }), /* @__PURE__ */ T(oe, {
737
734
  className: "w-[var(--radix-popover-trigger-width)] p-0",
738
735
  align: "start",
739
736
  children: [
@@ -742,15 +739,15 @@ function L({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
742
739
  children: /* @__PURE__ */ T("div", {
743
740
  className: "relative",
744
741
  children: [
745
- /* @__PURE__ */ w(ye, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
742
+ /* @__PURE__ */ w(xe, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
746
743
  /* @__PURE__ */ w(f, {
747
- placeholder: ce("common.search") + "...",
744
+ placeholder: le("common.search") + "...",
748
745
  value: p,
749
- onChange: (e) => je(e.target.value),
750
- onKeyDown: Ne,
746
+ onChange: (e) => Me(e.target.value),
747
+ onKeyDown: q,
751
748
  className: "w-full pl-9 h-8 text-sm"
752
749
  }),
753
- de && /* @__PURE__ */ w(_e, {
750
+ fe && /* @__PURE__ */ w(ye, {
754
751
  className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
755
752
  "data-testid": "lookup-loading"
756
753
  })
@@ -761,7 +758,7 @@ function L({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
761
758
  className: "flex flex-col items-center gap-2 py-4 px-2",
762
759
  role: "alert",
763
760
  children: [
764
- /* @__PURE__ */ w(me, { className: "size-5 text-destructive" }),
761
+ /* @__PURE__ */ w(ge, { className: "size-5 text-destructive" }),
765
762
  /* @__PURE__ */ w("p", {
766
763
  className: "text-sm text-destructive",
767
764
  children: h
@@ -775,17 +772,17 @@ function L({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
775
772
  })
776
773
  ]
777
774
  }),
778
- de && V.length === 0 && !h && /* @__PURE__ */ T("div", {
775
+ fe && V.length === 0 && !h && /* @__PURE__ */ T("div", {
779
776
  className: "flex flex-col items-center gap-2 py-6",
780
777
  role: "status",
781
778
  "aria-live": "polite",
782
- children: [/* @__PURE__ */ w(_e, { className: "size-6 animate-spin text-muted-foreground" }), /* @__PURE__ */ w("p", {
779
+ children: [/* @__PURE__ */ w(ye, { className: "size-6 animate-spin text-muted-foreground" }), /* @__PURE__ */ w("p", {
783
780
  className: "text-sm text-muted-foreground",
784
781
  children: "Loading…"
785
782
  })]
786
783
  }),
787
- !h && !(de && V.length === 0) && /* @__PURE__ */ w("div", {
788
- ref: ge,
784
+ !h && !(fe && V.length === 0) && /* @__PURE__ */ w("div", {
785
+ ref: ve,
789
786
  className: "max-h-64 overflow-y-auto px-1 pb-1",
790
787
  role: "listbox",
791
788
  children: V.length === 0 ? /* @__PURE__ */ T("div", {
@@ -793,25 +790,25 @@ function L({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
793
790
  children: [/* @__PURE__ */ w("p", {
794
791
  className: "text-sm text-muted-foreground",
795
792
  children: "No options found"
796
- }), R && /* @__PURE__ */ T(l, {
793
+ }), L && /* @__PURE__ */ T(l, {
797
794
  variant: "ghost",
798
795
  size: "sm",
799
796
  className: "mt-2 gap-1",
800
797
  type: "button",
801
798
  onClick: () => {
802
- R(p), d(!1);
799
+ L(p), d(!1);
803
800
  },
804
- children: [/* @__PURE__ */ w(ve, { className: "size-4" }), "Create new"]
801
+ children: [/* @__PURE__ */ w(be, { className: "size-4" }), "Create new"]
805
802
  })]
806
- }) : /* @__PURE__ */ T(Ce, { children: [
803
+ }) : /* @__PURE__ */ T(we, { children: [
807
804
  V.map((t, n) => {
808
805
  let r = E ? (Array.isArray(e) ? e : []).includes(t.value) : e === t.value;
809
806
  return /* @__PURE__ */ T("button", {
810
807
  "data-lookup-index": n,
811
808
  role: "option",
812
809
  "aria-selected": r,
813
- onClick: () => W(t),
814
- className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${n === b ? "bg-accent text-accent-foreground" : r ? "bg-accent/50 text-accent-foreground" : ""}`,
810
+ onClick: () => G(t),
811
+ className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${n === y ? "bg-accent text-accent-foreground" : r ? "bg-accent/50 text-accent-foreground" : ""}`,
815
812
  type: "button",
816
813
  children: [/* @__PURE__ */ T("div", {
817
814
  className: "min-w-0 flex-1",
@@ -829,17 +826,17 @@ function L({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
829
826
  })]
830
827
  }, t.value);
831
828
  }),
832
- L && _ > V.length && /* @__PURE__ */ T("p", {
829
+ I && g > V.length && /* @__PURE__ */ T("p", {
833
830
  className: "text-xs text-muted-foreground text-center py-2",
834
831
  children: [
835
832
  "Showing ",
836
833
  V.length,
837
834
  " of ",
838
- _,
835
+ g,
839
836
  " results."
840
837
  ]
841
838
  }),
842
- L && _ > V.length && /* @__PURE__ */ T("button", {
839
+ I && g > V.length && /* @__PURE__ */ T("button", {
843
840
  type: "button",
844
841
  className: "w-full text-center px-3 py-2 rounded-md text-sm font-medium text-primary hover:bg-accent flex items-center justify-center gap-1.5",
845
842
  onClick: () => {
@@ -847,20 +844,20 @@ function L({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
847
844
  },
848
845
  "data-testid": "show-all-results",
849
846
  children: [
850
- /* @__PURE__ */ w(xe, { className: "size-3.5" }),
847
+ /* @__PURE__ */ w(C, { className: "size-3.5" }),
851
848
  "Show All Results (",
852
- _,
849
+ g,
853
850
  ")"
854
851
  ]
855
852
  }),
856
- R && /* @__PURE__ */ T("button", {
853
+ L && /* @__PURE__ */ T("button", {
857
854
  type: "button",
858
855
  className: "w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center gap-1.5 text-muted-foreground",
859
856
  onClick: () => {
860
- R(p), d(!1);
857
+ L(p), d(!1);
861
858
  },
862
859
  children: [
863
- /* @__PURE__ */ w(ve, { className: "size-3.5" }),
860
+ /* @__PURE__ */ w(be, { className: "size-3.5" }),
864
861
  "Create new",
865
862
  p ? ` "${p}"` : ""
866
863
  ]
@@ -869,7 +866,7 @@ function L({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
869
866
  })
870
867
  ]
871
868
  })]
872
- }), L && /* @__PURE__ */ w(l, {
869
+ }), I && /* @__PURE__ */ w(l, {
873
870
  variant: "outline",
874
871
  size: "icon",
875
872
  className: "shrink-0",
@@ -878,29 +875,29 @@ function L({ value: e, onChange: u, field: ee, readonly: te, ...ne }) {
878
875
  "aria-label": "Browse all records",
879
876
  title: "Browse all records",
880
877
  "data-testid": "browse-all-records",
881
- children: /* @__PURE__ */ w(xe, { className: "size-4" })
878
+ children: /* @__PURE__ */ w(C, { className: "size-4" })
882
879
  })]
883
880
  }),
884
- L && F && k && /* @__PURE__ */ w(j, {
885
- open: Ae,
881
+ I && P && k && /* @__PURE__ */ w(j, {
882
+ open: R,
886
883
  onOpenChange: z,
887
- title: x?.label || "Select",
884
+ title: b?.label || "Select",
888
885
  multiple: E,
889
- dataSource: F,
886
+ dataSource: P,
890
887
  objectName: k,
891
888
  columns: A,
892
889
  displayField: D,
893
890
  idField: O,
894
- pageSize: Te,
891
+ pageSize: Ee,
895
892
  value: e,
896
893
  onSelect: u,
897
- onSelectRecords: K,
898
- lookupFilters: Ee,
899
- cellRenderer: P(),
894
+ onSelectRecords: Ne,
895
+ lookupFilters: De,
896
+ cellRenderer: Oe(),
900
897
  filterColumns: M
901
898
  })
902
899
  ]
903
900
  });
904
901
  }
905
902
  //#endregion
906
- export { j as i, F as n, N as r, L as t };
903
+ export { j as i, P as n, N as r, I as t };