@flopay/ui 1.9.7 → 1.10.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
@@ -233,6 +233,123 @@ layout, verify Outlook Windows, dark mode, and images-off behavior in real
233
233
  clients or an email rendering service in addition to the automated render
234
234
  snapshot.
235
235
 
236
+ ### 7. Email editor controls
237
+
238
+ The controls behind the dashboard's Emails screens: a switch for each email, and
239
+ the blocks of the email edit screen. They are root exports like `Input`, render
240
+ the shared classes in `components.css` (so they work in plain-CSS and Tailwind
241
+ apps), add no runtime dependency, and need no provider or dashboard code: data
242
+ wiring stays in the app.
243
+
244
+ `Switch`, `SlotTextField` and `VariablePicker` use React state, refs and
245
+ effects, so in a Next.js App Router app render them from a Client Component (a
246
+ file that starts with `"use client"`). Importing other primitives such as
247
+ `Button` from `@flopay/ui` in a Server Component is unaffected.
248
+
249
+ #### Switch
250
+
251
+ An accessible on/off switch: a native `<button role="switch">`, so Tab, Space
252
+ and Enter work and screen readers announce its name and `aria-checked` state.
253
+
254
+ ```tsx
255
+ import { Switch } from "@flopay/ui";
256
+
257
+ <Switch
258
+ label="Payment receipt"
259
+ labelHidden // keeps the accessible name, hides the text (table rows)
260
+ checked={enabled}
261
+ loading={saving} // busy, still focusable, keeps its state, ignores toggles
262
+ onCheckedChange={(next) => save(next)}
263
+ />;
264
+ ```
265
+
266
+ Use `checked` + `onCheckedChange` (controlled) or `defaultChecked` (uncontrolled).
267
+ `disabled` makes it a disabled button. While `loading`, it shows the `Spinner`
268
+ and stays put; flip `checked` once the save resolves. Pass `name` to submit
269
+ `name=on` in a form when it is on; like a disabled checkbox, a disabled switch
270
+ submits nothing.
271
+
272
+ #### SlotTextField
273
+
274
+ A labelled field for one email slot, with a Bold / Italic / Link toolbar that
275
+ writes only Markdown-lite: `**bold**`, `_italic_`, `[label](https://…)` and
276
+ blank-line paragraphs. No headings, lists, images or raw HTML; use custom HTML
277
+ mode for anything richer.
278
+
279
+ ```tsx
280
+ import { SlotTextField } from "@flopay/ui";
281
+
282
+ <SlotTextField
283
+ label="Intro"
284
+ multiline // textarea; single-line input by default
285
+ value={intro}
286
+ onChange={(event) => setIntro(event.target.value)}
287
+ error={introError} // replaces the hint, as in Field
288
+ />;
289
+ ```
290
+
291
+ Typed text reaches `onChange` unchanged, and toolbar edits fire `onChange` too.
292
+ Bold and Italic wrap the selection (or insert the markers with the cursor
293
+ between them); Link wraps it as `[selection](https://)` and selects the URL
294
+ placeholder. The default hint names the syntax; pass `hint` to replace it.
295
+
296
+ #### CodeArea
297
+
298
+ A labelled monospace textarea for custom HTML / Liquid. It has no editor
299
+ dependency: spellcheck, autocapitalize, autocomplete and soft wrapping are off,
300
+ and Tab moves focus on rather than being trapped.
301
+
302
+ ```tsx
303
+ import { CodeArea } from "@flopay/ui";
304
+
305
+ <CodeArea
306
+ label="Custom HTML"
307
+ value={source}
308
+ onChange={(event) => setSource(event.target.value)}
309
+ />;
310
+ ```
311
+
312
+ #### VariablePicker
313
+
314
+ An "Insert variable" menu button attached to a `SlotTextField` or `CodeArea`
315
+ through its `ref`. Choosing a variable, by click or with the arrow keys and
316
+ Enter, replaces the field's selection with the Liquid tag `{{ name }}` (or
317
+ appends it if the field never had focus), fires the field's `onChange`, and
318
+ returns focus to the field with the cursor after the tag. Escape closes the
319
+ list and returns focus to the button; with no variables the button is disabled.
320
+
321
+ ```tsx
322
+ import { useRef } from "react";
323
+ import { CodeArea, VariablePicker } from "@flopay/ui";
324
+
325
+ const bodyRef = useRef<HTMLTextAreaElement>(null);
326
+
327
+ <CodeArea ref={bodyRef} label="Body" value={body} onChange={(event) => setBody(event.target.value)} />;
328
+ <VariablePicker
329
+ targetRef={bodyRef}
330
+ variables={[
331
+ { name: "customer.first_name", label: "Customer first name" },
332
+ { name: "order.total", label: "Order total" },
333
+ ]}
334
+ />;
335
+ ```
336
+
337
+ The variable list is a prop; the picker fetches no schema.
338
+
339
+ #### PreviewFrame
340
+
341
+ A container that previews rendered email HTML in an isolated iframe: the HTML
342
+ goes in `srcdoc`, and `sandbox=""` blocks scripts, forms, popups and same-origin
343
+ access, so client-authored HTML can never reach the dashboard session.
344
+
345
+ ```tsx
346
+ import { PreviewFrame } from "@flopay/ui";
347
+
348
+ <PreviewFrame title="Email preview" html={renderedHtml} className="h-[720px]" />;
349
+ ```
350
+
351
+ The frame fills the container (at least 480px tall); size it with `className`.
352
+
236
353
  ## Design tokens
237
354
 
238
355
  `design-tokens.json` is the source of truth for the fourteen colors and base
package/dist/index.cjs CHANGED
@@ -23,14 +23,19 @@ __export(index_exports, {
23
23
  Badge: () => Badge,
24
24
  Button: () => Button,
25
25
  Card: () => Card,
26
+ CodeArea: () => CodeArea,
26
27
  Container: () => Container,
27
28
  EmptyState: () => EmptyState,
28
29
  Field: () => Field,
29
30
  Input: () => Input,
30
31
  Label: () => Label,
32
+ PreviewFrame: () => PreviewFrame,
31
33
  Section: () => Section,
32
34
  SectionHeader: () => SectionHeader,
35
+ SlotTextField: () => SlotTextField,
33
36
  Spinner: () => Spinner,
37
+ Switch: () => Switch,
38
+ VariablePicker: () => VariablePicker,
34
39
  cn: () => cn
35
40
  });
36
41
  module.exports = __toCommonJS(index_exports);
@@ -105,53 +110,402 @@ function Card({ padding = "md", interactive = false, className, ...props }) {
105
110
  );
106
111
  }
107
112
 
108
- // src/components/container.tsx
113
+ // src/components/code-area.tsx
114
+ var import_react = require("react");
115
+
116
+ // src/components/field.tsx
109
117
  var import_jsx_runtime4 = require("react/jsx-runtime");
118
+ function Input({ className, ...props }) {
119
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { className: cn("field", className), ...props });
120
+ }
121
+ function Label({ className, ...props }) {
122
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: cn("field-label", className), ...props });
123
+ }
124
+ function Field({ label, hint, error, htmlFor, className, children }) {
125
+ const message = error || hint;
126
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cn("field-group", className), children: [
127
+ label ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Label, { htmlFor, children: label }) : null,
128
+ children,
129
+ message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: error ? "field-error" : "field-hint", children: message }) : null
130
+ ] });
131
+ }
132
+
133
+ // src/components/code-area.tsx
134
+ var import_jsx_runtime5 = require("react/jsx-runtime");
135
+ function CodeArea({
136
+ label,
137
+ hint,
138
+ error,
139
+ value,
140
+ defaultValue,
141
+ onChange,
142
+ ref,
143
+ id,
144
+ name,
145
+ className
146
+ }) {
147
+ const generatedId = (0, import_react.useId)();
148
+ const controlId = id ?? generatedId;
149
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Field, { label, hint, error, htmlFor: controlId, className, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
150
+ "textarea",
151
+ {
152
+ ref,
153
+ id: controlId,
154
+ name,
155
+ className: "field code-area",
156
+ rows: 12,
157
+ value,
158
+ defaultValue,
159
+ onChange,
160
+ spellCheck: false,
161
+ autoCapitalize: "off",
162
+ autoComplete: "off",
163
+ autoCorrect: "off",
164
+ wrap: "off",
165
+ "aria-invalid": error ? true : void 0
166
+ }
167
+ ) });
168
+ }
169
+
170
+ // src/components/container.tsx
171
+ var import_jsx_runtime6 = require("react/jsx-runtime");
110
172
  function Container({ className, ...props }) {
111
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cn("container", className), ...props });
173
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn("container", className), ...props });
112
174
  }
113
175
 
114
176
  // src/components/feedback.tsx
115
- var import_jsx_runtime5 = require("react/jsx-runtime");
177
+ var import_jsx_runtime7 = require("react/jsx-runtime");
116
178
  function Spinner({ center = false, className, ...props }) {
117
- const spinner = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: cn("spinner", className), role: "status", "aria-label": "Loading", ...props });
118
- return center ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "spinner-center", children: spinner }) : spinner;
179
+ const spinner = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn("spinner", className), role: "status", "aria-label": "Loading", ...props });
180
+ return center ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "spinner-center", children: spinner }) : spinner;
119
181
  }
120
182
  function EmptyState({ title, description, icon, className }) {
121
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cn("empty-state", className), children: [
122
- icon ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "empty-state-icon", children: icon }) : null,
123
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { className: "empty-state-title", children: title }),
124
- description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "empty-state-desc", children: description }) : null
183
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn("empty-state", className), children: [
184
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "empty-state-icon", children: icon }) : null,
185
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { className: "empty-state-title", children: title }),
186
+ description ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "empty-state-desc", children: description }) : null
125
187
  ] });
126
188
  }
127
189
 
128
- // src/components/field.tsx
129
- var import_jsx_runtime6 = require("react/jsx-runtime");
130
- function Input({ className, ...props }) {
131
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { className: cn("field", className), ...props });
132
- }
133
- function Label({ className, ...props }) {
134
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { className: cn("field-label", className), ...props });
135
- }
136
- function Field({ label, hint, error, htmlFor, className, children }) {
137
- const message = error || hint;
138
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn("field-group", className), children: [
139
- label ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Label, { htmlFor, children: label }) : null,
140
- children,
141
- message ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: error ? "field-error" : "field-hint", children: message }) : null
142
- ] });
190
+ // src/components/preview-frame.tsx
191
+ var import_jsx_runtime8 = require("react/jsx-runtime");
192
+ function PreviewFrame({ html, title, className }) {
193
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: cn("preview-frame", className), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("iframe", { className: "preview-frame-iframe", title, srcDoc: html, sandbox: "" }) });
143
194
  }
144
195
 
145
196
  // src/components/section.tsx
146
- var import_jsx_runtime7 = require("react/jsx-runtime");
197
+ var import_jsx_runtime9 = require("react/jsx-runtime");
147
198
  function Section({ className, ...props }) {
148
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("section", { className: cn("section", className), ...props });
199
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("section", { className: cn("section", className), ...props });
149
200
  }
150
201
  function SectionHeader({ label, title, description, className }) {
151
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn("section-center", className), children: [
152
- label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "section-label", children: label }) : null,
153
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: "section-title", children: title }),
154
- description ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "section-desc", children: description }) : null
202
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cn("section-center", className), children: [
203
+ label ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "section-label", children: label }) : null,
204
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "section-title", children: title }),
205
+ description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "section-desc", children: description }) : null
206
+ ] });
207
+ }
208
+
209
+ // src/components/slot-text-field.tsx
210
+ var import_react2 = require("react");
211
+
212
+ // src/components/text-selection.ts
213
+ var watched = /* @__PURE__ */ new WeakSet();
214
+ var focused = /* @__PURE__ */ new WeakSet();
215
+ function watchFocus(control) {
216
+ if (watched.has(control)) return;
217
+ watched.add(control);
218
+ if (control.ownerDocument.activeElement === control) {
219
+ focused.add(control);
220
+ return;
221
+ }
222
+ control.addEventListener("focus", () => focused.add(control), { once: true });
223
+ }
224
+ function setValueAsTyped(control, value) {
225
+ const { set } = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(control), "value") ?? {};
226
+ set?.call(control, value);
227
+ control.dispatchEvent(new Event("input", { bubbles: true }));
228
+ }
229
+ function editSelection(control, build) {
230
+ const { value } = control;
231
+ const hadFocus = focused.has(control);
232
+ const start = hadFocus ? control.selectionStart ?? value.length : value.length;
233
+ const end = hadFocus ? control.selectionEnd ?? start : value.length;
234
+ const edit = build(value.slice(start, end));
235
+ setValueAsTyped(control, value.slice(0, start) + edit.text + value.slice(end));
236
+ control.focus();
237
+ control.setSelectionRange(start + edit.select[0], start + edit.select[1]);
238
+ }
239
+ function assignRef(ref, node) {
240
+ if (typeof ref === "function") {
241
+ ref(node);
242
+ return;
243
+ }
244
+ if (ref) ref.current = node;
245
+ }
246
+
247
+ // src/components/slot-text-field.tsx
248
+ var import_jsx_runtime10 = require("react/jsx-runtime");
249
+ var LINK_PLACEHOLDER = "https://";
250
+ function wrapWith(marker) {
251
+ return (selected) => ({
252
+ text: `${marker}${selected}${marker}`,
253
+ select: [marker.length, marker.length + selected.length]
254
+ });
255
+ }
256
+ function toLink(selected) {
257
+ const label = selected || "link";
258
+ const url = label.length + 3;
259
+ return { text: `[${label}](${LINK_PLACEHOLDER})`, select: [url, url + LINK_PLACEHOLDER.length] };
260
+ }
261
+ var FORMATS = [
262
+ { name: "Bold", edit: wrapWith("**") },
263
+ { name: "Italic", edit: wrapWith("_") },
264
+ { name: "Link", edit: toLink }
265
+ ];
266
+ var SYNTAX_HINT = "Markdown-lite: **bold**, _italic_ and [link](https://\u2026).";
267
+ var PARAGRAPH_HINT = " A blank line starts a new paragraph.";
268
+ function SlotTextField({
269
+ label,
270
+ hint,
271
+ error,
272
+ multiline = false,
273
+ value,
274
+ defaultValue,
275
+ onChange,
276
+ ref,
277
+ id,
278
+ name,
279
+ className
280
+ }) {
281
+ const generatedId = (0, import_react2.useId)();
282
+ const controlId = id ?? generatedId;
283
+ const control = (0, import_react2.useRef)(null);
284
+ const setControl = (0, import_react2.useCallback)(
285
+ (node) => {
286
+ control.current = node;
287
+ if (node) watchFocus(node);
288
+ assignRef(ref, node);
289
+ },
290
+ [ref]
291
+ );
292
+ const shared = {
293
+ id: controlId,
294
+ name,
295
+ value,
296
+ defaultValue,
297
+ onChange,
298
+ className: multiline ? "field field-multiline" : "field",
299
+ "aria-invalid": error ? true : void 0
300
+ };
301
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
302
+ Field,
303
+ {
304
+ label,
305
+ hint: hint ?? (multiline ? SYNTAX_HINT + PARAGRAPH_HINT : SYNTAX_HINT),
306
+ error,
307
+ htmlFor: controlId,
308
+ className,
309
+ children: [
310
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "slot-toolbar", children: FORMATS.map((format) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
311
+ "button",
312
+ {
313
+ type: "button",
314
+ className: "slot-toolbar-button",
315
+ onClick: () => {
316
+ if (control.current) editSelection(control.current, format.edit);
317
+ },
318
+ children: format.name
319
+ },
320
+ format.name
321
+ )) }),
322
+ multiline ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("textarea", { ref: setControl, rows: 4, ...shared }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { ref: setControl, type: "text", ...shared })
323
+ ]
324
+ }
325
+ );
326
+ }
327
+
328
+ // src/components/switch.tsx
329
+ var import_react3 = require("react");
330
+ var import_jsx_runtime11 = require("react/jsx-runtime");
331
+ function ignorePress(event) {
332
+ event.preventDefault();
333
+ }
334
+ function Switch({
335
+ label,
336
+ labelHidden = false,
337
+ checked,
338
+ defaultChecked = false,
339
+ onCheckedChange,
340
+ disabled = false,
341
+ loading = false,
342
+ id,
343
+ name,
344
+ className
345
+ }) {
346
+ const generatedId = (0, import_react3.useId)();
347
+ const controlId = id ?? generatedId;
348
+ const labelId = `${controlId}-label`;
349
+ const [ownChecked, setOwnChecked] = (0, import_react3.useState)(defaultChecked);
350
+ const isChecked = checked ?? ownChecked;
351
+ const toggle = () => {
352
+ if (loading) return;
353
+ const next = !isChecked;
354
+ if (checked === void 0) setOwnChecked(next);
355
+ onCheckedChange?.(next);
356
+ };
357
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: cn("switch", className), children: [
358
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
359
+ "button",
360
+ {
361
+ type: "button",
362
+ role: "switch",
363
+ id: controlId,
364
+ className: "switch-control",
365
+ "aria-checked": isChecked,
366
+ "aria-labelledby": labelId,
367
+ "aria-busy": loading || void 0,
368
+ "aria-disabled": loading || void 0,
369
+ disabled,
370
+ onMouseDown: loading ? ignorePress : void 0,
371
+ onClick: toggle,
372
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "switch-thumb", "aria-hidden": "true" })
373
+ }
374
+ ),
375
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
376
+ "label",
377
+ {
378
+ id: labelId,
379
+ htmlFor: controlId,
380
+ className: cn("switch-label", labelHidden && "visually-hidden"),
381
+ children: label
382
+ }
383
+ ),
384
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, { className: "switch-spinner" }) : null,
385
+ name && isChecked && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "hidden", name, value: "on" }) : null
386
+ ] });
387
+ }
388
+
389
+ // src/components/variable-picker.tsx
390
+ var import_react4 = require("react");
391
+ var import_jsx_runtime12 = require("react/jsx-runtime");
392
+ function liquidToken(name) {
393
+ return `{{ ${name} }}`;
394
+ }
395
+ function keepFocus(event) {
396
+ event.preventDefault();
397
+ }
398
+ function VariablePicker({ variables, targetRef, className }) {
399
+ const menuId = (0, import_react4.useId)();
400
+ const trigger = (0, import_react4.useRef)(null);
401
+ const menu = (0, import_react4.useRef)(null);
402
+ const items = (0, import_react4.useRef)([]);
403
+ const [open, setOpen] = (0, import_react4.useState)(false);
404
+ const [active, setActive] = (0, import_react4.useState)(0);
405
+ const count = variables.length;
406
+ (0, import_react4.useEffect)(() => {
407
+ if (targetRef.current) watchFocus(targetRef.current);
408
+ });
409
+ (0, import_react4.useEffect)(() => {
410
+ if (open) items.current[active]?.focus();
411
+ }, [open, active]);
412
+ const openAt = (index) => {
413
+ setActive(index);
414
+ setOpen(true);
415
+ };
416
+ const close = () => {
417
+ setOpen(false);
418
+ trigger.current?.focus();
419
+ };
420
+ const choose = (name) => {
421
+ setOpen(false);
422
+ const control = targetRef.current;
423
+ if (!control) {
424
+ trigger.current?.focus();
425
+ return;
426
+ }
427
+ const token = liquidToken(name);
428
+ editSelection(control, () => ({ text: token, select: [token.length, token.length] }));
429
+ };
430
+ const onTriggerKeyDown = (event) => {
431
+ const first = (/* @__PURE__ */ new Map([
432
+ ["ArrowDown", 0],
433
+ ["ArrowUp", count - 1]
434
+ ])).get(event.key);
435
+ if (first === void 0) return;
436
+ event.preventDefault();
437
+ openAt(first);
438
+ };
439
+ const onItemKeyDown = (event, index) => {
440
+ const next = (/* @__PURE__ */ new Map([
441
+ ["ArrowDown", (index + 1) % count],
442
+ ["ArrowUp", (index - 1 + count) % count],
443
+ ["Home", 0],
444
+ ["End", count - 1]
445
+ ])).get(event.key);
446
+ if (next !== void 0) {
447
+ event.preventDefault();
448
+ setActive(next);
449
+ return;
450
+ }
451
+ if (event.key !== "Escape") return;
452
+ event.preventDefault();
453
+ close();
454
+ };
455
+ const onItemBlur = (event) => {
456
+ if (!menu.current?.contains(event.relatedTarget)) setOpen(false);
457
+ };
458
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("variable-picker", className), children: [
459
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
460
+ "button",
461
+ {
462
+ ref: trigger,
463
+ type: "button",
464
+ className: "variable-picker-trigger",
465
+ "aria-haspopup": "menu",
466
+ "aria-expanded": open,
467
+ "aria-controls": open ? menuId : void 0,
468
+ disabled: count === 0,
469
+ onMouseDown: keepFocus,
470
+ onClick: () => {
471
+ if (open) close();
472
+ else openAt(0);
473
+ },
474
+ onKeyDown: onTriggerKeyDown,
475
+ children: "Insert variable"
476
+ }
477
+ ),
478
+ open ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
479
+ "div",
480
+ {
481
+ ref: menu,
482
+ id: menuId,
483
+ role: "menu",
484
+ "aria-label": "Variables",
485
+ className: "variable-picker-menu",
486
+ children: variables.map((variable, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
487
+ "button",
488
+ {
489
+ ref: (node) => {
490
+ items.current[index] = node;
491
+ },
492
+ type: "button",
493
+ role: "menuitem",
494
+ tabIndex: -1,
495
+ className: "variable-picker-item",
496
+ onMouseDown: keepFocus,
497
+ onClick: () => choose(variable.name),
498
+ onKeyDown: (event) => onItemKeyDown(event, index),
499
+ onBlur: onItemBlur,
500
+ children: [
501
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "variable-picker-item-label", children: variable.label }),
502
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { className: "variable-picker-item-token", children: liquidToken(variable.name) })
503
+ ]
504
+ },
505
+ variable.name
506
+ ))
507
+ }
508
+ ) : null
155
509
  ] });
156
510
  }
157
511
  // Annotate the CommonJS export names for ESM import in node:
@@ -159,14 +513,19 @@ function SectionHeader({ label, title, description, className }) {
159
513
  Badge,
160
514
  Button,
161
515
  Card,
516
+ CodeArea,
162
517
  Container,
163
518
  EmptyState,
164
519
  Field,
165
520
  Input,
166
521
  Label,
522
+ PreviewFrame,
167
523
  Section,
168
524
  SectionHeader,
525
+ SlotTextField,
169
526
  Spinner,
527
+ Switch,
528
+ VariablePicker,
170
529
  cn
171
530
  });
172
531
  //# sourceMappingURL=index.cjs.map