@flopay/ui 1.11.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -24,8 +24,194 @@ function Badge({
24
24
  ] });
25
25
  }
26
26
 
27
+ // src/components/block-list.tsx
28
+ import { useLayoutEffect, useRef } from "react";
29
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
30
+ function canMove(items, from, to) {
31
+ if (from === to || to < 0 || to >= items.length) return false;
32
+ const low = Math.min(from, to);
33
+ const high = Math.max(from, to);
34
+ for (let index = low; index <= high; index += 1) {
35
+ if (items[index]?.locked) return false;
36
+ }
37
+ return true;
38
+ }
39
+ function moved(items, from, to) {
40
+ const next = items.slice();
41
+ const [item] = next.splice(from, 1);
42
+ next.splice(to, 0, item);
43
+ return next;
44
+ }
45
+ function focusWasLost() {
46
+ const active = document.activeElement;
47
+ return !active || active === document.body || active instanceof HTMLButtonElement && active.disabled;
48
+ }
49
+ function enabledButton(rows, at, label) {
50
+ return rows[at]?.querySelector(`button[aria-label="${label}"]:enabled`) ?? null;
51
+ }
52
+ function rowAfterDelete(items, deletedAt) {
53
+ for (let at = deletedAt; at < items.length; at += 1) {
54
+ if (!items[at]?.locked) return at;
55
+ }
56
+ for (let at = Math.min(deletedAt, items.length) - 1; at >= 0; at -= 1) {
57
+ if (!items[at]?.locked) return at;
58
+ }
59
+ return -1;
60
+ }
61
+ function focusTarget(rows, items, pending) {
62
+ if ("deletedAt" in pending) {
63
+ const at2 = rowAfterDelete(items, pending.deletedAt);
64
+ return at2 < 0 ? null : enabledButton(rows, at2, "Delete");
65
+ }
66
+ const at = items.findIndex((item) => item.id === pending.movedId);
67
+ if (at < 0) return null;
68
+ const other = pending.label === "Move up" ? "Move down" : "Move up";
69
+ return enabledButton(rows, at, pending.label) ?? enabledButton(rows, at, other) ?? enabledButton(rows, at, "Delete");
70
+ }
71
+ var icons = {
72
+ grip: /* @__PURE__ */ jsxs2(Fragment, { children: [
73
+ /* @__PURE__ */ jsx2("circle", { cx: "6", cy: "4", r: "1.25" }),
74
+ /* @__PURE__ */ jsx2("circle", { cx: "10", cy: "4", r: "1.25" }),
75
+ /* @__PURE__ */ jsx2("circle", { cx: "6", cy: "8", r: "1.25" }),
76
+ /* @__PURE__ */ jsx2("circle", { cx: "10", cy: "8", r: "1.25" }),
77
+ /* @__PURE__ */ jsx2("circle", { cx: "6", cy: "12", r: "1.25" }),
78
+ /* @__PURE__ */ jsx2("circle", { cx: "10", cy: "12", r: "1.25" })
79
+ ] }),
80
+ up: /* @__PURE__ */ jsx2("path", { d: "M8 12.5v-9M4 7.5l4-4 4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
81
+ down: /* @__PURE__ */ jsx2("path", { d: "M8 3.5v9M4 8.5l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
82
+ delete: /* @__PURE__ */ jsx2("path", { d: "M4.5 4.5l7 7M11.5 4.5l-7 7", fill: "none", stroke: "currentColor", strokeWidth: "1.5" })
83
+ };
84
+ function Icon({ name }) {
85
+ return /* @__PURE__ */ jsx2(
86
+ "svg",
87
+ {
88
+ className: "block-list-icon",
89
+ viewBox: "0 0 16 16",
90
+ fill: "currentColor",
91
+ strokeLinecap: "round",
92
+ strokeLinejoin: "round",
93
+ "aria-hidden": "true",
94
+ children: icons[name]
95
+ }
96
+ );
97
+ }
98
+ function BlockList({
99
+ items,
100
+ renderItem,
101
+ onChange,
102
+ className
103
+ }) {
104
+ const draggedId = useRef(null);
105
+ const list = useRef(null);
106
+ const pendingFocus = useRef(null);
107
+ useLayoutEffect(() => {
108
+ const pending = pendingFocus.current;
109
+ pendingFocus.current = null;
110
+ const rows = list.current?.children;
111
+ if (pending && rows && focusWasLost()) focusTarget(rows, items, pending)?.focus();
112
+ }, [items]);
113
+ const moveByButton = (id, index, label) => {
114
+ pendingFocus.current = { movedId: id, label };
115
+ onChange(moved(items, index, label === "Move up" ? index - 1 : index + 1));
116
+ };
117
+ const deleteByButton = (index) => {
118
+ pendingFocus.current = { deletedAt: index };
119
+ onChange(items.filter((_, other) => other !== index));
120
+ };
121
+ const dropSource = (index) => {
122
+ const from = items.findIndex((item) => item.id === draggedId.current);
123
+ return from >= 0 && canMove(items, from, index) ? from : -1;
124
+ };
125
+ const startDrag = (event, id) => {
126
+ draggedId.current = id;
127
+ pendingFocus.current = null;
128
+ const transfer = event.dataTransfer;
129
+ if (!transfer) return;
130
+ transfer.effectAllowed = "move";
131
+ transfer.setData("text/plain", id);
132
+ const row = event.currentTarget.closest("li");
133
+ if (row) transfer.setDragImage(row, 0, 0);
134
+ };
135
+ const endDrag = () => {
136
+ draggedId.current = null;
137
+ };
138
+ const dragOver = (event, index) => {
139
+ if (dropSource(index) < 0) return;
140
+ event.preventDefault();
141
+ const transfer = event.dataTransfer;
142
+ if (transfer) transfer.dropEffect = "move";
143
+ };
144
+ const drop = (event, index) => {
145
+ const from = dropSource(index);
146
+ draggedId.current = null;
147
+ if (from < 0) return;
148
+ event.preventDefault();
149
+ onChange(moved(items, from, index));
150
+ };
151
+ return /* @__PURE__ */ jsx2("ul", { ref: list, className: cn("block-list", className), children: items.map((item, index) => (
152
+ // 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
153
+ /* @__PURE__ */ jsxs2(
154
+ "li",
155
+ {
156
+ className: cn("block-list-row", item.locked && "block-list-row-locked"),
157
+ onDragOver: (event) => dragOver(event, index),
158
+ onDrop: (event) => drop(event, index),
159
+ children: [
160
+ item.locked ? null : /* @__PURE__ */ jsx2(
161
+ "span",
162
+ {
163
+ className: "block-list-handle",
164
+ draggable: true,
165
+ "aria-hidden": "true",
166
+ onDragStart: (event) => startDrag(event, item.id),
167
+ onDragEnd: endDrag,
168
+ children: /* @__PURE__ */ jsx2(Icon, { name: "grip" })
169
+ }
170
+ ),
171
+ /* @__PURE__ */ jsx2("div", { className: "block-list-content", children: renderItem(item) }),
172
+ item.locked ? null : /* @__PURE__ */ jsxs2("div", { className: "block-list-controls", children: [
173
+ /* @__PURE__ */ jsx2(
174
+ "button",
175
+ {
176
+ type: "button",
177
+ className: "block-list-button",
178
+ "aria-label": "Move up",
179
+ disabled: !canMove(items, index, index - 1),
180
+ onClick: () => moveByButton(item.id, index, "Move up"),
181
+ children: /* @__PURE__ */ jsx2(Icon, { name: "up" })
182
+ }
183
+ ),
184
+ /* @__PURE__ */ jsx2(
185
+ "button",
186
+ {
187
+ type: "button",
188
+ className: "block-list-button",
189
+ "aria-label": "Move down",
190
+ disabled: !canMove(items, index, index + 1),
191
+ onClick: () => moveByButton(item.id, index, "Move down"),
192
+ children: /* @__PURE__ */ jsx2(Icon, { name: "down" })
193
+ }
194
+ ),
195
+ /* @__PURE__ */ jsx2(
196
+ "button",
197
+ {
198
+ type: "button",
199
+ className: "block-list-button block-list-button-delete",
200
+ "aria-label": "Delete",
201
+ onClick: () => deleteByButton(index),
202
+ children: /* @__PURE__ */ jsx2(Icon, { name: "delete" })
203
+ }
204
+ )
205
+ ] })
206
+ ]
207
+ },
208
+ item.id
209
+ )
210
+ )) });
211
+ }
212
+
27
213
  // src/components/button.tsx
28
- import { jsx as jsx2 } from "react/jsx-runtime";
214
+ import { jsx as jsx3 } from "react/jsx-runtime";
29
215
  var variantClass2 = {
30
216
  primary: "btn-primary",
31
217
  secondary: "btn-secondary",
@@ -38,7 +224,7 @@ function Button({
38
224
  type = "button",
39
225
  ...props
40
226
  }) {
41
- return /* @__PURE__ */ jsx2(
227
+ return /* @__PURE__ */ jsx3(
42
228
  "button",
43
229
  {
44
230
  type,
@@ -49,9 +235,9 @@ function Button({
49
235
  }
50
236
 
51
237
  // src/components/card.tsx
52
- import { jsx as jsx3 } from "react/jsx-runtime";
238
+ import { jsx as jsx4 } from "react/jsx-runtime";
53
239
  function Card({ padding = "md", interactive = false, className, ...props }) {
54
- return /* @__PURE__ */ jsx3(
240
+ return /* @__PURE__ */ jsx4(
55
241
  "div",
56
242
  {
57
243
  className: cn(
@@ -69,9 +255,9 @@ function Card({ padding = "md", interactive = false, className, ...props }) {
69
255
  import { useId } from "react";
70
256
 
71
257
  // src/components/check-icon.tsx
72
- import { jsx as jsx4 } from "react/jsx-runtime";
258
+ import { jsx as jsx5 } from "react/jsx-runtime";
73
259
  function CheckIcon({ className }) {
74
- return /* @__PURE__ */ jsx4("svg", { className, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(
260
+ return /* @__PURE__ */ jsx5("svg", { className, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(
75
261
  "path",
76
262
  {
77
263
  d: "M3.5 8.5l3 3 6-7",
@@ -84,9 +270,9 @@ function CheckIcon({ className }) {
84
270
  }
85
271
 
86
272
  // src/components/checklist.tsx
87
- import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
273
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
88
274
  function Checklist({ children, className }) {
89
- return /* @__PURE__ */ jsx5("ul", { className: cn("checklist", className), children });
275
+ return /* @__PURE__ */ jsx6("ul", { className: cn("checklist", className), children });
90
276
  }
91
277
  function ChecklistRow({
92
278
  label,
@@ -99,25 +285,25 @@ function ChecklistRow({
99
285
  className
100
286
  }) {
101
287
  const state = done ? statusLabels?.done ?? "Done" : statusLabels?.notDone ?? "Not done";
102
- const content = /* @__PURE__ */ jsxs2(Fragment, { children: [
103
- /* @__PURE__ */ jsx5("span", { className: cn("checklist-tick", done && "checklist-tick-done"), "aria-hidden": "true", children: done ? /* @__PURE__ */ jsx5(CheckIcon, { className: "checklist-tick-icon" }) : null }),
104
- /* @__PURE__ */ jsx5("span", { className: "checklist-row-label", children: label }),
105
- /* @__PURE__ */ jsx5("span", { className: "visually-hidden", children: state }),
106
- optional ? /* @__PURE__ */ jsx5(Badge, { children: "Optional" }) : null,
107
- status ? /* @__PURE__ */ jsx5("span", { className: "checklist-row-status", children: status }) : null
288
+ const content = /* @__PURE__ */ jsxs3(Fragment2, { children: [
289
+ /* @__PURE__ */ jsx6("span", { className: cn("checklist-tick", done && "checklist-tick-done"), "aria-hidden": "true", children: done ? /* @__PURE__ */ jsx6(CheckIcon, { className: "checklist-tick-icon" }) : null }),
290
+ /* @__PURE__ */ jsx6("span", { className: "checklist-row-label", children: label }),
291
+ /* @__PURE__ */ jsx6("span", { className: "visually-hidden", children: state }),
292
+ optional ? /* @__PURE__ */ jsx6(Badge, { children: "Optional" }) : null,
293
+ status ? /* @__PURE__ */ jsx6("span", { className: "checklist-row-status", children: status }) : null
108
294
  ] });
109
295
  const Link = linkAs ?? "a";
110
- return /* @__PURE__ */ jsx5("li", { className: cn("checklist-row", className), children: href ? /* @__PURE__ */ jsx5(Link, { href, className: "checklist-row-body checklist-row-link", children: content }) : /* @__PURE__ */ jsx5("div", { className: "checklist-row-body", children: content }) });
296
+ return /* @__PURE__ */ jsx6("li", { className: cn("checklist-row", className), children: href ? /* @__PURE__ */ jsx6(Link, { href, className: "checklist-row-body checklist-row-link", children: content }) : /* @__PURE__ */ jsx6("div", { className: "checklist-row-body", children: content }) });
111
297
  }
112
298
  function ChecklistSkeleton({ rows = 3, className }) {
113
299
  const labelId = useId();
114
- return /* @__PURE__ */ jsxs2("div", { className: cn("checklist-skeleton", className), role: "status", "aria-labelledby": labelId, children: [
115
- /* @__PURE__ */ jsx5("span", { id: labelId, className: "visually-hidden", children: "Loading" }),
300
+ return /* @__PURE__ */ jsxs3("div", { className: cn("checklist-skeleton", className), role: "status", "aria-labelledby": labelId, children: [
301
+ /* @__PURE__ */ jsx6("span", { id: labelId, className: "visually-hidden", children: "Loading" }),
116
302
  Array.from({ length: rows }, (_, index) => (
117
303
  // biome-ignore lint/suspicious/noArrayIndexKey: identical stateless placeholders with no identity of their own, so the position is the only key
118
- /* @__PURE__ */ jsxs2("div", { className: "checklist-skeleton-row", "aria-hidden": "true", children: [
119
- /* @__PURE__ */ jsx5("span", { className: "checklist-skeleton-tick" }),
120
- /* @__PURE__ */ jsx5("span", { className: "checklist-skeleton-line" })
304
+ /* @__PURE__ */ jsxs3("div", { className: "checklist-skeleton-row", "aria-hidden": "true", children: [
305
+ /* @__PURE__ */ jsx6("span", { className: "checklist-skeleton-tick" }),
306
+ /* @__PURE__ */ jsx6("span", { className: "checklist-skeleton-line" })
121
307
  ] }, index)
122
308
  ))
123
309
  ] });
@@ -127,24 +313,24 @@ function ChecklistSkeleton({ rows = 3, className }) {
127
313
  import { useId as useId2 } from "react";
128
314
 
129
315
  // src/components/field.tsx
130
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
316
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
131
317
  function Input({ className, ...props }) {
132
- return /* @__PURE__ */ jsx6("input", { className: cn("field", className), ...props });
318
+ return /* @__PURE__ */ jsx7("input", { className: cn("field", className), ...props });
133
319
  }
134
320
  function Label({ className, ...props }) {
135
- return /* @__PURE__ */ jsx6("label", { className: cn("field-label", className), ...props });
321
+ return /* @__PURE__ */ jsx7("label", { className: cn("field-label", className), ...props });
136
322
  }
137
323
  function Field({ label, hint, error, htmlFor, className, children }) {
138
324
  const message = error || hint;
139
- return /* @__PURE__ */ jsxs3("div", { className: cn("field-group", className), children: [
140
- label ? /* @__PURE__ */ jsx6(Label, { htmlFor, children: label }) : null,
325
+ return /* @__PURE__ */ jsxs4("div", { className: cn("field-group", className), children: [
326
+ label ? /* @__PURE__ */ jsx7(Label, { htmlFor, children: label }) : null,
141
327
  children,
142
- message ? /* @__PURE__ */ jsx6("span", { className: error ? "field-error" : "field-hint", children: message }) : null
328
+ message ? /* @__PURE__ */ jsx7("span", { className: error ? "field-error" : "field-hint", children: message }) : null
143
329
  ] });
144
330
  }
145
331
 
146
332
  // src/components/code-area.tsx
147
- import { jsx as jsx7 } from "react/jsx-runtime";
333
+ import { jsx as jsx8 } from "react/jsx-runtime";
148
334
  function CodeArea({
149
335
  label,
150
336
  hint,
@@ -159,7 +345,7 @@ function CodeArea({
159
345
  }) {
160
346
  const generatedId = useId2();
161
347
  const controlId = id ?? generatedId;
162
- return /* @__PURE__ */ jsx7(Field, { label, hint, error, htmlFor: controlId, className, children: /* @__PURE__ */ jsx7(
348
+ return /* @__PURE__ */ jsx8(Field, { label, hint, error, htmlFor: controlId, className, children: /* @__PURE__ */ jsx8(
163
349
  "textarea",
164
350
  {
165
351
  ref,
@@ -180,50 +366,162 @@ function CodeArea({
180
366
  ) });
181
367
  }
182
368
 
369
+ // src/components/confirm-dialog.tsx
370
+ import { useEffect, useId as useId3, useRef as useRef2 } from "react";
371
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
372
+ var FOCUSABLE = [
373
+ "a[href]",
374
+ "button:not([disabled])",
375
+ "input:not([disabled])",
376
+ "select:not([disabled])",
377
+ "textarea:not([disabled])",
378
+ '[tabindex]:not([tabindex="-1"])'
379
+ ].join(", ");
380
+ function nextFocusTarget(panel, backwards) {
381
+ const focusable = Array.from(panel.querySelectorAll(FOCUSABLE));
382
+ const last = focusable.length - 1;
383
+ if (last < 0) return panel;
384
+ const index = focusable.indexOf(document.activeElement);
385
+ if (backwards) return focusable[index <= 0 ? last : index - 1] ?? panel;
386
+ return focusable[index >= last ? 0 : index + 1] ?? panel;
387
+ }
388
+ function OpenConfirmDialog({
389
+ title,
390
+ description,
391
+ confirmLabel,
392
+ cancelLabel,
393
+ onConfirm,
394
+ onCancel,
395
+ confirming = false
396
+ }) {
397
+ const id = useId3();
398
+ const titleId = `${id}-title`;
399
+ const descriptionId = `${id}-description`;
400
+ const cancelId = `${id}-cancel`;
401
+ const panelRef = useRef2(null);
402
+ useEffect(() => {
403
+ const opener = document.activeElement;
404
+ return () => {
405
+ if (opener instanceof HTMLElement && opener.isConnected) opener.focus();
406
+ };
407
+ }, []);
408
+ useEffect(() => {
409
+ const panel = panelRef.current;
410
+ if (!panel) return;
411
+ const active = document.activeElement;
412
+ if (confirming) {
413
+ if (!panel.contains(active) || active instanceof HTMLButtonElement) panel.focus();
414
+ } else if (!panel.contains(active) || active === panel) {
415
+ document.getElementById(cancelId)?.focus();
416
+ }
417
+ }, [confirming, cancelId]);
418
+ useEffect(() => {
419
+ function onKeyDown(event) {
420
+ const panel = panelRef.current;
421
+ if (!panel) return;
422
+ if (event.key === "Escape") {
423
+ if (!confirming) onCancel();
424
+ } else if (event.key === "Tab") {
425
+ event.preventDefault();
426
+ nextFocusTarget(panel, event.shiftKey).focus();
427
+ }
428
+ }
429
+ document.addEventListener("keydown", onKeyDown);
430
+ return () => document.removeEventListener("keydown", onKeyDown);
431
+ }, [confirming, onCancel]);
432
+ const pressStartedOnBackdrop = useRef2(false);
433
+ const onBackdropMouseDown = (event) => {
434
+ pressStartedOnBackdrop.current = event.target === event.currentTarget;
435
+ if (pressStartedOnBackdrop.current) event.preventDefault();
436
+ };
437
+ const onBackdropClick = (event) => {
438
+ const startedOnBackdrop = pressStartedOnBackdrop.current;
439
+ pressStartedOnBackdrop.current = false;
440
+ if (startedOnBackdrop && event.target === event.currentTarget && !confirming) onCancel();
441
+ };
442
+ return (
443
+ // biome-ignore lint/a11y/noNoninteractiveElementInteractions: the backdrop click is only a pointer shortcut for Cancel; keyboard and screen-reader users have the Cancel button and Escape, so the backdrop needs no role or focus of its own
444
+ // biome-ignore lint/a11y/noStaticElementInteractions: as above, the backdrop is a pointer-only shortcut for Cancel and must not be announced as a control
445
+ // biome-ignore lint/a11y/useKeyWithClickEvents: the keyboard equivalent of a backdrop click is Escape, handled by the document listener while open
446
+ /* @__PURE__ */ jsx9(
447
+ "div",
448
+ {
449
+ className: "confirm-dialog-backdrop",
450
+ onMouseDown: onBackdropMouseDown,
451
+ onClick: onBackdropClick,
452
+ children: /* @__PURE__ */ jsxs5(
453
+ "div",
454
+ {
455
+ ref: panelRef,
456
+ role: "alertdialog",
457
+ "aria-modal": "true",
458
+ "aria-labelledby": titleId,
459
+ "aria-describedby": descriptionId,
460
+ tabIndex: -1,
461
+ className: "confirm-dialog",
462
+ children: [
463
+ /* @__PURE__ */ jsx9("h2", { id: titleId, className: "confirm-dialog-title", children: title }),
464
+ /* @__PURE__ */ jsx9("div", { id: descriptionId, className: "confirm-dialog-description", children: description }),
465
+ /* @__PURE__ */ jsxs5("div", { className: "confirm-dialog-actions", children: [
466
+ /* @__PURE__ */ jsx9(Button, { id: cancelId, variant: "outline", disabled: confirming, onClick: onCancel, children: cancelLabel }),
467
+ /* @__PURE__ */ jsx9(Button, { variant: "primary", disabled: confirming, onClick: onConfirm, children: confirmLabel })
468
+ ] })
469
+ ]
470
+ }
471
+ )
472
+ }
473
+ )
474
+ );
475
+ }
476
+ function ConfirmDialog({ open, ...props }) {
477
+ if (!open) return null;
478
+ return /* @__PURE__ */ jsx9(OpenConfirmDialog, { ...props });
479
+ }
480
+
183
481
  // src/components/container.tsx
184
- import { jsx as jsx8 } from "react/jsx-runtime";
482
+ import { jsx as jsx10 } from "react/jsx-runtime";
185
483
  function Container({ className, ...props }) {
186
- return /* @__PURE__ */ jsx8("div", { className: cn("container", className), ...props });
484
+ return /* @__PURE__ */ jsx10("div", { className: cn("container", className), ...props });
187
485
  }
188
486
 
189
487
  // src/components/feedback.tsx
190
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
488
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
191
489
  function Spinner({ center = false, className, ...props }) {
192
- const spinner = /* @__PURE__ */ jsx9("span", { className: cn("spinner", className), role: "status", "aria-label": "Loading", ...props });
193
- return center ? /* @__PURE__ */ jsx9("div", { className: "spinner-center", children: spinner }) : spinner;
490
+ const spinner = /* @__PURE__ */ jsx11("span", { className: cn("spinner", className), role: "status", "aria-label": "Loading", ...props });
491
+ return center ? /* @__PURE__ */ jsx11("div", { className: "spinner-center", children: spinner }) : spinner;
194
492
  }
195
493
  function EmptyState({ title, description, icon, className }) {
196
- return /* @__PURE__ */ jsxs4("div", { className: cn("empty-state", className), children: [
197
- icon ? /* @__PURE__ */ jsx9("div", { className: "empty-state-icon", children: icon }) : null,
198
- /* @__PURE__ */ jsx9("h3", { className: "empty-state-title", children: title }),
199
- description ? /* @__PURE__ */ jsx9("p", { className: "empty-state-desc", children: description }) : null
494
+ return /* @__PURE__ */ jsxs6("div", { className: cn("empty-state", className), children: [
495
+ icon ? /* @__PURE__ */ jsx11("div", { className: "empty-state-icon", children: icon }) : null,
496
+ /* @__PURE__ */ jsx11("h3", { className: "empty-state-title", children: title }),
497
+ description ? /* @__PURE__ */ jsx11("p", { className: "empty-state-desc", children: description }) : null
200
498
  ] });
201
499
  }
202
500
 
203
501
  // src/components/preview-frame.tsx
204
- import { jsx as jsx10 } from "react/jsx-runtime";
502
+ import { jsx as jsx12 } from "react/jsx-runtime";
205
503
  function PreviewFrame({ html, title, className }) {
206
- return /* @__PURE__ */ jsx10("div", { className: cn("preview-frame", className), children: /* @__PURE__ */ jsx10("iframe", { className: "preview-frame-iframe", title, srcDoc: html, sandbox: "" }) });
504
+ return /* @__PURE__ */ jsx12("div", { className: cn("preview-frame", className), children: /* @__PURE__ */ jsx12("iframe", { className: "preview-frame-iframe", title, srcDoc: html, sandbox: "" }) });
207
505
  }
208
506
 
209
507
  // src/components/section.tsx
210
- import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
508
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
211
509
  function Section({ className, ...props }) {
212
- return /* @__PURE__ */ jsx11("section", { className: cn("section", className), ...props });
510
+ return /* @__PURE__ */ jsx13("section", { className: cn("section", className), ...props });
213
511
  }
214
512
  function SectionHeader({ label, title, description, className }) {
215
- return /* @__PURE__ */ jsxs5("div", { className: cn("section-center", className), children: [
216
- label ? /* @__PURE__ */ jsx11("div", { className: "section-label", children: label }) : null,
217
- /* @__PURE__ */ jsx11("h2", { className: "section-title", children: title }),
218
- description ? /* @__PURE__ */ jsx11("p", { className: "section-desc", children: description }) : null
513
+ return /* @__PURE__ */ jsxs7("div", { className: cn("section-center", className), children: [
514
+ label ? /* @__PURE__ */ jsx13("div", { className: "section-label", children: label }) : null,
515
+ /* @__PURE__ */ jsx13("h2", { className: "section-title", children: title }),
516
+ description ? /* @__PURE__ */ jsx13("p", { className: "section-desc", children: description }) : null
219
517
  ] });
220
518
  }
221
519
 
222
520
  // src/components/slot-text-field.tsx
223
521
  import {
224
522
  useCallback,
225
- useId as useId3,
226
- useRef
523
+ useId as useId4,
524
+ useRef as useRef3
227
525
  } from "react";
228
526
 
229
527
  // src/components/text-selection.ts
@@ -262,7 +560,7 @@ function assignRef(ref, node) {
262
560
  }
263
561
 
264
562
  // src/components/slot-text-field.tsx
265
- import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
563
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
266
564
  var LINK_PLACEHOLDER = "https://";
267
565
  function wrapWith(marker) {
268
566
  return (selected) => ({
@@ -295,9 +593,9 @@ function SlotTextField({
295
593
  name,
296
594
  className
297
595
  }) {
298
- const generatedId = useId3();
596
+ const generatedId = useId4();
299
597
  const controlId = id ?? generatedId;
300
- const control = useRef(null);
598
+ const control = useRef3(null);
301
599
  const setControl = useCallback(
302
600
  (node) => {
303
601
  control.current = node;
@@ -315,7 +613,7 @@ function SlotTextField({
315
613
  className: multiline ? "field field-multiline" : "field",
316
614
  "aria-invalid": error ? true : void 0
317
615
  };
318
- return /* @__PURE__ */ jsxs6(
616
+ return /* @__PURE__ */ jsxs8(
319
617
  Field,
320
618
  {
321
619
  label,
@@ -324,7 +622,7 @@ function SlotTextField({
324
622
  htmlFor: controlId,
325
623
  className,
326
624
  children: [
327
- /* @__PURE__ */ jsx12("div", { className: "slot-toolbar", children: FORMATS.map((format) => /* @__PURE__ */ jsx12(
625
+ /* @__PURE__ */ jsx14("div", { className: "slot-toolbar", children: FORMATS.map((format) => /* @__PURE__ */ jsx14(
328
626
  "button",
329
627
  {
330
628
  type: "button",
@@ -336,14 +634,14 @@ function SlotTextField({
336
634
  },
337
635
  format.name
338
636
  )) }),
339
- multiline ? /* @__PURE__ */ jsx12("textarea", { ref: setControl, rows: 4, ...shared }) : /* @__PURE__ */ jsx12("input", { ref: setControl, type: "text", ...shared })
637
+ multiline ? /* @__PURE__ */ jsx14("textarea", { ref: setControl, rows: 4, ...shared }) : /* @__PURE__ */ jsx14("input", { ref: setControl, type: "text", ...shared })
340
638
  ]
341
639
  }
342
640
  );
343
641
  }
344
642
 
345
643
  // src/components/step-indicator.tsx
346
- import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
644
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
347
645
  var defaultStatusLabels = {
348
646
  done: "Done",
349
647
  current: "Current",
@@ -355,21 +653,21 @@ var markerClass = {
355
653
  upcoming: ""
356
654
  };
357
655
  function StepIndicator({ steps, statusLabels, className }) {
358
- return /* @__PURE__ */ jsx13("ol", { className: cn("step-indicator", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs7(
656
+ return /* @__PURE__ */ jsx15("ol", { className: cn("step-indicator", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs9(
359
657
  "li",
360
658
  {
361
659
  className: "step-indicator-step",
362
660
  "aria-current": step.status === "current" ? "step" : void 0,
363
661
  children: [
364
- /* @__PURE__ */ jsx13(
662
+ /* @__PURE__ */ jsx15(
365
663
  "span",
366
664
  {
367
665
  className: cn("step-indicator-marker", markerClass[step.status]),
368
666
  "aria-hidden": "true",
369
- children: step.status === "done" ? /* @__PURE__ */ jsx13(CheckIcon, { className: "step-indicator-icon" }) : index + 1
667
+ children: step.status === "done" ? /* @__PURE__ */ jsx15(CheckIcon, { className: "step-indicator-icon" }) : index + 1
370
668
  }
371
669
  ),
372
- /* @__PURE__ */ jsx13(
670
+ /* @__PURE__ */ jsx15(
373
671
  "span",
374
672
  {
375
673
  className: cn(
@@ -379,7 +677,7 @@ function StepIndicator({ steps, statusLabels, className }) {
379
677
  children: step.label
380
678
  }
381
679
  ),
382
- /* @__PURE__ */ jsx13("span", { className: "visually-hidden", children: statusLabels?.[step.status] ?? defaultStatusLabels[step.status] })
680
+ /* @__PURE__ */ jsx15("span", { className: "visually-hidden", children: statusLabels?.[step.status] ?? defaultStatusLabels[step.status] })
383
681
  ]
384
682
  },
385
683
  index
@@ -387,8 +685,8 @@ function StepIndicator({ steps, statusLabels, className }) {
387
685
  }
388
686
 
389
687
  // src/components/switch.tsx
390
- import { useId as useId4, useState } from "react";
391
- import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
688
+ import { useId as useId5, useState } from "react";
689
+ import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
392
690
  function ignorePress(event) {
393
691
  event.preventDefault();
394
692
  }
@@ -404,7 +702,7 @@ function Switch({
404
702
  name,
405
703
  className
406
704
  }) {
407
- const generatedId = useId4();
705
+ const generatedId = useId5();
408
706
  const controlId = id ?? generatedId;
409
707
  const labelId = `${controlId}-label`;
410
708
  const [ownChecked, setOwnChecked] = useState(defaultChecked);
@@ -415,8 +713,8 @@ function Switch({
415
713
  if (checked === void 0) setOwnChecked(next);
416
714
  onCheckedChange?.(next);
417
715
  };
418
- return /* @__PURE__ */ jsxs8("span", { className: cn("switch", className), children: [
419
- /* @__PURE__ */ jsx14(
716
+ return /* @__PURE__ */ jsxs10("span", { className: cn("switch", className), children: [
717
+ /* @__PURE__ */ jsx16(
420
718
  "button",
421
719
  {
422
720
  type: "button",
@@ -430,10 +728,10 @@ function Switch({
430
728
  disabled,
431
729
  onMouseDown: loading ? ignorePress : void 0,
432
730
  onClick: toggle,
433
- children: /* @__PURE__ */ jsx14("span", { className: "switch-thumb", "aria-hidden": "true" })
731
+ children: /* @__PURE__ */ jsx16("span", { className: "switch-thumb", "aria-hidden": "true" })
434
732
  }
435
733
  ),
436
- /* @__PURE__ */ jsx14(
734
+ /* @__PURE__ */ jsx16(
437
735
  "label",
438
736
  {
439
737
  id: labelId,
@@ -442,19 +740,19 @@ function Switch({
442
740
  children: label
443
741
  }
444
742
  ),
445
- loading ? /* @__PURE__ */ jsx14(Spinner, { className: "switch-spinner" }) : null,
446
- name && isChecked && !disabled ? /* @__PURE__ */ jsx14("input", { type: "hidden", name, value: "on" }) : null
743
+ loading ? /* @__PURE__ */ jsx16(Spinner, { className: "switch-spinner" }) : null,
744
+ name && isChecked && !disabled ? /* @__PURE__ */ jsx16("input", { type: "hidden", name, value: "on" }) : null
447
745
  ] });
448
746
  }
449
747
 
450
748
  // src/components/variable-picker.tsx
451
749
  import {
452
- useEffect,
453
- useId as useId5,
454
- useRef as useRef2,
750
+ useEffect as useEffect2,
751
+ useId as useId6,
752
+ useRef as useRef4,
455
753
  useState as useState2
456
754
  } from "react";
457
- import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
755
+ import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
458
756
  function liquidToken(name) {
459
757
  return `{{ ${name} }}`;
460
758
  }
@@ -462,17 +760,17 @@ function keepFocus(event) {
462
760
  event.preventDefault();
463
761
  }
464
762
  function VariablePicker({ variables, targetRef, className }) {
465
- const menuId = useId5();
466
- const trigger = useRef2(null);
467
- const menu = useRef2(null);
468
- const items = useRef2([]);
763
+ const menuId = useId6();
764
+ const trigger = useRef4(null);
765
+ const menu = useRef4(null);
766
+ const items = useRef4([]);
469
767
  const [open, setOpen] = useState2(false);
470
768
  const [active, setActive] = useState2(0);
471
769
  const count = variables.length;
472
- useEffect(() => {
770
+ useEffect2(() => {
473
771
  if (targetRef.current) watchFocus(targetRef.current);
474
772
  });
475
- useEffect(() => {
773
+ useEffect2(() => {
476
774
  if (open) items.current[active]?.focus();
477
775
  }, [open, active]);
478
776
  const openAt = (index) => {
@@ -521,8 +819,8 @@ function VariablePicker({ variables, targetRef, className }) {
521
819
  const onItemBlur = (event) => {
522
820
  if (!menu.current?.contains(event.relatedTarget)) setOpen(false);
523
821
  };
524
- return /* @__PURE__ */ jsxs9("div", { className: cn("variable-picker", className), children: [
525
- /* @__PURE__ */ jsx15(
822
+ return /* @__PURE__ */ jsxs11("div", { className: cn("variable-picker", className), children: [
823
+ /* @__PURE__ */ jsx17(
526
824
  "button",
527
825
  {
528
826
  ref: trigger,
@@ -541,7 +839,7 @@ function VariablePicker({ variables, targetRef, className }) {
541
839
  children: "Insert variable"
542
840
  }
543
841
  ),
544
- open ? /* @__PURE__ */ jsx15(
842
+ open ? /* @__PURE__ */ jsx17(
545
843
  "div",
546
844
  {
547
845
  ref: menu,
@@ -549,7 +847,7 @@ function VariablePicker({ variables, targetRef, className }) {
549
847
  role: "menu",
550
848
  "aria-label": "Variables",
551
849
  className: "variable-picker-menu",
552
- children: variables.map((variable, index) => /* @__PURE__ */ jsxs9(
850
+ children: variables.map((variable, index) => /* @__PURE__ */ jsxs11(
553
851
  "button",
554
852
  {
555
853
  ref: (node) => {
@@ -564,8 +862,8 @@ function VariablePicker({ variables, targetRef, className }) {
564
862
  onKeyDown: (event) => onItemKeyDown(event, index),
565
863
  onBlur: onItemBlur,
566
864
  children: [
567
- /* @__PURE__ */ jsx15("span", { className: "variable-picker-item-label", children: variable.label }),
568
- /* @__PURE__ */ jsx15("code", { className: "variable-picker-item-token", children: liquidToken(variable.name) })
865
+ /* @__PURE__ */ jsx17("span", { className: "variable-picker-item-label", children: variable.label }),
866
+ /* @__PURE__ */ jsx17("code", { className: "variable-picker-item-token", children: liquidToken(variable.name) })
569
867
  ]
570
868
  },
571
869
  variable.name
@@ -576,12 +874,14 @@ function VariablePicker({ variables, targetRef, className }) {
576
874
  }
577
875
  export {
578
876
  Badge,
877
+ BlockList,
579
878
  Button,
580
879
  Card,
581
880
  Checklist,
582
881
  ChecklistRow,
583
882
  ChecklistSkeleton,
584
883
  CodeArea,
884
+ ConfirmDialog,
585
885
  Container,
586
886
  EmptyState,
587
887
  Field,