@mbao01/common 0.9.3 → 0.9.4
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/Drawer/Drawer.d.ts +3 -3
- package/dist/types/components/Drawer/constants.d.ts +1 -0
- package/dist/types/components/Drawer/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/components/Dialog/constants.ts +1 -1
- package/src/components/Drawer/Drawer.tsx +15 -4
- package/src/components/Drawer/constants.ts +4 -0
- package/src/components/Drawer/types.ts +5 -0
- package/src/components/WidgetShell/WidgetShell.tsx +2 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DrawerProps } from './types';
|
|
1
|
+
import { DrawerContentProps, DrawerProps } from './types';
|
|
2
2
|
declare const Drawer: {
|
|
3
3
|
({ shouldScaleBackground, ...props }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
@@ -6,7 +6,7 @@ declare const Drawer: {
|
|
|
6
6
|
Overlay: import('react').ForwardRefExoticComponent<Omit<Omit<import('@radix-ui/react-dialog').DialogOverlayProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
7
7
|
Trigger: import('react').ForwardRefExoticComponent<import('@radix-ui/react-dialog').DialogTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
Close: import('react').ForwardRefExoticComponent<import('@radix-ui/react-dialog').DialogCloseProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
9
|
-
Content: import('react').ForwardRefExoticComponent<Omit<
|
|
9
|
+
Content: import('react').ForwardRefExoticComponent<Omit<DrawerContentProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
10
10
|
Header: {
|
|
11
11
|
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
displayName: string;
|
|
@@ -22,7 +22,7 @@ declare const DrawerTrigger: import('react').ForwardRefExoticComponent<import('@
|
|
|
22
22
|
declare const DrawerPortal: typeof import('vaul').Portal;
|
|
23
23
|
declare const DrawerClose: import('react').ForwardRefExoticComponent<import('@radix-ui/react-dialog').DialogCloseProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
24
24
|
declare const DrawerOverlay: import('react').ForwardRefExoticComponent<Omit<Omit<import('@radix-ui/react-dialog').DialogOverlayProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
25
|
-
declare const DrawerContent: import('react').ForwardRefExoticComponent<Omit<
|
|
25
|
+
declare const DrawerContent: import('react').ForwardRefExoticComponent<Omit<DrawerContentProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
26
26
|
declare const DrawerHeader: {
|
|
27
27
|
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
displayName: string;
|
|
@@ -4,3 +4,4 @@ export declare const getDrawerHeaderClasses: (props?: import('class-variance-aut
|
|
|
4
4
|
export declare const getDrawerFooterClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
5
5
|
export declare const getDrawerOverlayClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
6
6
|
export declare const getDrawerTitleClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
7
|
+
export declare const getDrawerCloseClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { Drawer as DrawerPrimitive } from 'vaul';
|
|
2
2
|
export type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root>;
|
|
3
|
+
export type DrawerContentProps = React.ComponentProps<typeof DrawerPrimitive.Content> & {
|
|
4
|
+
showClose?: boolean;
|
|
5
|
+
closeProps?: React.ComponentProps<typeof DrawerPrimitive.Close>;
|
|
6
|
+
};
|
package/package.json
CHANGED
|
@@ -41,5 +41,5 @@ export const getDialogTitleClasses = cva("text-lg font-semibold leading-none tra
|
|
|
41
41
|
export const getDialogDescriptionClasses = cva("text-sm text-muted-foreground");
|
|
42
42
|
|
|
43
43
|
export const getDialogCloseClasses = cva(
|
|
44
|
-
"absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-all duration-200 hover:opacity-100 hover:rotate-90 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
|
|
44
|
+
"absolute right-4 top-4 cursor-pointer rounded-xs opacity-70 ring-offset-background transition-all duration-200 hover:opacity-100 hover:rotate-90 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
|
|
45
45
|
);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
|
+
import { XIcon } from "lucide-react";
|
|
4
5
|
import { Drawer as DrawerPrimitive } from "vaul";
|
|
5
6
|
import { cn } from "../../utilities";
|
|
6
7
|
import {
|
|
8
|
+
getDrawerCloseClasses,
|
|
7
9
|
getDrawerContentClasses,
|
|
8
10
|
getDrawerDescriptionClasses,
|
|
9
11
|
getDrawerFooterClasses,
|
|
@@ -11,7 +13,7 @@ import {
|
|
|
11
13
|
getDrawerOverlayClasses,
|
|
12
14
|
getDrawerTitleClasses,
|
|
13
15
|
} from "./constants";
|
|
14
|
-
import { DrawerProps } from "./types";
|
|
16
|
+
import { DrawerContentProps, DrawerProps } from "./types";
|
|
15
17
|
|
|
16
18
|
const Drawer = ({ shouldScaleBackground = true, ...props }: DrawerProps) => (
|
|
17
19
|
<DrawerPrimitive.Root shouldScaleBackground={shouldScaleBackground} {...props} />
|
|
@@ -38,8 +40,8 @@ DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
|
|
|
38
40
|
|
|
39
41
|
const DrawerContent = forwardRef<
|
|
40
42
|
React.ElementRef<typeof DrawerPrimitive.Content>,
|
|
41
|
-
|
|
42
|
-
>(({ className, children, ...props }, ref) => (
|
|
43
|
+
DrawerContentProps
|
|
44
|
+
>(({ className, children, showClose, closeProps, ...props }, ref) => (
|
|
43
45
|
<DrawerPortal>
|
|
44
46
|
<DrawerOverlay />
|
|
45
47
|
<DrawerPrimitive.Content
|
|
@@ -47,8 +49,17 @@ const DrawerContent = forwardRef<
|
|
|
47
49
|
className={cn(getDrawerContentClasses(), className)}
|
|
48
50
|
{...props}
|
|
49
51
|
>
|
|
50
|
-
<div className="mx-auto mt-4 h-2 w-[80px] rounded-full bg-base-300" />
|
|
52
|
+
<div className="mx-auto mt-4 h-2 min-h-2 w-[80px] rounded-full bg-base-300" />
|
|
51
53
|
{children}
|
|
54
|
+
{showClose ? (
|
|
55
|
+
<DrawerPrimitive.Close
|
|
56
|
+
{...closeProps}
|
|
57
|
+
className={cn(getDrawerCloseClasses(), closeProps?.className)}
|
|
58
|
+
>
|
|
59
|
+
<XIcon className="h-4 w-4" />
|
|
60
|
+
<span className="sr-only">Close</span>
|
|
61
|
+
</DrawerPrimitive.Close>
|
|
62
|
+
) : null}
|
|
52
63
|
</DrawerPrimitive.Content>
|
|
53
64
|
</DrawerPortal>
|
|
54
65
|
));
|
|
@@ -13,3 +13,7 @@ export const getDrawerFooterClasses = cva("mt-auto flex flex-col gap-2 p-4");
|
|
|
13
13
|
export const getDrawerOverlayClasses = cva("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm");
|
|
14
14
|
|
|
15
15
|
export const getDrawerTitleClasses = cva("text-lg font-semibold leading-none tracking-tight");
|
|
16
|
+
|
|
17
|
+
export const getDrawerCloseClasses = cva(
|
|
18
|
+
"absolute right-4 top-4 cursor-pointer rounded-xs opacity-70 ring-offset-background transition-all duration-200 hover:opacity-100 hover:rotate-90 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
|
|
19
|
+
);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { Drawer as DrawerPrimitive } from "vaul";
|
|
2
2
|
|
|
3
3
|
export type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root>;
|
|
4
|
+
|
|
5
|
+
export type DrawerContentProps = React.ComponentProps<typeof DrawerPrimitive.Content> & {
|
|
6
|
+
showClose?: boolean;
|
|
7
|
+
closeProps?: React.ComponentProps<typeof DrawerPrimitive.Close>;
|
|
8
|
+
};
|
|
@@ -69,6 +69,8 @@ const WidgetShellError = ({
|
|
|
69
69
|
</div>
|
|
70
70
|
{onRetry && (
|
|
71
71
|
<Button
|
|
72
|
+
outline
|
|
73
|
+
size="sm"
|
|
72
74
|
type="button"
|
|
73
75
|
onClick={onRetry}
|
|
74
76
|
className="inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs font-medium transition-colors duration-200 hover:bg-base-200"
|