@flopay/ui 1.12.0 → 1.14.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
@@ -351,6 +402,34 @@ import { CodeArea } from "@flopay/ui";
351
402
  />;
352
403
  ```
353
404
 
405
+ #### Select
406
+
407
+ A labelled native `<select>` (for example the email editor's language
408
+ switcher), laid out like `Field`: a `field-label` linked through `htmlFor`, then
409
+ the select with the `Input` look (`field field-select`). It stays a native
410
+ control, so Tab, the arrow keys and the platform picker work, and it keeps the
411
+ browser's chevron.
412
+
413
+ ```tsx
414
+ import { Select } from "@flopay/ui";
415
+
416
+ <Select
417
+ id="locale"
418
+ label="Language"
419
+ value={locale} // "" selects the Default option
420
+ options={[
421
+ { value: "", label: "Default" },
422
+ { value: "fr", label: "French" },
423
+ { value: "de", label: "German" },
424
+ ]}
425
+ onChange={(next) => setLocale(next)} // the chosen value, not the event
426
+ />;
427
+ ```
428
+
429
+ It is controlled only: `value` picks the selected option and `onChange`
430
+ receives the chosen option's value as a string. `disabled` and `name` pass
431
+ through to the `<select>`; without them it has neither attribute.
432
+
354
433
  #### VariablePicker
355
434
 
356
435
  An "Insert variable" menu button attached to a `SlotTextField` or `CodeArea`
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,
@@ -36,6 +37,7 @@ __export(index_exports, {
36
37
  PreviewFrame: () => PreviewFrame,
37
38
  Section: () => Section,
38
39
  SectionHeader: () => SectionHeader,
40
+ Select: () => Select,
39
41
  SlotTextField: () => SlotTextField,
40
42
  Spinner: () => Spinner,
41
43
  StepIndicator: () => StepIndicator,
@@ -416,47 +418,176 @@ function CodeArea({
416
418
  ) });
417
419
  }
418
420
 
419
- // src/components/container.tsx
421
+ // src/components/confirm-dialog.tsx
422
+ var import_react4 = require("react");
420
423
  var import_jsx_runtime9 = require("react/jsx-runtime");
424
+ var FOCUSABLE = [
425
+ "a[href]",
426
+ "button:not([disabled])",
427
+ "input:not([disabled])",
428
+ "select:not([disabled])",
429
+ "textarea:not([disabled])",
430
+ '[tabindex]:not([tabindex="-1"])'
431
+ ].join(", ");
432
+ function nextFocusTarget(panel, backwards) {
433
+ const focusable = Array.from(panel.querySelectorAll(FOCUSABLE));
434
+ const last = focusable.length - 1;
435
+ if (last < 0) return panel;
436
+ const index = focusable.indexOf(document.activeElement);
437
+ if (backwards) return focusable[index <= 0 ? last : index - 1] ?? panel;
438
+ return focusable[index >= last ? 0 : index + 1] ?? panel;
439
+ }
440
+ function OpenConfirmDialog({
441
+ title,
442
+ description,
443
+ confirmLabel,
444
+ cancelLabel,
445
+ onConfirm,
446
+ onCancel,
447
+ confirming = false
448
+ }) {
449
+ const id = (0, import_react4.useId)();
450
+ const titleId = `${id}-title`;
451
+ const descriptionId = `${id}-description`;
452
+ const cancelId = `${id}-cancel`;
453
+ const panelRef = (0, import_react4.useRef)(null);
454
+ (0, import_react4.useEffect)(() => {
455
+ const opener = document.activeElement;
456
+ return () => {
457
+ if (opener instanceof HTMLElement && opener.isConnected) opener.focus();
458
+ };
459
+ }, []);
460
+ (0, import_react4.useEffect)(() => {
461
+ const panel = panelRef.current;
462
+ if (!panel) return;
463
+ const active = document.activeElement;
464
+ if (confirming) {
465
+ if (!panel.contains(active) || active instanceof HTMLButtonElement) panel.focus();
466
+ } else if (!panel.contains(active) || active === panel) {
467
+ document.getElementById(cancelId)?.focus();
468
+ }
469
+ }, [confirming, cancelId]);
470
+ (0, import_react4.useEffect)(() => {
471
+ function onKeyDown(event) {
472
+ const panel = panelRef.current;
473
+ if (!panel) return;
474
+ if (event.key === "Escape") {
475
+ if (!confirming) onCancel();
476
+ } else if (event.key === "Tab") {
477
+ event.preventDefault();
478
+ nextFocusTarget(panel, event.shiftKey).focus();
479
+ }
480
+ }
481
+ document.addEventListener("keydown", onKeyDown);
482
+ return () => document.removeEventListener("keydown", onKeyDown);
483
+ }, [confirming, onCancel]);
484
+ const pressStartedOnBackdrop = (0, import_react4.useRef)(false);
485
+ const onBackdropMouseDown = (event) => {
486
+ pressStartedOnBackdrop.current = event.target === event.currentTarget;
487
+ if (pressStartedOnBackdrop.current) event.preventDefault();
488
+ };
489
+ const onBackdropClick = (event) => {
490
+ const startedOnBackdrop = pressStartedOnBackdrop.current;
491
+ pressStartedOnBackdrop.current = false;
492
+ if (startedOnBackdrop && event.target === event.currentTarget && !confirming) onCancel();
493
+ };
494
+ return (
495
+ // 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
496
+ // biome-ignore lint/a11y/noStaticElementInteractions: as above, the backdrop is a pointer-only shortcut for Cancel and must not be announced as a control
497
+ // biome-ignore lint/a11y/useKeyWithClickEvents: the keyboard equivalent of a backdrop click is Escape, handled by the document listener while open
498
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
499
+ "div",
500
+ {
501
+ className: "confirm-dialog-backdrop",
502
+ onMouseDown: onBackdropMouseDown,
503
+ onClick: onBackdropClick,
504
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
505
+ "div",
506
+ {
507
+ ref: panelRef,
508
+ role: "alertdialog",
509
+ "aria-modal": "true",
510
+ "aria-labelledby": titleId,
511
+ "aria-describedby": descriptionId,
512
+ tabIndex: -1,
513
+ className: "confirm-dialog",
514
+ children: [
515
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { id: titleId, className: "confirm-dialog-title", children: title }),
516
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { id: descriptionId, className: "confirm-dialog-description", children: description }),
517
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "confirm-dialog-actions", children: [
518
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { id: cancelId, variant: "outline", disabled: confirming, onClick: onCancel, children: cancelLabel }),
519
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { variant: "primary", disabled: confirming, onClick: onConfirm, children: confirmLabel })
520
+ ] })
521
+ ]
522
+ }
523
+ )
524
+ }
525
+ )
526
+ );
527
+ }
528
+ function ConfirmDialog({ open, ...props }) {
529
+ if (!open) return null;
530
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(OpenConfirmDialog, { ...props });
531
+ }
532
+
533
+ // src/components/container.tsx
534
+ var import_jsx_runtime10 = require("react/jsx-runtime");
421
535
  function Container({ className, ...props }) {
422
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("container", className), ...props });
536
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("container", className), ...props });
423
537
  }
424
538
 
425
539
  // src/components/feedback.tsx
426
- var import_jsx_runtime10 = require("react/jsx-runtime");
540
+ var import_jsx_runtime11 = require("react/jsx-runtime");
427
541
  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;
542
+ const spinner = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: cn("spinner", className), role: "status", "aria-label": "Loading", ...props });
543
+ return center ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "spinner-center", children: spinner }) : spinner;
430
544
  }
431
545
  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
546
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("empty-state", className), children: [
547
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "empty-state-icon", children: icon }) : null,
548
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "empty-state-title", children: title }),
549
+ description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "empty-state-desc", children: description }) : null
436
550
  ] });
437
551
  }
438
552
 
439
553
  // src/components/preview-frame.tsx
440
- var import_jsx_runtime11 = require("react/jsx-runtime");
554
+ var import_jsx_runtime12 = require("react/jsx-runtime");
441
555
  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: "" }) });
556
+ 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
557
  }
444
558
 
445
559
  // src/components/section.tsx
446
- var import_jsx_runtime12 = require("react/jsx-runtime");
560
+ var import_jsx_runtime13 = require("react/jsx-runtime");
447
561
  function Section({ className, ...props }) {
448
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("section", { className: cn("section", className), ...props });
562
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("section", { className: cn("section", className), ...props });
449
563
  }
450
564
  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
565
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("section-center", className), children: [
566
+ label ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "section-label", children: label }) : null,
567
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h2", { className: "section-title", children: title }),
568
+ description ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "section-desc", children: description }) : null
455
569
  ] });
456
570
  }
457
571
 
572
+ // src/components/select.tsx
573
+ var import_jsx_runtime14 = require("react/jsx-runtime");
574
+ function Select({ id, label, value, options, onChange, disabled, name }) {
575
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Field, { label, htmlFor: id, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
576
+ "select",
577
+ {
578
+ id,
579
+ name,
580
+ className: "field field-select",
581
+ value,
582
+ disabled,
583
+ onChange: (event) => onChange(event.target.value),
584
+ children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: option.value, children: option.label }, option.value))
585
+ }
586
+ ) });
587
+ }
588
+
458
589
  // src/components/slot-text-field.tsx
459
- var import_react4 = require("react");
590
+ var import_react5 = require("react");
460
591
 
461
592
  // src/components/text-selection.ts
462
593
  var watched = /* @__PURE__ */ new WeakSet();
@@ -494,7 +625,7 @@ function assignRef(ref, node) {
494
625
  }
495
626
 
496
627
  // src/components/slot-text-field.tsx
497
- var import_jsx_runtime13 = require("react/jsx-runtime");
628
+ var import_jsx_runtime15 = require("react/jsx-runtime");
498
629
  var LINK_PLACEHOLDER = "https://";
499
630
  function wrapWith(marker) {
500
631
  return (selected) => ({
@@ -527,10 +658,10 @@ function SlotTextField({
527
658
  name,
528
659
  className
529
660
  }) {
530
- const generatedId = (0, import_react4.useId)();
661
+ const generatedId = (0, import_react5.useId)();
531
662
  const controlId = id ?? generatedId;
532
- const control = (0, import_react4.useRef)(null);
533
- const setControl = (0, import_react4.useCallback)(
663
+ const control = (0, import_react5.useRef)(null);
664
+ const setControl = (0, import_react5.useCallback)(
534
665
  (node) => {
535
666
  control.current = node;
536
667
  if (node) watchFocus(node);
@@ -547,7 +678,7 @@ function SlotTextField({
547
678
  className: multiline ? "field field-multiline" : "field",
548
679
  "aria-invalid": error ? true : void 0
549
680
  };
550
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
681
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
551
682
  Field,
552
683
  {
553
684
  label,
@@ -556,7 +687,7 @@ function SlotTextField({
556
687
  htmlFor: controlId,
557
688
  className,
558
689
  children: [
559
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "slot-toolbar", children: FORMATS.map((format) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
690
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "slot-toolbar", children: FORMATS.map((format) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
560
691
  "button",
561
692
  {
562
693
  type: "button",
@@ -568,14 +699,14 @@ function SlotTextField({
568
699
  },
569
700
  format.name
570
701
  )) }),
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 })
702
+ multiline ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("textarea", { ref: setControl, rows: 4, ...shared }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { ref: setControl, type: "text", ...shared })
572
703
  ]
573
704
  }
574
705
  );
575
706
  }
576
707
 
577
708
  // src/components/step-indicator.tsx
578
- var import_jsx_runtime14 = require("react/jsx-runtime");
709
+ var import_jsx_runtime16 = require("react/jsx-runtime");
579
710
  var defaultStatusLabels = {
580
711
  done: "Done",
581
712
  current: "Current",
@@ -587,21 +718,21 @@ var markerClass = {
587
718
  upcoming: ""
588
719
  };
589
720
  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)(
721
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ol", { className: cn("step-indicator", className), children: steps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
591
722
  "li",
592
723
  {
593
724
  className: "step-indicator-step",
594
725
  "aria-current": step.status === "current" ? "step" : void 0,
595
726
  children: [
596
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
727
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
597
728
  "span",
598
729
  {
599
730
  className: cn("step-indicator-marker", markerClass[step.status]),
600
731
  "aria-hidden": "true",
601
- children: step.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CheckIcon, { className: "step-indicator-icon" }) : index + 1
732
+ children: step.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckIcon, { className: "step-indicator-icon" }) : index + 1
602
733
  }
603
734
  ),
604
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
735
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
605
736
  "span",
606
737
  {
607
738
  className: cn(
@@ -611,7 +742,7 @@ function StepIndicator({ steps, statusLabels, className }) {
611
742
  children: step.label
612
743
  }
613
744
  ),
614
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "visually-hidden", children: statusLabels?.[step.status] ?? defaultStatusLabels[step.status] })
745
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "visually-hidden", children: statusLabels?.[step.status] ?? defaultStatusLabels[step.status] })
615
746
  ]
616
747
  },
617
748
  index
@@ -619,8 +750,8 @@ function StepIndicator({ steps, statusLabels, className }) {
619
750
  }
620
751
 
621
752
  // src/components/switch.tsx
622
- var import_react5 = require("react");
623
- var import_jsx_runtime15 = require("react/jsx-runtime");
753
+ var import_react6 = require("react");
754
+ var import_jsx_runtime17 = require("react/jsx-runtime");
624
755
  function ignorePress(event) {
625
756
  event.preventDefault();
626
757
  }
@@ -636,10 +767,10 @@ function Switch({
636
767
  name,
637
768
  className
638
769
  }) {
639
- const generatedId = (0, import_react5.useId)();
770
+ const generatedId = (0, import_react6.useId)();
640
771
  const controlId = id ?? generatedId;
641
772
  const labelId = `${controlId}-label`;
642
- const [ownChecked, setOwnChecked] = (0, import_react5.useState)(defaultChecked);
773
+ const [ownChecked, setOwnChecked] = (0, import_react6.useState)(defaultChecked);
643
774
  const isChecked = checked ?? ownChecked;
644
775
  const toggle = () => {
645
776
  if (loading) return;
@@ -647,8 +778,8 @@ function Switch({
647
778
  if (checked === void 0) setOwnChecked(next);
648
779
  onCheckedChange?.(next);
649
780
  };
650
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: cn("switch", className), children: [
651
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
781
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: cn("switch", className), children: [
782
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
652
783
  "button",
653
784
  {
654
785
  type: "button",
@@ -662,10 +793,10 @@ function Switch({
662
793
  disabled,
663
794
  onMouseDown: loading ? ignorePress : void 0,
664
795
  onClick: toggle,
665
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "switch-thumb", "aria-hidden": "true" })
796
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "switch-thumb", "aria-hidden": "true" })
666
797
  }
667
798
  ),
668
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
799
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
669
800
  "label",
670
801
  {
671
802
  id: labelId,
@@ -674,14 +805,14 @@ function Switch({
674
805
  children: label
675
806
  }
676
807
  ),
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
808
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Spinner, { className: "switch-spinner" }) : null,
809
+ name && isChecked && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "hidden", name, value: "on" }) : null
679
810
  ] });
680
811
  }
681
812
 
682
813
  // src/components/variable-picker.tsx
683
- var import_react6 = require("react");
684
- var import_jsx_runtime16 = require("react/jsx-runtime");
814
+ var import_react7 = require("react");
815
+ var import_jsx_runtime18 = require("react/jsx-runtime");
685
816
  function liquidToken(name) {
686
817
  return `{{ ${name} }}`;
687
818
  }
@@ -689,17 +820,17 @@ function keepFocus(event) {
689
820
  event.preventDefault();
690
821
  }
691
822
  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);
823
+ const menuId = (0, import_react7.useId)();
824
+ const trigger = (0, import_react7.useRef)(null);
825
+ const menu = (0, import_react7.useRef)(null);
826
+ const items = (0, import_react7.useRef)([]);
827
+ const [open, setOpen] = (0, import_react7.useState)(false);
828
+ const [active, setActive] = (0, import_react7.useState)(0);
698
829
  const count = variables.length;
699
- (0, import_react6.useEffect)(() => {
830
+ (0, import_react7.useEffect)(() => {
700
831
  if (targetRef.current) watchFocus(targetRef.current);
701
832
  });
702
- (0, import_react6.useEffect)(() => {
833
+ (0, import_react7.useEffect)(() => {
703
834
  if (open) items.current[active]?.focus();
704
835
  }, [open, active]);
705
836
  const openAt = (index) => {
@@ -748,8 +879,8 @@ function VariablePicker({ variables, targetRef, className }) {
748
879
  const onItemBlur = (event) => {
749
880
  if (!menu.current?.contains(event.relatedTarget)) setOpen(false);
750
881
  };
751
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cn("variable-picker", className), children: [
752
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
882
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cn("variable-picker", className), children: [
883
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
753
884
  "button",
754
885
  {
755
886
  ref: trigger,
@@ -768,7 +899,7 @@ function VariablePicker({ variables, targetRef, className }) {
768
899
  children: "Insert variable"
769
900
  }
770
901
  ),
771
- open ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
902
+ open ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
772
903
  "div",
773
904
  {
774
905
  ref: menu,
@@ -776,7 +907,7 @@ function VariablePicker({ variables, targetRef, className }) {
776
907
  role: "menu",
777
908
  "aria-label": "Variables",
778
909
  className: "variable-picker-menu",
779
- children: variables.map((variable, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
910
+ children: variables.map((variable, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
780
911
  "button",
781
912
  {
782
913
  ref: (node) => {
@@ -791,8 +922,8 @@ function VariablePicker({ variables, targetRef, className }) {
791
922
  onKeyDown: (event) => onItemKeyDown(event, index),
792
923
  onBlur: onItemBlur,
793
924
  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) })
925
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "variable-picker-item-label", children: variable.label }),
926
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", { className: "variable-picker-item-token", children: liquidToken(variable.name) })
796
927
  ]
797
928
  },
798
929
  variable.name
@@ -811,6 +942,7 @@ function VariablePicker({ variables, targetRef, className }) {
811
942
  ChecklistRow,
812
943
  ChecklistSkeleton,
813
944
  CodeArea,
945
+ ConfirmDialog,
814
946
  Container,
815
947
  EmptyState,
816
948
  Field,
@@ -819,6 +951,7 @@ function VariablePicker({ variables, targetRef, className }) {
819
951
  PreviewFrame,
820
952
  Section,
821
953
  SectionHeader,
954
+ Select,
822
955
  SlotTextField,
823
956
  Spinner,
824
957
  StepIndicator,