@flopay/ui 1.12.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/README.md CHANGED
@@ -117,6 +117,57 @@ visually hidden text, so it is never conveyed by colour alone: "Done" / "Not
117
117
  done" for a row, "Done" / "Current" / "Upcoming" for a step. Pass
118
118
  `statusLabels` to either to change that wording.
119
119
 
120
+ #### ConfirmDialog
121
+
122
+ A confirm/cancel alert dialog for a consent or destructive step. The caller owns
123
+ `open` and supplies all the wording; the dialog only reports which way the user
124
+ chose.
125
+
126
+ ```tsx
127
+ "use client";
128
+
129
+ import { useState } from "react";
130
+ import { Button, ConfirmDialog } from "@flopay/ui";
131
+
132
+ const [open, setOpen] = useState(false);
133
+ const [saving, setSaving] = useState(false);
134
+
135
+ <Button onClick={() => setOpen(true)}>Turn on reminders</Button>
136
+
137
+ <ConfirmDialog
138
+ open={open}
139
+ title="Send abandoned-cart emails?"
140
+ description={<p>Customers who leave a cart get a reminder. <a href="/terms">Terms</a></p>}
141
+ confirmLabel="Yes, send them"
142
+ cancelLabel="Not now"
143
+ confirming={saving}
144
+ onConfirm={async () => {
145
+ setSaving(true);
146
+ try {
147
+ await enableReminders();
148
+ setOpen(false);
149
+ } finally {
150
+ setSaving(false);
151
+ }
152
+ }}
153
+ onCancel={() => setOpen(false)}
154
+ />;
155
+ ```
156
+
157
+ Clear `confirming` when the request fails too (the `finally` above): while it is
158
+ set the dialog can't be confirmed, cancelled or dismissed, so a rejection that
159
+ leaves it `true` traps the user in the dialog.
160
+
161
+ While `open` it renders `role="alertdialog"` with `aria-modal="true"`, labelled
162
+ by `title` and described by `description` (text or a node); while closed it
163
+ renders nothing. Confirm calls `onConfirm`; Cancel, Escape and a click on the
164
+ backdrop call `onCancel`, and a click inside the panel does not, nor does a drag
165
+ that starts inside the panel and ends on the backdrop. Focus moves to
166
+ Cancel on open, Tab and Shift+Tab stay inside the dialog, and on close focus
167
+ goes back to the element that opened it. While `confirming`, both buttons are
168
+ disabled and Escape and the backdrop are ignored, so an in-flight request can't
169
+ be dismissed. It renders in place (no portal), so it server-renders as-is.
170
+
120
171
  ### 4. Marketing chrome (nav + footer)
121
172
 
122
173
  ```tsx
package/dist/index.cjs CHANGED
@@ -28,6 +28,7 @@ __export(index_exports, {
28
28
  ChecklistRow: () => ChecklistRow,
29
29
  ChecklistSkeleton: () => ChecklistSkeleton,
30
30
  CodeArea: () => CodeArea,
31
+ ConfirmDialog: () => ConfirmDialog,
31
32
  Container: () => Container,
32
33
  EmptyState: () => EmptyState,
33
34
  Field: () => Field,
@@ -416,47 +417,159 @@ function CodeArea({
416
417
  ) });
417
418
  }
418
419
 
419
- // src/components/container.tsx
420
+ // src/components/confirm-dialog.tsx
421
+ var import_react4 = require("react");
420
422
  var import_jsx_runtime9 = require("react/jsx-runtime");
423
+ var FOCUSABLE = [
424
+ "a[href]",
425
+ "button:not([disabled])",
426
+ "input:not([disabled])",
427
+ "select:not([disabled])",
428
+ "textarea:not([disabled])",
429
+ '[tabindex]:not([tabindex="-1"])'
430
+ ].join(", ");
431
+ function nextFocusTarget(panel, backwards) {
432
+ const focusable = Array.from(panel.querySelectorAll(FOCUSABLE));
433
+ const last = focusable.length - 1;
434
+ if (last < 0) return panel;
435
+ const index = focusable.indexOf(document.activeElement);
436
+ if (backwards) return focusable[index <= 0 ? last : index - 1] ?? panel;
437
+ return focusable[index >= last ? 0 : index + 1] ?? panel;
438
+ }
439
+ function OpenConfirmDialog({
440
+ title,
441
+ description,
442
+ confirmLabel,
443
+ cancelLabel,
444
+ onConfirm,
445
+ onCancel,
446
+ confirming = false
447
+ }) {
448
+ const id = (0, import_react4.useId)();
449
+ const titleId = `${id}-title`;
450
+ const descriptionId = `${id}-description`;
451
+ const cancelId = `${id}-cancel`;
452
+ const panelRef = (0, import_react4.useRef)(null);
453
+ (0, import_react4.useEffect)(() => {
454
+ const opener = document.activeElement;
455
+ return () => {
456
+ if (opener instanceof HTMLElement && opener.isConnected) opener.focus();
457
+ };
458
+ }, []);
459
+ (0, import_react4.useEffect)(() => {
460
+ const panel = panelRef.current;
461
+ if (!panel) return;
462
+ const active = document.activeElement;
463
+ if (confirming) {
464
+ if (!panel.contains(active) || active instanceof HTMLButtonElement) panel.focus();
465
+ } else if (!panel.contains(active) || active === panel) {
466
+ document.getElementById(cancelId)?.focus();
467
+ }
468
+ }, [confirming, cancelId]);
469
+ (0, import_react4.useEffect)(() => {
470
+ function onKeyDown(event) {
471
+ const panel = panelRef.current;
472
+ if (!panel) return;
473
+ if (event.key === "Escape") {
474
+ if (!confirming) onCancel();
475
+ } else if (event.key === "Tab") {
476
+ event.preventDefault();
477
+ nextFocusTarget(panel, event.shiftKey).focus();
478
+ }
479
+ }
480
+ document.addEventListener("keydown", onKeyDown);
481
+ return () => document.removeEventListener("keydown", onKeyDown);
482
+ }, [confirming, onCancel]);
483
+ const pressStartedOnBackdrop = (0, import_react4.useRef)(false);
484
+ const onBackdropMouseDown = (event) => {
485
+ pressStartedOnBackdrop.current = event.target === event.currentTarget;
486
+ if (pressStartedOnBackdrop.current) event.preventDefault();
487
+ };
488
+ const onBackdropClick = (event) => {
489
+ const startedOnBackdrop = pressStartedOnBackdrop.current;
490
+ pressStartedOnBackdrop.current = false;
491
+ if (startedOnBackdrop && event.target === event.currentTarget && !confirming) onCancel();
492
+ };
493
+ return (
494
+ // 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
495
+ // biome-ignore lint/a11y/noStaticElementInteractions: as above, the backdrop is a pointer-only shortcut for Cancel and must not be announced as a control
496
+ // biome-ignore lint/a11y/useKeyWithClickEvents: the keyboard equivalent of a backdrop click is Escape, handled by the document listener while open
497
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
498
+ "div",
499
+ {
500
+ className: "confirm-dialog-backdrop",
501
+ onMouseDown: onBackdropMouseDown,
502
+ onClick: onBackdropClick,
503
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
504
+ "div",
505
+ {
506
+ ref: panelRef,
507
+ role: "alertdialog",
508
+ "aria-modal": "true",
509
+ "aria-labelledby": titleId,
510
+ "aria-describedby": descriptionId,
511
+ tabIndex: -1,
512
+ className: "confirm-dialog",
513
+ children: [
514
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { id: titleId, className: "confirm-dialog-title", children: title }),
515
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { id: descriptionId, className: "confirm-dialog-description", children: description }),
516
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "confirm-dialog-actions", children: [
517
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { id: cancelId, variant: "outline", disabled: confirming, onClick: onCancel, children: cancelLabel }),
518
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { variant: "primary", disabled: confirming, onClick: onConfirm, children: confirmLabel })
519
+ ] })
520
+ ]
521
+ }
522
+ )
523
+ }
524
+ )
525
+ );
526
+ }
527
+ function ConfirmDialog({ open, ...props }) {
528
+ if (!open) return null;
529
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(OpenConfirmDialog, { ...props });
530
+ }
531
+
532
+ // src/components/container.tsx
533
+ var import_jsx_runtime10 = require("react/jsx-runtime");
421
534
  function Container({ className, ...props }) {
422
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("container", className), ...props });
535
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("container", className), ...props });
423
536
  }
424
537
 
425
538
  // src/components/feedback.tsx
426
- var import_jsx_runtime10 = require("react/jsx-runtime");
539
+ var import_jsx_runtime11 = require("react/jsx-runtime");
427
540
  function Spinner({ center = false, className, ...props }) {
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;
541
+ const spinner = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: cn("spinner", className), role: "status", "aria-label": "Loading", ...props });
542
+ return center ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "spinner-center", children: spinner }) : spinner;
430
543
  }
431
544
  function EmptyState({ title, description, icon, className }) {
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
545
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("empty-state", className), children: [
546
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "empty-state-icon", children: icon }) : null,
547
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "empty-state-title", children: title }),
548
+ description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "empty-state-desc", children: description }) : null
436
549
  ] });
437
550
  }
438
551
 
439
552
  // src/components/preview-frame.tsx
440
- var import_jsx_runtime11 = require("react/jsx-runtime");
553
+ var import_jsx_runtime12 = require("react/jsx-runtime");
441
554
  function PreviewFrame({ html, title, className }) {
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: "" }) });
555
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("preview-frame", className), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("iframe", { className: "preview-frame-iframe", title, srcDoc: html, sandbox: "" }) });
443
556
  }
444
557
 
445
558
  // src/components/section.tsx
446
- var import_jsx_runtime12 = require("react/jsx-runtime");
559
+ var import_jsx_runtime13 = require("react/jsx-runtime");
447
560
  function Section({ className, ...props }) {
448
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("section", { className: cn("section", className), ...props });
561
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("section", { className: cn("section", className), ...props });
449
562
  }
450
563
  function SectionHeader({ label, title, description, className }) {
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
564
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("section-center", className), children: [
565
+ label ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "section-label", children: label }) : null,
566
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h2", { className: "section-title", children: title }),
567
+ description ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "section-desc", children: description }) : null
455
568
  ] });
456
569
  }
457
570
 
458
571
  // src/components/slot-text-field.tsx
459
- var import_react4 = require("react");
572
+ var import_react5 = require("react");
460
573
 
461
574
  // src/components/text-selection.ts
462
575
  var watched = /* @__PURE__ */ new WeakSet();
@@ -494,7 +607,7 @@ function assignRef(ref, node) {
494
607
  }
495
608
 
496
609
  // src/components/slot-text-field.tsx
497
- var import_jsx_runtime13 = require("react/jsx-runtime");
610
+ var import_jsx_runtime14 = require("react/jsx-runtime");
498
611
  var LINK_PLACEHOLDER = "https://";
499
612
  function wrapWith(marker) {
500
613
  return (selected) => ({
@@ -527,10 +640,10 @@ function SlotTextField({
527
640
  name,
528
641
  className
529
642
  }) {
530
- const generatedId = (0, import_react4.useId)();
643
+ const generatedId = (0, import_react5.useId)();
531
644
  const controlId = id ?? generatedId;
532
- const control = (0, import_react4.useRef)(null);
533
- const setControl = (0, import_react4.useCallback)(
645
+ const control = (0, import_react5.useRef)(null);
646
+ const setControl = (0, import_react5.useCallback)(
534
647
  (node) => {
535
648
  control.current = node;
536
649
  if (node) watchFocus(node);
@@ -547,7 +660,7 @@ function SlotTextField({
547
660
  className: multiline ? "field field-multiline" : "field",
548
661
  "aria-invalid": error ? true : void 0
549
662
  };
550
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
663
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
551
664
  Field,
552
665
  {
553
666
  label,
@@ -556,7 +669,7 @@ function SlotTextField({
556
669
  htmlFor: controlId,
557
670
  className,
558
671
  children: [
559
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "slot-toolbar", children: FORMATS.map((format) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
672
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "slot-toolbar", children: FORMATS.map((format) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
560
673
  "button",
561
674
  {
562
675
  type: "button",
@@ -568,14 +681,14 @@ function SlotTextField({
568
681
  },
569
682
  format.name
570
683
  )) }),
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 })
684
+ multiline ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("textarea", { ref: setControl, rows: 4, ...shared }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { ref: setControl, type: "text", ...shared })
572
685
  ]
573
686
  }
574
687
  );
575
688
  }
576
689
 
577
690
  // src/components/step-indicator.tsx
578
- var import_jsx_runtime14 = require("react/jsx-runtime");
691
+ var import_jsx_runtime15 = require("react/jsx-runtime");
579
692
  var defaultStatusLabels = {
580
693
  done: "Done",
581
694
  current: "Current",
@@ -587,21 +700,21 @@ var markerClass = {
587
700
  upcoming: ""
588
701
  };
589
702
  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)(
703
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ol", { className: cn("step-indicator", className), children: steps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
591
704
  "li",
592
705
  {
593
706
  className: "step-indicator-step",
594
707
  "aria-current": step.status === "current" ? "step" : void 0,
595
708
  children: [
596
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
709
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
597
710
  "span",
598
711
  {
599
712
  className: cn("step-indicator-marker", markerClass[step.status]),
600
713
  "aria-hidden": "true",
601
- children: step.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CheckIcon, { className: "step-indicator-icon" }) : index + 1
714
+ children: step.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CheckIcon, { className: "step-indicator-icon" }) : index + 1
602
715
  }
603
716
  ),
604
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
717
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
605
718
  "span",
606
719
  {
607
720
  className: cn(
@@ -611,7 +724,7 @@ function StepIndicator({ steps, statusLabels, className }) {
611
724
  children: step.label
612
725
  }
613
726
  ),
614
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "visually-hidden", children: statusLabels?.[step.status] ?? defaultStatusLabels[step.status] })
727
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "visually-hidden", children: statusLabels?.[step.status] ?? defaultStatusLabels[step.status] })
615
728
  ]
616
729
  },
617
730
  index
@@ -619,8 +732,8 @@ function StepIndicator({ steps, statusLabels, className }) {
619
732
  }
620
733
 
621
734
  // src/components/switch.tsx
622
- var import_react5 = require("react");
623
- var import_jsx_runtime15 = require("react/jsx-runtime");
735
+ var import_react6 = require("react");
736
+ var import_jsx_runtime16 = require("react/jsx-runtime");
624
737
  function ignorePress(event) {
625
738
  event.preventDefault();
626
739
  }
@@ -636,10 +749,10 @@ function Switch({
636
749
  name,
637
750
  className
638
751
  }) {
639
- const generatedId = (0, import_react5.useId)();
752
+ const generatedId = (0, import_react6.useId)();
640
753
  const controlId = id ?? generatedId;
641
754
  const labelId = `${controlId}-label`;
642
- const [ownChecked, setOwnChecked] = (0, import_react5.useState)(defaultChecked);
755
+ const [ownChecked, setOwnChecked] = (0, import_react6.useState)(defaultChecked);
643
756
  const isChecked = checked ?? ownChecked;
644
757
  const toggle = () => {
645
758
  if (loading) return;
@@ -647,8 +760,8 @@ function Switch({
647
760
  if (checked === void 0) setOwnChecked(next);
648
761
  onCheckedChange?.(next);
649
762
  };
650
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: cn("switch", className), children: [
651
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
763
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: cn("switch", className), children: [
764
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
652
765
  "button",
653
766
  {
654
767
  type: "button",
@@ -662,10 +775,10 @@ function Switch({
662
775
  disabled,
663
776
  onMouseDown: loading ? ignorePress : void 0,
664
777
  onClick: toggle,
665
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "switch-thumb", "aria-hidden": "true" })
778
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "switch-thumb", "aria-hidden": "true" })
666
779
  }
667
780
  ),
668
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
781
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
669
782
  "label",
670
783
  {
671
784
  id: labelId,
@@ -674,14 +787,14 @@ function Switch({
674
787
  children: label
675
788
  }
676
789
  ),
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
790
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Spinner, { className: "switch-spinner" }) : null,
791
+ name && isChecked && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "hidden", name, value: "on" }) : null
679
792
  ] });
680
793
  }
681
794
 
682
795
  // src/components/variable-picker.tsx
683
- var import_react6 = require("react");
684
- var import_jsx_runtime16 = require("react/jsx-runtime");
796
+ var import_react7 = require("react");
797
+ var import_jsx_runtime17 = require("react/jsx-runtime");
685
798
  function liquidToken(name) {
686
799
  return `{{ ${name} }}`;
687
800
  }
@@ -689,17 +802,17 @@ function keepFocus(event) {
689
802
  event.preventDefault();
690
803
  }
691
804
  function VariablePicker({ variables, targetRef, className }) {
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);
805
+ const menuId = (0, import_react7.useId)();
806
+ const trigger = (0, import_react7.useRef)(null);
807
+ const menu = (0, import_react7.useRef)(null);
808
+ const items = (0, import_react7.useRef)([]);
809
+ const [open, setOpen] = (0, import_react7.useState)(false);
810
+ const [active, setActive] = (0, import_react7.useState)(0);
698
811
  const count = variables.length;
699
- (0, import_react6.useEffect)(() => {
812
+ (0, import_react7.useEffect)(() => {
700
813
  if (targetRef.current) watchFocus(targetRef.current);
701
814
  });
702
- (0, import_react6.useEffect)(() => {
815
+ (0, import_react7.useEffect)(() => {
703
816
  if (open) items.current[active]?.focus();
704
817
  }, [open, active]);
705
818
  const openAt = (index) => {
@@ -748,8 +861,8 @@ function VariablePicker({ variables, targetRef, className }) {
748
861
  const onItemBlur = (event) => {
749
862
  if (!menu.current?.contains(event.relatedTarget)) setOpen(false);
750
863
  };
751
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cn("variable-picker", className), children: [
752
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
864
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cn("variable-picker", className), children: [
865
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
753
866
  "button",
754
867
  {
755
868
  ref: trigger,
@@ -768,7 +881,7 @@ function VariablePicker({ variables, targetRef, className }) {
768
881
  children: "Insert variable"
769
882
  }
770
883
  ),
771
- open ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
884
+ open ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
772
885
  "div",
773
886
  {
774
887
  ref: menu,
@@ -776,7 +889,7 @@ function VariablePicker({ variables, targetRef, className }) {
776
889
  role: "menu",
777
890
  "aria-label": "Variables",
778
891
  className: "variable-picker-menu",
779
- children: variables.map((variable, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
892
+ children: variables.map((variable, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
780
893
  "button",
781
894
  {
782
895
  ref: (node) => {
@@ -791,8 +904,8 @@ function VariablePicker({ variables, targetRef, className }) {
791
904
  onKeyDown: (event) => onItemKeyDown(event, index),
792
905
  onBlur: onItemBlur,
793
906
  children: [
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) })
907
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "variable-picker-item-label", children: variable.label }),
908
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { className: "variable-picker-item-token", children: liquidToken(variable.name) })
796
909
  ]
797
910
  },
798
911
  variable.name
@@ -811,6 +924,7 @@ function VariablePicker({ variables, targetRef, className }) {
811
924
  ChecklistRow,
812
925
  ChecklistSkeleton,
813
926
  CodeArea,
927
+ ConfirmDialog,
814
928
  Container,
815
929
  EmptyState,
816
930
  Field,