@declarion/react 0.81.0 → 0.82.0

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 (28) hide show
  1. package/dist-lib/components/actions/ObjectActionBar.js +56 -54
  2. package/dist-lib/components/actions/PropertyGridEditor.js +56 -53
  3. package/dist-lib/components/actions/RowActionsKebab.js +51 -49
  4. package/dist-lib/components/detail-layout/AssociatedBlock.js +385 -383
  5. package/dist-lib/components/list/QuickPeek.js +77 -75
  6. package/dist-lib/components/pages/SmartDetailPage.impl.js +484 -458
  7. package/dist-lib/components/pages/SmartRecordListPage.impl.js +207 -206
  8. package/dist-lib/components/pages/list/DataCell.js +15 -15
  9. package/dist-lib/components/pages/list/ListFloatbar.js +55 -53
  10. package/dist-lib/components/pages/list/ListHeader.js +54 -52
  11. package/dist-lib/components/pages/list/ListTable.js +64 -64
  12. package/dist-lib/components/pages/list/cardProjection.js +85 -80
  13. package/dist-lib/components/pages/list/column-sizing.js +11 -1
  14. package/dist-lib/components/pages/list/use-filter-value-labels.js +29 -78
  15. package/dist-lib/components/pages/list/useListRowInteraction.js +78 -76
  16. package/dist-lib/components/pages/list/useRowMenu.js +60 -58
  17. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +341 -262
  18. package/dist-lib/components/params/ParamsBlock.js +59 -59
  19. package/dist-lib/components/params/param-editors.js +114 -99
  20. package/dist-lib/components/shared/ConfirmDialog.js +33 -66
  21. package/dist-lib/components/shared/ModalFrame.js +53 -0
  22. package/dist-lib/hooks/useRefRecords.js +73 -0
  23. package/dist-lib/hooks/useRowTenant.js +12 -0
  24. package/dist-lib/index.d.ts +4 -3
  25. package/dist-lib/lib/actions.js +105 -89
  26. package/dist-lib/lib/mass-edit.js +13 -13
  27. package/dist-lib/types/schema.js +29 -22
  28. package/package.json +1 -1
@@ -1,108 +1,108 @@
1
1
  import { Icon as e } from "../primitives/Icons.js";
2
2
  import { Btn as t } from "../primitives/Btn.js";
3
- import { IconBtn as n } from "../primitives/IconBtn.js";
4
- import { Pill as r } from "../primitives/Pill.js";
5
- import { useText as i } from "../../hooks/useText.js";
6
- import { SectionCard as a } from "../primitives/SectionCard.js";
7
- import { Spinner as o } from "../primitives/Spinner.js";
8
- import { useAllParams as s, useCarrierParamOverrides as c } from "../../hooks/useParams.js";
9
- import { EditParamDialog as l, ErrorLine as u, ValuePreview as d, paramSourceName as f } from "./param-editors.js";
10
- import { useMemo as p, useState as m } from "react";
11
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
3
+ import { Pill as n } from "../primitives/Pill.js";
4
+ import { useText as r } from "../../hooks/useText.js";
5
+ import { SectionCard as i } from "../primitives/SectionCard.js";
6
+ import { Spinner as a } from "../primitives/Spinner.js";
7
+ import { useAllParams as o, useCarrierParamOverrides as s } from "../../hooks/useParams.js";
8
+ import { EditParamDialog as c, ErrorLine as l, ResetParamControl as u, ValuePreview as d, paramSourceName as f, useParamRefLabels as p } from "./param-editors.js";
9
+ import { useMemo as m, useState as h } from "react";
10
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
12
11
  //#region src/components/params/ParamsBlock.tsx
13
- function _(e) {
12
+ function v(e) {
14
13
  return e === "tenant" || e === "role" || e === "user" ? e : "object";
15
14
  }
16
- function v(e, t) {
15
+ function y(e, t) {
17
16
  return e ? e.filter((e) => e.scopes?.includes(t)) : [];
18
17
  }
19
- function y({ carrierEntityCode: y, carrierScope: b, rowId: x, title: S, icon: C }) {
20
- let w = i(), T = i("errors"), E = s(), D = p(() => v(E.data, b), [E.data, b]), [O, k] = m(null), { overrideByCode: A, missingParams: j, isLoading: M, error: N, clearError: P, save: F, reset: I } = c({
21
- carrierEntityCode: y,
22
- rowId: x,
23
- enabled: D.length > 0
24
- }), L = async (e, t) => {
25
- await F(e, t) && k((t) => t === e ? null : t);
18
+ function b({ carrierEntityCode: b, carrierScope: x, rowId: S, title: C, icon: w }) {
19
+ let T = r(), E = r("errors"), D = o(), O = m(() => y(D.data, x), [D.data, x]), [k, A] = h(null), j = p(O), { overrideByCode: M, missingParams: N, isLoading: P, error: F, clearError: I, save: L, reset: R } = s({
20
+ carrierEntityCode: b,
21
+ rowId: S,
22
+ enabled: O.length > 0
23
+ }), z = async (e, t) => {
24
+ await L(e, t) && A((t) => t === e ? null : t);
26
25
  };
27
- return D.length === 0 ? null : /* @__PURE__ */ g(a, {
28
- title: S ?? w("params.title", "Parameters"),
29
- icon: C ?? /* @__PURE__ */ h(e.settings, { size: 14 }),
30
- children: [j ? /* @__PURE__ */ h(u, { text: T("param.overrides_unreadable", "The current parameter overrides could not be read.") }) : M ? /* @__PURE__ */ h("div", {
26
+ return O.length === 0 ? null : /* @__PURE__ */ _(i, {
27
+ title: C ?? T("params.title", "Parameters"),
28
+ icon: w ?? /* @__PURE__ */ g(e.settings, { size: 14 }),
29
+ children: [N ? /* @__PURE__ */ g(l, { text: E("param.overrides_unreadable", "The current parameter overrides could not be read.") }) : P ? /* @__PURE__ */ g("div", {
31
30
  style: { padding: "8px 0" },
32
- children: /* @__PURE__ */ h(o, { size: 16 })
33
- }) : /* @__PURE__ */ g("div", {
31
+ children: /* @__PURE__ */ g(a, { size: 16 })
32
+ }) : /* @__PURE__ */ _("div", {
34
33
  style: {
35
34
  display: "flex",
36
35
  flexDirection: "column",
37
36
  gap: 10
38
37
  },
39
- children: [N && !O && /* @__PURE__ */ h(u, { text: N }), D.map((i) => {
40
- let a = A.get(i.code), o = a !== void 0, s = o && i.source === _(b);
41
- return /* @__PURE__ */ g("div", {
42
- "data-testid": `param-row-${i.code}`,
38
+ children: [F && !k && /* @__PURE__ */ g(l, { text: F }), O.map((r) => {
39
+ let i = M.get(r.code), a = i !== void 0, o = a && r.source === v(x);
40
+ return /* @__PURE__ */ _("div", {
41
+ "data-testid": `param-row-${r.code}`,
43
42
  style: {
44
43
  display: "flex",
45
44
  alignItems: "center",
46
45
  gap: 10
47
46
  },
48
47
  children: [
49
- /* @__PURE__ */ h("div", {
48
+ /* @__PURE__ */ g("div", {
50
49
  style: {
51
50
  flex: 1,
52
51
  minWidth: 0,
53
52
  fontSize: 12.5,
54
53
  fontWeight: 500
55
54
  },
56
- children: w(i.name) || i.code
55
+ children: T(r.name) || r.code
57
56
  }),
58
- /* @__PURE__ */ h(d, {
59
- type: i.type,
60
- value: i.value,
61
- values: i.values
57
+ /* @__PURE__ */ g(d, {
58
+ type: r.type,
59
+ value: r.value,
60
+ values: r.values,
61
+ label: j(r)
62
62
  }),
63
- s && /* @__PURE__ */ h(r, {
63
+ o && /* @__PURE__ */ g(n, {
64
64
  tone: "violet",
65
65
  size: "xs",
66
- children: w("params.overridden", "overridden")
66
+ children: T("params.overridden", "overridden")
67
67
  }),
68
- o && !s && /* @__PURE__ */ h("span", {
69
- "data-testid": `param-not-applied-${i.code}`,
70
- title: w("params.block.not_applied_hint", "You set {value}, and it no longer satisfies this parameter's declaration. Source of the value in effect: {source}. Reset to remove what you set, or edit it to a value the declaration accepts.", {
71
- value: JSON.stringify(a.value),
72
- source: f(w, i.source)
68
+ a && !o && /* @__PURE__ */ g("span", {
69
+ "data-testid": `param-not-applied-${r.code}`,
70
+ title: T("params.block.not_applied_hint", "You set {value}, and it no longer satisfies this parameter's declaration. Source of the value in effect: {source}. Reset to remove what you set, or edit it to a value the declaration accepts.", {
71
+ value: JSON.stringify(i.value),
72
+ source: f(T, r.source)
73
73
  }),
74
- children: /* @__PURE__ */ h(r, {
74
+ children: /* @__PURE__ */ g(n, {
75
75
  tone: "amber",
76
76
  size: "xs",
77
- children: w("params.not_applied", "not applied")
77
+ children: T("params.not_applied", "not applied")
78
78
  })
79
79
  }),
80
- /* @__PURE__ */ h(t, {
80
+ /* @__PURE__ */ g(t, {
81
81
  size: "xs",
82
- icon: /* @__PURE__ */ h(e.edit, { size: 12 }),
82
+ icon: /* @__PURE__ */ g(e.edit, { size: 12 }),
83
83
  onClick: () => {
84
- P(), k(i);
84
+ I(), A(r);
85
85
  },
86
- children: w("params.edit", "Edit")
86
+ children: T("params.edit", "Edit")
87
87
  }),
88
- o && /* @__PURE__ */ h(n, {
89
- icon: /* @__PURE__ */ h(e.refresh, { size: 13 }),
90
- title: w("params.reset", "Reset to default"),
91
- onClick: () => I(i)
88
+ a && /* @__PURE__ */ g(u, {
89
+ param: r,
90
+ description: T("params.reset_confirm.block_description", "The value set here is removed, and the value it inherits applies again."),
91
+ onReset: (e) => void R(e)
92
92
  })
93
93
  ]
94
- }, i.code);
94
+ }, r.code);
95
95
  })]
96
- }), O && /* @__PURE__ */ h(l, {
97
- param: O,
98
- current: A.get(O.code)?.value ?? O.value,
99
- error: N,
96
+ }), k && /* @__PURE__ */ g(c, {
97
+ param: k,
98
+ current: M.get(k.code)?.value ?? k.value,
99
+ error: F,
100
100
  onCancel: () => {
101
- k(null), P();
101
+ A(null), I();
102
102
  },
103
- onSave: (e) => L(O, e)
103
+ onSave: (e) => z(k, e)
104
104
  })]
105
105
  });
106
106
  }
107
107
  //#endregion
108
- export { y as ParamsBlock };
108
+ export { b as ParamsBlock };
@@ -1,15 +1,19 @@
1
1
  import { coerceDisplayString as e } from "../../lib/display-value.js";
2
- import { pluralText as t } from "../../lib/language.js";
3
- import { Icon as n } from "../primitives/Icons.js";
4
- import { Btn as r } from "../primitives/Btn.js";
5
- import { useText as i } from "../../hooks/useText.js";
6
- import { Spinner as a } from "../primitives/Spinner.js";
7
- import { FieldLabel as o } from "../primitives/Fields.js";
8
- import { renderField as s } from "../fields/index.js";
9
- import { useState as c } from "react";
10
- import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
2
+ import { useSchema as t } from "../../hooks/useSchema.js";
3
+ import { pluralText as n } from "../../lib/language.js";
4
+ import { Icon as r } from "../primitives/Icons.js";
5
+ import { Btn as i } from "../primitives/Btn.js";
6
+ import { useText as a } from "../../hooks/useText.js";
7
+ import { Spinner as o } from "../primitives/Spinner.js";
8
+ import { FieldLabel as s } from "../primitives/Fields.js";
9
+ import { ModalFrame as c } from "../shared/ModalFrame.js";
10
+ import { ConfirmDialog as l } from "../shared/ConfirmDialog.js";
11
+ import { renderField as u } from "../fields/index.js";
12
+ import { refLabel as d, useRefRecords as f } from "../../hooks/useRefRecords.js";
13
+ import { useState as p } from "react";
14
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
11
15
  //#region src/components/params/param-editors.tsx
12
- var f = {
16
+ var _ = {
13
17
  object: ["params.source.object", "Record"],
14
18
  user: ["params.source.user", "User"],
15
19
  role: ["params.source.role", "Role"],
@@ -18,12 +22,29 @@ var f = {
18
22
  yaml: ["params.source.yaml", "Default"],
19
23
  none: ["params.source.none", "Not set"]
20
24
  };
21
- function p(e, t) {
22
- let n = f[t];
25
+ function v(e, t) {
26
+ let n = _[t];
23
27
  return n ? e(n[0], n[1]) : t;
24
28
  }
25
- function m({ text: e }) {
26
- return /* @__PURE__ */ d("div", {
29
+ var y = r["undo-2"];
30
+ function b({ param: e, description: t, onReset: n }) {
31
+ let r = a(), [o, s] = p(!1);
32
+ return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(i, {
33
+ size: "xs",
34
+ icon: /* @__PURE__ */ h(y, { size: 12 }),
35
+ onClick: () => s(!0),
36
+ children: r("params.reset", "Reset to default")
37
+ }), /* @__PURE__ */ h(l, {
38
+ open: o,
39
+ onOpenChange: s,
40
+ title: r("params.reset_confirm.title", "Reset {name} to default?", { name: r(e.name) || e.code }),
41
+ description: t,
42
+ confirmLabel: r("params.reset", "Reset to default"),
43
+ onConfirm: () => n(e)
44
+ })] });
45
+ }
46
+ function x({ text: e }) {
47
+ return /* @__PURE__ */ g("div", {
27
48
  style: {
28
49
  padding: "8px 10px",
29
50
  background: "var(--danger-soft)",
@@ -33,153 +54,147 @@ function m({ text: e }) {
33
54
  display: "flex",
34
55
  gap: 6
35
56
  },
36
- children: [/* @__PURE__ */ u(n.info, { size: 13 }), /* @__PURE__ */ u("span", { children: e })]
57
+ children: [/* @__PURE__ */ h(r.info, { size: 13 }), /* @__PURE__ */ h("span", { children: e })]
37
58
  });
38
59
  }
39
- function h({ type: n, value: r, values: a }) {
40
- let o = i(), s = (t) => {
41
- let n = a?.find((e) => e.code === t);
42
- return n && o(n.name) || e(t);
43
- }, c;
44
- if (r == null) c = "—";
45
- else if (a && a.length > 0) c = (Array.isArray(r) ? r.map(s).join(", ") : s(r)) || "—";
46
- else if (n === "bool") c = r ? o("params.value.on", "On") : o("params.value.off", "Off");
47
- else if (n === "multilang" || n === "multilang_text") c = o(r) || "—";
48
- else if (n === "multilang_array" && Array.isArray(r)) c = r.map((e) => o(e)).join(", ") || "—";
49
- else if (n === "json" || n === "structure") {
60
+ function S(e) {
61
+ let n = a(), { data: r } = t(), i = e.flatMap((e) => e.ref?.entity && e.value != null && e.value !== "" ? [{
62
+ ref: e.ref,
63
+ value: e.value
64
+ }] : []), { refs: o } = f(i, void 0, r?.entities);
65
+ return (e) => e.ref?.entity ? d(n, o, e.ref, e.value, r?.entities) : void 0;
66
+ }
67
+ function C({ type: t, value: r, values: i, label: o, maxWidth: s = 180 }) {
68
+ let c = a(), l = (t) => {
69
+ let n = i?.find((e) => e.code === t);
70
+ return n && c(n.name) || e(t);
71
+ }, u;
72
+ if (o !== void 0) u = o;
73
+ else if (r == null) u = "—";
74
+ else if (i && i.length > 0) u = (Array.isArray(r) ? r.map(l).join(", ") : l(r)) || "—";
75
+ else if (t === "bool") u = r ? c("params.value.on", "On") : c("params.value.off", "Off");
76
+ else if (t === "multilang" || t === "multilang_text") u = c(r) || "—";
77
+ else if (t === "multilang_array" && Array.isArray(r)) u = r.map((e) => c(e)).join(", ") || "—";
78
+ else if (t === "json" || t === "structure") {
50
79
  if (r && typeof r == "object") {
51
80
  let e = Array.isArray(r) ? r.length : Object.keys(r).length;
52
- c = `{${t(o, "params.value.keys", e, {
81
+ u = `{${n(c, "params.value.keys", e, {
53
82
  one: "{count} key",
54
83
  other: "{count} keys"
55
84
  })}}`;
56
- } else c = e(r);
57
- } else c = e(r);
58
- return /* @__PURE__ */ u("span", {
85
+ } else u = e(r);
86
+ } else u = e(r);
87
+ return /* @__PURE__ */ h("span", {
59
88
  className: "mono",
89
+ title: u,
60
90
  style: {
91
+ display: "inline-block",
92
+ verticalAlign: "middle",
61
93
  fontSize: 11.5,
62
94
  color: "var(--text-2)",
63
- maxWidth: 180,
95
+ maxWidth: s,
64
96
  overflow: "hidden",
65
97
  textOverflow: "ellipsis",
66
98
  whiteSpace: "nowrap"
67
99
  },
68
- children: c
100
+ children: u
69
101
  });
70
102
  }
71
- function g({ param: e, current: t, error: s, onCancel: f, onSave: p }) {
72
- let h = i(), [g, b] = c(() => v(e, t)), [x, S] = c(!1), [C, w] = c(null);
73
- async function T() {
74
- w(null);
103
+ function w({ param: e, current: t, error: n, onCancel: l, onSave: u }) {
104
+ let d = a(), [f, m] = p(() => E(e, t)), [_, v] = p(!1), [y, b] = p(null);
105
+ async function S() {
106
+ b(null);
75
107
  let e;
76
108
  try {
77
- e = y(h, g);
109
+ e = D(d, f);
78
110
  } catch (e) {
79
- w(String(e instanceof Error ? e.message : e));
111
+ b(String(e instanceof Error ? e.message : e));
80
112
  return;
81
113
  }
82
- S(!0);
114
+ v(!0);
83
115
  try {
84
- await p(e);
116
+ await u(e);
85
117
  } finally {
86
- S(!1);
118
+ v(!1);
87
119
  }
88
120
  }
89
- return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
90
- onClick: f,
91
- style: {
92
- position: "fixed",
93
- inset: 0,
94
- background: "var(--scrim)",
95
- zIndex: 60
96
- }
97
- }), /* @__PURE__ */ d("div", {
98
- "data-testid": "param-edit-dialog",
99
- style: {
100
- position: "fixed",
101
- top: "50%",
102
- left: "50%",
103
- transform: "translate(-50%, -50%)",
104
- zIndex: 61,
105
- width: 440,
106
- maxWidth: "calc(100vw - 24px)",
107
- background: "var(--surface)",
108
- borderRadius: "var(--radius-lg)",
109
- boxShadow: "var(--shadow-lg)",
110
- border: "1px solid var(--border)",
111
- overflow: "hidden"
112
- },
121
+ return /* @__PURE__ */ g(c, {
122
+ label: d(e.name) || e.code,
123
+ maxWidth: 440,
124
+ onClose: l,
125
+ testId: "param-edit-dialog",
113
126
  children: [
114
- /* @__PURE__ */ d("div", {
127
+ /* @__PURE__ */ g("div", {
115
128
  style: { padding: "14px 18px 0" },
116
- children: [/* @__PURE__ */ u("div", {
129
+ children: [/* @__PURE__ */ h("div", {
117
130
  style: {
118
131
  fontSize: 14,
119
132
  fontWeight: 600
120
133
  },
121
- children: h(e.name) || e.code
122
- }), e.description && /* @__PURE__ */ u("div", {
134
+ children: d(e.name) || e.code
135
+ }), e.description && /* @__PURE__ */ h("div", {
123
136
  style: {
124
137
  fontSize: 11.5,
125
138
  color: "var(--text-3)",
126
139
  marginTop: 2
127
140
  },
128
- children: h(e.description)
141
+ children: d(e.description)
129
142
  })]
130
143
  }),
131
- /* @__PURE__ */ d("div", {
144
+ /* @__PURE__ */ g("div", {
132
145
  style: {
133
146
  padding: "12px 18px 16px",
134
147
  display: "flex",
135
148
  flexDirection: "column",
136
- gap: 10
149
+ gap: 10,
150
+ overflowY: "auto"
137
151
  },
138
152
  children: [
139
- /* @__PURE__ */ u(o, { children: h("params.value", "Value") }),
140
- /* @__PURE__ */ u(_, {
153
+ /* @__PURE__ */ h(s, { children: d("params.value", "Value") }),
154
+ /* @__PURE__ */ h(T, {
141
155
  param: e,
142
- value: g,
143
- onChange: b
156
+ value: f,
157
+ onChange: m
144
158
  }),
145
- (C || s) && /* @__PURE__ */ u(m, { text: C || s })
159
+ (y || n) && /* @__PURE__ */ h(x, { text: y || n })
146
160
  ]
147
161
  }),
148
- /* @__PURE__ */ d("div", {
162
+ /* @__PURE__ */ g("div", {
149
163
  style: {
150
164
  padding: "10px 16px",
151
165
  borderTop: "1px solid var(--divider)",
152
166
  display: "flex",
153
167
  gap: 8,
154
- background: "var(--surface-2)"
168
+ background: "var(--surface-2)",
169
+ flexShrink: 0
155
170
  },
156
171
  children: [
157
- /* @__PURE__ */ u("div", { style: { flex: 1 } }),
158
- /* @__PURE__ */ u(r, {
159
- onClick: f,
160
- children: h("dialog.cancel", "Cancel")
172
+ /* @__PURE__ */ h("div", { style: { flex: 1 } }),
173
+ /* @__PURE__ */ h(i, {
174
+ onClick: l,
175
+ children: d("dialog.cancel", "Cancel")
161
176
  }),
162
- /* @__PURE__ */ u(r, {
177
+ /* @__PURE__ */ h(i, {
163
178
  kind: "primary",
164
- icon: u(x ? a : n.check, { size: 13 }),
165
- onClick: T,
166
- disabled: x,
167
- children: x ? h("dialog.saving", "Saving…") : h("dialog.save", "Save")
179
+ icon: h(_ ? o : r.check, { size: 13 }),
180
+ onClick: S,
181
+ disabled: _,
182
+ children: _ ? d("dialog.saving", "Saving…") : d("dialog.save", "Save")
168
183
  })
169
184
  ]
170
185
  })
171
186
  ]
172
- })] });
187
+ });
173
188
  }
174
- function _({ param: e, value: t, onChange: n }) {
175
- let r = i(), a = {
189
+ function T({ param: e, value: t, onChange: n }) {
190
+ let r = a(), i = {
176
191
  type: e.type,
177
192
  structure: e.structure,
178
193
  values: e.values,
179
194
  ref: e.ref
180
195
  };
181
- return /* @__PURE__ */ u(l, { children: s({
182
- field: a,
196
+ return /* @__PURE__ */ h(m, { children: u({
197
+ field: i,
183
198
  fieldName: e.code,
184
199
  value: t,
185
200
  mode: "edit",
@@ -187,23 +202,23 @@ function _({ param: e, value: t, onChange: n }) {
187
202
  t: r
188
203
  }) });
189
204
  }
190
- function v(e, t) {
205
+ function E(e, t) {
191
206
  return e.type === "bool" ? t === !0 : e.type === "structure" ? t ?? {} : t ?? null;
192
207
  }
193
- function y(e, t) {
208
+ function D(e, t) {
194
209
  if (t == null) throw Error(e("params.value.required", "Enter a value."));
195
210
  return t;
196
211
  }
197
- var b = /* @__PURE__ */ new Set([
212
+ var O = /* @__PURE__ */ new Set([
198
213
  "server",
199
214
  "database",
200
215
  "auth",
201
216
  "sso",
202
217
  "seeder"
203
218
  ]);
204
- function x(e) {
219
+ function k(e) {
205
220
  let t = e.scopes ?? [];
206
- return t.length === 0 ? !b.has(e.category ?? "") : t.includes("tenant");
221
+ return t.length === 0 ? !O.has(e.category ?? "") : t.includes("tenant");
207
222
  }
208
223
  //#endregion
209
- export { g as EditParamDialog, m as ErrorLine, h as ValuePreview, p as paramSourceName, x as paramTenantEditable };
224
+ export { w as EditParamDialog, x as ErrorLine, b as ResetParamControl, C as ValuePreview, v as paramSourceName, k as paramTenantEditable, S as useParamRefLabels };
@@ -2,50 +2,16 @@ import { Icon as e } from "../primitives/Icons.js";
2
2
  import { Btn as t } from "../primitives/Btn.js";
3
3
  import { IconBtn as n } from "../primitives/IconBtn.js";
4
4
  import { useText as r } from "../../hooks/useText.js";
5
- import { useEffect as i, useRef as a } from "react";
6
- import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
5
+ import { ModalFrame as i } from "./ModalFrame.js";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  //#region src/components/shared/ConfirmDialog.tsx
8
- function l({ open: l, onOpenChange: u, title: d, description: f, confirmLabel: p, onConfirm: m, destructive: h = !1 }) {
9
- let g = r(), _ = a(null);
10
- return i(() => {
11
- l && _.current?.focus();
12
- }, [l]), l ? /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", {
13
- onClick: () => u(!1),
14
- style: {
15
- position: "fixed",
16
- inset: 0,
17
- background: "var(--scrim)",
18
- zIndex: 60,
19
- backdropFilter: "blur(2px)"
20
- }
21
- }), /* @__PURE__ */ c("div", {
22
- ref: _,
23
- role: "dialog",
24
- "aria-modal": "true",
25
- "aria-label": d,
26
- tabIndex: -1,
27
- onKeyDown: (e) => {
28
- e.key === "Escape" && u(!1);
29
- },
30
- style: {
31
- position: "fixed",
32
- top: "50%",
33
- left: "50%",
34
- transform: "translate(-50%, -50%)",
35
- zIndex: 61,
36
- width: "calc(100vw - 24px)",
37
- maxWidth: 460,
38
- maxHeight: "calc(var(--app-height) - var(--safe-area-top) - var(--safe-area-bottom) - 16px)",
39
- background: "var(--surface)",
40
- borderRadius: "var(--radius-lg)",
41
- boxShadow: "var(--shadow-lg)",
42
- border: "1px solid var(--border)",
43
- overflow: "hidden",
44
- display: "flex",
45
- flexDirection: "column",
46
- outline: "none"
47
- },
48
- children: [/* @__PURE__ */ c("div", {
8
+ function s({ open: s, onOpenChange: c, title: l, description: u, confirmLabel: d, onConfirm: f, destructive: p = !1 }) {
9
+ let m = r();
10
+ return s ? /* @__PURE__ */ o(i, {
11
+ label: l,
12
+ maxWidth: 460,
13
+ onClose: () => c(!1),
14
+ children: [/* @__PURE__ */ o("div", {
49
15
  style: {
50
16
  padding: "14px 18px",
51
17
  display: "flex",
@@ -55,47 +21,48 @@ function l({ open: l, onOpenChange: u, title: d, description: f, confirmLabel: p
55
21
  overflowY: "auto"
56
22
  },
57
23
  children: [
58
- /* @__PURE__ */ s("span", {
24
+ /* @__PURE__ */ a("span", {
59
25
  style: {
60
26
  width: 28,
61
27
  height: 28,
62
28
  borderRadius: "var(--radius-md)",
63
- background: h ? "var(--danger-soft)" : "var(--accent-soft)",
64
- color: h ? "var(--danger)" : "var(--accent)",
29
+ background: p ? "var(--danger-soft)" : "var(--accent-soft)",
30
+ color: p ? "var(--danger)" : "var(--accent)",
65
31
  display: "inline-flex",
66
32
  alignItems: "center",
67
33
  justifyContent: "center",
68
34
  flexShrink: 0
69
35
  },
70
- children: s(h ? e.trash : e.info, { size: 15 })
36
+ children: a(p ? e.trash : e.info, { size: 15 })
71
37
  }),
72
- /* @__PURE__ */ c("div", {
38
+ /* @__PURE__ */ o("div", {
73
39
  style: {
74
40
  flex: 1,
75
41
  minWidth: 0
76
42
  },
77
- children: [/* @__PURE__ */ s("div", {
43
+ children: [/* @__PURE__ */ a("div", {
78
44
  style: {
79
45
  fontSize: 14,
80
46
  fontWeight: 600,
81
47
  color: "var(--text)"
82
48
  },
83
- children: d
84
- }), /* @__PURE__ */ s("div", {
49
+ children: l
50
+ }), /* @__PURE__ */ a("div", {
85
51
  style: {
86
52
  fontSize: 11.5,
87
53
  color: "var(--text-3)",
88
54
  marginTop: 2
89
55
  },
90
- children: f
56
+ children: u
91
57
  })]
92
58
  }),
93
- /* @__PURE__ */ s(n, {
94
- icon: /* @__PURE__ */ s(e.x, { size: 14 }),
95
- onClick: () => u(!1)
59
+ /* @__PURE__ */ a(n, {
60
+ icon: /* @__PURE__ */ a(e.x, { size: 14 }),
61
+ title: m("dialog.close", "Close"),
62
+ onClick: () => c(!1)
96
63
  })
97
64
  ]
98
- }), /* @__PURE__ */ c("div", {
65
+ }), /* @__PURE__ */ o("div", {
99
66
  style: {
100
67
  padding: "10px 16px",
101
68
  borderTop: "1px solid var(--divider)",
@@ -108,22 +75,22 @@ function l({ open: l, onOpenChange: u, title: d, description: f, confirmLabel: p
108
75
  flexShrink: 0
109
76
  },
110
77
  children: [
111
- /* @__PURE__ */ s("div", { style: { flex: 1 } }),
112
- /* @__PURE__ */ s(t, {
113
- onClick: () => u(!1),
114
- children: g("dialog.cancel", "Cancel")
78
+ /* @__PURE__ */ a("div", { style: { flex: 1 } }),
79
+ /* @__PURE__ */ a(t, {
80
+ onClick: () => c(!1),
81
+ children: m("dialog.cancel", "Cancel")
115
82
  }),
116
- /* @__PURE__ */ s(t, {
83
+ /* @__PURE__ */ a(t, {
117
84
  kind: "primary",
118
- danger: h,
85
+ danger: p,
119
86
  onClick: () => {
120
- m(), u(!1);
87
+ f(), c(!1);
121
88
  },
122
- children: p ?? g("dialog.confirm", "Confirm")
89
+ children: d ?? m("dialog.confirm", "Confirm")
123
90
  })
124
91
  ]
125
92
  })]
126
- })] }) : null;
93
+ }) : null;
127
94
  }
128
95
  //#endregion
129
- export { l as ConfirmDialog };
96
+ export { s as ConfirmDialog };