@mbao01/common 0.0.3 → 0.0.5
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/Card/Card.d.ts +9 -7
- package/dist/types/components/Description/Description.d.ts +7 -0
- package/dist/types/components/Description/index.d.ts +1 -0
- package/dist/types/components/Description/types.d.ts +3 -0
- package/dist/types/components/Skeleton/Skeleton.d.ts +2 -0
- package/dist/types/components/Skeleton/constants.d.ts +5 -0
- package/dist/types/components/Skeleton/index.d.ts +1 -0
- package/dist/types/components/Skeleton/types.d.ts +7 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/types/components/Tooltip/index.d.ts +1 -1
- package/dist/types/components/Tooltip/types.d.ts +2 -2
- package/dist/types/index.d.ts +7 -2
- package/package.json +3 -3
- package/src/components/Card/Card.tsx +7 -8
- package/src/components/Description/Description.tsx +29 -0
- package/src/components/Description/index.ts +1 -0
- package/src/components/Description/types.ts +5 -0
- package/src/components/Skeleton/Skeleton.tsx +26 -0
- package/src/components/Skeleton/constants.ts +38 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Skeleton/types.ts +8 -0
- package/src/components/Tooltip/Tooltip.tsx +13 -2
- package/src/components/Tooltip/index.ts +1 -1
- package/src/components/Tooltip/types.ts +2 -2
- package/src/index.ts +10 -2
- package/dist/types/components/Detail/Detail.d.ts +0 -2
- package/dist/types/components/Detail/index.d.ts +0 -1
- package/dist/types/components/Detail/types.d.ts +0 -5
- package/src/components/Detail/Detail.tsx +0 -10
- package/src/components/Detail/index.ts +0 -1
- package/src/components/Detail/types.ts +0 -6
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardImageProps, CardProps } from "./types";
|
|
2
|
-
declare const Card:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
declare const Card: {
|
|
3
|
+
({ compact, bordered, horizontal, overlay, className, ...props }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Header: ({ className, ...props }: CardHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Content: ({ className, ...props }: CardContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Description: ({ className, ...props }: CardDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Image: ({ className, src, alt, ...props }: CardImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
Footer: ({ className, ...props }: CardFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export { Card };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DescriptionProps, DescriptionTermProps, DescriptionDetailProps } from "./types";
|
|
2
|
+
declare const Description: {
|
|
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;
|
|
6
|
+
};
|
|
7
|
+
export { Description };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Description } from "./Description";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Skeleton } from "./Skeleton";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type TooltipProps } from './types';
|
|
2
|
-
export declare const Tooltip: ({
|
|
2
|
+
export declare const Tooltip: ({ content, children, variant, position, className, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Tooltip } from
|
|
1
|
+
export { Tooltip } from "./Tooltip";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
export type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
3
3
|
export type TooltipVariant = 'default' | 'neutral' | 'primary' | 'secondary' | 'accent' | 'ghost' | 'link' | 'info' | 'success' | 'warning' | 'error';
|
|
4
|
-
export type TooltipProps = {
|
|
5
|
-
|
|
4
|
+
export type TooltipProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
content: string;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
variant?: TooltipVariant;
|
|
8
8
|
position?: TooltipPosition;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/** actions */
|
|
2
2
|
export * from "./components/Button";
|
|
3
|
+
/** data display */
|
|
4
|
+
export * from "./components/Badge";
|
|
3
5
|
export * from "./components/Card";
|
|
4
|
-
export * from "./components/
|
|
6
|
+
export * from "./components/Description";
|
|
5
7
|
export * from "./components/Text";
|
|
8
|
+
/** data input */
|
|
9
|
+
/** feedback */
|
|
10
|
+
export * from "./components/Skeleton";
|
|
6
11
|
export * from "./components/Tooltip";
|
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.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ayomide Bakare",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"vitest.config.ts"
|
|
39
39
|
],
|
|
40
40
|
"bugs": "https://github.com/mbao01/mbao01/issues",
|
|
41
|
-
"homepage": "https://
|
|
41
|
+
"homepage": "https://ui.ayomidebakare.site/common/",
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|
|
44
44
|
"url": "git+https://github.com/mbao01/mbao01.git"
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"react-dom": "^18.2.0",
|
|
108
108
|
"typescript": "^5.2.2"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "d40fb1867ee09180de85ab18ffe74c4436e43413"
|
|
111
111
|
}
|
|
@@ -54,11 +54,10 @@ const CardFooter = ({ className, ...props }: CardFooterProps) => (
|
|
|
54
54
|
<div className={c("card-actions", className)} {...props} />
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
57
|
+
Card.Header = CardHeader;
|
|
58
|
+
Card.Content = CardContent;
|
|
59
|
+
Card.Description = CardDescription;
|
|
60
|
+
Card.Image = CardImage;
|
|
61
|
+
Card.Footer = CardFooter;
|
|
62
|
+
|
|
63
|
+
export { Card };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import c from "clsx";
|
|
2
|
+
import type {
|
|
3
|
+
DescriptionProps,
|
|
4
|
+
DescriptionTermProps,
|
|
5
|
+
DescriptionDetailProps,
|
|
6
|
+
} from "./types";
|
|
7
|
+
|
|
8
|
+
const Description = (props: DescriptionProps) => {
|
|
9
|
+
return <dl role="list" {...props} />;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const DescriptionTerm = (props: DescriptionTermProps) => {
|
|
13
|
+
return (
|
|
14
|
+
<dt
|
|
15
|
+
{...props}
|
|
16
|
+
role="listitem"
|
|
17
|
+
className={c("mb-1 py-2 text-sm font-medium", props.className)}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const DescriptionDetail = (props: DescriptionDetailProps) => {
|
|
23
|
+
return <dd {...props} className={c("text-base", props.className)} />;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
Description.Term = DescriptionTerm;
|
|
27
|
+
Description.Detail = DescriptionDetail;
|
|
28
|
+
|
|
29
|
+
export { Description };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Description } from "./Description";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import c from "clsx";
|
|
2
|
+
import { type SkeletonProps } from "./types";
|
|
3
|
+
import { getSkeletonSize } from "./constants";
|
|
4
|
+
|
|
5
|
+
export const Skeleton = ({
|
|
6
|
+
className,
|
|
7
|
+
round,
|
|
8
|
+
width,
|
|
9
|
+
height,
|
|
10
|
+
...props
|
|
11
|
+
}: SkeletonProps) => {
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
{...props}
|
|
15
|
+
className={c(
|
|
16
|
+
"skeleton",
|
|
17
|
+
getSkeletonSize({ width, height }),
|
|
18
|
+
{
|
|
19
|
+
"rounded-md": !round,
|
|
20
|
+
"rounded-full": round,
|
|
21
|
+
},
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import c from "clsx";
|
|
2
|
+
import { Size } from "./types";
|
|
3
|
+
|
|
4
|
+
const WIDTH_SIZES = {
|
|
5
|
+
2: c("w-2"),
|
|
6
|
+
4: c("w-4"),
|
|
7
|
+
8: c("w-8"),
|
|
8
|
+
12: c("w-12"),
|
|
9
|
+
16: c("w-16"),
|
|
10
|
+
24: c("w-24"),
|
|
11
|
+
32: c("w-32"),
|
|
12
|
+
48: c("w-48"),
|
|
13
|
+
64: c("w-64"),
|
|
14
|
+
full: c("w-full"),
|
|
15
|
+
} satisfies Record<Size, string>;
|
|
16
|
+
|
|
17
|
+
const HEIGHT_SIZES = {
|
|
18
|
+
2: c("h-2"),
|
|
19
|
+
4: c("h-4"),
|
|
20
|
+
8: c("h-8"),
|
|
21
|
+
12: c("h-12"),
|
|
22
|
+
16: c("h-16"),
|
|
23
|
+
24: c("h-24"),
|
|
24
|
+
32: c("h-32"),
|
|
25
|
+
48: c("h-48"),
|
|
26
|
+
64: c("h-64"),
|
|
27
|
+
full: c("h-full"),
|
|
28
|
+
} satisfies Record<Size, string>;
|
|
29
|
+
|
|
30
|
+
export const getSkeletonSize = ({
|
|
31
|
+
width,
|
|
32
|
+
height,
|
|
33
|
+
}: {
|
|
34
|
+
width?: Size;
|
|
35
|
+
height?: Size;
|
|
36
|
+
}) => {
|
|
37
|
+
return c(WIDTH_SIZES[width!] ?? "w-full", HEIGHT_SIZES[height!] ?? "h-4");
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Skeleton } from "./Skeleton";
|
|
@@ -2,9 +2,20 @@ import c from 'clsx';
|
|
|
2
2
|
import { getTooltipClasses } from './constants';
|
|
3
3
|
import { type TooltipProps } from './types';
|
|
4
4
|
|
|
5
|
-
export const Tooltip = ({
|
|
5
|
+
export const Tooltip = ({
|
|
6
|
+
content,
|
|
7
|
+
children,
|
|
8
|
+
variant,
|
|
9
|
+
position,
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: TooltipProps) => {
|
|
6
13
|
return (
|
|
7
|
-
<div
|
|
14
|
+
<div
|
|
15
|
+
{...props}
|
|
16
|
+
className={c(getTooltipClasses({ variant, position }), className)}
|
|
17
|
+
data-tip={content}
|
|
18
|
+
>
|
|
8
19
|
{children}
|
|
9
20
|
</div>
|
|
10
21
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Tooltip } from
|
|
1
|
+
export { Tooltip } from "./Tooltip";
|
|
@@ -15,8 +15,8 @@ export type TooltipVariant =
|
|
|
15
15
|
| 'warning'
|
|
16
16
|
| 'error';
|
|
17
17
|
|
|
18
|
-
export type TooltipProps = {
|
|
19
|
-
|
|
18
|
+
export type TooltipProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
19
|
+
content: string;
|
|
20
20
|
children: ReactNode;
|
|
21
21
|
variant?: TooltipVariant;
|
|
22
22
|
position?: TooltipPosition;
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/** actions */
|
|
2
2
|
export * from "./components/Button";
|
|
3
|
+
|
|
4
|
+
/** data display */
|
|
5
|
+
export * from "./components/Badge";
|
|
3
6
|
export * from "./components/Card";
|
|
4
|
-
export * from "./components/
|
|
7
|
+
export * from "./components/Description";
|
|
5
8
|
export * from "./components/Text";
|
|
9
|
+
|
|
10
|
+
/** data input */
|
|
11
|
+
|
|
12
|
+
/** feedback */
|
|
13
|
+
export * from "./components/Skeleton";
|
|
6
14
|
export * from "./components/Tooltip";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Detail } from './Detail';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Detail } from './Detail';
|