@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.js CHANGED
@@ -227,192 +227,6 @@ function CopyField({ value, onCopy, className }) {
227
227
  ] });
228
228
  }
229
229
 
230
- // src/components/Input/ChatInput.tsx
231
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
232
- function ChatInput({ value, onChange, onSend, sendIcon, className, placeholder = "Write your message here", ...rest }) {
233
- return /* @__PURE__ */ jsxs5("div", { className: cx("snacky-chatfield", className), children: [
234
- /* @__PURE__ */ jsx8(
235
- "input",
236
- {
237
- className: "snacky-chatfield__input",
238
- value,
239
- placeholder,
240
- onChange: (e) => onChange(e.target.value),
241
- onKeyDown: (e) => e.key === "Enter" && value && onSend(),
242
- ...rest
243
- }
244
- ),
245
- /* @__PURE__ */ jsx8(
246
- "button",
247
- {
248
- type: "button",
249
- className: cx("snacky-chatfield__send", value && "snacky-chatfield__send--active"),
250
- onClick: onSend,
251
- disabled: !value,
252
- "aria-label": "Send",
253
- children: sendIcon ?? "\u27A4"
254
- }
255
- )
256
- ] });
257
- }
258
-
259
- // src/components/Input/AddressResult.tsx
260
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
261
- function AddressResult({ icon: icon3, title, subtitle, onClick, className }) {
262
- return /* @__PURE__ */ jsxs6("button", { type: "button", className: cx("snacky-address-result", className), onClick, children: [
263
- icon3 && /* @__PURE__ */ jsx9("span", { className: "snacky-address-result__icon", children: icon3 }),
264
- /* @__PURE__ */ jsxs6("span", { children: [
265
- /* @__PURE__ */ jsx9("p", { className: "snacky-address-result__title", children: title }),
266
- /* @__PURE__ */ jsx9("p", { className: "snacky-address-result__subtitle", children: subtitle })
267
- ] })
268
- ] });
269
- }
270
-
271
- // src/components/Chips/ProductChip.tsx
272
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
273
- function ProductChip({ label, selected, thumbnail, onClick, className, ...rest }) {
274
- return /* @__PURE__ */ jsxs7(
275
- "button",
276
- {
277
- type: "button",
278
- className: cx("snacky-chip", selected && "snacky-chip--selected", className),
279
- "aria-pressed": selected,
280
- onClick,
281
- ...rest,
282
- children: [
283
- /* @__PURE__ */ jsx10("span", { className: "snacky-chip__thumb", children: thumbnail }),
284
- label
285
- ]
286
- }
287
- );
288
- }
289
-
290
- // src/components/Chips/FilterChip.tsx
291
- import { jsx as jsx11 } from "react/jsx-runtime";
292
- function FilterChip({ label, selected, onClick, className, ...rest }) {
293
- return /* @__PURE__ */ jsx11(
294
- "button",
295
- {
296
- type: "button",
297
- className: cx("snacky-chip", selected && "snacky-chip--selected", className),
298
- "aria-pressed": selected,
299
- onClick,
300
- ...rest,
301
- children: label
302
- }
303
- );
304
- }
305
-
306
- // src/components/RadioButton/RadioButton.tsx
307
- import { useId as useId2 } from "react";
308
- import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
309
- function RadioOption({ label, selected, onClick, disabled, name, className }) {
310
- const id = useId2();
311
- return /* @__PURE__ */ jsxs8(
312
- "label",
313
- {
314
- htmlFor: id,
315
- className: cx("snacky-radio-option", disabled && "snacky-radio-option--disabled", className),
316
- children: [
317
- /* @__PURE__ */ jsx12(
318
- "input",
319
- {
320
- id,
321
- type: "radio",
322
- className: "snacky-radio",
323
- name,
324
- checked: selected,
325
- disabled,
326
- onChange: onClick
327
- }
328
- ),
329
- label
330
- ]
331
- }
332
- );
333
- }
334
-
335
- // src/components/Checkbox/Checkbox.tsx
336
- import { useId as useId3 } from "react";
337
- import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
338
- function Checkbox({ label, checked, onChange, disabled, className }) {
339
- const id = useId3();
340
- return /* @__PURE__ */ jsxs9("label", { htmlFor: id, className: cx("snacky-checkbox-option", className), children: [
341
- /* @__PURE__ */ jsx13(
342
- "input",
343
- {
344
- id,
345
- type: "checkbox",
346
- className: "snacky-checkbox",
347
- checked,
348
- disabled,
349
- onChange: (e) => onChange(e.target.checked)
350
- }
351
- ),
352
- label
353
- ] });
354
- }
355
-
356
- // src/components/Toggle/Toggle.tsx
357
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
358
- function Toggle({ checked, onChange, disabled, ariaLabel = "Toggle", className }) {
359
- return /* @__PURE__ */ jsxs10(
360
- "button",
361
- {
362
- type: "button",
363
- role: "switch",
364
- "aria-checked": checked,
365
- "aria-label": ariaLabel,
366
- disabled,
367
- className: cx("snacky-toggle", checked && "snacky-toggle--on", className),
368
- onClick: () => onChange(!checked),
369
- children: [
370
- /* @__PURE__ */ jsx14("span", { className: "snacky-toggle__track" }),
371
- /* @__PURE__ */ jsx14("span", { className: "snacky-toggle__thumb" })
372
- ]
373
- }
374
- );
375
- }
376
-
377
- // src/components/Navbar/Navbar.tsx
378
- import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
379
- function NavBar({ items, selected, onSelect, className }) {
380
- return /* @__PURE__ */ jsx15("nav", { className: cx("snacky-navbar", className), children: items.map((item, i) => {
381
- const active = i === selected;
382
- return /* @__PURE__ */ jsxs11(
383
- "button",
384
- {
385
- type: "button",
386
- className: cx("snacky-navbar__item", active && "snacky-navbar__item--active"),
387
- "aria-current": active ? "page" : void 0,
388
- onClick: () => onSelect(i),
389
- children: [
390
- /* @__PURE__ */ jsx15("span", { className: "snacky-navbar__icon", children: active && item.activeIcon ? item.activeIcon : item.icon }),
391
- item.label
392
- ]
393
- },
394
- item.label
395
- );
396
- }) });
397
- }
398
-
399
- // src/components/Tab/Tab.tsx
400
- import { jsx as jsx16 } from "react/jsx-runtime";
401
- function TabRow({ tabs, selected, onSelect, className }) {
402
- return /* @__PURE__ */ jsx16("div", { className: cx("snacky-tabrow", className), role: "tablist", children: tabs.map((tab, i) => /* @__PURE__ */ jsx16(
403
- "button",
404
- {
405
- type: "button",
406
- role: "tab",
407
- "aria-selected": i === selected,
408
- className: cx("snacky-tab", i === selected && "snacky-tab--active"),
409
- onClick: () => onSelect(i),
410
- children: tab
411
- },
412
- tab
413
- )) });
414
- }
415
-
416
230
  // src/icons/outline.tsx
417
231
  var outline_exports = {};
418
232
  __export(outline_exports, {
@@ -459,10 +273,10 @@ __export(outline_exports, {
459
273
  truck: () => truck,
460
274
  unsent: () => unsent
461
275
  });
462
- import { jsx as jsx17 } from "react/jsx-runtime";
276
+ import { jsx as jsx8 } from "react/jsx-runtime";
463
277
  function icon(viewBox, paths) {
464
278
  return function SnackyIcon({ width = viewBox, height = viewBox, color = "currentColor", ...rest }) {
465
- return /* @__PURE__ */ jsx17("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__ */ jsx17(
279
+ return /* @__PURE__ */ jsx8("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__ */ jsx8(
466
280
  "path",
467
281
  {
468
282
  d,
@@ -636,6 +450,192 @@ var unsent = icon(24, [
636
450
  ["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"]
637
451
  ]);
638
452
 
453
+ // src/components/Input/ChatInput.tsx
454
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
455
+ function ChatInput({ value, onChange, onSend, sendIcon, className, placeholder = "Write your message here", ...rest }) {
456
+ return /* @__PURE__ */ jsxs5("div", { className: cx("snacky-chatfield", className), children: [
457
+ /* @__PURE__ */ jsx9(
458
+ "input",
459
+ {
460
+ className: "snacky-chatfield__input",
461
+ value,
462
+ placeholder,
463
+ onChange: (e) => onChange(e.target.value),
464
+ onKeyDown: (e) => e.key === "Enter" && value && onSend(),
465
+ ...rest
466
+ }
467
+ ),
468
+ /* @__PURE__ */ jsx9(
469
+ "button",
470
+ {
471
+ type: "button",
472
+ className: cx("snacky-chatfield__send", value && "snacky-chatfield__send--active"),
473
+ onClick: onSend,
474
+ disabled: !value,
475
+ "aria-label": "Send",
476
+ children: sendIcon ?? /* @__PURE__ */ jsx9(send, { width: 20, height: 20 })
477
+ }
478
+ )
479
+ ] });
480
+ }
481
+
482
+ // src/components/Input/AddressResult.tsx
483
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
484
+ function AddressResult({ icon: icon3, title, subtitle, onClick, className }) {
485
+ return /* @__PURE__ */ jsxs6("button", { type: "button", className: cx("snacky-address-result", className), onClick, children: [
486
+ icon3 && /* @__PURE__ */ jsx10("span", { className: "snacky-address-result__icon", children: icon3 }),
487
+ /* @__PURE__ */ jsxs6("span", { children: [
488
+ /* @__PURE__ */ jsx10("p", { className: "snacky-address-result__title", children: title }),
489
+ /* @__PURE__ */ jsx10("p", { className: "snacky-address-result__subtitle", children: subtitle })
490
+ ] })
491
+ ] });
492
+ }
493
+
494
+ // src/components/Chips/ProductChip.tsx
495
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
496
+ function ProductChip({ label, selected, thumbnail, onClick, className, ...rest }) {
497
+ return /* @__PURE__ */ jsxs7(
498
+ "button",
499
+ {
500
+ type: "button",
501
+ className: cx("snacky-chip", selected && "snacky-chip--selected", className),
502
+ "aria-pressed": selected,
503
+ onClick,
504
+ ...rest,
505
+ children: [
506
+ /* @__PURE__ */ jsx11("span", { className: "snacky-chip__thumb", children: thumbnail }),
507
+ label
508
+ ]
509
+ }
510
+ );
511
+ }
512
+
513
+ // src/components/Chips/FilterChip.tsx
514
+ import { jsx as jsx12 } from "react/jsx-runtime";
515
+ function FilterChip({ label, selected, onClick, className, ...rest }) {
516
+ return /* @__PURE__ */ jsx12(
517
+ "button",
518
+ {
519
+ type: "button",
520
+ className: cx("snacky-chip", selected && "snacky-chip--selected", className),
521
+ "aria-pressed": selected,
522
+ onClick,
523
+ ...rest,
524
+ children: label
525
+ }
526
+ );
527
+ }
528
+
529
+ // src/components/RadioButton/RadioButton.tsx
530
+ import { useId as useId2 } from "react";
531
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
532
+ function RadioOption({ label, selected, onClick, disabled, name, className }) {
533
+ const id = useId2();
534
+ return /* @__PURE__ */ jsxs8(
535
+ "label",
536
+ {
537
+ htmlFor: id,
538
+ className: cx("snacky-radio-option", disabled && "snacky-radio-option--disabled", className),
539
+ children: [
540
+ /* @__PURE__ */ jsx13(
541
+ "input",
542
+ {
543
+ id,
544
+ type: "radio",
545
+ className: "snacky-radio",
546
+ name,
547
+ checked: selected,
548
+ disabled,
549
+ onChange: onClick
550
+ }
551
+ ),
552
+ label
553
+ ]
554
+ }
555
+ );
556
+ }
557
+
558
+ // src/components/Checkbox/Checkbox.tsx
559
+ import { useId as useId3 } from "react";
560
+ import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
561
+ function Checkbox({ label, checked, onChange, disabled, className }) {
562
+ const id = useId3();
563
+ return /* @__PURE__ */ jsxs9("label", { htmlFor: id, className: cx("snacky-checkbox-option", className), children: [
564
+ /* @__PURE__ */ jsx14(
565
+ "input",
566
+ {
567
+ id,
568
+ type: "checkbox",
569
+ className: "snacky-checkbox",
570
+ checked,
571
+ disabled,
572
+ onChange: (e) => onChange(e.target.checked)
573
+ }
574
+ ),
575
+ label
576
+ ] });
577
+ }
578
+
579
+ // src/components/Toggle/Toggle.tsx
580
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
581
+ function Toggle({ checked, onChange, disabled, ariaLabel = "Toggle", className }) {
582
+ return /* @__PURE__ */ jsxs10(
583
+ "button",
584
+ {
585
+ type: "button",
586
+ role: "switch",
587
+ "aria-checked": checked,
588
+ "aria-label": ariaLabel,
589
+ disabled,
590
+ className: cx("snacky-toggle", checked && "snacky-toggle--on", className),
591
+ onClick: () => onChange(!checked),
592
+ children: [
593
+ /* @__PURE__ */ jsx15("span", { className: "snacky-toggle__track" }),
594
+ /* @__PURE__ */ jsx15("span", { className: "snacky-toggle__thumb" })
595
+ ]
596
+ }
597
+ );
598
+ }
599
+
600
+ // src/components/Navbar/Navbar.tsx
601
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
602
+ function NavBar({ items, selected, onSelect, className }) {
603
+ return /* @__PURE__ */ jsx16("nav", { className: cx("snacky-navbar", className), children: items.map((item, i) => {
604
+ const active = i === selected;
605
+ return /* @__PURE__ */ jsxs11(
606
+ "button",
607
+ {
608
+ type: "button",
609
+ className: cx("snacky-navbar__item", active && "snacky-navbar__item--active"),
610
+ "aria-current": active ? "page" : void 0,
611
+ onClick: () => onSelect(i),
612
+ children: [
613
+ /* @__PURE__ */ jsx16("span", { className: "snacky-navbar__icon", children: active && item.activeIcon ? item.activeIcon : item.icon }),
614
+ item.label
615
+ ]
616
+ },
617
+ item.label
618
+ );
619
+ }) });
620
+ }
621
+
622
+ // src/components/Tab/Tab.tsx
623
+ import { jsx as jsx17 } from "react/jsx-runtime";
624
+ function TabRow({ tabs, selected, onSelect, className }) {
625
+ return /* @__PURE__ */ jsx17("div", { className: cx("snacky-tabrow", className), role: "tablist", children: tabs.map((tab, i) => /* @__PURE__ */ jsx17(
626
+ "button",
627
+ {
628
+ type: "button",
629
+ role: "tab",
630
+ "aria-selected": i === selected,
631
+ className: cx("snacky-tab", i === selected && "snacky-tab--active"),
632
+ onClick: () => onSelect(i),
633
+ children: tab
634
+ },
635
+ tab
636
+ )) });
637
+ }
638
+
639
639
  // src/icons/solid.tsx
640
640
  var solid_exports = {};
641
641
  __export(solid_exports, {
@@ -1019,9 +1019,9 @@ function ProductCard(props) {
1019
1019
  ")"
1020
1020
  ] }),
1021
1021
  /* @__PURE__ */ jsxs21("div", { className: "snacky-product-card__actions snacky-product-card__actions--details", children: [
1022
- /* @__PURE__ */ jsx30(IconButton, { variant: "secondary", icon: favoriteIcon ?? "\u2665", selected: favorited, onClick: onFavoriteClick, ariaLabel: "Favorite" }),
1023
- /* @__PURE__ */ jsx30(IconButton, { variant: "secondary", icon: shareIcon ?? "\u2934", onClick: onShareClick, ariaLabel: "Share" }),
1024
- /* @__PURE__ */ jsx30(IconButton, { variant: "secondary", icon: chatIcon ?? "\u{1F4AC}", onClick: onChatClick, ariaLabel: "Chat with seller" })
1022
+ /* @__PURE__ */ jsx30(IconButton, { variant: "secondary", icon: favoriteIcon ?? (favorited ? /* @__PURE__ */ jsx30(heart2, { width: 20, height: 20 }) : /* @__PURE__ */ jsx30(heart, { width: 20, height: 20 })), selected: favorited, onClick: onFavoriteClick, ariaLabel: "Favorite" }),
1023
+ /* @__PURE__ */ jsx30(IconButton, { variant: "secondary", icon: shareIcon ?? /* @__PURE__ */ jsx30(share, { width: 20, height: 20 }), onClick: onShareClick, ariaLabel: "Share" }),
1024
+ /* @__PURE__ */ jsx30(IconButton, { variant: "secondary", icon: chatIcon ?? /* @__PURE__ */ jsx30(chat, { width: 20, height: 20 }), onClick: onChatClick, ariaLabel: "Chat with seller" })
1025
1025
  ] })
1026
1026
  ] })
1027
1027
  ] });
@@ -1054,7 +1054,7 @@ function ProductCard(props) {
1054
1054
  IconButton,
1055
1055
  {
1056
1056
  variant: "primary",
1057
- icon: cartIcon ?? "+",
1057
+ icon: cartIcon ?? /* @__PURE__ */ jsx30(cartAdd, { width: 16, height: 16 }),
1058
1058
  onClick: (e) => {
1059
1059
  e.stopPropagation();
1060
1060
  onAddToCart();