@adoptai/genui-components 0.1.33 → 0.1.54
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/README.md +5 -0
- package/dist/builders/BlockForm.d.ts +31 -0
- package/dist/builders/BlockForm.d.ts.map +1 -0
- package/dist/builders/BuilderForm.d.ts +25 -2
- package/dist/builders/BuilderForm.d.ts.map +1 -1
- package/dist/builders/BuilderRecap.d.ts.map +1 -1
- package/dist/builders/ContextSlot.d.ts +6 -0
- package/dist/builders/ContextSlot.d.ts.map +1 -1
- package/dist/builders/FieldRenderer.d.ts +9 -2
- package/dist/builders/FieldRenderer.d.ts.map +1 -1
- package/dist/builders/StepperBuilder.d.ts +9 -2
- package/dist/builders/StepperBuilder.d.ts.map +1 -1
- package/dist/builders/fields.d.ts +27 -2
- package/dist/builders/fields.d.ts.map +1 -1
- package/dist/builders/hooks.d.ts +17 -0
- package/dist/builders/hooks.d.ts.map +1 -1
- package/dist/builders/index.d.ts +5 -5
- package/dist/builders/index.d.ts.map +1 -1
- package/dist/builders/resolver.d.ts +14 -0
- package/dist/builders/resolver.d.ts.map +1 -1
- package/dist/builders/schemas.d.ts +196 -1
- package/dist/builders/schemas.d.ts.map +1 -1
- package/dist/composites/aging-report/resolver.cjs +1 -1
- package/dist/composites/aging-report/resolver.cjs.map +1 -1
- package/dist/composites/aging-report/resolver.js +1 -1
- package/dist/composites/aging-report/resolver.js.map +1 -1
- package/dist/composites/balance-sheet/resolver.cjs +1 -1
- package/dist/composites/balance-sheet/resolver.cjs.map +1 -1
- package/dist/composites/balance-sheet/resolver.js +1 -1
- package/dist/composites/balance-sheet/resolver.js.map +1 -1
- package/dist/composites/connect-integration/resolver.cjs +465 -0
- package/dist/composites/connect-integration/resolver.cjs.map +1 -0
- package/dist/composites/connect-integration/resolver.js +463 -0
- package/dist/composites/connect-integration/resolver.js.map +1 -0
- package/dist/composites/entity-card-grid/resolver.cjs +2 -2
- package/dist/composites/entity-card-grid/resolver.cjs.map +1 -1
- package/dist/composites/entity-card-grid/resolver.js +2 -2
- package/dist/composites/entity-card-grid/resolver.js.map +1 -1
- package/dist/composites/general-ledger/resolver.cjs +1 -0
- package/dist/composites/general-ledger/resolver.cjs.map +1 -1
- package/dist/composites/general-ledger/resolver.d.ts.map +1 -1
- package/dist/composites/general-ledger/resolver.js +1 -0
- package/dist/composites/general-ledger/resolver.js.map +1 -1
- package/dist/composites/income-statement/resolver.cjs +1 -1
- package/dist/composites/income-statement/resolver.cjs.map +1 -1
- package/dist/composites/income-statement/resolver.js +1 -1
- package/dist/composites/income-statement/resolver.js.map +1 -1
- package/dist/composites/integrations-list/resolver.cjs +511 -0
- package/dist/composites/integrations-list/resolver.cjs.map +1 -0
- package/dist/composites/integrations-list/resolver.js +509 -0
- package/dist/composites/integrations-list/resolver.js.map +1 -0
- package/dist/composites/journal-entry/resolver.cjs +2 -2
- package/dist/composites/journal-entry/resolver.cjs.map +1 -1
- package/dist/composites/journal-entry/resolver.js +2 -2
- package/dist/composites/journal-entry/resolver.js.map +1 -1
- package/dist/composites/key-value-list/resolver.cjs +28 -3
- package/dist/composites/key-value-list/resolver.cjs.map +1 -1
- package/dist/composites/key-value-list/resolver.d.ts.map +1 -1
- package/dist/composites/key-value-list/resolver.js +28 -3
- package/dist/composites/key-value-list/resolver.js.map +1 -1
- package/dist/composites/pipeline-preview/resolver.cjs +926 -0
- package/dist/composites/pipeline-preview/resolver.cjs.map +1 -0
- package/dist/composites/pipeline-preview/resolver.js +924 -0
- package/dist/composites/pipeline-preview/resolver.js.map +1 -0
- package/dist/composites/reconciliation-view/resolver.cjs +90 -32
- package/dist/composites/reconciliation-view/resolver.cjs.map +1 -1
- package/dist/composites/reconciliation-view/resolver.d.ts.map +1 -1
- package/dist/composites/reconciliation-view/resolver.js +91 -33
- package/dist/composites/reconciliation-view/resolver.js.map +1 -1
- package/dist/composites/stacked-breakdown/resolver.cjs +13 -2
- package/dist/composites/stacked-breakdown/resolver.cjs.map +1 -1
- package/dist/composites/stacked-breakdown/resolver.d.ts.map +1 -1
- package/dist/composites/stacked-breakdown/resolver.js +13 -2
- package/dist/composites/stacked-breakdown/resolver.js.map +1 -1
- package/dist/composites/stat-grid/resolver.cjs +83 -5
- package/dist/composites/stat-grid/resolver.cjs.map +1 -1
- package/dist/composites/stat-grid/resolver.d.ts.map +1 -1
- package/dist/composites/stat-grid/resolver.js +84 -6
- package/dist/composites/stat-grid/resolver.js.map +1 -1
- package/dist/composites/trial-balance/resolver.cjs +1 -1
- package/dist/composites/trial-balance/resolver.cjs.map +1 -1
- package/dist/composites/trial-balance/resolver.js +1 -1
- package/dist/composites/trial-balance/resolver.js.map +1 -1
- package/dist/composites/variance-analysis/resolver.cjs +1 -1
- package/dist/composites/variance-analysis/resolver.cjs.map +1 -1
- package/dist/composites/variance-analysis/resolver.js +1 -1
- package/dist/composites/variance-analysis/resolver.js.map +1 -1
- package/dist/composites/workflow-stepper/resolver.cjs +978 -0
- package/dist/composites/workflow-stepper/resolver.cjs.map +1 -0
- package/dist/composites/workflow-stepper/resolver.d.ts +20 -0
- package/dist/composites/workflow-stepper/resolver.d.ts.map +1 -0
- package/dist/composites/workflow-stepper/resolver.js +971 -0
- package/dist/composites/workflow-stepper/resolver.js.map +1 -0
- package/dist/index.cjs +2497 -972
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2344 -827
- package/dist/index.js.map +1 -1
- package/dist/renderer.cjs +1071 -213
- package/dist/renderer.cjs.map +1 -1
- package/dist/renderer.js +933 -75
- package/dist/renderer.js.map +1 -1
- package/dist/resolver.cjs +1070 -212
- package/dist/resolver.cjs.map +1 -1
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +933 -75
- package/dist/resolver.js.map +1 -1
- package/dist/schemas/index.cjs +75 -1
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.ts +123 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +75 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/workflow-stepper.d.ts +123 -0
- package/dist/schemas/workflow-stepper.d.ts.map +1 -0
- package/dist/shared/FitText.d.ts +22 -0
- package/dist/shared/FitText.d.ts.map +1 -0
- package/dist/shared/InteractionContext.d.ts +20 -0
- package/dist/shared/InteractionContext.d.ts.map +1 -0
- package/dist/shared/styles.d.ts +14 -0
- package/dist/shared/styles.d.ts.map +1 -0
- package/dist/tool-definitions.json +115 -3
- package/package.json +2 -2
- package/dist/builders/EscalationCard.d.ts +0 -12
- package/dist/builders/EscalationCard.d.ts.map +0 -1
- package/dist/builders/FormBuilder.d.ts +0 -13
- package/dist/builders/FormBuilder.d.ts.map +0 -1
|
@@ -0,0 +1,978 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React4 = require('react');
|
|
5
|
+
var htmlToImage = require('html-to-image');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
|
|
10
|
+
var React4__default = /*#__PURE__*/_interopDefault(React4);
|
|
11
|
+
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __defProps = Object.defineProperties;
|
|
14
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
15
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
16
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
17
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
18
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19
|
+
var __spreadValues = (a, b) => {
|
|
20
|
+
for (var prop in b || (b = {}))
|
|
21
|
+
if (__hasOwnProp.call(b, prop))
|
|
22
|
+
__defNormalProp(a, prop, b[prop]);
|
|
23
|
+
if (__getOwnPropSymbols)
|
|
24
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
25
|
+
if (__propIsEnum.call(b, prop))
|
|
26
|
+
__defNormalProp(a, prop, b[prop]);
|
|
27
|
+
}
|
|
28
|
+
return a;
|
|
29
|
+
};
|
|
30
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
31
|
+
|
|
32
|
+
// src/shared/theme.ts
|
|
33
|
+
var BORDER = "#dedede";
|
|
34
|
+
var MUTED = "#777777";
|
|
35
|
+
var PAPER = "#f6f6f6";
|
|
36
|
+
var ACCENT = "#ff5000";
|
|
37
|
+
var ACCENT_SOFT = "#cc4000";
|
|
38
|
+
var SECONDARY = "#0364ff";
|
|
39
|
+
var CHART_PALETTE = [
|
|
40
|
+
"#ff5000",
|
|
41
|
+
"#0364ff",
|
|
42
|
+
"#16a34a",
|
|
43
|
+
"#dc2626",
|
|
44
|
+
"#7c3aed",
|
|
45
|
+
"#0891b2",
|
|
46
|
+
"#f59e0b",
|
|
47
|
+
"#6366f1",
|
|
48
|
+
"#ec4899",
|
|
49
|
+
"#84cc16",
|
|
50
|
+
"#e11d48",
|
|
51
|
+
"#0ea5e9"
|
|
52
|
+
];
|
|
53
|
+
function ColumnSettingsPanel({ columns, hidden, onToggle, onShowAll, onHideAll }) {
|
|
54
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "6px", minWidth: "180px" }, children: [
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", paddingBottom: "4px", borderBottom: `1px solid ${BORDER}` }, children: [
|
|
56
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
"button",
|
|
58
|
+
{
|
|
59
|
+
onClick: onShowAll,
|
|
60
|
+
style: { background: "none", border: "none", cursor: "pointer", fontSize: "11px", color: ACCENT, fontWeight: 500, padding: 0 },
|
|
61
|
+
children: "Show all"
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
onClick: onHideAll,
|
|
68
|
+
style: { background: "none", border: "none", cursor: "pointer", fontSize: "11px", color: MUTED, fontWeight: 500, padding: 0 },
|
|
69
|
+
children: "Hide all"
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] }),
|
|
73
|
+
columns.map((col) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
74
|
+
"label",
|
|
75
|
+
{
|
|
76
|
+
style: { display: "flex", alignItems: "center", gap: "8px", cursor: "pointer", fontSize: "12px", color: "var(--foreground)" },
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
79
|
+
"input",
|
|
80
|
+
{
|
|
81
|
+
type: "checkbox",
|
|
82
|
+
checked: !hidden.has(col.key),
|
|
83
|
+
onChange: () => onToggle(col.key),
|
|
84
|
+
style: { accentColor: ACCENT, width: "14px", height: "14px", margin: 0, cursor: "pointer" }
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
col.label
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
col.key
|
|
91
|
+
))
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
var DOT_COLOR = "#aaaaaa";
|
|
95
|
+
var DOT_HOVER = "#555555";
|
|
96
|
+
function ComponentActions({ children, onDownloadCSV, columnConfig, filename = "component" }) {
|
|
97
|
+
const [open, setOpen] = React4.useState(false);
|
|
98
|
+
const [view, setView] = React4.useState("main");
|
|
99
|
+
const contentRef = React4.useRef(null);
|
|
100
|
+
const menuRef = React4.useRef(null);
|
|
101
|
+
const btnRef = React4.useRef(null);
|
|
102
|
+
const close = React4.useCallback(() => {
|
|
103
|
+
setOpen(false);
|
|
104
|
+
setView("main");
|
|
105
|
+
}, []);
|
|
106
|
+
React4.useEffect(() => {
|
|
107
|
+
if (!open) return;
|
|
108
|
+
const handler = (e) => {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
if ((_a = menuRef.current) == null ? void 0 : _a.contains(e.target)) return;
|
|
111
|
+
if ((_b = btnRef.current) == null ? void 0 : _b.contains(e.target)) return;
|
|
112
|
+
close();
|
|
113
|
+
};
|
|
114
|
+
document.addEventListener("mousedown", handler);
|
|
115
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
116
|
+
}, [open, close]);
|
|
117
|
+
const handleDownloadPNG = React4.useCallback(async () => {
|
|
118
|
+
if (!contentRef.current) return;
|
|
119
|
+
try {
|
|
120
|
+
const url = await htmlToImage.toPng(contentRef.current, { backgroundColor: "white", pixelRatio: 2 });
|
|
121
|
+
const a = document.createElement("a");
|
|
122
|
+
a.href = url;
|
|
123
|
+
a.download = `${filename}.png`;
|
|
124
|
+
a.click();
|
|
125
|
+
} catch (e) {
|
|
126
|
+
}
|
|
127
|
+
close();
|
|
128
|
+
}, [filename, close]);
|
|
129
|
+
const handleCSV = React4.useCallback(() => {
|
|
130
|
+
onDownloadCSV == null ? void 0 : onDownloadCSV();
|
|
131
|
+
close();
|
|
132
|
+
}, [onDownloadCSV, close]);
|
|
133
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column" }, children: [
|
|
134
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: contentRef, style: { width: "100%" }, children }),
|
|
135
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "flex-end", marginTop: "4px", position: "relative", zIndex: 10, flexShrink: 0 }, children: [
|
|
136
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
137
|
+
"button",
|
|
138
|
+
{
|
|
139
|
+
ref: btnRef,
|
|
140
|
+
onClick: () => {
|
|
141
|
+
setOpen((o) => !o);
|
|
142
|
+
setView("main");
|
|
143
|
+
},
|
|
144
|
+
"aria-label": "Component actions",
|
|
145
|
+
style: {
|
|
146
|
+
background: "none",
|
|
147
|
+
border: "none",
|
|
148
|
+
cursor: "pointer",
|
|
149
|
+
padding: "4px 8px",
|
|
150
|
+
display: "flex",
|
|
151
|
+
gap: "3px",
|
|
152
|
+
alignItems: "center",
|
|
153
|
+
borderRadius: "6px",
|
|
154
|
+
transition: "background 0.15s"
|
|
155
|
+
},
|
|
156
|
+
onMouseEnter: (e) => {
|
|
157
|
+
e.currentTarget.style.background = "#f2f2f2";
|
|
158
|
+
e.currentTarget.querySelectorAll("circle").forEach((c) => c.style.fill = DOT_HOVER);
|
|
159
|
+
},
|
|
160
|
+
onMouseLeave: (e) => {
|
|
161
|
+
e.currentTarget.style.background = "none";
|
|
162
|
+
e.currentTarget.querySelectorAll("circle").forEach((c) => c.style.fill = DOT_COLOR);
|
|
163
|
+
},
|
|
164
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "20", height: "6", viewBox: "0 0 20 6", children: [
|
|
165
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "3", cy: "3", r: "2", style: { fill: DOT_COLOR, transition: "fill 0.15s" } }),
|
|
166
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10", cy: "3", r: "2", style: { fill: DOT_COLOR, transition: "fill 0.15s" } }),
|
|
167
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "17", cy: "3", r: "2", style: { fill: DOT_COLOR, transition: "fill 0.15s" } })
|
|
168
|
+
] })
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
open && /* @__PURE__ */ jsxRuntime.jsx(
|
|
172
|
+
"div",
|
|
173
|
+
{
|
|
174
|
+
ref: menuRef,
|
|
175
|
+
style: {
|
|
176
|
+
position: "absolute",
|
|
177
|
+
bottom: "100%",
|
|
178
|
+
right: 0,
|
|
179
|
+
marginBottom: "4px",
|
|
180
|
+
background: "white",
|
|
181
|
+
border: `1px solid ${BORDER}`,
|
|
182
|
+
borderRadius: "0.75rem",
|
|
183
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.06)",
|
|
184
|
+
zIndex: 50,
|
|
185
|
+
padding: view === "columns" ? "10px" : "4px",
|
|
186
|
+
minWidth: view === "columns" ? "200px" : "160px"
|
|
187
|
+
},
|
|
188
|
+
children: view === "main" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
189
|
+
columnConfig && /* @__PURE__ */ jsxRuntime.jsx(MenuButton, { label: "Customize columns", onClick: () => setView("columns") }),
|
|
190
|
+
onDownloadCSV && /* @__PURE__ */ jsxRuntime.jsx(MenuButton, { label: "Download CSV", onClick: handleCSV }),
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuButton, { label: "Download PNG", onClick: handleDownloadPNG })
|
|
192
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
onClick: () => setView("main"),
|
|
197
|
+
style: { background: "none", border: "none", cursor: "pointer", fontSize: "11px", color: MUTED, marginBottom: "6px", padding: 0 },
|
|
198
|
+
children: "\u2190 Back"
|
|
199
|
+
}
|
|
200
|
+
),
|
|
201
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
202
|
+
ColumnSettingsPanel,
|
|
203
|
+
{
|
|
204
|
+
columns: columnConfig.columns,
|
|
205
|
+
hidden: columnConfig.hidden,
|
|
206
|
+
onToggle: columnConfig.onToggle,
|
|
207
|
+
onShowAll: columnConfig.onShowAll,
|
|
208
|
+
onHideAll: columnConfig.onHideAll
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
] })
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
] })
|
|
215
|
+
] });
|
|
216
|
+
}
|
|
217
|
+
function MenuButton({ label, onClick }) {
|
|
218
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
219
|
+
"button",
|
|
220
|
+
{
|
|
221
|
+
onClick,
|
|
222
|
+
style: {
|
|
223
|
+
background: "none",
|
|
224
|
+
border: "none",
|
|
225
|
+
cursor: "pointer",
|
|
226
|
+
padding: "8px 12px",
|
|
227
|
+
fontSize: "12.5px",
|
|
228
|
+
color: "var(--foreground)",
|
|
229
|
+
textAlign: "left",
|
|
230
|
+
borderRadius: "8px",
|
|
231
|
+
transition: "background 0.15s",
|
|
232
|
+
whiteSpace: "nowrap"
|
|
233
|
+
},
|
|
234
|
+
onMouseEnter: (e) => e.currentTarget.style.background = "#f2f2f2",
|
|
235
|
+
onMouseLeave: (e) => e.currentTarget.style.background = "none",
|
|
236
|
+
children: label
|
|
237
|
+
}
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
var DEFAULT_TOKENS = {
|
|
241
|
+
BORDER,
|
|
242
|
+
MUTED,
|
|
243
|
+
PAPER,
|
|
244
|
+
ACCENT,
|
|
245
|
+
ACCENT_SOFT,
|
|
246
|
+
SECONDARY,
|
|
247
|
+
CHART_PALETTE: [...CHART_PALETTE]
|
|
248
|
+
};
|
|
249
|
+
var GenUIThemeContext = React4.createContext(DEFAULT_TOKENS);
|
|
250
|
+
function useTheme() {
|
|
251
|
+
return React4.useContext(GenUIThemeContext);
|
|
252
|
+
}
|
|
253
|
+
var DEFAULT_INTERACTION = {
|
|
254
|
+
selectedStepId: null,
|
|
255
|
+
onStepSelect: void 0
|
|
256
|
+
};
|
|
257
|
+
var GenUIInteractionContext = React4.createContext(DEFAULT_INTERACTION);
|
|
258
|
+
function useGenUIInteraction() {
|
|
259
|
+
return React4.useContext(GenUIInteractionContext);
|
|
260
|
+
}
|
|
261
|
+
var STATUS_COLORS = {
|
|
262
|
+
done: "#15803d",
|
|
263
|
+
active: "",
|
|
264
|
+
// filled from theme ACCENT at render time
|
|
265
|
+
review: "#f59e0b",
|
|
266
|
+
pending: "#9ca3af",
|
|
267
|
+
blocked: "#b45309",
|
|
268
|
+
failed: "#dc2626"
|
|
269
|
+
};
|
|
270
|
+
var STATUS_LABELS = {
|
|
271
|
+
done: "Complete",
|
|
272
|
+
active: "In progress",
|
|
273
|
+
review: "In review",
|
|
274
|
+
pending: "Pending",
|
|
275
|
+
blocked: "Blocked",
|
|
276
|
+
failed: "Failed"
|
|
277
|
+
};
|
|
278
|
+
var HUMAN_PALETTE = ["#2563eb", "#0f766e", "#7c3aed", "#b45309", "#be185d", "#4d7c0f"];
|
|
279
|
+
function hashColor(name) {
|
|
280
|
+
let h = 0;
|
|
281
|
+
for (let i = 0; i < name.length; i++) h = h * 31 + name.charCodeAt(i) | 0;
|
|
282
|
+
return HUMAN_PALETTE[Math.abs(h) % HUMAN_PALETTE.length];
|
|
283
|
+
}
|
|
284
|
+
function initialsOf(a) {
|
|
285
|
+
var _a, _b, _c, _d;
|
|
286
|
+
if (a.initials) return a.initials.slice(0, 2).toUpperCase();
|
|
287
|
+
const parts = a.name.trim().split(/\s+/);
|
|
288
|
+
return (((_b = (_a = parts[0]) == null ? void 0 : _a[0]) != null ? _b : "") + ((_d = (_c = parts[1]) == null ? void 0 : _c[0]) != null ? _d : "")).toUpperCase() || "?";
|
|
289
|
+
}
|
|
290
|
+
function SparkMark({ size, color }) {
|
|
291
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
292
|
+
"path",
|
|
293
|
+
{
|
|
294
|
+
d: "M12 2C12 2 12.8 6.5 14.5 9.5C16.2 12.5 20 13 20 13C20 13 16.2 13.5 14.5 16.5C12.8 19.5 12 24 12 24C12 24 11.2 19.5 9.5 16.5C7.8 13.5 4 13 4 13C4 13 7.8 12.5 9.5 9.5C11.2 6.5 12 2 12 2Z",
|
|
295
|
+
fill: color
|
|
296
|
+
}
|
|
297
|
+
) });
|
|
298
|
+
}
|
|
299
|
+
function AvatarStack({ assignees, accent }) {
|
|
300
|
+
const shown = assignees.slice(0, 4);
|
|
301
|
+
const overflow = assignees.length - shown.length;
|
|
302
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
303
|
+
shown.map((a, i) => {
|
|
304
|
+
const isAgent = a.kind === "agent";
|
|
305
|
+
const bg = isAgent ? `${accent}1f` : a.color || hashColor(a.name);
|
|
306
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
307
|
+
"div",
|
|
308
|
+
{
|
|
309
|
+
title: `${a.name}${a.role ? ` \xB7 ${a.role}` : isAgent ? " \xB7 agent" : ""}`,
|
|
310
|
+
style: {
|
|
311
|
+
width: 20,
|
|
312
|
+
height: 20,
|
|
313
|
+
borderRadius: "50%",
|
|
314
|
+
flexShrink: 0,
|
|
315
|
+
marginLeft: i === 0 ? 0 : -7,
|
|
316
|
+
zIndex: shown.length - i,
|
|
317
|
+
display: "flex",
|
|
318
|
+
alignItems: "center",
|
|
319
|
+
justifyContent: "center",
|
|
320
|
+
background: bg,
|
|
321
|
+
border: "1.5px solid white",
|
|
322
|
+
boxShadow: isAgent ? `inset 0 0 0 1px ${accent}59` : "none"
|
|
323
|
+
},
|
|
324
|
+
children: isAgent ? /* @__PURE__ */ jsxRuntime.jsx(SparkMark, { size: 11, color: accent }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 8, fontWeight: 700, color: "white", letterSpacing: "0.02em" }, children: initialsOf(a) })
|
|
325
|
+
},
|
|
326
|
+
`${a.name}-${i}`
|
|
327
|
+
);
|
|
328
|
+
}),
|
|
329
|
+
overflow > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
330
|
+
"span",
|
|
331
|
+
{
|
|
332
|
+
style: {
|
|
333
|
+
marginLeft: -7,
|
|
334
|
+
zIndex: 0,
|
|
335
|
+
width: 20,
|
|
336
|
+
height: 20,
|
|
337
|
+
borderRadius: "50%",
|
|
338
|
+
background: "#f2f2f2",
|
|
339
|
+
border: "1.5px solid white",
|
|
340
|
+
display: "flex",
|
|
341
|
+
alignItems: "center",
|
|
342
|
+
justifyContent: "center",
|
|
343
|
+
fontSize: 8,
|
|
344
|
+
fontWeight: 700,
|
|
345
|
+
color: "#777777"
|
|
346
|
+
},
|
|
347
|
+
children: [
|
|
348
|
+
"+",
|
|
349
|
+
overflow
|
|
350
|
+
]
|
|
351
|
+
}
|
|
352
|
+
)
|
|
353
|
+
] });
|
|
354
|
+
}
|
|
355
|
+
function IndexDot({ step, index, accent }) {
|
|
356
|
+
var _a;
|
|
357
|
+
const n = (_a = step.n) != null ? _a : index + 1;
|
|
358
|
+
const base = {
|
|
359
|
+
width: 18,
|
|
360
|
+
height: 18,
|
|
361
|
+
borderRadius: "50%",
|
|
362
|
+
flexShrink: 0,
|
|
363
|
+
display: "flex",
|
|
364
|
+
alignItems: "center",
|
|
365
|
+
justifyContent: "center",
|
|
366
|
+
fontSize: 10,
|
|
367
|
+
fontWeight: 700,
|
|
368
|
+
lineHeight: 1
|
|
369
|
+
};
|
|
370
|
+
if (step.status === "done") {
|
|
371
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: __spreadProps(__spreadValues({}, base), { background: "#15803d", color: "white" }), children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 10 }, children: "\u2713" }) });
|
|
372
|
+
}
|
|
373
|
+
if (step.status === "failed") {
|
|
374
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: __spreadProps(__spreadValues({}, base), { background: "#dc2626", color: "white" }), children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 10 }, children: "!" }) });
|
|
375
|
+
}
|
|
376
|
+
if (step.status === "active") {
|
|
377
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: __spreadProps(__spreadValues({}, base), { background: accent, color: "white" }), children: n });
|
|
378
|
+
}
|
|
379
|
+
if (step.status === "review") {
|
|
380
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: __spreadProps(__spreadValues({}, base), { background: "white", border: "1.5px solid #f59e0b", color: "#b45309" }), children: n });
|
|
381
|
+
}
|
|
382
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: __spreadProps(__spreadValues({}, base), { background: "#f2f2f2", color: "#9ca3af" }), children: n });
|
|
383
|
+
}
|
|
384
|
+
var CARD_MIN = 132;
|
|
385
|
+
var CARD_GAP = 16;
|
|
386
|
+
var AUTO_COMPACT_BELOW = 360;
|
|
387
|
+
function useContainerWidth(ref) {
|
|
388
|
+
const [w, setW] = React4__default.default.useState(0);
|
|
389
|
+
React4__default.default.useLayoutEffect(() => {
|
|
390
|
+
const el = ref.current;
|
|
391
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
392
|
+
const ro = new ResizeObserver((entries) => {
|
|
393
|
+
var _a;
|
|
394
|
+
const cr = (_a = entries[0]) == null ? void 0 : _a.contentRect;
|
|
395
|
+
if (cr) setW(cr.width);
|
|
396
|
+
});
|
|
397
|
+
ro.observe(el);
|
|
398
|
+
setW(el.getBoundingClientRect().width);
|
|
399
|
+
return () => ro.disconnect();
|
|
400
|
+
}, [ref]);
|
|
401
|
+
return w;
|
|
402
|
+
}
|
|
403
|
+
var KEYFRAMES = `
|
|
404
|
+
@keyframes wfsPulse{0%,100%{opacity:1}50%{opacity:.35}}
|
|
405
|
+
@keyframes wfsLampPulse{0%,100%{box-shadow:0 0 0 0 var(--wfs-accent,#6366f1)73}50%{box-shadow:0 0 0 4px transparent}}
|
|
406
|
+
@keyframes wfsRise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
|
|
407
|
+
@keyframes wfsShimmer{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}
|
|
408
|
+
.wfs-rise{animation:wfsRise 0.32s cubic-bezier(0.22,1,0.36,1) both}
|
|
409
|
+
@media (prefers-reduced-motion: reduce){
|
|
410
|
+
.wfs-anim,.wfs-rise,.wfs-shim{animation:none !important}
|
|
411
|
+
.wfs-rise{opacity:1 !important;transform:none !important}
|
|
412
|
+
}`;
|
|
413
|
+
function ProgressMeter({
|
|
414
|
+
done,
|
|
415
|
+
total,
|
|
416
|
+
accent,
|
|
417
|
+
muted,
|
|
418
|
+
loading
|
|
419
|
+
}) {
|
|
420
|
+
const pct = total > 0 ? Math.round(done / total * 100) : 0;
|
|
421
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
422
|
+
"div",
|
|
423
|
+
{
|
|
424
|
+
"data-testid": "workflow-stepper-progress",
|
|
425
|
+
style: { display: "flex", alignItems: "center", gap: 8, padding: "0 2px 6px" },
|
|
426
|
+
children: [
|
|
427
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
428
|
+
"span",
|
|
429
|
+
{
|
|
430
|
+
style: {
|
|
431
|
+
fontSize: 10.5,
|
|
432
|
+
fontWeight: 600,
|
|
433
|
+
color: muted,
|
|
434
|
+
fontVariantNumeric: "tabular-nums",
|
|
435
|
+
letterSpacing: "0.01em",
|
|
436
|
+
whiteSpace: "nowrap"
|
|
437
|
+
},
|
|
438
|
+
children: loading ? "\u2014" : `${done} / ${total} \xB7 ${pct}%`
|
|
439
|
+
}
|
|
440
|
+
),
|
|
441
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
442
|
+
"span",
|
|
443
|
+
{
|
|
444
|
+
style: {
|
|
445
|
+
flex: 1,
|
|
446
|
+
height: 3,
|
|
447
|
+
borderRadius: 3,
|
|
448
|
+
background: "#eceff4",
|
|
449
|
+
overflow: "hidden",
|
|
450
|
+
minWidth: 40
|
|
451
|
+
},
|
|
452
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
453
|
+
"span",
|
|
454
|
+
{
|
|
455
|
+
className: loading ? "wfs-shim" : void 0,
|
|
456
|
+
style: {
|
|
457
|
+
display: "block",
|
|
458
|
+
height: "100%",
|
|
459
|
+
width: loading ? "100%" : `${pct}%`,
|
|
460
|
+
borderRadius: 3,
|
|
461
|
+
background: loading ? `linear-gradient(90deg, #eceff4, ${accent}55, #eceff4)` : accent,
|
|
462
|
+
backgroundSize: loading ? "200px 100%" : void 0,
|
|
463
|
+
animation: loading ? "wfsShimmer 1.1s linear infinite" : void 0,
|
|
464
|
+
transition: "width 0.45s cubic-bezier(0.22,1,0.36,1)"
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
)
|
|
468
|
+
}
|
|
469
|
+
)
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
function WorkflowStepperRenderer({
|
|
475
|
+
data,
|
|
476
|
+
selectedStep = null,
|
|
477
|
+
onSelectStep,
|
|
478
|
+
density = "auto",
|
|
479
|
+
loading = false,
|
|
480
|
+
loadingSteps = 6,
|
|
481
|
+
showProgress = true
|
|
482
|
+
}) {
|
|
483
|
+
var _a, _b, _c, _d, _e, _f;
|
|
484
|
+
const { BORDER: BORDER2, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
|
|
485
|
+
const steps = (_a = data.steps) != null ? _a : [];
|
|
486
|
+
const activeStepId = (_d = (_c = data.active_step) != null ? _c : (_b = steps.find((s) => s.status === "active")) == null ? void 0 : _b.id) != null ? _d : null;
|
|
487
|
+
const interactive = typeof onSelectStep === "function";
|
|
488
|
+
const statusColor = (s) => s === "active" ? ACCENT2 : STATUS_COLORS[s];
|
|
489
|
+
const doneCount = steps.filter((s) => s.status === "done").length;
|
|
490
|
+
const rootRef = React4__default.default.useRef(null);
|
|
491
|
+
const containerW = useContainerWidth(rootRef);
|
|
492
|
+
let resolved = density === "auto" ? "full" : density;
|
|
493
|
+
if (density === "auto" && containerW > 0) {
|
|
494
|
+
const needed = steps.length * CARD_MIN + Math.max(0, steps.length - 1) * CARD_GAP;
|
|
495
|
+
resolved = containerW < AUTO_COMPACT_BELOW || needed > containerW * 1.6 ? "compact" : "full";
|
|
496
|
+
}
|
|
497
|
+
const scrollerRef = React4__default.default.useRef(null);
|
|
498
|
+
React4__default.default.useEffect(() => {
|
|
499
|
+
if (resolved !== "full" || loading) return;
|
|
500
|
+
const sc = scrollerRef.current;
|
|
501
|
+
if (!sc) return;
|
|
502
|
+
const el = sc.querySelector(
|
|
503
|
+
`[data-testid="workflow-stepper-step-${selectedStep != null ? selectedStep : activeStepId}"]`
|
|
504
|
+
);
|
|
505
|
+
if (el && sc.scrollWidth > sc.clientWidth) {
|
|
506
|
+
el.scrollIntoView({ inline: "center", block: "nearest", behavior: "smooth" });
|
|
507
|
+
}
|
|
508
|
+
}, [resolved, loading, selectedStep, activeStepId]);
|
|
509
|
+
const [edges, setEdges] = React4__default.default.useState({
|
|
510
|
+
left: false,
|
|
511
|
+
right: false
|
|
512
|
+
});
|
|
513
|
+
const updateEdges = React4__default.default.useCallback(() => {
|
|
514
|
+
const sc = scrollerRef.current;
|
|
515
|
+
if (!sc) return;
|
|
516
|
+
const max = sc.scrollWidth - sc.clientWidth;
|
|
517
|
+
const sl = sc.scrollLeft;
|
|
518
|
+
const left = sl > 1;
|
|
519
|
+
const right = sl < max - 1;
|
|
520
|
+
setEdges((prev) => prev.left === left && prev.right === right ? prev : { left, right });
|
|
521
|
+
}, []);
|
|
522
|
+
React4__default.default.useLayoutEffect(() => {
|
|
523
|
+
if (resolved !== "full" || loading) return;
|
|
524
|
+
updateEdges();
|
|
525
|
+
const sc = scrollerRef.current;
|
|
526
|
+
if (!sc || typeof ResizeObserver === "undefined") return;
|
|
527
|
+
const ro = new ResizeObserver(updateEdges);
|
|
528
|
+
ro.observe(sc);
|
|
529
|
+
return () => ro.disconnect();
|
|
530
|
+
}, [resolved, loading, steps.length, updateEdges]);
|
|
531
|
+
const edgeMask = edges.left || edges.right ? `linear-gradient(90deg, ${edges.left ? "transparent 0, #000 14px" : "#000 0"}, ${edges.right ? "#000 calc(100% - 14px), transparent 100%" : "#000 100%"})` : void 0;
|
|
532
|
+
const themeStyle = { ["--wfs-accent"]: ACCENT2 };
|
|
533
|
+
if (loading) {
|
|
534
|
+
const ghosts = Array.from({ length: Math.max(2, loadingSteps) });
|
|
535
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-testid": "workflow-stepper-loading", style: __spreadValues({ width: "100%", minWidth: 0 }, themeStyle), children: [
|
|
536
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: KEYFRAMES }),
|
|
537
|
+
showProgress && /* @__PURE__ */ jsxRuntime.jsx(ProgressMeter, { done: 0, total: 0, accent: ACCENT2, muted: MUTED2, loading: true }),
|
|
538
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", alignItems: "stretch", gap: CARD_GAP, padding: "2px 2px 6px", overflow: "hidden" }, children: ghosts.map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
539
|
+
"div",
|
|
540
|
+
{
|
|
541
|
+
className: "wfs-shim",
|
|
542
|
+
"aria-hidden": "true",
|
|
543
|
+
style: {
|
|
544
|
+
flex: "0 1 168px",
|
|
545
|
+
minWidth: CARD_MIN,
|
|
546
|
+
height: 84,
|
|
547
|
+
borderRadius: 10,
|
|
548
|
+
border: `1px solid ${BORDER2}`,
|
|
549
|
+
background: `linear-gradient(90deg, #f4f6f9, #eceff4 40%, #f4f6f9 80%)`,
|
|
550
|
+
backgroundSize: "200px 100%",
|
|
551
|
+
animation: "wfsShimmer 1.1s linear infinite",
|
|
552
|
+
animationDelay: `${i * 0.08}s`
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
i
|
|
556
|
+
)) })
|
|
557
|
+
] });
|
|
558
|
+
}
|
|
559
|
+
if (resolved === "compact") {
|
|
560
|
+
const activeStep = (_e = steps.find((s) => s.id === activeStepId)) != null ? _e : null;
|
|
561
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
562
|
+
"div",
|
|
563
|
+
{
|
|
564
|
+
ref: rootRef,
|
|
565
|
+
"data-testid": "workflow-stepper-compact",
|
|
566
|
+
style: __spreadValues({ width: "100%", minWidth: 0 }, themeStyle),
|
|
567
|
+
children: [
|
|
568
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: KEYFRAMES }),
|
|
569
|
+
showProgress && /* @__PURE__ */ jsxRuntime.jsx(ProgressMeter, { done: doneCount, total: steps.length, accent: ACCENT2, muted: MUTED2 }),
|
|
570
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12, minWidth: 0 }, children: [
|
|
571
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", alignItems: "center", flexShrink: 0 }, children: steps.map((s, i) => {
|
|
572
|
+
const sel = selectedStep === s.id;
|
|
573
|
+
const act = s.status === "active";
|
|
574
|
+
const done = s.status === "done";
|
|
575
|
+
const reached = s.status !== "pending";
|
|
576
|
+
const clickable = interactive && reached;
|
|
577
|
+
const size = act ? 11 : done ? 9 : 8;
|
|
578
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React4__default.default.Fragment, { children: [
|
|
579
|
+
i > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
580
|
+
"span",
|
|
581
|
+
{
|
|
582
|
+
"aria-hidden": "true",
|
|
583
|
+
style: {
|
|
584
|
+
width: 14,
|
|
585
|
+
height: 1.5,
|
|
586
|
+
borderRadius: 1,
|
|
587
|
+
background: steps[i - 1].status === "done" ? "#15803d" : "#e5e7eb",
|
|
588
|
+
transition: "background 0.36s ease-out"
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
),
|
|
592
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
593
|
+
"button",
|
|
594
|
+
{
|
|
595
|
+
type: "button",
|
|
596
|
+
disabled: interactive && !reached,
|
|
597
|
+
"aria-disabled": interactive && !reached ? true : void 0,
|
|
598
|
+
title: `${s.title} \xB7 ${STATUS_LABELS[s.status]}`,
|
|
599
|
+
onClick: clickable ? () => onSelectStep == null ? void 0 : onSelectStep(sel ? null : s.id) : void 0,
|
|
600
|
+
"data-testid": `workflow-stepper-step-${s.id}`,
|
|
601
|
+
"data-status": s.status,
|
|
602
|
+
"data-reached": reached || void 0,
|
|
603
|
+
className: act ? "wfs-anim" : void 0,
|
|
604
|
+
style: {
|
|
605
|
+
position: "relative",
|
|
606
|
+
width: size,
|
|
607
|
+
height: size,
|
|
608
|
+
padding: 0,
|
|
609
|
+
borderRadius: "50%",
|
|
610
|
+
background: statusColor(s.status),
|
|
611
|
+
flexShrink: 0,
|
|
612
|
+
// border-box so the selected 2px border can't grow the dot
|
|
613
|
+
// and reflow the rail.
|
|
614
|
+
boxSizing: "border-box",
|
|
615
|
+
opacity: reached ? 1 : 0.55,
|
|
616
|
+
border: sel ? `2px solid ${ACCENT2}` : done ? "none" : "1px solid rgba(255,255,255,0.6)",
|
|
617
|
+
boxShadow: sel ? "0 0 0 2px #fff" : "none",
|
|
618
|
+
cursor: clickable ? "pointer" : "default",
|
|
619
|
+
transition: "width 0.15s, height 0.15s",
|
|
620
|
+
animation: act ? "wfsLampPulse 1.8s ease-in-out infinite" : "none"
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
)
|
|
624
|
+
] }, s.id);
|
|
625
|
+
}) }),
|
|
626
|
+
activeStep && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
627
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", style: { width: 1, height: 16, background: "#e6eaf1", flexShrink: 0 } }),
|
|
628
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "flex", alignItems: "center", gap: 7, minWidth: 0 }, children: [
|
|
629
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
630
|
+
"span",
|
|
631
|
+
{
|
|
632
|
+
"aria-hidden": "true",
|
|
633
|
+
style: {
|
|
634
|
+
width: 17,
|
|
635
|
+
height: 17,
|
|
636
|
+
borderRadius: "50%",
|
|
637
|
+
flexShrink: 0,
|
|
638
|
+
display: "flex",
|
|
639
|
+
alignItems: "center",
|
|
640
|
+
justifyContent: "center",
|
|
641
|
+
fontSize: 9.5,
|
|
642
|
+
fontWeight: 700,
|
|
643
|
+
lineHeight: 1,
|
|
644
|
+
background: activeStep.status === "done" ? "#15803d" : activeStep.status === "review" ? "#fff" : activeStep.status === "failed" ? "#dc2626" : ACCENT2,
|
|
645
|
+
color: activeStep.status === "review" ? "#b45309" : "#fff",
|
|
646
|
+
border: activeStep.status === "review" ? "1.5px solid #f59e0b" : "none"
|
|
647
|
+
},
|
|
648
|
+
children: activeStep.status === "done" ? "\u2713" : activeStep.status === "failed" ? "!" : (_f = activeStep.n) != null ? _f : steps.findIndex((x) => x.id === activeStep.id) + 1
|
|
649
|
+
}
|
|
650
|
+
),
|
|
651
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
652
|
+
"span",
|
|
653
|
+
{
|
|
654
|
+
style: {
|
|
655
|
+
fontSize: 12.5,
|
|
656
|
+
fontWeight: 650,
|
|
657
|
+
color: "var(--foreground)",
|
|
658
|
+
letterSpacing: "-0.01em",
|
|
659
|
+
whiteSpace: "nowrap",
|
|
660
|
+
overflow: "hidden",
|
|
661
|
+
textOverflow: "ellipsis",
|
|
662
|
+
minWidth: 0
|
|
663
|
+
},
|
|
664
|
+
children: [
|
|
665
|
+
activeStep.title,
|
|
666
|
+
activeStep.sub ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontWeight: 400, color: MUTED2 }, children: [
|
|
667
|
+
" \xB7 ",
|
|
668
|
+
activeStep.sub
|
|
669
|
+
] }) : null
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
)
|
|
673
|
+
] })
|
|
674
|
+
] })
|
|
675
|
+
] })
|
|
676
|
+
]
|
|
677
|
+
}
|
|
678
|
+
);
|
|
679
|
+
}
|
|
680
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, "data-testid": "workflow-stepper", style: __spreadValues({ width: "100%", minWidth: 0 }, themeStyle), children: [
|
|
681
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: KEYFRAMES }),
|
|
682
|
+
showProgress && /* @__PURE__ */ jsxRuntime.jsx(ProgressMeter, { done: doneCount, total: steps.length, accent: ACCENT2, muted: MUTED2 }),
|
|
683
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
684
|
+
"div",
|
|
685
|
+
{
|
|
686
|
+
ref: scrollerRef,
|
|
687
|
+
className: "wfs-scroller",
|
|
688
|
+
onScroll: updateEdges,
|
|
689
|
+
style: {
|
|
690
|
+
display: "flex",
|
|
691
|
+
alignItems: "stretch",
|
|
692
|
+
overflowX: "auto",
|
|
693
|
+
scrollSnapType: "x proximity",
|
|
694
|
+
padding: "2px 2px 4px",
|
|
695
|
+
// Thin, always-styled scrollbar (Firefox + Windows/desktop WebKit
|
|
696
|
+
// where overlay scrollbars aren't available). macOS/mobile show
|
|
697
|
+
// overlay scrollbars on scroll; harmless either way.
|
|
698
|
+
scrollbarWidth: "thin",
|
|
699
|
+
scrollbarColor: "#c2c9d6 transparent",
|
|
700
|
+
// Edge fade ONLY on the side(s) with hidden content — never when the
|
|
701
|
+
// row isn't scrollable, so the last card's right edge stays crisp.
|
|
702
|
+
maskImage: edgeMask,
|
|
703
|
+
WebkitMaskImage: edgeMask
|
|
704
|
+
},
|
|
705
|
+
children: [
|
|
706
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
707
|
+
.wfs-scroller::-webkit-scrollbar{height:8px}
|
|
708
|
+
.wfs-scroller::-webkit-scrollbar-track{background:transparent}
|
|
709
|
+
.wfs-scroller::-webkit-scrollbar-thumb{background:#c2c9d6;border-radius:8px;border:2px solid transparent;background-clip:padding-box}
|
|
710
|
+
.wfs-scroller:hover::-webkit-scrollbar-thumb{background:#aab2c2;background-clip:padding-box}
|
|
711
|
+
` }),
|
|
712
|
+
steps.map((step, i) => {
|
|
713
|
+
var _a2;
|
|
714
|
+
const isSelected = selectedStep === step.id;
|
|
715
|
+
const isActive = step.status === "active";
|
|
716
|
+
const reached = step.status !== "pending";
|
|
717
|
+
const clickable = interactive && reached;
|
|
718
|
+
const color = statusColor(step.status);
|
|
719
|
+
const humans = ((_a2 = step.assignees) != null ? _a2 : []).filter((a) => a.kind === "human");
|
|
720
|
+
const roleCaption = humans.map((h) => h.role).filter(Boolean).slice(0, 2).join(" \xB7 ");
|
|
721
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React4__default.default.Fragment, { children: [
|
|
722
|
+
i > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
723
|
+
"div",
|
|
724
|
+
{
|
|
725
|
+
style: {
|
|
726
|
+
width: CARD_GAP,
|
|
727
|
+
flexShrink: 0,
|
|
728
|
+
display: "flex",
|
|
729
|
+
alignItems: "center"
|
|
730
|
+
},
|
|
731
|
+
"aria-hidden": "true",
|
|
732
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
733
|
+
"div",
|
|
734
|
+
{
|
|
735
|
+
style: {
|
|
736
|
+
width: "100%",
|
|
737
|
+
height: 1.5,
|
|
738
|
+
borderRadius: 1,
|
|
739
|
+
// Fill sweep: completed rails wash green left→right.
|
|
740
|
+
background: steps[i - 1].status === "done" ? "linear-gradient(90deg, #15803d, #15803d)" : "#e5e7eb",
|
|
741
|
+
backgroundSize: "100% 100%",
|
|
742
|
+
transition: "background 0.36s ease-out"
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
)
|
|
746
|
+
}
|
|
747
|
+
),
|
|
748
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
749
|
+
"div",
|
|
750
|
+
{
|
|
751
|
+
role: clickable ? "button" : void 0,
|
|
752
|
+
tabIndex: clickable ? 0 : void 0,
|
|
753
|
+
"aria-disabled": interactive && !reached ? true : void 0,
|
|
754
|
+
className: "wfs-rise",
|
|
755
|
+
"data-testid": `workflow-stepper-step-${step.id}`,
|
|
756
|
+
"data-status": step.status,
|
|
757
|
+
"data-selected": isSelected || void 0,
|
|
758
|
+
"data-reached": reached || void 0,
|
|
759
|
+
onClick: clickable ? () => onSelectStep == null ? void 0 : onSelectStep(isSelected ? null : step.id) : void 0,
|
|
760
|
+
onKeyDown: clickable ? (e) => {
|
|
761
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
762
|
+
e.preventDefault();
|
|
763
|
+
onSelectStep == null ? void 0 : onSelectStep(isSelected ? null : step.id);
|
|
764
|
+
}
|
|
765
|
+
} : void 0,
|
|
766
|
+
onMouseEnter: clickable ? (e) => {
|
|
767
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
768
|
+
e.currentTarget.style.boxShadow = "0 3px 10px rgba(15,23,42,0.08)";
|
|
769
|
+
} : void 0,
|
|
770
|
+
onMouseLeave: clickable ? (e) => {
|
|
771
|
+
e.currentTarget.style.transform = "none";
|
|
772
|
+
e.currentTarget.style.boxShadow = "0 1px 2px rgba(0,0,0,0.04)";
|
|
773
|
+
} : void 0,
|
|
774
|
+
style: {
|
|
775
|
+
position: "relative",
|
|
776
|
+
flex: "0 1 168px",
|
|
777
|
+
minWidth: CARD_MIN,
|
|
778
|
+
maxWidth: 208,
|
|
779
|
+
scrollSnapAlign: "center",
|
|
780
|
+
borderRadius: 10,
|
|
781
|
+
boxSizing: "border-box",
|
|
782
|
+
// Selection changes border COLOR only (constant 1px width) so
|
|
783
|
+
// the card never reflows the row on click.
|
|
784
|
+
border: `1px solid ${isSelected ? ACCENT2 : BORDER2}`,
|
|
785
|
+
background: isSelected ? `${ACCENT2}0d` : "white",
|
|
786
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.04)",
|
|
787
|
+
padding: "10px 11px",
|
|
788
|
+
display: "flex",
|
|
789
|
+
flexDirection: "column",
|
|
790
|
+
gap: 7,
|
|
791
|
+
cursor: clickable ? "pointer" : "default",
|
|
792
|
+
opacity: reached ? 1 : 0.62,
|
|
793
|
+
transition: "border-color 0.15s, background 0.15s, transform 0.12s, box-shadow 0.12s",
|
|
794
|
+
animationDelay: `${Math.min(i, 10) * 0.04}s`,
|
|
795
|
+
overflow: "hidden"
|
|
796
|
+
},
|
|
797
|
+
children: [
|
|
798
|
+
isActive && !isSelected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
799
|
+
"span",
|
|
800
|
+
{
|
|
801
|
+
style: {
|
|
802
|
+
position: "absolute",
|
|
803
|
+
left: 0,
|
|
804
|
+
top: 6,
|
|
805
|
+
bottom: 6,
|
|
806
|
+
width: 2,
|
|
807
|
+
borderRadius: 2,
|
|
808
|
+
background: ACCENT2
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
),
|
|
812
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
813
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
814
|
+
/* @__PURE__ */ jsxRuntime.jsx(IndexDot, { step, index: i, accent: ACCENT2 }),
|
|
815
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
816
|
+
"span",
|
|
817
|
+
{
|
|
818
|
+
className: isActive ? "wfs-anim" : void 0,
|
|
819
|
+
style: {
|
|
820
|
+
width: 6,
|
|
821
|
+
height: 6,
|
|
822
|
+
borderRadius: "50%",
|
|
823
|
+
background: color,
|
|
824
|
+
animation: isActive ? "wfsLampPulse 1.8s ease-in-out infinite" : "none"
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
)
|
|
828
|
+
] }),
|
|
829
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
830
|
+
"span",
|
|
831
|
+
{
|
|
832
|
+
style: {
|
|
833
|
+
fontSize: 9,
|
|
834
|
+
fontWeight: 600,
|
|
835
|
+
letterSpacing: "0.05em",
|
|
836
|
+
textTransform: "uppercase",
|
|
837
|
+
color
|
|
838
|
+
},
|
|
839
|
+
children: STATUS_LABELS[step.status]
|
|
840
|
+
}
|
|
841
|
+
)
|
|
842
|
+
] }),
|
|
843
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { minWidth: 0 }, children: [
|
|
844
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
845
|
+
"div",
|
|
846
|
+
{
|
|
847
|
+
style: {
|
|
848
|
+
fontSize: 12.5,
|
|
849
|
+
fontWeight: 600,
|
|
850
|
+
color: "var(--foreground)",
|
|
851
|
+
lineHeight: 1.25,
|
|
852
|
+
letterSpacing: "-0.01em",
|
|
853
|
+
overflow: "hidden",
|
|
854
|
+
textOverflow: "ellipsis",
|
|
855
|
+
whiteSpace: "nowrap"
|
|
856
|
+
},
|
|
857
|
+
children: step.title
|
|
858
|
+
}
|
|
859
|
+
),
|
|
860
|
+
step.sub && /* @__PURE__ */ jsxRuntime.jsx(
|
|
861
|
+
"div",
|
|
862
|
+
{
|
|
863
|
+
style: {
|
|
864
|
+
fontSize: 10.5,
|
|
865
|
+
color: MUTED2,
|
|
866
|
+
marginTop: 2,
|
|
867
|
+
overflow: "hidden",
|
|
868
|
+
textOverflow: "ellipsis",
|
|
869
|
+
whiteSpace: "nowrap"
|
|
870
|
+
},
|
|
871
|
+
children: step.sub
|
|
872
|
+
}
|
|
873
|
+
)
|
|
874
|
+
] }),
|
|
875
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
876
|
+
"div",
|
|
877
|
+
{
|
|
878
|
+
style: {
|
|
879
|
+
display: "flex",
|
|
880
|
+
alignItems: "center",
|
|
881
|
+
justifyContent: "space-between",
|
|
882
|
+
marginTop: "auto",
|
|
883
|
+
minHeight: 20
|
|
884
|
+
},
|
|
885
|
+
children: [
|
|
886
|
+
step.assignees && step.assignees.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(AvatarStack, { assignees: step.assignees, accent: ACCENT2 }) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
|
|
887
|
+
roleCaption && /* @__PURE__ */ jsxRuntime.jsx(
|
|
888
|
+
"span",
|
|
889
|
+
{
|
|
890
|
+
style: {
|
|
891
|
+
fontSize: 9,
|
|
892
|
+
color: "#9ca3af",
|
|
893
|
+
fontWeight: 500,
|
|
894
|
+
textAlign: "right",
|
|
895
|
+
maxWidth: 76,
|
|
896
|
+
lineHeight: 1.2,
|
|
897
|
+
overflow: "hidden"
|
|
898
|
+
},
|
|
899
|
+
children: roleCaption
|
|
900
|
+
}
|
|
901
|
+
)
|
|
902
|
+
]
|
|
903
|
+
}
|
|
904
|
+
)
|
|
905
|
+
]
|
|
906
|
+
}
|
|
907
|
+
)
|
|
908
|
+
] }, step.id);
|
|
909
|
+
})
|
|
910
|
+
]
|
|
911
|
+
}
|
|
912
|
+
)
|
|
913
|
+
] });
|
|
914
|
+
}
|
|
915
|
+
function WorkflowStepperResolver(p) {
|
|
916
|
+
var _a;
|
|
917
|
+
const { selectedStepId, onStepSelect } = useGenUIInteraction();
|
|
918
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "workflow-stepper", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
919
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }, children: [
|
|
920
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
921
|
+
"p",
|
|
922
|
+
{
|
|
923
|
+
style: {
|
|
924
|
+
fontFamily: "var(--font-serif)",
|
|
925
|
+
fontSize: "15px",
|
|
926
|
+
fontWeight: 400,
|
|
927
|
+
color: "var(--foreground)",
|
|
928
|
+
letterSpacing: "-0.01em",
|
|
929
|
+
margin: 0
|
|
930
|
+
},
|
|
931
|
+
children: p.title
|
|
932
|
+
}
|
|
933
|
+
),
|
|
934
|
+
p.period && /* @__PURE__ */ jsxRuntime.jsx(
|
|
935
|
+
"span",
|
|
936
|
+
{
|
|
937
|
+
style: {
|
|
938
|
+
fontSize: 11,
|
|
939
|
+
fontWeight: 600,
|
|
940
|
+
padding: "2px 8px",
|
|
941
|
+
borderRadius: 9999,
|
|
942
|
+
background: "#f2f2f2",
|
|
943
|
+
color: "#777777",
|
|
944
|
+
fontVariantNumeric: "tabular-nums"
|
|
945
|
+
},
|
|
946
|
+
children: p.period
|
|
947
|
+
}
|
|
948
|
+
),
|
|
949
|
+
p.badge && /* @__PURE__ */ jsxRuntime.jsx(
|
|
950
|
+
"span",
|
|
951
|
+
{
|
|
952
|
+
style: {
|
|
953
|
+
fontSize: 11,
|
|
954
|
+
fontWeight: 600,
|
|
955
|
+
padding: "2px 8px",
|
|
956
|
+
borderRadius: 9999,
|
|
957
|
+
border: "1px solid #dedede",
|
|
958
|
+
color: "#777777"
|
|
959
|
+
},
|
|
960
|
+
children: p.badge
|
|
961
|
+
}
|
|
962
|
+
)
|
|
963
|
+
] }),
|
|
964
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
965
|
+
WorkflowStepperRenderer,
|
|
966
|
+
{
|
|
967
|
+
data: p,
|
|
968
|
+
selectedStep: selectedStepId,
|
|
969
|
+
onSelectStep: onStepSelect
|
|
970
|
+
}
|
|
971
|
+
)
|
|
972
|
+
] }) });
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
exports.WorkflowStepperRenderer = WorkflowStepperRenderer;
|
|
976
|
+
exports.WorkflowStepperResolver = WorkflowStepperResolver;
|
|
977
|
+
//# sourceMappingURL=resolver.cjs.map
|
|
978
|
+
//# sourceMappingURL=resolver.cjs.map
|