@mbao01/common 0.0.12 → 0.0.14

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.
@@ -0,0 +1,7 @@
1
+ import type { AlertDescriptionProps, AlertTitleProps, AlertProps } from "./types";
2
+ declare const Alert: {
3
+ ({ variant, outline, className, ...props }: AlertProps): import("react/jsx-runtime").JSX.Element;
4
+ Title: ({ className, ...props }: AlertTitleProps) => import("react/jsx-runtime").JSX.Element;
5
+ Description: ({ className, ...props }: AlertDescriptionProps) => import("react/jsx-runtime").JSX.Element;
6
+ };
7
+ export { Alert };
@@ -0,0 +1,4 @@
1
+ export declare const getAlertClasses: (props?: ({
2
+ variant?: "accent" | "default" | "error" | "ghost" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | null | undefined;
3
+ outline?: boolean | null | undefined;
4
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -0,0 +1 @@
1
+ export { Alert } from "./Alert";
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { type VariantProps } from "../../libs";
3
+ import { getAlertClasses } from "./constants";
4
+ export type AlertProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getAlertClasses>;
5
+ export type AlertTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
6
+ export type AlertDescriptionProps = React.HTMLAttributes<HTMLDivElement>;
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
3
+ import type { AlertDialogFooterProps, AlertDialogHeaderProps, AlertDialogProps } from "./types";
4
+ declare const AlertDialog: {
5
+ (props: AlertDialogProps): import("react/jsx-runtime").JSX.Element;
6
+ Portal: React.FC<AlertDialogPrimitive.AlertDialogPortalProps>;
7
+ Overlay: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & {} & React.RefAttributes<HTMLDivElement>>;
8
+ Trigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
9
+ Content: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {} & React.RefAttributes<HTMLDivElement>>;
10
+ Header: {
11
+ ({ className, ...props }: AlertDialogHeaderProps): import("react/jsx-runtime").JSX.Element;
12
+ displayName: string;
13
+ };
14
+ Footer: {
15
+ ({ className, ...props }: AlertDialogFooterProps): import("react/jsx-runtime").JSX.Element;
16
+ displayName: string;
17
+ };
18
+ Title: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & {} & React.RefAttributes<HTMLHeadingElement>>;
19
+ Description: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & {} & React.RefAttributes<HTMLParagraphElement>>;
20
+ Action: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
21
+ variant?: "accent" | "default" | "error" | "ghost" | "info" | "link" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
22
+ outline?: boolean | undefined;
23
+ wide?: boolean | undefined;
24
+ size?: "xs" | "sm" | "md" | "lg" | undefined;
25
+ isLoading?: boolean | undefined;
26
+ } & React.RefAttributes<HTMLButtonElement>>;
27
+ Cancel: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
28
+ variant?: "accent" | "default" | "error" | "ghost" | "info" | "link" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
29
+ outline?: boolean | undefined;
30
+ wide?: boolean | undefined;
31
+ size?: "xs" | "sm" | "md" | "lg" | undefined;
32
+ isLoading?: boolean | undefined;
33
+ } & React.RefAttributes<HTMLButtonElement>>;
34
+ };
35
+ export { AlertDialog };
@@ -0,0 +1 @@
1
+ export declare const getDialogCloseClasses: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
@@ -0,0 +1 @@
1
+ export { AlertDialog } from "./AlertDialog";
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
3
+ import { type VariantProps } from "../../libs";
4
+ import { getDialogContentClasses, getDialogDescriptionClasses, getDialogFooterClasses, getDialogHeaderClasses, getDialogOverlayClasses, getDialogTitleClasses } from "../Dialog/constants";
5
+ import { getButtonClasses } from "../Button/constants";
6
+ export type AlertDialogProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Root>;
7
+ export type AlertDialogOverlayProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay> & VariantProps<typeof getDialogOverlayClasses>;
8
+ export type AlertDialogContentProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> & VariantProps<typeof getDialogContentClasses>;
9
+ export type AlertDialogHeaderProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getDialogHeaderClasses>;
10
+ export type AlertDialogFooterProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getDialogFooterClasses>;
11
+ export type AlertDialogTitleProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title> & VariantProps<typeof getDialogTitleClasses>;
12
+ export type AlertDialogDescriptionProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description> & VariantProps<typeof getDialogDescriptionClasses>;
13
+ export type AlertDialogActionProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel> & VariantProps<typeof getButtonClasses>;
14
+ export type AlertDialogCancelProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel> & VariantProps<typeof getButtonClasses>;
@@ -4,6 +4,7 @@ export { Radio } from "./Radio";
4
4
  export { Range } from "./Range";
5
5
  export { Select } from "./Select";
6
6
  export { Slider } from "./Slider";
7
+ export { Switch } from "./Switch";
7
8
  export { Checkbox } from "./Checkbox";
8
9
  export { Textarea } from "./Textarea";
9
10
  export { TextField } from "./TextField";
@@ -0,0 +1,2 @@
1
+ import { type ToasterProps } from "./types";
2
+ export declare const Toaster: ({ theme, variant, outline, className, ...props }: ToasterProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare const getToastClasses: (props?: ({
2
+ variant?: "accent" | "default" | "error" | "ghost" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | null | undefined;
3
+ outline?: boolean | null | undefined;
4
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -0,0 +1,2 @@
1
+ export { toast } from "sonner";
2
+ export { Toaster } from "./Toaster";
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { Toaster } from "sonner";
3
+ import { type VariantProps } from "../../libs";
4
+ import { getToastClasses } from "./constants";
5
+ export type ToasterProps = React.ComponentProps<typeof Toaster> & VariantProps<typeof getToastClasses>;
@@ -2,21 +2,26 @@
2
2
  export * from "./components/Button";
3
3
  export * from "./components/Breadcrumbs";
4
4
  /** data display */
5
+ export * from "./components/Alert";
5
6
  export * from "./components/Avatar";
6
7
  export * from "./components/Badge";
7
8
  export * from "./components/Card";
9
+ export * from "./components/Calendar";
8
10
  export * from "./components/Description";
9
11
  export * from "./components/Progress";
10
12
  export * from "./components/Separator";
13
+ export * from "./components/Sonner";
11
14
  export * from "./components/Text";
12
15
  /** data input */
13
16
  export * from "./components/Form";
14
17
  export * from "./components/Combobox";
18
+ export * from "./components/DatePicker";
15
19
  /** feedback */
16
20
  export * from "./components/Loading";
17
21
  export * from "./components/Skeleton";
18
22
  export * from "./components/Tooltip";
19
23
  /** composable */
24
+ export * from "./components/AlertDialog";
20
25
  export * from "./components/Dialog";
21
26
  export * from "./components/Command";
22
27
  export * from "./components/Popover";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mbao01/common",
3
3
  "private": false,
4
- "version": "0.0.12",
4
+ "version": "0.0.14",
5
5
  "type": "module",
6
6
  "author": "Ayomide Bakare",
7
7
  "license": "MIT",
@@ -60,6 +60,7 @@
60
60
  "test:coverage": "vitest run --coverage"
61
61
  },
62
62
  "dependencies": {
63
+ "@radix-ui/react-alert-dialog": "^1.0.5",
63
64
  "@radix-ui/react-avatar": "^1.0.4",
64
65
  "@radix-ui/react-checkbox": "^1.0.4",
65
66
  "@radix-ui/react-dialog": "^1.0.5",
@@ -79,6 +80,7 @@
79
80
  "date-fns": "^3.6.0",
80
81
  "react-day-picker": "^8.10.0",
81
82
  "react-international-phone": "^4.2.6",
83
+ "sonner": "^1.4.41",
82
84
  "tailwind-merge": "^2.2.1",
83
85
  "tailwindcss-animate": "^1.0.7"
84
86
  },
@@ -127,5 +129,5 @@
127
129
  "react-dom": "^18.2.0",
128
130
  "typescript": "^5.2.2"
129
131
  },
130
- "gitHead": "529b4ea031970fd4696249033017ce46100c1d47"
132
+ "gitHead": "57a912d17db57876656b318632bcb235bef0459d"
131
133
  }
@@ -0,0 +1,31 @@
1
+ import type {
2
+ AlertDescriptionProps,
3
+ AlertTitleProps,
4
+ AlertProps,
5
+ } from "./types";
6
+ import { cn } from "../../utilities";
7
+ import { getAlertClasses } from "./constants";
8
+
9
+ const Alert = ({ variant, outline, className, ...props }: AlertProps) => (
10
+ <div
11
+ role="alert"
12
+ className={cn(getAlertClasses({ variant, outline }), className)}
13
+ {...props}
14
+ />
15
+ );
16
+
17
+ const AlertTitle = ({ className, ...props }: AlertTitleProps) => (
18
+ <h5
19
+ className={cn("mb-1 font-medium leading-none tracking-tight", className)}
20
+ {...props}
21
+ />
22
+ );
23
+
24
+ const AlertDescription = ({ className, ...props }: AlertDescriptionProps) => (
25
+ <div className={cn("text-sm [&_p]:leading-relaxed", className)} {...props} />
26
+ );
27
+
28
+ Alert.Title = AlertTitle;
29
+ Alert.Description = AlertDescription;
30
+
31
+ export { Alert };
@@ -0,0 +1,39 @@
1
+ import { cva } from "../../libs";
2
+
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",
5
+ {
6
+ variants: {
7
+ variant: {
8
+ accent: "bg-accent text-accent-content border-accent",
9
+ default: "bg-default text-default-content border-default",
10
+ error: "bg-error text-error-content border-error",
11
+ ghost: "bg-ghost text-ghost-content border-transparent",
12
+ info: "bg-info text-info-content border-info",
13
+ neutral: "bg-neutral text-neutral-content border-neutral",
14
+ primary: "bg-primary text-primary-content border-primary",
15
+ secondary: "bg-secondary text-secondary-content border-secondary",
16
+ success: "bg-success text-success-content border-success",
17
+ warning: "bg-warning text-warning-content border-warning",
18
+ },
19
+ outline: {
20
+ true: "border bg-default",
21
+ },
22
+ },
23
+ compoundVariants: [
24
+ { outline: true, variant: "accent", className: "text-accent" },
25
+ { outline: true, variant: "default", className: "text-default" },
26
+ { outline: true, variant: "error", className: "text-error" },
27
+ { outline: true, variant: "ghost", className: "text-ghost" },
28
+ { outline: true, variant: "info", className: "text-info" },
29
+ { outline: true, variant: "neutral", className: "text-neutral" },
30
+ { outline: true, variant: "primary", className: "text-primary" },
31
+ { outline: true, variant: "secondary", className: "text-secondary" },
32
+ { outline: true, variant: "success", className: "text-success" },
33
+ { outline: true, variant: "warning", className: "text-warning" },
34
+ ],
35
+ defaultVariants: {
36
+ variant: "default",
37
+ },
38
+ }
39
+ );
@@ -0,0 +1 @@
1
+ export { Alert } from "./Alert";
@@ -0,0 +1,9 @@
1
+ import { type VariantProps } from "../../libs";
2
+ import { getAlertClasses } from "./constants";
3
+
4
+ export type AlertProps = React.HTMLAttributes<HTMLDivElement> &
5
+ VariantProps<typeof getAlertClasses>;
6
+
7
+ export type AlertTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
8
+
9
+ export type AlertDescriptionProps = React.HTMLAttributes<HTMLDivElement>;
@@ -0,0 +1,128 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
5
+ import type {
6
+ AlertDialogActionProps,
7
+ AlertDialogCancelProps,
8
+ AlertDialogContentProps,
9
+ AlertDialogDescriptionProps,
10
+ AlertDialogFooterProps,
11
+ AlertDialogHeaderProps,
12
+ AlertDialogOverlayProps,
13
+ AlertDialogProps,
14
+ AlertDialogTitleProps,
15
+ } from "./types";
16
+ import { cn } from "../../utilities";
17
+ import {
18
+ getDialogContentClasses,
19
+ getDialogDescriptionClasses,
20
+ getDialogFooterClasses,
21
+ getDialogHeaderClasses,
22
+ getDialogOverlayClasses,
23
+ getDialogTitleClasses,
24
+ } from "../Dialog/constants";
25
+ import { Button } from "../Button";
26
+
27
+ const AlertDialog = (props: AlertDialogProps) => (
28
+ <AlertDialogPrimitive.Root {...props} />
29
+ );
30
+
31
+ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
32
+
33
+ const AlertDialogPortal = AlertDialogPrimitive.Portal;
34
+
35
+ const AlertDialogOverlay = React.forwardRef<
36
+ React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
37
+ AlertDialogOverlayProps
38
+ >(({ className, ...props }, ref) => (
39
+ <AlertDialogPrimitive.Overlay
40
+ className={cn(getDialogOverlayClasses(), className)}
41
+ {...props}
42
+ ref={ref}
43
+ />
44
+ ));
45
+ AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
46
+
47
+ const AlertDialogContent = React.forwardRef<
48
+ React.ElementRef<typeof AlertDialogPrimitive.Content>,
49
+ AlertDialogContentProps
50
+ >(({ className, ...props }, ref) => (
51
+ <AlertDialogPortal>
52
+ <AlertDialogOverlay />
53
+ <AlertDialogPrimitive.Content
54
+ ref={ref}
55
+ className={cn(getDialogContentClasses(), className)}
56
+ {...props}
57
+ />
58
+ </AlertDialogPortal>
59
+ ));
60
+ AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
61
+
62
+ const AlertDialogHeader = ({ className, ...props }: AlertDialogHeaderProps) => (
63
+ <div className={cn(getDialogHeaderClasses(), className)} {...props} />
64
+ );
65
+ AlertDialogHeader.displayName = "AlertDialogHeader";
66
+
67
+ const AlertDialogFooter = ({ className, ...props }: AlertDialogFooterProps) => (
68
+ <div className={cn(getDialogFooterClasses(), className)} {...props} />
69
+ );
70
+ AlertDialogFooter.displayName = "AlertDialogFooter";
71
+
72
+ const AlertDialogTitle = React.forwardRef<
73
+ React.ElementRef<typeof AlertDialogPrimitive.Title>,
74
+ AlertDialogTitleProps
75
+ >(({ className, ...props }, ref) => (
76
+ <AlertDialogPrimitive.Title
77
+ ref={ref}
78
+ className={cn(getDialogTitleClasses(), className)}
79
+ {...props}
80
+ />
81
+ ));
82
+ AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
83
+
84
+ const AlertDialogDescription = React.forwardRef<
85
+ React.ElementRef<typeof AlertDialogPrimitive.Description>,
86
+ AlertDialogDescriptionProps
87
+ >(({ className, ...props }, ref) => (
88
+ <AlertDialogPrimitive.Description
89
+ ref={ref}
90
+ className={cn(getDialogDescriptionClasses(), className)}
91
+ {...props}
92
+ />
93
+ ));
94
+ AlertDialogDescription.displayName =
95
+ AlertDialogPrimitive.Description.displayName;
96
+
97
+ const AlertDialogAction = React.forwardRef<
98
+ React.ElementRef<typeof AlertDialogPrimitive.Action>,
99
+ AlertDialogActionProps
100
+ >(({ className, ...props }, ref) => (
101
+ <AlertDialogPrimitive.Action ref={ref} asChild>
102
+ <Button className={cn(className)} {...props} />
103
+ </AlertDialogPrimitive.Action>
104
+ ));
105
+ AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
106
+
107
+ const AlertDialogCancel = React.forwardRef<
108
+ React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
109
+ AlertDialogCancelProps
110
+ >(({ className, ...props }, ref) => (
111
+ <AlertDialogPrimitive.Cancel ref={ref} asChild>
112
+ <Button className={cn("mt-2 sm:mt-0", className)} {...props} />
113
+ </AlertDialogPrimitive.Cancel>
114
+ ));
115
+ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
116
+
117
+ AlertDialog.Portal = AlertDialogPortal;
118
+ AlertDialog.Overlay = AlertDialogOverlay;
119
+ AlertDialog.Trigger = AlertDialogTrigger;
120
+ AlertDialog.Content = AlertDialogContent;
121
+ AlertDialog.Header = AlertDialogHeader;
122
+ AlertDialog.Footer = AlertDialogFooter;
123
+ AlertDialog.Title = AlertDialogTitle;
124
+ AlertDialog.Description = AlertDialogDescription;
125
+ AlertDialog.Action = AlertDialogAction;
126
+ AlertDialog.Cancel = AlertDialogCancel;
127
+
128
+ export { AlertDialog };
@@ -0,0 +1,5 @@
1
+ import { cva } from "../../libs";
2
+
3
+ export const getDialogCloseClasses = cva(
4
+ "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none 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"
5
+ );
@@ -0,0 +1 @@
1
+ export { AlertDialog } from "./AlertDialog";
@@ -0,0 +1,51 @@
1
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
2
+ import { type VariantProps } from "../../libs";
3
+ import {
4
+ getDialogContentClasses,
5
+ getDialogDescriptionClasses,
6
+ getDialogFooterClasses,
7
+ getDialogHeaderClasses,
8
+ getDialogOverlayClasses,
9
+ getDialogTitleClasses,
10
+ } from "../Dialog/constants";
11
+ import { getButtonClasses } from "../Button/constants";
12
+
13
+ export type AlertDialogProps = React.ComponentPropsWithoutRef<
14
+ typeof AlertDialogPrimitive.Root
15
+ >;
16
+
17
+ export type AlertDialogOverlayProps = React.ComponentPropsWithoutRef<
18
+ typeof AlertDialogPrimitive.Overlay
19
+ > &
20
+ VariantProps<typeof getDialogOverlayClasses>;
21
+
22
+ export type AlertDialogContentProps = React.ComponentPropsWithoutRef<
23
+ typeof AlertDialogPrimitive.Content
24
+ > &
25
+ VariantProps<typeof getDialogContentClasses>;
26
+
27
+ export type AlertDialogHeaderProps = React.HTMLAttributes<HTMLDivElement> &
28
+ VariantProps<typeof getDialogHeaderClasses>;
29
+
30
+ export type AlertDialogFooterProps = React.HTMLAttributes<HTMLDivElement> &
31
+ VariantProps<typeof getDialogFooterClasses>;
32
+
33
+ export type AlertDialogTitleProps = React.ComponentPropsWithoutRef<
34
+ typeof AlertDialogPrimitive.Title
35
+ > &
36
+ VariantProps<typeof getDialogTitleClasses>;
37
+
38
+ export type AlertDialogDescriptionProps = React.ComponentPropsWithoutRef<
39
+ typeof AlertDialogPrimitive.Description
40
+ > &
41
+ VariantProps<typeof getDialogDescriptionClasses>;
42
+
43
+ export type AlertDialogActionProps = React.ComponentPropsWithoutRef<
44
+ typeof AlertDialogPrimitive.Cancel
45
+ > &
46
+ VariantProps<typeof getButtonClasses>;
47
+
48
+ export type AlertDialogCancelProps = React.ComponentPropsWithoutRef<
49
+ typeof AlertDialogPrimitive.Cancel
50
+ > &
51
+ VariantProps<typeof getButtonClasses>;
@@ -4,6 +4,7 @@ export { Radio } from "./Radio";
4
4
  export { Range } from "./Range";
5
5
  export { Select } from "./Select";
6
6
  export { Slider } from "./Slider";
7
+ export { Switch } from "./Switch";
7
8
  export { Checkbox } from "./Checkbox";
8
9
  export { Textarea } from "./Textarea";
9
10
  export { TextField } from "./TextField";
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ import { Toaster as Sonner } from "sonner";
4
+ import { type ToasterProps } from "./types";
5
+ import { cn } from "../../utilities";
6
+ import { getToastClasses } from "./constants";
7
+
8
+ export const Toaster = ({
9
+ theme,
10
+ variant,
11
+ outline,
12
+ className,
13
+ ...props
14
+ }: ToasterProps) => {
15
+ return (
16
+ <Sonner
17
+ theme={theme}
18
+ className={cn("toaster group", className)}
19
+ toastOptions={{
20
+ classNames: {
21
+ toast: cn(
22
+ "group sonn group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
23
+ getToastClasses({ variant, outline })
24
+ ),
25
+ description: "group-[.sonn]:text-muted-foreground",
26
+ actionButton:
27
+ "group-[.sonn]:bg-primary group-[.sonn]:text-primary-foreground",
28
+ cancelButton:
29
+ "group-[.sonn]:bg-muted group-[.sonn]:text-muted-foreground",
30
+ },
31
+ }}
32
+ {...props}
33
+ />
34
+ );
35
+ };
@@ -0,0 +1,39 @@
1
+ import { cva } from "../../libs";
2
+
3
+ export const getToastClasses = 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",
5
+ {
6
+ variants: {
7
+ variant: {
8
+ accent: "bg-accent text-accent-content border-accent",
9
+ default: "bg-default text-default-content border-default",
10
+ error: "bg-error text-error-content border-error",
11
+ ghost: "bg-ghost text-ghost-content border-transparent",
12
+ info: "bg-info text-info-content border-info",
13
+ neutral: "bg-neutral text-neutral-content border-neutral",
14
+ primary: "bg-primary text-primary-content border-primary",
15
+ secondary: "bg-secondary text-secondary-content border-secondary",
16
+ success: "bg-success text-success-content border-success",
17
+ warning: "bg-warning text-warning-content border-warning",
18
+ },
19
+ outline: {
20
+ true: "border bg-default",
21
+ },
22
+ },
23
+ compoundVariants: [
24
+ { outline: true, variant: "accent", className: "text-accent" },
25
+ { outline: true, variant: "default", className: "text-default" },
26
+ { outline: true, variant: "error", className: "text-error" },
27
+ { outline: true, variant: "ghost", className: "text-ghost" },
28
+ { outline: true, variant: "info", className: "text-info" },
29
+ { outline: true, variant: "neutral", className: "text-neutral" },
30
+ { outline: true, variant: "primary", className: "text-primary" },
31
+ { outline: true, variant: "secondary", className: "text-secondary" },
32
+ { outline: true, variant: "success", className: "text-success" },
33
+ { outline: true, variant: "warning", className: "text-warning" },
34
+ ],
35
+ defaultVariants: {
36
+ variant: "default",
37
+ },
38
+ }
39
+ );
@@ -0,0 +1,2 @@
1
+ export { toast } from "sonner";
2
+ export { Toaster } from "./Toaster";
@@ -0,0 +1,6 @@
1
+ import { Toaster } from "sonner";
2
+ import { type VariantProps } from "../../libs";
3
+ import { getToastClasses } from "./constants";
4
+
5
+ export type ToasterProps = React.ComponentProps<typeof Toaster> &
6
+ VariantProps<typeof getToastClasses>;
package/src/index.ts CHANGED
@@ -3,17 +3,21 @@ export * from "./components/Button";
3
3
  export * from "./components/Breadcrumbs";
4
4
 
5
5
  /** data display */
6
+ export * from "./components/Alert";
6
7
  export * from "./components/Avatar";
7
8
  export * from "./components/Badge";
8
9
  export * from "./components/Card";
10
+ export * from "./components/Calendar";
9
11
  export * from "./components/Description";
10
12
  export * from "./components/Progress";
11
13
  export * from "./components/Separator";
14
+ export * from "./components/Sonner";
12
15
  export * from "./components/Text";
13
16
 
14
17
  /** data input */
15
18
  export * from "./components/Form";
16
19
  export * from "./components/Combobox";
20
+ export * from "./components/DatePicker";
17
21
 
18
22
  /** feedback */
19
23
  export * from "./components/Loading";
@@ -21,6 +25,7 @@ export * from "./components/Skeleton";
21
25
  export * from "./components/Tooltip";
22
26
 
23
27
  /** composable */
28
+ export * from "./components/AlertDialog";
24
29
  export * from "./components/Dialog";
25
30
  export * from "./components/Command";
26
31
  export * from "./components/Popover";