@tapcart/mobile-components 0.6.22 → 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 (55) 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.map +1 -1
  11. package/dist/components/ui/Input/input.js +23 -5
  12. package/dist/components/ui/Input/types.d.ts +1 -0
  13. package/dist/components/ui/Input/types.d.ts.map +1 -1
  14. package/dist/components/ui/Input/useInput.d.ts +1 -1
  15. package/dist/components/ui/Input/useInput.d.ts.map +1 -1
  16. package/dist/components/ui/Input/useInput.js +24 -10
  17. package/dist/components/ui/accordion.d.ts +3 -1
  18. package/dist/components/ui/accordion.d.ts.map +1 -1
  19. package/dist/components/ui/accordion.js +2 -2
  20. package/dist/components/ui/button.d.ts +2 -2
  21. package/dist/components/ui/button.d.ts.map +1 -1
  22. package/dist/components/ui/button.js +1 -1
  23. package/dist/components/ui/carousel.d.ts +1 -0
  24. package/dist/components/ui/carousel.d.ts.map +1 -1
  25. package/dist/components/ui/carousel.js +61 -2
  26. package/dist/components/ui/chip.d.ts +2 -2
  27. package/dist/components/ui/icon.d.ts +4 -1
  28. package/dist/components/ui/icon.d.ts.map +1 -1
  29. package/dist/components/ui/icon.js +35 -8
  30. package/dist/components/ui/image.d.ts.map +1 -1
  31. package/dist/components/ui/image.js +1 -1
  32. package/dist/components/ui/radio-group.d.ts +2 -2
  33. package/dist/components/ui/scroll-area.d.ts +1 -0
  34. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  35. package/dist/components/ui/scroll-area.js +2 -2
  36. package/dist/components/ui/toast.d.ts +2 -2
  37. package/dist/components/ui/toggle-group.d.ts +2 -2
  38. package/dist/components/ui/toggle.d.ts +2 -2
  39. package/dist/components/ui/video.d.ts +3 -1
  40. package/dist/components/ui/video.d.ts.map +1 -1
  41. package/dist/components/ui/video.js +2 -2
  42. package/dist/index.d.ts +6 -3
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +6 -3
  45. package/dist/lib/utils.d.ts +16 -0
  46. package/dist/lib/utils.d.ts.map +1 -1
  47. package/dist/lib/utils.js +18 -0
  48. package/dist/styles.css +15 -78
  49. package/package.json +18 -17
  50. package/dist/components/hooks/use-click-outside.d.ts +0 -3
  51. package/dist/components/hooks/use-click-outside.d.ts.map +0 -1
  52. package/dist/components/hooks/use-click-outside.js +0 -16
  53. package/dist/components/hooks/use-outside-click.d.ts +0 -4
  54. package/dist/components/hooks/use-outside-click.d.ts.map +0 -1
  55. package/dist/components/hooks/use-outside-click.js +0 -16
@@ -11,6 +11,8 @@ interface PageData {
11
11
  interface UseInfiniteScrollProps {
12
12
  initialData: PageData;
13
13
  queryVariables: Record<string, any>;
14
+ direction: "vertical" | "horizontal";
15
+ productLimit: number;
14
16
  }
15
17
  interface UseInfiniteScrollReturn {
16
18
  data: PageData[] | undefined;
@@ -26,6 +28,6 @@ interface UseInfiniteScrollReturn {
26
28
  }
27
29
  export declare const formatSearchParamsAsNextQueryVariables: (searchParams: ReadonlyURLSearchParams) => {};
28
30
  declare const constructURL: (apiURL: string) => string;
29
- declare const useInfiniteScroll: ({ initialData, queryVariables: queryVariableProps, }: UseInfiniteScrollProps) => UseInfiniteScrollReturn;
31
+ declare const useInfiniteScroll: ({ initialData, queryVariables: queryVariableProps, direction, productLimit, }: UseInfiniteScrollProps) => UseInfiniteScrollReturn;
30
32
  export { useInfiniteScroll, constructURL };
31
33
  //# sourceMappingURL=use-infinite-scroll.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-infinite-scroll.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-infinite-scroll.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAmB,MAAM,iBAAiB,CAAA;AAE1E,UAAU,OAAO;IACf,MAAM,EAAE,MAAM,CAAA;CAEf;AAED,UAAU,QAAQ;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,GAAG,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf;AAOD,UAAU,sBAAsB;IAC9B,WAAW,EAAE,QAAQ,CAAA;IACrB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CACpC;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAA;IAC5B,KAAK,EAAE,GAAG,CAAA;IACV,oBAAoB,EAAE,OAAO,CAAA;IAC7B,aAAa,EAAE,OAAO,GAAG,SAAS,CAAA;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,CAAA;IAChD,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,EAAE,OAAO,CAAA;CACtB;AAED,eAAO,MAAM,sCAAsC,iBACnC,uBAAuB,OAsBtC,CAAA;AAED,QAAA,MAAM,YAAY,WAAY,MAAM,WAGnC,CAAA;AAED,QAAA,MAAM,iBAAiB,yDAGpB,sBAAsB,KAAG,uBA4F3B,CAAA;AAED,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"use-infinite-scroll.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-infinite-scroll.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAmB,MAAM,iBAAiB,CAAA;AAE1E,UAAU,OAAO;IACf,MAAM,EAAE,MAAM,CAAA;CAEf;AAED,UAAU,QAAQ;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,GAAG,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf;AAOD,UAAU,sBAAsB;IAC9B,WAAW,EAAE,QAAQ,CAAA;IACrB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACnC,SAAS,EAAE,UAAU,GAAG,YAAY,CAAA;IACpC,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAA;IAC5B,KAAK,EAAE,GAAG,CAAA;IACV,oBAAoB,EAAE,OAAO,CAAA;IAC7B,aAAa,EAAE,OAAO,GAAG,SAAS,CAAA;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,CAAA;IAChD,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,EAAE,OAAO,CAAA;CACtB;AAED,eAAO,MAAM,sCAAsC,iBACnC,uBAAuB,OAsBtC,CAAA;AAED,QAAA,MAAM,YAAY,WAAY,MAAM,WAGnC,CAAA;AAED,QAAA,MAAM,iBAAiB,kFAKpB,sBAAsB,KAAG,uBAuG3B,CAAA;AAED,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAA"}
@@ -1,5 +1,14 @@
1
1
  "use client";
2
- import { useCallback, useEffect, useMemo } from "react";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { useCallback, useEffect, useMemo, useRef } from "react";
3
12
  import useSWRInfinite from "swr/infinite";
4
13
  import { useInView } from "react-intersection-observer";
5
14
  import { useSearchParams } from "next/navigation";
@@ -31,10 +40,14 @@ const constructURL = (apiURL) => {
31
40
  const url = new URL(apiURL);
32
41
  return url.toString();
33
42
  };
34
- const useInfiniteScroll = ({ initialData, queryVariables: queryVariableProps, }) => {
43
+ const useInfiniteScroll = ({ initialData, queryVariables: queryVariableProps, direction = "vertical", productLimit = Infinity, }) => {
35
44
  var _a, _b, _c, _d, _e;
36
45
  const searchParams = useSearchParams();
37
- const { ref, inView } = useInView({ rootMargin: "600px" }); // controls how early the next page loads
46
+ const productCount = useRef(0);
47
+ const { ref, inView } = useInView({
48
+ rootMargin: direction === "vertical" ? "600px" : "0px 420px 0px 0px",
49
+ threshold: 0,
50
+ });
38
51
  const queryVariables = useMemo(() => {
39
52
  const formattedParams = formatSearchParamsAsNextQueryVariables(searchParams);
40
53
  return Object.assign(Object.assign({}, queryVariableProps), { searchParams: formattedParams });
@@ -48,10 +61,16 @@ const useInfiniteScroll = ({ initialData, queryVariables: queryVariableProps, })
48
61
  return null;
49
62
  return Object.assign(Object.assign({}, queryVariables), { cursorBlob: previousPageData.pageData.cursorBlob });
50
63
  };
51
- const fetcher = (body) => fetch(constructURL(initialData.apiURL), {
52
- method: "POST",
53
- body: JSON.stringify(body),
54
- }).then((res) => res.json());
64
+ const fetcher = (body) => __awaiter(void 0, void 0, void 0, function* () {
65
+ var _f, _g;
66
+ const res = yield fetch(constructURL(initialData.apiURL), {
67
+ method: "POST",
68
+ body: JSON.stringify(body),
69
+ });
70
+ const data = yield res.json();
71
+ productCount.current += (_g = (_f = data === null || data === void 0 ? void 0 : data.products) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0;
72
+ return data;
73
+ });
55
74
  const { data, error, size, setSize, isLoading, isValidating, } = useSWRInfinite((pageIndex, previousPageData) => getKey(pageIndex, previousPageData, queryVariables), fetcher, {
56
75
  revalidateFirstPage: false,
57
76
  initialSize: 1,
@@ -66,9 +85,11 @@ const useInfiniteScroll = ({ initialData, queryVariables: queryVariableProps, })
66
85
  const isReachingEnd = isEmpty || isEndPointer;
67
86
  const isRefreshing = isValidating && data && data.length === size;
68
87
  const loadMore = useCallback(() => {
69
- if (!isLoadingMore && !isReachingEnd && !isRefreshing) {
70
- setSize(size + 1);
71
- }
88
+ if (isLoadingMore || isReachingEnd || isRefreshing)
89
+ return;
90
+ if (productCount.current >= productLimit)
91
+ return;
92
+ setSize(size + 1);
72
93
  }, [isLoadingMore, isReachingEnd, isRefreshing, setSize, size]);
73
94
  useEffect(() => {
74
95
  if (inView) {
@@ -83,7 +104,9 @@ const useInfiniteScroll = ({ initialData, queryVariables: queryVariableProps, })
83
104
  isEmpty,
84
105
  isReachingEnd,
85
106
  ref,
86
- products: data ? data === null || data === void 0 ? void 0 : data.flatMap((page) => page === null || page === void 0 ? void 0 : page.products) : [],
107
+ products: data
108
+ ? data === null || data === void 0 ? void 0 : data.flatMap((page) => page === null || page === void 0 ? void 0 : page.products).slice(0, productLimit)
109
+ : [],
87
110
  isLoading,
88
111
  isValidating,
89
112
  };
@@ -8,7 +8,9 @@ type UseProductsProps = {
8
8
  productIds: string[];
9
9
  productHandles: string[];
10
10
  baseURL: URL;
11
- fetcher?: (url: string) => Promise<any>;
11
+ collection?: string;
12
+ queryVariables?: Record<string, any>;
13
+ fetcher?: (url: string, body?: Record<string, any> | null) => Promise<any>;
12
14
  metafields?: MetafieldInput[];
13
15
  };
14
16
  type UseProductsReturn = {
@@ -1 +1 @@
1
- {"version":3,"file":"use-products.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-products.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,KAAK,GAAG,GAAG,MAAM,CAAA;AACjB,KAAK,cAAc,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AACxD,KAAK,gBAAgB,GAAG;IACtB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,OAAO,EAAE,GAAG,CAAA;IACZ,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACvC,UAAU,CAAC,EAAE,cAAc,EAAE,CAAA;CAC9B,CAAA;AACD,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,iBAAiB,CA8B7E"}
1
+ {"version":3,"file":"use-products.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-products.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,KAAK,GAAG,GAAG,MAAM,CAAA;AACjB,KAAK,cAAc,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AACxD,KAAK,gBAAgB,GAAG;IACtB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,OAAO,EAAE,GAAG,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IAC1E,UAAU,CAAC,EAAE,cAAc,EAAE,CAAA;CAC9B,CAAA;AACD,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,iBAAiB,CAyD7E"}
@@ -2,23 +2,37 @@
2
2
  import useSWR from "swr";
3
3
  export function useProducts(props) {
4
4
  let url = null;
5
+ let body = null;
5
6
  if (props) {
6
- const { baseURL, productIds, productHandles, metafields } = props;
7
+ const { baseURL, productIds, productHandles, metafields, collection, queryVariables, } = props;
7
8
  let queryParams = new URLSearchParams();
8
9
  if ((productIds === null || productIds === void 0 ? void 0 : productIds.length) > 0) {
9
10
  queryParams.set("ids", productIds.join(","));
10
11
  }
11
- else if ((productHandles === null || productHandles === void 0 ? void 0 : productHandles.length) > 0) {
12
+ if ((productHandles === null || productHandles === void 0 ? void 0 : productHandles.length) > 0) {
12
13
  queryParams.set("handles", productHandles.join(","));
13
14
  }
14
15
  if (metafields && metafields.length > 0) {
15
16
  const metafieldStrings = metafields.map((m) => `${m.namespace}.${m.key}`);
16
17
  queryParams.set("metafields", metafieldStrings.join(","));
17
18
  }
18
- url = `${baseURL}/products/by-ids?${queryParams.toString()}`;
19
+ if (collection) {
20
+ url = `${baseURL}/products/by-page?${queryParams.toString()}`;
21
+ body = queryVariables || {};
22
+ }
23
+ if ((productIds === null || productIds === void 0 ? void 0 : productIds.length) || (productHandles === null || productHandles === void 0 ? void 0 : productHandles.length)) {
24
+ url = `${baseURL}/products/by-ids?${queryParams.toString()}`;
25
+ }
19
26
  }
20
- const fetcher = (props === null || props === void 0 ? void 0 : props.fetcher) || ((url) => fetch(url).then((res) => res.json()));
21
- const { data, error } = useSWR(url, fetcher);
27
+ const defaultFetcher = (url, body) => fetch(url, {
28
+ method: body ? "POST" : "GET",
29
+ headers: {
30
+ "Content-Type": "application/json",
31
+ },
32
+ body: body ? JSON.stringify(body) : undefined,
33
+ }).then((res) => res.json());
34
+ const fetcher = (props === null || props === void 0 ? void 0 : props.fetcher) || defaultFetcher;
35
+ const { data, error } = useSWR(url ? [url, body] : null, ([url, body]) => fetcher(url, body));
22
36
  return {
23
37
  products: data || [],
24
38
  error,
@@ -0,0 +1,27 @@
1
+ import { ReviewSummaryData, ReviewMetaData, ReviewSearchData } from "app-studio-types";
2
+ type UseReviewsProps = {
3
+ baseURL: string;
4
+ productId: string;
5
+ provider: string;
6
+ fetcher?: (url: string) => Promise<any>;
7
+ dataType: "summary" | "metadata" | "search";
8
+ searchText: string;
9
+ ratings: [number];
10
+ topics: [string];
11
+ sortBy: "date" | "votes_up" | "votes_down" | "time" | "rating" | "reviewer_type";
12
+ ascending: boolean;
13
+ perPage: number;
14
+ page: number;
15
+ };
16
+ type UseReviewsReturn = {
17
+ data: ReviewSummaryData | ReviewMetaData | ReviewSearchData;
18
+ error: any;
19
+ isLoading: boolean;
20
+ };
21
+ export declare function useReviews(props: UseReviewsProps | null): UseReviewsReturn;
22
+ type UseReviewsInfiniteReturn = UseReviewsReturn & {
23
+ ref: (node?: Element | null) => void;
24
+ };
25
+ export declare function useReviewsInfinite(props: UseReviewsProps | null): UseReviewsInfiniteReturn;
26
+ export {};
27
+ //# sourceMappingURL=use-reviews.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-reviews.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-reviews.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGtF,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,QAAQ,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,CAAC;IACjF,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,iBAAiB,GAAG,cAAc,GAAG,gBAAgB,CAAA;IAC3D,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,gBAAgB,CAwD1E;AAED,KAAK,wBAAwB,GAAG,gBAAgB,GAAG;IACjD,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;CACtC,CAAA;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,wBAAwB,CA8F1F"}
@@ -0,0 +1,130 @@
1
+ "use client";
2
+ import { useCallback, useEffect } from "react";
3
+ import useSWR from "swr";
4
+ import useSWRInfinite from "swr/infinite";
5
+ import { useInView } from 'react-intersection-observer';
6
+ export function useReviews(props) {
7
+ let url = null;
8
+ if (props) {
9
+ const { baseURL, productId, provider, dataType, searchText, ratings, topics, sortBy, ascending, perPage, page } = props;
10
+ let queryParams = new URLSearchParams();
11
+ if (productId.length > 0) {
12
+ queryParams.set("id", productId);
13
+ }
14
+ if (provider.length > 0) {
15
+ queryParams.set("provider", provider);
16
+ }
17
+ queryParams.set("dataType", dataType);
18
+ if (searchText) {
19
+ queryParams.set("searchText", searchText);
20
+ }
21
+ if (ratings && ratings.length > 0) {
22
+ queryParams.set("ratings", ratings.join(","));
23
+ }
24
+ if (topics && topics.length > 0) {
25
+ queryParams.set("topics", topics.join(","));
26
+ }
27
+ if (sortBy) {
28
+ queryParams.set("sortBy", sortBy);
29
+ }
30
+ if (ascending !== undefined) {
31
+ queryParams.set("ascending", ascending.toString());
32
+ }
33
+ if (perPage) {
34
+ queryParams.set("perPage", String(perPage));
35
+ }
36
+ if (page) {
37
+ queryParams.set("page", String(page));
38
+ }
39
+ if (dataType === null || productId === null || productId.length === 0) {
40
+ url = null;
41
+ }
42
+ else {
43
+ url = `${baseURL}/reviews/by-id?${queryParams.toString()}`;
44
+ }
45
+ }
46
+ const fetcher = (props === null || props === void 0 ? void 0 : props.fetcher) || ((url) => fetch(url).then((res) => res.json()));
47
+ const { data, error } = useSWR(url, fetcher);
48
+ return {
49
+ data: data || {},
50
+ error,
51
+ isLoading: !data && !error,
52
+ };
53
+ }
54
+ export function useReviewsInfinite(props) {
55
+ var _a, _b;
56
+ let url = null;
57
+ const { ref, inView } = useInView({ rootMargin: "800px" });
58
+ let baseURL = "";
59
+ let queryParams = new URLSearchParams();
60
+ if (props) {
61
+ const { productId, provider, dataType, searchText, ratings, topics, sortBy, ascending, perPage } = props; // Destructure all relevant props
62
+ baseURL = props.baseURL;
63
+ if (productId.length > 0) {
64
+ queryParams.set("id", productId);
65
+ }
66
+ if (provider.length > 0) {
67
+ queryParams.set("provider", provider);
68
+ }
69
+ queryParams.set("dataType", dataType);
70
+ if (searchText) {
71
+ queryParams.set("searchText", searchText);
72
+ }
73
+ if (ratings && ratings.length > 0) {
74
+ queryParams.set("ratings", ratings.join(","));
75
+ }
76
+ if (topics && topics.length > 0) {
77
+ queryParams.set("topics", topics.join(","));
78
+ }
79
+ if (sortBy) {
80
+ queryParams.set("sortBy", sortBy);
81
+ }
82
+ if (ascending !== undefined) {
83
+ queryParams.set("ascending", ascending.toString());
84
+ }
85
+ if (perPage) {
86
+ queryParams.set("perPage", String(perPage));
87
+ }
88
+ if (dataType === null || productId === null || productId.length === 0) {
89
+ url = null;
90
+ }
91
+ else {
92
+ url = `${baseURL}/reviews/by-id?${queryParams.toString()}`;
93
+ }
94
+ }
95
+ const getKey = (pageIndex, previousPageData) => {
96
+ const dataType = queryParams.get("dataType") === "null" ? null : queryParams.get("dataType");
97
+ if (dataType == null) {
98
+ return null;
99
+ }
100
+ return `${baseURL}/reviews/by-id?${queryParams.toString()}&page=${pageIndex + 1}`;
101
+ };
102
+ const fetcher = (props === null || props === void 0 ? void 0 : props.fetcher) || ((url) => fetch(url).then((res) => res.json()));
103
+ const { data: dataInfinite, error: errorInfinite, size, setSize, isLoading, isValidating, } = useSWRInfinite(getKey, fetcher);
104
+ let mergedReviews = dataInfinite
105
+ ? dataInfinite
106
+ .filter(page => page && page.reviews)
107
+ .flatMap(page => (page.reviews))
108
+ : [];
109
+ let searchResponse = {
110
+ pagination: (dataInfinite === null || dataInfinite === void 0 ? void 0 : dataInfinite.length) ? dataInfinite[0].pagination : null,
111
+ reviews: mergedReviews
112
+ };
113
+ const isAllReviewsLoaded = (mergedReviews === null || mergedReviews === void 0 ? void 0 : mergedReviews.length) === ((_b = (_a = dataInfinite === null || dataInfinite === void 0 ? void 0 : dataInfinite[0]) === null || _a === void 0 ? void 0 : _a.pagination) === null || _b === void 0 ? void 0 : _b.total);
114
+ const loadMore = useCallback(() => {
115
+ if (!isLoading && !isValidating && !isAllReviewsLoaded) {
116
+ setSize(size + 1);
117
+ }
118
+ }, [isLoading, isValidating, setSize, size, isAllReviewsLoaded]);
119
+ useEffect(() => {
120
+ if (inView) {
121
+ loadMore();
122
+ }
123
+ }, [inView, loadMore]);
124
+ return {
125
+ data: searchResponse || {},
126
+ error: errorInfinite,
127
+ isLoading: isValidating,
128
+ ref
129
+ };
130
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAGxD,QAAA,MAAM,KAAK,qFAwIV,CAAA;AAGD,OAAO,EAAE,KAAK,EAAE,CAAA"}
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAExD,QAAA,MAAM,KAAK,qFA+KV,CAAA;AAGD,OAAO,EAAE,KAAK,EAAE,CAAA"}
@@ -12,14 +12,15 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from "react";
14
14
  import { inputVariants, useInput } from "./useInput";
15
- import { cn } from "../../../lib/utils";
15
+ import { cn, getColor } from "../../../lib/utils";
16
16
  import { Icon } from "../icon";
17
17
  const Input = React.forwardRef((_a, ref) => {
18
- var { className, error = false, id, type, label, asChild, value, onChange, icon, iconPosition = "right", // Default to "right" for backward compatibility
19
- iconColor, placeholder, placeholderFont, placeholderFontWeight, placeholderFontSize, placeholderTextAlign, placeholderTextColor, placeholderUpperCase, inputPadding, backgroundColor, borderRadius, inputBorderColor, borderSides, inputSpacing } = _a, props = __rest(_a, ["className", "error", "id", "type", "label", "asChild", "value", "onChange", "icon", "iconPosition", "iconColor", "placeholder", "placeholderFont", "placeholderFontWeight", "placeholderFontSize", "placeholderTextAlign", "placeholderTextColor", "placeholderUpperCase", "inputPadding", "backgroundColor", "borderRadius", "inputBorderColor", "borderSides", "inputSpacing"]);
18
+ var { className, error = false, id, type, label, asChild, value, onChange, icon, iconUrl, iconPosition = "right", // Default to "right" for backward compatibility
19
+ iconColor, placeholder, placeholderFont, placeholderFontWeight, placeholderFontSize, placeholderTextAlign, placeholderTextColor, placeholderUpperCase, inputPadding, backgroundColor, borderRadius, inputBorderColor, borderSides, inputSpacing } = _a, props = __rest(_a, ["className", "error", "id", "type", "label", "asChild", "value", "onChange", "icon", "iconUrl", "iconPosition", "iconColor", "placeholder", "placeholderFont", "placeholderFontWeight", "placeholderFontSize", "placeholderTextAlign", "placeholderTextColor", "placeholderUpperCase", "inputPadding", "backgroundColor", "borderRadius", "inputBorderColor", "borderSides", "inputSpacing"]);
20
20
  const { Comp, inputPaddingRight, inputPaddingLeft, borderStyle, borderRadiusStyle, iconLeftPadding, iconRightPadding, iconTopPadding, iconBottomPadding, placeholderTextColorStyle, iconColorStyle, inputBgColor, inputBorderColorStyle, } = useInput({
21
21
  asChild,
22
22
  icon,
23
+ iconUrl,
23
24
  iconPosition,
24
25
  iconColor,
25
26
  className,
@@ -31,7 +32,9 @@ const Input = React.forwardRef((_a, ref) => {
31
32
  inputPadding,
32
33
  placeholderTextColor,
33
34
  });
34
- return (_jsxs(Comp, Object.assign({ className: "relative flex items-center group" }, { children: [icon && iconPosition === "left" && (_jsx(Icon, { name: icon, "data-error": error, size: "sm", color: iconColorStyle !== "inherit" ? undefined : "coreColors-secondaryIcon", className: cn("flex items-center absolute aspect-square fill-current z-10 icon ", {
35
+ return (_jsxs(Comp, Object.assign({ className: "relative flex items-center group" }, { children: [(icon || iconUrl) && iconPosition === "left" && (_jsx(Icon, { name: icon, url: iconUrl, "data-error": error, size: "sm", strokeColor: getColor(iconColor), color: iconColorStyle !== "inherit"
36
+ ? undefined
37
+ : "coreColors-secondaryIcon", className: cn("flex items-center absolute aspect-square fill-current z-10 icon ", {
35
38
  "w-5": true,
36
39
  "text-stateColors-error": error,
37
40
  }), style: {
@@ -43,7 +46,22 @@ const Input = React.forwardRef((_a, ref) => {
43
46
  } })), _jsx("style", { children: `
44
47
  .custom-placeholder-value::placeholder {
45
48
  color: ${placeholderTextColorStyle};
46
- }` }), _jsx("input", Object.assign({ placeholder: placeholder, value: value, onChange: (e) => onChange(e.target.value), id: id, type: type, className: cn(inputVariants({ error, hasLabel: !!label }), className, "custom-placeholder-value"), "data-icon": !!icon, ref: ref }, props, { style: Object.assign(Object.assign({ paddingLeft: inputPaddingLeft, paddingRight: inputPaddingRight, fontFamily: placeholderFont, fontWeight: placeholderFontWeight, fontSize: `${placeholderFontSize}px`, textAlign: placeholderTextAlign, color: placeholderTextColorStyle, textTransform: placeholderUpperCase ? "uppercase" : undefined, borderColor: inputBorderColorStyle, paddingTop: inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.top, paddingBottom: inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.bottom, backgroundColor: inputBgColor }, borderStyle), (label ? { borderRadius: "8px" } : borderRadiusStyle)) })), label ? (_jsx("label", Object.assign({ htmlFor: id, className: cn("absolute text-[10px] text-textColors-secondaryColor group-active:text-coreColors-brandColorPrimary top-2 z-10 h-4 origin-[0] opacity-100 peer-placeholder-shown:opacity-0", iconPosition === "left" ? "start-10" : "start-4") }, { children: label }))) : null, icon && iconPosition === "right" && (_jsx(Icon, { name: icon, "data-error": error, size: "sm", className: "absolute w-5 aspect-square fill-current text-textColors-secondaryColor top-[18px] z-10 origin-[0] end-4 peer-pr-8 icon data-[error=true]:text-stateColors-error" }))] })));
49
+ }` }), _jsx("input", Object.assign({ placeholder: placeholder, value: value, onChange: (e) => onChange(e.target.value), id: id, type: type, className: cn(inputVariants({ error, hasLabel: !!label }), className, "custom-placeholder-value"), "data-icon": !!icon, ref: ref }, props, { style: Object.assign(Object.assign({ paddingLeft: iconUrl &&
50
+ iconPosition === "left" &&
51
+ placeholderTextAlign === "center"
52
+ ? undefined
53
+ : inputPaddingLeft, paddingRight: inputPaddingRight, fontFamily: placeholderFont, fontWeight: placeholderFontWeight, fontSize: `${placeholderFontSize}px`, textAlign: placeholderTextAlign, color: placeholderTextColorStyle, textTransform: placeholderUpperCase ? "uppercase" : undefined, borderColor: inputBorderColorStyle, paddingTop: inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.top, paddingBottom: inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.bottom, backgroundColor: inputBgColor }, borderStyle), (label ? { borderRadius: "8px" } : borderRadiusStyle)) })), label ? (_jsx("label", Object.assign({ htmlFor: id, className: cn("absolute text-[10px] text-textColors-secondaryColor group-active:text-coreColors-brandColorPrimary top-2 z-10 h-4 origin-[0] opacity-100 peer-placeholder-shown:opacity-0", iconPosition === "left" ? "start-10" : "start-4") }, { children: label }))) : null, (icon || iconUrl) && iconPosition === "right" && (_jsx(Icon, { name: icon, url: iconUrl, "data-error": error, size: "sm", strokeColor: getColor(iconColor), color: iconColorStyle !== "inherit"
54
+ ? undefined
55
+ : "coreColors-secondaryIcon", className: cn("flex items-center absolute aspect-square fill-current z-10 icon ", {
56
+ "w-5": true,
57
+ "text-stateColors-error": error,
58
+ }), style: {
59
+ left: iconLeftPadding,
60
+ right: iconRightPadding,
61
+ top: iconTopPadding,
62
+ bottom: iconBottomPadding,
63
+ color: iconColorStyle,
64
+ } }))] })));
47
65
  });
48
66
  Input.displayName = "Input";
49
67
  export { Input };
@@ -10,6 +10,7 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
10
10
  value: string;
11
11
  onChange: (value: string) => void;
12
12
  icon?: string;
13
+ iconUrl?: string;
13
14
  iconPosition?: "left" | "right";
14
15
  iconColor?: Color;
15
16
  placeholder: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA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B,eAAe,CAAC,EAAE,KAAK,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAA;IACxB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,YAAY,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB"}
@@ -7,7 +7,7 @@ export declare const inputVariants: (props?: ({
7
7
  hasLabel?: boolean | null | undefined;
8
8
  error?: boolean | null | undefined;
9
9
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
10
- export declare const useInput: (props: Pick<InputProps, "asChild" | "icon" | "iconPosition" | "iconColor" | "className" | "backgroundColor" | "borderRadius" | "inputBorderColor" | "borderSides" | "inputSpacing" | "inputPadding" | "placeholderTextColor">) => {
10
+ export declare const useInput: (props: Pick<InputProps, "asChild" | "icon" | "iconUrl" | "iconPosition" | "iconColor" | "className" | "backgroundColor" | "borderRadius" | "inputBorderColor" | "borderSides" | "inputSpacing" | "inputPadding" | "placeholderTextColor">) => {
11
11
  Comp: string | import("react").ForwardRefExoticComponent<import("@radix-ui/react-slot").SlotProps & import("react").RefAttributes<HTMLElement>>;
12
12
  inputPaddingRight: string | undefined;
13
13
  inputPaddingLeft: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useInput.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/useInput.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAGxD,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC,eAAO,MAAM,aAAa;;;mFAkBzB,CAAA;AAED,eAAO,MAAM,QAAQ,UAAW,KAAK,UAAU,EAAE,SAAS,GAAG,MAAM,GAAG,cAAc,GAAG,WAAW,GAAG,WAAW,GAAG,iBAAiB,GAAG,cAAc,GAAG,kBAAkB,GAAG,aAAa,GAAG,cAAc,GAAG,cAAc,GAAG,sBAAsB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkErP,CAAA"}
1
+ {"version":3,"file":"useInput.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/useInput.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAGxD,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC,eAAO,MAAM,aAAa;;;mFAkBzB,CAAA;AAED,eAAO,MAAM,QAAQ,UACZ,KACL,UAAU,EACR,SAAS,GACT,MAAM,GACN,SAAS,GACT,cAAc,GACd,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,cAAc,GACd,kBAAkB,GAClB,aAAa,GACb,cAAc,GACd,cAAc,GACd,sBAAsB,CACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwFF,CAAA"}
@@ -8,7 +8,7 @@ export const inputVariants = cva("flex w-full border border-coreColors-dividingL
8
8
  variants: {
9
9
  hasLabel: {
10
10
  true: "h-14 px-4 rounded pt-5 pb-2 placeholder-shown:p-4",
11
- false: "pl-10 pr-4 py-2",
11
+ false: "px-4 py-2",
12
12
  },
13
13
  error: {
14
14
  true: "border-stateColors-error text-stateColors-error placeholder:text-stateColors-error focus:border-stateColors-error [&+label]:text-stateColors-error",
@@ -21,11 +21,15 @@ export const inputVariants = cva("flex w-full border border-coreColors-dividingL
21
21
  },
22
22
  });
23
23
  export const useInput = (props) => {
24
- const { asChild, icon, iconPosition = "right", // Default to "right" for backward compatibility
25
- iconColor, placeholderTextColor, backgroundColor, borderRadius, inputBorderColor, borderSides = ["all"], inputPadding, inputSpacing = DEFAULT_X_PADDING, } = props;
24
+ const { asChild, icon, iconUrl, iconPosition = "right", // Default to "right" for backward compatibility
25
+ iconColor, placeholderTextColor, backgroundColor, borderRadius, inputBorderColor, borderSides = ["all"], inputPadding, inputSpacing, } = props;
26
26
  const Comp = asChild ? Slot : "div";
27
- const inputPaddingRight = icon && iconPosition === "right" ? (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.right) ? `${inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.right}px` : "2.5rem" : undefined;
28
- const inputPaddingLeft = icon && iconPosition === "left"
27
+ const inputPaddingRight = (icon || iconUrl) && iconPosition === "right"
28
+ ? (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.right)
29
+ ? `${inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.right}px`
30
+ : "2.5rem"
31
+ : undefined;
32
+ const inputPaddingLeft = (icon || iconUrl) && iconPosition === "left"
29
33
  ? (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.left) !== undefined && inputSpacing
30
34
  ? `calc(${(inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.left) + inputSpacing + DEFAULT_ICON_SIZE}px)`
31
35
  : (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.left)
@@ -42,11 +46,21 @@ export const useInput = (props) => {
42
46
  borderLeftWidth: borderSides.includes("left") ? "1px" : 0,
43
47
  borderRightWidth: borderSides.includes("right") ? "1px" : 0,
44
48
  };
45
- const borderRadiusStyle = borderRadius ? { borderRadius: `${borderRadius}px` } : {};
46
- const iconLeftPadding = (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.left) !== undefined ? `${inputPadding.left}px` : `${DEFAULT_X_PADDING}px`;
47
- const iconRightPadding = (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.right) !== undefined ? `${inputPadding.right}px` : `${DEFAULT_X_PADDING}px`;
48
- const iconTopPadding = (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.top) !== undefined ? `${inputPadding.top}px` : `${DEFAULT_Y_PADDING}px`;
49
- const iconBottomPadding = (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.bottom) !== undefined ? `${inputPadding.bottom}px` : `${DEFAULT_Y_PADDING}px`;
49
+ const borderRadiusStyle = borderRadius
50
+ ? { borderRadius: `${borderRadius}px` }
51
+ : {};
52
+ const iconLeftPadding = (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.left) !== undefined
53
+ ? `${inputPadding.left}px`
54
+ : `${DEFAULT_X_PADDING}px`;
55
+ const iconRightPadding = (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.right) !== undefined
56
+ ? `${inputPadding.right}px`
57
+ : `${DEFAULT_X_PADDING}px`;
58
+ const iconTopPadding = (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.top) !== undefined
59
+ ? `${inputPadding.top}px`
60
+ : `${DEFAULT_Y_PADDING}px`;
61
+ const iconBottomPadding = (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.bottom) !== undefined
62
+ ? `${inputPadding.bottom}px`
63
+ : `${DEFAULT_Y_PADDING}px`;
50
64
  const iconColorStyle = getColor(iconColor);
51
65
  const inputBgColor = getColor(backgroundColor);
52
66
  const inputBorderColorStyle = getColor(inputBorderColor);
@@ -5,6 +5,8 @@ declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimi
5
5
  declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
6
6
  showDefaultIcon?: boolean | undefined;
7
7
  } & React.RefAttributes<HTMLButtonElement>>;
8
- declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
9
+ contentClassName: string;
10
+ } & React.RefAttributes<HTMLDivElement>>;
9
11
  export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
10
12
  //# sourceMappingURL=accordion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../components/ui/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAA;AAK/D,QAAA,MAAM,SAAS,8JAA0B,CAAA;AAEzC,QAAA,MAAM,aAAa,iKASjB,CAAA;AAGF,QAAA,MAAM,gBAAgB;;2CA4BpB,CAAA;AAGF,QAAA,MAAM,gBAAgB,oKAWpB,CAAA;AAIF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAA"}
1
+ {"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../components/ui/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAA;AAK/D,QAAA,MAAM,SAAS,8JAA0B,CAAA;AAEzC,QAAA,MAAM,aAAa,iKASjB,CAAA;AAGF,QAAA,MAAM,gBAAgB;;2CA4BpB,CAAA;AAGF,QAAA,MAAM,gBAAgB;sBAGA,MAAM;wCAU1B,CAAA;AAIF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAA"}
@@ -27,8 +27,8 @@ const AccordionTrigger = React.forwardRef((_a, ref) => {
27
27
  });
28
28
  AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
29
29
  const AccordionContent = React.forwardRef((_a, ref) => {
30
- var { className, children } = _a, props = __rest(_a, ["className", "children"]);
31
- return (_jsx(AccordionPrimitive.Content, Object.assign({ ref: ref, className: "px-4 overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down" }, props, { children: _jsx("div", Object.assign({ className: cn("pb-4 pt-0", className) }, { children: children })) })));
30
+ var { className, children, contentClassName } = _a, props = __rest(_a, ["className", "children", "contentClassName"]);
31
+ return (_jsx(AccordionPrimitive.Content, Object.assign({ ref: ref, className: cn("px-4 overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down", contentClassName) }, props, { children: _jsx("div", Object.assign({ className: cn("pb-4 pt-0", className) }, { children: children })) })));
32
32
  });
33
33
  AccordionContent.displayName = AccordionPrimitive.Content.displayName;
34
34
  export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
@@ -2,8 +2,8 @@ import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  import { Color, TextStyle, BackgroundAndPadding } from "../../lib/utils";
4
4
  declare const buttonVariants: (props?: ({
5
- size?: "sm" | "lg" | "content" | "default" | "icon" | null | undefined;
6
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "quickadd" | "applePay" | "shopPay" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | "content" | "icon" | null | undefined;
6
+ variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | "quickadd" | "applePay" | "shopPay" | null | undefined;
7
7
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
8
8
  export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
9
9
  asChild?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAGL,KAAK,EAEL,SAAS,EAET,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;AAIxB,QAAA,MAAM,cAAc;;;mFAgCnB,C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AAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAA;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAChC;AAED,QAAA,MAAM,MAAM,uFA4FX,CAAA;AAGD,QAAA,MAAM,cAAc,iBACJ,SAAS,GACrB,oBAAoB,GAAG;IACrB,SAAS,EAAE,KAAK,CAAA;IAChB,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5B,gBAAgB,EAAE,OAAO,CAAA;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBJ,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,CAAA"}
@@ -81,7 +81,7 @@ const labelVariants = cva("truncate", {
81
81
  const Button = React.forwardRef((_a, ref) => {
82
82
  var { className, labelClassName, labelStyle, variant, size, asChild = false, loading, icon, iconColor, iconStrokeColor, iconPosition, iconSize, iconUrl, iconClassName } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconStrokeColor", "iconPosition", "iconSize", "iconUrl", "iconClassName"]);
83
83
  const Comp = asChild ? Slot : "button";
84
- const IconButton = () => icon || iconUrl ? (_jsx(Icon, { name: icon, size: "sm", style: { color: iconColor } })) : null;
84
+ const IconButton = () => icon || iconUrl ? (_jsx(Icon, { name: icon, url: iconUrl, size: "sm", style: { color: iconColor, stroke: iconColor, fill: iconColor } })) : null;
85
85
  const BasicButton = () => (_jsxs(_Fragment, { children: [icon || iconUrl ? (_jsx(Icon, { name: iconUrl ? undefined : icon, url: iconUrl, size: iconSize || variant === "quickadd" ? "xs" : "sm", className: cn(iconVariants({ variant }), {
86
86
  "mr-2": iconPosition === "left",
87
87
  "ml-2": iconPosition === "right",
@@ -8,6 +8,7 @@ type CarouselProps = {
8
8
  opts?: CarouselOptions;
9
9
  plugins?: CarouselPlugin;
10
10
  orientation?: "horizontal" | "vertical";
11
+ tween?: boolean;
11
12
  setApi?: (api: CarouselApi) => void;
12
13
  slidesInView?: (slides: Array<number>) => void;
13
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../components/ui/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAAgB,EAAE,EACvB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAA;AAM7B,KAAK,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAA;AAC1C,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAChE,KAAK,eAAe,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAC/C,KAAK,cAAc,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAE9C,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAA;IACnC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,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