@mbao01/common 0.0.15 → 0.0.17
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/Card/Card.d.ts +4 -1
- package/dist/types/components/Card/types.d.ts +3 -0
- package/dist/types/components/Dialog/Dialog.d.ts +4 -1
- package/dist/types/components/Dialog/constants.d.ts +4 -1
- package/dist/types/components/Tabs/Tabs.d.ts +10 -0
- package/dist/types/components/Tabs/constants.d.ts +3 -0
- package/dist/types/components/Tabs/index.d.ts +1 -0
- package/dist/types/components/Tabs/types.d.ts +8 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +3 -2
- package/src/components/Card/Card.tsx +20 -2
- package/src/components/Card/types.ts +3 -0
- package/src/components/Dialog/Dialog.tsx +27 -16
- package/src/components/Dialog/constants.ts +23 -2
- package/src/components/Tabs/Tabs.tsx +60 -0
- package/src/components/Tabs/constants.ts +13 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tabs/types.ts +26 -0
- package/src/index.ts +1 -0
|
@@ -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;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type { CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardImageProps, CardProps } from "./types";
|
|
1
|
+
import type { CardActionsProps, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardImageProps, CardTitleProps, CardProps, CardBodyProps } from "./types";
|
|
2
2
|
declare const Card: {
|
|
3
3
|
({ compact, bordered, horizontal, overlay, className, ...props }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Actions: ({ className, ...props }: CardActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Body: ({ className, ...props }: CardBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
6
|
Header: ({ className, ...props }: CardHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Title: ({ className, ...props }: CardTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
8
|
Content: ({ className, ...props }: CardContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
9
|
Description: ({ className, ...props }: CardDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
10
|
Image: ({ className, src, alt, ...props }: CardImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,8 +2,11 @@ import React from "react";
|
|
|
2
2
|
import { type VariantProps } from "../../libs";
|
|
3
3
|
import { getCardClasses } from "./constants";
|
|
4
4
|
export type CardProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getCardClasses>;
|
|
5
|
+
export type CardActionsProps = React.HTMLAttributes<HTMLDivElement>;
|
|
6
|
+
export type CardBodyProps = React.HTMLAttributes<HTMLDivElement>;
|
|
5
7
|
export type CardContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
6
8
|
export type CardImageProps = React.ImgHTMLAttributes<HTMLImageElement>;
|
|
7
9
|
export type CardHeaderProps = React.HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
export type CardTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
|
|
8
11
|
export type CardFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
9
12
|
export type CardDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
@@ -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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
3
|
+
import type { TabsProps } from "./types";
|
|
4
|
+
declare const Tabs: {
|
|
5
|
+
(props: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
List: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & {} & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
Trigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {} & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
Content: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {} & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
};
|
|
10
|
+
export { Tabs };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const getTabsListClasses: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const getTabsTriggerClasses: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const getTabsContentClasses: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tabs } from "./Tabs";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
3
|
+
import { type VariantProps } from "../../libs";
|
|
4
|
+
import { getTabsContentClasses, getTabsListClasses, getTabsTriggerClasses } from "./constants";
|
|
5
|
+
export type TabsProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root>;
|
|
6
|
+
export type TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & VariantProps<typeof getTabsListClasses>;
|
|
7
|
+
export type TabsTriggerProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & VariantProps<typeof getTabsTriggerClasses>;
|
|
8
|
+
export type TabsContentProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content> & VariantProps<typeof getTabsContentClasses>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./components/Description";
|
|
|
11
11
|
export * from "./components/Progress";
|
|
12
12
|
export * from "./components/Separator";
|
|
13
13
|
export * from "./components/Sonner";
|
|
14
|
+
export * from "./components/Tabs";
|
|
14
15
|
export * from "./components/Text";
|
|
15
16
|
/** data input */
|
|
16
17
|
export * from "./components/Form";
|
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.17",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ayomide Bakare",
|
|
7
7
|
"license": "MIT",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"@radix-ui/react-separator": "^1.0.3",
|
|
73
73
|
"@radix-ui/react-slider": "^1.1.2",
|
|
74
74
|
"@radix-ui/react-slot": "^1.0.2",
|
|
75
|
+
"@radix-ui/react-tabs": "^1.0.4",
|
|
75
76
|
"@radix-ui/react-tooltip": "^1.0.7",
|
|
76
77
|
"class-variance-authority": "^0.7.0",
|
|
77
78
|
"clsx": "^2.1.0",
|
|
@@ -129,5 +130,5 @@
|
|
|
129
130
|
"react-dom": "^18.2.0",
|
|
130
131
|
"typescript": "^5.2.2"
|
|
131
132
|
},
|
|
132
|
-
"gitHead": "
|
|
133
|
+
"gitHead": "626046c20b138596dc5bd520b29c885823531fb6"
|
|
133
134
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
CardActionsProps,
|
|
2
3
|
CardContentProps,
|
|
3
4
|
CardDescriptionProps,
|
|
4
5
|
CardFooterProps,
|
|
5
6
|
CardHeaderProps,
|
|
6
7
|
CardImageProps,
|
|
8
|
+
CardTitleProps,
|
|
7
9
|
CardProps,
|
|
10
|
+
CardBodyProps,
|
|
8
11
|
} from "./types";
|
|
9
12
|
import { cn } from "../../utilities";
|
|
10
13
|
import { getCardClasses } from "./constants";
|
|
@@ -27,6 +30,10 @@ const Card = ({
|
|
|
27
30
|
);
|
|
28
31
|
|
|
29
32
|
const CardHeader = ({ className, ...props }: CardHeaderProps) => (
|
|
33
|
+
<div className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const CardTitle = ({ className, ...props }: CardTitleProps) => (
|
|
30
37
|
<h3 className={cn("card-title", className)} {...props} />
|
|
31
38
|
);
|
|
32
39
|
|
|
@@ -34,8 +41,12 @@ const CardDescription = ({ className, ...props }: CardDescriptionProps) => (
|
|
|
34
41
|
<p className={cn("text-sm text-muted-foreground", className)} {...props} />
|
|
35
42
|
);
|
|
36
43
|
|
|
44
|
+
const CardBody = ({ className, ...props }: CardBodyProps) => (
|
|
45
|
+
<div className={cn("card-body", className)} {...props} />
|
|
46
|
+
);
|
|
47
|
+
|
|
37
48
|
const CardContent = ({ className, ...props }: CardContentProps) => (
|
|
38
|
-
<div className={cn("
|
|
49
|
+
<div className={cn("p-6 pt-0", className)} {...props} />
|
|
39
50
|
);
|
|
40
51
|
|
|
41
52
|
const CardImage = ({ className, src, alt, ...props }: CardImageProps) => (
|
|
@@ -44,11 +55,18 @@ const CardImage = ({ className, src, alt, ...props }: CardImageProps) => (
|
|
|
44
55
|
</figure>
|
|
45
56
|
);
|
|
46
57
|
|
|
47
|
-
const
|
|
58
|
+
const CardActions = ({ className, ...props }: CardActionsProps) => (
|
|
48
59
|
<div className={cn("card-actions", className)} {...props} />
|
|
49
60
|
);
|
|
50
61
|
|
|
62
|
+
const CardFooter = ({ className, ...props }: CardFooterProps) => (
|
|
63
|
+
<div className={cn("flex items-center p-6 pt-0", className)} {...props} />
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
Card.Actions = CardActions;
|
|
67
|
+
Card.Body = CardBody;
|
|
51
68
|
Card.Header = CardHeader;
|
|
69
|
+
Card.Title = CardTitle;
|
|
52
70
|
Card.Content = CardContent;
|
|
53
71
|
Card.Description = CardDescription;
|
|
54
72
|
Card.Image = CardImage;
|
|
@@ -5,8 +5,11 @@ import { getCardClasses } from "./constants";
|
|
|
5
5
|
export type CardProps = React.HTMLAttributes<HTMLDivElement> &
|
|
6
6
|
VariantProps<typeof getCardClasses>;
|
|
7
7
|
|
|
8
|
+
export type CardActionsProps = React.HTMLAttributes<HTMLDivElement>;
|
|
9
|
+
export type CardBodyProps = React.HTMLAttributes<HTMLDivElement>;
|
|
8
10
|
export type CardContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
9
11
|
export type CardImageProps = React.ImgHTMLAttributes<HTMLImageElement>;
|
|
10
12
|
export type CardHeaderProps = React.HTMLAttributes<HTMLDivElement>;
|
|
13
|
+
export type CardTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
|
|
11
14
|
export type CardFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
12
15
|
export type CardDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
@@ -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(
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
5
|
+
import { cn } from "../../utilities";
|
|
6
|
+
import {
|
|
7
|
+
getTabsContentClasses,
|
|
8
|
+
getTabsListClasses,
|
|
9
|
+
getTabsTriggerClasses,
|
|
10
|
+
} from "./constants";
|
|
11
|
+
import type {
|
|
12
|
+
TabsContentProps,
|
|
13
|
+
TabsListProps,
|
|
14
|
+
TabsProps,
|
|
15
|
+
TabsTriggerProps,
|
|
16
|
+
} from "./types";
|
|
17
|
+
|
|
18
|
+
const Tabs = (props: TabsProps) => <TabsPrimitive.Root {...props} />;
|
|
19
|
+
|
|
20
|
+
const TabsList = React.forwardRef<
|
|
21
|
+
React.ElementRef<typeof TabsPrimitive.List>,
|
|
22
|
+
TabsListProps
|
|
23
|
+
>(({ className, ...props }, ref) => (
|
|
24
|
+
<TabsPrimitive.List
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cn(getTabsListClasses(), className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
));
|
|
30
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
31
|
+
|
|
32
|
+
const TabsTrigger = React.forwardRef<
|
|
33
|
+
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
34
|
+
TabsTriggerProps
|
|
35
|
+
>(({ className, ...props }, ref) => (
|
|
36
|
+
<TabsPrimitive.Trigger
|
|
37
|
+
ref={ref}
|
|
38
|
+
className={cn(getTabsTriggerClasses(), className)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
));
|
|
42
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
43
|
+
|
|
44
|
+
const TabsContent = React.forwardRef<
|
|
45
|
+
React.ElementRef<typeof TabsPrimitive.Content>,
|
|
46
|
+
TabsContentProps
|
|
47
|
+
>(({ className, ...props }, ref) => (
|
|
48
|
+
<TabsPrimitive.Content
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn(getTabsContentClasses(), className)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
));
|
|
54
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
55
|
+
|
|
56
|
+
Tabs.List = TabsList;
|
|
57
|
+
Tabs.Trigger = TabsTrigger;
|
|
58
|
+
Tabs.Content = TabsContent;
|
|
59
|
+
|
|
60
|
+
export { Tabs };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
|
|
3
|
+
export const getTabsListClasses = cva(
|
|
4
|
+
"inline-flex h-9 items-center justify-center rounded-lg bg-base-200 p-1"
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
export const getTabsTriggerClasses = cva(
|
|
8
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-base-100 data-[state=active]:text-foreground data-[state=active]:shadow"
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
export const getTabsContentClasses = cva(
|
|
12
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
13
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tabs } from "./Tabs";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
import { type VariantProps } from "../../libs";
|
|
3
|
+
import {
|
|
4
|
+
getTabsContentClasses,
|
|
5
|
+
getTabsListClasses,
|
|
6
|
+
getTabsTriggerClasses,
|
|
7
|
+
} from "./constants";
|
|
8
|
+
|
|
9
|
+
export type TabsProps = React.ComponentPropsWithoutRef<
|
|
10
|
+
typeof TabsPrimitive.Root
|
|
11
|
+
>;
|
|
12
|
+
|
|
13
|
+
export type TabsListProps = React.ComponentPropsWithoutRef<
|
|
14
|
+
typeof TabsPrimitive.List
|
|
15
|
+
> &
|
|
16
|
+
VariantProps<typeof getTabsListClasses>;
|
|
17
|
+
|
|
18
|
+
export type TabsTriggerProps = React.ComponentPropsWithoutRef<
|
|
19
|
+
typeof TabsPrimitive.Trigger
|
|
20
|
+
> &
|
|
21
|
+
VariantProps<typeof getTabsTriggerClasses>;
|
|
22
|
+
|
|
23
|
+
export type TabsContentProps = React.ComponentPropsWithoutRef<
|
|
24
|
+
typeof TabsPrimitive.Content
|
|
25
|
+
> &
|
|
26
|
+
VariantProps<typeof getTabsContentClasses>;
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./components/Description";
|
|
|
12
12
|
export * from "./components/Progress";
|
|
13
13
|
export * from "./components/Separator";
|
|
14
14
|
export * from "./components/Sonner";
|
|
15
|
+
export * from "./components/Tabs";
|
|
15
16
|
export * from "./components/Text";
|
|
16
17
|
|
|
17
18
|
/** data input */
|