@mbao01/common 0.0.16 → 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.
@@ -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>;
@@ -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>;
@@ -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.16",
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": "109cf6f95514f5d5b0bfc6f89bc02b8ecd821c41"
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("card-body p-6 pt-0", className)} {...props} />
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 CardFooter = ({ className, ...props }: CardFooterProps) => (
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>;
@@ -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 */