@nivaro/react 0.3.120 → 0.3.121

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.
@@ -79,6 +79,11 @@ const Q = [
79
79
  label: "App crashes",
80
80
  help: "A crash that is new in the current release reached several times or more than one person within 15 minutes. Only administrators get these."
81
81
  },
82
+ {
83
+ key: "security",
84
+ label: "Security alerts",
85
+ help: "Someone changed a person’s role or a role’s permissions, created or widened an API key, was refused access over and over, or an administrator signed in from a new location. Only administrators get these."
86
+ },
82
87
  {
83
88
  key: "views",
84
89
  label: "Views sent to you",
@@ -94,23 +99,28 @@ const Q = [
94
99
  label: "Everything else",
95
100
  help: "Any notification that does not fit a category above — direct messages from other users, access requests, task assignments."
96
101
  }
97
- ], ae = /* @__PURE__ */ new Set(["chaos", "audit", "crashes"]);
98
- function le(a, l) {
99
- return a === "role" || l ? Q : Q.filter((i) => !ae.has(i.key));
102
+ ], ae = /* @__PURE__ */ new Set([
103
+ "chaos",
104
+ "audit",
105
+ "crashes",
106
+ "security"
107
+ ]);
108
+ function oe(a, o) {
109
+ return a === "role" || o ? Q : Q.filter((i) => !ae.has(i.key));
100
110
  }
101
- const oe = ["inapp", "push", "teams", "email", "quiet_override"], H = ["push_after_min", "email_after_min"], A = (a) => !!a && (a.quiet_start !== void 0 || a.quiet_end !== void 0);
102
- function se(a, l) {
111
+ const le = ["inapp", "push", "teams", "email", "quiet_override"], H = ["push_after_min", "email_after_min"], A = (a) => !!a && (a.quiet_start !== void 0 || a.quiet_end !== void 0);
112
+ function se(a, o) {
103
113
  var b, h, p, N, E, _, R, T;
104
- const i = {}, m = A(a) ? a : A(l) ? l : null;
114
+ const i = {}, m = A(a) ? a : A(o) ? o : null;
105
115
  (m == null ? void 0 : m.quiet_start) !== void 0 && (i.quiet_start = m.quiet_start), (m == null ? void 0 : m.quiet_end) !== void 0 && (i.quiet_end = m.quiet_end);
106
116
  const O = {};
107
117
  for (const y of /* @__PURE__ */ new Set([
108
- ...Object.keys((l == null ? void 0 : l.matrix) ?? {}),
118
+ ...Object.keys((o == null ? void 0 : o.matrix) ?? {}),
109
119
  ...Object.keys((a == null ? void 0 : a.matrix) ?? {})
110
120
  ])) {
111
121
  const v = {};
112
- for (const f of oe) {
113
- const x = ((h = (b = a == null ? void 0 : a.matrix) == null ? void 0 : b[y]) == null ? void 0 : h[f]) ?? ((N = (p = l == null ? void 0 : l.matrix) == null ? void 0 : p[y]) == null ? void 0 : N[f]);
122
+ for (const f of le) {
123
+ const x = ((h = (b = a == null ? void 0 : a.matrix) == null ? void 0 : b[y]) == null ? void 0 : h[f]) ?? ((N = (p = o == null ? void 0 : o.matrix) == null ? void 0 : p[y]) == null ? void 0 : N[f]);
114
124
  x !== void 0 && (v[f] = x);
115
125
  }
116
126
  O[y] = v;
@@ -118,20 +128,20 @@ function se(a, l) {
118
128
  i.matrix = O;
119
129
  const q = {};
120
130
  for (const y of /* @__PURE__ */ new Set([
121
- ...Object.keys((l == null ? void 0 : l.escalation) ?? {}),
131
+ ...Object.keys((o == null ? void 0 : o.escalation) ?? {}),
122
132
  ...Object.keys((a == null ? void 0 : a.escalation) ?? {})
123
133
  ])) {
124
134
  const v = {};
125
135
  for (const f of H) {
126
- const x = ((_ = (E = a == null ? void 0 : a.escalation) == null ? void 0 : E[y]) == null ? void 0 : _[f]) ?? ((T = (R = l == null ? void 0 : l.escalation) == null ? void 0 : R[y]) == null ? void 0 : T[f]);
136
+ const x = ((_ = (E = a == null ? void 0 : a.escalation) == null ? void 0 : E[y]) == null ? void 0 : _[f]) ?? ((T = (R = o == null ? void 0 : o.escalation) == null ? void 0 : R[y]) == null ? void 0 : T[f]);
127
137
  x !== void 0 && (v[f] = x);
128
138
  }
129
139
  q[y] = v;
130
140
  }
131
141
  return i.escalation = q, i;
132
142
  }
133
- function D(a, l, i) {
134
- return i(a) !== void 0 ? "person" : i(l) !== void 0 ? "role" : "system";
143
+ function D(a, o, i) {
144
+ return i(a) !== void 0 ? "person" : i(o) !== void 0 ? "role" : "system";
135
145
  }
136
146
  function w({ text: a }) {
137
147
  return /* @__PURE__ */ t(
@@ -145,8 +155,8 @@ function w({ text: a }) {
145
155
  }
146
156
  );
147
157
  }
148
- function S({ show: a, roleName: l }) {
149
- const i = `From the ${l ? `"${l}" ` : ""}role default — change it to make it yours`;
158
+ function S({ show: a, roleName: o }) {
159
+ const i = `From the ${o ? `"${o}" ` : ""}role default — change it to make it yours`;
150
160
  return /* @__PURE__ */ t(
151
161
  "span",
152
162
  {
@@ -163,7 +173,7 @@ function S({ show: a, roleName: l }) {
163
173
  }
164
174
  function ue({
165
175
  value: a,
166
- inherited: l,
176
+ inherited: o,
167
177
  inheritedName: i,
168
178
  legacyEmail: m = "instant",
169
179
  onCommit: O,
@@ -174,42 +184,42 @@ function ue({
174
184
  extraColumn: N,
175
185
  isAdmin: E = !0
176
186
  }) {
177
- const _ = se(a, l), R = le(h, E), [T, y] = W(null), [v, f] = W(null), x = T ?? _.quiet_start ?? "", P = v ?? _.quiet_end ?? "", U = A(a) ? "person" : A(l) ? "role" : "system", k = h === "person" && !!l, C = (e) => {
178
- const o = {
187
+ const _ = se(a, o), R = oe(h, E), [T, y] = W(null), [v, f] = W(null), x = T ?? _.quiet_start ?? "", P = v ?? _.quiet_end ?? "", U = A(a) ? "person" : A(o) ? "role" : "system", k = h === "person" && !!o, C = (e) => {
188
+ const l = {
179
189
  ...a,
180
190
  matrix: { ...a.matrix ?? {} },
181
191
  escalation: { ...a.escalation ?? {} }
182
192
  };
183
- e(o), O(o);
184
- }, L = (e, o, s) => C((d) => {
193
+ e(l), O(l);
194
+ }, L = (e, l, s) => C((d) => {
185
195
  var c;
186
196
  const n = { ...((c = d.matrix) == null ? void 0 : c[e]) ?? {} };
187
- s === void 0 ? delete n[o] : n[o] = s;
197
+ s === void 0 ? delete n[l] : n[l] = s;
188
198
  const u = d.matrix ?? {};
189
199
  Object.keys(n).length ? u[e] = n : delete u[e], d.matrix = u;
190
200
  }), V = (e) => {
191
- var o;
192
- return ((o = l == null ? void 0 : l.matrix) == null ? void 0 : o[e]) ?? {};
201
+ var l;
202
+ return ((l = o == null ? void 0 : o.matrix) == null ? void 0 : l[e]) ?? {};
193
203
  }, X = (e) => {
194
- var o, s, d, n;
195
- return ((s = (o = a.matrix) == null ? void 0 : o[e]) == null ? void 0 : s.email) ?? (m === "daily" ? "daily" : ((n = (d = l == null ? void 0 : l.matrix) == null ? void 0 : d[e]) == null ? void 0 : n.email) ?? m);
204
+ var l, s, d, n;
205
+ return ((s = (l = a.matrix) == null ? void 0 : l[e]) == null ? void 0 : s.email) ?? (m === "daily" ? "daily" : ((n = (d = o == null ? void 0 : o.matrix) == null ? void 0 : d[e]) == null ? void 0 : n.email) ?? m);
196
206
  }, z = (e) => {
197
- var o, s, d, n;
198
- return ((s = (o = a.matrix) == null ? void 0 : o[e]) == null ? void 0 : s.email) !== void 0 || m === "daily" ? "person" : ((n = (d = l == null ? void 0 : l.matrix) == null ? void 0 : d[e]) == null ? void 0 : n.email) !== void 0 ? "role" : "system";
199
- }, $ = (e, o) => C((s) => {
200
- e === void 0 && o === void 0 ? (delete s.quiet_start, delete s.quiet_end) : (s.quiet_start = e ?? "", s.quiet_end = o ?? "");
201
- }), K = (e, o, s) => C((d) => {
207
+ var l, s, d, n;
208
+ return ((s = (l = a.matrix) == null ? void 0 : l[e]) == null ? void 0 : s.email) !== void 0 || m === "daily" ? "person" : ((n = (d = o == null ? void 0 : o.matrix) == null ? void 0 : d[e]) == null ? void 0 : n.email) !== void 0 ? "role" : "system";
209
+ }, $ = (e, l) => C((s) => {
210
+ e === void 0 && l === void 0 ? (delete s.quiet_start, delete s.quiet_end) : (s.quiet_start = e ?? "", s.quiet_end = l ?? "");
211
+ }), K = (e, l, s) => C((d) => {
202
212
  var c, g, I;
203
213
  const n = { ...((c = d.escalation) == null ? void 0 : c[e]) ?? {} };
204
- s ? n[o] = s : (I = (g = l == null ? void 0 : l.escalation) == null ? void 0 : g[e]) != null && I[o] ? n[o] = 0 : delete n[o];
214
+ s ? n[l] = s : (I = (g = o == null ? void 0 : o.escalation) == null ? void 0 : g[e]) != null && I[l] ? n[l] = 0 : delete n[l];
205
215
  const u = d.escalation ?? {};
206
216
  Object.keys(n).length ? u[e] = n : delete u[e], d.escalation = u;
207
- }), G = (e) => C((o) => {
217
+ }), G = (e) => C((l) => {
208
218
  var s;
209
- (s = o.matrix) == null || delete s[e];
210
- }), J = (e) => C((o) => {
219
+ (s = l.matrix) == null || delete s[e];
220
+ }), J = (e) => C((l) => {
211
221
  var s;
212
- (s = o.escalation) == null || delete s[e];
222
+ (s = l.escalation) == null || delete s[e];
213
223
  }), Z = A(a) || Object.keys(a.matrix ?? {}).length > 0 || Object.keys(a.escalation ?? {}).length > 0, ee = [
214
224
  { value: "", label: "never" },
215
225
  { value: "15", label: "15 min" },
@@ -287,13 +297,13 @@ function ue({
287
297
  {
288
298
  type: "button",
289
299
  onClick: () => {
290
- y(""), f(""), A(l) ? $("", "") : $(void 0, void 0);
300
+ y(""), f(""), A(o) ? $("", "") : $(void 0, void 0);
291
301
  },
292
302
  className: "text-[11.5px] text-slate-400 underline decoration-dotted underline-offset-2",
293
303
  children: "Clear"
294
304
  }
295
305
  ),
296
- k && U === "person" && A(l) && /* @__PURE__ */ r(
306
+ k && U === "person" && A(o) && /* @__PURE__ */ r(
297
307
  "button",
298
308
  {
299
309
  type: "button",
@@ -303,9 +313,9 @@ function ue({
303
313
  className: "text-[11.5px] text-slate-400 underline decoration-dotted underline-offset-2",
304
314
  children: [
305
315
  "Use the role's (",
306
- (l == null ? void 0 : l.quiet_start) || "—",
316
+ (o == null ? void 0 : o.quiet_start) || "—",
307
317
  "–",
308
- (l == null ? void 0 : l.quiet_end) || "—",
318
+ (o == null ? void 0 : o.quiet_end) || "—",
309
319
  ")"
310
320
  ]
311
321
  }
@@ -345,7 +355,7 @@ function ue({
345
355
  ] }) }),
346
356
  /* @__PURE__ */ t("tbody", { children: R.map((e) => {
347
357
  var n, u;
348
- const o = ((n = _.matrix) == null ? void 0 : n[e.key]) ?? {}, s = (c) => k && D(a, l, (g) => {
358
+ const l = ((n = _.matrix) == null ? void 0 : n[e.key]) ?? {}, s = (c) => k && D(a, o, (g) => {
349
359
  var I, B;
350
360
  return (B = (I = g == null ? void 0 : g.matrix) == null ? void 0 : I[e.key]) == null ? void 0 : B[c];
351
361
  }) === "role", d = (u = a.matrix) == null ? void 0 : u[e.key];
@@ -359,8 +369,8 @@ function ue({
359
369
  "input",
360
370
  {
361
371
  type: "checkbox",
362
- checked: o[c] !== !1,
363
- onChange: () => L(e.key, c, o[c] === !1),
372
+ checked: l[c] !== !1,
373
+ onChange: () => L(e.key, c, l[c] === !1),
364
374
  disabled: b,
365
375
  "aria-label": `${c === "inapp" ? "In-app" : "Push"} for ${e.label}`,
366
376
  "data-notify-channel": `${e.key}:${c}`,
@@ -392,8 +402,8 @@ function ue({
392
402
  "input",
393
403
  {
394
404
  type: "checkbox",
395
- checked: o.teams === !0,
396
- onChange: () => L(e.key, "teams", o.teams !== !0),
405
+ checked: l.teams === !0,
406
+ onChange: () => L(e.key, "teams", l.teams !== !0),
397
407
  disabled: b || h === "person" && !p.linked,
398
408
  "aria-label": `Teams for ${e.label}`,
399
409
  "data-tip": h === "person" && !p.linked ? "Connect Teams first" : void 0,
@@ -409,11 +419,11 @@ function ue({
409
419
  "input",
410
420
  {
411
421
  type: "checkbox",
412
- checked: o.quiet_override === !0,
422
+ checked: l.quiet_override === !0,
413
423
  onChange: () => L(
414
424
  e.key,
415
425
  "quiet_override",
416
- o.quiet_override === !0 ? V(e.key).quiet_override === !0 ? !1 : void 0 : !0
426
+ l.quiet_override === !0 ? V(e.key).quiet_override === !0 ? !1 : void 0 : !0
417
427
  ),
418
428
  disabled: b,
419
429
  "aria-label": `Let ${e.label} through quiet hours`,
@@ -449,11 +459,11 @@ function ue({
449
459
  type: "button",
450
460
  disabled: b,
451
461
  onClick: () => {
452
- C((o) => {
453
- const s = o.matrix ?? {};
462
+ C((l) => {
463
+ const s = l.matrix ?? {};
454
464
  for (const d of Q)
455
465
  s[d.key] = { ...s[d.key] ?? {}, email: e.value };
456
- o.matrix = s;
466
+ l.matrix = s;
457
467
  }), e.value !== "off" && (q == null || q(e.value));
458
468
  },
459
469
  className: "rounded border border-slate-200 px-2 py-0.5 hover:border-slate-400 hover:text-slate-800 dark:border-border dark:hover:text-foreground",
@@ -493,7 +503,7 @@ function ue({
493
503
  ] }) }),
494
504
  /* @__PURE__ */ t("tbody", { children: R.map((e) => {
495
505
  var s, d;
496
- const o = ((s = _.escalation) == null ? void 0 : s[e.key]) ?? {};
506
+ const l = ((s = _.escalation) == null ? void 0 : s[e.key]) ?? {};
497
507
  return /* @__PURE__ */ r("tr", { className: "border-t border-slate-100 dark:border-border", children: [
498
508
  /* @__PURE__ */ t("td", { className: "py-1 text-slate-700 dark:text-foreground", children: e.label }),
499
509
  H.map((n) => /* @__PURE__ */ t("td", { className: "py-1", children: /* @__PURE__ */ r("span", { className: "inline-flex items-center", children: [
@@ -501,7 +511,7 @@ function ue({
501
511
  Y,
502
512
  {
503
513
  ariaLabel: `${n === "push_after_min" ? "Push" : "Email"} after for ${e.label}`,
504
- value: o[n] ? String(o[n]) : "",
514
+ value: l[n] ? String(l[n]) : "",
505
515
  options: ee,
506
516
  onChange: (u) => K(e.key, n, u ? Number(u) : null)
507
517
  }
@@ -509,7 +519,7 @@ function ue({
509
519
  /* @__PURE__ */ t(
510
520
  S,
511
521
  {
512
- show: k && D(a, l, (u) => {
522
+ show: k && D(a, o, (u) => {
513
523
  var c, g;
514
524
  return (g = (c = u == null ? void 0 : u.escalation) == null ? void 0 : c[e.key]) == null ? void 0 : g[n];
515
525
  }) === "role",
@@ -543,5 +553,5 @@ export {
543
553
  Q as NOTIFY_RULE_CATS,
544
554
  ue as NotificationRulesEditor,
545
555
  se as mergeNotifyRulesClient,
546
- le as ruleCatsFor
556
+ oe as ruleCatsFor
547
557
  };
@@ -1,115 +1,115 @@
1
- const K = "shrink-0 border-y border-slate-200/90 bg-white dark:border-border dark:bg-card", M = "flex items-stretch overflow-hidden pr-4 pl-[29px]", N = "flex min-w-0 flex-1 flex-wrap content-start items-stretch overflow-hidden", L = "[[data-header-dense]_&]:min-h-[34px] [[data-header-dense]_&]:flex-row [[data-header-dense]_&]:items-center [[data-header-dense]_&]:gap-x-2 [[data-header-dense]_&]:pr-3 [[data-header-dense]_&]:pl-4 [[data-header-dense]_&]:pt-[7px] [[data-header-dense]_&]:pb-[7px] [[data-header-dense]_&]:max-w-none", H = "[[data-header-list]_&]:h-8 [[data-header-list]_&]:min-h-0 [[data-header-list]_&]:w-full [[data-header-list]_&]:max-w-none [[data-header-list]_&]:flex-row [[data-header-list]_&]:items-center [[data-header-list]_&]:justify-between [[data-header-list]_&]:gap-x-6 [[data-header-list]_&]:rounded-sm [[data-header-list]_&]:px-2 [[data-header-list]_&]:py-0 [[data-header-list]_&]:shadow-none", O = "[&[data-header-folded]]:pointer-events-none [&[data-header-folded]]:invisible [&[data-header-folded]]:absolute", U = `group relative flex min-h-[52px] min-w-[96px] max-w-[264px] flex-none flex-col justify-start gap-1 px-4 pt-[9px] pb-2 shadow-[-1px_1px_0_0_#e2e8f0] data-[empty=true]:min-w-0 data-[empty=true]:px-3 data-[empty=true]:opacity-60 dark:shadow-[-1px_1px_0_0_hsl(var(--border))] ${L} ${H} ${O}`, $ = "truncate text-[13px] font-semibold leading-tight tabular-nums tracking-[-0.01em] text-slate-900 dark:text-slate-100", T = "truncate text-[10px] font-semibold uppercase leading-none tracking-[0.07em] text-slate-400 dark:text-slate-500 [[data-header-dense]_&]:shrink-0 [[data-header-list]_&]:shrink-0", V = "truncate text-[13px] font-semibold leading-tight tabular-nums text-slate-900 dark:text-slate-100", j = "flex shrink-0 items-stretch self-stretch max-lg:[&[data-header-dock]]:hidden shadow-[-1px_0_0_0_#e2e8f0] dark:shadow-[-1px_0_0_0_hsl(var(--border))]", F = "ml-auto hidden items-center self-center py-1 pr-0 pl-4 max-lg:[&[data-header-tail]]:flex", P = "flex min-h-[40px] items-center gap-3 py-2 pr-4 pl-5", X = "absolute top-2 right-6 flex empty:hidden [[data-header-dense]_&]:static [[data-header-dense]_&]:order-1 [[data-header-dense]_&]:shrink-0 [[data-header-list]_&]:static [[data-header-list]_&]:order-1 [[data-header-list]_&]:shrink-0 [[data-header-list]_&]:mr-auto [[data-header-list]_&]:-ml-4", Y = "[[data-header-dense]_&]:order-2 [[data-header-list]_&]:order-2", z = "text-[11px] font-medium leading-none tabular-nums text-slate-400 dark:text-slate-500 [[data-header-dense]_&]:hidden", G = "flex h-5 items-end gap-x-1.5 [[data-header-dense]_&]:h-auto [[data-header-dense]_&]:items-center [[data-header-list]_&]:h-auto [[data-header-list]_&]:items-baseline [[data-header-list]_&]:justify-end [[data-header-list]_&]:text-right";
1
+ const K = "shrink-0 border-y border-slate-200/90 bg-white dark:border-border dark:bg-card", M = "flex items-stretch overflow-hidden pr-4 pl-[29px]", N = "flex min-w-0 flex-1 flex-wrap content-start items-stretch overflow-hidden", H = "[[data-header-dense]_&]:min-h-[34px] [[data-header-dense]_&]:flex-row [[data-header-dense]_&]:items-center [[data-header-dense]_&]:gap-x-2 [[data-header-dense]_&]:pr-3 [[data-header-dense]_&]:pl-4 [[data-header-dense]_&]:pt-[7px] [[data-header-dense]_&]:pb-[7px] [[data-header-dense]_&]:max-w-none", L = "[[data-header-list]_&]:h-8 [[data-header-list]_&]:min-h-0 [[data-header-list]_&]:w-full [[data-header-list]_&]:max-w-none [[data-header-list]_&]:flex-row [[data-header-list]_&]:items-center [[data-header-list]_&]:justify-between [[data-header-list]_&]:gap-x-6 [[data-header-list]_&]:rounded-sm [[data-header-list]_&]:px-2 [[data-header-list]_&]:py-0 [[data-header-list]_&]:shadow-none", O = "[&[data-header-folded]]:pointer-events-none [&[data-header-folded]]:invisible [&[data-header-folded]]:absolute", U = `group relative flex min-h-[52px] min-w-[96px] max-w-[264px] flex-none flex-col justify-start gap-1 px-4 pt-[9px] pb-2 shadow-[-1px_1px_0_0_#e2e8f0] data-[empty=true]:min-w-0 data-[empty=true]:px-3 data-[empty=true]:opacity-60 dark:shadow-[-1px_1px_0_0_hsl(var(--border))] ${H} ${L} ${O}`, $ = "truncate text-[13px] font-semibold leading-tight tabular-nums tracking-[-0.01em] text-slate-900 dark:text-slate-100", T = "truncate text-[10px] font-semibold uppercase leading-none tracking-[0.07em] text-slate-400 dark:text-slate-500 [[data-header-dense]_&]:shrink-0 [[data-header-list]_&]:shrink-0", V = "truncate text-[13px] font-semibold leading-tight tabular-nums text-slate-900 dark:text-slate-100", j = "flex shrink-0 items-stretch self-stretch max-lg:[&[data-header-dock]]:hidden shadow-[-1px_0_0_0_#e2e8f0] dark:shadow-[-1px_0_0_0_hsl(var(--border))]", F = "ml-auto hidden items-center self-center py-1 pr-0 pl-4 max-lg:[&[data-header-tail]]:flex", P = "flex min-h-[40px] items-center gap-3 py-2 pr-4 pl-5", Y = "absolute top-2 right-2 flex empty:hidden [[data-header-dense]_&]:static [[data-header-dense]_&]:order-1 [[data-header-dense]_&]:shrink-0 [[data-header-list]_&]:static [[data-header-list]_&]:order-1 [[data-header-list]_&]:shrink-0 [[data-header-list]_&]:mr-auto [[data-header-list]_&]:-ml-4", X = "absolute top-2 right-2 [[data-header-field]:has(>[data-header-freshness]>*)>&]:right-6 [[data-header-dense]_[data-header-field]:has(>[data-header-freshness]>*)>&]:right-2 [[data-header-list]_[data-header-field]:has(>[data-header-freshness]>*)>&]:right-2", z = "[[data-header-dense]_&]:order-2 [[data-header-list]_&]:order-2", G = "text-[11px] font-medium leading-none tabular-nums text-slate-400 dark:text-slate-500 [[data-header-dense]_&]:hidden", J = "flex h-5 items-end gap-x-1.5 [[data-header-dense]_&]:h-auto [[data-header-dense]_&]:items-center [[data-header-list]_&]:h-auto [[data-header-list]_&]:items-baseline [[data-header-list]_&]:justify-end [[data-header-list]_&]:text-right";
2
2
  function b(a) {
3
- const d = Array.from(a.children).filter(
3
+ const r = Array.from(a.children).filter(
4
4
  (t) => !t.hasAttribute("data-header-more") && !t.hasAttribute("data-header-tail")
5
- ), r = d.filter((t) => t.hasAttribute("data-header-cell"));
6
- return r.length > 0 ? r : d;
5
+ ), n = r.filter((t) => t.hasAttribute("data-header-cell"));
6
+ return n.length > 0 ? n : r;
7
7
  }
8
8
  function R(a) {
9
- const d = /* @__PURE__ */ new Set();
10
- return a.map((r, t) => {
11
- let l = r.hasAttribute("data-header-cell") ? r.getAttribute("data-header-cell") ?? t : t;
12
- return d.has(l) && (l = `${l}#${t}`), d.add(l), l;
9
+ const r = /* @__PURE__ */ new Set();
10
+ return a.map((n, t) => {
11
+ let l = n.hasAttribute("data-header-cell") ? n.getAttribute("data-header-cell") ?? t : t;
12
+ return r.has(l) && (l = `${l}#${t}`), r.add(l), l;
13
13
  });
14
14
  }
15
- function J(a, d) {
16
- const r = b(a), t = R(r), l = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
17
- for (const s of d) {
15
+ function Q(a, r) {
16
+ const n = b(a), t = R(n), l = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
17
+ for (const s of r) {
18
18
  if (s.target === a) continue;
19
19
  let o = s.target instanceof Element ? s.target : s.target.parentElement;
20
20
  if (!o || o.closest("[data-header-more]")) continue;
21
21
  for (; o && o.parentElement !== a; ) o = o.parentElement;
22
- const c = o ? r.indexOf(o) : -1;
23
- !o || c < 0 || (o.hasAttribute("data-header-folded") ? n : l).add(t[c]);
22
+ const c = o ? n.indexOf(o) : -1;
23
+ !o || c < 0 || (o.hasAttribute("data-header-folded") ? d : l).add(t[c]);
24
24
  }
25
- return { shown: [...l], folded: [...n] };
25
+ return { shown: [...l], folded: [...d] };
26
26
  }
27
- function Q(a, d, r) {
27
+ function Z(a, r, n) {
28
28
  const t = b(a);
29
29
  if (t.length === 0) return !1;
30
- const l = R(t), n = a.querySelector(":scope > [data-header-tail]");
30
+ const l = R(t), d = a.querySelector(":scope > [data-header-tail]");
31
31
  let s = 0;
32
32
  t.forEach((c, f) => {
33
- let h;
34
- d ? h = r.get(l[f]) ?? v(c) : (h = c.getBoundingClientRect().width, r.set(l[f], h)), s += h;
33
+ let i;
34
+ r ? i = n.get(l[f]) ?? v(c) : (i = c.getBoundingClientRect().width, n.set(l[f], i)), s += i;
35
35
  });
36
- const o = a.clientWidth - ((n == null ? void 0 : n.getBoundingClientRect().width) ?? 0);
37
- return d ? s > o - 24 : s > o;
36
+ const o = a.clientWidth - ((d == null ? void 0 : d.getBoundingClientRect().width) ?? 0);
37
+ return r ? s > o - 24 : s > o;
38
38
  }
39
39
  function v(a) {
40
40
  var t;
41
- const d = a.querySelectorAll("[data-header-label]");
42
- if (d.length === 0) return a.getBoundingClientRect().width;
43
- let r = 0;
44
- for (const l of d) {
45
- const n = (t = l.parentElement) == null ? void 0 : t.querySelector(":scope > [data-header-value]"), s = l.closest('[data-empty="true"]') != null, o = Math.max(l.scrollWidth, ((n == null ? void 0 : n.scrollWidth) ?? 0) * 1.16 + 40);
46
- r += Math.max(o + (s ? 24 : 32), s ? 0 : 96);
41
+ const r = a.querySelectorAll("[data-header-label]");
42
+ if (r.length === 0) return a.getBoundingClientRect().width;
43
+ let n = 0;
44
+ for (const l of r) {
45
+ const d = (t = l.parentElement) == null ? void 0 : t.querySelector(":scope > [data-header-value]"), s = l.closest('[data-empty="true"]') != null, o = Math.max(l.scrollWidth, ((d == null ? void 0 : d.scrollWidth) ?? 0) * 1.16 + 40);
46
+ n += Math.max(o + (s ? 24 : 32), s ? 0 : 96);
47
47
  }
48
- return r;
48
+ return n;
49
49
  }
50
50
  const S = 2;
51
51
  function q(a) {
52
- var n, s;
53
- const d = a.querySelectorAll("[data-header-label]");
54
- if (d.length === 0) return a.getBoundingClientRect().width;
55
- const r = a.querySelectorAll("[data-header-value]");
52
+ var d, s;
53
+ const r = a.querySelectorAll("[data-header-label]");
54
+ if (r.length === 0) return a.getBoundingClientRect().width;
55
+ const n = a.querySelectorAll("[data-header-value]");
56
56
  let t = 0, l = 0;
57
- for (const o of d) {
58
- const c = ((n = o.parentElement) == null ? void 0 : n.querySelector(":scope > [data-header-value]")) ?? r[l], f = (s = o.parentElement) == null ? void 0 : s.querySelector(":scope > [data-header-freshness] > *");
57
+ for (const o of r) {
58
+ const c = ((d = o.parentElement) == null ? void 0 : d.querySelector(":scope > [data-header-value]")) ?? n[l], f = (s = o.parentElement) == null ? void 0 : s.querySelector(":scope > [data-header-freshness] > *");
59
59
  t += o.scrollWidth + ((c == null ? void 0 : c.scrollWidth) ?? 0) + 8 + 28 + (f ? 20 : 0), l++;
60
60
  }
61
61
  return t;
62
62
  }
63
- function Z(a) {
64
- const d = (r) => r.empty ? 2 : r.money ? 0 : 1;
65
- return [...a].sort((r, t) => d(r) - d(t) || r.index - t.index);
63
+ function ee(a) {
64
+ const r = (n) => n.empty ? 2 : n.money ? 0 : 1;
65
+ return [...a].sort((n, t) => r(n) - r(t) || n.index - t.index);
66
66
  }
67
- const W = "__more__";
68
- function B(a, d, r, t, l) {
69
- const n = [], s = (h, _) => n[h] === d || _ <= n[h] + 0.5, o = (h) => {
70
- let _ = l ? n.findIndex((g, E) => s(E, h)) : n.length - 1;
71
- return (_ < 0 || !s(_, h)) && (n.push(d), _ = n.length - 1), n[_] -= h, _;
72
- }, c = a.map((h) => h == null ? -1 : o(h)), f = a.some((h) => h == null) ? o(r) : -1;
73
- return n.length === 0 && n.push(d), t > 0 && !s(n.length - 1, t) && n.push(d - t), { count: n.length, rowOf: c, chipRow: f };
67
+ const B = "__more__";
68
+ function W(a, r, n, t, l) {
69
+ const d = [], s = (i, _) => d[i] === r || _ <= d[i] + 0.5, o = (i) => {
70
+ let _ = l ? d.findIndex((g, E) => s(E, i)) : d.length - 1;
71
+ return (_ < 0 || !s(_, i)) && (d.push(r), _ = d.length - 1), d[_] -= i, _;
72
+ }, c = a.map((i) => i == null ? -1 : o(i)), f = a.some((i) => i == null) ? o(n) : -1;
73
+ return d.length === 0 && d.push(r), t > 0 && !s(d.length - 1, t) && d.push(r - t), { count: d.length, rowOf: c, chipRow: f };
74
74
  }
75
75
  function I(a) {
76
76
  if (a.matches('[data-empty="true"]') || a.querySelector('[data-empty="true"]')) return !0;
77
- const d = a.querySelectorAll("[data-header-value]");
78
- return d.length > 0 && Array.from(d).every((r) => {
77
+ const r = a.querySelectorAll("[data-header-value]");
78
+ return r.length > 0 && Array.from(r).every((n) => {
79
79
  var t;
80
- return ((t = r.textContent) == null ? void 0 : t.trim()) === "—";
80
+ return ((t = n.textContent) == null ? void 0 : t.trim()) === "—";
81
81
  });
82
82
  }
83
- function ee(a, d, r) {
84
- const t = Array.from(a.children), l = t.find((e) => e.hasAttribute("data-header-more")), n = t.find((e) => e.hasAttribute("data-header-tail")), s = b(a);
83
+ function te(a, r, n) {
84
+ const t = Array.from(a.children), l = t.find((e) => e.hasAttribute("data-header-more")), d = t.find((e) => e.hasAttribute("data-header-tail")), s = b(a);
85
85
  if (s.length === 0) return { folded: [], rows: null };
86
- const o = R(s), c = s.map((e, i) => {
87
- const u = o[i];
88
- if (d && !e.hasAttribute("data-header-folded")) {
86
+ const o = R(s), c = s.map((e, h) => {
87
+ const u = o[h];
88
+ if (r && !e.hasAttribute("data-header-folded")) {
89
89
  const m = e.getBoundingClientRect().width;
90
- m > 0 && r.set(u, m);
90
+ m > 0 && n.set(u, m);
91
91
  }
92
- return r.get(u) ?? q(e);
93
- }), f = a.clientWidth, h = l ? l.getBoundingClientRect().width : 96, _ = (n == null ? void 0 : n.getBoundingClientRect().width) ?? 0, g = (e, i) => B(
92
+ return n.get(u) ?? q(e);
93
+ }), f = a.clientWidth, i = l ? l.getBoundingClientRect().width : 96, _ = (d == null ? void 0 : d.getBoundingClientRect().width) ?? 0, g = (e, h) => W(
94
94
  c.map((u, m) => e.has(m) ? null : u),
95
95
  f,
96
- h,
96
+ i,
97
97
  _,
98
- i
98
+ h
99
99
  ), E = s.map(I), A = s.map(
100
100
  (e) => e.hasAttribute("data-header-money") || e.querySelector("[data-header-money]") != null
101
- ), k = s.map((e) => e.hasAttribute("data-header-pin")), D = (e) => [...e].sort((i, u) => i - u).map((i) => {
101
+ ), k = s.map((e) => e.hasAttribute("data-header-pin")), D = (e) => [...e].sort((h, u) => h - u).map((h) => {
102
102
  var u, m;
103
103
  return {
104
- index: i,
105
- key: o[i],
106
- empty: E[i],
107
- money: A[i],
108
- label: ((m = (u = s[i].querySelector("[data-header-label]")) == null ? void 0 : u.textContent) == null ? void 0 : m.trim()) ?? ""
104
+ index: h,
105
+ key: o[h],
106
+ empty: E[h],
107
+ money: A[h],
108
+ label: ((m = (u = s[h].querySelector("[data-header-label]")) == null ? void 0 : u.textContent) == null ? void 0 : m.trim()) ?? ""
109
109
  };
110
- }), p = new Set(c.flatMap((e, i) => !k[i] && e > f + 0.5 ? [i] : []));
110
+ }), p = new Set(c.flatMap((e, h) => !k[h] && e > f + 0.5 ? [h] : []));
111
111
  if (g(p, !1).count <= S) return { folded: D(p), rows: null };
112
- const y = (e) => s.map((i, u) => u).filter((i) => !k[i] && e(i)).reverse(), C = [
112
+ const y = (e) => s.map((h, u) => u).filter((h) => !k[h] && e(h)).reverse(), C = [
113
113
  ...y((e) => E[e]),
114
114
  ...y((e) => !E[e] && !A[e]),
115
115
  ...y((e) => !E[e] && A[e])
@@ -120,37 +120,38 @@ function ee(a, d, r) {
120
120
  p.has(e) || (p.add(e), x = g(p, !0));
121
121
  }
122
122
  const w = {};
123
- return x.rowOf.forEach((e, i) => {
124
- e >= 0 && (w[String(o[i])] = e);
125
- }), x.chipRow >= 0 && (w[W] = x.chipRow), { folded: D(p), rows: w };
123
+ return x.rowOf.forEach((e, h) => {
124
+ e >= 0 && (w[String(o[h])] = e);
125
+ }), x.chipRow >= 0 && (w[B] = x.chipRow), { folded: D(p), rows: w };
126
126
  }
127
127
  export {
128
128
  K as HEADER_BAND,
129
- L as HEADER_CELL_DENSE,
129
+ H as HEADER_CELL_DENSE,
130
130
  O as HEADER_CELL_FOLDED,
131
- H as HEADER_CELL_LIST,
131
+ L as HEADER_CELL_LIST,
132
+ X as HEADER_COPY_BESIDE_MARK,
132
133
  j as HEADER_DOCK,
133
134
  P as HEADER_DOCK_CELL,
134
135
  F as HEADER_DOCK_INLINE,
135
136
  T as HEADER_LABEL,
136
- X as HEADER_MARK,
137
+ Y as HEADER_MARK,
137
138
  S as HEADER_MAX_ROWS,
138
- W as HEADER_MORE_ROW_KEY,
139
+ B as HEADER_MORE_ROW_KEY,
139
140
  M as HEADER_ROW,
140
- z as HEADER_SUB,
141
+ G as HEADER_SUB,
141
142
  U as HEADER_TILE,
142
143
  N as HEADER_TILES,
143
144
  V as HEADER_VALUE,
144
- Y as HEADER_VALUE_AFTER_MARK,
145
+ z as HEADER_VALUE_AFTER_MARK,
145
146
  $ as HEADER_VALUE_HERO,
146
- G as HEADER_VALUE_LINE,
147
- Z as foldedListOrder,
147
+ J as HEADER_VALUE_LINE,
148
+ ee as foldedListOrder,
148
149
  I as headerCellIsEmpty,
149
150
  R as headerCellKeys,
150
151
  b as headerCells,
151
- J as headerChangedCells,
152
+ Q as headerChangedCells,
152
153
  q as headerEstimateDenseWidth,
153
- ee as headerFoldPlan,
154
- Q as headerNeedsDense,
155
- B as headerPackRows
154
+ te as headerFoldPlan,
155
+ Z as headerNeedsDense,
156
+ W as headerPackRows
156
157
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.120",
3
+ "version": "0.3.121",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",