@mbao01/common 0.0.15 → 0.0.16
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/types/components/AlertDialog/AlertDialog.d.ts +4 -1
- package/dist/types/components/Dialog/Dialog.d.ts +4 -1
- package/dist/types/components/Dialog/constants.d.ts +4 -1
- package/package.json +2 -2
- package/src/components/Dialog/Dialog.tsx +27 -16
- package/src/components/Dialog/constants.ts +23 -2
|
@@ -6,7 +6,10 @@ declare const AlertDialog: {
|
|
|
6
6
|
Portal: React.FC<AlertDialogPrimitive.AlertDialogPortalProps>;
|
|
7
7
|
Overlay: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & {} & React.RefAttributes<HTMLDivElement>>;
|
|
8
8
|
Trigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
-
Content: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
9
|
+
Content: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
10
|
+
variant?: "dialog" | "sheet" | undefined;
|
|
11
|
+
side?: "top" | "right" | "bottom" | "left" | undefined;
|
|
12
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
10
13
|
Header: {
|
|
11
14
|
({ className, ...props }: AlertDialogHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
15
|
displayName: string;
|
|
@@ -12,7 +12,10 @@ declare const Dialog: {
|
|
|
12
12
|
};
|
|
13
13
|
Title: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & {} & React.RefAttributes<HTMLHeadingElement>>;
|
|
14
14
|
Description: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & {} & React.RefAttributes<HTMLParagraphElement>>;
|
|
15
|
-
Content: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
15
|
+
Content: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
16
|
+
variant?: "dialog" | "sheet" | undefined;
|
|
17
|
+
side?: "top" | "right" | "bottom" | "left" | undefined;
|
|
18
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
16
19
|
Footer: {
|
|
17
20
|
({ className, ...props }: DialogFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
18
21
|
displayName: string;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export declare const getDialogOverlayClasses: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
|
-
export declare const getDialogContentClasses: (props?:
|
|
2
|
+
export declare const getDialogContentClasses: (props?: ({
|
|
3
|
+
variant?: "dialog" | "sheet" | null | undefined;
|
|
4
|
+
side?: "top" | "right" | "bottom" | "left" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
3
6
|
export declare const getDialogHeaderClasses: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
4
7
|
export declare const getDialogFooterClasses: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
5
8
|
export declare const getDialogTitleClasses: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbao01/common",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.16",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ayomide Bakare",
|
|
7
7
|
"license": "MIT",
|
|
@@ -129,5 +129,5 @@
|
|
|
129
129
|
"react-dom": "^18.2.0",
|
|
130
130
|
"typescript": "^5.2.2"
|
|
131
131
|
},
|
|
132
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "109cf6f95514f5d5b0bfc6f89bc02b8ecd821c41"
|
|
133
133
|
}
|
|
@@ -40,22 +40,33 @@ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
|
40
40
|
const DialogContent = React.forwardRef<
|
|
41
41
|
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
42
42
|
DialogContentProps
|
|
43
|
-
>(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
)
|
|
43
|
+
>(
|
|
44
|
+
(
|
|
45
|
+
{ className, children, variant = "dialog", side = "right", ...props },
|
|
46
|
+
ref
|
|
47
|
+
) => (
|
|
48
|
+
<DialogPrimitive.Portal>
|
|
49
|
+
<DialogOverlay />
|
|
50
|
+
<DialogPrimitive.Content
|
|
51
|
+
ref={ref}
|
|
52
|
+
className={cn(
|
|
53
|
+
getDialogContentClasses({
|
|
54
|
+
variant,
|
|
55
|
+
side: variant === "sheet" ? side : undefined,
|
|
56
|
+
}),
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
{children}
|
|
62
|
+
<DialogPrimitive.Close className={cn(getDialogCloseClasses())}>
|
|
63
|
+
<Cross2Icon className="h-4 w-4" />
|
|
64
|
+
<span className="sr-only">Close</span>
|
|
65
|
+
</DialogPrimitive.Close>
|
|
66
|
+
</DialogPrimitive.Content>
|
|
67
|
+
</DialogPrimitive.Portal>
|
|
68
|
+
)
|
|
69
|
+
);
|
|
59
70
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
60
71
|
|
|
61
72
|
const DialogHeader = ({ className, ...props }: DialogHeaderProps) => (
|
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
2
|
|
|
3
3
|
export const getDialogOverlayClasses = cva(
|
|
4
|
-
"fixed inset-0 z-50 bg-black/80
|
|
4
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
|
5
5
|
);
|
|
6
6
|
|
|
7
7
|
export const getDialogContentClasses = cva(
|
|
8
|
-
"fixed
|
|
8
|
+
"fixed z-50 gap-4 p-6 shadow-lg transition bg-base-100 w-full",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
dialog:
|
|
13
|
+
"border duration-200 left-[50%] top-[50%] grid max-w-lg translate-x-[-50%] translate-y-[-50%] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
14
|
+
sheet:
|
|
15
|
+
"ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
16
|
+
},
|
|
17
|
+
side: {
|
|
18
|
+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
19
|
+
bottom:
|
|
20
|
+
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
21
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
22
|
+
right:
|
|
23
|
+
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: "dialog",
|
|
28
|
+
},
|
|
29
|
+
}
|
|
9
30
|
);
|
|
10
31
|
|
|
11
32
|
export const getDialogHeaderClasses = cva(
|