@snacky/ui 0.9.0 → 0.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/CHANGELOG.md +77 -0
- package/dist/index.cjs +144 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +69 -59
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +12 -7
- package/dist/index.d.ts +12 -7
- package/dist/index.js +144 -138
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,83 @@ How `@snacky/ui` got to its current state. The README documents what the
|
|
|
4
4
|
package *is*; this documents how it got there, including the mistakes, so the
|
|
5
5
|
verification claims in the README can be taken at face value.
|
|
6
6
|
|
|
7
|
+
## Brand ramp renamed to amber, components re-checked against Figma (0.10.0)
|
|
8
|
+
|
|
9
|
+
**Breaking: the brand primitive ramp is now `amber`.** It was the only
|
|
10
|
+
primitive named by role (`primary`) while its neighbours were named by hue
|
|
11
|
+
(`neutral`, `red`), which made `--bg-action-primary: var(--color-primary-500)`
|
|
12
|
+
read like a tautology. `--color-primary-50` through `--color-primary-900` are
|
|
13
|
+
now `--color-amber-50` through `--color-amber-900`, with no alias left behind.
|
|
14
|
+
Semantic tokens keep their role names (`--bg-action-primary`,
|
|
15
|
+
`--border-input-active`, ...) and resolve to byte-identical values: all 175
|
|
16
|
+
custom properties were compared before and after, 63 of them still through a
|
|
17
|
+
reference. Only code that referenced a `--color-primary-*` variable directly
|
|
18
|
+
needs to change, and a find-and-replace of `--color-primary-` to
|
|
19
|
+
`--color-amber-` is the whole migration.
|
|
20
|
+
|
|
21
|
+
**Components now use the semantic token Figma binds.** The earlier checks
|
|
22
|
+
compared rendered colours, so a component painting the right hex from the
|
|
23
|
+
wrong token passed. This pass read each node's bound variables instead, and
|
|
24
|
+
found 17 places across both packages reaching past the semantic layer to a
|
|
25
|
+
primitive. Most resolve to the same colour, so only the token changed
|
|
26
|
+
(Checkbox, Toggle, Callout, Navbar's active icon, Tab's underline, Chips'
|
|
27
|
+
selected border). Three were real colour bugs, all rendering `#f8b732` where
|
|
28
|
+
Figma binds `border-highlight` (`#fcdea1`): InfoBadge's border when it has no
|
|
29
|
+
icon, and PointBalanceBanner's border and divider. InfoBadge with an icon
|
|
30
|
+
keeps `border-input-active`, selected by the same icon slot Figma uses to tell
|
|
31
|
+
the two variants apart.
|
|
32
|
+
|
|
33
|
+
**BottomSheet's drag handle** follows Figma's `Driver Slider`: 40x4 (was
|
|
34
|
+
36x4), `border-main` rather than the `neutral-200` primitive (same colour),
|
|
35
|
+
`radius-full`, and no bottom margin of its own. The space below the handle is
|
|
36
|
+
now just the sheet's 16px gap, so a sheet with `showHandle` is 8px shorter.
|
|
37
|
+
|
|
38
|
+
**IconButton `size="small"`** is Figma's 24px circle with the icon at the full
|
|
39
|
+
24x24 and no padding. It used to pad by 4 and inset the icon to 16px, about
|
|
40
|
+
60% of Figma's size. The chevron it carries in Figma, `fi-sr-angle-small-right`,
|
|
41
|
+
was not in the icon set at all; it now ships as `SnackyIcons.solid.angleSmallRight`,
|
|
42
|
+
making the solid set 12 icons.
|
|
43
|
+
|
|
44
|
+
**Section's "see more" action** is that shared small IconButton. It used to be
|
|
45
|
+
its own button with a hand-drawn 16px stroked chevron, so the
|
|
46
|
+
`.snacky-section__action` class no longer exists; style the IconButton instead
|
|
47
|
+
if you were targeting it. The header is also 30px tall now, not the title's
|
|
48
|
+
36px line box, because Figma crops the h3 title node to 30 from the top. Every
|
|
49
|
+
Section is 6px shorter as a result.
|
|
50
|
+
|
|
51
|
+
**UploadButton** matches Figma's `Property 1=upload`: `bg-action-secondary`
|
|
52
|
+
fill (was `bg-surface`) and a dashed `border-action-secondary` outline (was
|
|
53
|
+
`border-main`) drawn 1px outside the 72px circle, as Figma draws it. A real
|
|
54
|
+
border sat inside the box and squeezed the icon to 22px. The `icon` prop is
|
|
55
|
+
now optional and defaults to the camera glyph Figma uses.
|
|
56
|
+
|
|
57
|
+
**ProductCard (list)** pins the name box and the rating/cart row at 41px each,
|
|
58
|
+
as Figma does, so the card is 294 tall (it was 292). The docs site's spec
|
|
59
|
+
already said 294; the package was the one that was wrong.
|
|
60
|
+
|
|
61
|
+
compose-ui ships the same changes as `compose-v2.0.0`. The major bump is for
|
|
62
|
+
the ramp rename, which there is `SnackyColorPrimitive.Primary` becoming
|
|
63
|
+
`SnackyColorPrimitive.Amber`; `SnackyColor.*` semantic names are unchanged.
|
|
64
|
+
It also adds `SnackyUploadButton`, which react-ui had and compose-ui did not,
|
|
65
|
+
and `SnackyIcons.Solid.AngleSmallRight`.
|
|
66
|
+
|
|
67
|
+
## SoldOut overlay uses its own token (0.9.1)
|
|
68
|
+
|
|
69
|
+
Auditing the rest of the package after the semantic-token fix turned up two
|
|
70
|
+
places still painting `rgba(51, 51, 51, 0.8)` by hand: `.snacky-soldout-badge`
|
|
71
|
+
and `.snacky-product-image-sold-label`. `--bg-overlay-dim` is defined for
|
|
72
|
+
exactly that value, and its description in `tokens.json` names this exact use
|
|
73
|
+
("Dark translucent overlay - e.g. Sold Out badge over product images"), so
|
|
74
|
+
both now reference the token. Renders identically (verified in the badge
|
|
75
|
+
playground: still `rgba(51, 51, 51, 0.8)`), but the overlay is now overridable
|
|
76
|
+
like every other colour.
|
|
77
|
+
|
|
78
|
+
compose-ui already had this right, using `SnackyColor.bgOverlayDim` in all
|
|
79
|
+
three places it paints the overlay, so nothing changed there. Everything else
|
|
80
|
+
in the component CSS was already on tokens; the remaining raw values are
|
|
81
|
+
alpha-only tints with no token behind them (the tertiary icon-button press
|
|
82
|
+
state, ProductCard's white scrim).
|
|
83
|
+
|
|
7
84
|
## Semantic tokens reference their primitive again, instead of copying it (0.9.0)
|
|
8
85
|
|
|
9
86
|
`tokens.css` shipped every semantic token as a frozen literal:
|
package/dist/index.cjs
CHANGED
|
@@ -153,141 +153,6 @@ var IconButton = (0, import_react2.forwardRef)(function IconButton2({ variant =
|
|
|
153
153
|
|
|
154
154
|
// src/components/IconButton/UploadButton.tsx
|
|
155
155
|
var import_react3 = require("react");
|
|
156
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
157
|
-
var UploadButton = (0, import_react3.forwardRef)(function UploadButton2({ icon: icon3, ariaLabel = "Upload image", className, ...rest }, ref) {
|
|
158
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { ref, type: "button", "aria-label": ariaLabel, className: cx("snacky-upload", className), ...rest, children: icon3 });
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// src/components/Input/TextField.tsx
|
|
162
|
-
var import_react4 = require("react");
|
|
163
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
164
|
-
var TextField = (0, import_react4.forwardRef)(function TextField2({
|
|
165
|
-
value,
|
|
166
|
-
onChange,
|
|
167
|
-
label,
|
|
168
|
-
leadingIcon,
|
|
169
|
-
trailingIcon,
|
|
170
|
-
trailingIconRotated = false,
|
|
171
|
-
error,
|
|
172
|
-
disabled,
|
|
173
|
-
className,
|
|
174
|
-
id,
|
|
175
|
-
...rest
|
|
176
|
-
}, ref) {
|
|
177
|
-
const autoId = (0, import_react4.useId)();
|
|
178
|
-
const fieldId = id ?? autoId;
|
|
179
|
-
const errorMessage = typeof error === "string" ? error : void 0;
|
|
180
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className, children: [
|
|
181
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "snacky-field-label", htmlFor: fieldId, children: label }),
|
|
182
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
183
|
-
"div",
|
|
184
|
-
{
|
|
185
|
-
className: cx("snacky-field", !!error && "snacky-field--error", disabled && "snacky-field--disabled"),
|
|
186
|
-
children: [
|
|
187
|
-
leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "snacky-field__icon", children: leadingIcon }),
|
|
188
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
189
|
-
"input",
|
|
190
|
-
{
|
|
191
|
-
ref,
|
|
192
|
-
id: fieldId,
|
|
193
|
-
className: "snacky-field__input",
|
|
194
|
-
value,
|
|
195
|
-
onChange: (e) => onChange(e.target.value),
|
|
196
|
-
disabled,
|
|
197
|
-
...rest
|
|
198
|
-
}
|
|
199
|
-
),
|
|
200
|
-
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
201
|
-
"span",
|
|
202
|
-
{
|
|
203
|
-
className: "snacky-field__icon",
|
|
204
|
-
style: trailingIconRotated ? { transform: "rotate(180deg)" } : void 0,
|
|
205
|
-
children: trailingIcon
|
|
206
|
-
}
|
|
207
|
-
)
|
|
208
|
-
]
|
|
209
|
-
}
|
|
210
|
-
),
|
|
211
|
-
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "snacky-field-error", children: errorMessage })
|
|
212
|
-
] });
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
// src/components/Input/SearchField.tsx
|
|
216
|
-
var import_react5 = require("react");
|
|
217
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
218
|
-
var SearchField = (0, import_react5.forwardRef)(function SearchField2({ value, onChange, searchIcon, onClear, className, placeholder = "Search products...", ...rest }, ref) {
|
|
219
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cx("snacky-search", className), children: [
|
|
220
|
-
searchIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "snacky-search__icon", children: searchIcon }),
|
|
221
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
222
|
-
"input",
|
|
223
|
-
{
|
|
224
|
-
ref,
|
|
225
|
-
className: "snacky-search__input",
|
|
226
|
-
value,
|
|
227
|
-
placeholder,
|
|
228
|
-
onChange: (e) => onChange(e.target.value),
|
|
229
|
-
...rest
|
|
230
|
-
}
|
|
231
|
-
),
|
|
232
|
-
value && onClear && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "snacky-search__clear", onClick: onClear, "aria-label": "Clear search", children: "\u2715" })
|
|
233
|
-
] });
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
// src/components/Input/OtpField.tsx
|
|
237
|
-
var import_react6 = require("react");
|
|
238
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
239
|
-
function OtpField({ value, onChange, length = 6, disabled }) {
|
|
240
|
-
const cellRefs = (0, import_react6.useRef)([]);
|
|
241
|
-
const digits = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
242
|
-
function setDigit(index, digit) {
|
|
243
|
-
const next = digits.slice();
|
|
244
|
-
next[index] = digit;
|
|
245
|
-
onChange(next.join(""));
|
|
246
|
-
if (digit && index < length - 1) cellRefs.current[index + 1]?.focus();
|
|
247
|
-
}
|
|
248
|
-
function handleKeyDown(index, e) {
|
|
249
|
-
if (e.key === "Backspace" && !digits[index] && index > 0) {
|
|
250
|
-
cellRefs.current[index - 1]?.focus();
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "snacky-otp", children: digits.map((digit, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
254
|
-
"input",
|
|
255
|
-
{
|
|
256
|
-
ref: (el) => {
|
|
257
|
-
cellRefs.current[i] = el;
|
|
258
|
-
},
|
|
259
|
-
className: "snacky-otp__cell",
|
|
260
|
-
inputMode: "numeric",
|
|
261
|
-
maxLength: 1,
|
|
262
|
-
value: digit,
|
|
263
|
-
disabled,
|
|
264
|
-
onChange: (e) => setDigit(i, e.target.value.replace(/\D/g, "").slice(-1)),
|
|
265
|
-
onKeyDown: (e) => handleKeyDown(i, e),
|
|
266
|
-
"aria-label": `Digit ${i + 1}`
|
|
267
|
-
},
|
|
268
|
-
i
|
|
269
|
-
)) });
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// src/components/Input/CopyField.tsx
|
|
273
|
-
var import_react7 = require("react");
|
|
274
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
275
|
-
function CopyField({ value, onCopy, className }) {
|
|
276
|
-
const [copied, setCopied] = (0, import_react7.useState)(false);
|
|
277
|
-
async function handleCopy() {
|
|
278
|
-
try {
|
|
279
|
-
await navigator.clipboard.writeText(value);
|
|
280
|
-
} catch {
|
|
281
|
-
}
|
|
282
|
-
onCopy?.(value);
|
|
283
|
-
setCopied(true);
|
|
284
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
285
|
-
}
|
|
286
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cx("snacky-copy", className), children: [
|
|
287
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "snacky-copy__value", children: value }),
|
|
288
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: cx("snacky-copy__action", copied && "snacky-copy__action--copied"), onClick: handleCopy, children: copied ? "Copied" : "Copy" })
|
|
289
|
-
] });
|
|
290
|
-
}
|
|
291
156
|
|
|
292
157
|
// src/icons/outline.tsx
|
|
293
158
|
var outline_exports = {};
|
|
@@ -335,10 +200,10 @@ __export(outline_exports, {
|
|
|
335
200
|
truck: () => truck,
|
|
336
201
|
unsent: () => unsent
|
|
337
202
|
});
|
|
338
|
-
var
|
|
203
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
339
204
|
function icon(viewBox, paths) {
|
|
340
205
|
return function SnackyIcon({ width = viewBox, height = viewBox, color = "currentColor", ...rest }) {
|
|
341
|
-
return /* @__PURE__ */ (0,
|
|
206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width, height, viewBox: `0 0 ${viewBox} ${viewBox}`, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: paths.map(([d, fillRule], i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
342
207
|
"path",
|
|
343
208
|
{
|
|
344
209
|
d,
|
|
@@ -512,6 +377,143 @@ var unsent = icon(24, [
|
|
|
512
377
|
["M11.9999 7C11.7788 7 11.5669 7.0878 11.4106 7.24408C11.2543 7.40036 11.1665 7.61232 11.1665 7.83333V11.4375L8.35735 13.1975C8.16949 13.3148 8.03594 13.502 7.98609 13.7179C7.93624 13.9337 7.97416 14.1605 8.09152 14.3483C8.20888 14.5362 8.39606 14.6697 8.61188 14.7196C8.8277 14.7694 9.05449 14.7315 9.24235 14.6142L12.4424 12.6142C12.5633 12.5384 12.6627 12.4329 12.7311 12.3077C12.7996 12.1825 12.8347 12.0418 12.8332 11.8992V7.83333C12.8332 7.61232 12.7454 7.40036 12.5891 7.24408C12.4328 7.0878 12.2209 7 11.9999 7Z", "nonzero"]
|
|
513
378
|
]);
|
|
514
379
|
|
|
380
|
+
// src/components/IconButton/UploadButton.tsx
|
|
381
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
382
|
+
var UploadButton = (0, import_react3.forwardRef)(function UploadButton2({ icon: icon3 = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(camera, {}), ariaLabel = "Upload image", className, ...rest }, ref) {
|
|
383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { ref, type: "button", "aria-label": ariaLabel, className: cx("snacky-upload", className), ...rest, children: icon3 });
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
// src/components/Input/TextField.tsx
|
|
387
|
+
var import_react4 = require("react");
|
|
388
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
389
|
+
var TextField = (0, import_react4.forwardRef)(function TextField2({
|
|
390
|
+
value,
|
|
391
|
+
onChange,
|
|
392
|
+
label,
|
|
393
|
+
leadingIcon,
|
|
394
|
+
trailingIcon,
|
|
395
|
+
trailingIconRotated = false,
|
|
396
|
+
error,
|
|
397
|
+
disabled,
|
|
398
|
+
className,
|
|
399
|
+
id,
|
|
400
|
+
...rest
|
|
401
|
+
}, ref) {
|
|
402
|
+
const autoId = (0, import_react4.useId)();
|
|
403
|
+
const fieldId = id ?? autoId;
|
|
404
|
+
const errorMessage = typeof error === "string" ? error : void 0;
|
|
405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className, children: [
|
|
406
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { className: "snacky-field-label", htmlFor: fieldId, children: label }),
|
|
407
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
408
|
+
"div",
|
|
409
|
+
{
|
|
410
|
+
className: cx("snacky-field", !!error && "snacky-field--error", disabled && "snacky-field--disabled"),
|
|
411
|
+
children: [
|
|
412
|
+
leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "snacky-field__icon", children: leadingIcon }),
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
414
|
+
"input",
|
|
415
|
+
{
|
|
416
|
+
ref,
|
|
417
|
+
id: fieldId,
|
|
418
|
+
className: "snacky-field__input",
|
|
419
|
+
value,
|
|
420
|
+
onChange: (e) => onChange(e.target.value),
|
|
421
|
+
disabled,
|
|
422
|
+
...rest
|
|
423
|
+
}
|
|
424
|
+
),
|
|
425
|
+
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
426
|
+
"span",
|
|
427
|
+
{
|
|
428
|
+
className: "snacky-field__icon",
|
|
429
|
+
style: trailingIconRotated ? { transform: "rotate(180deg)" } : void 0,
|
|
430
|
+
children: trailingIcon
|
|
431
|
+
}
|
|
432
|
+
)
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "snacky-field-error", children: errorMessage })
|
|
437
|
+
] });
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
// src/components/Input/SearchField.tsx
|
|
441
|
+
var import_react5 = require("react");
|
|
442
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
443
|
+
var SearchField = (0, import_react5.forwardRef)(function SearchField2({ value, onChange, searchIcon, onClear, className, placeholder = "Search products...", ...rest }, ref) {
|
|
444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cx("snacky-search", className), children: [
|
|
445
|
+
searchIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "snacky-search__icon", children: searchIcon }),
|
|
446
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
447
|
+
"input",
|
|
448
|
+
{
|
|
449
|
+
ref,
|
|
450
|
+
className: "snacky-search__input",
|
|
451
|
+
value,
|
|
452
|
+
placeholder,
|
|
453
|
+
onChange: (e) => onChange(e.target.value),
|
|
454
|
+
...rest
|
|
455
|
+
}
|
|
456
|
+
),
|
|
457
|
+
value && onClear && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "snacky-search__clear", onClick: onClear, "aria-label": "Clear search", children: "\u2715" })
|
|
458
|
+
] });
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
// src/components/Input/OtpField.tsx
|
|
462
|
+
var import_react6 = require("react");
|
|
463
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
464
|
+
function OtpField({ value, onChange, length = 6, disabled }) {
|
|
465
|
+
const cellRefs = (0, import_react6.useRef)([]);
|
|
466
|
+
const digits = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
467
|
+
function setDigit(index, digit) {
|
|
468
|
+
const next = digits.slice();
|
|
469
|
+
next[index] = digit;
|
|
470
|
+
onChange(next.join(""));
|
|
471
|
+
if (digit && index < length - 1) cellRefs.current[index + 1]?.focus();
|
|
472
|
+
}
|
|
473
|
+
function handleKeyDown(index, e) {
|
|
474
|
+
if (e.key === "Backspace" && !digits[index] && index > 0) {
|
|
475
|
+
cellRefs.current[index - 1]?.focus();
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "snacky-otp", children: digits.map((digit, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
479
|
+
"input",
|
|
480
|
+
{
|
|
481
|
+
ref: (el) => {
|
|
482
|
+
cellRefs.current[i] = el;
|
|
483
|
+
},
|
|
484
|
+
className: "snacky-otp__cell",
|
|
485
|
+
inputMode: "numeric",
|
|
486
|
+
maxLength: 1,
|
|
487
|
+
value: digit,
|
|
488
|
+
disabled,
|
|
489
|
+
onChange: (e) => setDigit(i, e.target.value.replace(/\D/g, "").slice(-1)),
|
|
490
|
+
onKeyDown: (e) => handleKeyDown(i, e),
|
|
491
|
+
"aria-label": `Digit ${i + 1}`
|
|
492
|
+
},
|
|
493
|
+
i
|
|
494
|
+
)) });
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// src/components/Input/CopyField.tsx
|
|
498
|
+
var import_react7 = require("react");
|
|
499
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
500
|
+
function CopyField({ value, onCopy, className }) {
|
|
501
|
+
const [copied, setCopied] = (0, import_react7.useState)(false);
|
|
502
|
+
async function handleCopy() {
|
|
503
|
+
try {
|
|
504
|
+
await navigator.clipboard.writeText(value);
|
|
505
|
+
} catch {
|
|
506
|
+
}
|
|
507
|
+
onCopy?.(value);
|
|
508
|
+
setCopied(true);
|
|
509
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
510
|
+
}
|
|
511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cx("snacky-copy", className), children: [
|
|
512
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "snacky-copy__value", children: value }),
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: cx("snacky-copy__action", copied && "snacky-copy__action--copied"), onClick: handleCopy, children: copied ? "Copied" : "Copy" })
|
|
514
|
+
] });
|
|
515
|
+
}
|
|
516
|
+
|
|
515
517
|
// src/components/Input/ChatInput.tsx
|
|
516
518
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
517
519
|
function ChatInput({ value, onChange, onSend, sendIcon, className, placeholder = "Write your message here", ...rest }) {
|
|
@@ -702,6 +704,7 @@ function TabRow({ tabs, selected, onSelect, className }) {
|
|
|
702
704
|
var solid_exports = {};
|
|
703
705
|
__export(solid_exports, {
|
|
704
706
|
account: () => account2,
|
|
707
|
+
angleSmallRight: () => angleSmallRight,
|
|
705
708
|
balance: () => balance2,
|
|
706
709
|
bell: () => bell2,
|
|
707
710
|
cart: () => cart2,
|
|
@@ -732,6 +735,9 @@ var account2 = icon2(20, [
|
|
|
732
735
|
["M10 10C12.7614 10 15 7.76142 15 5C15 2.23858 12.7614 0 10 0C7.23858 0 5 2.23858 5 5C5 7.76142 7.23858 10 10 10Z", "nonzero"],
|
|
733
736
|
["M10 11.6659C5.85977 11.6705 2.50461 15.0257 2.5 19.1659C2.5 19.6261 2.87309 19.9992 3.33332 19.9992H16.6666C17.1269 19.9992 17.5 19.6261 17.5 19.1659C17.4954 15.0257 14.1402 11.6705 10 11.6659Z", "nonzero"]
|
|
734
737
|
]);
|
|
738
|
+
var angleSmallRight = icon2(24, [
|
|
739
|
+
["M15.75 9.525L11.164 4.939C10.8827 4.65774 10.5011 4.49978 10.1032 4.49988C9.70534 4.49997 9.32381 4.65811 9.04255 4.9395C8.76129 5.2209 8.60333 5.6025 8.60342 6.00036C8.60352 6.39822 8.76166 6.77974 9.04305 7.061L13.629 11.646C13.6756 11.6925 13.7125 11.7476 13.7378 11.8084C13.763 11.8691 13.7759 11.9342 13.7759 12C13.7759 12.0658 13.763 12.1309 13.7378 12.1916C13.7125 12.2524 13.6756 12.3076 13.629 12.354L9.04305 16.939C8.76166 17.2203 8.60352 17.6018 8.60342 17.9997C8.60333 18.3975 8.76129 18.7791 9.04255 19.0605C9.32381 19.3419 9.70534 19.5 10.1032 19.5001C10.5011 19.5002 10.8827 19.3423 11.164 19.061L15.75 14.475C16.4053 13.818 16.7732 12.9279 16.7732 12C16.7732 11.0721 16.4053 10.182 15.75 9.525Z", "nonzero"]
|
|
740
|
+
]);
|
|
735
741
|
var balance2 = icon2(24, [
|
|
736
742
|
["M19 4.00031H5C3.67441 4.00189 2.40356 4.52919 1.46622 5.46653C0.528882 6.40386 0.00158786 7.67471 0 9.00031L0 15.0003C0.00158786 16.3259 0.528882 17.5967 1.46622 18.5341C2.40356 19.4714 3.67441 19.9987 5 20.0003H19C20.3256 19.9987 21.5964 19.4714 22.5338 18.5341C23.4711 17.5967 23.9984 16.3259 24 15.0003V9.00031C23.9984 7.67471 23.4711 6.40386 22.5338 5.46653C21.5964 4.52919 20.3256 4.00189 19 4.00031ZM4 17.0003C3.80222 17.0003 3.60888 16.9417 3.44443 16.8318C3.27998 16.7219 3.15181 16.5657 3.07612 16.383C3.00043 16.2003 2.98063 15.9992 3.01921 15.8052C3.0578 15.6112 3.15304 15.4331 3.29289 15.2932C3.43275 15.1533 3.61093 15.0581 3.80491 15.0195C3.99889 14.9809 4.19996 15.0007 4.38268 15.0764C4.56541 15.1521 4.72159 15.2803 4.83147 15.4447C4.94135 15.6092 5 15.8025 5 16.0003C5 16.2655 4.89464 16.5199 4.70711 16.7074C4.51957 16.8949 4.26522 17.0003 4 17.0003ZM4 9.00031C3.80222 9.00031 3.60888 8.94166 3.44443 8.83177C3.27998 8.72189 3.15181 8.56571 3.07612 8.38299C3.00043 8.20026 2.98063 7.9992 3.01921 7.80521C3.0578 7.61123 3.15304 7.43305 3.29289 7.2932C3.43275 7.15335 3.61093 7.0581 3.80491 7.01952C3.99889 6.98093 4.19996 7.00074 4.38268 7.07643C4.56541 7.15211 4.72159 7.28029 4.83147 7.44474C4.94135 7.60918 5 7.80252 5 8.00031C5 8.26552 4.89464 8.51988 4.70711 8.70741C4.51957 8.89495 4.26522 9.00031 4 9.00031ZM12 16.0003C11.2089 16.0003 10.4355 15.7657 9.77772 15.3262C9.11992 14.8867 8.60723 14.2619 8.30448 13.531C8.00173 12.8001 7.92252 11.9959 8.07686 11.2199C8.2312 10.444 8.61216 9.73129 9.17157 9.17188C9.73098 8.61247 10.4437 8.2315 11.2196 8.07716C11.9956 7.92282 12.7998 8.00204 13.5307 8.30479C14.2616 8.60754 14.8864 9.12023 15.3259 9.77802C15.7654 10.4358 16 11.2092 16 12.0003C16 13.0612 15.5786 14.0786 14.8284 14.8287C14.0783 15.5789 13.0609 16.0003 12 16.0003ZM20 17.0003C19.8022 17.0003 19.6089 16.9417 19.4444 16.8318C19.28 16.7219 19.1518 16.5657 19.0761 16.383C19.0004 16.2003 18.9806 15.9992 19.0192 15.8052C19.0578 15.6112 19.153 15.4331 19.2929 15.2932C19.4327 15.1533 19.6109 15.0581 19.8049 15.0195C19.9989 14.9809 20.2 15.0007 20.3827 15.0764C20.5654 15.1521 20.7216 15.2803 20.8315 15.4447C20.9414 15.6092 21 15.8025 21 16.0003C21 16.2655 20.8946 16.5199 20.7071 16.7074C20.5196 16.8949 20.2652 17.0003 20 17.0003ZM20 9.00031C19.8022 9.00031 19.6089 8.94166 19.4444 8.83177C19.28 8.72189 19.1518 8.56571 19.0761 8.38299C19.0004 8.20026 18.9806 7.9992 19.0192 7.80521C19.0578 7.61123 19.153 7.43305 19.2929 7.2932C19.4327 7.15335 19.6109 7.0581 19.8049 7.01952C19.9989 6.98093 20.2 7.00074 20.3827 7.07643C20.5654 7.15211 20.7216 7.28029 20.8315 7.44474C20.9414 7.60918 21 7.80252 21 8.00031C21 8.26552 20.8946 8.51988 20.7071 8.70741C20.5196 8.89495 20.2652 9.00031 20 9.00031ZM14 12.0003C14 12.3959 13.8827 12.7825 13.6629 13.1114C13.4432 13.4403 13.1308 13.6967 12.7654 13.8481C12.3999 13.9994 11.9978 14.039 11.6098 13.9619C11.2219 13.8847 10.8655 13.6942 10.5858 13.4145C10.3061 13.1348 10.1156 12.7784 10.0384 12.3905C9.96126 12.0025 10.0009 11.6004 10.1522 11.2349C10.3036 10.8695 10.56 10.5571 10.8889 10.3374C11.2178 10.1176 11.6044 10.0003 12 10.0003C12.5304 10.0003 13.0391 10.211 13.4142 10.5861C13.7893 10.9612 14 11.4699 14 12.0003Z", "nonzero"]
|
|
737
743
|
]);
|
|
@@ -1029,7 +1035,7 @@ function Section({ title, onAction, children, className }) {
|
|
|
1029
1035
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("section", { className: cx("snacky-section", className), children: [
|
|
1030
1036
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "snacky-section__header", children: [
|
|
1031
1037
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h3", { className: "snacky-section__title", children: title }),
|
|
1032
|
-
onAction && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1038
|
+
onAction && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconButton, { size: "small", icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(angleSmallRight, {}), onClick: onAction, ariaLabel: `See more: ${title}` })
|
|
1033
1039
|
] }),
|
|
1034
1040
|
children
|
|
1035
1041
|
] });
|