@flopay/ui 1.11.0 → 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/dist/index.cjs CHANGED
@@ -21,6 +21,7 @@ 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,
26
27
  Checklist: () => Checklist,
@@ -73,8 +74,194 @@ function Badge({
73
74
  ] });
74
75
  }
75
76
 
76
- // src/components/button.tsx
77
+ // src/components/block-list.tsx
78
+ var import_react = require("react");
77
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");
78
265
  var variantClass2 = {
79
266
  primary: "btn-primary",
80
267
  secondary: "btn-secondary",
@@ -87,7 +274,7 @@ function Button({
87
274
  type = "button",
88
275
  ...props
89
276
  }) {
90
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
277
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
91
278
  "button",
92
279
  {
93
280
  type,
@@ -98,9 +285,9 @@ function Button({
98
285
  }
99
286
 
100
287
  // src/components/card.tsx
101
- var import_jsx_runtime3 = require("react/jsx-runtime");
288
+ var import_jsx_runtime4 = require("react/jsx-runtime");
102
289
  function Card({ padding = "md", interactive = false, className, ...props }) {
103
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
290
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
104
291
  "div",
105
292
  {
106
293
  className: cn(
@@ -115,12 +302,12 @@ function Card({ padding = "md", interactive = false, className, ...props }) {
115
302
  }
116
303
 
117
304
  // src/components/checklist.tsx
118
- var import_react = require("react");
305
+ var import_react2 = require("react");
119
306
 
120
307
  // src/components/check-icon.tsx
121
- var import_jsx_runtime4 = require("react/jsx-runtime");
308
+ var import_jsx_runtime5 = require("react/jsx-runtime");
122
309
  function CheckIcon({ className }) {
123
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { className, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
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)(
124
311
  "path",
125
312
  {
126
313
  d: "M3.5 8.5l3 3 6-7",
@@ -133,9 +320,9 @@ function CheckIcon({ className }) {
133
320
  }
134
321
 
135
322
  // src/components/checklist.tsx
136
- var import_jsx_runtime5 = require("react/jsx-runtime");
323
+ var import_jsx_runtime6 = require("react/jsx-runtime");
137
324
  function Checklist({ children, className }) {
138
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: cn("checklist", className), children });
325
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: cn("checklist", className), children });
139
326
  }
140
327
  function ChecklistRow({
141
328
  label,
@@ -148,52 +335,52 @@ function ChecklistRow({
148
335
  className
149
336
  }) {
150
337
  const state = done ? statusLabels?.done ?? "Done" : statusLabels?.notDone ?? "Not done";
151
- const content = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
152
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: cn("checklist-tick", done && "checklist-tick-done"), "aria-hidden": "true", children: done ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CheckIcon, { className: "checklist-tick-icon" }) : null }),
153
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "checklist-row-label", children: label }),
154
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "visually-hidden", children: state }),
155
- optional ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Badge, { children: "Optional" }) : null,
156
- status ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "checklist-row-status", children: status }) : null
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
157
344
  ] });
158
345
  const Link = linkAs ?? "a";
159
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { className: cn("checklist-row", className), children: href ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Link, { href, className: "checklist-row-body checklist-row-link", children: content }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "checklist-row-body", children: content }) });
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 }) });
160
347
  }
161
348
  function ChecklistSkeleton({ rows = 3, className }) {
162
- const labelId = (0, import_react.useId)();
163
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cn("checklist-skeleton", className), role: "status", "aria-labelledby": labelId, children: [
164
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { id: labelId, className: "visually-hidden", children: "Loading" }),
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" }),
165
352
  Array.from({ length: rows }, (_, index) => (
166
353
  // biome-ignore lint/suspicious/noArrayIndexKey: identical stateless placeholders with no identity of their own, so the position is the only key
167
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "checklist-skeleton-row", "aria-hidden": "true", children: [
168
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "checklist-skeleton-tick" }),
169
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "checklist-skeleton-line" })
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" })
170
357
  ] }, index)
171
358
  ))
172
359
  ] });
173
360
  }
174
361
 
175
362
  // src/components/code-area.tsx
176
- var import_react2 = require("react");
363
+ var import_react3 = require("react");
177
364
 
178
365
  // src/components/field.tsx
179
- var import_jsx_runtime6 = require("react/jsx-runtime");
366
+ var import_jsx_runtime7 = require("react/jsx-runtime");
180
367
  function Input({ className, ...props }) {
181
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { className: cn("field", className), ...props });
368
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { className: cn("field", className), ...props });
182
369
  }
183
370
  function Label({ className, ...props }) {
184
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { className: cn("field-label", className), ...props });
371
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { className: cn("field-label", className), ...props });
185
372
  }
186
373
  function Field({ label, hint, error, htmlFor, className, children }) {
187
374
  const message = error || hint;
188
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn("field-group", className), children: [
189
- label ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Label, { htmlFor, children: label }) : null,
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,
190
377
  children,
191
- message ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: error ? "field-error" : "field-hint", children: message }) : null
378
+ message ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: error ? "field-error" : "field-hint", children: message }) : null
192
379
  ] });
193
380
  }
194
381
 
195
382
  // src/components/code-area.tsx
196
- var import_jsx_runtime7 = require("react/jsx-runtime");
383
+ var import_jsx_runtime8 = require("react/jsx-runtime");
197
384
  function CodeArea({
198
385
  label,
199
386
  hint,
@@ -206,9 +393,9 @@ function CodeArea({
206
393
  name,
207
394
  className
208
395
  }) {
209
- const generatedId = (0, import_react2.useId)();
396
+ const generatedId = (0, import_react3.useId)();
210
397
  const controlId = id ?? generatedId;
211
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label, hint, error, htmlFor: controlId, className, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
398
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Field, { label, hint, error, htmlFor: controlId, className, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
212
399
  "textarea",
213
400
  {
214
401
  ref,
@@ -230,46 +417,46 @@ function CodeArea({
230
417
  }
231
418
 
232
419
  // src/components/container.tsx
233
- var import_jsx_runtime8 = require("react/jsx-runtime");
420
+ var import_jsx_runtime9 = require("react/jsx-runtime");
234
421
  function Container({ className, ...props }) {
235
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: cn("container", className), ...props });
422
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("container", className), ...props });
236
423
  }
237
424
 
238
425
  // src/components/feedback.tsx
239
- var import_jsx_runtime9 = require("react/jsx-runtime");
426
+ var import_jsx_runtime10 = require("react/jsx-runtime");
240
427
  function Spinner({ center = false, className, ...props }) {
241
- const spinner = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn("spinner", className), role: "status", "aria-label": "Loading", ...props });
242
- return center ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "spinner-center", children: spinner }) : spinner;
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;
243
430
  }
244
431
  function EmptyState({ title, description, icon, className }) {
245
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cn("empty-state", className), children: [
246
- icon ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "empty-state-icon", children: icon }) : null,
247
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "empty-state-title", children: title }),
248
- description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "empty-state-desc", children: description }) : null
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
249
436
  ] });
250
437
  }
251
438
 
252
439
  // src/components/preview-frame.tsx
253
- var import_jsx_runtime10 = require("react/jsx-runtime");
440
+ var import_jsx_runtime11 = require("react/jsx-runtime");
254
441
  function PreviewFrame({ html, title, className }) {
255
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("preview-frame", className), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("iframe", { className: "preview-frame-iframe", title, srcDoc: html, sandbox: "" }) });
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: "" }) });
256
443
  }
257
444
 
258
445
  // src/components/section.tsx
259
- var import_jsx_runtime11 = require("react/jsx-runtime");
446
+ var import_jsx_runtime12 = require("react/jsx-runtime");
260
447
  function Section({ className, ...props }) {
261
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("section", { className: cn("section", className), ...props });
448
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("section", { className: cn("section", className), ...props });
262
449
  }
263
450
  function SectionHeader({ label, title, description, className }) {
264
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("section-center", className), children: [
265
- label ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "section-label", children: label }) : null,
266
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h2", { className: "section-title", children: title }),
267
- description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "section-desc", children: description }) : null
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
268
455
  ] });
269
456
  }
270
457
 
271
458
  // src/components/slot-text-field.tsx
272
- var import_react3 = require("react");
459
+ var import_react4 = require("react");
273
460
 
274
461
  // src/components/text-selection.ts
275
462
  var watched = /* @__PURE__ */ new WeakSet();
@@ -307,7 +494,7 @@ function assignRef(ref, node) {
307
494
  }
308
495
 
309
496
  // src/components/slot-text-field.tsx
310
- var import_jsx_runtime12 = require("react/jsx-runtime");
497
+ var import_jsx_runtime13 = require("react/jsx-runtime");
311
498
  var LINK_PLACEHOLDER = "https://";
312
499
  function wrapWith(marker) {
313
500
  return (selected) => ({
@@ -340,10 +527,10 @@ function SlotTextField({
340
527
  name,
341
528
  className
342
529
  }) {
343
- const generatedId = (0, import_react3.useId)();
530
+ const generatedId = (0, import_react4.useId)();
344
531
  const controlId = id ?? generatedId;
345
- const control = (0, import_react3.useRef)(null);
346
- const setControl = (0, import_react3.useCallback)(
532
+ const control = (0, import_react4.useRef)(null);
533
+ const setControl = (0, import_react4.useCallback)(
347
534
  (node) => {
348
535
  control.current = node;
349
536
  if (node) watchFocus(node);
@@ -360,7 +547,7 @@ function SlotTextField({
360
547
  className: multiline ? "field field-multiline" : "field",
361
548
  "aria-invalid": error ? true : void 0
362
549
  };
363
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
550
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
364
551
  Field,
365
552
  {
366
553
  label,
@@ -369,7 +556,7 @@ function SlotTextField({
369
556
  htmlFor: controlId,
370
557
  className,
371
558
  children: [
372
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "slot-toolbar", children: FORMATS.map((format) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
559
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "slot-toolbar", children: FORMATS.map((format) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
373
560
  "button",
374
561
  {
375
562
  type: "button",
@@ -381,14 +568,14 @@ function SlotTextField({
381
568
  },
382
569
  format.name
383
570
  )) }),
384
- multiline ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("textarea", { ref: setControl, rows: 4, ...shared }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { ref: setControl, type: "text", ...shared })
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 })
385
572
  ]
386
573
  }
387
574
  );
388
575
  }
389
576
 
390
577
  // src/components/step-indicator.tsx
391
- var import_jsx_runtime13 = require("react/jsx-runtime");
578
+ var import_jsx_runtime14 = require("react/jsx-runtime");
392
579
  var defaultStatusLabels = {
393
580
  done: "Done",
394
581
  current: "Current",
@@ -400,21 +587,21 @@ var markerClass = {
400
587
  upcoming: ""
401
588
  };
402
589
  function StepIndicator({ steps, statusLabels, className }) {
403
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ol", { className: cn("step-indicator", className), children: steps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
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)(
404
591
  "li",
405
592
  {
406
593
  className: "step-indicator-step",
407
594
  "aria-current": step.status === "current" ? "step" : void 0,
408
595
  children: [
409
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
596
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
410
597
  "span",
411
598
  {
412
599
  className: cn("step-indicator-marker", markerClass[step.status]),
413
600
  "aria-hidden": "true",
414
- children: step.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CheckIcon, { className: "step-indicator-icon" }) : index + 1
601
+ children: step.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CheckIcon, { className: "step-indicator-icon" }) : index + 1
415
602
  }
416
603
  ),
417
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
604
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
418
605
  "span",
419
606
  {
420
607
  className: cn(
@@ -424,7 +611,7 @@ function StepIndicator({ steps, statusLabels, className }) {
424
611
  children: step.label
425
612
  }
426
613
  ),
427
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "visually-hidden", children: statusLabels?.[step.status] ?? defaultStatusLabels[step.status] })
614
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "visually-hidden", children: statusLabels?.[step.status] ?? defaultStatusLabels[step.status] })
428
615
  ]
429
616
  },
430
617
  index
@@ -432,8 +619,8 @@ function StepIndicator({ steps, statusLabels, className }) {
432
619
  }
433
620
 
434
621
  // src/components/switch.tsx
435
- var import_react4 = require("react");
436
- var import_jsx_runtime14 = require("react/jsx-runtime");
622
+ var import_react5 = require("react");
623
+ var import_jsx_runtime15 = require("react/jsx-runtime");
437
624
  function ignorePress(event) {
438
625
  event.preventDefault();
439
626
  }
@@ -449,10 +636,10 @@ function Switch({
449
636
  name,
450
637
  className
451
638
  }) {
452
- const generatedId = (0, import_react4.useId)();
639
+ const generatedId = (0, import_react5.useId)();
453
640
  const controlId = id ?? generatedId;
454
641
  const labelId = `${controlId}-label`;
455
- const [ownChecked, setOwnChecked] = (0, import_react4.useState)(defaultChecked);
642
+ const [ownChecked, setOwnChecked] = (0, import_react5.useState)(defaultChecked);
456
643
  const isChecked = checked ?? ownChecked;
457
644
  const toggle = () => {
458
645
  if (loading) return;
@@ -460,8 +647,8 @@ function Switch({
460
647
  if (checked === void 0) setOwnChecked(next);
461
648
  onCheckedChange?.(next);
462
649
  };
463
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: cn("switch", className), children: [
464
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
650
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: cn("switch", className), children: [
651
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
465
652
  "button",
466
653
  {
467
654
  type: "button",
@@ -475,10 +662,10 @@ function Switch({
475
662
  disabled,
476
663
  onMouseDown: loading ? ignorePress : void 0,
477
664
  onClick: toggle,
478
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "switch-thumb", "aria-hidden": "true" })
665
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "switch-thumb", "aria-hidden": "true" })
479
666
  }
480
667
  ),
481
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
668
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
482
669
  "label",
483
670
  {
484
671
  id: labelId,
@@ -487,14 +674,14 @@ function Switch({
487
674
  children: label
488
675
  }
489
676
  ),
490
- loading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Spinner, { className: "switch-spinner" }) : null,
491
- name && isChecked && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "hidden", name, value: "on" }) : null
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
492
679
  ] });
493
680
  }
494
681
 
495
682
  // src/components/variable-picker.tsx
496
- var import_react5 = require("react");
497
- var import_jsx_runtime15 = require("react/jsx-runtime");
683
+ var import_react6 = require("react");
684
+ var import_jsx_runtime16 = require("react/jsx-runtime");
498
685
  function liquidToken(name) {
499
686
  return `{{ ${name} }}`;
500
687
  }
@@ -502,17 +689,17 @@ function keepFocus(event) {
502
689
  event.preventDefault();
503
690
  }
504
691
  function VariablePicker({ variables, targetRef, className }) {
505
- const menuId = (0, import_react5.useId)();
506
- const trigger = (0, import_react5.useRef)(null);
507
- const menu = (0, import_react5.useRef)(null);
508
- const items = (0, import_react5.useRef)([]);
509
- const [open, setOpen] = (0, import_react5.useState)(false);
510
- const [active, setActive] = (0, import_react5.useState)(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);
511
698
  const count = variables.length;
512
- (0, import_react5.useEffect)(() => {
699
+ (0, import_react6.useEffect)(() => {
513
700
  if (targetRef.current) watchFocus(targetRef.current);
514
701
  });
515
- (0, import_react5.useEffect)(() => {
702
+ (0, import_react6.useEffect)(() => {
516
703
  if (open) items.current[active]?.focus();
517
704
  }, [open, active]);
518
705
  const openAt = (index) => {
@@ -561,8 +748,8 @@ function VariablePicker({ variables, targetRef, className }) {
561
748
  const onItemBlur = (event) => {
562
749
  if (!menu.current?.contains(event.relatedTarget)) setOpen(false);
563
750
  };
564
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("variable-picker", className), children: [
565
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
751
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cn("variable-picker", className), children: [
752
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
566
753
  "button",
567
754
  {
568
755
  ref: trigger,
@@ -581,7 +768,7 @@ function VariablePicker({ variables, targetRef, className }) {
581
768
  children: "Insert variable"
582
769
  }
583
770
  ),
584
- open ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
771
+ open ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
585
772
  "div",
586
773
  {
587
774
  ref: menu,
@@ -589,7 +776,7 @@ function VariablePicker({ variables, targetRef, className }) {
589
776
  role: "menu",
590
777
  "aria-label": "Variables",
591
778
  className: "variable-picker-menu",
592
- children: variables.map((variable, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
779
+ children: variables.map((variable, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
593
780
  "button",
594
781
  {
595
782
  ref: (node) => {
@@ -604,8 +791,8 @@ function VariablePicker({ variables, targetRef, className }) {
604
791
  onKeyDown: (event) => onItemKeyDown(event, index),
605
792
  onBlur: onItemBlur,
606
793
  children: [
607
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "variable-picker-item-label", children: variable.label }),
608
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { className: "variable-picker-item-token", children: liquidToken(variable.name) })
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) })
609
796
  ]
610
797
  },
611
798
  variable.name
@@ -617,6 +804,7 @@ function VariablePicker({ variables, targetRef, className }) {
617
804
  // Annotate the CommonJS export names for ESM import in node:
618
805
  0 && (module.exports = {
619
806
  Badge,
807
+ BlockList,
620
808
  Button,
621
809
  Card,
622
810
  Checklist,