@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 @@
|
|
|
1
|
+
export * from './Toast';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Tooltip } from "./Tooltip";
|
|
4
|
+
import { Tag } from '../Tag';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Tooltip> = {
|
|
7
|
+
title: "Library/Components/Tooltip",
|
|
8
|
+
component: Tooltip,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'padded',
|
|
11
|
+
},
|
|
12
|
+
render: ({ children, content, side, sideOffset, visible }) => (
|
|
13
|
+
<div className="w-full h-[260px] flex items-center justify-center">
|
|
14
|
+
<Tooltip
|
|
15
|
+
side={side}
|
|
16
|
+
sideOffset={sideOffset}
|
|
17
|
+
visible={visible}
|
|
18
|
+
content={content}
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
</Tooltip>
|
|
22
|
+
</div>
|
|
23
|
+
),
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
|
|
28
|
+
type Story = StoryObj<typeof Tooltip>;
|
|
29
|
+
|
|
30
|
+
export const Default: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
id: '',
|
|
33
|
+
className: '',
|
|
34
|
+
side: 'bottom',
|
|
35
|
+
sideOffset: 8,
|
|
36
|
+
visible: undefined,
|
|
37
|
+
content: 'Informação qualquer',
|
|
38
|
+
children: (
|
|
39
|
+
<Tag>
|
|
40
|
+
Coloca o mouse aqui
|
|
41
|
+
</Tag>
|
|
42
|
+
),
|
|
43
|
+
},
|
|
44
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Tooltip as PrimitiveTooltip,
|
|
7
|
+
TooltipContent,
|
|
8
|
+
TooltipProvider,
|
|
9
|
+
TooltipTrigger,
|
|
10
|
+
} from "../../shadcn/tooltip"
|
|
11
|
+
|
|
12
|
+
type TooltipProps = {
|
|
13
|
+
id?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
align?: "start" | "center" | "end";
|
|
16
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
17
|
+
sideOffset?: number;
|
|
18
|
+
visible?: boolean;
|
|
19
|
+
content: string;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const Tooltip = ({
|
|
24
|
+
id,
|
|
25
|
+
className,
|
|
26
|
+
align,
|
|
27
|
+
side,
|
|
28
|
+
sideOffset = 8,
|
|
29
|
+
visible,
|
|
30
|
+
content,
|
|
31
|
+
children,
|
|
32
|
+
}: TooltipProps) => {
|
|
33
|
+
return (
|
|
34
|
+
<TooltipProvider>
|
|
35
|
+
<PrimitiveTooltip
|
|
36
|
+
open={visible}
|
|
37
|
+
delayDuration={100}
|
|
38
|
+
>
|
|
39
|
+
<TooltipTrigger className="gyramais-tooltip-trigger">
|
|
40
|
+
{children}
|
|
41
|
+
</TooltipTrigger>
|
|
42
|
+
|
|
43
|
+
<TooltipContent
|
|
44
|
+
id={id}
|
|
45
|
+
className={classNames(
|
|
46
|
+
'gyramais-tooltip-content',
|
|
47
|
+
className,
|
|
48
|
+
)}
|
|
49
|
+
align={align}
|
|
50
|
+
side={side}
|
|
51
|
+
sideOffset={sideOffset}
|
|
52
|
+
>
|
|
53
|
+
{content}
|
|
54
|
+
</TooltipContent>
|
|
55
|
+
</PrimitiveTooltip>
|
|
56
|
+
</TooltipProvider>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { Tooltip };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tooltip";
|
package/src/index.css
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
@tailwind base;
|
|
2
|
+
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
4
|
+
|
|
5
|
+
:root {
|
|
6
|
+
--dark-logo-url: url('https://api.gyramais.com.br/files/cbc6e712-dc06-4c37-8720-ee2cef5b9a9d/573a37ddfb6002405568e8b538e3463d_Gyra_Marca_COR1_sem_margem.png');
|
|
7
|
+
--white-logo-url: url('https://api.gyramais.com.br/files/cbc6e712-dc06-4c37-8720-ee2cef5b9a9d/b254740ef7b86b49b2150a2f436e0877_Gyra_Marca_MONO_Negativo_sem_margem.png');
|
|
8
|
+
--background-logo-url: url('https://api.gyramais.com.br/files/cbc6e712-dc06-4c37-8720-ee2cef5b9a9d/573a37ddfb6002405568e8b538e3463d_Gyra_Marca_COR1_sem_margem.png');
|
|
9
|
+
--icon-url: url('https://api.gyramais.com.br/files/cbc6e712-dc06-4c37-8720-ee2cef5b9a9d/a5d3cb0568f3f80783c6cee6c37bdae4_Group.png');
|
|
10
|
+
|
|
11
|
+
--background-color: #F2F2F2;
|
|
12
|
+
--background-text-color: #2B2B2B;
|
|
13
|
+
--primary-button-color: #2F5DCB;
|
|
14
|
+
--primary-button-text-color: #FFFFFF;
|
|
15
|
+
--dark-button-color: #2f5ecb66;
|
|
16
|
+
--dark-button-text-color: #FFFFFF;
|
|
17
|
+
--primary-button-color-000: #2f5dcb;
|
|
18
|
+
--primary-button-color-100: #5280ee;
|
|
19
|
+
--primary-button-color-200: #75a3ff;
|
|
20
|
+
--primary-button-color-300: #98c6ff;
|
|
21
|
+
--primary-button-color-400: #bbe9ff;
|
|
22
|
+
--secondary-button-color: #B0C8FF;
|
|
23
|
+
--secondary-button-text-color: #2B2B2B;
|
|
24
|
+
--link-button-color: #2F5DCB;
|
|
25
|
+
|
|
26
|
+
--success-color: #5CC827;
|
|
27
|
+
--success-light-color: #E0F8F4;
|
|
28
|
+
--warning-color: #F3A712;
|
|
29
|
+
--warning-light-color: #FFF6ED;
|
|
30
|
+
--danger-color: #F45153;
|
|
31
|
+
--danger-light-color: #FFEDED;
|
|
32
|
+
|
|
33
|
+
--border-color: #C9D3CC;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
* {
|
|
37
|
+
font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji';
|
|
38
|
+
outline: none !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
::-webkit-scrollbar {
|
|
42
|
+
@apply
|
|
43
|
+
w-[0.5rem]
|
|
44
|
+
h-[0.5rem];
|
|
45
|
+
}
|
|
46
|
+
::-webkit-scrollbar-track {
|
|
47
|
+
@apply
|
|
48
|
+
bg-transparent;
|
|
49
|
+
}
|
|
50
|
+
::-webkit-scrollbar-thumb {
|
|
51
|
+
@apply
|
|
52
|
+
bg-[var(--primary-button-color)]
|
|
53
|
+
rounded-[0.625rem]
|
|
54
|
+
|
|
55
|
+
md:bg-[#DCDCDC];
|
|
56
|
+
}
|
|
57
|
+
::-webkit-scrollbar-thumb:hover {
|
|
58
|
+
@apply
|
|
59
|
+
bg-[var(--primary-button-color)]
|
|
60
|
+
brightness-110;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
a {
|
|
64
|
+
@apply
|
|
65
|
+
text-[var(--link-button-color)]
|
|
66
|
+
underline;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
form {
|
|
70
|
+
@apply
|
|
71
|
+
w-full;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.Toastify__toast {
|
|
75
|
+
@apply
|
|
76
|
+
!rounded-[10px]
|
|
77
|
+
!text-black;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ReactCollapse--collapse {
|
|
81
|
+
@apply
|
|
82
|
+
transition-[height_500ms];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* FONT-SIZE { desktop size -> mobile size }
|
|
86
|
+
h1 { 38px -> 24px }
|
|
87
|
+
h2 { 32px -> 24px }
|
|
88
|
+
h3 { 28px -> 20px }
|
|
89
|
+
h4 { 24px -> 20px }
|
|
90
|
+
h5 { 20px -> 16px }
|
|
91
|
+
h6 { 18px -> 16px }
|
|
92
|
+
p { 16px -> 16px }
|
|
93
|
+
|
|
94
|
+
FONT-WEIGHT
|
|
95
|
+
b { 400 }
|
|
96
|
+
strong { 700 } */
|
|
97
|
+
|
|
98
|
+
h1,
|
|
99
|
+
h2,
|
|
100
|
+
h3,
|
|
101
|
+
h4,
|
|
102
|
+
h5,
|
|
103
|
+
h6,
|
|
104
|
+
p {
|
|
105
|
+
@apply
|
|
106
|
+
whitespace-pre-line
|
|
107
|
+
text-black;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
h1 {
|
|
111
|
+
font-size: 2.375rem !important;
|
|
112
|
+
line-height: 2.380rem !important;
|
|
113
|
+
font-weight: 300;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
h2 {
|
|
117
|
+
font-size: 2rem !important;
|
|
118
|
+
line-height: 2.5rem !important;
|
|
119
|
+
font-weight: 300;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
h3 {
|
|
123
|
+
font-size: 1.75rem !important;
|
|
124
|
+
line-height: 2.1rem !important;
|
|
125
|
+
font-weight: 300;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
h4 {
|
|
129
|
+
font-size: 1.5rem !important;
|
|
130
|
+
line-height: 1.8rem !important;
|
|
131
|
+
font-weight: 300;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
h5 {
|
|
135
|
+
font-size: 1.25rem !important;
|
|
136
|
+
line-height: 1.5rem !important;
|
|
137
|
+
font-weight: 300;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
h6 {
|
|
141
|
+
font-size: 1.125rem !important;
|
|
142
|
+
line-height: 1.3rem !important;
|
|
143
|
+
font-weight: 300;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@media(max-width: 768px) {
|
|
147
|
+
h1 {
|
|
148
|
+
font-size: 1.5rem !important;
|
|
149
|
+
line-height: 1.6rem !important;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
h2 {
|
|
153
|
+
font-size: 1.5rem !important;
|
|
154
|
+
line-height: 1.6rem !important;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
h3 {
|
|
158
|
+
font-size: 1.25rem !important;
|
|
159
|
+
line-height: 1.3rem !important;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
h4 {
|
|
163
|
+
font-size: 1.25rem !important;
|
|
164
|
+
line-height: 1.5rem !important;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
h5 {
|
|
168
|
+
font-size: 1rem !important;
|
|
169
|
+
line-height: 1.3rem !important;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
h6 {
|
|
173
|
+
font-size: 1rem !important;
|
|
174
|
+
line-height: 1rem !important;
|
|
175
|
+
}
|
|
176
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// BASE CSS
|
|
2
|
+
import "./index.css";
|
|
3
|
+
import "react-toastify/dist/ReactToastify.css";
|
|
4
|
+
import "react-modern-drawer/dist/index.css";
|
|
5
|
+
|
|
6
|
+
// COMPONENTS CSS
|
|
7
|
+
import "./components/Avatar/index.css";
|
|
8
|
+
import "./components/Button/index.css";
|
|
9
|
+
import "./components/Card/index.css";
|
|
10
|
+
import "./components/Chart/index.css";
|
|
11
|
+
import "./components/Checkbox/index.css";
|
|
12
|
+
import "./components/Col/index.css";
|
|
13
|
+
import "./components/Collapse/index.css";
|
|
14
|
+
import "./components/Divider/index.css";
|
|
15
|
+
import "./components/Drawer/index.css";
|
|
16
|
+
import "./components/DropdownMenu/index.css";
|
|
17
|
+
import "./components/Filter/index.css";
|
|
18
|
+
import "./components/Form/index.css";
|
|
19
|
+
import "./components/HoverCard/index.css";
|
|
20
|
+
import "./components/Icon/index.css";
|
|
21
|
+
import "./components/IconDisplay/index.css";
|
|
22
|
+
import "./components/Information/index.css";
|
|
23
|
+
import "./components/Input/index.css";
|
|
24
|
+
import "./components/Layout/index.css";
|
|
25
|
+
import "./components/List/index.css";
|
|
26
|
+
import "./components/Loading/index.css";
|
|
27
|
+
import "./components/Logo/index.css";
|
|
28
|
+
import "./components/Menubar/index.css";
|
|
29
|
+
import "./components/Row/index.css";
|
|
30
|
+
import "./components/Switch/index.css";
|
|
31
|
+
import "./components/Table/index.css";
|
|
32
|
+
import "./components/Tabs/index.css";
|
|
33
|
+
import "./components/Tag/index.css";
|
|
34
|
+
import "./components/Tooltip/index.css";
|
|
35
|
+
|
|
36
|
+
// THEME
|
|
37
|
+
import theme from "./theme";
|
|
38
|
+
export default theme;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
|
3
|
+
import CheckIcon from '@mui/icons-material/Check';
|
|
4
|
+
|
|
5
|
+
import { cn } from "./lib/utils";
|
|
6
|
+
|
|
7
|
+
const Checkbox = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
|
10
|
+
>(({ id, className, ...props }, ref) => (
|
|
11
|
+
<CheckboxPrimitive.Root
|
|
12
|
+
ref={ref}
|
|
13
|
+
id={id}
|
|
14
|
+
className={cn(
|
|
15
|
+
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
>
|
|
20
|
+
<CheckboxPrimitive.Indicator className={cn("flex items-center justify-center text-current")}>
|
|
21
|
+
<CheckIcon className={cn('!text-base text-[var(--primary-button-color)]')} />
|
|
22
|
+
</CheckboxPrimitive.Indicator>
|
|
23
|
+
</CheckboxPrimitive.Root>
|
|
24
|
+
))
|
|
25
|
+
|
|
26
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
|
27
|
+
|
|
28
|
+
export { Checkbox }
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
5
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "./lib/utils"
|
|
8
|
+
|
|
9
|
+
const DropdownMenu = DropdownMenuPrimitive.Root
|
|
10
|
+
|
|
11
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
12
|
+
|
|
13
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group
|
|
14
|
+
|
|
15
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
|
16
|
+
|
|
17
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub
|
|
18
|
+
|
|
19
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
|
|
20
|
+
|
|
21
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
|
22
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
23
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
24
|
+
inset?: boolean
|
|
25
|
+
}
|
|
26
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
27
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cn(
|
|
30
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
31
|
+
inset && "pl-8",
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
|
38
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
39
|
+
))
|
|
40
|
+
DropdownMenuSubTrigger.displayName =
|
|
41
|
+
DropdownMenuPrimitive.SubTrigger.displayName
|
|
42
|
+
|
|
43
|
+
const DropdownMenuSubContent = React.forwardRef<
|
|
44
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
45
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
46
|
+
>(({ className, ...props }, ref) => (
|
|
47
|
+
<DropdownMenuPrimitive.SubContent
|
|
48
|
+
ref={ref}
|
|
49
|
+
className={cn(
|
|
50
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
51
|
+
className
|
|
52
|
+
)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
))
|
|
56
|
+
DropdownMenuSubContent.displayName =
|
|
57
|
+
DropdownMenuPrimitive.SubContent.displayName
|
|
58
|
+
|
|
59
|
+
const DropdownMenuContent = React.forwardRef<
|
|
60
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
|
61
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
62
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
63
|
+
<DropdownMenuPrimitive.Portal>
|
|
64
|
+
<DropdownMenuPrimitive.Content
|
|
65
|
+
ref={ref}
|
|
66
|
+
sideOffset={sideOffset}
|
|
67
|
+
className={cn(
|
|
68
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
69
|
+
className
|
|
70
|
+
)}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
</DropdownMenuPrimitive.Portal>
|
|
74
|
+
))
|
|
75
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
|
|
76
|
+
|
|
77
|
+
const DropdownMenuItem = React.forwardRef<
|
|
78
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
79
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
80
|
+
inset?: boolean
|
|
81
|
+
}
|
|
82
|
+
>(({ className, inset, ...props }, ref) => (
|
|
83
|
+
<DropdownMenuPrimitive.Item
|
|
84
|
+
ref={ref}
|
|
85
|
+
className={cn(
|
|
86
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
87
|
+
inset && "pl-8",
|
|
88
|
+
className
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
))
|
|
93
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
|
94
|
+
|
|
95
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
96
|
+
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
97
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
98
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
99
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
100
|
+
ref={ref}
|
|
101
|
+
className={cn(
|
|
102
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
103
|
+
className
|
|
104
|
+
)}
|
|
105
|
+
checked={checked}
|
|
106
|
+
{...props}
|
|
107
|
+
>
|
|
108
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
109
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
110
|
+
<Check className="h-4 w-4" />
|
|
111
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
112
|
+
</span>
|
|
113
|
+
{children}
|
|
114
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
115
|
+
))
|
|
116
|
+
DropdownMenuCheckboxItem.displayName =
|
|
117
|
+
DropdownMenuPrimitive.CheckboxItem.displayName
|
|
118
|
+
|
|
119
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
|
120
|
+
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
121
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
122
|
+
>(({ className, children, ...props }, ref) => (
|
|
123
|
+
<DropdownMenuPrimitive.RadioItem
|
|
124
|
+
ref={ref}
|
|
125
|
+
className={cn(
|
|
126
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
127
|
+
className
|
|
128
|
+
)}
|
|
129
|
+
{...props}
|
|
130
|
+
>
|
|
131
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
132
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
133
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
134
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
135
|
+
</span>
|
|
136
|
+
{children}
|
|
137
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
138
|
+
))
|
|
139
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
|
|
140
|
+
|
|
141
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
142
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
|
143
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
|
144
|
+
inset?: boolean
|
|
145
|
+
}
|
|
146
|
+
>(({ className, inset, ...props }, ref) => (
|
|
147
|
+
<DropdownMenuPrimitive.Label
|
|
148
|
+
ref={ref}
|
|
149
|
+
className={cn(
|
|
150
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
151
|
+
inset && "pl-8",
|
|
152
|
+
className
|
|
153
|
+
)}
|
|
154
|
+
{...props}
|
|
155
|
+
/>
|
|
156
|
+
))
|
|
157
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
|
|
158
|
+
|
|
159
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
160
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
|
161
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
162
|
+
>(({ className, ...props }, ref) => (
|
|
163
|
+
<DropdownMenuPrimitive.Separator
|
|
164
|
+
ref={ref}
|
|
165
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
166
|
+
{...props}
|
|
167
|
+
/>
|
|
168
|
+
))
|
|
169
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
|
|
170
|
+
|
|
171
|
+
const DropdownMenuShortcut = ({
|
|
172
|
+
className,
|
|
173
|
+
...props
|
|
174
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
175
|
+
return (
|
|
176
|
+
<span
|
|
177
|
+
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
|
|
178
|
+
{...props}
|
|
179
|
+
/>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
DropdownMenu,
|
|
186
|
+
DropdownMenuTrigger,
|
|
187
|
+
DropdownMenuContent,
|
|
188
|
+
DropdownMenuItem,
|
|
189
|
+
DropdownMenuCheckboxItem,
|
|
190
|
+
DropdownMenuRadioItem,
|
|
191
|
+
DropdownMenuLabel,
|
|
192
|
+
DropdownMenuSeparator,
|
|
193
|
+
DropdownMenuShortcut,
|
|
194
|
+
DropdownMenuGroup,
|
|
195
|
+
DropdownMenuPortal,
|
|
196
|
+
DropdownMenuSub,
|
|
197
|
+
DropdownMenuSubContent,
|
|
198
|
+
DropdownMenuSubTrigger,
|
|
199
|
+
DropdownMenuRadioGroup,
|
|
200
|
+
}
|