@tapcart/mobile-components 0.7.5 → 0.7.7
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/drawer.d.ts +19 -10
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer.js +11 -8
- package/dist/styles.css +6 -6
- package/package.json +3 -3
- package/dist/components/hooks/use-destination.d.ts +0 -23
- package/dist/components/hooks/use-destination.d.ts.map +0 -1
- package/dist/components/hooks/use-destination.js +0 -13
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Drawer as DrawerPrimitive } from "vaul";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type
|
|
3
|
+
type DrawerTriggerProps = React.ComponentPropsWithoutRef<"button"> & {
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
};
|
|
6
|
+
type DrawerPortalProps = {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
type DrawerCloseProps = React.ComponentPropsWithoutRef<"button"> & {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const DrawerTrigger: React.FC<DrawerTriggerProps>;
|
|
13
|
+
declare const DrawerPortal: React.FC<DrawerPortalProps>;
|
|
14
|
+
declare const DrawerClose: React.FC<DrawerCloseProps>;
|
|
15
|
+
type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root> & {
|
|
16
|
+
containerRef?: HTMLElement | null;
|
|
17
|
+
};
|
|
7
18
|
declare const Drawer: {
|
|
8
|
-
({ shouldScaleBackground, ...props }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
({ shouldScaleBackground, containerRef, ...props }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
9
20
|
displayName: string;
|
|
10
21
|
};
|
|
11
|
-
declare const DrawerOverlay: React.ForwardRefExoticComponent<Omit<
|
|
22
|
+
declare const DrawerOverlay: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
12
23
|
backdropHexColor?: string | undefined;
|
|
13
24
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
-
declare const DrawerContentBase: React.ForwardRefExoticComponent<Omit<
|
|
15
|
-
onAnimationEnd?: ((open: boolean) => void) | undefined;
|
|
16
|
-
} & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
25
|
+
declare const DrawerContentBase: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
17
26
|
hideBackdrop?: boolean | undefined;
|
|
18
27
|
backdropHexColor?: string | undefined;
|
|
19
28
|
isSheet?: boolean | undefined;
|
|
@@ -22,7 +31,7 @@ declare const DrawerFooter: {
|
|
|
22
31
|
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
23
32
|
displayName: string;
|
|
24
33
|
};
|
|
25
|
-
declare const DrawerDescription: React.ForwardRefExoticComponent<Omit<
|
|
34
|
+
declare const DrawerDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
26
35
|
type DrawerHeaderProps = {
|
|
27
36
|
iconLeftName?: string;
|
|
28
37
|
iconRightName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../components/ui/drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,MAAM,CAAA;AAIhD,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../components/ui/drawer.tsx"],"names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AAM,aAAa;cAA8B,MAAM,SAAS;6CAE/D,CAAA;AAED,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,YAAY,GACb,CAAA"}
|
|
@@ -16,11 +16,14 @@ import { Drawer as DrawerPrimitive } from "vaul";
|
|
|
16
16
|
import { cn } from "../../lib/utils";
|
|
17
17
|
import { Icon } from "./icon";
|
|
18
18
|
const DrawerTrigger = DrawerPrimitive.Trigger;
|
|
19
|
+
DrawerTrigger.displayName = "DrawerTrigger";
|
|
19
20
|
const DrawerPortal = DrawerPrimitive.Portal;
|
|
21
|
+
DrawerPortal.displayName = "DrawerPortal";
|
|
20
22
|
const DrawerClose = DrawerPrimitive.Close;
|
|
23
|
+
DrawerClose.displayName = "DrawerClose";
|
|
21
24
|
const Drawer = (_a) => {
|
|
22
|
-
var { shouldScaleBackground } = _a, props = __rest(_a, ["shouldScaleBackground"]);
|
|
23
|
-
return (_jsx(DrawerPrimitive.Root, Object.assign({ shouldScaleBackground:
|
|
25
|
+
var { shouldScaleBackground, containerRef } = _a, props = __rest(_a, ["shouldScaleBackground", "containerRef"]);
|
|
26
|
+
return (_jsx(DrawerPrimitive.Root, Object.assign({ shouldScaleBackground: shouldScaleBackground, container: containerRef }, props, { noBodyStyles: true, disablePreventScroll: true })));
|
|
24
27
|
};
|
|
25
28
|
Drawer.displayName = "Drawer";
|
|
26
29
|
const DrawerOverlay = React.forwardRef((_a, ref) => {
|
|
@@ -28,13 +31,13 @@ const DrawerOverlay = React.forwardRef((_a, ref) => {
|
|
|
28
31
|
const style = { backgroundColor: `${backdropHexColor}CC` };
|
|
29
32
|
return (_jsx(DrawerPrimitive.Overlay, Object.assign({ style: style, ref: ref, className: cn(`fixed inset-0 z-50`, className) }, props)));
|
|
30
33
|
});
|
|
31
|
-
DrawerOverlay.displayName =
|
|
34
|
+
DrawerOverlay.displayName = "DrawerOverlay";
|
|
32
35
|
const DrawerContentBase = React.forwardRef((_a, ref) => {
|
|
33
36
|
var { className, children, hideBackdrop = false, backdropHexColor, isSheet = false } = _a, props = __rest(_a, ["className", "children", "hideBackdrop", "backdropHexColor", "isSheet"]);
|
|
34
37
|
const styles = isSheet
|
|
35
38
|
? { height: "calc(100vh - 112px)" }
|
|
36
39
|
: { maxHeight: "calc(100vh - 112px)" };
|
|
37
|
-
return (_jsxs(DrawerPortal, { children: [hideBackdrop ? null : (_jsx(DrawerOverlay, { backdropHexColor: backdropHexColor })), _jsxs(DrawerPrimitive.Content, Object.assign({ ref: ref, style: styles, className: cn("fixed inset-x-0 bottom-0 z-50 flex h-auto flex-col rounded-t-2xl bg-coreColors-modalBackground", className) }, props, { children: [_jsx("div", { className: "mx-auto mb-2 mt-2 h-[4px] w-[40px] rounded-full bg-coreColors-dividingLines" }), children] }))] }));
|
|
40
|
+
return (_jsxs(DrawerPortal, { children: [hideBackdrop ? null : (_jsx(DrawerOverlay, { backdropHexColor: backdropHexColor })), _jsxs(DrawerPrimitive.Content, Object.assign({ ref: ref, style: styles, className: cn("fixed inset-x-0 bottom-0 z-50 flex h-auto flex-col rounded-t-2xl bg-coreColors-modalBackground", className) }, props, { "data-testid": "drawer-content" }, { children: [_jsx("div", { className: "mx-auto mb-2 mt-2 h-[4px] w-[40px] rounded-full bg-coreColors-dividingLines" }), children] }))] }));
|
|
38
41
|
});
|
|
39
42
|
DrawerContentBase.displayName = "DrawerContentBase";
|
|
40
43
|
const DrawerHeaderBase = (_a) => {
|
|
@@ -44,9 +47,9 @@ const DrawerHeaderBase = (_a) => {
|
|
|
44
47
|
DrawerHeaderBase.displayName = "DrawerHeaderBase";
|
|
45
48
|
const DrawerTitle = React.forwardRef((_a, ref) => {
|
|
46
49
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
47
|
-
return (_jsx(
|
|
50
|
+
return (_jsx("h2", Object.assign({ ref: ref, className: cn("text-textColors-primaryColor text-center text-[18px] font-medium leading-[24px] truncate my-0 mx-4", className) }, props)));
|
|
48
51
|
});
|
|
49
|
-
DrawerTitle.displayName =
|
|
52
|
+
DrawerTitle.displayName = "DrawerTitle";
|
|
50
53
|
const DrawerFooter = (_a) => {
|
|
51
54
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
52
55
|
return (_jsx("div", Object.assign({ className: cn("mt-auto flex flex-row gap-2 pb-8 pt-4 pl-4 pr-4 border-t border-coreColors-dividingLines", className) }, props)));
|
|
@@ -54,9 +57,9 @@ const DrawerFooter = (_a) => {
|
|
|
54
57
|
DrawerFooter.displayName = "DrawerFooter";
|
|
55
58
|
const DrawerDescription = React.forwardRef((_a, ref) => {
|
|
56
59
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
57
|
-
return (_jsx(
|
|
60
|
+
return (_jsx("p", Object.assign({ ref: ref, className: cn("text-sm text-muted-foreground", className) }, props)));
|
|
58
61
|
});
|
|
59
|
-
DrawerDescription.displayName =
|
|
62
|
+
DrawerDescription.displayName = "DrawerDescription";
|
|
60
63
|
const DrawerHeader = ({ title, iconLeftName, iconRightName, onCloseClick, }) => {
|
|
61
64
|
return (_jsxs(DrawerHeaderBase, Object.assign({ className: "p-4 text-center flex justify-between" }, { children: [iconLeftName ? (_jsx(DrawerClose, Object.assign({ className: "h-6 w-6 p-0", onClick: onCloseClick }, { children: _jsx(Icon, { name: iconLeftName, color: "coreColors-secondaryIcon", className: "h-6 w-6 p-0", size: "md" }) }))) : (_jsx("div", { className: "w-6" })), _jsx(DrawerTitle, { children: title }), iconRightName ? (_jsx(DrawerClose, Object.assign({ className: "h-6 w-6 p-0", onClick: onCloseClick }, { children: _jsx(Icon, { name: iconRightName, color: "coreColors-secondaryIcon", className: "h-6 w-6 p-0", size: "md" }) }))) : (_jsx("div", { className: "w-6" }))] })));
|
|
62
65
|
};
|
package/dist/styles.css
CHANGED
|
@@ -985,9 +985,6 @@ video {
|
|
|
985
985
|
.max-h-\[240px\] {
|
|
986
986
|
max-height: 240px;
|
|
987
987
|
}
|
|
988
|
-
.max-h-\[300px\] {
|
|
989
|
-
max-height: 300px;
|
|
990
|
-
}
|
|
991
988
|
.max-h-screen {
|
|
992
989
|
max-height: 100vh;
|
|
993
990
|
}
|
|
@@ -1075,9 +1072,6 @@ video {
|
|
|
1075
1072
|
min-width: -moz-fit-content;
|
|
1076
1073
|
min-width: fit-content;
|
|
1077
1074
|
}
|
|
1078
|
-
.max-w-\[200px\] {
|
|
1079
|
-
max-width: 200px;
|
|
1080
|
-
}
|
|
1081
1075
|
.max-w-full {
|
|
1082
1076
|
max-width: 100%;
|
|
1083
1077
|
}
|
|
@@ -1090,6 +1084,9 @@ video {
|
|
|
1090
1084
|
.flex-1 {
|
|
1091
1085
|
flex: 1 1 0%;
|
|
1092
1086
|
}
|
|
1087
|
+
.flex-none {
|
|
1088
|
+
flex: none;
|
|
1089
|
+
}
|
|
1093
1090
|
.flex-shrink-0 {
|
|
1094
1091
|
flex-shrink: 0;
|
|
1095
1092
|
}
|
|
@@ -1428,6 +1425,9 @@ video {
|
|
|
1428
1425
|
.border-t {
|
|
1429
1426
|
border-top-width: 1px;
|
|
1430
1427
|
}
|
|
1428
|
+
.border-t-0 {
|
|
1429
|
+
border-top-width: 0px;
|
|
1430
|
+
}
|
|
1431
1431
|
.border-t-\[0px\] {
|
|
1432
1432
|
border-top-width: 0px;
|
|
1433
1433
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"swr": "^2.2.5",
|
|
74
74
|
"tailwind-merge": "^1.13.2",
|
|
75
75
|
"tailwindcss-animate": "^1.0.6",
|
|
76
|
-
"vaul": "^
|
|
76
|
+
"vaul": "^1.1.0"
|
|
77
77
|
}
|
|
78
|
-
}
|
|
78
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
type OpenProductFn = (arg: {
|
|
2
|
-
productId: string;
|
|
3
|
-
}) => void;
|
|
4
|
-
type OpenCollectionFn = (arg: {
|
|
5
|
-
collectionId: string;
|
|
6
|
-
}) => void;
|
|
7
|
-
type OpenScreenFn = (arg: {
|
|
8
|
-
destination: {
|
|
9
|
-
type: "internal" | "web";
|
|
10
|
-
url: string;
|
|
11
|
-
};
|
|
12
|
-
}) => void;
|
|
13
|
-
type DestinationType = "product" | "collection" | "url" | "app-screen";
|
|
14
|
-
interface UseDestinationProps {
|
|
15
|
-
openProduct: OpenProductFn;
|
|
16
|
-
openCollection: OpenCollectionFn;
|
|
17
|
-
openScreen: OpenScreenFn;
|
|
18
|
-
type: DestinationType;
|
|
19
|
-
location: string;
|
|
20
|
-
}
|
|
21
|
-
export declare const useDestination: ({ openProduct, openCollection, openScreen, type, location, }: UseDestinationProps) => (() => void);
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=use-destination.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-destination.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-destination.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,GAAG,CAAC,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,CAAA;AACzD,KAAK,gBAAgB,GAAG,CAAC,GAAG,EAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,CAAA;AAC/D,KAAK,YAAY,GAAG,CAAC,GAAG,EAAE;IACxB,WAAW,EAAE;QAAE,IAAI,EAAE,UAAU,GAAG,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CACvD,KAAK,IAAI,CAAA;AAEV,KAAK,eAAe,GAAG,SAAS,GAAG,YAAY,GAAG,KAAK,GAAG,YAAY,CAAA;AAEtE,UAAU,mBAAmB;IAC3B,WAAW,EAAE,aAAa,CAAA;IAC1B,cAAc,EAAE,gBAAgB,CAAA;IAChC,UAAU,EAAE,YAAY,CAAA;IACxB,IAAI,EAAE,eAAe,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,cAAc,iEAMxB,mBAAmB,KAAG,CAAC,MAAM,IAAI,CAYnC,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
export const useDestination = ({ openProduct, openCollection, openScreen, type, location, }) => {
|
|
3
|
-
switch (type) {
|
|
4
|
-
case "product":
|
|
5
|
-
return () => openProduct({ productId: location });
|
|
6
|
-
case "collection":
|
|
7
|
-
return () => openCollection({ collectionId: location });
|
|
8
|
-
case "url":
|
|
9
|
-
return () => openScreen({ destination: { type: "web", url: location } });
|
|
10
|
-
case "app-screen":
|
|
11
|
-
return () => openScreen({ destination: { type: "internal", url: location } });
|
|
12
|
-
}
|
|
13
|
-
};
|