@mbao01/common 0.0.26 → 0.0.28

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.
@@ -15,6 +15,9 @@ declare const Dialog: {
15
15
  Content: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
16
16
  variant?: "dialog" | "sheet" | undefined;
17
17
  side?: "top" | "right" | "bottom" | "left" | undefined;
18
+ } & {
19
+ showClose?: boolean | undefined;
20
+ closeProps?: import("./types").DialogCloseProps | undefined;
18
21
  } & React.RefAttributes<HTMLDivElement>>;
19
22
  Footer: {
20
23
  ({ className, ...props }: DialogFooterProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import * as DialogPrimitive from "@radix-ui/react-dialog";
3
3
  import { type VariantProps } from "../../libs";
4
- import { getDialogContentClasses, getDialogDescriptionClasses, getDialogFooterClasses, getDialogHeaderClasses, getDialogOverlayClasses, getDialogTitleClasses } from "./constants";
4
+ import { getDialogCloseClasses, getDialogContentClasses, getDialogDescriptionClasses, getDialogFooterClasses, getDialogHeaderClasses, getDialogOverlayClasses, getDialogTitleClasses } from "./constants";
5
5
  export type DialogProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
6
6
  export type DialogOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> & VariantProps<typeof getDialogOverlayClasses>;
7
- export type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & VariantProps<typeof getDialogContentClasses>;
7
+ export type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close> & VariantProps<typeof getDialogCloseClasses>;
8
+ export type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & VariantProps<typeof getDialogContentClasses> & {
9
+ showClose?: boolean;
10
+ closeProps?: DialogCloseProps;
11
+ };
8
12
  export type DialogHeaderProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getDialogHeaderClasses>;
9
13
  export type DialogFooterProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getDialogFooterClasses>;
10
14
  export type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title> & VariantProps<typeof getDialogTitleClasses>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mbao01/common",
3
3
  "private": false,
4
- "version": "0.0.26",
4
+ "version": "0.0.28",
5
5
  "type": "module",
6
6
  "author": "Ayomide Bakare",
7
7
  "license": "MIT",
@@ -142,5 +142,5 @@
142
142
  "react-dom": "^18.2.0",
143
143
  "typescript": "^5.2.2"
144
144
  },
145
- "gitHead": "ae57ca0c314f2fb4aeb6b3c87d11f96cc7b8d5f0"
145
+ "gitHead": "74c0783184a29ff6cac39bdb20a7c1d3621fc102"
146
146
  }
@@ -1,7 +1,7 @@
1
1
  import { cva } from "../../libs";
2
2
 
3
3
  export const getAlertClasses = cva(
4
- "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-inherit",
4
+ "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-inherit",
5
5
  {
6
6
  variants: {
7
7
  variant: {
@@ -23,7 +23,7 @@ const classesConfig = {
23
23
  variants: {
24
24
  variant: {
25
25
  accent: "bg-accent text-accent-content ring-accent",
26
- default: "bg-default text-default-content ring-default",
26
+ default: "bg-base-200 text-base-content ring-default",
27
27
  error: "bg-error text-error-content ring-error",
28
28
  ghost: "bg-ghost text-ghost-content ring-ghost",
29
29
  info: "bg-info text-info-content ring-info",
@@ -42,7 +42,15 @@ const DialogContent = React.forwardRef<
42
42
  DialogContentProps
43
43
  >(
44
44
  (
45
- { className, children, variant = "dialog", side = "right", ...props },
45
+ {
46
+ className,
47
+ children,
48
+ closeProps,
49
+ variant = "dialog",
50
+ showClose = true,
51
+ side = "right",
52
+ ...props
53
+ },
46
54
  ref
47
55
  ) => (
48
56
  <DialogPrimitive.Portal>
@@ -59,10 +67,15 @@ const DialogContent = React.forwardRef<
59
67
  {...props}
60
68
  >
61
69
  {children}
62
- <DialogPrimitive.Close className={cn(getDialogCloseClasses())}>
63
- <Cross2Icon className="h-4 w-4" />
64
- <span className="sr-only">Close</span>
65
- </DialogPrimitive.Close>
70
+ {showClose ? (
71
+ <DialogPrimitive.Close
72
+ {...closeProps}
73
+ className={cn(getDialogCloseClasses(), closeProps?.className)}
74
+ >
75
+ <Cross2Icon className="h-4 w-4" />
76
+ <span className="sr-only">Close</span>
77
+ </DialogPrimitive.Close>
78
+ ) : null}
66
79
  </DialogPrimitive.Content>
67
80
  </DialogPrimitive.Portal>
68
81
  )
@@ -1,6 +1,7 @@
1
1
  import * as DialogPrimitive from "@radix-ui/react-dialog";
2
2
  import { type VariantProps } from "../../libs";
3
3
  import {
4
+ getDialogCloseClasses,
4
5
  getDialogContentClasses,
5
6
  getDialogDescriptionClasses,
6
7
  getDialogFooterClasses,
@@ -18,10 +19,18 @@ export type DialogOverlayProps = React.ComponentPropsWithoutRef<
18
19
  > &
19
20
  VariantProps<typeof getDialogOverlayClasses>;
20
21
 
22
+ export type DialogCloseProps = React.ComponentPropsWithoutRef<
23
+ typeof DialogPrimitive.Close
24
+ > &
25
+ VariantProps<typeof getDialogCloseClasses>;
26
+
21
27
  export type DialogContentProps = React.ComponentPropsWithoutRef<
22
28
  typeof DialogPrimitive.Content
23
29
  > &
24
- VariantProps<typeof getDialogContentClasses>;
30
+ VariantProps<typeof getDialogContentClasses> & {
31
+ showClose?: boolean;
32
+ closeProps?: DialogCloseProps;
33
+ };
25
34
 
26
35
  export type DialogHeaderProps = React.HTMLAttributes<HTMLDivElement> &
27
36
  VariantProps<typeof getDialogHeaderClasses>;