@tapcart/mobile-components 0.8.0 → 0.8.2

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.
@@ -147,7 +147,7 @@ const transformCart = ({ products, cartOrigin = cartMock, }) => {
147
147
  deliveryGroups,
148
148
  cost });
149
149
  };
150
- export const useMockCart = ({ apiUrl, appId, enabled = true, limit = 3, }) => {
150
+ export const useMockCart = ({ apiUrl, appId, enabled = true, limit = 10, }) => {
151
151
  const { products, error: productsError, isLoading: productsLoading, } = useProducts({
152
152
  productIds: [],
153
153
  productHandles: [],
@@ -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;AAM1C,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;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AACD,KAAK,iBAAiB,GAAG;IACvB,Q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,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,EAAE,OAAO,CAAA;IACrB,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,KAC3B;QACE,EAAE,EAAE,MAAM,CAAA;QACV,MAAM,EAAE,MAAM,CAAA;KACf,GACD,SAAS,CAAA;CACd,CAAA;AAgCD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,iBAAiB,CAuI7E"}
@@ -107,8 +107,10 @@ export function useProducts(props) {
107
107
  };
108
108
  // set local state when when SWR data is updated
109
109
  React.useEffect(() => {
110
- if (!data)
110
+ if (!data) {
111
+ setCachedProducts([]);
111
112
  return;
113
+ }
112
114
  // Determine the products array from data
113
115
  const productsArray = Array.isArray(data) ? data : data.products || [];
114
116
  if (!productsArray.length)
@@ -15,6 +15,5 @@ interface AnimateContainerProps {
15
15
  hasData?: boolean;
16
16
  }
17
17
  export declare function AnimateContainer({ children, animations, duration, className, isLoading, hasData, }: AnimateContainerProps): import("react/jsx-runtime").JSX.Element;
18
- export declare function SlideUp(props: Omit<AnimateContainerProps, "type">): import("react/jsx-runtime").JSX.Element;
19
18
  export {};
20
19
  //# sourceMappingURL=animate-container.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"animate-container.d.ts","sourceRoot":"","sources":["../../../components/ui/animate-container.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAG1D,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAA;AAErC,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE,eAAe,CAW7D,CAAA;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,EAAE,eAAe,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,UAAU,EACV,QAAc,EACd,SAAS,EACT,SAAS,EACT,OAAO,GACR,EAAE,qBAAqB,2CAyCvB;AAGD,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,2CAEjE"}
1
+ {"version":3,"file":"animate-container.d.ts","sourceRoot":"","sources":["../../../components/ui/animate-container.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAG1D,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAA;AAErC,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE,eAAe,CAW7D,CAAA;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,EAAE,eAAe,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,UAAU,EACV,QAAc,EACd,SAAS,EACT,SAAS,EACT,OAAO,GACR,EAAE,qBAAqB,2CAgCvB"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useState, useEffect, useRef } from "react";
3
+ import { useEffect, useRef } from "react";
4
4
  import { cn } from "../../lib/utils";
5
5
  export const Animations = {
6
6
  slide: {
@@ -16,8 +16,6 @@ export const Animations = {
16
16
  };
17
17
  export function AnimateContainer({ children, animations, duration = 300, className, isLoading, hasData, }) {
18
18
  const contentRef = useRef(null);
19
- const [prevData, setPrevData] = useState(hasData !== null && hasData !== void 0 ? hasData : false);
20
- const [shouldAnimate, setShouldAnimate] = useState(false);
21
19
  useEffect(() => {
22
20
  if (contentRef.current &&
23
21
  (animations === null || animations === void 0 ? void 0 : animations.some((animation) => animation.isHeight))) {
@@ -25,21 +23,11 @@ export function AnimateContainer({ children, animations, duration = 300, classNa
25
23
  }
26
24
  if (isLoading)
27
25
  return;
28
- if (prevData !== hasData) {
29
- setShouldAnimate(true);
30
- setPrevData(hasData !== null && hasData !== void 0 ? hasData : false);
31
- }
32
- }, [hasData, isLoading, animations, prevData]);
26
+ }, [isLoading, animations]);
33
27
  const getAnimationClasses = () => {
34
- if (!shouldAnimate)
35
- return "";
36
28
  return animations
37
29
  .map((animation) => (hasData ? animation.enter : animation.exit))
38
30
  .join(" ");
39
31
  };
40
32
  return (_jsx("div", Object.assign({ ref: contentRef, className: cn("overflow-hidden", getAnimationClasses(), className), style: { animationDuration: `${duration}ms` } }, { children: children })));
41
33
  }
42
- // TO REMOVE
43
- export function SlideUp(props) {
44
- return _jsx(AnimateContainer, Object.assign({}, props, { animations: [Animations.slide] }));
45
- }
@@ -1,4 +1,9 @@
1
- import { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, Type as ListType } from "react-swipeable-list";
1
+ import * as SwipeableListLib from "react-swipeable-list";
2
2
  import "react-swipeable-list/dist/styles.css";
3
- export { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, ListType, };
3
+ export declare const LeadingActions: (props: any) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const SwipeableList: (props: any) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const SwipeableListItem: (props: any) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const SwipeAction: (props: any) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const TrailingActions: (props: any) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const ListType: typeof SwipeableListLib.Type;
4
9
  //# sourceMappingURL=swipeable-list-item.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"swipeable-list-item.d.ts","sourceRoot":"","sources":["../../../components/ui/swipeable-list-item.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,IAAI,IAAI,QAAQ,EACjB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,sCAAsC,CAAA;AAE7C,OAAO,EACL,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,QAAQ,GACT,CAAA"}
1
+ {"version":3,"file":"swipeable-list-item.d.ts","sourceRoot":"","sources":["../../../components/ui/swipeable-list-item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,gBAAgB,MAAM,sBAAsB,CAAA;AACxD,OAAO,sCAAsC,CAAA;AAG7C,eAAO,MAAM,cAAc,UAAW,GAAG,4CAExC,CAAA;AACD,eAAO,MAAM,aAAa,UAAW,GAAG,4CAEvC,CAAA;AACD,eAAO,MAAM,iBAAiB,UAAW,GAAG,4CAE3C,CAAA;AACD,eAAO,MAAM,WAAW,UAAW,GAAG,4CAErC,CAAA;AACD,eAAO,MAAM,eAAe,UAAW,GAAG,4CAEzC,CAAA;AACD,eAAO,MAAM,QAAQ,8BAAwB,CAAA"}
@@ -1,4 +1,11 @@
1
1
  "use client";
2
- import { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, Type as ListType, } from "react-swipeable-list";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as SwipeableListLib from "react-swipeable-list";
3
4
  import "react-swipeable-list/dist/styles.css";
4
- export { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, ListType, };
5
+ // Re-export as wrapped components
6
+ export const LeadingActions = (props) => (_jsx(SwipeableListLib.LeadingActions, Object.assign({}, props)));
7
+ export const SwipeableList = (props) => (_jsx(SwipeableListLib.SwipeableList, Object.assign({}, props)));
8
+ export const SwipeableListItem = (props) => (_jsx(SwipeableListLib.SwipeableListItem, Object.assign({}, props)));
9
+ export const SwipeAction = (props) => (_jsx(SwipeableListLib.SwipeAction, Object.assign({}, props)));
10
+ export const TrailingActions = (props) => (_jsx(SwipeableListLib.TrailingActions, Object.assign({}, props)));
11
+ export const ListType = SwipeableListLib.Type;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",