@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,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
type LogoProps = {
|
|
6
|
+
id?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
type?: "dark" | "white" | "background-contrasted";
|
|
9
|
+
width?: number | string;
|
|
10
|
+
height?: number | string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Logo = ({
|
|
14
|
+
id,
|
|
15
|
+
className,
|
|
16
|
+
type = 'dark',
|
|
17
|
+
width,
|
|
18
|
+
height,
|
|
19
|
+
}: LogoProps) => {
|
|
20
|
+
return (
|
|
21
|
+
<img
|
|
22
|
+
id={id}
|
|
23
|
+
className={classNames(
|
|
24
|
+
'gyramais-logo',
|
|
25
|
+
`gyramais-logo-${type}`,
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
style={{
|
|
29
|
+
width,
|
|
30
|
+
height,
|
|
31
|
+
}}
|
|
32
|
+
width={width}
|
|
33
|
+
height={height}
|
|
34
|
+
alt="Logo"
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { Logo };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Logo";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Menubar } from "./Menubar";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Menubar> = {
|
|
5
|
+
title: "Library/Components/Menubar",
|
|
6
|
+
component: Menubar,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'padded',
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof Menubar>;
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
id: '',
|
|
19
|
+
className: '',
|
|
20
|
+
borderless: false,
|
|
21
|
+
orientation: 'horizontal',
|
|
22
|
+
onClick: (key: string) => {},
|
|
23
|
+
activeKey: '',
|
|
24
|
+
items: [{
|
|
25
|
+
key: 'home',
|
|
26
|
+
title: 'Página inicial',
|
|
27
|
+
items: [{
|
|
28
|
+
key: 'loans',
|
|
29
|
+
title: 'Empréstimos',
|
|
30
|
+
}, {
|
|
31
|
+
key: 'prepayments',
|
|
32
|
+
title: 'Antecipações',
|
|
33
|
+
disabled: true,
|
|
34
|
+
}]
|
|
35
|
+
}, {
|
|
36
|
+
key: 'plain',
|
|
37
|
+
title: 'Plano',
|
|
38
|
+
disabled: true,
|
|
39
|
+
}, {
|
|
40
|
+
separator: true,
|
|
41
|
+
}, {
|
|
42
|
+
key: 'profile',
|
|
43
|
+
title: 'Perfil',
|
|
44
|
+
items: [{
|
|
45
|
+
key: 'user',
|
|
46
|
+
title: 'Usuário',
|
|
47
|
+
}, {
|
|
48
|
+
separator: true,
|
|
49
|
+
}, {
|
|
50
|
+
key: 'business',
|
|
51
|
+
title: 'Empresa',
|
|
52
|
+
}]
|
|
53
|
+
}],
|
|
54
|
+
},
|
|
55
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Menubar as PrimitiveMenubar,
|
|
7
|
+
MenubarContent,
|
|
8
|
+
MenubarItem,
|
|
9
|
+
MenubarMenu,
|
|
10
|
+
MenubarSeparator,
|
|
11
|
+
MenubarTrigger,
|
|
12
|
+
} from "../../shadcn/menubar"
|
|
13
|
+
|
|
14
|
+
type MenubarProps = {
|
|
15
|
+
id?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
borderless?: boolean;
|
|
18
|
+
orientation?: 'horizontal' | 'vertical';
|
|
19
|
+
activeKey?: string;
|
|
20
|
+
items?: Array<{
|
|
21
|
+
key?: string;
|
|
22
|
+
title?: string | React.ReactNode;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
separator?: boolean;
|
|
25
|
+
items?: Array<{
|
|
26
|
+
key?: string;
|
|
27
|
+
title?: string | React.ReactNode;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
separator?: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
}>;
|
|
32
|
+
onClick?: (key: string) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const Menubar = ({
|
|
36
|
+
id,
|
|
37
|
+
className,
|
|
38
|
+
borderless = false,
|
|
39
|
+
orientation = 'horizontal',
|
|
40
|
+
activeKey = '',
|
|
41
|
+
items = [],
|
|
42
|
+
onClick,
|
|
43
|
+
}: MenubarProps) => {
|
|
44
|
+
const [internalActiveKey, setInternalActiveKey] = useState(activeKey);
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
setInternalActiveKey(activeKey);
|
|
48
|
+
}, [activeKey]);
|
|
49
|
+
return (
|
|
50
|
+
<PrimitiveMenubar
|
|
51
|
+
id={id}
|
|
52
|
+
className={classNames(
|
|
53
|
+
"gyramais-menubar",
|
|
54
|
+
`gyramais-menubar-${orientation}`,
|
|
55
|
+
borderless ? 'gyramais-menubar-borderless' : '',
|
|
56
|
+
className,
|
|
57
|
+
)}
|
|
58
|
+
>
|
|
59
|
+
{items.map((item, index) => item.separator ? (
|
|
60
|
+
<MenubarSeparator
|
|
61
|
+
key={`separator-${index}`}
|
|
62
|
+
aria-orientation={orientation === 'horizontal' ? "vertical" : "horizontal"} className="gyramais-menubar-separator"
|
|
63
|
+
/>
|
|
64
|
+
) : (
|
|
65
|
+
<MenubarMenu key={`menu-${index}`}>
|
|
66
|
+
<MenubarTrigger
|
|
67
|
+
className={classNames(
|
|
68
|
+
'gyramais-menubar-option',
|
|
69
|
+
item.key === internalActiveKey ? 'gyramais-menubar-option-selected' : '',
|
|
70
|
+
)}
|
|
71
|
+
onClick={() => {
|
|
72
|
+
if (item.key) {
|
|
73
|
+
if (!activeKey && item.key) {
|
|
74
|
+
setInternalActiveKey(item.key);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
onClick?.(item.key);
|
|
78
|
+
}
|
|
79
|
+
}}
|
|
80
|
+
disabled={item.disabled}
|
|
81
|
+
>
|
|
82
|
+
{item.title}
|
|
83
|
+
</MenubarTrigger>
|
|
84
|
+
|
|
85
|
+
{!item.disabled
|
|
86
|
+
&& Array.isArray(item.items)
|
|
87
|
+
&& item.items.length > 0
|
|
88
|
+
&& (
|
|
89
|
+
<MenubarContent className="gyramais-menubar-content" side={orientation === 'horizontal' ? 'bottom' : 'right'}>
|
|
90
|
+
{item.items.map((subitem, index) => subitem.separator ? (
|
|
91
|
+
<MenubarSeparator
|
|
92
|
+
key={`sub-separator-${index}`}
|
|
93
|
+
aria-orientation="horizontal"
|
|
94
|
+
className="gyramais-menubar-separator submenu-separator"
|
|
95
|
+
/>
|
|
96
|
+
) : (
|
|
97
|
+
<MenubarItem
|
|
98
|
+
key={`sub-menu-${index}`}
|
|
99
|
+
className="gyramais-menubar-sub-option"
|
|
100
|
+
onClick={() => {
|
|
101
|
+
if (subitem.key) {
|
|
102
|
+
onClick?.(subitem.key);
|
|
103
|
+
}
|
|
104
|
+
}}
|
|
105
|
+
disabled={subitem.disabled}
|
|
106
|
+
>
|
|
107
|
+
{subitem.title}
|
|
108
|
+
</MenubarItem>
|
|
109
|
+
))}
|
|
110
|
+
</MenubarContent>
|
|
111
|
+
)}
|
|
112
|
+
</MenubarMenu>
|
|
113
|
+
))}
|
|
114
|
+
</PrimitiveMenubar>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export { Menubar };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
.gyramais-menubar {
|
|
2
|
+
@apply
|
|
3
|
+
w-fit
|
|
4
|
+
bg-white;
|
|
5
|
+
}
|
|
6
|
+
.gyramais-menubar.gyramais-menubar-vertical {
|
|
7
|
+
@apply
|
|
8
|
+
flex-col
|
|
9
|
+
h-fit;
|
|
10
|
+
}
|
|
11
|
+
.gyramais-menubar.gyramais-menubar-borderless {
|
|
12
|
+
@apply
|
|
13
|
+
border-none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.gyramais-menubar-option {
|
|
17
|
+
@apply
|
|
18
|
+
rounded-[4px]
|
|
19
|
+
duration-300
|
|
20
|
+
text-[#4F5762];
|
|
21
|
+
}
|
|
22
|
+
.gyramais-menubar-vertical .gyramais-menubar-option {
|
|
23
|
+
@apply
|
|
24
|
+
flex
|
|
25
|
+
w-full
|
|
26
|
+
items-center
|
|
27
|
+
justify-center
|
|
28
|
+
!mr-0
|
|
29
|
+
!ml-0
|
|
30
|
+
}
|
|
31
|
+
.gyramais-menubar-vertical .gyramais-menubar-option + .gyramais-menubar-option {
|
|
32
|
+
@apply
|
|
33
|
+
mt-2;
|
|
34
|
+
}
|
|
35
|
+
.gyramais-menubar-option-selected {
|
|
36
|
+
@apply
|
|
37
|
+
!bg-[var(--dark-button-color)]
|
|
38
|
+
!text-[var(--primary-button-color)]
|
|
39
|
+
}
|
|
40
|
+
.gyramais-menubar-option:disabled {
|
|
41
|
+
@apply
|
|
42
|
+
opacity-50
|
|
43
|
+
!bg-transparent
|
|
44
|
+
!text-black
|
|
45
|
+
}
|
|
46
|
+
.gyramais-menubar-option:not(:disabled) {
|
|
47
|
+
@apply
|
|
48
|
+
cursor-pointer
|
|
49
|
+
hover:!bg-[var(--dark-button-color)]
|
|
50
|
+
hover:!text-[var(--primary-button-color)]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.gyramais-menubar-sub-option {
|
|
54
|
+
@apply
|
|
55
|
+
rounded-none
|
|
56
|
+
duration-300;
|
|
57
|
+
}
|
|
58
|
+
.gyramais-menubar-sub-option:disabled {
|
|
59
|
+
@apply
|
|
60
|
+
opacity-50
|
|
61
|
+
}
|
|
62
|
+
.gyramais-menubar-sub-option:not(:disabled) {
|
|
63
|
+
@apply
|
|
64
|
+
cursor-pointer
|
|
65
|
+
hover:!bg-[var(--primary-button-color)]
|
|
66
|
+
hover:!text-[var(--primary-button-text-color)]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.gyramais-menubar-content {
|
|
70
|
+
@apply
|
|
71
|
+
!bg-white;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.gyramais-menubar-separator[aria-orientation="vertical"] {
|
|
75
|
+
@apply
|
|
76
|
+
h-full
|
|
77
|
+
w-[1px]
|
|
78
|
+
bg-[var(--border-color)];
|
|
79
|
+
}
|
|
80
|
+
.gyramais-menubar-separator[aria-orientation="horizontal"] {
|
|
81
|
+
@apply
|
|
82
|
+
bg-[var(--border-color)];
|
|
83
|
+
}
|
|
84
|
+
.gyramais-menubar-vertical .gyramais-menubar-separator[aria-orientation="horizontal"] {
|
|
85
|
+
@apply
|
|
86
|
+
!mr-0
|
|
87
|
+
!ml-0
|
|
88
|
+
mb-2
|
|
89
|
+
mt-2
|
|
90
|
+
}
|
|
91
|
+
.gyramais-menubar-separator[aria-orientation="horizontal"]:not(.submenu-separator) {
|
|
92
|
+
@apply
|
|
93
|
+
h-[1px]
|
|
94
|
+
w-full
|
|
95
|
+
bg-[var(--border-color)];
|
|
96
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Menubar";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Col } from "../Col";
|
|
4
|
+
import { Row } from "./Row";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Row> = {
|
|
7
|
+
title: "Library/Components/Row",
|
|
8
|
+
component: Row,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'padded',
|
|
11
|
+
},
|
|
12
|
+
render: ({ columns, gap, align }) => (
|
|
13
|
+
<Row columns={columns} gap={gap} align={align}>
|
|
14
|
+
{Array.from({ length: columns || 3 }).map((_, index) => (
|
|
15
|
+
<Col span={1} className={`${index % 2 === 0 ? 'h-32' : 'h-14'} rounded-md bg-[var(--background-color)]`} />
|
|
16
|
+
))}
|
|
17
|
+
</Row>
|
|
18
|
+
),
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<typeof Row>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
id: '',
|
|
28
|
+
className: '',
|
|
29
|
+
columns: 4,
|
|
30
|
+
gap: 16,
|
|
31
|
+
align: 'start',
|
|
32
|
+
},
|
|
33
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
type Gap = {
|
|
6
|
+
mobile?: 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | 80;
|
|
7
|
+
tablet?: 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | 80;
|
|
8
|
+
desktop?: 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | 80;
|
|
9
|
+
wide?: 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | 80;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type RowProps = {
|
|
13
|
+
id?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
columns?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
16
|
+
gap?: 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | 80 | Gap;
|
|
17
|
+
align?: 'start' | 'center' | 'end';
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const Row = ({
|
|
22
|
+
id,
|
|
23
|
+
className,
|
|
24
|
+
columns = 1,
|
|
25
|
+
gap = 0,
|
|
26
|
+
align = 'start',
|
|
27
|
+
children,
|
|
28
|
+
}: RowProps) => {
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
id={id}
|
|
32
|
+
className={classNames(
|
|
33
|
+
"gyramais-row",
|
|
34
|
+
`gyramais-row-columns-${columns}`,
|
|
35
|
+
`gyramais-row-align-${align}`,
|
|
36
|
+
`gyramais-row-mobile-gap-${typeof gap === 'number' ? gap : typeof gap === 'object' && !Array.isArray(gap) && gap.mobile}`,
|
|
37
|
+
typeof gap === 'object' && !Array.isArray(gap) && gap.tablet ? `gyramais-row-tablet-gap-${gap.tablet}` : '',
|
|
38
|
+
typeof gap === 'object' && !Array.isArray(gap) && gap.desktop ? `gyramais-row-desktop-gap-${gap.desktop}` : '',
|
|
39
|
+
typeof gap === 'object' && !Array.isArray(gap) && gap.wide ? `gyramais-row-wide-gap-${gap.wide}` : '',
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { Row };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
.gyramais-row {
|
|
2
|
+
@apply
|
|
3
|
+
grid
|
|
4
|
+
w-full;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.gyramais-row.gyramais-row-mobile-gap-0 { @apply gap-[0px]; }
|
|
8
|
+
.gyramais-row.gyramais-row-mobile-gap-4 { @apply gap-[4px]; }
|
|
9
|
+
.gyramais-row.gyramais-row-mobile-gap-8 { @apply gap-[8px]; }
|
|
10
|
+
.gyramais-row.gyramais-row-mobile-gap-12 { @apply gap-[12px]; }
|
|
11
|
+
.gyramais-row.gyramais-row-mobile-gap-16 { @apply gap-[16px]; }
|
|
12
|
+
.gyramais-row.gyramais-row-mobile-gap-20 { @apply gap-[20px]; }
|
|
13
|
+
.gyramais-row.gyramais-row-mobile-gap-24 { @apply gap-[24px]; }
|
|
14
|
+
.gyramais-row.gyramais-row-mobile-gap-28 { @apply gap-[28px]; }
|
|
15
|
+
.gyramais-row.gyramais-row-mobile-gap-32 { @apply gap-[32px]; }
|
|
16
|
+
.gyramais-row.gyramais-row-mobile-gap-36 { @apply gap-[36px]; }
|
|
17
|
+
.gyramais-row.gyramais-row-mobile-gap-40 { @apply gap-[40px]; }
|
|
18
|
+
.gyramais-row.gyramais-row-mobile-gap-44 { @apply gap-[44px]; }
|
|
19
|
+
.gyramais-row.gyramais-row-mobile-gap-48 { @apply gap-[48px]; }
|
|
20
|
+
.gyramais-row.gyramais-row-mobile-gap-52 { @apply gap-[52px]; }
|
|
21
|
+
.gyramais-row.gyramais-row-mobile-gap-56 { @apply gap-[56px]; }
|
|
22
|
+
.gyramais-row.gyramais-row-mobile-gap-60 { @apply gap-[60px]; }
|
|
23
|
+
.gyramais-row.gyramais-row-mobile-gap-64 { @apply gap-[64px]; }
|
|
24
|
+
.gyramais-row.gyramais-row-mobile-gap-68 { @apply gap-[68px]; }
|
|
25
|
+
.gyramais-row.gyramais-row-mobile-gap-72 { @apply gap-[72px]; }
|
|
26
|
+
.gyramais-row.gyramais-row-mobile-gap-76 { @apply gap-[76px]; }
|
|
27
|
+
.gyramais-row.gyramais-row-mobile-gap-80 { @apply gap-[80px]; }
|
|
28
|
+
|
|
29
|
+
@media(min-width: 769px) {
|
|
30
|
+
.gyramais-row.gyramais-row-tablet-gap-0 { @apply gap-[0px]; }
|
|
31
|
+
.gyramais-row.gyramais-row-tablet-gap-4 { @apply gap-[4px]; }
|
|
32
|
+
.gyramais-row.gyramais-row-tablet-gap-8 { @apply gap-[8px]; }
|
|
33
|
+
.gyramais-row.gyramais-row-tablet-gap-12 { @apply gap-[12px]; }
|
|
34
|
+
.gyramais-row.gyramais-row-tablet-gap-16 { @apply gap-[16px]; }
|
|
35
|
+
.gyramais-row.gyramais-row-tablet-gap-20 { @apply gap-[20px]; }
|
|
36
|
+
.gyramais-row.gyramais-row-tablet-gap-24 { @apply gap-[24px]; }
|
|
37
|
+
.gyramais-row.gyramais-row-tablet-gap-28 { @apply gap-[28px]; }
|
|
38
|
+
.gyramais-row.gyramais-row-tablet-gap-32 { @apply gap-[32px]; }
|
|
39
|
+
.gyramais-row.gyramais-row-tablet-gap-36 { @apply gap-[36px]; }
|
|
40
|
+
.gyramais-row.gyramais-row-tablet-gap-40 { @apply gap-[40px]; }
|
|
41
|
+
.gyramais-row.gyramais-row-tablet-gap-44 { @apply gap-[44px]; }
|
|
42
|
+
.gyramais-row.gyramais-row-tablet-gap-48 { @apply gap-[48px]; }
|
|
43
|
+
.gyramais-row.gyramais-row-tablet-gap-52 { @apply gap-[52px]; }
|
|
44
|
+
.gyramais-row.gyramais-row-tablet-gap-56 { @apply gap-[56px]; }
|
|
45
|
+
.gyramais-row.gyramais-row-tablet-gap-60 { @apply gap-[60px]; }
|
|
46
|
+
.gyramais-row.gyramais-row-tablet-gap-64 { @apply gap-[64px]; }
|
|
47
|
+
.gyramais-row.gyramais-row-tablet-gap-68 { @apply gap-[68px]; }
|
|
48
|
+
.gyramais-row.gyramais-row-tablet-gap-72 { @apply gap-[72px]; }
|
|
49
|
+
.gyramais-row.gyramais-row-tablet-gap-76 { @apply gap-[76px]; }
|
|
50
|
+
.gyramais-row.gyramais-row-tablet-gap-80 { @apply gap-[80px]; }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@media(min-width: 1025px) {
|
|
54
|
+
.gyramais-row.gyramais-row-desktop-gap-0 { @apply gap-[0px]; }
|
|
55
|
+
.gyramais-row.gyramais-row-desktop-gap-4 { @apply gap-[4px]; }
|
|
56
|
+
.gyramais-row.gyramais-row-desktop-gap-8 { @apply gap-[8px]; }
|
|
57
|
+
.gyramais-row.gyramais-row-desktop-gap-12 { @apply gap-[12px]; }
|
|
58
|
+
.gyramais-row.gyramais-row-desktop-gap-16 { @apply gap-[16px]; }
|
|
59
|
+
.gyramais-row.gyramais-row-desktop-gap-20 { @apply gap-[20px]; }
|
|
60
|
+
.gyramais-row.gyramais-row-desktop-gap-24 { @apply gap-[24px]; }
|
|
61
|
+
.gyramais-row.gyramais-row-desktop-gap-28 { @apply gap-[28px]; }
|
|
62
|
+
.gyramais-row.gyramais-row-desktop-gap-32 { @apply gap-[32px]; }
|
|
63
|
+
.gyramais-row.gyramais-row-desktop-gap-36 { @apply gap-[36px]; }
|
|
64
|
+
.gyramais-row.gyramais-row-desktop-gap-40 { @apply gap-[40px]; }
|
|
65
|
+
.gyramais-row.gyramais-row-desktop-gap-44 { @apply gap-[44px]; }
|
|
66
|
+
.gyramais-row.gyramais-row-desktop-gap-48 { @apply gap-[48px]; }
|
|
67
|
+
.gyramais-row.gyramais-row-desktop-gap-52 { @apply gap-[52px]; }
|
|
68
|
+
.gyramais-row.gyramais-row-desktop-gap-56 { @apply gap-[56px]; }
|
|
69
|
+
.gyramais-row.gyramais-row-desktop-gap-60 { @apply gap-[60px]; }
|
|
70
|
+
.gyramais-row.gyramais-row-desktop-gap-64 { @apply gap-[64px]; }
|
|
71
|
+
.gyramais-row.gyramais-row-desktop-gap-68 { @apply gap-[68px]; }
|
|
72
|
+
.gyramais-row.gyramais-row-desktop-gap-72 { @apply gap-[72px]; }
|
|
73
|
+
.gyramais-row.gyramais-row-desktop-gap-76 { @apply gap-[76px]; }
|
|
74
|
+
.gyramais-row.gyramais-row-desktop-gap-80 { @apply gap-[80px]; }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media(min-width: 1201px) {
|
|
78
|
+
.gyramais-row.gyramais-row-wide-gap-0 { @apply gap-[0px]; }
|
|
79
|
+
.gyramais-row.gyramais-row-wide-gap-4 { @apply gap-[4px]; }
|
|
80
|
+
.gyramais-row.gyramais-row-wide-gap-8 { @apply gap-[8px]; }
|
|
81
|
+
.gyramais-row.gyramais-row-wide-gap-12 { @apply gap-[12px]; }
|
|
82
|
+
.gyramais-row.gyramais-row-wide-gap-16 { @apply gap-[16px]; }
|
|
83
|
+
.gyramais-row.gyramais-row-wide-gap-20 { @apply gap-[20px]; }
|
|
84
|
+
.gyramais-row.gyramais-row-wide-gap-24 { @apply gap-[24px]; }
|
|
85
|
+
.gyramais-row.gyramais-row-wide-gap-28 { @apply gap-[28px]; }
|
|
86
|
+
.gyramais-row.gyramais-row-wide-gap-32 { @apply gap-[32px]; }
|
|
87
|
+
.gyramais-row.gyramais-row-wide-gap-36 { @apply gap-[36px]; }
|
|
88
|
+
.gyramais-row.gyramais-row-wide-gap-40 { @apply gap-[40px]; }
|
|
89
|
+
.gyramais-row.gyramais-row-wide-gap-44 { @apply gap-[44px]; }
|
|
90
|
+
.gyramais-row.gyramais-row-wide-gap-48 { @apply gap-[48px]; }
|
|
91
|
+
.gyramais-row.gyramais-row-wide-gap-52 { @apply gap-[52px]; }
|
|
92
|
+
.gyramais-row.gyramais-row-wide-gap-56 { @apply gap-[56px]; }
|
|
93
|
+
.gyramais-row.gyramais-row-wide-gap-60 { @apply gap-[60px]; }
|
|
94
|
+
.gyramais-row.gyramais-row-wide-gap-64 { @apply gap-[64px]; }
|
|
95
|
+
.gyramais-row.gyramais-row-wide-gap-68 { @apply gap-[68px]; }
|
|
96
|
+
.gyramais-row.gyramais-row-wide-gap-72 { @apply gap-[72px]; }
|
|
97
|
+
.gyramais-row.gyramais-row-wide-gap-76 { @apply gap-[76px]; }
|
|
98
|
+
.gyramais-row.gyramais-row-wide-gap-80 { @apply gap-[80px]; }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.gyramais-row.gyramais-row-columns-1 { @apply grid-cols-1; }
|
|
102
|
+
.gyramais-row.gyramais-row-columns-2 { @apply grid-cols-2; }
|
|
103
|
+
.gyramais-row.gyramais-row-columns-3 { @apply grid-cols-3; }
|
|
104
|
+
.gyramais-row.gyramais-row-columns-4 { @apply grid-cols-4; }
|
|
105
|
+
.gyramais-row.gyramais-row-columns-5 { @apply grid-cols-5; }
|
|
106
|
+
.gyramais-row.gyramais-row-columns-6 { @apply grid-cols-6; }
|
|
107
|
+
.gyramais-row.gyramais-row-columns-7 { @apply grid-cols-7; }
|
|
108
|
+
.gyramais-row.gyramais-row-columns-8 { @apply grid-cols-8; }
|
|
109
|
+
.gyramais-row.gyramais-row-columns-9 { @apply grid-cols-9; }
|
|
110
|
+
.gyramais-row.gyramais-row-columns-10 { @apply grid-cols-10; }
|
|
111
|
+
.gyramais-row.gyramais-row-columns-11 { @apply grid-cols-11; }
|
|
112
|
+
.gyramais-row.gyramais-row-columns-12 { @apply grid-cols-12; }
|
|
113
|
+
|
|
114
|
+
.gyramais-row.gyramais-row-align-start { @apply items-start; }
|
|
115
|
+
.gyramais-row.gyramais-row-align-center { @apply items-center; }
|
|
116
|
+
.gyramais-row.gyramais-row-align-end { @apply items-end; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Row";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Switch } from "./Switch";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Switch> = {
|
|
6
|
+
title: "Library/Components/Switch",
|
|
7
|
+
component: Switch,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
render: ({ disabled, checked = false }) => {
|
|
12
|
+
const [internalChecked, setInternalChecked] = useState(false);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setInternalChecked(checked);
|
|
16
|
+
}, [checked])
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Switch
|
|
20
|
+
disabled={disabled}
|
|
21
|
+
checked={internalChecked}
|
|
22
|
+
onCheckedChange={(checked) => setInternalChecked(checked)}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
|
|
30
|
+
type Story = StoryObj<typeof Switch>;
|
|
31
|
+
|
|
32
|
+
export const Default: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
id: '',
|
|
35
|
+
className: '',
|
|
36
|
+
disabled: false,
|
|
37
|
+
checked: false,
|
|
38
|
+
},
|
|
39
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
import { Switch as PrimitiveSwitch } from '../../shadcn/switch';
|
|
6
|
+
|
|
7
|
+
type SwitchProps = {
|
|
8
|
+
id?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Switch = ({
|
|
16
|
+
id,
|
|
17
|
+
className,
|
|
18
|
+
disabled = false,
|
|
19
|
+
checked = false,
|
|
20
|
+
onCheckedChange,
|
|
21
|
+
}: SwitchProps) => {
|
|
22
|
+
return (
|
|
23
|
+
<PrimitiveSwitch
|
|
24
|
+
id={id}
|
|
25
|
+
className={classNames(
|
|
26
|
+
'gyramais-switch',
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
disabled={disabled}
|
|
30
|
+
checked={checked}
|
|
31
|
+
onCheckedChange={onCheckedChange}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { Switch };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.gyramais-switch {
|
|
2
|
+
@apply
|
|
3
|
+
relative
|
|
4
|
+
w-[44px]
|
|
5
|
+
h-[25px]
|
|
6
|
+
bg-[var(--dark-button-color)]
|
|
7
|
+
rounded-[999999px]
|
|
8
|
+
border-[1px]
|
|
9
|
+
border-[var(--border-color)]
|
|
10
|
+
duration-300;
|
|
11
|
+
}
|
|
12
|
+
.gyramais-switch[data-state='checked'],
|
|
13
|
+
.gyramais-switch:hover {
|
|
14
|
+
@apply
|
|
15
|
+
bg-[var(--primary-button-color)]
|
|
16
|
+
}
|
|
17
|
+
.gyramais-switch:disabled {
|
|
18
|
+
@apply
|
|
19
|
+
grayscale
|
|
20
|
+
opacity-50
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.gyramais-switch .switch-thumb {
|
|
24
|
+
@apply
|
|
25
|
+
block
|
|
26
|
+
w-[21px]
|
|
27
|
+
h-[21px]
|
|
28
|
+
bg-white
|
|
29
|
+
rounded-full
|
|
30
|
+
transition-[transform_100ms]
|
|
31
|
+
translate-x-[2px]
|
|
32
|
+
will-change-transform;
|
|
33
|
+
}
|
|
34
|
+
.gyramais-switch .switch-thumb[data-state='checked'] {
|
|
35
|
+
@apply
|
|
36
|
+
translate-x-[19px];
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Switch";
|