@nivaro/react 0.3.35 → 0.3.37

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 (106) hide show
  1. package/dist/components/slots/CommentsSlot.js +44 -36
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +13 -4
  5. package/dist/shared/components/AgentBadge.js +26 -0
  6. package/dist/shared/components/AgentQuestionsCard.js +198 -0
  7. package/dist/shared/components/ItemEditForm.js +3329 -3263
  8. package/dist/shared/components/McpConnectionScope.js +480 -0
  9. package/dist/shared/components/MyWorkView.js +223 -208
  10. package/dist/shared/components/RecordReadView.js +620 -572
  11. package/dist/shared/components/chat/ChatPanel.js +683 -671
  12. package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
  13. package/dist/shared/components/imports/ImportConsole.js +106 -104
  14. package/dist/shared/components/imports/RunDetailSheet.js +11 -10
  15. package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
  16. package/dist/shared/components/item-edit/FormTour.js +279 -0
  17. package/dist/shared/components/item-edit/GroupSection.js +377 -360
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +80 -63
  19. package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
  20. package/dist/shared/components/item-edit/form-density.js +36 -0
  21. package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
  22. package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
  23. package/dist/shared/components/layout-editor/AddPanel.js +349 -192
  24. package/dist/shared/components/layout-editor/DesignNode.js +146 -131
  25. package/dist/shared/components/layout-editor/EditorCanvas.js +25 -17
  26. package/dist/shared/components/layout-editor/EditorTopBar.js +268 -206
  27. package/dist/shared/components/layout-editor/LayoutEditor.js +810 -731
  28. package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
  29. package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
  30. package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
  31. package/dist/shared/components/layout-editor/add-target.js +54 -43
  32. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
  33. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
  34. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
  35. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +379 -185
  36. package/dist/shared/components/layout-editor/dnd/TrashZone.js +96 -0
  37. package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
  38. package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
  39. package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
  40. package/dist/shared/components/layout-editor/dnd/node.js +115 -105
  41. package/dist/shared/components/layout-editor/dnd/rail-drop.js +4 -4
  42. package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
  43. package/dist/shared/components/layout-editor/dnd/trash-drop.js +58 -0
  44. package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
  45. package/dist/shared/components/layout-editor/even-row.js +86 -0
  46. package/dist/shared/components/layout-editor/field-list.js +99 -0
  47. package/dist/shared/components/layout-editor/format-painter.js +102 -0
  48. package/dist/shared/components/layout-editor/grid-guides.js +15 -13
  49. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
  50. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
  51. package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
  52. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
  53. package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
  54. package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
  55. package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
  56. package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
  57. package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
  58. package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
  59. package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
  60. package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
  61. package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
  62. package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
  63. package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
  64. package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
  65. package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
  66. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
  67. package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
  68. package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
  69. package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
  70. package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
  71. package/dist/shared/components/layout-editor/panel-frame.js +1 -1
  72. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  73. package/dist/shared/components/layout-editor/personal-default-marks.js +40 -0
  74. package/dist/shared/components/layout-editor/pin.js +37 -19
  75. package/dist/shared/components/layout-editor/place-clip.js +257 -0
  76. package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
  77. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +149 -118
  78. package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
  79. package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
  80. package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
  81. package/dist/shared/components/layout-editor/removed-log.js +151 -0
  82. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
  83. package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
  84. package/dist/shared/components/layout-editor/revert-element.js +140 -0
  85. package/dist/shared/components/layout-editor/section-structure.js +193 -170
  86. package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
  87. package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
  88. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
  89. package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
  90. package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
  91. package/dist/shared/components/layout-editor/shortcuts.js +21 -16
  92. package/dist/shared/components/layout-editor/structure-ops.js +221 -195
  93. package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
  94. package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
  95. package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
  96. package/dist/shared/components/panels/CommentPanel.js +47 -45
  97. package/dist/shared/components/panels/RevisionsPanel.js +66 -64
  98. package/dist/shared/components/panels/TaskPanel.js +395 -332
  99. package/dist/shared/components/profile/AgentsPanel.js +196 -147
  100. package/dist/shared/components/profile/ConnectionRollback.js +329 -0
  101. package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
  102. package/dist/shared/lib/entry-config.js +22 -22
  103. package/dist/shared/lib/form-usage-beacon.js +91 -55
  104. package/dist/shared/lib/layout-lint.js +530 -284
  105. package/dist/shared/lib/layout-resolve.js +58 -44
  106. package/package.json +1 -1
@@ -1,16 +1,18 @@
1
- import { jsxs as b, jsx as t, Fragment as V } from "react/jsx-runtime";
2
- import { rowOf as K, readGroupStructure as X, isFolded as _ } from "../../../lib/form-structure.js";
3
- import { InlineDisplaySection as z } from "../editors/inline-display.js";
4
- import { foldPlan as J, rowUpdatePlan as Q } from "../section-structure.js";
5
- import { AiFillSetting as Y } from "./AiFillSetting.js";
6
- import { showsNumbers as Z, showsDateMode as ee, showsInputMask as te } from "./applies.js";
7
- import { TextRulesSetting as le, CounterSetting as oe } from "./BehaviourSettings.js";
8
- import { ColumnFit as ae } from "./ColumnFit.js";
9
- import { useFieldCtx as H } from "./field-context.js";
10
- import { interfaceOptions as ie, interfaceLabel as ne, currentInterface as re } from "./interfaces.js";
11
- import { useGlobalValue as m, Setting as n, TextInput as v, Toggle as k, Choice as N, Segmented as w, Section as G, Buffered as de, DraftInput as y } from "./kit.js";
12
- import { inlineDisplayOf as se, withInlineDisplay as ce } from "./model.js";
13
- import { FieldTranslations as ue } from "./Translations.js";
1
+ import { jsxs as m, jsx as t, Fragment as K } from "react/jsx-runtime";
2
+ import { useMemo as X } from "react";
3
+ import { rowOf as z, readGroupStructure as J, isFolded as D } from "../../../lib/form-structure.js";
4
+ import { InlineDisplaySection as Q } from "../editors/inline-display.js";
5
+ import { foldPlan as Y, rowUpdatePlan as Z } from "../section-structure.js";
6
+ import { AiFillSetting as ee } from "./AiFillSetting.js";
7
+ import { showsNumbers as te, showsDateMode as le, showsInputMask as oe } from "./applies.js";
8
+ import { TextRulesSetting as ae, CounterSetting as ie } from "./BehaviourSettings.js";
9
+ import { ColumnFit as ne } from "./ColumnFit.js";
10
+ import { EvenRowAction as re } from "./EvenRowAction.js";
11
+ import { useFieldCtx as M } from "./field-context.js";
12
+ import { interfaceOptions as de, interfaceLabel as se, currentInterface as ce } from "./interfaces.js";
13
+ import { useGlobalValue as g, Setting as r, TextInput as w, Toggle as k, Choice as N, Segmented as v, Section as G, Buffered as ue, DraftInput as y } from "./kit.js";
14
+ import { inlineDisplayOf as fe, withInlineDisplay as he } from "./model.js";
15
+ import { FieldTranslations as pe } from "./Translations.js";
14
16
  const F = [
15
17
  { value: "12", label: "Full" },
16
18
  { value: "6", label: "½" },
@@ -21,7 +23,7 @@ const F = [
21
23
  { value: "int", label: "Integer" },
22
24
  { value: "decimal", label: "Decimal" },
23
25
  { value: "currency", label: "Currency" }
24
- ], fe = [
26
+ ], me = [
25
27
  { value: "", label: "None" },
26
28
  { value: "SUM", label: "Sum" },
27
29
  { value: "COUNT", label: "Count" },
@@ -29,26 +31,29 @@ const F = [
29
31
  { value: "MIN", label: "Smallest" },
30
32
  { value: "MAX", label: "Largest" }
31
33
  ], f = (o) => typeof o == "string" ? o : "";
32
- function Te() {
33
- var T, I, L, D;
34
- const o = H(), { info: a, ov: s, opts: c, env: g, row: u, globalOptions: i } = o, l = a.label, p = ((T = a.global) == null ? void 0 : T.label) || l, r = s.label === "", M = Z(a), U = ee(a), C = te(a), R = ie(a.abstractType), S = ne(a.abstractType, ((I = a.global) == null ? void 0 : I.interface) ?? null) ?? ((L = a.global) != null && L.interface ? "custom input" : null), $ = f(s.interface), P = re(a.abstractType, $) ?? $, x = m("field.format", f(i.format)), q = m("field.currency", f(i.currency)), E = m("field.aggregate", f(i.aggregate)), W = m("field.unit", f(i.unit)), j = m("field.input_mask", f(i.input_mask)), B = se(u), O = (e) => o.setPlacement(
35
- { input_bindings: ce(u, e) },
34
+ function Ne() {
35
+ var O, _, I, L;
36
+ const o = M(), { info: a, ov: c, opts: u, env: p, row: i, globalOptions: n } = o, l = a.label, b = ((O = a.global) == null ? void 0 : O.label) || l, d = c.label === "", H = te(a), U = le(a), C = oe(a), R = de(a.abstractType), S = se(a.abstractType, ((_ = a.global) == null ? void 0 : _.interface) ?? null) ?? ((I = a.global) != null && I.interface ? "custom input" : null), $ = f(c.interface), P = ce(a.abstractType, $) ?? $, E = X(
37
+ () => [{ kind: "field", field: i.field, group_key: i.group_key }],
38
+ [i.field, i.group_key]
39
+ ), x = g("field.format", f(n.format)), q = g("field.currency", f(n.currency)), W = g("field.aggregate", f(n.aggregate)), j = g("field.unit", f(n.unit)), B = g("field.input_mask", f(n.input_mask)), V = fe(i), T = (e) => o.setPlacement(
40
+ { input_bindings: he(i, e) },
36
41
  `Change what shows under ${l}`,
37
42
  !0
38
43
  );
39
- return /* @__PURE__ */ b("div", { className: "space-y-5", children: [
44
+ return /* @__PURE__ */ m("div", { className: "space-y-5", children: [
40
45
  /* @__PURE__ */ t(
41
- n,
46
+ r,
42
47
  {
43
48
  k: "field.label",
44
49
  label: "Label",
45
- effect: `What this form calls the field. Empty uses the field's own label (${p}).`,
50
+ effect: `What this form calls the field. Empty uses the field's own label (${b}).`,
46
51
  children: /* @__PURE__ */ t(
47
- v,
52
+ w,
48
53
  {
49
54
  ariaLabel: "Label",
50
- value: r ? "" : f(s.label),
51
- placeholder: p,
55
+ value: d ? "" : f(c.label),
56
+ placeholder: b,
52
57
  onChange: (e) => o.setOverride("label", e === "" ? void 0 : e, `Rename ${l}`, !0)
53
58
  }
54
59
  )
@@ -60,7 +65,7 @@ function Te() {
60
65
  k: "field.label_hidden",
61
66
  label: "Hide the label",
62
67
  effect: "Shows the value without its label on this form.",
63
- checked: r,
68
+ checked: d,
64
69
  onChange: (e) => o.setOverride(
65
70
  "label",
66
71
  e ? "" : void 0,
@@ -68,7 +73,7 @@ function Te() {
68
73
  )
69
74
  }
70
75
  ),
71
- /* @__PURE__ */ t(n, { k: "field.interface", label: "Input", effect: "How the field is edited on this form.", children: /* @__PURE__ */ t(
76
+ /* @__PURE__ */ t(r, { k: "field.interface", label: "Input", effect: "How the field is edited on this form.", children: /* @__PURE__ */ t(
72
77
  N,
73
78
  {
74
79
  ariaLabel: "Input",
@@ -81,11 +86,11 @@ function Te() {
81
86
  onChange: (e) => o.setOverride("interface", e || void 0, `Change how ${l} is edited`)
82
87
  }
83
88
  ) }),
84
- /* @__PURE__ */ t(n, { k: "field.placeholder", label: "Placeholder", effect: "Grey hint inside the empty input.", children: /* @__PURE__ */ t(
85
- v,
89
+ /* @__PURE__ */ t(r, { k: "field.placeholder", label: "Placeholder", effect: "Grey hint inside the empty input.", children: /* @__PURE__ */ t(
90
+ w,
86
91
  {
87
92
  ariaLabel: "Placeholder",
88
- value: f(s.placeholder),
93
+ value: f(c.placeholder),
89
94
  onChange: (e) => o.setOverride(
90
95
  "placeholder",
91
96
  e || void 0,
@@ -94,65 +99,68 @@ function Te() {
94
99
  )
95
100
  }
96
101
  ) }),
97
- /* @__PURE__ */ t(n, { k: "field.note", label: "Help text", effect: "A line of help under the field.", children: /* @__PURE__ */ t(
98
- v,
102
+ /* @__PURE__ */ t(r, { k: "field.note", label: "Help text", effect: "A line of help under the field.", children: /* @__PURE__ */ t(
103
+ w,
99
104
  {
100
105
  ariaLabel: "Help text",
101
- value: f(s.note),
102
- placeholder: ((D = a.global) == null ? void 0 : D.note) ?? "",
106
+ value: f(c.note),
107
+ placeholder: ((L = a.global) == null ? void 0 : L.note) ?? "",
103
108
  onChange: (e) => o.setOverride("note", e || void 0, `Change the help text of ${l}`, !0)
104
109
  }
105
110
  ) }),
106
- /* @__PURE__ */ t(le, {}),
111
+ /* @__PURE__ */ t(ae, {}),
107
112
  /* @__PURE__ */ t(
108
113
  k,
109
114
  {
110
115
  k: "field.hidden",
111
116
  label: "Hidden",
112
117
  effect: "Leaves the field off this form; its value is kept.",
113
- checked: s.hidden === !0,
118
+ checked: c.hidden === !0,
114
119
  onChange: (e) => o.setOverride("hidden", e ? !0 : void 0, e ? `Hide ${l}` : `Show ${l}`)
115
120
  }
116
121
  ),
117
- g.layoutType !== "table" && /* @__PURE__ */ t(n, { k: "field.col_span", label: "Width", effect: "Share of the row the field takes.", children: /* @__PURE__ */ t(
118
- w,
119
- {
120
- value: String(u.col_span ?? 12),
121
- options: F,
122
- onChange: (e) => {
123
- var d;
124
- return o.setPlacement(
125
- { col_span: e === "12" ? null : Number(e) },
126
- `Set the width of ${l} to ${(d = F.find((h) => h.value === e)) == null ? void 0 : d.label}`
127
- );
122
+ p.layoutType !== "table" && /* @__PURE__ */ m(r, { k: "field.col_span", label: "Width", effect: "Share of the row the field takes.", children: [
123
+ /* @__PURE__ */ t(
124
+ v,
125
+ {
126
+ value: String(i.col_span ?? 12),
127
+ options: F,
128
+ onChange: (e) => {
129
+ var s;
130
+ return o.setPlacement(
131
+ { col_span: e === "12" ? null : Number(e) },
132
+ `Set the width of ${l} to ${(s = F.find((h) => h.value === e)) == null ? void 0 : s.label}`
133
+ );
134
+ }
128
135
  }
129
- }
130
- ) }),
131
- /* @__PURE__ */ t(ae, {}),
132
- g.layoutType !== "table" && u.group_key !== null && /* @__PURE__ */ t(he, {}),
133
- a.relKind === "M2O" && a.relatedCollection && /* @__PURE__ */ b(G, { title: "Show under the value", children: [
136
+ ),
137
+ /* @__PURE__ */ t(re, { bundle: p.bundle, targets: E, apply: p.apply })
138
+ ] }),
139
+ /* @__PURE__ */ t(ne, {}),
140
+ p.layoutType !== "table" && i.group_key !== null && /* @__PURE__ */ t(be, {}),
141
+ a.relKind === "M2O" && a.relatedCollection && /* @__PURE__ */ m(G, { title: "Show under the value", children: [
134
142
  /* @__PURE__ */ t("p", { className: "text-[12px] leading-snug text-slate-500 dark:text-muted-foreground", children: "Fields of the picked record shown with it on this form." }),
135
- /* @__PURE__ */ t(de, { value: B, children: (e, d) => /* @__PURE__ */ t(
136
- z,
143
+ /* @__PURE__ */ t(ue, { value: V, children: (e, s) => /* @__PURE__ */ t(
144
+ Q,
137
145
  {
138
146
  relatedCollection: a.relatedCollection,
139
147
  entries: e.entries,
140
148
  separator: e.separator,
141
- onChange: (h) => O(d({ ...e, entries: h })),
142
- onSeparatorChange: (h) => O(d({ ...e, separator: h }))
149
+ onChange: (h) => T(s({ ...e, entries: h })),
150
+ onSeparatorChange: (h) => T(s({ ...e, separator: h }))
143
151
  }
144
152
  ) })
145
153
  ] }),
146
154
  U && /* @__PURE__ */ t(
147
- n,
155
+ r,
148
156
  {
149
157
  k: "field.date_mode",
150
158
  label: "Show",
151
159
  effect: "Date only hides the time in the picker and wherever this form shows the value.",
152
160
  children: /* @__PURE__ */ t(
153
- w,
161
+ v,
154
162
  {
155
- value: c.date_mode === "date" ? "date" : "datetime",
163
+ value: u.date_mode === "date" ? "date" : "datetime",
156
164
  options: [
157
165
  { value: "datetime", label: "Date & time" },
158
166
  { value: "date", label: "Date only" }
@@ -166,47 +174,47 @@ function Te() {
166
174
  )
167
175
  }
168
176
  ),
169
- M && /* @__PURE__ */ b(G, { title: "Numbers", children: [
177
+ H && /* @__PURE__ */ m(G, { title: "Numbers", children: [
170
178
  /* @__PURE__ */ t(
171
- n,
179
+ r,
172
180
  {
173
181
  k: "field.precision",
174
182
  label: "Decimal places",
175
183
  effect: "Rounds entry and display on this form.",
176
184
  children: /* @__PURE__ */ t(
177
- v,
185
+ w,
178
186
  {
179
187
  type: "number",
180
188
  ariaLabel: "Decimal places",
181
- value: c.precision == null ? "" : String(c.precision),
189
+ value: u.precision == null ? "" : String(u.precision),
182
190
  placeholder: "2",
183
191
  onChange: (e) => {
184
- const d = e === "" ? void 0 : Math.max(0, Math.min(10, Math.round(Number(e))));
185
- d !== void 0 && Number.isNaN(d) || o.setOption("precision", d, `Set the decimal places of ${l}`, !0);
192
+ const s = e === "" ? void 0 : Math.max(0, Math.min(10, Math.round(Number(e))));
193
+ s !== void 0 && Number.isNaN(s) || o.setOption("precision", s, `Set the decimal places of ${l}`, !0);
186
194
  }
187
195
  }
188
196
  )
189
197
  }
190
198
  ),
191
199
  /* @__PURE__ */ t(
192
- n,
200
+ r,
193
201
  {
194
202
  k: "field.format",
195
203
  label: "Number format",
196
204
  scope: "field",
197
205
  effect: "How the value is written everywhere it shows.",
198
206
  children: /* @__PURE__ */ t(
199
- w,
207
+ v,
200
208
  {
201
209
  value: x,
202
210
  options: A,
203
211
  onChange: (e) => {
204
- var d;
212
+ var s;
205
213
  return o.proposeGlobalOption(
206
214
  "field.format",
207
215
  "format",
208
216
  e || void 0,
209
- `Show ${l} as ${(d = A.find((h) => h.value === e)) == null ? void 0 : d.label.toLowerCase()}`,
217
+ `Show ${l} as ${(s = A.find((h) => h.value === e)) == null ? void 0 : s.label.toLowerCase()}`,
210
218
  e
211
219
  );
212
220
  }
@@ -215,7 +223,7 @@ function Te() {
215
223
  }
216
224
  ),
217
225
  x === "currency" && /* @__PURE__ */ t(
218
- n,
226
+ r,
219
227
  {
220
228
  k: "field.currency",
221
229
  label: "Currency",
@@ -240,7 +248,7 @@ function Te() {
240
248
  }
241
249
  ),
242
250
  /* @__PURE__ */ t(
243
- n,
251
+ r,
244
252
  {
245
253
  k: "field.aggregate",
246
254
  label: "Grid footer",
@@ -250,8 +258,8 @@ function Te() {
250
258
  N,
251
259
  {
252
260
  ariaLabel: "Grid footer",
253
- value: E,
254
- options: fe,
261
+ value: W,
262
+ options: me,
255
263
  onChange: (e) => o.proposeGlobalOption(
256
264
  "field.aggregate",
257
265
  "aggregate",
@@ -264,7 +272,7 @@ function Te() {
264
272
  }
265
273
  ),
266
274
  /* @__PURE__ */ t(
267
- n,
275
+ r,
268
276
  {
269
277
  k: "field.unit",
270
278
  label: "Unit",
@@ -274,7 +282,7 @@ function Te() {
274
282
  y,
275
283
  {
276
284
  ariaLabel: "Unit",
277
- value: W,
285
+ value: j,
278
286
  onCommit: (e) => o.proposeGlobalOption(
279
287
  "field.unit",
280
288
  "unit",
@@ -288,7 +296,7 @@ function Te() {
288
296
  )
289
297
  ] }),
290
298
  C && /* @__PURE__ */ t(
291
- n,
299
+ r,
292
300
  {
293
301
  k: "field.input_mask",
294
302
  label: "Input mask",
@@ -298,7 +306,7 @@ function Te() {
298
306
  y,
299
307
  {
300
308
  ariaLabel: "Input mask",
301
- value: j,
309
+ value: B,
302
310
  mono: !0,
303
311
  placeholder: "(###) ###-####",
304
312
  onCommit: (e) => o.proposeGlobalOption(
@@ -312,48 +320,48 @@ function Te() {
312
320
  )
313
321
  }
314
322
  ),
315
- /* @__PURE__ */ t(oe, {}),
316
- C && !a.isPath && !a.computedType && /* @__PURE__ */ t(Y, {}),
317
- /* @__PURE__ */ t(ue, {})
323
+ /* @__PURE__ */ t(ie, {}),
324
+ C && !a.isPath && !a.computedType && /* @__PURE__ */ t(ee, {}),
325
+ /* @__PURE__ */ t(pe, {})
318
326
  ] });
319
327
  }
320
- function he() {
321
- const { info: o, ov: a, env: s, row: c } = H(), g = o.label, u = s.bundle.groups.find((r) => r.key === c.group_key) ?? null;
322
- if (!u || !["section", "tab"].includes(u.type)) return null;
323
- const i = K(X(u.swap_config).rows, c.field), l = a.required === !0, p = (r) => {
324
- r.ok && s.apply(r.ops, { label: r.label });
328
+ function be() {
329
+ const { info: o, ov: a, env: c, row: u } = M(), p = o.label, i = c.bundle.groups.find((d) => d.key === u.group_key) ?? null;
330
+ if (!i || !["section", "tab"].includes(i.type)) return null;
331
+ const n = z(J(i.swap_config).rows, u.field), l = a.required === !0, b = (d) => {
332
+ d.ok && c.apply(d.ops, { label: d.label });
325
333
  };
326
- return /* @__PURE__ */ b(V, { children: [
334
+ return /* @__PURE__ */ m(K, { children: [
327
335
  /* @__PURE__ */ t(
328
336
  k,
329
337
  {
330
338
  k: "field.fold",
331
339
  label: "Behind “Show more”",
332
- effect: i ? "Fields side by side in a row always show." : l ? "Required fields always show." : "Tucked under “Show N more” at the end of the section while empty. It opens on its own once one of them has a value.",
333
- checked: _(c.overrides) && !i,
334
- disabled: !!i || l && !_(c.overrides),
335
- onChange: (r) => p(J(s.bundle, [c], r))
340
+ effect: n ? "Fields side by side in a row always show." : l ? "Required fields always show." : "Tucked under “Show N more” at the end of the section while empty. It opens on its own once one of them has a value.",
341
+ checked: D(u.overrides) && !n,
342
+ disabled: !!n || l && !D(u.overrides),
343
+ onChange: (d) => b(Y(c.bundle, [u], d))
336
344
  }
337
345
  ),
338
- i && /* @__PURE__ */ t(
339
- n,
346
+ n && /* @__PURE__ */ t(
347
+ r,
340
348
  {
341
349
  k: "field.row_group",
342
350
  label: "Shares a row",
343
- effect: `Side by side under “${i.label || "one label"}”. Rename the row in the section's settings.`,
344
- children: /* @__PURE__ */ b(
351
+ effect: `Side by side under “${n.label || "one label"}”. Rename the row in the section's settings.`,
352
+ children: /* @__PURE__ */ m(
345
353
  "button",
346
354
  {
347
355
  type: "button",
348
- onClick: () => p(
349
- Q(s.bundle, u.key, i.key, {
350
- fields: i.fields.filter((r) => r !== c.field)
356
+ onClick: () => b(
357
+ Z(c.bundle, i.key, n.key, {
358
+ fields: n.fields.filter((d) => d !== u.field)
351
359
  })
352
360
  ),
353
361
  className: "rounded-md border border-slate-200 px-2.5 py-1 text-[12px] font-medium text-slate-700 hover:bg-muted dark:border-border dark:text-foreground",
354
362
  children: [
355
363
  "Take ",
356
- g,
364
+ p,
357
365
  " out of the row"
358
366
  ]
359
367
  }
@@ -363,5 +371,5 @@ function he() {
363
371
  ] });
364
372
  }
365
373
  export {
366
- Te as LookTab
374
+ Ne as LookTab
367
375
  };
@@ -1,7 +1,7 @@
1
1
  import { jsxs as c, jsx as l } from "react/jsx-runtime";
2
- import { useQuery as j } from "@tanstack/react-query";
3
- import { X as B } from "lucide-react";
4
- import { useNivaroClient as D } from "../../../context.js";
2
+ import { useQuery as V } from "@tanstack/react-query";
3
+ import { X as j } from "lucide-react";
4
+ import { useNivaroClient as B } from "../../../context.js";
5
5
  import { get as E } from "../../../lib/commands.js";
6
6
  import { cn as W, titleCase as G } from "../../../lib/utils.js";
7
7
  import { FieldRuleWriter as Q } from "../ai-rules/FieldRuleWriter.js";
@@ -11,10 +11,10 @@ import { FieldDefaultValueControl as z } from "../editors/field-default-value.js
11
11
  import { RoleConditionRow as J, PipelineStateConditionRow as U } from "../editors/lock-conditions.js";
12
12
  import { useLayoutEditorHost as Y } from "../host.js";
13
13
  import { tintCard as Z } from "../panel-style.js";
14
- import { RecommendedToggle as ee, PersonalDefaultToggle as le, ConfirmChangeSetting as te, RepeatLastToggle as ie } from "./BehaviourSettings.js";
15
- import { useFieldCtx as oe } from "./field-context.js";
16
- import { Toggle as g, Setting as p, Segmented as ae, AddButton as ne, Section as R, TextInput as S, Choice as T } from "./kit.js";
17
- import { lockConditionsOf as re, layoutGrids as de, asObject as se, defaultValuesOf as ce, withDefaultValue as ue, lockConditionsColumn as fe } from "./model.js";
14
+ import { RecommendedToggle as ee, PersonalDefaultToggle as le, PersonalDefaultInlineToggle as te, ConfirmChangeSetting as ie, RepeatLastToggle as oe } from "./BehaviourSettings.js";
15
+ import { useFieldCtx as ae } from "./field-context.js";
16
+ import { Toggle as b, Setting as p, Segmented as ne, AddButton as re, Section as R, TextInput as T, Choice as S } from "./kit.js";
17
+ import { lockConditionsOf as de, layoutGrids as se, asObject as ce, defaultValuesOf as ue, withDefaultValue as fe, lockConditionsColumn as pe } from "./model.js";
18
18
  const L = /* @__PURE__ */ new Set([
19
19
  "inline-table",
20
20
  "inline-grid",
@@ -25,9 +25,9 @@ const L = /* @__PURE__ */ new Set([
25
25
  "o2m",
26
26
  "relation-path"
27
27
  ]);
28
- function pe(a, i) {
29
- const u = D();
30
- return j({
28
+ function me(a, i) {
29
+ const u = B();
30
+ return V({
31
31
  queryKey: ["layout-editor", "field-rows", a, i ?? null],
32
32
  queryFn: () => u.request(
33
33
  E(`/field-config/${a}`, i ? { layout_id: i } : void 0)
@@ -36,16 +36,16 @@ function pe(a, i) {
36
36
  staleTime: 6e4
37
37
  });
38
38
  }
39
- function Te() {
40
- const a = oe(), { info: i, ov: u, opts: m, env: s, row: f } = a, o = i.label, y = s.bundle.layout, v = f.field.startsWith("__") || i.isPath, b = re(f), _ = (e, t) => a.setPlacement({ lock_conditions: fe(e) }, t), w = (e, t, n) => _(
41
- b.map((d, h) => h === e ? { ...d, ...t } : d),
39
+ function Le() {
40
+ const a = ae(), { info: i, ov: u, opts: m, env: s, row: f } = a, o = i.label, y = s.bundle.layout, v = f.field.startsWith("__") || i.isPath, g = de(f), _ = (e, t) => a.setPlacement({ lock_conditions: pe(e) }, t), w = (e, t, n) => _(
41
+ g.map((d, h) => h === e ? { ...d, ...t } : d),
42
42
  n
43
- ), x = de(s.bundle, a.globals, a.relations), M = !v && i.relKind !== "M2M" && i.relKind !== "O2M" && !L.has(i.iface ?? "") && x.length > 0, r = se(u.apply_to_lines), $ = x.find((e) => e.field === r.grid) ?? null, { data: K = [] } = pe(M ? $ == null ? void 0 : $.childCollection : null), P = K.filter(
43
+ ), x = se(s.bundle, a.globals, a.relations), M = !v && i.relKind !== "M2M" && i.relKind !== "O2M" && !L.has(i.iface ?? "") && x.length > 0, r = ce(u.apply_to_lines), $ = x.find((e) => e.field === r.grid) ?? null, { data: P = [] } = me(M ? $ == null ? void 0 : $.childCollection : null), K = P.filter(
44
44
  (e) => e.field !== "id" && !e.field.startsWith("__") && !e.field.includes(".") && !["alias", "o2m", "m2m"].includes(e.type ?? "")
45
- ), N = (e, t) => a.setOverride("apply_to_lines", e ?? void 0, t), I = Y().isAdmin && !v && !i.relKind && !L.has(i.iface ?? "") && i.type !== "alias" && i.computedType !== "virtual", q = ce(y), A = typeof m.max_values == "number" ? m.max_values : null;
45
+ ), N = (e, t) => a.setOverride("apply_to_lines", e ?? void 0, t), I = Y().isAdmin && !v && !i.relKind && !L.has(i.iface ?? "") && i.type !== "alias" && i.computedType !== "virtual", q = ue(y), A = typeof m.max_values == "number" ? m.max_values : null;
46
46
  return /* @__PURE__ */ c("div", { className: "space-y-5", children: [
47
47
  /* @__PURE__ */ l(
48
- g,
48
+ b,
49
49
  {
50
50
  k: "field.required",
51
51
  label: "Required",
@@ -60,7 +60,7 @@ function Te() {
60
60
  ),
61
61
  /* @__PURE__ */ l(ee, {}),
62
62
  /* @__PURE__ */ l(
63
- g,
63
+ b,
64
64
  {
65
65
  k: "field.readonly",
66
66
  label: "Read-only",
@@ -76,8 +76,9 @@ function Te() {
76
76
  /* @__PURE__ */ l(le, {}),
77
77
  /* @__PURE__ */ l(te, {}),
78
78
  /* @__PURE__ */ l(ie, {}),
79
+ /* @__PURE__ */ l(oe, {}),
79
80
  (i.computedType === "rollup" || i.computedType === "write") && /* @__PURE__ */ l(
80
- g,
81
+ b,
81
82
  {
82
83
  k: "field.editable_computed",
83
84
  label: "Allow manual entry",
@@ -97,14 +98,14 @@ function Te() {
97
98
  label: "Read-only when",
98
99
  effect: "Locks the field while any of these holds. No conditions: always editable.",
99
100
  children: /* @__PURE__ */ c("div", { className: "space-y-2", children: [
100
- b.map((e, t) => /* @__PURE__ */ c(
101
+ g.map((e, t) => /* @__PURE__ */ c(
101
102
  "div",
102
103
  {
103
104
  className: W(Z, "space-y-3 p-3"),
104
105
  children: [
105
106
  /* @__PURE__ */ c("div", { className: "flex items-center gap-1.5", children: [
106
107
  /* @__PURE__ */ l("div", { className: "flex-1", "data-setting": "field.lock_conditions.type", children: /* @__PURE__ */ l(
107
- ae,
108
+ ne,
108
109
  {
109
110
  value: e.type,
110
111
  options: [
@@ -112,7 +113,7 @@ function Te() {
112
113
  { value: "role", label: "Role" }
113
114
  ],
114
115
  onChange: (n) => _(
115
- b.map(
116
+ g.map(
116
117
  (d, h) => h === t ? n === "role" ? { type: "role", role_ids: [] } : { type: "pipeline_state", state_keys: [] } : d
117
118
  ),
118
119
  `Change a lock condition of ${o}`
@@ -125,12 +126,12 @@ function Te() {
125
126
  type: "button",
126
127
  "aria-label": "Remove condition",
127
128
  onClick: () => _(
128
- b.filter((n, d) => d !== t),
129
+ g.filter((n, d) => d !== t),
129
130
  `Remove a lock condition from ${o}`
130
131
  ),
131
132
  "data-tip": "Remove condition",
132
133
  className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-slate-500 transition-colors hover:bg-slate-100 hover:text-red-600 dark:hover:bg-muted dark:hover:text-red-400",
133
- children: /* @__PURE__ */ l(B, { className: "h-3.5 w-3.5" })
134
+ children: /* @__PURE__ */ l(j, { className: "h-3.5 w-3.5" })
134
135
  }
135
136
  )
136
137
  ] }),
@@ -160,10 +161,10 @@ function Te() {
160
161
  )),
161
162
  /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-1.5", children: [
162
163
  /* @__PURE__ */ l(
163
- ne,
164
+ re,
164
165
  {
165
166
  onClick: () => _(
166
- [...b, { type: "pipeline_state", state_keys: [] }],
167
+ [...g, { type: "pipeline_state", state_keys: [] }],
167
168
  `Add a lock condition to ${o}`
168
169
  ),
169
170
  children: "+ Add condition"
@@ -198,7 +199,7 @@ function Te() {
198
199
  [
199
200
  {
200
201
  op: "layout_update",
201
- patch: { default_values: ue(y, f.field, e) }
202
+ patch: { default_values: fe(y, f.field, e) }
202
203
  }
203
204
  ],
204
205
  { label: `Change the default of ${o}`, text: t }
@@ -235,8 +236,8 @@ function Te() {
235
236
  field: f.field,
236
237
  disabled: a.readOnly,
237
238
  onApply: (e, t, n) => a.proposeGlobal("field.validation_rules", e.length, n, (d) => {
238
- const h = d.columns.validation_rules, O = Array.isArray(h) ? h : t, F = (k, C) => k.type === C.type && String(k.value ?? "") === String(C.value ?? ""), V = e.filter((k) => !O.some((C) => F(C, k)));
239
- return { ...d, columns: { ...d.columns, validation_rules: [...O, ...V] } };
239
+ const h = d.columns.validation_rules, O = Array.isArray(h) ? h : t, F = (k, C) => k.type === C.type && String(k.value ?? "") === String(C.value ?? ""), D = e.filter((k) => !O.some((C) => F(C, k)));
240
+ return { ...d, columns: { ...d.columns, validation_rules: [...O, ...D] } };
240
241
  })
241
242
  }
242
243
  )
@@ -250,7 +251,7 @@ function Te() {
250
251
  label: "Most values",
251
252
  effect: "Empty: no limit. 1 makes it a single pick.",
252
253
  children: /* @__PURE__ */ l(
253
- S,
254
+ T,
254
255
  {
255
256
  type: "number",
256
257
  ariaLabel: "Most values",
@@ -265,7 +266,7 @@ function Te() {
265
266
  }
266
267
  ),
267
268
  A != null && /* @__PURE__ */ l(
268
- g,
269
+ b,
269
270
  {
270
271
  k: "field.max_values_enforce_on_write",
271
272
  label: "Refuse more on the server too",
@@ -289,7 +290,7 @@ function Te() {
289
290
  label: "Grid",
290
291
  effect: "The grid whose lines get the value.",
291
292
  children: /* @__PURE__ */ l(
292
- T,
293
+ S,
293
294
  {
294
295
  ariaLabel: "Grid",
295
296
  value: r.grid ?? "",
@@ -312,14 +313,14 @@ function Te() {
312
313
  label: "Column",
313
314
  effect: "The column of each line that receives the value.",
314
315
  children: /* @__PURE__ */ l(
315
- T,
316
+ S,
316
317
  {
317
318
  ariaLabel: "Column",
318
319
  disabled: !r.grid,
319
320
  value: r.target ?? "",
320
321
  options: [
321
322
  { value: "", label: r.grid ? "Pick a column…" : "Pick a grid first" },
322
- ...P.map((e) => ({ value: e.field, label: e.label || G(e.field) }))
323
+ ...K.map((e) => ({ value: e.field, label: e.label || G(e.field) }))
323
324
  ],
324
325
  onChange: (e) => N({ ...r, target: e }, `Copy ${o} into a column`)
325
326
  }
@@ -333,7 +334,7 @@ function Te() {
333
334
  label: "Button label",
334
335
  effect: "The words on the button.",
335
336
  children: /* @__PURE__ */ l(
336
- S,
337
+ T,
337
338
  {
338
339
  ariaLabel: "Button label",
339
340
  disabled: !r.grid,
@@ -354,7 +355,7 @@ function Te() {
354
355
  )
355
356
  ] }),
356
357
  s.layoutType === "addendum" && /* @__PURE__ */ l(
357
- g,
358
+ b,
358
359
  {
359
360
  k: "field.prefill_from_parent",
360
361
  label: "Prefill from the record",
@@ -370,6 +371,6 @@ function Te() {
370
371
  ] });
371
372
  }
372
373
  export {
373
- Te as RulesTab,
374
- pe as useFieldRows
374
+ Le as RulesTab,
375
+ me as useFieldRows
375
376
  };