@rovula/ui 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/cjs/bundle.css +1207 -0
- package/dist/cjs/bundle.js +2 -0
- package/dist/cjs/bundle.js.map +1 -0
- package/dist/cjs/types/components/Button/Button.d.ts +15 -0
- package/dist/cjs/types/components/Button/Button.styles.d.ts +7 -0
- package/dist/cjs/types/components/Button/Buttons.stories.d.ts +375 -0
- package/dist/cjs/types/components/Text/Text.d.ts +12 -0
- package/dist/cjs/types/components/Text/Text.stories.d.ts +35 -0
- package/dist/cjs/types/index.d.ts +7 -0
- package/dist/components/Button/Button.js +31 -0
- package/dist/components/Button/Button.styles.js +90 -0
- package/dist/components/Button/Buttons.stories.js +66 -0
- package/dist/components/Form/Form.js +106 -0
- package/dist/components/Form/Text.js +6 -0
- package/dist/components/Form/TextInput.js +6 -0
- package/dist/components/Table/Table.js +6 -0
- package/dist/components/Tabs/Tabs.js +8 -0
- package/dist/components/Text/Text.js +6 -0
- package/dist/components/Text/Text.stories.js +73 -0
- package/dist/esm/bundle.css +1207 -0
- package/dist/esm/bundle.js +2 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/types/components/Button/Button.d.ts +15 -0
- package/dist/esm/types/components/Button/Button.styles.d.ts +7 -0
- package/dist/esm/types/components/Button/Buttons.stories.d.ts +375 -0
- package/dist/esm/types/components/Form/Form.d.ts +12 -0
- package/dist/esm/types/components/Form/Text.d.ts +9 -0
- package/dist/esm/types/components/Form/TextInput.d.ts +11 -0
- package/dist/esm/types/components/Table/Table.d.ts +11 -0
- package/dist/esm/types/components/Tabs/Tabs.d.ts +11 -0
- package/dist/esm/types/components/Text/Text.d.ts +12 -0
- package/dist/esm/types/components/Text/Text.stories.d.ts +35 -0
- package/dist/esm/types/index.d.ts +7 -0
- package/dist/esm/types/utils/datetime.d.ts +9 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.js +12 -0
- package/dist/src/theme/global.css +1485 -0
- package/dist/theme/global.css +136 -0
- package/dist/theme/main-preset.js +159 -0
- package/dist/theme/plugins/utilities/typography.js +69 -0
- package/dist/theme/presets/colors.js +140 -0
- package/dist/utils/datetime.js +30 -0
- package/package.json +42 -9
- package/src/components/Button/Button.styles.ts +98 -0
- package/src/components/Button/Button.tsx +48 -18
- package/src/components/Button/Buttons.stories.tsx +120 -0
- package/src/components/Text/Text.stories.tsx +112 -0
- package/src/components/Text/Text.tsx +59 -0
- package/src/index.ts +21 -0
- package/src/stories/Typography.mdx +160 -0
- package/src/theme/global.css +136 -0
- package/src/theme/main-preset.js +159 -0
- package/src/theme/plugins/utilities/typography.js +69 -0
- package/src/theme/presets/colors.js +140 -0
- package/dist/main.d.ts +0 -7
- package/dist/main.js +0 -25
- package/dist/src/components/Button/Button.d.ts +0 -12
- package/dist/src/components/Button/Button.js +0 -10
- package/dist/src/components/Form/Form.js +0 -91
- package/dist/src/components/Form/Text.js +0 -10
- package/dist/src/components/Form/TextInput.js +0 -10
- package/dist/src/components/Table/Table.js +0 -13
- package/dist/src/components/Tabs/Tabs.js +0 -33
- package/dist/src/utils/datetime.js +0 -37
- package/src/style.css +0 -3
- /package/dist/{src → cjs/types}/components/Form/Form.d.ts +0 -0
- /package/dist/{src → cjs/types}/components/Form/Text.d.ts +0 -0
- /package/dist/{src → cjs/types}/components/Form/TextInput.d.ts +0 -0
- /package/dist/{src → cjs/types}/components/Table/Table.d.ts +0 -0
- /package/dist/{src → cjs/types}/components/Tabs/Tabs.d.ts +0 -0
- /package/dist/{src → cjs/types}/utils/datetime.d.ts +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
export const buttonCva = cva(
|
|
4
|
+
[
|
|
5
|
+
// "inline-flex items-center justify-center align-middle no-underline transition-colors ease-in-out duration-300",
|
|
6
|
+
// "font-sans appearance-none select-none rounded-sm border font-medium tracking-[.02857em]",
|
|
7
|
+
// "aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-disabled:cursor-not-allowed",
|
|
8
|
+
"gap-2 font-bold text-white hover:bg-opacity-90 active:scale-[98%]",
|
|
9
|
+
],
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
color: {
|
|
13
|
+
primary: "bg-primary border-primary text-primary hover:bg-primary-80",
|
|
14
|
+
secondary:
|
|
15
|
+
"border-secondary bg-secondary-100 text-secondary-foreground hover:bg-secondary-120",
|
|
16
|
+
tertiary:
|
|
17
|
+
"border-tertiary-120 bg-tertiary-120 text-tertiary-120 hover:bg-tertiary-100",
|
|
18
|
+
success: "border-success bg-success text-success hover:bg-success-120",
|
|
19
|
+
info: "border-info bg-info text-info hover:bg-info-100",
|
|
20
|
+
warning:
|
|
21
|
+
"border-warning bg-warning text-warning hover:bg-warning-100 hover:border-warning-100",
|
|
22
|
+
error:
|
|
23
|
+
"border-error bg-error text-error hover:bg-error-120 hover:border-error-120",
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
sm: "px-3 py-1 text-sm rounded-[--btn-rounded-sm]",
|
|
27
|
+
md: "px-4 py-2 text-sm rounded-[--btn-rounded-md]",
|
|
28
|
+
lg: "px-6 py-4 text-base rounded-[--btn-rounded-lg]",
|
|
29
|
+
},
|
|
30
|
+
variant: {
|
|
31
|
+
solid: "border",
|
|
32
|
+
outline: "border bg-transparent hover:bg-opacity-20",
|
|
33
|
+
flat: "bg-transparent hover:bg-opacity-20",
|
|
34
|
+
link: "bg-transparent underline underline-offset-4 hover:bg-transparent hover:text-opacity-80",
|
|
35
|
+
},
|
|
36
|
+
disabled: {
|
|
37
|
+
true: "pointer-events-none border-transparent bg-secondary-110 text-secondary-130",
|
|
38
|
+
},
|
|
39
|
+
fullwidth: {
|
|
40
|
+
true: "w-full",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
compoundVariants: [
|
|
44
|
+
{
|
|
45
|
+
variant: ["flat", "link"],
|
|
46
|
+
disabled: true,
|
|
47
|
+
class: "border-transparent bg-transparent",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
variant: "solid",
|
|
51
|
+
color: "primary",
|
|
52
|
+
class: "text-primary-foreground",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
variant: "solid",
|
|
56
|
+
color: "secondary",
|
|
57
|
+
class: "text-secondary-foreground",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
variant: "solid",
|
|
61
|
+
disabled: true,
|
|
62
|
+
color: "secondary",
|
|
63
|
+
class: "text-white",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
variant: "solid",
|
|
67
|
+
color: "tertiary",
|
|
68
|
+
class: "text-tertiary-foreground",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
variant: "solid",
|
|
72
|
+
color: "success",
|
|
73
|
+
class: "text-success-foreground",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
variant: "solid",
|
|
77
|
+
color: "info",
|
|
78
|
+
class: "text-info-foreground",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
variant: "solid",
|
|
82
|
+
color: "warning",
|
|
83
|
+
class: "text-warning-foreground",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
variant: "solid",
|
|
87
|
+
color: "error",
|
|
88
|
+
class: "text-error-foreground",
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
defaultVariants: {
|
|
92
|
+
size: "md",
|
|
93
|
+
color: "primary",
|
|
94
|
+
variant: "solid",
|
|
95
|
+
fullwidth: true,
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
);
|
|
@@ -1,32 +1,62 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { FC, ReactElement } from "react";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
import { buttonCva } from "./Button.styles";
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type ButtonProps = {
|
|
6
|
+
title?: string;
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
color?:
|
|
9
|
+
| "primary"
|
|
10
|
+
| "secondary"
|
|
11
|
+
| "success"
|
|
12
|
+
| "tertiary"
|
|
13
|
+
| "info"
|
|
14
|
+
| "warning"
|
|
15
|
+
| "error";
|
|
16
|
+
variant?: "solid" | "outline" | "flat" | "link";
|
|
7
17
|
disabled?: boolean;
|
|
8
|
-
className?: string;
|
|
9
18
|
isLoading?: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
fullwidth?: boolean;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
startIcon?: ReactElement;
|
|
22
|
+
endIcon?: ReactElement;
|
|
23
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
12
24
|
|
|
13
|
-
const Button:
|
|
25
|
+
const Button: FC<ButtonProps> = ({
|
|
26
|
+
size = "md",
|
|
27
|
+
color = "primary",
|
|
28
|
+
variant = "solid",
|
|
29
|
+
title,
|
|
14
30
|
children,
|
|
15
|
-
|
|
16
|
-
|
|
31
|
+
startIcon,
|
|
32
|
+
endIcon,
|
|
17
33
|
disabled = false,
|
|
18
|
-
|
|
34
|
+
fullwidth = false,
|
|
19
35
|
isLoading = false,
|
|
20
|
-
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
21
38
|
}) => {
|
|
39
|
+
const isDisabled = disabled || isLoading;
|
|
40
|
+
|
|
22
41
|
return (
|
|
23
42
|
<button
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
43
|
+
type="button"
|
|
44
|
+
{...props}
|
|
45
|
+
aria-disabled={isDisabled || undefined}
|
|
46
|
+
tabIndex={isDisabled ? -1 : 0}
|
|
47
|
+
className={twMerge(
|
|
48
|
+
buttonCva({ size, color, variant, disabled, fullwidth }),
|
|
49
|
+
className
|
|
50
|
+
)}
|
|
51
|
+
disabled={isDisabled}
|
|
28
52
|
>
|
|
29
|
-
{
|
|
53
|
+
{
|
|
54
|
+
<>
|
|
55
|
+
{startIcon}
|
|
56
|
+
{children || title}
|
|
57
|
+
{endIcon}
|
|
58
|
+
</>
|
|
59
|
+
}
|
|
30
60
|
</button>
|
|
31
61
|
);
|
|
32
62
|
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import Button from "./Button";
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Components/Button",
|
|
9
|
+
component: Button,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
parameters: {
|
|
12
|
+
// More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
|
|
13
|
+
layout: "fullscreen",
|
|
14
|
+
},
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (
|
|
17
|
+
<div className="p-5">
|
|
18
|
+
<Story />
|
|
19
|
+
</div>
|
|
20
|
+
),
|
|
21
|
+
],
|
|
22
|
+
} satisfies Meta<typeof Button>;
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof Button>;
|
|
26
|
+
|
|
27
|
+
export const Solid = {
|
|
28
|
+
args: {
|
|
29
|
+
title: "Button",
|
|
30
|
+
},
|
|
31
|
+
render: (args) => {
|
|
32
|
+
const props: typeof args = {
|
|
33
|
+
...args,
|
|
34
|
+
className: "capitalize",
|
|
35
|
+
};
|
|
36
|
+
return (
|
|
37
|
+
<div className="flex gap-2">
|
|
38
|
+
<Button color="primary" {...props} title="primary" />
|
|
39
|
+
<Button color="secondary" {...props} title="secondary" />
|
|
40
|
+
<Button color="tertiary" {...props} title="tertiary" />
|
|
41
|
+
<Button color="info" {...props} title="info" />
|
|
42
|
+
<Button color="success" {...props} title="success" />
|
|
43
|
+
<Button color="warning" {...props} title="warning" />
|
|
44
|
+
<Button color="error" {...props} title="error" />
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
} satisfies Story;
|
|
49
|
+
|
|
50
|
+
export const Outline = {
|
|
51
|
+
args: {
|
|
52
|
+
title: "Button",
|
|
53
|
+
variant: "outline",
|
|
54
|
+
},
|
|
55
|
+
render: (args) => {
|
|
56
|
+
const props: typeof args = {
|
|
57
|
+
...args,
|
|
58
|
+
className: "capitalize",
|
|
59
|
+
};
|
|
60
|
+
return (
|
|
61
|
+
<div className="flex gap-2">
|
|
62
|
+
<Button color="primary" {...props} title="primary" />
|
|
63
|
+
<Button color="secondary" {...props} title="secondary" />
|
|
64
|
+
<Button color="tertiary" {...props} title="tertiary" />
|
|
65
|
+
<Button color="info" {...props} title="info" />
|
|
66
|
+
<Button color="success" {...props} title="success" />
|
|
67
|
+
<Button color="warning" {...props} title="warning" />
|
|
68
|
+
<Button color="error" {...props} title="error" />
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
},
|
|
72
|
+
} satisfies Story;
|
|
73
|
+
|
|
74
|
+
export const Flat = {
|
|
75
|
+
args: {
|
|
76
|
+
title: "Button",
|
|
77
|
+
variant: "flat",
|
|
78
|
+
},
|
|
79
|
+
render: (args) => {
|
|
80
|
+
const props: typeof args = {
|
|
81
|
+
...args,
|
|
82
|
+
className: "capitalize",
|
|
83
|
+
};
|
|
84
|
+
return (
|
|
85
|
+
<div className="flex gap-2">
|
|
86
|
+
<Button color="primary" {...props} title="primary" />
|
|
87
|
+
<Button color="secondary" {...props} title="secondary" />
|
|
88
|
+
<Button color="tertiary" {...props} title="tertiary" />
|
|
89
|
+
<Button color="info" {...props} title="info" />
|
|
90
|
+
<Button color="success" {...props} title="success" />
|
|
91
|
+
<Button color="warning" {...props} title="warning" />
|
|
92
|
+
<Button color="error" {...props} title="error" />
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
},
|
|
96
|
+
} satisfies Story;
|
|
97
|
+
|
|
98
|
+
export const Link = {
|
|
99
|
+
args: {
|
|
100
|
+
title: "Button",
|
|
101
|
+
variant: "link",
|
|
102
|
+
},
|
|
103
|
+
render: (args) => {
|
|
104
|
+
const props: typeof args = {
|
|
105
|
+
...args,
|
|
106
|
+
className: "capitalize",
|
|
107
|
+
};
|
|
108
|
+
return (
|
|
109
|
+
<div className="flex gap-2">
|
|
110
|
+
<Button color="primary" {...props} title="primary" />
|
|
111
|
+
<Button color="secondary" {...props} title="secondary" />
|
|
112
|
+
<Button color="tertiary" {...props} title="tertiary" />
|
|
113
|
+
<Button color="info" {...props} title="info" />
|
|
114
|
+
<Button color="success" {...props} title="success" />
|
|
115
|
+
<Button color="warning" {...props} title="warning" />
|
|
116
|
+
<Button color="error" {...props} title="error" />
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
},
|
|
120
|
+
} satisfies Story;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import Text from "./Text";
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Components/Text",
|
|
9
|
+
component: Text,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
parameters: {
|
|
12
|
+
// More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
|
|
13
|
+
layout: "fullscreen",
|
|
14
|
+
},
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (
|
|
17
|
+
<div className="p-5 flex w-full">
|
|
18
|
+
<Story />
|
|
19
|
+
</div>
|
|
20
|
+
),
|
|
21
|
+
],
|
|
22
|
+
} satisfies Meta<typeof Text>;
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
|
|
26
|
+
const variant: any = [
|
|
27
|
+
"h1",
|
|
28
|
+
"h2",
|
|
29
|
+
"h3",
|
|
30
|
+
"h4",
|
|
31
|
+
"h5",
|
|
32
|
+
"h6",
|
|
33
|
+
"subtitile1",
|
|
34
|
+
"subtitile2",
|
|
35
|
+
"subtitile3",
|
|
36
|
+
"subtitile4",
|
|
37
|
+
"subtitile5",
|
|
38
|
+
"subtitile6",
|
|
39
|
+
"body1",
|
|
40
|
+
"body2",
|
|
41
|
+
"body3",
|
|
42
|
+
"body4",
|
|
43
|
+
"small1",
|
|
44
|
+
"small2",
|
|
45
|
+
"small3",
|
|
46
|
+
"label1",
|
|
47
|
+
"label2",
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const color = [
|
|
51
|
+
"primary",
|
|
52
|
+
"secondary",
|
|
53
|
+
"tertiary",
|
|
54
|
+
"success",
|
|
55
|
+
"info",
|
|
56
|
+
"warning",
|
|
57
|
+
"error",
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
export const Default = {
|
|
61
|
+
args: {},
|
|
62
|
+
render: (args) => {
|
|
63
|
+
const props: typeof args = {
|
|
64
|
+
...args,
|
|
65
|
+
};
|
|
66
|
+
return (
|
|
67
|
+
<div className="flex flex-col gap-2 gap-y-6 w-full">
|
|
68
|
+
{variant.map((value: any) => (
|
|
69
|
+
<div key={value} className="flex flex-row ">
|
|
70
|
+
<div className="w-[200px]">
|
|
71
|
+
<Text variant={value} color="primary">
|
|
72
|
+
{value}
|
|
73
|
+
</Text>
|
|
74
|
+
</div>
|
|
75
|
+
<div className="w-full">
|
|
76
|
+
<Text variant={value} color="primary">
|
|
77
|
+
Lorem ipsum dolor sit amet, adipiscing elit.
|
|
78
|
+
</Text>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
))}
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
} satisfies StoryObj;
|
|
86
|
+
|
|
87
|
+
export const Color = {
|
|
88
|
+
args: {},
|
|
89
|
+
render: (args) => {
|
|
90
|
+
const props: typeof args = {
|
|
91
|
+
...args,
|
|
92
|
+
};
|
|
93
|
+
return (
|
|
94
|
+
<div className="flex flex-col gap-2 gap-y-6 w-full">
|
|
95
|
+
{color.map((color: any, i) => (
|
|
96
|
+
<div key={color} className="flex flex-row ">
|
|
97
|
+
<div className="w-[400px]">
|
|
98
|
+
<Text variant={variant?.[i]} color={color}>
|
|
99
|
+
{color}
|
|
100
|
+
</Text>
|
|
101
|
+
</div>
|
|
102
|
+
<div className="w-full">
|
|
103
|
+
<Text variant={variant?.[i]} color={color}>
|
|
104
|
+
Lorem ipsum dolor sit amet, adipiscing elit.
|
|
105
|
+
</Text>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
))}
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
} satisfies StoryObj;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { FC } from "react";
|
|
2
|
+
|
|
3
|
+
type TextProps = {
|
|
4
|
+
variant?:
|
|
5
|
+
| "h1"
|
|
6
|
+
| "h2"
|
|
7
|
+
| "h3"
|
|
8
|
+
| "h4"
|
|
9
|
+
| "h5"
|
|
10
|
+
| "h6"
|
|
11
|
+
| "subtitile1"
|
|
12
|
+
| "subtitile2"
|
|
13
|
+
| "subtitile3"
|
|
14
|
+
| "subtitile4"
|
|
15
|
+
| "subtitile5"
|
|
16
|
+
| "subtitile6"
|
|
17
|
+
| "body1"
|
|
18
|
+
| "body2"
|
|
19
|
+
| "body3"
|
|
20
|
+
| "body4"
|
|
21
|
+
| "small1"
|
|
22
|
+
| "small2"
|
|
23
|
+
| "small3"
|
|
24
|
+
| "label1"
|
|
25
|
+
| "label2";
|
|
26
|
+
color?:
|
|
27
|
+
| "primary"
|
|
28
|
+
| "secondary"
|
|
29
|
+
| "success"
|
|
30
|
+
| "tertiary"
|
|
31
|
+
| "info"
|
|
32
|
+
| "warning"
|
|
33
|
+
| "error";
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
className?: string;
|
|
36
|
+
tag?: keyof JSX.IntrinsicElements;
|
|
37
|
+
style?: React.CSSProperties;
|
|
38
|
+
id?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const Text: FC<TextProps> = ({
|
|
42
|
+
variant = "body1",
|
|
43
|
+
tag: Tag = "p",
|
|
44
|
+
children,
|
|
45
|
+
className,
|
|
46
|
+
color,
|
|
47
|
+
style,
|
|
48
|
+
}) => {
|
|
49
|
+
return (
|
|
50
|
+
<Tag
|
|
51
|
+
className={`typography-${variant} text-${color} ${className}`}
|
|
52
|
+
style={style}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</Tag>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default Text;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// UI Components
|
|
2
|
+
// import "./src/styles/style.css";
|
|
3
|
+
import "./theme/global.css";
|
|
4
|
+
export { default as Button } from "./components/Button/Button";
|
|
5
|
+
export { default as Table } from "./components/Table/Table";
|
|
6
|
+
export { default as TextInput } from "./components/Form/TextInput";
|
|
7
|
+
export { default as Text } from "./components/Text/Text";
|
|
8
|
+
export { default as Tabs } from "./components/Tabs/Tabs";
|
|
9
|
+
|
|
10
|
+
// UTILS
|
|
11
|
+
export {
|
|
12
|
+
resloveTimestamp,
|
|
13
|
+
getStartDateOfDay,
|
|
14
|
+
getEndDateOfDay,
|
|
15
|
+
getStartEndTimestampOfDay,
|
|
16
|
+
getTimestampUTC,
|
|
17
|
+
} from "./utils/datetime";
|
|
18
|
+
|
|
19
|
+
// const mainPreset = require("./theme/main-preset");
|
|
20
|
+
|
|
21
|
+
// export { mainPreset };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { Meta, Canvas } from "@storybook/addon-docs";
|
|
2
|
+
|
|
3
|
+
<Meta title="Guidelines/Typography" />
|
|
4
|
+
|
|
5
|
+
export const code = ['<button className="scroll rounded-lg border border-primary-500">', " button", "</button>"];
|
|
6
|
+
|
|
7
|
+
# Typography
|
|
8
|
+
|
|
9
|
+
The Typography styles makes it easy to apply a default set of font weights and sizes in your application.
|
|
10
|
+
|
|
11
|
+
<br />
|
|
12
|
+
|
|
13
|
+
## Styles
|
|
14
|
+
|
|
15
|
+
<Canvas>
|
|
16
|
+
<div className="mx-auto max-w-3xl text-gray-100">
|
|
17
|
+
<div className="grid grid-cols-[auto_1fr] gap-x-8 gap-y-4">
|
|
18
|
+
<div className="flex items-center">
|
|
19
|
+
<div>
|
|
20
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
21
|
+
<code className="whitespace-nowrap typography-code">typography-heading-1</code>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div>
|
|
25
|
+
<h1 className="typography-heading-1">Heading 1</h1>
|
|
26
|
+
</div>
|
|
27
|
+
<div className="flex items-center">
|
|
28
|
+
<div>
|
|
29
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
30
|
+
<code className="typography-code">typography-heading-2</code>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div>
|
|
34
|
+
<h2 className="typography-heading-2">Heading 2</h2>
|
|
35
|
+
</div>
|
|
36
|
+
<div className="flex items-center">
|
|
37
|
+
<div>
|
|
38
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
39
|
+
<code className="typography-code">typography-heading-3</code>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<div>
|
|
43
|
+
<h3 className="typography-heading-3">Heading 3</h3>
|
|
44
|
+
</div>
|
|
45
|
+
<div className="flex items-center">
|
|
46
|
+
<div>
|
|
47
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
48
|
+
<code className="typography-code">typography-heading-4</code>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div className="flex items-center">
|
|
52
|
+
<h4 className="typography-heading-4">Heading 4</h4>
|
|
53
|
+
</div>
|
|
54
|
+
<div className="flex items-center">
|
|
55
|
+
<div>
|
|
56
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
57
|
+
<code className="typography-code">typography-heading-5</code>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
<div className="flex items-center">
|
|
61
|
+
<h5 className="typography-heading-5">Heading 5</h5>
|
|
62
|
+
</div>
|
|
63
|
+
<div className="flex items-center">
|
|
64
|
+
<div>
|
|
65
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
66
|
+
<code className="typography-code">typography-heading-6</code>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
<div className="flex items-center">
|
|
70
|
+
<h6 className="typography-heading-6">Heading 6</h6>
|
|
71
|
+
</div>
|
|
72
|
+
<div className="flex items-center">
|
|
73
|
+
<div>
|
|
74
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
75
|
+
<code className="whitespace-nowrap typography-code">typography-subtitle-1</code>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
<div className="">
|
|
79
|
+
<p className="typography-subtitle-1">
|
|
80
|
+
Subtitle 1 - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
|
81
|
+
labore et dolore magna aliqua.
|
|
82
|
+
</p>
|
|
83
|
+
</div>
|
|
84
|
+
<div className="flex items-center">
|
|
85
|
+
<div>
|
|
86
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
87
|
+
<code className="whitespace-nowrap typography-code">typography-subtitle-2</code>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
<div className="flex items-center">
|
|
91
|
+
<p className="typography-subtitle-2">
|
|
92
|
+
Subtitle 2 - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
|
93
|
+
labore et dolore magna aliqua.
|
|
94
|
+
</p>
|
|
95
|
+
</div>
|
|
96
|
+
<div className="flex items-center">
|
|
97
|
+
<div>
|
|
98
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
99
|
+
<code className="typography-code">typography-body-1</code>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
<div>
|
|
103
|
+
<p className="typography-body-1">
|
|
104
|
+
Body 1 - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
|
|
105
|
+
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
|
|
106
|
+
ea commodo consequat.
|
|
107
|
+
</p>
|
|
108
|
+
</div>
|
|
109
|
+
<div className="flex items-center">
|
|
110
|
+
<div>
|
|
111
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
112
|
+
<code className="typography-code">typography-body-2</code>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
<div>
|
|
116
|
+
<p className="typography-body-2">
|
|
117
|
+
Body 2 - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
|
|
118
|
+
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
|
|
119
|
+
ea commodo consequat.
|
|
120
|
+
</p>
|
|
121
|
+
</div>
|
|
122
|
+
<div className="flex items-center">
|
|
123
|
+
<div>
|
|
124
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
125
|
+
<code className="typography-code">typography-button</code>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
<div className="flex items-center">
|
|
129
|
+
<span className="typography-button">BUTTON TEXT</span>
|
|
130
|
+
</div>
|
|
131
|
+
<div className="flex items-center">
|
|
132
|
+
<div>
|
|
133
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
134
|
+
<code className="typography-code">typography-caption</code>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
<div className="flex items-center">
|
|
138
|
+
<span className="typography-caption">caption text</span>
|
|
139
|
+
</div>
|
|
140
|
+
<div className="flex items-center">
|
|
141
|
+
<div>
|
|
142
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
143
|
+
<code className="typography-code">typography-overline</code>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
<div className="flex items-center">
|
|
147
|
+
<span className="my-auto typography-overline">OVERLINE TEXT</span>
|
|
148
|
+
</div>
|
|
149
|
+
<div className="flex items-center">
|
|
150
|
+
<div>
|
|
151
|
+
<div className="typography-subtitle-1">Class Name:</div>
|
|
152
|
+
<code className="typography-code">typography-code</code>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
<div className="overflow-x-auto">
|
|
156
|
+
<pre className="py-2 typography-code">{code.join("\n")}</pre>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
</Canvas>
|