@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,192 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
ResponsiveContainer,
|
|
7
|
+
BarChart,
|
|
8
|
+
Bar,
|
|
9
|
+
XAxis,
|
|
10
|
+
YAxis,
|
|
11
|
+
CartesianGrid,
|
|
12
|
+
Tooltip,
|
|
13
|
+
Legend,
|
|
14
|
+
PieChart,
|
|
15
|
+
Pie,
|
|
16
|
+
Sector,
|
|
17
|
+
} from 'recharts';
|
|
18
|
+
|
|
19
|
+
type BarChartData = Array<{
|
|
20
|
+
[key: string]: number;
|
|
21
|
+
}>;
|
|
22
|
+
type PieChartData = Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
value: string | number;
|
|
25
|
+
}>;
|
|
26
|
+
|
|
27
|
+
type ChartProps = {
|
|
28
|
+
id?: string;
|
|
29
|
+
className?: string;
|
|
30
|
+
type?: 'bar' | 'pie';
|
|
31
|
+
layout?: 'horizontal' | 'vertical';
|
|
32
|
+
barSize?: number;
|
|
33
|
+
barGap?: number;
|
|
34
|
+
indexes?: Array<{
|
|
35
|
+
name: string;
|
|
36
|
+
key: string;
|
|
37
|
+
stackId?: string;
|
|
38
|
+
color?: string;
|
|
39
|
+
}>;
|
|
40
|
+
data?: BarChartData | PieChartData;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const renderActiveShape = (props: any) => {
|
|
44
|
+
const RADIAN = Math.PI / 180;
|
|
45
|
+
const { cx, cy, midAngle, innerRadius, outerRadius, startAngle, endAngle, fill, payload, percent, value } = props;
|
|
46
|
+
const sin = Math.sin(-RADIAN * midAngle);
|
|
47
|
+
const cos = Math.cos(-RADIAN * midAngle);
|
|
48
|
+
const sx = cx + (outerRadius + 10) * cos;
|
|
49
|
+
const sy = cy + (outerRadius + 10) * sin;
|
|
50
|
+
const mx = cx + (outerRadius + 30) * cos;
|
|
51
|
+
const my = cy + (outerRadius + 30) * sin;
|
|
52
|
+
const ex = mx + (cos >= 0 ? 1 : -1) * 22;
|
|
53
|
+
const ey = my;
|
|
54
|
+
const textAnchor = cos >= 0 ? 'start' : 'end';
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<g>
|
|
58
|
+
<text x={cx} y={cy} dy={8} textAnchor="middle" fill={fill}>
|
|
59
|
+
{payload.name}
|
|
60
|
+
</text>
|
|
61
|
+
|
|
62
|
+
<Sector
|
|
63
|
+
cx={cx}
|
|
64
|
+
cy={cy}
|
|
65
|
+
innerRadius={innerRadius}
|
|
66
|
+
outerRadius={outerRadius}
|
|
67
|
+
startAngle={startAngle}
|
|
68
|
+
endAngle={endAngle}
|
|
69
|
+
fill={fill}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<Sector
|
|
73
|
+
cx={cx}
|
|
74
|
+
cy={cy}
|
|
75
|
+
startAngle={startAngle}
|
|
76
|
+
endAngle={endAngle}
|
|
77
|
+
innerRadius={outerRadius + 6}
|
|
78
|
+
outerRadius={outerRadius + 10}
|
|
79
|
+
fill={fill}
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
<path d={`M${sx},${sy}L${mx},${my}L${ex},${ey}`} stroke={fill} fill="none" />
|
|
83
|
+
<circle cx={ex} cy={ey} r={2} fill={fill} stroke="none" />
|
|
84
|
+
<text x={ex + (cos >= 0 ? 1 : -1) * 12} y={ey} textAnchor={textAnchor} fill="#333">{`${value}`}</text>
|
|
85
|
+
<text x={ex + (cos >= 0 ? 1 : -1) * 12} y={ey} dy={18} textAnchor={textAnchor} fill="var(--dark-button-color)">
|
|
86
|
+
{`(${(percent * 100).toFixed(2)}%)`}
|
|
87
|
+
</text>
|
|
88
|
+
</g>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const Chart = ({
|
|
93
|
+
id,
|
|
94
|
+
className,
|
|
95
|
+
type = 'bar',
|
|
96
|
+
layout = 'vertical',
|
|
97
|
+
barSize = 24,
|
|
98
|
+
barGap = 16,
|
|
99
|
+
indexes = [],
|
|
100
|
+
data = [],
|
|
101
|
+
}: ChartProps) => {
|
|
102
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
103
|
+
|
|
104
|
+
const renderChart = () => {
|
|
105
|
+
if (type === 'bar') {
|
|
106
|
+
return (
|
|
107
|
+
<BarChart
|
|
108
|
+
barSize={barSize}
|
|
109
|
+
barGap={barGap}
|
|
110
|
+
layout={layout}
|
|
111
|
+
data={data}
|
|
112
|
+
>
|
|
113
|
+
<CartesianGrid />
|
|
114
|
+
|
|
115
|
+
<XAxis
|
|
116
|
+
hide={layout === 'horizontal'}
|
|
117
|
+
type={layout === 'horizontal' ? 'category' : 'number'}
|
|
118
|
+
/>
|
|
119
|
+
<YAxis
|
|
120
|
+
hide={layout === 'vertical'}
|
|
121
|
+
type={layout === 'vertical' ? 'category' : 'number'}
|
|
122
|
+
/>
|
|
123
|
+
|
|
124
|
+
<Tooltip
|
|
125
|
+
contentStyle={{ borderRadius: 12 }}
|
|
126
|
+
labelStyle={{ display: 'none' }}
|
|
127
|
+
cursor={{ fill: '#00000011' }}
|
|
128
|
+
/>
|
|
129
|
+
|
|
130
|
+
<Legend
|
|
131
|
+
align={layout === 'vertical' ? 'left' : 'right'}
|
|
132
|
+
verticalAlign="top"
|
|
133
|
+
iconType="square"
|
|
134
|
+
iconSize={12}
|
|
135
|
+
wrapperStyle={{ paddingBottom: 16 }}
|
|
136
|
+
/>
|
|
137
|
+
|
|
138
|
+
{indexes.map((index, i) => (
|
|
139
|
+
<Bar
|
|
140
|
+
key={`${index}-${i}`}
|
|
141
|
+
name={index.name}
|
|
142
|
+
dataKey={index.key}
|
|
143
|
+
stackId={index.stackId}
|
|
144
|
+
fill={`var(--primary-button-color-${i}00)`}
|
|
145
|
+
radius={layout === 'vertical' ? [0, 4, 4, 0] : [4, 4, 0, 0]}
|
|
146
|
+
/>
|
|
147
|
+
))}
|
|
148
|
+
</BarChart>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (type === 'pie') {
|
|
153
|
+
return (
|
|
154
|
+
<PieChart width={300} height={300}>
|
|
155
|
+
<Pie
|
|
156
|
+
activeIndex={activeIndex}
|
|
157
|
+
activeShape={renderActiveShape}
|
|
158
|
+
onMouseEnter={(_, index) => setActiveIndex(index)}
|
|
159
|
+
data={data}
|
|
160
|
+
dataKey="value"
|
|
161
|
+
cx="50%"
|
|
162
|
+
cy="50%"
|
|
163
|
+
outerRadius={90}
|
|
164
|
+
innerRadius={70}
|
|
165
|
+
fill="var(--primary-button-color)"
|
|
166
|
+
/>
|
|
167
|
+
</PieChart>
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<div />
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<ResponsiveContainer
|
|
178
|
+
id={id}
|
|
179
|
+
className={classNames(
|
|
180
|
+
'gyramais-chart',
|
|
181
|
+
`gyramais-chart-${type}`,
|
|
182
|
+
className,
|
|
183
|
+
)}
|
|
184
|
+
width="100%"
|
|
185
|
+
height="100%"
|
|
186
|
+
>
|
|
187
|
+
{renderChart()}
|
|
188
|
+
</ResponsiveContainer>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export { Chart };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.gyramais-chart .recharts-legend-item {
|
|
2
|
+
@apply
|
|
3
|
+
!mr-0
|
|
4
|
+
}
|
|
5
|
+
.gyramais-chart .recharts-legend-item + .recharts-legend-item {
|
|
6
|
+
@apply
|
|
7
|
+
!ml-8
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.gyramais-chart .recharts-legend-item-text {
|
|
11
|
+
@apply
|
|
12
|
+
!text-[#565656]
|
|
13
|
+
!font-normal
|
|
14
|
+
!text-xs
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Chart";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Checkbox } from "./Checkbox";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Checkbox> = {
|
|
6
|
+
title: "Library/Components/Checkbox",
|
|
7
|
+
component: Checkbox,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
backgrounds: {
|
|
11
|
+
default: 'white',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
render: ({ children, checked = false }) => {
|
|
15
|
+
const [internalChecked, setInternalChecked] = useState(false);
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setInternalChecked(checked);
|
|
19
|
+
}, [checked])
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Checkbox
|
|
23
|
+
checked={internalChecked}
|
|
24
|
+
onCheckedChange={(checked) => setInternalChecked(checked)}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
</Checkbox>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
33
|
+
|
|
34
|
+
type Story = StoryObj<typeof Checkbox>;
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
id: '',
|
|
39
|
+
className: '',
|
|
40
|
+
name: '',
|
|
41
|
+
checked: false,
|
|
42
|
+
children: (
|
|
43
|
+
'Caixa de seleção'
|
|
44
|
+
),
|
|
45
|
+
},
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
import { Checkbox as PrimitiveCheckbox } from "../../shadcn/checkbox";
|
|
6
|
+
|
|
7
|
+
type CheckboxProps = {
|
|
8
|
+
id?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const Checkbox = React.forwardRef(({
|
|
17
|
+
id,
|
|
18
|
+
className,
|
|
19
|
+
name,
|
|
20
|
+
checked,
|
|
21
|
+
onCheckedChange,
|
|
22
|
+
children,
|
|
23
|
+
}: CheckboxProps, ref) => {
|
|
24
|
+
return (
|
|
25
|
+
<div className="gyramais-checkbox-container">
|
|
26
|
+
<PrimitiveCheckbox
|
|
27
|
+
id={id}
|
|
28
|
+
name={name}
|
|
29
|
+
className={classNames(
|
|
30
|
+
'gyramais-checkbox',
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
checked={checked}
|
|
34
|
+
onCheckedChange={onCheckedChange}
|
|
35
|
+
/>
|
|
36
|
+
|
|
37
|
+
{children && (
|
|
38
|
+
<div className="gyramais-checkbox-label">
|
|
39
|
+
{children}
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export { Checkbox };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.gyramais-checkbox-container {
|
|
2
|
+
@apply
|
|
3
|
+
flex
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.gyramais-checkbox-container .gyramais-checkbox {
|
|
7
|
+
@apply
|
|
8
|
+
relative
|
|
9
|
+
bg-white
|
|
10
|
+
min-h-[20px]
|
|
11
|
+
min-w-[20px]
|
|
12
|
+
h-5
|
|
13
|
+
w-5
|
|
14
|
+
rounded-sm
|
|
15
|
+
border-2
|
|
16
|
+
border-[var(--border-color)]
|
|
17
|
+
duration-300;
|
|
18
|
+
}
|
|
19
|
+
.gyramais-checkbox-container .gyramais-checkbox:hover,
|
|
20
|
+
.gyramais-checkbox-container .gyramais-checkbox[data-state="checked"]{
|
|
21
|
+
@apply
|
|
22
|
+
border-[var(--primary-button-color)];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.gyramais-checkbox-container .gyramais-checkbox-label {
|
|
26
|
+
@apply
|
|
27
|
+
ml-4
|
|
28
|
+
font-normal
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Checkbox";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Row } from "../Row";
|
|
4
|
+
import { Col } from "./Col";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Col> = {
|
|
7
|
+
title: "Library/Components/Col",
|
|
8
|
+
component: Col,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'padded',
|
|
11
|
+
},
|
|
12
|
+
render: ({ span }) => (
|
|
13
|
+
<Row columns={12} gap={16}>
|
|
14
|
+
<Col span={span} className="h-16 bg-[var(--background-color)] rounded-md" />
|
|
15
|
+
|
|
16
|
+
{Array.from({ length: 12 - (typeof span === 'number' ? span : 0) }).map(() => (
|
|
17
|
+
<Col span={1} className="h-full bg-[var(--background-color)] rounded-md opacity-20" />
|
|
18
|
+
))}
|
|
19
|
+
</Row>
|
|
20
|
+
),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
|
|
25
|
+
type Story = StoryObj<typeof Col>;
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
id: '',
|
|
30
|
+
className: '',
|
|
31
|
+
span: 4,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
type Span = {
|
|
6
|
+
mobile?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
7
|
+
tablet?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
8
|
+
desktop?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
9
|
+
wide?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type ColProps = {
|
|
13
|
+
id?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
span?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Span;
|
|
16
|
+
onClick?: () => void;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const Col = ({
|
|
21
|
+
id,
|
|
22
|
+
className,
|
|
23
|
+
span = 1,
|
|
24
|
+
onClick,
|
|
25
|
+
children,
|
|
26
|
+
}: ColProps) => {
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
id={id}
|
|
30
|
+
className={classNames(
|
|
31
|
+
"gyramais-col",
|
|
32
|
+
`gyramais-col-mobile-span-${typeof span === 'number' ? span : typeof span === 'object' && !Array.isArray(span) && span.mobile}`,
|
|
33
|
+
typeof span === 'object' && !Array.isArray(span) && span.tablet ? `gyramais-col-tablet-span-${span.tablet}` : '',
|
|
34
|
+
typeof span === 'object' && !Array.isArray(span) && span.desktop ? `gyramais-col-desktop-span-${span.desktop}` : '',
|
|
35
|
+
typeof span === 'object' && !Array.isArray(span) && span.wide ? `gyramais-col-wide-span-${span.wide}` : '',
|
|
36
|
+
className,
|
|
37
|
+
)}
|
|
38
|
+
onClick={onClick}
|
|
39
|
+
>
|
|
40
|
+
{children}
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { Col };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.gyramais-col.gyramais-col-mobile-span-1 { @apply col-span-1; }
|
|
2
|
+
.gyramais-col.gyramais-col-mobile-span-2 { @apply col-span-2; }
|
|
3
|
+
.gyramais-col.gyramais-col-mobile-span-3 { @apply col-span-3; }
|
|
4
|
+
.gyramais-col.gyramais-col-mobile-span-4 { @apply col-span-4; }
|
|
5
|
+
.gyramais-col.gyramais-col-mobile-span-5 { @apply col-span-5; }
|
|
6
|
+
.gyramais-col.gyramais-col-mobile-span-6 { @apply col-span-6; }
|
|
7
|
+
.gyramais-col.gyramais-col-mobile-span-7 { @apply col-span-7; }
|
|
8
|
+
.gyramais-col.gyramais-col-mobile-span-8 { @apply col-span-8; }
|
|
9
|
+
.gyramais-col.gyramais-col-mobile-span-9 { @apply col-span-9; }
|
|
10
|
+
.gyramais-col.gyramais-col-mobile-span-10 { @apply col-span-10; }
|
|
11
|
+
.gyramais-col.gyramais-col-mobile-span-11 { @apply col-span-11; }
|
|
12
|
+
.gyramais-col.gyramais-col-mobile-span-12 { @apply col-span-12; }
|
|
13
|
+
|
|
14
|
+
@media(min-width: 769px) {
|
|
15
|
+
.gyramais-col.gyramais-col-tablet-span-1 { @apply col-span-1; }
|
|
16
|
+
.gyramais-col.gyramais-col-tablet-span-2 { @apply col-span-2; }
|
|
17
|
+
.gyramais-col.gyramais-col-tablet-span-3 { @apply col-span-3; }
|
|
18
|
+
.gyramais-col.gyramais-col-tablet-span-4 { @apply col-span-4; }
|
|
19
|
+
.gyramais-col.gyramais-col-tablet-span-5 { @apply col-span-5; }
|
|
20
|
+
.gyramais-col.gyramais-col-tablet-span-6 { @apply col-span-6; }
|
|
21
|
+
.gyramais-col.gyramais-col-tablet-span-7 { @apply col-span-7; }
|
|
22
|
+
.gyramais-col.gyramais-col-tablet-span-8 { @apply col-span-8; }
|
|
23
|
+
.gyramais-col.gyramais-col-tablet-span-9 { @apply col-span-9; }
|
|
24
|
+
.gyramais-col.gyramais-col-tablet-span-10 { @apply col-span-10; }
|
|
25
|
+
.gyramais-col.gyramais-col-tablet-span-11 { @apply col-span-11; }
|
|
26
|
+
.gyramais-col.gyramais-col-tablet-span-12 { @apply col-span-12; }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@media(min-width: 1025px) {
|
|
30
|
+
.gyramais-col.gyramais-col-desktop-span-1 { @apply col-span-1; }
|
|
31
|
+
.gyramais-col.gyramais-col-desktop-span-2 { @apply col-span-2; }
|
|
32
|
+
.gyramais-col.gyramais-col-desktop-span-3 { @apply col-span-3; }
|
|
33
|
+
.gyramais-col.gyramais-col-desktop-span-4 { @apply col-span-4; }
|
|
34
|
+
.gyramais-col.gyramais-col-desktop-span-5 { @apply col-span-5; }
|
|
35
|
+
.gyramais-col.gyramais-col-desktop-span-6 { @apply col-span-6; }
|
|
36
|
+
.gyramais-col.gyramais-col-desktop-span-7 { @apply col-span-7; }
|
|
37
|
+
.gyramais-col.gyramais-col-desktop-span-8 { @apply col-span-8; }
|
|
38
|
+
.gyramais-col.gyramais-col-desktop-span-9 { @apply col-span-9; }
|
|
39
|
+
.gyramais-col.gyramais-col-desktop-span-10 { @apply col-span-10; }
|
|
40
|
+
.gyramais-col.gyramais-col-desktop-span-11 { @apply col-span-11; }
|
|
41
|
+
.gyramais-col.gyramais-col-desktop-span-12 { @apply col-span-12; }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@media(min-width: 1201px) {
|
|
45
|
+
.gyramais-col.gyramais-col-wide-span-1 { @apply col-span-1; }
|
|
46
|
+
.gyramais-col.gyramais-col-wide-span-2 { @apply col-span-2; }
|
|
47
|
+
.gyramais-col.gyramais-col-wide-span-3 { @apply col-span-3; }
|
|
48
|
+
.gyramais-col.gyramais-col-wide-span-4 { @apply col-span-4; }
|
|
49
|
+
.gyramais-col.gyramais-col-wide-span-5 { @apply col-span-5; }
|
|
50
|
+
.gyramais-col.gyramais-col-wide-span-6 { @apply col-span-6; }
|
|
51
|
+
.gyramais-col.gyramais-col-wide-span-7 { @apply col-span-7; }
|
|
52
|
+
.gyramais-col.gyramais-col-wide-span-8 { @apply col-span-8; }
|
|
53
|
+
.gyramais-col.gyramais-col-wide-span-9 { @apply col-span-9; }
|
|
54
|
+
.gyramais-col.gyramais-col-wide-span-10 { @apply col-span-10; }
|
|
55
|
+
.gyramais-col.gyramais-col-wide-span-11 { @apply col-span-11; }
|
|
56
|
+
.gyramais-col.gyramais-col-wide-span-12 { @apply col-span-12; }
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Col";
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Collapse } from "./Collapse";
|
|
4
|
+
import { CollapseIcon } from "./CollapseIcon";
|
|
5
|
+
import { Card } from '../Card';
|
|
6
|
+
import { Switch } from '../Switch';
|
|
7
|
+
import { Divider } from '../Divider';
|
|
8
|
+
import { Logo } from '../Logo';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof Collapse> = {
|
|
11
|
+
title: "Library/Components/Collapse",
|
|
12
|
+
component: Collapse,
|
|
13
|
+
parameters: {
|
|
14
|
+
layout: 'centered',
|
|
15
|
+
},
|
|
16
|
+
render: ({ children, collapsed }) => {
|
|
17
|
+
const [internalCollapsed, setInternalCollapsed] = useState<boolean | undefined>(collapsed);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setInternalCollapsed(collapsed);
|
|
21
|
+
}, [collapsed]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Card className="w-[300px]">
|
|
25
|
+
<Switch
|
|
26
|
+
checked={!internalCollapsed}
|
|
27
|
+
onCheckedChange={(checked) => setInternalCollapsed(!checked)}
|
|
28
|
+
/>
|
|
29
|
+
|
|
30
|
+
<Divider margin={12} />
|
|
31
|
+
|
|
32
|
+
<Collapse collapsed={internalCollapsed}>
|
|
33
|
+
{children}
|
|
34
|
+
</Collapse>
|
|
35
|
+
</Card>
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default meta;
|
|
41
|
+
|
|
42
|
+
type Story = StoryObj<typeof Collapse>;
|
|
43
|
+
|
|
44
|
+
export const Default: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
id: '',
|
|
47
|
+
className: '',
|
|
48
|
+
collapsed: false,
|
|
49
|
+
children: (
|
|
50
|
+
<Logo height={30} />
|
|
51
|
+
),
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const WithIcon: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
id: '',
|
|
58
|
+
className: '',
|
|
59
|
+
collapsed: true,
|
|
60
|
+
children: (
|
|
61
|
+
<Logo height={30} />
|
|
62
|
+
),
|
|
63
|
+
},
|
|
64
|
+
render: ({ children, collapsed }) => {
|
|
65
|
+
const [internalCollapsed, setInternalCollapsed] = useState<boolean | undefined>(false);
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
setInternalCollapsed(collapsed);
|
|
69
|
+
}, [collapsed])
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Card className="w-[300px]">
|
|
73
|
+
<CollapseIcon
|
|
74
|
+
collapsed={internalCollapsed}
|
|
75
|
+
onCollapse={(value) => setInternalCollapsed(value)}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<Divider margin={12} />
|
|
79
|
+
|
|
80
|
+
<Collapse collapsed={internalCollapsed}>
|
|
81
|
+
{children}
|
|
82
|
+
</Collapse>
|
|
83
|
+
</Card>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
import { Collapse as PrimitiveCollapse } from 'react-collapse';
|
|
6
|
+
|
|
7
|
+
type CollapseProps = {
|
|
8
|
+
id?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
collapsed?: boolean;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Collapse = ({
|
|
15
|
+
id,
|
|
16
|
+
className,
|
|
17
|
+
collapsed = false,
|
|
18
|
+
children,
|
|
19
|
+
}: CollapseProps) => {
|
|
20
|
+
return (
|
|
21
|
+
<PrimitiveCollapse
|
|
22
|
+
id={id}
|
|
23
|
+
className={classNames(
|
|
24
|
+
'gyramais-collapse',
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
isOpened={!collapsed}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</PrimitiveCollapse>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { Collapse };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
|
6
|
+
|
|
7
|
+
type CollapseIconProps = {
|
|
8
|
+
id?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
collapsed?: boolean;
|
|
11
|
+
onCollapse?: (collapsed: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const CollapseIcon = ({
|
|
15
|
+
id,
|
|
16
|
+
className,
|
|
17
|
+
collapsed = false,
|
|
18
|
+
onCollapse,
|
|
19
|
+
}: CollapseIconProps) => {
|
|
20
|
+
return (
|
|
21
|
+
<ArrowForwardIosIcon
|
|
22
|
+
id={id}
|
|
23
|
+
className={classNames(
|
|
24
|
+
'gyramais-collapse-icon',
|
|
25
|
+
collapsed ? 'collapsed' : '',
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
onClick={() => onCollapse?.(!collapsed)}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { CollapseIcon };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Divider } from "./Divider";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Divider> = {
|
|
6
|
+
title: "Library/Components/Divider",
|
|
7
|
+
component: Divider,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
render: ({ children, margin }) => (
|
|
12
|
+
<div className="w-[360px]">
|
|
13
|
+
Conteúdo 1
|
|
14
|
+
|
|
15
|
+
<Divider margin={margin}>
|
|
16
|
+
{children}
|
|
17
|
+
</Divider>
|
|
18
|
+
|
|
19
|
+
Conteúdo 2
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
|
|
26
|
+
type Story = StoryObj<typeof Divider>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
id: '',
|
|
31
|
+
className: '',
|
|
32
|
+
margin: 26,
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const Content: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
id: '',
|
|
39
|
+
className: '',
|
|
40
|
+
margin: 26,
|
|
41
|
+
children: (
|
|
42
|
+
'Ou'
|
|
43
|
+
)
|
|
44
|
+
},
|
|
45
|
+
}
|