blockforce-design-system 2.0.2 → 2.0.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.
@@ -0,0 +1,231 @@
1
+ # Tokens do Blockforce Design System 2.0.2
2
+
3
+ Gerado de `src/theme` e `tokens/*.tokens.json`. Use sempre o token, nunca o valor solto.
4
+
5
+ ## No React (`theme`)
6
+
7
+ | Token | Valor | Descrição |
8
+ |---|---|---|
9
+ | `theme.colors.primary` | `#6633CC` | Roxo da marca Blockforce. |
10
+ | `theme.colors.secondary` | `#00CC99` | Teal da marca Blockforce. |
11
+ | `theme.colors.brand.gradient` | `linear-gradient(45deg, #6633CC 0%, #00CC99 100%)` | Gradiente da marca: o único, sempre no ângulo da logo (45°, roxo embaixo à esquerda, teal em cima à direita). Todo componente com gradiente usa este token; não criar outro ângulo nem outras cores. |
12
+ | `theme.colors.border.focus` | `#6633CC` | Roxo de foco, para foco de marca em peças novas e no tema do cliente. Campos usam a própria cor de borda no foco. |
13
+ | `theme.colors.white` | `#FFFFFF` | Branco. |
14
+ | `theme.colors.interactive` | `#1779B2` | Links e ações textuais. |
15
+ | `theme.colors.state.success` | `#27AE60` | Sucesso, aprovado, concluído. Ícones, bordas e preenchimentos. |
16
+ | `theme.colors.state.warning` | `#F79009` | Alerta, pendente, atenção. Ícones, bordas e preenchimentos. |
17
+ | `theme.colors.state.error` | `#EB5757` | Erro, reprovado, ação destrutiva. |
18
+ | `theme.colors.state.info` | `#2F80ED` | Informação neutra. |
19
+ | `theme.colors.stateSubtle.success` | `#ECFDF3` | Fundo de etiqueta ou aviso de sucesso. |
20
+ | `theme.colors.stateSubtle.warning` | `#FEF3E7` | Fundo de etiqueta ou aviso de alerta. |
21
+ | `theme.colors.stateSubtle.error` | `#FDECEA` | Fundo de etiqueta ou aviso de erro. |
22
+ | `theme.colors.stateSubtle.info` | `#E8F3FA` | Fundo de etiqueta ou aviso de informação. |
23
+ | `theme.colors.stateText.success` | `#067647` | Texto de sucesso sobre fundo claro (contraste AA). |
24
+ | `theme.colors.stateText.warning` | `#DC6803` | Texto de alerta. Contraste 3.5:1 no branco, abaixo do AA para texto pequeno: use em semibold ou maior, sempre junto de ícone. Tom escolhido para não parecer vermelho. |
25
+ | `theme.colors.stateText.error` | `#C0392B` | Texto de erro sobre fundo claro (contraste AA). |
26
+ | `theme.colors.stateText.info` | `#0F5E8C` | Texto de informação sobre fundo claro (contraste AA). |
27
+ | `theme.colors.chart.purple` | `#6633CC` | Roxo da marca. |
28
+ | `theme.colors.chart.lilac` | `#B692F6` | Lilás. |
29
+ | `theme.colors.chart.lightBlue` | `#ABD0FD` | Azul clarinho, pastel. |
30
+ | `theme.colors.chart.blue` | `#36BFFA` | Azul ciano. |
31
+ | `theme.colors.chart.teal` | `#00CC99` | Teal da marca. |
32
+ | `theme.colors.chart.orange` | `#FAC074` | Laranja pastel. |
33
+ | `theme.colors.chart.pink` | `#F670C7` | Rosa. |
34
+ | `theme.colors.chart.grey` | `#D9D9D9` | Cinza, para "outros" ou o que sobra. |
35
+ | `theme.colors.grey_1` | `#333333` | Cinza 1, o mais escuro. Texto principal. |
36
+ | `theme.colors.grey_2` | `#666666` | Cinza 2. Texto de apoio. |
37
+ | `theme.colors.grey_3` | `#7D7D7D` | Cinza 3. Rótulos e textos auxiliares. |
38
+ | `theme.colors.grey_4` | `#D9D9D9` | Cinza 4. Bordas. |
39
+ | `theme.colors.grey_5` | `#F3F3F3` | Cinza 5. Fundo de áreas de apoio. |
40
+ | `theme.colors.grey_6` | `#F8F7FC` | Cinza 6, o mais claro, com um toque do roxo da marca. Fundo de página e destaque leve (hover de linha). |
41
+ | `theme.typography.fontFamily` | `Inter, system-ui, -apple-system, 'Segoe UI', sans-serif` | Fonte da marca. O projeto que consome carrega o Inter (300 a 700). A v1 usava Rubik (legacyTheme). |
42
+ | `theme.typography.monoFamily` | `'JetBrains Mono', ui-monospace, SFMono-Regular, monospace` | Fonte monoespaçada para código e números tabulares. |
43
+ | `theme.typography.fontWeight.light` | `300` | Leve. Uso raro, textos grandes. |
44
+ | `theme.typography.fontWeight.regular` | `400` | Texto corrido. |
45
+ | `theme.typography.fontWeight.medium` | `500` | Rótulos e destaques leves. |
46
+ | `theme.typography.fontWeight.semibold` | `600` | Títulos de seção e cabeçalhos. |
47
+ | `theme.typography.fontWeight.bold` | `700` | Títulos principais e números de destaque. |
48
+ | `theme.typography.lineHeight.tight` | `1.1` | Títulos grandes. |
49
+ | `theme.typography.lineHeight.snug` | `1.3` | Títulos médios. |
50
+ | `theme.typography.lineHeight.normal` | `1.5` | Texto corrido compacto. |
51
+ | `theme.typography.lineHeight.relaxed` | `1.6` | Texto corrido longo. |
52
+ | `theme.typography.textSize.caption` | `12px` | Legendas e textos auxiliares. Menor tamanho permitido. |
53
+ | `theme.typography.textSize.bodySm` | `14px` | Texto corrido compacto (tabelas, formulários). |
54
+ | `theme.typography.textSize.body` | `16px` | Texto corrido padrão. |
55
+ | `theme.typography.textSize.bodyLg` | `18px` | Texto corrido de destaque. |
56
+ | `theme.typography.textSize.h4` | `22px` | Título de card ou bloco. |
57
+ | `theme.typography.textSize.h3` | `28px` | Título de seção. |
58
+ | `theme.typography.textSize.h2` | `40px` | Título de página. |
59
+ | `theme.typography.textSize.h1` | `56px` | Título principal. |
60
+ | `theme.typography.textSize.display` | `72px` | Título de capa e hero. |
61
+ | `theme.spacing.1` | `8px` | 8px, unidade da grade. |
62
+ | `theme.spacing.2` | `16px` | 16px. |
63
+ | `theme.spacing.3` | `24px` | 24px. |
64
+ | `theme.spacing.4` | `32px` | 32px. |
65
+ | `theme.spacing.5` | `40px` | 40px. |
66
+ | `theme.spacing.6` | `56px` | 56px. |
67
+ | `theme.spacing.7` | `72px` | 72px. |
68
+ | `theme.spacing.8` | `80px` | 80px. |
69
+ | `theme.spacing.9` | `96px` | 96px. |
70
+ | `theme.spacing.10` | `120px` | 120px. |
71
+ | `theme.spacing.0.5` | `4px` | 4px. |
72
+ | `theme.spacing.1.5` | `12px` | 12px. |
73
+ | `theme.spacing.xs` | `4px` | 4px. |
74
+ | `theme.spacing.sm` | `8px` | 8px, unidade da grade. |
75
+ | `theme.spacing.md` | `16px` | 16px. |
76
+ | `theme.spacing.lg` | `24px` | 24px. |
77
+ | `theme.spacing.xl` | `32px` | 32px. |
78
+ | `theme.spacing.2xl` | `48px` | 48px. |
79
+ | `theme.radius.none` | `0px` | Sem arredondamento. |
80
+ | `theme.radius.sm` | `4px` | Checkbox, etiquetas pequenas. |
81
+ | `theme.radius.md` | `8px` | Botões e campos. |
82
+ | `theme.radius.lg` | `12px` | Cards. |
83
+ | `theme.radius.xl` | `16px` | Tabelas, painéis e modais. |
84
+ | `theme.radius.2xl` | `24px` | Blocos grandes de destaque. |
85
+ | `theme.radius.full` | `9999px` | Pílula e círculo. |
86
+ | `theme.shadow.xs` | `0px 1px 2px 0px #0000000D` | Campos e botões. |
87
+ | `theme.shadow.sm` | `0px 2px 8px 0px #0000000F` | Cards em repouso. |
88
+ | `theme.shadow.md` | `0px 4px 16px 0px #00000014` | Cards em destaque e hover. |
89
+ | `theme.shadow.lg` | `0px 8px 32px 0px #0000001A` | Modais, menus e dropdowns. |
90
+ | `theme.shadow.xl` | `0px 16px 48px 0px #0000001F` | Elementos flutuantes de destaque. |
91
+ | `theme.shadow.focus` | `0px 0px 0px 4px #6633CC3D` | Anel de foco roxo (24%), para foco de marca em peças novas. Campos e botões usam o anel cinza que acompanha a borda. |
92
+ | `theme.shadow.button` | `0px 2px 8px 0px #0000000F` | |
93
+ | `theme.breakpoints.xs` | `480px` | Celular grande. |
94
+ | `theme.breakpoints.sm` | `640px` | Celular deitado. |
95
+ | `theme.breakpoints.md` | `768px` | Tablet. Abaixo disso é celular. |
96
+ | `theme.breakpoints.lg` | `1024px` | Notebook pequeno. |
97
+ | `theme.breakpoints.xl` | `1280px` | Desktop. |
98
+ | `theme.zIndex.drawer` | `1100` | Painéis laterais (Drawer). |
99
+ | `theme.zIndex.modal` | `1200` | Modais. Ficam acima do Drawer. |
100
+ | `theme.zIndex.dropdown` | `1300` | Select, popover e menus. Abrem soltos na página, então ficam acima do Modal para funcionar dentro dele. |
101
+ | `theme.zIndex.toast` | `1400` | Avisos no canto da tela. |
102
+ | `theme.zIndex.tooltip` | `1500` | Tooltips, sempre por cima. |
103
+ | `theme.motion.duration.fast` | `120ms` | Mudança de estado pequena (hover de cor). |
104
+ | `theme.motion.duration.normal` | `200ms` | Transição padrão. |
105
+ | `theme.motion.duration.slow` | `300ms` | Abertura de painel e revelação de card. |
106
+ | `theme.motion.easing.default` | `cubic-bezier(0.4, 0, 0.2, 1)` | Entra e sai suave (ease-in-out). |
107
+ | `theme.motion.easing.enter` | `cubic-bezier(0, 0, 0.2, 1)` | Elemento entrando (ease-out). |
108
+ | `theme.motion.easing.exit` | `cubic-bezier(0.4, 0, 1, 1)` | Elemento saindo (ease-in). |
109
+
110
+ Chaves da v1 (`colors.custom`, `box_shadow`, `border_radius`, `title_size`, `body_size`, `typography.family`) continuam aceitas como apelido, mas não use em código novo. A troca está no `MIGRATION.md`.
111
+
112
+ ## Fora do React (`lib/tokens/tokens.css`)
113
+
114
+ Para HTML, slides, landing e vídeo: importe `blockforce-design-system/lib/tokens/tokens.css` e use as variáveis.
115
+
116
+ ```css
117
+ --bf-color-purple-500: #6633CC
118
+ --bf-color-teal-500: #00CC99
119
+ --bf-color-navy-900: #1A202B
120
+ --bf-color-white: #FFFFFF
121
+ --bf-color-grey-1: #333333
122
+ --bf-color-grey-2: #666666
123
+ --bf-color-grey-3: #7D7D7D
124
+ --bf-color-grey-4: #D9D9D9
125
+ --bf-color-grey-5: #F3F3F3
126
+ --bf-color-grey-6: #F8F7FC
127
+ --bf-color-green-50: #ECFDF3
128
+ --bf-color-green-500: #27AE60
129
+ --bf-color-green-700: #067647
130
+ --bf-color-orange-50: #FEF3E7
131
+ --bf-color-orange-200: #FAC074
132
+ --bf-color-orange-500: #F79009
133
+ --bf-color-orange-700: #DC6803
134
+ --bf-color-red-50: #FDECEA
135
+ --bf-color-red-500: #EB5757
136
+ --bf-color-red-700: #C0392B
137
+ --bf-color-blue-50: #E8F3FA
138
+ --bf-color-blue-200: #ABD0FD
139
+ --bf-color-blue-500: #2F80ED
140
+ --bf-color-blue-600: #1779B2
141
+ --bf-color-blue-700: #0F5E8C
142
+ --bf-color-lilac-300: #B692F6
143
+ --bf-color-pink-400: #F670C7
144
+ --bf-color-cyan-400: #36BFFA
145
+ --bf-font-family-sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif
146
+ --bf-font-family-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace
147
+ --bf-font-weight-light: 300
148
+ --bf-font-weight-regular: 400
149
+ --bf-font-weight-medium: 500
150
+ --bf-font-weight-semibold: 600
151
+ --bf-font-weight-bold: 700
152
+ --bf-font-size-caption: 12px
153
+ --bf-font-size-body-sm: 14px
154
+ --bf-font-size-body: 16px
155
+ --bf-font-size-body-lg: 18px
156
+ --bf-font-size-h4: 22px
157
+ --bf-font-size-h3: 28px
158
+ --bf-font-size-h2: 40px
159
+ --bf-font-size-h1: 56px
160
+ --bf-font-size-display: 72px
161
+ --bf-font-line-height-tight: 1.1
162
+ --bf-font-line-height-snug: 1.3
163
+ --bf-font-line-height-normal: 1.5
164
+ --bf-font-line-height-relaxed: 1.6
165
+ --bf-space-0: 0px
166
+ --bf-space-4: 4px
167
+ --bf-space-8: 8px
168
+ --bf-space-12: 12px
169
+ --bf-space-16: 16px
170
+ --bf-space-24: 24px
171
+ --bf-space-32: 32px
172
+ --bf-space-40: 40px
173
+ --bf-space-48: 48px
174
+ --bf-space-56: 56px
175
+ --bf-space-72: 72px
176
+ --bf-space-80: 80px
177
+ --bf-space-96: 96px
178
+ --bf-space-120: 120px
179
+ --bf-radius-none: 0px
180
+ --bf-radius-sm: 4px
181
+ --bf-radius-md: 8px
182
+ --bf-radius-lg: 12px
183
+ --bf-radius-xl: 16px
184
+ --bf-radius-2xl: 24px
185
+ --bf-radius-full: 9999px
186
+ --bf-shadow-xs: 0px 1px 2px 0px #0000000D
187
+ --bf-shadow-sm: 0px 2px 8px 0px #0000000F
188
+ --bf-shadow-md: 0px 4px 16px 0px #00000014
189
+ --bf-shadow-lg: 0px 8px 32px 0px #0000001A
190
+ --bf-shadow-xl: 0px 16px 48px 0px #0000001F
191
+ --bf-shadow-focus: 0px 0px 0px 4px #6633CC3D
192
+ --bf-breakpoint-xs: 480px
193
+ --bf-breakpoint-sm: 640px
194
+ --bf-breakpoint-md: 768px
195
+ --bf-breakpoint-lg: 1024px
196
+ --bf-breakpoint-xl: 1280px
197
+ --bf-z-index-drawer: 1100
198
+ --bf-z-index-modal: 1200
199
+ --bf-z-index-dropdown: 1300
200
+ --bf-z-index-toast: 1400
201
+ --bf-z-index-tooltip: 1500
202
+ --bf-duration-fast: 120ms
203
+ --bf-duration-normal: 200ms
204
+ --bf-duration-slow: 300ms
205
+ --bf-easing-default: cubic-bezier(0.4, 0, 0.2, 1)
206
+ --bf-easing-enter: cubic-bezier(0, 0, 0.2, 1)
207
+ --bf-easing-exit: cubic-bezier(0.4, 0, 1, 1)
208
+ --bf-brand-gradient: linear-gradient(45deg, #6633CC 0%, #00CC99 100%)
209
+ --bf-border-focus: #6633CC
210
+ --bf-interactive: #1779B2
211
+ --bf-state-success: #27AE60
212
+ --bf-state-warning: #F79009
213
+ --bf-state-error: #EB5757
214
+ --bf-state-info: #2F80ED
215
+ --bf-state-subtle-success: #ECFDF3
216
+ --bf-state-subtle-warning: #FEF3E7
217
+ --bf-state-subtle-error: #FDECEA
218
+ --bf-state-subtle-info: #E8F3FA
219
+ --bf-state-text-success: #067647
220
+ --bf-state-text-warning: #DC6803
221
+ --bf-state-text-error: #C0392B
222
+ --bf-state-text-info: #0F5E8C
223
+ --bf-chart-purple: #6633CC
224
+ --bf-chart-lilac: #B692F6
225
+ --bf-chart-light-blue: #ABD0FD
226
+ --bf-chart-blue: #36BFFA
227
+ --bf-chart-teal: #00CC99
228
+ --bf-chart-orange: #FAC074
229
+ --bf-chart-pink: #F670C7
230
+ --bf-chart-grey: #D9D9D9
231
+ ```
@@ -1 +1 @@
1
- {"version":3,"file":"file-image-preview.comp.js","sources":["../../../../../../src/components/forms/file/file-image-preview/file-image-preview.comp.tsx"],"sourcesContent":["import { useTheme } from 'styled-components'\n\nimport { Button } from '../../../buttons'\nimport { Icon } from '../../../icons'\nimport { Image } from '../../../images'\nimport { Box } from '../../../layout'\nimport { Text } from '../../../typography'\nimport * as DragNDropStyles from '../file.styles'\nimport {\n bytesToSize,\n getFileIcon,\n getFileName,\n isImageFile,\n} from '../file.utils'\nimport { useObjectUrl } from '../use-object-url'\n\nimport { FileImagePreviewProps } from './file-image-preview.types'\n\nexport const FileImagePreview = ({\n file,\n onChange,\n onDelete,\n onClickInput,\n ...rest\n}: FileImagePreviewProps) => {\n const theme = useTheme()\n\n const fileIsLink = !(file instanceof File)\n\n const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange && e.target.files) {\n onChange(e.target.files[0])\n e.target.value = ''\n }\n }\n\n const imageUrl = useObjectUrl(file)\n\n return (\n <Box gap={2} alignItems=\"center\" data-testid=\"file-image-preview\" {...rest}>\n {isImageFile(file) ? (\n imageUrl ? (\n <Image\n width=\"56px\"\n height=\"56px\"\n objectFit=\"cover\"\n borderRadius={theme.border_radius.card}\n src={imageUrl}\n alt={getFileName(file)}\n />\n ) : (\n <Box width=\"56px\" height=\"56px\" flex=\"none\" />\n )\n ) : (\n <Box\n width=\"56px\"\n height=\"56px\"\n flex=\"none\"\n justifyContent=\"center\"\n alignItems=\"center\"\n borderRadius={theme.border_radius.card}\n backgroundColor=\"grey_5\"\n data-testid=\"file-icon\"\n >\n <Icon name={getFileIcon(file)} size={28} color=\"grey_2\" />\n </Box>\n )}\n <Box direction=\"column\" gap={1}>\n <Box gap={1}>\n {onChange && (\n <Button variant=\"text\" padding={'0'} data-testid=\"change-button\">\n <input\n hidden\n type=\"file\"\n id=\"fileToChange\"\n onChange={handleOnChange}\n />\n <DragNDropStyles.UpdateLabel\n htmlFor=\"fileToChange\"\n onClick={() => onClickInput?.()}\n >\n <Icon name=\"image_edit\" size={20} color={theme.colors.grey_1} />\n </DragNDropStyles.UpdateLabel>\n </Button>\n )}\n <Button variant=\"text\" padding={'0'} onClick={onDelete}>\n <Icon name=\"delete_bin7\" size={20} color={theme.colors.grey_2} />\n </Button>\n </Box>\n <Text size=\"small\">\n {getFileName(file)} {!fileIsLink && bytesToSize(file.size)}\n </Text>\n </Box>\n </Box>\n )\n}\n"],"names":["FileImagePreview","file","onChange","onDelete","onClickInput","rest","theme","useTheme","fileIsLink","File","imageUrl","useObjectUrl","_jsxs","Box","gap","alignItems","children","isImageFile","_jsx","jsx","Image","width","height","objectFit","borderRadius","border_radius","card","src","alt","getFileName","flex","justifyContent","backgroundColor","Icon","name","getFileIcon","size","color","direction","jsxs","Button","variant","padding","hidden","type","id","e","target","files","value","DragNDropStyles","htmlFor","onClick","colors","grey_1","grey_2","Text","bytesToSize"],"mappings":"0bAkBgCA,EAC9BC,OACAC,WACAC,WACAC,kBACGC,MAEH,MAAMC,EAAQC,EAAAA,WAERC,IAAeP,aAAgBQ,MAS/BC,EAAWC,eAAaV,GAE9B,OACEW,EAAAA,KAACC,EAAAA,IAAG,CAACC,IAAK,EAAGC,WAAW,SAAQ,cAAa,wBAAyBV,EACnEW,SAAA,CAAAC,EAAAA,YAAYhB,GACXS,EACEQ,EAACC,IAAAC,QACC,CAAAC,MAAM,OACNC,OAAO,OACPC,UAAU,QACVC,aAAclB,EAAMmB,cAAcC,KAClCC,IAAKjB,EACLkB,IAAKC,EAAWA,YAAC5B,KAGnBiB,EAAAC,IAACN,MAAG,CAACQ,MAAM,OAAOC,OAAO,OAAOQ,KAAK,SAGvCZ,EAAAC,IAACN,MACC,CAAAQ,MAAM,OACNC,OAAO,OACPQ,KAAK,OACLC,eAAe,SACfhB,WAAW,SACXS,aAAclB,EAAMmB,cAAcC,KAClCM,gBAAgB,uBACJ,YAAWhB,SAEvBE,EAACC,IAAAc,QAAKC,KAAMC,EAAWA,YAAClC,GAAOmC,KAAM,GAAIC,MAAM,aAGnDzB,OAACC,MAAG,CAACyB,UAAU,SAASxB,IAAK,EAC3BE,SAAA,CAAAJ,EAAA2B,KAAC1B,MAAG,CAACC,IAAK,EACPE,SAAA,CAAAd,GACCU,EAAA2B,KAACC,SAAM,CAACC,QAAQ,OAAOC,QAAS,IAAiB,cAAA,0BAC/CxB,EACEC,IAAA,QAAA,CAAAwB,QACA,EAAAC,KAAK,OACLC,GAAG,eACH3C,SA9CU4C,IAClB5C,GAAY4C,EAAEC,OAAOC,QACvB9C,EAAS4C,EAAEC,OAAOC,MAAM,IACxBF,EAAEC,OAAOE,MAAQ,GACnB,IA4CU/B,EAACC,IAAA+B,cAA2B,CAC1BC,QAAQ,eACRC,QAASA,IAAMhD,MAEfY,SAAAE,EAAAC,IAACc,OAAI,CAACC,KAAK,aAAaE,KAAM,GAAIC,MAAO/B,EAAM+C,OAAOC,cAI5DpC,EAACC,IAAAqB,SAAO,CAAAC,QAAQ,OAAOC,QAAS,IAAKU,QAASjD,EAC5Ca,SAAAE,EAAAC,IAACc,OAAI,CAACC,KAAK,cAAcE,KAAM,GAAIC,MAAO/B,EAAM+C,OAAOE,cAG3D3C,OAAC4C,OAAI,CAACpB,KAAK,QACRpB,SAAA,CAAAa,cAAY5B,GAAK,KAAIO,GAAciD,EAAWA,YAACxD,EAAKmC,cAGrD"}
1
+ {"version":3,"file":"file-image-preview.comp.js","sources":["../../../../../../src/components/forms/file/file-image-preview/file-image-preview.comp.tsx"],"sourcesContent":["import { useTheme } from 'styled-components'\n\nimport { Button } from '../../../buttons'\nimport { Icon } from '../../../icons'\nimport { Image } from '../../../images'\nimport { Box } from '../../../layout'\nimport { Text } from '../../../typography'\nimport * as DragNDropStyles from '../file.styles'\nimport {\n bytesToSize,\n getFileIcon,\n getFileName,\n isImageFile,\n} from '../file.utils'\nimport { useObjectUrl } from '../use-object-url'\n\nimport { FileImagePreviewProps } from './file-image-preview.types'\n\n/**\n * Miniatura de uma imagem enviada (arquivo ou URL), com ações de trocar e excluir.\n * Arquivo que não é imagem aparece como ícone. Normalmente vem pronto dentro do FileDropzone (`preview=\"image\"`).\n * @example <FileImagePreview file={foto} onDelete={remover} />\n */\nexport const FileImagePreview = ({\n file,\n onChange,\n onDelete,\n onClickInput,\n ...rest\n}: FileImagePreviewProps) => {\n const theme = useTheme()\n\n const fileIsLink = !(file instanceof File)\n\n const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange && e.target.files) {\n onChange(e.target.files[0])\n e.target.value = ''\n }\n }\n\n const imageUrl = useObjectUrl(file)\n\n return (\n <Box gap={2} alignItems=\"center\" data-testid=\"file-image-preview\" {...rest}>\n {isImageFile(file) ? (\n imageUrl ? (\n <Image\n width=\"56px\"\n height=\"56px\"\n objectFit=\"cover\"\n borderRadius={theme.border_radius.card}\n src={imageUrl}\n alt={getFileName(file)}\n />\n ) : (\n <Box width=\"56px\" height=\"56px\" flex=\"none\" />\n )\n ) : (\n <Box\n width=\"56px\"\n height=\"56px\"\n flex=\"none\"\n justifyContent=\"center\"\n alignItems=\"center\"\n borderRadius={theme.border_radius.card}\n backgroundColor=\"grey_5\"\n data-testid=\"file-icon\"\n >\n <Icon name={getFileIcon(file)} size={28} color=\"grey_2\" />\n </Box>\n )}\n <Box direction=\"column\" gap={1}>\n <Box gap={1}>\n {onChange && (\n <Button variant=\"text\" padding={'0'} data-testid=\"change-button\">\n <input\n hidden\n type=\"file\"\n id=\"fileToChange\"\n onChange={handleOnChange}\n />\n <DragNDropStyles.UpdateLabel\n htmlFor=\"fileToChange\"\n onClick={() => onClickInput?.()}\n >\n <Icon name=\"image_edit\" size={20} color={theme.colors.grey_1} />\n </DragNDropStyles.UpdateLabel>\n </Button>\n )}\n <Button variant=\"text\" padding={'0'} onClick={onDelete}>\n <Icon name=\"delete_bin7\" size={20} color={theme.colors.grey_2} />\n </Button>\n </Box>\n <Text size=\"small\">\n {getFileName(file)} {!fileIsLink && bytesToSize(file.size)}\n </Text>\n </Box>\n </Box>\n )\n}\n"],"names":["FileImagePreview","file","onChange","onDelete","onClickInput","rest","theme","useTheme","fileIsLink","File","imageUrl","useObjectUrl","_jsxs","Box","gap","alignItems","children","isImageFile","_jsx","jsx","Image","width","height","objectFit","borderRadius","border_radius","card","src","alt","getFileName","flex","justifyContent","backgroundColor","Icon","name","getFileIcon","size","color","direction","jsxs","Button","variant","padding","hidden","type","id","e","target","files","value","DragNDropStyles","htmlFor","onClick","colors","grey_1","grey_2","Text","bytesToSize"],"mappings":"0bAuBgCA,EAC9BC,OACAC,WACAC,WACAC,kBACGC,MAEH,MAAMC,EAAQC,EAAAA,WAERC,IAAeP,aAAgBQ,MAS/BC,EAAWC,eAAaV,GAE9B,OACEW,EAAAA,KAACC,EAAAA,IAAG,CAACC,IAAK,EAAGC,WAAW,SAAQ,cAAa,wBAAyBV,EACnEW,SAAA,CAAAC,EAAAA,YAAYhB,GACXS,EACEQ,EAACC,IAAAC,QACC,CAAAC,MAAM,OACNC,OAAO,OACPC,UAAU,QACVC,aAAclB,EAAMmB,cAAcC,KAClCC,IAAKjB,EACLkB,IAAKC,EAAWA,YAAC5B,KAGnBiB,EAAAC,IAACN,MAAG,CAACQ,MAAM,OAAOC,OAAO,OAAOQ,KAAK,SAGvCZ,EAAAC,IAACN,MACC,CAAAQ,MAAM,OACNC,OAAO,OACPQ,KAAK,OACLC,eAAe,SACfhB,WAAW,SACXS,aAAclB,EAAMmB,cAAcC,KAClCM,gBAAgB,uBACJ,YAAWhB,SAEvBE,EAACC,IAAAc,QAAKC,KAAMC,EAAWA,YAAClC,GAAOmC,KAAM,GAAIC,MAAM,aAGnDzB,OAACC,MAAG,CAACyB,UAAU,SAASxB,IAAK,EAC3BE,SAAA,CAAAJ,EAAA2B,KAAC1B,MAAG,CAACC,IAAK,EACPE,SAAA,CAAAd,GACCU,EAAA2B,KAACC,SAAM,CAACC,QAAQ,OAAOC,QAAS,IAAiB,cAAA,0BAC/CxB,EACEC,IAAA,QAAA,CAAAwB,QACA,EAAAC,KAAK,OACLC,GAAG,eACH3C,SA9CU4C,IAClB5C,GAAY4C,EAAEC,OAAOC,QACvB9C,EAAS4C,EAAEC,OAAOC,MAAM,IACxBF,EAAEC,OAAOE,MAAQ,GACnB,IA4CU/B,EAACC,IAAA+B,cAA2B,CAC1BC,QAAQ,eACRC,QAASA,IAAMhD,MAEfY,SAAAE,EAAAC,IAACc,OAAI,CAACC,KAAK,aAAaE,KAAM,GAAIC,MAAO/B,EAAM+C,OAAOC,cAI5DpC,EAACC,IAAAqB,SAAO,CAAAC,QAAQ,OAAOC,QAAS,IAAKU,QAASjD,EAC5Ca,SAAAE,EAAAC,IAACc,OAAI,CAACC,KAAK,cAAcE,KAAM,GAAIC,MAAO/B,EAAM+C,OAAOE,cAG3D3C,OAAC4C,OAAI,CAACpB,KAAK,QACRpB,SAAA,CAAAa,cAAY5B,GAAK,KAAIO,GAAciD,EAAWA,YAACxD,EAAKmC,cAGrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"file-image-preview-list.comp.js","sources":["../../../../../../src/components/forms/file/file-image-preview-list/file-image-preview-list.comp.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { Text } from '../../../typography'\nimport { FileImagePreview } from '../file-image-preview/file-image-preview.comp'\n\nimport { FileImagePreviewListProps } from './file-image-preview-list.types'\n\nimport * as Styles from './file-image-preview-list.styles'\n\nexport const FileImagePreviewList = ({\n files,\n setFiles,\n onDelete,\n defaultFiles,\n onDeleteDefaultFile,\n ...rest\n}: FileImagePreviewListProps) => {\n const [fileToChange, setFileToChange] = useState<number | null>(null)\n\n const handleUpload = (file: File) => {\n const fileListCopy = [...files]\n if (fileToChange !== null) {\n fileListCopy[fileToChange] = file\n setFiles?.(fileListCopy)\n setFileToChange(null)\n }\n }\n\n return (\n <Styles.FileImageContainer\n data-testid=\"file-image-preview-list\"\n marginTop={1}\n width=\"100%\"\n {...rest}\n >\n {files.map((file, index) => (\n <FileImagePreview\n file={file}\n key={`image-preview-${index}`}\n onChange={(_file) => handleUpload(_file)}\n onClickInput={() => setFileToChange(index)}\n onDelete={() => onDelete?.([index])}\n />\n ))}\n\n {defaultFiles && defaultFiles.length > 0 && (\n <Styles.DefaultFilesContainer\n direction=\"column\"\n width=\"100%\"\n data-testid=\"default-files\"\n >\n <Text color=\"grey_2\" size=\"small\">\n Adicionados anteriormente\n </Text>\n\n <Styles.FileImageContainer marginTop={1}>\n {defaultFiles?.map((file, index) => (\n <FileImagePreview\n file={file}\n key={`default-image-preview-${index}`}\n onDelete={() => onDeleteDefaultFile?.(index)}\n />\n ))}\n </Styles.FileImageContainer>\n </Styles.DefaultFilesContainer>\n )}\n </Styles.FileImageContainer>\n )\n}\n"],"names":["FileImagePreviewList","files","setFiles","onDelete","defaultFiles","onDeleteDefaultFile","rest","fileToChange","setFileToChange","useState","_jsxs","Styles","marginTop","width","children","map","file","index","_jsx","jsx","FileImagePreview","onChange","_file","fileListCopy","handleUpload","onClickInput","length","direction","Text","color","size"],"mappings":"kQASoCA,EAClCC,QACAC,WACAC,WACAC,eACAC,yBACGC,MAEH,MAAOC,EAAcC,GAAmBC,EAAQA,SAAgB,MAWhE,OACEC,EAAAA,KAACC,EAAAA,kCACa,0BACZC,UAAW,EACXC,MAAM,UACFP,EAEHQ,SAAA,CAAAb,EAAMc,KAAI,CAACC,EAAMC,IAChBC,EAAAC,IAACC,mBACC,CAAAJ,KAAMA,EAENK,SAAWC,GApBGN,KACpB,MAAMO,EAAe,IAAItB,GACJ,OAAjBM,IACFgB,EAAahB,GAAgBS,EAC7Bd,IAAWqB,GACXf,EAAgB,MAClB,EAc2BgB,CAAaF,GAClCG,aAAcA,IAAMjB,EAAgBS,GACpCd,SAAUA,IAAMA,IAAW,CAACc,KAHvB,iBAAiBA,OAOzBb,GAAgBA,EAAasB,OAAS,GACrChB,EAAAA,KAACC,EAAAA,sBACC,CAAAgB,UAAU,SACVd,MAAM,qBACM,gBAAeC,SAAA,CAE3BI,EAACC,IAAAS,QAAKC,MAAM,SAASC,KAAK,QAEnBhB,SAAA,8BAEPI,MAACP,qBAA0B,CAAAC,UAAW,EAACE,SACpCV,GAAcW,KAAI,CAACC,EAAMC,IACxBC,MAACE,mBAAgB,CACfJ,KAAMA,EAENb,SAAUA,IAAME,IAAsBY,IADR,yBAAAA,cAOd"}
1
+ {"version":3,"file":"file-image-preview-list.comp.js","sources":["../../../../../../src/components/forms/file/file-image-preview-list/file-image-preview-list.comp.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { Text } from '../../../typography'\nimport { FileImagePreview } from '../file-image-preview/file-image-preview.comp'\n\nimport { FileImagePreviewListProps } from './file-image-preview-list.types'\n\nimport * as Styles from './file-image-preview-list.styles'\n\n/**\n * Grade de miniaturas das imagens enviadas, com excluir em cada uma. `defaultFiles` mostra imagens que já estavam salvas (URLs).\n * Normalmente vem pronta dentro do FileDropzone com `multiple` e `preview=\"image\"`.\n * @example <FileImagePreviewList files={fotos} setFiles={setFotos} />\n */\nexport const FileImagePreviewList = ({\n files,\n setFiles,\n onDelete,\n defaultFiles,\n onDeleteDefaultFile,\n ...rest\n}: FileImagePreviewListProps) => {\n const [fileToChange, setFileToChange] = useState<number | null>(null)\n\n const handleUpload = (file: File) => {\n const fileListCopy = [...files]\n if (fileToChange !== null) {\n fileListCopy[fileToChange] = file\n setFiles?.(fileListCopy)\n setFileToChange(null)\n }\n }\n\n return (\n <Styles.FileImageContainer\n data-testid=\"file-image-preview-list\"\n marginTop={1}\n width=\"100%\"\n {...rest}\n >\n {files.map((file, index) => (\n <FileImagePreview\n file={file}\n key={`image-preview-${index}`}\n onChange={(_file) => handleUpload(_file)}\n onClickInput={() => setFileToChange(index)}\n onDelete={() => onDelete?.([index])}\n />\n ))}\n\n {defaultFiles && defaultFiles.length > 0 && (\n <Styles.DefaultFilesContainer\n direction=\"column\"\n width=\"100%\"\n data-testid=\"default-files\"\n >\n <Text color=\"grey_2\" size=\"small\">\n Adicionados anteriormente\n </Text>\n\n <Styles.FileImageContainer marginTop={1}>\n {defaultFiles?.map((file, index) => (\n <FileImagePreview\n file={file}\n key={`default-image-preview-${index}`}\n onDelete={() => onDeleteDefaultFile?.(index)}\n />\n ))}\n </Styles.FileImageContainer>\n </Styles.DefaultFilesContainer>\n )}\n </Styles.FileImageContainer>\n )\n}\n"],"names":["FileImagePreviewList","files","setFiles","onDelete","defaultFiles","onDeleteDefaultFile","rest","fileToChange","setFileToChange","useState","_jsxs","Styles","marginTop","width","children","map","file","index","_jsx","jsx","FileImagePreview","onChange","_file","fileListCopy","handleUpload","onClickInput","length","direction","Text","color","size"],"mappings":"kQAcoCA,EAClCC,QACAC,WACAC,WACAC,eACAC,yBACGC,MAEH,MAAOC,EAAcC,GAAmBC,EAAQA,SAAgB,MAWhE,OACEC,EAAAA,KAACC,EAAAA,kCACa,0BACZC,UAAW,EACXC,MAAM,UACFP,EAEHQ,SAAA,CAAAb,EAAMc,KAAI,CAACC,EAAMC,IAChBC,EAAAC,IAACC,mBACC,CAAAJ,KAAMA,EAENK,SAAWC,GApBGN,KACpB,MAAMO,EAAe,IAAItB,GACJ,OAAjBM,IACFgB,EAAahB,GAAgBS,EAC7Bd,IAAWqB,GACXf,EAAgB,MAClB,EAc2BgB,CAAaF,GAClCG,aAAcA,IAAMjB,EAAgBS,GACpCd,SAAUA,IAAMA,IAAW,CAACc,KAHvB,iBAAiBA,OAOzBb,GAAgBA,EAAasB,OAAS,GACrChB,EAAAA,KAACC,EAAAA,sBACC,CAAAgB,UAAU,SACVd,MAAM,qBACM,gBAAeC,SAAA,CAE3BI,EAACC,IAAAS,QAAKC,MAAM,SAASC,KAAK,QAEnBhB,SAAA,8BAEPI,MAACP,qBAA0B,CAAAC,UAAW,EAACE,SACpCV,GAAcW,KAAI,CAACC,EAAMC,IACxBC,MAACE,mBAAgB,CACfJ,KAAMA,EAENb,SAAUA,IAAME,IAAsBY,IADR,yBAAAA,cAOd"}
@@ -1 +1 @@
1
- {"version":3,"file":"file-preview-list.comp.js","sources":["../../../../../../src/components/forms/file/file-preview-list/file-preview-list.comp.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nimport { useTheme } from 'styled-components'\n\nimport { Button } from '../../../buttons'\nimport { Box } from '../../../layout'\nimport { Text } from '../../../typography'\nimport { FilePreview } from '../file-preview/file-preview.comp'\n\nimport { FilePreviewListProps } from './file-preview-list.types'\n\nimport * as Styles from './file-preview-list.styles'\n\nexport const FilePreviewList = ({\n files,\n showImages = false,\n setFiles,\n onDelete,\n defaultFiles,\n onDeleteDefaultFile,\n ...rest\n}: FilePreviewListProps) => {\n const theme = useTheme()\n const [selectedFiles, setSelectedFiles] = useState<number[]>([])\n const [fileToChange, setFileToChange] = useState<number | null>(null)\n\n const handleToggleSelect = (index: number) => {\n let newSelectedFiles: number[] = selectedFiles\n if (selectedFiles.includes(index)) {\n newSelectedFiles = selectedFiles.filter(\n (selectedFiles) => selectedFiles !== index,\n )\n } else {\n newSelectedFiles = [...selectedFiles, index]\n }\n setSelectedFiles(newSelectedFiles)\n }\n\n const handleUpload = (file: File) => {\n const fileListCopy = [...files]\n if (fileToChange !== null) {\n fileListCopy[fileToChange] = file\n setFiles?.(fileListCopy)\n setFileToChange(null)\n }\n }\n\n useEffect(() => {\n setSelectedFiles([])\n }, [onDelete])\n\n return (\n <Styles.FileListPreviewContainer\n data-testid=\"file-list-preview\"\n width=\"100%\"\n {...rest}\n >\n {files.length > 0 && (\n <Box gap={2} alignItems=\"center\" marginTop={2}>\n <Text size=\"small\" color={theme.colors.grey_2}>\n {selectedFiles.length ?? 0} selecionados\n </Text>\n {selectedFiles.length > 0 && (\n <Button\n fontSize={theme.typography.body_size.small}\n variant=\"text\"\n padding=\"0\"\n color={theme.colors.grey_1}\n onClick={() => selectedFiles && onDelete?.(selectedFiles)}\n disabled={selectedFiles.length === 0}\n >\n Deletar\n </Button>\n )}\n </Box>\n )}\n\n {files.map((file, index) => (\n <FilePreview\n file={file}\n key={`file-preview-${index}`}\n onChange={handleUpload}\n onClickInput={() => setFileToChange(index)}\n selectable\n isSelected={selectedFiles.includes(index)}\n onSelect={() => handleToggleSelect(index)}\n onDelete={() => onDelete?.([index])}\n showImage={showImages}\n />\n ))}\n\n {defaultFiles && defaultFiles.length > 0 && (\n <Styles.DefaultFilesContainer\n direction=\"column\"\n marginTop={2}\n width=\"100%\"\n paddingY={2}\n gap={1}\n data-testid=\"default-files\"\n >\n <Text size=\"small\" color={theme.colors.grey_2}>\n Adicionados anteriormente\n </Text>\n {defaultFiles?.map((file, index) => {\n return (\n <FilePreview\n file={file}\n onDelete={() => onDeleteDefaultFile?.(index)}\n showImage={showImages}\n key={`default-file-${index}`}\n />\n )\n })}\n </Styles.DefaultFilesContainer>\n )}\n </Styles.FileListPreviewContainer>\n )\n}\n"],"names":["FilePreviewList","files","showImages","setFiles","onDelete","defaultFiles","onDeleteDefaultFile","rest","theme","useTheme","selectedFiles","setSelectedFiles","useState","fileToChange","setFileToChange","handleUpload","file","fileListCopy","useEffect","_jsxs","Styles","width","children","length","Box","gap","alignItems","marginTop","jsxs","Text","size","color","colors","grey_2","_jsx","Button","fontSize","typography","body_size","small","variant","padding","grey_1","onClick","disabled","map","index","jsx","FilePreview","onChange","onClickInput","selectable","isSelected","includes","onSelect","newSelectedFiles","filter","handleToggleSelect","showImage","direction","paddingY"],"mappings":"2WAa+BA,EAC7BC,QACAC,cAAa,EACbC,WACAC,WACAC,eACAC,yBACGC,MAEH,MAAMC,EAAQC,EAAAA,YACPC,EAAeC,GAAoBC,EAAQA,SAAW,KACtDC,EAAcC,GAAmBF,EAAQA,SAAgB,MAc1DG,EAAgBC,IACpB,MAAMC,EAAe,IAAIhB,GACJ,OAAjBY,IACFI,EAAaJ,GAAgBG,EAC7Bb,IAAWc,GACXH,EAAgB,MAClB,EAOF,OAJAI,EAAAA,WAAU,KACRP,EAAiB,GAAG,GACnB,CAACP,IAGFe,EAAAA,KAACC,EAAAA,yBAA+B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ACc,EAAAA,YAAW,CACVhC,KAAMA,EACNZ,SAAUA,IAAME,IAAsBwC,GACtCY,UAAWxD,GACN,gBAAgB4C,YAMC"}
1
+ {"version":3,"file":"file-preview-list.comp.js","sources":["../../../../../../src/components/forms/file/file-preview-list/file-preview-list.comp.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nimport { useTheme } from 'styled-components'\n\nimport { Button } from '../../../buttons'\nimport { Box } from '../../../layout'\nimport { Text } from '../../../typography'\nimport { FilePreview } from '../file-preview/file-preview.comp'\n\nimport { FilePreviewListProps } from './file-preview-list.types'\n\nimport * as Styles from './file-preview-list.styles'\n\n/**\n * Lista dos arquivos enviados, com nome, ícone do tipo e excluir. `defaultFiles` mostra arquivos que já estavam salvos (URLs).\n * Normalmente vem pronta dentro do FileDropzone com `multiple` e `preview=\"list\"`.\n * @example <FilePreviewList files={arquivos} setFiles={setArquivos} />\n */\nexport const FilePreviewList = ({\n files,\n showImages = false,\n setFiles,\n onDelete,\n defaultFiles,\n onDeleteDefaultFile,\n ...rest\n}: FilePreviewListProps) => {\n const theme = useTheme()\n const [selectedFiles, setSelectedFiles] = useState<number[]>([])\n const [fileToChange, setFileToChange] = useState<number | null>(null)\n\n const handleToggleSelect = (index: number) => {\n let newSelectedFiles: number[] = selectedFiles\n if (selectedFiles.includes(index)) {\n newSelectedFiles = selectedFiles.filter(\n (selectedFiles) => selectedFiles !== index,\n )\n } else {\n newSelectedFiles = [...selectedFiles, index]\n }\n setSelectedFiles(newSelectedFiles)\n }\n\n const handleUpload = (file: File) => {\n const fileListCopy = [...files]\n if (fileToChange !== null) {\n fileListCopy[fileToChange] = file\n setFiles?.(fileListCopy)\n setFileToChange(null)\n }\n }\n\n useEffect(() => {\n setSelectedFiles([])\n }, [onDelete])\n\n return (\n <Styles.FileListPreviewContainer\n data-testid=\"file-list-preview\"\n width=\"100%\"\n {...rest}\n >\n {files.length > 0 && (\n <Box gap={2} alignItems=\"center\" marginTop={2}>\n <Text size=\"small\" color={theme.colors.grey_2}>\n {selectedFiles.length ?? 0} selecionados\n </Text>\n {selectedFiles.length > 0 && (\n <Button\n fontSize={theme.typography.body_size.small}\n variant=\"text\"\n padding=\"0\"\n color={theme.colors.grey_1}\n onClick={() => selectedFiles && onDelete?.(selectedFiles)}\n disabled={selectedFiles.length === 0}\n >\n Deletar\n </Button>\n )}\n </Box>\n )}\n\n {files.map((file, index) => (\n <FilePreview\n file={file}\n key={`file-preview-${index}`}\n onChange={handleUpload}\n onClickInput={() => setFileToChange(index)}\n selectable\n isSelected={selectedFiles.includes(index)}\n onSelect={() => handleToggleSelect(index)}\n onDelete={() => onDelete?.([index])}\n showImage={showImages}\n />\n ))}\n\n {defaultFiles && defaultFiles.length > 0 && (\n <Styles.DefaultFilesContainer\n direction=\"column\"\n marginTop={2}\n width=\"100%\"\n paddingY={2}\n gap={1}\n data-testid=\"default-files\"\n >\n <Text size=\"small\" color={theme.colors.grey_2}>\n Adicionados anteriormente\n </Text>\n {defaultFiles?.map((file, index) => {\n return (\n <FilePreview\n file={file}\n onDelete={() => onDeleteDefaultFile?.(index)}\n showImage={showImages}\n key={`default-file-${index}`}\n />\n )\n })}\n </Styles.DefaultFilesContainer>\n )}\n </Styles.FileListPreviewContainer>\n )\n}\n"],"names":["FilePreviewList","files","showImages","setFiles","onDelete","defaultFiles","onDeleteDefaultFile","rest","theme","useTheme","selectedFiles","setSelectedFiles","useState","fileToChange","setFileToChange","handleUpload","file","fileListCopy","useEffect","_jsxs","Styles","width","children","length","Box","gap","alignItems","marginTop","jsxs","Text","size","color","colors","grey_2","_jsx","Button","fontSize","typography","body_size","small","variant","padding","grey_1","onClick","disabled","map","index","jsx","FilePreview","onChange","onClickInput","selectable","isSelected","includes","onSelect","newSelectedFiles","filter","handleToggleSelect","showImage","direction","paddingY"],"mappings":"2WAkB+BA,EAC7BC,QACAC,cAAa,EACbC,WACAC,WACAC,eACAC,yBACGC,MAEH,MAAMC,EAAQC,EAAAA,YACPC,EAAeC,GAAoBC,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AA,KAACC,EAAAA,sBACC,CAAAuC,UAAU,SACVhC,UAAW,EACXN,MAAM,OACNuC,SAAU,EACVnC,IAAK,EAAC,cACM,gBAAeH,SAAA,CAE3BY,EAACa,IAAAlB,OAAK,CAAAC,KAAK,QAAQC,MAAOvB,EAAMwB,OAAOC,OAEhCX,SAAA,8BACNjB,GAAcwC,KAAI,CAAC7B,EAAM8B,IAEtBZ,EAAAA,IAACc,EAAAA,YAAW,CACVhC,KAAMA,EACNZ,SAAUA,IAAME,IAAsBwC,GACtCY,UAAWxD,GACN,gBAAgB4C,YAMC"}
@@ -1 +1 @@
1
- {"version":3,"file":"icon.comp.js","sources":["../../../../../src/components/icons/icon/icon.comp.tsx"],"sourcesContent":["import React, { useContext, useId } from 'react'\n\nimport * as LucideIcon from 'react-icons/lu'\nimport * as RemixIcon from 'react-icons/ri'\nimport { ThemeContext } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme/theme.util'\n\nimport { IconProps, CustomIconName } from './icon.types'\nimport {\n isLucideName,\n parseIconNameToLucide,\n parseIconNameToRemixIcon,\n} from './icon.utils'\nimport { iconsList } from './svg'\n\nimport * as Styles from './icon.styles'\n\nexport const Icon = ({\n color,\n name,\n size = 24,\n fill: fillProp,\n defs: defsProp,\n gradient,\n ...props\n}: IconProps) => {\n const theme = useContext(ThemeContext)\n const gradientId = `bf-icon-gradient-${useId().replace(/:/g, '')}`\n\n const fill = gradient ? `url(#${gradientId})` : fillProp\n const defs = gradient ? (\n <defs>\n <linearGradient id={gradientId} x1=\"1\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={getThemeColor('secondary', theme)} />\n <stop offset=\"100%\" stopColor={getThemeColor('primary', theme)} />\n </linearGradient>\n </defs>\n ) : (\n defsProp\n )\n\n const customIcon = iconsList(\n gradient\n ? `url(#${gradientId})`\n : getThemeColor(color ? color : 'primary', theme),\n size,\n )[name as CustomIconName]\n\n if (customIcon) {\n if (gradient) {\n return (\n <Styles.IconComp data-testid=\"icon\">\n <Styles.HiddenDefs aria-hidden=\"true\">{defs}</Styles.HiddenDefs>\n {customIcon}\n </Styles.IconComp>\n )\n }\n if (defs && React.isValidElement(customIcon)) {\n const children = (customIcon as React.ReactElement).props.children\n return (\n <Styles.IconComp data-testid=\"icon\">\n {React.cloneElement(customIcon, {}, [\n defs,\n ...(Array.isArray(children)\n ? children\n : children\n ? [children]\n : []),\n ])}\n </Styles.IconComp>\n )\n }\n return <Styles.IconComp data-testid=\"icon\">{customIcon}</Styles.IconComp>\n }\n\n if (isLucideName(name)) {\n const lucideIcon = LucideIcon[parseIconNameToLucide(name)]\n\n if (!lucideIcon) {\n return null\n }\n\n // Lucide desenha com traço: o gradiente (ou `fill` com `defs`) pinta o `stroke`.\n if (defs && fill) {\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n <Styles.HiddenDefs aria-hidden=\"true\">{defs}</Styles.HiddenDefs>\n {React.createElement(lucideIcon, { size, stroke: fill })}\n </Styles.IconComp>\n )\n }\n\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n {React.createElement(lucideIcon, {\n color: getThemeColor(color ? color : 'primary', theme) || color,\n size,\n })}\n </Styles.IconComp>\n )\n }\n\n const remixIcon = RemixIcon[parseIconNameToRemixIcon(name as string)]\n\n if (!remixIcon) {\n return null\n }\n\n if (defs && fill) {\n return (\n <Styles.IconComp data-testid=\"icon\">\n <svg\n width={`${size}px`}\n height={`${size}px`}\n viewBox={`0 0 ${size} ${size}`}\n fill={fill}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {defs}\n {React.createElement(remixIcon, {\n size: size,\n fill: fill,\n style: { position: 'relative', zIndex: 1 },\n })}\n </svg>\n </Styles.IconComp>\n )\n }\n\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n {React.createElement(remixIcon, {\n color: getThemeColor(color ? color : 'primary', theme) || color,\n size: size,\n })}\n </Styles.IconComp>\n )\n}\n"],"names":["Icon","color","name","size","fill","fillProp","defs","defsProp","gradient","props","theme","useContext","ThemeContext","gradientId","useId","replace","_jsx","jsx","children","_jsxs","jsxs","id","x1","y1","x2","y2","offset","stopColor","getThemeColor","customIcon","iconsList","Styles","React","isValidElement","cloneElement","Array","isArray","isLucideName","lucideIcon","LucideIcon","parseIconNameToLucide","createElement","stroke","remixIcon","RemixIcon","parseIconNameToRemixIcon","width","height","viewBox","xmlns","style","position","zIndex"],"mappings":"6jBAkBoBA,EAClBC,QACAC,OACAC,OAAO,GACPC,KAAMC,EACNC,KAAMC,EACNC,cACGC,MAEH,MAAMC,EAAQC,aAAWC,EAAAA,cACnBC,EAAiC,oBAAAC,EAAKA,QAAGC,QAAQ,KAAM,MAEvDX,EAAOI,EAAmB,QAAAK,KAAgBR,EAC1CC,EAAOE,EACXQ,EAAAC,IAAA,OAAA,CAAAC,SACEC,EAAgBC,KAAA,iBAAA,CAAAC,GAAIR,EAAYS,GAAG,IAAIC,GAAG,IAAIC,GAAG,IAAIC,GAAG,IACtDP,SAAA,CAAAF,EAAAC,IAAA,OAAA,CAAMS,OAAO,KAAKC,UAAWC,EAAAA,cAAc,YAAalB,KACxDM,EAAMC,IAAA,OAAA,CAAAS,OAAO,OAAOC,UAAWC,EAAAA,cAAc,UAAWlB,UAI5DH,EAGIsB,EAAaC,EAAAA,UACjBtB,EACY,QAAAK,KACRe,EAAaA,cAAC3B,GAAgB,UAAWS,GAC7CP,GACAD,GAEF,GAAI2B,EAAY,CACd,GAAIrB,EACF,OACEW,EAAAA,KAACY,EAAAA,SAA4B,CAAA,cAAA,iBAC3Bf,EAACC,IAAAc,aAAiB,CAAA,cAAa,OAAQb,SAAAZ,IACtCuB,KAIP,GAAIvB,GAAQ0B,EAAMC,eAAeJ,GAAa,CAC5C,MAAMX,EAAYW,EAAkCpB,MAAMS,SAC1D,OACEF,EAAAA,IAACe,EAAAA,SAA4B,CAAA,cAAA,OAC1Bb,SAAAc,EAAME,aAAaL,EAAY,CAAE,EAAE,CAClCvB,KACI6B,MAAMC,QAAQlB,GACdA,EACAA,EACE,CAACA,GACD,MAId,CACA,OAAOF,EAAAA,IAACe,EAAAA,wBAA4B,OAAMb,SAAEW,GAC9C,CAEA,GAAIQ,EAAAA,aAAanC,GAAO,CACtB,MAAMoC,EAAaC,EAAWC,wBAAsBtC,IAEpD,OAAKoC,EAKDhC,GAAQF,EAERe,EAAAA,KAACY,EAAAA,wBAA4B,UAAWtB,EAAKS,SAAA,CAC3CF,MAACe,aAAiB,CAAA,cAAa,OAAQb,SAAAZ,IACtC0B,EAAMS,cAAcH,EAAY,CAAEnC,OAAMuC,OAAQtC,OAMrDY,EAAAA,IAACe,EAAAA,SAA4B,CAAA,cAAA,UAAWtB,WACrCuB,EAAMS,cAAcH,EAAY,CAC/BrC,MAAO2B,EAAaA,cAAC3B,GAAgB,UAAWS,IAAUT,EAC1DE,WAjBG,IAqBX,CAEA,MAAMwC,EAAYC,EAAUC,2BAAyB3C,IAErD,OAAKyC,EAIDrC,GAAQF,EAERY,EAAAA,IAACe,EAAAA,SAA4B,CAAA,cAAA,gBAC3BZ,EACEC,KAAA,MAAA,CAAA0B,MAAU,GAAA3C,MACV4C,OAAW,GAAA5C,MACX6C,QAAgB,OAAA7C,KAAQA,IACxBC,KAAMA,EACN6C,MAAM,6BAA4B/B,SAAA,CAEjCZ,EACA0B,EAAMS,cAAcE,EAAW,CAC9BxC,KAAMA,EACNC,KAAMA,EACN8C,MAAO,CAAEC,SAAU,WAAYC,OAAQ,UAQ/CpC,EAAAA,IAACe,EAAAA,SAA4B,CAAA,cAAA,UAAWtB,WACrCuB,EAAMS,cAAcE,EAAW,CAC9B1C,MAAO2B,EAAaA,cAAC3B,GAAgB,UAAWS,IAAUT,EAC1DE,KAAMA,MA5BH,IA8BW"}
1
+ {"version":3,"file":"icon.comp.js","sources":["../../../../../src/components/icons/icon/icon.comp.tsx"],"sourcesContent":["import React, { useContext, useId } from 'react'\n\nimport * as LucideIcon from 'react-icons/lu'\nimport * as RemixIcon from 'react-icons/ri'\nimport { ThemeContext } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme/theme.util'\n\nimport { IconProps, CustomIconName } from './icon.types'\nimport {\n isLucideName,\n parseIconNameToLucide,\n parseIconNameToRemixIcon,\n} from './icon.utils'\nimport { iconsList } from './svg'\n\nimport * as Styles from './icon.styles'\n\n/**\n * Ícone da biblioteca do DS pelo nome: ícones próprios da Blockforce, Remix e Lucide (`lu:nome`).\n * `color` usa as cores do tema e `gradient` pinta com o gradiente da marca. A lista de nomes está em `lib/ai/icons.txt`.\n * Para ícone clicável use IconButton; para ícone dentro de uma caixinha use IconBox.\n * @example <Icon name=\"leaf\" size={20} color=\"primary\" />\n */\nexport const Icon = ({\n color,\n name,\n size = 24,\n fill: fillProp,\n defs: defsProp,\n gradient,\n ...props\n}: IconProps) => {\n const theme = useContext(ThemeContext)\n const gradientId = `bf-icon-gradient-${useId().replace(/:/g, '')}`\n\n const fill = gradient ? `url(#${gradientId})` : fillProp\n const defs = gradient ? (\n <defs>\n <linearGradient id={gradientId} x1=\"1\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={getThemeColor('secondary', theme)} />\n <stop offset=\"100%\" stopColor={getThemeColor('primary', theme)} />\n </linearGradient>\n </defs>\n ) : (\n defsProp\n )\n\n const customIcon = iconsList(\n gradient\n ? `url(#${gradientId})`\n : getThemeColor(color ? color : 'primary', theme),\n size,\n )[name as CustomIconName]\n\n if (customIcon) {\n if (gradient) {\n return (\n <Styles.IconComp data-testid=\"icon\">\n <Styles.HiddenDefs aria-hidden=\"true\">{defs}</Styles.HiddenDefs>\n {customIcon}\n </Styles.IconComp>\n )\n }\n if (defs && React.isValidElement(customIcon)) {\n const children = (customIcon as React.ReactElement).props.children\n return (\n <Styles.IconComp data-testid=\"icon\">\n {React.cloneElement(customIcon, {}, [\n defs,\n ...(Array.isArray(children)\n ? children\n : children\n ? [children]\n : []),\n ])}\n </Styles.IconComp>\n )\n }\n return <Styles.IconComp data-testid=\"icon\">{customIcon}</Styles.IconComp>\n }\n\n if (isLucideName(name)) {\n const lucideIcon = LucideIcon[parseIconNameToLucide(name)]\n\n if (!lucideIcon) {\n return null\n }\n\n // Lucide desenha com traço: o gradiente (ou `fill` com `defs`) pinta o `stroke`.\n if (defs && fill) {\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n <Styles.HiddenDefs aria-hidden=\"true\">{defs}</Styles.HiddenDefs>\n {React.createElement(lucideIcon, { size, stroke: fill })}\n </Styles.IconComp>\n )\n }\n\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n {React.createElement(lucideIcon, {\n color: getThemeColor(color ? color : 'primary', theme) || color,\n size,\n })}\n </Styles.IconComp>\n )\n }\n\n const remixIcon = RemixIcon[parseIconNameToRemixIcon(name as string)]\n\n if (!remixIcon) {\n return null\n }\n\n if (defs && fill) {\n return (\n <Styles.IconComp data-testid=\"icon\">\n <svg\n width={`${size}px`}\n height={`${size}px`}\n viewBox={`0 0 ${size} ${size}`}\n fill={fill}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {defs}\n {React.createElement(remixIcon, {\n size: size,\n fill: fill,\n style: { position: 'relative', zIndex: 1 },\n })}\n </svg>\n </Styles.IconComp>\n )\n }\n\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n {React.createElement(remixIcon, {\n color: getThemeColor(color ? color : 'primary', theme) || color,\n size: size,\n })}\n </Styles.IconComp>\n )\n}\n"],"names":["Icon","color","name","size","fill","fillProp","defs","defsProp","gradient","props","theme","useContext","ThemeContext","gradientId","useId","replace","_jsx","jsx","children","_jsxs","jsxs","id","x1","y1","x2","y2","offset","stopColor","getThemeColor","customIcon","iconsList","Styles","React","isValidElement","cloneElement","Array","isArray","isLucideName","lucideIcon","LucideIcon","parseIconNameToLucide","createElement","stroke","remixIcon","RemixIcon","parseIconNameToRemixIcon","width","height","viewBox","xmlns","style","position","zIndex"],"mappings":"6jBAwBoBA,EAClBC,QACAC,OACAC,OAAO,GACPC,KAAMC,EACN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ACtC0B,EAAMS,cAAcH,EAAY,CAAEnC,OAAMuC,OAAQtC,OAMrDY,EAAAA,IAACe,EAAAA,SAA4B,CAAA,cAAA,UAAWtB,WACrCuB,EAAMS,cAAcH,EAAY,CAC/BrC,MAAO2B,EAAaA,cAAC3B,GAAgB,UAAWS,IAAUT,EAC1DE,WAjBG,IAqBX,CAEA,MAAMwC,EAAYC,EAAUC,2BAAyB3C,IAErD,OAAKyC,EAIDrC,GAAQF,EAERY,EAAAA,IAACe,EAAAA,SAA4B,CAAA,cAAA,gBAC3BZ,EACEC,KAAA,MAAA,CAAA0B,MAAU,GAAA3C,MACV4C,OAAW,GAAA5C,MACX6C,QAAgB,OAAA7C,KAAQA,IACxBC,KAAMA,EACN6C,MAAM,6BAA4B/B,SAAA,CAEjCZ,EACA0B,EAAMS,cAAcE,EAAW,CAC9BxC,KAAMA,EACNC,KAAMA,EACN8C,MAAO,CAAEC,SAAU,WAAYC,OAAQ,UAQ/CpC,EAAAA,IAACe,EAAAA,SAA4B,CAAA,cAAA,UAAWtB,WACrCuB,EAAMS,cAAcE,EAAW,CAC9B1C,MAAO2B,EAAaA,cAAC3B,GAAgB,UAAWS,IAAUT,EAC1DE,KAAMA,MA5BH,IA8BW"}
package/lib/index.d.ts CHANGED
@@ -1940,6 +1940,12 @@ declare const ConfirmDialogProvider: ({ children, }: {
1940
1940
  */
1941
1941
  declare const useConfirm: () => Confirm;
1942
1942
 
1943
+ /**
1944
+ * Ícone da biblioteca do DS pelo nome: ícones próprios da Blockforce, Remix e Lucide (`lu:nome`).
1945
+ * `color` usa as cores do tema e `gradient` pinta com o gradiente da marca. A lista de nomes está em `lib/ai/icons.txt`.
1946
+ * Para ícone clicável use IconButton; para ícone dentro de uma caixinha use IconBox.
1947
+ * @example <Icon name="leaf" size={20} color="primary" />
1948
+ */
1943
1949
  declare const Icon: ({ color, name, size, fill: fillProp, defs: defsProp, gradient, ...props }: IconProps) => react_jsx_runtime.JSX.Element | null;
1944
1950
 
1945
1951
  declare const parseIconNameToRemixIcon: (name: string) => RiIconName;
@@ -2334,6 +2340,11 @@ interface FileImagePreviewProps {
2334
2340
  onClickInput?: () => void;
2335
2341
  }
2336
2342
 
2343
+ /**
2344
+ * Miniatura de uma imagem enviada (arquivo ou URL), com ações de trocar e excluir.
2345
+ * Arquivo que não é imagem aparece como ícone. Normalmente vem pronto dentro do FileDropzone (`preview="image"`).
2346
+ * @example <FileImagePreview file={foto} onDelete={remover} />
2347
+ */
2337
2348
  declare const FileImagePreview: ({ file, onChange, onDelete, onClickInput, ...rest }: FileImagePreviewProps) => react_jsx_runtime.JSX.Element;
2338
2349
 
2339
2350
  /** Props for the FilePreviewList component */
@@ -2352,6 +2363,11 @@ interface FilePreviewListProps {
2352
2363
  onDeleteDefaultFile?: (index: number) => void;
2353
2364
  }
2354
2365
 
2366
+ /**
2367
+ * Lista dos arquivos enviados, com nome, ícone do tipo e excluir. `defaultFiles` mostra arquivos que já estavam salvos (URLs).
2368
+ * Normalmente vem pronta dentro do FileDropzone com `multiple` e `preview="list"`.
2369
+ * @example <FilePreviewList files={arquivos} setFiles={setArquivos} />
2370
+ */
2355
2371
  declare const FilePreviewList: ({ files, showImages, setFiles, onDelete, defaultFiles, onDeleteDefaultFile, ...rest }: FilePreviewListProps) => react_jsx_runtime.JSX.Element;
2356
2372
 
2357
2373
  /** Props for the FileImagePreviewList component */
@@ -2368,6 +2384,11 @@ interface FileImagePreviewListProps {
2368
2384
  onDeleteDefaultFile?: (index: number) => void;
2369
2385
  }
2370
2386
 
2387
+ /**
2388
+ * Grade de miniaturas das imagens enviadas, com excluir em cada uma. `defaultFiles` mostra imagens que já estavam salvas (URLs).
2389
+ * Normalmente vem pronta dentro do FileDropzone com `multiple` e `preview="image"`.
2390
+ * @example <FileImagePreviewList files={fotos} setFiles={setFotos} />
2391
+ */
2371
2392
  declare const FileImagePreviewList: ({ files, setFiles, onDelete, defaultFiles, onDeleteDefaultFile, ...rest }: FileImagePreviewListProps) => react_jsx_runtime.JSX.Element;
2372
2393
 
2373
2394
  /** Props for the Accordion component */
@@ -3612,6 +3633,6 @@ declare const useIsTablet: (options?: ScreenHookOptions) => boolean;
3612
3633
  * Lê a tela já no primeiro render. Em Next, passe `{ ssr: true }`: o primeiro render devolve `xl`
3613
3634
  * (igual ao servidor) e logo depois de montar reflete a tela.
3614
3635
  */
3615
- declare const useBreakpoint: ({ ssr }?: ScreenHookOptions) => Breakpoint | 'base';
3636
+ declare const useBreakpoint: ({ ssr }?: ScreenHookOptions) => Breakpoint | "base";
3616
3637
 
3617
3638
  export { Accordion, type AccordionProps, ActionMenu, type ActionMenuItem, type ActionMenuProps, Alert, type AlertProps, type AlertStatus, Autocomplete, type AutocompleteOption, type AutocompleteProps, Avatar, type AvatarProps, BarChart, type BarChartData, type BarChartProps, Box, type BoxProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, type Breakpoint, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CHART_COLOR_ORDER, CHART_OTHER_COLOR, type CSSCursor, Calendar, type CalendarEvent, type CalendarLabels, type CalendarLegendItem, type CalendarProps, CanvasButton, type CanvasButtonProps, CanvasPanel, type CanvasPanelProps, Card, type CardProps, type CardVariant, Carousel, type CarouselProps, type CellAlign, type ChartColorName, ChartLegend, type ChartLegendItem, type ChartLegendProps, CheckBox, type CheckBoxProps, Checkbox, type CheckboxAlign, type CheckboxProps, type ClientFont, type ClientThemeIssue, type ClientThemeOptions, ConfirmDialog, type ConfirmDialogProps, ConfirmDialogProvider, type ConfirmDialogReason, type ConfirmOptions, CustomAutocomplete, CustomBox, CustomCheckBox, type CustomIconName, type CustomIconProps, CustomInput, CustomSwitch, CustomTextArea, DEFAULT_DATE_LABELS, DatePicker, type DatePickerLabels, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DeepPartial, DirectionToggle, type DirectionToggleProps, Divider, type DividerProps, DoughnutChart, type DoughnutChartProps, DragNDrop, type DragNDropProps, Drawer, type DrawerAnchor, type DrawerProps, EmptyState, type EmptyStateProps, type ExternalIconName, FileDropzone, type FileDropzoneProps, FileImagePreview, FileImagePreviewList, type FileImagePreviewListProps, type FileImagePreviewProps, FilePreview, FilePreviewList, type FilePreviewListProps, type FilePreviewProps, FullscreenToggle, type FullscreenToggleProps, GlobalStyle, Icon, IconBox, type IconBoxProps, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, type IconProps, type IconsName, Image, type ImageProps, InfoItem, type InfoItemProps, Input, type InputProps, LUCIDE_PREFIX, type LegacyButtonSize, LineChart, type LineChartData, type LineChartProps, type LineChartSeries, type LuIconName, type LucideIconName, Matrix, type MatrixAxisItem, type MatrixBand, type MatrixCell, type MatrixCellStyle, type MatrixItem, type MatrixKey, type MatrixLegendItem, type MatrixProps, Modal, type ModalProps, MonthPicker, type MonthPickerProps, Pagination, type PaginationProps, type PartsProps, Popover, type PopoverPosition, type PopoverProps, ProgressBar, type ProgressBarProps, RadioGroup, type RadioGroupProps, type RadioOption, type RiIconName, SUPPORTED_CLIENT_FONTS, type ScreenHookOptions, SearchInput, type SearchInputProps, Select, type SelectOption, type SelectProps, SelectableItem, type SelectableItemProps, SidePanel, type SidePanelProps, type SizeType, Skeleton, type SkeletonProps, Slider, type SliderProps, type SpacingName, Spinner, type SpinnerProps, StatCard, type StatCardProps, type StepState, Stepper, type StepperLabels, type StepperProps, type StepperStep, Switch, type SwitchProps, type TabItem, Table, type TableData, type TableHeader, TablePagination, type TablePaginationProps, type TableProps, Tabs, type TabsProps, type TabsVariant, Tag, type TagProps, Text, TextArea, type TextAreaProps, type TextElementTags, TextLink, type TextLinkProps, type TextProps, type Theme, type ThemeColorPath, type ThemeColors, type ThemeProps, CustomThemeProvider as ThemeProvider, Timeline, type TimelineProps, TintedSection, type TintedSectionProps, TitleCard, type TitleCardProps, Toast, type ToastApi, type ToastConfig, type ToastOptions, type ToastPosition, type ToastProps, ToastProvider, type ToastProviderProps, ToastStackStyles, type ToastType, type Tokens, Tooltip, type TooltipProps, type TreeDirection, TreeNode, type TreeNodeBaseProps, type TreeNodeCaptionProps, type TreeNodeProps, type TreeNodeTitleProps, TreeView, type TreeViewProps, TreemapChart, type TreemapChartData, type TreemapChartProps, Treeview, type TreeviewProps, ViewToggle, type ViewToggleOption, type ViewToggleProps, adjustColorBrightness, allIconsOptions, breakpointValues, createClientTheme, createTheme, customIconsOptions, defaultTheme, formatDateKey, getBand, getChartColors, getClientThemeIssues, getContrastRatio, getLuminance, getReadableTextColor, getThemeColor, getThemeContrastColor, getThemeSize, getThemeSpacing, initialDay, isLucideName, legacyTheme, media, mixColors, parseDateText, parseIconNameToLucide, parseIconNameToRemixIcon, tokens, useBreakpoint, useConfirm, useIsMobile, useIsTablet, useMediaQuery, useToast };
@@ -1 +1 @@
1
- {"version":3,"file":"file-image-preview.comp.js","sources":["../../../../../../src/components/forms/file/file-image-preview/file-image-preview.comp.tsx"],"sourcesContent":["import { useTheme } from 'styled-components'\n\nimport { Button } from '../../../buttons'\nimport { Icon } from '../../../icons'\nimport { Image } from '../../../images'\nimport { Box } from '../../../layout'\nimport { Text } from '../../../typography'\nimport * as DragNDropStyles from '../file.styles'\nimport {\n bytesToSize,\n getFileIcon,\n getFileName,\n isImageFile,\n} from '../file.utils'\nimport { useObjectUrl } from '../use-object-url'\n\nimport { FileImagePreviewProps } from './file-image-preview.types'\n\nexport const FileImagePreview = ({\n file,\n onChange,\n onDelete,\n onClickInput,\n ...rest\n}: FileImagePreviewProps) => {\n const theme = useTheme()\n\n const fileIsLink = !(file instanceof File)\n\n const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange && e.target.files) {\n onChange(e.target.files[0])\n e.target.value = ''\n }\n }\n\n const imageUrl = useObjectUrl(file)\n\n return (\n <Box gap={2} alignItems=\"center\" data-testid=\"file-image-preview\" {...rest}>\n {isImageFile(file) ? (\n imageUrl ? (\n <Image\n width=\"56px\"\n height=\"56px\"\n objectFit=\"cover\"\n borderRadius={theme.border_radius.card}\n src={imageUrl}\n alt={getFileName(file)}\n />\n ) : (\n <Box width=\"56px\" height=\"56px\" flex=\"none\" />\n )\n ) : (\n <Box\n width=\"56px\"\n height=\"56px\"\n flex=\"none\"\n justifyContent=\"center\"\n alignItems=\"center\"\n borderRadius={theme.border_radius.card}\n backgroundColor=\"grey_5\"\n data-testid=\"file-icon\"\n >\n <Icon name={getFileIcon(file)} size={28} color=\"grey_2\" />\n </Box>\n )}\n <Box direction=\"column\" gap={1}>\n <Box gap={1}>\n {onChange && (\n <Button variant=\"text\" padding={'0'} data-testid=\"change-button\">\n <input\n hidden\n type=\"file\"\n id=\"fileToChange\"\n onChange={handleOnChange}\n />\n <DragNDropStyles.UpdateLabel\n htmlFor=\"fileToChange\"\n onClick={() => onClickInput?.()}\n >\n <Icon name=\"image_edit\" size={20} color={theme.colors.grey_1} />\n </DragNDropStyles.UpdateLabel>\n </Button>\n )}\n <Button variant=\"text\" padding={'0'} onClick={onDelete}>\n <Icon name=\"delete_bin7\" size={20} color={theme.colors.grey_2} />\n </Button>\n </Box>\n <Text size=\"small\">\n {getFileName(file)} {!fileIsLink && bytesToSize(file.size)}\n </Text>\n </Box>\n </Box>\n )\n}\n"],"names":["FileImagePreview","file","onChange","onDelete","onClickInput","rest","theme","useTheme","fileIsLink","File","imageUrl","useObjectUrl","_jsxs","Box","gap","alignItems","children","isImageFile","_jsx","Image","width","height","objectFit","borderRadius","border_radius","card","src","alt","getFileName","flex","justifyContent","backgroundColor","Icon","name","getFileIcon","size","color","direction","Button","variant","padding","hidden","type","id","e","target","files","value","DragNDropStyles","htmlFor","onClick","colors","grey_1","grey_2","Text","bytesToSize"],"mappings":"4kBAkBO,MAAMA,EAAmBA,EAC9BC,OACAC,WACAC,WACAC,kBACGC,MAEH,MAAMC,EAAQC,IAERC,IAAeP,aAAgBQ,MAS/BC,EAAWC,EAAaV,GAE9B,OACEW,EAACC,EAAG,CAACC,IAAK,EAAGC,WAAW,SAAQ,cAAa,wBAAyBV,EACnEW,SAAA,CAAAC,EAAYhB,GACXS,EACEQ,EAACC,EACC,CAAAC,MAAM,OACNC,OAAO,OACPC,UAAU,QACVC,aAAcjB,EAAMkB,cAAcC,KAClCC,IAAKhB,EACLiB,IAAKC,EAAY3B,KAGnBiB,EAACL,EAAG,CAACO,MAAM,OAAOC,OAAO,OAAOQ,KAAK,SAGvCX,EAACL,EACC,CAAAO,MAAM,OACNC,OAAO,OACPQ,KAAK,OACLC,eAAe,SACff,WAAW,SACXQ,aAAcjB,EAAMkB,cAAcC,KAClCM,gBAAgB,uBACJ,YAAWf,SAEvBE,EAACc,GAAKC,KAAMC,EAAYjC,GAAOkC,KAAM,GAAIC,MAAM,aAGnDxB,EAACC,EAAG,CAACwB,UAAU,SAASvB,IAAK,EAC3BE,SAAA,CAAAJ,EAACC,EAAG,CAACC,IAAK,EACPE,SAAA,CAAAd,GACCU,EAAC0B,EAAM,CAACC,QAAQ,OAAOC,QAAS,IAAiB,cAAA,0BAC/CtB,EACE,QAAA,CAAAuB,QACA,EAAAC,KAAK,OACLC,GAAG,eACHzC,SA9CU0C,IAClB1C,GAAY0C,EAAEC,OAAOC,QACvB5C,EAAS0C,EAAEC,OAAOC,MAAM,IACxBF,EAAEC,OAAOE,MAAQ,GACnB,IA4CU7B,EAAC8B,EAA2B,CAC1BC,QAAQ,eACRC,QAASA,IAAM9C,MAEfY,SAAAE,EAACc,EAAI,CAACC,KAAK,aAAaE,KAAM,GAAIC,MAAO9B,EAAM6C,OAAOC,cAI5DlC,EAACoB,EAAO,CAAAC,QAAQ,OAAOC,QAAS,IAAKU,QAAS/C,EAC5Ca,SAAAE,EAACc,EAAI,CAACC,KAAK,cAAcE,KAAM,GAAIC,MAAO9B,EAAM6C,OAAOE,cAG3DzC,EAAC0C,EAAI,CAACnB,KAAK,QACRnB,SAAA,CAAAY,EAAY3B,GAAK,KAAIO,GAAc+C,EAAYtD,EAAKkC,cAGrD"}
1
+ {"version":3,"file":"file-image-preview.comp.js","sources":["../../../../../../src/components/forms/file/file-image-preview/file-image-preview.comp.tsx"],"sourcesContent":["import { useTheme } from 'styled-components'\n\nimport { Button } from '../../../buttons'\nimport { Icon } from '../../../icons'\nimport { Image } from '../../../images'\nimport { Box } from '../../../layout'\nimport { Text } from '../../../typography'\nimport * as DragNDropStyles from '../file.styles'\nimport {\n bytesToSize,\n getFileIcon,\n getFileName,\n isImageFile,\n} from '../file.utils'\nimport { useObjectUrl } from '../use-object-url'\n\nimport { FileImagePreviewProps } from './file-image-preview.types'\n\n/**\n * Miniatura de uma imagem enviada (arquivo ou URL), com ações de trocar e excluir.\n * Arquivo que não é imagem aparece como ícone. Normalmente vem pronto dentro do FileDropzone (`preview=\"image\"`).\n * @example <FileImagePreview file={foto} onDelete={remover} />\n */\nexport const FileImagePreview = ({\n file,\n onChange,\n onDelete,\n onClickInput,\n ...rest\n}: FileImagePreviewProps) => {\n const theme = useTheme()\n\n const fileIsLink = !(file instanceof File)\n\n const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange && e.target.files) {\n onChange(e.target.files[0])\n e.target.value = ''\n }\n }\n\n const imageUrl = useObjectUrl(file)\n\n return (\n <Box gap={2} alignItems=\"center\" data-testid=\"file-image-preview\" {...rest}>\n {isImageFile(file) ? (\n imageUrl ? (\n <Image\n width=\"56px\"\n height=\"56px\"\n objectFit=\"cover\"\n borderRadius={theme.border_radius.card}\n src={imageUrl}\n alt={getFileName(file)}\n />\n ) : (\n <Box width=\"56px\" height=\"56px\" flex=\"none\" />\n )\n ) : (\n <Box\n width=\"56px\"\n height=\"56px\"\n flex=\"none\"\n justifyContent=\"center\"\n alignItems=\"center\"\n borderRadius={theme.border_radius.card}\n backgroundColor=\"grey_5\"\n data-testid=\"file-icon\"\n >\n <Icon name={getFileIcon(file)} size={28} color=\"grey_2\" />\n </Box>\n )}\n <Box direction=\"column\" gap={1}>\n <Box gap={1}>\n {onChange && (\n <Button variant=\"text\" padding={'0'} data-testid=\"change-button\">\n <input\n hidden\n type=\"file\"\n id=\"fileToChange\"\n onChange={handleOnChange}\n />\n <DragNDropStyles.UpdateLabel\n htmlFor=\"fileToChange\"\n onClick={() => onClickInput?.()}\n >\n <Icon name=\"image_edit\" size={20} color={theme.colors.grey_1} />\n </DragNDropStyles.UpdateLabel>\n </Button>\n )}\n <Button variant=\"text\" padding={'0'} onClick={onDelete}>\n <Icon name=\"delete_bin7\" size={20} color={theme.colors.grey_2} />\n </Button>\n </Box>\n <Text size=\"small\">\n {getFileName(file)} {!fileIsLink && bytesToSize(file.size)}\n </Text>\n </Box>\n </Box>\n )\n}\n"],"names":["FileImagePreview","file","onChange","onDelete","onClickInput","rest","theme","useTheme","fileIsLink","File","imageUrl","useObjectUrl","_jsxs","Box","gap","alignItems","children","isImageFile","_jsx","Image","width","height","objectFit","borderRadius","border_radius","card","src","alt","getFileName","flex","justifyContent","backgroundColor","Icon","name","getFileIcon","size","color","direction","Button","variant","padding","hidden","type","id","e","target","files","value","DragNDropStyles","htmlFor","onClick","colors","grey_1","grey_2","Text","bytesToSize"],"mappings":"4kBAuBO,MAAMA,EAAmBA,EAC9BC,OACAC,WACAC,WACAC,kBACGC,MAEH,MAAMC,EAAQC,IAERC,IAAeP,aAAgBQ,MAS/BC,EAAWC,EAAaV,GAE9B,OACEW,EAACC,EAAG,CAACC,IAAK,EAAGC,WAAW,SAAQ,cAAa,wBAAyBV,EACnEW,SAAA,CAAAC,EAAYhB,GACXS,EACEQ,EAACC,EACC,CAAAC,MAAM,OACNC,OAAO,OACPC,UAAU,QACVC,aAAcjB,EAAMkB,cAAcC,KAClCC,IAAKhB,EACLiB,IAAKC,EAAY3B,KAGnBiB,EAACL,EAAG,CAACO,MAAM,OAAOC,OAAO,OAAOQ,KAAK,SAGvCX,EAACL,EACC,CAAAO,MAAM,OACNC,OAAO,OACPQ,KAAK,OACLC,eAAe,SACff,WAAW,SACXQ,aAAcjB,EAAMkB,cAAcC,KAClCM,gBAAgB,uBACJ,YAAWf,SAEvBE,EAACc,GAAKC,KAAMC,EAAYjC,GAAOkC,KAAM,GAAIC,MAAM,aAGnDxB,EAACC,EAAG,CAACwB,UAAU,SAASvB,IAAK,EAC3BE,SAAA,CAAAJ,EAACC,EAAG,CAACC,IAAK,EACPE,SAAA,CAAAd,GACCU,EAAC0B,EAAM,CAACC,QAAQ,OAAOC,QAAS,IAAiB,cAAA,0BAC/CtB,EACE,QAAA,CAAAuB,QACA,EAAAC,KAAK,OACLC,GAAG,eACHzC,SA9CU0C,IAClB1C,GAAY0C,EAAEC,OAAOC,QACvB5C,EAAS0C,EAAEC,OAAOC,MAAM,IACxBF,EAAEC,OAAOE,MAAQ,GACnB,IA4CU7B,EAAC8B,EAA2B,CAC1BC,QAAQ,eACRC,QAASA,IAAM9C,MAEfY,SAAAE,EAACc,EAAI,CAACC,KAAK,aAAaE,KAAM,GAAIC,MAAO9B,EAAM6C,OAAOC,cAI5DlC,EAACoB,EAAO,CAAAC,QAAQ,OAAOC,QAAS,IAAKU,QAAS/C,EAC5Ca,SAAAE,EAACc,EAAI,CAACC,KAAK,cAAcE,KAAM,GAAIC,MAAO9B,EAAM6C,OAAOE,cAG3DzC,EAAC0C,EAAI,CAACnB,KAAK,QACRnB,SAAA,CAAAY,EAAY3B,GAAK,KAAIO,GAAc+C,EAAYtD,EAAKkC,cAGrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"file-image-preview-list.comp.js","sources":["../../../../../../src/components/forms/file/file-image-preview-list/file-image-preview-list.comp.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { Text } from '../../../typography'\nimport { FileImagePreview } from '../file-image-preview/file-image-preview.comp'\n\nimport { FileImagePreviewListProps } from './file-image-preview-list.types'\n\nimport * as Styles from './file-image-preview-list.styles'\n\nexport const FileImagePreviewList = ({\n files,\n setFiles,\n onDelete,\n defaultFiles,\n onDeleteDefaultFile,\n ...rest\n}: FileImagePreviewListProps) => {\n const [fileToChange, setFileToChange] = useState<number | null>(null)\n\n const handleUpload = (file: File) => {\n const fileListCopy = [...files]\n if (fileToChange !== null) {\n fileListCopy[fileToChange] = file\n setFiles?.(fileListCopy)\n setFileToChange(null)\n }\n }\n\n return (\n <Styles.FileImageContainer\n data-testid=\"file-image-preview-list\"\n marginTop={1}\n width=\"100%\"\n {...rest}\n >\n {files.map((file, index) => (\n <FileImagePreview\n file={file}\n key={`image-preview-${index}`}\n onChange={(_file) => handleUpload(_file)}\n onClickInput={() => setFileToChange(index)}\n onDelete={() => onDelete?.([index])}\n />\n ))}\n\n {defaultFiles && defaultFiles.length > 0 && (\n <Styles.DefaultFilesContainer\n direction=\"column\"\n width=\"100%\"\n data-testid=\"default-files\"\n >\n <Text color=\"grey_2\" size=\"small\">\n Adicionados anteriormente\n </Text>\n\n <Styles.FileImageContainer marginTop={1}>\n {defaultFiles?.map((file, index) => (\n <FileImagePreview\n file={file}\n key={`default-image-preview-${index}`}\n onDelete={() => onDeleteDefaultFile?.(index)}\n />\n ))}\n </Styles.FileImageContainer>\n </Styles.DefaultFilesContainer>\n )}\n </Styles.FileImageContainer>\n )\n}\n"],"names":["FileImagePreviewList","files","setFiles","onDelete","defaultFiles","onDeleteDefaultFile","rest","fileToChange","setFileToChange","useState","_jsxs","Styles","marginTop","width","children","map","file","index","_jsx","FileImagePreview","onChange","_file","fileListCopy","handleUpload","onClickInput","length","direction","Text","color","size"],"mappings":"wUASO,MAAMA,EAAuBA,EAClCC,QACAC,WACAC,WACAC,eACAC,yBACGC,MAEH,MAAOC,EAAcC,GAAmBC,EAAwB,MAWhE,OACEC,EAACC,iBACa,0BACZC,UAAW,EACXC,MAAM,UACFP,EAEHQ,SAAA,CAAAb,EAAMc,KAAI,CAACC,EAAMC,IAChBC,EAACC,EACC,CAAAH,KAAMA,EAENI,SAAWC,GApBGL,KACpB,MAAMM,EAAe,IAAIrB,GACJ,OAAjBM,IACFe,EAAaf,GAAgBS,EAC7Bd,IAAWoB,GACXd,EAAgB,MAClB,EAc2Be,CAAaF,GAClCG,aAAcA,IAAMhB,EAAgBS,GACpCd,SAAUA,IAAMA,IAAW,CAACc,KAHvB,iBAAiBA,OAOzBb,GAAgBA,EAAaqB,OAAS,GACrCf,EAACC,EACC,CAAAe,UAAU,SACVb,MAAM,qBACM,gBAAeC,SAAA,CAE3BI,EAACS,GAAKC,MAAM,SAASC,KAAK,QAEnBf,SAAA,8BAEPI,EAACP,EAA0B,CAAAC,UAAW,EAACE,SACpCV,GAAcW,KAAI,CAACC,EAAMC,IACxBC,EAACC,EAAgB,CACfH,KAAMA,EAENb,SAAUA,IAAME,IAAsBY,IADR,yBAAAA,cAOd"}
1
+ {"version":3,"file":"file-image-preview-list.comp.js","sources":["../../../../../../src/components/forms/file/file-image-preview-list/file-image-preview-list.comp.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { Text } from '../../../typography'\nimport { FileImagePreview } from '../file-image-preview/file-image-preview.comp'\n\nimport { FileImagePreviewListProps } from './file-image-preview-list.types'\n\nimport * as Styles from './file-image-preview-list.styles'\n\n/**\n * Grade de miniaturas das imagens enviadas, com excluir em cada uma. `defaultFiles` mostra imagens que já estavam salvas (URLs).\n * Normalmente vem pronta dentro do FileDropzone com `multiple` e `preview=\"image\"`.\n * @example <FileImagePreviewList files={fotos} setFiles={setFotos} />\n */\nexport const FileImagePreviewList = ({\n files,\n setFiles,\n onDelete,\n defaultFiles,\n onDeleteDefaultFile,\n ...rest\n}: FileImagePreviewListProps) => {\n const [fileToChange, setFileToChange] = useState<number | null>(null)\n\n const handleUpload = (file: File) => {\n const fileListCopy = [...files]\n if (fileToChange !== null) {\n fileListCopy[fileToChange] = file\n setFiles?.(fileListCopy)\n setFileToChange(null)\n }\n }\n\n return (\n <Styles.FileImageContainer\n data-testid=\"file-image-preview-list\"\n marginTop={1}\n width=\"100%\"\n {...rest}\n >\n {files.map((file, index) => (\n <FileImagePreview\n file={file}\n key={`image-preview-${index}`}\n onChange={(_file) => handleUpload(_file)}\n onClickInput={() => setFileToChange(index)}\n onDelete={() => onDelete?.([index])}\n />\n ))}\n\n {defaultFiles && defaultFiles.length > 0 && (\n <Styles.DefaultFilesContainer\n direction=\"column\"\n width=\"100%\"\n data-testid=\"default-files\"\n >\n <Text color=\"grey_2\" size=\"small\">\n Adicionados anteriormente\n </Text>\n\n <Styles.FileImageContainer marginTop={1}>\n {defaultFiles?.map((file, index) => (\n <FileImagePreview\n file={file}\n key={`default-image-preview-${index}`}\n onDelete={() => onDeleteDefaultFile?.(index)}\n />\n ))}\n </Styles.FileImageContainer>\n </Styles.DefaultFilesContainer>\n )}\n </Styles.FileImageContainer>\n )\n}\n"],"names":["FileImagePreviewList","files","setFiles","onDelete","defaultFiles","onDeleteDefaultFile","rest","fileToChange","setFileToChange","useState","_jsxs","Styles","marginTop","width","children","map","file","index","_jsx","FileImagePreview","onChange","_file","fileListCopy","handleUpload","onClickInput","length","direction","Text","color","size"],"mappings":"wUAcO,MAAMA,EAAuBA,EAClCC,QACAC,WACAC,WACAC,eACAC,yBACGC,MAEH,MAAOC,EAAcC,GAAmBC,EAAwB,MAWhE,OACEC,EAACC,iBACa,0BACZC,UAAW,EACXC,MAAM,UACFP,EAEHQ,SAAA,CAAAb,EAAMc,KAAI,CAACC,EAAMC,IAChBC,EAACC,EACC,CAAAH,KAAMA,EAENI,SAAWC,GApBGL,KACpB,MAAMM,EAAe,IAAIrB,GACJ,OAAjBM,IACFe,EAAaf,GAAgBS,EAC7Bd,IAAWoB,GACXd,EAAgB,MAClB,EAc2Be,CAAaF,GAClCG,aAAcA,IAAMhB,EAAgBS,GACpCd,SAAUA,IAAMA,IAAW,CAACc,KAHvB,iBAAiBA,OAOzBb,GAAgBA,EAAaqB,OAAS,GACrCf,EAACC,EACC,CAAAe,UAAU,SACVb,MAAM,qBACM,gBAAeC,SAAA,CAE3BI,EAACS,GAAKC,MAAM,SAASC,KAAK,QAEnBf,SAAA,8BAEPI,EAACP,EAA0B,CAAAC,UAAW,EAACE,SACpCV,GAAcW,KAAI,CAACC,EAAMC,IACxBC,EAACC,EAAgB,CACfH,KAAMA,EAENb,SAAUA,IAAME,IAAsBY,IADR,yBAAAA,cAOd"}
@@ -1 +1 @@
1
- {"version":3,"file":"file-preview-list.comp.js","sources":["../../../../../../src/components/forms/file/file-preview-list/file-preview-list.comp.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nimport { useTheme } from 'styled-components'\n\nimport { Button } from '../../../buttons'\nimport { Box } from '../../../layout'\nimport { Text } from '../../../typography'\nimport { FilePreview } from '../file-preview/file-preview.comp'\n\nimport { FilePreviewListProps } from './file-preview-list.types'\n\nimport * as Styles from './file-preview-list.styles'\n\nexport const FilePreviewList = ({\n files,\n showImages = false,\n setFiles,\n onDelete,\n defaultFiles,\n onDeleteDefaultFile,\n ...rest\n}: FilePreviewListProps) => {\n const theme = useTheme()\n const [selectedFiles, setSelectedFiles] = useState<number[]>([])\n const [fileToChange, setFileToChange] = useState<number | null>(null)\n\n const handleToggleSelect = (index: number) => {\n let newSelectedFiles: number[] = selectedFiles\n if (selectedFiles.includes(index)) {\n newSelectedFiles = selectedFiles.filter(\n (selectedFiles) => selectedFiles !== index,\n )\n } else {\n newSelectedFiles = [...selectedFiles, index]\n }\n setSelectedFiles(newSelectedFiles)\n }\n\n const handleUpload = (file: File) => {\n const fileListCopy = [...files]\n if (fileToChange !== null) {\n fileListCopy[fileToChange] = file\n setFiles?.(fileListCopy)\n setFileToChange(null)\n }\n }\n\n useEffect(() => {\n setSelectedFiles([])\n }, [onDelete])\n\n return (\n <Styles.FileListPreviewContainer\n data-testid=\"file-list-preview\"\n width=\"100%\"\n {...rest}\n >\n {files.length > 0 && (\n <Box gap={2} alignItems=\"center\" marginTop={2}>\n <Text size=\"small\" color={theme.colors.grey_2}>\n {selectedFiles.length ?? 0} selecionados\n </Text>\n {selectedFiles.length > 0 && (\n <Button\n fontSize={theme.typography.body_size.small}\n variant=\"text\"\n padding=\"0\"\n color={theme.colors.grey_1}\n onClick={() => selectedFiles && onDelete?.(selectedFiles)}\n disabled={selectedFiles.length === 0}\n >\n Deletar\n </Button>\n )}\n </Box>\n )}\n\n {files.map((file, index) => (\n <FilePreview\n file={file}\n key={`file-preview-${index}`}\n onChange={handleUpload}\n onClickInput={() => setFileToChange(index)}\n selectable\n isSelected={selectedFiles.includes(index)}\n onSelect={() => handleToggleSelect(index)}\n onDelete={() => onDelete?.([index])}\n showImage={showImages}\n />\n ))}\n\n {defaultFiles && defaultFiles.length > 0 && (\n <Styles.DefaultFilesContainer\n direction=\"column\"\n marginTop={2}\n width=\"100%\"\n paddingY={2}\n gap={1}\n data-testid=\"default-files\"\n >\n <Text size=\"small\" color={theme.colors.grey_2}>\n Adicionados anteriormente\n </Text>\n {defaultFiles?.map((file, index) => {\n return (\n <FilePreview\n file={file}\n onDelete={() => onDeleteDefaultFile?.(index)}\n showImage={showImages}\n key={`default-file-${index}`}\n />\n )\n })}\n </Styles.DefaultFilesContainer>\n )}\n </Styles.FileListPreviewContainer>\n )\n}\n"],"names":["FilePreviewList","files","showImages","setFiles","onDelete","defaultFiles","onDeleteDefaultFile","rest","theme","useTheme","selectedFiles","setSelectedFiles","useState","fileToChange","setFileToChange","handleUpload","file","fileListCopy","useEffect","_jsxs","Styles","width","children","length","Box","gap","alignItems","marginTop","Text","size","color","colors","grey_2","_jsx","Button","fontSize","typography","body_size","small","variant","padding","grey_1","onClick","disabled","map","index","FilePreview","onChange","onClickInput","selectable","isSelected","includes","onSelect","newSelectedFiles","filter","handleToggleSelect","showImage","direction","paddingY"],"mappings":"yeAaO,MAAMA,EAAkBA,EAC7BC,QACAC,cAAa,EACbC,WACAC,WACAC,eACAC,yBACGC,MAEH,MAAMC,EAAQC,KACPC,EAAeC,GAAoBC,EAAmB,KACtDC,EAAcC,GAAmBF,EAAwB,MAc1DG,EAAgBC,IACpB,MAAMC,EAAe,IAAIhB,GACJ,OAAjBY,IACFI,EAAaJ,GAAgBG,EAC7Bb,IAAWc,GACXH,EAAgB,MAClB,EAOF,OAJAI,GAAU,KACRP,EAAiB,GAAG,GACnB,CAACP,IAGFe,EAACC,EAA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AAgB2C,YAMC"}
1
+ {"version":3,"file":"file-preview-list.comp.js","sources":["../../../../../../src/components/forms/file/file-preview-list/file-preview-list.comp.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nimport { useTheme } from 'styled-components'\n\nimport { Button } from '../../../buttons'\nimport { Box } from '../../../layout'\nimport { Text } from '../../../typography'\nimport { FilePreview } from '../file-preview/file-preview.comp'\n\nimport { FilePreviewListProps } from './file-preview-list.types'\n\nimport * as Styles from './file-preview-list.styles'\n\n/**\n * Lista dos arquivos enviados, com nome, ícone do tipo e excluir. `defaultFiles` mostra arquivos que já estavam salvos (URLs).\n * Normalmente vem pronta dentro do FileDropzone com `multiple` e `preview=\"list\"`.\n * @example <FilePreviewList files={arquivos} setFiles={setArquivos} />\n */\nexport const FilePreviewList = ({\n files,\n showImages = false,\n setFiles,\n onDelete,\n defaultFiles,\n onDeleteDefaultFile,\n ...rest\n}: FilePreviewListProps) => {\n const theme = useTheme()\n const [selectedFiles, setSelectedFiles] = useState<number[]>([])\n const [fileToChange, setFileToChange] = useState<number | null>(null)\n\n const handleToggleSelect = (index: number) => {\n let newSelectedFiles: number[] = selectedFiles\n if (selectedFiles.includes(index)) {\n newSelectedFiles = selectedFiles.filter(\n (selectedFiles) => selectedFiles !== index,\n )\n } else {\n newSelectedFiles = [...selectedFiles, index]\n }\n setSelectedFiles(newSelectedFiles)\n }\n\n const handleUpload = (file: File) => {\n const fileListCopy = [...files]\n if (fileToChange !== null) {\n fileListCopy[fileToChange] = file\n setFiles?.(fileListCopy)\n setFileToChange(null)\n }\n }\n\n useEffect(() => {\n setSelectedFiles([])\n }, [onDelete])\n\n return (\n <Styles.FileListPreviewContainer\n data-testid=\"file-list-preview\"\n width=\"100%\"\n {...rest}\n >\n {files.length > 0 && (\n <Box gap={2} alignItems=\"center\" marginTop={2}>\n <Text size=\"small\" color={theme.colors.grey_2}>\n {selectedFiles.length ?? 0} selecionados\n </Text>\n {selectedFiles.length > 0 && (\n <Button\n fontSize={theme.typography.body_size.small}\n variant=\"text\"\n padding=\"0\"\n color={theme.colors.grey_1}\n onClick={() => selectedFiles && onDelete?.(selectedFiles)}\n disabled={selectedFiles.length === 0}\n >\n Deletar\n </Button>\n )}\n </Box>\n )}\n\n {files.map((file, index) => (\n <FilePreview\n file={file}\n key={`file-preview-${index}`}\n onChange={handleUpload}\n onClickInput={() => setFileToChange(index)}\n selectable\n isSelected={selectedFiles.includes(index)}\n onSelect={() => handleToggleSelect(index)}\n onDelete={() => onDelete?.([index])}\n showImage={showImages}\n />\n ))}\n\n {defaultFiles && defaultFiles.length > 0 && (\n <Styles.DefaultFilesContainer\n direction=\"column\"\n marginTop={2}\n width=\"100%\"\n paddingY={2}\n gap={1}\n data-testid=\"default-files\"\n >\n <Text size=\"small\" color={theme.colors.grey_2}>\n Adicionados anteriormente\n </Text>\n {defaultFiles?.map((file, index) => {\n return (\n <FilePreview\n file={file}\n onDelete={() => onDeleteDefaultFile?.(index)}\n showImage={showImages}\n key={`default-file-${index}`}\n />\n )\n })}\n </Styles.DefaultFilesContainer>\n )}\n </Styles.FileListPreviewContainer>\n )\n}\n"],"names":["FilePreviewList","files","showImages","setFiles","onDelete","defaultFiles","onDeleteDefaultFile","rest","theme","useTheme","selectedFiles","setSelectedFiles","useState","fileToChange","setFileToChange","handleUpload","file","fileListCopy","useEffect","_jsxs","Styles","width","children","length","Box","gap","alignItems","marginTop","Text","size","color","colors","grey_2","_jsx","Button","fontSize","typography","body_size","small","variant","padding","grey_1","onClick","disabled","map","index","FilePreview","onChange","onClickInput","selectable","isSelected","includes","onSelect","newSelectedFiles","filter","handleToggleSelect","showImage","direction","paddingY"],"mappings":"yeAkBO,MAAMA,EAAkBA,EAC7BC,QACAC,cAAa,EACbC,WACAC,WACAC,eACAC,yBACGC,MAEH,MAAMC,EAAQC,KACPC,EAAeC,GAAoBC,EAAmB,KACtDC,EAAcC,GAAmBF,EAAwB,MAc1DG,EAAgBC,IACpB,MAAMC,EAAe,IAAIhB,GACJ,O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AAA,8BACNjB,GAAcuC,KAAI,CAAC5B,EAAM6B,IAEtBZ,EAACa,EAAW,CACV9B,KAAMA,EACNZ,SAAUA,IAAME,IAAsBuC,GACtCW,UAAWtD,GACN,gBAAgB2C,YAMC"}
@@ -1 +1 @@
1
- {"version":3,"file":"icon.comp.js","sources":["../../../../../src/components/icons/icon/icon.comp.tsx"],"sourcesContent":["import React, { useContext, useId } from 'react'\n\nimport * as LucideIcon from 'react-icons/lu'\nimport * as RemixIcon from 'react-icons/ri'\nimport { ThemeContext } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme/theme.util'\n\nimport { IconProps, CustomIconName } from './icon.types'\nimport {\n isLucideName,\n parseIconNameToLucide,\n parseIconNameToRemixIcon,\n} from './icon.utils'\nimport { iconsList } from './svg'\n\nimport * as Styles from './icon.styles'\n\nexport const Icon = ({\n color,\n name,\n size = 24,\n fill: fillProp,\n defs: defsProp,\n gradient,\n ...props\n}: IconProps) => {\n const theme = useContext(ThemeContext)\n const gradientId = `bf-icon-gradient-${useId().replace(/:/g, '')}`\n\n const fill = gradient ? `url(#${gradientId})` : fillProp\n const defs = gradient ? (\n <defs>\n <linearGradient id={gradientId} x1=\"1\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={getThemeColor('secondary', theme)} />\n <stop offset=\"100%\" stopColor={getThemeColor('primary', theme)} />\n </linearGradient>\n </defs>\n ) : (\n defsProp\n )\n\n const customIcon = iconsList(\n gradient\n ? `url(#${gradientId})`\n : getThemeColor(color ? color : 'primary', theme),\n size,\n )[name as CustomIconName]\n\n if (customIcon) {\n if (gradient) {\n return (\n <Styles.IconComp data-testid=\"icon\">\n <Styles.HiddenDefs aria-hidden=\"true\">{defs}</Styles.HiddenDefs>\n {customIcon}\n </Styles.IconComp>\n )\n }\n if (defs && React.isValidElement(customIcon)) {\n const children = (customIcon as React.ReactElement).props.children\n return (\n <Styles.IconComp data-testid=\"icon\">\n {React.cloneElement(customIcon, {}, [\n defs,\n ...(Array.isArray(children)\n ? children\n : children\n ? [children]\n : []),\n ])}\n </Styles.IconComp>\n )\n }\n return <Styles.IconComp data-testid=\"icon\">{customIcon}</Styles.IconComp>\n }\n\n if (isLucideName(name)) {\n const lucideIcon = LucideIcon[parseIconNameToLucide(name)]\n\n if (!lucideIcon) {\n return null\n }\n\n // Lucide desenha com traço: o gradiente (ou `fill` com `defs`) pinta o `stroke`.\n if (defs && fill) {\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n <Styles.HiddenDefs aria-hidden=\"true\">{defs}</Styles.HiddenDefs>\n {React.createElement(lucideIcon, { size, stroke: fill })}\n </Styles.IconComp>\n )\n }\n\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n {React.createElement(lucideIcon, {\n color: getThemeColor(color ? color : 'primary', theme) || color,\n size,\n })}\n </Styles.IconComp>\n )\n }\n\n const remixIcon = RemixIcon[parseIconNameToRemixIcon(name as string)]\n\n if (!remixIcon) {\n return null\n }\n\n if (defs && fill) {\n return (\n <Styles.IconComp data-testid=\"icon\">\n <svg\n width={`${size}px`}\n height={`${size}px`}\n viewBox={`0 0 ${size} ${size}`}\n fill={fill}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {defs}\n {React.createElement(remixIcon, {\n size: size,\n fill: fill,\n style: { position: 'relative', zIndex: 1 },\n })}\n </svg>\n </Styles.IconComp>\n )\n }\n\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n {React.createElement(remixIcon, {\n color: getThemeColor(color ? color : 'primary', theme) || color,\n size: size,\n })}\n </Styles.IconComp>\n )\n}\n"],"names":["Icon","color","name","size","fill","fillProp","defs","defsProp","gradient","props","theme","useContext","ThemeContext","gradientId","useId","replace","_jsx","children","_jsxs","id","x1","y1","x2","y2","offset","stopColor","getThemeColor","customIcon","iconsList","Styles","React","isValidElement","cloneElement","Array","isArray","isLucideName","lucideIcon","LucideIcon","parseIconNameToLucide","createElement","stroke","remixIcon","RemixIcon","parseIconNameToRemixIcon","width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AQpC,OAMrDY,EAACa,EAA4B,CAAA,cAAA,UAAWpB,WACrCqB,EAAMS,cAAcH,EAAY,CAC/BnC,MAAOyB,EAAczB,GAAgB,UAAWS,IAAUT,EAC1DE,WAjBG,IAqBX,CAEA,MAAMsC,EAAYC,EAAUC,EAAyBzC,IAErD,OAAKuC,EAMDzB,EAACa,EAFDvB,GAAQF,EAEqB,CAAA,cAAA,gBAC3Bc,EACE,MAAA,CAAA0B,MAAU,GAAAzC,MACV0C,OAAW,GAAA1C,MACX2C,QAAgB,OAAA3C,KAAQA,IACxBC,KAAMA,EACN2C,MAAM,6BAA4B9B,SAAA,CAEjCX,EACAwB,EAAMS,cAAcE,EAAW,CAC9BtC,KAAMA,EACNC,KAAMA,EACN4C,MAAO,CAAEC,SAAU,WAAYC,OAAQ,SAQlB,CAAA,cAAA,UAAWzC,WACrCqB,EAAMS,cAAcE,EAAW,CAC9BxC,MAAOyB,EAAczB,GAAgB,UAAWS,IAAUT,EAC1DE,KAAMA,MA5BH,IA8BW"}
1
+ {"version":3,"file":"icon.comp.js","sources":["../../../../../src/components/icons/icon/icon.comp.tsx"],"sourcesContent":["import React, { useContext, useId } from 'react'\n\nimport * as LucideIcon from 'react-icons/lu'\nimport * as RemixIcon from 'react-icons/ri'\nimport { ThemeContext } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme/theme.util'\n\nimport { IconProps, CustomIconName } from './icon.types'\nimport {\n isLucideName,\n parseIconNameToLucide,\n parseIconNameToRemixIcon,\n} from './icon.utils'\nimport { iconsList } from './svg'\n\nimport * as Styles from './icon.styles'\n\n/**\n * Ícone da biblioteca do DS pelo nome: ícones próprios da Blockforce, Remix e Lucide (`lu:nome`).\n * `color` usa as cores do tema e `gradient` pinta com o gradiente da marca. A lista de nomes está em `lib/ai/icons.txt`.\n * Para ícone clicável use IconButton; para ícone dentro de uma caixinha use IconBox.\n * @example <Icon name=\"leaf\" size={20} color=\"primary\" />\n */\nexport const Icon = ({\n color,\n name,\n size = 24,\n fill: fillProp,\n defs: defsProp,\n gradient,\n ...props\n}: IconProps) => {\n const theme = useContext(ThemeContext)\n const gradientId = `bf-icon-gradient-${useId().replace(/:/g, '')}`\n\n const fill = gradient ? `url(#${gradientId})` : fillProp\n const defs = gradient ? (\n <defs>\n <linearGradient id={gradientId} x1=\"1\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={getThemeColor('secondary', theme)} />\n <stop offset=\"100%\" stopColor={getThemeColor('primary', theme)} />\n </linearGradient>\n </defs>\n ) : (\n defsProp\n )\n\n const customIcon = iconsList(\n gradient\n ? `url(#${gradientId})`\n : getThemeColor(color ? color : 'primary', theme),\n size,\n )[name as CustomIconName]\n\n if (customIcon) {\n if (gradient) {\n return (\n <Styles.IconComp data-testid=\"icon\">\n <Styles.HiddenDefs aria-hidden=\"true\">{defs}</Styles.HiddenDefs>\n {customIcon}\n </Styles.IconComp>\n )\n }\n if (defs && React.isValidElement(customIcon)) {\n const children = (customIcon as React.ReactElement).props.children\n return (\n <Styles.IconComp data-testid=\"icon\">\n {React.cloneElement(customIcon, {}, [\n defs,\n ...(Array.isArray(children)\n ? children\n : children\n ? [children]\n : []),\n ])}\n </Styles.IconComp>\n )\n }\n return <Styles.IconComp data-testid=\"icon\">{customIcon}</Styles.IconComp>\n }\n\n if (isLucideName(name)) {\n const lucideIcon = LucideIcon[parseIconNameToLucide(name)]\n\n if (!lucideIcon) {\n return null\n }\n\n // Lucide desenha com traço: o gradiente (ou `fill` com `defs`) pinta o `stroke`.\n if (defs && fill) {\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n <Styles.HiddenDefs aria-hidden=\"true\">{defs}</Styles.HiddenDefs>\n {React.createElement(lucideIcon, { size, stroke: fill })}\n </Styles.IconComp>\n )\n }\n\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n {React.createElement(lucideIcon, {\n color: getThemeColor(color ? color : 'primary', theme) || color,\n size,\n })}\n </Styles.IconComp>\n )\n }\n\n const remixIcon = RemixIcon[parseIconNameToRemixIcon(name as string)]\n\n if (!remixIcon) {\n return null\n }\n\n if (defs && fill) {\n return (\n <Styles.IconComp data-testid=\"icon\">\n <svg\n width={`${size}px`}\n height={`${size}px`}\n viewBox={`0 0 ${size} ${size}`}\n fill={fill}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {defs}\n {React.createElement(remixIcon, {\n size: size,\n fill: fill,\n style: { position: 'relative', zIndex: 1 },\n })}\n </svg>\n </Styles.IconComp>\n )\n }\n\n return (\n <Styles.IconComp data-testid=\"icon\" {...props}>\n {React.createElement(remixIcon, {\n color: getThemeColor(color ? color : 'primary', theme) || color,\n size: size,\n })}\n </Styles.IconComp>\n )\n}\n"],"names":["Icon","color","name","size","fill","fillProp","defs","defsProp","gradient","props","theme","useContext","ThemeContext","gradientId","useId","replace","_jsx","children","_jsxs","id","x1","y1","x2","y2","offset","stopColor","getThemeColor","customIcon","iconsList","Styles","React","isValidElement","cloneElement","Array","isArray","isLucideName","lucideIcon","LucideIcon","parseIconNameToLucide","createElement","stroke","remixIcon","RemixIcon","parseIconNameToRemixIcon","width","height","viewBox","xmlns","style","position","zIndex"],"mappings":"keAwBO,MAAMA,EAAOA,EAClBC,QACAC,OACAC,OAAO,GACPC,KAAMC,EACNC,KAAMC,EACNC,cACGC,MAEH,MAAMC,EAAQC,EAAWC,GACnBC,EAAiC,oBAAAC,IAAQC,QAAQ,KAAM,MAEvDX,EAAOI,EAAmB,QAAAK,KAAgBR,EAC1CC,EAAOE,EACXQ,EAAA,OAAA,CAAAC,SACEC,EAAgB,iBAAA,CAAAC,GAAIN,EAAYO,GAAG,IAAIC,GAAG,IAAIC,GAAG,IAAIC,GAAG,IACtDN,SAAA,CAAAD,EAAA,OAAA,CAAMQ,OAAO,KAAKC,UAAWC,EAAc,YAAahB,KACxDM,EAAM,OAAA,CAAAQ,OAAO,OAAOC,UAAWC,EAAc,UAAWhB,UAI5DH,EAGIoB,EAAaC,EACjBpB,EACY,QAAAK,K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