@mbao01/common 0.0.5 → 0.0.6
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/README.md +1 -2
- package/dist/types/components/Badge/Badge.d.ts +1 -1
- package/dist/types/components/Badge/constants.d.ts +5 -5
- package/dist/types/components/Badge/types.d.ts +3 -7
- package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +3 -0
- package/dist/types/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/types/components/Breadcrumbs/types.d.ts +2 -0
- package/dist/types/components/Button/Button.d.ts +11 -2
- package/dist/types/components/Button/constants.d.ts +7 -8
- package/dist/types/components/Button/types.d.ts +6 -12
- package/dist/types/components/Card/Card.d.ts +1 -1
- package/dist/types/components/Card/constants.d.ts +6 -0
- package/dist/types/components/Card/types.d.ts +3 -18
- package/dist/types/components/Description/Description.d.ts +2 -2
- package/dist/types/components/Loading/Loading.d.ts +2 -0
- package/dist/types/components/Loading/constants.d.ts +5 -0
- package/dist/types/components/Loading/index.d.ts +1 -0
- package/dist/types/components/Loading/types.d.ts +3 -0
- package/dist/types/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/types/components/Skeleton/constants.d.ts +6 -5
- package/dist/types/components/Skeleton/types.d.ts +3 -7
- package/dist/types/components/Text/Text.d.ts +2 -4
- package/dist/types/components/Text/constants.d.ts +4 -5
- package/dist/types/components/Text/types.d.ts +4 -9
- package/dist/types/components/Tooltip/Tooltip.d.ts +14 -2
- package/dist/types/components/Tooltip/constants.d.ts +6 -5
- package/dist/types/components/Tooltip/types.d.ts +5 -10
- package/dist/types/index.d.ts +2 -0
- package/dist/types/libs/cva.d.ts +1 -0
- package/dist/types/libs/index.d.ts +1 -0
- package/dist/types/utilities/cn.d.ts +2 -0
- package/dist/types/utilities/getSubpaths/getSubpaths.d.ts +6 -0
- package/dist/types/utilities/getSubpaths/index.d.ts +1 -0
- package/dist/types/utilities/index.d.ts +2 -0
- package/package.json +11 -4
- package/plugin.js +1 -3
- package/src/components/Badge/Badge.tsx +4 -14
- package/src/components/Badge/constants.ts +28 -30
- package/src/components/Badge/types.ts +4 -17
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +13 -0
- package/src/components/Breadcrumbs/index.ts +1 -0
- package/src/components/Breadcrumbs/types.ts +3 -0
- package/src/components/Button/Button.tsx +51 -37
- package/src/components/Button/constants.ts +39 -43
- package/src/components/Button/types.ts +7 -25
- package/src/components/Card/Card.tsx +9 -15
- package/src/components/Card/constants.ts +22 -0
- package/src/components/Card/types.ts +4 -18
- package/src/components/Description/Description.tsx +11 -6
- package/src/components/Loading/Loading.tsx +18 -0
- package/src/components/Loading/constants.ts +30 -0
- package/src/components/Loading/index.ts +1 -0
- package/src/components/Loading/types.ts +5 -0
- package/src/components/Skeleton/Skeleton.tsx +7 -11
- package/src/components/Skeleton/constants.ts +39 -37
- package/src/components/Skeleton/types.ts +4 -7
- package/src/components/Text/Text.tsx +24 -9
- package/src/components/Text/constants.ts +26 -28
- package/src/components/Text/types.ts +9 -20
- package/src/components/Tooltip/Tooltip.tsx +35 -21
- package/src/components/Tooltip/constants.ts +32 -31
- package/src/components/Tooltip/types.ts +13 -22
- package/src/index.ts +2 -0
- package/src/libs/cva.ts +1 -0
- package/src/libs/index.ts +1 -0
- package/src/utilities/cn.ts +6 -0
- package/src/utilities/getSubpaths/getSubpaths.ts +34 -0
- package/src/utilities/getSubpaths/index.ts +1 -0
- package/src/utilities/index.ts +2 -0
- package/vitest-setup.ts +11 -1
package/README.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type BadgeProps } from "./types";
|
|
2
|
-
export declare const Badge: ({ size, outline, variant,
|
|
2
|
+
export declare const Badge: ({ size, outline, variant, className, ...props }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) => string;
|
|
1
|
+
export declare const getBadgeClasses: (props?: ({
|
|
2
|
+
variant?: "accent" | "error" | "ghost" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
3
|
+
outline?: boolean | null | undefined;
|
|
4
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type BadgeProps = React.HTMLAttributes<HTMLSpanElement> &
|
|
4
|
-
size?: BadgeSize;
|
|
5
|
-
outline?: boolean;
|
|
6
|
-
variant?: BadgeVariant;
|
|
7
|
-
};
|
|
1
|
+
import { type VariantProps } from "../../libs";
|
|
2
|
+
import { getBadgeClasses } from "./constants";
|
|
3
|
+
export type BadgeProps = React.HTMLAttributes<HTMLSpanElement> & VariantProps<typeof getBadgeClasses>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Breadcrumbs } from "./Breadcrumbs";
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & import("class-variance-authority").VariantProps<(props?: ({
|
|
3
|
+
variant?: "accent" | "default" | "error" | "ghost" | "info" | "link" | "neutral" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
4
|
+
outline?: boolean | null | undefined;
|
|
5
|
+
wide?: boolean | null | undefined;
|
|
6
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
7
|
+
isLoading?: boolean | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
9
|
+
as?: "a" | "span" | "p" | undefined;
|
|
10
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export { Button };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
wide?: boolean | undefined;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}) => string;
|
|
1
|
+
export declare const getButtonClasses: (props?: ({
|
|
2
|
+
variant?: "accent" | "default" | "error" | "ghost" | "info" | "link" | "neutral" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
3
|
+
outline?: boolean | null | undefined;
|
|
4
|
+
wide?: boolean | null | undefined;
|
|
5
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
6
|
+
isLoading?: boolean | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type ButtonProps = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
label: ReactNode;
|
|
8
|
-
loading?: boolean;
|
|
9
|
-
outline?: boolean;
|
|
10
|
-
variant?: ButtonVariant;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
} & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
1
|
+
import { type VariantProps } from "../../libs";
|
|
2
|
+
import { type ButtonHTMLAttributes } from "react";
|
|
3
|
+
import { getButtonClasses } from "./constants";
|
|
4
|
+
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof getButtonClasses> & {
|
|
5
|
+
as?: keyof Pick<JSX.IntrinsicElements, "a" | "span" | "p">;
|
|
6
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardImageProps, CardProps } from "./types";
|
|
1
|
+
import type { CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardImageProps, CardProps } from "./types";
|
|
2
2
|
declare const Card: {
|
|
3
3
|
({ compact, bordered, horizontal, overlay, className, ...props }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
Header: ({ className, ...props }: CardHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const getCardClasses: (props?: ({
|
|
2
|
+
bordered?: boolean | null | undefined;
|
|
3
|
+
compact?: boolean | null | undefined;
|
|
4
|
+
horizontal?: boolean | null | undefined;
|
|
5
|
+
overlay?: boolean | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
compact?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* applies border to the card.
|
|
9
|
-
*/
|
|
10
|
-
bordered?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* shows the card horizontally with image to the right or left of it.
|
|
13
|
-
*/
|
|
14
|
-
horizontal?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* overlay is used to make the image full width with the content on top.
|
|
17
|
-
*/
|
|
18
|
-
overlay?: boolean;
|
|
19
|
-
} & React.HTMLAttributes<HTMLDivElement>;
|
|
2
|
+
import { type VariantProps } from "../../libs";
|
|
3
|
+
import { getCardClasses } from "./constants";
|
|
4
|
+
export type CardProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getCardClasses>;
|
|
20
5
|
export type CardContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
21
6
|
export type CardImageProps = React.ImgHTMLAttributes<HTMLImageElement>;
|
|
22
7
|
export type CardHeaderProps = React.HTMLAttributes<HTMLDivElement>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DescriptionProps, DescriptionTermProps, DescriptionDetailProps } from "./types";
|
|
2
2
|
declare const Description: {
|
|
3
3
|
(props: DescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
Term: (props: DescriptionTermProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
Detail: (props: DescriptionDetailProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Term: ({ className, ...props }: DescriptionTermProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Detail: ({ className, ...props }: DescriptionDetailProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
};
|
|
7
7
|
export { Description };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const getLoadingClasses: (props?: ({
|
|
2
|
+
variant?: "spinner" | "dots" | "ring" | "ball" | "bars" | "infinity" | null | undefined;
|
|
3
|
+
intent?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
4
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Loading } from "./Loading";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type SkeletonProps } from "./types";
|
|
2
|
-
export declare const Skeleton: ({
|
|
2
|
+
export declare const Skeleton: ({ round, width, height, variant, className, ...props }: SkeletonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
width?:
|
|
4
|
-
height?:
|
|
5
|
-
|
|
1
|
+
export declare const getSkeletonClasses: (props?: ({
|
|
2
|
+
variant?: "pulse" | null | undefined;
|
|
3
|
+
width?: "full" | 4 | 2 | 8 | 12 | 16 | 24 | 32 | 48 | 64 | null | undefined;
|
|
4
|
+
height?: "full" | 4 | 2 | 8 | 12 | 16 | 24 | 32 | 48 | 64 | null | undefined;
|
|
5
|
+
round?: boolean | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
height?: Size;
|
|
5
|
-
round?: boolean;
|
|
6
|
-
className?: string;
|
|
7
|
-
};
|
|
1
|
+
import { type VariantProps } from "../../libs";
|
|
2
|
+
import { getSkeletonClasses } from "./constants";
|
|
3
|
+
export type SkeletonProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getSkeletonClasses>;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { type TextProps } from
|
|
2
|
-
export declare const Text: ({ as, size, variant, children, className }: TextProps) => import("react").
|
|
3
|
-
className: string;
|
|
4
|
-
}, HTMLElement>;
|
|
1
|
+
import { type TextProps } from "./types";
|
|
2
|
+
export declare const Text: ({ as, size, variant, children, className, ...props }: TextProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
size?:
|
|
4
|
-
|
|
5
|
-
}) => string;
|
|
1
|
+
export declare const getTextClasses: (props?: ({
|
|
2
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
3
|
+
size?: "xs" | "sm" | "lg" | "base" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
as?: TextTag;
|
|
6
|
-
size?: TextSize;
|
|
7
|
-
variant?: TextVariant;
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
className?: string;
|
|
1
|
+
import { type VariantProps } from "../../libs";
|
|
2
|
+
import { getTextClasses } from "./constants";
|
|
3
|
+
export type TextProps = React.HTMLAttributes<HTMLSpanElement> & VariantProps<typeof getTextClasses> & {
|
|
4
|
+
as?: keyof Pick<JSX.IntrinsicElements, "h1" | "h2" | "h3" | "h4" | "h5" | "p">;
|
|
10
5
|
};
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3
|
+
import type { TooltipArrowProps } from "./types";
|
|
4
|
+
declare const Tooltip: {
|
|
5
|
+
(props: TooltipPrimitive.TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Content: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & TooltipPrimitive.TooltipContentProps & import("class-variance-authority").VariantProps<(props?: ({
|
|
7
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
Arrow: ({ className, variant, ...props }: TooltipArrowProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
Portal: React.FC<TooltipPrimitive.TooltipPortalProps>;
|
|
11
|
+
Provider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
12
|
+
Trigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
};
|
|
14
|
+
export { Tooltip };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export declare const getTooltipContentClasses: (props?: ({
|
|
2
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
3
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
4
|
+
export declare const getTooltipArrowClasses: (props?: ({
|
|
5
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
variant?: TooltipVariant;
|
|
8
|
-
position?: TooltipPosition;
|
|
9
|
-
className?: string;
|
|
10
|
-
};
|
|
1
|
+
import { type VariantProps } from "../../libs";
|
|
2
|
+
import { getTooltipArrowClasses, getTooltipContentClasses } from "./constants";
|
|
3
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4
|
+
export type TooltipArrowProps = React.HTMLAttributes<React.ElementRef<typeof TooltipPrimitive.Arrow>> & TooltipPrimitive.TooltipArrowProps & VariantProps<typeof getTooltipArrowClasses>;
|
|
5
|
+
export type TooltipContentProps = React.HTMLAttributes<React.ElementRef<typeof TooltipPrimitive.Content>> & TooltipPrimitive.TooltipContentProps & VariantProps<typeof getTooltipContentClasses>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** actions */
|
|
2
2
|
export * from "./components/Button";
|
|
3
|
+
export * from "./components/Breadcrumbs";
|
|
3
4
|
/** data display */
|
|
4
5
|
export * from "./components/Badge";
|
|
5
6
|
export * from "./components/Card";
|
|
@@ -7,5 +8,6 @@ export * from "./components/Description";
|
|
|
7
8
|
export * from "./components/Text";
|
|
8
9
|
/** data input */
|
|
9
10
|
/** feedback */
|
|
11
|
+
export * from "./components/Loading";
|
|
10
12
|
export * from "./components/Skeleton";
|
|
11
13
|
export * from "./components/Tooltip";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { cva, type VariantProps } from "class-variance-authority";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { cva, type VariantProps } from "./cva";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getSubpaths } from "./getSubpaths";
|
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.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ayomide Bakare",
|
|
7
7
|
"license": "MIT",
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
"default": "./src/index.ts"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
+
"./libs": "./src/libs/index.ts",
|
|
23
24
|
"./plugin": "./plugin.js",
|
|
25
|
+
"./utilities": "./src/utilities/index.ts",
|
|
24
26
|
"./vitest/setup": "./vitest-setup.ts",
|
|
25
27
|
"./vitest/config": "./vitest.config.ts",
|
|
26
28
|
"./styles": "./src/stylesheets/index.css"
|
|
@@ -58,8 +60,14 @@
|
|
|
58
60
|
"test:coverage": "vitest run --coverage"
|
|
59
61
|
},
|
|
60
62
|
"dependencies": {
|
|
63
|
+
"@radix-ui/react-icons": "^1.3.0",
|
|
64
|
+
"@radix-ui/react-slot": "^1.0.2",
|
|
65
|
+
"@radix-ui/react-tooltip": "^1.0.7",
|
|
66
|
+
"class-variance-authority": "^0.7.0",
|
|
61
67
|
"clsx": "^2.1.0",
|
|
62
|
-
"daisyui": "^4.6.2"
|
|
68
|
+
"daisyui": "^4.6.2",
|
|
69
|
+
"tailwind-merge": "^2.2.1",
|
|
70
|
+
"tailwindcss-animate": "^1.0.7"
|
|
63
71
|
},
|
|
64
72
|
"devDependencies": {
|
|
65
73
|
"@storybook/addon-essentials": "^7.6.14",
|
|
@@ -102,10 +110,9 @@
|
|
|
102
110
|
"vitest": "^1.2.2"
|
|
103
111
|
},
|
|
104
112
|
"peerDependencies": {
|
|
105
|
-
"@heroicons/react": "^2.1.1",
|
|
106
113
|
"react": "^18.2.0",
|
|
107
114
|
"react-dom": "^18.2.0",
|
|
108
115
|
"typescript": "^5.2.2"
|
|
109
116
|
},
|
|
110
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "ceb6cef48e8547b4da5c51dda329bd6edee73c0b"
|
|
111
118
|
}
|
package/plugin.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { cn } from "../../utilities";
|
|
2
2
|
import { getBadgeClasses } from "./constants";
|
|
3
3
|
import { type BadgeProps } from "./types";
|
|
4
4
|
|
|
5
5
|
export const Badge = ({
|
|
6
6
|
size,
|
|
7
7
|
outline,
|
|
8
|
-
variant
|
|
9
|
-
children,
|
|
8
|
+
variant,
|
|
10
9
|
className,
|
|
11
10
|
...props
|
|
12
11
|
}: BadgeProps) => {
|
|
13
12
|
return (
|
|
14
13
|
<span
|
|
14
|
+
className={cn(getBadgeClasses({ size, variant, outline }), className)}
|
|
15
15
|
{...props}
|
|
16
|
-
|
|
17
|
-
getBadgeClasses({ size, variant }),
|
|
18
|
-
{
|
|
19
|
-
"badge-outline": outline,
|
|
20
|
-
"text-base-200": !["ghost", "neutral"].includes(variant),
|
|
21
|
-
},
|
|
22
|
-
className
|
|
23
|
-
)}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
</span>
|
|
16
|
+
/>
|
|
27
17
|
);
|
|
28
18
|
};
|
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { BadgeSize, BadgeVariant } from "./types";
|
|
1
|
+
import { cva } from "../../libs";
|
|
3
2
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
};
|
|
3
|
+
export const getBadgeClasses = cva("badge", {
|
|
4
|
+
variants: {
|
|
5
|
+
variant: {
|
|
6
|
+
accent: "badge-accent",
|
|
7
|
+
error: "badge-error",
|
|
8
|
+
ghost: "badge-ghost",
|
|
9
|
+
info: "badge-info",
|
|
10
|
+
neutral: "badge-neutral",
|
|
11
|
+
primary: "badge-primary",
|
|
12
|
+
secondary: "badge-secondary",
|
|
13
|
+
success: "badge-success",
|
|
14
|
+
warning: "badge-warning",
|
|
15
|
+
},
|
|
16
|
+
outline: {
|
|
17
|
+
true: "badge-outline",
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
xs: "badge-xs",
|
|
21
|
+
sm: "badge-sm",
|
|
22
|
+
md: "badge-md",
|
|
23
|
+
lg: "badge-lg",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: "ghost",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type VariantProps } from "../../libs";
|
|
2
|
+
import { getBadgeClasses } from "./constants";
|
|
2
3
|
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
| "primary"
|
|
6
|
-
| "secondary"
|
|
7
|
-
| "accent"
|
|
8
|
-
| "ghost"
|
|
9
|
-
| "info"
|
|
10
|
-
| "success"
|
|
11
|
-
| "warning"
|
|
12
|
-
| "error";
|
|
13
|
-
|
|
14
|
-
export type BadgeProps = React.HTMLAttributes<HTMLSpanElement> & {
|
|
15
|
-
size?: BadgeSize;
|
|
16
|
-
outline?: boolean;
|
|
17
|
-
variant?: BadgeVariant;
|
|
18
|
-
};
|
|
4
|
+
export type BadgeProps = React.HTMLAttributes<HTMLSpanElement> &
|
|
5
|
+
VariantProps<typeof getBadgeClasses>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BreadcrumbProps, BreadcrumbsProps } from "./types";
|
|
2
|
+
|
|
3
|
+
export const Breadcrumbs = (props: BreadcrumbsProps) => {
|
|
4
|
+
return (
|
|
5
|
+
<div className="breadcrumbs -ml-1 w-fit px-1 text-sm">
|
|
6
|
+
<ul {...props} />
|
|
7
|
+
</div>
|
|
8
|
+
);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Breadcrumb = (props: BreadcrumbProps) => {
|
|
12
|
+
return <li {...props} />;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Breadcrumbs } from "./Breadcrumbs";
|
|
@@ -1,40 +1,54 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
3
|
import { type ButtonProps } from "./types";
|
|
4
|
+
import { getButtonClasses } from "./constants";
|
|
5
|
+
import { Loading } from "../Loading";
|
|
6
|
+
import { cn } from "../../utilities";
|
|
7
|
+
|
|
8
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
9
|
+
(
|
|
10
|
+
{
|
|
11
|
+
as,
|
|
12
|
+
className,
|
|
13
|
+
outline,
|
|
14
|
+
children,
|
|
15
|
+
isLoading,
|
|
16
|
+
variant,
|
|
17
|
+
size,
|
|
18
|
+
wide,
|
|
19
|
+
...props
|
|
20
|
+
},
|
|
21
|
+
ref
|
|
22
|
+
) => {
|
|
23
|
+
const Comp = as ? Slot : "button";
|
|
24
|
+
const SlotChild = as ? as : React.Fragment;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Comp
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cn(
|
|
30
|
+
getButtonClasses({ size, wide, outline, variant, isLoading }),
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
>
|
|
35
|
+
{/* slot merges it's prop into it's immediate child */}
|
|
36
|
+
<SlotChild>
|
|
37
|
+
{children}
|
|
38
|
+
{isLoading ? (
|
|
39
|
+
<span
|
|
40
|
+
className="absolute left-0 top-0 flex h-full w-full items-center justify-center bg-[inherit]"
|
|
41
|
+
data-testid="loading"
|
|
42
|
+
>
|
|
43
|
+
<Loading />
|
|
44
|
+
</span>
|
|
45
|
+
) : null}
|
|
46
|
+
</SlotChild>
|
|
47
|
+
</Comp>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
);
|
|
4
51
|
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
className,
|
|
8
|
-
outline,
|
|
9
|
-
label,
|
|
10
|
-
disabled,
|
|
11
|
-
onClick,
|
|
12
|
-
loading,
|
|
13
|
-
variant,
|
|
14
|
-
size,
|
|
15
|
-
wide,
|
|
16
|
-
...rest
|
|
17
|
-
} = props;
|
|
52
|
+
Button.displayName = "Button";
|
|
18
53
|
|
|
19
|
-
|
|
20
|
-
<button
|
|
21
|
-
{...rest}
|
|
22
|
-
onClick={onClick}
|
|
23
|
-
disabled={disabled}
|
|
24
|
-
className={c(
|
|
25
|
-
getButtonClasses({ size, wide, outline, variant, loading }),
|
|
26
|
-
className
|
|
27
|
-
)}
|
|
28
|
-
>
|
|
29
|
-
{label}
|
|
30
|
-
{loading ? (
|
|
31
|
-
<span
|
|
32
|
-
className="absolute left-0 top-0 flex h-full w-full items-center justify-center bg-[inherit]"
|
|
33
|
-
data-testid="loading"
|
|
34
|
-
>
|
|
35
|
-
<span className="loading loading-spinner" />
|
|
36
|
-
</span>
|
|
37
|
-
) : null}
|
|
38
|
-
</button>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
54
|
+
export { Button };
|