@datametria/vue-components 1.1.3 → 2.0.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.
- package/README.md +548 -590
- package/dist/index.es.js +2460 -1440
- package/dist/index.umd.js +10 -10
- package/dist/vue-components.css +1 -1
- package/package.json +102 -98
- package/src/components/DatametriaAlert.vue +38 -24
- package/src/components/DatametriaAutocomplete.vue +184 -138
- package/src/components/DatametriaAvatar.vue +177 -33
- package/src/components/DatametriaBadge.vue +31 -23
- package/src/components/DatametriaBreadcrumb.vue +21 -21
- package/src/components/DatametriaButton.vue +38 -18
- package/src/components/DatametriaCard.vue +12 -12
- package/src/components/DatametriaCheckbox.vue +8 -8
- package/src/components/DatametriaChip.vue +29 -33
- package/src/components/DatametriaContainer.vue +4 -4
- package/src/components/DatametriaDatePicker.vue +686 -68
- package/src/components/DatametriaDivider.vue +13 -13
- package/src/components/DatametriaFileUpload.vue +272 -140
- package/src/components/DatametriaGrid.vue +3 -3
- package/src/components/DatametriaInput.vue +15 -15
- package/src/components/DatametriaMenu.vue +604 -619
- package/src/components/DatametriaModal.vue +16 -16
- package/src/components/DatametriaNavbar.vue +57 -54
- package/src/components/DatametriaPasswordInput.vue +430 -0
- package/src/components/DatametriaProgress.vue +18 -18
- package/src/components/DatametriaRadio.vue +20 -20
- package/src/components/DatametriaSelect.vue +15 -15
- package/src/components/DatametriaSkeleton.vue +243 -239
- package/src/components/DatametriaSlider.vue +395 -407
- package/src/components/DatametriaSortableTable.vue +585 -0
- package/src/components/DatametriaSpinner.vue +7 -7
- package/src/components/DatametriaSwitch.vue +16 -16
- package/src/components/DatametriaTable.vue +14 -14
- package/src/components/DatametriaTextarea.vue +28 -28
- package/src/components/DatametriaTimePicker.vue +285 -285
- package/src/components/DatametriaToast.vue +32 -19
- package/src/components/DatametriaTooltip.vue +408 -408
- package/src/components/__tests__/DatametriaAlert.test.js +36 -0
- package/src/components/__tests__/DatametriaAlert.test.ts +190 -0
- package/src/components/__tests__/DatametriaAutocomplete.test.ts +180 -0
- package/src/components/__tests__/DatametriaAvatar.test.ts +152 -0
- package/src/components/__tests__/DatametriaBadge.test.js +30 -0
- package/src/components/__tests__/DatametriaBadge.test.ts +167 -0
- package/src/components/__tests__/DatametriaBreadcrumb.test.ts +75 -0
- package/src/components/__tests__/DatametriaButton.test.js +31 -0
- package/src/components/__tests__/DatametriaButton.test.ts +283 -0
- package/src/components/__tests__/DatametriaCard.test.ts +201 -0
- package/src/components/__tests__/DatametriaCheckbox.test.ts +47 -0
- package/src/components/__tests__/DatametriaChip.test.js +39 -0
- package/src/components/__tests__/DatametriaContainer.test.ts +52 -0
- package/src/components/__tests__/DatametriaDatePicker.test.ts +234 -0
- package/src/components/__tests__/DatametriaDivider.test.ts +54 -0
- package/src/components/__tests__/DatametriaFileUpload.test.ts +291 -0
- package/src/components/__tests__/DatametriaGrid.test.ts +31 -0
- package/src/components/__tests__/DatametriaInput.test.ts +72 -0
- package/src/components/__tests__/DatametriaMenu.test.ts +366 -0
- package/src/components/__tests__/DatametriaModal.test.ts +86 -0
- package/src/components/__tests__/DatametriaNavbar.test.js +49 -0
- package/src/components/__tests__/DatametriaNavbar.test.ts +203 -0
- package/src/components/__tests__/DatametriaPasswordInput.test.js +305 -0
- package/src/components/__tests__/DatametriaProgress.test.ts +90 -0
- package/src/components/__tests__/DatametriaRadio.test.ts +77 -0
- package/src/components/__tests__/DatametriaSelect.test.ts +77 -0
- package/src/components/__tests__/DatametriaSlider.test.ts +261 -0
- package/src/components/__tests__/DatametriaSortableTable.test.js +168 -0
- package/src/components/__tests__/DatametriaSpinner.test.ts +156 -0
- package/src/components/__tests__/DatametriaSwitch.test.ts +64 -0
- package/src/components/__tests__/DatametriaTable.test.ts +97 -0
- package/src/components/__tests__/DatametriaTextarea.test.ts +66 -0
- package/src/components/__tests__/DatametriaToast.test.js +49 -0
- package/src/components/__tests__/DatametriaToast.test.ts +99 -0
- package/src/composables/useAccessibilityScale.ts +94 -94
- package/src/composables/useBreakpoints.ts +82 -82
- package/src/composables/useHapticFeedback.ts +439 -439
- package/src/composables/useRipple.ts +218 -218
- package/src/index.ts +68 -61
- package/src/stories/Variants.stories.js +96 -0
- package/src/styles/design-tokens.css +623 -623
- package/src/theme/ThemeProvider.vue +96 -0
- package/src/theme/__tests__/ThemeProvider.test.ts +208 -0
- package/src/theme/__tests__/constants.test.ts +31 -0
- package/src/theme/__tests__/presets.test.ts +166 -0
- package/src/theme/__tests__/tokens.test.ts +155 -0
- package/src/theme/__tests__/types.test.ts +153 -0
- package/src/theme/__tests__/useTheme.test.ts +146 -0
- package/src/theme/constants.ts +14 -0
- package/src/theme/index.ts +12 -0
- package/src/theme/presets/datametria.ts +94 -0
- package/src/theme/presets/default.ts +94 -0
- package/src/theme/presets/index.ts +8 -0
- package/src/theme/tokens/colors.ts +28 -0
- package/src/theme/tokens/index.ts +47 -0
- package/src/theme/tokens/spacing.ts +21 -0
- package/src/theme/tokens/typography.ts +35 -0
- package/src/theme/types.ts +111 -0
- package/src/theme/useTheme.ts +28 -0
- package/src/types/index.ts +19 -0
|
@@ -1,219 +1,219 @@
|
|
|
1
|
-
import { ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
|
|
3
|
-
interface RippleOptions {
|
|
4
|
-
color?: string
|
|
5
|
-
duration?: number
|
|
6
|
-
disabled?: boolean
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface RippleEffect {
|
|
10
|
-
x: number
|
|
11
|
-
y: number
|
|
12
|
-
size: number
|
|
13
|
-
id: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Composable para efeito ripple em elementos clicáveis
|
|
18
|
-
* Implementa Material Design ripple effect com acessibilidade
|
|
19
|
-
*/
|
|
20
|
-
export function useRipple(options: RippleOptions = {}) {
|
|
21
|
-
const {
|
|
22
|
-
color = 'rgba(255, 255, 255, 0.3)',
|
|
23
|
-
duration = 600,
|
|
24
|
-
disabled = false
|
|
25
|
-
} = options
|
|
26
|
-
|
|
27
|
-
const elementRef = ref<HTMLElement>()
|
|
28
|
-
const ripples = ref<RippleEffect[]>([])
|
|
29
|
-
|
|
30
|
-
// Criar elemento ripple DOM
|
|
31
|
-
const createRipple = (event: MouseEvent | TouchEvent) => {
|
|
32
|
-
if (disabled || !elementRef.value) return
|
|
33
|
-
|
|
34
|
-
const element = elementRef.value
|
|
35
|
-
const rect = element.getBoundingClientRect()
|
|
36
|
-
|
|
37
|
-
// Calcular posição do clique
|
|
38
|
-
let clientX: number, clientY: number
|
|
39
|
-
|
|
40
|
-
if (event instanceof MouseEvent) {
|
|
41
|
-
clientX = event.clientX
|
|
42
|
-
clientY = event.clientY
|
|
43
|
-
} else {
|
|
44
|
-
const touch = event.touches[0] || event.changedTouches[0]
|
|
45
|
-
clientX = touch.clientX
|
|
46
|
-
clientY = touch.clientY
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const x = clientX - rect.left
|
|
50
|
-
const y = clientY - rect.top
|
|
51
|
-
|
|
52
|
-
// Calcular tamanho do ripple (maior dimensão)
|
|
53
|
-
const size = Math.max(rect.width, rect.height)
|
|
54
|
-
|
|
55
|
-
// Criar elemento DOM do ripple
|
|
56
|
-
const rippleElement = document.createElement('div')
|
|
57
|
-
rippleElement.className = 'datametria-ripple'
|
|
58
|
-
rippleElement.style.cssText = `
|
|
59
|
-
position: absolute;
|
|
60
|
-
left: ${x - size / 2}px;
|
|
61
|
-
top: ${y - size / 2}px;
|
|
62
|
-
width: ${size}px;
|
|
63
|
-
height: ${size}px;
|
|
64
|
-
border-radius: 50%;
|
|
65
|
-
background: ${color};
|
|
66
|
-
transform: scale(0);
|
|
67
|
-
animation: ripple-animation ${duration / 1000}s ease-out;
|
|
68
|
-
pointer-events: none;
|
|
69
|
-
z-index: 1;
|
|
70
|
-
`
|
|
71
|
-
|
|
72
|
-
element.appendChild(rippleElement)
|
|
73
|
-
|
|
74
|
-
// Remover ripple após animação
|
|
75
|
-
setTimeout(() => {
|
|
76
|
-
if (rippleElement.parentNode) {
|
|
77
|
-
rippleElement.parentNode.removeChild(rippleElement)
|
|
78
|
-
}
|
|
79
|
-
}, duration)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Event handlers
|
|
83
|
-
const handleClick = (event: MouseEvent) => {
|
|
84
|
-
createRipple(event)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Aplicar ripple ao elemento
|
|
88
|
-
const applyRipple = (element: HTMLElement) => {
|
|
89
|
-
if (!element) return
|
|
90
|
-
|
|
91
|
-
elementRef.value = element
|
|
92
|
-
|
|
93
|
-
// Garantir posição relativa para ripples
|
|
94
|
-
const computedStyle = window.getComputedStyle(element)
|
|
95
|
-
if (computedStyle.position === 'static') {
|
|
96
|
-
element.style.position = 'relative'
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Garantir overflow hidden
|
|
100
|
-
element.style.overflow = 'hidden'
|
|
101
|
-
|
|
102
|
-
// Adicionar event listeners
|
|
103
|
-
element.addEventListener('click', handleClick)
|
|
104
|
-
|
|
105
|
-
return () => {
|
|
106
|
-
element.removeEventListener('click', handleClick)
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Remover ripple específico
|
|
111
|
-
const removeRipple = (id: string) => {
|
|
112
|
-
const index = ripples.value.findIndex(r => r.id === id)
|
|
113
|
-
if (index > -1) {
|
|
114
|
-
ripples.value.splice(index, 1)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Limpar todos os ripples
|
|
119
|
-
const clearRipples = () => {
|
|
120
|
-
ripples.value = []
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Cleanup
|
|
124
|
-
onUnmounted(() => {
|
|
125
|
-
clearRipples()
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
// Computed styles para ripples
|
|
129
|
-
const getRippleStyle = (ripple: RippleEffect) => ({
|
|
130
|
-
position: 'absolute' as const,
|
|
131
|
-
left: `${ripple.x}px`,
|
|
132
|
-
top: `${ripple.y}px`,
|
|
133
|
-
width: `${ripple.size}px`,
|
|
134
|
-
height: `${ripple.size}px`,
|
|
135
|
-
borderRadius: '50%',
|
|
136
|
-
backgroundColor: color,
|
|
137
|
-
transform: 'scale(0)',
|
|
138
|
-
animation: `ripple-animation ${duration}ms ease-out`,
|
|
139
|
-
pointerEvents: 'none' as const,
|
|
140
|
-
zIndex: 1
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
// CSS para animação (deve ser injetado no head)
|
|
144
|
-
const injectRippleCSS = () => {
|
|
145
|
-
const styleId = 'ripple-keyframes'
|
|
146
|
-
|
|
147
|
-
if (document.getElementById(styleId)) return
|
|
148
|
-
|
|
149
|
-
const style = document.createElement('style')
|
|
150
|
-
style.id = styleId
|
|
151
|
-
style.textContent = `
|
|
152
|
-
@keyframes ripple-animation {
|
|
153
|
-
0% {
|
|
154
|
-
transform: scale(0);
|
|
155
|
-
opacity: 1;
|
|
156
|
-
}
|
|
157
|
-
100% {
|
|
158
|
-
transform: scale(2);
|
|
159
|
-
opacity: 0;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
@media (prefers-reduced-motion: reduce) {
|
|
164
|
-
@keyframes ripple-animation {
|
|
165
|
-
0%, 100% {
|
|
166
|
-
transform: scale(0);
|
|
167
|
-
opacity: 0;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
`
|
|
172
|
-
|
|
173
|
-
document.head.appendChild(style)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
// Método para adicionar efeito ripple ao elemento
|
|
179
|
-
const addRippleEffect = () => {
|
|
180
|
-
if (!elementRef.value) return
|
|
181
|
-
return applyRipple(elementRef.value)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// Método para remover efeito ripple do elemento
|
|
185
|
-
const removeRippleEffect = () => {
|
|
186
|
-
if (!elementRef.value) return
|
|
187
|
-
|
|
188
|
-
elementRef.value.removeEventListener('click', handleClick)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// Injetar CSS na montagem
|
|
192
|
-
onMounted(() => {
|
|
193
|
-
injectRippleCSS()
|
|
194
|
-
|
|
195
|
-
// Auto-aplicar se elemento já existe
|
|
196
|
-
if (elementRef.value) {
|
|
197
|
-
addRippleEffect()
|
|
198
|
-
}
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
// Watch para aplicar ripple quando elemento for definido
|
|
202
|
-
watch(elementRef, (newElement) => {
|
|
203
|
-
if (newElement) {
|
|
204
|
-
addRippleEffect()
|
|
205
|
-
}
|
|
206
|
-
})
|
|
207
|
-
|
|
208
|
-
return {
|
|
209
|
-
rippleRef: elementRef,
|
|
210
|
-
ripples,
|
|
211
|
-
applyRipple,
|
|
212
|
-
removeRipple,
|
|
213
|
-
clearRipples,
|
|
214
|
-
getRippleStyle,
|
|
215
|
-
createRipple,
|
|
216
|
-
addRippleEffect,
|
|
217
|
-
removeRippleEffect
|
|
218
|
-
}
|
|
1
|
+
import { ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
+
|
|
3
|
+
interface RippleOptions {
|
|
4
|
+
color?: string
|
|
5
|
+
duration?: number
|
|
6
|
+
disabled?: boolean
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface RippleEffect {
|
|
10
|
+
x: number
|
|
11
|
+
y: number
|
|
12
|
+
size: number
|
|
13
|
+
id: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Composable para efeito ripple em elementos clicáveis
|
|
18
|
+
* Implementa Material Design ripple effect com acessibilidade
|
|
19
|
+
*/
|
|
20
|
+
export function useRipple(options: RippleOptions = {}) {
|
|
21
|
+
const {
|
|
22
|
+
color = 'rgba(255, 255, 255, 0.3)',
|
|
23
|
+
duration = 600,
|
|
24
|
+
disabled = false
|
|
25
|
+
} = options
|
|
26
|
+
|
|
27
|
+
const elementRef = ref<HTMLElement>()
|
|
28
|
+
const ripples = ref<RippleEffect[]>([])
|
|
29
|
+
|
|
30
|
+
// Criar elemento ripple DOM
|
|
31
|
+
const createRipple = (event: MouseEvent | TouchEvent) => {
|
|
32
|
+
if (disabled || !elementRef.value) return
|
|
33
|
+
|
|
34
|
+
const element = elementRef.value
|
|
35
|
+
const rect = element.getBoundingClientRect()
|
|
36
|
+
|
|
37
|
+
// Calcular posição do clique
|
|
38
|
+
let clientX: number, clientY: number
|
|
39
|
+
|
|
40
|
+
if (event instanceof MouseEvent) {
|
|
41
|
+
clientX = event.clientX
|
|
42
|
+
clientY = event.clientY
|
|
43
|
+
} else {
|
|
44
|
+
const touch = event.touches[0] || event.changedTouches[0]
|
|
45
|
+
clientX = touch.clientX
|
|
46
|
+
clientY = touch.clientY
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const x = clientX - rect.left
|
|
50
|
+
const y = clientY - rect.top
|
|
51
|
+
|
|
52
|
+
// Calcular tamanho do ripple (maior dimensão)
|
|
53
|
+
const size = Math.max(rect.width, rect.height)
|
|
54
|
+
|
|
55
|
+
// Criar elemento DOM do ripple
|
|
56
|
+
const rippleElement = document.createElement('div')
|
|
57
|
+
rippleElement.className = 'datametria-ripple'
|
|
58
|
+
rippleElement.style.cssText = `
|
|
59
|
+
position: absolute;
|
|
60
|
+
left: ${x - size / 2}px;
|
|
61
|
+
top: ${y - size / 2}px;
|
|
62
|
+
width: ${size}px;
|
|
63
|
+
height: ${size}px;
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
background: ${color};
|
|
66
|
+
transform: scale(0);
|
|
67
|
+
animation: ripple-animation ${duration / 1000}s ease-out;
|
|
68
|
+
pointer-events: none;
|
|
69
|
+
z-index: 1;
|
|
70
|
+
`
|
|
71
|
+
|
|
72
|
+
element.appendChild(rippleElement)
|
|
73
|
+
|
|
74
|
+
// Remover ripple após animação
|
|
75
|
+
setTimeout(() => {
|
|
76
|
+
if (rippleElement.parentNode) {
|
|
77
|
+
rippleElement.parentNode.removeChild(rippleElement)
|
|
78
|
+
}
|
|
79
|
+
}, duration)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Event handlers
|
|
83
|
+
const handleClick = (event: MouseEvent) => {
|
|
84
|
+
createRipple(event)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Aplicar ripple ao elemento
|
|
88
|
+
const applyRipple = (element: HTMLElement) => {
|
|
89
|
+
if (!element) return
|
|
90
|
+
|
|
91
|
+
elementRef.value = element
|
|
92
|
+
|
|
93
|
+
// Garantir posição relativa para ripples
|
|
94
|
+
const computedStyle = window.getComputedStyle(element)
|
|
95
|
+
if (computedStyle.position === 'static') {
|
|
96
|
+
element.style.position = 'relative'
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Garantir overflow hidden
|
|
100
|
+
element.style.overflow = 'hidden'
|
|
101
|
+
|
|
102
|
+
// Adicionar event listeners
|
|
103
|
+
element.addEventListener('click', handleClick)
|
|
104
|
+
|
|
105
|
+
return () => {
|
|
106
|
+
element.removeEventListener('click', handleClick)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Remover ripple específico
|
|
111
|
+
const removeRipple = (id: string) => {
|
|
112
|
+
const index = ripples.value.findIndex(r => r.id === id)
|
|
113
|
+
if (index > -1) {
|
|
114
|
+
ripples.value.splice(index, 1)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Limpar todos os ripples
|
|
119
|
+
const clearRipples = () => {
|
|
120
|
+
ripples.value = []
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Cleanup
|
|
124
|
+
onUnmounted(() => {
|
|
125
|
+
clearRipples()
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
// Computed styles para ripples
|
|
129
|
+
const getRippleStyle = (ripple: RippleEffect) => ({
|
|
130
|
+
position: 'absolute' as const,
|
|
131
|
+
left: `${ripple.x}px`,
|
|
132
|
+
top: `${ripple.y}px`,
|
|
133
|
+
width: `${ripple.size}px`,
|
|
134
|
+
height: `${ripple.size}px`,
|
|
135
|
+
borderRadius: '50%',
|
|
136
|
+
backgroundColor: color,
|
|
137
|
+
transform: 'scale(0)',
|
|
138
|
+
animation: `ripple-animation ${duration}ms ease-out`,
|
|
139
|
+
pointerEvents: 'none' as const,
|
|
140
|
+
zIndex: 1
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
// CSS para animação (deve ser injetado no head)
|
|
144
|
+
const injectRippleCSS = () => {
|
|
145
|
+
const styleId = 'ripple-keyframes'
|
|
146
|
+
|
|
147
|
+
if (document.getElementById(styleId)) return
|
|
148
|
+
|
|
149
|
+
const style = document.createElement('style')
|
|
150
|
+
style.id = styleId
|
|
151
|
+
style.textContent = `
|
|
152
|
+
@keyframes ripple-animation {
|
|
153
|
+
0% {
|
|
154
|
+
transform: scale(0);
|
|
155
|
+
opacity: 1;
|
|
156
|
+
}
|
|
157
|
+
100% {
|
|
158
|
+
transform: scale(2);
|
|
159
|
+
opacity: 0;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@media (prefers-reduced-motion: reduce) {
|
|
164
|
+
@keyframes ripple-animation {
|
|
165
|
+
0%, 100% {
|
|
166
|
+
transform: scale(0);
|
|
167
|
+
opacity: 0;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
`
|
|
172
|
+
|
|
173
|
+
document.head.appendChild(style)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
// Método para adicionar efeito ripple ao elemento
|
|
179
|
+
const addRippleEffect = () => {
|
|
180
|
+
if (!elementRef.value) return
|
|
181
|
+
return applyRipple(elementRef.value)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Método para remover efeito ripple do elemento
|
|
185
|
+
const removeRippleEffect = () => {
|
|
186
|
+
if (!elementRef.value) return
|
|
187
|
+
|
|
188
|
+
elementRef.value.removeEventListener('click', handleClick)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Injetar CSS na montagem
|
|
192
|
+
onMounted(() => {
|
|
193
|
+
injectRippleCSS()
|
|
194
|
+
|
|
195
|
+
// Auto-aplicar se elemento já existe
|
|
196
|
+
if (elementRef.value) {
|
|
197
|
+
addRippleEffect()
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
// Watch para aplicar ripple quando elemento for definido
|
|
202
|
+
watch(elementRef, (newElement) => {
|
|
203
|
+
if (newElement) {
|
|
204
|
+
addRippleEffect()
|
|
205
|
+
}
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
return {
|
|
209
|
+
rippleRef: elementRef,
|
|
210
|
+
ripples,
|
|
211
|
+
applyRipple,
|
|
212
|
+
removeRipple,
|
|
213
|
+
clearRipples,
|
|
214
|
+
getRippleStyle,
|
|
215
|
+
createRipple,
|
|
216
|
+
addRippleEffect,
|
|
217
|
+
removeRippleEffect
|
|
218
|
+
}
|
|
219
219
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,61 +1,68 @@
|
|
|
1
|
-
// Components - Form
|
|
2
|
-
export { default as DatametriaButton } from './components/DatametriaButton.vue'
|
|
3
|
-
export { default as DatametriaInput } from './components/DatametriaInput.vue'
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as
|
|
12
|
-
export { default as
|
|
13
|
-
export { default as
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export { default as
|
|
18
|
-
export { default as
|
|
19
|
-
export { default as
|
|
20
|
-
export { default as
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export { default as
|
|
25
|
-
export { default as
|
|
26
|
-
export { default as
|
|
27
|
-
export { default as
|
|
28
|
-
export { default as
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export { default as
|
|
33
|
-
export { default as
|
|
34
|
-
export { default as
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export { default as
|
|
40
|
-
export { default as
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export {
|
|
50
|
-
export {
|
|
51
|
-
export {
|
|
52
|
-
export {
|
|
53
|
-
export {
|
|
54
|
-
export {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
export
|
|
59
|
-
export
|
|
60
|
-
export
|
|
61
|
-
export type
|
|
1
|
+
// Components - Form
|
|
2
|
+
export { default as DatametriaButton } from './components/DatametriaButton.vue'
|
|
3
|
+
export { default as DatametriaInput } from './components/DatametriaInput.vue'
|
|
4
|
+
export { default as DatametriaPasswordInput } from './components/DatametriaPasswordInput.vue'
|
|
5
|
+
export { default as DatametriaSelect } from './components/DatametriaSelect.vue'
|
|
6
|
+
export { default as DatametriaCheckbox } from './components/DatametriaCheckbox.vue'
|
|
7
|
+
export { default as DatametriaRadio } from './components/DatametriaRadio.vue'
|
|
8
|
+
export { default as DatametriaSwitch } from './components/DatametriaSwitch.vue'
|
|
9
|
+
export { default as DatametriaTextarea } from './components/DatametriaTextarea.vue'
|
|
10
|
+
export { default as DatametriaDatePicker } from './components/DatametriaDatePicker.vue'
|
|
11
|
+
export { default as DatametriaTimePicker } from './components/DatametriaTimePicker.vue'
|
|
12
|
+
export { default as DatametriaSlider } from './components/DatametriaSlider.vue'
|
|
13
|
+
export { default as DatametriaFileUpload } from './components/DatametriaFileUpload.vue'
|
|
14
|
+
export { default as DatametriaAutocomplete } from './components/DatametriaAutocomplete.vue'
|
|
15
|
+
|
|
16
|
+
// Components - Layout
|
|
17
|
+
export { default as DatametriaCard } from './components/DatametriaCard.vue'
|
|
18
|
+
export { default as DatametriaModal } from './components/DatametriaModal.vue'
|
|
19
|
+
export { default as DatametriaContainer } from './components/DatametriaContainer.vue'
|
|
20
|
+
export { default as DatametriaGrid } from './components/DatametriaGrid.vue'
|
|
21
|
+
export { default as DatametriaDivider } from './components/DatametriaDivider.vue'
|
|
22
|
+
|
|
23
|
+
// Components - Feedback
|
|
24
|
+
export { default as DatametriaAlert } from './components/DatametriaAlert.vue'
|
|
25
|
+
export { default as DatametriaToast } from './components/DatametriaToast.vue'
|
|
26
|
+
export { default as DatametriaTooltip } from './components/DatametriaTooltip.vue'
|
|
27
|
+
export { default as DatametriaSkeleton } from './components/DatametriaSkeleton.vue'
|
|
28
|
+
export { default as DatametriaProgress } from './components/DatametriaProgress.vue'
|
|
29
|
+
export { default as DatametriaSpinner } from './components/DatametriaSpinner.vue'
|
|
30
|
+
|
|
31
|
+
// Components - Data Display
|
|
32
|
+
export { default as DatametriaTable } from './components/DatametriaTable.vue'
|
|
33
|
+
export { default as DatametriaSortableTable } from './components/DatametriaSortableTable.vue'
|
|
34
|
+
export { default as DatametriaAvatar } from './components/DatametriaAvatar.vue'
|
|
35
|
+
export { default as DatametriaBadge } from './components/DatametriaBadge.vue'
|
|
36
|
+
export { default as DatametriaChip } from './components/DatametriaChip.vue'
|
|
37
|
+
|
|
38
|
+
// Components - Navigation
|
|
39
|
+
export { default as DatametriaNavbar } from './components/DatametriaNavbar.vue'
|
|
40
|
+
export { default as DatametriaMenu } from './components/DatametriaMenu.vue'
|
|
41
|
+
export { default as DatametriaBreadcrumb } from './components/DatametriaBreadcrumb.vue'
|
|
42
|
+
export { default as DatametriaTabs } from './components/DatametriaTabs.vue'
|
|
43
|
+
|
|
44
|
+
// Composables - Core
|
|
45
|
+
export { useValidation, required, email, minLength, maxLength, pattern, custom } from './composables/useValidation'
|
|
46
|
+
export { useAPI } from './composables/useAPI'
|
|
47
|
+
|
|
48
|
+
// Composables - Utility
|
|
49
|
+
export { useAccessibilityScale } from './composables/useAccessibilityScale'
|
|
50
|
+
export { useBreakpoints } from './composables/useBreakpoints'
|
|
51
|
+
export { useRipple } from './composables/useRipple'
|
|
52
|
+
export { useHapticFeedback } from './composables/useHapticFeedback'
|
|
53
|
+
export { useLocalStorage } from './composables/useLocalStorage'
|
|
54
|
+
export { useDebounce } from './composables/useDebounce'
|
|
55
|
+
export { useClipboard } from './composables/useClipboard'
|
|
56
|
+
|
|
57
|
+
// Theming System (v2.0)
|
|
58
|
+
export { default as ThemeProvider } from './theme/ThemeProvider.vue'
|
|
59
|
+
export { useTheme } from './theme/useTheme'
|
|
60
|
+
export { datametriaTheme, defaultTheme } from './theme/presets'
|
|
61
|
+
export type { Theme, ThemeTokens } from './theme/types'
|
|
62
|
+
|
|
63
|
+
// Types
|
|
64
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'outline'
|
|
65
|
+
export type ButtonSize = 'sm' | 'md' | 'lg'
|
|
66
|
+
export type AlertVariant = 'info' | 'success' | 'warning' | 'error'
|
|
67
|
+
export type BadgeVariant = 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info'
|
|
68
|
+
export type BadgeSize = 'sm' | 'md' | 'lg'
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import DatametriaButton from '../components/DatametriaButton.vue'
|
|
2
|
+
import DatametriaAlert from '../components/DatametriaAlert.vue'
|
|
3
|
+
import DatametriaBadge from '../components/DatametriaBadge.vue'
|
|
4
|
+
import DatametriaChip from '../components/DatametriaChip.vue'
|
|
5
|
+
import DatametriaToast from '../components/DatametriaToast.vue'
|
|
6
|
+
import DatametriaNavbar from '../components/DatametriaNavbar.vue'
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Design System/Variants',
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: 'Showcase of all component variants with primary variant standardization'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const AllVariants = () => ({
|
|
20
|
+
components: {
|
|
21
|
+
DatametriaButton,
|
|
22
|
+
DatametriaAlert,
|
|
23
|
+
DatametriaBadge,
|
|
24
|
+
DatametriaChip,
|
|
25
|
+
DatametriaToast,
|
|
26
|
+
DatametriaNavbar
|
|
27
|
+
},
|
|
28
|
+
template: `
|
|
29
|
+
<div style="padding: 2rem; space-y: 2rem;">
|
|
30
|
+
<section>
|
|
31
|
+
<h2>Button Variants</h2>
|
|
32
|
+
<div style="display: flex; gap: 1rem; margin: 1rem 0;">
|
|
33
|
+
<DatametriaButton variant="primary">Primary</DatametriaButton>
|
|
34
|
+
<DatametriaButton variant="secondary">Secondary</DatametriaButton>
|
|
35
|
+
<DatametriaButton variant="outline">Outline</DatametriaButton>
|
|
36
|
+
<DatametriaButton variant="ghost">Ghost</DatametriaButton>
|
|
37
|
+
</div>
|
|
38
|
+
</section>
|
|
39
|
+
|
|
40
|
+
<section>
|
|
41
|
+
<h2>Alert Variants</h2>
|
|
42
|
+
<div style="display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0;">
|
|
43
|
+
<DatametriaAlert variant="primary" message="Primary alert message" />
|
|
44
|
+
<DatametriaAlert variant="success" message="Success alert message" />
|
|
45
|
+
<DatametriaAlert variant="error" message="Error alert message" />
|
|
46
|
+
<DatametriaAlert variant="warning" message="Warning alert message" />
|
|
47
|
+
<DatametriaAlert variant="info" message="Info alert message" />
|
|
48
|
+
</div>
|
|
49
|
+
</section>
|
|
50
|
+
|
|
51
|
+
<section>
|
|
52
|
+
<h2>Badge Variants</h2>
|
|
53
|
+
<div style="display: flex; gap: 1rem; margin: 1rem 0;">
|
|
54
|
+
<DatametriaBadge variant="primary" label="Primary" />
|
|
55
|
+
<DatametriaBadge variant="secondary" label="Secondary" />
|
|
56
|
+
<DatametriaBadge variant="success" label="Success" />
|
|
57
|
+
<DatametriaBadge variant="error" label="Error" />
|
|
58
|
+
<DatametriaBadge variant="warning" label="Warning" />
|
|
59
|
+
<DatametriaBadge variant="info" label="Info" />
|
|
60
|
+
</div>
|
|
61
|
+
</section>
|
|
62
|
+
|
|
63
|
+
<section>
|
|
64
|
+
<h2>Chip Variants</h2>
|
|
65
|
+
<div style="display: flex; gap: 1rem; margin: 1rem 0;">
|
|
66
|
+
<DatametriaChip variant="primary" label="Primary" />
|
|
67
|
+
<DatametriaChip variant="secondary" label="Secondary" />
|
|
68
|
+
<DatametriaChip variant="success" label="Success" />
|
|
69
|
+
<DatametriaChip variant="error" label="Error" />
|
|
70
|
+
<DatametriaChip variant="warning" label="Warning" />
|
|
71
|
+
</div>
|
|
72
|
+
</section>
|
|
73
|
+
|
|
74
|
+
<section>
|
|
75
|
+
<h2>Toast Variants</h2>
|
|
76
|
+
<div style="display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0;">
|
|
77
|
+
<DatametriaToast variant="primary" message="Primary toast" :model-value="true" />
|
|
78
|
+
<DatametriaToast variant="success" message="Success toast" :model-value="true" />
|
|
79
|
+
<DatametriaToast variant="error" message="Error toast" :model-value="true" />
|
|
80
|
+
<DatametriaToast variant="warning" message="Warning toast" :model-value="true" />
|
|
81
|
+
<DatametriaToast variant="info" message="Info toast" :model-value="true" />
|
|
82
|
+
</div>
|
|
83
|
+
</section>
|
|
84
|
+
|
|
85
|
+
<section>
|
|
86
|
+
<h2>Navbar Variants</h2>
|
|
87
|
+
<div style="display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0;">
|
|
88
|
+
<DatametriaNavbar variant="primary" brand="Primary Navbar" />
|
|
89
|
+
<DatametriaNavbar variant="light" brand="Light Navbar" />
|
|
90
|
+
<DatametriaNavbar variant="dark" brand="Dark Navbar" />
|
|
91
|
+
<DatametriaNavbar variant="transparent" brand="Transparent Navbar" />
|
|
92
|
+
</div>
|
|
93
|
+
</section>
|
|
94
|
+
</div>
|
|
95
|
+
`
|
|
96
|
+
})
|