@flopay/ui 1.10.2 → 1.11.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 +42 -0
- package/dist/index.cjs +171 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -2
- package/dist/index.d.ts +74 -2
- package/dist/index.mjs +157 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +200 -0
package/README.md
CHANGED
|
@@ -75,6 +75,48 @@ The primitives render the shared component classes, so they work in plain-CSS
|
|
|
75
75
|
apps (which import `components.css`) and in Tailwind apps (where you can extend
|
|
76
76
|
them via `className` + `cn()`).
|
|
77
77
|
|
|
78
|
+
#### Checklist and step indicator
|
|
79
|
+
|
|
80
|
+
A tick list for setup checklists and a step indicator for wizards. They need no
|
|
81
|
+
provider or dashboard code, and use no hooks apart from `ChecklistSkeleton`'s
|
|
82
|
+
`useId`, so they render from Server Components too.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import Link from "next/link";
|
|
86
|
+
import { Checklist, ChecklistRow, ChecklistSkeleton, StepIndicator } from "@flopay/ui";
|
|
87
|
+
|
|
88
|
+
{loading ? (
|
|
89
|
+
<ChecklistSkeleton rows={3} /> // role="status", announced as "Loading"
|
|
90
|
+
) : (
|
|
91
|
+
<Checklist>
|
|
92
|
+
<ChecklistRow label="Verify your domain" done status="Connected" />
|
|
93
|
+
<ChecklistRow label="Brand your emails" href="/setup/emails" linkAs={Link} />
|
|
94
|
+
<ChecklistRow label="Invite your team" optional />
|
|
95
|
+
</Checklist>
|
|
96
|
+
)}
|
|
97
|
+
|
|
98
|
+
<StepIndicator
|
|
99
|
+
steps={[
|
|
100
|
+
{ label: "Account", status: "done" },
|
|
101
|
+
{ label: "Domain", status: "current" },
|
|
102
|
+
{ label: "Emails", status: "upcoming" },
|
|
103
|
+
]}
|
|
104
|
+
/>;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
A `ChecklistRow` shows a filled tick on the `success` token when `done` and an
|
|
108
|
+
empty one otherwise, optional `status` text on the right and, with `optional`, a
|
|
109
|
+
neutral "Optional" `Badge`. With `href` the whole row is one link: a plain `<a>`,
|
|
110
|
+
or the component you pass as `linkAs` (it receives `href`, `className` and the
|
|
111
|
+
row content), so the package never imports a router.
|
|
112
|
+
|
|
113
|
+
`StepIndicator` is an ordered list. Each step passes its own `status` (`done`,
|
|
114
|
+
`current` or `upcoming`), so steps can be completed out of order, and the
|
|
115
|
+
current step carries `aria-current="step"`. Rows and steps say their state in
|
|
116
|
+
visually hidden text, so it is never conveyed by colour alone: "Done" / "Not
|
|
117
|
+
done" for a row, "Done" / "Current" / "Upcoming" for a step. Pass
|
|
118
|
+
`statusLabels` to either to change that wording.
|
|
119
|
+
|
|
78
120
|
### 4. Marketing chrome (nav + footer)
|
|
79
121
|
|
|
80
122
|
```tsx
|
package/dist/index.cjs
CHANGED
|
@@ -23,6 +23,9 @@ __export(index_exports, {
|
|
|
23
23
|
Badge: () => Badge,
|
|
24
24
|
Button: () => Button,
|
|
25
25
|
Card: () => Card,
|
|
26
|
+
Checklist: () => Checklist,
|
|
27
|
+
ChecklistRow: () => ChecklistRow,
|
|
28
|
+
ChecklistSkeleton: () => ChecklistSkeleton,
|
|
26
29
|
CodeArea: () => CodeArea,
|
|
27
30
|
Container: () => Container,
|
|
28
31
|
EmptyState: () => EmptyState,
|
|
@@ -34,6 +37,7 @@ __export(index_exports, {
|
|
|
34
37
|
SectionHeader: () => SectionHeader,
|
|
35
38
|
SlotTextField: () => SlotTextField,
|
|
36
39
|
Spinner: () => Spinner,
|
|
40
|
+
StepIndicator: () => StepIndicator,
|
|
37
41
|
Switch: () => Switch,
|
|
38
42
|
VariablePicker: () => VariablePicker,
|
|
39
43
|
cn: () => cn
|
|
@@ -110,28 +114,86 @@ function Card({ padding = "md", interactive = false, className, ...props }) {
|
|
|
110
114
|
);
|
|
111
115
|
}
|
|
112
116
|
|
|
113
|
-
// src/components/
|
|
117
|
+
// src/components/checklist.tsx
|
|
114
118
|
var import_react = require("react");
|
|
115
119
|
|
|
116
|
-
// src/components/
|
|
120
|
+
// src/components/check-icon.tsx
|
|
117
121
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
122
|
+
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)(
|
|
124
|
+
"path",
|
|
125
|
+
{
|
|
126
|
+
d: "M3.5 8.5l3 3 6-7",
|
|
127
|
+
stroke: "currentColor",
|
|
128
|
+
strokeWidth: "2",
|
|
129
|
+
strokeLinecap: "round",
|
|
130
|
+
strokeLinejoin: "round"
|
|
131
|
+
}
|
|
132
|
+
) });
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// src/components/checklist.tsx
|
|
136
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
137
|
+
function Checklist({ children, className }) {
|
|
138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: cn("checklist", className), children });
|
|
139
|
+
}
|
|
140
|
+
function ChecklistRow({
|
|
141
|
+
label,
|
|
142
|
+
done = false,
|
|
143
|
+
status,
|
|
144
|
+
optional = false,
|
|
145
|
+
href,
|
|
146
|
+
linkAs,
|
|
147
|
+
statusLabels,
|
|
148
|
+
className
|
|
149
|
+
}) {
|
|
150
|
+
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
|
|
157
|
+
] });
|
|
158
|
+
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 }) });
|
|
160
|
+
}
|
|
161
|
+
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" }),
|
|
165
|
+
Array.from({ length: rows }, (_, index) => (
|
|
166
|
+
// 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" })
|
|
170
|
+
] }, index)
|
|
171
|
+
))
|
|
172
|
+
] });
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// src/components/code-area.tsx
|
|
176
|
+
var import_react2 = require("react");
|
|
177
|
+
|
|
178
|
+
// src/components/field.tsx
|
|
179
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
118
180
|
function Input({ className, ...props }) {
|
|
119
|
-
return /* @__PURE__ */ (0,
|
|
181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { className: cn("field", className), ...props });
|
|
120
182
|
}
|
|
121
183
|
function Label({ className, ...props }) {
|
|
122
|
-
return /* @__PURE__ */ (0,
|
|
184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { className: cn("field-label", className), ...props });
|
|
123
185
|
}
|
|
124
186
|
function Field({ label, hint, error, htmlFor, className, children }) {
|
|
125
187
|
const message = error || hint;
|
|
126
|
-
return /* @__PURE__ */ (0,
|
|
127
|
-
label ? /* @__PURE__ */ (0,
|
|
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,
|
|
128
190
|
children,
|
|
129
|
-
message ? /* @__PURE__ */ (0,
|
|
191
|
+
message ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: error ? "field-error" : "field-hint", children: message }) : null
|
|
130
192
|
] });
|
|
131
193
|
}
|
|
132
194
|
|
|
133
195
|
// src/components/code-area.tsx
|
|
134
|
-
var
|
|
196
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
135
197
|
function CodeArea({
|
|
136
198
|
label,
|
|
137
199
|
hint,
|
|
@@ -144,9 +206,9 @@ function CodeArea({
|
|
|
144
206
|
name,
|
|
145
207
|
className
|
|
146
208
|
}) {
|
|
147
|
-
const generatedId = (0,
|
|
209
|
+
const generatedId = (0, import_react2.useId)();
|
|
148
210
|
const controlId = id ?? generatedId;
|
|
149
|
-
return /* @__PURE__ */ (0,
|
|
211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label, hint, error, htmlFor: controlId, className, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
150
212
|
"textarea",
|
|
151
213
|
{
|
|
152
214
|
ref,
|
|
@@ -168,46 +230,46 @@ function CodeArea({
|
|
|
168
230
|
}
|
|
169
231
|
|
|
170
232
|
// src/components/container.tsx
|
|
171
|
-
var
|
|
233
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
172
234
|
function Container({ className, ...props }) {
|
|
173
|
-
return /* @__PURE__ */ (0,
|
|
235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: cn("container", className), ...props });
|
|
174
236
|
}
|
|
175
237
|
|
|
176
238
|
// src/components/feedback.tsx
|
|
177
|
-
var
|
|
239
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
178
240
|
function Spinner({ center = false, className, ...props }) {
|
|
179
|
-
const spinner = /* @__PURE__ */ (0,
|
|
180
|
-
return center ? /* @__PURE__ */ (0,
|
|
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;
|
|
181
243
|
}
|
|
182
244
|
function EmptyState({ title, description, icon, className }) {
|
|
183
|
-
return /* @__PURE__ */ (0,
|
|
184
|
-
icon ? /* @__PURE__ */ (0,
|
|
185
|
-
/* @__PURE__ */ (0,
|
|
186
|
-
description ? /* @__PURE__ */ (0,
|
|
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
|
|
187
249
|
] });
|
|
188
250
|
}
|
|
189
251
|
|
|
190
252
|
// src/components/preview-frame.tsx
|
|
191
|
-
var
|
|
253
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
192
254
|
function PreviewFrame({ html, title, className }) {
|
|
193
|
-
return /* @__PURE__ */ (0,
|
|
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: "" }) });
|
|
194
256
|
}
|
|
195
257
|
|
|
196
258
|
// src/components/section.tsx
|
|
197
|
-
var
|
|
259
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
198
260
|
function Section({ className, ...props }) {
|
|
199
|
-
return /* @__PURE__ */ (0,
|
|
261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("section", { className: cn("section", className), ...props });
|
|
200
262
|
}
|
|
201
263
|
function SectionHeader({ label, title, description, className }) {
|
|
202
|
-
return /* @__PURE__ */ (0,
|
|
203
|
-
label ? /* @__PURE__ */ (0,
|
|
204
|
-
/* @__PURE__ */ (0,
|
|
205
|
-
description ? /* @__PURE__ */ (0,
|
|
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
|
|
206
268
|
] });
|
|
207
269
|
}
|
|
208
270
|
|
|
209
271
|
// src/components/slot-text-field.tsx
|
|
210
|
-
var
|
|
272
|
+
var import_react3 = require("react");
|
|
211
273
|
|
|
212
274
|
// src/components/text-selection.ts
|
|
213
275
|
var watched = /* @__PURE__ */ new WeakSet();
|
|
@@ -245,7 +307,7 @@ function assignRef(ref, node) {
|
|
|
245
307
|
}
|
|
246
308
|
|
|
247
309
|
// src/components/slot-text-field.tsx
|
|
248
|
-
var
|
|
310
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
249
311
|
var LINK_PLACEHOLDER = "https://";
|
|
250
312
|
function wrapWith(marker) {
|
|
251
313
|
return (selected) => ({
|
|
@@ -278,10 +340,10 @@ function SlotTextField({
|
|
|
278
340
|
name,
|
|
279
341
|
className
|
|
280
342
|
}) {
|
|
281
|
-
const generatedId = (0,
|
|
343
|
+
const generatedId = (0, import_react3.useId)();
|
|
282
344
|
const controlId = id ?? generatedId;
|
|
283
|
-
const control = (0,
|
|
284
|
-
const setControl = (0,
|
|
345
|
+
const control = (0, import_react3.useRef)(null);
|
|
346
|
+
const setControl = (0, import_react3.useCallback)(
|
|
285
347
|
(node) => {
|
|
286
348
|
control.current = node;
|
|
287
349
|
if (node) watchFocus(node);
|
|
@@ -298,7 +360,7 @@ function SlotTextField({
|
|
|
298
360
|
className: multiline ? "field field-multiline" : "field",
|
|
299
361
|
"aria-invalid": error ? true : void 0
|
|
300
362
|
};
|
|
301
|
-
return /* @__PURE__ */ (0,
|
|
363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
302
364
|
Field,
|
|
303
365
|
{
|
|
304
366
|
label,
|
|
@@ -307,7 +369,7 @@ function SlotTextField({
|
|
|
307
369
|
htmlFor: controlId,
|
|
308
370
|
className,
|
|
309
371
|
children: [
|
|
310
|
-
/* @__PURE__ */ (0,
|
|
372
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "slot-toolbar", children: FORMATS.map((format) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
311
373
|
"button",
|
|
312
374
|
{
|
|
313
375
|
type: "button",
|
|
@@ -319,15 +381,59 @@ function SlotTextField({
|
|
|
319
381
|
},
|
|
320
382
|
format.name
|
|
321
383
|
)) }),
|
|
322
|
-
multiline ? /* @__PURE__ */ (0,
|
|
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 })
|
|
323
385
|
]
|
|
324
386
|
}
|
|
325
387
|
);
|
|
326
388
|
}
|
|
327
389
|
|
|
390
|
+
// src/components/step-indicator.tsx
|
|
391
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
392
|
+
var defaultStatusLabels = {
|
|
393
|
+
done: "Done",
|
|
394
|
+
current: "Current",
|
|
395
|
+
upcoming: "Upcoming"
|
|
396
|
+
};
|
|
397
|
+
var markerClass = {
|
|
398
|
+
done: "step-indicator-marker-done",
|
|
399
|
+
current: "step-indicator-marker-current",
|
|
400
|
+
upcoming: ""
|
|
401
|
+
};
|
|
402
|
+
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)(
|
|
404
|
+
"li",
|
|
405
|
+
{
|
|
406
|
+
className: "step-indicator-step",
|
|
407
|
+
"aria-current": step.status === "current" ? "step" : void 0,
|
|
408
|
+
children: [
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
410
|
+
"span",
|
|
411
|
+
{
|
|
412
|
+
className: cn("step-indicator-marker", markerClass[step.status]),
|
|
413
|
+
"aria-hidden": "true",
|
|
414
|
+
children: step.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CheckIcon, { className: "step-indicator-icon" }) : index + 1
|
|
415
|
+
}
|
|
416
|
+
),
|
|
417
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
418
|
+
"span",
|
|
419
|
+
{
|
|
420
|
+
className: cn(
|
|
421
|
+
"step-indicator-label",
|
|
422
|
+
step.status === "current" && "step-indicator-label-current"
|
|
423
|
+
),
|
|
424
|
+
children: step.label
|
|
425
|
+
}
|
|
426
|
+
),
|
|
427
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "visually-hidden", children: statusLabels?.[step.status] ?? defaultStatusLabels[step.status] })
|
|
428
|
+
]
|
|
429
|
+
},
|
|
430
|
+
index
|
|
431
|
+
)) });
|
|
432
|
+
}
|
|
433
|
+
|
|
328
434
|
// src/components/switch.tsx
|
|
329
|
-
var
|
|
330
|
-
var
|
|
435
|
+
var import_react4 = require("react");
|
|
436
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
331
437
|
function ignorePress(event) {
|
|
332
438
|
event.preventDefault();
|
|
333
439
|
}
|
|
@@ -343,10 +449,10 @@ function Switch({
|
|
|
343
449
|
name,
|
|
344
450
|
className
|
|
345
451
|
}) {
|
|
346
|
-
const generatedId = (0,
|
|
452
|
+
const generatedId = (0, import_react4.useId)();
|
|
347
453
|
const controlId = id ?? generatedId;
|
|
348
454
|
const labelId = `${controlId}-label`;
|
|
349
|
-
const [ownChecked, setOwnChecked] = (0,
|
|
455
|
+
const [ownChecked, setOwnChecked] = (0, import_react4.useState)(defaultChecked);
|
|
350
456
|
const isChecked = checked ?? ownChecked;
|
|
351
457
|
const toggle = () => {
|
|
352
458
|
if (loading) return;
|
|
@@ -354,8 +460,8 @@ function Switch({
|
|
|
354
460
|
if (checked === void 0) setOwnChecked(next);
|
|
355
461
|
onCheckedChange?.(next);
|
|
356
462
|
};
|
|
357
|
-
return /* @__PURE__ */ (0,
|
|
358
|
-
/* @__PURE__ */ (0,
|
|
463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: cn("switch", className), children: [
|
|
464
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
359
465
|
"button",
|
|
360
466
|
{
|
|
361
467
|
type: "button",
|
|
@@ -369,10 +475,10 @@ function Switch({
|
|
|
369
475
|
disabled,
|
|
370
476
|
onMouseDown: loading ? ignorePress : void 0,
|
|
371
477
|
onClick: toggle,
|
|
372
|
-
children: /* @__PURE__ */ (0,
|
|
478
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "switch-thumb", "aria-hidden": "true" })
|
|
373
479
|
}
|
|
374
480
|
),
|
|
375
|
-
/* @__PURE__ */ (0,
|
|
481
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
376
482
|
"label",
|
|
377
483
|
{
|
|
378
484
|
id: labelId,
|
|
@@ -381,14 +487,14 @@ function Switch({
|
|
|
381
487
|
children: label
|
|
382
488
|
}
|
|
383
489
|
),
|
|
384
|
-
loading ? /* @__PURE__ */ (0,
|
|
385
|
-
name && isChecked && !disabled ? /* @__PURE__ */ (0,
|
|
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
|
|
386
492
|
] });
|
|
387
493
|
}
|
|
388
494
|
|
|
389
495
|
// src/components/variable-picker.tsx
|
|
390
|
-
var
|
|
391
|
-
var
|
|
496
|
+
var import_react5 = require("react");
|
|
497
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
392
498
|
function liquidToken(name) {
|
|
393
499
|
return `{{ ${name} }}`;
|
|
394
500
|
}
|
|
@@ -396,17 +502,17 @@ function keepFocus(event) {
|
|
|
396
502
|
event.preventDefault();
|
|
397
503
|
}
|
|
398
504
|
function VariablePicker({ variables, targetRef, className }) {
|
|
399
|
-
const menuId = (0,
|
|
400
|
-
const trigger = (0,
|
|
401
|
-
const menu = (0,
|
|
402
|
-
const items = (0,
|
|
403
|
-
const [open, setOpen] = (0,
|
|
404
|
-
const [active, setActive] = (0,
|
|
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);
|
|
405
511
|
const count = variables.length;
|
|
406
|
-
(0,
|
|
512
|
+
(0, import_react5.useEffect)(() => {
|
|
407
513
|
if (targetRef.current) watchFocus(targetRef.current);
|
|
408
514
|
});
|
|
409
|
-
(0,
|
|
515
|
+
(0, import_react5.useEffect)(() => {
|
|
410
516
|
if (open) items.current[active]?.focus();
|
|
411
517
|
}, [open, active]);
|
|
412
518
|
const openAt = (index) => {
|
|
@@ -455,8 +561,8 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
455
561
|
const onItemBlur = (event) => {
|
|
456
562
|
if (!menu.current?.contains(event.relatedTarget)) setOpen(false);
|
|
457
563
|
};
|
|
458
|
-
return /* @__PURE__ */ (0,
|
|
459
|
-
/* @__PURE__ */ (0,
|
|
564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("variable-picker", className), children: [
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
460
566
|
"button",
|
|
461
567
|
{
|
|
462
568
|
ref: trigger,
|
|
@@ -475,7 +581,7 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
475
581
|
children: "Insert variable"
|
|
476
582
|
}
|
|
477
583
|
),
|
|
478
|
-
open ? /* @__PURE__ */ (0,
|
|
584
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
479
585
|
"div",
|
|
480
586
|
{
|
|
481
587
|
ref: menu,
|
|
@@ -483,7 +589,7 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
483
589
|
role: "menu",
|
|
484
590
|
"aria-label": "Variables",
|
|
485
591
|
className: "variable-picker-menu",
|
|
486
|
-
children: variables.map((variable, index) => /* @__PURE__ */ (0,
|
|
592
|
+
children: variables.map((variable, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
487
593
|
"button",
|
|
488
594
|
{
|
|
489
595
|
ref: (node) => {
|
|
@@ -498,8 +604,8 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
498
604
|
onKeyDown: (event) => onItemKeyDown(event, index),
|
|
499
605
|
onBlur: onItemBlur,
|
|
500
606
|
children: [
|
|
501
|
-
/* @__PURE__ */ (0,
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
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) })
|
|
503
609
|
]
|
|
504
610
|
},
|
|
505
611
|
variable.name
|
|
@@ -513,6 +619,9 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
513
619
|
Badge,
|
|
514
620
|
Button,
|
|
515
621
|
Card,
|
|
622
|
+
Checklist,
|
|
623
|
+
ChecklistRow,
|
|
624
|
+
ChecklistSkeleton,
|
|
516
625
|
CodeArea,
|
|
517
626
|
Container,
|
|
518
627
|
EmptyState,
|
|
@@ -524,6 +633,7 @@ function VariablePicker({ variables, targetRef, className }) {
|
|
|
524
633
|
SectionHeader,
|
|
525
634
|
SlotTextField,
|
|
526
635
|
Spinner,
|
|
636
|
+
StepIndicator,
|
|
527
637
|
Switch,
|
|
528
638
|
VariablePicker,
|
|
529
639
|
cn
|