@tapcart/mobile-components 0.2.4 → 0.2.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/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 +33 -0
- package/dist/components/ui/product-card.d.ts.map +1 -0
- package/dist/components/ui/product-card.js +40 -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 +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -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 +401 -145
- package/package.json +15 -8
- package/dist/index.d.mts +0 -221
- package/dist/index.mjs +0 -999
- package/dist/index.mjs.map +0 -1
|
@@ -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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
import { Text } from "./text";
|
|
15
|
+
import { cn } from "../../lib/utils";
|
|
16
|
+
import { Icon } from "./icon";
|
|
17
|
+
const PlaceholderIcon = () => (_jsx("div", Object.assign({ className: "flex-shrink-0 flex items-center justify-center h-10 w-10 bg-stateColors-skeleton rounded-sm" }, { children: _jsx(Icon, { name: "heart-filled", size: "sm", color: "stateColors-disabled" }, void 0) }), void 0));
|
|
18
|
+
const Wishlist = React.forwardRef((_a, ref) => {
|
|
19
|
+
var { imgUrl, name, amount, selected = false, onClick, className } = _a, props = __rest(_a, ["imgUrl", "name", "amount", "selected", "onClick", "className"]);
|
|
20
|
+
return (_jsxs("button", Object.assign({ className: cn("flex flex-row items-center px-4 py-2 w-full border-b border-coreColors-dividingLines", selected ? "bg-stateColors-skeleton" : "", className), ref: ref, onClick: onClick }, props, { children: [imgUrl ? (_jsx("img", { alt: "wishlist-image", className: "flex-shrink-0 h-10 w-10 border border-coreColors-dividingLines rounded-sm", src: imgUrl }, void 0)) : (_jsx(PlaceholderIcon, {}, void 0)), _jsxs("div", Object.assign({ className: "flex flex-col items-start ml-2 space-y-1 overflow-hidden" }, { children: [_jsx(Text, Object.assign({ type: "body-primary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap" }, { children: name }), void 0), _jsx(Text, Object.assign({ type: "body-secondary", className: "h-4" }, { children: `${amount} item${amount !== 1 ? "s" : ""}` }), void 0)] }), void 0)] }), void 0));
|
|
21
|
+
});
|
|
22
|
+
Wishlist.displayName = "Wishlist";
|
|
23
|
+
export { Wishlist };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export * from "./components/ui/button";
|
|
2
|
+
export * from "./components/ui/input";
|
|
3
|
+
export * from "./components/ui/aspect-ratio";
|
|
4
|
+
export * from "./components/ui/accordion";
|
|
5
|
+
export * from "./components/ui/icon";
|
|
6
|
+
export * from "./components/ui/carousel";
|
|
7
|
+
export * from "./components/ui/checkbox";
|
|
8
|
+
export * from "./components/ui/container";
|
|
9
|
+
export * from "./components/ui/grid";
|
|
10
|
+
export * from "./components/ui/label";
|
|
11
|
+
export * from "./components/ui/separator";
|
|
12
|
+
export * from "./components/ui/badge";
|
|
13
|
+
export * from "./components/ui/video";
|
|
14
|
+
export * from "./components/ui/money";
|
|
15
|
+
export * from "./components/ui/skeleton";
|
|
16
|
+
export * from "./components/ui/text";
|
|
17
|
+
export * from "./components/ui/toggle";
|
|
18
|
+
export * from "./components/ui/toggle-group";
|
|
19
|
+
export * from "./components/ui/switch";
|
|
20
|
+
export * from "./components/ui/scroll-area";
|
|
21
|
+
export * from "./components/ui/selectors";
|
|
22
|
+
export * from "./components/ui/toast";
|
|
23
|
+
export * from "./components/ui/toaster";
|
|
24
|
+
export * from "./components/ui/chip";
|
|
25
|
+
export * from "./components/ui/use-toast";
|
|
26
|
+
export * from "./components/ui/drawer";
|
|
27
|
+
export * from "./components/ui/radio-group";
|
|
28
|
+
export * from "./components/ui/tabs";
|
|
29
|
+
export * from "./components/ui/price";
|
|
30
|
+
export * from "./components/ui/favorite";
|
|
31
|
+
export * from "./components/ui/wishlist";
|
|
32
|
+
export * from "./components/ui/product-card";
|
|
33
|
+
export { cn, cva } from "./lib/utils";
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// component exports
|
|
2
|
+
export * from "./components/ui/button";
|
|
3
|
+
export * from "./components/ui/input";
|
|
4
|
+
export * from "./components/ui/aspect-ratio";
|
|
5
|
+
export * from "./components/ui/accordion";
|
|
6
|
+
export * from "./components/ui/icon";
|
|
7
|
+
export * from "./components/ui/carousel";
|
|
8
|
+
export * from "./components/ui/checkbox";
|
|
9
|
+
export * from "./components/ui/container";
|
|
10
|
+
export * from "./components/ui/grid";
|
|
11
|
+
export * from "./components/ui/label";
|
|
12
|
+
export * from "./components/ui/separator";
|
|
13
|
+
export * from "./components/ui/badge";
|
|
14
|
+
export * from "./components/ui/video";
|
|
15
|
+
export * from "./components/ui/money";
|
|
16
|
+
export * from "./components/ui/skeleton";
|
|
17
|
+
export * from "./components/ui/text";
|
|
18
|
+
export * from "./components/ui/toggle";
|
|
19
|
+
export * from "./components/ui/toggle-group";
|
|
20
|
+
export * from "./components/ui/switch";
|
|
21
|
+
export * from "./components/ui/scroll-area";
|
|
22
|
+
export * from "./components/ui/selectors";
|
|
23
|
+
export * from "./components/ui/toast";
|
|
24
|
+
export * from "./components/ui/toaster";
|
|
25
|
+
export * from "./components/ui/chip";
|
|
26
|
+
export * from "./components/ui/use-toast";
|
|
27
|
+
export * from "./components/ui/drawer";
|
|
28
|
+
export * from "./components/ui/radio-group";
|
|
29
|
+
export * from "./components/ui/tabs";
|
|
30
|
+
export * from "./components/ui/price";
|
|
31
|
+
export * from "./components/ui/favorite";
|
|
32
|
+
export * from "./components/ui/wishlist";
|
|
33
|
+
export * from "./components/ui/product-card";
|
|
34
|
+
export { cn, cva } from "./lib/utils";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ClassValue } from "clsx";
|
|
2
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
+
export declare const iconColorLevels: string[];
|
|
4
|
+
export declare const iconColorVariantClasses: Record<string, string>;
|
|
5
|
+
export { cva } from "class-variance-authority";
|
|
6
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAA;AAGvC,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,eAAO,MAAM,eAAe,UAc3B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,CAAA;AAMjE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
export function cn(...inputs) {
|
|
4
|
+
return twMerge(clsx(inputs));
|
|
5
|
+
}
|
|
6
|
+
export const iconColorLevels = [
|
|
7
|
+
"coreColors-primaryIcon",
|
|
8
|
+
"coreColors-secondaryIcon",
|
|
9
|
+
"coreColors-headerIcon",
|
|
10
|
+
"coreColors-brandColorPrimary",
|
|
11
|
+
"stateColors-subscriptions",
|
|
12
|
+
"stateColors-favorites",
|
|
13
|
+
"stateColors-reviews",
|
|
14
|
+
"stateColors-success",
|
|
15
|
+
"stateColors-error",
|
|
16
|
+
"stateColors-warning",
|
|
17
|
+
"stateColors-disabled",
|
|
18
|
+
"buttonColors-primaryText",
|
|
19
|
+
"buttonColors-secondaryText",
|
|
20
|
+
];
|
|
21
|
+
export const iconColorVariantClasses = {};
|
|
22
|
+
for (let iconColorLevel of iconColorLevels) {
|
|
23
|
+
iconColorVariantClasses[iconColorLevel] = `text-${iconColorLevel}`;
|
|
24
|
+
}
|
|
25
|
+
export { cva } from "class-variance-authority";
|