@servicetitan/json-render-react 0.2.0 → 0.3.1
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/catalog/context/catalog-prompt.md +229 -0
- package/dist/catalog/context/schema.json +56 -0
- package/dist/catalog/core/catalog-prompt.md +104 -90
- package/dist/catalog/core/schema.json +0 -1
- package/dist/catalog/marketing/catalog-prompt.md +104 -90
- package/dist/catalog/marketing/schema.json +0 -1
- package/dist/context/catalog/catalog-def.d.ts +50 -0
- package/dist/context/catalog/context-card.catalog.d.ts +19 -0
- package/dist/context/catalog/context-card.d.ts +8 -0
- package/dist/context/catalog/context-data-table.catalog.d.ts +34 -0
- package/dist/context/catalog/context-data-table.css.d.ts +2 -0
- package/dist/context/catalog/context-data-table.d.ts +6 -0
- package/dist/context/catalog/context-file-list.catalog.d.ts +11 -0
- package/dist/context/catalog/context-file-list.css.d.ts +16 -0
- package/dist/context/catalog/context-file-list.d.ts +6 -0
- package/dist/context/catalog/context-list.catalog.d.ts +48 -0
- package/dist/context/catalog/context-list.css.d.ts +16 -0
- package/dist/context/catalog/context-list.d.ts +6 -0
- package/dist/context/catalog/context-metric-grid.catalog.d.ts +22 -0
- package/dist/context/catalog/context-metric-grid.css.d.ts +13 -0
- package/dist/context/catalog/context-metric-grid.d.ts +6 -0
- package/dist/context/catalog/context-note-list.catalog.d.ts +15 -0
- package/dist/context/catalog/context-note-list.d.ts +6 -0
- package/dist/context/catalog/context-overview.catalog.d.ts +8 -0
- package/dist/context/catalog/context-overview.css.d.ts +2 -0
- package/dist/context/catalog/context-overview.d.ts +6 -0
- package/dist/context/catalog/context-panel.catalog.d.ts +6 -0
- package/dist/context/catalog/context-panel.css.d.ts +1 -0
- package/dist/context/catalog/context-panel.d.ts +6 -0
- package/dist/context/catalog/context-tabular-list.catalog.d.ts +19 -0
- package/dist/context/catalog/context-tabular-list.css.d.ts +17 -0
- package/dist/context/catalog/context-tabular-list.d.ts +6 -0
- package/dist/context/catalog/index.d.ts +10 -0
- package/dist/context/catalog/schemas.d.ts +151 -0
- package/dist/context/components/collapsible-card.css.d.ts +41 -0
- package/dist/context/components/collapsible-card.d.ts +14 -0
- package/dist/context/components/context-ai-summary.css.d.ts +5 -0
- package/dist/context/components/context-ai-summary.d.ts +4 -0
- package/dist/context/components/context-chip-tone.d.ts +10 -0
- package/dist/context/components/context-note-list.css.d.ts +10 -0
- package/dist/context/components/context-render-error-boundary.d.ts +21 -0
- package/dist/context/constants.d.ts +6 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/context/validate-context-spec-deep.d.ts +9 -0
- package/dist/context/validate-context-spec.d.ts +11 -0
- package/dist/core/catalog/alert.catalog.d.ts +2 -0
- package/dist/core/catalog/button.catalog.d.ts +3 -0
- package/dist/core/catalog/card.catalog.d.ts +2 -0
- package/dist/core/catalog/catalog-def.d.ts +33 -19
- package/dist/core/catalog/checkbox.catalog.d.ts +1 -0
- package/dist/core/catalog/chip.catalog.d.ts +1 -0
- package/dist/core/catalog/flex.catalog.d.ts +13 -0
- package/dist/core/catalog/grid.catalog.d.ts +4 -0
- package/dist/core/catalog/input.catalog.d.ts +1 -0
- package/dist/core/catalog/link.catalog.d.ts +2 -0
- package/dist/core/catalog/listbox.catalog.d.ts +1 -0
- package/dist/core/catalog/radio-group.catalog.d.ts +1 -0
- package/dist/core/catalog/schemas.d.ts +33 -19
- package/dist/core/catalog/switch.catalog.d.ts +1 -0
- package/dist/core/catalog/text.catalog.d.ts +0 -8
- package/dist/core/catalog/textarea.catalog.d.ts +1 -0
- package/dist/generate.d.ts +4 -4
- package/dist/index.d.ts +6 -3
- package/dist/index.js +2298 -0
- package/dist/index.js.map +1 -0
- package/dist/marketing/catalog/catalog.d.ts +1 -1
- package/dist/marketing/catalog/index.d.ts +1 -1
- package/dist/marketing/catalog/scoped-catalogs.d.ts +4 -0
- package/dist/registry-utils.d.ts +1 -1
- package/dist/registry.d.ts +1 -0
- package/dist/renderers/context-spec-renderer.d.ts +6 -0
- package/dist/renderers/sectioned-context-renderer.css.d.ts +1 -0
- package/dist/renderers/sectioned-context-renderer.d.ts +36 -0
- package/dist/renderers/spec-renderer.d.ts +6 -1
- package/dist/renderers/types.d.ts +2 -1
- package/dist/renderers/wrap-context-registry.d.ts +3 -0
- package/dist/scoped-catalog.d.ts +64 -0
- package/dist/styles.css +1 -1
- package/dist/test/setup-dom.d.ts +1 -0
- package/dist/types.d.ts +6 -3
- package/package.json +7 -4
- package/dist/core/catalog/badge.catalog.d.ts +0 -12
- package/dist/core/catalog/badge.css.d.ts +0 -1
- package/dist/core/catalog/badge.d.ts +0 -8
- package/dist/json-render-react.js +0 -1183
- package/dist/json-render-react.js.map +0 -1
- package/dist/marketing/catalog/teams.d.ts +0 -4
- package/dist/team-catalog.d.ts +0 -26
package/dist/index.js
ADDED
|
@@ -0,0 +1,2298 @@
|
|
|
1
|
+
import { AiMark as e, Alert as t, Badge as n, Button as r, Card as i, Checkbox as a, Chip as o, Divider as s, FieldLabel as c, Flex as l, Grid as u, Icon as d, Link as f, Listbox as ee, OverflowText as te, ProgressBar as ne, Radio as re, SkeletonRectangle as ie, SkeletonText as ae, Switch as oe, Text as p, TextField as se, Textarea as ce } from "@servicetitan/anvil2";
|
|
2
|
+
import { Card as m, Dialog as le, Link as ue, Text as h } from "@servicetitan/carto-react-kit";
|
|
3
|
+
import { IconChevronDown as de } from "@servicetitan/carto-react-kit/icons";
|
|
4
|
+
import { Children as g, Component as fe, Fragment as pe, useEffect as _, useId as me, useMemo as v, useRef as y, useState as b } from "react";
|
|
5
|
+
import { core as x } from "@servicetitan/anvil2/token";
|
|
6
|
+
import { Fragment as he, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
7
|
+
import { z as w } from "zod";
|
|
8
|
+
import { DataTable as ge, createColumnHelper as _e } from "@servicetitan/anvil2/beta";
|
|
9
|
+
import ve from "@servicetitan/anvil2/assets/icons/material/round/image.svg";
|
|
10
|
+
import ye from "@servicetitan/anvil2/assets/icons/st/document_audio.svg";
|
|
11
|
+
import be from "@servicetitan/anvil2/assets/icons/st/document_doc.svg";
|
|
12
|
+
import xe from "@servicetitan/anvil2/assets/icons/st/document_form.svg";
|
|
13
|
+
import Se from "@servicetitan/anvil2/assets/icons/st/document_other.svg";
|
|
14
|
+
import Ce from "@servicetitan/anvil2/assets/icons/st/document_pdf.svg";
|
|
15
|
+
import we from "@servicetitan/anvil2/assets/icons/st/document_spreadsheet.svg";
|
|
16
|
+
import Te from "@servicetitan/anvil2/assets/icons/st/document_text.svg";
|
|
17
|
+
import { primitive as Ee } from "@servicetitan/carto-react-kit/tokens";
|
|
18
|
+
import { defineCatalog as T, getByPath as E, validateSpec as De } from "@json-render/core";
|
|
19
|
+
import { schema as D } from "@json-render/react/schema";
|
|
20
|
+
import { JSONUIProvider as Oe, Renderer as ke, createStateStore as Ae, defineRegistry as je, useStateStore as O } from "@json-render/react";
|
|
21
|
+
import * as k from "@amcharts/amcharts5";
|
|
22
|
+
import * as A from "@amcharts/amcharts5/xy";
|
|
23
|
+
import Me from "@amcharts/amcharts5/themes/Animated";
|
|
24
|
+
import { ThemeCategorical as Ne, ThemeMonochrome as Pe, ThemeSemantic as Fe } from "@servicetitan/anvil2-ext-charts/am5";
|
|
25
|
+
import Ie from "@servicetitan/anvil2/assets/icons/material/round/check_circle.svg";
|
|
26
|
+
import Le from "@servicetitan/anvil2/assets/icons/material/round/radio_button_unchecked.svg";
|
|
27
|
+
import Re from "@servicetitan/anvil2/assets/icons/st/in_progress.svg";
|
|
28
|
+
import * as ze from "@amcharts/amcharts5/percent";
|
|
29
|
+
//#region ../../node_modules/.pnpm/@vanilla-extract+recipes@0.5.7_@vanilla-extract+css@1.20.1/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js
|
|
30
|
+
function Be(e, t) {
|
|
31
|
+
if (typeof e != "object" || !e) return e;
|
|
32
|
+
var n = e[Symbol.toPrimitive];
|
|
33
|
+
if (n !== void 0) {
|
|
34
|
+
var r = n.call(e, t || "default");
|
|
35
|
+
if (typeof r != "object") return r;
|
|
36
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
37
|
+
}
|
|
38
|
+
return (t === "string" ? String : Number)(e);
|
|
39
|
+
}
|
|
40
|
+
function Ve(e) {
|
|
41
|
+
var t = Be(e, "string");
|
|
42
|
+
return typeof t == "symbol" ? t : String(t);
|
|
43
|
+
}
|
|
44
|
+
function He(e, t, n) {
|
|
45
|
+
return t = Ve(t), t in e ? Object.defineProperty(e, t, {
|
|
46
|
+
value: n,
|
|
47
|
+
enumerable: !0,
|
|
48
|
+
configurable: !0,
|
|
49
|
+
writable: !0
|
|
50
|
+
}) : e[t] = n, e;
|
|
51
|
+
}
|
|
52
|
+
function Ue(e, t) {
|
|
53
|
+
var n = Object.keys(e);
|
|
54
|
+
if (Object.getOwnPropertySymbols) {
|
|
55
|
+
var r = Object.getOwnPropertySymbols(e);
|
|
56
|
+
t && (r = r.filter(function(t) {
|
|
57
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
58
|
+
})), n.push.apply(n, r);
|
|
59
|
+
}
|
|
60
|
+
return n;
|
|
61
|
+
}
|
|
62
|
+
function We(e) {
|
|
63
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
64
|
+
var n = arguments[t] == null ? {} : arguments[t];
|
|
65
|
+
t % 2 ? Ue(Object(n), !0).forEach(function(t) {
|
|
66
|
+
He(e, t, n[t]);
|
|
67
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Ue(Object(n)).forEach(function(t) {
|
|
68
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return e;
|
|
72
|
+
}
|
|
73
|
+
function Ge(e, t) {
|
|
74
|
+
var n = {};
|
|
75
|
+
for (var r in e) n[r] = t(e[r], r);
|
|
76
|
+
return n;
|
|
77
|
+
}
|
|
78
|
+
var Ke = (e, t, n) => {
|
|
79
|
+
for (var r of Object.keys(e)) if (e[r] !== (t[r] ?? n[r])) return !1;
|
|
80
|
+
return !0;
|
|
81
|
+
}, j = (e) => {
|
|
82
|
+
var t = (t) => {
|
|
83
|
+
var n = e.defaultClassName, r = We(We({}, e.defaultVariants), t);
|
|
84
|
+
for (var i in r) {
|
|
85
|
+
var a = r[i] ?? e.defaultVariants[i];
|
|
86
|
+
if (a != null) {
|
|
87
|
+
var o = a;
|
|
88
|
+
typeof o == "boolean" && (o = o === !0 ? "true" : "false");
|
|
89
|
+
var s = e.variantClassNames[i][o];
|
|
90
|
+
s && (n += " " + s);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
for (var [c, l] of e.compoundVariants) Ke(c, r, e.defaultVariants) && (n += " " + l);
|
|
94
|
+
return n;
|
|
95
|
+
};
|
|
96
|
+
return t.variants = () => Object.keys(e.variantClassNames), t.classNames = {
|
|
97
|
+
get base() {
|
|
98
|
+
return e.defaultClassName.split(" ")[0];
|
|
99
|
+
},
|
|
100
|
+
get variants() {
|
|
101
|
+
return Ge(e.variantClassNames, (e) => Ge(e, (e) => e.split(" ")[0]));
|
|
102
|
+
}
|
|
103
|
+
}, t;
|
|
104
|
+
}, qe = "_7hazmf0", Je = "_7hazmf1", Ye = "_7hazmf2", Xe = j({
|
|
105
|
+
defaultClassName: "_7hazmf3",
|
|
106
|
+
variantClassNames: { expanded: {
|
|
107
|
+
true: "_7hazmf4",
|
|
108
|
+
false: "_7hazmf5"
|
|
109
|
+
} },
|
|
110
|
+
defaultVariants: { expanded: !1 },
|
|
111
|
+
compoundVariants: []
|
|
112
|
+
}), Ze = j({
|
|
113
|
+
defaultClassName: "_7hazmf6",
|
|
114
|
+
variantClassNames: { expanded: {
|
|
115
|
+
true: "_7hazmf7",
|
|
116
|
+
false: "_7hazmf8"
|
|
117
|
+
} },
|
|
118
|
+
defaultVariants: { expanded: !1 },
|
|
119
|
+
compoundVariants: []
|
|
120
|
+
}), Qe = "_7hazmf9", $e = "_7hazmfa", et = "_7hazmfb", tt = j({
|
|
121
|
+
defaultClassName: "_7hazmfc",
|
|
122
|
+
variantClassNames: { expanded: {
|
|
123
|
+
true: "_7hazmfd",
|
|
124
|
+
false: "_7hazmfe"
|
|
125
|
+
} },
|
|
126
|
+
defaultVariants: { expanded: !1 },
|
|
127
|
+
compoundVariants: []
|
|
128
|
+
}), M = [
|
|
129
|
+
"success",
|
|
130
|
+
"warning",
|
|
131
|
+
"danger",
|
|
132
|
+
"info",
|
|
133
|
+
"neutral"
|
|
134
|
+
], nt = {
|
|
135
|
+
success: x.semantic.BackgroundColorSuccessSubdued.value,
|
|
136
|
+
warning: x.semantic.BackgroundColorWarningSubdued.value,
|
|
137
|
+
danger: x.semantic.BackgroundColorDangerSubdued.value,
|
|
138
|
+
info: x.semantic.BackgroundColorPrimarySubdued.value,
|
|
139
|
+
neutral: x.semantic.BackgroundColorSecondary.value
|
|
140
|
+
};
|
|
141
|
+
function rt(e = "neutral") {
|
|
142
|
+
return nt[e];
|
|
143
|
+
}
|
|
144
|
+
var it = {
|
|
145
|
+
success: x.semantic.BackgroundColorSuccess.value,
|
|
146
|
+
warning: x.semantic.BackgroundColorWarning.value,
|
|
147
|
+
danger: x.semantic.ForegroundColorDanger.value,
|
|
148
|
+
info: x.semantic.ForegroundColorPrimary.value,
|
|
149
|
+
neutral: void 0
|
|
150
|
+
};
|
|
151
|
+
function N(e) {
|
|
152
|
+
return it[e];
|
|
153
|
+
}
|
|
154
|
+
function at(e) {
|
|
155
|
+
if (e == null || e === "") return null;
|
|
156
|
+
if (typeof e == "object" && e && "label" in e) {
|
|
157
|
+
let t = e;
|
|
158
|
+
return {
|
|
159
|
+
label: t.label,
|
|
160
|
+
tone: t.tone ?? "neutral"
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
return typeof e == "string" ? {
|
|
164
|
+
label: e,
|
|
165
|
+
tone: "neutral"
|
|
166
|
+
} : {
|
|
167
|
+
label: String(e),
|
|
168
|
+
tone: "neutral"
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/context/components/collapsible-card.tsx
|
|
173
|
+
function ot({ badge: e }) {
|
|
174
|
+
return typeof e == "number" ? /* @__PURE__ */ S(o, {
|
|
175
|
+
label: String(e),
|
|
176
|
+
size: "small",
|
|
177
|
+
style: { marginTop: "2px" }
|
|
178
|
+
}) : /* @__PURE__ */ S(o, {
|
|
179
|
+
label: e.label,
|
|
180
|
+
size: "small",
|
|
181
|
+
color: rt(e.tone ?? "neutral"),
|
|
182
|
+
style: { marginTop: "2px" }
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
var st = ({ title: e, badge: t, defaultExpanded: n = !0, children: r }) => {
|
|
186
|
+
let [i, a] = b(n), [o, s] = b(n), c = me();
|
|
187
|
+
return /* @__PURE__ */ S("div", {
|
|
188
|
+
className: qe,
|
|
189
|
+
children: /* @__PURE__ */ S(m, {
|
|
190
|
+
padding: "base",
|
|
191
|
+
content: /* @__PURE__ */ C("div", {
|
|
192
|
+
className: Ye,
|
|
193
|
+
children: [/* @__PURE__ */ S(h, {
|
|
194
|
+
variant: "headline",
|
|
195
|
+
el: "h3",
|
|
196
|
+
size: "substantial",
|
|
197
|
+
text: /* @__PURE__ */ C("button", {
|
|
198
|
+
type: "button",
|
|
199
|
+
"aria-expanded": i,
|
|
200
|
+
"aria-controls": c,
|
|
201
|
+
onClick: () => {
|
|
202
|
+
a((e) => {
|
|
203
|
+
let t = !e;
|
|
204
|
+
return t && s(!0), t;
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
className: Qe,
|
|
208
|
+
children: [/* @__PURE__ */ C("span", {
|
|
209
|
+
className: $e,
|
|
210
|
+
children: [/* @__PURE__ */ S("span", {
|
|
211
|
+
className: et,
|
|
212
|
+
children: e
|
|
213
|
+
}), t == null ? null : /* @__PURE__ */ S(ot, { badge: t })]
|
|
214
|
+
}), /* @__PURE__ */ S(de, { className: tt({ expanded: i }) })]
|
|
215
|
+
})
|
|
216
|
+
}), /* @__PURE__ */ S("div", {
|
|
217
|
+
className: Xe({ expanded: i }),
|
|
218
|
+
onTransitionEnd: (e) => {
|
|
219
|
+
e.propertyName !== "grid-template-rows" || i || s(!1);
|
|
220
|
+
},
|
|
221
|
+
children: /* @__PURE__ */ S("div", {
|
|
222
|
+
className: Ze({ expanded: i }),
|
|
223
|
+
children: /* @__PURE__ */ S("div", {
|
|
224
|
+
id: c,
|
|
225
|
+
className: Je,
|
|
226
|
+
"aria-hidden": !i,
|
|
227
|
+
children: o ? r : null
|
|
228
|
+
})
|
|
229
|
+
})
|
|
230
|
+
})]
|
|
231
|
+
})
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
}, ct = w.object({
|
|
235
|
+
label: w.string(),
|
|
236
|
+
tone: w.enum(M).optional()
|
|
237
|
+
}), lt = w.union([w.number().int().nonnegative(), ct]), ut = {
|
|
238
|
+
props: w.object({
|
|
239
|
+
title: w.string(),
|
|
240
|
+
defaultExpanded: w.boolean().optional(),
|
|
241
|
+
badge: lt.optional()
|
|
242
|
+
}),
|
|
243
|
+
slots: ["default"],
|
|
244
|
+
description: "Collapsible card for the Context panel. Each card holds a single content component as its body. Optional badge shows a count (number) or status label ({ label, tone? }) in the card header. Use defaultExpanded: false to start collapsed."
|
|
245
|
+
}, dt = ({ props: e, children: t }) => /* @__PURE__ */ S(st, {
|
|
246
|
+
title: e.title,
|
|
247
|
+
...e.badge == null ? {} : { badge: e.badge },
|
|
248
|
+
defaultExpanded: e.defaultExpanded ?? !0,
|
|
249
|
+
children: t
|
|
250
|
+
}), ft = w.object({
|
|
251
|
+
label: w.string(),
|
|
252
|
+
tone: w.enum(M).optional()
|
|
253
|
+
}), pt = w.union([
|
|
254
|
+
w.string(),
|
|
255
|
+
w.number(),
|
|
256
|
+
w.null(),
|
|
257
|
+
ft
|
|
258
|
+
]), mt = w.object({
|
|
259
|
+
key: w.string(),
|
|
260
|
+
header: w.string(),
|
|
261
|
+
type: w.enum([
|
|
262
|
+
"text",
|
|
263
|
+
"currency",
|
|
264
|
+
"chip",
|
|
265
|
+
"delta"
|
|
266
|
+
]).optional(),
|
|
267
|
+
sortable: w.boolean().optional()
|
|
268
|
+
}), ht = w.record(w.string(), pt).and(w.object({ id: w.string() })), gt = {
|
|
269
|
+
props: w.object({
|
|
270
|
+
columns: w.array(mt),
|
|
271
|
+
rows: w.array(ht),
|
|
272
|
+
defaultSortedColumn: w.object({
|
|
273
|
+
id: w.string(),
|
|
274
|
+
desc: w.boolean().optional()
|
|
275
|
+
}).optional()
|
|
276
|
+
}),
|
|
277
|
+
slots: [],
|
|
278
|
+
description: "Read-only DataTable for context cards. Column type: text (default), currency, chip, or delta. Chip cells: plain string (neutral tone) or { label, tone } where tone is success | warning | danger | info | neutral. Delta cells: signed string ('+5%', '-3%') or null — positive renders danger-red, negative renders success-green, null renders '–'. Rows must include id."
|
|
279
|
+
}, _t = "_1b4fiav0", vt = "_1b4fiav1";
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/context/catalog/context-data-table.tsx
|
|
282
|
+
function yt(e) {
|
|
283
|
+
if (e == null || e === "" || e === "–" || e === "0" || e === "0%") return {
|
|
284
|
+
text: "–",
|
|
285
|
+
sign: "none"
|
|
286
|
+
};
|
|
287
|
+
let t = String(e).trim();
|
|
288
|
+
return t.startsWith("+") || !t.startsWith("-") && parseFloat(t) > 0 ? {
|
|
289
|
+
text: t,
|
|
290
|
+
sign: "positive"
|
|
291
|
+
} : t.startsWith("-") || parseFloat(t) < 0 ? {
|
|
292
|
+
text: t,
|
|
293
|
+
sign: "negative"
|
|
294
|
+
} : {
|
|
295
|
+
text: t,
|
|
296
|
+
sign: "none"
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
var bt = ({ props: e }) => /* @__PURE__ */ S("div", {
|
|
300
|
+
className: _t,
|
|
301
|
+
children: /* @__PURE__ */ S(ge, {
|
|
302
|
+
columns: v(() => {
|
|
303
|
+
let t = _e();
|
|
304
|
+
return e.columns.map((e) => t(e.key, {
|
|
305
|
+
header: { label: e.header },
|
|
306
|
+
...e.sortable ? { sortable: !0 } : {},
|
|
307
|
+
...e.type === "currency" ? { type: "currency" } : {},
|
|
308
|
+
...e.type === "chip" ? { renderCell: (e) => {
|
|
309
|
+
let t = at(e);
|
|
310
|
+
return t ? /* @__PURE__ */ S(o, {
|
|
311
|
+
label: t.label,
|
|
312
|
+
size: "small",
|
|
313
|
+
color: rt(t.tone)
|
|
314
|
+
}) : null;
|
|
315
|
+
} } : {},
|
|
316
|
+
...e.type === "delta" ? { renderCell: (e) => {
|
|
317
|
+
let { text: t, sign: n } = yt(e), r = n === "positive" ? N("danger") : n === "negative" ? N("success") : void 0;
|
|
318
|
+
return /* @__PURE__ */ S("span", {
|
|
319
|
+
className: vt,
|
|
320
|
+
style: r ? { color: r } : void 0,
|
|
321
|
+
children: t
|
|
322
|
+
});
|
|
323
|
+
} } : {}
|
|
324
|
+
}));
|
|
325
|
+
}, [e.columns]),
|
|
326
|
+
data: v(() => e.rows.map((e) => ({ ...e })), [e.rows]),
|
|
327
|
+
isSelectable: !1,
|
|
328
|
+
...e.defaultSortedColumn ? { defaultSortedColumn: {
|
|
329
|
+
id: e.defaultSortedColumn.id,
|
|
330
|
+
desc: e.defaultSortedColumn.desc ?? !1
|
|
331
|
+
} } : {}
|
|
332
|
+
})
|
|
333
|
+
}), xt = w.object({
|
|
334
|
+
label: w.string(),
|
|
335
|
+
url: w.string()
|
|
336
|
+
}), St = {
|
|
337
|
+
props: w.object({ items: w.array(xt) }),
|
|
338
|
+
slots: [],
|
|
339
|
+
description: "Vertical list of file attachments and documents. Each row shows a color-coded file-type icon (inferred from the extension: pdf, xlsx/csv, doc/docx, image, or generic) and the filename. Clicking a row opens a preview dialog. Image files render from url; other files show a large icon and a Download footer action. Use for Completed Forms and Attachments sections."
|
|
340
|
+
}, Ct = "_1afcqze0", wt = "_1afcqze1", Tt = "_1afcqze2", Et = "_1afcqze3", Dt = "_1afcqze4", Ot = "_1afcqze5", kt = "_1afcqze6", At = "_1afcqze7", jt = "_1afcqze8";
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region src/context/catalog/context-file-list.tsx
|
|
343
|
+
function Mt(e) {
|
|
344
|
+
let t = e.toLowerCase();
|
|
345
|
+
return t.endsWith(".pdf") ? "pdf" : /\.(xlsx|xls|csv|numbers)$/.test(t) ? "spreadsheet" : /\.(doc|docx|pages)$/.test(t) ? /form/i.test(t.replace(/\.[^.]+$/, "")) ? "form" : "doc" : /\.(txt|rtf|md)$/.test(t) ? "text" : /\.(mp3|wav|aac|m4a|flac|ogg)$/.test(t) ? "audio" : /\.(jpg|jpeg|png|gif|webp|heic|svg)$/.test(t) ? "image" : /form/i.test(t.replace(/\.[^.]+$/, "")) ? "form" : "generic";
|
|
346
|
+
}
|
|
347
|
+
var Nt = {
|
|
348
|
+
pdf: {
|
|
349
|
+
svg: Ce,
|
|
350
|
+
color: "#DC2626"
|
|
351
|
+
},
|
|
352
|
+
spreadsheet: {
|
|
353
|
+
svg: we,
|
|
354
|
+
color: "#16A34A"
|
|
355
|
+
},
|
|
356
|
+
doc: {
|
|
357
|
+
svg: be,
|
|
358
|
+
color: "#2563EB"
|
|
359
|
+
},
|
|
360
|
+
text: {
|
|
361
|
+
svg: Te,
|
|
362
|
+
color: "#6B7280"
|
|
363
|
+
},
|
|
364
|
+
form: {
|
|
365
|
+
svg: xe,
|
|
366
|
+
color: "#2563EB"
|
|
367
|
+
},
|
|
368
|
+
audio: {
|
|
369
|
+
svg: ye,
|
|
370
|
+
color: "#6B7280"
|
|
371
|
+
},
|
|
372
|
+
image: {
|
|
373
|
+
svg: ve,
|
|
374
|
+
color: "#374151"
|
|
375
|
+
},
|
|
376
|
+
generic: {
|
|
377
|
+
svg: Se,
|
|
378
|
+
color: "#6B7280"
|
|
379
|
+
}
|
|
380
|
+
}, Pt = { "--a2-mod-icon-font-size": "80px" };
|
|
381
|
+
function Ft({ kind: e }) {
|
|
382
|
+
let { svg: t, color: n } = Nt[e];
|
|
383
|
+
return /* @__PURE__ */ S("div", {
|
|
384
|
+
className: Et,
|
|
385
|
+
"aria-hidden": "true",
|
|
386
|
+
children: /* @__PURE__ */ S(d, {
|
|
387
|
+
svg: t,
|
|
388
|
+
size: "medium",
|
|
389
|
+
color: n
|
|
390
|
+
})
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
function It(e, t) {
|
|
394
|
+
let n = document.createElement("a");
|
|
395
|
+
n.href = e, n.download = t, n.target = "_blank", n.rel = "noopener noreferrer", document.body.appendChild(n), n.click(), n.remove();
|
|
396
|
+
}
|
|
397
|
+
function Lt({ label: e }) {
|
|
398
|
+
return /* @__PURE__ */ S(h, {
|
|
399
|
+
variant: "body",
|
|
400
|
+
size: "regular",
|
|
401
|
+
text: e,
|
|
402
|
+
className: jt
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
function Rt({ item: e, kind: t }) {
|
|
406
|
+
let { svg: n, color: r } = Nt[t];
|
|
407
|
+
return /* @__PURE__ */ C("div", {
|
|
408
|
+
className: Dt,
|
|
409
|
+
children: [/* @__PURE__ */ S("div", {
|
|
410
|
+
className: Ot,
|
|
411
|
+
children: t === "image" ? /* @__PURE__ */ S("img", {
|
|
412
|
+
src: e.url,
|
|
413
|
+
alt: e.label,
|
|
414
|
+
className: kt
|
|
415
|
+
}) : /* @__PURE__ */ S("div", {
|
|
416
|
+
className: At,
|
|
417
|
+
children: /* @__PURE__ */ S(d, {
|
|
418
|
+
svg: n,
|
|
419
|
+
color: r,
|
|
420
|
+
style: Pt
|
|
421
|
+
})
|
|
422
|
+
})
|
|
423
|
+
}), /* @__PURE__ */ S(Lt, { label: e.label })]
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
function zt({ item: e, onPreview: t }) {
|
|
427
|
+
let n = Mt(e.label);
|
|
428
|
+
return /* @__PURE__ */ S(m, {
|
|
429
|
+
className: wt,
|
|
430
|
+
padding: "snug",
|
|
431
|
+
onPress: t,
|
|
432
|
+
label: `Preview ${e.label}`,
|
|
433
|
+
content: /* @__PURE__ */ C("div", {
|
|
434
|
+
className: Tt,
|
|
435
|
+
children: [/* @__PURE__ */ S(Ft, { kind: n }), /* @__PURE__ */ S(h, {
|
|
436
|
+
variant: "body",
|
|
437
|
+
size: "compact",
|
|
438
|
+
text: e.label
|
|
439
|
+
})]
|
|
440
|
+
})
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
function Bt({ item: e }) {
|
|
444
|
+
let [t, n] = b(!1), r = Mt(e.label);
|
|
445
|
+
return /* @__PURE__ */ C(he, { children: [/* @__PURE__ */ S(zt, {
|
|
446
|
+
item: e,
|
|
447
|
+
onPreview: () => n(!0)
|
|
448
|
+
}), /* @__PURE__ */ S(le, {
|
|
449
|
+
title: "View Attachment",
|
|
450
|
+
content: /* @__PURE__ */ S(Rt, {
|
|
451
|
+
item: e,
|
|
452
|
+
kind: r
|
|
453
|
+
}),
|
|
454
|
+
isOpen: t,
|
|
455
|
+
onOpenChange: n,
|
|
456
|
+
...r === "image" ? {} : { primaryAction: {
|
|
457
|
+
label: "Download",
|
|
458
|
+
onPress: () => It(e.url, e.label)
|
|
459
|
+
} }
|
|
460
|
+
})] });
|
|
461
|
+
}
|
|
462
|
+
var Vt = ({ props: e }) => /* @__PURE__ */ S("div", {
|
|
463
|
+
className: Ct,
|
|
464
|
+
children: e.items.map((e, t) => /* @__PURE__ */ S(Bt, { item: e }, `${e.label}-${t}`))
|
|
465
|
+
}), Ht = w.object({
|
|
466
|
+
title: w.string(),
|
|
467
|
+
identifier: w.string().optional(),
|
|
468
|
+
identifierHref: w.string().optional(),
|
|
469
|
+
meta: w.string().optional(),
|
|
470
|
+
callout: w.string().optional(),
|
|
471
|
+
calloutTone: w.enum(M).optional(),
|
|
472
|
+
calloutLabel: w.string().optional()
|
|
473
|
+
}), Ut = {
|
|
474
|
+
props: w.object({ items: w.array(Ht) }),
|
|
475
|
+
slots: [],
|
|
476
|
+
description: "Flat list for timesheets and recent jobs. Each item has a required title, optional identifier link + meta on the left, and optional callout + calloutLabel on the right. For grouped procurement records with aligned columns, use ContextTabularList instead."
|
|
477
|
+
}, Wt = "blgld0", Gt = "blgld1", Kt = "blgld2", qt = "blgld3", Jt = "blgld4", Yt = "blgld5", Xt = "blgld6", Zt = "blgld7";
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/context/catalog/context-list.tsx
|
|
480
|
+
function Qt({ item: e }) {
|
|
481
|
+
let t = e.calloutTone ? N(e.calloutTone) : void 0, n = e.identifier, r = e.callout != null || e.calloutLabel != null;
|
|
482
|
+
return /* @__PURE__ */ C("div", {
|
|
483
|
+
className: qt,
|
|
484
|
+
children: [/* @__PURE__ */ C("div", {
|
|
485
|
+
className: Jt,
|
|
486
|
+
children: [/* @__PURE__ */ C("div", {
|
|
487
|
+
className: Yt,
|
|
488
|
+
children: [
|
|
489
|
+
n && e.identifierHref ? /* @__PURE__ */ S(ue, {
|
|
490
|
+
href: e.identifierHref,
|
|
491
|
+
target: "_blank",
|
|
492
|
+
text: n
|
|
493
|
+
}) : n ? /* @__PURE__ */ S(h, {
|
|
494
|
+
variant: "body",
|
|
495
|
+
size: "compact",
|
|
496
|
+
text: n
|
|
497
|
+
}) : null,
|
|
498
|
+
n ? /* @__PURE__ */ S("span", {
|
|
499
|
+
"aria-hidden": "true",
|
|
500
|
+
className: Xt
|
|
501
|
+
}) : null,
|
|
502
|
+
/* @__PURE__ */ S(h, {
|
|
503
|
+
variant: "body",
|
|
504
|
+
size: "regular",
|
|
505
|
+
text: e.title
|
|
506
|
+
})
|
|
507
|
+
]
|
|
508
|
+
}), e.meta ? /* @__PURE__ */ S(h, {
|
|
509
|
+
variant: "body",
|
|
510
|
+
size: "fine",
|
|
511
|
+
text: e.meta,
|
|
512
|
+
className: Gt
|
|
513
|
+
}) : null]
|
|
514
|
+
}), r ? /* @__PURE__ */ C("div", {
|
|
515
|
+
className: Zt,
|
|
516
|
+
children: [e.callout ? /* @__PURE__ */ S(h, {
|
|
517
|
+
variant: "headline",
|
|
518
|
+
el: "h6",
|
|
519
|
+
size: "regular",
|
|
520
|
+
text: e.callout,
|
|
521
|
+
...t ? { style: { color: t } } : {}
|
|
522
|
+
}) : null, e.calloutLabel ? /* @__PURE__ */ S(h, {
|
|
523
|
+
variant: "eyebrow",
|
|
524
|
+
text: e.calloutLabel,
|
|
525
|
+
className: Gt
|
|
526
|
+
}) : null]
|
|
527
|
+
}) : null]
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
var $t = ({ props: e }) => /* @__PURE__ */ S("div", {
|
|
531
|
+
className: Wt,
|
|
532
|
+
children: e.items.map((e, t) => /* @__PURE__ */ S("div", {
|
|
533
|
+
className: Kt,
|
|
534
|
+
children: /* @__PURE__ */ S(Qt, { item: e })
|
|
535
|
+
}, e.identifier ?? e.title ?? t))
|
|
536
|
+
}), en = w.object({
|
|
537
|
+
label: w.string(),
|
|
538
|
+
value: w.string(),
|
|
539
|
+
tone: w.enum(M).optional()
|
|
540
|
+
}), tn = {
|
|
541
|
+
props: w.object({
|
|
542
|
+
items: w.array(en),
|
|
543
|
+
columns: w.enum(["3", "4"]).optional()
|
|
544
|
+
}),
|
|
545
|
+
slots: [],
|
|
546
|
+
description: "KPI grid with label and value pairs. Optional columns: 3 (default) or 4. Each item supports an optional tone (danger | warning | success | info | neutral) to color the value text."
|
|
547
|
+
}, nn = j({
|
|
548
|
+
defaultClassName: "_16tl57e0",
|
|
549
|
+
variantClassNames: { columns: {
|
|
550
|
+
3: "_16tl57e1",
|
|
551
|
+
4: "_16tl57e2"
|
|
552
|
+
} },
|
|
553
|
+
defaultVariants: { columns: "3" },
|
|
554
|
+
compoundVariants: []
|
|
555
|
+
}), rn = "_16tl57e3", an = "_16tl57e4", on = ({ props: e }) => /* @__PURE__ */ S("div", {
|
|
556
|
+
className: nn({ columns: e.columns === "4" ? "4" : "3" }),
|
|
557
|
+
children: e.items.map((e) => {
|
|
558
|
+
let t = e.tone ? N(e.tone) : void 0;
|
|
559
|
+
return /* @__PURE__ */ C("div", {
|
|
560
|
+
className: an,
|
|
561
|
+
children: [/* @__PURE__ */ S(h, {
|
|
562
|
+
variant: "eyebrow",
|
|
563
|
+
text: e.label.toUpperCase(),
|
|
564
|
+
className: rn
|
|
565
|
+
}), /* @__PURE__ */ S(h, {
|
|
566
|
+
variant: "headline",
|
|
567
|
+
el: "h6",
|
|
568
|
+
size: "regular",
|
|
569
|
+
text: e.value,
|
|
570
|
+
...t ? { style: { color: t } } : {}
|
|
571
|
+
})]
|
|
572
|
+
}, e.label);
|
|
573
|
+
})
|
|
574
|
+
}), sn = "_2pn4ri0", cn = ({ summary: e }) => /* @__PURE__ */ S("div", {
|
|
575
|
+
className: sn,
|
|
576
|
+
"data-carto": "context-ai-summary",
|
|
577
|
+
children: /* @__PURE__ */ S(m, {
|
|
578
|
+
highlighted: !0,
|
|
579
|
+
padding: "snug",
|
|
580
|
+
role: "status",
|
|
581
|
+
style: { width: "100%" },
|
|
582
|
+
content: /* @__PURE__ */ S(h, {
|
|
583
|
+
variant: "body",
|
|
584
|
+
size: "regular",
|
|
585
|
+
text: e
|
|
586
|
+
})
|
|
587
|
+
})
|
|
588
|
+
}), ln = "_4l9lye0", un = "_4l9lye1", dn = "_4l9lye2", fn = "_4l9lye3", P = "_4l9lye4", pn = w.object({
|
|
589
|
+
category: w.string().optional(),
|
|
590
|
+
body: w.string(),
|
|
591
|
+
author: w.string().optional(),
|
|
592
|
+
date: w.string().optional(),
|
|
593
|
+
truncate: w.boolean().optional()
|
|
594
|
+
}), mn = {
|
|
595
|
+
props: w.object({
|
|
596
|
+
summary: w.string().optional(),
|
|
597
|
+
items: w.array(pn)
|
|
598
|
+
}),
|
|
599
|
+
slots: [],
|
|
600
|
+
description: "Notes & Summaries list. Optional summary renders an AI-highlighted box at the top. Each item shows an optional category eyebrow (e.g. 'JOB SUMMARY'), body text, and optional author + date at top-right. Set truncate: true on long items to clamp to ~3 lines with an inline More/Less expand."
|
|
601
|
+
};
|
|
602
|
+
//#endregion
|
|
603
|
+
//#region src/context/catalog/context-note-list.tsx
|
|
604
|
+
function hn({ item: e }) {
|
|
605
|
+
return /* @__PURE__ */ C("div", {
|
|
606
|
+
className: dn,
|
|
607
|
+
children: [e.category || e.author || e.date ? /* @__PURE__ */ C("div", {
|
|
608
|
+
className: fn,
|
|
609
|
+
children: [e.category ? /* @__PURE__ */ S(h, {
|
|
610
|
+
variant: "eyebrow",
|
|
611
|
+
text: e.category,
|
|
612
|
+
className: P
|
|
613
|
+
}) : /* @__PURE__ */ S("span", {}), e.author || e.date ? /* @__PURE__ */ S(h, {
|
|
614
|
+
variant: "eyebrow",
|
|
615
|
+
text: [e.author, e.date].filter(Boolean).join(" · "),
|
|
616
|
+
className: P
|
|
617
|
+
}) : null]
|
|
618
|
+
}) : null, e.truncate ? /* @__PURE__ */ S(te, {
|
|
619
|
+
rows: 3,
|
|
620
|
+
expandable: !0,
|
|
621
|
+
expandText: "More",
|
|
622
|
+
collapseText: "Less",
|
|
623
|
+
children: e.body
|
|
624
|
+
}) : /* @__PURE__ */ S(h, {
|
|
625
|
+
variant: "body",
|
|
626
|
+
size: "regular",
|
|
627
|
+
text: e.body
|
|
628
|
+
})]
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
var gn = ({ props: e }) => /* @__PURE__ */ C("div", {
|
|
632
|
+
className: ln,
|
|
633
|
+
children: [e.summary ? /* @__PURE__ */ S("div", {
|
|
634
|
+
className: un,
|
|
635
|
+
children: /* @__PURE__ */ S(cn, { summary: e.summary })
|
|
636
|
+
}) : null, e.items.map((e, t) => /* @__PURE__ */ S(hn, { item: e }, `${e.category ?? ""}-${t}`))]
|
|
637
|
+
}), _n = {
|
|
638
|
+
props: w.object({ summary: w.string() }),
|
|
639
|
+
slots: [],
|
|
640
|
+
description: "AI-generated overview summary for the Context panel. Optional first child of ContextPanel. Renders as a plain section (not a card): Overview headline with sparkle icon and body text. Leaf node — no children."
|
|
641
|
+
}, vn = "_1ysu3qn0", yn = "_1ysu3qn1", bn = ({ props: t }) => /* @__PURE__ */ C("section", {
|
|
642
|
+
className: vn,
|
|
643
|
+
children: [/* @__PURE__ */ C("div", {
|
|
644
|
+
className: yn,
|
|
645
|
+
children: [/* @__PURE__ */ S(h, {
|
|
646
|
+
variant: "headline",
|
|
647
|
+
el: "h2",
|
|
648
|
+
size: "substantial",
|
|
649
|
+
text: "Overview"
|
|
650
|
+
}), /* @__PURE__ */ S(e, {
|
|
651
|
+
size: "small",
|
|
652
|
+
type: "gradient"
|
|
653
|
+
})]
|
|
654
|
+
}), /* @__PURE__ */ S(h, {
|
|
655
|
+
variant: "body",
|
|
656
|
+
size: "regular",
|
|
657
|
+
text: t.summary
|
|
658
|
+
})]
|
|
659
|
+
}), xn = {
|
|
660
|
+
props: w.object({}),
|
|
661
|
+
slots: ["default"],
|
|
662
|
+
description: "Root container for the Context panel. MUST be the spec root. Children MUST only be ContextOverview (optional, first) followed by one or more ContextCard components."
|
|
663
|
+
}, F = "_19nljxi0", Sn = ({ children: e }) => /* @__PURE__ */ S("div", {
|
|
664
|
+
className: F,
|
|
665
|
+
children: g.toArray(e).filter(Boolean)
|
|
666
|
+
}), Cn = w.object({
|
|
667
|
+
label: w.string(),
|
|
668
|
+
value: w.string()
|
|
669
|
+
}), wn = w.object({
|
|
670
|
+
eyebrow: w.string().optional(),
|
|
671
|
+
identifier: w.string().optional(),
|
|
672
|
+
identifierHref: w.string().optional(),
|
|
673
|
+
fields: w.array(Cn)
|
|
674
|
+
}), Tn = w.object({
|
|
675
|
+
label: w.string(),
|
|
676
|
+
items: w.array(wn)
|
|
677
|
+
}), En = {
|
|
678
|
+
props: w.object({ groups: w.array(Tn) }),
|
|
679
|
+
slots: [],
|
|
680
|
+
description: "Grouped tabular list for procurement-style records. Each group has a vendor label and rows with an optional eyebrow + identifier in the first column and additional label/value field columns (e.g. DATE, AMOUNT). Use inside ContextCard for Procurement sections."
|
|
681
|
+
}, Dn = "_5kl5rv0", On = "_5kl5rv1", kn = "_5kl5rv2", I = "_5kl5rv3", An = "_5kl5rv4", jn = "_5kl5rv5", Mn = "_5kl5rv6";
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src/context/catalog/context-tabular-list.tsx
|
|
684
|
+
function Nn(e) {
|
|
685
|
+
let t = e + 1;
|
|
686
|
+
if (t <= 1) return "max-content";
|
|
687
|
+
let n = `minmax(${Ee.size[400]}, 1fr)`;
|
|
688
|
+
return Array(t).fill("max-content").join(` ${n} `);
|
|
689
|
+
}
|
|
690
|
+
function Pn(e) {
|
|
691
|
+
return e * 2 + 1;
|
|
692
|
+
}
|
|
693
|
+
function Fn({ item: e, gridRow: t }) {
|
|
694
|
+
let n = (e) => ({
|
|
695
|
+
style: {
|
|
696
|
+
gridColumn: Pn(e),
|
|
697
|
+
gridRow: t
|
|
698
|
+
},
|
|
699
|
+
className: Mn
|
|
700
|
+
});
|
|
701
|
+
return /* @__PURE__ */ C(he, { children: [/* @__PURE__ */ C("div", {
|
|
702
|
+
...n(0),
|
|
703
|
+
children: [e.eyebrow ? /* @__PURE__ */ S(h, {
|
|
704
|
+
variant: "eyebrow",
|
|
705
|
+
text: e.eyebrow,
|
|
706
|
+
className: I
|
|
707
|
+
}) : null, e.identifier && e.identifierHref ? /* @__PURE__ */ S(ue, {
|
|
708
|
+
href: e.identifierHref,
|
|
709
|
+
target: "_blank",
|
|
710
|
+
text: e.identifier
|
|
711
|
+
}) : e.identifier ? /* @__PURE__ */ S(h, {
|
|
712
|
+
variant: "body",
|
|
713
|
+
size: "compact",
|
|
714
|
+
text: e.identifier
|
|
715
|
+
}) : null]
|
|
716
|
+
}), e.fields.map((e, t) => /* @__PURE__ */ C("div", {
|
|
717
|
+
...n(t + 1),
|
|
718
|
+
children: [/* @__PURE__ */ S(h, {
|
|
719
|
+
variant: "eyebrow",
|
|
720
|
+
text: e.label,
|
|
721
|
+
className: I
|
|
722
|
+
}), /* @__PURE__ */ S(h, {
|
|
723
|
+
variant: "body",
|
|
724
|
+
size: "compact",
|
|
725
|
+
text: e.value
|
|
726
|
+
})]
|
|
727
|
+
}, e.label))] });
|
|
728
|
+
}
|
|
729
|
+
var In = ({ props: e }) => /* @__PURE__ */ S("div", {
|
|
730
|
+
className: Dn,
|
|
731
|
+
children: e.groups.map((e) => {
|
|
732
|
+
let t = e.items[0]?.fields.length ?? 0;
|
|
733
|
+
return /* @__PURE__ */ C("div", {
|
|
734
|
+
className: On,
|
|
735
|
+
children: [/* @__PURE__ */ S("div", {
|
|
736
|
+
className: kn,
|
|
737
|
+
children: /* @__PURE__ */ S(h, {
|
|
738
|
+
variant: "headline",
|
|
739
|
+
el: "h5",
|
|
740
|
+
size: "regular",
|
|
741
|
+
text: e.label
|
|
742
|
+
})
|
|
743
|
+
}), /* @__PURE__ */ S("div", {
|
|
744
|
+
className: An,
|
|
745
|
+
style: { gridTemplateColumns: Nn(t) },
|
|
746
|
+
children: e.items.map((e, t) => {
|
|
747
|
+
let n = t * 2 + 1;
|
|
748
|
+
return /* @__PURE__ */ C(pe, { children: [t > 0 ? /* @__PURE__ */ S("div", {
|
|
749
|
+
className: jn,
|
|
750
|
+
style: { gridRow: t * 2 }
|
|
751
|
+
}) : null, /* @__PURE__ */ S(Fn, {
|
|
752
|
+
item: e,
|
|
753
|
+
gridRow: n
|
|
754
|
+
})] }, e.identifier ?? e.eyebrow ?? t);
|
|
755
|
+
})
|
|
756
|
+
})]
|
|
757
|
+
}, e.label);
|
|
758
|
+
})
|
|
759
|
+
}), L = {
|
|
760
|
+
ContextPanel: xn,
|
|
761
|
+
ContextOverview: _n,
|
|
762
|
+
ContextCard: ut
|
|
763
|
+
}, R = {
|
|
764
|
+
ContextNoteList: mn,
|
|
765
|
+
ContextMetricGrid: tn,
|
|
766
|
+
ContextDataTable: gt,
|
|
767
|
+
ContextList: Ut,
|
|
768
|
+
ContextTabularList: En,
|
|
769
|
+
ContextFileList: St
|
|
770
|
+
}, z = {
|
|
771
|
+
"atlas.submitUserAction": {
|
|
772
|
+
params: w.object({
|
|
773
|
+
data: w.record(w.string(), w.unknown()).optional(),
|
|
774
|
+
actionId: w.string().optional()
|
|
775
|
+
}),
|
|
776
|
+
description: "Submit form data. actionId overrides default \"form_submit\" identifier."
|
|
777
|
+
},
|
|
778
|
+
"atlas.navigate": {
|
|
779
|
+
params: w.object({ url: w.string() }),
|
|
780
|
+
description: "Navigate to a URL or internal route. External URLs (http/https) open in a new tab; internal route strings navigate within the app."
|
|
781
|
+
},
|
|
782
|
+
"atlas.toolCall": {
|
|
783
|
+
params: w.object({
|
|
784
|
+
tool: w.string(),
|
|
785
|
+
args: w.record(w.string(), w.unknown()).optional()
|
|
786
|
+
}),
|
|
787
|
+
description: "Invoke a tool on the active artifact panel app (an MCP-backed MFE). args is the tool argument payload; if omitted the current form state is sent."
|
|
788
|
+
}
|
|
789
|
+
}, Ln = {
|
|
790
|
+
"atlas.submitUserAction": async (e) => {},
|
|
791
|
+
"atlas.navigate": async (e) => {},
|
|
792
|
+
"atlas.toolCall": async (e) => {}
|
|
793
|
+
}, Rn = {
|
|
794
|
+
props: w.object({
|
|
795
|
+
title: w.string(),
|
|
796
|
+
status: w.enum([
|
|
797
|
+
"info",
|
|
798
|
+
"success",
|
|
799
|
+
"warning",
|
|
800
|
+
"danger"
|
|
801
|
+
]).optional(),
|
|
802
|
+
dismissible: w.boolean().optional(),
|
|
803
|
+
aiMark: w.boolean().optional()
|
|
804
|
+
}),
|
|
805
|
+
slots: ["default"],
|
|
806
|
+
events: ["close"],
|
|
807
|
+
description: "Inline notification banner with a required title. status: info (default) | success | warning | danger — danger for errors, warning for cautions, success for confirmations. Put the main message in the alert's children (rendered below the title). dismissible: true adds a close button that emits a \"close\" event."
|
|
808
|
+
}, zn = {
|
|
809
|
+
props: w.object({
|
|
810
|
+
data: w.array(w.object({
|
|
811
|
+
category: w.string(),
|
|
812
|
+
value: w.number()
|
|
813
|
+
})),
|
|
814
|
+
orientation: w.enum(["vertical", "horizontal"]).optional(),
|
|
815
|
+
theme: w.enum([
|
|
816
|
+
"monochrome",
|
|
817
|
+
"categorical",
|
|
818
|
+
"semantic"
|
|
819
|
+
]).optional(),
|
|
820
|
+
height: w.number().optional(),
|
|
821
|
+
unit: w.string().optional()
|
|
822
|
+
}),
|
|
823
|
+
slots: [],
|
|
824
|
+
description: "Bar chart (vertical or horizontal) with Anvil2 theme. data: [{category, value}]. theme: monochrome (default, ≤4 vars), categorical (5-9 distinct), semantic (success/neutral/warning/danger order). unit: tooltip suffix."
|
|
825
|
+
}, Bn = {
|
|
826
|
+
props: w.object({
|
|
827
|
+
label: w.string(),
|
|
828
|
+
appearance: w.enum([
|
|
829
|
+
"primary",
|
|
830
|
+
"secondary",
|
|
831
|
+
"ghost",
|
|
832
|
+
"danger"
|
|
833
|
+
]).optional(),
|
|
834
|
+
size: w.enum([
|
|
835
|
+
"xsmall",
|
|
836
|
+
"small",
|
|
837
|
+
"medium",
|
|
838
|
+
"large"
|
|
839
|
+
]).optional(),
|
|
840
|
+
loading: w.boolean().optional(),
|
|
841
|
+
disabled: w.boolean().optional(),
|
|
842
|
+
badge: w.string().optional()
|
|
843
|
+
}),
|
|
844
|
+
slots: [],
|
|
845
|
+
events: ["press"],
|
|
846
|
+
description: "Clickable button. Emits a \"press\" event when clicked; inside a form the host treats press as a submit and uses the element key as the actionId, so no explicit on.press wiring is needed for form submits. appearance: primary | secondary (default) | ghost | danger (destructive actions like delete/cancel). size: xsmall | small | medium (default) | large. loading: true shows a spinner and blocks interaction. disabled: true prevents interaction. badge: optional notification count shown as a superscript (e.g. \"3\", \"99+\"); use an empty string for a dot-only indicator."
|
|
847
|
+
}, Vn = {
|
|
848
|
+
props: w.object({
|
|
849
|
+
title: w.string().optional(),
|
|
850
|
+
description: w.string().optional(),
|
|
851
|
+
background: w.enum(["strong", "stronger"]).optional(),
|
|
852
|
+
padding: w.enum([
|
|
853
|
+
"0",
|
|
854
|
+
"xsmall",
|
|
855
|
+
"small",
|
|
856
|
+
"medium",
|
|
857
|
+
"large"
|
|
858
|
+
]).optional()
|
|
859
|
+
}),
|
|
860
|
+
slots: ["default"],
|
|
861
|
+
description: "White surface that groups a logical section of related content. title: optional headline rendered at the top of the card. description: optional subdued line below the title. Children render below the header and are stacked vertically with consistent spacing — you do not need to wrap them in a Flex. Prefer the built-in title/description over standalone Text children for the heading. background: strong | stronger for nested/elevated surfaces. padding: 0 | xsmall | small | medium (default) | large. Do not nest a Card inside another Card."
|
|
862
|
+
}, Hn = {
|
|
863
|
+
props: w.object({
|
|
864
|
+
label: w.string(),
|
|
865
|
+
checked: w.boolean().optional(),
|
|
866
|
+
disabled: w.boolean().optional()
|
|
867
|
+
}),
|
|
868
|
+
slots: [],
|
|
869
|
+
events: ["change"],
|
|
870
|
+
description: "Checkbox for selecting zero or more independent options that are submitted with a form (one Checkbox per option). For a single on/off setting with immediate effect prefer Switch. Bind state with $bindState on checked; emits a \"change\" event when toggled. disabled: true prevents toggling."
|
|
871
|
+
}, Un = {
|
|
872
|
+
props: w.object({
|
|
873
|
+
label: w.string(),
|
|
874
|
+
size: w.enum(["small", "medium"]).optional(),
|
|
875
|
+
color: w.string().optional(),
|
|
876
|
+
icon: w.enum([
|
|
877
|
+
"check-circle",
|
|
878
|
+
"in-progress",
|
|
879
|
+
"radio-button-unchecked"
|
|
880
|
+
]).optional(),
|
|
881
|
+
removable: w.boolean().optional()
|
|
882
|
+
}),
|
|
883
|
+
slots: [],
|
|
884
|
+
events: ["close"],
|
|
885
|
+
description: "Inline label pill for metadata, tags, or categories — use for job statuses, not notification counts (use a Button/Link badge prop for those). size: small | medium (default). color: any CSS color. icon: optional leading status icon. removable: true adds a close button that emits a \"close\" event (ignored when size=small)."
|
|
886
|
+
}, Wn = {
|
|
887
|
+
props: w.object({
|
|
888
|
+
vertical: w.boolean().optional(),
|
|
889
|
+
spacing: w.enum([
|
|
890
|
+
"0",
|
|
891
|
+
"half",
|
|
892
|
+
"1",
|
|
893
|
+
"2",
|
|
894
|
+
"3",
|
|
895
|
+
"4",
|
|
896
|
+
"5",
|
|
897
|
+
"6",
|
|
898
|
+
"8",
|
|
899
|
+
"12"
|
|
900
|
+
]).optional(),
|
|
901
|
+
alignContent: w.enum([
|
|
902
|
+
"start",
|
|
903
|
+
"center",
|
|
904
|
+
"end"
|
|
905
|
+
]).optional()
|
|
906
|
+
}),
|
|
907
|
+
slots: [],
|
|
908
|
+
description: "Horizontal (default) or vertical rule that separates content sections. vertical: true for a vertical separator between side-by-side content. spacing (space around the divider, ~4px per step): 0 (default) | half | 1–6 | 8 | 12. alignContent: alignment of any divider content (start | center | end). Place between logical sections — not as a top/bottom border of a container."
|
|
909
|
+
}, Gn = {
|
|
910
|
+
props: w.object({
|
|
911
|
+
data: w.array(w.object({
|
|
912
|
+
category: w.string(),
|
|
913
|
+
value: w.number()
|
|
914
|
+
})),
|
|
915
|
+
theme: w.enum([
|
|
916
|
+
"monochrome",
|
|
917
|
+
"categorical",
|
|
918
|
+
"semantic"
|
|
919
|
+
]).optional(),
|
|
920
|
+
showLegend: w.boolean().optional(),
|
|
921
|
+
height: w.number().optional(),
|
|
922
|
+
unit: w.string().optional()
|
|
923
|
+
}),
|
|
924
|
+
slots: [],
|
|
925
|
+
description: "Donut chart with optional legend and Anvil2 theme. data: [{category, value}]. theme: monochrome (≤4 vars), categorical (5-9 distinct), semantic (status values)."
|
|
926
|
+
}, Kn = {
|
|
927
|
+
props: w.object({
|
|
928
|
+
direction: w.enum(["row", "column"]).optional(),
|
|
929
|
+
gap: w.enum([
|
|
930
|
+
"0",
|
|
931
|
+
"half",
|
|
932
|
+
"1",
|
|
933
|
+
"2",
|
|
934
|
+
"3",
|
|
935
|
+
"4",
|
|
936
|
+
"5",
|
|
937
|
+
"6",
|
|
938
|
+
"8",
|
|
939
|
+
"12"
|
|
940
|
+
]).optional(),
|
|
941
|
+
alignItems: w.enum([
|
|
942
|
+
"center",
|
|
943
|
+
"flex-start",
|
|
944
|
+
"flex-end",
|
|
945
|
+
"stretch",
|
|
946
|
+
"baseline"
|
|
947
|
+
]).optional(),
|
|
948
|
+
justifyContent: w.enum([
|
|
949
|
+
"center",
|
|
950
|
+
"flex-start",
|
|
951
|
+
"flex-end",
|
|
952
|
+
"space-between",
|
|
953
|
+
"space-around",
|
|
954
|
+
"space-evenly"
|
|
955
|
+
]).optional(),
|
|
956
|
+
alignSelf: w.enum([
|
|
957
|
+
"auto",
|
|
958
|
+
"center",
|
|
959
|
+
"flex-start",
|
|
960
|
+
"flex-end",
|
|
961
|
+
"stretch",
|
|
962
|
+
"baseline"
|
|
963
|
+
]).optional(),
|
|
964
|
+
wrap: w.enum([
|
|
965
|
+
"wrap",
|
|
966
|
+
"nowrap",
|
|
967
|
+
"wrap-reverse"
|
|
968
|
+
]).optional(),
|
|
969
|
+
grow: w.number().optional(),
|
|
970
|
+
shrink: w.number().optional(),
|
|
971
|
+
basis: w.string().optional(),
|
|
972
|
+
inline: w.boolean().optional()
|
|
973
|
+
}),
|
|
974
|
+
slots: ["default"],
|
|
975
|
+
description: "Flex layout container. direction: row (default) | column — always set column when stacking children vertically. gap (spacing token, ~4px per step): half=2px 1=4px 2=8px 3=12px 4=16px 5=20px 6=24px 8=32px 12=48px. alignItems: cross-axis alignment of children. justifyContent: main-axis distribution. When this Flex is itself a child of another Flex, use grow (1=fill available space), shrink, basis (CSS flex-basis e.g. \"200px\"), and alignSelf to control how it flexes."
|
|
976
|
+
}, B = {
|
|
977
|
+
props: w.object({
|
|
978
|
+
templateColumns: w.string().optional(),
|
|
979
|
+
gap: w.enum([
|
|
980
|
+
"0",
|
|
981
|
+
"half",
|
|
982
|
+
"1",
|
|
983
|
+
"2",
|
|
984
|
+
"3",
|
|
985
|
+
"4",
|
|
986
|
+
"5",
|
|
987
|
+
"6",
|
|
988
|
+
"8",
|
|
989
|
+
"12"
|
|
990
|
+
]).optional(),
|
|
991
|
+
bordered: w.boolean().optional()
|
|
992
|
+
}),
|
|
993
|
+
slots: ["default"],
|
|
994
|
+
description: "CSS Grid layout. templateColumns: CSS grid-template-columns value — \"repeat(3, 1fr)\" for equal columns, \"200px 1fr\" for fixed+flex two-column (e.g. key-value tables), \"1fr 1fr 80px\" for multi-column tables. Children flow into grid cells left-to-right, top-to-bottom. gap (spacing token, ~4px per step): 1=4px 2=8px … 6=24px 8=32px 12=48px (default 2). bordered: true renders a bordered table with row separators and cell padding — use for key-value and data tables."
|
|
995
|
+
}, qn = {
|
|
996
|
+
props: w.object({
|
|
997
|
+
name: w.enum([
|
|
998
|
+
"check-circle",
|
|
999
|
+
"in-progress",
|
|
1000
|
+
"radio-button-unchecked"
|
|
1001
|
+
]),
|
|
1002
|
+
size: w.enum([
|
|
1003
|
+
"small",
|
|
1004
|
+
"medium",
|
|
1005
|
+
"large",
|
|
1006
|
+
"xlarge"
|
|
1007
|
+
]).optional(),
|
|
1008
|
+
color: w.string().optional()
|
|
1009
|
+
}),
|
|
1010
|
+
slots: [],
|
|
1011
|
+
description: "Small status icon. name (only these three are available): check-circle=completed/success checkmark, in-progress=partial circle (active/working), radio-button-unchecked=empty circle (pending/not started). size: small | medium (default) | large | xlarge. color: any CSS color (defaults to the current text color). Commonly paired with status Text in lists and checklists."
|
|
1012
|
+
}, Jn = {
|
|
1013
|
+
props: w.object({
|
|
1014
|
+
label: w.string(),
|
|
1015
|
+
placeholder: w.string().optional(),
|
|
1016
|
+
type: w.enum([
|
|
1017
|
+
"text",
|
|
1018
|
+
"password",
|
|
1019
|
+
"email",
|
|
1020
|
+
"tel",
|
|
1021
|
+
"url",
|
|
1022
|
+
"number"
|
|
1023
|
+
]).optional(),
|
|
1024
|
+
value: w.string().optional(),
|
|
1025
|
+
disabled: w.boolean().optional()
|
|
1026
|
+
}),
|
|
1027
|
+
slots: [],
|
|
1028
|
+
events: ["change"],
|
|
1029
|
+
description: "Free-text input field for user-typed values (names, notes, numbers, etc). type: text (default), password (masked), email, tel (phone), url, number. Bind value with $bindState so the typed value is captured in state; emits a \"change\" event on every keystroke. Prefer this over Listbox when the value is not from a fixed list. disabled: true prevents editing."
|
|
1030
|
+
}, Yn = {
|
|
1031
|
+
props: w.object({
|
|
1032
|
+
data: w.array(w.record(w.string(), w.union([w.string(), w.number()]))),
|
|
1033
|
+
series: w.array(w.string()).optional(),
|
|
1034
|
+
theme: w.enum([
|
|
1035
|
+
"monochrome",
|
|
1036
|
+
"categorical",
|
|
1037
|
+
"semantic"
|
|
1038
|
+
]).optional(),
|
|
1039
|
+
showLegend: w.boolean().optional(),
|
|
1040
|
+
showDots: w.boolean().optional(),
|
|
1041
|
+
height: w.number().optional(),
|
|
1042
|
+
unit: w.string().optional()
|
|
1043
|
+
}),
|
|
1044
|
+
slots: [],
|
|
1045
|
+
description: "Line chart for tracking trends over time with optional multiple series. data: array of objects with a \"category\" key (x-axis label) and one numeric key per series (e.g. [{category: \"Jan\", revenue: 100, cost: 60}]). series: explicit list of series keys to plot (inferred from data keys if omitted, max 6). theme: monochrome (1-2 series), categorical (3-6 distinct). showLegend: true when multiple series (default true for 2+ series). showDots: true adds data-point markers (default true). unit: tooltip value suffix."
|
|
1046
|
+
}, Xn = {
|
|
1047
|
+
props: w.object({
|
|
1048
|
+
label: w.string(),
|
|
1049
|
+
href: w.string(),
|
|
1050
|
+
appearance: w.enum(["primary", "secondary"]).optional(),
|
|
1051
|
+
target: w.enum(["_blank", "_self"]).optional(),
|
|
1052
|
+
ghost: w.boolean().optional(),
|
|
1053
|
+
badge: w.string().optional()
|
|
1054
|
+
}),
|
|
1055
|
+
slots: [],
|
|
1056
|
+
events: ["press"],
|
|
1057
|
+
description: "Inline navigation link (renders an <a>). Emits a \"press\" event when clicked — handle navigation in on.press; href and target are inputs for the host/router rather than native browser navigation. href: destination URL for the host/router. appearance: primary (default) | secondary. target: _blank marks the link as external (shows external-link icon) and lets the host open a new tab if desired. ghost: quieter styling (primary only). badge: optional notification count shown as a superscript (e.g. \"5\"); use an empty string for a dot-only indicator."
|
|
1058
|
+
}, Zn = {
|
|
1059
|
+
props: w.object({
|
|
1060
|
+
label: w.string(),
|
|
1061
|
+
options: w.array(w.object({
|
|
1062
|
+
value: w.string(),
|
|
1063
|
+
label: w.string()
|
|
1064
|
+
})),
|
|
1065
|
+
value: w.string().optional(),
|
|
1066
|
+
disabled: w.boolean().optional()
|
|
1067
|
+
}),
|
|
1068
|
+
slots: [],
|
|
1069
|
+
events: ["change"],
|
|
1070
|
+
description: "Single-select dropdown for choosing one value from a fixed list of known options. options: [{ value, label }] — value is stored in state, label is shown. Bind the selection with $bindState on value; emits a \"change\" event on selection. Use only when options are predefined; for free-text user input use Input, and for 2–7 visible mutually-exclusive choices prefer RadioGroup. disabled: true prevents selection."
|
|
1071
|
+
}, Qn = {
|
|
1072
|
+
props: w.object({
|
|
1073
|
+
label: w.string(),
|
|
1074
|
+
value: w.number().min(0).max(100).optional(),
|
|
1075
|
+
description: w.string().optional(),
|
|
1076
|
+
indeterminate: w.boolean().optional()
|
|
1077
|
+
}),
|
|
1078
|
+
slots: [],
|
|
1079
|
+
description: "Horizontal progress bar showing task completion. label is required (the accessible name for the bar). value: 0–100 percentage filled. Omit value and set indeterminate=true when progress cannot be measured (do not set both). description: optional helper text shown below the bar."
|
|
1080
|
+
}, $n = {
|
|
1081
|
+
props: w.object({
|
|
1082
|
+
label: w.string(),
|
|
1083
|
+
options: w.array(w.object({
|
|
1084
|
+
value: w.string(),
|
|
1085
|
+
label: w.string()
|
|
1086
|
+
})),
|
|
1087
|
+
value: w.string().optional(),
|
|
1088
|
+
disabled: w.boolean().optional()
|
|
1089
|
+
}),
|
|
1090
|
+
slots: [],
|
|
1091
|
+
events: ["change"],
|
|
1092
|
+
description: "Group of radio buttons for picking one option from 2–7 visible mutually-exclusive choices. options: [{ value, label }]. Bind the selection with $bindState on value; emits a \"change\" event on selection. For longer option lists use Listbox. disabled: true prevents selection."
|
|
1093
|
+
}, er = {
|
|
1094
|
+
props: w.object({
|
|
1095
|
+
label: w.string(),
|
|
1096
|
+
checked: w.boolean().optional(),
|
|
1097
|
+
disabled: w.boolean().optional()
|
|
1098
|
+
}),
|
|
1099
|
+
slots: [],
|
|
1100
|
+
events: ["change"],
|
|
1101
|
+
description: "Toggle switch for a single binary on/off setting with immediate effect (no form submit). Prefer over Checkbox for enabling/disabling features. Bind state with $bindState on checked; emits a \"change\" event when toggled. disabled: true prevents toggling."
|
|
1102
|
+
}, tr = {
|
|
1103
|
+
props: w.object({
|
|
1104
|
+
content: w.string(),
|
|
1105
|
+
variant: w.enum([
|
|
1106
|
+
"headline",
|
|
1107
|
+
"body",
|
|
1108
|
+
"eyebrow"
|
|
1109
|
+
]).optional(),
|
|
1110
|
+
size: w.enum([
|
|
1111
|
+
"small",
|
|
1112
|
+
"medium",
|
|
1113
|
+
"large",
|
|
1114
|
+
"xlarge"
|
|
1115
|
+
]).optional(),
|
|
1116
|
+
subdued: w.boolean().optional()
|
|
1117
|
+
}),
|
|
1118
|
+
slots: [],
|
|
1119
|
+
description: "Display text. variant: headline=bold title, eyebrow=small uppercase label, body=default (default variant). size: small | medium (default) | large | xlarge — applies to headline and body only (ignored for eyebrow). subdued: deemphasized secondary text (body only). Use eyebrow+headline pairs for KPI/stat labels above values."
|
|
1120
|
+
}, nr = {
|
|
1121
|
+
props: w.object({
|
|
1122
|
+
label: w.string(),
|
|
1123
|
+
placeholder: w.string().optional(),
|
|
1124
|
+
description: w.string().optional(),
|
|
1125
|
+
moreInfo: w.string().optional(),
|
|
1126
|
+
value: w.string().optional(),
|
|
1127
|
+
rows: w.number().optional(),
|
|
1128
|
+
disabled: w.boolean().optional()
|
|
1129
|
+
}),
|
|
1130
|
+
slots: [],
|
|
1131
|
+
events: ["change"],
|
|
1132
|
+
description: "Multi-line free-text input for long values (notes, descriptions, email body). Bind value with $bindState; emits a \"change\" event on every keystroke. rows: visible row count (default 3). description: helper text below the field. moreInfo: tooltip text on the label. disabled: true prevents editing."
|
|
1133
|
+
}, V = {
|
|
1134
|
+
Text: tr,
|
|
1135
|
+
Card: Vn,
|
|
1136
|
+
Flex: Kn,
|
|
1137
|
+
Grid: B,
|
|
1138
|
+
Alert: Rn,
|
|
1139
|
+
Divider: Wn,
|
|
1140
|
+
Icon: qn,
|
|
1141
|
+
Chip: Un,
|
|
1142
|
+
Link: Xn,
|
|
1143
|
+
ProgressBar: Qn,
|
|
1144
|
+
BarChart: zn,
|
|
1145
|
+
DonutChart: Gn,
|
|
1146
|
+
LineChart: Yn,
|
|
1147
|
+
Button: Bn,
|
|
1148
|
+
Checkbox: Hn,
|
|
1149
|
+
Input: Jn,
|
|
1150
|
+
Textarea: nr,
|
|
1151
|
+
Listbox: Zn,
|
|
1152
|
+
RadioGroup: $n,
|
|
1153
|
+
Switch: er
|
|
1154
|
+
};
|
|
1155
|
+
//#endregion
|
|
1156
|
+
//#region src/scoped-catalog.ts
|
|
1157
|
+
function H(e = {}) {
|
|
1158
|
+
let { core: t = "all", overrides: n = {}, components: r = {} } = e, i = {
|
|
1159
|
+
...t === "all" ? { ...V } : Object.fromEntries(t.map((e) => {
|
|
1160
|
+
let t = V[e];
|
|
1161
|
+
if (!t) throw Error(`Unknown core component: ${String(e)}`);
|
|
1162
|
+
return [e, t];
|
|
1163
|
+
})),
|
|
1164
|
+
...r
|
|
1165
|
+
};
|
|
1166
|
+
for (let [e, t] of Object.entries(n)) {
|
|
1167
|
+
let n = i[e];
|
|
1168
|
+
if (!n || !t) continue;
|
|
1169
|
+
let r = t.description ?? (t.append ? `${n.description} ${t.append}` : n.description);
|
|
1170
|
+
i[e] = {
|
|
1171
|
+
...n,
|
|
1172
|
+
description: r
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
return i;
|
|
1176
|
+
}
|
|
1177
|
+
function rr(e) {
|
|
1178
|
+
return e;
|
|
1179
|
+
}
|
|
1180
|
+
function ir(e) {
|
|
1181
|
+
let t = H({
|
|
1182
|
+
core: e.core ?? "all",
|
|
1183
|
+
...e.overrides ? { overrides: e.overrides } : {},
|
|
1184
|
+
...e.components ? { components: e.components } : {}
|
|
1185
|
+
}), n = Object.fromEntries(Object.entries(e.actions ?? {}).map(([t, n]) => [`${e.prefix}.${t}`, n])), r = T(D, {
|
|
1186
|
+
components: t,
|
|
1187
|
+
actions: {
|
|
1188
|
+
...z,
|
|
1189
|
+
...n
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
return {
|
|
1193
|
+
prefix: e.prefix,
|
|
1194
|
+
catalog: r,
|
|
1195
|
+
prompt(t) {
|
|
1196
|
+
let n = [
|
|
1197
|
+
r.prompt(),
|
|
1198
|
+
"\n",
|
|
1199
|
+
t
|
|
1200
|
+
];
|
|
1201
|
+
return e.rules && n.push("\n", e.rules), n.join("");
|
|
1202
|
+
},
|
|
1203
|
+
jsonSchema() {
|
|
1204
|
+
return r.jsonSchema();
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
var ar = H({
|
|
1209
|
+
core: [
|
|
1210
|
+
"Text",
|
|
1211
|
+
"Chip",
|
|
1212
|
+
"Link",
|
|
1213
|
+
"Alert"
|
|
1214
|
+
],
|
|
1215
|
+
overrides: { Link: { append: "In a context panel, links appear inside content primitives (ContextList, ContextTabularList identifier links, ContextNoteList, etc.); use a standalone Link only for inline references within rich text." } },
|
|
1216
|
+
components: {
|
|
1217
|
+
...L,
|
|
1218
|
+
...R
|
|
1219
|
+
}
|
|
1220
|
+
}), or = T(D, {
|
|
1221
|
+
components: ar,
|
|
1222
|
+
actions: z
|
|
1223
|
+
}), U = [
|
|
1224
|
+
{
|
|
1225
|
+
name: "ContextPanel",
|
|
1226
|
+
catalog: L.ContextPanel,
|
|
1227
|
+
renderer: Sn,
|
|
1228
|
+
renderers: ["context"]
|
|
1229
|
+
},
|
|
1230
|
+
{
|
|
1231
|
+
name: "ContextOverview",
|
|
1232
|
+
catalog: L.ContextOverview,
|
|
1233
|
+
renderer: bn,
|
|
1234
|
+
renderers: ["context"]
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
name: "ContextCard",
|
|
1238
|
+
catalog: L.ContextCard,
|
|
1239
|
+
renderer: dt,
|
|
1240
|
+
renderers: ["context"]
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
name: "ContextNoteList",
|
|
1244
|
+
catalog: R.ContextNoteList,
|
|
1245
|
+
renderer: gn,
|
|
1246
|
+
renderers: ["context"]
|
|
1247
|
+
},
|
|
1248
|
+
{
|
|
1249
|
+
name: "ContextMetricGrid",
|
|
1250
|
+
catalog: R.ContextMetricGrid,
|
|
1251
|
+
renderer: on,
|
|
1252
|
+
renderers: ["context"]
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
name: "ContextDataTable",
|
|
1256
|
+
catalog: R.ContextDataTable,
|
|
1257
|
+
renderer: bt,
|
|
1258
|
+
renderers: ["context"]
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
name: "ContextList",
|
|
1262
|
+
catalog: R.ContextList,
|
|
1263
|
+
renderer: $t,
|
|
1264
|
+
renderers: ["context"]
|
|
1265
|
+
},
|
|
1266
|
+
{
|
|
1267
|
+
name: "ContextTabularList",
|
|
1268
|
+
catalog: R.ContextTabularList,
|
|
1269
|
+
renderer: In,
|
|
1270
|
+
renderers: ["context"]
|
|
1271
|
+
},
|
|
1272
|
+
{
|
|
1273
|
+
name: "ContextFileList",
|
|
1274
|
+
catalog: R.ContextFileList,
|
|
1275
|
+
renderer: Vt,
|
|
1276
|
+
renderers: ["context"]
|
|
1277
|
+
}
|
|
1278
|
+
];
|
|
1279
|
+
Object.fromEntries(U.filter(({ name: e }) => e in L).map(({ name: e, renderer: t }) => [e, t])), Object.fromEntries(U.filter(({ name: e }) => e in R).map(({ name: e, renderer: t }) => [e, t]));
|
|
1280
|
+
//#endregion
|
|
1281
|
+
//#region src/context/constants.ts
|
|
1282
|
+
var sr = [
|
|
1283
|
+
"ContextPanel",
|
|
1284
|
+
"ContextOverview",
|
|
1285
|
+
"ContextCard"
|
|
1286
|
+
], cr = ["ContextOverview", "ContextCard"];
|
|
1287
|
+
function lr(e) {
|
|
1288
|
+
return sr.includes(e);
|
|
1289
|
+
}
|
|
1290
|
+
function ur(e) {
|
|
1291
|
+
return cr.includes(e);
|
|
1292
|
+
}
|
|
1293
|
+
//#endregion
|
|
1294
|
+
//#region src/context/validate-context-spec.ts
|
|
1295
|
+
function W(e, t) {
|
|
1296
|
+
return e.elements[t];
|
|
1297
|
+
}
|
|
1298
|
+
function dr(e, t, n = /* @__PURE__ */ new Set()) {
|
|
1299
|
+
let r = W(e, t);
|
|
1300
|
+
if (!r || n.has(t)) return n;
|
|
1301
|
+
n.add(t);
|
|
1302
|
+
for (let t of r.children ?? []) dr(e, t, n);
|
|
1303
|
+
return n;
|
|
1304
|
+
}
|
|
1305
|
+
function G(e) {
|
|
1306
|
+
let t = [], n = e.root, r = W(e, n);
|
|
1307
|
+
if (!r) return t.push({
|
|
1308
|
+
path: "/root",
|
|
1309
|
+
message: "Root element is missing from elements map."
|
|
1310
|
+
}), t;
|
|
1311
|
+
if (r.type !== "ContextPanel") return t.push({
|
|
1312
|
+
path: `/elements/${n}`,
|
|
1313
|
+
message: `Root must be ContextPanel, got "${r.type}".`
|
|
1314
|
+
}), t;
|
|
1315
|
+
let i = 0;
|
|
1316
|
+
for (let n of r.children ?? []) {
|
|
1317
|
+
let r = W(e, n);
|
|
1318
|
+
if (!r) {
|
|
1319
|
+
t.push({
|
|
1320
|
+
path: `/elements/${n}`,
|
|
1321
|
+
message: `Child "${n}" referenced by ContextPanel is missing.`
|
|
1322
|
+
});
|
|
1323
|
+
continue;
|
|
1324
|
+
}
|
|
1325
|
+
if (!ur(r.type)) {
|
|
1326
|
+
t.push({
|
|
1327
|
+
path: `/elements/${n}`,
|
|
1328
|
+
message: `Direct child of ContextPanel must be ContextOverview or ContextCard — got "${r.type}".`
|
|
1329
|
+
});
|
|
1330
|
+
continue;
|
|
1331
|
+
}
|
|
1332
|
+
r.type === "ContextOverview" && (i += 1, i > 1 && t.push({
|
|
1333
|
+
path: `/elements/${n}`,
|
|
1334
|
+
message: "ContextOverview may appear at most once in ContextPanel."
|
|
1335
|
+
}));
|
|
1336
|
+
for (let r of dr(e, n)) {
|
|
1337
|
+
if (r === n) continue;
|
|
1338
|
+
let i = W(e, r);
|
|
1339
|
+
i && lr(i.type) && t.push({
|
|
1340
|
+
path: `/elements/${r}`,
|
|
1341
|
+
message: `Shell component "${i.type}" cannot be nested inside a card.`
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
return t;
|
|
1346
|
+
}
|
|
1347
|
+
function K(e) {
|
|
1348
|
+
return e.map((e) => `${(e.severity ?? "error").toUpperCase()} ${e.path}: ${e.message}`).join("\n");
|
|
1349
|
+
}
|
|
1350
|
+
//#endregion
|
|
1351
|
+
//#region src/context/validate-context-spec-deep.ts
|
|
1352
|
+
function q(e, t, n, r) {
|
|
1353
|
+
e.push({
|
|
1354
|
+
path: t,
|
|
1355
|
+
message: n,
|
|
1356
|
+
severity: r
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
function fr(e, t) {
|
|
1360
|
+
return t.length === 0 ? e : `${e}/${t.map((e) => typeof e == "number" ? `[${e}]` : `.${String(e)}`).join("").replace(/^\./, "")}`;
|
|
1361
|
+
}
|
|
1362
|
+
function pr(e) {
|
|
1363
|
+
return ar[e];
|
|
1364
|
+
}
|
|
1365
|
+
function mr(e) {
|
|
1366
|
+
return (e?.slots?.length ?? 0) === 0;
|
|
1367
|
+
}
|
|
1368
|
+
function hr(e, t) {
|
|
1369
|
+
for (let [n, r] of Object.entries(e.elements)) r && r.type === "ContextCard" && r.props.defaultExpanded === !1 && q(t, `/elements/${n}/props/defaultExpanded`, "defaultExpanded: false shows only the card header until the user expands the card.", "warn");
|
|
1370
|
+
}
|
|
1371
|
+
function gr(e) {
|
|
1372
|
+
let t = [];
|
|
1373
|
+
for (let n of G(e)) q(t, n.path, n.message, "error");
|
|
1374
|
+
let n = De(e);
|
|
1375
|
+
if (!n.valid) for (let e of n.issues) q(t, e.elementKey ? `/elements/${e.elementKey}` : "/", e.message, e.severity === "warning" ? "warn" : "error");
|
|
1376
|
+
let r = or.validate(e);
|
|
1377
|
+
if (!r.success && r.error) for (let e of r.error.issues) {
|
|
1378
|
+
let n = e.path.length > 0 ? `/${e.path.join("/")}` : "/";
|
|
1379
|
+
n.endsWith("/visible") || n.endsWith("/children") && e.message.includes("expected array, received undefined") || q(t, n, e.message, "error");
|
|
1380
|
+
}
|
|
1381
|
+
for (let [n, r] of Object.entries(e.elements)) {
|
|
1382
|
+
if (!r) continue;
|
|
1383
|
+
let e = pr(r.type);
|
|
1384
|
+
if (!e) {
|
|
1385
|
+
q(t, `/elements/${n}`, `Unknown component type "${r.type}" for context catalog.`, "error");
|
|
1386
|
+
continue;
|
|
1387
|
+
}
|
|
1388
|
+
if (e.props) {
|
|
1389
|
+
let i = e.props.safeParse(r.props ?? {});
|
|
1390
|
+
if (!i.success) for (let e of i.error.issues) q(t, fr(`/elements/${n}/props`, e.path), e.message, "error");
|
|
1391
|
+
}
|
|
1392
|
+
let i = r.children, a = mr(e);
|
|
1393
|
+
i === void 0 && a && q(t, `/elements/${n}/children`, `Leaf element "${r.type}" should include "children": [].`, "warn"), a && (i?.length ?? 0) > 0 && q(t, `/elements/${n}/children`, `Leaf component "${r.type}" must not have children.`, "error");
|
|
1394
|
+
}
|
|
1395
|
+
return hr(e, t), t;
|
|
1396
|
+
}
|
|
1397
|
+
function _r(e) {
|
|
1398
|
+
let t = [], n = structuredClone(e);
|
|
1399
|
+
for (let [e, r] of Object.entries(n.elements)) {
|
|
1400
|
+
if (!r) continue;
|
|
1401
|
+
let n = mr(pr(r.type));
|
|
1402
|
+
r.children === void 0 && n && (r.children = [], t.push(`Added children: [] to leaf element "${e}".`)), n && r.children && r.children.length > 0 && (r.children = [], t.push(`Removed illegal children from leaf element "${e}".`));
|
|
1403
|
+
}
|
|
1404
|
+
return {
|
|
1405
|
+
spec: n,
|
|
1406
|
+
fixes: t
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
function vr(e) {
|
|
1410
|
+
return e.some((e) => e.severity !== "warn");
|
|
1411
|
+
}
|
|
1412
|
+
function yr(e) {
|
|
1413
|
+
return K(gr(e));
|
|
1414
|
+
}
|
|
1415
|
+
//#endregion
|
|
1416
|
+
//#region src/core/catalog/alert.tsx
|
|
1417
|
+
var br = ({ props: e, emit: n, children: r }) => /* @__PURE__ */ S(t, {
|
|
1418
|
+
title: e.title,
|
|
1419
|
+
status: e.status ?? "info",
|
|
1420
|
+
...e.aiMark ? { aiMark: !0 } : {},
|
|
1421
|
+
...e.dismissible ? { onClose: () => n("close") } : {},
|
|
1422
|
+
children: r
|
|
1423
|
+
}), J = "zf6dad0";
|
|
1424
|
+
//#endregion
|
|
1425
|
+
//#region src/core/catalog/chart-utils.ts
|
|
1426
|
+
function Y(e, t = "monochrome") {
|
|
1427
|
+
let n = {
|
|
1428
|
+
monochrome: Pe,
|
|
1429
|
+
categorical: Ne,
|
|
1430
|
+
semantic: Fe
|
|
1431
|
+
}[t] ?? Pe;
|
|
1432
|
+
e.setThemes([Me.new(e), n.new(e)]);
|
|
1433
|
+
}
|
|
1434
|
+
//#endregion
|
|
1435
|
+
//#region src/core/catalog/bar-chart.tsx
|
|
1436
|
+
var xr = ({ props: e }) => {
|
|
1437
|
+
let t = y(null);
|
|
1438
|
+
return _(() => {
|
|
1439
|
+
let n = t.current;
|
|
1440
|
+
if (!n) return;
|
|
1441
|
+
let r, i = () => {
|
|
1442
|
+
r && r.dispose(), r = k.Root.new(n), Y(r, e.theme);
|
|
1443
|
+
let t = r.container.children.push(A.XYChart.new(r, { paddingLeft: 0 }));
|
|
1444
|
+
if (e.orientation === "horizontal") {
|
|
1445
|
+
let n = t.yAxes.push(A.CategoryAxis.new(r, {
|
|
1446
|
+
categoryField: "category",
|
|
1447
|
+
renderer: A.AxisRendererY.new(r, { minGridDistance: 20 })
|
|
1448
|
+
})), i = t.xAxes.push(A.ValueAxis.new(r, { renderer: A.AxisRendererX.new(r, {}) })), a = t.series.push(A.ColumnSeries.new(r, {
|
|
1449
|
+
xAxis: i,
|
|
1450
|
+
yAxis: n,
|
|
1451
|
+
valueXField: "value",
|
|
1452
|
+
categoryYField: "category"
|
|
1453
|
+
}));
|
|
1454
|
+
a.columns.template.setAll({ tooltipText: `{categoryY}: ${e.unit ?? ""}{valueX}` }), n.data.setAll(e.data), a.data.setAll(e.data);
|
|
1455
|
+
} else {
|
|
1456
|
+
let n = t.xAxes.push(A.CategoryAxis.new(r, {
|
|
1457
|
+
categoryField: "category",
|
|
1458
|
+
renderer: A.AxisRendererX.new(r, { minGridDistance: 30 })
|
|
1459
|
+
})), i = t.yAxes.push(A.ValueAxis.new(r, { renderer: A.AxisRendererY.new(r, {}) })), a = t.series.push(A.ColumnSeries.new(r, {
|
|
1460
|
+
xAxis: n,
|
|
1461
|
+
yAxis: i,
|
|
1462
|
+
valueYField: "value",
|
|
1463
|
+
categoryXField: "category"
|
|
1464
|
+
}));
|
|
1465
|
+
a.columns.template.setAll({ tooltipText: `{categoryX}: ${e.unit ?? ""}{valueY}` }), n.data.setAll(e.data), a.data.setAll(e.data);
|
|
1466
|
+
}
|
|
1467
|
+
}, a = new ResizeObserver((e) => {
|
|
1468
|
+
(e[0]?.contentRect.width ?? 0) > 0 && !r && i();
|
|
1469
|
+
});
|
|
1470
|
+
return a.observe(n), n.offsetWidth > 0 && i(), () => {
|
|
1471
|
+
a.disconnect(), r?.dispose();
|
|
1472
|
+
};
|
|
1473
|
+
}, []), /* @__PURE__ */ S("div", {
|
|
1474
|
+
ref: t,
|
|
1475
|
+
className: J,
|
|
1476
|
+
style: { height: e.height ?? 300 }
|
|
1477
|
+
});
|
|
1478
|
+
};
|
|
1479
|
+
//#endregion
|
|
1480
|
+
//#region src/utils/defined-props.ts
|
|
1481
|
+
function X(e) {
|
|
1482
|
+
let t = {};
|
|
1483
|
+
for (let n of Object.keys(e)) {
|
|
1484
|
+
let r = e[n];
|
|
1485
|
+
r !== void 0 && (t[n] = r);
|
|
1486
|
+
}
|
|
1487
|
+
return t;
|
|
1488
|
+
}
|
|
1489
|
+
//#endregion
|
|
1490
|
+
//#region src/core/catalog/button.tsx
|
|
1491
|
+
var Sr = ({ props: e, emit: t }) => /* @__PURE__ */ C(r, {
|
|
1492
|
+
appearance: e.appearance ?? "secondary",
|
|
1493
|
+
...X({
|
|
1494
|
+
size: e.size,
|
|
1495
|
+
loading: e.loading,
|
|
1496
|
+
disabled: e.disabled
|
|
1497
|
+
}),
|
|
1498
|
+
onClick: () => t("press"),
|
|
1499
|
+
children: [e.label, e.badge === void 0 ? null : /* @__PURE__ */ S(n, {
|
|
1500
|
+
"aria-label": e.badge ? `${e.badge} unread` : "unread",
|
|
1501
|
+
children: e.badge
|
|
1502
|
+
})]
|
|
1503
|
+
}), Cr = ({ props: e, children: t }) => {
|
|
1504
|
+
let n = e.title !== void 0 || e.description !== void 0;
|
|
1505
|
+
return /* @__PURE__ */ C(i, {
|
|
1506
|
+
flexDirection: "column",
|
|
1507
|
+
gap: "3",
|
|
1508
|
+
...X({
|
|
1509
|
+
background: e.background,
|
|
1510
|
+
padding: e.padding
|
|
1511
|
+
}),
|
|
1512
|
+
children: [n ? /* @__PURE__ */ C(l, {
|
|
1513
|
+
direction: "column",
|
|
1514
|
+
gap: "half",
|
|
1515
|
+
children: [e.title === void 0 ? null : /* @__PURE__ */ S(p, {
|
|
1516
|
+
variant: "headline",
|
|
1517
|
+
el: "h3",
|
|
1518
|
+
size: "small",
|
|
1519
|
+
children: e.title
|
|
1520
|
+
}), e.description === void 0 ? null : /* @__PURE__ */ S(p, {
|
|
1521
|
+
variant: "body",
|
|
1522
|
+
subdued: !0,
|
|
1523
|
+
children: e.description
|
|
1524
|
+
})]
|
|
1525
|
+
}) : null, t]
|
|
1526
|
+
});
|
|
1527
|
+
}, wr = T(D, {
|
|
1528
|
+
components: V,
|
|
1529
|
+
actions: z
|
|
1530
|
+
}), Tr = ({ props: e, bindings: t, emit: n }) => {
|
|
1531
|
+
let r = t?.checked, { state: i, set: o } = O(), s = r ? E(i, r) : void 0, c = r ? s ?? e.checked ?? !1 : e.checked ?? !1;
|
|
1532
|
+
return /* @__PURE__ */ S(a, {
|
|
1533
|
+
label: e.label,
|
|
1534
|
+
checked: c,
|
|
1535
|
+
...X({ disabled: e.disabled }),
|
|
1536
|
+
onClick: (e, t) => {
|
|
1537
|
+
r && o(r, !(t?.checked ?? !1)), n("change");
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
}, Er = {
|
|
1541
|
+
"check-circle": Ie,
|
|
1542
|
+
"in-progress": Re,
|
|
1543
|
+
"radio-button-unchecked": Le
|
|
1544
|
+
}, Dr = ({ props: e, emit: t }) => {
|
|
1545
|
+
let n = e.icon ? Er[e.icon] : void 0, r = e.removable && e.size !== "small" ? () => t("close") : void 0;
|
|
1546
|
+
return /* @__PURE__ */ S(o, {
|
|
1547
|
+
label: e.label,
|
|
1548
|
+
...X({
|
|
1549
|
+
size: e.size,
|
|
1550
|
+
color: e.color,
|
|
1551
|
+
icon: n,
|
|
1552
|
+
onClose: r
|
|
1553
|
+
})
|
|
1554
|
+
});
|
|
1555
|
+
}, Or = ({ props: e }) => /* @__PURE__ */ S(s, { ...X({
|
|
1556
|
+
vertical: e.vertical,
|
|
1557
|
+
spacing: e.spacing,
|
|
1558
|
+
alignContent: e.alignContent
|
|
1559
|
+
}) }), kr = ({ props: e }) => {
|
|
1560
|
+
let t = y(null);
|
|
1561
|
+
return _(() => {
|
|
1562
|
+
let n = t.current;
|
|
1563
|
+
if (!n) return;
|
|
1564
|
+
let r, i = () => {
|
|
1565
|
+
r && r.dispose(), r = k.Root.new(n), Y(r, e.theme);
|
|
1566
|
+
let t = r.container.children.push(ze.PieChart.new(r, {
|
|
1567
|
+
layout: r.horizontalLayout,
|
|
1568
|
+
innerRadius: k.percent(50)
|
|
1569
|
+
})), i = t.series.push(ze.PieSeries.new(r, {
|
|
1570
|
+
valueField: "value",
|
|
1571
|
+
categoryField: "category",
|
|
1572
|
+
legendValueText: ""
|
|
1573
|
+
}));
|
|
1574
|
+
i.labels.template.set("text", "{valuePercentTotal.formatNumber('#.')}%"), i.data.setAll(e.data), (e.showLegend ?? !0) && t.children.push(k.Legend.new(r, {
|
|
1575
|
+
centerY: k.percent(50),
|
|
1576
|
+
y: k.percent(50),
|
|
1577
|
+
layout: r.verticalLayout
|
|
1578
|
+
})).data.setAll(i.dataItems);
|
|
1579
|
+
}, a = new ResizeObserver((e) => {
|
|
1580
|
+
(e[0]?.contentRect.width ?? 0) > 0 && !r && i();
|
|
1581
|
+
});
|
|
1582
|
+
return a.observe(n), n.offsetWidth > 0 && i(), () => {
|
|
1583
|
+
a.disconnect(), r?.dispose();
|
|
1584
|
+
};
|
|
1585
|
+
}, []), /* @__PURE__ */ S("div", {
|
|
1586
|
+
ref: t,
|
|
1587
|
+
className: J,
|
|
1588
|
+
style: { height: e.height ?? 300 }
|
|
1589
|
+
});
|
|
1590
|
+
}, Ar = ({ props: e, children: t }) => /* @__PURE__ */ S(l, {
|
|
1591
|
+
...X({
|
|
1592
|
+
direction: e.direction,
|
|
1593
|
+
gap: e.gap,
|
|
1594
|
+
alignItems: e.alignItems,
|
|
1595
|
+
justifyContent: e.justifyContent,
|
|
1596
|
+
alignSelf: e.alignSelf,
|
|
1597
|
+
wrap: e.wrap,
|
|
1598
|
+
grow: e.grow,
|
|
1599
|
+
shrink: e.shrink,
|
|
1600
|
+
basis: e.basis,
|
|
1601
|
+
inline: e.inline
|
|
1602
|
+
}),
|
|
1603
|
+
children: t
|
|
1604
|
+
}), jr = (...e) => e.filter(Boolean).join(" "), Mr = "_1v76lkh0", Nr = "_1v76lkh1";
|
|
1605
|
+
//#endregion
|
|
1606
|
+
//#region src/core/catalog/grid.tsx
|
|
1607
|
+
function Pr(e) {
|
|
1608
|
+
let t = e.match(/repeat\(\s*(\d+)/);
|
|
1609
|
+
return t?.[1] ? Number(t[1]) : e.trim().split(/\s+/).length;
|
|
1610
|
+
}
|
|
1611
|
+
var Fr = ({ props: e, children: t }) => {
|
|
1612
|
+
if (e.bordered) {
|
|
1613
|
+
let n = e.templateColumns ?? "1fr", r = g.count(t), i = Math.max(1, Pr(n)), a = Math.max(0, r - (r % i || i));
|
|
1614
|
+
return /* @__PURE__ */ S("div", {
|
|
1615
|
+
className: Mr,
|
|
1616
|
+
style: { gridTemplateColumns: n },
|
|
1617
|
+
children: g.map(t, (e, t) => /* @__PURE__ */ S("div", {
|
|
1618
|
+
className: jr(Nr, t < a && "_1v76lkh2"),
|
|
1619
|
+
children: e
|
|
1620
|
+
}))
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
return /* @__PURE__ */ S(u, {
|
|
1624
|
+
templateColumns: e.templateColumns,
|
|
1625
|
+
gap: e.gap ?? "2",
|
|
1626
|
+
children: t
|
|
1627
|
+
});
|
|
1628
|
+
}, Ir = {
|
|
1629
|
+
"check-circle": Ie,
|
|
1630
|
+
"in-progress": Re,
|
|
1631
|
+
"radio-button-unchecked": Le
|
|
1632
|
+
}, Lr = ({ props: e }) => {
|
|
1633
|
+
let t = Ir[e.name];
|
|
1634
|
+
return t ? /* @__PURE__ */ S(d, {
|
|
1635
|
+
svg: t,
|
|
1636
|
+
...X({
|
|
1637
|
+
size: e.size,
|
|
1638
|
+
color: e.color
|
|
1639
|
+
})
|
|
1640
|
+
}) : null;
|
|
1641
|
+
}, Rr = ({ props: e, bindings: t, emit: n }) => {
|
|
1642
|
+
let r = t?.value, { state: i, set: a } = O(), o = r ? E(i, r) : void 0, s = r ? o ?? e.value ?? "" : e.value ?? "";
|
|
1643
|
+
return /* @__PURE__ */ S(se, {
|
|
1644
|
+
label: e.label,
|
|
1645
|
+
type: e.type ?? "text",
|
|
1646
|
+
value: s,
|
|
1647
|
+
...X({
|
|
1648
|
+
placeholder: e.placeholder,
|
|
1649
|
+
disabled: e.disabled
|
|
1650
|
+
}),
|
|
1651
|
+
onChange: (e) => {
|
|
1652
|
+
r && a(r, e.target.value), n("change");
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
}, zr = ({ props: e }) => {
|
|
1656
|
+
let t = y(null);
|
|
1657
|
+
return _(() => {
|
|
1658
|
+
let n = t.current;
|
|
1659
|
+
if (!n) return;
|
|
1660
|
+
let r, i = () => {
|
|
1661
|
+
r && r.dispose(), r = k.Root.new(n), Y(r, e.theme);
|
|
1662
|
+
let t = r.container.children.push(A.XYChart.new(r, { paddingLeft: 0 })), i = t.xAxes.push(A.CategoryAxis.new(r, {
|
|
1663
|
+
categoryField: "category",
|
|
1664
|
+
renderer: A.AxisRendererX.new(r, { minGridDistance: 30 })
|
|
1665
|
+
})), a = t.yAxes.push(A.ValueAxis.new(r, { renderer: A.AxisRendererY.new(r, {}) })), o = e.data[0], s = e.series ?? (o ? Object.keys(o).filter((e) => e !== "category") : []);
|
|
1666
|
+
for (let n of s) {
|
|
1667
|
+
let o = t.series.push(A.LineSeries.new(r, {
|
|
1668
|
+
name: n,
|
|
1669
|
+
xAxis: i,
|
|
1670
|
+
yAxis: a,
|
|
1671
|
+
valueYField: n,
|
|
1672
|
+
categoryXField: "category",
|
|
1673
|
+
tooltip: k.Tooltip.new(r, { labelText: `${n}: ${e.unit ?? ""}{valueY}` })
|
|
1674
|
+
}));
|
|
1675
|
+
o.strokes.template.setAll({ strokeWidth: 2 }), (e.showDots ?? !0) && o.bullets.push(() => {
|
|
1676
|
+
if (!r) throw Error("Chart root is not initialized");
|
|
1677
|
+
let e = o.get("fill");
|
|
1678
|
+
return k.Bullet.new(r, { sprite: k.Circle.new(r, {
|
|
1679
|
+
radius: 4,
|
|
1680
|
+
...e ? { fill: e } : {},
|
|
1681
|
+
strokeWidth: 0
|
|
1682
|
+
}) });
|
|
1683
|
+
}), o.data.setAll(e.data);
|
|
1684
|
+
}
|
|
1685
|
+
i.data.setAll(e.data), (e.showLegend ?? s.length > 1) && t.children.push(k.Legend.new(r, {
|
|
1686
|
+
centerX: k.percent(50),
|
|
1687
|
+
x: k.percent(50),
|
|
1688
|
+
marginTop: 8
|
|
1689
|
+
})).data.setAll(t.series.values);
|
|
1690
|
+
}, a = new ResizeObserver((e) => {
|
|
1691
|
+
(e[0]?.contentRect.width ?? 0) > 0 && !r && i();
|
|
1692
|
+
});
|
|
1693
|
+
return a.observe(n), n.offsetWidth > 0 && i(), () => {
|
|
1694
|
+
a.disconnect(), r?.dispose();
|
|
1695
|
+
};
|
|
1696
|
+
}, []), /* @__PURE__ */ S("div", {
|
|
1697
|
+
ref: t,
|
|
1698
|
+
className: J,
|
|
1699
|
+
style: { height: e.height ?? 300 }
|
|
1700
|
+
});
|
|
1701
|
+
}, Br = ({ props: e, emit: t }) => {
|
|
1702
|
+
let { label: r, href: i, appearance: a, target: o, ghost: s, badge: c } = e, l = (e) => {
|
|
1703
|
+
e.preventDefault(), t("press");
|
|
1704
|
+
}, u = c === void 0 ? r : /* @__PURE__ */ C("span", {
|
|
1705
|
+
style: {
|
|
1706
|
+
position: "relative",
|
|
1707
|
+
display: "inline-flex",
|
|
1708
|
+
alignItems: "center"
|
|
1709
|
+
},
|
|
1710
|
+
children: [r, /* @__PURE__ */ S(n, {
|
|
1711
|
+
"aria-label": c ? `${c} unread` : "unread",
|
|
1712
|
+
offset: {
|
|
1713
|
+
x: "8px",
|
|
1714
|
+
y: "0px"
|
|
1715
|
+
},
|
|
1716
|
+
children: c
|
|
1717
|
+
})]
|
|
1718
|
+
});
|
|
1719
|
+
return a === "secondary" ? /* @__PURE__ */ S(f, {
|
|
1720
|
+
appearance: "secondary",
|
|
1721
|
+
ghost: !1,
|
|
1722
|
+
href: i,
|
|
1723
|
+
...o ? { target: o } : {},
|
|
1724
|
+
onClick: l,
|
|
1725
|
+
children: u
|
|
1726
|
+
}) : s === void 0 ? /* @__PURE__ */ S(f, {
|
|
1727
|
+
appearance: "primary",
|
|
1728
|
+
href: i,
|
|
1729
|
+
...o ? { target: o } : {},
|
|
1730
|
+
onClick: l,
|
|
1731
|
+
children: u
|
|
1732
|
+
}) : /* @__PURE__ */ S(f, {
|
|
1733
|
+
appearance: "primary",
|
|
1734
|
+
ghost: s,
|
|
1735
|
+
href: i,
|
|
1736
|
+
...o ? { target: o } : {},
|
|
1737
|
+
onClick: l,
|
|
1738
|
+
children: u
|
|
1739
|
+
});
|
|
1740
|
+
}, Vr = j({
|
|
1741
|
+
defaultClassName: "_1le8ba60",
|
|
1742
|
+
variantClassNames: { disabled: {
|
|
1743
|
+
true: "_1le8ba61",
|
|
1744
|
+
false: "_1le8ba62"
|
|
1745
|
+
} },
|
|
1746
|
+
defaultVariants: {},
|
|
1747
|
+
compoundVariants: []
|
|
1748
|
+
}), Hr = [
|
|
1749
|
+
{
|
|
1750
|
+
name: "Text",
|
|
1751
|
+
catalog: tr,
|
|
1752
|
+
renderer: ({ props: e }) => e.variant === "headline" ? e.size === void 0 ? /* @__PURE__ */ S(p, {
|
|
1753
|
+
variant: "headline",
|
|
1754
|
+
el: "h3",
|
|
1755
|
+
children: e.content
|
|
1756
|
+
}) : /* @__PURE__ */ S(p, {
|
|
1757
|
+
variant: "headline",
|
|
1758
|
+
el: "h3",
|
|
1759
|
+
size: e.size,
|
|
1760
|
+
children: e.content
|
|
1761
|
+
}) : e.variant === "eyebrow" ? /* @__PURE__ */ S(p, {
|
|
1762
|
+
variant: "eyebrow",
|
|
1763
|
+
children: e.content
|
|
1764
|
+
}) : e.size !== void 0 && e.subdued !== void 0 ? /* @__PURE__ */ S(p, {
|
|
1765
|
+
variant: "body",
|
|
1766
|
+
size: e.size,
|
|
1767
|
+
subdued: e.subdued,
|
|
1768
|
+
children: e.content
|
|
1769
|
+
}) : e.size === void 0 ? e.subdued === void 0 ? /* @__PURE__ */ S(p, {
|
|
1770
|
+
variant: "body",
|
|
1771
|
+
children: e.content
|
|
1772
|
+
}) : /* @__PURE__ */ S(p, {
|
|
1773
|
+
variant: "body",
|
|
1774
|
+
subdued: e.subdued,
|
|
1775
|
+
children: e.content
|
|
1776
|
+
}) : /* @__PURE__ */ S(p, {
|
|
1777
|
+
variant: "body",
|
|
1778
|
+
size: e.size,
|
|
1779
|
+
children: e.content
|
|
1780
|
+
}),
|
|
1781
|
+
renderers: ["all"]
|
|
1782
|
+
},
|
|
1783
|
+
{
|
|
1784
|
+
name: "Card",
|
|
1785
|
+
catalog: Vn,
|
|
1786
|
+
renderer: Cr,
|
|
1787
|
+
renderers: ["all"]
|
|
1788
|
+
},
|
|
1789
|
+
{
|
|
1790
|
+
name: "Flex",
|
|
1791
|
+
catalog: Kn,
|
|
1792
|
+
renderer: Ar,
|
|
1793
|
+
renderers: ["all"]
|
|
1794
|
+
},
|
|
1795
|
+
{
|
|
1796
|
+
name: "Grid",
|
|
1797
|
+
catalog: B,
|
|
1798
|
+
renderer: Fr,
|
|
1799
|
+
renderers: ["all"]
|
|
1800
|
+
},
|
|
1801
|
+
{
|
|
1802
|
+
name: "Alert",
|
|
1803
|
+
catalog: Rn,
|
|
1804
|
+
renderer: br,
|
|
1805
|
+
renderers: ["all"]
|
|
1806
|
+
},
|
|
1807
|
+
{
|
|
1808
|
+
name: "Divider",
|
|
1809
|
+
catalog: Wn,
|
|
1810
|
+
renderer: Or,
|
|
1811
|
+
renderers: ["all"]
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
name: "Icon",
|
|
1815
|
+
catalog: qn,
|
|
1816
|
+
renderer: Lr,
|
|
1817
|
+
renderers: ["all"]
|
|
1818
|
+
},
|
|
1819
|
+
{
|
|
1820
|
+
name: "Chip",
|
|
1821
|
+
catalog: Un,
|
|
1822
|
+
renderer: Dr,
|
|
1823
|
+
renderers: ["all"]
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
name: "Link",
|
|
1827
|
+
catalog: Xn,
|
|
1828
|
+
renderer: Br,
|
|
1829
|
+
renderers: ["all"]
|
|
1830
|
+
},
|
|
1831
|
+
{
|
|
1832
|
+
name: "ProgressBar",
|
|
1833
|
+
catalog: Qn,
|
|
1834
|
+
renderer: ({ props: e }) => {
|
|
1835
|
+
let t = X({ description: e.description });
|
|
1836
|
+
return e.indeterminate || e.value === void 0 ? /* @__PURE__ */ S(ne, {
|
|
1837
|
+
label: e.label,
|
|
1838
|
+
indeterminate: !0,
|
|
1839
|
+
...t
|
|
1840
|
+
}) : /* @__PURE__ */ S(ne, {
|
|
1841
|
+
label: e.label,
|
|
1842
|
+
value: e.value,
|
|
1843
|
+
...t
|
|
1844
|
+
});
|
|
1845
|
+
},
|
|
1846
|
+
renderers: ["all"]
|
|
1847
|
+
},
|
|
1848
|
+
{
|
|
1849
|
+
name: "BarChart",
|
|
1850
|
+
catalog: zn,
|
|
1851
|
+
renderer: xr,
|
|
1852
|
+
renderers: ["all"]
|
|
1853
|
+
},
|
|
1854
|
+
{
|
|
1855
|
+
name: "DonutChart",
|
|
1856
|
+
catalog: Gn,
|
|
1857
|
+
renderer: kr,
|
|
1858
|
+
renderers: ["all"]
|
|
1859
|
+
},
|
|
1860
|
+
{
|
|
1861
|
+
name: "LineChart",
|
|
1862
|
+
catalog: Yn,
|
|
1863
|
+
renderer: zr,
|
|
1864
|
+
renderers: ["all"]
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
name: "Button",
|
|
1868
|
+
catalog: Bn,
|
|
1869
|
+
renderer: Sr,
|
|
1870
|
+
renderers: ["all"]
|
|
1871
|
+
},
|
|
1872
|
+
{
|
|
1873
|
+
name: "Checkbox",
|
|
1874
|
+
catalog: Hn,
|
|
1875
|
+
renderer: Tr,
|
|
1876
|
+
renderers: ["all"]
|
|
1877
|
+
},
|
|
1878
|
+
{
|
|
1879
|
+
name: "Input",
|
|
1880
|
+
catalog: Jn,
|
|
1881
|
+
renderer: Rr,
|
|
1882
|
+
renderers: ["all"]
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
name: "Textarea",
|
|
1886
|
+
catalog: nr,
|
|
1887
|
+
renderer: ({ props: e, bindings: t, emit: n }) => {
|
|
1888
|
+
let r = t?.value, { state: i, set: a } = O(), o = r ? E(i, r) : void 0, s = r ? o ?? e.value ?? "" : e.value ?? "";
|
|
1889
|
+
return /* @__PURE__ */ S(ce, {
|
|
1890
|
+
label: e.label,
|
|
1891
|
+
value: s,
|
|
1892
|
+
...X({
|
|
1893
|
+
placeholder: e.placeholder,
|
|
1894
|
+
description: e.description,
|
|
1895
|
+
moreInfo: e.moreInfo,
|
|
1896
|
+
rows: e.rows,
|
|
1897
|
+
disabled: e.disabled
|
|
1898
|
+
}),
|
|
1899
|
+
onChange: (e) => {
|
|
1900
|
+
r && a(r, e.target.value), n("change");
|
|
1901
|
+
}
|
|
1902
|
+
});
|
|
1903
|
+
},
|
|
1904
|
+
renderers: ["all"]
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
name: "Listbox",
|
|
1908
|
+
catalog: Zn,
|
|
1909
|
+
renderer: ({ props: e, bindings: t, emit: n }) => {
|
|
1910
|
+
let r = t?.value, { state: i, set: a } = O(), o = r ? E(i, r) : void 0, s = r ? o ?? e.value ?? "" : e.value ?? "", l = e.options.map((e) => ({
|
|
1911
|
+
id: e.value,
|
|
1912
|
+
label: e.label
|
|
1913
|
+
})), u = l.find((e) => e.id === s);
|
|
1914
|
+
return /* @__PURE__ */ C("div", {
|
|
1915
|
+
className: Vr({ disabled: e.disabled ?? !1 }),
|
|
1916
|
+
children: [/* @__PURE__ */ S(c, { children: e.label }), /* @__PURE__ */ S(ee, {
|
|
1917
|
+
items: l,
|
|
1918
|
+
...u ? { selected: u } : {},
|
|
1919
|
+
onSelectionChange: (e) => {
|
|
1920
|
+
let t = e?.id ?? "";
|
|
1921
|
+
r && a(r, t), n("change");
|
|
1922
|
+
},
|
|
1923
|
+
children: ({ items: e }) => e.map((e) => /* @__PURE__ */ S(ee.Option, {
|
|
1924
|
+
item: e,
|
|
1925
|
+
children: e.label
|
|
1926
|
+
}, e.id))
|
|
1927
|
+
})]
|
|
1928
|
+
});
|
|
1929
|
+
},
|
|
1930
|
+
renderers: ["all"]
|
|
1931
|
+
},
|
|
1932
|
+
{
|
|
1933
|
+
name: "RadioGroup",
|
|
1934
|
+
catalog: $n,
|
|
1935
|
+
renderer: ({ props: e, bindings: t, emit: n }) => {
|
|
1936
|
+
let r = t?.value, { state: i, set: a } = O(), o = r ? E(i, r) : void 0, s = r ? o ?? e.value ?? "" : e.value ?? "";
|
|
1937
|
+
return /* @__PURE__ */ S(re.Group, {
|
|
1938
|
+
legend: e.label,
|
|
1939
|
+
children: e.options.map((t) => /* @__PURE__ */ S(re, {
|
|
1940
|
+
label: t.label,
|
|
1941
|
+
value: t.value,
|
|
1942
|
+
checked: s === t.value,
|
|
1943
|
+
...X({ disabled: e.disabled }),
|
|
1944
|
+
onChange: () => {
|
|
1945
|
+
r && a(r, t.value), n("change");
|
|
1946
|
+
}
|
|
1947
|
+
}, t.value))
|
|
1948
|
+
});
|
|
1949
|
+
},
|
|
1950
|
+
renderers: ["all"]
|
|
1951
|
+
},
|
|
1952
|
+
{
|
|
1953
|
+
name: "Switch",
|
|
1954
|
+
catalog: er,
|
|
1955
|
+
renderer: ({ props: e, bindings: t, emit: n }) => {
|
|
1956
|
+
let r = t?.checked, { state: i, set: a } = O(), o = r ? E(i, r) : void 0, s = r ? o ?? e.checked ?? !1 : e.checked ?? !1;
|
|
1957
|
+
return /* @__PURE__ */ S(oe, {
|
|
1958
|
+
label: e.label,
|
|
1959
|
+
value: e.label,
|
|
1960
|
+
checked: s,
|
|
1961
|
+
...X({ disabled: e.disabled }),
|
|
1962
|
+
onChange: (e, t) => {
|
|
1963
|
+
r && a(r, t?.checked ?? !1), n("change");
|
|
1964
|
+
}
|
|
1965
|
+
});
|
|
1966
|
+
},
|
|
1967
|
+
renderers: ["all"]
|
|
1968
|
+
}
|
|
1969
|
+
];
|
|
1970
|
+
Object.fromEntries(Hr.map(({ name: e, renderer: t }) => [e, t]));
|
|
1971
|
+
//#endregion
|
|
1972
|
+
//#region src/marketing/catalog/components/revenue-card.catalog.ts
|
|
1973
|
+
var Ur = {
|
|
1974
|
+
props: w.object({
|
|
1975
|
+
title: w.string(),
|
|
1976
|
+
value: w.string(),
|
|
1977
|
+
trend: w.enum([
|
|
1978
|
+
"up",
|
|
1979
|
+
"down",
|
|
1980
|
+
"flat"
|
|
1981
|
+
]).optional(),
|
|
1982
|
+
delta: w.string().optional()
|
|
1983
|
+
}),
|
|
1984
|
+
slots: [],
|
|
1985
|
+
description: "KPI metric card. trend: up=green↑ down=red↓ flat=grey→. delta e.g. \"+12% vs last month\". Leaf node — no children."
|
|
1986
|
+
}, Wr = j({
|
|
1987
|
+
defaultClassName: "cy2dbi0",
|
|
1988
|
+
variantClassNames: { trend: {
|
|
1989
|
+
up: "cy2dbi1",
|
|
1990
|
+
down: "cy2dbi2",
|
|
1991
|
+
flat: "cy2dbi3"
|
|
1992
|
+
} },
|
|
1993
|
+
defaultVariants: {},
|
|
1994
|
+
compoundVariants: []
|
|
1995
|
+
}), Gr = [{
|
|
1996
|
+
name: "RevenueCard",
|
|
1997
|
+
catalog: Ur,
|
|
1998
|
+
renderer: ({ props: e }) => {
|
|
1999
|
+
let t = e.trend ?? "flat", n = e.trend === "up" ? "↑" : e.trend === "down" ? "↓" : "→", r = Wr({ trend: t });
|
|
2000
|
+
return /* @__PURE__ */ S(i, { children: /* @__PURE__ */ C(l, {
|
|
2001
|
+
direction: "column",
|
|
2002
|
+
gap: "2",
|
|
2003
|
+
children: [
|
|
2004
|
+
/* @__PURE__ */ S(p, {
|
|
2005
|
+
variant: "eyebrow",
|
|
2006
|
+
children: e.title
|
|
2007
|
+
}),
|
|
2008
|
+
/* @__PURE__ */ S(p, {
|
|
2009
|
+
variant: "headline",
|
|
2010
|
+
el: "h3",
|
|
2011
|
+
children: e.value
|
|
2012
|
+
}),
|
|
2013
|
+
e.delta && /* @__PURE__ */ C(l, {
|
|
2014
|
+
direction: "row",
|
|
2015
|
+
gap: "1",
|
|
2016
|
+
alignItems: "center",
|
|
2017
|
+
children: [/* @__PURE__ */ S("span", {
|
|
2018
|
+
className: r,
|
|
2019
|
+
children: n
|
|
2020
|
+
}), /* @__PURE__ */ S(p, {
|
|
2021
|
+
variant: "eyebrow",
|
|
2022
|
+
className: r,
|
|
2023
|
+
children: e.delta
|
|
2024
|
+
})]
|
|
2025
|
+
})
|
|
2026
|
+
]
|
|
2027
|
+
}) });
|
|
2028
|
+
},
|
|
2029
|
+
renderers: ["chat"]
|
|
2030
|
+
}];
|
|
2031
|
+
//#endregion
|
|
2032
|
+
//#region src/registry-utils.ts
|
|
2033
|
+
function Kr(e, t) {
|
|
2034
|
+
return t === "all" ? [...e] : e.filter(({ renderers: e }) => e.includes("all") || e.includes(t));
|
|
2035
|
+
}
|
|
2036
|
+
function qr(e) {
|
|
2037
|
+
return Object.fromEntries(e.map(({ name: e, catalog: t }) => [e, t]));
|
|
2038
|
+
}
|
|
2039
|
+
function Jr(e) {
|
|
2040
|
+
return Object.fromEntries(e.map(({ name: e, renderer: t }) => [e, t]));
|
|
2041
|
+
}
|
|
2042
|
+
//#endregion
|
|
2043
|
+
//#region src/registry.ts
|
|
2044
|
+
var Yr = [
|
|
2045
|
+
...Hr,
|
|
2046
|
+
...Gr,
|
|
2047
|
+
...U
|
|
2048
|
+
];
|
|
2049
|
+
function Z(e = "chat") {
|
|
2050
|
+
let t = Kr(Yr, e), n = qr(t), r = Jr(t);
|
|
2051
|
+
return je(T(D, {
|
|
2052
|
+
components: n,
|
|
2053
|
+
actions: z
|
|
2054
|
+
}), {
|
|
2055
|
+
components: r,
|
|
2056
|
+
actions: Ln
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
2059
|
+
var Q = Z("chat"), Xr = Q.registry, Zr = Q.handlers, Qr = Q.executeAction;
|
|
2060
|
+
function $r() {
|
|
2061
|
+
return Z("context");
|
|
2062
|
+
}
|
|
2063
|
+
//#endregion
|
|
2064
|
+
//#region src/renderers/internal/enrichments/button-actions.ts
|
|
2065
|
+
function ei(e) {
|
|
2066
|
+
let t = { ...e.elements };
|
|
2067
|
+
for (let [e, n] of Object.entries(t)) {
|
|
2068
|
+
if (n.type !== "Button" || n.on?.press) continue;
|
|
2069
|
+
let r = e;
|
|
2070
|
+
t[e] = {
|
|
2071
|
+
...n,
|
|
2072
|
+
on: {
|
|
2073
|
+
...n.on,
|
|
2074
|
+
press: {
|
|
2075
|
+
action: "atlas.submitUserAction",
|
|
2076
|
+
params: { actionId: r }
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
};
|
|
2080
|
+
}
|
|
2081
|
+
return {
|
|
2082
|
+
...e,
|
|
2083
|
+
elements: t
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2086
|
+
//#endregion
|
|
2087
|
+
//#region src/renderers/internal/enrichments/useEnrichedSpec.ts
|
|
2088
|
+
function ti(e, t) {
|
|
2089
|
+
return v(() => t.reduce((e, t) => t(e), e), [e, t]);
|
|
2090
|
+
}
|
|
2091
|
+
//#endregion
|
|
2092
|
+
//#region src/renderers/spec-renderer.tsx
|
|
2093
|
+
var ni = [ei], $ = ({ spec: e, registry: t, handlers: n, actions: r, loading: i }) => {
|
|
2094
|
+
let a = ti(e, ni), o = y(null), s = y(null);
|
|
2095
|
+
if (o.current !== e && (o.current = e, s.current = Ae(a.state ?? {})), s.current === null) throw Error("State store is not initialized");
|
|
2096
|
+
let c = s.current;
|
|
2097
|
+
return /* @__PURE__ */ S(Oe, {
|
|
2098
|
+
registry: t,
|
|
2099
|
+
store: c,
|
|
2100
|
+
handlers: v(() => {
|
|
2101
|
+
let e = n(() => void 0, () => c.getSnapshot()), t = r ? r({
|
|
2102
|
+
setState: c.set,
|
|
2103
|
+
getSnapshot: () => c.getSnapshot()
|
|
2104
|
+
}) : {};
|
|
2105
|
+
return {
|
|
2106
|
+
...e,
|
|
2107
|
+
...t
|
|
2108
|
+
};
|
|
2109
|
+
}, [
|
|
2110
|
+
n,
|
|
2111
|
+
r,
|
|
2112
|
+
c
|
|
2113
|
+
]),
|
|
2114
|
+
functions: v(() => ({ computeTotal: (e) => `$${((Number.parseFloat(String(e.quantity ?? 0)) || 0) * (Number.parseFloat(String(e.unitPrice ?? "0").replace(/[^0-9.]/g, "")) || 0)).toFixed(2)}` }), []),
|
|
2115
|
+
children: /* @__PURE__ */ S(ke, {
|
|
2116
|
+
spec: a,
|
|
2117
|
+
registry: t,
|
|
2118
|
+
loading: i ?? !1
|
|
2119
|
+
})
|
|
2120
|
+
});
|
|
2121
|
+
}, ri = class extends fe {
|
|
2122
|
+
state = {
|
|
2123
|
+
hasError: !1,
|
|
2124
|
+
message: ""
|
|
2125
|
+
};
|
|
2126
|
+
static getDerivedStateFromError(e) {
|
|
2127
|
+
return {
|
|
2128
|
+
hasError: !0,
|
|
2129
|
+
message: e.message
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
componentDidCatch(e, t) {
|
|
2133
|
+
console.error(`[ContextSpecRenderer] Rendering error in <${this.props.elementType}>:`, e, t.componentStack), this.props.onError?.({
|
|
2134
|
+
elementType: this.props.elementType,
|
|
2135
|
+
message: e.message
|
|
2136
|
+
});
|
|
2137
|
+
}
|
|
2138
|
+
render() {
|
|
2139
|
+
return this.state.hasError ? process.env.NODE_ENV === "production" ? null : /* @__PURE__ */ S(t, {
|
|
2140
|
+
status: "danger",
|
|
2141
|
+
title: `${this.props.elementType} failed to render`,
|
|
2142
|
+
children: /* @__PURE__ */ S(p, {
|
|
2143
|
+
variant: "body",
|
|
2144
|
+
children: this.state.message
|
|
2145
|
+
})
|
|
2146
|
+
}) : this.props.children;
|
|
2147
|
+
}
|
|
2148
|
+
};
|
|
2149
|
+
//#endregion
|
|
2150
|
+
//#region src/renderers/wrap-context-registry.tsx
|
|
2151
|
+
function ii(e, t) {
|
|
2152
|
+
if (process.env.NODE_ENV === "production") return e;
|
|
2153
|
+
let n = { ...e };
|
|
2154
|
+
for (let [r, i] of Object.entries(e)) {
|
|
2155
|
+
let e = i;
|
|
2156
|
+
n[r] = ((n) => /* @__PURE__ */ S(ri, {
|
|
2157
|
+
elementType: r,
|
|
2158
|
+
...t ? { onError: t } : {},
|
|
2159
|
+
children: /* @__PURE__ */ S(e, { ...n })
|
|
2160
|
+
}));
|
|
2161
|
+
}
|
|
2162
|
+
return n;
|
|
2163
|
+
}
|
|
2164
|
+
//#endregion
|
|
2165
|
+
//#region src/renderers/context-spec-renderer.tsx
|
|
2166
|
+
var ai = ({ spec: e, registry: t, handlers: n, actions: r, onRenderError: i, loading: a }) => {
|
|
2167
|
+
let o = a ? [] : G(e);
|
|
2168
|
+
o.length > 0 && process.env.NODE_ENV !== "production" && console.warn(`[ContextSpecRenderer] Spec validation issues:\n${K(o.map((e) => ({
|
|
2169
|
+
...e,
|
|
2170
|
+
severity: "error"
|
|
2171
|
+
})))}`);
|
|
2172
|
+
let s = t ?? Z("context").registry, c = n ?? Z("context").handlers;
|
|
2173
|
+
return /* @__PURE__ */ S($, {
|
|
2174
|
+
spec: e,
|
|
2175
|
+
registry: v(() => ii(s, i), [s, i]),
|
|
2176
|
+
handlers: c,
|
|
2177
|
+
...r ? { actions: r } : {},
|
|
2178
|
+
...a === void 0 ? {} : { loading: a }
|
|
2179
|
+
});
|
|
2180
|
+
}, oi = "nilaa0";
|
|
2181
|
+
//#endregion
|
|
2182
|
+
//#region src/renderers/sectioned-context-renderer.tsx
|
|
2183
|
+
function si(e, t) {
|
|
2184
|
+
let n = {}, r = !1, i = (t) => {
|
|
2185
|
+
let a = e.elements[t];
|
|
2186
|
+
if (!a) {
|
|
2187
|
+
r = !0;
|
|
2188
|
+
return;
|
|
2189
|
+
}
|
|
2190
|
+
if (!n[t]) {
|
|
2191
|
+
n[t] = a;
|
|
2192
|
+
for (let e of a.children ?? []) i(e);
|
|
2193
|
+
}
|
|
2194
|
+
};
|
|
2195
|
+
return i(t), {
|
|
2196
|
+
elements: n,
|
|
2197
|
+
hasMissingRefs: r
|
|
2198
|
+
};
|
|
2199
|
+
}
|
|
2200
|
+
function ci(e, t) {
|
|
2201
|
+
let { elements: n, hasMissingRefs: r } = si(e, t), i = {
|
|
2202
|
+
root: t,
|
|
2203
|
+
elements: n
|
|
2204
|
+
}, a = e.state;
|
|
2205
|
+
return a !== void 0 && (i.state = a), {
|
|
2206
|
+
spec: i,
|
|
2207
|
+
hasMissingRefs: r
|
|
2208
|
+
};
|
|
2209
|
+
}
|
|
2210
|
+
function li(e, t) {
|
|
2211
|
+
let n = y(/* @__PURE__ */ new Map());
|
|
2212
|
+
return v(() => {
|
|
2213
|
+
if (!e?.root) return [];
|
|
2214
|
+
let r = e.elements[e.root];
|
|
2215
|
+
if (!r) return [];
|
|
2216
|
+
let i = (r.children ?? []).filter((t) => e.elements[t]), a = n.current, o = /* @__PURE__ */ new Map(), s = i.map((n, r) => {
|
|
2217
|
+
let { spec: s, hasMissingRefs: c } = ci(e, n), l = JSON.stringify(s), u = a.get(n), d = u && u.key === l ? u.spec : s;
|
|
2218
|
+
o.set(n, {
|
|
2219
|
+
key: l,
|
|
2220
|
+
spec: d
|
|
2221
|
+
});
|
|
2222
|
+
let f = r === i.length - 1;
|
|
2223
|
+
return {
|
|
2224
|
+
id: n,
|
|
2225
|
+
spec: d,
|
|
2226
|
+
status: c || f && t ? "loading" : "ready"
|
|
2227
|
+
};
|
|
2228
|
+
});
|
|
2229
|
+
return n.current = o, s;
|
|
2230
|
+
}, [e, t]);
|
|
2231
|
+
}
|
|
2232
|
+
function ui(e) {
|
|
2233
|
+
let t = y(/* @__PURE__ */ new Map());
|
|
2234
|
+
return v(() => {
|
|
2235
|
+
let n = t.current, r = /* @__PURE__ */ new Map(), i = e.map((e) => {
|
|
2236
|
+
let t = e.spec ? JSON.stringify(e.spec) : "", i = n.get(e.id), a = e.spec && i && i.key === t ? i.spec : e.spec;
|
|
2237
|
+
return r.set(e.id, {
|
|
2238
|
+
key: t,
|
|
2239
|
+
spec: a
|
|
2240
|
+
}), a === e.spec ? e : {
|
|
2241
|
+
...e,
|
|
2242
|
+
spec: a
|
|
2243
|
+
};
|
|
2244
|
+
});
|
|
2245
|
+
return t.current = r, i;
|
|
2246
|
+
}, [e]);
|
|
2247
|
+
}
|
|
2248
|
+
function di({ title: e }) {
|
|
2249
|
+
return /* @__PURE__ */ C("div", {
|
|
2250
|
+
className: Je,
|
|
2251
|
+
"data-testid": "context-section-skeleton",
|
|
2252
|
+
children: [/* @__PURE__ */ S(ae, {
|
|
2253
|
+
variant: "headline",
|
|
2254
|
+
...e ? { "aria-label": `Loading ${e}` } : {}
|
|
2255
|
+
}), /* @__PURE__ */ S(ie, { height: "64px" })]
|
|
2256
|
+
});
|
|
2257
|
+
}
|
|
2258
|
+
function fi({ slot: e, registry: t, handlers: n, actions: r }) {
|
|
2259
|
+
return e.spec ? /* @__PURE__ */ C("div", {
|
|
2260
|
+
"data-testid": `context-section-${e.id}`,
|
|
2261
|
+
"data-status": e.status,
|
|
2262
|
+
children: [/* @__PURE__ */ S($, {
|
|
2263
|
+
spec: e.spec,
|
|
2264
|
+
registry: t,
|
|
2265
|
+
handlers: n,
|
|
2266
|
+
loading: e.status === "loading",
|
|
2267
|
+
...r ? { actions: r } : {}
|
|
2268
|
+
}), e.status === "loading" ? /* @__PURE__ */ S("div", {
|
|
2269
|
+
className: oi,
|
|
2270
|
+
children: /* @__PURE__ */ S(ae, {
|
|
2271
|
+
variant: "body",
|
|
2272
|
+
rows: 2,
|
|
2273
|
+
"aria-label": "Loading more of this section"
|
|
2274
|
+
})
|
|
2275
|
+
}) : null]
|
|
2276
|
+
}) : /* @__PURE__ */ S(di, { ...e.title ? { title: e.title } : {} });
|
|
2277
|
+
}
|
|
2278
|
+
var pi = ({ spec: e, sections: t, loading: n = !1, registry: r, handlers: i, actions: a, onRenderError: o }) => {
|
|
2279
|
+
let s = v(() => Z("context"), []), c = r ?? s.registry, l = i ?? s.handlers, u = v(() => ii(c, o), [c, o]), d = li(e, n);
|
|
2280
|
+
return /* @__PURE__ */ S("div", {
|
|
2281
|
+
className: F,
|
|
2282
|
+
"data-testid": "sectioned-context-panel",
|
|
2283
|
+
children: ui(t ?? d).map((e) => /* @__PURE__ */ S(ri, {
|
|
2284
|
+
elementType: e.id,
|
|
2285
|
+
...o ? { onError: o } : {},
|
|
2286
|
+
children: /* @__PURE__ */ S(fi, {
|
|
2287
|
+
slot: e,
|
|
2288
|
+
registry: u,
|
|
2289
|
+
handlers: l,
|
|
2290
|
+
...a ? { actions: a } : {}
|
|
2291
|
+
})
|
|
2292
|
+
}, e.id))
|
|
2293
|
+
});
|
|
2294
|
+
};
|
|
2295
|
+
//#endregion
|
|
2296
|
+
export { ai as ContextSpecRenderer, pi as SectionedContextRenderer, $ as SpecRenderer, wr as catalog, H as composeCatalogComponents, or as contextCatalog, rr as createScopedCatalog, Qr as executeAction, ci as extractSectionSpec, yr as formatContextRenderReport, K as formatContextSpecIssues, $r as getContextRegistry, Z as getRegistry, Zr as handlers, vr as hasContextSpecErrors, ir as mergeCatalogs, _r as postProcessContextSpec, Xr as registry, G as validateContextSpec, gr as validateContextSpecDeep };
|
|
2297
|
+
|
|
2298
|
+
//# sourceMappingURL=index.js.map
|