@farm-investimentos/front-mfe-components-vue3 1.4.0 → 1.5.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/dist/front-mfe-components.common.js +435 -422
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +1 -1
- package/dist/front-mfe-components.umd.js +435 -422
- package/dist/front-mfe-components.umd.js.map +1 -1
- package/dist/front-mfe-components.umd.min.js +1 -1
- package/dist/front-mfe-components.umd.min.js.map +1 -1
- package/dist/img/currency-exchange.00d6a787.svg +3 -0
- package/package.json +1 -1
- package/src/assets/icons/README.md +33 -0
- package/src/assets/icons/currency-exchange/currency-exchange.scss +14 -0
- package/src/assets/icons/currency-exchange/currency-exchange.svg +3 -0
- package/src/assets/icons/custom-icons-list.ts +3 -0
- package/src/assets/icons/custom-icons.scss +2 -0
- package/src/assets/icons/index.ts +2 -0
- package/src/components/Icon/Icon.scss +1 -0
- package/src/components/Icon/Icon.stories.js +28 -0
- package/src/components/Icon/Icon.vue +7 -2
- package/src/components/Icon/icons_list.ts +3 -0
- package/src/components/Tooltip/Tooltip.scss +0 -21
- package/src/components/Tooltip/Tooltip.stories.js +38 -38
- package/src/components/Tooltip/Tooltip.vue +7 -12
- package/src/components/Tooltip/docs/Tooltip.md +50 -24
- package/src/components/Tooltip/types.ts +3 -11
- package/src/main.ts +4 -0
|
@@ -29,7 +29,33 @@ O componente Tooltip fornece informações contextuais ao usuário através de u
|
|
|
29
29
|
## 📦 Instalação e Importação
|
|
30
30
|
|
|
31
31
|
```javascript
|
|
32
|
+
// Importar o componente
|
|
32
33
|
import { Tooltip } from '@farm-investimentos/front-mfe-components-vue3';
|
|
34
|
+
|
|
35
|
+
// Registrar no app Vue (global)
|
|
36
|
+
app.component('farm-tooltip', Tooltip);
|
|
37
|
+
|
|
38
|
+
// Ou registrar localmente no componente
|
|
39
|
+
export default {
|
|
40
|
+
components: {
|
|
41
|
+
'farm-tooltip': Tooltip
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Com script setup
|
|
46
|
+
import { Tooltip } from '@farm-investimentos/front-mfe-components-vue3';
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Uso com npm link
|
|
50
|
+
Após fazer `npm link` no projeto e `npm link @farm-investimentos/front-mfe-components-vue3` no projeto de destino, você pode usar:
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
// main.js ou main.ts
|
|
54
|
+
import { createApp } from 'vue';
|
|
55
|
+
import { Tooltip } from '@farm-investimentos/front-mfe-components-vue3';
|
|
56
|
+
|
|
57
|
+
const app = createApp(App);
|
|
58
|
+
app.component('farm-tooltip', Tooltip);
|
|
33
59
|
```
|
|
34
60
|
|
|
35
61
|
## 🎨 API
|
|
@@ -69,28 +95,28 @@ import { Tooltip } from '@farm-investimentos/front-mfe-components-vue3';
|
|
|
69
95
|
|
|
70
96
|
### Básico
|
|
71
97
|
```vue
|
|
72
|
-
<
|
|
98
|
+
<farm-tooltip>
|
|
73
99
|
<template #activator>
|
|
74
100
|
<button>Hover me</button>
|
|
75
101
|
</template>
|
|
76
102
|
Informação adicional sobre este botão
|
|
77
|
-
</
|
|
103
|
+
</farm-tooltip>
|
|
78
104
|
```
|
|
79
105
|
|
|
80
106
|
### Posicionamento Customizado
|
|
81
107
|
```vue
|
|
82
|
-
<
|
|
108
|
+
<farm-tooltip placement="bottom-right" :offset="12">
|
|
83
109
|
<template #activator>
|
|
84
110
|
<IconHelp />
|
|
85
111
|
</template>
|
|
86
112
|
Ajuda contextual posicionada à direita
|
|
87
|
-
</
|
|
113
|
+
</farm-tooltip>
|
|
88
114
|
```
|
|
89
115
|
|
|
90
116
|
### Modo Controlado com Título
|
|
91
117
|
```vue
|
|
92
118
|
<template>
|
|
93
|
-
<
|
|
119
|
+
<farm-tooltip v-model="showHelp">
|
|
94
120
|
<template #activator>
|
|
95
121
|
<button @click="showHelp = !showHelp">
|
|
96
122
|
Toggle Help
|
|
@@ -104,7 +130,7 @@ import { Tooltip } from '@farm-investimentos/front-mfe-components-vue3';
|
|
|
104
130
|
<li>Segundo ponto</li>
|
|
105
131
|
<li>Terceiro ponto</li>
|
|
106
132
|
</ul>
|
|
107
|
-
</
|
|
133
|
+
</farm-tooltip>
|
|
108
134
|
</template>
|
|
109
135
|
|
|
110
136
|
<script setup>
|
|
@@ -115,50 +141,50 @@ const showHelp = ref(false);
|
|
|
115
141
|
|
|
116
142
|
### Tooltip Fluido para Conteúdo Longo
|
|
117
143
|
```vue
|
|
118
|
-
<
|
|
144
|
+
<farm-tooltip :fluid="true">
|
|
119
145
|
<template #activator>
|
|
120
146
|
<span>Ver descrição completa</span>
|
|
121
147
|
</template>
|
|
122
148
|
Este é um texto mais longo que se adapta automaticamente
|
|
123
149
|
à largura do conteúdo, expandindo até o máximo de 300px
|
|
124
150
|
antes de quebrar em múltiplas linhas.
|
|
125
|
-
</
|
|
151
|
+
</farm-tooltip>
|
|
126
152
|
```
|
|
127
153
|
|
|
128
154
|
### Diferentes Tamanhos
|
|
129
155
|
```vue
|
|
130
156
|
<div class="flex gap-4">
|
|
131
|
-
<
|
|
157
|
+
<farm-tooltip size="sm">
|
|
132
158
|
<template #activator>
|
|
133
159
|
<Badge>SM</Badge>
|
|
134
160
|
</template>
|
|
135
161
|
Tooltip pequeno
|
|
136
|
-
</
|
|
162
|
+
</farm-tooltip>
|
|
137
163
|
|
|
138
|
-
<
|
|
164
|
+
<farm-tooltip size="md">
|
|
139
165
|
<template #activator>
|
|
140
166
|
<Badge>MD</Badge>
|
|
141
167
|
</template>
|
|
142
168
|
Tooltip médio (padrão)
|
|
143
|
-
</
|
|
169
|
+
</farm-tooltip>
|
|
144
170
|
|
|
145
|
-
<
|
|
171
|
+
<farm-tooltip size="lg">
|
|
146
172
|
<template #activator>
|
|
147
173
|
<Badge>LG</Badge>
|
|
148
174
|
</template>
|
|
149
175
|
Tooltip grande com mais espaçamento
|
|
150
|
-
</
|
|
176
|
+
</farm-tooltip>
|
|
151
177
|
</div>
|
|
152
178
|
```
|
|
153
179
|
|
|
154
180
|
### Com Delay Customizado
|
|
155
181
|
```vue
|
|
156
|
-
<
|
|
182
|
+
<farm-tooltip :delay="[500, 0]">
|
|
157
183
|
<template #activator>
|
|
158
184
|
<button>Hover com delay</button>
|
|
159
185
|
</template>
|
|
160
186
|
Aparece após 500ms, desaparece instantaneamente
|
|
161
|
-
</
|
|
187
|
+
</farm-tooltip>
|
|
162
188
|
```
|
|
163
189
|
|
|
164
190
|
## 🎯 Casos de Uso Comuns
|
|
@@ -167,42 +193,42 @@ const showHelp = ref(false);
|
|
|
167
193
|
```vue
|
|
168
194
|
<label>
|
|
169
195
|
CPF
|
|
170
|
-
<
|
|
196
|
+
<farm-tooltip placement="top-right">
|
|
171
197
|
<template #activator>
|
|
172
198
|
<IconQuestion class="ml-1 text-gray-400" />
|
|
173
199
|
</template>
|
|
174
200
|
Digite apenas números, sem pontos ou traços
|
|
175
|
-
</
|
|
201
|
+
</farm-tooltip>
|
|
176
202
|
</label>
|
|
177
203
|
```
|
|
178
204
|
|
|
179
205
|
### 2. Botões com Ações Desabilitadas
|
|
180
206
|
```vue
|
|
181
|
-
<
|
|
207
|
+
<farm-tooltip :disabled="canDelete">
|
|
182
208
|
<template #activator>
|
|
183
209
|
<button :disabled="!canDelete" @click="handleDelete">
|
|
184
210
|
Excluir
|
|
185
211
|
</button>
|
|
186
212
|
</template>
|
|
187
213
|
Você não tem permissão para excluir este item
|
|
188
|
-
</
|
|
214
|
+
</farm-tooltip>
|
|
189
215
|
```
|
|
190
216
|
|
|
191
217
|
### 3. Truncate com Preview Completo
|
|
192
218
|
```vue
|
|
193
|
-
<
|
|
219
|
+
<farm-tooltip>
|
|
194
220
|
<template #activator>
|
|
195
221
|
<p class="truncate max-w-xs">
|
|
196
222
|
{{ longText }}
|
|
197
223
|
</p>
|
|
198
224
|
</template>
|
|
199
225
|
{{ longText }}
|
|
200
|
-
</
|
|
226
|
+
</farm-tooltip>
|
|
201
227
|
```
|
|
202
228
|
|
|
203
229
|
### 4. Status com Detalhes
|
|
204
230
|
```vue
|
|
205
|
-
<
|
|
231
|
+
<farm-tooltip placement="bottom-center">
|
|
206
232
|
<template #activator>
|
|
207
233
|
<StatusBadge :status="order.status" />
|
|
208
234
|
</template>
|
|
@@ -211,7 +237,7 @@ const showHelp = ref(false);
|
|
|
211
237
|
<p><strong>Atualizado:</strong> {{ order.updatedAt }}</p>
|
|
212
238
|
<p><strong>Por:</strong> {{ order.updatedBy }}</p>
|
|
213
239
|
</div>
|
|
214
|
-
</
|
|
240
|
+
</farm-tooltip>
|
|
215
241
|
```
|
|
216
242
|
|
|
217
243
|
## ⚡ Performance e Boas Práticas
|
|
@@ -13,28 +13,20 @@ export type TooltipVariant = 'dark' | 'light';
|
|
|
13
13
|
export type TooltipSize = 'sm' | 'md' | 'lg';
|
|
14
14
|
|
|
15
15
|
export interface TooltipProps {
|
|
16
|
-
|
|
17
|
-
modelValue?: boolean; // v-model
|
|
16
|
+
modelValue?: boolean;
|
|
18
17
|
trigger?: TooltipTrigger;
|
|
19
|
-
|
|
20
|
-
// Placement (all 6 positions are supported)
|
|
21
18
|
placement?: TooltipPlacement;
|
|
22
19
|
offset?: number;
|
|
23
|
-
|
|
24
|
-
// Aparência
|
|
25
20
|
variant?: TooltipVariant;
|
|
26
21
|
size?: TooltipSize;
|
|
27
22
|
maxWidth?: string | number;
|
|
28
|
-
|
|
29
|
-
// Comportamento
|
|
30
|
-
delay?: number | [number, number]; // [show, hide]
|
|
23
|
+
delay?: number | [number, number];
|
|
31
24
|
disabled?: boolean;
|
|
32
25
|
fluid?: boolean;
|
|
33
|
-
position?: string;
|
|
34
26
|
}
|
|
35
27
|
|
|
36
28
|
export interface TooltipEmits {
|
|
37
|
-
'update:modelValue': [value: boolean];
|
|
29
|
+
'update:modelValue': [value: boolean];
|
|
38
30
|
show: [];
|
|
39
31
|
hide: [];
|
|
40
32
|
}
|
package/src/main.ts
CHANGED
|
@@ -18,6 +18,7 @@ import PromptUserToConfirm from './components/PromptUserToConfirm';
|
|
|
18
18
|
import RangeDatePicker from './components/RangeDatePicker';
|
|
19
19
|
import ResourceMetaInfo from './components/ResourceMetaInfo';
|
|
20
20
|
import TableContextMenu from './components/TableContextMenu';
|
|
21
|
+
import Tooltip from './components/Tooltip';
|
|
21
22
|
|
|
22
23
|
export {
|
|
23
24
|
DataTablePaginator,
|
|
@@ -38,6 +39,7 @@ export {
|
|
|
38
39
|
Collapsible,
|
|
39
40
|
IdCaption,
|
|
40
41
|
ResourceMetaInfo,
|
|
42
|
+
Tooltip,
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
export * from './components/AlertBox';
|
|
@@ -89,3 +91,5 @@ export * from './components/layout/ContainerFooter';
|
|
|
89
91
|
export * from './components/layout/Row';
|
|
90
92
|
export * from './components/layout/Line';
|
|
91
93
|
|
|
94
|
+
export * from './assets/icons';
|
|
95
|
+
|