@mbao01/ui 0.0.2 → 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/README.md +0 -2
- package/dist/{src → types}/index.d.ts +1 -0
- package/package.json +5 -5
- package/src/components/Button/Button.tsx +40 -0
- package/src/components/Text/Text.tsx +12 -0
- package/src/index.ts +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/src/components/Button/Button.stories.d.ts +0 -19
- package/dist/src/components/Button/Button.test.d.ts +0 -1
- package/dist/src/components/Text/Text.stories.d.ts +0 -17
- package/dist/src/components/Text/Text.test.d.ts +0 -1
- package/dist/tailwind.config.d.ts +0 -3
- package/dist/vite.config.d.ts +0 -2
- package/dist/vitest-setup.d.ts +0 -0
- package/dist/vitest.config.d.ts +0 -2
- package/src/components/Button/Button.stories.ts +0 -77
- package/src/components/Text/Text.stories.ts +0 -47
- package/src/vite-env.d.ts +0 -1
- /package/dist/{src → types}/components/Button/Button.d.ts +0 -0
- /package/dist/{src → types}/components/Button/constants.d.ts +0 -0
- /package/dist/{src → types}/components/Button/index.d.ts +0 -0
- /package/dist/{src → types}/components/Button/types.d.ts +0 -0
- /package/dist/{src → types}/components/Text/Text.d.ts +0 -0
- /package/dist/{src → types}/components/Text/constants.d.ts +0 -0
- /package/dist/{src → types}/components/Text/index.d.ts +0 -0
- /package/dist/{src → types}/components/Text/types.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
[](http://commitizen.github.io/cz-cli/)
|
|
2
|
-
|
|
3
1
|
So here it is, I have gotten really bored creating UI component from scratch for the many projects I work on.
|
|
4
2
|
It is high time I have a unified component library - so here it is.
|
|
5
3
|
I have built this to be highly opinionated on certain libraries I love to use like typescript, tailwind, date-fns, and react.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbao01/ui",
|
|
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",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"library"
|
|
14
14
|
],
|
|
15
15
|
"main": "./src/index.ts",
|
|
16
|
-
"types": "
|
|
16
|
+
"types": "dist/types/index.d.ts",
|
|
17
17
|
"files": [
|
|
18
|
+
"src",
|
|
18
19
|
"plugin.js",
|
|
19
20
|
"plugin.d.ts",
|
|
20
|
-
"
|
|
21
|
-
"dist/**/*.d.ts"
|
|
21
|
+
"dist/types"
|
|
22
22
|
],
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"scripts": {
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"tailwindcss": "^3.4.0",
|
|
83
83
|
"typescript": "^5.2.2"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "c2c9b7d5cfa793a6c9e59f62814aa51de57ee42d"
|
|
86
86
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import c from "clsx";
|
|
2
|
+
import { getButtonClasses } from "./constants";
|
|
3
|
+
import { type ButtonProps } from "./types";
|
|
4
|
+
|
|
5
|
+
export const Button = (props: ButtonProps) => {
|
|
6
|
+
const {
|
|
7
|
+
className,
|
|
8
|
+
outline,
|
|
9
|
+
label,
|
|
10
|
+
disabled,
|
|
11
|
+
onClick,
|
|
12
|
+
loading,
|
|
13
|
+
variant,
|
|
14
|
+
size,
|
|
15
|
+
wide,
|
|
16
|
+
...rest
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
return (
|
|
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
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import c from 'clsx';
|
|
2
|
+
import { createElement } from 'react';
|
|
3
|
+
import { type TextProps } from './types';
|
|
4
|
+
import { getTextClasses } from './constants';
|
|
5
|
+
|
|
6
|
+
export const Text = ({ as = 'span', size, variant, children, className }: TextProps) => {
|
|
7
|
+
return createElement(
|
|
8
|
+
as,
|
|
9
|
+
{ className: c(getTextClasses({ size, variant }), className) },
|
|
10
|
+
children
|
|
11
|
+
);
|
|
12
|
+
};
|
package/src/index.ts
CHANGED
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/index'
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
declare const meta: {
|
|
3
|
-
component: (props: import("./types").ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
parameters: {
|
|
5
|
-
layout: string;
|
|
6
|
-
};
|
|
7
|
-
tags: string[];
|
|
8
|
-
argTypes: {};
|
|
9
|
-
};
|
|
10
|
-
export default meta;
|
|
11
|
-
type Story = StoryObj<typeof meta>;
|
|
12
|
-
export declare const Default: Story;
|
|
13
|
-
export declare const PrimaryButton: Story;
|
|
14
|
-
export declare const WideButton: Story;
|
|
15
|
-
export declare const TinyButton: Story;
|
|
16
|
-
export declare const OutlineButton: Story;
|
|
17
|
-
export declare const DisabledButton: Story;
|
|
18
|
-
export declare const LoadingButton: Story;
|
|
19
|
-
export declare const BlockButton: Story;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
declare const meta: {
|
|
3
|
-
component: ({ as, size, variant, children, className }: import("./types").TextProps) => import("react").DetailedReactHTMLElement<{
|
|
4
|
-
className: string;
|
|
5
|
-
}, HTMLElement>;
|
|
6
|
-
parameters: {
|
|
7
|
-
layout: string;
|
|
8
|
-
};
|
|
9
|
-
tags: string[];
|
|
10
|
-
argTypes: {};
|
|
11
|
-
};
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof meta>;
|
|
14
|
-
export declare const Default: Story;
|
|
15
|
-
export declare const PrimaryText: Story;
|
|
16
|
-
export declare const TinyText: Story;
|
|
17
|
-
export declare const HeadingText: Story;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/vite.config.d.ts
DELETED
package/dist/vitest-setup.d.ts
DELETED
|
File without changes
|
package/dist/vitest.config.d.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { Button } from './Button';
|
|
4
|
-
|
|
5
|
-
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
6
|
-
const meta = {
|
|
7
|
-
component: Button,
|
|
8
|
-
parameters: {
|
|
9
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
|
|
10
|
-
layout: 'centered',
|
|
11
|
-
},
|
|
12
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
13
|
-
tags: ['autodocs'],
|
|
14
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
15
|
-
argTypes: {},
|
|
16
|
-
} satisfies Meta<typeof Button>;
|
|
17
|
-
|
|
18
|
-
export default meta;
|
|
19
|
-
type Story = StoryObj<typeof meta>;
|
|
20
|
-
|
|
21
|
-
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
22
|
-
export const Default: Story = {
|
|
23
|
-
args: {
|
|
24
|
-
variant: 'default',
|
|
25
|
-
label: 'Button',
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const PrimaryButton: Story = {
|
|
30
|
-
args: {
|
|
31
|
-
variant: 'primary',
|
|
32
|
-
label: 'Button',
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const WideButton: Story = {
|
|
37
|
-
args: {
|
|
38
|
-
wide: true,
|
|
39
|
-
label: 'Wide Button',
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const TinyButton: Story = {
|
|
44
|
-
args: {
|
|
45
|
-
size: 'xs',
|
|
46
|
-
label: 'Tiny',
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const OutlineButton: Story = {
|
|
51
|
-
args: {
|
|
52
|
-
outline: true,
|
|
53
|
-
label: 'Click me!',
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export const DisabledButton: Story = {
|
|
58
|
-
args: {
|
|
59
|
-
disabled: true,
|
|
60
|
-
label: 'Click me?',
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const LoadingButton: Story = {
|
|
65
|
-
args: {
|
|
66
|
-
loading: true,
|
|
67
|
-
label: 'Loading',
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const BlockButton: Story = {
|
|
72
|
-
args: {
|
|
73
|
-
disabled: true,
|
|
74
|
-
className: 'btn-block',
|
|
75
|
-
label: 'Block Button',
|
|
76
|
-
},
|
|
77
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { Text } from './Text';
|
|
4
|
-
|
|
5
|
-
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
6
|
-
const meta = {
|
|
7
|
-
component: Text,
|
|
8
|
-
parameters: {
|
|
9
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
|
|
10
|
-
layout: 'centered',
|
|
11
|
-
},
|
|
12
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
13
|
-
tags: ['autodocs'],
|
|
14
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
15
|
-
argTypes: {},
|
|
16
|
-
} satisfies Meta<typeof Text>;
|
|
17
|
-
|
|
18
|
-
export default meta;
|
|
19
|
-
type Story = StoryObj<typeof meta>;
|
|
20
|
-
|
|
21
|
-
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
22
|
-
export const Default: Story = {
|
|
23
|
-
args: {
|
|
24
|
-
children: 'Text',
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const PrimaryText: Story = {
|
|
29
|
-
args: {
|
|
30
|
-
variant: 'primary',
|
|
31
|
-
children: 'Primary text',
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const TinyText: Story = {
|
|
36
|
-
args: {
|
|
37
|
-
size: 'xs',
|
|
38
|
-
children: 'Tiny Text',
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const HeadingText: Story = {
|
|
43
|
-
args: {
|
|
44
|
-
as: 'h1',
|
|
45
|
-
children: 'Heading 1',
|
|
46
|
-
},
|
|
47
|
-
};
|
package/src/vite-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|