@tapcart/mobile-components 0.7.67 → 0.7.69
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-click-outside.d.ts +6 -0
- package/dist/components/hooks/use-click-outside.d.ts.map +1 -0
- package/dist/components/hooks/use-click-outside.js +15 -0
- package/dist/components/hooks/use-outside-click.d.ts +7 -0
- package/dist/components/hooks/use-outside-click.d.ts.map +1 -0
- package/dist/components/hooks/use-outside-click.js +16 -0
- package/dist/components/hooks/use-tap.d.ts +8 -0
- package/dist/components/hooks/use-tap.d.ts.map +1 -0
- package/dist/components/hooks/use-tap.js +100 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +5 -4
- package/dist/components/ui/empty-message.d.ts +2 -1
- package/dist/components/ui/empty-message.d.ts.map +1 -1
- package/dist/components/ui/empty-message.js +2 -2
- package/dist/components/ui/quantity-picker.d.ts +1 -0
- package/dist/components/ui/quantity-picker.d.ts.map +1 -1
- package/dist/components/ui/quantity-picker.js +10 -2
- package/dist/components/ui/virtual-grid.d.ts +1 -1
- package/dist/components/ui/virtual-grid.d.ts.map +1 -1
- package/dist/components/ui/virtual-grid.js +33 -36
- package/dist/components/ui/wishlist.d.ts +6 -1
- package/dist/components/ui/wishlist.d.ts.map +1 -1
- package/dist/components/ui/wishlist.js +17 -4
- package/dist/styles.css +3 -0
- package/package.json +20 -20
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,100 @@
|
|
|
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 }
|
|
@@ -13,7 +13,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
13
13
|
labelClassName?: string;
|
|
14
14
|
labelStyle?: React.CSSProperties | undefined;
|
|
15
15
|
iconColor?: string;
|
|
16
|
-
iconSize?:
|
|
16
|
+
iconSize?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
17
17
|
iconStrokeColor?: string;
|
|
18
18
|
iconClassName?: string;
|
|
19
19
|
iconPosition?: "left" | "right";
|
|
@@ -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;AAMxB,QAAA,MAAM,cAAc;;;mFAgCnB,CAAA;AAwCD,MAAM,WAAW,WACf,SAAQ,KAAK,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,
|
|
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;AAMxB,QAAA,MAAM,cAAc;;;mFAgCnB,CAAA;AAwCD,MAAM,WAAW,WACf,SAAQ,KAAK,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,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAA;IACvD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CAC9D;AAED,QAAA,MAAM,MAAM,uFA0GX,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"}
|
|
@@ -18,14 +18,14 @@ import { Icon } from "./icon";
|
|
|
18
18
|
import { Text } from "./text";
|
|
19
19
|
import { useTap } from "./tap";
|
|
20
20
|
import { useMergeRefs } from "../hooks/use-merge-refs";
|
|
21
|
-
const buttonVariants = cva("w-full flex rounded items-center justify-center transition-colors disabled:bg-stateColors-disabled disabled:border-stateColors-disabled disabled:pointer-events-none ring-offset-background overflow-elipse whitespace-nowrap truncate
|
|
21
|
+
const buttonVariants = cva("w-full flex rounded items-center justify-center transition-colors disabled:bg-stateColors-disabled disabled:border-stateColors-disabled disabled:pointer-events-none ring-offset-background overflow-elipse whitespace-nowrap truncate disabled:opacity-70 cursor-pointer", {
|
|
22
22
|
variants: {
|
|
23
23
|
size: {
|
|
24
|
-
default: "py-
|
|
24
|
+
default: "py-2 px-3",
|
|
25
25
|
sm: "px-3 rounded-md",
|
|
26
26
|
lg: "px-8 rounded-md",
|
|
27
27
|
icon: "p-3 w-auto",
|
|
28
|
-
content: "py-
|
|
28
|
+
content: "py-2 px-4 w-auto",
|
|
29
29
|
},
|
|
30
30
|
variant: {
|
|
31
31
|
default: "bg-buttonColors-primaryFill border border-buttonColors-primaryOutlineColor shadow-primary",
|
|
@@ -86,7 +86,8 @@ const Button = React.forwardRef((_a, ref) => {
|
|
|
86
86
|
const mergedRef = useMergeRefs(ref, tapRef);
|
|
87
87
|
const Comp = asChild ? Slot : "button";
|
|
88
88
|
const IconButton = () => icon || iconUrl ? (_jsx(Icon, { name: icon, url: iconUrl, size: "sm", style: { color: iconColor } })) : null;
|
|
89
|
-
|
|
89
|
+
// TODO: need to refactor icon sizing. This isnt extensible.
|
|
90
|
+
const BasicButton = () => (_jsxs(_Fragment, { children: [icon || iconUrl ? (_jsx(Icon, { name: iconUrl ? undefined : icon, url: iconUrl, size: iconSize ? iconSize : "sm", className: cn(iconVariants({ variant }), {
|
|
90
91
|
"mr-2": iconPosition === "left",
|
|
91
92
|
"ml-2": iconPosition === "right",
|
|
92
93
|
}, iconClassName), style: { color: iconColor } })) : null, !loading ? (_jsx(Text, Object.assign({ type: "body-primary", className: cn(labelVariants({ variant }), labelClassName), style: labelStyle }, { children: props.children }))) : (_jsx(_Fragment, {}))] }));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface EmptyMessageProps {
|
|
2
2
|
iconName: string;
|
|
3
|
+
iconUrl: string;
|
|
3
4
|
title: string;
|
|
4
5
|
description: string;
|
|
5
6
|
className?: string;
|
|
@@ -17,6 +18,6 @@ interface Destination {
|
|
|
17
18
|
interface OpenScreenParams {
|
|
18
19
|
destination: Destination;
|
|
19
20
|
}
|
|
20
|
-
declare function EmptyMessage({ iconName, title, description, className, buttonLabel, openScreen, usePathname, useRouter, useSearchParams, }: EmptyMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function EmptyMessage({ iconName, iconUrl, title, description, className, buttonLabel, openScreen, usePathname, useRouter, useSearchParams, }: EmptyMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
export { EmptyMessage };
|
|
22
23
|
//# sourceMappingURL=empty-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-message.d.ts","sourceRoot":"","sources":["../../../components/ui/empty-message.tsx"],"names":[],"mappings":"AAOA,UAAU,iBAAiB;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC9C,WAAW,EAAE,MAAM,MAAM,CAAA;IACzB,SAAS,EAAE,MAAM,MAAM,EAAE,CAAA;IACzB,eAAe,EAAE,MAAM,MAAM,CAAA;CAC9B;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,UAAU,GAAG,UAAU,CAAA;IAC7B,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,UAAU,gBAAgB;IACxB,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,iBAAS,YAAY,CAAC,EACpB,QAAQ,EACR,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,UAAU,EACV,WAAsB,EACtB,SAAoB,EACpB,eAA0B,GAC3B,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"empty-message.d.ts","sourceRoot":"","sources":["../../../components/ui/empty-message.tsx"],"names":[],"mappings":"AAOA,UAAU,iBAAiB;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC9C,WAAW,EAAE,MAAM,MAAM,CAAA;IACzB,SAAS,EAAE,MAAM,MAAM,EAAE,CAAA;IACzB,eAAe,EAAE,MAAM,MAAM,CAAA;CAC9B;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,UAAU,GAAG,UAAU,CAAA;IAC7B,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,UAAU,gBAAgB;IACxB,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,iBAAS,YAAY,CAAC,EACpB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,UAAU,EACV,WAAsB,EACtB,SAAoB,EACpB,eAA0B,GAC3B,EAAE,iBAAiB,2CAwGnB;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -5,7 +5,7 @@ import { Icon } from "./icon";
|
|
|
5
5
|
import { Text } from "./text";
|
|
6
6
|
import { cn } from "../../lib/utils";
|
|
7
7
|
import { useState, useEffect } from "react";
|
|
8
|
-
function EmptyMessage({ iconName, title, description, className, buttonLabel, openScreen, usePathname = () => "", useRouter = () => [], useSearchParams = () => "", }) {
|
|
8
|
+
function EmptyMessage({ iconName, iconUrl, title, description, className, buttonLabel, openScreen, usePathname = () => "", useRouter = () => [], useSearchParams = () => "", }) {
|
|
9
9
|
const [clickCount, setClickCount] = useState(0);
|
|
10
10
|
const router = useRouter();
|
|
11
11
|
const pathname = usePathname();
|
|
@@ -70,6 +70,6 @@ function EmptyMessage({ iconName, title, description, className, buttonLabel, op
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
return (_jsxs("div", Object.assign({ className: cn("flex-grow flex flex-col justify-center items-center gap-4 h-full", className), onClick: handlePageClick }, { children: [_jsxs("div", Object.assign({ className: "flex flex-col justify-center items-center gap-2" }, { children: [_jsx(Icon, { name: iconName, size: "md", color: "coreColors-secondaryIcon" }), _jsx(Text, Object.assign({ type: "h2", className: "text-textColors-primaryColor text-center" }, { children: title })), _jsx(Text, Object.assign({ type: "body-primary", className: "text-textColors-secondaryColor text-center" }, { children: description }))] })), buttonLabel ? (_jsx(Button, Object.assign({ variant: "default", onClick: onClick, className: "w-auto" }, { children: buttonLabel }))) : null] })));
|
|
73
|
+
return (_jsxs("div", Object.assign({ className: cn("flex-grow flex flex-col justify-center items-center gap-4 h-full", className), onClick: handlePageClick }, { children: [_jsxs("div", Object.assign({ className: "flex flex-col justify-center items-center gap-2" }, { children: [_jsx(Icon, { url: iconUrl, name: iconName, size: "md", color: "coreColors-secondaryIcon" }), _jsx(Text, Object.assign({ type: "h2", className: "text-textColors-primaryColor text-center" }, { children: title })), _jsx(Text, Object.assign({ type: "body-primary", className: "text-textColors-secondaryColor text-center" }, { children: description }))] })), buttonLabel ? (_jsx(Button, Object.assign({ variant: "default", onClick: onClick, className: "w-auto" }, { children: buttonLabel }))) : null] })));
|
|
74
74
|
}
|
|
75
75
|
export { EmptyMessage };
|
|
@@ -15,6 +15,7 @@ export interface QuantityPickerProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
15
15
|
inputStyle?: React.CSSProperties;
|
|
16
16
|
buttonStyle?: React.CSSProperties;
|
|
17
17
|
buttonCornerRadius?: number;
|
|
18
|
+
max?: number;
|
|
18
19
|
}
|
|
19
20
|
declare const QuantityPicker: React.ForwardRefExoticComponent<QuantityPickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
21
|
export { QuantityPicker };
|
|
@@ -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;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;
|
|
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"}
|
|
@@ -22,7 +22,9 @@ const IconButton = ({ iconUrl, iconColor, handler, className, style, disabled })
|
|
|
22
22
|
} }) })));
|
|
23
23
|
};
|
|
24
24
|
const QuantityPicker = React.forwardRef((_a, ref) => {
|
|
25
|
-
var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, isDecreaseDisabled, isIncreaseDisabled, value, setValue, inputStyle, buttonStyle, buttonCornerRadius = 4 } = _a, props = __rest(_a, ["className", "decreaseIconUrl", "increaseIconUrl", "deleteIconUrl", "isDeleteOnly", "iconColor", "onDecreaseClick", "onIncreaseClick", "isDecreaseDisabled", "isIncreaseDisabled", "value", "setValue", "inputStyle", "buttonStyle", "buttonCornerRadius"]);
|
|
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"]);
|
|
26
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
27
|
+
const [localValue, setLocalValue] = React.useState(value);
|
|
26
28
|
const leftButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderTopLeftRadius: buttonCornerRadius
|
|
27
29
|
? `${buttonCornerRadius}px`
|
|
28
30
|
: undefined, borderBottomLeftRadius: buttonCornerRadius
|
|
@@ -34,7 +36,13 @@ const QuantityPicker = React.forwardRef((_a, ref) => {
|
|
|
34
36
|
? `${buttonCornerRadius}px`
|
|
35
37
|
: undefined });
|
|
36
38
|
const singleButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderRadius: buttonCornerRadius ? `${buttonCornerRadius}px` : undefined });
|
|
37
|
-
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: "
|
|
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 })] })) })));
|
|
38
46
|
});
|
|
39
47
|
QuantityPicker.displayName = "QuantityPicker";
|
|
40
48
|
export { QuantityPicker };
|
|
@@ -13,6 +13,6 @@ declare const virtualGridVariants: (props?: ({
|
|
|
13
13
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
14
14
|
export interface VirtualGridProps extends GridType, VariantProps<typeof virtualGridVariants> {
|
|
15
15
|
}
|
|
16
|
-
declare function VirtualGrid({ className, columns, children, overscan, estimatedHeight, isLoadingMore, loaderItem,
|
|
16
|
+
declare function VirtualGrid({ className, columns, children, overscan, estimatedHeight, isLoadingMore, loaderItem, }: VirtualGridProps): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export { VirtualGrid, virtualGridVariants };
|
|
18
18
|
//# sourceMappingURL=virtual-grid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/virtual-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"virtual-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/virtual-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,UAAU,QAAQ;IAChB,SAAS,EAAE,GAAG,CAAA;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,QAAA,MAAM,mBAAmB;;mFAYvB,CAAA;AAEF,MAAM,WAAW,gBACf,SAAQ,QAAQ,EACd,YAAY,CAAC,OAAO,mBAAmB,CAAC;CAAG;AAE/C,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAY,EACZ,eAAqB,EACrB,aAAa,EACb,UAAU,GACX,EAAE,gBAAgB,2CA4ElB;AAED,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import * as React from "react";
|
|
14
3
|
import { cva } from "class-variance-authority";
|
|
15
|
-
import { Container } from "./container";
|
|
16
4
|
import { useVirtual } from "react-virtual";
|
|
17
5
|
import { cn } from "../../lib/utils";
|
|
18
6
|
const virtualGridVariants = cva("grid", {
|
|
@@ -28,38 +16,47 @@ const virtualGridVariants = cva("grid", {
|
|
|
28
16
|
columns: 2,
|
|
29
17
|
},
|
|
30
18
|
});
|
|
31
|
-
function VirtualGrid(
|
|
32
|
-
|
|
33
|
-
const NUM_LOADER_ITEMS = 8;
|
|
19
|
+
function VirtualGrid({ className, columns, children, overscan = 4, estimatedHeight = 375, isLoadingMore, loaderItem, }) {
|
|
20
|
+
const NUM_LOADER_ITEMS = columns || 2;
|
|
34
21
|
const col = columns || 2;
|
|
35
|
-
const parentRef = React.useRef(
|
|
22
|
+
const parentRef = React.useRef(document.getElementById("tc-vgsl"));
|
|
36
23
|
const childrenArray = React.Children.toArray(children);
|
|
37
24
|
const rowCount = Math.ceil(childrenArray.length / col);
|
|
38
|
-
const
|
|
39
|
-
const totalItems = isLoadingMore ? rowCount + loaderRowCount : rowCount;
|
|
25
|
+
const totalItems = rowCount + (isLoadingMore ? 1 : 0);
|
|
40
26
|
const rowVirtualizer = useVirtual({
|
|
41
27
|
size: totalItems,
|
|
42
28
|
parentRef,
|
|
43
29
|
estimateSize: React.useCallback(() => estimatedHeight, []),
|
|
44
30
|
overscan,
|
|
31
|
+
initialRect: { width: 0, height: estimatedHeight },
|
|
45
32
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
33
|
+
return (_jsx("div", Object.assign({ style: {
|
|
34
|
+
width: "100%",
|
|
35
|
+
position: "relative",
|
|
36
|
+
willChange: "transform",
|
|
37
|
+
}, className: cn(virtualGridVariants({ columns }), className) }, { children: rowVirtualizer.virtualItems.map((virtualRow) => {
|
|
38
|
+
const rowStartIndex = virtualRow.index * col;
|
|
39
|
+
if (isLoadingMore && virtualRow.index === rowCount) {
|
|
40
|
+
return (_jsx("div", Object.assign({ style: {
|
|
41
|
+
position: "absolute",
|
|
42
|
+
top: 0,
|
|
43
|
+
left: 0,
|
|
44
|
+
width: "100%",
|
|
45
|
+
transform: `translateY(${virtualRow.start}px)`,
|
|
46
|
+
}, className: cn(virtualGridVariants({ columns })), ref: virtualRow.measureRef }, { children: Array.from({ length: NUM_LOADER_ITEMS }).map((_, index) => (_jsx("div", { children: loaderItem }, index))) }), `loader-row-${virtualRow.index}`));
|
|
47
|
+
}
|
|
48
|
+
return (_jsx("div", Object.assign({ className: cn(virtualGridVariants({ columns })), style: {
|
|
49
|
+
position: "absolute",
|
|
50
|
+
top: 0,
|
|
51
|
+
left: 0,
|
|
52
|
+
width: "100%",
|
|
53
|
+
transform: `translateY(${virtualRow.start}px)`,
|
|
54
|
+
}, ref: virtualRow.measureRef }, { children: Array.from({ length: col }).map((_, colIndex) => {
|
|
55
|
+
const index = rowStartIndex + colIndex;
|
|
56
|
+
if (index >= childrenArray.length)
|
|
57
|
+
return null;
|
|
58
|
+
return _jsx("div", { children: childrenArray[index] }, index);
|
|
59
|
+
}) }), `row-${virtualRow.index}`));
|
|
60
|
+
}) })));
|
|
64
61
|
}
|
|
65
62
|
export { VirtualGrid, virtualGridVariants };
|
|
@@ -7,6 +7,8 @@ export interface WishlistProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
7
7
|
onClick?: () => void;
|
|
8
8
|
className?: string;
|
|
9
9
|
imgUrl?: string;
|
|
10
|
+
imgRightBorderRadius?: number;
|
|
11
|
+
imgLeftBorderRadius?: number;
|
|
10
12
|
aspectRatio?: string;
|
|
11
13
|
objectFit?: "none" | "fit" | "fill" | "cover" | "contain" | "scale-down";
|
|
12
14
|
isTrigger?: boolean;
|
|
@@ -14,7 +16,10 @@ export interface WishlistProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
14
16
|
nameStyle?: React.CSSProperties;
|
|
15
17
|
amountStyle?: React.CSSProperties;
|
|
16
18
|
}
|
|
17
|
-
declare const PlaceholderIcon: (
|
|
19
|
+
declare const PlaceholderIcon: ({ rightBorderRadius, leftBorderRadius, }: {
|
|
20
|
+
rightBorderRadius?: number | undefined;
|
|
21
|
+
leftBorderRadius?: number | undefined;
|
|
22
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
18
23
|
declare const Wishlist: React.ForwardRefExoticComponent<WishlistProps & React.RefAttributes<HTMLButtonElement>>;
|
|
19
24
|
export interface CreateNewProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
20
25
|
selected?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wishlist.d.ts","sourceRoot":"","sources":["../../../components/ui/wishlist.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,CAAA;IACxE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,YAAY,CAAA;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC/B,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAClC;AAED,QAAA,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"wishlist.d.ts","sourceRoot":"","sources":["../../../components/ui/wishlist.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,CAAA;IACxE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,YAAY,CAAA;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC/B,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAClC;AAED,QAAA,MAAM,eAAe;;;6CAmBpB,CAAA;AAED,QAAA,MAAM,QAAQ,yFA0Fb,CAAA;AAID,MAAM,WAAW,cACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,YAAY,CAAA;CAC3B;AAED,QAAA,MAAM,SAAS,0FAwBd,CAAA;AAID,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -15,14 +15,27 @@ import * as React from "react";
|
|
|
15
15
|
import { Text } from "./text";
|
|
16
16
|
import { cn } from "../../lib/utils";
|
|
17
17
|
import { Icon } from "./icon";
|
|
18
|
-
const PlaceholderIcon = () => (_jsx("div", Object.assign({ className: "flex items-center justify-center h-10 w-10 bg-stateColors-skeleton rounded-sm", style: {
|
|
18
|
+
const PlaceholderIcon = ({ rightBorderRadius, leftBorderRadius, }) => (_jsx("div", Object.assign({ className: "flex items-center justify-center h-10 w-10 bg-stateColors-skeleton rounded-sm", style: {
|
|
19
19
|
flex: "0 1 auto",
|
|
20
|
+
borderTopRightRadius: `${rightBorderRadius}px`,
|
|
21
|
+
borderBottomRightRadius: `${rightBorderRadius}px`,
|
|
22
|
+
borderTopLeftRadius: `${leftBorderRadius}px`,
|
|
23
|
+
borderBottomLeftRadius: `${leftBorderRadius}px`,
|
|
20
24
|
} }, { children: _jsx(Icon, { name: "heart-filled", size: "sm", color: "coreColors-secondaryIcon" }) })));
|
|
21
25
|
const Wishlist = React.forwardRef((_a, ref) => {
|
|
22
|
-
var { selected = false, onClick, className, name, amount, imgUrl, aspectRatio, objectFit, isTrigger, translations, nameStyle, amountStyle } = _a, props = __rest(_a, ["selected", "onClick", "className", "name", "amount", "imgUrl", "aspectRatio", "objectFit", "isTrigger", "translations", "nameStyle", "amountStyle"]);
|
|
23
|
-
return (_jsxs("button", Object.assign({ className: cn("flex flex-row items-center px-4 py-2 w-full ", selected ? "bg-stateColors-skeleton" : "", className), ref: ref, onClick: onClick }, props, { children: [imgUrl ? (_jsx("div", Object.assign({ className: "h-10 w-10 border border-coreColors-dividingLines
|
|
26
|
+
var { selected = false, onClick, className, name, amount, imgUrl, imgRightBorderRadius = 4, imgLeftBorderRadius = 0, aspectRatio, objectFit, isTrigger, translations, nameStyle, amountStyle } = _a, props = __rest(_a, ["selected", "onClick", "className", "name", "amount", "imgUrl", "imgRightBorderRadius", "imgLeftBorderRadius", "aspectRatio", "objectFit", "isTrigger", "translations", "nameStyle", "amountStyle"]);
|
|
27
|
+
return (_jsxs("button", Object.assign({ className: cn("flex flex-row items-center px-4 py-2 w-full ", selected ? "bg-stateColors-skeleton" : "", className), ref: ref, onClick: onClick }, props, { children: [imgUrl ? (_jsx("div", Object.assign({ className: "h-10 w-10 border border-coreColors-dividingLines overflow-hidden", style: {
|
|
24
28
|
flex: "0 1 auto",
|
|
25
|
-
|
|
29
|
+
borderTopRightRadius: `${imgRightBorderRadius}px`,
|
|
30
|
+
borderBottomRightRadius: `${imgRightBorderRadius}px`,
|
|
31
|
+
borderTopLeftRadius: `${imgLeftBorderRadius}px`,
|
|
32
|
+
borderBottomLeftRadius: `${imgLeftBorderRadius}px`,
|
|
33
|
+
} }, { children: _jsx("img", { alt: "wishlist-image", src: `${imgUrl}?width=40`, width: 40, height: 40, className: cn("w-full h-full", objectFit === "contain" ? "object-contain" : "object-cover"), style: {
|
|
34
|
+
borderTopRightRadius: `${imgRightBorderRadius}px`,
|
|
35
|
+
borderBottomRightRadius: `${imgRightBorderRadius}px`,
|
|
36
|
+
borderTopLeftRadius: `${imgLeftBorderRadius}px`,
|
|
37
|
+
borderBottomLeftRadius: `${imgLeftBorderRadius}px`,
|
|
38
|
+
} }) }))) : (_jsx(PlaceholderIcon, { rightBorderRadius: imgRightBorderRadius, leftBorderRadius: imgLeftBorderRadius })), _jsxs("div", Object.assign({ className: "flex flex-col flex-1 items-start mx-2 overflow-hidden" }, { children: [isTrigger && _jsx(Text, Object.assign({ type: "body-secondary" }, { children: "Wishlists" })), _jsx(Text, Object.assign({ type: "body-secondary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: nameStyle }, { children: name })), !isTrigger && (_jsx(Text, Object.assign({ type: "label", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: amountStyle }, { children: `${amount} ${amount !== 1
|
|
26
39
|
? translations["checkout-summary-items"]
|
|
27
40
|
: translations["checkout-summary-item"]}` })))] }))] })));
|
|
28
41
|
});
|
package/dist/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.69",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -11,20 +11,6 @@
|
|
|
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
|
-
},
|
|
28
14
|
"peerDependencies": {
|
|
29
15
|
"react": "^17.0.2 || ^18.0.0",
|
|
30
16
|
"react-dom": "^17.0.2 || ^18.0.0"
|
|
@@ -37,20 +23,20 @@
|
|
|
37
23
|
"@types/pluralize": "^0.0.33",
|
|
38
24
|
"@types/react": "^18.2.0",
|
|
39
25
|
"@types/react-dom": "^18.2.0",
|
|
40
|
-
"app-studio-types": "workspace:*",
|
|
41
26
|
"autoprefixer": "^10.4.14",
|
|
42
27
|
"chokidar-cli": "^3.0.0",
|
|
43
28
|
"concurrently": "^8.2.2",
|
|
44
29
|
"eslint": "^7.32.0",
|
|
45
|
-
"eslint-config-custom": "workspace:*",
|
|
46
30
|
"jest": "^29.7.0",
|
|
47
31
|
"jest-environment-jsdom": "^29.7.0",
|
|
48
32
|
"postcss": "^8.4.24",
|
|
49
33
|
"tailwindcss": "^3.3.2",
|
|
50
34
|
"ts-jest": "^29.2.5",
|
|
51
35
|
"tsc-alias": "^1.8.10",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
36
|
+
"typescript": "^4.5.2",
|
|
37
|
+
"app-studio-types": "0.0.9",
|
|
38
|
+
"eslint-config-custom": "0.0.0",
|
|
39
|
+
"tsconfig": "0.0.0"
|
|
54
40
|
},
|
|
55
41
|
"dependencies": {
|
|
56
42
|
"@radix-ui/react-accordion": "^1.1.2",
|
|
@@ -90,5 +76,19 @@
|
|
|
90
76
|
"tailwind-merge": "^1.13.2",
|
|
91
77
|
"tailwindcss-animate": "^1.0.6",
|
|
92
78
|
"vaul": "0.9.1"
|
|
79
|
+
},
|
|
80
|
+
"scripts": {
|
|
81
|
+
"clean": "rm -rf dist node_modules",
|
|
82
|
+
"lint": "eslint \"**/*.ts*\"",
|
|
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"
|
|
93
93
|
}
|
|
94
|
-
}
|
|
94
|
+
}
|