@mbao01/common 0.0.27 → 0.0.29

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>;
@@ -2,6 +2,6 @@ import type { LabelProps, LabelTextProps } from "./types";
2
2
  declare const Label: {
3
3
  ({ className, ...props }: LabelProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string | undefined;
5
- Text: ({ className, ...props }: LabelTextProps) => import("react/jsx-runtime").JSX.Element;
5
+ Text: ({ className, children, ...props }: LabelTextProps) => import("react/jsx-runtime").JSX.Element;
6
6
  };
7
7
  export { Label };
@@ -2,5 +2,6 @@
2
2
  import * as LabelPrimitive from "@radix-ui/react-label";
3
3
  import { type VariantProps } from "../../../../libs";
4
4
  import { getLabelClasses } from "./constants";
5
+ import { Text } from "../../../Text";
5
6
  export type LabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof getLabelClasses>;
6
- export type LabelTextProps = React.HTMLAttributes<HTMLSpanElement>;
7
+ export type LabelTextProps = Omit<React.ComponentProps<typeof Text>, "as">;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mbao01/common",
3
3
  "private": false,
4
- "version": "0.0.27",
4
+ "version": "0.0.29",
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": "011f80eb4c8b456df0a2af179f46f57000a603b5"
145
+ "gitHead": "1ccc8b44c98ab629a4ec708e3ee1bee6d9e13be8"
146
146
  }
@@ -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>;
@@ -1,5 +1,6 @@
1
1
  import * as LabelPrimitive from "@radix-ui/react-label";
2
2
  import type { LabelProps, LabelTextProps } from "./types";
3
+ import { Text } from "../../../Text";
3
4
  import { cn } from "../../../../utilities";
4
5
  import { getLabelClasses } from "./constants";
5
6
 
@@ -11,10 +12,10 @@ const Label = ({ className, ...props }: LabelProps) => (
11
12
  );
12
13
  Label.displayName = LabelPrimitive.Root.displayName;
13
14
 
14
- const LabelText = ({ className, ...props }: LabelTextProps) => (
15
- <span className={cn("label-text", className)} {...props}>
16
- Pick the best fantasy franchise
17
- </span>
15
+ const LabelText = ({ className, children, ...props }: LabelTextProps) => (
16
+ <Text as="span" className={cn("label-text", className)} {...props}>
17
+ {children}
18
+ </Text>
18
19
  );
19
20
 
20
21
  Label.Text = LabelText;
@@ -1,10 +1,11 @@
1
1
  import * as LabelPrimitive from "@radix-ui/react-label";
2
2
  import { type VariantProps } from "../../../../libs";
3
3
  import { getLabelClasses } from "./constants";
4
+ import { Text } from "../../../Text";
4
5
 
5
6
  export type LabelProps = React.ComponentPropsWithoutRef<
6
7
  typeof LabelPrimitive.Root
7
8
  > &
8
9
  VariantProps<typeof getLabelClasses>;
9
10
 
10
- export type LabelTextProps = React.HTMLAttributes<HTMLSpanElement>;
11
+ export type LabelTextProps = Omit<React.ComponentProps<typeof Text>, "as">;