@datametria/vue-components 1.1.1

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.
Files changed (44) hide show
  1. package/ACCESSIBILITY.md +78 -0
  2. package/DESIGN-SYSTEM.md +70 -0
  3. package/LICENSE +21 -0
  4. package/PROGRESS.md +327 -0
  5. package/README.md +473 -0
  6. package/dist/index.es.js +1405 -0
  7. package/dist/index.umd.js +1 -0
  8. package/dist/vue-components.css +1 -0
  9. package/package.json +98 -0
  10. package/src/components/DatametriaAlert.vue +123 -0
  11. package/src/components/DatametriaAutocomplete.vue +292 -0
  12. package/src/components/DatametriaAvatar.vue +99 -0
  13. package/src/components/DatametriaBadge.vue +90 -0
  14. package/src/components/DatametriaBreadcrumb.vue +144 -0
  15. package/src/components/DatametriaButton.vue +157 -0
  16. package/src/components/DatametriaCard.vue +72 -0
  17. package/src/components/DatametriaCheckbox.vue +82 -0
  18. package/src/components/DatametriaChip.vue +149 -0
  19. package/src/components/DatametriaContainer.vue +57 -0
  20. package/src/components/DatametriaDatePicker.vue +140 -0
  21. package/src/components/DatametriaDivider.vue +100 -0
  22. package/src/components/DatametriaFileUpload.vue +268 -0
  23. package/src/components/DatametriaGrid.vue +44 -0
  24. package/src/components/DatametriaInput.vue +102 -0
  25. package/src/components/DatametriaModal.vue +135 -0
  26. package/src/components/DatametriaNavbar.vue +227 -0
  27. package/src/components/DatametriaProgress.vue +113 -0
  28. package/src/components/DatametriaRadio.vue +138 -0
  29. package/src/components/DatametriaSelect.vue +112 -0
  30. package/src/components/DatametriaSpinner.vue +112 -0
  31. package/src/components/DatametriaSwitch.vue +137 -0
  32. package/src/components/DatametriaTable.vue +105 -0
  33. package/src/components/DatametriaTabs.vue +180 -0
  34. package/src/components/DatametriaTextarea.vue +159 -0
  35. package/src/components/DatametriaToast.vue +163 -0
  36. package/src/composables/useAPI.ts +78 -0
  37. package/src/composables/useClipboard.ts +42 -0
  38. package/src/composables/useDebounce.ts +16 -0
  39. package/src/composables/useLocalStorage.ts +26 -0
  40. package/src/composables/useTheme.ts +66 -0
  41. package/src/composables/useValidation.ts +39 -0
  42. package/src/index.ts +52 -0
  43. package/src/styles/design-tokens.css +31 -0
  44. package/src/types/index.ts +34 -0
package/README.md ADDED
@@ -0,0 +1,473 @@
1
+ # @datametria/vue-components
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@datametria/vue-components.svg)](https://www.npmjs.com/package/@datametria/vue-components)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@datametria/vue-components.svg)](https://www.npmjs.com/package/@datametria/vue-components)
5
+ [![License](https://img.shields.io/npm/l/@datametria/vue-components)](https://github.com/datametria/DATAMETRIA-common-libraries/blob/main/LICENSE)
6
+ [![Coverage](https://img.shields.io/badge/coverage-95.28%25-brightgreen)](./PROGRESS.md)
7
+ [![Tests](https://img.shields.io/badge/tests-175%20passing-brightgreen)](./PROGRESS.md)
8
+
9
+ > Biblioteca enterprise de componentes Vue.js 3 com Design System DATAMETRIA, acessibilidade WCAG 2.1 AA e 95.28% de cobertura de testes.
10
+
11
+ ## ✨ Features
12
+
13
+ - 🎨 **26 Componentes** prontos para produção
14
+ - 🧩 **6 Composables** reutilizáveis
15
+ - ♿ **WCAG 2.1 AA** - Acessibilidade completa
16
+ - 📱 **Mobile-first** - Responsivo em todos os dispositivos
17
+ - 🌙 **Dark Mode** - Suporte nativo
18
+ - 🎯 **TypeScript** - 100% tipado
19
+ - ✅ **95.28% Coverage** - 175 testes passando
20
+ - 🎨 **Design System** - Tokens CSS integrados
21
+
22
+ ## 📦 Instalação
23
+
24
+ ```bash
25
+ # npm
26
+ npm install @datametria/vue-components
27
+
28
+ # yarn
29
+ yarn add @datametria/vue-components
30
+
31
+ # pnpm
32
+ pnpm add @datametria/vue-components
33
+ ```
34
+
35
+ ## 🚀 Uso Rápido
36
+
37
+ ### Importação Global
38
+
39
+ ```typescript
40
+ // main.ts
41
+ import { createApp } from 'vue'
42
+ import DatametriaComponents from '@datametria/vue-components'
43
+ import '@datametria/vue-components/style.css'
44
+
45
+ const app = createApp(App)
46
+ app.use(DatametriaComponents)
47
+ app.mount('#app')
48
+ ```
49
+
50
+ ### Importação Individual (Recomendado)
51
+
52
+ ```vue
53
+ <script setup lang="ts">
54
+ import { DatametriaButton, DatametriaInput } from '@datametria/vue-components'
55
+ import '@datametria/vue-components/style.css'
56
+ import { ref } from 'vue'
57
+
58
+ const email = ref('')
59
+ const password = ref('')
60
+
61
+ const handleLogin = () => {
62
+ console.log('Login:', email.value, password.value)
63
+ }
64
+ </script>
65
+
66
+ <template>
67
+ <div class="login-form">
68
+ <DatametriaInput
69
+ v-model="email"
70
+ label="Email"
71
+ type="email"
72
+ placeholder="seu@email.com"
73
+ />
74
+ <DatametriaInput
75
+ v-model="password"
76
+ label="Senha"
77
+ type="password"
78
+ />
79
+ <DatametriaButton
80
+ variant="primary"
81
+ @click="handleLogin"
82
+ >
83
+ Entrar
84
+ </DatametriaButton>
85
+ </div>
86
+ </template>
87
+ ```
88
+
89
+ ## 🎨 Componentes (26/56)
90
+
91
+ ### 🔘 Form Components (10)
92
+
93
+ ```vue
94
+ <!-- Button com 4 variants e 3 sizes -->
95
+ <DatametriaButton variant="primary" size="md" :loading="false">
96
+ Clique aqui
97
+ </DatametriaButton>
98
+
99
+ <!-- Input com validação -->
100
+ <DatametriaInput
101
+ v-model="value"
102
+ label="Nome"
103
+ :error="errorMessage"
104
+ required
105
+ />
106
+
107
+ <!-- Select com options -->
108
+ <DatametriaSelect
109
+ v-model="selected"
110
+ :options="options"
111
+ placeholder="Selecione..."
112
+ />
113
+
114
+ <!-- Checkbox -->
115
+ <DatametriaCheckbox v-model="checked" label="Aceito os termos" />
116
+
117
+ <!-- Radio -->
118
+ <DatametriaRadio v-model="selected" value="option1" label="Opção 1" />
119
+
120
+ <!-- Switch -->
121
+ <DatametriaSwitch v-model="enabled" label="Ativar notificações" />
122
+
123
+ <!-- Textarea -->
124
+ <DatametriaTextarea v-model="text" label="Mensagem" :maxlength="500" />
125
+
126
+ <!-- DatePicker -->
127
+ <DatametriaDatePicker v-model="date" label="Data" />
128
+
129
+ <!-- FileUpload -->
130
+ <DatametriaFileUpload v-model="files" :multiple="true" />
131
+
132
+ <!-- Autocomplete -->
133
+ <DatametriaAutocomplete
134
+ v-model="selected"
135
+ :options="options"
136
+ placeholder="Buscar..."
137
+ />
138
+ ```
139
+
140
+ ### 📦 Layout Components (5)
141
+
142
+ ```vue
143
+ <!-- Card com slots -->
144
+ <DatametriaCard title="Título" subtitle="Subtítulo">
145
+ <template #header>Header customizado</template>
146
+ Conteúdo do card
147
+ <template #footer>Footer customizado</template>
148
+ </DatametriaCard>
149
+
150
+ <!-- Modal com teleport -->
151
+ <DatametriaModal v-model="isOpen" title="Modal" size="md">
152
+ Conteúdo do modal
153
+ </DatametriaModal>
154
+
155
+ <!-- Container responsivo -->
156
+ <DatametriaContainer size="lg" :fluid="false">
157
+ Conteúdo
158
+ </DatametriaContainer>
159
+
160
+ <!-- Grid responsivo -->
161
+ <DatametriaGrid :cols="3" :gap="4">
162
+ <div>Item 1</div>
163
+ <div>Item 2</div>
164
+ <div>Item 3</div>
165
+ </DatametriaGrid>
166
+
167
+ <!-- Divider -->
168
+ <DatametriaDivider orientation="horizontal" :dashed="false" />
169
+ ```
170
+
171
+ ### 🔔 Feedback Components (4)
172
+
173
+ ```vue
174
+ <!-- Alert -->
175
+ <DatametriaAlert variant="success" :closable="true">
176
+ Operação realizada com sucesso!
177
+ </DatametriaAlert>
178
+
179
+ <!-- Toast -->
180
+ <DatametriaToast
181
+ v-model="showToast"
182
+ variant="info"
183
+ :duration="3000"
184
+ >
185
+ Notificação
186
+ </DatametriaToast>
187
+
188
+ <!-- Progress -->
189
+ <DatametriaProgress :value="75" variant="primary" />
190
+
191
+ <!-- Spinner -->
192
+ <DatametriaSpinner size="md" variant="primary" />
193
+ ```
194
+
195
+ ### 📊 Data Display (4)
196
+
197
+ ```vue
198
+ <!-- Table -->
199
+ <DatametriaTable :columns="columns" :data="data" />
200
+
201
+ <!-- Avatar -->
202
+ <DatametriaAvatar
203
+ src="/avatar.jpg"
204
+ alt="User"
205
+ size="md"
206
+ :rounded="true"
207
+ />
208
+
209
+ <!-- Badge -->
210
+ <DatametriaBadge variant="success" size="md">
211
+ Novo
212
+ </DatametriaBadge>
213
+
214
+ <!-- Chip -->
215
+ <DatametriaChip
216
+ variant="primary"
217
+ :closable="true"
218
+ @close="handleClose"
219
+ >
220
+ Tag
221
+ </DatametriaChip>
222
+ ```
223
+
224
+ ### 🧭 Navigation (3)
225
+
226
+ ```vue
227
+ <!-- Navbar -->
228
+ <DatametriaNavbar variant="primary" :sticky="true">
229
+ <template #brand>Logo</template>
230
+ <template #menu>Menu</template>
231
+ <template #actions>Actions</template>
232
+ </DatametriaNavbar>
233
+
234
+ <!-- Breadcrumb -->
235
+ <DatametriaBreadcrumb :items="breadcrumbs" separator="/" />
236
+
237
+ <!-- Tabs -->
238
+ <DatametriaTabs v-model="activeTab" :tabs="tabs" />
239
+ ```
240
+
241
+ ## 🧩 Composables (6/8)
242
+
243
+ ### useTheme - Dark Mode
244
+
245
+ ```typescript
246
+ import { useTheme } from '@datametria/vue-components'
247
+
248
+ const { isDark, toggle, setDark, setLight } = useTheme()
249
+
250
+ // Toggle dark mode
251
+ toggle()
252
+
253
+ // Set específico
254
+ setDark()
255
+ setLight()
256
+
257
+ // Verifica estado
258
+ console.log(isDark.value) // true/false
259
+ ```
260
+
261
+ ### useValidation - Validators
262
+
263
+ ```typescript
264
+ import { useValidation } from '@datametria/vue-components'
265
+
266
+ const { required, email, minLength, maxLength, pattern, custom } = useValidation()
267
+
268
+ // Validar campo
269
+ const isValid = required(value) // boolean
270
+ const isEmail = email('test@example.com') // boolean
271
+ const isMin = minLength(5)('texto') // boolean
272
+ ```
273
+
274
+ ### useAPI - HTTP Client
275
+
276
+ ```typescript
277
+ import { useAPI } from '@datametria/vue-components'
278
+
279
+ const { get, post, put, delete: del, loading, error, data } = useAPI()
280
+
281
+ // GET request
282
+ await get('/api/users')
283
+ console.log(data.value) // Response data
284
+
285
+ // POST request
286
+ await post('/api/users', { name: 'John' })
287
+
288
+ // Loading state
289
+ console.log(loading.value) // true/false
290
+
291
+ // Error handling
292
+ if (error.value) {
293
+ console.error(error.value)
294
+ }
295
+ ```
296
+
297
+ ### useLocalStorage - Sync Storage
298
+
299
+ ```typescript
300
+ import { useLocalStorage } from '@datametria/vue-components'
301
+
302
+ const user = useLocalStorage('user', { name: 'Default' })
303
+
304
+ // Auto-sync com localStorage
305
+ user.value = { name: 'John' }
306
+ // localStorage.setItem('user', '{"name":"John"}')
307
+
308
+ console.log(user.value) // { name: 'John' }
309
+ ```
310
+
311
+ ### useDebounce - Delay Input
312
+
313
+ ```typescript
314
+ import { useDebounce } from '@datametria/vue-components'
315
+ import { ref } from 'vue'
316
+
317
+ const search = ref('')
318
+ const debouncedSearch = useDebounce(search, 300)
319
+
320
+ // search muda imediatamente
321
+ // debouncedSearch muda após 300ms
322
+ watch(debouncedSearch, (value) => {
323
+ console.log('Buscar:', value)
324
+ })
325
+ ```
326
+
327
+ ### useClipboard - Copy/Paste
328
+
329
+ ```typescript
330
+ import { useClipboard } from '@datametria/vue-components'
331
+
332
+ const { copy, read, copied, error } = useClipboard()
333
+
334
+ // Copiar texto
335
+ await copy('Texto para copiar')
336
+ console.log(copied.value) // true (auto-reset após 2s)
337
+
338
+ // Ler clipboard
339
+ const text = await read()
340
+ console.log(text)
341
+ ```
342
+
343
+ ## 🎨 Design System
344
+
345
+ ### Brand Colors
346
+
347
+ ```css
348
+ /* Primary */
349
+ --dm-primary: #0072CE; /* Azul DATAMETRIA */
350
+ --dm-primary-dark: #005ba3;
351
+ --dm-primary-light: #3399ff;
352
+
353
+ /* Secondary */
354
+ --dm-secondary: #4B0078; /* Roxo DATAMETRIA */
355
+ --dm-secondary-dark: #3a005c;
356
+ --dm-secondary-light: #6b00a8;
357
+
358
+ /* Semantic Colors */
359
+ --dm-success: #10b981;
360
+ --dm-warning: #f59e0b;
361
+ --dm-error: #ef4444;
362
+ --dm-info: #3b82f6;
363
+ ```
364
+
365
+ ### Spacing System
366
+
367
+ ```css
368
+ --dm-space-1: 0.25rem; /* 4px */
369
+ --dm-space-2: 0.5rem; /* 8px */
370
+ --dm-space-3: 0.75rem; /* 12px */
371
+ --dm-space-4: 1rem; /* 16px */
372
+ --dm-space-6: 1.5rem; /* 24px */
373
+ --dm-space-8: 2rem; /* 32px */
374
+ ```
375
+
376
+ ### Typography
377
+
378
+ ```css
379
+ --dm-text-xs: 0.75rem; /* 12px */
380
+ --dm-text-sm: 0.875rem; /* 14px */
381
+ --dm-text-base: 1rem; /* 16px */
382
+ --dm-text-lg: 1.125rem; /* 18px */
383
+ --dm-text-xl: 1.25rem; /* 20px */
384
+ --dm-text-2xl: 1.5rem; /* 24px */
385
+ ```
386
+
387
+ ### Features
388
+
389
+ - ✅ **Design Tokens** - CSS Custom Properties
390
+ - ✅ **WCAG 2.1 AA** - Contraste 4.5:1 mínimo
391
+ - ✅ **Mobile-first** - Breakpoints responsivos
392
+ - ✅ **Dark Mode** - Suporte nativo com useTheme
393
+ - ✅ **TypeScript** - 100% tipado
394
+ - ✅ **Tree-shaking** - Import apenas o necessário
395
+
396
+ ## 📊 Status do Projeto
397
+
398
+ | Categoria | Implementado | Total | Progresso |
399
+ |-----------|--------------|-------|-----------|
400
+ | **Componentes** | 26 | 56 | 46% 🟡 |
401
+ | **Composables** | 6 | 8 | 75% 🟡 |
402
+ | **Testes** | 175 | 175 | 100% ✅ |
403
+ | **Coverage** | 95.28% | 95% | 100% ✅ |
404
+ | **Design System** | 100% | 100% | 100% ✅ |
405
+ | **Acessibilidade** | 100% | 100% | 100% ✅ |
406
+ | **Documentação** | 40% | 100% | 40% 🟡 |
407
+
408
+ ### Métricas de Qualidade
409
+
410
+ - ✅ **175/175 testes passando** (100%)
411
+ - ✅ **95.28% coverage** (statements)
412
+ - ✅ **77.6% branches** | **76.38% functions**
413
+ - ✅ **Composables: 100% coverage**
414
+ - ✅ **Componentes: 94.09% coverage**
415
+
416
+ Veja [PROGRESS.md](./PROGRESS.md) para detalhes completos.
417
+
418
+ ## 📚 Documentação Completa
419
+
420
+ - 📖 [README.md](./README.md) - Este arquivo
421
+ - ♿ [ACCESSIBILITY.md](./ACCESSIBILITY.md) - Guia WCAG 2.1 AA
422
+ - 🎨 [DESIGN-SYSTEM.md](./DESIGN-SYSTEM.md) - Design tokens e uso
423
+ - 📊 [PROGRESS.md](./PROGRESS.md) - Status de implementação
424
+ - 🎓 [LESSONS-LEARNED.md](./LESSONS-LEARNED.md) - Lições aprendidas
425
+ - 📦 [PUBLISHING.md](./PUBLISHING.md) - Guia de publicação NPM
426
+
427
+ ## 🤝 Contribuindo
428
+
429
+ Contribuições são bem-vindas! Por favor:
430
+
431
+ 1. Fork o repositório
432
+ 2. Crie uma branch: `git checkout -b feature/nova-feature`
433
+ 3. Commit suas mudanças: `git commit -m 'feat: adiciona nova feature'`
434
+ 4. Push para a branch: `git push origin feature/nova-feature`
435
+ 5. Abra um Pull Request
436
+
437
+ ### Desenvolvimento Local
438
+
439
+ ```bash
440
+ # Clone o repositório
441
+ git clone https://github.com/datametria/DATAMETRIA-common-libraries.git
442
+ cd DATAMETRIA-common-libraries/packages/vue-components
443
+
444
+ # Instale dependências
445
+ npm install
446
+
447
+ # Rode testes
448
+ npm test
449
+
450
+ # Build
451
+ npm run build
452
+ ```
453
+
454
+ ## 📄 Licença
455
+
456
+ MIT © 2025 DATAMETRIA
457
+
458
+ ## 👥 Equipe
459
+
460
+ - **Vander Loto** - CTO DATAMETRIA
461
+ - **Marcelo Loto** - Tech Lead
462
+ - **Dalila Rodrigues** - Senior Developer
463
+
464
+ ## 🔗 Links
465
+
466
+ - 📦 [NPM Package](https://www.npmjs.com/package/@datametria/vue-components)
467
+ - 🐙 [GitHub Repository](https://github.com/datametria/DATAMETRIA-common-libraries)
468
+ - 🌐 [DATAMETRIA Website](https://datametria.io)
469
+ - 💬 [Discord Community](https://discord.gg/kKYGmCC3)
470
+
471
+ ---
472
+
473
+ **Desenvolvido com ❤️ pela equipe DATAMETRIA**