designer-system-agroe 0.0.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/.storybook/main.ts +17 -0
- package/.storybook/preview.ts +22 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/README.md +73 -0
- package/eslint.config.js +23 -0
- package/index.html +13 -0
- package/package.json +45 -0
- package/public/vite.svg +1 -0
- package/src/App.tsx +8 -0
- package/src/index.css +40 -0
- package/src/index.ts +15 -0
- package/src/main.tsx +10 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/badges/badge.module.css +45 -0
- package/src/stories/badges/badge.stories.tsx +56 -0
- package/src/stories/badges/index.tsx +16 -0
- package/src/stories/buttons/Button.stories.tsx +35 -0
- package/src/stories/buttons/button.module.css +17 -0
- package/src/stories/buttons/index.tsx +17 -0
- package/src/stories/forms/inputs/input-quantity/index.tsx +45 -0
- package/src/stories/forms/inputs/input-quantity/input-quantity.module.css +27 -0
- package/src/stories/forms/inputs/input-quantity/input-quantity.stories.tsx +43 -0
- package/src/stories/modais/index.tsx +95 -0
- package/src/stories/modais/modal.module.css +143 -0
- package/src/stories/modais/modal.stories.tsx +97 -0
- package/src/stories/totalizadores/index.tsx +36 -0
- package/src/stories/totalizadores/totalizador.module.css +100 -0
- package/src/stories/totalizadores/totalizador.stories.tsx +96 -0
- package/src/utils/cn.tsx +3 -0
- package/tsconfig.app.json +34 -0
- package/tsconfig.json +13 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +54 -0
- package/vitest.shims.d.ts +1 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ComponentProps, HTMLAttributes } from 'react';
|
|
2
|
+
import { Dialog } from 'radix-ui';
|
|
3
|
+
import { cn } from '@/utils/cn';
|
|
4
|
+
import styles from './modal.module.css';
|
|
5
|
+
|
|
6
|
+
type ModalRootProps = ComponentProps<typeof Dialog.Root>;
|
|
7
|
+
type ModalTriggerProps = ComponentProps<typeof Dialog.Trigger>;
|
|
8
|
+
|
|
9
|
+
interface ModalContentProps extends ComponentProps<typeof Dialog.Content> {
|
|
10
|
+
showCloseButton?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ModalSectionProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ModalCloseProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function Modal(props: ModalRootProps) {
|
|
22
|
+
return <Dialog.Root {...props} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function ModalTrigger({ className, children, ...props }: ModalTriggerProps) {
|
|
26
|
+
return (
|
|
27
|
+
<Dialog.Trigger className={className} {...props}>
|
|
28
|
+
{children}
|
|
29
|
+
</Dialog.Trigger>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function ModalContent({ children, className, showCloseButton = true, ...props }: ModalContentProps) {
|
|
34
|
+
return (
|
|
35
|
+
<Dialog.Portal>
|
|
36
|
+
<Dialog.Overlay className={styles.overlay} />
|
|
37
|
+
<Dialog.Content className={cn(styles.content, className)} {...props}>
|
|
38
|
+
{children}
|
|
39
|
+
{showCloseButton ? (
|
|
40
|
+
<Dialog.Close className={styles.iconButton} aria-label="Fechar modal">
|
|
41
|
+
X
|
|
42
|
+
</Dialog.Close>
|
|
43
|
+
) : null}
|
|
44
|
+
</Dialog.Content>
|
|
45
|
+
</Dialog.Portal>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function ModalHeader({ className, children, ...props }: ModalSectionProps) {
|
|
50
|
+
return (
|
|
51
|
+
<div className={cn(styles.header, className)} {...props}>
|
|
52
|
+
{children}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function ModalBody({ className, children, ...props }: ModalSectionProps) {
|
|
58
|
+
return (
|
|
59
|
+
<div className={cn(styles.body, className)} {...props}>
|
|
60
|
+
{children}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function ModalFooter({ className, children, ...props }: ModalSectionProps) {
|
|
66
|
+
return (
|
|
67
|
+
<div className={cn(styles.footer, className)} {...props}>
|
|
68
|
+
{children}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function ModalTitle({ className, children, ...props }: ComponentProps<typeof Dialog.Title>) {
|
|
74
|
+
return (
|
|
75
|
+
<Dialog.Title className={cn(styles.title, className)} {...props}>
|
|
76
|
+
{children}
|
|
77
|
+
</Dialog.Title>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function ModalDescription({ className, children, ...props }: ComponentProps<typeof Dialog.Description>) {
|
|
82
|
+
return (
|
|
83
|
+
<Dialog.Description className={cn(styles.description, className)} {...props}>
|
|
84
|
+
{children}
|
|
85
|
+
</Dialog.Description>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function ModalClose({ className, children = 'Fechar', ...props }: ModalCloseProps) {
|
|
90
|
+
return (
|
|
91
|
+
<Dialog.Close className={cn(styles.closeButton, className)} {...props}>
|
|
92
|
+
{children}
|
|
93
|
+
</Dialog.Close>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
.overlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
background: rgba(19, 28, 22, 0.58);
|
|
5
|
+
backdrop-filter: blur(4px);
|
|
6
|
+
animation: fadeIn 180ms ease-out;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.content {
|
|
10
|
+
position: fixed;
|
|
11
|
+
top: 50%;
|
|
12
|
+
left: 50%;
|
|
13
|
+
width: min(92vw, 560px);
|
|
14
|
+
max-height: min(85vh, 720px);
|
|
15
|
+
transform: translate(-50%, -50%);
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
gap: 20px;
|
|
19
|
+
padding: 28px;
|
|
20
|
+
border: 1px solid rgba(52, 58, 64, 0.12);
|
|
21
|
+
border-radius: 24px;
|
|
22
|
+
background: linear-gradient(180deg, #ffffff 0%, #f6f8f6 100%);
|
|
23
|
+
box-shadow: 0 24px 60px rgba(17, 24, 39, 0.22);
|
|
24
|
+
color: var(--font-color);
|
|
25
|
+
overflow-y: auto;
|
|
26
|
+
animation: contentIn 220ms ease-out;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.header {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
gap: 8px;
|
|
33
|
+
padding-right: 36px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.title {
|
|
37
|
+
margin: 0;
|
|
38
|
+
font-size: 1.5rem;
|
|
39
|
+
font-weight: 700;
|
|
40
|
+
line-height: 1.2;
|
|
41
|
+
color: var(--color-primary);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.description {
|
|
45
|
+
margin: 0;
|
|
46
|
+
font-size: 0.98rem;
|
|
47
|
+
line-height: 1.6;
|
|
48
|
+
color: rgba(52, 58, 64, 0.76);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.body {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
gap: 16px;
|
|
55
|
+
font-size: 0.98rem;
|
|
56
|
+
line-height: 1.7;
|
|
57
|
+
color: var(--font-color);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.footer {
|
|
61
|
+
display: flex;
|
|
62
|
+
justify-content: flex-end;
|
|
63
|
+
gap: 12px;
|
|
64
|
+
flex-wrap: wrap;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.closeButton,
|
|
68
|
+
.iconButton {
|
|
69
|
+
border: 0;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.closeButton {
|
|
75
|
+
min-width: 112px;
|
|
76
|
+
padding: 12px 18px;
|
|
77
|
+
border-radius: 12px;
|
|
78
|
+
background: var(--color-secondary);
|
|
79
|
+
color: #ffffff;
|
|
80
|
+
font-weight: 600;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.closeButton:hover,
|
|
84
|
+
.iconButton:hover {
|
|
85
|
+
transform: translateY(-1px);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.closeButton:hover {
|
|
89
|
+
box-shadow: 0 10px 24px rgba(32, 93, 46, 0.24);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.iconButton {
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: 18px;
|
|
95
|
+
right: 18px;
|
|
96
|
+
width: 36px;
|
|
97
|
+
height: 36px;
|
|
98
|
+
border-radius: 999px;
|
|
99
|
+
background: rgba(52, 58, 64, 0.08);
|
|
100
|
+
color: var(--color-primary);
|
|
101
|
+
font-size: 0.95rem;
|
|
102
|
+
font-weight: 700;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.iconButton:hover {
|
|
106
|
+
background: rgba(52, 58, 64, 0.14);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@keyframes fadeIn {
|
|
110
|
+
from {
|
|
111
|
+
opacity: 0;
|
|
112
|
+
}
|
|
113
|
+
to {
|
|
114
|
+
opacity: 1;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@keyframes contentIn {
|
|
119
|
+
from {
|
|
120
|
+
opacity: 0;
|
|
121
|
+
transform: translate(-50%, calc(-50% + 16px)) scale(0.98);
|
|
122
|
+
}
|
|
123
|
+
to {
|
|
124
|
+
opacity: 1;
|
|
125
|
+
transform: translate(-50%, -50%) scale(1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@media (max-width: 640px) {
|
|
130
|
+
.content {
|
|
131
|
+
width: calc(100vw - 24px);
|
|
132
|
+
padding: 22px 18px;
|
|
133
|
+
border-radius: 20px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.footer {
|
|
137
|
+
flex-direction: column;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.closeButton {
|
|
141
|
+
width: 100%;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Button } from '../buttons';
|
|
3
|
+
import {
|
|
4
|
+
Modal,
|
|
5
|
+
ModalBody,
|
|
6
|
+
ModalClose,
|
|
7
|
+
ModalContent,
|
|
8
|
+
ModalDescription,
|
|
9
|
+
ModalFooter,
|
|
10
|
+
ModalHeader,
|
|
11
|
+
ModalTitle,
|
|
12
|
+
ModalTrigger,
|
|
13
|
+
} from '.';
|
|
14
|
+
|
|
15
|
+
const meta = {
|
|
16
|
+
title: 'Components/Modal',
|
|
17
|
+
component: Modal,
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: 'centered',
|
|
20
|
+
},
|
|
21
|
+
tags: ['autodocs'],
|
|
22
|
+
argTypes: {
|
|
23
|
+
defaultOpen: {
|
|
24
|
+
control: 'boolean',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
} satisfies Meta<typeof Modal>;
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
|
|
32
|
+
export const Default: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
defaultOpen: false,
|
|
35
|
+
},
|
|
36
|
+
render: (args) => (
|
|
37
|
+
<Modal {...args}>
|
|
38
|
+
<ModalTrigger asChild>
|
|
39
|
+
<Button label="Abrir modal" onClick={() => undefined} />
|
|
40
|
+
</ModalTrigger>
|
|
41
|
+
<ModalContent>
|
|
42
|
+
<ModalHeader>
|
|
43
|
+
<ModalTitle>Nova safra em analise</ModalTitle>
|
|
44
|
+
<ModalDescription>
|
|
45
|
+
Revise as informacoes consolidadas antes de confirmar a publicacao para o time comercial.
|
|
46
|
+
</ModalDescription>
|
|
47
|
+
</ModalHeader>
|
|
48
|
+
<ModalBody>
|
|
49
|
+
<p>Area estimada: 2.450 hectares.</p>
|
|
50
|
+
<p>Janela de plantio: 18 de marco a 07 de abril.</p>
|
|
51
|
+
<p>Responsavel: Time de planejamento agricola.</p>
|
|
52
|
+
</ModalBody>
|
|
53
|
+
<ModalFooter>
|
|
54
|
+
<ModalClose>Fechar</ModalClose>
|
|
55
|
+
</ModalFooter>
|
|
56
|
+
</ModalContent>
|
|
57
|
+
</Modal>
|
|
58
|
+
),
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Opened: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
defaultOpen: true,
|
|
64
|
+
},
|
|
65
|
+
render: Default.render,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const LongContent: Story = {
|
|
69
|
+
args: {
|
|
70
|
+
defaultOpen: true,
|
|
71
|
+
},
|
|
72
|
+
render: (args) => (
|
|
73
|
+
<Modal {...args}>
|
|
74
|
+
<ModalTrigger asChild>
|
|
75
|
+
<Button label="Abrir modal" onClick={() => undefined} />
|
|
76
|
+
</ModalTrigger>
|
|
77
|
+
<ModalContent>
|
|
78
|
+
<ModalHeader>
|
|
79
|
+
<ModalTitle>Resumo operacional da fazenda</ModalTitle>
|
|
80
|
+
<ModalDescription>
|
|
81
|
+
Conteudo extenso para validar espacamento, scroll interno e hierarquia visual do componente.
|
|
82
|
+
</ModalDescription>
|
|
83
|
+
</ModalHeader>
|
|
84
|
+
<ModalBody>
|
|
85
|
+
<p>A produtividade media projetada para o talhao norte subiu 8% apos a ultima rodada de irrigacao.</p>
|
|
86
|
+
<p>O custo logistico permanece dentro do limite previsto para o trimestre, com desvio inferior a 2,1%.</p>
|
|
87
|
+
<p>As equipes de campo reportaram estabilidade no cronograma de colheita e nenhuma intercorrencia critica.</p>
|
|
88
|
+
<p>Os indicadores de solo apontam necessidade de reforco nutricional em duas frentes especificas.</p>
|
|
89
|
+
<p>A validacao deste painel garante o envio do fechamento para as liderancas regionais.</p>
|
|
90
|
+
</ModalBody>
|
|
91
|
+
<ModalFooter>
|
|
92
|
+
<ModalClose>Entendi</ModalClose>
|
|
93
|
+
</ModalFooter>
|
|
94
|
+
</ModalContent>
|
|
95
|
+
</Modal>
|
|
96
|
+
),
|
|
97
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cn } from "@/utils/cn"
|
|
2
|
+
import styles from './totalizador.module.css'
|
|
3
|
+
|
|
4
|
+
interface TotalizadorProps {
|
|
5
|
+
className?: string,
|
|
6
|
+
title: string
|
|
7
|
+
subtitle: string
|
|
8
|
+
description: string
|
|
9
|
+
variant?: 'success' | 'warning' | 'danger' | 'info' | 'details'
|
|
10
|
+
selected?: boolean
|
|
11
|
+
loading?: boolean
|
|
12
|
+
onClick?: () => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function Totalizador({
|
|
16
|
+
className,
|
|
17
|
+
title,
|
|
18
|
+
subtitle,
|
|
19
|
+
description,
|
|
20
|
+
variant = 'success',
|
|
21
|
+
selected = false,
|
|
22
|
+
loading = false,
|
|
23
|
+
onClick,
|
|
24
|
+
}: TotalizadorProps) {
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
onClick={onClick}
|
|
28
|
+
className={cn(styles.totalizador, styles[variant], className)}
|
|
29
|
+
title={description}
|
|
30
|
+
>
|
|
31
|
+
<span>{title}</span>
|
|
32
|
+
{loading && <div>Carregando...</div>}
|
|
33
|
+
{!loading && <strong className={selected ? styles.selected : ''}>{subtitle}</strong>}
|
|
34
|
+
</div>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
.totalizador {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 60px;
|
|
4
|
+
border-radius: 12px;
|
|
5
|
+
border: 1px solid var(--border);
|
|
6
|
+
display: flex;
|
|
7
|
+
box-shadow: var(--box-shadow);
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
align-items: center;
|
|
10
|
+
background-color: var(--background-totalizador);
|
|
11
|
+
border-left: 12px solid var(--color-success-totalizador);
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
transition: all 0.3s ease-in-out !important;
|
|
14
|
+
color: var(--font-color);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.totalizador:hover {
|
|
18
|
+
box-shadow: none;
|
|
19
|
+
transform: scale(1.02);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.totalizador span {
|
|
23
|
+
font-size: 13px;
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
margin: 5px 0 2px 0;
|
|
26
|
+
color: var(--font-color);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.totalizador strong {
|
|
30
|
+
font-size: 19px;
|
|
31
|
+
font-weight: 600;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.selected {
|
|
35
|
+
text-align: center;
|
|
36
|
+
border-radius: 8px;
|
|
37
|
+
color: white;
|
|
38
|
+
min-width: 140px;
|
|
39
|
+
height: 26px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.success {
|
|
43
|
+
border-left-color: var(--color-success-totalizador);
|
|
44
|
+
color: var(--color-success-totalizador);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.success .selected {
|
|
48
|
+
background-color: var(--color-success-totalizador);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.warning {
|
|
52
|
+
border-left-color: var(--color-warning-totalizador);
|
|
53
|
+
color: var(--color-warning-totalizador);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.warning .selected {
|
|
57
|
+
background-color: var(--color-warning-totalizador);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.danger {
|
|
61
|
+
border-left-color: var(--color-danger-totalizador);
|
|
62
|
+
color: var(--color-danger-totalizador);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.danger .selected {
|
|
66
|
+
background-color: var(--color-danger-totalizador);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.info {
|
|
70
|
+
border-left-color: var(--color-info-totalizador);
|
|
71
|
+
color: var(--color-info-totalizador);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.info .selected {
|
|
75
|
+
background-color: var(--color-info-totalizador);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.details {
|
|
79
|
+
border-left-color: var(--color-details-totalizador);
|
|
80
|
+
color: var(--color-details-totalizador);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.details .selected {
|
|
84
|
+
background-color: var(--color-details-totalizador);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.loading {
|
|
88
|
+
width: 100%;
|
|
89
|
+
padding: 0 40px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.skeleton {
|
|
93
|
+
width: 200px;
|
|
94
|
+
margin: 5px;
|
|
95
|
+
border-radius: 10px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.minWidth {
|
|
99
|
+
min-width: 340px;
|
|
100
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Totalizador } from '.';
|
|
3
|
+
import styles from './totalizador.module.css';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/Totalizador',
|
|
7
|
+
component: Totalizador,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
} satisfies Meta<typeof Totalizador>;
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
export const Default: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
title: 'Total Geral',
|
|
20
|
+
subtitle: '10',
|
|
21
|
+
description: 'Total geral de vendas',
|
|
22
|
+
className: styles.minWidth,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Success: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
title: 'Totalizador de Sucesso',
|
|
29
|
+
subtitle: '10',
|
|
30
|
+
description: 'Total de sucesso',
|
|
31
|
+
variant: 'success',
|
|
32
|
+
className: styles.minWidth,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Warning: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
title: 'Totalizador de Aviso',
|
|
39
|
+
subtitle: '10',
|
|
40
|
+
description: 'Total de avisos',
|
|
41
|
+
variant: 'warning',
|
|
42
|
+
className: styles.minWidth,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Danger: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
title: 'Totalizador de Erro',
|
|
49
|
+
subtitle: '10',
|
|
50
|
+
description: 'Total de erros',
|
|
51
|
+
variant: 'danger',
|
|
52
|
+
className: styles.minWidth,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const Info: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
title: 'Totalizador de Informação',
|
|
59
|
+
subtitle: '10',
|
|
60
|
+
description: 'Total de informações',
|
|
61
|
+
variant: 'info',
|
|
62
|
+
className: styles.minWidth,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const Details: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
title: 'Totalizador de Detalhes',
|
|
69
|
+
subtitle: '10',
|
|
70
|
+
description: 'Total de detalhes',
|
|
71
|
+
variant: 'details',
|
|
72
|
+
className: styles.minWidth,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const Selected: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
title: 'Totalizador Selecionado',
|
|
79
|
+
subtitle: '10',
|
|
80
|
+
description: 'Total selecionado',
|
|
81
|
+
selected: true,
|
|
82
|
+
variant: 'danger',
|
|
83
|
+
className: styles.minWidth,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const Loading: Story = {
|
|
88
|
+
args: {
|
|
89
|
+
title: 'Totalizador Carregando',
|
|
90
|
+
subtitle: '---',
|
|
91
|
+
description: 'Carregando dados',
|
|
92
|
+
loading: true,
|
|
93
|
+
variant: 'info',
|
|
94
|
+
className: styles.minWidth,
|
|
95
|
+
},
|
|
96
|
+
};
|
package/src/utils/cn.tsx
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"types": ["vite/client"],
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
|
|
11
|
+
/* Bundler mode */
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"moduleDetection": "force",
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
|
|
19
|
+
/* Linting */
|
|
20
|
+
"strict": true,
|
|
21
|
+
"noUnusedLocals": true,
|
|
22
|
+
"noUnusedParameters": true,
|
|
23
|
+
"erasableSyntaxOnly": true,
|
|
24
|
+
"noFallthroughCasesInSwitch": true,
|
|
25
|
+
"noUncheckedSideEffectImports": true,
|
|
26
|
+
|
|
27
|
+
/* alias */
|
|
28
|
+
"baseUrl": ".",
|
|
29
|
+
"paths": {
|
|
30
|
+
"@/*": ["src/*"]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"include": ["src"]
|
|
34
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"erasableSyntaxOnly": true,
|
|
22
|
+
"noFallthroughCasesInSwitch": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true
|
|
24
|
+
},
|
|
25
|
+
"include": ["vite.config.ts"]
|
|
26
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference types="vitest/config" />
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import react from '@vitejs/plugin-react';
|
|
4
|
+
|
|
5
|
+
// https://vite.dev/config/
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
9
|
+
import { playwright } from '@vitest/browser-playwright';
|
|
10
|
+
const dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
|
|
12
|
+
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
plugins: [react()],
|
|
15
|
+
resolve: {
|
|
16
|
+
alias: {
|
|
17
|
+
'@': path.resolve(__dirname, 'src'),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
build: {
|
|
21
|
+
lib: {
|
|
22
|
+
entry: path.resolve(__dirname, 'src/index.ts'),
|
|
23
|
+
name: 'DesignSystemAgroe',
|
|
24
|
+
fileName: 'index',
|
|
25
|
+
formats: ['es', 'cjs']
|
|
26
|
+
},
|
|
27
|
+
rollupOptions: {
|
|
28
|
+
external: ['react', 'react-dom']
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
test: {
|
|
32
|
+
projects: [{
|
|
33
|
+
extends: true,
|
|
34
|
+
plugins: [
|
|
35
|
+
// The plugin will run tests for the stories defined in your Storybook config
|
|
36
|
+
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
37
|
+
storybookTest({
|
|
38
|
+
configDir: path.join(dirname, '.storybook')
|
|
39
|
+
})],
|
|
40
|
+
test: {
|
|
41
|
+
name: 'storybook',
|
|
42
|
+
browser: {
|
|
43
|
+
enabled: true,
|
|
44
|
+
headless: true,
|
|
45
|
+
provider: playwright({}),
|
|
46
|
+
instances: [{
|
|
47
|
+
browser: 'chromium'
|
|
48
|
+
}]
|
|
49
|
+
},
|
|
50
|
+
setupFiles: ['.storybook/vitest.setup.ts']
|
|
51
|
+
}
|
|
52
|
+
}]
|
|
53
|
+
}
|
|
54
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="@vitest/browser-playwright" />
|