@tapcart/mobile-components 0.7.0 → 0.7.1

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.
Files changed (62) hide show
  1. package/dist/components/hooks/use-infinite-scroll.d.ts +3 -1
  2. package/dist/components/hooks/use-infinite-scroll.d.ts.map +1 -1
  3. package/dist/components/hooks/use-infinite-scroll.js +34 -11
  4. package/dist/components/hooks/use-products.d.ts +3 -1
  5. package/dist/components/hooks/use-products.d.ts.map +1 -1
  6. package/dist/components/hooks/use-products.js +19 -5
  7. package/dist/components/hooks/use-reviews.d.ts +27 -0
  8. package/dist/components/hooks/use-reviews.d.ts.map +1 -0
  9. package/dist/components/hooks/use-reviews.js +130 -0
  10. package/dist/components/ui/Input/input.d.ts +1 -1
  11. package/dist/components/ui/Input/input.d.ts.map +1 -1
  12. package/dist/components/ui/Input/input.js +23 -5
  13. package/dist/components/ui/Input/types.d.ts +3 -2
  14. package/dist/components/ui/Input/types.d.ts.map +1 -1
  15. package/dist/components/ui/Input/useInput.d.ts +2 -2
  16. package/dist/components/ui/Input/useInput.d.ts.map +1 -1
  17. package/dist/components/ui/Input/useInput.js +24 -10
  18. package/dist/components/ui/accordion.d.ts +3 -1
  19. package/dist/components/ui/accordion.d.ts.map +1 -1
  20. package/dist/components/ui/accordion.js +2 -2
  21. package/dist/components/ui/button.d.ts +2 -2
  22. package/dist/components/ui/button.d.ts.map +1 -1
  23. package/dist/components/ui/button.js +1 -1
  24. package/dist/components/ui/carousel.d.ts +1 -0
  25. package/dist/components/ui/carousel.d.ts.map +1 -1
  26. package/dist/components/ui/carousel.js +61 -2
  27. package/dist/components/ui/chip.d.ts +2 -2
  28. package/dist/components/ui/icon.d.ts +4 -1
  29. package/dist/components/ui/icon.d.ts.map +1 -1
  30. package/dist/components/ui/icon.js +35 -8
  31. package/dist/components/ui/image.d.ts.map +1 -1
  32. package/dist/components/ui/image.js +1 -1
  33. package/dist/components/ui/radio-group.d.ts +2 -2
  34. package/dist/components/ui/scroll-area.d.ts +1 -0
  35. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  36. package/dist/components/ui/scroll-area.js +2 -2
  37. package/dist/components/ui/toast.d.ts +2 -2
  38. package/dist/components/ui/toggle-group.d.ts +2 -2
  39. package/dist/components/ui/toggle.d.ts +2 -2
  40. package/dist/index.d.ts +6 -3
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +6 -3
  43. package/dist/lib/utils.d.ts +16 -0
  44. package/dist/lib/utils.d.ts.map +1 -1
  45. package/dist/lib/utils.js +18 -0
  46. package/dist/styles.css +201 -727
  47. package/package.json +3 -2
  48. package/dist/components/templates/product-card.d.ts +0 -33
  49. package/dist/components/templates/product-card.d.ts.map +0 -1
  50. package/dist/components/templates/product-card.js +0 -42
  51. package/dist/components/templates/product-grid.d.ts +0 -14
  52. package/dist/components/templates/product-grid.d.ts.map +0 -1
  53. package/dist/components/templates/product-grid.js +0 -22
  54. package/dist/components/ui/input.d.ts +0 -17
  55. package/dist/components/ui/input.d.ts.map +0 -1
  56. package/dist/components/ui/input.js +0 -35
  57. package/dist/components/ui/product-grid.d.ts +0 -15
  58. package/dist/components/ui/product-grid.d.ts.map +0 -1
  59. package/dist/components/ui/product-grid.js +0 -22
  60. package/dist/components/ui/select.d.ts +0 -14
  61. package/dist/components/ui/select.d.ts.map +0 -1
  62. package/dist/components/ui/select.js +0 -59
@@ -16,7 +16,9 @@ import useEmblaCarousel from "embla-carousel-react";
16
16
  import { ArrowLeft, ArrowRight } from "lucide-react";
17
17
  import { cn } from "../../lib/utils";
18
18
  import { Button } from "../../components/ui/button";
19
+ const TWEEN_FACTOR_BASE = 0.1;
19
20
  const CarouselContext = React.createContext(null);
21
+ const numberWithinRange = (number, min, max) => Math.min(Math.max(number, min), max);
20
22
  function useCarousel() {
21
23
  const context = React.useContext(CarouselContext);
22
24
  if (!context) {
@@ -25,8 +27,9 @@ function useCarousel() {
25
27
  return context;
26
28
  }
27
29
  const Carousel = React.forwardRef((_a, ref) => {
28
- var { orientation = "horizontal", opts, setApi, plugins, className, children, slidesInView } = _a, props = __rest(_a, ["orientation", "opts", "setApi", "plugins", "className", "children", "slidesInView"]);
30
+ var { orientation = "horizontal", tween = false, opts, setApi, plugins, className, children, slidesInView } = _a, props = __rest(_a, ["orientation", "tween", "opts", "setApi", "plugins", "className", "children", "slidesInView"]);
29
31
  const [carouselRef, api] = useEmblaCarousel(Object.assign(Object.assign({}, opts), { axis: orientation === "horizontal" ? "x" : "y" }), plugins);
32
+ const { setTweenNodes, setTweenFactor, tweenScale } = useTween();
30
33
  const [canScrollPrev, setCanScrollPrev] = React.useState(false);
31
34
  const [canScrollNext, setCanScrollNext] = React.useState(false);
32
35
  const onSelect = React.useCallback((api) => {
@@ -65,7 +68,7 @@ const Carousel = React.forwardRef((_a, ref) => {
65
68
  setApi(api);
66
69
  }, [api, setApi]);
67
70
  React.useEffect(() => {
68
- if (!api) {
71
+ if (!api || tween) {
69
72
  return;
70
73
  }
71
74
  onSelect(api);
@@ -76,6 +79,19 @@ const Carousel = React.forwardRef((_a, ref) => {
76
79
  api === null || api === void 0 ? void 0 : api.off("select", onSelect);
77
80
  };
78
81
  }, [api, onSelect]);
82
+ React.useEffect(() => {
83
+ if (!api || !tween)
84
+ return;
85
+ setTweenNodes(api);
86
+ setTweenFactor(api);
87
+ tweenScale(api);
88
+ api
89
+ .on("reInit", setTweenNodes)
90
+ .on("reInit", setTweenFactor)
91
+ .on("reInit", tweenScale)
92
+ .on("scroll", tweenScale)
93
+ .on("slideFocus", tweenScale);
94
+ }, [api, tweenScale]);
79
95
  return (_jsx(CarouselContext.Provider, Object.assign({ value: {
80
96
  carouselRef,
81
97
  api: api,
@@ -144,4 +160,47 @@ const CarouselDots = React.forwardRef((_a, ref) => {
144
160
  }
145
161
  });
146
162
  CarouselDots.displayName = "CarouselDots";
163
+ const useTween = () => {
164
+ const tweenFactor = React.useRef(0);
165
+ const tweenNodes = React.useRef([]);
166
+ const setTweenNodes = React.useCallback((emblaApi) => {
167
+ tweenNodes.current = emblaApi.slideNodes();
168
+ }, []);
169
+ const setTweenFactor = React.useCallback((emblaApi) => {
170
+ tweenFactor.current = TWEEN_FACTOR_BASE * emblaApi.scrollSnapList().length;
171
+ }, []);
172
+ const tweenScale = React.useCallback((emblaApi, eventName) => {
173
+ const engine = emblaApi.internalEngine();
174
+ const scrollProgress = emblaApi.scrollProgress();
175
+ const slidesInView = emblaApi.slidesInView();
176
+ const isScrollEvent = eventName === "scroll";
177
+ emblaApi.scrollSnapList().forEach((scrollSnap, snapIndex) => {
178
+ let diffToTarget = scrollSnap - scrollProgress;
179
+ const slidesInSnap = engine.slideRegistry[snapIndex];
180
+ slidesInSnap.forEach((slideIndex) => {
181
+ if (isScrollEvent && !slidesInView.includes(slideIndex))
182
+ return;
183
+ if (engine.options.loop) {
184
+ engine.slideLooper.loopPoints.forEach((loopItem) => {
185
+ const target = loopItem.target();
186
+ if (slideIndex === loopItem.index && target !== 0) {
187
+ const sign = Math.sign(target);
188
+ if (sign === -1) {
189
+ diffToTarget = scrollSnap - (1 + scrollProgress);
190
+ }
191
+ if (sign === 1) {
192
+ diffToTarget = scrollSnap + (1 - scrollProgress);
193
+ }
194
+ }
195
+ });
196
+ }
197
+ const tweenValue = 1 - Math.abs(diffToTarget * tweenFactor.current);
198
+ const scale = numberWithinRange(tweenValue, 0, 1).toString();
199
+ const tweenNode = tweenNodes.current[slideIndex];
200
+ tweenNode.style.transform = `scale(${scale})`;
201
+ });
202
+ });
203
+ }, []);
204
+ return { setTweenNodes, setTweenFactor, tweenScale };
205
+ };
147
206
  export { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, CarouselDots, };
@@ -2,7 +2,7 @@ import { type VariantProps } from "class-variance-authority";
2
2
  import React from "react";
3
3
  declare const chipVariants: (props?: ({
4
4
  variant?: "secondary" | "primary" | null | undefined;
5
- direction?: "horizontal" | "vertical" | null | undefined;
5
+ direction?: "vertical" | "horizontal" | null | undefined;
6
6
  iconPosition?: "left" | "right" | "default" | null | undefined;
7
7
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
8
8
  type ChipProps = React.ComponentPropsWithoutRef<"div"> & VariantProps<typeof chipVariants> & {
@@ -13,7 +13,7 @@ type ChipProps = React.ComponentPropsWithoutRef<"div"> & VariantProps<typeof chi
13
13
  };
14
14
  declare const Chip: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & VariantProps<(props?: ({
15
15
  variant?: "secondary" | "primary" | null | undefined;
16
- direction?: "horizontal" | "vertical" | null | undefined;
16
+ direction?: "vertical" | "horizontal" | null | undefined;
17
17
  iconPosition?: "left" | "right" | "default" | null | undefined;
18
18
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & {
19
19
  icon?: React.ElementType<any> | undefined;
@@ -8,9 +8,12 @@ declare const iconVariants: (props?: ({
8
8
  export interface IconProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "color">, VariantProps<typeof iconVariants> {
9
9
  name?: string | null;
10
10
  url?: string | null;
11
+ color?: string | null;
11
12
  fillColor?: string | null;
13
+ secondaryFillColor?: string;
12
14
  strokeColor?: string | null;
15
+ fillPercentage?: number | null;
13
16
  }
14
- declare function Icon({ className, name, size, color, url, fillColor, strokeColor, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
17
+ declare function Icon({ className, name, size, color, url, fillColor, secondaryFillColor, strokeColor, fillPercentage, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
15
18
  export { Icon, iconVariants, IconPencilMinus };
16
19
  //# sourceMappingURL=icon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../components/ui/icon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAEL,eAA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AAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAyFD,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,IAAW,EACX,KAAK,EACL,GAAG,EACH,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,GAAG,KAAK,EACT,EAAE,SAAS,2CAmBX;AAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,CAAA"}
@@ -87,27 +87,54 @@ const TablerIcon = ({ name, size }) => {
87
87
  const IconComponent = icons[name];
88
88
  return IconComponent ? (_jsx(IconComponent, { size: sizeMapping[size], strokeWidth: strokeWidthMapping[size] })) : null;
89
89
  };
90
- const CustomIcon = ({ url, size, color, fillColor, strokeColor }) => {
90
+ const CustomIcon = ({ url, size, color, strokeColor, fillColor, fillPercentage, secondaryFillColor }) => {
91
91
  return (_jsx(ReactSVG, { src: url, beforeInjection: (svg) => {
92
92
  svg.setAttribute("style", `width: ${sizeMapping[size]}px; height: ${sizeMapping[size]}px`);
93
93
  const paths = svg.querySelectorAll("path");
94
94
  paths.forEach((path) => {
95
95
  if (color) {
96
- if (path.hasAttribute("fill"))
96
+ if (path.hasAttribute("fill") && fillPercentage === 1) {
97
97
  path.setAttribute("fill", color);
98
- if (path.hasAttribute("stroke"))
99
- path.setAttribute("stroke", color);
98
+ }
99
+ path.setAttribute("stroke", color);
100
+ }
101
+ else {
102
+ if (fillColor && path.hasAttribute("fill") && fillPercentage === 1) {
103
+ path.setAttribute("fill", fillColor);
104
+ }
105
+ if (strokeColor) {
106
+ path.setAttribute("stroke", strokeColor);
107
+ }
100
108
  }
101
109
  if (path.hasAttribute("stroke")) {
102
110
  path.setAttribute("stroke-width", strokeWidthMapping[size].toString());
103
111
  }
104
- fillColor && path.setAttribute("fill", fillColor);
105
- strokeColor && path.setAttribute("stroke", strokeColor);
112
+ // Create a gradient fill based on the fillPercentage
113
+ if (fillPercentage && fillPercentage > 0 && fillPercentage < 1) {
114
+ const percentage = Math.min(Math.max(fillPercentage, 0), 1);
115
+ const gradientId = `gradient-${Math.random()}`;
116
+ const gradient = document.createElementNS("http://www.w3.org/2000/svg", "linearGradient");
117
+ gradient.setAttribute("id", gradientId);
118
+ gradient.setAttribute("x1", "0%");
119
+ gradient.setAttribute("y1", "0%");
120
+ gradient.setAttribute("x2", "100%");
121
+ gradient.setAttribute("y2", "0%");
122
+ const stop1 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
123
+ stop1.setAttribute("offset", `${percentage * 100}%`);
124
+ stop1.setAttribute("stop-color", color || fillColor || "currentColor");
125
+ gradient.appendChild(stop1);
126
+ const stop2 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
127
+ stop2.setAttribute("offset", `${percentage * 100}%`);
128
+ stop2.setAttribute("stop-color", secondaryFillColor || "transparent"); // Use secondary fill color
129
+ gradient.appendChild(stop2);
130
+ svg.appendChild(gradient);
131
+ path.setAttribute("fill", `url(#${gradientId})`);
132
+ }
106
133
  });
107
134
  } }));
108
135
  };
109
136
  function Icon(_a) {
110
- var { className, name, size = "md", color, url, fillColor, strokeColor } = _a, props = __rest(_a, ["className", "name", "size", "color", "url", "fillColor", "strokeColor"]);
111
- return (_jsxs("div", Object.assign({ className: cn(iconVariants({ size, color, className })) }, props, { children: [url ? (_jsx(CustomIcon, { url: url, size: size, color: color, fillColor: fillColor, strokeColor: strokeColor })) : (_jsx(TablerIcon, { name: name, size: size })), props.children] })));
137
+ var { className, name, size = "md", color, url, fillColor, secondaryFillColor, strokeColor, fillPercentage } = _a, props = __rest(_a, ["className", "name", "size", "color", "url", "fillColor", "secondaryFillColor", "strokeColor", "fillPercentage"]);
138
+ return (_jsxs("div", Object.assign({ className: cn(iconVariants({ size, color }), className) }, props, { children: [url ? (_jsx(CustomIcon, { url: url, size: size, color: color, fillColor: fillColor, secondaryFillColor: secondaryFillColor, strokeColor: strokeColor, fillPercentage: fillPercentage || (color || fillColor ? 1 : 0) })) : (_jsx(TablerIcon, { name: name, size: size })), props.children] })));
112
139
  }
113
140
  export { Icon, iconVariants, IconPencilMinus };
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../components/ui/image.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAkC1D,KAAK,aAAa,GAAG;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAUD,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,MAAM,CAAA;AAKrD,KAAK,IAAI,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAI1D,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,GAChE,qBAAqB,CAAA;AAEvB,KAAK,qBAAqB,GAAG;IAC3B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,IAAI,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE;QAAE,iBAAiB,EAAE,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ACtB,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,GAAE,IAAe,GAEnB;IACE,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,IAAI,EAAE,IAAI,CAAA;CACX,EAAE,GACH,SAAS,CAUZ"}
@@ -175,7 +175,7 @@ export const Image = React.forwardRef((_a, ref) => {
175
175
  sizes,
176
176
  fetchPriority: normalizedProps.fetchPriority,
177
177
  src: normalizedProps.src || "",
178
- } })), _jsx("div", Object.assign({ className: "relative bg-stateColors-skeleton border-transparent", style: wrapperStyle }, { children: !hasError && normalizedProps.src ? (_jsx("img", Object.assign({}, passthroughProps, { fetchPriority: normalizedProps.fetchPriority, alt: normalizedProps.alt, decoding: decoding, height: normalizedProps.height, loading: loading, srcSet: srcSet, width: normalizedProps.width, className: imgClassName, onLoad: handleImageLoad, onError: handleImageError, sizes: sizes,
178
+ } })), _jsx("div", Object.assign({ className: "relative bg-stateColors-skeleton border-transparent", style: Object.assign({ borderRadius: `${imageRadius}px` }, wrapperStyle) }, { children: !hasError && normalizedProps.src ? (_jsx("img", Object.assign({}, passthroughProps, { fetchPriority: normalizedProps.fetchPriority, alt: normalizedProps.alt, decoding: decoding, height: normalizedProps.height, loading: loading, srcSet: srcSet, width: normalizedProps.width, className: imgClassName, onLoad: handleImageLoad, onError: handleImageError, sizes: sizes,
179
179
  // `src` needs to come after `sizes` and `srcSet` because React updates
180
180
  // attributes in order. If we keep `src` the first one, Safari will
181
181
  // immediately start to fetch `src`, before `sizes` and `srcSet` are even
@@ -12,10 +12,10 @@ export interface RadioGroupItemProps {
12
12
  value: string;
13
13
  }
14
14
  declare const radiogroupItemVariants: (props?: ({
15
- variant?: "selected" | "default" | "deactivated" | null | undefined;
15
+ variant?: "default" | "selected" | "deactivated" | null | undefined;
16
16
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
17
17
  declare const RadioGroupItem: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & RadioGroupItemProps & VariantProps<(props?: ({
18
- variant?: "selected" | "default" | "deactivated" | null | undefined;
18
+ variant?: "default" | "selected" | "deactivated" | null | undefined;
19
19
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
20
20
  export { RadioGroup, RadioGroupItem, radiogroupItemVariants };
21
21
  //# sourceMappingURL=radio-group.d.ts.map
@@ -3,6 +3,7 @@ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
3
3
  type Orientation = "horizontal" | "vertical";
4
4
  declare const ScrollArea: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
5
5
  wrapperClass?: string | undefined;
6
+ scrollbar: boolean;
6
7
  } & React.RefAttributes<HTMLDivElement>>;
7
8
  declare const ScrollBar: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
8
9
  orientation?: Orientation | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../../components/ui/scroll-area.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAA;AAIlE,KAAK,WAAW,GAAG,YAAY,GAAG,UAAU,CAAA;AAE5C,QAAA,MAAM,UAAU;;wCAiBd,CAAA;AAGF,QAAA,MAAM,SAAS;;wCAuBb,CAAA;AAGF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAA"}
1
+ {"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../../components/ui/scroll-area.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAA;AAIlE,KAAK,WAAW,GAAG,YAAY,GAAG,UAAU,CAAA;AAE5C,QAAA,MAAM,UAAU;;eAID,OAAO;wCAcpB,CAAA;AAGF,QAAA,MAAM,SAAS;;wCAuBb,CAAA;AAGF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAA"}
@@ -15,8 +15,8 @@ import * as React from "react";
15
15
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
16
16
  import { cn } from "../../lib/utils";
17
17
  const ScrollArea = React.forwardRef((_a, ref) => {
18
- var { className, wrapperClass, children } = _a, props = __rest(_a, ["className", "wrapperClass", "children"]);
19
- return (_jsxs(ScrollAreaPrimitive.Root, Object.assign({ ref: ref, className: cn("relative overflow-hidden", className) }, props, { children: [_jsx(ScrollAreaPrimitive.Viewport, Object.assign({ className: "h-full w-full rounded-[inherit]" }, { children: _jsx("div", Object.assign({ className: cn("flex w-max", wrapperClass) }, { children: children })) })), _jsx(ScrollBar, {}), _jsx(ScrollAreaPrimitive.Corner, {})] })));
18
+ var { className, wrapperClass, scrollbar = true, children } = _a, props = __rest(_a, ["className", "wrapperClass", "scrollbar", "children"]);
19
+ return (_jsxs(ScrollAreaPrimitive.Root, Object.assign({ ref: ref, className: cn("relative overflow-hidden", className) }, props, { children: [_jsx(ScrollAreaPrimitive.Viewport, Object.assign({ className: "h-full w-full rounded-[inherit]" }, { children: _jsx("div", Object.assign({ className: cn("flex w-max", wrapperClass) }, { children: children })) })), _jsx(ScrollBar, { className: scrollbar ? "" : "hidden" }), _jsx(ScrollAreaPrimitive.Corner, {})] })));
20
20
  });
21
21
  ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
22
22
  const ScrollBar = React.forwardRef((_a, ref) => {
@@ -4,14 +4,14 @@ import { type VariantProps } from "class-variance-authority";
4
4
  declare const ToastProvider: React.FC<ToastPrimitives.ToastProviderProps>;
5
5
  declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastViewportProps & React.RefAttributes<HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
6
6
  declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: ({
7
- variant?: "error" | "default" | "warning" | "success" | null | undefined;
7
+ variant?: "default" | "error" | "warning" | "success" | null | undefined;
8
8
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLLIElement>>;
9
9
  declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
10
10
  declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
11
11
  declare const ToastTitle: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
12
12
  type ToastType = "default" | "warning" | "error" | "success";
13
13
  declare const ToastDescription: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastDescriptionProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
14
- type?: "error" | "default" | "warning" | "success" | undefined;
14
+ type?: "default" | "error" | "warning" | "success" | undefined;
15
15
  icon?: boolean | undefined;
16
16
  } & React.RefAttributes<HTMLDivElement>>;
17
17
  type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
@@ -3,11 +3,11 @@ import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
3
3
  import { VariantProps } from "class-variance-authority";
4
4
  declare const ToggleGroup: React.ForwardRefExoticComponent<((Omit<ToggleGroupPrimitive.ToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<ToggleGroupPrimitive.ToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>, "ref">) & VariantProps<(props?: ({
5
5
  variant?: "default" | "outline" | null | undefined;
6
- size?: "sm" | "lg" | "default" | null | undefined;
6
+ size?: "default" | "sm" | "lg" | null | undefined;
7
7
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string>) & React.RefAttributes<HTMLDivElement>>;
8
8
  declare const ToggleGroupItem: React.ForwardRefExoticComponent<Omit<ToggleGroupPrimitive.ToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
9
9
  variant?: "default" | "outline" | null | undefined;
10
- size?: "sm" | "lg" | "default" | null | undefined;
10
+ size?: "default" | "sm" | "lg" | null | undefined;
11
11
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
12
12
  export { ToggleGroup, ToggleGroupItem };
13
13
  //# sourceMappingURL=toggle-group.d.ts.map
@@ -3,11 +3,11 @@ import * as TogglePrimitive from "@radix-ui/react-toggle";
3
3
  import { type VariantProps } from "class-variance-authority";
4
4
  declare const toggleVariants: (props?: ({
5
5
  variant?: "default" | "outline" | null | undefined;
6
- size?: "sm" | "lg" | "default" | null | undefined;
6
+ size?: "default" | "sm" | "lg" | null | undefined;
7
7
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
8
8
  declare const Toggle: React.ForwardRefExoticComponent<Omit<TogglePrimitive.ToggleProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
9
9
  variant?: "default" | "outline" | null | undefined;
10
- size?: "sm" | "lg" | "default" | null | undefined;
10
+ size?: "default" | "sm" | "lg" | null | undefined;
11
11
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
12
12
  export { Toggle, toggleVariants };
13
13
  //# sourceMappingURL=toggle.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,10 +1,13 @@
1
- export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, stringRatioToInt, getOverlayStyle, } from "./lib/utils";
1
+ export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, getDestinationHandler, } from "./lib/utils";
2
2
  export * from "./components/hooks/use-collection";
3
3
  export * from "./components/hooks/use-infinite-scroll";
4
4
  export * from "./components/hooks/use-recommendations";
5
5
  export * from "./components/hooks/use-products";
6
6
  export * from "./components/hooks/use-scroll-direction";
7
7
  export * from "./components/hooks/use-sort-filter";
8
+ export * from "./components/hooks/use-product-options";
9
+ export * from "./components/hooks/use-shop";
10
+ export * from "./components/hooks/use-tap";
8
11
  export * from "./components/ui/accordion";
9
12
  export * from "./components/ui/aspect-ratio";
10
13
  export * from "./components/ui/badge";
@@ -46,10 +49,10 @@ export * from "./components/ui/toggle";
46
49
  export * from "./components/ui/use-toast";
47
50
  export * from "./components/ui/video";
48
51
  export * from "./components/ui/wishlist";
49
- export * from "./components/hooks/use-product-options";
50
52
  export * from "./components/ui/wishlist-select";
51
53
  export * from "./components/hooks/use-shop";
52
54
  export * from "./components/libs/sort-filter/search-integration";
55
+ export * from "./components/hooks/use-reviews";
53
56
  export * from "./components/ui/subcollection-tabs";
54
- export * from "./components/hooks/use-tap";
57
+ export * from "./components/libs/sort-filter/search-integration";
55
58
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,EAAE,EACF,GAAG,EACH,QAAQ,EACR,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,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sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,uBAAuB,CAAA;AACrC,cAAc,sCAAsC,CAAA;AACpD,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kDAAkD,CAAA;AAChE,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,kDAAkD,CAAA"}
package/dist/index.js CHANGED
@@ -1,11 +1,14 @@
1
1
  // component exports
2
- export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, stringRatioToInt, getOverlayStyle, } from "./lib/utils";
2
+ export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, getDestinationHandler, } from "./lib/utils";
3
3
  export * from "./components/hooks/use-collection";
4
4
  export * from "./components/hooks/use-infinite-scroll";
5
5
  export * from "./components/hooks/use-recommendations";
6
6
  export * from "./components/hooks/use-products";
7
7
  export * from "./components/hooks/use-scroll-direction";
8
8
  export * from "./components/hooks/use-sort-filter";
9
+ export * from "./components/hooks/use-product-options";
10
+ export * from "./components/hooks/use-shop";
11
+ export * from "./components/hooks/use-tap";
9
12
  export * from "./components/ui/accordion";
10
13
  export * from "./components/ui/aspect-ratio";
11
14
  export * from "./components/ui/badge";
@@ -47,9 +50,9 @@ export * from "./components/ui/toggle";
47
50
  export * from "./components/ui/use-toast";
48
51
  export * from "./components/ui/video";
49
52
  export * from "./components/ui/wishlist";
50
- export * from "./components/hooks/use-product-options";
51
53
  export * from "./components/ui/wishlist-select";
52
54
  export * from "./components/hooks/use-shop";
53
55
  export * from "./components/libs/sort-filter/search-integration";
56
+ export * from "./components/hooks/use-reviews";
54
57
  export * from "./components/ui/subcollection-tabs";
55
- export * from "./components/hooks/use-tap";
58
+ export * from "./components/libs/sort-filter/search-integration";
@@ -146,6 +146,7 @@ export declare const mapFlexToAlignment: (flexClass: string) => string;
146
146
  export declare function getIdFromGid(gid: string | undefined): string;
147
147
  export declare function productGidFromId(id: string | null | undefined): string | null;
148
148
  export declare function variantGidFromId(id: string | null | undefined): string | null;
149
+ export declare function formatRelativeTime(inputDate: Date | string): string;
149
150
  export declare const stringRatioToInt: (string: string) => number;
150
151
  export declare const getOverlayStyle: (opacity: number) => {
151
152
  position: string;
@@ -155,4 +156,19 @@ export declare const getOverlayStyle: (opacity: number) => {
155
156
  bottom: number;
156
157
  backgroundColor: string;
157
158
  };
159
+ type DestinationActions = {
160
+ openScreen: (arg: {
161
+ destination: {
162
+ type: "internal" | "web";
163
+ url: string;
164
+ };
165
+ }) => void;
166
+ openProduct: (arg: {
167
+ productId: string;
168
+ }) => void;
169
+ openCollection: (arg: {
170
+ collectionId: string;
171
+ }) => void;
172
+ };
173
+ export declare const getDestinationHandler: (type: "app-screen" | "url" | "product" | "collection" | "none") => ((location: string, actions: DestinationActions) => void) | ((location: string, actions: DestinationActions) => void) | ((location: string, actions: DestinationActions) => void) | ((location: string, actions: DestinationActions) => void) | (() => void);
158
174
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAA;AAGvC,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnE,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,eAAO,MAAM,eAAe,UAc3B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,CAAA;AAMjE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAI9C,eAAO,MAAM,QAAQ,gBAAiB,KAAK,GAAG,SAAS,uBAUtD,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAC7D,KAAK,WAAW,GAAG,UAAU,EAAE,CAAA;AAE/B,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CAU/B,CAAA;AAED,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEpD,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,UAAU,mB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E;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACxD,CAAA;AAgBD,eAAO,MAAM,qBAAqB,SAC1B,YAAY,GAAG,KAAK,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,iBAdrC,MAAM,WAAW,kBAAkB,yBAE5C,MAAM,WAAW,kBAAkB,yBAI/B,MAAM,WAAW,kBAAkB,yBAEhC,MAAM,WAAW,kBAAkB,yBAS3D,CAAA"}
package/dist/lib/utils.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { clsx } from "clsx";
2
2
  import { twMerge } from "tailwind-merge";
3
+ import dayjs from 'dayjs';
4
+ import relativeTime from 'dayjs/plugin/relativeTime';
3
5
  export function cn(...inputs) {
4
6
  return twMerge(clsx(inputs));
5
7
  }
@@ -147,6 +149,10 @@ export function variantGidFromId(id) {
147
149
  return id;
148
150
  return `gid://shopify/ProductVariant/${id}`;
149
151
  }
152
+ export function formatRelativeTime(inputDate) {
153
+ dayjs.extend(relativeTime);
154
+ return dayjs(inputDate).fromNow();
155
+ }
150
156
  export const stringRatioToInt = (string) => {
151
157
  const [numerator, denominator] = string
152
158
  .replace(":", "/")
@@ -166,4 +172,16 @@ export const getOverlayStyle = (opacity) => {
166
172
  backgroundColor: `rgba(0, 0, 0, ${opacityDecimal})`,
167
173
  };
168
174
  };
175
+ const DESTINATION_HANDLERS = {
176
+ "app-screen": (location, actions) => actions.openScreen({ destination: { type: "internal", url: location } }),
177
+ url: (location, actions) => actions.openScreen({
178
+ destination: { type: "web", url: `https://${location}` },
179
+ }),
180
+ product: (location, actions) => actions.openProduct({ productId: location }),
181
+ collection: (location, actions) => actions.openCollection({ collectionId: location }),
182
+ none: () => { },
183
+ };
184
+ export const getDestinationHandler = (type) => {
185
+ return DESTINATION_HANDLERS[type];
186
+ };
169
187
  // #endregion =-=-=-= END BLOCK UTILS =-=-=-=