@nivaro/react 0.3.73 → 0.3.74

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,62 +1,62 @@
1
- import { jsxs as m, jsx as n, Fragment as w } from "react/jsx-runtime";
2
- import { X as S } from "lucide-react";
1
+ import { jsxs as m, jsx as n, Fragment as _ } from "react/jsx-runtime";
2
+ import { X as $ } from "lucide-react";
3
3
  import { useMemo as O } from "react";
4
- import { validateExpression as N } from "../../../lib/expression.js";
5
- import { displayFormulaOf as T, textRulesOf as R, counterOf as M, confirmChangeOf as F } from "../../../lib/placement-behaviour.js";
4
+ import { validateExpression as T } from "../../../lib/expression.js";
5
+ import { displayFormulaOf as N, textRulesOf as R, counterOf as M, confirmChangeOf as F } from "../../../lib/placement-behaviour.js";
6
6
  import { cn as L } from "../../../lib/utils.js";
7
- import { RoleConditionRow as A, PipelineStateConditionRow as $ } from "../editors/lock-conditions.js";
8
- import { useColumnFacts as P, columnOf as D } from "../inspect/inspect-api.js";
9
- import { effectText as I, tintCard as W } from "../panel-style.js";
10
- import { isRelational as K } from "./applies.js";
11
- import { useFieldCtx as b } from "./field-context.js";
12
- import { useInspectorEnv as j, Setting as p, TextInput as _, TextArea as q, Segmented as k, DraftInput as E, AddButton as H, Toggle as g } from "./kit.js";
7
+ import { RoleConditionRow as A, PipelineStateConditionRow as S } from "../editors/lock-conditions.js";
8
+ import { useColumnFacts as P, columnOf as I } from "../inspect/inspect-api.js";
9
+ import { effectText as D, tintCard as K } from "../panel-style.js";
10
+ import { isRelational as W } from "./applies.js";
11
+ import { useFieldCtx as g } from "./field-context.js";
12
+ import { useInspectorEnv as j, Setting as y, TextInput as w, TextArea as q, Segmented as k, DraftInput as E, AddButton as H, Toggle as p } from "./kit.js";
13
13
  const U = "rounded p-0.5 text-slate-400 transition-colors hover:bg-muted hover:text-slate-700 dark:hover:text-foreground";
14
14
  function z(t) {
15
- if (K(t)) return !1;
16
- const i = t.iface ?? "";
17
- return ["string", "text", "richtext", "rich_text", "markdown", "wysiwyg"].includes(t.type) || /textarea|rich|wysiwyg|markdown/i.test(i);
15
+ if (W(t)) return !1;
16
+ const a = t.iface ?? "";
17
+ return ["string", "text", "richtext", "rich_text", "markdown", "wysiwyg"].includes(t.type) || /textarea|rich|wysiwyg|markdown/i.test(a);
18
18
  }
19
- function C(t, i, o = {}) {
20
- const s = o.allowM2M === !0 && t.relKind === "M2M";
21
- return !i.startsWith("__") && !t.isPath && (s || t.type !== "alias" && t.relKind !== "M2M") && t.relKind !== "O2M" && t.computedType !== "virtual" && t.computedType !== "read";
19
+ function C(t, a, l = {}) {
20
+ const r = l.allowM2M === !0 && t.relKind === "M2M";
21
+ return !a.startsWith("__") && !t.isPath && (r || t.type !== "alias" && t.relKind !== "M2M") && t.relKind !== "O2M" && t.computedType !== "virtual" && t.computedType !== "read";
22
22
  }
23
23
  function re() {
24
- const t = b(), { ov: i, info: o, env: s, row: d } = t, c = o.label, f = R(i), u = (r, a, e) => t.setOverride("text_rules", r.length ? r : void 0, a, e), l = (r, a, e, h) => u(
25
- f.map((v, y) => y === r ? { ...v, ...a } : v),
24
+ const t = g(), { ov: a, info: l, env: r, row: c } = t, d = l.label, f = R(a), u = (s, i, e) => t.setOverride("text_rules", s.length ? s : void 0, i, e), o = (s, i, e, h) => u(
25
+ f.map((b, v) => v === s ? { ...b, ...i } : b),
26
26
  e,
27
27
  h
28
28
  );
29
- return d.field.startsWith("__") ? null : /* @__PURE__ */ m(
30
- p,
29
+ return c.field.startsWith("__") ? null : /* @__PURE__ */ m(
30
+ y,
31
31
  {
32
32
  k: "field.text_rules",
33
33
  label: "Label and help by state or role",
34
34
  effect: "Different words in a workflow state or for a role: “Requested date” becomes “Delivered date” once Completed. The first rule that matches wins; the record page, read view and PDF follow it.",
35
35
  children: [
36
- f.map((r, a) => /* @__PURE__ */ m(
36
+ f.map((s, i) => /* @__PURE__ */ m(
37
37
  "div",
38
38
  {
39
- "data-text-rule": a,
40
- className: L(W, "space-y-2 px-2.5 py-2"),
39
+ "data-text-rule": i,
40
+ className: L(K, "space-y-2 px-2.5 py-2"),
41
41
  children: [
42
42
  /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
43
43
  /* @__PURE__ */ n("div", { className: "flex-1", children: /* @__PURE__ */ n(
44
44
  k,
45
45
  {
46
- value: r.type,
46
+ value: s.type,
47
47
  options: [
48
48
  { value: "pipeline_state", label: "In a state" },
49
49
  { value: "role", label: "For a role" }
50
50
  ],
51
- onChange: (e) => l(
52
- a,
51
+ onChange: (e) => o(
52
+ i,
53
53
  e === "role" ? {
54
54
  type: "role",
55
55
  role_ids: [],
56
56
  state_keys: void 0,
57
57
  pipeline_id: void 0
58
58
  } : { type: "pipeline_state", state_keys: [], role_ids: void 0 },
59
- `Change when ${c} reads differently`
59
+ `Change when ${d} reads differently`
60
60
  )
61
61
  }
62
62
  ) }),
@@ -68,57 +68,57 @@ function re() {
68
68
  "data-tip": "Remove this rule",
69
69
  className: U,
70
70
  onClick: () => u(
71
- f.filter((e, h) => h !== a),
72
- `Remove a label rule from ${c}`
71
+ f.filter((e, h) => h !== i),
72
+ `Remove a label rule from ${d}`
73
73
  ),
74
- children: /* @__PURE__ */ n(S, { className: "h-3.5 w-3.5" })
74
+ children: /* @__PURE__ */ n($, { className: "h-3.5 w-3.5" })
75
75
  }
76
76
  )
77
77
  ] }),
78
- r.type === "role" ? /* @__PURE__ */ n(
78
+ s.type === "role" ? /* @__PURE__ */ n(
79
79
  A,
80
80
  {
81
- roleIds: r.role_ids ?? [],
82
- onRoleIdsChange: (e) => l(a, { role_ids: e }, `Change the roles for ${c}`)
81
+ roleIds: s.role_ids ?? [],
82
+ onRoleIdsChange: (e) => o(i, { role_ids: e }, `Change the roles for ${d}`)
83
83
  }
84
84
  ) : /* @__PURE__ */ n(
85
- $,
85
+ S,
86
86
  {
87
- collection: s.collection,
88
- pipelineId: r.pipeline_id,
89
- stateKeys: r.state_keys ?? [],
90
- onPipelineChange: (e) => l(a, { pipeline_id: e, state_keys: [] }, `Change the pipeline for ${c}`),
91
- onStateKeysChange: (e) => l(a, { state_keys: e }, `Change the states for ${c}`)
87
+ collection: r.collection,
88
+ pipelineId: s.pipeline_id,
89
+ stateKeys: s.state_keys ?? [],
90
+ onPipelineChange: (e) => o(i, { pipeline_id: e, state_keys: [] }, `Change the pipeline for ${d}`),
91
+ onStateKeysChange: (e) => o(i, { state_keys: e }, `Change the states for ${d}`)
92
92
  }
93
93
  ),
94
94
  /* @__PURE__ */ n(
95
- _,
95
+ w,
96
96
  {
97
97
  ariaLabel: "Label in this case",
98
- value: r.label ?? "",
99
- placeholder: `Label (${c})`,
100
- onChange: (e) => l(a, { label: e || void 0 }, `Change a label rule of ${c}`, !0)
98
+ value: s.label ?? "",
99
+ placeholder: `Label (${d})`,
100
+ onChange: (e) => o(i, { label: e || void 0 }, `Change a label rule of ${d}`, !0)
101
101
  }
102
102
  ),
103
103
  /* @__PURE__ */ n(
104
- _,
104
+ w,
105
105
  {
106
106
  ariaLabel: "Help text in this case",
107
- value: r.note ?? "",
107
+ value: s.note ?? "",
108
108
  placeholder: "Help text (unchanged when empty)",
109
- onChange: (e) => l(a, { note: e || void 0 }, `Change a help rule of ${c}`, !0)
109
+ onChange: (e) => o(i, { note: e || void 0 }, `Change a help rule of ${d}`, !0)
110
110
  }
111
111
  )
112
112
  ]
113
113
  },
114
- a
114
+ i
115
115
  )),
116
116
  /* @__PURE__ */ n(
117
117
  H,
118
118
  {
119
119
  onClick: () => u(
120
120
  [...f, { type: "pipeline_state", state_keys: [] }],
121
- `Add a label rule to ${c}`
121
+ `Add a label rule to ${d}`
122
122
  ),
123
123
  children: "+ Add a rule"
124
124
  }
@@ -128,58 +128,58 @@ function re() {
128
128
  );
129
129
  }
130
130
  function ie() {
131
- const t = b(), { ov: i, info: o, env: s, row: d } = t, { data: c } = P(s.collection), f = D(c, d.field);
132
- if (!z(o) || d.field.startsWith("__")) return null;
133
- const u = o.label, l = M(i), r = (f == null ? void 0 : f.max_length) != null && f.max_length > 0 ? f.max_length : null, a = (e, h, v) => t.setOverride("counter", e, h, v);
131
+ const t = g(), { ov: a, info: l, env: r, row: c } = t, { data: d } = P(r.collection), f = I(d, c.field);
132
+ if (!z(l) || c.field.startsWith("__")) return null;
133
+ const u = l.label, o = M(a), s = (f == null ? void 0 : f.max_length) != null && f.max_length > 0 ? f.max_length : null, i = (e, h, b) => t.setOverride("counter", e, h, b);
134
134
  return /* @__PURE__ */ m("div", { "data-setting": "field.counter", className: "space-y-3", children: [
135
135
  /* @__PURE__ */ n(
136
- g,
136
+ p,
137
137
  {
138
138
  k: "field.counter.on",
139
139
  label: "Counter and limit",
140
- effect: r ? `Counts as people type. The limit starts at the column size (${r.toLocaleString()} characters); past it the form will not save.` : "Counts as people type; past a limit the form will not save.",
141
- checked: !!l,
142
- onChange: (e) => a(
143
- e ? { unit: "characters", ...r ? { limit: r } : {} } : void 0,
140
+ effect: s ? `Counts as people type. The limit starts at the column size (${s.toLocaleString()} characters); past it the form will not save.` : "Counts as people type; past a limit the form will not save.",
141
+ checked: !!o,
142
+ onChange: (e) => i(
143
+ e ? { unit: "characters", ...s ? { limit: s } : {} } : void 0,
144
144
  e ? `Count the characters of ${u}` : `Stop counting ${u}`
145
145
  )
146
146
  }
147
147
  ),
148
- l && /* @__PURE__ */ m(w, { children: [
149
- /* @__PURE__ */ n(p, { k: "field.counter.unit", label: "Count", effect: "Characters or words.", children: /* @__PURE__ */ n(
148
+ o && /* @__PURE__ */ m(_, { children: [
149
+ /* @__PURE__ */ n(y, { k: "field.counter.unit", label: "Count", effect: "Characters or words.", children: /* @__PURE__ */ n(
150
150
  k,
151
151
  {
152
- value: l.unit,
152
+ value: o.unit,
153
153
  options: [
154
154
  { value: "characters", label: "Characters" },
155
155
  { value: "words", label: "Words" }
156
156
  ],
157
- onChange: (e) => a(
157
+ onChange: (e) => i(
158
158
  {
159
159
  unit: e,
160
- ...e === "words" ? {} : l.limit != null ? { limit: l.limit } : r ? { limit: r } : {}
160
+ ...e === "words" ? {} : o.limit != null ? { limit: o.limit } : s ? { limit: s } : {}
161
161
  },
162
162
  `Count the ${e} of ${u}`
163
163
  )
164
164
  }
165
165
  ) }),
166
166
  /* @__PURE__ */ n(
167
- p,
167
+ y,
168
168
  {
169
169
  k: "field.counter.limit",
170
170
  label: "Limit",
171
- effect: l.unit === "words" ? "Most words allowed. Empty counts without a limit." : `Most characters allowed. Empty counts without a limit${r ? `; the column holds ${r.toLocaleString()}` : ""}.`,
171
+ effect: o.unit === "words" ? "Most words allowed. Empty counts without a limit." : `Most characters allowed. Empty counts without a limit${s ? `; the column holds ${s.toLocaleString()}` : ""}.`,
172
172
  children: /* @__PURE__ */ n(
173
- _,
173
+ w,
174
174
  {
175
175
  type: "number",
176
176
  ariaLabel: "Limit",
177
- value: l.limit == null ? "" : String(l.limit),
178
- placeholder: l.unit === "characters" && r ? String(r) : "No limit",
177
+ value: o.limit == null ? "" : String(o.limit),
178
+ placeholder: o.unit === "characters" && s ? String(s) : "No limit",
179
179
  onChange: (e) => {
180
180
  const h = e === "" ? void 0 : Math.max(1, Math.floor(Number(e)));
181
- h !== void 0 && !Number.isFinite(h) || a(
182
- { unit: l.unit, ...h ? { limit: h } : {} },
181
+ h !== void 0 && !Number.isFinite(h) || i(
182
+ { unit: o.unit, ...h ? { limit: h } : {} },
183
183
  `Set the limit of ${u}`,
184
184
  !0
185
185
  );
@@ -192,63 +192,63 @@ function ie() {
192
192
  ] });
193
193
  }
194
194
  function se() {
195
- var c;
196
- const t = b(), { ov: i, info: o, row: s } = t;
197
- if (s.field.startsWith("__")) return null;
198
- const d = i.required === !0 || i.required === void 0 && !!((c = o.global) != null && c.required);
195
+ var d;
196
+ const t = g(), { ov: a, info: l, row: r } = t;
197
+ if (r.field.startsWith("__")) return null;
198
+ const c = a.required === !0 || a.required === void 0 && !!((d = l.global) != null && d.required);
199
199
  return /* @__PURE__ */ n(
200
- g,
200
+ p,
201
201
  {
202
202
  k: "field.recommended",
203
203
  label: "Recommended",
204
- effect: d ? "Required already wins; switch Required off to make this a recommendation." : "An amber marker and a reminder on save listing what is still empty. Saving is never blocked.",
205
- checked: i.recommended === !0 && !d,
206
- disabled: d,
204
+ effect: c ? "Required already wins; switch Required off to make this a recommendation." : "An amber marker and a reminder on save listing what is still empty. Saving is never blocked.",
205
+ checked: a.recommended === !0 && !c,
206
+ disabled: c,
207
207
  onChange: (f) => t.setOverride(
208
208
  "recommended",
209
209
  f ? !0 : void 0,
210
- f ? `Recommend ${o.label}` : `Stop recommending ${o.label}`
210
+ f ? `Recommend ${l.label}` : `Stop recommending ${l.label}`
211
211
  )
212
212
  }
213
213
  );
214
214
  }
215
- function de() {
216
- const t = b(), { ov: i, info: o, env: s, row: d } = t;
217
- if (!C(o, d.field)) return null;
218
- const c = o.label, f = F(i), u = i.confirm_change && typeof i.confirm_change == "object" ? i.confirm_change : {}, l = typeof u.pipeline_id == "string" ? u.pipeline_id : void 0, r = (a, e) => t.setOverride("confirm_change", a, e);
215
+ function ce() {
216
+ const t = g(), { ov: a, info: l, env: r, row: c } = t;
217
+ if (!C(l, c.field)) return null;
218
+ const d = l.label, f = F(a), u = a.confirm_change && typeof a.confirm_change == "object" ? a.confirm_change : {}, o = typeof u.pipeline_id == "string" ? u.pipeline_id : void 0, s = (i, e) => t.setOverride("confirm_change", i, e);
219
219
  return /* @__PURE__ */ m("div", { "data-setting": "field.confirm_change", className: "space-y-3", children: [
220
220
  /* @__PURE__ */ n(
221
- g,
221
+ p,
222
222
  {
223
223
  k: "field.confirm_change.on",
224
224
  label: "Confirm changes on saved records",
225
225
  effect: "Changing it on an existing record asks “Are you sure?” and a short reason, kept with the change in the history. New records are not asked.",
226
226
  checked: !!f,
227
- onChange: (a) => r(
228
- a ? { state_keys: [] } : void 0,
229
- a ? `Confirm changes to ${c}` : `Stop confirming changes to ${c}`
227
+ onChange: (i) => s(
228
+ i ? { state_keys: [] } : void 0,
229
+ i ? `Confirm changes to ${d}` : `Stop confirming changes to ${d}`
230
230
  )
231
231
  }
232
232
  ),
233
233
  f && /* @__PURE__ */ n(
234
- p,
234
+ y,
235
235
  {
236
236
  k: "field.confirm_change.states",
237
237
  label: "Only in these states",
238
238
  effect: f.state_keys.length ? "Asked only while the record is in a ticked state." : "No state ticked: asked in every state.",
239
239
  children: /* @__PURE__ */ n(
240
- $,
240
+ S,
241
241
  {
242
- collection: s.collection,
243
- pipelineId: l,
242
+ collection: r.collection,
243
+ pipelineId: o,
244
244
  stateKeys: f.state_keys,
245
- onPipelineChange: (a) => r(
246
- { ...a ? { pipeline_id: a } : {}, state_keys: [] },
247
- `Change the pipeline that confirms ${c}`
245
+ onPipelineChange: (i) => s(
246
+ { ...i ? { pipeline_id: i } : {}, state_keys: [] },
247
+ `Change the pipeline that confirms ${d}`
248
248
  ),
249
- onStateKeysChange: (a) => r(
250
- { ...l ? { pipeline_id: l } : {}, state_keys: a },
251
- `Change the states that confirm ${c}`
249
+ onStateKeysChange: (i) => s(
250
+ { ...o ? { pipeline_id: o } : {}, state_keys: i },
251
+ `Change the states that confirm ${d}`
252
252
  )
253
253
  }
254
254
  )
@@ -256,53 +256,70 @@ function de() {
256
256
  )
257
257
  ] });
258
258
  }
259
- function ce() {
260
- const t = b(), { ov: i, info: o, row: s } = t;
261
- return !C(o, s.field) || o.computedType ? null : /* @__PURE__ */ n(
262
- g,
259
+ function de() {
260
+ const t = g(), { ov: a, info: l, row: r } = t;
261
+ return !C(l, r.field) || l.computedType ? null : /* @__PURE__ */ n(
262
+ p,
263
263
  {
264
264
  k: "field.repeat_last",
265
265
  label: "Repeat last value",
266
266
  effect: "A “Repeat last” button beside the label fills in what this person entered on their previous record here.",
267
- checked: i.repeat_last === !0,
268
- onChange: (d) => t.setOverride(
267
+ checked: a.repeat_last === !0,
268
+ onChange: (c) => t.setOverride(
269
269
  "repeat_last",
270
- d ? !0 : void 0,
271
- d ? `Offer to repeat the last ${o.label}` : `Stop offering to repeat ${o.label}`
270
+ c ? !0 : void 0,
271
+ c ? `Offer to repeat the last ${l.label}` : `Stop offering to repeat ${l.label}`
272
272
  )
273
273
  }
274
274
  );
275
275
  }
276
276
  function fe() {
277
- const t = b(), { ov: i, info: o, row: s } = t;
278
- return !C(o, s.field, { allowM2M: !0 }) || o.computedType ? null : /* @__PURE__ */ n(
279
- g,
277
+ const t = g(), { ov: a, info: l, row: r } = t;
278
+ return !C(l, r.field, { allowM2M: !0 }) || l.computedType ? null : /* @__PURE__ */ n(
279
+ p,
280
280
  {
281
281
  k: "field.personal_default",
282
282
  label: "Personal default",
283
283
  effect: "On this form, people can save their own starting value for this field, and new records start with it.",
284
- checked: i.personal_default === !0,
285
- onChange: (d) => t.setOverride(
284
+ checked: a.personal_default === !0,
285
+ onChange: (c) => t.setOverride(
286
286
  "personal_default",
287
- d ? !0 : void 0,
288
- d ? `Allow personal defaults for ${o.label}` : `Stop personal defaults for ${o.label}`
287
+ c ? !0 : void 0,
288
+ c ? `Allow personal defaults for ${l.label}` : `Stop personal defaults for ${l.label}`
289
289
  )
290
290
  }
291
291
  );
292
292
  }
293
293
  function ue() {
294
- const t = b(), { ov: i, info: o } = t;
295
- return i.personal_default !== !0 ? null : /* @__PURE__ */ n(
296
- g,
294
+ const t = g(), { ov: a, info: l } = t;
295
+ return a.personal_default !== !0 ? null : /* @__PURE__ */ n(
296
+ p,
297
297
  {
298
298
  k: "field.personal_default_inline",
299
299
  label: "Make default on the form",
300
300
  effect: "People can save, update and clear their default right beside this field. Off: they manage it only on their profile (My defaults); the form still fills it in.",
301
- checked: i.personal_default_inline !== !1,
302
- onChange: (s) => t.setOverride(
301
+ checked: a.personal_default_inline !== !1,
302
+ onChange: (r) => t.setOverride(
303
303
  "personal_default_inline",
304
- s ? void 0 : !1,
305
- s ? `Offer Make default on the form for ${o.label}` : `Keep ${o.label}'s default to the profile`
304
+ r ? void 0 : !1,
305
+ r ? `Offer Make default on the form for ${l.label}` : `Keep ${l.label}'s default to the profile`
306
+ )
307
+ }
308
+ );
309
+ }
310
+ function he() {
311
+ const t = g(), { ov: a, info: l } = t;
312
+ return l.type !== "boolean" ? null : /* @__PURE__ */ n(
313
+ p,
314
+ {
315
+ k: "field.summary_toggle",
316
+ label: "Switch it from Summary view",
317
+ effect: "In Summary view this yes/no is a switch people can flip without opening Edit. Their access and the edit lock are checked as for any save.",
318
+ checked: a.summary_toggle === !0,
319
+ onChange: (r) => t.setOverride(
320
+ "summary_toggle",
321
+ r ? !0 : void 0,
322
+ r ? `Let ${l.label} be switched from Summary view` : `Keep ${l.label} read-only in Summary view`
306
323
  )
307
324
  }
308
325
  );
@@ -310,34 +327,34 @@ function ue() {
310
327
  function B(t) {
311
328
  return ["file", "file-image", "files-m2m"].includes(t.iface ?? "");
312
329
  }
313
- function he() {
314
- const t = b(), { ov: i, info: o } = t;
315
- return B(o) ? /* @__PURE__ */ m(w, { children: [
330
+ function me() {
331
+ const t = g(), { ov: a, info: l } = t;
332
+ return B(l) ? /* @__PURE__ */ m(_, { children: [
316
333
  /* @__PURE__ */ n(
317
- g,
334
+ p,
318
335
  {
319
336
  k: "field.file_used_in",
320
337
  label: "Show where each file was used",
321
338
  effect: "A small chip on each file lists the addendum, integration push, email or generated document on this record that carried it.",
322
- checked: i.file_used_in !== !1,
323
- onChange: (s) => t.setOverride(
339
+ checked: a.file_used_in !== !1,
340
+ onChange: (r) => t.setOverride(
324
341
  "file_used_in",
325
- s ? void 0 : !1,
326
- s ? `Show where ${o.label} files were used` : `Hide where ${o.label} files were used`
342
+ r ? void 0 : !1,
343
+ r ? `Show where ${l.label} files were used` : `Hide where ${l.label} files were used`
327
344
  )
328
345
  }
329
346
  ),
330
347
  /* @__PURE__ */ n(
331
- g,
348
+ p,
332
349
  {
333
350
  k: "field.file_downloads",
334
351
  label: "Show who downloaded each file",
335
352
  effect: "Administrators see how many people downloaded each file from this record; hover names them. Everyone else sees nothing.",
336
- checked: i.file_downloads !== !1,
337
- onChange: (s) => t.setOverride(
353
+ checked: a.file_downloads !== !1,
354
+ onChange: (r) => t.setOverride(
338
355
  "file_downloads",
339
- s ? void 0 : !1,
340
- s ? `Show downloads for ${o.label}` : `Hide downloads for ${o.label}`
356
+ r ? void 0 : !1,
357
+ r ? `Show downloads for ${l.label}` : `Hide downloads for ${l.label}`
341
358
  )
342
359
  }
343
360
  )
@@ -350,11 +367,11 @@ const J = [
350
367
  { value: "currency", label: "Money" },
351
368
  { value: "percent", label: "Percent" }
352
369
  ];
353
- function me({
370
+ function pe({
354
371
  row: t,
355
- fields: i
372
+ fields: a
356
373
  }) {
357
- const o = j(), s = O(() => {
374
+ const l = j(), r = O(() => {
358
375
  const e = t.overrides;
359
376
  if (typeof e == "string")
360
377
  try {
@@ -363,32 +380,32 @@ function me({
363
380
  return {};
364
381
  }
365
382
  return e && typeof e == "object" ? e : {};
366
- }, [t.overrides]), d = T(s) ?? { expr: "", format: "", currency: null }, c = typeof s.label == "string" ? s.label : "", f = { field: t.field, group_key: t.group_key }, u = (e, h, v) => {
367
- const y = { ...s, ...e };
368
- for (const x of Object.keys(y)) y[x] === void 0 && delete y[x];
369
- o.apply([{ op: "update_placement", at: f, patch: { overrides: y } }], {
383
+ }, [t.overrides]), c = N(r) ?? { expr: "", format: "", currency: null }, d = typeof r.label == "string" ? r.label : "", f = { field: t.field, group_key: t.group_key }, u = (e, h, b) => {
384
+ const v = { ...r, ...e };
385
+ for (const x of Object.keys(v)) v[x] === void 0 && delete v[x];
386
+ l.apply([{ op: "update_placement", at: f, patch: { overrides: v } }], {
370
387
  label: h,
371
- text: v
388
+ text: b
372
389
  });
373
- }, l = d.expr.trim() ? N(d.expr, i) : null, r = new Set(
374
- o.bundle.placements.filter((e) => !e.field.startsWith("__")).map((e) => e.field)
375
- ), a = l != null && l.ok ? l.tokens.filter((e) => !r.has(e.split(".")[0])) : [];
390
+ }, o = c.expr.trim() ? T(c.expr, a) : null, s = new Set(
391
+ l.bundle.placements.filter((e) => !e.field.startsWith("__")).map((e) => e.field)
392
+ ), i = o != null && o.ok ? o.tokens.filter((e) => !s.has(e.split(".")[0])) : [];
376
393
  return /* @__PURE__ */ m("div", { className: "space-y-5", children: [
377
- /* @__PURE__ */ n(p, { k: "display_formula.label", label: "Label", effect: "What the form calls the value.", children: /* @__PURE__ */ n(
378
- _,
394
+ /* @__PURE__ */ n(y, { k: "display_formula.label", label: "Label", effect: "What the form calls the value.", children: /* @__PURE__ */ n(
395
+ w,
379
396
  {
380
397
  ariaLabel: "Label",
381
- value: c,
398
+ value: d,
382
399
  placeholder: "Remaining",
383
400
  onChange: (e) => u({ label: e || void 0 }, "Rename the formula", !0)
384
401
  }
385
402
  ) }),
386
403
  /* @__PURE__ */ m(
387
- p,
404
+ y,
388
405
  {
389
406
  k: "display_formula.expr",
390
407
  label: "Formula",
391
- effect: /* @__PURE__ */ m(w, { children: [
408
+ effect: /* @__PURE__ */ m(_, { children: [
392
409
  "Fields in double braces, for example",
393
410
  " ",
394
411
  /* @__PURE__ */ n("code", { className: "font-mono text-[11.5px]", children: "{{budget}} - {{committed}}" }),
@@ -401,42 +418,42 @@ function me({
401
418
  ariaLabel: "Formula",
402
419
  rows: 3,
403
420
  mono: !0,
404
- value: d.expr,
405
- onChange: (e) => u({ display_formula: { ...d, expr: e } }, "Change the formula", !0)
421
+ value: c.expr,
422
+ onChange: (e) => u({ display_formula: { ...c, expr: e } }, "Change the formula", !0)
406
423
  }
407
424
  ),
408
- l && !l.ok && /* @__PURE__ */ n(
425
+ o && !o.ok && /* @__PURE__ */ n(
409
426
  "p",
410
427
  {
411
428
  role: "alert",
412
429
  "data-formula-error": "",
413
430
  className: "text-[12px] text-red-700 dark:text-red-300",
414
- children: l.error
431
+ children: o.error
415
432
  }
416
433
  ),
417
- (l == null ? void 0 : l.ok) && l.unknownTokens.length > 0 && /* @__PURE__ */ m("p", { "data-formula-unknown": "", className: "text-[12px] text-amber-700 dark:text-amber-300", children: [
434
+ (o == null ? void 0 : o.ok) && o.unknownTokens.length > 0 && /* @__PURE__ */ m("p", { "data-formula-unknown": "", className: "text-[12px] text-amber-700 dark:text-amber-300", children: [
418
435
  "Not fields of this collection:",
419
436
  " ",
420
- /* @__PURE__ */ n("span", { className: "font-mono", children: l.unknownTokens.join(", ") })
437
+ /* @__PURE__ */ n("span", { className: "font-mono", children: o.unknownTokens.join(", ") })
421
438
  ] }),
422
- (l == null ? void 0 : l.ok) && !l.unknownTokens.length && a.length > 0 && /* @__PURE__ */ m("p", { "data-formula-offform": "", className: I, children: [
439
+ (o == null ? void 0 : o.ok) && !o.unknownTokens.length && i.length > 0 && /* @__PURE__ */ m("p", { "data-formula-offform": "", className: D, children: [
423
440
  "Not on this form, so they read as empty here:",
424
441
  " ",
425
- /* @__PURE__ */ n("span", { className: "font-mono", children: a.join(", ") })
442
+ /* @__PURE__ */ n("span", { className: "font-mono", children: i.join(", ") })
426
443
  ] })
427
444
  ]
428
445
  }
429
446
  ),
430
- /* @__PURE__ */ n(p, { k: "display_formula.format", label: "Show as", effect: "How the number is written.", children: /* @__PURE__ */ n(
447
+ /* @__PURE__ */ n(y, { k: "display_formula.format", label: "Show as", effect: "How the number is written.", children: /* @__PURE__ */ n(
431
448
  k,
432
449
  {
433
- value: d.format,
450
+ value: c.format,
434
451
  options: J,
435
- onChange: (e) => u({ display_formula: { ...d, format: e } }, "Change how the formula shows")
452
+ onChange: (e) => u({ display_formula: { ...c, format: e } }, "Change how the formula shows")
436
453
  }
437
454
  ) }),
438
- d.format === "currency" && /* @__PURE__ */ n(
439
- p,
455
+ c.format === "currency" && /* @__PURE__ */ n(
456
+ y,
440
457
  {
441
458
  k: "display_formula.currency",
442
459
  label: "Currency",
@@ -445,13 +462,13 @@ function me({
445
462
  E,
446
463
  {
447
464
  ariaLabel: "Currency",
448
- value: d.currency ?? "",
465
+ value: c.currency ?? "",
449
466
  mono: !0,
450
467
  placeholder: "USD",
451
468
  onCommit: (e) => {
452
469
  const h = e.trim().toUpperCase();
453
470
  h && !/^[A-Z]{3}$/.test(h) || u(
454
- { display_formula: { ...d, currency: h || null } },
471
+ { display_formula: { ...c, currency: h || null } },
455
472
  "Change the currency of the formula",
456
473
  !0
457
474
  );
@@ -463,14 +480,15 @@ function me({
463
480
  ] });
464
481
  }
465
482
  export {
466
- de as ConfirmChangeSetting,
483
+ ce as ConfirmChangeSetting,
467
484
  ie as CounterSetting,
468
- me as DisplayFormulaSettings,
469
- he as FileChipToggles,
485
+ pe as DisplayFormulaSettings,
486
+ me as FileChipToggles,
470
487
  ue as PersonalDefaultInlineToggle,
471
488
  fe as PersonalDefaultToggle,
472
489
  se as RecommendedToggle,
473
- ce as RepeatLastToggle,
490
+ de as RepeatLastToggle,
491
+ he as SummaryToggleSetting,
474
492
  re as TextRulesSetting,
475
493
  z as takesText
476
494
  };