@snacky/ui 0.4.4 → 0.4.5

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/dist/index.cjs CHANGED
@@ -284,192 +284,6 @@ function CopyField({ value, onCopy, className }) {
284
284
  ] });
285
285
  }
286
286
 
287
- // src/components/Input/ChatInput.tsx
288
- var import_jsx_runtime8 = require("react/jsx-runtime");
289
- function ChatInput({ value, onChange, onSend, sendIcon, className, placeholder = "Write your message here", ...rest }) {
290
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cx("snacky-chatfield", className), children: [
291
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
292
- "input",
293
- {
294
- className: "snacky-chatfield__input",
295
- value,
296
- placeholder,
297
- onChange: (e) => onChange(e.target.value),
298
- onKeyDown: (e) => e.key === "Enter" && value && onSend(),
299
- ...rest
300
- }
301
- ),
302
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
303
- "button",
304
- {
305
- type: "button",
306
- className: cx("snacky-chatfield__send", value && "snacky-chatfield__send--active"),
307
- onClick: onSend,
308
- disabled: !value,
309
- "aria-label": "Send",
310
- children: sendIcon ?? "\u27A4"
311
- }
312
- )
313
- ] });
314
- }
315
-
316
- // src/components/Input/AddressResult.tsx
317
- var import_jsx_runtime9 = require("react/jsx-runtime");
318
- function AddressResult({ icon: icon3, title, subtitle, onClick, className }) {
319
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: cx("snacky-address-result", className), onClick, children: [
320
- icon3 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "snacky-address-result__icon", children: icon3 }),
321
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
322
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "snacky-address-result__title", children: title }),
323
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "snacky-address-result__subtitle", children: subtitle })
324
- ] })
325
- ] });
326
- }
327
-
328
- // src/components/Chips/ProductChip.tsx
329
- var import_jsx_runtime10 = require("react/jsx-runtime");
330
- function ProductChip({ label, selected, thumbnail, onClick, className, ...rest }) {
331
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
332
- "button",
333
- {
334
- type: "button",
335
- className: cx("snacky-chip", selected && "snacky-chip--selected", className),
336
- "aria-pressed": selected,
337
- onClick,
338
- ...rest,
339
- children: [
340
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "snacky-chip__thumb", children: thumbnail }),
341
- label
342
- ]
343
- }
344
- );
345
- }
346
-
347
- // src/components/Chips/FilterChip.tsx
348
- var import_jsx_runtime11 = require("react/jsx-runtime");
349
- function FilterChip({ label, selected, onClick, className, ...rest }) {
350
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
351
- "button",
352
- {
353
- type: "button",
354
- className: cx("snacky-chip", selected && "snacky-chip--selected", className),
355
- "aria-pressed": selected,
356
- onClick,
357
- ...rest,
358
- children: label
359
- }
360
- );
361
- }
362
-
363
- // src/components/RadioButton/RadioButton.tsx
364
- var import_react8 = require("react");
365
- var import_jsx_runtime12 = require("react/jsx-runtime");
366
- function RadioOption({ label, selected, onClick, disabled, name, className }) {
367
- const id = (0, import_react8.useId)();
368
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
369
- "label",
370
- {
371
- htmlFor: id,
372
- className: cx("snacky-radio-option", disabled && "snacky-radio-option--disabled", className),
373
- children: [
374
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
375
- "input",
376
- {
377
- id,
378
- type: "radio",
379
- className: "snacky-radio",
380
- name,
381
- checked: selected,
382
- disabled,
383
- onChange: onClick
384
- }
385
- ),
386
- label
387
- ]
388
- }
389
- );
390
- }
391
-
392
- // src/components/Checkbox/Checkbox.tsx
393
- var import_react9 = require("react");
394
- var import_jsx_runtime13 = require("react/jsx-runtime");
395
- function Checkbox({ label, checked, onChange, disabled, className }) {
396
- const id = (0, import_react9.useId)();
397
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { htmlFor: id, className: cx("snacky-checkbox-option", className), children: [
398
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
399
- "input",
400
- {
401
- id,
402
- type: "checkbox",
403
- className: "snacky-checkbox",
404
- checked,
405
- disabled,
406
- onChange: (e) => onChange(e.target.checked)
407
- }
408
- ),
409
- label
410
- ] });
411
- }
412
-
413
- // src/components/Toggle/Toggle.tsx
414
- var import_jsx_runtime14 = require("react/jsx-runtime");
415
- function Toggle({ checked, onChange, disabled, ariaLabel = "Toggle", className }) {
416
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
417
- "button",
418
- {
419
- type: "button",
420
- role: "switch",
421
- "aria-checked": checked,
422
- "aria-label": ariaLabel,
423
- disabled,
424
- className: cx("snacky-toggle", checked && "snacky-toggle--on", className),
425
- onClick: () => onChange(!checked),
426
- children: [
427
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "snacky-toggle__track" }),
428
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "snacky-toggle__thumb" })
429
- ]
430
- }
431
- );
432
- }
433
-
434
- // src/components/Navbar/Navbar.tsx
435
- var import_jsx_runtime15 = require("react/jsx-runtime");
436
- function NavBar({ items, selected, onSelect, className }) {
437
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("nav", { className: cx("snacky-navbar", className), children: items.map((item, i) => {
438
- const active = i === selected;
439
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
440
- "button",
441
- {
442
- type: "button",
443
- className: cx("snacky-navbar__item", active && "snacky-navbar__item--active"),
444
- "aria-current": active ? "page" : void 0,
445
- onClick: () => onSelect(i),
446
- children: [
447
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "snacky-navbar__icon", children: active && item.activeIcon ? item.activeIcon : item.icon }),
448
- item.label
449
- ]
450
- },
451
- item.label
452
- );
453
- }) });
454
- }
455
-
456
- // src/components/Tab/Tab.tsx
457
- var import_jsx_runtime16 = require("react/jsx-runtime");
458
- function TabRow({ tabs, selected, onSelect, className }) {
459
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cx("snacky-tabrow", className), role: "tablist", children: tabs.map((tab, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
460
- "button",
461
- {
462
- type: "button",
463
- role: "tab",
464
- "aria-selected": i === selected,
465
- className: cx("snacky-tab", i === selected && "snacky-tab--active"),
466
- onClick: () => onSelect(i),
467
- children: tab
468
- },
469
- tab
470
- )) });
471
- }
472
-
473
287
  // src/icons/outline.tsx
474
288
  var outline_exports = {};
475
289
  __export(outline_exports, {
@@ -516,10 +330,10 @@ __export(outline_exports, {
516
330
  truck: () => truck,
517
331
  unsent: () => unsent
518
332
  });
519
- var import_jsx_runtime17 = require("react/jsx-runtime");
333
+ var import_jsx_runtime8 = require("react/jsx-runtime");
520
334
  function icon(viewBox, paths) {
521
335
  return function SnackyIcon({ width = viewBox, height = viewBox, color = "currentColor", ...rest }) {
522
- return /* @__PURE__ */ (0, import_jsx_runtime17.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_runtime17.jsx)(
336
+ return /* @__PURE__ */ (0, import_jsx_runtime8.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_runtime8.jsx)(
523
337
  "path",
524
338
  {
525
339
  d,
@@ -693,6 +507,192 @@ var unsent = icon(24, [
693
507
  ["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"]
694
508
  ]);
695
509
 
510
+ // src/components/Input/ChatInput.tsx
511
+ var import_jsx_runtime9 = require("react/jsx-runtime");
512
+ function ChatInput({ value, onChange, onSend, sendIcon, className, placeholder = "Write your message here", ...rest }) {
513
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cx("snacky-chatfield", className), children: [
514
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
515
+ "input",
516
+ {
517
+ className: "snacky-chatfield__input",
518
+ value,
519
+ placeholder,
520
+ onChange: (e) => onChange(e.target.value),
521
+ onKeyDown: (e) => e.key === "Enter" && value && onSend(),
522
+ ...rest
523
+ }
524
+ ),
525
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
526
+ "button",
527
+ {
528
+ type: "button",
529
+ className: cx("snacky-chatfield__send", value && "snacky-chatfield__send--active"),
530
+ onClick: onSend,
531
+ disabled: !value,
532
+ "aria-label": "Send",
533
+ children: sendIcon ?? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(send, { width: 20, height: 20 })
534
+ }
535
+ )
536
+ ] });
537
+ }
538
+
539
+ // src/components/Input/AddressResult.tsx
540
+ var import_jsx_runtime10 = require("react/jsx-runtime");
541
+ function AddressResult({ icon: icon3, title, subtitle, onClick, className }) {
542
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: cx("snacky-address-result", className), onClick, children: [
543
+ icon3 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "snacky-address-result__icon", children: icon3 }),
544
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
545
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "snacky-address-result__title", children: title }),
546
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "snacky-address-result__subtitle", children: subtitle })
547
+ ] })
548
+ ] });
549
+ }
550
+
551
+ // src/components/Chips/ProductChip.tsx
552
+ var import_jsx_runtime11 = require("react/jsx-runtime");
553
+ function ProductChip({ label, selected, thumbnail, onClick, className, ...rest }) {
554
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
555
+ "button",
556
+ {
557
+ type: "button",
558
+ className: cx("snacky-chip", selected && "snacky-chip--selected", className),
559
+ "aria-pressed": selected,
560
+ onClick,
561
+ ...rest,
562
+ children: [
563
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "snacky-chip__thumb", children: thumbnail }),
564
+ label
565
+ ]
566
+ }
567
+ );
568
+ }
569
+
570
+ // src/components/Chips/FilterChip.tsx
571
+ var import_jsx_runtime12 = require("react/jsx-runtime");
572
+ function FilterChip({ label, selected, onClick, className, ...rest }) {
573
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
574
+ "button",
575
+ {
576
+ type: "button",
577
+ className: cx("snacky-chip", selected && "snacky-chip--selected", className),
578
+ "aria-pressed": selected,
579
+ onClick,
580
+ ...rest,
581
+ children: label
582
+ }
583
+ );
584
+ }
585
+
586
+ // src/components/RadioButton/RadioButton.tsx
587
+ var import_react8 = require("react");
588
+ var import_jsx_runtime13 = require("react/jsx-runtime");
589
+ function RadioOption({ label, selected, onClick, disabled, name, className }) {
590
+ const id = (0, import_react8.useId)();
591
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
592
+ "label",
593
+ {
594
+ htmlFor: id,
595
+ className: cx("snacky-radio-option", disabled && "snacky-radio-option--disabled", className),
596
+ children: [
597
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
598
+ "input",
599
+ {
600
+ id,
601
+ type: "radio",
602
+ className: "snacky-radio",
603
+ name,
604
+ checked: selected,
605
+ disabled,
606
+ onChange: onClick
607
+ }
608
+ ),
609
+ label
610
+ ]
611
+ }
612
+ );
613
+ }
614
+
615
+ // src/components/Checkbox/Checkbox.tsx
616
+ var import_react9 = require("react");
617
+ var import_jsx_runtime14 = require("react/jsx-runtime");
618
+ function Checkbox({ label, checked, onChange, disabled, className }) {
619
+ const id = (0, import_react9.useId)();
620
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { htmlFor: id, className: cx("snacky-checkbox-option", className), children: [
621
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
622
+ "input",
623
+ {
624
+ id,
625
+ type: "checkbox",
626
+ className: "snacky-checkbox",
627
+ checked,
628
+ disabled,
629
+ onChange: (e) => onChange(e.target.checked)
630
+ }
631
+ ),
632
+ label
633
+ ] });
634
+ }
635
+
636
+ // src/components/Toggle/Toggle.tsx
637
+ var import_jsx_runtime15 = require("react/jsx-runtime");
638
+ function Toggle({ checked, onChange, disabled, ariaLabel = "Toggle", className }) {
639
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
640
+ "button",
641
+ {
642
+ type: "button",
643
+ role: "switch",
644
+ "aria-checked": checked,
645
+ "aria-label": ariaLabel,
646
+ disabled,
647
+ className: cx("snacky-toggle", checked && "snacky-toggle--on", className),
648
+ onClick: () => onChange(!checked),
649
+ children: [
650
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "snacky-toggle__track" }),
651
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "snacky-toggle__thumb" })
652
+ ]
653
+ }
654
+ );
655
+ }
656
+
657
+ // src/components/Navbar/Navbar.tsx
658
+ var import_jsx_runtime16 = require("react/jsx-runtime");
659
+ function NavBar({ items, selected, onSelect, className }) {
660
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("nav", { className: cx("snacky-navbar", className), children: items.map((item, i) => {
661
+ const active = i === selected;
662
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
663
+ "button",
664
+ {
665
+ type: "button",
666
+ className: cx("snacky-navbar__item", active && "snacky-navbar__item--active"),
667
+ "aria-current": active ? "page" : void 0,
668
+ onClick: () => onSelect(i),
669
+ children: [
670
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "snacky-navbar__icon", children: active && item.activeIcon ? item.activeIcon : item.icon }),
671
+ item.label
672
+ ]
673
+ },
674
+ item.label
675
+ );
676
+ }) });
677
+ }
678
+
679
+ // src/components/Tab/Tab.tsx
680
+ var import_jsx_runtime17 = require("react/jsx-runtime");
681
+ function TabRow({ tabs, selected, onSelect, className }) {
682
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: cx("snacky-tabrow", className), role: "tablist", children: tabs.map((tab, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
683
+ "button",
684
+ {
685
+ type: "button",
686
+ role: "tab",
687
+ "aria-selected": i === selected,
688
+ className: cx("snacky-tab", i === selected && "snacky-tab--active"),
689
+ onClick: () => onSelect(i),
690
+ children: tab
691
+ },
692
+ tab
693
+ )) });
694
+ }
695
+
696
696
  // src/icons/solid.tsx
697
697
  var solid_exports = {};
698
698
  __export(solid_exports, {
@@ -1076,9 +1076,9 @@ function ProductCard(props) {
1076
1076
  ")"
1077
1077
  ] }),
1078
1078
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "snacky-product-card__actions snacky-product-card__actions--details", children: [
1079
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { variant: "secondary", icon: favoriteIcon ?? "\u2665", selected: favorited, onClick: onFavoriteClick, ariaLabel: "Favorite" }),
1080
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { variant: "secondary", icon: shareIcon ?? "\u2934", onClick: onShareClick, ariaLabel: "Share" }),
1081
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { variant: "secondary", icon: chatIcon ?? "\u{1F4AC}", onClick: onChatClick, ariaLabel: "Chat with seller" })
1079
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { variant: "secondary", icon: favoriteIcon ?? (favorited ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(heart2, { width: 20, height: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(heart, { width: 20, height: 20 })), selected: favorited, onClick: onFavoriteClick, ariaLabel: "Favorite" }),
1080
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { variant: "secondary", icon: shareIcon ?? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(share, { width: 20, height: 20 }), onClick: onShareClick, ariaLabel: "Share" }),
1081
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { variant: "secondary", icon: chatIcon ?? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(chat, { width: 20, height: 20 }), onClick: onChatClick, ariaLabel: "Chat with seller" })
1082
1082
  ] })
1083
1083
  ] })
1084
1084
  ] });
@@ -1111,7 +1111,7 @@ function ProductCard(props) {
1111
1111
  IconButton,
1112
1112
  {
1113
1113
  variant: "primary",
1114
- icon: cartIcon ?? "+",
1114
+ icon: cartIcon ?? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(cartAdd, { width: 16, height: 16 }),
1115
1115
  onClick: (e) => {
1116
1116
  e.stopPropagation();
1117
1117
  onAddToCart();