@farm-investimentos/front-mfe-components-vue3 1.6.1 → 1.6.3
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 +64 -0
- 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 +64 -0
- 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/package.json +1 -1
- package/src/components/BrazilMap/BrazilMap.stories.js +125 -0
- package/src/components/BrazilMap/BrazilMapSkeleton.scss +73 -0
- package/src/components/BrazilMap/BrazilMapSkeleton.vue +39 -0
- package/src/components/BrazilMap/index.ts +2 -1
- package/src/components/layout/PropsValues.mdx +17 -20
- package/src/stories/Introduction.mdx +3 -2
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import BrazilMap from './BrazilMap.vue';
|
|
2
2
|
import BrazilMapPositionEditor from './BrazilMapPositionEditor.vue';
|
|
3
|
+
import BrazilMapSkeleton from './BrazilMapSkeleton.vue';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
title: 'Display/Brazil Map',
|
|
@@ -25,6 +26,17 @@ Mapa interativo do Brasil com estados customizáveis e labels externos para esta
|
|
|
25
26
|
|
|
26
27
|
---
|
|
27
28
|
|
|
29
|
+
### 🔄 Skeleton Loading
|
|
30
|
+
|
|
31
|
+
Para exibir estado de carregamento, use o componente standalone \`<farm-brazil-map-skeleton>\`:
|
|
32
|
+
|
|
33
|
+
\`\`\`vue
|
|
34
|
+
<farm-brazil-map-skeleton v-if="isLoading" size="md" />
|
|
35
|
+
<farm-brazil-map v-else :statesData="data" size="md" />
|
|
36
|
+
\`\`\`
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
28
40
|
### 📦 Formato dos Dados (\`statesData\`)
|
|
29
41
|
|
|
30
42
|
\`\`\`javascript
|
|
@@ -377,6 +389,119 @@ Use esses eventos para criar tooltips customizados, painéis de detalhes, ou qua
|
|
|
377
389
|
},
|
|
378
390
|
};
|
|
379
391
|
|
|
392
|
+
export const SkeletonLoadingStandalone = () => ({
|
|
393
|
+
components: { BrazilMapSkeleton },
|
|
394
|
+
template: `
|
|
395
|
+
<div>
|
|
396
|
+
<h3 style="margin-bottom: 16px; color: #333;">Skeleton Loading (Standalone Component)</h3>
|
|
397
|
+
|
|
398
|
+
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px;">
|
|
399
|
+
<div>
|
|
400
|
+
<h4 style="color: #4f8406; margin-bottom: 8px;">Small (sm)</h4>
|
|
401
|
+
<farm-brazil-map-skeleton size="sm" />
|
|
402
|
+
</div>
|
|
403
|
+
<div>
|
|
404
|
+
<h4 style="color: #4f8406; margin-bottom: 8px;">Medium (md)</h4>
|
|
405
|
+
<farm-brazil-map-skeleton size="md" />
|
|
406
|
+
</div>
|
|
407
|
+
</div>
|
|
408
|
+
|
|
409
|
+
<div style="margin-bottom: 24px;">
|
|
410
|
+
<h4 style="color: #4f8406; margin-bottom: 8px;">Large (lg)</h4>
|
|
411
|
+
<farm-brazil-map-skeleton size="lg" />
|
|
412
|
+
</div>
|
|
413
|
+
|
|
414
|
+
<div style="margin-top: 16px; padding: 12px; background: #fff3cd; border-left: 4px solid #ffc107; border-radius: 4px;">
|
|
415
|
+
<strong>⚡ Componente Standalone:</strong> Use <code><farm-brazil-map-skeleton /></code>
|
|
416
|
+
como componente independente para exibir o skeleton sem lógica condicional.
|
|
417
|
+
</div>
|
|
418
|
+
|
|
419
|
+
<div style="margin-top: 12px; padding: 12px; background: #e8f5e9; border-left: 4px solid #4caf50; border-radius: 4px;">
|
|
420
|
+
<strong>✅ Vantagens:</strong>
|
|
421
|
+
<ul style="margin: 8px 0 0 0; padding-left: 20px;">
|
|
422
|
+
<li>Componente dedicado apenas para loading</li>
|
|
423
|
+
<li>Não depende de props statesData</li>
|
|
424
|
+
<li>Código mais limpo e semântico</li>
|
|
425
|
+
<li>Fácil de usar em v-if/v-else</li>
|
|
426
|
+
<li>Separação clara de responsabilidades</li>
|
|
427
|
+
</ul>
|
|
428
|
+
</div>
|
|
429
|
+
</div>
|
|
430
|
+
`,
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
SkeletonLoadingStandalone.parameters = {
|
|
434
|
+
docs: {
|
|
435
|
+
description: {
|
|
436
|
+
story: `
|
|
437
|
+
### 🔄 BrazilMapSkeleton - Componente Standalone
|
|
438
|
+
|
|
439
|
+
Componente separado dedicado exclusivamente ao estado de loading com efeito wave shimmer.
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
#### Como usar:
|
|
444
|
+
|
|
445
|
+
\`\`\`vue
|
|
446
|
+
<template>
|
|
447
|
+
<farm-brazil-map-skeleton v-if="isLoading" size="md" />
|
|
448
|
+
<farm-brazil-map v-else :statesData="mapData" size="md" />
|
|
449
|
+
</template>
|
|
450
|
+
|
|
451
|
+
<script>
|
|
452
|
+
import { BrazilMap, BrazilMapSkeleton } from '@/components/BrazilMap';
|
|
453
|
+
|
|
454
|
+
export default {
|
|
455
|
+
components: { BrazilMap, BrazilMapSkeleton },
|
|
456
|
+
data() {
|
|
457
|
+
return {
|
|
458
|
+
isLoading: true,
|
|
459
|
+
mapData: [],
|
|
460
|
+
};
|
|
461
|
+
},
|
|
462
|
+
async mounted() {
|
|
463
|
+
const data = await fetch('/api/map-data');
|
|
464
|
+
this.mapData = await data.json();
|
|
465
|
+
this.isLoading = false;
|
|
466
|
+
},
|
|
467
|
+
};
|
|
468
|
+
</script>
|
|
469
|
+
\`\`\`
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
#### Props disponíveis:
|
|
474
|
+
|
|
475
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
476
|
+
|------|------|--------|-----------|
|
|
477
|
+
| \`size\` | \`'sm' \\| 'md' \\| 'lg'\` | \`'md'\` | Tamanho do skeleton (sm: 300px, md: 460px, lg: 700px) |
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
#### Vantagens:
|
|
482
|
+
|
|
483
|
+
✅ Componente dedicado apenas para loading
|
|
484
|
+
✅ Não depende de props statesData
|
|
485
|
+
✅ Código mais limpo e semântico
|
|
486
|
+
✅ Fácil de usar em v-if/v-else
|
|
487
|
+
✅ Separação clara de responsabilidades
|
|
488
|
+
✅ Wave shimmer effect profissional
|
|
489
|
+
✅ Zero layout shift garantido
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
#### Implementação técnica:
|
|
494
|
+
|
|
495
|
+
- Animações CSS com @keyframes
|
|
496
|
+
- Wave shimmer horizontal (esquerda → direita)
|
|
497
|
+
- Pulsação de opacidade sincronizada
|
|
498
|
+
- Mesmo viewBox e paths do mapa original
|
|
499
|
+
- Performance otimizada
|
|
500
|
+
`,
|
|
501
|
+
},
|
|
502
|
+
},
|
|
503
|
+
};
|
|
504
|
+
|
|
380
505
|
export const PositionEditor = () => ({
|
|
381
506
|
components: { BrazilMapPositionEditor },
|
|
382
507
|
template: '<BrazilMapPositionEditor />',
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
@import '../../configurations/mixins';
|
|
2
|
+
|
|
3
|
+
@keyframes skeleton-wave {
|
|
4
|
+
0% {
|
|
5
|
+
opacity: 0.4;
|
|
6
|
+
}
|
|
7
|
+
50% {
|
|
8
|
+
opacity: 0.8;
|
|
9
|
+
}
|
|
10
|
+
100% {
|
|
11
|
+
opacity: 0.4;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.farm-brazil-map-skeleton {
|
|
16
|
+
display: inline-block;
|
|
17
|
+
width: 100%;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
user-select: none;
|
|
20
|
+
position: relative;
|
|
21
|
+
|
|
22
|
+
svg {
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: auto;
|
|
25
|
+
display: block;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.farm-brazil-map--sm {
|
|
29
|
+
max-width: 300px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.farm-brazil-map--md {
|
|
33
|
+
max-width: 460px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.farm-brazil-map--lg {
|
|
37
|
+
max-width: 700px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&::before {
|
|
41
|
+
content: '';
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 0;
|
|
44
|
+
left: -100%;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
background: linear-gradient(
|
|
48
|
+
90deg,
|
|
49
|
+
rgba(255, 255, 255, 0) 0%,
|
|
50
|
+
rgba(255, 255, 255, 0.3) 50%,
|
|
51
|
+
rgba(255, 255, 255, 0) 100%
|
|
52
|
+
);
|
|
53
|
+
animation: skeleton-shimmer-wave 2s ease-in-out infinite;
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
z-index: 1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&__shape {
|
|
59
|
+
fill: #e8e8e8;
|
|
60
|
+
cursor: default;
|
|
61
|
+
transition: none;
|
|
62
|
+
animation: skeleton-wave 1.5s ease-in-out infinite;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@keyframes skeleton-shimmer-wave {
|
|
67
|
+
0% {
|
|
68
|
+
left: -100%;
|
|
69
|
+
}
|
|
70
|
+
100% {
|
|
71
|
+
left: 100%;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="farm-brazil-map farm-brazil-map-skeleton" :class="`farm-brazil-map--${size}`">
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-10 -40 700 545">
|
|
4
|
+
<!-- All Brazil States -->
|
|
5
|
+
<g v-for="state in brazilStates" :key="state.uf">
|
|
6
|
+
<path :id="`skeleton_shape_${state.uf.toLowerCase()}`" class="farm-brazil-map-skeleton__shape"
|
|
7
|
+
:d="state.path" fill="#e8e8e8" stroke="#fff" stroke-width="1" />
|
|
8
|
+
</g>
|
|
9
|
+
</svg>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import { defineComponent, PropType } from 'vue';
|
|
15
|
+
|
|
16
|
+
import { BrazilMapSize } from './types';
|
|
17
|
+
|
|
18
|
+
import { brazilStates } from './data/brazilMapData';
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: 'farm-brazil-map-skeleton',
|
|
22
|
+
props: {
|
|
23
|
+
size: {
|
|
24
|
+
type: String as PropType<BrazilMapSize>,
|
|
25
|
+
default: 'md',
|
|
26
|
+
validator: (value: string) => ['sm', 'md', 'lg'].includes(value),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
setup() {
|
|
30
|
+
return {
|
|
31
|
+
brazilStates,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style lang="scss" scoped>
|
|
38
|
+
@import './BrazilMapSkeleton';
|
|
39
|
+
</style>
|
|
@@ -7,31 +7,28 @@ import { Meta } from '@storybook/blocks';
|
|
|
7
7
|
Many components have props that accepts strings as values instead of passa a numeric values.
|
|
8
8
|
Example:
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</code>
|
|
14
|
-
|
|
15
|
-
<br />
|
|
10
|
+
```html
|
|
11
|
+
<my-component some-prop="md" /> // "md" will be used as 12px in the CSS
|
|
12
|
+
```
|
|
16
13
|
|
|
17
14
|
<br />
|
|
18
15
|
|
|
19
16
|
## Gutter
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
- none: 0
|
|
19
|
+
- xs: 4px
|
|
20
|
+
- sm: 8px
|
|
21
|
+
- vuetify: 12px
|
|
22
|
+
- md: 16px
|
|
23
|
+
- lg: 24px
|
|
24
|
+
- xl: 32px
|
|
25
|
+
- default: 24px
|
|
29
26
|
|
|
30
27
|
## Font Size
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
- xs: 8px
|
|
30
|
+
- sm: 12px
|
|
31
|
+
- md: 14px
|
|
32
|
+
- default: 16px
|
|
33
|
+
- lg: 20px
|
|
34
|
+
- xl: 24px
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Meta } from '@storybook/blocks';
|
|
2
2
|
import imageFile from './assets/logo_farmtech.svg';
|
|
3
|
+
import packageJson from '../../package.json';
|
|
3
4
|
|
|
4
5
|
<Meta title="Introduction" />
|
|
5
6
|
|
|
6
7
|
<style>
|
|
7
|
-
|
|
8
|
+
{`
|
|
8
9
|
.subheading {
|
|
9
10
|
--mediumdark: '#999999';
|
|
10
11
|
font-weight: 900;
|
|
@@ -115,4 +116,4 @@ import imageFile from './assets/logo_farmtech.svg';
|
|
|
115
116
|
|
|
116
117
|
Here you can find the components from the Farmtech's Design System on the top of Vue 3.
|
|
117
118
|
|
|
118
|
-
|
|
119
|
+
Current version: {packageJson.version}
|