@gyramais/gyra-design 0.1.0
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/.eslintrc.json +14 -0
- package/.storybook/main.ts +20 -0
- package/.storybook/preview.ts +45 -0
- package/README.md +31 -0
- package/dist/index.js +2 -0
- package/package.json +83 -0
- package/postcss.config.js +6 -0
- package/rollup.config.js +104 -0
- package/scripts/build-utils.js +16 -0
- package/src/components/Avatar/Avatar.stories.tsx +26 -0
- package/src/components/Avatar/Avatar.tsx +36 -0
- package/src/components/Avatar/index.css +9 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Button/Button.stories.tsx +99 -0
- package/src/components/Button/Button.tsx +71 -0
- package/src/components/Button/index.css +168 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Card/Card.stories.tsx +126 -0
- package/src/components/Card/Card.tsx +111 -0
- package/src/components/Card/index.css +96 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Chart/Chart.stories.tsx +61 -0
- package/src/components/Chart/Chart.tsx +192 -0
- package/src/components/Chart/index.css +15 -0
- package/src/components/Chart/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +46 -0
- package/src/components/Checkbox/Checkbox.tsx +46 -0
- package/src/components/Checkbox/index.css +29 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Col/Col.stories.tsx +33 -0
- package/src/components/Col/Col.tsx +45 -0
- package/src/components/Col/index.css +57 -0
- package/src/components/Col/index.ts +1 -0
- package/src/components/Collapse/Collapse.stories.tsx +86 -0
- package/src/components/Collapse/Collapse.tsx +34 -0
- package/src/components/Collapse/CollapseIcon.tsx +33 -0
- package/src/components/Collapse/index.css +14 -0
- package/src/components/Collapse/index.ts +2 -0
- package/src/components/Divider/Divider.stories.tsx +45 -0
- package/src/components/Divider/Divider.tsx +42 -0
- package/src/components/Divider/index.css +20 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/Drawer/Drawer.stories.tsx +51 -0
- package/src/components/Drawer/Drawer.tsx +40 -0
- package/src/components/Drawer/index.css +15 -0
- package/src/components/Drawer/index.ts +1 -0
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +66 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +91 -0
- package/src/components/DropdownMenu/index.css +18 -0
- package/src/components/DropdownMenu/index.ts +1 -0
- package/src/components/Filter/Filter.stories.tsx +94 -0
- package/src/components/Filter/Filter.tsx +213 -0
- package/src/components/Filter/index.css +81 -0
- package/src/components/Filter/index.ts +1 -0
- package/src/components/Form/Form.tsx +11 -0
- package/src/components/Form/Item.tsx +33 -0
- package/src/components/Form/index.css +4 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/HoverCard/HoverCard.stories.tsx +48 -0
- package/src/components/HoverCard/HoverCard.tsx +54 -0
- package/src/components/HoverCard/index.css +15 -0
- package/src/components/HoverCard/index.ts +1 -0
- package/src/components/Icon/Icon.stories.tsx +23 -0
- package/src/components/Icon/Icon.tsx +36 -0
- package/src/components/Icon/index.css +3 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/IconDisplay/IconDisplay.stories.tsx +27 -0
- package/src/components/IconDisplay/IconDisplay.tsx +29 -0
- package/src/components/IconDisplay/index.css +18 -0
- package/src/components/IconDisplay/index.ts +1 -0
- package/src/components/Information/Information.stories.tsx +25 -0
- package/src/components/Information/Information.tsx +50 -0
- package/src/components/Information/index.css +34 -0
- package/src/components/Information/index.ts +1 -0
- package/src/components/Input/Input.stories.tsx +38 -0
- package/src/components/Input/Input.tsx +91 -0
- package/src/components/Input/index.css +74 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/Label/Label.tsx +26 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/Layout/Content.tsx +29 -0
- package/src/components/Layout/Header.tsx +29 -0
- package/src/components/Layout/Layout.stories.tsx +54 -0
- package/src/components/Layout/Layout.tsx +32 -0
- package/src/components/Layout/Sider.tsx +29 -0
- package/src/components/Layout/index.css +37 -0
- package/src/components/Layout/index.ts +4 -0
- package/src/components/List/List.stories.tsx +58 -0
- package/src/components/List/List.tsx +98 -0
- package/src/components/List/index.css +54 -0
- package/src/components/List/index.ts +1 -0
- package/src/components/Loading/Loading.stories.tsx +23 -0
- package/src/components/Loading/Loading.tsx +51 -0
- package/src/components/Loading/index.css +36 -0
- package/src/components/Loading/index.ts +1 -0
- package/src/components/Logo/Logo.stories.tsx +34 -0
- package/src/components/Logo/Logo.tsx +39 -0
- package/src/components/Logo/index.css +9 -0
- package/src/components/Logo/index.ts +1 -0
- package/src/components/Menubar/Menubar.stories.tsx +55 -0
- package/src/components/Menubar/Menubar.tsx +118 -0
- package/src/components/Menubar/index.css +96 -0
- package/src/components/Menubar/index.ts +1 -0
- package/src/components/Row/Row.stories.tsx +33 -0
- package/src/components/Row/Row.tsx +48 -0
- package/src/components/Row/index.css +116 -0
- package/src/components/Row/index.ts +1 -0
- package/src/components/Switch/Switch.stories.tsx +39 -0
- package/src/components/Switch/Switch.tsx +36 -0
- package/src/components/Switch/index.css +37 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Table/Table.stories.tsx +85 -0
- package/src/components/Table/Table.tsx +123 -0
- package/src/components/Table/index.css +74 -0
- package/src/components/Table/index.ts +1 -0
- package/src/components/Tabs/Tabs.stories.tsx +49 -0
- package/src/components/Tabs/Tabs.tsx +76 -0
- package/src/components/Tabs/index.css +89 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tag/Tag.stories.tsx +41 -0
- package/src/components/Tag/Tag.tsx +39 -0
- package/src/components/Tag/index.css +31 -0
- package/src/components/Tag/index.ts +1 -0
- package/src/components/Text/Text.stories.tsx +41 -0
- package/src/components/Toast/Toast.stories.tsx +47 -0
- package/src/components/Toast/Toast.tsx +13 -0
- package/src/components/Toast/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +44 -0
- package/src/components/Tooltip/Tooltip.tsx +60 -0
- package/src/components/Tooltip/index.css +15 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/index.css +176 -0
- package/src/index.ts +38 -0
- package/src/shadcn/checkbox.tsx +28 -0
- package/src/shadcn/dropdown-menu.tsx +200 -0
- package/src/shadcn/form.tsx +178 -0
- package/src/shadcn/hover-card.tsx +31 -0
- package/src/shadcn/label.tsx +26 -0
- package/src/shadcn/lib/utils.ts +6 -0
- package/src/shadcn/menubar.tsx +248 -0
- package/src/shadcn/switch.tsx +25 -0
- package/src/shadcn/table.tsx +117 -0
- package/src/shadcn/tabs.tsx +55 -0
- package/src/shadcn/tooltip.tsx +30 -0
- package/src/theme.ts +123 -0
- package/tailwind.config.js +9 -0
- package/tsconfig.json +32 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Table } from "./Table";
|
|
4
|
+
|
|
5
|
+
import SettingsIcon from '@mui/icons-material/Settings';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Table> = {
|
|
8
|
+
title: "Library/Components/Table",
|
|
9
|
+
component: Table,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'padded',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
type Story = StoryObj<typeof Table>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
args: {
|
|
21
|
+
id: '',
|
|
22
|
+
className: '',
|
|
23
|
+
columns: [{
|
|
24
|
+
key: 'fullName',
|
|
25
|
+
header: 'Nome',
|
|
26
|
+
render: (value) => `Sr. ${value}`,
|
|
27
|
+
align: 'left',
|
|
28
|
+
}, {
|
|
29
|
+
key: 'email',
|
|
30
|
+
header: 'E-mail',
|
|
31
|
+
}, {
|
|
32
|
+
key: 'age',
|
|
33
|
+
header: 'Idade',
|
|
34
|
+
render: (value) => `${value} anos`,
|
|
35
|
+
}, {
|
|
36
|
+
key: 'options',
|
|
37
|
+
header: 'Ações',
|
|
38
|
+
render: () => (
|
|
39
|
+
<div className="flex justify-center">
|
|
40
|
+
<SettingsIcon className="text-[var(--primary-button-color)]" />
|
|
41
|
+
</div>
|
|
42
|
+
),
|
|
43
|
+
}],
|
|
44
|
+
data: [{
|
|
45
|
+
fullName: 'Dayvid',
|
|
46
|
+
email: 'dmoreira@gyramais.com',
|
|
47
|
+
age: 24,
|
|
48
|
+
}, {
|
|
49
|
+
fullName: 'Bruna',
|
|
50
|
+
email: 'breis@gyramais.com',
|
|
51
|
+
age: 24,
|
|
52
|
+
}],
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const Empty: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
id: '',
|
|
59
|
+
className: '',
|
|
60
|
+
columns: [{
|
|
61
|
+
key: 'fullName',
|
|
62
|
+
header: 'Nome',
|
|
63
|
+
render: (value) => `Sr. ${value}`,
|
|
64
|
+
align: 'left',
|
|
65
|
+
}, {
|
|
66
|
+
key: 'email',
|
|
67
|
+
header: 'E-mail',
|
|
68
|
+
}, {
|
|
69
|
+
key: 'age',
|
|
70
|
+
header: 'Idade',
|
|
71
|
+
render: (value) => `${value} anos`,
|
|
72
|
+
}, {
|
|
73
|
+
key: 'options',
|
|
74
|
+
header: 'Ações',
|
|
75
|
+
render: () => (
|
|
76
|
+
<div className="flex justify-center">
|
|
77
|
+
<SettingsIcon className="text-[var(--primary-button-color)]" />
|
|
78
|
+
</div>
|
|
79
|
+
),
|
|
80
|
+
}],
|
|
81
|
+
empty: {
|
|
82
|
+
text: 'Sem dados para exibir',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Table as PrimitiveTable,
|
|
7
|
+
TableBody,
|
|
8
|
+
TableCell,
|
|
9
|
+
TableHead,
|
|
10
|
+
TableHeader,
|
|
11
|
+
TableRow,
|
|
12
|
+
} from "../../shadcn/table";
|
|
13
|
+
import { Row } from "../Row";
|
|
14
|
+
import { Col } from "../Col";
|
|
15
|
+
import UpcomingOutlinedIcon from '@mui/icons-material/UpcomingOutlined';
|
|
16
|
+
|
|
17
|
+
type TableColumnProps = {
|
|
18
|
+
key: string;
|
|
19
|
+
header: string;
|
|
20
|
+
render?: (value: any, data: any) => React.ReactNode | string;
|
|
21
|
+
align?: 'left' | 'center' | 'right';
|
|
22
|
+
}
|
|
23
|
+
type TableProps = {
|
|
24
|
+
id?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
columns: Array<TableColumnProps>;
|
|
27
|
+
data: Array<any>;
|
|
28
|
+
empty?: {
|
|
29
|
+
icon?: React.ReactNode;
|
|
30
|
+
text?: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const Table = ({
|
|
35
|
+
id,
|
|
36
|
+
className,
|
|
37
|
+
columns = [],
|
|
38
|
+
data = [],
|
|
39
|
+
empty = {
|
|
40
|
+
icon: undefined,
|
|
41
|
+
text: 'Tabela vazia',
|
|
42
|
+
},
|
|
43
|
+
}: TableProps) => {
|
|
44
|
+
const formattedData = useMemo(() => {
|
|
45
|
+
const columnsByKey = columns.reduce((acc: { [key: string]: TableColumnProps }, column) => {
|
|
46
|
+
const key = column.key;
|
|
47
|
+
acc[key] = column;
|
|
48
|
+
|
|
49
|
+
return acc;
|
|
50
|
+
}, {});
|
|
51
|
+
const keys = Object.keys(columnsByKey);
|
|
52
|
+
|
|
53
|
+
const temp = data.reduce((acc, item, index) => {
|
|
54
|
+
const cells: Array<React.ReactNode> = [];
|
|
55
|
+
|
|
56
|
+
keys.forEach((key) => {
|
|
57
|
+
const { render, align } = columnsByKey[key] || {};
|
|
58
|
+
|
|
59
|
+
cells.push(
|
|
60
|
+
<TableCell
|
|
61
|
+
key={`${key}-${JSON.stringify(item)}`}
|
|
62
|
+
className={`gyramais-table-cell gyramais-table-align-${align || 'center'}`}
|
|
63
|
+
>
|
|
64
|
+
{render ? render(item[key], item) : item[key]}
|
|
65
|
+
</TableCell>
|
|
66
|
+
)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
acc.push(
|
|
70
|
+
<TableRow key={`${index}-${JSON.stringify(item)}`}>
|
|
71
|
+
{cells}
|
|
72
|
+
</TableRow>
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
return acc;
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
return temp
|
|
79
|
+
}, [columns, data]);
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div className="gyramais-table-container">
|
|
83
|
+
<PrimitiveTable
|
|
84
|
+
id={id}
|
|
85
|
+
className={classNames(
|
|
86
|
+
'gyramais-table',
|
|
87
|
+
className,
|
|
88
|
+
)}
|
|
89
|
+
>
|
|
90
|
+
<TableHeader>
|
|
91
|
+
<TableRow>
|
|
92
|
+
{columns.map((column) => (
|
|
93
|
+
<TableHead
|
|
94
|
+
key={column.key}
|
|
95
|
+
className={`gyramais-table-head gyramais-table-align-${column.align || 'center'}`}
|
|
96
|
+
>
|
|
97
|
+
{column.header}
|
|
98
|
+
</TableHead>
|
|
99
|
+
))}
|
|
100
|
+
</TableRow>
|
|
101
|
+
</TableHeader>
|
|
102
|
+
|
|
103
|
+
<TableBody className="gyramais-table-body">
|
|
104
|
+
{formattedData}
|
|
105
|
+
</TableBody>
|
|
106
|
+
</PrimitiveTable>
|
|
107
|
+
|
|
108
|
+
{data.length === 0 && (
|
|
109
|
+
<Row columns={1} gap={8} className="gyramais-table-empty-container">
|
|
110
|
+
<Col span={1} className="gyramais-table-empty-icon">
|
|
111
|
+
{empty.icon || (<UpcomingOutlinedIcon />)}
|
|
112
|
+
</Col>
|
|
113
|
+
|
|
114
|
+
<Col span={1} className="gyramais-table-empty-text">
|
|
115
|
+
{empty.text}
|
|
116
|
+
</Col>
|
|
117
|
+
</Row>
|
|
118
|
+
)}
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export { Table };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
.gyramais-table {
|
|
2
|
+
@apply
|
|
3
|
+
relative;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.gyramais-table .gyramais-table-head {
|
|
7
|
+
@apply
|
|
8
|
+
text-sm
|
|
9
|
+
font-medium
|
|
10
|
+
leading-[14px]
|
|
11
|
+
text-black;
|
|
12
|
+
}
|
|
13
|
+
.gyramais-table .gyramais-table-head:nth-child(1) {
|
|
14
|
+
@apply
|
|
15
|
+
pl-0;
|
|
16
|
+
}
|
|
17
|
+
.gyramais-table .gyramais-table-head:last-child {
|
|
18
|
+
@apply
|
|
19
|
+
pr-0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.gyramais-table .gyramais-table-cell {
|
|
23
|
+
@apply
|
|
24
|
+
py-7
|
|
25
|
+
text-base
|
|
26
|
+
font-normal
|
|
27
|
+
leading-[19.2px]
|
|
28
|
+
text-[#626976];
|
|
29
|
+
}
|
|
30
|
+
.gyramais-table .gyramais-table-cell:nth-child(1) {
|
|
31
|
+
@apply
|
|
32
|
+
pl-0;
|
|
33
|
+
}
|
|
34
|
+
.gyramais-table .gyramais-table-cell:last-child {
|
|
35
|
+
@apply
|
|
36
|
+
pr-0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.gyramais-table .gyramais-table-align-left {
|
|
40
|
+
@apply
|
|
41
|
+
text-left;
|
|
42
|
+
}
|
|
43
|
+
.gyramais-table .gyramais-table-align-center {
|
|
44
|
+
@apply
|
|
45
|
+
text-center;
|
|
46
|
+
}
|
|
47
|
+
.gyramais-table .gyramais-table-align-right {
|
|
48
|
+
@apply
|
|
49
|
+
text-right;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.gyramais-table-container .gyramais-table-empty-container {
|
|
53
|
+
@apply
|
|
54
|
+
py-4
|
|
55
|
+
}
|
|
56
|
+
.gyramais-table-container .gyramais-table-empty-icon {
|
|
57
|
+
@apply
|
|
58
|
+
flex
|
|
59
|
+
justify-center
|
|
60
|
+
}
|
|
61
|
+
.gyramais-table-container .gyramais-table-empty-icon svg {
|
|
62
|
+
@apply
|
|
63
|
+
text-[40px]
|
|
64
|
+
text-[#b8b8b8];
|
|
65
|
+
}
|
|
66
|
+
.gyramais-table-container .gyramais-table-empty-text {
|
|
67
|
+
@apply
|
|
68
|
+
flex
|
|
69
|
+
justify-center
|
|
70
|
+
text-black
|
|
71
|
+
text-sm
|
|
72
|
+
font-normal
|
|
73
|
+
leading-[22px];
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Table";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Tabs } from "./Tabs";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Tabs> = {
|
|
6
|
+
title: "Library/Components/Tabs",
|
|
7
|
+
component: Tabs,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'padded',
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof Tabs>;
|
|
16
|
+
|
|
17
|
+
export const Default: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
id: '',
|
|
20
|
+
className: '',
|
|
21
|
+
defaultKey: 'account',
|
|
22
|
+
tabs: [{
|
|
23
|
+
key: 'account',
|
|
24
|
+
title: 'Conta',
|
|
25
|
+
content: (
|
|
26
|
+
<div>
|
|
27
|
+
Conteúdo da janela de conta
|
|
28
|
+
</div>
|
|
29
|
+
)
|
|
30
|
+
}, {
|
|
31
|
+
key: 'business',
|
|
32
|
+
title: 'Empresa',
|
|
33
|
+
content: (
|
|
34
|
+
<div>
|
|
35
|
+
Conteúdo da janela de empresa
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}, {
|
|
39
|
+
key: 'analysis',
|
|
40
|
+
title: 'Análises',
|
|
41
|
+
disabled: true,
|
|
42
|
+
content: (
|
|
43
|
+
<div>
|
|
44
|
+
Conteúdo da janela de análise
|
|
45
|
+
</div>
|
|
46
|
+
)
|
|
47
|
+
}],
|
|
48
|
+
},
|
|
49
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
import { Tabs as PrimitiveTabs, TabsContent, TabsList, TabsTrigger } from "../../shadcn/tabs";
|
|
6
|
+
|
|
7
|
+
type TabsProps = {
|
|
8
|
+
id?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
defaultKey?: string;
|
|
11
|
+
tabs: Array<{
|
|
12
|
+
key: string;
|
|
13
|
+
title: string | React.ReactNode;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
content: React.ReactNode;
|
|
16
|
+
}>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const Tabs = ({
|
|
20
|
+
id,
|
|
21
|
+
className,
|
|
22
|
+
defaultKey,
|
|
23
|
+
tabs = [],
|
|
24
|
+
}: TabsProps) => {
|
|
25
|
+
const {
|
|
26
|
+
titles,
|
|
27
|
+
contents,
|
|
28
|
+
} = useMemo(() => {
|
|
29
|
+
const titles = tabs.map((tab) => (
|
|
30
|
+
<TabsTrigger
|
|
31
|
+
key={`${tab.key}-tab`}
|
|
32
|
+
className="gyramais-tabs-tab"
|
|
33
|
+
value={tab.key}
|
|
34
|
+
disabled={tab.disabled}
|
|
35
|
+
>
|
|
36
|
+
{tab.title}
|
|
37
|
+
</TabsTrigger>
|
|
38
|
+
))
|
|
39
|
+
|
|
40
|
+
const contents = tabs.map((tab) => (
|
|
41
|
+
<TabsContent
|
|
42
|
+
key={`${tab.key}-content`}
|
|
43
|
+
value={tab.key}
|
|
44
|
+
className="gyramais-tabs-content"
|
|
45
|
+
>
|
|
46
|
+
{tab.content}
|
|
47
|
+
</TabsContent>
|
|
48
|
+
))
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
titles,
|
|
52
|
+
contents,
|
|
53
|
+
}
|
|
54
|
+
}, [tabs]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<PrimitiveTabs
|
|
58
|
+
id={id}
|
|
59
|
+
defaultValue={defaultKey}
|
|
60
|
+
className={classNames(
|
|
61
|
+
'gyramais-tabs',
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
>
|
|
65
|
+
<div className="gyramais-tabs-tab-container">
|
|
66
|
+
<TabsList className="gyramais-tabs-tab-content">
|
|
67
|
+
{titles}
|
|
68
|
+
</TabsList>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
{contents}
|
|
72
|
+
</PrimitiveTabs>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export { Tabs };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
.gyramais-tabs {
|
|
2
|
+
@apply
|
|
3
|
+
w-full;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.gyramais-tabs .gyramais-tabs-tab-container {
|
|
7
|
+
@apply
|
|
8
|
+
overflow-x-auto;
|
|
9
|
+
}
|
|
10
|
+
.gyramais-tabs .gyramais-tabs-tab-container::-webkit-scrollbar {
|
|
11
|
+
@apply
|
|
12
|
+
w-[1px]
|
|
13
|
+
h-[1px];
|
|
14
|
+
}
|
|
15
|
+
.gyramais-tabs .gyramais-tabs-tab-container::-webkit-scrollbar-track {
|
|
16
|
+
@apply
|
|
17
|
+
bg-transparent;
|
|
18
|
+
}
|
|
19
|
+
.gyramais-tabs .gyramais-tabs-tab-container::-webkit-scrollbar-thumb {
|
|
20
|
+
@apply
|
|
21
|
+
bg-[var(--primary-button-color)]
|
|
22
|
+
rounded-[0.625rem]
|
|
23
|
+
|
|
24
|
+
md:bg-[#DCDCDC];
|
|
25
|
+
}
|
|
26
|
+
.gyramais-tabs .gyramais-tabs-tab-container::-webkit-scrollbar-thumb:hover {
|
|
27
|
+
@apply
|
|
28
|
+
bg-[var(--primary-button-color)]
|
|
29
|
+
brightness-110;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
.gyramais-tabs .gyramais-tabs-tab-content {
|
|
34
|
+
@apply
|
|
35
|
+
relative
|
|
36
|
+
h-fit
|
|
37
|
+
p-0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.gyramais-tabs .gyramais-tabs-tab {
|
|
41
|
+
@apply
|
|
42
|
+
relative
|
|
43
|
+
p-0
|
|
44
|
+
pb-3
|
|
45
|
+
text-xs
|
|
46
|
+
font-bold
|
|
47
|
+
opacity-50
|
|
48
|
+
duration-200;
|
|
49
|
+
}
|
|
50
|
+
.gyramais-tabs .gyramais-tabs-tab[data-state="active"],
|
|
51
|
+
.gyramais-tabs .gyramais-tabs-tab:hover {
|
|
52
|
+
@apply
|
|
53
|
+
opacity-100
|
|
54
|
+
}
|
|
55
|
+
.gyramais-tabs .gyramais-tabs-tab::before {
|
|
56
|
+
@apply
|
|
57
|
+
content-['']
|
|
58
|
+
absolute
|
|
59
|
+
w-full
|
|
60
|
+
h-[0px]
|
|
61
|
+
bottom-0
|
|
62
|
+
bg-[var(--primary-button-color)]
|
|
63
|
+
duration-200;
|
|
64
|
+
}
|
|
65
|
+
.gyramais-tabs .gyramais-tabs-tab[data-state="active"]::before,
|
|
66
|
+
.gyramais-tabs .gyramais-tabs-tab:hover::before {
|
|
67
|
+
@apply
|
|
68
|
+
h-[3px]
|
|
69
|
+
}
|
|
70
|
+
.gyramais-tabs .gyramais-tabs-tab + .gyramais-tabs-tab {
|
|
71
|
+
@apply
|
|
72
|
+
ml-4;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.gyramais-tabs .gyramais-tabs-content {
|
|
76
|
+
@apply
|
|
77
|
+
relative
|
|
78
|
+
m-0
|
|
79
|
+
pt-4;
|
|
80
|
+
}
|
|
81
|
+
.gyramais-tabs .gyramais-tabs-content::before {
|
|
82
|
+
@apply
|
|
83
|
+
content-['']
|
|
84
|
+
absolute
|
|
85
|
+
w-full
|
|
86
|
+
h-[1px]
|
|
87
|
+
top-0
|
|
88
|
+
bg-[var(--border-color)];
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tabs";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Tag } from "./Tag";
|
|
4
|
+
|
|
5
|
+
import PersonIcon from '@mui/icons-material/Person';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Tag> = {
|
|
8
|
+
title: "Library/Components/Tag",
|
|
9
|
+
component: Tag,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
type Story = StoryObj<typeof Tag>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
args: {
|
|
21
|
+
id: '',
|
|
22
|
+
className: '',
|
|
23
|
+
icon: false,
|
|
24
|
+
children: (
|
|
25
|
+
'Informação qualquer'
|
|
26
|
+
),
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const WithIcon: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
id: '',
|
|
33
|
+
className: '',
|
|
34
|
+
icon: (
|
|
35
|
+
<PersonIcon />
|
|
36
|
+
),
|
|
37
|
+
children: (
|
|
38
|
+
'Informação qualquer'
|
|
39
|
+
),
|
|
40
|
+
},
|
|
41
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
type TagProps = {
|
|
6
|
+
id?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Tag = ({
|
|
13
|
+
id,
|
|
14
|
+
className,
|
|
15
|
+
icon,
|
|
16
|
+
children,
|
|
17
|
+
}: TagProps) => {
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
id={id}
|
|
21
|
+
className={classNames(
|
|
22
|
+
"gyramais-tag",
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
>
|
|
26
|
+
{icon && (
|
|
27
|
+
<div className="gyramais-tag-icon">
|
|
28
|
+
{icon}
|
|
29
|
+
</div>
|
|
30
|
+
)}
|
|
31
|
+
|
|
32
|
+
<div className="gyramais-tag-content">
|
|
33
|
+
{children}
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { Tag };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.gyramais-tag {
|
|
2
|
+
@apply
|
|
3
|
+
flex
|
|
4
|
+
items-center
|
|
5
|
+
w-fit
|
|
6
|
+
px-4
|
|
7
|
+
py-3
|
|
8
|
+
bg-[#F6F8F7]
|
|
9
|
+
border-[1px]
|
|
10
|
+
border-[var(--border-color)]
|
|
11
|
+
border-solid
|
|
12
|
+
rounded-xl;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.gyramais-tag .gyramais-tag-icon {
|
|
16
|
+
@apply
|
|
17
|
+
flex
|
|
18
|
+
items-center
|
|
19
|
+
justify-center
|
|
20
|
+
mr-2
|
|
21
|
+
text-[var(--primary-button-color)]
|
|
22
|
+
scale-[135%]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.gyramais-tag .gyramais-tag-content {
|
|
26
|
+
@apply
|
|
27
|
+
text-lg
|
|
28
|
+
leading-[18px]
|
|
29
|
+
text-black
|
|
30
|
+
font-normal
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tag";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
const meta: Meta = {
|
|
5
|
+
title: "Library/Components/Text",
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
},
|
|
9
|
+
render: () => (
|
|
10
|
+
<>
|
|
11
|
+
<h1>Texto em h1 em desktop</h1>
|
|
12
|
+
<h1 className="text-[24px]">Texto em h1 em mobile</h1>
|
|
13
|
+
<br />
|
|
14
|
+
|
|
15
|
+
<h2>Texto em h2 em desktop</h2>
|
|
16
|
+
<h2 className="text-[24px]">Texto em h2 em mobile</h2>
|
|
17
|
+
<br />
|
|
18
|
+
|
|
19
|
+
<h3>Texto em h3 em desktop</h3>
|
|
20
|
+
<h3 className="text-[20px]">Texto em h3 em mobile</h3>
|
|
21
|
+
<br />
|
|
22
|
+
|
|
23
|
+
<h4>Texto em h4 em desktop</h4>
|
|
24
|
+
<h4 className="text-[20px]">Texto em h4 em mobile</h4>
|
|
25
|
+
<br />
|
|
26
|
+
|
|
27
|
+
<h5>Texto em h5 em desktop</h5>
|
|
28
|
+
<h5 className="text-[16px]">Texto em h5 em mobile</h5>
|
|
29
|
+
<br />
|
|
30
|
+
|
|
31
|
+
<h6>Texto em h6 em desktop</h6>
|
|
32
|
+
<h6 className="text-[16px]">Texto em h6 em mobile</h6>
|
|
33
|
+
</>
|
|
34
|
+
)
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
38
|
+
|
|
39
|
+
type Story = StoryObj;
|
|
40
|
+
|
|
41
|
+
export const Default: Story = {}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { ToastContainer, toast } from '.';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
|
|
6
|
+
const meta: Meta = {
|
|
7
|
+
title: "Library/Components/Toast",
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
render: ({ type, position, message }) => (
|
|
12
|
+
<div className="w-[800px] h-[400px]">
|
|
13
|
+
<ToastContainer />
|
|
14
|
+
|
|
15
|
+
<div className="w-full h-full flex items-center justify-center">
|
|
16
|
+
<Button onClick={() => toast(message, { type, position })}>
|
|
17
|
+
Notificar
|
|
18
|
+
</Button>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
|
|
26
|
+
type Story = StoryObj;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
argTypes: {
|
|
30
|
+
type: {
|
|
31
|
+
control: 'select',
|
|
32
|
+
options: ['info', 'success', 'warning', 'error', 'default'],
|
|
33
|
+
},
|
|
34
|
+
position: {
|
|
35
|
+
control: 'select',
|
|
36
|
+
options: ['top-right', 'top-center', 'top-left', 'bottom-right', 'bottom-center', 'bottom-left'],
|
|
37
|
+
},
|
|
38
|
+
message: {
|
|
39
|
+
control: 'text',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
args: {
|
|
43
|
+
type: 'success',
|
|
44
|
+
position: 'top-right',
|
|
45
|
+
message: 'Conteúdo da notificação',
|
|
46
|
+
},
|
|
47
|
+
}
|