@tapcart/mobile-components 0.2.4 → 0.2.8
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-infinite-scroll.d.ts +25 -0
- package/dist/components/hooks/use-infinite-scroll.d.ts.map +1 -0
- package/dist/components/hooks/use-infinite-scroll.js +48 -0
- package/dist/components/ui/accordion.d.ts +8 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +34 -0
- package/dist/components/ui/alert-dialog.d.ts +21 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +62 -0
- package/dist/components/ui/aspect-ratio.d.ts +5 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.js +4 -0
- package/dist/components/ui/badge.d.ts +13 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +34 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +56 -0
- package/dist/components/ui/carousel.d.ts +19 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/carousel.js +112 -0
- package/dist/components/ui/checkbox.d.ts +18 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +38 -0
- package/dist/components/ui/chip.d.ts +28 -0
- package/dist/components/ui/chip.d.ts.map +1 -0
- package/dist/components/ui/chip.js +66 -0
- package/dist/components/ui/container.d.ts +10 -0
- package/dist/components/ui/container.d.ts.map +1 -0
- package/dist/components/ui/container.js +26 -0
- package/dist/components/ui/drawer.d.ts +37 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/drawer.js +63 -0
- package/dist/components/ui/favorite.d.ts +13 -0
- package/dist/components/ui/favorite.d.ts.map +1 -0
- package/dist/components/ui/favorite.js +35 -0
- package/dist/components/ui/grid.d.ts +14 -0
- package/dist/components/ui/grid.d.ts.map +1 -0
- package/dist/components/ui/grid.js +33 -0
- package/dist/components/ui/icon.d.ts +13 -0
- package/dist/components/ui/icon.d.ts.map +1 -0
- package/dist/components/ui/icon.js +50 -0
- package/dist/components/ui/input.d.ts +17 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +35 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +24 -0
- package/dist/components/ui/money.d.ts +12 -0
- package/dist/components/ui/money.d.ts.map +1 -0
- package/dist/components/ui/money.js +30 -0
- package/dist/components/ui/price.d.ts +13 -0
- package/dist/components/ui/price.d.ts.map +1 -0
- package/dist/components/ui/price.js +9 -0
- package/dist/components/ui/product-card.d.ts +68 -0
- package/dist/components/ui/product-card.d.ts.map +1 -0
- package/dist/components/ui/product-card.js +132 -0
- package/dist/components/ui/product-grid.d.ts +14 -0
- package/dist/components/ui/product-grid.d.ts.map +1 -0
- package/dist/components/ui/product-grid.js +22 -0
- package/dist/components/ui/radio-group.d.ts +21 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +47 -0
- package/dist/components/ui/scroll-area.d.ts +9 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +29 -0
- package/dist/components/ui/selectors.d.ts +30 -0
- package/dist/components/ui/selectors.d.ts.map +1 -0
- package/dist/components/ui/selectors.js +45 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +22 -0
- package/dist/components/ui/skeleton.d.ts +13 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +33 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +22 -0
- package/dist/components/ui/tabs.d.ts +13 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +96 -0
- package/dist/components/ui/text.d.ts +10 -0
- package/dist/components/ui/text.d.ts.map +1 -0
- package/dist/components/ui/text.js +33 -0
- package/dist/components/ui/toast.d.ts +20 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +98 -0
- package/dist/components/ui/toaster.d.ts +6 -0
- package/dist/components/ui/toaster.d.ts.map +1 -0
- package/dist/components/ui/toaster.js +22 -0
- package/dist/components/ui/toggle-group.d.ts +13 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +36 -0
- package/dist/components/ui/toggle.d.ts +13 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +40 -0
- package/dist/components/ui/use-toast.d.ts +45 -0
- package/dist/components/ui/use-toast.d.ts.map +1 -0
- package/dist/components/ui/use-toast.js +112 -0
- package/dist/components/ui/video.d.ts +8 -0
- package/dist/components/ui/video.d.ts.map +1 -0
- package/dist/components/ui/video.js +22 -0
- package/dist/components/ui/wishlist.d.ts +12 -0
- package/dist/components/ui/wishlist.d.ts.map +1 -0
- package/dist/components/ui/wishlist.js +23 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +25 -0
- package/dist/styles.css +425 -142
- package/package.json +19 -9
- package/dist/index.d.mts +0 -221
- package/dist/index.mjs +0 -999
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import { cva } from "class-variance-authority";
|
|
16
|
+
import { cn } from "../../lib/utils";
|
|
17
|
+
import { Text } from "./text";
|
|
18
|
+
const tabVariants = cva("flex items-center justify-center px-4 py-2 w-full", {
|
|
19
|
+
variants: {
|
|
20
|
+
isActive: {
|
|
21
|
+
true: "[&>p]:text-textColors-primaryColor",
|
|
22
|
+
false: "[&>p]:text-textColors-secondaryColor",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
isActive: false,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const Tab = ({ label, isActive = false, onClick }) => {
|
|
30
|
+
return (_jsx("button", Object.assign({ className: cn(tabVariants({
|
|
31
|
+
isActive,
|
|
32
|
+
})), onClick: onClick }, { children: _jsx(Text, Object.assign({ type: "body-primary" }, { children: label }), void 0) }), void 0));
|
|
33
|
+
};
|
|
34
|
+
const Tabs = React.forwardRef((_a, ref) => {
|
|
35
|
+
var { className, tabs, activeTab, onTabChange } = _a, props = __rest(_a, ["className", "tabs", "activeTab", "onTabChange"]);
|
|
36
|
+
const [underlinePosition, setUnderlinePosition] = React.useState({
|
|
37
|
+
left: 0,
|
|
38
|
+
width: 0,
|
|
39
|
+
});
|
|
40
|
+
const containerRef = React.useRef(null);
|
|
41
|
+
const [showLeftGradient, setShowLeftGradient] = React.useState(false);
|
|
42
|
+
const [showRightGradient, setShowRightGradient] = React.useState(false);
|
|
43
|
+
React.useEffect(() => {
|
|
44
|
+
onTabChange(activeTab);
|
|
45
|
+
}, [activeTab, tabs, onTabChange]);
|
|
46
|
+
const checkShowGradients = () => {
|
|
47
|
+
const { scrollLeft, scrollWidth, clientWidth } = containerRef.current;
|
|
48
|
+
setShowLeftGradient(scrollLeft > 0);
|
|
49
|
+
setShowRightGradient(scrollLeft + clientWidth < scrollWidth);
|
|
50
|
+
};
|
|
51
|
+
const handleTabChanged = React.useCallback(() => {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
const currentTab = containerRef.current.children[activeTab];
|
|
54
|
+
setUnderlinePosition({
|
|
55
|
+
left: (_a = currentTab === null || currentTab === void 0 ? void 0 : currentTab.offsetLeft) !== null && _a !== void 0 ? _a : 0,
|
|
56
|
+
width: (_b = currentTab === null || currentTab === void 0 ? void 0 : currentTab.clientWidth) !== null && _b !== void 0 ? _b : 0,
|
|
57
|
+
});
|
|
58
|
+
currentTab.scrollIntoView({
|
|
59
|
+
behavior: "smooth",
|
|
60
|
+
block: "nearest",
|
|
61
|
+
inline: "center",
|
|
62
|
+
});
|
|
63
|
+
}, [activeTab]);
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
handleTabChanged();
|
|
66
|
+
window.addEventListener("resize", handleTabChanged);
|
|
67
|
+
return () => {
|
|
68
|
+
window.removeEventListener("resize", handleTabChanged);
|
|
69
|
+
};
|
|
70
|
+
}, [handleTabChanged]);
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
const handleResize = () => checkShowGradients();
|
|
73
|
+
window.addEventListener("resize", handleResize);
|
|
74
|
+
checkShowGradients();
|
|
75
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
76
|
+
}, []);
|
|
77
|
+
React.useEffect(() => {
|
|
78
|
+
checkShowGradients();
|
|
79
|
+
}, [tabs]);
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
if (ref) {
|
|
82
|
+
if (typeof ref === "function") {
|
|
83
|
+
ref(containerRef.current);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
ref.current = containerRef.current;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, [ref]);
|
|
90
|
+
return (_jsxs("div", Object.assign({ className: "relative" }, props, { children: [_jsxs("div", Object.assign({ ref: containerRef, className: "relative flex overflow-x-auto", onScroll: checkShowGradients }, { children: [tabs.map((tab, index) => (_jsx(Tab, { label: tab.label, isActive: activeTab === index, onClick: () => onTabChange(index) }, index))), _jsx("div", { className: `absolute bottom-0 bg-coreColors-brandColorPrimary h-[2px] transition-all duration-300`, style: {
|
|
91
|
+
left: underlinePosition.left,
|
|
92
|
+
width: underlinePosition.width,
|
|
93
|
+
} }, void 0)] }), void 0), showRightGradient ? (_jsx("div", { className: "absolute right-0 bottom-0 w-16 h-10 bg-[linear-gradient(90deg,#ffffff00_0%,#FFF_100%)] pointer-events-none" }, void 0)) : (_jsx(_Fragment, {}, void 0)), showLeftGradient ? (_jsx("div", { className: "absolute left-0 bottom-0 w-16 h-10 bg-[linear-gradient(270deg,#ffffff00_0%,#FFF_100%)] pointer-events-none" }, void 0)) : (_jsx(_Fragment, {}, void 0))] }), void 0));
|
|
94
|
+
});
|
|
95
|
+
Tabs.displayName = "Tabs";
|
|
96
|
+
export { Tabs };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const textVariants: (props?: ({
|
|
4
|
+
type?: "h1" | "h2" | "label" | "body-primary" | "body-secondary" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
+
export interface TextProps extends React.HTMLAttributes<HTMLParagraphElement>, VariantProps<typeof textVariants> {
|
|
7
|
+
}
|
|
8
|
+
declare function Text({ className, type, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { Text, textVariants };
|
|
10
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../components/ui/text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAGjE,QAAA,MAAM,YAAY;;mFAgBhB,CAAA;AAEF,MAAM,WAAW,SACf,SAAQ,KAAK,CAAC,cAAc,CAAC,oBAAoB,CAAC,EAChD,YAAY,CAAC,OAAO,YAAY,CAAC;CAAG;AAExC,iBAAS,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,2CAErD;AAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { cva } from "class-variance-authority";
|
|
14
|
+
import { cn } from "../../lib/utils";
|
|
15
|
+
const textVariants = cva("", {
|
|
16
|
+
variants: {
|
|
17
|
+
type: {
|
|
18
|
+
h1: "text-[23px] font-sfpro-roboto leading-[130%] font-normal text-textColors-primaryColor",
|
|
19
|
+
h2: "text-lg font-sfpro-roboto leading-[130%] font-medium text-textColors-primaryColor",
|
|
20
|
+
"body-primary": "text-[15px] font-sfpro-roboto leading-[160%] font-normal text-textColors-primaryColor",
|
|
21
|
+
"body-secondary": "text-[12px] font-sfpro-roboto leading-[130%] font-normal text-textColors-secondaryColor",
|
|
22
|
+
label: "text-[10px] font-sfpro-roboto leading-[130%] font-normal text-textColors-secondaryColor",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
type: "body-primary",
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
function Text(_a) {
|
|
30
|
+
var { className, type } = _a, props = __rest(_a, ["className", "type"]);
|
|
31
|
+
return _jsx("p", Object.assign({ className: cn(textVariants({ type }), className) }, props), void 0);
|
|
32
|
+
}
|
|
33
|
+
export { Text, textVariants };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
declare const ToastProvider: React.FC<ToastPrimitives.ToastProviderProps>;
|
|
5
|
+
declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastViewportProps & React.RefAttributes<HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
6
|
+
declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: ({
|
|
7
|
+
variant?: "default" | "error" | "warning" | "success" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLLIElement>>;
|
|
9
|
+
declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
declare const ToastTitle: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare type ToastType = "default" | "warning" | "error" | "success";
|
|
13
|
+
declare const ToastDescription: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastDescriptionProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
14
|
+
type?: "default" | "error" | "warning" | "success" | undefined;
|
|
15
|
+
icon?: boolean | undefined;
|
|
16
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
declare type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
|
|
18
|
+
declare type ToastActionElement = React.ReactElement<typeof ToastAction>;
|
|
19
|
+
export { type ToastProps, type ToastActionElement, ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, type ToastType, };
|
|
20
|
+
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../components/ui/toast.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAOjE,QAAA,MAAM,aAAa,8CAA2B,CAAA;AAE9C,QAAA,MAAM,aAAa,kKAYjB,CAAA;AAgCF,QAAA,MAAM,KAAK;;0HAYT,CAAA;AAGF,QAAA,MAAM,WAAW,kKAYf,CAAA;AAGF,QAAA,MAAM,UAAU,iKAed,CAAA;AAGF,QAAA,MAAM,UAAU,2JASd,CAAA;AAEF,aAAK,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;AAiC5D,QAAA,MAAM,gBAAgB;;;wCAiBpB,CAAA;AAGF,aAAK,UAAU,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,CAAC,CAAA;AAE9D,aAAK,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAA;AAEhE,OAAO,EACL,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,aAAa,EACb,aAAa,EACb,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,KAAK,SAAS,GACf,CAAA"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
16
|
+
import { cva } from "class-variance-authority";
|
|
17
|
+
import { X } from "lucide-react";
|
|
18
|
+
import { cn } from "../../lib/utils";
|
|
19
|
+
import { Icon } from "./icon";
|
|
20
|
+
import { Text } from "./text";
|
|
21
|
+
const ToastProvider = ToastPrimitives.Provider;
|
|
22
|
+
const ToastViewport = React.forwardRef((_a, ref) => {
|
|
23
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
24
|
+
return (_jsx(ToastPrimitives.Viewport, Object.assign({ ref: ref, className: cn("fixed z-[100] top-0 flex max-h-screen w-full flex-col items-center right-0", className) }, props), void 0));
|
|
25
|
+
});
|
|
26
|
+
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
|
27
|
+
const toastVariants = cva(`fixed w-full pb-4 pt-12 px-4 h-auto group pointer-events-auto flex items-center justify-between shadow-[0_0_6px_0_rgba(17,17,17,0.16)] transition-all
|
|
28
|
+
data-[swipe=cancel]:translate-x-0
|
|
29
|
+
data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)]
|
|
30
|
+
data-[swipe=end]:animate-out
|
|
31
|
+
data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)]
|
|
32
|
+
data-[swipe=move]:transition-none
|
|
33
|
+
data-[state=closed]:animate-out
|
|
34
|
+
data-[state=closed]:fade-out-0
|
|
35
|
+
data-[state=closed]:slide-out-to-top-full
|
|
36
|
+
data-[state=open]:slide-in-from-top-full
|
|
37
|
+
data-[state=open]:animate-in
|
|
38
|
+
data-[state=open]:duration-500`, {
|
|
39
|
+
variants: {
|
|
40
|
+
variant: {
|
|
41
|
+
default: "bg-coreColors-modalBackground [&_*]:text-textColors-primaryColor",
|
|
42
|
+
error: "bg-stateColors-error [&_*]:text-coreColors-pageColor",
|
|
43
|
+
warning: "bg-stateColors-warning [&_*]:text-coreColors-pageColor",
|
|
44
|
+
success: "bg-stateColors-success [&_*]:text-coreColors-pageColor",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
variant: "default",
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
const Toast = React.forwardRef((_a, ref) => {
|
|
52
|
+
var { className, variant } = _a, props = __rest(_a, ["className", "variant"]);
|
|
53
|
+
return (_jsx(ToastPrimitives.Root, Object.assign({ ref: ref, className: cn(toastVariants({ variant }), className) }, props), void 0));
|
|
54
|
+
});
|
|
55
|
+
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
56
|
+
const ToastAction = React.forwardRef((_a, ref) => {
|
|
57
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
58
|
+
return (_jsx(ToastPrimitives.Action, Object.assign({ ref: ref, className: cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive", className) }, props), void 0));
|
|
59
|
+
});
|
|
60
|
+
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
61
|
+
const ToastClose = React.forwardRef((_a, ref) => {
|
|
62
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
63
|
+
return (_jsx(ToastPrimitives.Close, Object.assign({ ref: ref, className: cn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600", className), "toast-close": "" }, props, { children: _jsx(X, { className: "h-4 w-4" }, void 0) }), void 0));
|
|
64
|
+
});
|
|
65
|
+
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
66
|
+
const ToastTitle = React.forwardRef((_a, ref) => {
|
|
67
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
68
|
+
return (_jsx(ToastPrimitives.Title, Object.assign({ ref: ref, className: cn("text-sm font-semibold", className) }, props), void 0));
|
|
69
|
+
});
|
|
70
|
+
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
71
|
+
const ToastIcon = ({ type }) => {
|
|
72
|
+
const logoTypes = {
|
|
73
|
+
warning: {
|
|
74
|
+
name: "alert-circle",
|
|
75
|
+
color: "coreColors-pageColor",
|
|
76
|
+
},
|
|
77
|
+
error: {
|
|
78
|
+
name: "circle-x",
|
|
79
|
+
color: "coreColors-pageColor",
|
|
80
|
+
},
|
|
81
|
+
success: {
|
|
82
|
+
name: "check",
|
|
83
|
+
color: "coreColors-pageColor",
|
|
84
|
+
},
|
|
85
|
+
default: {
|
|
86
|
+
name: "info-circle",
|
|
87
|
+
color: "textColos-primaryColor",
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
const logoType = logoTypes[type];
|
|
91
|
+
return _jsx(Icon, { name: logoType.name || "", size: "sm", color: logoType.color }, void 0);
|
|
92
|
+
};
|
|
93
|
+
const ToastDescription = React.forwardRef((_a, ref) => {
|
|
94
|
+
var { className, type = "default", icon } = _a, props = __rest(_a, ["className", "type", "icon"]);
|
|
95
|
+
return (_jsxs(ToastPrimitives.Description, Object.assign({ ref: ref, className: cn("flex gap-4 items-center", className) }, props, { children: [icon ? _jsx(ToastIcon, { type: type }, void 0) : null, _jsx(Text, Object.assign({ type: "body-primary", className: "line-clamp-2" }, { children: props.children }), void 0)] }), void 0));
|
|
96
|
+
});
|
|
97
|
+
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
|
98
|
+
export { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../../../components/ui/toaster.tsx"],"names":[],"mappings":"AAWA,wBAAgB,OAAO,CAAC,EACtB,IAAgB,GACjB,EAAE;IACD,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IAClD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,2CAqBA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Toast, ToastDescription, ToastProvider, ToastTitle, ToastViewport, } from "../../components/ui/toast";
|
|
15
|
+
import { useToast } from "../../components/ui/use-toast";
|
|
16
|
+
export function Toaster({ type = "default", }) {
|
|
17
|
+
const { toasts } = useToast();
|
|
18
|
+
return (_jsxs(ToastProvider, { children: [toasts.map(function (_a) {
|
|
19
|
+
var { id, title, description, icon } = _a, props = __rest(_a, ["id", "title", "description", "icon"]);
|
|
20
|
+
return (_jsx(Toast, Object.assign({ variant: type }, props, { children: _jsxs("div", Object.assign({ className: "flex w-full justify-center" }, { children: [title && _jsx(ToastTitle, { children: title }, void 0), description && (_jsx(ToastDescription, Object.assign({ type: type, icon: icon }, { children: description }), void 0))] }), void 0) }), id));
|
|
21
|
+
}), _jsx(ToastViewport, {}, void 0)] }, void 0));
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
declare const ToggleGroup: React.ForwardRefExoticComponent<((Omit<ToggleGroupPrimitive.ToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<ToggleGroupPrimitive.ToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>, "ref">) & VariantProps<(props?: ({
|
|
5
|
+
variant?: "outline" | "default" | null | undefined;
|
|
6
|
+
size?: "sm" | "lg" | "default" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string>) & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const ToggleGroupItem: React.ForwardRefExoticComponent<Omit<ToggleGroupPrimitive.ToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
9
|
+
variant?: "outline" | "default" | null | undefined;
|
|
10
|
+
size?: "sm" | "lg" | "default" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
export { ToggleGroup, ToggleGroupItem };
|
|
13
|
+
//# sourceMappingURL=toggle-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle-group.d.ts","sourceRoot":"","sources":["../../../components/ui/toggle-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAYvD,QAAA,MAAM,WAAW;;;4HAcf,CAAA;AAIF,QAAA,MAAM,eAAe;;;8HAsBnB,CAAA;AAIF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
16
|
+
import { cn } from "../../lib/utils";
|
|
17
|
+
import { toggleVariants } from "../../components/ui/toggle";
|
|
18
|
+
const ToggleGroupContext = React.createContext({
|
|
19
|
+
size: "default",
|
|
20
|
+
variant: "default",
|
|
21
|
+
});
|
|
22
|
+
const ToggleGroup = React.forwardRef((_a, ref) => {
|
|
23
|
+
var { className, variant, size, children } = _a, props = __rest(_a, ["className", "variant", "size", "children"]);
|
|
24
|
+
return (_jsx(ToggleGroupPrimitive.Root, Object.assign({ ref: ref, className: cn("flex items-center justify-center gap-1", className) }, props, { children: _jsx(ToggleGroupContext.Provider, Object.assign({ value: { variant, size } }, { children: children }), void 0) }), void 0));
|
|
25
|
+
});
|
|
26
|
+
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
27
|
+
const ToggleGroupItem = React.forwardRef((_a, ref) => {
|
|
28
|
+
var { className, children, variant, size } = _a, props = __rest(_a, ["className", "children", "variant", "size"]);
|
|
29
|
+
const context = React.useContext(ToggleGroupContext);
|
|
30
|
+
return (_jsx(ToggleGroupPrimitive.Item, Object.assign({ ref: ref, className: cn(toggleVariants({
|
|
31
|
+
variant: context.variant || variant,
|
|
32
|
+
size: context.size || size,
|
|
33
|
+
}), className) }, props, { children: children }), void 0));
|
|
34
|
+
});
|
|
35
|
+
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
36
|
+
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
declare const toggleVariants: (props?: ({
|
|
5
|
+
variant?: "outline" | "default" | null | undefined;
|
|
6
|
+
size?: "sm" | "lg" | "default" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare const Toggle: React.ForwardRefExoticComponent<Omit<TogglePrimitive.ToggleProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
9
|
+
variant?: "outline" | "default" | null | undefined;
|
|
10
|
+
size?: "sm" | "lg" | "default" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
export { Toggle, toggleVariants };
|
|
13
|
+
//# sourceMappingURL=toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../components/ui/toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,cAAc;;;mFAoBnB,CAAA;AAED,QAAA,MAAM,MAAM;;;8HAUV,CAAA;AAIF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
16
|
+
import { cva } from "class-variance-authority";
|
|
17
|
+
import { cn } from "../../lib/utils";
|
|
18
|
+
const toggleVariants = cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground", {
|
|
19
|
+
variants: {
|
|
20
|
+
variant: {
|
|
21
|
+
default: "bg-transparent",
|
|
22
|
+
outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
default: "h-10 px-3",
|
|
26
|
+
sm: "h-9 px-2.5",
|
|
27
|
+
lg: "h-11 px-5",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
variant: "default",
|
|
32
|
+
size: "default",
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const Toggle = React.forwardRef((_a, ref) => {
|
|
36
|
+
var { className, variant, size } = _a, props = __rest(_a, ["className", "variant", "size"]);
|
|
37
|
+
return (_jsx(TogglePrimitive.Root, Object.assign({ ref: ref, className: cn(toggleVariants({ variant, size, className })) }, props), void 0));
|
|
38
|
+
});
|
|
39
|
+
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
40
|
+
export { Toggle, toggleVariants };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ToastProps } from "../../components/ui/toast";
|
|
3
|
+
declare type ToasterToast = ToastProps & {
|
|
4
|
+
id: string;
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
description?: React.ReactNode;
|
|
7
|
+
icon?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const actionTypes: {
|
|
10
|
+
readonly ADD_TOAST: "ADD_TOAST";
|
|
11
|
+
readonly UPDATE_TOAST: "UPDATE_TOAST";
|
|
12
|
+
readonly DISMISS_TOAST: "DISMISS_TOAST";
|
|
13
|
+
readonly REMOVE_TOAST: "REMOVE_TOAST";
|
|
14
|
+
};
|
|
15
|
+
declare type ActionType = typeof actionTypes;
|
|
16
|
+
declare type Action = {
|
|
17
|
+
type: ActionType["ADD_TOAST"];
|
|
18
|
+
toast: ToasterToast;
|
|
19
|
+
} | {
|
|
20
|
+
type: ActionType["UPDATE_TOAST"];
|
|
21
|
+
toast: Partial<ToasterToast>;
|
|
22
|
+
} | {
|
|
23
|
+
type: ActionType["DISMISS_TOAST"];
|
|
24
|
+
toastId?: ToasterToast["id"];
|
|
25
|
+
} | {
|
|
26
|
+
type: ActionType["REMOVE_TOAST"];
|
|
27
|
+
toastId?: ToasterToast["id"];
|
|
28
|
+
};
|
|
29
|
+
interface State {
|
|
30
|
+
toasts: ToasterToast[];
|
|
31
|
+
}
|
|
32
|
+
export declare const reducer: (state: State, action: Action) => State;
|
|
33
|
+
declare type Toast = Omit<ToasterToast, "id">;
|
|
34
|
+
declare function toast({ ...props }: Toast): {
|
|
35
|
+
id: string;
|
|
36
|
+
dismiss: () => void;
|
|
37
|
+
update: (props: ToasterToast) => void;
|
|
38
|
+
};
|
|
39
|
+
declare function useToast(): {
|
|
40
|
+
toast: typeof toast;
|
|
41
|
+
dismiss: (toastId?: string | undefined) => void;
|
|
42
|
+
toasts: ToasterToast[];
|
|
43
|
+
};
|
|
44
|
+
export { useToast, toast };
|
|
45
|
+
//# sourceMappingURL=use-toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-toast.d.ts","sourceRoot":"","sources":["../../../components/ui/use-toast.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAsB,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAK3E,aAAK,YAAY,GAAG,UAAU,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,QAAA,MAAM,WAAW;;;;;CAKP,CAAA;AASV,aAAK,UAAU,GAAG,OAAO,WAAW,CAAA;AAEpC,aAAK,MAAM,GACP;IACE,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;IAC7B,KAAK,EAAE,YAAY,CAAA;CACpB,GACD;IACE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IAChC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAC7B,GACD;IACE,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IACjC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;CAC7B,GACD;IACE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IAChC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;CAC7B,CAAA;AAEL,UAAU,KAAK;IACb,MAAM,EAAE,YAAY,EAAE,CAAA;CACvB;AAoBD,eAAO,MAAM,OAAO,UAAW,KAAK,UAAU,MAAM,KAAG,KAqDtD,CAAA;AAaD,aAAK,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAErC,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK;;;oBAGT,YAAY;EAwBpC;AAED,iBAAS,QAAQ;;;;EAkBhB;AAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
// Inspired by react-hot-toast library
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
const TOAST_LIMIT = 1;
|
|
16
|
+
const TOAST_REMOVE_DELAY = 1000000;
|
|
17
|
+
const actionTypes = {
|
|
18
|
+
ADD_TOAST: "ADD_TOAST",
|
|
19
|
+
UPDATE_TOAST: "UPDATE_TOAST",
|
|
20
|
+
DISMISS_TOAST: "DISMISS_TOAST",
|
|
21
|
+
REMOVE_TOAST: "REMOVE_TOAST",
|
|
22
|
+
};
|
|
23
|
+
let count = 0;
|
|
24
|
+
function genId() {
|
|
25
|
+
count = (count + 1) % Number.MAX_SAFE_INTEGER;
|
|
26
|
+
return count.toString();
|
|
27
|
+
}
|
|
28
|
+
const toastTimeouts = new Map();
|
|
29
|
+
const addToRemoveQueue = (toastId) => {
|
|
30
|
+
if (toastTimeouts.has(toastId)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const timeout = setTimeout(() => {
|
|
34
|
+
toastTimeouts.delete(toastId);
|
|
35
|
+
dispatch({
|
|
36
|
+
type: "REMOVE_TOAST",
|
|
37
|
+
toastId: toastId,
|
|
38
|
+
});
|
|
39
|
+
}, TOAST_REMOVE_DELAY);
|
|
40
|
+
toastTimeouts.set(toastId, timeout);
|
|
41
|
+
};
|
|
42
|
+
export const reducer = (state, action) => {
|
|
43
|
+
switch (action.type) {
|
|
44
|
+
case "ADD_TOAST":
|
|
45
|
+
return Object.assign(Object.assign({}, state), { toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT) });
|
|
46
|
+
case "UPDATE_TOAST":
|
|
47
|
+
return Object.assign(Object.assign({}, state), { toasts: state.toasts.map((t) => t.id === action.toast.id ? Object.assign(Object.assign({}, t), action.toast) : t) });
|
|
48
|
+
case "DISMISS_TOAST": {
|
|
49
|
+
const { toastId } = action;
|
|
50
|
+
// ! Side effects ! - This could be extracted into a dismissToast() action,
|
|
51
|
+
// but I'll keep it here for simplicity
|
|
52
|
+
if (toastId) {
|
|
53
|
+
addToRemoveQueue(toastId);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
state.toasts.forEach((toast) => {
|
|
57
|
+
addToRemoveQueue(toast.id);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return Object.assign(Object.assign({}, state), { toasts: state.toasts.map((t) => t.id === toastId || toastId === undefined
|
|
61
|
+
? Object.assign(Object.assign({}, t), { open: false }) : t) });
|
|
62
|
+
}
|
|
63
|
+
case "REMOVE_TOAST":
|
|
64
|
+
if (action.toastId === undefined) {
|
|
65
|
+
return Object.assign(Object.assign({}, state), { toasts: [] });
|
|
66
|
+
}
|
|
67
|
+
return Object.assign(Object.assign({}, state), { toasts: state.toasts.filter((t) => t.id !== action.toastId) });
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const listeners = [];
|
|
71
|
+
let memoryState = { toasts: [] };
|
|
72
|
+
function dispatch(action) {
|
|
73
|
+
memoryState = reducer(memoryState, action);
|
|
74
|
+
listeners.forEach((listener) => {
|
|
75
|
+
listener(memoryState);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function toast(_a) {
|
|
79
|
+
var props = __rest(_a, []);
|
|
80
|
+
const id = genId();
|
|
81
|
+
const update = (props) => dispatch({
|
|
82
|
+
type: "UPDATE_TOAST",
|
|
83
|
+
toast: Object.assign(Object.assign({}, props), { id }),
|
|
84
|
+
});
|
|
85
|
+
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
|
|
86
|
+
dispatch({
|
|
87
|
+
type: "ADD_TOAST",
|
|
88
|
+
toast: Object.assign(Object.assign({}, props), { id, open: true, onOpenChange: (open) => {
|
|
89
|
+
if (!open)
|
|
90
|
+
dismiss();
|
|
91
|
+
} }),
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
id: id,
|
|
95
|
+
dismiss,
|
|
96
|
+
update,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function useToast() {
|
|
100
|
+
const [state, setState] = React.useState(memoryState);
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
listeners.push(setState);
|
|
103
|
+
return () => {
|
|
104
|
+
const index = listeners.indexOf(setState);
|
|
105
|
+
if (index > -1) {
|
|
106
|
+
listeners.splice(index, 1);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}, [state]);
|
|
110
|
+
return Object.assign(Object.assign({}, state), { toast, dismiss: (toastId) => dispatch({ type: "DISMISS_TOAST", toastId }) });
|
|
111
|
+
}
|
|
112
|
+
export { useToast, toast };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const videoVariants: (props?: ({} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
4
|
+
export interface VideoProps extends React.HTMLAttributes<HTMLVideoElement>, VariantProps<typeof videoVariants> {
|
|
5
|
+
}
|
|
6
|
+
declare function Video({ className, ...props }: VideoProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export { Video, videoVariants };
|
|
8
|
+
//# sourceMappingURL=video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../components/ui/video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,aAAa,gGAEjB,CAAA;AAEF,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAC5C,YAAY,CAAC,OAAO,aAAa,CAAC;CAAG;AAEzC,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAWjD;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { cva } from "class-variance-authority";
|
|
14
|
+
import { cn } from "../../lib/utils";
|
|
15
|
+
const videoVariants = cva("w-full", {
|
|
16
|
+
variants: {},
|
|
17
|
+
});
|
|
18
|
+
function Video(_a) {
|
|
19
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
20
|
+
return (_jsx("video", Object.assign({ className: cn(videoVariants({}), className) }, props, { autoPlay: true, playsInline: true, muted: true, loop: true }), void 0));
|
|
21
|
+
}
|
|
22
|
+
export { Video, videoVariants };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface WishlistProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
imgUrl?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
amount: number;
|
|
6
|
+
selected?: boolean;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Wishlist: React.ForwardRefExoticComponent<WishlistProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export { Wishlist };
|
|
12
|
+
//# sourceMappingURL=wishlist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wishlist.d.ts","sourceRoot":"","sources":["../../../components/ui/wishlist.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAQD,QAAA,MAAM,QAAQ,yFAuCb,CAAA;AAID,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|