@tapcart/mobile-components 0.8.3 → 0.8.4
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/components/hooks/use-mock-cart.js +1 -1
- package/dist/components/ui/quantity-picker.d.ts.map +1 -1
- package/dist/components/ui/quantity-picker.js +47 -10
- package/dist/components/ui/swipeable-list-item.d.ts +2 -7
- package/dist/components/ui/swipeable-list-item.d.ts.map +1 -1
- package/dist/components/ui/swipeable-list-item.js +2 -9
- package/dist/components/ui/swipeable-list.d.ts +4 -0
- package/dist/components/ui/swipeable-list.d.ts.map +1 -0
- package/dist/components/ui/swipeable-list.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lib/cart.util.d.ts +4 -0
- package/dist/lib/cart.util.d.ts.map +1 -1
- package/dist/lib/cart.util.js +5 -0
- package/dist/styles.css +3 -0
- package/package.json +2 -1
|
@@ -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 =
|
|
150
|
+
export const useMockCart = ({ apiUrl, appId, enabled = true, limit = 3, }) => {
|
|
151
151
|
const { products, error: productsError, isLoading: productsLoading, } = useProducts({
|
|
152
152
|
productIds: [],
|
|
153
153
|
productHandles: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quantity-picker.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,YA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AE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AA0ED,QAAA,MAAM,cAAc,4FA8HnB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
import { jsx as _jsx,
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import { cn } from "../../lib/utils";
|
|
16
16
|
import { Icon } from "./icon";
|
|
@@ -18,14 +18,37 @@ import { useTap } from "./tap";
|
|
|
18
18
|
import { LoadingDots } from "./loading-dots";
|
|
19
19
|
const IconButton = ({ iconUrl, iconColor, handler, className, style, disabled }) => {
|
|
20
20
|
const { onTap, isPressed, ref: tapRef } = useTap();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const [isButtonPressed, setIsButtonPressed] = React.useState(false);
|
|
22
|
+
// Handle press state manually for the invisible button
|
|
23
|
+
const handleMouseDown = React.useCallback(() => {
|
|
24
|
+
if (!disabled)
|
|
25
|
+
setIsButtonPressed(true);
|
|
26
|
+
}, [disabled]);
|
|
27
|
+
const handleMouseUp = React.useCallback(() => {
|
|
28
|
+
setIsButtonPressed(false);
|
|
29
|
+
}, []);
|
|
30
|
+
// Calculate the visual styles for the button
|
|
31
|
+
const visualButtonStyle = Object.assign({}, style);
|
|
32
|
+
return (_jsxs("div", Object.assign({ className: "relative h-7 w-7", style: { touchAction: "manipulation" } }, { children: [_jsx("div", Object.assign({ className: cn("absolute inset-0 flex items-center justify-center bg-stateColors-skeleton border border-coreColors-dividingLines", className, disabled ? "opacity-50" : ""), style: visualButtonStyle, "aria-hidden": "true" }, { children: _jsx(Icon, { url: iconUrl, size: "sm", strokeColor: iconColor, strokeWidth: 4, style: {
|
|
33
|
+
opacity: isPressed || isButtonPressed ? 0.7 : 1,
|
|
34
|
+
} }) })), _jsx("button", { onClick: onTap(handler), onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, onTouchStart: handleMouseDown, onTouchEnd: handleMouseUp, onTouchCancel: handleMouseUp, ref: tapRef, className: "absolute cursor-pointer", style: {
|
|
35
|
+
top: "-8px",
|
|
36
|
+
right: "-8px",
|
|
37
|
+
bottom: "-8px",
|
|
38
|
+
left: "-8px",
|
|
39
|
+
opacity: 0,
|
|
40
|
+
zIndex: 10,
|
|
41
|
+
}, disabled: disabled, "aria-label": "Quantity button" })] })));
|
|
24
42
|
};
|
|
25
43
|
const QuantityPicker = React.forwardRef((_a, ref) => {
|
|
26
44
|
var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, isDecreaseDisabled, isIncreaseDisabled, value, setValue, inputStyle, buttonStyle, buttonCornerRadius = 4, max = 99, loading = false } = _a, props = __rest(_a, ["className", "decreaseIconUrl", "increaseIconUrl", "deleteIconUrl", "isDeleteOnly", "iconColor", "onDecreaseClick", "onIncreaseClick", "isDecreaseDisabled", "isIncreaseDisabled", "value", "setValue", "inputStyle", "buttonStyle", "buttonCornerRadius", "max", "loading"]);
|
|
27
45
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
28
|
-
const [localValue, setLocalValue] = React.useState(value);
|
|
46
|
+
const [localValue, setLocalValue] = React.useState(value.toString());
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
if (!isFocused) {
|
|
49
|
+
setLocalValue(value.toString());
|
|
50
|
+
}
|
|
51
|
+
}, [value, isFocused]);
|
|
29
52
|
const leftButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderTopLeftRadius: buttonCornerRadius
|
|
30
53
|
? `${buttonCornerRadius}px`
|
|
31
54
|
: undefined, borderBottomLeftRadius: buttonCornerRadius
|
|
@@ -37,13 +60,27 @@ const QuantityPicker = React.forwardRef((_a, ref) => {
|
|
|
37
60
|
? `${buttonCornerRadius}px`
|
|
38
61
|
: undefined });
|
|
39
62
|
const singleButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderRadius: buttonCornerRadius ? `${buttonCornerRadius}px` : undefined });
|
|
40
|
-
return (_jsxs("div", Object.assign({ className: cn("flex relative", className), ref: ref }, props, { children: [isDeleteOnly ? (_jsx(IconButton, { handler: onDecreaseClick, iconUrl: deleteIconUrl, iconColor: iconColor, style: singleButtonStyle })) : (_jsxs(_Fragment, { children: [_jsx(IconButton, { handler: onDecreaseClick, iconUrl: value === 1 ? deleteIconUrl : decreaseIconUrl, iconColor: iconColor, style: leftButtonStyle, disabled: isDecreaseDisabled || loading }), _jsx("input", { type: "number", pattern: "[0-9]*", disabled: loading, max: max, value:
|
|
63
|
+
return (_jsxs("div", Object.assign({ className: cn("flex relative", className), ref: ref }, props, { children: [isDeleteOnly ? (_jsx(IconButton, { handler: onDecreaseClick, iconUrl: deleteIconUrl, iconColor: iconColor, style: singleButtonStyle })) : (_jsxs(_Fragment, { children: [_jsx(IconButton, { handler: onDecreaseClick, iconUrl: value === 1 ? deleteIconUrl : decreaseIconUrl, iconColor: iconColor, style: leftButtonStyle, disabled: isDecreaseDisabled || loading }), _jsx("input", { type: "number", pattern: "[0-9]*", disabled: loading, max: max, value: localValue, onBlur: (e) => {
|
|
41
64
|
setIsFocused(false);
|
|
42
|
-
|
|
43
|
-
|
|
65
|
+
const parsedValue = parseInt(e.target.value) || 0;
|
|
66
|
+
const clampedValue = Math.min(parsedValue, max);
|
|
67
|
+
setValue(clampedValue);
|
|
68
|
+
setLocalValue(clampedValue.toString());
|
|
69
|
+
}, onFocus: () => {
|
|
44
70
|
setIsFocused(true);
|
|
45
|
-
|
|
46
|
-
|
|
71
|
+
}, onChange: (e) => {
|
|
72
|
+
const inputValue = e.target.value;
|
|
73
|
+
if (inputValue === "") {
|
|
74
|
+
setLocalValue("");
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
const parsedValue = parseInt(inputValue);
|
|
78
|
+
if (!isNaN(parsedValue)) {
|
|
79
|
+
const clampedValue = Math.min(parsedValue, max);
|
|
80
|
+
setLocalValue(clampedValue.toString());
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, className: "w-8 h-7 focus-visible:outline-none text-center bg-coreColors-inputBackground text-textColors-primaryColor border-t border-b border-coreColors-dividingLines", style: Object.assign(Object.assign({}, inputStyle), { borderRadius: (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.borderRadius)
|
|
47
84
|
? `${inputStyle.borderRadius}px`
|
|
48
85
|
: 0 }), inputMode: "numeric" }), _jsx(IconButton, { handler: onIncreaseClick, iconUrl: increaseIconUrl, iconColor: iconColor, style: rightButtonStyle, disabled: isIncreaseDisabled || loading })] })), _jsx(LoadingDots, { show: loading, size: 1, iconColor: iconColor })] })));
|
|
49
86
|
});
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, Type as ListType } from "react-swipeable-list";
|
|
2
2
|
import "react-swipeable-list/dist/styles.css";
|
|
3
|
-
export
|
|
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;
|
|
3
|
+
export { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, ListType, };
|
|
9
4
|
//# 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,
|
|
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,11 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import * as SwipeableListLib from "react-swipeable-list";
|
|
2
|
+
import { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, Type as ListType, } from "react-swipeable-list";
|
|
4
3
|
import "react-swipeable-list/dist/styles.css";
|
|
5
|
-
|
|
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;
|
|
4
|
+
export { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, ListType, };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, Type as ListType } from "react-swipeable-list";
|
|
2
|
+
import "react-swipeable-list/dist/styles.css";
|
|
3
|
+
export { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, ListType, };
|
|
4
|
+
//# sourceMappingURL=swipeable-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swipeable-list.d.ts","sourceRoot":"","sources":["../../../components/ui/swipeable-list.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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, Type as ListType, } from "react-swipeable-list";
|
|
3
|
+
import "react-swipeable-list/dist/styles.css";
|
|
4
|
+
export { LeadingActions, SwipeableList, SwipeableListItem, SwipeAction, TrailingActions, ListType, };
|
package/dist/index.d.ts
CHANGED
|
@@ -73,5 +73,6 @@ export * from "./components/hooks/use-nosto-recommendation";
|
|
|
73
73
|
export * from "./components/libs/sort-filter/search-integration";
|
|
74
74
|
export * from "./components/ui/tap";
|
|
75
75
|
export * from "./components/ui/circular-progress";
|
|
76
|
+
export * from "./components/ui/swipeable-list";
|
|
76
77
|
export * from "./components/libs/cache/index";
|
|
77
78
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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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5 @@ export * from "./components/hooks/use-nosto-recommendation";
|
|
|
74
74
|
export * from "./components/libs/sort-filter/search-integration";
|
|
75
75
|
export * from "./components/ui/tap";
|
|
76
76
|
export * from "./components/ui/circular-progress";
|
|
77
|
+
export * from "./components/ui/swipeable-list";
|
|
77
78
|
export * from "./components/libs/cache/index";
|
package/dist/lib/cart.util.d.ts
CHANGED
|
@@ -13,4 +13,8 @@ export type CalculatedData = {
|
|
|
13
13
|
};
|
|
14
14
|
export declare const DEFAULT_CALCULATED_DATA: CalculatedData;
|
|
15
15
|
export declare const getCalculatedCartData: (cart: EnrichedCart) => CalculatedData;
|
|
16
|
+
export declare const getCartItemKey: (variantId: string, sellingPlanId?: string, attributes?: {
|
|
17
|
+
key: string;
|
|
18
|
+
value: string;
|
|
19
|
+
}[]) => string;
|
|
16
20
|
//# sourceMappingURL=cart.util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.util.d.ts","sourceRoot":"","sources":["../../lib/cart.util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"cart.util.d.ts","sourceRoot":"","sources":["../../lib/cart.util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,kBAAkB,CAAA;AA4CzB,eAAO,MAAM,oBAAoB,SAAU,MAAM,QAAQ,YAAY,YAMpE,CAAA;AAED,eAAO,MAAM,kBAAkB,SAAU,MAAM,QAAQ,YAAY,YAMlE,CAAA;AAqGD,MAAM,MAAM,cAAc,GAAG;IAC3B,yBAAyB,EAAE,sBAAsB,EAAE,CAAA;IACnD,gBAAgB,EAAE,6BAA6B,EAAE,CAAA;IACjD,cAAc,EAAE,OAAO,CAAA;IACvB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,cASrC,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,YAAY,KAAG,cA4B1D,CAAA;AAED,eAAO,MAAM,cAAc,cACd,MAAM,kBACD,MAAM,eACT;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,WAO9C,CAAA"}
|
package/dist/lib/cart.util.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getIdFromGid } from "./utils";
|
|
1
2
|
const getOrderLevelDiscounts = (cart) => {
|
|
2
3
|
var _a;
|
|
3
4
|
const discountMap = (_a = cart.discountAllocations) === null || _a === void 0 ? void 0 : _a.filter((discount) => discount.targetType !== "SHIPPING_LINE").reduce((acc, discount) => {
|
|
@@ -149,3 +150,7 @@ export const getCalculatedCartData = (cart) => {
|
|
|
149
150
|
totalDiscountedPrice,
|
|
150
151
|
};
|
|
151
152
|
};
|
|
153
|
+
export const getCartItemKey = (variantId, sellingPlanId, attributes) => {
|
|
154
|
+
const key = `${getIdFromGid(variantId)}:${sellingPlanId || "no-plan"}:${attributes === null || attributes === void 0 ? void 0 : attributes.map((attr) => `${attr.key}-${attr.value}`).join("-")}`;
|
|
155
|
+
return key;
|
|
156
|
+
};
|
package/dist/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"react-circular-progressbar": "2.2.0",
|
|
89
89
|
"react-intersection-observer": "^9.10.2",
|
|
90
90
|
"react-svg": "^16.1.34",
|
|
91
|
+
"react-swipeable-list": "^1.10.0",
|
|
91
92
|
"react-virtual": "^2.10.4",
|
|
92
93
|
"swr": "^2.2.5",
|
|
93
94
|
"tailwind-merge": "^1.13.2",
|