@flopay/ui 1.10.2 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -3
- package/dist/index.cjs +363 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +107 -2
- package/dist/index.d.ts +107 -2
- package/dist/index.mjs +354 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +303 -0
package/dist/index.cjs
CHANGED
|
@@ -21,8 +21,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
Badge: () => Badge,
|
|
24
|
+
BlockList: () => BlockList,
|
|
24
25
|
Button: () => Button,
|
|
25
26
|
Card: () => Card,
|
|
27
|
+
Checklist: () => Checklist,
|
|
28
|
+
ChecklistRow: () => ChecklistRow,
|
|
29
|
+
ChecklistSkeleton: () => ChecklistSkeleton,
|
|
26
30
|
CodeArea: () => CodeArea,
|
|
27
31
|
Container: () => Container,
|
|
28
32
|
EmptyState: () => EmptyState,
|
|
@@ -34,6 +38,7 @@ __export(index_exports, {
|
|
|
34
38
|
SectionHeader: () => SectionHeader,
|
|
35
39
|
SlotTextField: () => SlotTextField,
|
|
36
40
|
Spinner: () => Spinner,
|
|
41
|
+
StepIndicator: () => StepIndicator,
|
|
37
42
|
Switch: () => Switch,
|
|
38
43
|
VariablePicker: () => VariablePicker,
|
|
39
44
|
cn: () => cn
|
|
@@ -69,8 +74,194 @@ function Badge({
|
|
|
69
74
|
] });
|
|
70
75
|
}
|
|
71
76
|
|
|
72
|
-
// src/components/
|
|
77
|
+
// src/components/block-list.tsx
|
|
78
|
+
var import_react = require("react");
|
|
73
79
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
80
|
+
function canMove(items, from, to) {
|
|
81
|
+
if (from === to || to < 0 || to >= items.length) return false;
|
|
82
|
+
const low = Math.min(from, to);
|
|
83
|
+
const high = Math.max(from, to);
|
|
84
|
+
for (let index = low; index <= high; index += 1) {
|
|
85
|
+
if (items[index]?.locked) return false;
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
function moved(items, from, to) {
|
|
90
|
+
const next = items.slice();
|
|
91
|
+
const [item] = next.splice(from, 1);
|
|
92
|
+
next.splice(to, 0, item);
|
|
93
|
+
return next;
|
|
94
|
+
}
|
|
95
|
+
function focusWasLost() {
|
|
96
|
+
const active = document.activeElement;
|
|
97
|
+
return !active || active === document.body || active instanceof HTMLButtonElement && active.disabled;
|
|
98
|
+
}
|
|
99
|
+
function enabledButton(rows, at, label) {
|
|
100
|
+
return rows[at]?.querySelector(`button[aria-label="${label}"]:enabled`) ?? null;
|
|
101
|
+
}
|
|
102
|
+
function rowAfterDelete(items, deletedAt) {
|
|
103
|
+
for (let at = deletedAt; at < items.length; at += 1) {
|
|
104
|
+
if (!items[at]?.locked) return at;
|
|
105
|
+
}
|
|
106
|
+
for (let at = Math.min(deletedAt, items.length) - 1; at >= 0; at -= 1) {
|
|
107
|
+
if (!items[at]?.locked) return at;
|
|
108
|
+
}
|
|
109
|
+
return -1;
|
|
110
|
+
}
|
|
111
|
+
function focusTarget(rows, items, pending) {
|
|
112
|
+
if ("deletedAt" in pending) {
|
|
113
|
+
const at2 = rowAfterDelete(items, pending.deletedAt);
|
|
114
|
+
return at2 < 0 ? null : enabledButton(rows, at2, "Delete");
|
|
115
|
+
}
|
|
116
|
+
const at = items.findIndex((item) => item.id === pending.movedId);
|
|
117
|
+
if (at < 0) return null;
|
|
118
|
+
const other = pending.label === "Move up" ? "Move down" : "Move up";
|
|
119
|
+
return enabledButton(rows, at, pending.label) ?? enabledButton(rows, at, other) ?? enabledButton(rows, at, "Delete");
|
|
120
|
+
}
|
|
121
|
+
var icons = {
|
|
122
|
+
grip: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "6", cy: "4", r: "1.25" }),
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "10", cy: "4", r: "1.25" }),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "6", cy: "8", r: "1.25" }),
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "10", cy: "8", r: "1.25" }),
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "6", cy: "12", r: "1.25" }),
|
|
128
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "10", cy: "12", r: "1.25" })
|
|
129
|
+
] }),
|
|
130
|
+
up: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M8 12.5v-9M4 7.5l4-4 4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
131
|
+
down: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M8 3.5v9M4 8.5l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
132
|
+
delete: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M4.5 4.5l7 7M11.5 4.5l-7 7", fill: "none", stroke: "currentColor", strokeWidth: "1.5" })
|
|
133
|
+
};
|
|
134
|
+
function Icon({ name }) {
|
|
135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
136
|
+
"svg",
|
|
137
|
+
{
|
|
138
|
+
className: "block-list-icon",
|
|
139
|
+
viewBox: "0 0 16 16",
|
|
140
|
+
fill: "currentColor",
|
|
141
|
+
strokeLinecap: "round",
|
|
142
|
+
strokeLinejoin: "round",
|
|
143
|
+
"aria-hidden": "true",
|
|
144
|
+
children: icons[name]
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
function BlockList({
|
|
149
|
+
items,
|
|
150
|
+
renderItem,
|
|
151
|
+
onChange,
|
|
152
|
+
className
|
|
153
|
+
}) {
|
|
154
|
+
const draggedId = (0, import_react.useRef)(null);
|
|
155
|
+
const list = (0, import_react.useRef)(null);
|
|
156
|
+
const pendingFocus = (0, import_react.useRef)(null);
|
|
157
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
158
|
+
const pending = pendingFocus.current;
|
|
159
|
+
pendingFocus.current = null;
|
|
160
|
+
const rows = list.current?.children;
|
|
161
|
+
if (pending && rows && focusWasLost()) focusTarget(rows, items, pending)?.focus();
|
|
162
|
+
}, [items]);
|
|
163
|
+
const moveByButton = (id, index, label) => {
|
|
164
|
+
pendingFocus.current = { movedId: id, label };
|
|
165
|
+
onChange(moved(items, index, label === "Move up" ? index - 1 : index + 1));
|
|
166
|
+
};
|
|
167
|
+
const deleteByButton = (index) => {
|
|
168
|
+
pendingFocus.current = { deletedAt: index };
|
|
169
|
+
onChange(items.filter((_, other) => other !== index));
|
|
170
|
+
};
|
|
171
|
+
const dropSource = (index) => {
|
|
172
|
+
const from = items.findIndex((item) => item.id === draggedId.current);
|
|
173
|
+
return from >= 0 && canMove(items, from, index) ? from : -1;
|
|
174
|
+
};
|
|
175
|
+
const startDrag = (event, id) => {
|
|
176
|
+
draggedId.current = id;
|
|
177
|
+
pendingFocus.current = null;
|
|
178
|
+
const transfer = event.dataTransfer;
|
|
179
|
+
if (!transfer) return;
|
|
180
|
+
transfer.effectAllowed = "move";
|
|
181
|
+
transfer.setData("text/plain", id);
|
|
182
|
+
const row = event.currentTarget.closest("li");
|
|
183
|
+
if (row) transfer.setDragImage(row, 0, 0);
|
|
184
|
+
};
|
|
185
|
+
const endDrag = () => {
|
|
186
|
+
draggedId.current = null;
|
|
187
|
+
};
|
|
188
|
+
const dragOver = (event, index) => {
|
|
189
|
+
if (dropSource(index) < 0) return;
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
const transfer = event.dataTransfer;
|
|
192
|
+
if (transfer) transfer.dropEffect = "move";
|
|
193
|
+
};
|
|
194
|
+
const drop = (event, index) => {
|
|
195
|
+
const from = dropSource(index);
|
|
196
|
+
draggedId.current = null;
|
|
197
|
+
if (from < 0) return;
|
|
198
|
+
event.preventDefault();
|
|
199
|
+
onChange(moved(items, from, index));
|
|
200
|
+
};
|
|
201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { ref: list, className: cn("block-list", className), children: items.map((item, index) => (
|
|
202
|
+
// biome-ignore lint/a11y/noNoninteractiveElementInteractions: the row is only a pointer drop target for the handle's native drag; keyboard and screen-reader users reorder with the row's Move buttons, so it needs no role or focus of its own
|
|
203
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
204
|
+
"li",
|
|
205
|
+
{
|
|
206
|
+
className: cn("block-list-row", item.locked && "block-list-row-locked"),
|
|
207
|
+
onDragOver: (event) => dragOver(event, index),
|
|
208
|
+
onDrop: (event) => drop(event, index),
|
|
209
|
+
children: [
|
|
210
|
+
item.locked ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
211
|
+
"span",
|
|
212
|
+
{
|
|
213
|
+
className: "block-list-handle",
|
|
214
|
+
draggable: true,
|
|
215
|
+
"aria-hidden": "true",
|
|
216
|
+
onDragStart: (event) => startDrag(event, item.id),
|
|
217
|
+
onDragEnd: endDrag,
|
|
218
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "grip" })
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "block-list-content", children: renderItem(item) }),
|
|
222
|
+
item.locked ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "block-list-controls", children: [
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
224
|
+
"button",
|
|
225
|
+
{
|
|
226
|
+
type: "button",
|
|
227
|
+
className: "block-list-button",
|
|
228
|
+
"aria-label": "Move up",
|
|
229
|
+
disabled: !canMove(items, index, index - 1),
|
|
230
|
+
onClick: () => moveByButton(item.id, index, "Move up"),
|
|
231
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "up" })
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
235
|
+
"button",
|
|
236
|
+
{
|
|
237
|
+
type: "button",
|
|
238
|
+
className: "block-list-button",
|
|
239
|
+
"aria-label": "Move down",
|
|
240
|
+
disabled: !canMove(items, index, index + 1),
|
|
241
|
+
onClick: () => moveByButton(item.id, index, "Move down"),
|
|
242
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "down" })
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
246
|
+
"button",
|
|
247
|
+
{
|
|
248
|
+
type: "button",
|
|
249
|
+
className: "block-list-button block-list-button-delete",
|
|
250
|
+
"aria-label": "Delete",
|
|
251
|
+
onClick: () => deleteByButton(index),
|
|
252
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "delete" })
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
] })
|
|
256
|
+
]
|
|
257
|
+
},
|
|
258
|
+
item.id
|
|
259
|
+
)
|
|
260
|
+
)) });
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// src/components/button.tsx
|
|
264
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
74
265
|
var variantClass2 = {
|
|
75
266
|
primary: "btn-primary",
|
|
76
267
|
secondary: "btn-secondary",
|
|
@@ -83,7 +274,7 @@ function Button({
|
|
|
83
274
|
type = "button",
|
|
84
275
|
...props
|
|
85
276
|
}) {
|
|
86
|
-
return /* @__PURE__ */ (0,
|
|
277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
87
278
|
"button",
|
|
88
279
|
{
|
|
89
280
|
type,
|
|
@@ -94,9 +285,9 @@ function Button({
|
|
|
94
285
|
}
|
|
95
286
|
|
|
96
287
|
// src/components/card.tsx
|
|
97
|
-
var
|
|
288
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
98
289
|
function Card({ padding = "md", interactive = false, className, ...props }) {
|
|
99
|
-
return /* @__PURE__ */ (0,
|
|
290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
100
291
|
"div",
|
|
101
292
|
{
|
|
102
293
|
className: cn(
|
|
@@ -110,28 +301,86 @@ function Card({ padding = "md", interactive = false, className, ...props }) {
|
|
|
110
301
|
);
|
|
111
302
|
}
|
|
112
303
|
|
|
304
|
+
// src/components/checklist.tsx
|
|
305
|
+
var import_react2 = require("react");
|
|
306
|
+
|
|
307
|
+
// src/components/check-icon.tsx
|
|
308
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
309
|
+
function CheckIcon({ className }) {
|
|
310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { className, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
311
|
+
"path",
|
|
312
|
+
{
|
|
313
|
+
d: "M3.5 8.5l3 3 6-7",
|
|
314
|
+
stroke: "currentColor",
|
|
315
|
+
strokeWidth: "2",
|
|
316
|
+
strokeLinecap: "round",
|
|
317
|
+
strokeLinejoin: "round"
|
|
318
|
+
}
|
|
319
|
+
) });
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// src/components/checklist.tsx
|
|
323
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
324
|
+
function Checklist({ children, className }) {
|
|
325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: cn("checklist", className), children });
|
|
326
|
+
}
|
|
327
|
+
function ChecklistRow({
|
|
328
|
+
label,
|
|
329
|
+
done = false,
|
|
330
|
+
status,
|
|
331
|
+
optional = false,
|
|
332
|
+
href,
|
|
333
|
+
linkAs,
|
|
334
|
+
statusLabels,
|
|
335
|
+
className
|
|
336
|
+
}) {
|
|
337
|
+
const state = done ? statusLabels?.done ?? "Done" : statusLabels?.notDone ?? "Not done";
|
|
338
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
339
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: cn("checklist-tick", done && "checklist-tick-done"), "aria-hidden": "true", children: done ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CheckIcon, { className: "checklist-tick-icon" }) : null }),
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "checklist-row-label", children: label }),
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "visually-hidden", children: state }),
|
|
342
|
+
optional ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { children: "Optional" }) : null,
|
|
343
|
+
status ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "checklist-row-status", children: status }) : null
|
|
344
|
+
] });
|
|
345
|
+
const Link = linkAs ?? "a";
|
|
346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { className: cn("checklist-row", className), children: href ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Link, { href, className: "checklist-row-body checklist-row-link", children: content }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "checklist-row-body", children: content }) });
|
|
347
|
+
}
|
|
348
|
+
function ChecklistSkeleton({ rows = 3, className }) {
|
|
349
|
+
const labelId = (0, import_react2.useId)();
|
|
350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn("checklist-skeleton", className), role: "status", "aria-labelledby": labelId, children: [
|
|
351
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { id: labelId, className: "visually-hidden", children: "Loading" }),
|
|
352
|
+
Array.from({ length: rows }, (_, index) => (
|
|
353
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: identical stateless placeholders with no identity of their own, so the position is the only key
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "checklist-skeleton-row", "aria-hidden": "true", children: [
|
|
355
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "checklist-skeleton-tick" }),
|
|
356
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "checklist-skeleton-line" })
|
|
357
|
+
] }, index)
|
|
358
|
+
))
|
|
359
|
+
] });
|
|
360
|
+
}
|
|
361
|
+
|
|
113
362
|
// src/components/code-area.tsx
|
|
114
|
-
var
|
|
363
|
+
var import_react3 = require("react");
|
|
115
364
|
|
|
116
365
|
// src/components/field.tsx
|
|
117
|
-
var
|
|
366
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
118
367
|
function Input({ className, ...props }) {
|
|
119
|
-
return /* @__PURE__ */ (0,
|
|
368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { className: cn("field", className), ...props });
|
|
120
369
|
}
|
|
121
370
|
function Label({ className, ...props }) {
|
|
122
|
-
return /* @__PURE__ */ (0,
|
|
371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { className: cn("field-label", className), ...props });
|
|
123
372
|
}
|
|
124
373
|
function Field({ label, hint, error, htmlFor, className, children }) {
|
|
125
374
|
const message = error || hint;
|
|
126
|
-
return /* @__PURE__ */ (0,
|
|
127
|
-
label ? /* @__PURE__ */ (0,
|
|
375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn("field-group", className), children: [
|
|
376
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Label, { htmlFor, children: label }) : null,
|
|
128
377
|
children,
|
|
129
|
-
message ? /* @__PURE__ */ (0,
|
|
378
|
+
message ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: error ? "field-error" : "field-hint", children: message }) : null
|
|
130
379
|
] });
|
|
131
380
|
}
|
|
132
381
|
|
|
133
382
|
// src/components/code-area.tsx
|
|
134
|
-
var
|
|
383
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
135
384
|
function CodeArea({
|
|
136
385
|
label,
|
|
137
386
|
hint,
|
|
@@ -144,9 +393,9 @@ function CodeArea({
|
|
|
144
393
|
name,
|
|
145
394
|
className
|
|
146
395
|
}) {
|
|
147
|
-
const generatedId = (0,
|
|
396
|
+
const generatedId = (0, import_react3.useId)();
|
|
148
397
|
const controlId = id ?? generatedId;
|
|
149
|
-
return /* @__PURE__ */ (0,
|
|
398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Field, { label, hint, error, htmlFor: controlId, className, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
150
399
|
"textarea",
|
|
151
400
|
{
|
|
152
401
|
ref,
|
|
@@ -168,46 +417,46 @@ function CodeArea({
|
|
|
168
417
|
}
|
|
169
418
|
|
|
170
419
|
// src/components/container.tsx
|
|
171
|
-
var
|
|
420
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
172
421
|
function Container({ className, ...props }) {
|
|
173
|
-
return /* @__PURE__ */ (0,
|
|
422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("container", className), ...props });
|
|
174
423
|
}
|
|
175
424
|
|
|
176
425
|
// src/components/feedback.tsx
|
|
177
|
-
var
|
|
426
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
178
427
|
function Spinner({ center = false, className, ...props }) {
|
|
179
|
-
const spinner = /* @__PURE__ */ (0,
|
|
180
|
-
return center ? /* @__PURE__ */ (0,
|
|
428
|
+
const spinner = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn("spinner", className), role: "status", "aria-label": "Loading", ...props });
|
|
429
|
+
return center ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "spinner-center", children: spinner }) : spinner;
|
|
181
430
|
}
|
|
182
431
|
function EmptyState({ title, description, icon, className }) {
|
|
183
|
-
return /* @__PURE__ */ (0,
|
|
184
|
-
icon ? /* @__PURE__ */ (0,
|
|
185
|
-
/* @__PURE__ */ (0,
|
|
186
|
-
description ? /* @__PURE__ */ (0,
|
|
432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: cn("empty-state", className), children: [
|
|
433
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "empty-state-icon", children: icon }) : null,
|
|
434
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "empty-state-title", children: title }),
|
|
435
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "empty-state-desc", children: description }) : null
|
|
187
436
|
] });
|
|
188
437
|
}
|
|
189
438
|
|
|
190
439
|
// src/components/preview-frame.tsx
|
|
191
|
-
var
|
|
440
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
192
441
|
function PreviewFrame({ html, title, className }) {
|
|
193
|
-
return /* @__PURE__ */ (0,
|
|
442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn("preview-frame", className), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("iframe", { className: "preview-frame-iframe", title, srcDoc: html, sandbox: "" }) });
|
|
194
443
|
}
|
|
195
444
|
|
|
196
445
|
// src/components/section.tsx
|
|
197
|
-
var
|
|
446
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
198
447
|
function Section({ className, ...props }) {
|
|
199
|
-
return /* @__PURE__ */ (0,
|
|
448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("section", { className: cn("section", className), ...props });
|
|
200
449
|
}
|
|
201
450
|
function SectionHeader({ label, title, description, className }) {
|
|
202
|
-
return /* @__PURE__ */ (0,
|
|
203
|
-
label ? /* @__PURE__ */ (0,
|
|
204
|
-
/* @__PURE__ */ (0,
|
|
205
|
-
description ? /* @__PURE__ */ (0,
|
|
451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("section-center", className), children: [
|
|
452
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "section-label", children: label }) : null,
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { className: "section-title", children: title }),
|
|
454
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "section-desc", children: description }) : null
|
|
206
455
|
] });
|
|
207
456
|
}
|
|
208
457
|
|
|
209
458
|
// src/components/slot-text-field.tsx
|
|
210
|
-
var
|
|
459
|
+
var import_react4 = require("react");
|
|
211
460
|
|
|
212
461
|
// src/components/text-selection.ts
|
|
213
462
|
var watched = /* @__PURE__ */ new WeakSet();
|
|
@@ -245,7 +494,7 @@ function assignRef(ref, node) {
|
|
|
245
494
|
}
|
|
246
495
|
|
|
247
496
|
// src/components/slot-text-field.tsx
|
|
248
|
-
var
|
|
497
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
249
498
|
var LINK_PLACEHOLDER = "https://";
|
|
250
499
|
function wrapWith(marker) {
|
|
251
500
|
return (selected) => ({
|
|
@@ -278,10 +527,10 @@ function SlotTextField({
|
|
|
278
527
|
name,
|
|
279
528
|
className
|
|
280
529
|
}) {
|
|
281
|
-
const generatedId = (0,
|
|
530
|
+
const generatedId = (0, import_react4.useId)();
|
|
282
531
|
const controlId = id ?? generatedId;
|
|
283
|
-
const control = (0,
|
|
284
|
-
const setControl = (0,
|
|
532
|
+
const control = (0, import_react4.useRef)(null);
|
|
533
|
+
const setControl = (0, import_react4.useCallback)(
|
|
285
534
|
(node) => {
|
|
286
535
|
control.current = node;
|
|
287
536
|
if (node) watchFocus(node);
|
|
@@ -298,7 +547,7 @@ function SlotTextField({
|
|
|
298
547
|
className: multiline ? "field field-multiline" : "field",
|
|
299
548
|
"aria-invalid": error ? true : void 0
|
|
300
549
|
};
|
|
301
|
-
return /* @__PURE__ */ (0,
|
|
550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
302
551
|
Field,
|
|
303
552
|
{
|
|
304
553
|
label,
|
|
@@ -307,7 +556,7 @@ function SlotTextField({
|
|
|
307
556
|
htmlFor: controlId,
|
|
308
557
|
className,
|
|
309
558
|
children: [
|
|
310
|
-
/* @__PURE__ */ (0,
|
|
559
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "slot-toolbar", children: FORMATS.map((format) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
311
560
|
"button",
|
|
312
561
|
{
|
|
313
562
|
type: "button",
|
|
@@ -319,15 +568,59 @@ function SlotTextField({
|
|
|
319
568
|
},
|
|
320
569
|
format.name
|
|
321
570
|
)) }),
|
|
322
|
-
multiline ? /* @__PURE__ */ (0,
|
|
571
|
+
multiline ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("textarea", { ref: setControl, rows: 4, ...shared }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { ref: setControl, type: "text", ...shared })
|
|
323
572
|
]
|
|
324
573
|
}
|
|
325
574
|
);
|
|
326
575
|
}
|
|
327
576
|
|
|
577
|
+
// src/components/step-indicator.tsx
|
|
578
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
579
|
+
var defaultStatusLabels = {
|
|
580
|
+
done: "Done",
|
|
581
|
+
current: "Current",
|
|
582
|
+
upcoming: "Upcoming"
|
|
583
|
+
};
|
|
584
|
+
var markerClass = {
|
|
585
|
+
done: "step-indicator-marker-done",
|
|
586
|
+
current: "step-indicator-marker-current",
|
|
587
|
+
upcoming: ""
|
|
588
|
+
};
|
|
589
|
+
function StepIndicator({ steps, statusLabels, className }) {
|
|
590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ol", { className: cn("step-indicator", className), children: steps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
591
|
+
"li",
|
|
592
|
+
{
|
|
593
|
+
className: "step-indicator-step",
|
|
594
|
+
"aria-current": step.status === "current" ? "step" : void 0,
|
|
595
|
+
children: [
|
|
596
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
597
|
+
"span",
|
|
598
|
+
{
|
|
599
|
+
className: cn("step-indicator-marker", markerClass[step.status]),
|
|
600
|
+
"aria-hidden": "true",
|
|
601
|
+
children: step.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CheckIcon, { className: "step-indicator-icon" }) : index + 1
|
|
602
|
+
}
|
|
603
|
+
),
|
|
604
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
605
|
+
"span",
|
|
606
|
+
{
|
|
607
|
+
className: cn(
|
|
608
|
+
"step-indicator-label",
|
|
609
|
+
step.status === "current" && "step-indicator-label-current"
|
|
610
|
+
),
|
|
611
|
+
children: step.label
|
|
612
|
+
}
|
|
613
|
+
),
|
|
614
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "visually-hidden", children: statusLabels?.[step.status] ?? defaultStatusLabels[step.status] })
|
|
615
|
+
]
|
|
616
|
+
},
|
|
617
|
+
index
|
|
618
|
+
)) });
|
|
619
|
+
}
|
|
620
|
+
|
|
328
621
|
// src/components/switch.tsx
|
|
329
|
-
var
|
|
330
|
-
var
|
|
622
|
+
var import_react5 = require("react");
|
|
623
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
331
624
|
function ignorePress(event) {
|
|
332
625
|
event.preventDefault();
|
|
333
626
|
}
|
|
@@ -343,10 +636,10 @@ function Switch({
|
|
|
343
636
|
name,
|
|
344
637
|
className
|
|
345
638
|
}) {
|
|
346
|
-
const generatedId = (0,
|
|
639
|
+
const generatedId = (0, import_react5.useId)();
|
|
347
640
|
const controlId = id ?? generatedId;
|
|
348
641
|
const labelId = `${controlId}-label`;
|
|
349
|
-
const [ownChecked, setOwnChecked] = (0,
|
|
642
|
+
const [ownChecked, setOwnChecked] = (0, import_react5.useState)(defaultChecked);
|
|
350
643
|
const isChecked = checked ?? ownChecked;
|
|
351
644
|
const toggle = () => {
|
|
352
645
|
if (loading) return;
|
|
@@ -354,8 +647,8 @@ function Switch({
|
|
|
354
647
|
if (checked === void 0) setOwnChecked(next);
|
|
355
648
|
onCheckedChange?.(next);
|
|
356
649
|
};
|
|
357
|
-
return /* @__PURE__ */ (0,
|
|
358
|
-
/* @__PURE__ */ (0,
|
|
650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: cn("switch", className), children: [
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
359
652
|
"button",
|
|
360
653
|
{
|
|
361
654
|
type: "button",
|
|
@@ -369,10 +662,10 @@ function Switch({
|
|
|
369
662
|
disabled,
|
|
370
663
|
onMouseDown: loading ? ignorePress : void 0,
|
|
371
664
|
onClick: toggle,
|
|
372
|
-
children: /* @__PURE__ */ (0,
|
|
665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "switch-thumb", "aria-hidden": "true" })
|
|
373
666
|
}
|
|
374
667
|
),
|
|
375
|
-
/* @__PURE__ */ (0,
|
|
668
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
376
669
|
"label",
|
|
377
670
|
{
|
|
378
671
|
id: labelId,
|
|
@@ -381,14 +674,14 @@ function Switch({
|
|
|
381
674
|
children: label
|
|
382
675
|
}
|
|
383
676
|
),
|
|
384
|
-
loading ? /* @__PURE__ */ (0,
|
|
385
|
-
name && isChecked && !disabled ? /* @__PURE__ */ (0,
|
|
677
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Spinner, { className: "switch-spinner" }) : null,
|
|
678
|
+
name && isChecked && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "hidden", name, value: "on" }) : null
|
|
386
679
|
] });
|
|
387
680
|
}
|
|
388
681
|
|
|
389
682
|
// src/components/variable-picker.tsx
|
|
390
|
-
var
|
|
391
|
-
var
|
|
683
|
+
var import_react6 = require("react");
|
|
684
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
392
685
|
function liquidToken(name) {
|
|
393
686
|
return `{{ ${name} }}`;
|
|
394
687
|
}
|
|
@@ -396,17 +689,17 @@ function keepFocus(event) {
|
|
|
396
689
|
event.preventDefault();
|
|
397
690
|
}
|
|
398
691
|
function VariablePicker({ variables, targetRef, className }) {
|
|
399
|
-
const menuId = (0,
|
|
400
|
-
const trigger = (0,
|
|
401
|
-
const menu = (0,
|
|
402
|
-
const items = (0,
|
|
403
|
-
const [open, setOpen] = (0,
|
|
404
|
-
const [active, setActive] = (0,
|
|
692
|
+
const menuId = (0, import_react6.useId)();
|
|
693
|
+
const trigger = (0, import_react6.useRef)(null);
|
|
694
|
+
const menu = (0, import_react6.useRef)(null);
|
|
695
|
+
const items = (0, import_react6.useRef)([]);
|
|
696
|
+
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
697
|
+
const [active, setActive] = (0, import_react6.useState)(0);
|
|
405
698
|
const count = variables.length;
|
|
406
|
-
(0,
|
|
699
|
+
(0, import_react6.useEffect)(() => {
|
|
407
700
|
if (targetRef.current) watchFocus(targetRef.current);
|
|
408
701
|
});
|
|
409
|
-
(0,
|
|
702
|
+
(0, import_react6.useEffect)(() => {
|
|
410
703
|
if (open) items.current[active]?.focus();
|
|
411
704
|
}, [open, active]);
|
|
412
705
|
const openAt = (index) => {
|
|
@@ -455,8 +748,8 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
455
748
|
const onItemBlur = (event) => {
|
|
456
749
|
if (!menu.current?.contains(event.relatedTarget)) setOpen(false);
|
|
457
750
|
};
|
|
458
|
-
return /* @__PURE__ */ (0,
|
|
459
|
-
/* @__PURE__ */ (0,
|
|
751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cn("variable-picker", className), children: [
|
|
752
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
460
753
|
"button",
|
|
461
754
|
{
|
|
462
755
|
ref: trigger,
|
|
@@ -475,7 +768,7 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
475
768
|
children: "Insert variable"
|
|
476
769
|
}
|
|
477
770
|
),
|
|
478
|
-
open ? /* @__PURE__ */ (0,
|
|
771
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
479
772
|
"div",
|
|
480
773
|
{
|
|
481
774
|
ref: menu,
|
|
@@ -483,7 +776,7 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
483
776
|
role: "menu",
|
|
484
777
|
"aria-label": "Variables",
|
|
485
778
|
className: "variable-picker-menu",
|
|
486
|
-
children: variables.map((variable, index) => /* @__PURE__ */ (0,
|
|
779
|
+
children: variables.map((variable, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
487
780
|
"button",
|
|
488
781
|
{
|
|
489
782
|
ref: (node) => {
|
|
@@ -498,8 +791,8 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
498
791
|
onKeyDown: (event) => onItemKeyDown(event, index),
|
|
499
792
|
onBlur: onItemBlur,
|
|
500
793
|
children: [
|
|
501
|
-
/* @__PURE__ */ (0,
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
794
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "variable-picker-item-label", children: variable.label }),
|
|
795
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", { className: "variable-picker-item-token", children: liquidToken(variable.name) })
|
|
503
796
|
]
|
|
504
797
|
},
|
|
505
798
|
variable.name
|
|
@@ -511,8 +804,12 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
511
804
|
// Annotate the CommonJS export names for ESM import in node:
|
|
512
805
|
0 && (module.exports = {
|
|
513
806
|
Badge,
|
|
807
|
+
BlockList,
|
|
514
808
|
Button,
|
|
515
809
|
Card,
|
|
810
|
+
Checklist,
|
|
811
|
+
ChecklistRow,
|
|
812
|
+
ChecklistSkeleton,
|
|
516
813
|
CodeArea,
|
|
517
814
|
Container,
|
|
518
815
|
EmptyState,
|
|
@@ -524,6 +821,7 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
524
821
|
SectionHeader,
|
|
525
822
|
SlotTextField,
|
|
526
823
|
Spinner,
|
|
824
|
+
StepIndicator,
|
|
527
825
|
Switch,
|
|
528
826
|
VariablePicker,
|
|
529
827
|
cn
|