@farm-investimentos/front-mfe-components 15.10.2 → 15.12.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.
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12.5 6.9c1.78 0 2.44.85 2.5 2.1h2.21c-.07-1.72-1.12-3.3-3.21-3.81V3h-3v2.16c-.53.12-1.03.3-1.48.54l1.47 1.47c.41-.17.91-.27 1.51-.27zM5.33 4.06L4.06 5.33 7.5 8.77c0 2.08 1.56 3.21 3.91 3.91l3.51 3.51c-.34.48-1.05.91-2.42.91-2.06 0-2.87-.92-2.98-2.1h-2.2c.12 2.19 1.76 3.42 3.68 3.83V21h3v-2.15c.96-.18 1.82-.55 2.45-1.12l2.22 2.22 1.27-1.27L5.33 4.06z"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "15.10.2",
3
+ "version": "15.12.0",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -0,0 +1,161 @@
1
+ # Guia de Ícones Customizados
2
+
3
+ Esta pasta contém ícones SVG customizados que não estão disponíveis no Material Design Icons.
4
+
5
+ ## Estrutura de Pastas
6
+
7
+ ```
8
+ src/assets/icons/
9
+ ├── money-off/ # 📁 Pasta do ícone money-off
10
+ │ ├── money-off.scss # 🎨 Estilos do ícone
11
+ │ └── money-off.svg # 📄 Arquivo SVG
12
+ ├── custom-icons-list.ts # 📋 Lista de ícones disponíveis
13
+ ├── custom-icons.scss # 📦 Importa todos os estilos
14
+ ├── index.ts # 🔄 Exports centralizados
15
+ └── README.md # 📖 Este arquivo
16
+ ```
17
+
18
+ ## Como Adicionar um Novo Ícone Customizado
19
+
20
+ ### 1. Crie a pasta do ícone
21
+
22
+ Crie uma pasta com o nome do ícone (ex: `my-custom-icon/`)
23
+
24
+ ### 2. Adicione o arquivo SVG
25
+
26
+ Coloque seu arquivo SVG na pasta (ex: `my-custom-icon/my-custom-icon.svg`)
27
+
28
+ ### 3. Crie o arquivo SCSS
29
+
30
+ Crie o arquivo de estilos na pasta `my-custom-icon/my-custom-icon.scss`:
31
+
32
+ ```scss
33
+ // My Custom Icon - Custom SVG
34
+ // Descrição do que o ícone representa
35
+
36
+ .farm-icon {
37
+ &.custom-my-custom-icon:before {
38
+ content: '';
39
+ display: inline-block;
40
+ width: 1em;
41
+ height: 1em;
42
+ background-color: currentColor;
43
+ mask: url('../../assets/icons/my-custom-icon/my-custom-icon.svg') no-repeat center;
44
+ mask-size: contain;
45
+ -webkit-mask: url('../../assets/icons/my-custom-icon/my-custom-icon.svg') no-repeat center;
46
+ -webkit-mask-size: contain;
47
+ }
48
+ }
49
+ ```
50
+
51
+ ### 4. Adicione o import no arquivo principal
52
+
53
+ Adicione o import no arquivo `custom-icons.scss`:
54
+
55
+ ```scss
56
+ @import './my-custom-icon/my-custom-icon.scss';
57
+ ```
58
+
59
+ ### 5. Adicione à lista de ícones
60
+
61
+ Adicione seu ícone ao arquivo `custom-icons-list.ts`:
62
+
63
+ ```typescript
64
+ export const customIconsList = [
65
+ 'custom-money-off',
66
+ 'custom-my-custom-icon', // Adicione aqui
67
+ ];
68
+ ```
69
+
70
+ ### 6. Use o ícone nos seus componentes
71
+
72
+ Use o ícone com o prefixo `custom-`:
73
+
74
+ ```vue
75
+ <farm-icon>custom-my-custom-icon</farm-icon>
76
+ ```
77
+
78
+ ## CSS Mask vs Background Image
79
+
80
+ ### Background Image (Simples)
81
+
82
+ - Bom para ícones com cores estáticas
83
+ - A cor do ícone é fixa conforme o conteúdo do SVG
84
+
85
+ ```scss
86
+ &.custom-my-icon:before {
87
+ content: '';
88
+ display: inline-block;
89
+ width: 1em;
90
+ height: 1em;
91
+ background-image: url('../../assets/icons/my-icon/my-icon.svg');
92
+ background-size: contain;
93
+ background-repeat: no-repeat;
94
+ background-position: center;
95
+ }
96
+ ```
97
+
98
+ ### CSS Mask (Recomendado)
99
+
100
+ - Melhor para temas
101
+ - O ícone herda a cor do texto do componente
102
+ - Funciona melhor com o sistema de cores existente
103
+
104
+ ```scss
105
+ &.custom-my-icon:before {
106
+ content: '';
107
+ display: inline-block;
108
+ width: 1em;
109
+ height: 1em;
110
+ background-color: currentColor;
111
+ mask: url('../../assets/icons/my-icon/my-icon.svg') no-repeat center;
112
+ mask-size: contain;
113
+ -webkit-mask: url('../../assets/icons/my-icon/my-icon.svg') no-repeat center;
114
+ -webkit-mask-size: contain;
115
+ }
116
+ ```
117
+
118
+ ## Requisitos do SVG
119
+
120
+ - Use viewBox para escalabilidade
121
+ - Evite cores fixas (use `currentColor` ou remova fill/stroke)
122
+ - Mantenha o tamanho do arquivo pequeno
123
+ - Garanta acessibilidade com nomenclatura adequada
124
+
125
+ ## Exemplos
126
+
127
+ ```vue
128
+ <!-- Uso básico -->
129
+ <farm-icon>custom-money-off</farm-icon>
130
+
131
+ <!-- Com cor e tamanho -->
132
+ <farm-icon color="primary" size="lg">custom-money-off</farm-icon>
133
+
134
+ <!-- No IconBox -->
135
+ <farm-icon-box icon="custom-money-off" color="error" />
136
+ ```
137
+
138
+ ## Testando no Storybook
139
+
140
+ Após adicionar um novo ícone customizado:
141
+
142
+ 1. **Navegar**: Vá para "Display/Icons" → "List Of Custom Icons"
143
+ 2. **Buscar**: Use o campo de busca para encontrar seu ícone
144
+ 3. **Testar**: Verifique diferentes exemplos nas stories "Custom Icons" e "Money Off Icon"
145
+
146
+ ## Observações Importantes
147
+
148
+ - **Estrutura**: Cada ícone tem sua própria pasta com SVG e SCSS
149
+ - **Nomenclatura**: Sempre use o prefixo `custom-` para ícones customizados
150
+ - **Caminhos**: Use `../../assets/icons/pasta-do-icone/arquivo.svg` nos arquivos SCSS
151
+ - **Import Principal**: Adicione o import no `custom-icons.scss`
152
+ - **Atualizar Lista**: Não esqueça de adicionar novos ícones em `custom-icons-list.ts`
153
+ - **Testes**: Verifique no Storybook em "Display/Icons" → "List Of Custom Icons"
154
+
155
+ ## Vantagens desta Estrutura
156
+
157
+ - **Organização**: Cada ícone é autocontido em sua pasta
158
+ - **Escalabilidade**: Fácil adicionar novos ícones sem conflitos
159
+ - **Manutenibilidade**: Fácil encontrar e editar ícones específicos
160
+ - **Clareza**: Estrutura clara e previsível
161
+ - **Reutilização**: Ícones podem ser facilmente movidos ou compartilhados
@@ -0,0 +1,12 @@
1
+ // List of custom icons available in the system
2
+ // Add new custom icons to this list as they are created
3
+
4
+ export const customIconsList = [
5
+ 'custom-money-off',
6
+ // Add more custom icons here as they are created
7
+ // Example:
8
+ // 'custom-icon-name',
9
+ // 'custom-another-icon',
10
+ ];
11
+
12
+ export default customIconsList;
@@ -0,0 +1,9 @@
1
+ // Custom Icons Main SCSS
2
+ // This file imports all individual custom icon styles
3
+
4
+ // Import individual icon styles
5
+ @import './money-off/money-off.scss';
6
+
7
+ // Add new icon imports here as they are created
8
+ // @import './your-icon/your-icon.scss';
9
+ // @import './another-icon/another-icon.scss';
@@ -0,0 +1,7 @@
1
+ // Custom Icons exports
2
+ // Centralized export for all custom icons functionality
3
+
4
+ export { default as customIconsList, customIconsList as customIcons } from './custom-icons-list';
5
+
6
+ // Re-export individual items for convenience
7
+ export * from './custom-icons-list';
@@ -0,0 +1,28 @@
1
+ // Money Off Icon - Custom SVG
2
+ // Icon for representing disabled payments, free services, or budget limits
3
+
4
+ .farm-icon {
5
+ &.custom-money-off:before {
6
+ content: '';
7
+ display: inline-block;
8
+ width: 1em;
9
+ height: 1em;
10
+ background-color: currentColor;
11
+ mask: url('../../assets/icons/money-off/money-off.svg') no-repeat center;
12
+ mask-size: contain;
13
+ -webkit-mask: url('../../assets/icons/money-off/money-off.svg') no-repeat center;
14
+ -webkit-mask-size: contain;
15
+ }
16
+
17
+ // Alternative approach using background-image (simpler but less flexible for theming)
18
+ // &.custom-money-off:before {
19
+ // content: '';
20
+ // display: inline-block;
21
+ // width: 1em;
22
+ // height: 1em;
23
+ // background-image: url('../../assets/icons/money-off/money-off.svg');
24
+ // background-size: contain;
25
+ // background-repeat: no-repeat;
26
+ // background-position: center;
27
+ // }
28
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12.5 6.9c1.78 0 2.44.85 2.5 2.1h2.21c-.07-1.72-1.12-3.3-3.21-3.81V3h-3v2.16c-.53.12-1.03.3-1.48.54l1.47 1.47c.41-.17.91-.27 1.51-.27zM5.33 4.06L4.06 5.33 7.5 8.77c0 2.08 1.56 3.21 3.91 3.91l3.51 3.51c-.34.48-1.05.91-2.42.91-2.06 0-2.87-.92-2.98-2.1h-2.2c.12 2.19 1.76 3.42 3.68 3.83V21h3v-2.15c.96-.18 1.82-.55 2.45-1.12l2.22 2.22 1.27-1.27L5.33 4.06z"/></svg>
@@ -4,6 +4,7 @@ import sizes from '../../configurations/sizes';
4
4
  import baseThemeColors from '../../configurations/_theme-colors-base.scss';
5
5
  import bwThemeColors from '../../configurations/_theme-colors-bw.scss';
6
6
  import iconsList from './icons_list';
7
+ import { customIconsList } from '../../assets/icons';
7
8
  const colors = Object.keys(baseThemeColors);
8
9
 
9
10
  import('./Icons.stories.scss');
@@ -154,3 +155,43 @@ export const ListOfIcons = () => ({
154
155
  </div>
155
156
  </div>`,
156
157
  });
158
+
159
+ export const ListOfCustomIcons = () => ({
160
+ data() {
161
+ return {
162
+ customIconsList: [...customIconsList],
163
+ filteredCustomIcons: [...customIconsList],
164
+ filterKey: '',
165
+ };
166
+ },
167
+ watch: {
168
+ filterKey(newValue) {
169
+ this.filteredCustomIcons = [...this.customIconsList].filter(
170
+ item => item.toLowerCase().indexOf(newValue.toLowerCase()) >= 0
171
+ );
172
+ },
173
+ },
174
+ template: `<div>
175
+ <div style="margin-bottom: 20px; text-align: center;">
176
+ <h3>Custom Icons</h3>
177
+ <p style="font-size: 12px; color: #666;">Total: {{ customIconsList.length }} icon(s)</p>
178
+ </div>
179
+ <farm-textfield-v2 v-model="filterKey" placeholder="Search custom icons..." style="margin: 0 auto; width: 240px;" />
180
+ <div class="icons-container__list">
181
+ <div v-for="icon of filteredCustomIcons" :key="'custom_icon_' + icon">
182
+ <farm-icon color="primary">
183
+ {{ icon }}
184
+ </farm-icon>
185
+ <span>{{ icon }}</span>
186
+ </div>
187
+ </div>
188
+ <div v-if="filteredCustomIcons.length === 0 && filterKey" style="text-align: center; padding: 40px; color: #666;">
189
+ <p>No custom icons found for "{{ filterKey }}"</p>
190
+ <p style="font-size: 12px;">Try searching for: custom-money-off</p>
191
+ </div>
192
+ <div v-if="customIconsList.length === 0" style="text-align: center; padding: 40px; color: #666;">
193
+ <p>No custom icons available yet.</p>
194
+ <p>Add your custom SVG icons to <code>src/assets/icons/</code> and update the list.</p>
195
+ </div>
196
+ </div>`,
197
+ });
@@ -55,16 +55,18 @@ export default defineComponent({
55
55
 
56
56
  computed: {
57
57
  classes() {
58
- const obj = {};
58
+ const isCustomIcon = this.icon.startsWith('custom-');
59
+
59
60
  return {
60
61
  'farm-icon': true,
61
62
  ['farm-icon--' + this.color]: true,
62
- mdi: true,
63
- ['mdi-' + this.icon]: true,
63
+ // MDI classes for standard icons
64
+ ...(isCustomIcon ? {} : { mdi: true, ['mdi-' + this.icon]: true }),
65
+ // Custom icon class
66
+ ...(isCustomIcon ? { [this.icon]: true } : {}),
64
67
  'farm-icon--lighten': this.variation === 'lighten',
65
68
  'farm-icon--darken': this.variation === 'darken',
66
69
  ['farm-icon--black-' + this.variation]: this.color === 'black',
67
- ...obj,
68
70
  };
69
71
  },
70
72
  fontSize() {
@@ -95,4 +97,5 @@ export default defineComponent({
95
97
  </script>
96
98
  <style lang="scss" scoped>
97
99
  @import 'Icon.scss';
100
+ @import '../../assets/icons/custom-icons.scss';
98
101
  </style>
@@ -1041,7 +1041,7 @@ export default [
1041
1041
  'football',
1042
1042
  'football-australian',
1043
1043
  'football-helmet',
1044
- 'forklift',
1044
+ 'fotlift',
1045
1045
  'format-align-bottom',
1046
1046
  'format-align-center',
1047
1047
  'format-align-justify',
@@ -2555,4 +2555,5 @@ export default [
2555
2555
  'youtube-tv',
2556
2556
  'zip-box',
2557
2557
  'zip-disk',
2558
+ 'money-off',
2558
2559
  ];
@@ -1,6 +1,9 @@
1
- @import '../../configurations/theme-colors';
2
1
  @import '../../configurations/variables';
3
2
 
3
+ $arrow-size: 6px;
4
+ $tooltip-color: #333333;
5
+ $arrow-margin: 12px;
6
+
4
7
  .farm-tooltip {
5
8
  display: inline-block;
6
9
  position: relative;
@@ -11,31 +14,110 @@
11
14
  }
12
15
 
13
16
  .farm-tooltip__popup {
14
- background-color: rgba(themeColor('primary'), 0.95);
15
- @each $color in $theme-colors-list {
16
- &.farm-tooltip--#{$color} {
17
- background-color: rgba(themeColor($color), 0.95);
18
- }
19
- }
20
- }
21
-
22
- .farm-tooltip__popup {
17
+ background-color: $tooltip-color;
23
18
  visibility: hidden;
24
19
  opacity: 0;
25
20
  transition: visibility 0.3s linear, opacity 0.3s linear;
26
21
  position: absolute;
27
22
  width: 160px;
28
- contain: content;
29
- color: white;
23
+ color: #f5f5f5;
30
24
  border-radius: 5px;
31
25
  font-family: 'Manrope', sans-serif !important;
32
26
  font-size: 12px;
33
27
  font-weight: 500px;
34
- padding: 8px 12px;
28
+ padding: 16px;
35
29
  display: block;
30
+ z-index: 9999;
31
+
32
+ &--fluid {
33
+ width: auto;
34
+ min-width: 160px;
35
+ max-width: 300px;
36
+ }
36
37
 
37
38
  &--visible {
38
39
  opacity: 1;
39
40
  visibility: visible;
40
41
  }
42
+
43
+ .farm-tooltip__header {
44
+ display: flex;
45
+ justify-content: space-between;
46
+ align-items: center;
47
+ margin-bottom: 8px;
48
+ }
49
+
50
+ .farm-tooltip__title {
51
+ font-weight: 600;
52
+ font-size: 13px;
53
+ margin-right: 16px;
54
+ }
55
+
56
+ .farm-tooltip__content {
57
+ font-weight: 500;
58
+ }
59
+
60
+ .farm-tooltip__arrow {
61
+ position: absolute;
62
+ width: 0;
63
+ height: 0;
64
+ border-style: solid;
65
+ z-index: 10000;
66
+ }
67
+
68
+ // Top positions - arrow at bottom
69
+ &--top-center .farm-tooltip__arrow,
70
+ &--top-left .farm-tooltip__arrow,
71
+ &--top-right .farm-tooltip__arrow {
72
+ border-width: $arrow-size $arrow-size 0 $arrow-size;
73
+ border-color: $tooltip-color transparent transparent transparent;
74
+ bottom: -$arrow-size;
75
+ z-index: 99999;
76
+ }
77
+
78
+ // Bottom positions - arrow at top
79
+ &--bottom-center .farm-tooltip__arrow,
80
+ &--bottom-left .farm-tooltip__arrow,
81
+ &--bottom-right .farm-tooltip__arrow {
82
+ border-width: 0 $arrow-size $arrow-size $arrow-size;
83
+ border-color: transparent transparent $tooltip-color transparent;
84
+ top: -$arrow-size;
85
+ z-index: 99999;
86
+ }
87
+
88
+ // Left alignment - arrow at left
89
+ &--top-left .farm-tooltip__arrow,
90
+ &--bottom-left .farm-tooltip__arrow {
91
+ left: $arrow-margin;
92
+ }
93
+
94
+ // Right alignment - arrow at right
95
+ &--top-right .farm-tooltip__arrow,
96
+ &--bottom-right .farm-tooltip__arrow {
97
+ right: $arrow-margin;
98
+ }
99
+
100
+ // Center alignment - arrow at center
101
+ &--top-center .farm-tooltip__arrow,
102
+ &--bottom-center .farm-tooltip__arrow {
103
+ left: 50%;
104
+ transform: translateX(-50%);
105
+ }
106
+
107
+ .farm-tooltip__close {
108
+ position: relative;
109
+ width: 16px;
110
+ height: 16px;
111
+ line-height: 16px;
112
+ text-align: center;
113
+ cursor: pointer;
114
+ font-size: 16px;
115
+ color: #f5f5f5;
116
+ }
117
+
118
+ &:not(.farm-tooltip__popup--has-title) .farm-tooltip__close {
119
+ position: absolute;
120
+ top: 8px;
121
+ right: 8px;
122
+ }
41
123
  }