@declarion/react 0.255.0 → 0.302.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.
- package/dist-lib/components/detail-layout/DetailHighlights.js +40 -40
- package/dist-lib/components/detail-layout/useQuickAdd.js +45 -47
- package/dist-lib/components/fields/EnumField.js +25 -25
- package/dist-lib/components/fields/cells/factories/badge.js +14 -27
- package/dist-lib/components/fields/cells/factories/statusPill.js +13 -26
- package/dist-lib/components/fields/cells/factories/tagList.js +13 -26
- package/dist-lib/components/pages/SmartDetailPage.impl.js +416 -415
- package/dist-lib/components/pages/auth/AuthShell.js +57 -76
- package/dist-lib/components/pages/list/ListCardRow.js +66 -66
- package/dist-lib/components/pages/list/columns.js +89 -89
- package/dist-lib/components/pages/profile/Profile.impl.js +130 -126
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +107 -109
- package/dist-lib/components/params/ParamsBlock.js +42 -37
- package/dist-lib/components/params/param-editors.js +20 -33
- package/dist-lib/components/primitives/Pill.js +36 -15
- package/dist-lib/components/shared/StatusGroupsDisplay.js +49 -49
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useDeclaredEnum.js +38 -0
- package/dist-lib/index.d.ts +34 -12
- package/dist-lib/index.js +123 -122
- package/dist-lib/lib/evidence-verdict.js +6 -5
- package/dist-lib/lib/fill-from.js +15 -0
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/{useResponsiveMode-CgwjOaEE.d.ts → useResponsiveMode-CBSHZBY5.d.ts} +1 -0
- package/package.json +1 -1
|
@@ -13,25 +13,12 @@ import { RetryButton as f } from "../primitives/RetryButton.js";
|
|
|
13
13
|
import { useState as p } from "react";
|
|
14
14
|
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
15
15
|
// src/components/params/param-editors.tsx
|
|
16
|
-
var _ =
|
|
17
|
-
|
|
18
|
-
user: ["params.source.user", "User"],
|
|
19
|
-
role: ["params.source.role", "Role"],
|
|
20
|
-
tenant: ["params.source.tenant", "Tenant"],
|
|
21
|
-
env: ["params.source.env", "Environment"],
|
|
22
|
-
yaml: ["params.source.yaml", "Default"],
|
|
23
|
-
none: ["params.source.none", "Not set"]
|
|
24
|
-
};
|
|
25
|
-
function v(e, t) {
|
|
26
|
-
let n = _[t];
|
|
27
|
-
return n ? e(n[0], n[1]) : t;
|
|
28
|
-
}
|
|
29
|
-
var y = t["undo-2"];
|
|
30
|
-
function b({ param: t, description: n, onReset: r }) {
|
|
16
|
+
var _ = t["undo-2"];
|
|
17
|
+
function v({ param: t, description: n, onReset: r }) {
|
|
31
18
|
let a = d(), [o, s] = p(!1);
|
|
32
19
|
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(e, {
|
|
33
20
|
size: "xs",
|
|
34
|
-
icon: /* @__PURE__ */ h(
|
|
21
|
+
icon: /* @__PURE__ */ h(_, { size: 12 }),
|
|
35
22
|
onClick: () => s(!0),
|
|
36
23
|
children: a("params.reset", "Reset to default")
|
|
37
24
|
}), /* @__PURE__ */ h(i, {
|
|
@@ -43,7 +30,7 @@ function b({ param: t, description: n, onReset: r }) {
|
|
|
43
30
|
onConfirm: () => r(t)
|
|
44
31
|
})] });
|
|
45
32
|
}
|
|
46
|
-
function
|
|
33
|
+
function y({ text: e, onRetry: n }) {
|
|
47
34
|
return /* @__PURE__ */ g("div", {
|
|
48
35
|
style: {
|
|
49
36
|
padding: "8px 10px",
|
|
@@ -62,14 +49,14 @@ function x({ text: e, onRetry: n }) {
|
|
|
62
49
|
]
|
|
63
50
|
});
|
|
64
51
|
}
|
|
65
|
-
function
|
|
52
|
+
function b(e, t) {
|
|
66
53
|
let n = d(), { data: r } = c(), i = e.flatMap((e) => e.ref?.entity && e.value != null && e.value !== "" ? [{
|
|
67
54
|
ref: e.ref,
|
|
68
55
|
value: e.value
|
|
69
56
|
}] : []), { refs: a } = s(i, t, r?.entities);
|
|
70
57
|
return (e) => e.ref?.entity ? o(n, a, e.ref, e.value, r?.entities) : void 0;
|
|
71
58
|
}
|
|
72
|
-
function
|
|
59
|
+
function x({ type: e, value: t, values: n, structure: r, label: i, maxWidth: a = 180 }) {
|
|
73
60
|
let o = d(), { data: s } = c(), l = (e) => {
|
|
74
61
|
let t = n?.find((t) => t.code === e);
|
|
75
62
|
return t && o(t.name) || u(e);
|
|
@@ -93,15 +80,15 @@ function C({ type: e, value: t, values: n, structure: r, label: i, maxWidth: a =
|
|
|
93
80
|
children: p
|
|
94
81
|
});
|
|
95
82
|
}
|
|
96
|
-
function
|
|
97
|
-
let u = d(), [f, m] = p(() =>
|
|
83
|
+
function S({ param: i, current: o, error: s, onCancel: c, onSave: l }) {
|
|
84
|
+
let u = d(), [f, m] = p(() => w(i, o)), [_, v] = p(!1), [b, x] = p(null);
|
|
98
85
|
async function S() {
|
|
99
|
-
|
|
86
|
+
x(null);
|
|
100
87
|
let e;
|
|
101
88
|
try {
|
|
102
|
-
e =
|
|
89
|
+
e = T(u, f);
|
|
103
90
|
} catch (e) {
|
|
104
|
-
|
|
91
|
+
x(String(e instanceof Error ? e.message : e));
|
|
105
92
|
return;
|
|
106
93
|
}
|
|
107
94
|
v(!0);
|
|
@@ -144,12 +131,12 @@ function w({ param: i, current: o, error: s, onCancel: c, onSave: l }) {
|
|
|
144
131
|
},
|
|
145
132
|
children: [
|
|
146
133
|
/* @__PURE__ */ h(n, { children: u("params.value", "Value") }),
|
|
147
|
-
/* @__PURE__ */ h(
|
|
134
|
+
/* @__PURE__ */ h(C, {
|
|
148
135
|
param: i,
|
|
149
136
|
value: f,
|
|
150
137
|
onChange: m
|
|
151
138
|
}),
|
|
152
|
-
(
|
|
139
|
+
(b || s) && /* @__PURE__ */ h(y, { text: b || s })
|
|
153
140
|
]
|
|
154
141
|
}),
|
|
155
142
|
/* @__PURE__ */ g("div", {
|
|
@@ -179,7 +166,7 @@ function w({ param: i, current: o, error: s, onCancel: c, onSave: l }) {
|
|
|
179
166
|
]
|
|
180
167
|
});
|
|
181
168
|
}
|
|
182
|
-
function
|
|
169
|
+
function C({ param: e, value: t, onChange: n }) {
|
|
183
170
|
let r = d(), i = {
|
|
184
171
|
type: e.type,
|
|
185
172
|
structure: e.structure,
|
|
@@ -196,22 +183,22 @@ function T({ param: e, value: t, onChange: n }) {
|
|
|
196
183
|
t: r
|
|
197
184
|
}) });
|
|
198
185
|
}
|
|
199
|
-
function
|
|
186
|
+
function w(e, t) {
|
|
200
187
|
return e.type === "bool" ? t === !0 : e.type === "structure" ? t ?? (e.array ? [] : {}) : t ?? null;
|
|
201
188
|
}
|
|
202
|
-
function
|
|
189
|
+
function T(e, t) {
|
|
203
190
|
if (t == null) throw Error(e("params.value.required", "Enter a value."));
|
|
204
191
|
return t;
|
|
205
192
|
}
|
|
206
|
-
var
|
|
193
|
+
var E = /* @__PURE__ */ new Set([
|
|
207
194
|
"server",
|
|
208
195
|
"database",
|
|
209
196
|
"auth",
|
|
210
197
|
"sso",
|
|
211
198
|
"seeder"
|
|
212
199
|
]);
|
|
213
|
-
function
|
|
200
|
+
function D(e) {
|
|
214
201
|
let t = e.scopes ?? [];
|
|
215
|
-
return t.length === 0 ? !
|
|
202
|
+
return t.length === 0 ? !E.has(e.category ?? "") : t.includes("tenant");
|
|
216
203
|
}
|
|
217
|
-
export {
|
|
204
|
+
export { S as EditParamDialog, y as ErrorLine, v as ResetParamControl, x as ValuePreview, D as paramTenantEditable, b as useParamRefLabels };
|
|
@@ -1,41 +1,62 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
// src/components/primitives/Pill.tsx
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var n = [
|
|
4
|
+
"indigo",
|
|
5
|
+
"emerald",
|
|
6
|
+
"amber",
|
|
7
|
+
"rose",
|
|
8
|
+
"sky",
|
|
9
|
+
"violet",
|
|
10
|
+
"slate",
|
|
11
|
+
"teal",
|
|
12
|
+
"blue",
|
|
13
|
+
"orange"
|
|
14
|
+
], r = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
15
|
+
function i(e) {
|
|
16
|
+
return e && (n.includes(e) || r.test(e)) ? e : "slate";
|
|
5
17
|
}
|
|
6
|
-
function
|
|
7
|
-
|
|
18
|
+
function a(e) {
|
|
19
|
+
return e.startsWith("#") ? `color-mix(in srgb, ${e} var(--pill-hex-fg-mix), var(--pill-hex-fg-base))` : `var(--pill-${e})`;
|
|
20
|
+
}
|
|
21
|
+
function o(e) {
|
|
22
|
+
return e.startsWith("#") ? `color-mix(in srgb, ${e} var(--pill-hex-bg-mix), transparent)` : `var(--pill-${e}-bg)`;
|
|
23
|
+
}
|
|
24
|
+
function s(e) {
|
|
25
|
+
return e == null || e === !1 || e === "" ? !1 : !Array.isArray(e) || e.some((e) => s(e));
|
|
26
|
+
}
|
|
27
|
+
function c({ tone: n = "slate", children: r, size: i = "sm", dot: c = !1, style: l }) {
|
|
28
|
+
let u = o(n), d = a(n);
|
|
8
29
|
return /* @__PURE__ */ t("span", {
|
|
9
30
|
className: "num",
|
|
10
31
|
style: {
|
|
11
32
|
display: "inline-flex",
|
|
12
33
|
alignItems: "center",
|
|
13
34
|
gap: 6,
|
|
14
|
-
height:
|
|
15
|
-
padding: `0 ${
|
|
35
|
+
height: i === "sm" ? 20 : i === "xs" ? 16 : 24,
|
|
36
|
+
padding: `0 ${i === "xs" ? 6 : 8}px`,
|
|
16
37
|
borderRadius: 999,
|
|
17
|
-
background:
|
|
18
|
-
color:
|
|
19
|
-
fontSize:
|
|
38
|
+
background: u,
|
|
39
|
+
color: d,
|
|
40
|
+
fontSize: i === "xs" ? 10.5 : 11.5,
|
|
20
41
|
fontWeight: 500,
|
|
21
42
|
whiteSpace: "nowrap",
|
|
22
43
|
maxWidth: "100%",
|
|
23
|
-
...
|
|
44
|
+
...l
|
|
24
45
|
},
|
|
25
|
-
children: [
|
|
46
|
+
children: [c && /* @__PURE__ */ e("span", { style: {
|
|
26
47
|
width: 6,
|
|
27
48
|
height: 6,
|
|
28
49
|
borderRadius: 999,
|
|
29
|
-
background:
|
|
30
|
-
} }),
|
|
50
|
+
background: d
|
|
51
|
+
} }), s(r) && /* @__PURE__ */ e("span", {
|
|
31
52
|
style: {
|
|
32
53
|
minWidth: 0,
|
|
33
54
|
overflow: "hidden",
|
|
34
55
|
textOverflow: "ellipsis",
|
|
35
56
|
whiteSpace: "nowrap"
|
|
36
57
|
},
|
|
37
|
-
children:
|
|
58
|
+
children: r
|
|
38
59
|
})]
|
|
39
60
|
});
|
|
40
61
|
}
|
|
41
|
-
export {
|
|
62
|
+
export { n as PILL_TONES, c as Pill, i as pillColor, a as pillForeground };
|
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
import { Pill as e } from "../primitives/Pill.js";
|
|
2
|
-
import { Select as
|
|
3
|
-
import { StatusStepper as
|
|
4
|
-
import { useText as
|
|
5
|
-
import { jsx as
|
|
1
|
+
import { Pill as e, pillColor as t, pillForeground as n } from "../primitives/Pill.js";
|
|
2
|
+
import { Select as r } from "../primitives/Fields.js";
|
|
3
|
+
import { StatusStepper as i } from "./StatusStepper.js";
|
|
4
|
+
import { useText as a } from "../../hooks/useText.js";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
6
|
// src/components/shared/StatusGroupsDisplay.tsx
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
return /* @__PURE__ */
|
|
7
|
+
function c({ statusGroups: c, objectStatuses: l, onSetStatus: u, isPending: d, mode: f = "edit" }) {
|
|
8
|
+
let p = a();
|
|
9
|
+
return /* @__PURE__ */ o("div", {
|
|
10
10
|
style: {
|
|
11
11
|
display: "flex",
|
|
12
12
|
flexWrap: "wrap",
|
|
13
13
|
alignItems: "center",
|
|
14
14
|
gap: 16
|
|
15
15
|
},
|
|
16
|
-
children: Object.entries(
|
|
17
|
-
let
|
|
18
|
-
if (
|
|
19
|
-
let e =
|
|
20
|
-
return /* @__PURE__ */
|
|
16
|
+
children: Object.entries(c).map(([a, c]) => {
|
|
17
|
+
let m = l?.find((e) => e.group_code === a)?.status_code, h = m ? c.statuses.find((e) => e.code === m) : void 0;
|
|
18
|
+
if (c.display_mode === "stepper") {
|
|
19
|
+
let e = f === "edit", t = e ? c.transitions && m ? /* @__PURE__ */ new Set([m, ...c.transitions[m] ?? []]) : new Set(c.statuses.map((e) => e.code)) : void 0;
|
|
20
|
+
return /* @__PURE__ */ s("div", {
|
|
21
21
|
style: {
|
|
22
22
|
display: "flex",
|
|
23
23
|
alignItems: "center",
|
|
24
24
|
gap: 8,
|
|
25
25
|
minWidth: 0
|
|
26
26
|
},
|
|
27
|
-
children: [/* @__PURE__ */
|
|
27
|
+
children: [/* @__PURE__ */ s("span", {
|
|
28
28
|
style: {
|
|
29
29
|
fontSize: 12,
|
|
30
30
|
color: "var(--text-3)",
|
|
31
31
|
flexShrink: 0
|
|
32
32
|
},
|
|
33
|
-
children: [
|
|
34
|
-
}), /* @__PURE__ */
|
|
33
|
+
children: [p(c.name), ":"]
|
|
34
|
+
}), /* @__PURE__ */ o("div", {
|
|
35
35
|
style: {
|
|
36
36
|
minWidth: 240,
|
|
37
|
-
opacity:
|
|
38
|
-
pointerEvents:
|
|
37
|
+
opacity: d ? .6 : 1,
|
|
38
|
+
pointerEvents: d ? "none" : "auto"
|
|
39
39
|
},
|
|
40
|
-
children: /* @__PURE__ */ i
|
|
41
|
-
stages:
|
|
40
|
+
children: /* @__PURE__ */ o(i, {
|
|
41
|
+
stages: c.statuses.map((e) => ({
|
|
42
42
|
code: e.code,
|
|
43
|
-
label:
|
|
43
|
+
label: p(e.name)
|
|
44
44
|
})),
|
|
45
|
-
current:
|
|
45
|
+
current: m,
|
|
46
46
|
selectable: t,
|
|
47
|
-
onSelect: e ? (e) =>
|
|
47
|
+
onSelect: e ? (e) => u(a, e) : void 0,
|
|
48
48
|
compact: !0
|
|
49
49
|
})
|
|
50
50
|
})]
|
|
51
|
-
},
|
|
51
|
+
}, a);
|
|
52
52
|
}
|
|
53
|
-
if (
|
|
53
|
+
if (f === "display") return /* @__PURE__ */ s("div", {
|
|
54
54
|
style: {
|
|
55
55
|
display: "flex",
|
|
56
56
|
alignItems: "center",
|
|
57
57
|
gap: 8
|
|
58
58
|
},
|
|
59
|
-
children: [/* @__PURE__ */
|
|
59
|
+
children: [/* @__PURE__ */ s("span", {
|
|
60
60
|
style: {
|
|
61
61
|
fontSize: 12,
|
|
62
62
|
color: "var(--text-3)"
|
|
63
63
|
},
|
|
64
|
-
children: [
|
|
65
|
-
}),
|
|
66
|
-
tone:
|
|
64
|
+
children: [p(c.name), ":"]
|
|
65
|
+
}), h ? /* @__PURE__ */ o(e, {
|
|
66
|
+
tone: t(h.color),
|
|
67
67
|
size: "xs",
|
|
68
|
-
children:
|
|
69
|
-
}) : /* @__PURE__ */
|
|
68
|
+
children: p(h.name)
|
|
69
|
+
}) : /* @__PURE__ */ o("span", {
|
|
70
70
|
style: {
|
|
71
71
|
fontSize: 12.5,
|
|
72
72
|
color: "var(--text-4)"
|
|
73
73
|
},
|
|
74
74
|
children: "—"
|
|
75
75
|
})]
|
|
76
|
-
},
|
|
77
|
-
let
|
|
76
|
+
}, a);
|
|
77
|
+
let g = (c.transitions && m ? c.statuses.filter((e) => e.code === m || (c.transitions[m]?.includes(e.code) ?? !1)) : c.statuses).map((e) => ({
|
|
78
78
|
value: e.code,
|
|
79
|
-
label: /* @__PURE__ */
|
|
79
|
+
label: /* @__PURE__ */ s("span", {
|
|
80
80
|
style: {
|
|
81
81
|
display: "inline-flex",
|
|
82
82
|
alignItems: "center",
|
|
83
83
|
gap: 6
|
|
84
84
|
},
|
|
85
|
-
children: [e.color && /* @__PURE__ */
|
|
85
|
+
children: [e.color && /* @__PURE__ */ o("span", { style: {
|
|
86
86
|
width: 8,
|
|
87
87
|
height: 8,
|
|
88
88
|
borderRadius: 999,
|
|
89
|
-
background:
|
|
89
|
+
background: n(t(e.color)),
|
|
90
90
|
display: "inline-block"
|
|
91
|
-
} }),
|
|
91
|
+
} }), p(e.name)]
|
|
92
92
|
})
|
|
93
93
|
}));
|
|
94
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ s("div", {
|
|
95
95
|
style: {
|
|
96
96
|
display: "flex",
|
|
97
97
|
alignItems: "center",
|
|
98
98
|
gap: 8
|
|
99
99
|
},
|
|
100
|
-
children: [/* @__PURE__ */
|
|
100
|
+
children: [/* @__PURE__ */ s("span", {
|
|
101
101
|
style: {
|
|
102
102
|
fontSize: 12,
|
|
103
103
|
color: "var(--text-3)"
|
|
104
104
|
},
|
|
105
|
-
children: [
|
|
106
|
-
}), /* @__PURE__ */
|
|
105
|
+
children: [p(c.name), ":"]
|
|
106
|
+
}), /* @__PURE__ */ o("div", {
|
|
107
107
|
style: {
|
|
108
108
|
minWidth: 180,
|
|
109
|
-
opacity:
|
|
110
|
-
pointerEvents:
|
|
109
|
+
opacity: d ? .6 : 1,
|
|
110
|
+
pointerEvents: d ? "none" : "auto"
|
|
111
111
|
},
|
|
112
|
-
children: /* @__PURE__ */
|
|
113
|
-
value:
|
|
114
|
-
options:
|
|
115
|
-
onChange: (e) =>
|
|
112
|
+
children: /* @__PURE__ */ o(r, {
|
|
113
|
+
value: m ?? "",
|
|
114
|
+
options: g,
|
|
115
|
+
onChange: (e) => u(a, e)
|
|
116
116
|
})
|
|
117
117
|
})]
|
|
118
|
-
},
|
|
118
|
+
}, a);
|
|
119
119
|
})
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
export {
|
|
122
|
+
export { c as StatusGroupsDisplay };
|