mblabs-roccato-frontend-commons 0.1.13 → 0.1.15
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/README.md +130 -0
- package/dist/index.d.ts +11 -1
- package/dist/mblabs-roccato-frontend-commons.css +1 -1
- package/dist/mblabs-roccato-frontend-commons.js +6734 -6704
- package/package.json +1 -1
- package/src/components/atoms/Sonner/sonner.css +14 -0
- package/src/components/atoms/Sonner/sonner.stories.tsx +61 -5
- package/src/components/atoms/Sonner/sonner.tsx +1 -9
- package/src/components/icons/alert-circle.tsx +22 -0
- package/src/components/icons/index.ts +3 -0
- package/src/components/icons/info-circle.tsx +15 -0
- package/src/components/icons/table.tsx +9 -0
- package/src/components/molecules/Drawer/drawer.tsx +9 -9
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useToast.tsx +24 -0
- package/src/index.css +382 -379
package/README.md
CHANGED
|
@@ -71,6 +71,136 @@ import 'mblabs-roccato-frontend-commons/css'; // estilos padrões
|
|
|
71
71
|
|
|
72
72
|
---
|
|
73
73
|
|
|
74
|
+
## 📦 Adicionando novos ícones
|
|
75
|
+
|
|
76
|
+
Para adicionar novos ícones ao projeto, siga este processo passo a passo:
|
|
77
|
+
|
|
78
|
+
### 1. Copiar nome do ícone do Figma
|
|
79
|
+
- Identifique o nome exato do ícone no design do Figma
|
|
80
|
+
- Exemplo: `check-circle`, `info-circle`, `user-01`
|
|
81
|
+
|
|
82
|
+
### 2. Buscar ícone no Untitled UI
|
|
83
|
+
- Acesse [https://www.untitledui.com/free-icons](https://www.untitledui.com/free-icons)
|
|
84
|
+
- Use a barra de pesquisa para encontrar o ícone pelo nome
|
|
85
|
+
- Certifique-se de que é o ícone correto visualmente
|
|
86
|
+
|
|
87
|
+
### 3. Copiar SVG
|
|
88
|
+
- Clique no ícone desejado
|
|
89
|
+
- Copie o código SVG fornecido
|
|
90
|
+
- O SVG deve ter viewBox="0 0 24 24" e ser otimizado
|
|
91
|
+
|
|
92
|
+
### 4. Criar componente reutilizável
|
|
93
|
+
Crie um novo arquivo em `src/components/icons/` seguindo o padrão:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
// src/components/icons/nome-do-icone.tsx
|
|
97
|
+
import { ComponentProps } from 'react';
|
|
98
|
+
|
|
99
|
+
export function NomeDoIcone(props: ComponentProps<'svg'>) {
|
|
100
|
+
return (
|
|
101
|
+
<svg
|
|
102
|
+
width="100%"
|
|
103
|
+
height="100%"
|
|
104
|
+
viewBox="0 0 24 24"
|
|
105
|
+
fill="none"
|
|
106
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
107
|
+
{...props}
|
|
108
|
+
>
|
|
109
|
+
{/* Cole o conteúdo SVG aqui */}
|
|
110
|
+
</svg>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 5. Corrigir propriedades CSS
|
|
116
|
+
Converta propriedades kebab-case para camelCase:
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
// ❌ Incorreto
|
|
120
|
+
stroke-width="2" → strokeWidth="2"
|
|
121
|
+
stroke-linecap="round" → strokeLinecap="round"
|
|
122
|
+
stroke-linejoin="round" → strokeLinejoin="round"
|
|
123
|
+
fill-rule="evenodd" → fillRule="evenodd"
|
|
124
|
+
clip-rule="evenodd" → clipRule="evenodd"
|
|
125
|
+
|
|
126
|
+
// ✅ Correto
|
|
127
|
+
strokeWidth="2"
|
|
128
|
+
strokeLinecap="round"
|
|
129
|
+
strokeLinejoin="round"
|
|
130
|
+
fillRule="evenodd"
|
|
131
|
+
clipRule="evenodd"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 6. Adicionar ao index.ts
|
|
135
|
+
Adicione a exportação no arquivo `src/components/icons/index.ts`:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
// Adicione no final do arquivo, em ordem alfabética
|
|
139
|
+
export * from './nome-do-icone';
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Exemplo Completo
|
|
143
|
+
|
|
144
|
+
**Nome do ícone:** `check-circle`
|
|
145
|
+
|
|
146
|
+
**Arquivo criado:** `src/components/icons/check-circle.tsx`
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import { ComponentProps } from 'react';
|
|
150
|
+
|
|
151
|
+
export function CheckCircle(props: ComponentProps<'svg'>) {
|
|
152
|
+
return (
|
|
153
|
+
<svg
|
|
154
|
+
width="100%"
|
|
155
|
+
height="100%"
|
|
156
|
+
viewBox="0 0 24 24"
|
|
157
|
+
fill="none"
|
|
158
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
159
|
+
{...props}
|
|
160
|
+
>
|
|
161
|
+
<path
|
|
162
|
+
d="M7.5 12L10.5 15L16.5 9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"
|
|
163
|
+
stroke="currentColor"
|
|
164
|
+
strokeWidth="2"
|
|
165
|
+
strokeLinecap="round"
|
|
166
|
+
strokeLinejoin="round"
|
|
167
|
+
/>
|
|
168
|
+
</svg>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Adicionado ao index.ts:**
|
|
174
|
+
```tsx
|
|
175
|
+
export * from './check-circle';
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Boas Práticas
|
|
179
|
+
|
|
180
|
+
- ✅ Use `currentColor` para stroke/fill para permitir customização
|
|
181
|
+
- ✅ Mantenha viewBox="0 0 24 24" para consistência
|
|
182
|
+
- ✅ Use width="100%" height="100%" para responsividade
|
|
183
|
+
- ✅ Nomeie o componente em PascalCase
|
|
184
|
+
- ✅ Nomeie o arquivo em kebab-case
|
|
185
|
+
- ✅ Mantenha ordem alfabética no index.ts
|
|
186
|
+
- ✅ Teste o ícone no Storybook após adicionar
|
|
187
|
+
|
|
188
|
+
### Uso do Ícone
|
|
189
|
+
|
|
190
|
+
Após adicionar, o ícone estará disponível para uso:
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
import { CheckCircle } from '@/components/icons';
|
|
194
|
+
|
|
195
|
+
// Uso básico
|
|
196
|
+
<CheckCircle />
|
|
197
|
+
|
|
198
|
+
// Com customização
|
|
199
|
+
<CheckCircle className="w-6 h-6 text-blue-500" />
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
74
204
|
## 📚 Storybook
|
|
75
205
|
|
|
76
206
|
Explore e teste os componentes interativamente:
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
|
18
18
|
import { Drawer as Drawer_2 } from 'vaul';
|
|
19
19
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
20
20
|
import { ElementType } from 'react';
|
|
21
|
+
import { ExternalToast } from 'sonner';
|
|
21
22
|
import { FieldError } from 'react-hook-form';
|
|
22
23
|
import { FieldPath } from 'react-hook-form';
|
|
23
24
|
import { FieldValues } from 'react-hook-form';
|
|
@@ -69,6 +70,8 @@ export declare function addMonth(date: DateTime, month: number): DateTime;
|
|
|
69
70
|
|
|
70
71
|
export declare function Alert({ className, variant, ...props }: React_2.ComponentProps<'div'> & VariantProps<typeof alertVariants>): JSX.Element;
|
|
71
72
|
|
|
73
|
+
export declare function AlertCircle({ ...props }: ComponentProps<'svg'>): JSX.Element;
|
|
74
|
+
|
|
72
75
|
export declare function AlertDescription({ className, ...props }: React_2.ComponentProps<'div'>): JSX.Element;
|
|
73
76
|
|
|
74
77
|
export declare const AlertDialog: React_2.FC<AlertDialogPrimitive.AlertDialogProps>;
|
|
@@ -783,6 +786,8 @@ export declare interface IconProps {
|
|
|
783
786
|
size?: keyof typeof ICON_SIZES;
|
|
784
787
|
}
|
|
785
788
|
|
|
789
|
+
export declare function InfoCircle(props: ComponentProps<'svg'>): JSX.Element;
|
|
790
|
+
|
|
786
791
|
export declare const Input: ForwardRefExoticComponent<Omit<InputProps, "ref"> & RefAttributes<HTMLInputElement>>;
|
|
787
792
|
|
|
788
793
|
declare const INPUT_SIZE_CLASSES: {
|
|
@@ -1337,7 +1342,7 @@ export declare function stringToNumber(value: string): string;
|
|
|
1337
1342
|
|
|
1338
1343
|
export declare function Switch({ className, ...props }: React_2.ComponentProps<typeof SwitchPrimitive.Root>): JSX.Element;
|
|
1339
1344
|
|
|
1340
|
-
export declare function Table(
|
|
1345
|
+
export declare function Table(props: ComponentProps<'svg'>): JSX.Element;
|
|
1341
1346
|
|
|
1342
1347
|
export declare function TableBody({ className, ...props }: React_2.ComponentProps<'tbody'>): JSX.Element;
|
|
1343
1348
|
|
|
@@ -1457,6 +1462,11 @@ export declare function useScreenSize(): ScreenSizes;
|
|
|
1457
1462
|
|
|
1458
1463
|
export declare function useSidebar(): SidebarContextProps;
|
|
1459
1464
|
|
|
1465
|
+
export declare const useToast: () => {
|
|
1466
|
+
success: (message: string, options?: ExternalToast) => void;
|
|
1467
|
+
error: (message: string, options?: ExternalToast) => void;
|
|
1468
|
+
};
|
|
1469
|
+
|
|
1460
1470
|
declare interface UseToggleReturn {
|
|
1461
1471
|
/** Current boolean state */
|
|
1462
1472
|
state: boolean;
|