@abqm-ds/icons 1.0.3 → 1.0.4
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +6 -0
- package/README.md +133 -141
- package/package.json +1 -1
- package/scripts/move-icons.js +84 -84
- package/src/components/AwardFillIcon.tsx +23 -23
- package/src/components/BroadcastIcon.tsx +25 -25
- package/src/components/CaretDownIcon.tsx +18 -18
- package/src/components/CaretRightIcon.tsx +18 -18
- package/src/components/FacebookIcon.tsx +18 -18
- package/src/components/FilterIcon.tsx +18 -18
- package/src/components/HorseIcon.tsx +16 -16
- package/src/components/InstagramIcon.tsx +18 -18
- package/src/components/ListOlIcon.tsx +25 -25
- package/src/components/LogoSeqmIcon.tsx +79 -79
- package/src/components/LogoSeqmMobileIcon.tsx +35 -35
- package/src/components/MenuIcon.tsx +20 -20
- package/src/components/PencilSquareIcon.tsx +25 -25
- package/src/components/PersonCircleIcon.tsx +26 -26
- package/src/components/PlusIcon.tsx +18 -18
- package/src/components/PrinterIcon.tsx +18 -18
- package/src/components/SearchIcon.tsx +25 -25
- package/src/components/StarIcon.tsx +18 -18
- package/src/components/XIcon.tsx +18 -18
- package/src/components/YoutubeIcon.tsx +18 -18
- package/src/icons/AwardFill.svg +4 -4
- package/src/icons/Broadcast.svg +10 -10
- package/src/icons/CaretDown.svg +3 -3
- package/src/icons/CaretRight.svg +3 -3
- package/src/icons/ListOl.svg +4 -4
- package/src/icons/LogoSeqm.svg +44 -44
- package/src/icons/LogoSeqmMobile.svg +10 -10
- package/src/icons/Menu.svg +3 -3
- package/src/icons/PencilSquare.svg +4 -4
- package/src/icons/PersonCircle.svg +11 -11
- package/src/icons/Search.svg +10 -10
- package/src/icons/Star.svg +3 -3
- package/src/icons/X.svg +3 -3
- package/src/icons/{Facebook.svg → facebook.svg} +3 -3
- package/src/icons/{Filter.svg → filter.svg} +3 -3
- package/src/icons/{Horse.svg → horse.svg} +3 -3
- package/src/icons/{Instagram.svg → instagram.svg} +3 -3
- package/src/icons/{Plus.svg → plus.svg} +3 -3
- package/src/icons/{Printer.svg → printer.svg} +3 -3
- package/src/icons/{Youtube.svg → youtube.svg} +3 -3
- package/src/index.ts +30 -30
- package/tsconfig.json +20 -20
- package/tsup.config.ts +9 -9
- package/.turbo/turbo-clean.log +0 -4
- package/src/_temp/AwardFill.tsx +0 -24
- package/src/_temp/Broadcast.tsx +0 -26
- package/src/_temp/CaretDown.tsx +0 -19
- package/src/_temp/CaretRight.tsx +0 -19
- package/src/_temp/Facebook.tsx +0 -19
- package/src/_temp/Filter.tsx +0 -19
- package/src/_temp/Horse.tsx +0 -17
- package/src/_temp/Instagram.tsx +0 -19
- package/src/_temp/ListOl.tsx +0 -26
- package/src/_temp/LogoSeqm.tsx +0 -80
- package/src/_temp/LogoSeqmMobile.tsx +0 -36
- package/src/_temp/Menu.tsx +0 -21
- package/src/_temp/PencilSquare.tsx +0 -26
- package/src/_temp/PersonCircle.tsx +0 -27
- package/src/_temp/Plus.tsx +0 -19
- package/src/_temp/Printer.tsx +0 -19
- package/src/_temp/Search.tsx +0 -26
- package/src/_temp/Star.tsx +0 -19
- package/src/_temp/X.tsx +0 -19
- package/src/_temp/Youtube.tsx +0 -19
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
> @abqm-ds/icons@1.0.
|
|
2
|
+
> @abqm-ds/icons@1.0.4 build
|
|
3
3
|
> tsup --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v8.
|
|
8
|
-
[34mCLI[39m Using tsup config:
|
|
7
|
+
[34mCLI[39m tsup v8.5.0
|
|
8
|
+
[34mCLI[39m Using tsup config: /home/runner/work/design-system/design-system/packages/icons/tsup.config.ts
|
|
9
9
|
[34mCLI[39m Target: esnext
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[32mCJS[39m [1mdist
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
15
|
-
[32mESM[39m [1mdist
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m126.77 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 67ms
|
|
15
|
+
[32mESM[39m [1mdist/index.js [22m[32m125.84 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 68ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist
|
|
20
|
-
[32mDTS[39m [1mdist
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 2353ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.35 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m2.35 KB[39m
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,141 +1,133 @@
|
|
|
1
|
-
# @abqm-ds/icons
|
|
2
|
-
|
|
3
|
-
> Biblioteca de ícones em React baseada em SVGs personalizados da ABQM.
|
|
4
|
-
|
|
5
|
-
Esta biblioteca fornece ícones SVG como componentes React, permitindo
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 📦 Instalação
|
|
10
|
-
|
|
11
|
-
No seu projeto React (com suporte a pacotes do monorepo):
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
yarn add @abqm-ds/icons
|
|
15
|
-
# ou
|
|
16
|
-
npm install @abqm-ds/icons
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
1. Adicione os arquivos **SVG** que deseja converter na pasta src/icons
|
|
24
|
-
|
|
25
|
-
>
|
|
26
|
-
>
|
|
27
|
-
> ❌ caretright.svg
|
|
28
|
-
>
|
|
29
|
-
> ✅ CaretRight.svg
|
|
30
|
-
|
|
31
|
-
2. Em seguida, execute o comando abaixo no terminal:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npm run generate:icons
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
3. O processo de geração segue estas etapas:
|
|
38
|
-
- Os ícones são convertidos e salvos temporariamente na pasta `_temp`.
|
|
39
|
-
- Em seguida, são organizados e movidos para a pasta `
|
|
40
|
-
|
|
41
|
-
> 💡 Esse processo evita que todos os ícones existentes sejam modificados a cada nova adição. O script verifica se um ícone já existe e somente cria ou atualiza os que são realmente novos ou alterados.
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## 💡 Como Usar
|
|
46
|
-
|
|
47
|
-
Importe o componente do ícone desejado diretamente:
|
|
48
|
-
|
|
49
|
-
```tsx
|
|
50
|
-
import {
|
|
51
|
-
|
|
52
|
-
export function Example() {
|
|
53
|
-
return (
|
|
54
|
-
<div style={ display: 'flex', gap: 16 }>
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
<
|
|
58
|
-
<
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## 🎯 Props Aceitas
|
|
67
|
-
|
|
68
|
-
Todos os ícones exportados são componentes React SVG e aceitam todas as propriedades nativas de SVG:
|
|
69
|
-
|
|
70
|
-
| Prop | Tipo | Exemplo |
|
|
71
|
-
| ----------- | ----------------------------- | -------------------------- |
|
|
72
|
-
| `width` | `number \| string` | `24`, `"1em"` |
|
|
73
|
-
| `height` | `number \| string` | `24`, `"1.5rem"` |
|
|
74
|
-
| `fill` | `string` (cor em HEX ou nome) | `"#333"`, `"currentColor"` |
|
|
75
|
-
| `className` | `string` | `"icon-large"` |
|
|
76
|
-
| `style` | `React.CSSProperties` | `{ marginRight: 8 }` |
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## 🛠 Desenvolvimento
|
|
81
|
-
|
|
82
|
-
### Gerar componentes a partir de SVGs
|
|
83
|
-
|
|
84
|
-
1. Coloque seus arquivos SVG em `src/icons/`.
|
|
85
|
-
2. Rode o comando:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
npm run generate
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Isso irá converter todos os SVGs para componentes React TypeScript (`.tsx`) e salvá-los em `src/components/`.
|
|
92
|
-
|
|
93
|
-
### Compilar a lib
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
npm run build
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
Esse comando usa o `tsup` para gerar a pasta `dist/` com módulos `esm`, `cjs` e os arquivos `.d.ts`.
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## 📁 Estrutura
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
packages/icons/
|
|
107
|
-
├── scripts/ # Scripts de desenvolvimento
|
|
108
|
-
├── src/
|
|
109
|
-
│ ├── icons/ # SVGs originais
|
|
110
|
-
│ ├── components/ # Componentes React (.tsx)
|
|
111
|
-
│ ├── _temp/ #
|
|
112
|
-
│ └── index.ts # Exportações centralizadas
|
|
113
|
-
├── tsconfig.json
|
|
114
|
-
├── package.json
|
|
115
|
-
└── README.md
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
##
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
3. Adicione ao a exportação em `src/index.ts`
|
|
135
|
-
4. Teste no seu projeto local
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## 📃 Licença
|
|
140
|
-
|
|
141
|
-
Este projeto é privado e pertence à ABQM. Uso externo é restrito.
|
|
1
|
+
# @abqm-ds/icons
|
|
2
|
+
|
|
3
|
+
> Biblioteca de ícones em React baseada em SVGs personalizados da ABQM.
|
|
4
|
+
|
|
5
|
+
Esta biblioteca fornece ícones SVG como componentes React, permitindo uso simples, estilização via props e integração fluida com projetos em React ou design systems internos.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📦 Instalação
|
|
10
|
+
|
|
11
|
+
No seu projeto React (com suporte a pacotes do monorepo):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
yarn add @abqm-ds/icons
|
|
15
|
+
# ou
|
|
16
|
+
npm install @abqm-ds/icons
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## ⚙️ Como Funciona
|
|
22
|
+
|
|
23
|
+
1. Adicione os arquivos **SVG** que deseja converter na pasta `src/icons/`:
|
|
24
|
+
|
|
25
|
+
> **Atenção:** A nomenclatura dos ícones deve ser capitalizada, ex:
|
|
26
|
+
>
|
|
27
|
+
> ❌ caretright.svg
|
|
28
|
+
>
|
|
29
|
+
> ✅ CaretRight.svg
|
|
30
|
+
|
|
31
|
+
2. Em seguida, execute o comando abaixo no terminal:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm run generate:icons
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
3. O processo de geração segue estas etapas:
|
|
38
|
+
- Os ícones são convertidos e salvos temporariamente na pasta `_temp`.
|
|
39
|
+
- Em seguida, são organizados e movidos para a pasta `components`.
|
|
40
|
+
|
|
41
|
+
> 💡 Esse processo evita que todos os ícones existentes sejam modificados a cada nova adição. O script verifica se um ícone já existe e somente cria ou atualiza os que são realmente novos ou alterados.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 💡 Como Usar
|
|
46
|
+
|
|
47
|
+
Importe o componente do ícone desejado diretamente:
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { FacebookIcon, InstagramIcon, YoutubeIcon, HorseIcon } from '@abqm-ds/icons';
|
|
51
|
+
|
|
52
|
+
export function Example() {
|
|
53
|
+
return (
|
|
54
|
+
<div style={{ display: 'flex', gap: 16 }}>
|
|
55
|
+
<FacebookIcon width={24} height={24} fill="#1877F2" />
|
|
56
|
+
<InstagramIcon width={24} height={24} fill="#E1306C" />
|
|
57
|
+
<YoutubeIcon width={24} height={24} fill="#FF0000" />
|
|
58
|
+
<HorseIcon width={32} height={32} />
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 🎯 Props Aceitas
|
|
67
|
+
|
|
68
|
+
Todos os ícones exportados são componentes React SVG e aceitam todas as propriedades nativas de SVG:
|
|
69
|
+
|
|
70
|
+
| Prop | Tipo | Exemplo |
|
|
71
|
+
| ----------- | ----------------------------- | -------------------------- |
|
|
72
|
+
| `width` | `number \| string` | `24`, `"1em"` |
|
|
73
|
+
| `height` | `number \| string` | `24`, `"1.5rem"` |
|
|
74
|
+
| `fill` | `string` (cor em HEX ou nome) | `"#333"`, `"currentColor"` |
|
|
75
|
+
| `className` | `string` | `"icon-large"` |
|
|
76
|
+
| `style` | `React.CSSProperties` | `{ marginRight: 8 }` |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 🛠 Desenvolvimento
|
|
81
|
+
|
|
82
|
+
### Gerar componentes a partir de SVGs
|
|
83
|
+
|
|
84
|
+
1. Coloque seus arquivos SVG em `src/icons/`.
|
|
85
|
+
2. Rode o comando:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm run generate
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Isso irá converter todos os SVGs para componentes React TypeScript (`.tsx`) e salvá-los em `src/components/`.
|
|
92
|
+
|
|
93
|
+
### Compilar a lib
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npm run build
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Esse comando usa o `tsup` para gerar a pasta `dist/` com módulos `esm`, `cjs` e os arquivos `.d.ts`.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 📁 Estrutura
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
packages/icons/
|
|
107
|
+
├── scripts/ # Scripts de desenvolvimento
|
|
108
|
+
├── src/
|
|
109
|
+
│ ├── icons/ # SVGs originais
|
|
110
|
+
│ ├── components/ # Componentes React (.tsx)
|
|
111
|
+
│ ├── _temp/ # SVGs temporários
|
|
112
|
+
│ └── index.ts # Exportações centralizadas
|
|
113
|
+
├── tsconfig.json
|
|
114
|
+
├── package.json
|
|
115
|
+
└── README.md
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 🤝 Contribuição
|
|
121
|
+
|
|
122
|
+
Para adicionar novos ícones:
|
|
123
|
+
|
|
124
|
+
1. Adicione o SVG em `src/icons/`
|
|
125
|
+
2. Rode `npm run generate`
|
|
126
|
+
3. Adicione à exportação em `src/index.ts`
|
|
127
|
+
4. Teste no seu projeto local
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 📃 Licença
|
|
132
|
+
|
|
133
|
+
Este projeto é privado e pertence à ABQM. Uso externo é restrito.
|
package/package.json
CHANGED
package/scripts/move-icons.js
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
|
|
5
|
-
// Corrigir __dirname em ESM
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
|
|
9
|
-
// Caminhos
|
|
10
|
-
const tempDir = path.resolve(__dirname, '../src/_temp');
|
|
11
|
-
const finalDir = path.resolve(__dirname, '../src/components');
|
|
12
|
-
const indexFile = path.resolve(__dirname, '../src/index.ts');
|
|
13
|
-
|
|
14
|
-
// Verifica se a pasta temporária existe
|
|
15
|
-
if (!fs.existsSync(tempDir)) {
|
|
16
|
-
console.log('⚠️ Pasta src/_temp não existe. Rode "npm run generate" antes.');
|
|
17
|
-
process.exit(0);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Cria a pasta final se necessário
|
|
21
|
-
if (!fs.existsSync(finalDir)) {
|
|
22
|
-
fs.mkdirSync(finalDir, { recursive: true });
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const tempFiles = fs.readdirSync(tempDir).filter((f) => f.endsWith('.tsx'));
|
|
26
|
-
const exports = [];
|
|
27
|
-
|
|
28
|
-
for (const file of tempFiles) {
|
|
29
|
-
const baseName = path.basename(file, '.tsx');
|
|
30
|
-
const cleanedName = baseName.replace(/^svg/i, ''); // Remove prefixo svg
|
|
31
|
-
const componentName = `${cleanedName}Icon`;
|
|
32
|
-
|
|
33
|
-
const fromPath = path.join(tempDir, file);
|
|
34
|
-
const toPath = path.join(finalDir, `${componentName}.tsx`);
|
|
35
|
-
|
|
36
|
-
if (fs.existsSync(toPath)) {
|
|
37
|
-
console.log(`⏩ Ignorado (já existe): ${componentName}`);
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Lê e modifica o conteúdo
|
|
42
|
-
let fileContent = fs.readFileSync(fromPath, 'utf-8');
|
|
43
|
-
|
|
44
|
-
// Remove a linha de importação do React
|
|
45
|
-
fileContent = fileContent.replace(
|
|
46
|
-
/import\s+\*\s+as\s+React\s+from\s+['"]react['"];?\n?/g,
|
|
47
|
-
''
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
// Renomeia o nome do componente
|
|
51
|
-
const regex = new RegExp(`const\\s+Svg${cleanedName}\\b`, 'g');
|
|
52
|
-
fileContent = fileContent.replace(regex, `const ${componentName}`);
|
|
53
|
-
|
|
54
|
-
// Atualiza o export default
|
|
55
|
-
fileContent = fileContent.replace(
|
|
56
|
-
new RegExp(`export\\s+default\\s+Svg${cleanedName}\\b`, 'g'),
|
|
57
|
-
`export default ${componentName}`
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
// Escreve novo arquivo e remove o antigo
|
|
61
|
-
fs.writeFileSync(toPath, fileContent);
|
|
62
|
-
fs.unlinkSync(fromPath);
|
|
63
|
-
|
|
64
|
-
console.log(`✅ Movido e renomeado: ${componentName}`);
|
|
65
|
-
exports.push(
|
|
66
|
-
`export { default as ${componentName} } from './components/${componentName}';`
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Atualiza index.ts
|
|
71
|
-
if (exports.length > 0) {
|
|
72
|
-
let indexContent = '';
|
|
73
|
-
if (fs.existsSync(indexFile)) {
|
|
74
|
-
indexContent = fs.readFileSync(indexFile, 'utf-8');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const newExports = exports.filter((e) => !indexContent.includes(e));
|
|
78
|
-
if (newExports.length > 0) {
|
|
79
|
-
fs.appendFileSync(indexFile, '\n' + newExports.join('\n') + '\n');
|
|
80
|
-
console.log('📦 index.ts atualizado');
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
console.log('✅ Nenhum novo componente a mover');
|
|
84
|
-
}
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
|
|
5
|
+
// Corrigir __dirname em ESM
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
// Caminhos
|
|
10
|
+
const tempDir = path.resolve(__dirname, '../src/_temp');
|
|
11
|
+
const finalDir = path.resolve(__dirname, '../src/components');
|
|
12
|
+
const indexFile = path.resolve(__dirname, '../src/index.ts');
|
|
13
|
+
|
|
14
|
+
// Verifica se a pasta temporária existe
|
|
15
|
+
if (!fs.existsSync(tempDir)) {
|
|
16
|
+
console.log('⚠️ Pasta src/_temp não existe. Rode "npm run generate" antes.');
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Cria a pasta final se necessário
|
|
21
|
+
if (!fs.existsSync(finalDir)) {
|
|
22
|
+
fs.mkdirSync(finalDir, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const tempFiles = fs.readdirSync(tempDir).filter((f) => f.endsWith('.tsx'));
|
|
26
|
+
const exports = [];
|
|
27
|
+
|
|
28
|
+
for (const file of tempFiles) {
|
|
29
|
+
const baseName = path.basename(file, '.tsx');
|
|
30
|
+
const cleanedName = baseName.replace(/^svg/i, ''); // Remove prefixo svg
|
|
31
|
+
const componentName = `${cleanedName}Icon`;
|
|
32
|
+
|
|
33
|
+
const fromPath = path.join(tempDir, file);
|
|
34
|
+
const toPath = path.join(finalDir, `${componentName}.tsx`);
|
|
35
|
+
|
|
36
|
+
if (fs.existsSync(toPath)) {
|
|
37
|
+
console.log(`⏩ Ignorado (já existe): ${componentName}`);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Lê e modifica o conteúdo
|
|
42
|
+
let fileContent = fs.readFileSync(fromPath, 'utf-8');
|
|
43
|
+
|
|
44
|
+
// Remove a linha de importação do React
|
|
45
|
+
fileContent = fileContent.replace(
|
|
46
|
+
/import\s+\*\s+as\s+React\s+from\s+['"]react['"];?\n?/g,
|
|
47
|
+
''
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// Renomeia o nome do componente
|
|
51
|
+
const regex = new RegExp(`const\\s+Svg${cleanedName}\\b`, 'g');
|
|
52
|
+
fileContent = fileContent.replace(regex, `const ${componentName}`);
|
|
53
|
+
|
|
54
|
+
// Atualiza o export default
|
|
55
|
+
fileContent = fileContent.replace(
|
|
56
|
+
new RegExp(`export\\s+default\\s+Svg${cleanedName}\\b`, 'g'),
|
|
57
|
+
`export default ${componentName}`
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
// Escreve novo arquivo e remove o antigo
|
|
61
|
+
fs.writeFileSync(toPath, fileContent);
|
|
62
|
+
fs.unlinkSync(fromPath);
|
|
63
|
+
|
|
64
|
+
console.log(`✅ Movido e renomeado: ${componentName}`);
|
|
65
|
+
exports.push(
|
|
66
|
+
`export { default as ${componentName} } from './components/${componentName}';`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Atualiza index.ts
|
|
71
|
+
if (exports.length > 0) {
|
|
72
|
+
let indexContent = '';
|
|
73
|
+
if (fs.existsSync(indexFile)) {
|
|
74
|
+
indexContent = fs.readFileSync(indexFile, 'utf-8');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const newExports = exports.filter((e) => !indexContent.includes(e));
|
|
78
|
+
if (newExports.length > 0) {
|
|
79
|
+
fs.appendFileSync(indexFile, '\n' + newExports.join('\n') + '\n');
|
|
80
|
+
console.log('📦 index.ts atualizado');
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
console.log('✅ Nenhum novo componente a mover');
|
|
84
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import type { SVGProps } from 'react';
|
|
2
|
-
const AwardFillIcon = (props: SVGProps<SVGSVGElement>) => (
|
|
3
|
-
<svg
|
|
4
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
-
width="1em"
|
|
6
|
-
height="1em"
|
|
7
|
-
fill="none"
|
|
8
|
-
viewBox="0 0 16 16"
|
|
9
|
-
{...props}
|
|
10
|
-
>
|
|
11
|
-
<path
|
|
12
|
-
fill="#001007"
|
|
13
|
-
fillOpacity={0.5}
|
|
14
|
-
d="m8 0 1.669.864 1.858.282.842 1.68 1.337 1.32L13.4 6l.306 1.854-1.337 1.32-.842 1.68-1.858.282L8 12l-1.669-.864-1.858-.282-.842-1.68-1.337-1.32L2.6 6l-.306-1.854 1.337-1.32.842-1.68L6.331.864z"
|
|
15
|
-
/>
|
|
16
|
-
<path
|
|
17
|
-
fill="#001007"
|
|
18
|
-
fillOpacity={0.5}
|
|
19
|
-
d="M4 11.794V16l4-1 4 1v-4.206l-2.018.306L8 13.126 6.018 12.1z"
|
|
20
|
-
/>
|
|
21
|
-
</svg>
|
|
22
|
-
);
|
|
23
|
-
export default AwardFillIcon;
|
|
1
|
+
import type { SVGProps } from 'react';
|
|
2
|
+
const AwardFillIcon = (props: SVGProps<SVGSVGElement>) => (
|
|
3
|
+
<svg
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
width="1em"
|
|
6
|
+
height="1em"
|
|
7
|
+
fill="none"
|
|
8
|
+
viewBox="0 0 16 16"
|
|
9
|
+
{...props}
|
|
10
|
+
>
|
|
11
|
+
<path
|
|
12
|
+
fill="#001007"
|
|
13
|
+
fillOpacity={0.5}
|
|
14
|
+
d="m8 0 1.669.864 1.858.282.842 1.68 1.337 1.32L13.4 6l.306 1.854-1.337 1.32-.842 1.68-1.858.282L8 12l-1.669-.864-1.858-.282-.842-1.68-1.337-1.32L2.6 6l-.306-1.854 1.337-1.32.842-1.68L6.331.864z"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
fill="#001007"
|
|
18
|
+
fillOpacity={0.5}
|
|
19
|
+
d="M4 11.794V16l4-1 4 1v-4.206l-2.018.306L8 13.126 6.018 12.1z"
|
|
20
|
+
/>
|
|
21
|
+
</svg>
|
|
22
|
+
);
|
|
23
|
+
export default AwardFillIcon;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type { SVGProps } from 'react';
|
|
2
|
-
const BroadcastIcon = (props: SVGProps<SVGSVGElement>) => (
|
|
3
|
-
<svg
|
|
4
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
-
width="1em"
|
|
6
|
-
height="1em"
|
|
7
|
-
fill="none"
|
|
8
|
-
viewBox="0 0 16 16"
|
|
9
|
-
{...props}
|
|
10
|
-
>
|
|
11
|
-
<g clipPath="url(#Broadcast_svg__a)">
|
|
12
|
-
<path
|
|
13
|
-
fill="#001007"
|
|
14
|
-
fillOpacity={0.5}
|
|
15
|
-
d="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.501.501 0 0 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 1 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM10 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0"
|
|
16
|
-
/>
|
|
17
|
-
</g>
|
|
18
|
-
<defs>
|
|
19
|
-
<clipPath id="Broadcast_svg__a">
|
|
20
|
-
<path fill="#fff" d="M0 0h16v16H0z" />
|
|
21
|
-
</clipPath>
|
|
22
|
-
</defs>
|
|
23
|
-
</svg>
|
|
24
|
-
);
|
|
25
|
-
export default BroadcastIcon;
|
|
1
|
+
import type { SVGProps } from 'react';
|
|
2
|
+
const BroadcastIcon = (props: SVGProps<SVGSVGElement>) => (
|
|
3
|
+
<svg
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
width="1em"
|
|
6
|
+
height="1em"
|
|
7
|
+
fill="none"
|
|
8
|
+
viewBox="0 0 16 16"
|
|
9
|
+
{...props}
|
|
10
|
+
>
|
|
11
|
+
<g clipPath="url(#Broadcast_svg__a)">
|
|
12
|
+
<path
|
|
13
|
+
fill="#001007"
|
|
14
|
+
fillOpacity={0.5}
|
|
15
|
+
d="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.501.501 0 0 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 1 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM10 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0"
|
|
16
|
+
/>
|
|
17
|
+
</g>
|
|
18
|
+
<defs>
|
|
19
|
+
<clipPath id="Broadcast_svg__a">
|
|
20
|
+
<path fill="#fff" d="M0 0h16v16H0z" />
|
|
21
|
+
</clipPath>
|
|
22
|
+
</defs>
|
|
23
|
+
</svg>
|
|
24
|
+
);
|
|
25
|
+
export default BroadcastIcon;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { SVGProps } from 'react';
|
|
2
|
-
const CaretDownIcon = (props: SVGProps<SVGSVGElement>) => (
|
|
3
|
-
<svg
|
|
4
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
-
width="1em"
|
|
6
|
-
height="1em"
|
|
7
|
-
fill="none"
|
|
8
|
-
viewBox="0 0 10 6"
|
|
9
|
-
{...props}
|
|
10
|
-
>
|
|
11
|
-
<path
|
|
12
|
-
fill="#fff"
|
|
13
|
-
fillOpacity={0.5}
|
|
14
|
-
d="M4.435 5.355.838 1.244A.75.75 0 0 1 1.403 0h7.194a.75.75 0 0 1 .565 1.244l-3.597 4.11a.75.75 0 0 1-1.13 0z"
|
|
15
|
-
/>
|
|
16
|
-
</svg>
|
|
17
|
-
);
|
|
18
|
-
export default CaretDownIcon;
|
|
1
|
+
import type { SVGProps } from 'react';
|
|
2
|
+
const CaretDownIcon = (props: SVGProps<SVGSVGElement>) => (
|
|
3
|
+
<svg
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
width="1em"
|
|
6
|
+
height="1em"
|
|
7
|
+
fill="none"
|
|
8
|
+
viewBox="0 0 10 6"
|
|
9
|
+
{...props}
|
|
10
|
+
>
|
|
11
|
+
<path
|
|
12
|
+
fill="#fff"
|
|
13
|
+
fillOpacity={0.5}
|
|
14
|
+
d="M4.435 5.355.838 1.244A.75.75 0 0 1 1.403 0h7.194a.75.75 0 0 1 .565 1.244l-3.597 4.11a.75.75 0 0 1-1.13 0z"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
export default CaretDownIcon;
|