@tapcart/mobile-components 0.7.73 → 0.7.74
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/ui/chip.d.ts +0 -2
- package/dist/components/ui/chip.d.ts.map +1 -1
- package/dist/components/ui/chip.js +3 -6
- package/dist/components/ui/quantity-picker.d.ts +0 -1
- package/dist/components/ui/quantity-picker.d.ts.map +1 -1
- package/dist/components/ui/quantity-picker.js +8 -9
- package/dist/components/ui/selectors.js +1 -1
- package/dist/components/ui/text.js +5 -5
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/lib/cart.util.d.ts.map +1 -1
- package/dist/lib/cart.util.js +2 -2
- package/dist/lib/price.d.ts +14 -0
- package/dist/lib/price.d.ts.map +1 -1
- package/dist/lib/price.js +19 -0
- package/dist/lib/utils.d.ts +0 -17
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +0 -30
- package/dist/styles.css +5 -26
- package/package.json +23 -19
- package/dist/components/hooks/use-click-outside.d.ts +0 -6
- package/dist/components/hooks/use-click-outside.d.ts.map +0 -1
- package/dist/components/hooks/use-click-outside.js +0 -15
- package/dist/components/hooks/use-outside-click.d.ts +0 -7
- package/dist/components/hooks/use-outside-click.d.ts.map +0 -1
- package/dist/components/hooks/use-outside-click.js +0 -16
- package/dist/components/hooks/use-tap.d.ts +0 -8
- package/dist/components/hooks/use-tap.d.ts.map +0 -1
- package/dist/components/hooks/use-tap.js +0 -100
- package/dist/components/ui/loading-dots.d.ts +0 -9
- package/dist/components/ui/loading-dots.d.ts.map +0 -1
- package/dist/components/ui/loading-dots.js +0 -22
|
@@ -12,7 +12,6 @@ type ChipProps = React.ComponentPropsWithoutRef<"div"> & VariantProps<typeof chi
|
|
|
12
12
|
iconUrl?: string;
|
|
13
13
|
onChipClick?: () => void;
|
|
14
14
|
onIconClick?: () => void;
|
|
15
|
-
loading?: boolean;
|
|
16
15
|
};
|
|
17
16
|
declare const Chip: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
18
17
|
variant?: "secondary" | "primary" | null | undefined;
|
|
@@ -25,7 +24,6 @@ declare const Chip: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps
|
|
|
25
24
|
iconUrl?: string | undefined;
|
|
26
25
|
onChipClick?: (() => void) | undefined;
|
|
27
26
|
onIconClick?: (() => void) | undefined;
|
|
28
|
-
loading?: boolean | undefined;
|
|
29
27
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
30
28
|
type MultipleChipsProps = {
|
|
31
29
|
children: React.ReactElement<ChipProps>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../../components/ui/chip.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAsC,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../../components/ui/chip.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAsC,MAAM,OAAO,CAAA;AAG1D,QAAA,MAAM,YAAY;;;;mFAwBjB,CAAA;AAED,KAAK,SAAS,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GACpD,YAAY,CAAC,OAAO,YAAY,CAAC,GAAG;IAClC,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;CACzB,CAAA;AAEH,QAAA,MAAM,IAAI;;;;;;;;;yBAJc,IAAI;yBACJ,IAAI;wCAgE3B,CAAA;AAGD,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAA;IACzC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;CAC9C,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoD/C,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAAE,CAAA"}
|
|
@@ -15,7 +15,6 @@ import { cva } from "class-variance-authority";
|
|
|
15
15
|
import { cn } from "../../lib/utils";
|
|
16
16
|
import React, { useState, useEffect } from "react";
|
|
17
17
|
import { Icon } from "./icon";
|
|
18
|
-
import { LoadingDots } from "./loading-dots";
|
|
19
18
|
const chipVariants = cva("inline-flex items-center justify-center rounded border border-coreColors-dividingLines text-[12px] transition-colors h-8 active:opacity-70", {
|
|
20
19
|
variants: {
|
|
21
20
|
variant: {
|
|
@@ -39,7 +38,7 @@ const chipVariants = cva("inline-flex items-center justify-center rounded border
|
|
|
39
38
|
},
|
|
40
39
|
});
|
|
41
40
|
const Chip = React.forwardRef((_a, ref) => {
|
|
42
|
-
var { className, variant, direction, children, iconPosition, iconColor = "coreColors-secondaryIcon", iconUrl,
|
|
41
|
+
var { className, variant, direction, children, iconPosition, iconColor = "coreColors-secondaryIcon", iconUrl, onChipClick, onIconClick } = _a, props = __rest(_a, ["className", "variant", "direction", "children", "iconPosition", "iconColor", "iconUrl", "onChipClick", "onIconClick"]);
|
|
43
42
|
const handleOnClick = () => {
|
|
44
43
|
onChipClick === null || onChipClick === void 0 ? void 0 : onChipClick();
|
|
45
44
|
};
|
|
@@ -47,9 +46,7 @@ const Chip = React.forwardRef((_a, ref) => {
|
|
|
47
46
|
onIconClick === null || onIconClick === void 0 ? void 0 : onIconClick();
|
|
48
47
|
};
|
|
49
48
|
const ChipIcon = ({ className }) => iconUrl ? (_jsx(Icon, { url: iconUrl, size: "xs", color: iconColor, className: className })) : (_jsx(Icon, { name: "square-x-filled", color: iconColor, className: className }));
|
|
50
|
-
return (_jsxs("div", Object.assign({ onClick:
|
|
51
|
-
relative: loading,
|
|
52
|
-
}) }, props, { children: [iconPosition === "left" && (_jsx("button", Object.assign({ onClick: loading ? undefined : handleIconClick, className: "h-full flex items-center justify-center pl-2" }, { children: _jsx(ChipIcon, { className: "mr-2 h-4 w-4 cursor-pointer" }) }))), children, iconPosition === "right" && (_jsx("button", Object.assign({ onClick: loading ? undefined : handleIconClick, className: "h-full flex items-center justify-center pr-2" }, { children: _jsx(ChipIcon, { className: "ml-2 h-4 w-4 cursor-pointer" }) }))), _jsx(LoadingDots, { show: loading, size: 1, iconColor: iconColor })] })));
|
|
49
|
+
return (_jsxs("div", Object.assign({ onClick: handleOnClick, ref: ref, className: cn(chipVariants({ variant, direction, iconPosition }), className) }, props, { children: [iconPosition === "left" && (_jsx("button", Object.assign({ onClick: handleIconClick, className: "h-full flex items-center justify-center pl-2" }, { children: _jsx(ChipIcon, { className: "mr-2 h-4 w-4 cursor-pointer" }) }))), children, iconPosition === "right" && (_jsx("button", Object.assign({ onClick: handleIconClick, className: "h-full flex items-center justify-center pr-2" }, { children: _jsx(ChipIcon, { className: "ml-2 h-4 w-4 cursor-pointer" }) })))] })));
|
|
53
50
|
});
|
|
54
51
|
Chip.displayName = "Chip";
|
|
55
52
|
const MultipleChips = ({ children, containerRef, style, }) => {
|
|
@@ -69,7 +66,7 @@ const MultipleChips = ({ children, containerRef, style, }) => {
|
|
|
69
66
|
useEffect(() => {
|
|
70
67
|
checkOverflow();
|
|
71
68
|
}, [children]);
|
|
72
|
-
return (_jsxs("div", Object.assign({ className: "relative no-scrollbar" }, { children: [_jsx("div", Object.assign({ ref: containerRef, className: "flex overflow-x-auto overflow-y-hidden", onScroll: checkOverflow, style: style }, { children: children.map((chip, index) => (_jsx("div", Object.assign({ className: cn("shrink-0", {
|
|
69
|
+
return (_jsxs("div", Object.assign({ className: "relative no-scrollbar" }, { children: [_jsx("div", Object.assign({ ref: containerRef, className: "flex overflow-x-auto overflow-y-hidden pt-2", onScroll: checkOverflow, style: style }, { children: children.map((chip, index) => (_jsx("div", Object.assign({ className: cn("shrink-0", {
|
|
73
70
|
"mr-2": index < children.length - 1,
|
|
74
71
|
}) }, { children: chip }), index))) })), showFadeLeft && (_jsx("div", { className: "absolute top-0 left-0 w-8 h-full pointer-events-none bg-fade-left" })), showFadeRight && (_jsx("div", { className: "absolute top-0 right-0 w-8 h-full pointer-events-none bg-fade-right" }))] })));
|
|
75
72
|
};
|
|
@@ -9,7 +9,6 @@ export interface QuantityPickerProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
9
9
|
onIncreaseClick: React.ReactEventHandler;
|
|
10
10
|
isDecreaseDisabled?: boolean;
|
|
11
11
|
isIncreaseDisabled?: boolean;
|
|
12
|
-
loading?: boolean;
|
|
13
12
|
value: number;
|
|
14
13
|
setValue: (_: number) => void;
|
|
15
14
|
className?: string;
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"quantity-picker.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,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,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,SAAS,CAAC,EAAE,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;AAmCD,QAAA,MAAM,cAAc,4FAoGnB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -15,7 +15,6 @@ import * as React from "react";
|
|
|
15
15
|
import { cn } from "../../lib/utils";
|
|
16
16
|
import { Icon } from "./icon";
|
|
17
17
|
import { useTap } from "./tap";
|
|
18
|
-
import { LoadingDots } from "./loading-dots";
|
|
19
18
|
const IconButton = ({ iconUrl, iconColor, handler, className, style, disabled }) => {
|
|
20
19
|
const { onTap, isPressed, ref: tapRef } = useTap();
|
|
21
20
|
return (_jsx("button", Object.assign({ onClick: onTap(handler), ref: tapRef, className: cn("flex items-center justify-center h-7 w-7 bg-stateColors-skeleton border border-coreColors-dividingLines", className), style: style, disabled: disabled }, { children: _jsx(Icon, { url: iconUrl, size: "sm", strokeColor: iconColor, strokeWidth: 4, style: {
|
|
@@ -23,7 +22,7 @@ const IconButton = ({ iconUrl, iconColor, handler, className, style, disabled })
|
|
|
23
22
|
} }) })));
|
|
24
23
|
};
|
|
25
24
|
const QuantityPicker = React.forwardRef((_a, ref) => {
|
|
26
|
-
var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, isDecreaseDisabled, isIncreaseDisabled, value, setValue, inputStyle, buttonStyle, buttonCornerRadius = 4, max = 99
|
|
25
|
+
var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, isDecreaseDisabled, isIncreaseDisabled, value, setValue, inputStyle, buttonStyle, buttonCornerRadius = 4, max = 99 } = _a, props = __rest(_a, ["className", "decreaseIconUrl", "increaseIconUrl", "deleteIconUrl", "isDeleteOnly", "iconColor", "onDecreaseClick", "onIncreaseClick", "isDecreaseDisabled", "isIncreaseDisabled", "value", "setValue", "inputStyle", "buttonStyle", "buttonCornerRadius", "max"]);
|
|
27
26
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
28
27
|
const [localValue, setLocalValue] = React.useState(value);
|
|
29
28
|
const leftButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderTopLeftRadius: buttonCornerRadius
|
|
@@ -37,13 +36,13 @@ const QuantityPicker = React.forwardRef((_a, ref) => {
|
|
|
37
36
|
? `${buttonCornerRadius}px`
|
|
38
37
|
: undefined });
|
|
39
38
|
const singleButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderRadius: buttonCornerRadius ? `${buttonCornerRadius}px` : undefined });
|
|
40
|
-
return (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
return (_jsx("div", Object.assign({ className: cn("flex", 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 }), _jsx("input", { type: "number", pattern: "[0-9]*", max: max, value: isFocused ? localValue : value, onBlur: (e) => {
|
|
40
|
+
setIsFocused(false);
|
|
41
|
+
setValue(Math.min(parseInt(e.target.value) || 0, max));
|
|
42
|
+
}, onFocus: (e) => {
|
|
43
|
+
setIsFocused(true);
|
|
44
|
+
setLocalValue(value);
|
|
45
|
+
}, onChange: (e) => setLocalValue(Math.min(parseInt(e.target.value), max)), 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: inputStyle, inputMode: "numeric" }), _jsx(IconButton, { handler: onIncreaseClick, iconUrl: increaseIconUrl, iconColor: iconColor, style: rightButtonStyle, disabled: isIncreaseDisabled })] })) })));
|
|
47
46
|
});
|
|
48
47
|
QuantityPicker.displayName = "QuantityPicker";
|
|
49
48
|
export { QuantityPicker };
|
|
@@ -59,7 +59,7 @@ const SelectorContainer = ({ children, containerRef, className, height = "42px",
|
|
|
59
59
|
React.useEffect(() => {
|
|
60
60
|
checkOverflow();
|
|
61
61
|
}, [children]);
|
|
62
|
-
return (_jsx("div", Object.assign({ className: "relative no-scrollbar" }, { children: _jsxs("div", Object.assign({ className: cn(`flex gap-2 px-1 items-center overflow-x-auto overflow-y-hidden no-scrollbar`, className), onScroll: checkOverflow, style: {
|
|
62
|
+
return (_jsx("div", Object.assign({ className: "relative no-scrollbar" }, { children: _jsxs("div", Object.assign({ className: cn(`flex gap-2 px-1 items-center overflow-x-auto overflow-y-hidden no-scrollbar`, className), onScroll: checkOverflow, style: { height: height }, ref: containerRef }, { children: [children, showFadeLeft && (_jsx("div", { className: "absolute top-0 left-0 w-8 h-full pointer-events-none bg-fade-left" })), showFadeRight && (_jsx("div", { className: "absolute top-0 right-0 w-8 h-full pointer-events-none bg-fade-right" }))] })) })));
|
|
63
63
|
};
|
|
64
64
|
Selectors.displayName = "Selectors";
|
|
65
65
|
export { SelectorContainer, Selectors, selectorsVariants };
|
|
@@ -51,11 +51,11 @@ function injectString(template, injections) {
|
|
|
51
51
|
const textVariants = cva("", {
|
|
52
52
|
variants: {
|
|
53
53
|
type: {
|
|
54
|
-
h1: "text-[23px]
|
|
55
|
-
h2: "text-lg
|
|
56
|
-
"body-primary": "text-[14px]
|
|
57
|
-
"body-secondary": "text-[12px]
|
|
58
|
-
label: "text-[10px]
|
|
54
|
+
h1: "text-[23px] font-fontRegular leading-[130%] font-normal text-textColors-primaryColor",
|
|
55
|
+
h2: "text-lg font-fontRegular leading-[130%] font-medium text-textColors-primaryColor",
|
|
56
|
+
"body-primary": "text-[14px] font-fontRegular leading-[160%] font-normal text-textColors-primaryColor",
|
|
57
|
+
"body-secondary": "text-[12px] font-fontRegular leading-[130%] font-normal text-textColors-secondaryColor",
|
|
58
|
+
label: "text-[10px] font-fontRegular leading-[130%] font-normal text-textColors-secondaryColor",
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
61
|
defaultVariants: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds,
|
|
1
|
+
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, isFavoriteIntegrationEnabled, getSpaceBetween, getGridSpacing, pluralize, getInputPlaceholderTextProps, } from "./lib/utils";
|
|
2
2
|
export * from "./lib/cart.util";
|
|
3
3
|
export * from "./components/contexts/translation-context";
|
|
4
4
|
export * from "./components/hooks/use-collection";
|
|
@@ -34,7 +34,6 @@ export * from "./components/ui/image";
|
|
|
34
34
|
export * from "./components/ui/Input/input";
|
|
35
35
|
export * from "./components/ui/label";
|
|
36
36
|
export * from "./components/ui/line-item-text-icons";
|
|
37
|
-
export * from "./components/ui/loading-dots";
|
|
38
37
|
export * from "./components/ui/money";
|
|
39
38
|
export * from "./components/ui/price";
|
|
40
39
|
export * from "./components/ui/product-card";
|
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,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,EAAE,EACF,GAAG,EACH,QAAQ,EACR,4BAA4B,EAC5B,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,EAC5B,eAAe,EACf,cAAc,EACd,SAAS,EACT,4BAA4B,GAC7B,MAAM,aAAa,CAAA;AACpB,cAAc,iBAAiB,CAAA;AAC/B,cA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AAc,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,gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kDAAkD,CAAA;AAChE,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,aAAa,CAAA;AAC3B,cAAc,6CAA6C,CAAA;AAC3D,cAAc,kDAAkD,CAAA;AAChE,cAAc,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// component exports
|
|
2
|
-
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds,
|
|
2
|
+
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, isFavoriteIntegrationEnabled, getSpaceBetween, getGridSpacing, pluralize, getInputPlaceholderTextProps, } from "./lib/utils";
|
|
3
3
|
export * from "./lib/cart.util";
|
|
4
4
|
export * from "./components/contexts/translation-context";
|
|
5
5
|
export * from "./components/hooks/use-collection";
|
|
@@ -35,7 +35,6 @@ export * from "./components/ui/image";
|
|
|
35
35
|
export * from "./components/ui/Input/input";
|
|
36
36
|
export * from "./components/ui/label";
|
|
37
37
|
export * from "./components/ui/line-item-text-icons";
|
|
38
|
-
export * from "./components/ui/loading-dots";
|
|
39
38
|
export * from "./components/ui/money";
|
|
40
39
|
export * from "./components/ui/price";
|
|
41
40
|
export * from "./components/ui/product-card";
|
|
@@ -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;AA2CzB,eAAO,MAAM,oBAAoB,SAAU,MAAM,QAAQ,YAAY,
|
|
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;AA2CzB,eAAO,MAAM,oBAAoB,SAAU,MAAM,QAAQ,YAAY,YAGpE,CAAA;AAED,eAAO,MAAM,kBAAkB,SAAU,MAAM,QAAQ,YAAY,YAGlE,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"}
|
package/dist/lib/cart.util.js
CHANGED
|
@@ -34,11 +34,11 @@ const getShippingDiscounts = (cart) => {
|
|
|
34
34
|
};
|
|
35
35
|
export const isOrderLevelDiscount = (code, cart) => {
|
|
36
36
|
const orderLevelDiscounts = getOrderLevelDiscounts(cart);
|
|
37
|
-
return orderLevelDiscounts.some((discount) =>
|
|
37
|
+
return orderLevelDiscounts.some((discount) => discount.id === code);
|
|
38
38
|
};
|
|
39
39
|
export const isLineItemDiscount = (code, cart) => {
|
|
40
40
|
const lineItemDiscounts = getLineItemDiscounts(cart);
|
|
41
|
-
return lineItemDiscounts.some((discount) =>
|
|
41
|
+
return lineItemDiscounts.some((discount) => discount.id === code);
|
|
42
42
|
};
|
|
43
43
|
const getAppliedGiftCards = (cart) => {
|
|
44
44
|
var _a;
|
package/dist/lib/price.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { ProductVariant, Product } from "app-studio-types";
|
|
2
|
+
type Badge = {
|
|
3
|
+
verticalPosition: "below" | "bottom" | "top";
|
|
4
|
+
priority: number;
|
|
5
|
+
tags: string[];
|
|
6
|
+
excludeTags: string[];
|
|
7
|
+
text?: string;
|
|
8
|
+
color?: string;
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
};
|
|
11
|
+
type BadgeConfig = {
|
|
12
|
+
[key in "below" | "bottom" | "top"]?: Badge[];
|
|
13
|
+
};
|
|
2
14
|
export declare const getCheapestProductFromVariantsFn: (productVariants: ProductVariant[]) => ProductVariant;
|
|
15
|
+
export declare const getBadgeForProductFn: (badgeConfig?: BadgeConfig, productTags?: string[]) => Badge | undefined;
|
|
3
16
|
export declare function getPriceRangesFn(product: Product): {
|
|
4
17
|
price: number;
|
|
5
18
|
isSale: boolean;
|
|
@@ -12,4 +25,5 @@ export declare function getPriceFn(product: Product): {
|
|
|
12
25
|
compareAtPrice: number;
|
|
13
26
|
isSale: boolean;
|
|
14
27
|
};
|
|
28
|
+
export {};
|
|
15
29
|
//# sourceMappingURL=price.d.ts.map
|
package/dist/lib/price.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../lib/price.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../lib/price.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAG1D,KAAK,KAAK,GAAG;IACX,gBAAgB,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAC5C,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,WAAW,EAAE,MAAM,EAAE,CAAA;IAErB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAGD,KAAK,WAAW,GAAG;KAChB,GAAG,IAAI,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE;CAC9C,CAAA;AAGD,eAAO,MAAM,gCAAgC,oBAC1B,cAAc,EAAE,mBAelC,CAAA;AAED,eAAO,MAAM,oBAAoB,iBAClB,WAAW,gBACX,MAAM,EAAE,KACpB,KAAK,GAAG,SAqBV,CAAA;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO;WAsBtC,MAAM;YACL,OAAO;;;;EAclB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO;;;;EAQ1C"}
|
package/dist/lib/price.js
CHANGED
|
@@ -11,6 +11,25 @@ export const getCheapestProductFromVariantsFn = (productVariants) => {
|
|
|
11
11
|
: lowest;
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
|
+
export const getBadgeForProductFn = (badgeConfig = {}, productTags = []) => {
|
|
15
|
+
const badgePositions = ["below", "bottom", "top"];
|
|
16
|
+
const badgesCombined = [];
|
|
17
|
+
const addBadgesToCombined = (badgePosition) => {
|
|
18
|
+
var _a;
|
|
19
|
+
return (_a = badgeConfig[badgePosition]) === null || _a === void 0 ? void 0 : _a.forEach((badge) => badgesCombined.push(Object.assign(Object.assign({}, badge), { verticalPosition: badgePosition })));
|
|
20
|
+
};
|
|
21
|
+
badgePositions.forEach(addBadgesToCombined);
|
|
22
|
+
badgesCombined.sort((a, b) => a.priority - b.priority);
|
|
23
|
+
let productBadge = badgesCombined.find((badge) => {
|
|
24
|
+
if (productTags.includes(badge.tags[0])) {
|
|
25
|
+
if (productTags.includes(badge.excludeTags[0]))
|
|
26
|
+
return false;
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
});
|
|
31
|
+
return productBadge;
|
|
32
|
+
};
|
|
14
33
|
export function getPriceRangesFn(product) {
|
|
15
34
|
const { minVariantPrice: minPrice, maxVariantPrice: maxPrice } = product.priceRange;
|
|
16
35
|
const { minVariantPrice: minCompareAt, maxVariantPrice: maxCompareAt } = product.compareAtPriceRange;
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -211,23 +211,6 @@ export declare const getInputPlaceholderTextProps: (placeholderText: TextStyle)
|
|
|
211
211
|
placeholderFont: string;
|
|
212
212
|
placeholderFontWeight: string | number;
|
|
213
213
|
};
|
|
214
|
-
export type Badge = {
|
|
215
|
-
id: string;
|
|
216
|
-
horizontalPosition: string;
|
|
217
|
-
cornerRadius: string;
|
|
218
|
-
tags: string[];
|
|
219
|
-
fontColor: string;
|
|
220
|
-
backgroundColor: string;
|
|
221
|
-
excludeTags: string[];
|
|
222
|
-
text: string;
|
|
223
|
-
priority: number;
|
|
224
|
-
image: {
|
|
225
|
-
type: string;
|
|
226
|
-
url: string;
|
|
227
|
-
} | null;
|
|
228
|
-
verticalPosition: string;
|
|
229
|
-
};
|
|
230
|
-
export declare const getBadgesForProductFn: (badgeConfig?: Record<string, Badge[]>, productTags?: string[]) => Badge[];
|
|
231
214
|
export declare function gidFromId(id: string): string;
|
|
232
215
|
export declare const countNumberOfTagsInState: (state: ConditionalSelectorValues) => number;
|
|
233
216
|
type Location = {
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,4BAA4B,EAC5B,yBAAyB,EACzB,UAAU,EACV,eAAe,EACf,OAAO,EACP,QAAQ,EACR,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAA;AAMvC,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,MAA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(placeholderText) => {
|
|
|
281
281
|
: placeholderText.font.weight,
|
|
282
282
|
};
|
|
283
283
|
};
|
|
284
|
-
export const getBadgesForProductFn = (badgeConfig = {}, productTags = []) => {
|
|
285
|
-
const badgePositions = ["below", "bottom", "top"];
|
|
286
|
-
const badgesCombined = [];
|
|
287
|
-
const addBadgesToCombined = (badgePosition) => {
|
|
288
|
-
var _a;
|
|
289
|
-
return (_a = badgeConfig[badgePosition]) === null || _a === void 0 ? void 0 : _a.forEach((badge) => badgesCombined.push(Object.assign(Object.assign({}, badge), { verticalPosition: badgePosition })));
|
|
290
|
-
};
|
|
291
|
-
badgePositions.forEach(addBadgesToCombined);
|
|
292
|
-
badgesCombined.sort((a, b) => a.priority - b.priority);
|
|
293
|
-
const filterBadges = badgesCombined.filter((badge) => {
|
|
294
|
-
if (productTags.includes(badge.tags[0])) {
|
|
295
|
-
if (productTags.includes(badge.excludeTags[0]))
|
|
296
|
-
return false;
|
|
297
|
-
return true;
|
|
298
|
-
}
|
|
299
|
-
return false;
|
|
300
|
-
});
|
|
301
|
-
const productBadges = filterBadges.reduce((acc, badge) => {
|
|
302
|
-
const { verticalPosition, horizontalPosition } = badge;
|
|
303
|
-
const key = `${verticalPosition}-${horizontalPosition}`;
|
|
304
|
-
if (!acc[key]) {
|
|
305
|
-
acc[key] = badge;
|
|
306
|
-
}
|
|
307
|
-
else if (badge.priority < acc[key].priority) {
|
|
308
|
-
acc[key] = badge;
|
|
309
|
-
}
|
|
310
|
-
return acc;
|
|
311
|
-
}, {});
|
|
312
|
-
return Object.values(productBadges);
|
|
313
|
-
};
|
|
314
284
|
// #endregion =-=-=-= END BLOCK UTILS =-=-=-=
|
|
315
285
|
// --- Start (Block conditional rendering util functions) ----
|
|
316
286
|
export function gidFromId(id) {
|
package/dist/styles.css
CHANGED
|
@@ -1209,21 +1209,6 @@ video {
|
|
|
1209
1209
|
.transform {
|
|
1210
1210
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1211
1211
|
}
|
|
1212
|
-
@keyframes bounce {
|
|
1213
|
-
|
|
1214
|
-
0%, 100% {
|
|
1215
|
-
transform: translateY(-25%);
|
|
1216
|
-
animation-timing-function: cubic-bezier(0.8,0,1,1);
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
|
-
50% {
|
|
1220
|
-
transform: none;
|
|
1221
|
-
animation-timing-function: cubic-bezier(0,0,0.2,1);
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
.animate-bounce {
|
|
1225
|
-
animation: bounce 1s infinite;
|
|
1226
|
-
}
|
|
1227
1212
|
@keyframes pulse {
|
|
1228
1213
|
|
|
1229
1214
|
50% {
|
|
@@ -1647,9 +1632,6 @@ video {
|
|
|
1647
1632
|
--tw-bg-opacity: 1;
|
|
1648
1633
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
1649
1634
|
}
|
|
1650
|
-
.bg-opacity-70 {
|
|
1651
|
-
--tw-bg-opacity: 0.7;
|
|
1652
|
-
}
|
|
1653
1635
|
.bg-fade-left {
|
|
1654
1636
|
background-image: linear-gradient(to right, var(--coreColors-pageColor) 0%, #ffffff00 100%);;
|
|
1655
1637
|
}
|
|
@@ -1750,6 +1732,9 @@ video {
|
|
|
1750
1732
|
.pb-0 {
|
|
1751
1733
|
padding-bottom: 0px;
|
|
1752
1734
|
}
|
|
1735
|
+
.pb-1 {
|
|
1736
|
+
padding-bottom: 0.25rem;
|
|
1737
|
+
}
|
|
1753
1738
|
.pb-2 {
|
|
1754
1739
|
padding-bottom: 0.5rem;
|
|
1755
1740
|
}
|
|
@@ -1874,8 +1859,8 @@ video {
|
|
|
1874
1859
|
.leading-6 {
|
|
1875
1860
|
line-height: 1.5rem;
|
|
1876
1861
|
}
|
|
1877
|
-
.leading-\[
|
|
1878
|
-
line-height:
|
|
1862
|
+
.leading-\[130\%\] {
|
|
1863
|
+
line-height: 130%;
|
|
1879
1864
|
}
|
|
1880
1865
|
.leading-\[13px\] {
|
|
1881
1866
|
line-height: 13px;
|
|
@@ -2219,12 +2204,6 @@ video {
|
|
|
2219
2204
|
.\[-ms-overflow-style\:none\] {
|
|
2220
2205
|
-ms-overflow-style: none;
|
|
2221
2206
|
}
|
|
2222
|
-
.\[animation-delay\:-0\.15s\] {
|
|
2223
|
-
animation-delay: -0.15s;
|
|
2224
|
-
}
|
|
2225
|
-
.\[animation-delay\:-0\.3s\] {
|
|
2226
|
-
animation-delay: -0.3s;
|
|
2227
|
-
}
|
|
2228
2207
|
.\[scrollbar-width\:none\] {
|
|
2229
2208
|
scrollbar-width: none;
|
|
2230
2209
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.74",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -11,6 +11,20 @@
|
|
|
11
11
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
12
12
|
"author": "Tapcart Inc.",
|
|
13
13
|
"homepage": "https://tapcart.com",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"clean": "rm -rf dist node_modules",
|
|
16
|
+
"lint": "eslint \"**/*.ts*\"",
|
|
17
|
+
"ui:add": "pnpm dlx shadcn-ui@latest add",
|
|
18
|
+
"build:styles": "postcss styles/globals.css -o dist/styles.css",
|
|
19
|
+
"build:ts": "tsc -p tsconfig.json && tsc-alias",
|
|
20
|
+
"build": "pnpm run build:ts && pnpm run build:styles",
|
|
21
|
+
"dev:ts": "tsc -w -p tsconfig.json",
|
|
22
|
+
"dev:styles": "npx tailwindcss -i styles/globals.css -o dist/styles.css --watch",
|
|
23
|
+
"dev": "concurrently \"pnpm run dev:ts\" \"pnpm run dev:styles\"",
|
|
24
|
+
"test": "jest",
|
|
25
|
+
"test:silent": "jest --silent",
|
|
26
|
+
"test:watch": "jest --watch"
|
|
27
|
+
},
|
|
14
28
|
"peerDependencies": {
|
|
15
29
|
"react": "^17.0.2 || ^18.0.0",
|
|
16
30
|
"react-dom": "^17.0.2 || ^18.0.0"
|
|
@@ -23,20 +37,20 @@
|
|
|
23
37
|
"@types/pluralize": "^0.0.33",
|
|
24
38
|
"@types/react": "^18.2.0",
|
|
25
39
|
"@types/react-dom": "^18.2.0",
|
|
40
|
+
"app-studio-types": "workspace:*",
|
|
26
41
|
"autoprefixer": "^10.4.14",
|
|
27
42
|
"chokidar-cli": "^3.0.0",
|
|
28
43
|
"concurrently": "^8.2.2",
|
|
29
44
|
"eslint": "^7.32.0",
|
|
45
|
+
"eslint-config-custom": "workspace:*",
|
|
30
46
|
"jest": "^29.7.0",
|
|
31
47
|
"jest-environment-jsdom": "^29.7.0",
|
|
32
48
|
"postcss": "^8.4.24",
|
|
33
49
|
"tailwindcss": "^3.3.2",
|
|
34
50
|
"ts-jest": "^29.2.5",
|
|
35
51
|
"tsc-alias": "^1.8.10",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"tsconfig": "0.0.0",
|
|
39
|
-
"eslint-config-custom": "0.0.0"
|
|
52
|
+
"tsconfig": "workspace:*",
|
|
53
|
+
"typescript": "^4.5.2"
|
|
40
54
|
},
|
|
41
55
|
"dependencies": {
|
|
42
56
|
"@radix-ui/react-accordion": "^1.1.2",
|
|
@@ -77,18 +91,8 @@
|
|
|
77
91
|
"tailwindcss-animate": "^1.0.6",
|
|
78
92
|
"vaul": "0.9.1"
|
|
79
93
|
},
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"ui:add": "pnpm dlx shadcn-ui@latest add",
|
|
84
|
-
"build:styles": "postcss styles/globals.css -o dist/styles.css",
|
|
85
|
-
"build:ts": "tsc -p tsconfig.json && tsc-alias",
|
|
86
|
-
"build": "pnpm run build:ts && pnpm run build:styles",
|
|
87
|
-
"dev:ts": "tsc -w -p tsconfig.json",
|
|
88
|
-
"dev:styles": "npx tailwindcss -i styles/globals.css -o dist/styles.css --watch",
|
|
89
|
-
"dev": "concurrently \"pnpm run dev:ts\" \"pnpm run dev:styles\"",
|
|
90
|
-
"test": "jest",
|
|
91
|
-
"test:silent": "jest --silent",
|
|
92
|
-
"test:watch": "jest --watch"
|
|
94
|
+
"publishConfig": {
|
|
95
|
+
"access": "public",
|
|
96
|
+
"registry": "https://registry.npmjs.org/"
|
|
93
97
|
}
|
|
94
|
-
}
|
|
98
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-click-outside.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-click-outside.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAE,IAAI,CAa5F"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
import React from "react"
|
|
3
|
-
export function useClickOutside(ref, callback) {
|
|
4
|
-
React.useEffect(() => {
|
|
5
|
-
const handleClickOutside = (event) => {
|
|
6
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
7
|
-
callback()
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
document.addEventListener("mousedown", handleClickOutside)
|
|
11
|
-
return () => {
|
|
12
|
-
document.removeEventListener("mousedown", handleClickOutside)
|
|
13
|
-
}
|
|
14
|
-
}, [ref, callback])
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-outside-click.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-outside-click.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,QAAA,MAAM,eAAe,QAAS,MAAM,SAAS,CAAC,WAAW,CAAC,YAAY,MAAM,IAAI,SAa/E,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
import React from "react"
|
|
3
|
-
const useClickOutside = (ref, callback) => {
|
|
4
|
-
React.useEffect(() => {
|
|
5
|
-
const handleClickOutside = (event) => {
|
|
6
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
7
|
-
callback()
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
document.addEventListener("mousedown", handleClickOutside)
|
|
11
|
-
return () => {
|
|
12
|
-
document.removeEventListener("mousedown", handleClickOutside)
|
|
13
|
-
}
|
|
14
|
-
}, [ref, callback])
|
|
15
|
-
}
|
|
16
|
-
export default useClickOutside
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-tap.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-tap.ts"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAuFvE,QAAA,MAAM,MAAM;6BAuBkC,GAAG,KAAK,IAAI,aACvC,GAAG;;;CAerB,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
import { useState, useEffect, useCallback, useRef } from "react"
|
|
3
|
-
// Shared manager for all instances of the hook
|
|
4
|
-
const tapManager = (() => {
|
|
5
|
-
const elements = new Map()
|
|
6
|
-
let isListening = false
|
|
7
|
-
const startListening = () => {
|
|
8
|
-
if (isListening) return
|
|
9
|
-
const handleTouchStart = (e) => {
|
|
10
|
-
const touch = e.touches[0]
|
|
11
|
-
elements.forEach((data, el) => {
|
|
12
|
-
if (el.contains(touch.target)) {
|
|
13
|
-
data.touchStarted = true
|
|
14
|
-
data.touchMoved = false
|
|
15
|
-
data.startPosition = { x: touch.clientX, y: touch.clientY }
|
|
16
|
-
// Don't set isPressed here, wait to determine if it's a tap or drag
|
|
17
|
-
}
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
const handleTouchMove = (e) => {
|
|
21
|
-
const touch = e.touches[0]
|
|
22
|
-
elements.forEach((data, el) => {
|
|
23
|
-
if (data.touchStarted) {
|
|
24
|
-
const deltaX = Math.abs(touch.clientX - data.startPosition.x)
|
|
25
|
-
const deltaY = Math.abs(touch.clientY - data.startPosition.y)
|
|
26
|
-
if (deltaX > data.tapThreshold || deltaY > data.tapThreshold) {
|
|
27
|
-
data.touchMoved = true
|
|
28
|
-
data.setIsPressed(false)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
const handleTouchEnd = () => {
|
|
34
|
-
elements.forEach((data) => {
|
|
35
|
-
if (data.touchStarted) {
|
|
36
|
-
data.touchStarted = false
|
|
37
|
-
if (!data.touchMoved) {
|
|
38
|
-
// It's a tap, set isPressed briefly
|
|
39
|
-
data.setIsPressed(true)
|
|
40
|
-
setTimeout(() => data.setIsPressed(false), 100)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
document.addEventListener("touchstart", (e) => handleTouchStart(e), {
|
|
46
|
-
passive: true,
|
|
47
|
-
})
|
|
48
|
-
document.addEventListener("touchmove", (e) => handleTouchMove(e), {
|
|
49
|
-
passive: true,
|
|
50
|
-
})
|
|
51
|
-
document.addEventListener("touchend", () => handleTouchEnd(), {
|
|
52
|
-
passive: true,
|
|
53
|
-
})
|
|
54
|
-
isListening = true
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
register: (el, data) => {
|
|
58
|
-
elements.set(el, data)
|
|
59
|
-
startListening()
|
|
60
|
-
},
|
|
61
|
-
unregister: (el) => {
|
|
62
|
-
elements.delete(el)
|
|
63
|
-
},
|
|
64
|
-
elements,
|
|
65
|
-
}
|
|
66
|
-
})()
|
|
67
|
-
const useTap = (tapThreshold = 10) => {
|
|
68
|
-
const [isPressed, setIsPressed] = useState(false)
|
|
69
|
-
const elementRef = useRef(null)
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
const element = elementRef.current
|
|
72
|
-
if (!element) return
|
|
73
|
-
const data = {
|
|
74
|
-
touchStarted: false,
|
|
75
|
-
touchMoved: false,
|
|
76
|
-
startPosition: { x: 0, y: 0 },
|
|
77
|
-
setIsPressed,
|
|
78
|
-
tapThreshold,
|
|
79
|
-
}
|
|
80
|
-
tapManager.register(element, data)
|
|
81
|
-
return () => {
|
|
82
|
-
tapManager.unregister(element)
|
|
83
|
-
}
|
|
84
|
-
}, [tapThreshold])
|
|
85
|
-
const onTap = useCallback((handler) => {
|
|
86
|
-
return (event) => {
|
|
87
|
-
const data = tapManager.elements.get(elementRef.current)
|
|
88
|
-
if (!data) return
|
|
89
|
-
if (event.type === "touchend" && !data.touchMoved) {
|
|
90
|
-
handler(event)
|
|
91
|
-
} else if (event.type === "click" && !data.touchStarted) {
|
|
92
|
-
handler(event)
|
|
93
|
-
setIsPressed(true)
|
|
94
|
-
setTimeout(() => setIsPressed(false), 100)
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}, [])
|
|
98
|
-
return { onTap, isPressed, ref: elementRef }
|
|
99
|
-
}
|
|
100
|
-
export { useTap }
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface LoadingDotsProps {
|
|
2
|
-
iconColor: string;
|
|
3
|
-
size?: number;
|
|
4
|
-
spacing?: 0 | 1 | 2 | 4;
|
|
5
|
-
opacity?: number;
|
|
6
|
-
show?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const LoadingDots: ({ iconColor, size, spacing, opacity, show, }: LoadingDotsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
-
//# sourceMappingURL=loading-dots.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loading-dots.d.ts","sourceRoot":"","sources":["../../../components/ui/loading-dots.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,eAAO,MAAM,WAAW,iDAMrB,gBAAgB,mDAyClB,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export const LoadingDots = ({ iconColor, size = 4, spacing = 1, opacity = 0.8, show = false, }) => {
|
|
4
|
-
const [showLoadingDots, setShowLoadingDots] = React.useState(show);
|
|
5
|
-
const [isAnimatingOut, setIsAnimatingOut] = React.useState(false);
|
|
6
|
-
React.useEffect(() => {
|
|
7
|
-
if (!show) {
|
|
8
|
-
setIsAnimatingOut(true);
|
|
9
|
-
setTimeout(() => {
|
|
10
|
-
setShowLoadingDots(false);
|
|
11
|
-
setIsAnimatingOut(false);
|
|
12
|
-
}, 300); // Match animation duration
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
setShowLoadingDots(true);
|
|
16
|
-
setIsAnimatingOut(false);
|
|
17
|
-
}
|
|
18
|
-
}, [show]);
|
|
19
|
-
if (!showLoadingDots)
|
|
20
|
-
return null;
|
|
21
|
-
return (_jsx("div", Object.assign({ className: `absolute inset-0 flex items-center justify-center bg-white bg-opacity-70 ${isAnimatingOut ? "animate-fadeOut" : "animate-fadeIn"}` }, { children: _jsxs("div", Object.assign({ className: `flex space-x-${spacing}` }, { children: [_jsx("div", { style: { backgroundColor: iconColor, opacity: opacity }, className: `h-${size} w-${size} bg-black rounded-full animate-bounce [animation-delay:-0.3s]` }), _jsx("div", { style: { backgroundColor: iconColor, opacity: opacity }, className: `h-${size} w-${size} bg-black rounded-full animate-bounce [animation-delay:-0.15s]` }), _jsx("div", { style: { backgroundColor: iconColor, opacity: opacity }, className: `h-${size} w-${size} bg-black rounded-full animate-bounce` })] })) })));
|
|
22
|
-
};
|