blockforce-design-system 2.0.4 → 2.0.6
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/MIGRATION.md +41 -33
- package/lib/ai/components.json +51 -10
- package/lib/ai/tokens.md +1 -1
- package/lib/commonjs/components/charts/bar-chart/bar-chart.comp.js +1 -1
- package/lib/commonjs/components/charts/bar-chart/bar-chart.comp.js.map +1 -1
- package/lib/commonjs/components/charts/chart-legend/chart-legend.comp.js +1 -1
- package/lib/commonjs/components/charts/chart-legend/chart-legend.comp.js.map +1 -1
- package/lib/commonjs/components/charts/chart-legend/chart-legend.styles.js +22 -15
- package/lib/commonjs/components/charts/chart-legend/chart-legend.styles.js.map +1 -1
- package/lib/commonjs/components/charts/doughnut-chart/doughnut-chart.comp.js +1 -1
- package/lib/commonjs/components/charts/doughnut-chart/doughnut-chart.comp.js.map +1 -1
- package/lib/commonjs/components/charts/line-chart/line-chart.comp.js +1 -1
- package/lib/commonjs/components/charts/line-chart/line-chart.comp.js.map +1 -1
- package/lib/commonjs/components/charts/treemap-chart/treemap-chart.comp.js +1 -1
- package/lib/commonjs/components/charts/treemap-chart/treemap-chart.comp.js.map +1 -1
- package/lib/commonjs/components/icons/icon-box/icon-box.comp.js +1 -1
- package/lib/commonjs/components/icons/icon-box/icon-box.comp.js.map +1 -1
- package/lib/commonjs/components/icons/icon-box/icon-box.styles.js +7 -4
- package/lib/commonjs/components/icons/icon-box/icon-box.styles.js.map +1 -1
- package/lib/commonjs/components/layout/card/card.styles.js +3 -52
- package/lib/commonjs/components/layout/card/card.styles.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/theme/gradient-border.js +51 -0
- package/lib/commonjs/theme/gradient-border.js.map +1 -0
- package/lib/index.d.ts +88 -15
- package/lib/module/components/charts/bar-chart/bar-chart.comp.js +1 -1
- package/lib/module/components/charts/bar-chart/bar-chart.comp.js.map +1 -1
- package/lib/module/components/charts/chart-legend/chart-legend.comp.js +1 -1
- package/lib/module/components/charts/chart-legend/chart-legend.comp.js.map +1 -1
- package/lib/module/components/charts/chart-legend/chart-legend.styles.js +21 -14
- package/lib/module/components/charts/chart-legend/chart-legend.styles.js.map +1 -1
- package/lib/module/components/charts/doughnut-chart/doughnut-chart.comp.js +1 -1
- package/lib/module/components/charts/doughnut-chart/doughnut-chart.comp.js.map +1 -1
- package/lib/module/components/charts/line-chart/line-chart.comp.js +1 -1
- package/lib/module/components/charts/line-chart/line-chart.comp.js.map +1 -1
- package/lib/module/components/charts/treemap-chart/treemap-chart.comp.js +1 -1
- package/lib/module/components/charts/treemap-chart/treemap-chart.comp.js.map +1 -1
- package/lib/module/components/icons/icon-box/icon-box.comp.js +1 -1
- package/lib/module/components/icons/icon-box/icon-box.comp.js.map +1 -1
- package/lib/module/components/icons/icon-box/icon-box.styles.js +7 -4
- package/lib/module/components/icons/icon-box/icon-box.styles.js.map +1 -1
- package/lib/module/components/layout/card/card.styles.js +3 -52
- package/lib/module/components/layout/card/card.styles.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/theme/gradient-border.js +51 -0
- package/lib/module/theme/gradient-border.js.map +1 -0
- package/llms-full.txt +36 -5
- package/llms.txt +10 -2
- package/package.json +1 -1
package/MIGRATION.md
CHANGED
|
@@ -57,38 +57,38 @@ Em cada par, o nome antigo e o novo apontam para o mesmo componente. Um teste co
|
|
|
57
57
|
|
|
58
58
|
### 3.2 Novos
|
|
59
59
|
|
|
60
|
-
| Componente | Para que serve
|
|
61
|
-
| -------------------------------------------------------------------- |
|
|
62
|
-
| `IconButton` | Botão só com ícone. O `label` é obrigatório e vira o nome acessível.
|
|
63
|
-
| `RadioGroup` | Uma escolha entre poucas opções visíveis.
|
|
64
|
-
| `SearchInput` | Busca com lupa, `debounce` e botão de limpar.
|
|
65
|
-
| `DatePicker`, `DateRangePicker` | Uma data, ou um período com atalhos. O valor é `YYYY-MM-DD`.
|
|
66
|
-
| `Tag` | Etiqueta curta de status ou categoria. Tem `loading`, ícones e gradiente.
|
|
67
|
-
| `Toast` + `ToastProvider` + `useToast()` | Aviso rápido: `toast.success/error/warning/info(msg, { duration?, closable? })`.
|
|
68
|
-
| `Alert` | Aviso fixo na página.
|
|
69
|
-
| `EmptyState` | Área vazia, carregando ou com erro (`state`).
|
|
70
|
-
| `ProgressBar` | Quanto de uma tarefa já foi feito.
|
|
71
|
-
| `Skeleton` | Forma do conteúdo enquanto carrega.
|
|
72
|
-
| `ConfirmDialog` + `ConfirmDialogProvider` + `useConfirm()` | Confirmação antes de uma ação importante, com motivo opcional.
|
|
73
|
-
| `ActionMenu` | Menu de ações de um item.
|
|
74
|
-
| `Breadcrumb` | Caminho de navegação.
|
|
75
|
-
| `Stepper` | Passos de um fluxo longo.
|
|
76
|
-
| `ViewToggle` | Troca de visão do mesmo conteúdo (lista ou árvore, por exemplo).
|
|
77
|
-
| `NavigationCard`, `NavigationCards` | Atalhos em card no topo de uma dash, para poucos atalhos (até uns cinco).
|
|
78
|
-
| `NavigationSections` | Painel de atalhos agrupados em seções, para módulos com muitas telas.
|
|
79
|
-
| `Card` | Superfície de um bloco (`elevated`, `outlined` ou `subtle`), com borda em gradiente opcional, que pode ser animada.
|
|
80
|
-
| `StatCard` | Indicador de dashboard.
|
|
81
|
-
| `TitleCard` | Cabeçalho de card.
|
|
82
|
-
| `Divider` | Linha que separa blocos.
|
|
83
|
-
| `Calendar` | Mês com eventos por dia.
|
|
84
|
-
| `Matrix` | Grade de linhas × colunas: riscos, materialidade, status.
|
|
85
|
-
| `InfoItem` | Par rótulo e valor.
|
|
86
|
-
| `TintedSection` | Seção com fundo tingido na cor do tema.
|
|
87
|
-
| `TreeNode` (`.Title`, `.Caption`) | Nó da árvore de rastreabilidade. Com `onClick`, exige `aria-label`.
|
|
88
|
-
| `CanvasPanel`, `CanvasButton`, `DirectionToggle`, `FullscreenToggle` | Barra de ferramentas do canvas da árvore.
|
|
89
|
-
| `SidePanel` + `SelectableItem` | Lista lateral recolhível, com busca e item selecionado.
|
|
90
|
-
| `ChartLegend` | Legenda de gráfico.
|
|
91
|
-
| `IconBox` | Ícone dentro de uma caixinha.
|
|
60
|
+
| Componente | Para que serve |
|
|
61
|
+
| -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `IconButton` | Botão só com ícone. O `label` é obrigatório e vira o nome acessível. |
|
|
63
|
+
| `RadioGroup` | Uma escolha entre poucas opções visíveis. |
|
|
64
|
+
| `SearchInput` | Busca com lupa, `debounce` e botão de limpar. |
|
|
65
|
+
| `DatePicker`, `DateRangePicker` | Uma data, ou um período com atalhos. O valor é `YYYY-MM-DD`. |
|
|
66
|
+
| `Tag` | Etiqueta curta de status ou categoria. Tem `loading`, ícones e gradiente. |
|
|
67
|
+
| `Toast` + `ToastProvider` + `useToast()` | Aviso rápido: `toast.success/error/warning/info(msg, { duration?, closable? })`. |
|
|
68
|
+
| `Alert` | Aviso fixo na página. |
|
|
69
|
+
| `EmptyState` | Área vazia, carregando ou com erro (`state`). |
|
|
70
|
+
| `ProgressBar` | Quanto de uma tarefa já foi feito. |
|
|
71
|
+
| `Skeleton` | Forma do conteúdo enquanto carrega. |
|
|
72
|
+
| `ConfirmDialog` + `ConfirmDialogProvider` + `useConfirm()` | Confirmação antes de uma ação importante, com motivo opcional. |
|
|
73
|
+
| `ActionMenu` | Menu de ações de um item. |
|
|
74
|
+
| `Breadcrumb` | Caminho de navegação. |
|
|
75
|
+
| `Stepper` | Passos de um fluxo longo. |
|
|
76
|
+
| `ViewToggle` | Troca de visão do mesmo conteúdo (lista ou árvore, por exemplo). |
|
|
77
|
+
| `NavigationCard`, `NavigationCards` | Atalhos em card no topo de uma dash, para poucos atalhos (até uns cinco). |
|
|
78
|
+
| `NavigationSections` | Painel de atalhos agrupados em seções, para módulos com muitas telas. |
|
|
79
|
+
| `Card` | Superfície de um bloco (`elevated`, `outlined` ou `subtle`), com borda em gradiente opcional, que pode ser animada. |
|
|
80
|
+
| `StatCard` | Indicador de dashboard. |
|
|
81
|
+
| `TitleCard` | Cabeçalho de card. |
|
|
82
|
+
| `Divider` | Linha que separa blocos. |
|
|
83
|
+
| `Calendar` | Mês com eventos por dia. |
|
|
84
|
+
| `Matrix` | Grade de linhas × colunas: riscos, materialidade, status. |
|
|
85
|
+
| `InfoItem` | Par rótulo e valor. |
|
|
86
|
+
| `TintedSection` | Seção com fundo tingido na cor do tema. |
|
|
87
|
+
| `TreeNode` (`.Title`, `.Caption`) | Nó da árvore de rastreabilidade. Com `onClick`, exige `aria-label`. |
|
|
88
|
+
| `CanvasPanel`, `CanvasButton`, `DirectionToggle`, `FullscreenToggle` | Barra de ferramentas do canvas da árvore. |
|
|
89
|
+
| `SidePanel` + `SelectableItem` | Lista lateral recolhível, com busca e item selecionado. |
|
|
90
|
+
| `ChartLegend` | Legenda de gráfico. `variant="square"` é a das roscas das dashboards: quadradinho e "Nome: valor". |
|
|
91
|
+
| `IconBox` | Ícone dentro de uma caixinha. `shape="circle"` e `gradientBorder` (fixa ou `"animated"`) para o ícone de agente de IA. |
|
|
92
92
|
|
|
93
93
|
**Hooks novos:**
|
|
94
94
|
|
|
@@ -248,7 +248,13 @@ Nenhuma prop foi removida.
|
|
|
248
248
|
- **+ `legend`:** `side` ou `bottom`.
|
|
249
249
|
- **`customContent`:** não tem mais o tamanho e a cor do texto sobrescritos pelo DS.
|
|
250
250
|
|
|
251
|
-
**BarChart, LineChart e TreemapChart:** usam a sombra e as cores de texto do tema.
|
|
251
|
+
**BarChart, LineChart e TreemapChart:** usam a sombra e as cores de texto do tema.
|
|
252
|
+
|
|
253
|
+
**Cores dos gráficos (DoughnutChart, BarChart, LineChart, TreemapChart):**
|
|
254
|
+
|
|
255
|
+
- **`color` aceita o nome do token:** `'chart.blue'`, além do valor (`theme.colors.chart.blue` ou hex). A `ChartLegend` já aceitava.
|
|
256
|
+
- **`color` ficou opcional** na rosca, na linha e no treemap: sem cor, a peça segue a ordem de `getChartColors`. A barra continua em `secondary` sem cor.
|
|
257
|
+
- **Gráfico usa só `chart.*`,** mesmo quando a fatia é um status. Os exemplos e as stories em hex e `success` foram trocados.
|
|
252
258
|
|
|
253
259
|
**Sem mudança de API:** `Image` e `TextLink`.
|
|
254
260
|
|
|
@@ -331,6 +337,7 @@ O `legacyTheme` mantém todos os valores da v1.
|
|
|
331
337
|
| `getContrastRatio`, `getReadableTextColor`, `mixColors` | Contraste e mistura de cores. |
|
|
332
338
|
| `createClientTheme` | Monta o tema de cliente. Só aceita hex `#RGB` ou `#RRGGBB`. |
|
|
333
339
|
| `thinScrollbar`, `thinScrollbarOnHover` | Barra de rolagem fina (4px, `grey_4`) para usar em styled-components, a mesma das peças do DS. A segunda só aparece com o mouse em cima. |
|
|
340
|
+
| `gradientBorder({ animated, width, radius, theme })` | Borda no gradiente da marca, fixa ou girando, a mesma do `Card` e do `IconBox`. |
|
|
334
341
|
|
|
335
342
|
**Corrigidos:**
|
|
336
343
|
|
|
@@ -376,6 +383,7 @@ Use para landing, slides, vídeos e HTML sem React.
|
|
|
376
383
|
| `grey_6` e sombras | Novos valores (4.3). | Nada. |
|
|
377
384
|
| Modal (z-index 1200) | Listas próprias com z-index 1000 ficam atrás dele. | Suba essas listas para `theme.zIndex.dropdown` (1300). |
|
|
378
385
|
| Estilos do projeto que sobrescrevem estilos internos do DS | Podem ganhar ou perder pela ordem de carregamento dos estilos. | Revise as telas. O DoughnutChart foi um caso real, já corrigido. |
|
|
386
|
+
| TreemapChart com item sem `color` | O bloco sai na paleta de gráfico, na ordem de `getChartColors`, em vez de cinza (`#cccccc`). | Passe `color` no item para escolher. |
|
|
379
387
|
| Barra de rolagem de Modal, Autocomplete, Carousel, Drawer, Popover, Table, Calendar, SidePanel e Matrix | Fica fina (4px), com polegar `grey_4` e trilho transparente. No Carousel continua aparecendo só no hover. | Nada. Para a mesma barra nas telas do projeto, use `thinScrollbar`. |
|
|
380
388
|
|
|
381
389
|
### 6.2 Compatibilidades adicionadas
|
package/lib/ai/components.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blockforce-design-system",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"storybook": "https://designsystem.blockforce.ai",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
@@ -4200,7 +4200,7 @@
|
|
|
4200
4200
|
{
|
|
4201
4201
|
"name": "BarChart",
|
|
4202
4202
|
"group": "Gráficos",
|
|
4203
|
-
"description": "Gráfico de barras para comparar valores entre categorias (ex.: emissões por fornecedor).\nCada item de `data` é uma barra, com `name` e `value`.\nPara evolução no tempo use LineChart; para partes de um total use DoughnutChart.",
|
|
4203
|
+
"description": "Gráfico de barras para comparar valores entre categorias (ex.: emissões por fornecedor).\nCada item de `data` é uma barra, com `name` e `value`.\nPara evolução no tempo use LineChart; para partes de um total use DoughnutChart.\nCor da barra pela paleta de gráfico (`color: 'chart.purple'`), mesmo quando a barra é um status.",
|
|
4204
4204
|
"examples": [
|
|
4205
4205
|
"<BarChart data={[{ name: 'Jan', value: 10 }, { name: 'Fev', value: 14 }]} />"
|
|
4206
4206
|
],
|
|
@@ -4308,9 +4308,10 @@
|
|
|
4308
4308
|
{
|
|
4309
4309
|
"name": "ChartLegend",
|
|
4310
4310
|
"group": "Gráficos",
|
|
4311
|
-
"description": "Legenda de gráfico: bolinha na cor da série, nome e valor opcional.\nUse ao lado ou abaixo de qualquer gráfico; o DoughnutChart já monta a dele com a prop `legend
|
|
4311
|
+
"description": "Legenda de gráfico: bolinha na cor da série, nome e valor opcional.\nUse ao lado ou abaixo de qualquer gráfico; o DoughnutChart já monta a dele com a prop `legend`.\n`variant=\"square\"` é a legenda das roscas das dashboards: quadradinho e \"Nome: valor\".",
|
|
4312
4312
|
"examples": [
|
|
4313
|
-
"<ChartLegend items={[{ label: 'Aprovados', color: '
|
|
4313
|
+
"<ChartLegend items={[{ label: 'Aprovados', color: 'chart.blue', value: '60%' }]} />",
|
|
4314
|
+
"<ChartLegend variant=\"square\" direction=\"column\" items={[{ label: 'Pendentes', color: 'chart.purple', value: 850 }]} />"
|
|
4314
4315
|
],
|
|
4315
4316
|
"aliases": [],
|
|
4316
4317
|
"docs": "https://designsystem.blockforce.ai/?path=/docs/gráficos-chartlegend--docs",
|
|
@@ -4334,15 +4335,27 @@
|
|
|
4334
4335
|
"default": "row",
|
|
4335
4336
|
"description": "`row`: itens lado a lado, quebrando linha. `column`: um por linha, com o valor alinhado à direita.",
|
|
4336
4337
|
"deprecated": null
|
|
4338
|
+
},
|
|
4339
|
+
{
|
|
4340
|
+
"name": "variant",
|
|
4341
|
+
"type": "ChartLegendVariant",
|
|
4342
|
+
"values": [
|
|
4343
|
+
"square",
|
|
4344
|
+
"dot"
|
|
4345
|
+
],
|
|
4346
|
+
"required": false,
|
|
4347
|
+
"default": "dot",
|
|
4348
|
+
"description": "Visual da legenda.\n- `dot`: bolinha, nome e valor em destaque (à direita no `column`).\n- `square`: quadradinho e \"Nome: valor\" na mesma linha, em texto pequeno. É o das roscas das\n dashboards da plataforma (cards por status).",
|
|
4349
|
+
"deprecated": null
|
|
4337
4350
|
}
|
|
4338
4351
|
]
|
|
4339
4352
|
},
|
|
4340
4353
|
{
|
|
4341
4354
|
"name": "DoughnutChart",
|
|
4342
4355
|
"group": "Gráficos",
|
|
4343
|
-
"description": "Rosca que mostra partes de um total (ex.: 60% dos fornecedores aprovados).\n`parts` são as fatias; o que faltar para chegar em `totalValue` aparece em cinza.\n`legend` mostra a legenda das fatias com nome ao lado (`side`) ou abaixo (`bottom`).\nUse com até 5 fatias. Com mais categorias use BarChart.",
|
|
4356
|
+
"description": "Rosca que mostra partes de um total (ex.: 60% dos fornecedores aprovados).\n`parts` são as fatias; o que faltar para chegar em `totalValue` aparece em cinza.\n`legend` mostra a legenda das fatias com nome ao lado (`side`) ou abaixo (`bottom`).\nUse com até 5 fatias. Com mais categorias use BarChart.\nAs fatias usam a paleta de gráfico (`chart.*`), mesmo quando cada uma é um status: passe o nome\n(`color: 'chart.blue'`) ou deixe sem cor, que a rosca segue a ordem de `getChartColors`.",
|
|
4344
4357
|
"examples": [
|
|
4345
|
-
"<DoughnutChart totalValue={100} parts={[{ value: 60, color: '
|
|
4358
|
+
"<DoughnutChart totalValue={100} parts={[{ value: 60, color: 'chart.blue', name: 'Aprovados' }]} />"
|
|
4346
4359
|
],
|
|
4347
4360
|
"aliases": [],
|
|
4348
4361
|
"docs": "https://designsystem.blockforce.ai/?path=/docs/gráficos-doughnutchart--docs",
|
|
@@ -4447,7 +4460,7 @@
|
|
|
4447
4460
|
"group": "Gráficos",
|
|
4448
4461
|
"description": "Gráfico de linhas para mostrar evolução no tempo, com uma ou mais séries (`series`).\n`showArea` preenche a área abaixo da linha.\nPara comparar categorias sem ordem de tempo use BarChart.",
|
|
4449
4462
|
"examples": [
|
|
4450
|
-
"<LineChart data={dados} series={[{ dataKey: 'total', name: 'Total', color: '
|
|
4463
|
+
"<LineChart data={dados} series={[{ dataKey: 'total', name: 'Total', color: 'chart.purple' }]} />"
|
|
4451
4464
|
],
|
|
4452
4465
|
"aliases": [],
|
|
4453
4466
|
"docs": "https://designsystem.blockforce.ai/?path=/docs/gráficos-linechart--docs",
|
|
@@ -4529,7 +4542,7 @@
|
|
|
4529
4542
|
{
|
|
4530
4543
|
"name": "TreemapChart",
|
|
4531
4544
|
"group": "Gráficos",
|
|
4532
|
-
"description": "Retângulos com área proporcional ao valor, para mostrar o peso de muitas categorias de uma vez (ex.: volume por material).\nPara poucas categorias use BarChart ou DoughnutChart.",
|
|
4545
|
+
"description": "Retângulos com área proporcional ao valor, para mostrar o peso de muitas categorias de uma vez (ex.: volume por material).\nPara poucas categorias use BarChart ou DoughnutChart.\nCor de cada bloco pela paleta de gráfico (`color: 'chart.lilac'`); sem cor, segue a ordem de\n`getChartColors`.",
|
|
4533
4546
|
"examples": [
|
|
4534
4547
|
"<TreemapChart data={[{ name: 'Algodão', value: 120 }, { name: 'Poliéster', value: 40 }]} />"
|
|
4535
4548
|
],
|
|
@@ -4693,9 +4706,10 @@
|
|
|
4693
4706
|
{
|
|
4694
4707
|
"name": "IconBox",
|
|
4695
4708
|
"group": "Imagens e ícones",
|
|
4696
|
-
"description": "Ícone dentro de uma caixinha com borda e sombra leve. É o ícone dos títulos de card e dos números\ndas dashboards. Sem `color`, o ícone vem no gradiente da marca.\nUse para identificar um bloco; não use como botão (use IconButton).",
|
|
4709
|
+
"description": "Ícone dentro de uma caixinha com borda e sombra leve. É o ícone dos títulos de card e dos números\ndas dashboards. Sem `color`, o ícone vem no gradiente da marca.\n`shape=\"circle\"` com `gradientBorder=\"animated\"` é o ícone de um agente de IA ao lado do nome dele.\nUse para identificar um bloco; não use como botão (use IconButton).",
|
|
4697
4710
|
"examples": [
|
|
4698
|
-
"<IconBox icon=\"file_list3\" />"
|
|
4711
|
+
"<IconBox icon=\"file_list3\" />",
|
|
4712
|
+
"<IconBox icon=\"robot2\" shape=\"circle\" gradientBorder=\"animated\" />"
|
|
4699
4713
|
],
|
|
4700
4714
|
"aliases": [],
|
|
4701
4715
|
"docs": "https://designsystem.blockforce.ai/?path=/docs/imagens-e-ícones-iconbox--docs",
|
|
@@ -4718,6 +4732,26 @@
|
|
|
4718
4732
|
"description": "Cor do ícone (token do tema). Sem ela, o ícone usa o gradiente da marca.",
|
|
4719
4733
|
"deprecated": null
|
|
4720
4734
|
},
|
|
4735
|
+
{
|
|
4736
|
+
"name": "gradientBorder",
|
|
4737
|
+
"type": "boolean | \"animated\"",
|
|
4738
|
+
"required": false,
|
|
4739
|
+
"default": null,
|
|
4740
|
+
"description": "Borda no gradiente da marca, como no Card.\n- `true`: borda fixa (1px), para destacar.\n- `'animated'`: borda (2px) com as cores da marca girando devagar, para algo vivo ou em\n andamento (um agente trabalhando). Use um por tela; quem pediu menos movimento no sistema vê\n a borda parada.",
|
|
4741
|
+
"deprecated": null
|
|
4742
|
+
},
|
|
4743
|
+
{
|
|
4744
|
+
"name": "shape",
|
|
4745
|
+
"type": "IconBoxShape",
|
|
4746
|
+
"values": [
|
|
4747
|
+
"circle",
|
|
4748
|
+
"square"
|
|
4749
|
+
],
|
|
4750
|
+
"required": false,
|
|
4751
|
+
"default": "square",
|
|
4752
|
+
"description": "Formato da caixa. `square` é o dos títulos de card e números; `circle` é para quem age\n(agente de IA, assistente), ao lado de um nome.",
|
|
4753
|
+
"deprecated": null
|
|
4754
|
+
},
|
|
4721
4755
|
{
|
|
4722
4756
|
"name": "size",
|
|
4723
4757
|
"type": "number",
|
|
@@ -6455,6 +6489,13 @@
|
|
|
6455
6489
|
"description": "Tema padrão Blockforce. Montado a partir dos tokens; para mudar um valor, edite `tokens/*.tokens.json`.",
|
|
6456
6490
|
"examples": []
|
|
6457
6491
|
},
|
|
6492
|
+
{
|
|
6493
|
+
"name": "gradientBorder",
|
|
6494
|
+
"description": "Borda no gradiente da marca (45°, roxo → teal), fixa ou girando. Fundo branco por dentro.\nÉ a borda do `Card` com `gradientBorder` e do `IconBox` com `gradientBorder`.\nA animada gira só uma camada com `transform`, sem repintar o conteúdo.",
|
|
6495
|
+
"examples": [
|
|
6496
|
+
"const Box = styled.div`\n ${({ theme }) => gradientBorder({ animated: true, width: 2, radius: theme.radius.full, theme })}\n`"
|
|
6497
|
+
]
|
|
6498
|
+
},
|
|
6458
6499
|
{
|
|
6459
6500
|
"name": "breakpointValues",
|
|
6460
6501
|
"description": "Larguras de tela em pixels, como número.",
|
package/lib/ai/tokens.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("styled-components"),t=require("./bar-chart.styles.js"),o=require("../../../node_modules/recharts/es6/component/ResponsiveContainer.js"),s=require("../../../node_modules/recharts/es6/chart/BarChart.js"),i=require("../../../node_modules/recharts/es6/cartesian/CartesianGrid.js"),a=require("../../../node_modules/recharts/es6/cartesian/XAxis.js"),l=require("../../../node_modules/recharts/es6/cartesian/YAxis.js"),n=require("../../../node_modules/recharts/es6/component/Tooltip.js"),h=require("../../../node_modules/recharts/es6/cartesian/Bar.js"),d=require("../../../node_modules/recharts/es6/component/Cell.js"),c=require("../../../node_modules/recharts/es6/component/LabelList.js"),m=require("../../../theme/theme.util.js"),u=require("../../typography/text/text.comp.js");const g=({active:r,payload:o,label:s})=>r&&o&&o.length?e.jsxs(t.CustomTooltip,{direction:"column",gap:1,children:[e.jsx(u.Text,{size:"small",fontWeight:500,children:s}),o.map(((r,t)=>e.jsx(u.Text,{size:"small",color:r.color||r.payload?.color,children:r.value},t)))]}):null;exports.BarChart=({width:u="100%",height:p=300,data:x,showGrid:j=!0,xAxisLabel:y,yAxisLabel:C,yAxisFormatter:f,barSize:b,radius:_,showLabels:T=!1,labelFormatter:q,barCategoryGap:v})=>{const z=r.useTheme();return e.jsx(t.ChartContainer,{"data-testid":"bar-chart",width:u,height:p,children:e.jsx(o.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(s.BarChart,{width:"number"==typeof u?u:500,height:p,data:x,margin:{top:T?20:5,right:30,left:20,bottom:5},barCategoryGap:v,children:[j&&e.jsx(i.CartesianGrid,{strokeDasharray:"3 3",stroke:m.getThemeColor("grey_4",z),horizontal:!0,vertical:!1}),e.jsx(a.XAxis,{dataKey:"name",stroke:m.getThemeColor("grey_3",z),tick:{fill:m.getThemeColor("grey_2",z),fontSize:12},label:y?{value:y,position:"insideBottom",offset:-5,style:{fill:m.getThemeColor("grey_2",z),fontSize:12}}:void 0}),e.jsx(l.YAxis,{stroke:m.getThemeColor("grey_3",z),tick:{fill:m.getThemeColor("grey_2",z),fontSize:12},tickFormatter:f,label:C?{value:C,angle:-90,position:"insideLeft",style:{fill:m.getThemeColor("grey_2",z),fontSize:12}}:void 0}),e.jsx(n.Tooltip,{content:e.jsx(g,{})}),e.jsxs(h.Bar,{dataKey:"value",barSize:b,radius:(e=>{if(e)return"number"==typeof e?[e,e,0,0]:e})(_),children:[x.map(((r,t)=>e.jsx(d.Cell,{fill:r.color||
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("styled-components"),t=require("./bar-chart.styles.js"),o=require("../../../node_modules/recharts/es6/component/ResponsiveContainer.js"),s=require("../../../node_modules/recharts/es6/chart/BarChart.js"),i=require("../../../node_modules/recharts/es6/cartesian/CartesianGrid.js"),a=require("../../../node_modules/recharts/es6/cartesian/XAxis.js"),l=require("../../../node_modules/recharts/es6/cartesian/YAxis.js"),n=require("../../../node_modules/recharts/es6/component/Tooltip.js"),h=require("../../../node_modules/recharts/es6/cartesian/Bar.js"),d=require("../../../node_modules/recharts/es6/component/Cell.js"),c=require("../../../node_modules/recharts/es6/component/LabelList.js"),m=require("../../../theme/theme.util.js"),u=require("../../typography/text/text.comp.js");const g=({active:r,payload:o,label:s})=>r&&o&&o.length?e.jsxs(t.CustomTooltip,{direction:"column",gap:1,children:[e.jsx(u.Text,{size:"small",fontWeight:500,children:s}),o.map(((r,t)=>e.jsx(u.Text,{size:"small",color:r.color||r.payload?.color,children:r.value},t)))]}):null;exports.BarChart=({width:u="100%",height:p=300,data:x,showGrid:j=!0,xAxisLabel:y,yAxisLabel:C,yAxisFormatter:f,barSize:b,radius:_,showLabels:T=!1,labelFormatter:q,barCategoryGap:v})=>{const z=r.useTheme();return e.jsx(t.ChartContainer,{"data-testid":"bar-chart",width:u,height:p,children:e.jsx(o.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(s.BarChart,{width:"number"==typeof u?u:500,height:p,data:x,margin:{top:T?20:5,right:30,left:20,bottom:5},barCategoryGap:v,children:[j&&e.jsx(i.CartesianGrid,{strokeDasharray:"3 3",stroke:m.getThemeColor("grey_4",z),horizontal:!0,vertical:!1}),e.jsx(a.XAxis,{dataKey:"name",stroke:m.getThemeColor("grey_3",z),tick:{fill:m.getThemeColor("grey_2",z),fontSize:12},label:y?{value:y,position:"insideBottom",offset:-5,style:{fill:m.getThemeColor("grey_2",z),fontSize:12}}:void 0}),e.jsx(l.YAxis,{stroke:m.getThemeColor("grey_3",z),tick:{fill:m.getThemeColor("grey_2",z),fontSize:12},tickFormatter:f,label:C?{value:C,angle:-90,position:"insideLeft",style:{fill:m.getThemeColor("grey_2",z),fontSize:12}}:void 0}),e.jsx(n.Tooltip,{content:e.jsx(g,{})}),e.jsxs(h.Bar,{dataKey:"value",barSize:b,radius:(e=>{if(e)return"number"==typeof e?[e,e,0,0]:e})(_),children:[x.map(((r,t)=>e.jsx(d.Cell,{fill:m.getThemeColor(r.color||"secondary",z)},`cell-${t}`))),T&&e.jsx(c.LabelList,{position:"top",formatter:e=>q?q(e):e,style:{fill:m.getThemeColor("grey_1",z),fontSize:12}})]})]})})})};
|
|
2
2
|
//# sourceMappingURL=bar-chart.comp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-chart.comp.js","sources":["../../../../../src/components/charts/bar-chart/bar-chart.comp.tsx"],"sourcesContent":["import {\n Bar,\n BarChart as BarChartRecharts,\n CartesianGrid,\n Cell,\n LabelList,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts'\nimport { useTheme } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme'\nimport { Text } from '../../typography'\n\nimport { BarChartProps } from './bar-chart.types'\n\nimport * as Styles from './bar-chart.styles'\n\nconst CustomTooltip = ({ active, payload, label }: any) => {\n if (!active || !payload || !payload.length) return null\n\n return (\n <Styles.CustomTooltip direction=\"column\" gap={1}>\n <Text size=\"small\" fontWeight={500}>\n {label}\n </Text>\n {payload.map((entry: any, index: number) => (\n <Text\n key={index}\n size=\"small\"\n color={entry.color || entry.payload?.color}\n >\n {entry.value}\n </Text>\n ))}\n </Styles.CustomTooltip>\n )\n}\n\n/**\n * Gráfico de barras para comparar valores entre categorias (ex.: emissões por fornecedor).\n * Cada item de `data` é uma barra, com `name` e `value`.\n * Para evolução no tempo use LineChart; para partes de um total use DoughnutChart.\n * @example <BarChart data={[{ name: 'Jan', value: 10 }, { name: 'Fev', value: 14 }]} />\n */\nexport const BarChart = ({\n width = '100%',\n height = 300,\n data,\n showGrid = true,\n xAxisLabel,\n yAxisLabel,\n yAxisFormatter,\n barSize,\n radius,\n showLabels = false,\n labelFormatter,\n barCategoryGap,\n}: BarChartProps) => {\n const theme = useTheme()\n\n // Converte radius numérico para array [topLeft, topRight, 0, 0] (apenas cantos superiores)\n const getRadiusValue = (\n radiusValue?: number | [number, number, number, number],\n ) => {\n if (!radiusValue) return undefined\n if (typeof radiusValue === 'number') {\n return [radiusValue, radiusValue, 0, 0] as [\n number,\n number,\n number,\n number,\n ]\n }\n return radiusValue\n }\n\n return (\n <Styles.ChartContainer\n data-testid=\"bar-chart\"\n width={width}\n height={height}\n >\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChartRecharts\n width={typeof width === 'number' ? width : 500}\n height={height}\n data={data}\n margin={{ top: showLabels ? 20 : 5, right: 30, left: 20, bottom: 5 }}\n barCategoryGap={barCategoryGap}\n >\n {showGrid && (\n <CartesianGrid\n strokeDasharray=\"3 3\"\n stroke={getThemeColor('grey_4', theme)}\n horizontal\n vertical={false}\n />\n )}\n <XAxis\n dataKey=\"name\"\n stroke={getThemeColor('grey_3', theme)}\n tick={{ fill: getThemeColor('grey_2', theme), fontSize: 12 }}\n label={\n xAxisLabel\n ? {\n value: xAxisLabel,\n position: 'insideBottom',\n offset: -5,\n style: {\n fill: getThemeColor('grey_2', theme),\n fontSize: 12,\n },\n }\n : undefined\n }\n />\n <YAxis\n stroke={getThemeColor('grey_3', theme)}\n tick={{ fill: getThemeColor('grey_2', theme), fontSize: 12 }}\n tickFormatter={yAxisFormatter}\n label={\n yAxisLabel\n ? {\n value: yAxisLabel,\n angle: -90,\n position: 'insideLeft',\n style: {\n fill: getThemeColor('grey_2', theme),\n fontSize: 12,\n },\n }\n : undefined\n }\n />\n <Tooltip content={<CustomTooltip />} />\n <Bar\n dataKey=\"value\"\n barSize={barSize}\n radius={getRadiusValue(radius)}\n >\n {data.map((entry, index) => (\n <Cell\n key={`cell-${index}`}\n fill={entry.color ||
|
|
1
|
+
{"version":3,"file":"bar-chart.comp.js","sources":["../../../../../src/components/charts/bar-chart/bar-chart.comp.tsx"],"sourcesContent":["import {\n Bar,\n BarChart as BarChartRecharts,\n CartesianGrid,\n Cell,\n LabelList,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts'\nimport { useTheme } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme'\nimport { Text } from '../../typography'\n\nimport { BarChartProps } from './bar-chart.types'\n\nimport * as Styles from './bar-chart.styles'\n\nconst CustomTooltip = ({ active, payload, label }: any) => {\n if (!active || !payload || !payload.length) return null\n\n return (\n <Styles.CustomTooltip direction=\"column\" gap={1}>\n <Text size=\"small\" fontWeight={500}>\n {label}\n </Text>\n {payload.map((entry: any, index: number) => (\n <Text\n key={index}\n size=\"small\"\n color={entry.color || entry.payload?.color}\n >\n {entry.value}\n </Text>\n ))}\n </Styles.CustomTooltip>\n )\n}\n\n/**\n * Gráfico de barras para comparar valores entre categorias (ex.: emissões por fornecedor).\n * Cada item de `data` é uma barra, com `name` e `value`.\n * Para evolução no tempo use LineChart; para partes de um total use DoughnutChart.\n * Cor da barra pela paleta de gráfico (`color: 'chart.purple'`), mesmo quando a barra é um status.\n * @example <BarChart data={[{ name: 'Jan', value: 10 }, { name: 'Fev', value: 14 }]} />\n */\nexport const BarChart = ({\n width = '100%',\n height = 300,\n data,\n showGrid = true,\n xAxisLabel,\n yAxisLabel,\n yAxisFormatter,\n barSize,\n radius,\n showLabels = false,\n labelFormatter,\n barCategoryGap,\n}: BarChartProps) => {\n const theme = useTheme()\n\n // Converte radius numérico para array [topLeft, topRight, 0, 0] (apenas cantos superiores)\n const getRadiusValue = (\n radiusValue?: number | [number, number, number, number],\n ) => {\n if (!radiusValue) return undefined\n if (typeof radiusValue === 'number') {\n return [radiusValue, radiusValue, 0, 0] as [\n number,\n number,\n number,\n number,\n ]\n }\n return radiusValue\n }\n\n return (\n <Styles.ChartContainer\n data-testid=\"bar-chart\"\n width={width}\n height={height}\n >\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChartRecharts\n width={typeof width === 'number' ? width : 500}\n height={height}\n data={data}\n margin={{ top: showLabels ? 20 : 5, right: 30, left: 20, bottom: 5 }}\n barCategoryGap={barCategoryGap}\n >\n {showGrid && (\n <CartesianGrid\n strokeDasharray=\"3 3\"\n stroke={getThemeColor('grey_4', theme)}\n horizontal\n vertical={false}\n />\n )}\n <XAxis\n dataKey=\"name\"\n stroke={getThemeColor('grey_3', theme)}\n tick={{ fill: getThemeColor('grey_2', theme), fontSize: 12 }}\n label={\n xAxisLabel\n ? {\n value: xAxisLabel,\n position: 'insideBottom',\n offset: -5,\n style: {\n fill: getThemeColor('grey_2', theme),\n fontSize: 12,\n },\n }\n : undefined\n }\n />\n <YAxis\n stroke={getThemeColor('grey_3', theme)}\n tick={{ fill: getThemeColor('grey_2', theme), fontSize: 12 }}\n tickFormatter={yAxisFormatter}\n label={\n yAxisLabel\n ? {\n value: yAxisLabel,\n angle: -90,\n position: 'insideLeft',\n style: {\n fill: getThemeColor('grey_2', theme),\n fontSize: 12,\n },\n }\n : undefined\n }\n />\n <Tooltip content={<CustomTooltip />} />\n <Bar\n dataKey=\"value\"\n barSize={barSize}\n radius={getRadiusValue(radius)}\n >\n {data.map((entry, index) => (\n <Cell\n key={`cell-${index}`}\n fill={getThemeColor(entry.color || 'secondary', theme)}\n />\n ))}\n {showLabels && (\n <LabelList\n position=\"top\"\n formatter={(value: number) =>\n labelFormatter ? labelFormatter(value) : value\n }\n // style aqui é a API do recharts para o texto do rótulo, não CSS inline em elemento HTML\n // eslint-disable-next-line no-restricted-syntax\n style={{\n fill: getThemeColor('grey_1', theme),\n fontSize: 12,\n }}\n />\n )}\n </Bar>\n </BarChartRecharts>\n </ResponsiveContainer>\n </Styles.ChartContainer>\n )\n}\n"],"names":["CustomTooltip","active","payload","label","length","_jsxs","Styles","direction","gap","_jsx","jsx","Text","size","fontWeight","children","map","entry","index","color","value","BarChart","width","height","data","showGrid","xAxisLabel","yAxisLabel","yAxisFormatter","barSize","radius","showLabels","labelFormatter","barCategoryGap","theme","useTheme","ResponsiveContainer","BarChartRecharts","margin","top","right","left","bottom","CartesianGrid","strokeDasharray","stroke","getThemeColor","horizontal","vertical","XAxis","dataKey","tick","fill","fontSize","position","offset","style","undefined","YAxis","tickFormatter","angle","Tooltip","content","jsxs","Bar","radiusValue","getRadiusValue","Cell","LabelList","formatter"],"mappings":"+zBAoBA,MAAMA,EAAgBA,EAAGC,SAAQC,UAASC,WACnCF,GAAWC,GAAYA,EAAQE,OAGlCC,EAAAA,KAACC,EAAAA,cAAqB,CAAAC,UAAU,SAASC,IAAK,YAC5CC,EAACC,IAAAC,OAAK,CAAAC,KAAK,QAAQC,WAAY,IAAGC,SAC/BX,IAEFD,EAAQa,KAAI,CAACC,EAAYC,IACxBR,MAACE,OAAI,CAEHC,KAAK,QACLM,MAAOF,EAAME,OAASF,EAAMd,SAASgB,eAEpCF,EAAMG,OAJFF,QATsC,sBA2B7BG,EACtBC,QAAQ,OACRC,SAAS,IACTC,OACAC,YAAW,EACXC,aACAC,aACAC,iBACAC,UACAC,SACAC,cAAa,EACbC,iBACAC,qBAEA,MAAMC,EAAQC,EAAAA,WAkBd,OACEzB,EAAAA,IAACH,EAAAA,eACa,CAAA,cAAA,YACZe,MAAOA,EACPC,OAAQA,EAAMR,SAEdL,EAACC,IAAAyB,sBAAoB,CAAAd,MAAM,OAAOC,OAAO,OAAMR,SAC7CT,OAAC+B,WAAgB,CACff,MAAwB,iBAAVA,EAAqBA,EAAQ,IAC3CC,OAAQA,EACRC,KAAMA,EACNc,OAAQ,CAAEC,IAAKR,EAAa,GAAK,EAAGS,MAAO,GAAIC,KAAM,GAAIC,OAAQ,GACjET,eAAgBA,YAEfR,GACCf,EAAAC,IAACgC,gBACC,CAAAC,gBAAgB,MAChBC,OAAQC,EAAAA,cAAc,SAAUZ,GAChCa,YAAU,EACVC,UAAU,IAGdtC,EAAAC,IAACsC,QAAK,CACJC,QAAQ,OACRL,OAAQC,EAAAA,cAAc,SAAUZ,GAChCiB,KAAM,CAAEC,KAAMN,EAAAA,cAAc,SAAUZ,GAAQmB,SAAU,IACxDjD,MACEsB,EACI,CACEN,MAAOM,EACP4B,SAAU,eACVC,QAAS,EACTC,MAAO,CACLJ,KAAMN,EAAAA,cAAc,SAAUZ,GAC9BmB,SAAU,UAGdI,IAGR/C,EAAAC,IAAC+C,QACC,CAAAb,OAAQC,EAAAA,cAAc,SAAUZ,GAChCiB,KAAM,CAAEC,KAAMN,EAAAA,cAAc,SAAUZ,GAAQmB,SAAU,IACxDM,cAAe/B,EACfxB,MACEuB,EACI,CACEP,MAAOO,EACPiC,OAAQ,GACRN,SAAU,aACVE,MAAO,CACLJ,KAAMN,EAAAA,cAAc,SAAUZ,GAC9BmB,SAAU,UAGdI,IAGR/C,MAACmD,UAAO,CAACC,QAASpD,EAAAA,IAACT,EAAgB,MACnCK,EAACyD,KAAAC,OACCd,QAAQ,QACRrB,QAASA,EACTC,OA5ERmC,KAEA,GAAKA,EACL,MAA2B,iBAAhBA,EACF,CAACA,EAAaA,EAAa,EAAG,GAOhCA,CAAW,EAiEFC,CAAepC,aAEtBN,EAAKR,KAAI,CAACC,EAAOC,IAChBR,EAAAC,IAACwD,OAAI,CAEHf,KAAMN,EAAAA,cAAc7B,EAAME,OAAS,YAAae,IADnC,QAAAhB,OAIhBa,GACCrB,EAACC,IAAAyD,aACCd,SAAS,MACTe,UAAYjD,GACVY,EAAiBA,EAAeZ,GAASA,EAI3CoC,MAAO,CACLJ,KAAMN,EAAAA,cAAc,SAAUZ,GAC9BmB,SAAU,eAOA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("./chart-legend.styles.js");exports.ChartLegend=({items:
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("./chart-legend.styles.js");exports.ChartLegend=({items:a,direction:l="row",variant:i="dot"})=>e.jsx(r.List,{$direction:l,$variant:i,"data-testid":"chart-legend",children:a.map((a=>e.jsxs(r.Item,{$variant:i,children:[e.jsx(r.Marker,{$color:a.color,$variant:i,"aria-hidden":"true"}),"square"===i?e.jsxs(r.Label,{title:a.label,children:[a.label,void 0!==a.value&&e.jsxs(e.Fragment,{children:[": ",a.value]})]}):e.jsxs(e.Fragment,{children:[e.jsx(r.Label,{title:a.label,children:a.label}),void 0!==a.value&&e.jsx(r.Value,{$direction:l,children:a.value})]})]},a.label)))});
|
|
2
2
|
//# sourceMappingURL=chart-legend.comp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-legend.comp.js","sources":["../../../../../src/components/charts/chart-legend/chart-legend.comp.tsx"],"sourcesContent":["import { ChartLegendProps } from './chart-legend.types'\n\nimport * as Styles from './chart-legend.styles'\n\n/**\n * Legenda de gráfico: bolinha na cor da série, nome e valor opcional.\n * Use ao lado ou abaixo de qualquer gráfico; o DoughnutChart já monta a dele com a prop `legend`.\n * @example <ChartLegend items={[{ label: 'Aprovados', color: '
|
|
1
|
+
{"version":3,"file":"chart-legend.comp.js","sources":["../../../../../src/components/charts/chart-legend/chart-legend.comp.tsx"],"sourcesContent":["import { ChartLegendProps } from './chart-legend.types'\n\nimport * as Styles from './chart-legend.styles'\n\n/**\n * Legenda de gráfico: bolinha na cor da série, nome e valor opcional.\n * Use ao lado ou abaixo de qualquer gráfico; o DoughnutChart já monta a dele com a prop `legend`.\n * `variant=\"square\"` é a legenda das roscas das dashboards: quadradinho e \"Nome: valor\".\n * @example <ChartLegend items={[{ label: 'Aprovados', color: 'chart.blue', value: '60%' }]} />\n * @example <ChartLegend variant=\"square\" direction=\"column\" items={[{ label: 'Pendentes', color: 'chart.purple', value: 850 }]} />\n */\nexport const ChartLegend = ({\n items,\n direction = 'row',\n variant = 'dot',\n}: ChartLegendProps) => (\n <Styles.List\n $direction={direction}\n $variant={variant}\n data-testid=\"chart-legend\"\n >\n {items.map((item) => (\n <Styles.Item key={item.label} $variant={variant}>\n <Styles.Marker\n $color={item.color}\n $variant={variant}\n aria-hidden=\"true\"\n />\n {variant === 'square' ? (\n <Styles.Label title={item.label}>\n {item.label}\n {item.value !== undefined && <>: {item.value}</>}\n </Styles.Label>\n ) : (\n <>\n <Styles.Label title={item.label}>{item.label}</Styles.Label>\n {item.value !== undefined && (\n <Styles.Value $direction={direction}>{item.value}</Styles.Value>\n )}\n </>\n )}\n </Styles.Item>\n ))}\n </Styles.List>\n)\n"],"names":["ChartLegend","items","direction","variant","_jsx","Styles","$direction","$variant","children","map","item","_jsxs","jsx","color","title","label","undefined","value","jsxs","_Fragment"],"mappings":"0GAW2BA,EACzBC,QACAC,YAAY,MACZC,UAAU,SAEVC,EAAAA,IAACC,EAAAA,KACa,CAAAC,WAAAJ,EACFK,SAAAJ,gBACE,eAAcK,SAEzBP,EAAMQ,KAAKC,GACVC,EAAAA,KAACN,EAAAA,KAAuC,CAAAE,SAAAJ,YACtCC,EAACQ,IAAAP,iBACSK,EAAKG,MAAKN,SACRJ,EAAO,cACL,SAED,WAAZA,EACCQ,EAAAA,KAACN,EAAAA,MAAY,CAACS,MAAOJ,EAAKK,MAAKP,SAAA,CAC5BE,EAAKK,WACUC,IAAfN,EAAKO,OAAuBN,kCAAKD,EAAKO,YAGzCN,EAAAO,KAAAC,WAAA,CAAAX,SAAA,CACEJ,EAACQ,IAAAP,QAAY,CAACS,MAAOJ,EAAKK,MAAQP,SAAAE,EAAKK,aACvBC,IAAfN,EAAKO,OACJb,EAAAA,IAACC,EAAAA,MAAyB,CAAAC,WAAAJ,EAAYM,SAAAE,EAAKO,aAfjCP,EAAKK"}
|
|
@@ -1,40 +1,47 @@
|
|
|
1
|
-
"use strict";var e=require("styled-components"),t=require("../../../theme/theme.util.js");const
|
|
1
|
+
"use strict";var e=require("styled-components"),t=require("../../../theme/theme.util.js");const s=e.styled.ul`
|
|
2
2
|
display: flex;
|
|
3
3
|
margin: 0;
|
|
4
4
|
padding: 0;
|
|
5
5
|
list-style: none;
|
|
6
6
|
font-family: ${({theme:e})=>e.typography.fontFamily};
|
|
7
7
|
|
|
8
|
-
${({$direction:t,theme:
|
|
8
|
+
${({$direction:t,$variant:s,theme:i})=>"row"===t?e.css`
|
|
9
9
|
flex-wrap: wrap;
|
|
10
|
-
gap: ${
|
|
10
|
+
gap: ${i.spacing.xs} ${i.spacing.md};
|
|
11
11
|
`:e.css`
|
|
12
12
|
flex-direction: column;
|
|
13
|
-
gap: ${
|
|
13
|
+
gap: ${"square"===s?i.spacing.xs:i.spacing.sm};
|
|
14
14
|
`}
|
|
15
|
-
`,
|
|
15
|
+
`,i=e.styled.li`
|
|
16
16
|
display: flex;
|
|
17
17
|
align-items: center;
|
|
18
18
|
gap: ${({theme:e})=>e.spacing.sm};
|
|
19
19
|
min-width: 0;
|
|
20
|
-
font-size: ${({theme:
|
|
21
|
-
color: ${({theme:
|
|
22
|
-
`,
|
|
20
|
+
font-size: ${({$variant:e,theme:t})=>"square"===e?t.typography.textSize.caption:t.typography.textSize.bodySm};
|
|
21
|
+
color: ${({$variant:e,theme:t})=>"square"===e?t.colors.grey_1:t.colors.grey_2};
|
|
22
|
+
`,r=e.styled.span`
|
|
23
23
|
flex: none;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
background: ${({$color:e,theme:s})=>t.getThemeColor(e,s)};
|
|
25
|
+
|
|
26
|
+
${({$variant:t,theme:s})=>"square"===t?e.css`
|
|
27
|
+
width: ${s.spacing.md};
|
|
28
|
+
height: ${s.spacing.md};
|
|
29
|
+
border-radius: ${s.radius.sm};
|
|
30
|
+
`:e.css`
|
|
31
|
+
width: 10px;
|
|
32
|
+
height: 10px;
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
`}
|
|
35
|
+
`,a=e.styled.span`
|
|
29
36
|
min-width: 0;
|
|
30
37
|
overflow: hidden;
|
|
31
38
|
text-overflow: ellipsis;
|
|
32
39
|
white-space: nowrap;
|
|
33
|
-
`,
|
|
40
|
+
`,o=e.styled.span`
|
|
34
41
|
flex: none;
|
|
35
42
|
margin-left: ${({$direction:e})=>"column"===e?"auto":"0"};
|
|
36
43
|
padding-left: ${({theme:e})=>e.spacing.sm};
|
|
37
44
|
font-weight: ${({theme:e})=>e.typography.fontWeight.semibold};
|
|
38
45
|
color: ${({theme:e})=>e.colors.grey_1};
|
|
39
|
-
`;exports.
|
|
46
|
+
`;exports.Item=i,exports.Label=a,exports.List=s,exports.Marker=r,exports.Value=o;
|
|
40
47
|
//# sourceMappingURL=chart-legend.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-legend.styles.js","sources":["../../../../../src/components/charts/chart-legend/chart-legend.styles.tsx"],"sourcesContent":["import { css, styled } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme'\n\nexport const List = styled.ul<{
|
|
1
|
+
{"version":3,"file":"chart-legend.styles.js","sources":["../../../../../src/components/charts/chart-legend/chart-legend.styles.tsx"],"sourcesContent":["import { css, styled } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme'\n\nimport { ChartLegendVariant } from './chart-legend.types'\n\nexport const List = styled.ul<{\n $direction: 'row' | 'column'\n $variant: ChartLegendVariant\n}>`\n display: flex;\n margin: 0;\n padding: 0;\n list-style: none;\n font-family: ${({ theme }) => theme.typography.fontFamily};\n\n ${({ $direction, $variant, theme }) =>\n $direction === 'row'\n ? css`\n flex-wrap: wrap;\n gap: ${theme.spacing.xs} ${theme.spacing.md};\n `\n : css`\n flex-direction: column;\n gap: ${$variant === 'square' ? theme.spacing.xs : theme.spacing.sm};\n `}\n`\n\nexport const Item = styled.li<{ $variant: ChartLegendVariant }>`\n display: flex;\n align-items: center;\n gap: ${({ theme }) => theme.spacing.sm};\n min-width: 0;\n font-size: ${({ $variant, theme }) =>\n $variant === 'square'\n ? theme.typography.textSize.caption\n : theme.typography.textSize.bodySm};\n color: ${({ $variant, theme }) =>\n $variant === 'square' ? theme.colors.grey_1 : theme.colors.grey_2};\n`\n\nexport const Marker = styled.span<{\n $color: string\n $variant: ChartLegendVariant\n}>`\n flex: none;\n background: ${({ $color, theme }) => getThemeColor($color, theme)};\n\n ${({ $variant, theme }) =>\n $variant === 'square'\n ? css`\n width: ${theme.spacing.md};\n height: ${theme.spacing.md};\n border-radius: ${theme.radius.sm};\n `\n : css`\n width: 10px;\n height: 10px;\n border-radius: 50%;\n `}\n`\n\nexport const Label = styled.span`\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`\n\nexport const Value = styled.span<{ $direction: 'row' | 'column' }>`\n flex: none;\n margin-left: ${({ $direction }) => ($direction === 'column' ? 'auto' : '0')};\n padding-left: ${({ theme }) => theme.spacing.sm};\n font-weight: ${({ theme }) => theme.typography.fontWeight.semibold};\n color: ${({ theme }) => theme.colors.grey_1};\n`\n"],"names":["List","styled","ul","theme","typography","fontFamily","$direction","$variant","css","spacing","xs","md","sm","Item","li","textSize","caption","bodySm","colors","grey_1","grey_2","Marker","span","$color","getThemeColor","radius","Label","Value","fontWeight","semibold"],"mappings":"0FAMaA,MAAAA,EAAOC,EAAMA,OAACC,EAGzB;;;;;iBAKe,EAAGC,WAAYA,EAAMC,WAAWC;;IAE7C,EAAGC,aAAYC,WAAUJ,WACV,QAAfG,EACIE,KAAG;;iBAEML,EAAMM,QAAQC,MAAMP,EAAMM,QAAQE;UAE3CH,EAAAA,GAAG;;iBAEmB,WAAbD,EAAwBJ,EAAMM,QAAQC,GAAKP,EAAMM,QAAQG;;EAI7DC,EAAOZ,EAAMA,OAACa,EAAoC;;;SAGtD,EAAGX,WAAYA,EAAMM,QAAQG;;eAEvB,EAAGL,WAAUJ,WACX,WAAbI,EACIJ,EAAMC,WAAWW,SAASC,QAC1Bb,EAAMC,WAAWW,SAASE;WACvB,EAAGV,WAAUJ,WACP,WAAbI,EAAwBJ,EAAMe,OAAOC,OAAShB,EAAMe,OAAOE;EAGlDC,EAASpB,EAAMA,OAACqB,IAG3B;;gBAEc,EAAGC,SAAQpB,WAAYqB,EAAaA,cAACD,EAAQpB;;IAEzD,EAAGI,WAAUJ,WACA,WAAbI,EACIC,KAAG;mBACQL,EAAMM,QAAQE;oBACbR,EAAMM,QAAQE;2BACPR,EAAMsB,OAAOb;UAEhCJ,EAAAA,GAAG;;;;;EAOEkB,EAAQzB,EAAMA,OAACqB,IAAI;;;;;EAOnBK,EAAQ1B,EAAMA,OAACqB,IAAsC;;iBAEjD,EAAGhB,gBAAiC,WAAfA,EAA0B,OAAS;kBACvD,EAAGH,WAAYA,EAAMM,QAAQG;iBAC9B,EAAGT,WAAYA,EAAMC,WAAWwB,WAAWC;WACjD,EAAG1B,WAAYA,EAAMe,OAAOC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components"),a=require("./doughnut-chart.styles.js"),l=require("../../../theme/chart-colors.js"),s=require("../../../node_modules/recharts/es6/chart/PieChart.js"),i=require("../../../node_modules/recharts/es6/polar/Pie.js"),n=require("../../../node_modules/recharts/es6/component/Cell.js"),o=require("../../../node_modules/recharts/es6/component/Tooltip.js"),u=require("../chart-legend/chart-legend.comp.js"),c=require("../../../theme/theme.util.js"),d=require("../../typography/text/text.comp.js");const h=e=>e.name?{"aria-label":`${e.name}: ${e.display??e.value}`}:{"aria-hidden":"true"};exports.DoughnutChart=({size:m=200,totalValue:p,parts:j,fontSize:x,showTotalValue:g=!0,showTooltip:C=!1,tooltipValueFormatter:T,disableAnimation:v=!1,customContent:q,legend:y})=>{const f=r.useTheme(),A=l.CHART_COLOR_ORDER.map((e=>c.getThemeColor(`chart.${e}`,f))),$=(e,t)=>c.getThemeColor(e.color??A[t%A.length],f),[_,z]=t.useState([]),[R,P]=t.useState(!1),w=t.useId();t.useEffect((()=>{const e=j.reduce(((e,t)=>e+t.value),0),t=[...j];e!==p&&(1===j.length?(P(!0),t.push({value:p-e,color:"transparent",display:"none"})):t.push({value:p-e,color:c.getThemeColor("grey_5",f)})),z([...t])}),[j]);const S={dataKey:"value",innerRadius:m/2*.75,outerRadius:m/2,startAngle:90,endAngle:-270},b=e.jsxs(a.ChartContainer,{"data-testid":"doughnut-chart",size:m,children:[q?e.jsx(a.CenterText,{children:q}):g&&e.jsxs(a.TotalText,{fontSize:x,children:[e.jsx("small",{children:"Total"}),e.jsx("p",{children:p})]}),e.jsxs(s.PieChart,{width:m,height:m,id:w,children:[(R||!p)&&e.jsx(i.Pie,{data:[{value:1}],fill:c.getThemeColor("grey_5",f),animationDuration:0,isAnimationActive:!v,...S,children:e.jsx(n.Cell,{"aria-hidden":"true"})}),p&&e.jsx(i.Pie,{data:_,paddingAngle:1===_.length?0:3,cornerRadius:10,isAnimationActive:!v,...S,children:_.map(((t,r)=>e.jsx(n.Cell,{fill:$(t,r),...h(t)},`cell-${r}`)))}),C&&e.jsx(o.Tooltip,{content:({active:t,payload:r})=>{const l=r?.[0]?.name&&"string"==typeof r[0].name;return t?e.jsx(a.CustomTooltip,{direction:"column",children:l?e.jsxs(e.Fragment,{children:[e.jsx(d.Text,{size:"small",fontWeight:500,children:`${r[0].name}`}),e.jsx(d.Text,{size:"small",children:`${T?T(r[0].value):r[0].value}`})]}):e.jsx(d.Text,{size:"small",children:`${T?T(r[0].value):r[0].value}`})}):null}})]})]});return y?e.jsxs(a.WithLegend,{$position:y,children:[b,e.jsx(u.ChartLegend,{direction:"side"===y?"column":"row",items:j.map(((e,t)=>({part:e,color:$(e,t)}))).filter((({part:e})=>e.name)).map((({part:e,color:t})=>({label:e.name,color:t,value:e.display??e.value})))})]}):b};
|
|
2
2
|
//# sourceMappingURL=doughnut-chart.comp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doughnut-chart.comp.js","sources":["../../../../../src/components/charts/doughnut-chart/doughnut-chart.comp.tsx"],"sourcesContent":["import { useEffect, useId, useState } from 'react'\n\nimport { Cell, Pie, PieChart, Tooltip } from 'recharts'\nimport { useTheme } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme'\nimport { Text } from '../../typography'\nimport { ChartLegend } from '../chart-legend'\n\nimport { DoughnutChartProps, PartsProps } from './doughnut-chart.types'\n\nimport * as Styles from './doughnut-chart.styles'\n\n/** Fatia com nome vira imagem com texto alternativo; fatia sem nome (restante) fica fora do leitor de tela. */\nconst getCellA11yProps = (part: PartsProps) =>\n part.name\n ? { 'aria-label': `${part.name}: ${part.display ?? part.value}` }\n : { 'aria-hidden': 'true' as const }\n\n/**\n * Rosca que mostra partes de um total (ex.: 60% dos fornecedores aprovados).\n * `parts` são as fatias; o que faltar para chegar em `totalValue` aparece em cinza.\n * `legend` mostra a legenda das fatias com nome ao lado (`side`) ou abaixo (`bottom`).\n * Use com até 5 fatias. Com mais categorias use BarChart.\n * @example <DoughnutChart totalValue={100} parts={[{ value: 60, color: '
|
|
1
|
+
{"version":3,"file":"doughnut-chart.comp.js","sources":["../../../../../src/components/charts/doughnut-chart/doughnut-chart.comp.tsx"],"sourcesContent":["import { useEffect, useId, useState } from 'react'\n\nimport { Cell, Pie, PieChart, Tooltip } from 'recharts'\nimport { useTheme } from 'styled-components'\n\nimport { CHART_COLOR_ORDER, getThemeColor } from '../../../theme'\nimport { Text } from '../../typography'\nimport { ChartLegend } from '../chart-legend'\n\nimport { DoughnutChartProps, PartsProps } from './doughnut-chart.types'\n\nimport * as Styles from './doughnut-chart.styles'\n\n/** Fatia com nome vira imagem com texto alternativo; fatia sem nome (restante) fica fora do leitor de tela. */\nconst getCellA11yProps = (part: PartsProps) =>\n part.name\n ? { 'aria-label': `${part.name}: ${part.display ?? part.value}` }\n : { 'aria-hidden': 'true' as const }\n\n/**\n * Rosca que mostra partes de um total (ex.: 60% dos fornecedores aprovados).\n * `parts` são as fatias; o que faltar para chegar em `totalValue` aparece em cinza.\n * `legend` mostra a legenda das fatias com nome ao lado (`side`) ou abaixo (`bottom`).\n * Use com até 5 fatias. Com mais categorias use BarChart.\n * As fatias usam a paleta de gráfico (`chart.*`), mesmo quando cada uma é um status: passe o nome\n * (`color: 'chart.blue'`) ou deixe sem cor, que a rosca segue a ordem de `getChartColors`.\n * @example <DoughnutChart totalValue={100} parts={[{ value: 60, color: 'chart.blue', name: 'Aprovados' }]} />\n */\nexport const DoughnutChart = ({\n size = 200,\n totalValue,\n parts,\n fontSize,\n showTotalValue = true,\n showTooltip = false,\n tooltipValueFormatter,\n disableAnimation = false,\n customContent,\n legend,\n}: DoughnutChartProps) => {\n const theme = useTheme()\n const chartColors = CHART_COLOR_ORDER.map((name) =>\n getThemeColor(`chart.${name}`, theme),\n )\n const colorOf = (part: PartsProps, index: number) =>\n getThemeColor(part.color ?? chartColors[index % chartColors.length], theme)\n\n const [adjustedParts, setAdjustedParts] = useState<PartsProps[]>([])\n const [showBackground, setShowBackground] = useState(false)\n\n const chartId = useId()\n\n useEffect(() => {\n const totalSum = parts.reduce((sum, part) => sum + part.value, 0)\n const auxParts = [...parts]\n\n if (totalSum !== totalValue) {\n if (parts.length === 1) {\n setShowBackground(true)\n auxParts.push({\n value: totalValue - totalSum,\n color: 'transparent',\n display: 'none',\n })\n } else {\n auxParts.push({\n value: totalValue - totalSum,\n color: getThemeColor('grey_5', theme),\n })\n }\n }\n setAdjustedParts([...auxParts])\n }, [parts])\n\n const defaultPieChartProps = {\n dataKey: 'value',\n innerRadius: (size / 2) * 0.75,\n outerRadius: size / 2,\n startAngle: 90,\n endAngle: -270,\n }\n\n const CustomTooltip = ({ active, payload }: any) => {\n const hasName = payload?.[0]?.name && typeof payload[0].name === 'string'\n\n if (!active) return null\n\n return (\n <Styles.CustomTooltip direction=\"column\">\n {hasName ? (\n <>\n <Text size=\"small\" fontWeight={500}>{`${payload[0].name}`}</Text>\n <Text size=\"small\">{`${tooltipValueFormatter ? tooltipValueFormatter(payload[0].value) : payload[0].value}`}</Text>\n </>\n ) : (\n <Text size=\"small\">{`${tooltipValueFormatter ? tooltipValueFormatter(payload[0].value) : payload[0].value}`}</Text>\n )}\n </Styles.CustomTooltip>\n )\n }\n\n const chart = (\n <Styles.ChartContainer data-testid=\"doughnut-chart\" size={size}>\n {customContent ? (\n <Styles.CenterText>{customContent}</Styles.CenterText>\n ) : (\n showTotalValue && (\n <Styles.TotalText fontSize={fontSize}>\n <small>Total</small>\n <p>{totalValue}</p>\n </Styles.TotalText>\n )\n )}\n <PieChart width={size} height={size} id={chartId}>\n {(showBackground || !totalValue) && (\n <Pie\n data={[{ value: 1 }]}\n fill={getThemeColor('grey_5', theme)}\n animationDuration={0}\n isAnimationActive={!disableAnimation}\n {...defaultPieChartProps}\n >\n <Cell aria-hidden=\"true\" />\n </Pie>\n )}\n\n {totalValue && (\n <Pie\n data={adjustedParts}\n paddingAngle={adjustedParts.length === 1 ? 0 : 3}\n cornerRadius={10}\n isAnimationActive={!disableAnimation}\n {...defaultPieChartProps}\n >\n {adjustedParts.map((part, index) => (\n <Cell\n key={`cell-${index}`}\n fill={colorOf(part, index)}\n {...getCellA11yProps(part)}\n />\n ))}\n </Pie>\n )}\n\n {showTooltip && <Tooltip content={CustomTooltip} />}\n </PieChart>\n </Styles.ChartContainer>\n )\n\n if (!legend) return chart\n\n return (\n <Styles.WithLegend $position={legend}>\n {chart}\n <ChartLegend\n direction={legend === 'side' ? 'column' : 'row'}\n items={parts\n .map((part, index) => ({ part, color: colorOf(part, index) }))\n .filter(({ part }) => part.name)\n .map(({ part, color }) => ({\n label: part.name as string,\n color,\n value: part.display ?? part.value,\n }))}\n />\n </Styles.WithLegend>\n )\n}\n"],"names":["getCellA11yProps","part","name","display","value","DoughnutChart","size","totalValue","parts","fontSize","showTotalValue","showTooltip","tooltipValueFormatter","disableAnimation","customContent","legend","theme","useTheme","chartColors","CHART_COLOR_ORDER","map","getThemeColor","colorOf","index","color","length","adjustedParts","setAdjustedParts","useState","showBackground","setShowBackground","chartId","useId","useEffect","totalSum","reduce","sum","auxParts","push","defaultPieChartProps","dataKey","innerRadius","outerRadius","startAngle","endAngle","chart","_jsxs","jsxs","Styles","_jsx","jsx","children","PieChart","width","height","id","Pie","data","fill","animationDuration","isAnimationActive","Cell","paddingAngle","cornerRadius","Tooltip","content","CustomTooltip","active","payload","hasName","direction","_Fragment","Text","fontWeight","$position","ChartLegend","items","filter","label"],"mappings":"wkBAcA,MAAMA,EAAoBC,GACxBA,EAAKC,KACD,CAAE,aAAc,GAAGD,EAAKC,SAASD,EAAKE,SAAWF,EAAKG,SACtD,CAAE,cAAe,8BAWMC,EAC3BC,OAAO,IACPC,aACAC,QACAC,WACAC,kBAAiB,EACjBC,eAAc,EACdC,wBACAC,oBAAmB,EACnBC,gBACAC,aAEA,MAAMC,EAAQC,EAAAA,WACRC,EAAcC,EAAAA,kBAAkBC,KAAKlB,GACzCmB,EAAAA,uBAAuBnB,IAAQc,KAE3BM,EAAUA,CAACrB,EAAkBsB,IACjCF,EAAaA,cAACpB,EAAKuB,OAASN,EAAYK,EAAQL,EAAYO,QAAST,IAEhEU,EAAeC,GAAoBC,EAAQA,SAAe,KAC1DC,EAAgBC,GAAqBF,EAAQA,UAAC,GAE/CG,EAAUC,EAAAA,QAEhBC,EAAAA,WAAU,KACR,MAAMC,EAAW1B,EAAM2B,QAAO,CAACC,EAAKnC,IAASmC,EAAMnC,EAAKG,OAAO,GACzDiC,EAAW,IAAI7B,GAEjB0B,IAAa3B,IACM,IAAjBC,EAAMiB,QACRK,GAAkB,GAClBO,EAASC,KAAK,CACZlC,MAAOG,EAAa2B,EACpBV,MAAO,cACPrB,QAAS,UAGXkC,EAASC,KAAK,CACZlC,MAAOG,EAAa2B,EACpBV,MAAOH,EAAAA,cAAc,SAAUL,MAIrCW,EAAiB,IAAIU,GAAU,GAC9B,CAAC7B,IAEJ,MAAM+B,EAAuB,CAC3BC,QAAS,QACTC,YAAcnC,EAAO,EAAK,IAC1BoC,YAAapC,EAAO,EACpBqC,WAAY,GACZC,UAAW,KAsBPC,EACJC,EAAAC,KAACC,gCAAkC,iBAAiB1C,KAAMA,YACvDQ,EACCmC,EAACC,IAAAF,uBAAmBlC,IAEpBJ,GACEoC,EAACC,KAAAC,YAAgB,CAACvC,SAAUA,YAC1BwC,EAAoBC,IAAA,QAAA,CAAAC,SAAA,UACpBF,EAAIC,IAAA,IAAA,CAAAC,SAAA5C,OAIVuC,OAACM,WAAQ,CAACC,MAAO/C,EAAMgD,OAAQhD,EAAMiD,GAAIxB,EACtCoB,SAAA,EAACtB,IAAmBtB,IACnB0C,EAAAA,IAACO,EAAAA,IAAG,CACFC,KAAM,CAAC,CAAErD,MAAO,IAChBsD,KAAMrC,EAAAA,cAAc,SAAUL,GAC9B2C,kBAAmB,EACnBC,mBAAoB/C,KAChB0B,WAEJU,EAACC,IAAAW,OAAiB,CAAA,cAAA,WAIrBtD,GACC0C,EAAAC,IAACM,MACC,CAAAC,KAAM/B,EACNoC,aAAuC,IAAzBpC,EAAcD,OAAe,EAAI,EAC/CsC,aAAc,GACdH,mBAAoB/C,KAChB0B,EAAoBY,SAEvBzB,EAAcN,KAAI,CAACnB,EAAMsB,IACxB0B,EAAAC,IAACW,OAEC,CAAAH,KAAMpC,EAAQrB,EAAMsB,MAChBvB,EAAiBC,YAFRsB,SAQpBZ,GAAesC,EAACC,IAAAc,WAAQC,QA9DTC,EAAGC,SAAQC,cAC/B,MAAMC,EAAUD,IAAU,IAAIlE,MAAmC,iBAApBkE,EAAQ,GAAGlE,KAExD,OAAKiE,EAGHlB,EAAAA,IAACD,EAAAA,eAAqBsB,UAAU,SAAQnB,SACrCkB,EACCvB,EACEC,KAAAwB,WAAA,CAAApB,SAAA,CAAAF,EAAAC,IAACsB,OAAI,CAAClE,KAAK,QAAQmE,WAAY,aAAS,GAAAL,EAAQ,GAAGlE,SACnD+C,EAAAC,IAACsB,OAAI,CAAClE,KAAK,QAAS6C,SAAA,GAAGvC,EAAwBA,EAAsBwD,EAAQ,GAAGhE,OAASgE,EAAQ,GAAGhE,aAGtG6C,EAAAC,IAACsB,OAAK,CAAAlE,KAAK,QAAS6C,SAAA,GAAGvC,EAAwBA,EAAsBwD,EAAQ,GAAGhE,OAASgE,EAAQ,GAAGhE,YAVtF,IAYK,UAoD3B,OAAKW,EAGH+B,EAAAA,KAACE,EAAAA,WAAiB,CAAA0B,UAAY3D,EAAMoC,SAAA,CACjCN,EACDI,EAACC,IAAAyB,cACC,CAAAL,UAAsB,SAAXvD,EAAoB,SAAW,MAC1C6D,MAAOpE,EACJY,KAAI,CAACnB,EAAMsB,KAAW,CAAEtB,OAAMuB,MAAOF,EAAQrB,EAAMsB,OACnDsD,QAAO,EAAG5E,UAAWA,EAAKC,OAC1BkB,KAAI,EAAGnB,OAAMuB,YAAa,CACzBsD,MAAO7E,EAAKC,KACZsB,QACApB,MAAOH,EAAKE,SAAWF,EAAKG,eAblByC,CAgBE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("styled-components"),r=require("./line-chart.styles.js"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("styled-components"),r=require("./line-chart.styles.js"),o=require("../../../node_modules/recharts/es6/component/ResponsiveContainer.js"),s=require("../../../node_modules/recharts/es6/cartesian/CartesianGrid.js"),i=require("../../../node_modules/recharts/es6/cartesian/XAxis.js"),a=require("../../../node_modules/recharts/es6/cartesian/YAxis.js"),l=require("../../../node_modules/recharts/es6/component/Tooltip.js"),n=require("../../../node_modules/recharts/es6/cartesian/Area.js"),h=require("../../../node_modules/recharts/es6/cartesian/Line.js"),d=require("../../../node_modules/recharts/es6/chart/AreaChart.js"),c=require("../../../node_modules/recharts/es6/chart/LineChart.js"),m=require("../../../theme/chart-colors.js"),u=require("../../../theme/theme.util.js"),g=require("../../typography/text/text.comp.js");const j=({active:t,payload:o,label:s})=>t&&o&&o.length?e.jsxs(r.CustomTooltip,{direction:"column",gap:1,children:[e.jsx(g.Text,{size:"small",fontWeight:500,children:s}),o.map(((t,r)=>e.jsxs(g.Text,{size:"small",color:t.color,children:[t.name,": ",t.value]},r)))]}):null;exports.LineChart=({width:g=500,height:x=300,data:y,series:p,showArea:C=!1,showGrid:_=!0,xAxisLabel:T,yAxisLabel:f,yAxisFormatter:q})=>{const k=t.useTheme(),A=m.CHART_COLOR_ORDER.map((e=>u.getThemeColor(`chart.${e}`,k))),v=(e,t)=>u.getThemeColor(e??A[t%A.length],k),L=C?d.AreaChart:c.LineChart;return e.jsx(r.ChartContainer,{"data-testid":"line-chart",width:g,height:x,children:e.jsx(o.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(L,{width:g,height:x,data:y,margin:{top:5,right:30,left:20,bottom:5},children:[_&&e.jsx(s.CartesianGrid,{strokeDasharray:"3 3",stroke:u.getThemeColor("grey_4",k),horizontal:!0,vertical:!1}),e.jsx(i.XAxis,{dataKey:"name",stroke:u.getThemeColor("grey_3",k),tick:{fill:u.getThemeColor("grey_2",k),fontSize:12},label:T?{value:T,position:"insideBottom",offset:-5,style:{fill:u.getThemeColor("grey_2",k),fontSize:12}}:void 0}),e.jsx(a.YAxis,{stroke:u.getThemeColor("grey_3",k),tick:{fill:u.getThemeColor("grey_2",k),fontSize:12},tickFormatter:q,label:f?{value:f,angle:-90,position:"insideLeft",style:{fill:u.getThemeColor("grey_2",k),fontSize:12}}:void 0}),e.jsx(l.Tooltip,{content:e.jsx(j,{})}),C?p.map(((t,r)=>e.jsx(n.Area,{type:"monotone",dataKey:t.dataKey,name:t.name,stroke:v(t.color,r),fill:v(t.color,r),fillOpacity:.2,strokeWidth:t.strokeWidth||2},t.dataKey))):p.map(((t,r)=>e.jsx(h.Line,{type:"monotone",dataKey:t.dataKey,name:t.name,stroke:v(t.color,r),strokeWidth:t.strokeWidth||2,dot:{r:4},activeDot:{r:6}},t.dataKey)))]})})})};
|
|
2
2
|
//# sourceMappingURL=line-chart.comp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.comp.js","sources":["../../../../../src/components/charts/line-chart/line-chart.comp.tsx"],"sourcesContent":["import {\n Area,\n AreaChart as AreaChartRecharts,\n CartesianGrid,\n Line,\n LineChart as LineChartRecharts,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts'\nimport { useTheme } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme'\nimport { Text } from '../../typography'\n\nimport { LineChartProps } from './line-chart.types'\n\nimport * as Styles from './line-chart.styles'\n\nconst CustomTooltip = ({ active, payload, label }: any) => {\n if (!active || !payload || !payload.length) return null\n\n return (\n <Styles.CustomTooltip direction=\"column\" gap={1}>\n <Text size=\"small\" fontWeight={500}>\n {label}\n </Text>\n {payload.map((entry: any, index: number) => (\n <Text key={index} size=\"small\" color={entry.color}>\n {entry.name}: {entry.value}\n </Text>\n ))}\n </Styles.CustomTooltip>\n )\n}\n\n/**\n * Gráfico de linhas para mostrar evolução no tempo, com uma ou mais séries (`series`).\n * `showArea` preenche a área abaixo da linha.\n * Para comparar categorias sem ordem de tempo use BarChart.\n * @example <LineChart data={dados} series={[{ dataKey: 'total', name: 'Total', color: '
|
|
1
|
+
{"version":3,"file":"line-chart.comp.js","sources":["../../../../../src/components/charts/line-chart/line-chart.comp.tsx"],"sourcesContent":["import {\n Area,\n AreaChart as AreaChartRecharts,\n CartesianGrid,\n Line,\n LineChart as LineChartRecharts,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts'\nimport { useTheme } from 'styled-components'\n\nimport { CHART_COLOR_ORDER, getThemeColor } from '../../../theme'\nimport { Text } from '../../typography'\n\nimport { LineChartProps } from './line-chart.types'\n\nimport * as Styles from './line-chart.styles'\n\nconst CustomTooltip = ({ active, payload, label }: any) => {\n if (!active || !payload || !payload.length) return null\n\n return (\n <Styles.CustomTooltip direction=\"column\" gap={1}>\n <Text size=\"small\" fontWeight={500}>\n {label}\n </Text>\n {payload.map((entry: any, index: number) => (\n <Text key={index} size=\"small\" color={entry.color}>\n {entry.name}: {entry.value}\n </Text>\n ))}\n </Styles.CustomTooltip>\n )\n}\n\n/**\n * Gráfico de linhas para mostrar evolução no tempo, com uma ou mais séries (`series`).\n * `showArea` preenche a área abaixo da linha.\n * Para comparar categorias sem ordem de tempo use BarChart.\n * @example <LineChart data={dados} series={[{ dataKey: 'total', name: 'Total', color: 'chart.purple' }]} />\n */\nexport const LineChart = ({\n width = 500,\n height = 300,\n data,\n series,\n showArea = false,\n showGrid = true,\n xAxisLabel,\n yAxisLabel,\n yAxisFormatter,\n}: LineChartProps) => {\n const theme = useTheme()\n const chartColors = CHART_COLOR_ORDER.map((name) =>\n getThemeColor(`chart.${name}`, theme),\n )\n const colorOf = (color: string | undefined, index: number) =>\n getThemeColor(color ?? chartColors[index % chartColors.length], theme)\n\n const ChartComponent = showArea ? AreaChartRecharts : LineChartRecharts\n\n return (\n <Styles.ChartContainer\n data-testid=\"line-chart\"\n width={width}\n height={height}\n >\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <ChartComponent\n width={width}\n height={height}\n data={data}\n margin={{ top: 5, right: 30, left: 20, bottom: 5 }}\n >\n {showGrid && (\n <CartesianGrid\n strokeDasharray=\"3 3\"\n stroke={getThemeColor('grey_4', theme)}\n horizontal\n vertical={false}\n />\n )}\n <XAxis\n dataKey=\"name\"\n stroke={getThemeColor('grey_3', theme)}\n tick={{ fill: getThemeColor('grey_2', theme), fontSize: 12 }}\n label={\n xAxisLabel\n ? {\n value: xAxisLabel,\n position: 'insideBottom',\n offset: -5,\n style: {\n fill: getThemeColor('grey_2', theme),\n fontSize: 12,\n },\n }\n : undefined\n }\n />\n <YAxis\n stroke={getThemeColor('grey_3', theme)}\n tick={{ fill: getThemeColor('grey_2', theme), fontSize: 12 }}\n tickFormatter={yAxisFormatter}\n label={\n yAxisLabel\n ? {\n value: yAxisLabel,\n angle: -90,\n position: 'insideLeft',\n style: {\n fill: getThemeColor('grey_2', theme),\n fontSize: 12,\n },\n }\n : undefined\n }\n />\n <Tooltip content={<CustomTooltip />} />\n {showArea\n ? series.map((serie, index) => (\n <Area\n key={serie.dataKey}\n type=\"monotone\"\n dataKey={serie.dataKey}\n name={serie.name}\n stroke={colorOf(serie.color, index)}\n fill={colorOf(serie.color, index)}\n fillOpacity={0.2}\n strokeWidth={serie.strokeWidth || 2}\n />\n ))\n : series.map((serie, index) => (\n <Line\n key={serie.dataKey}\n type=\"monotone\"\n dataKey={serie.dataKey}\n name={serie.name}\n stroke={colorOf(serie.color, index)}\n strokeWidth={serie.strokeWidth || 2}\n dot={{ r: 4 }}\n activeDot={{ r: 6 }}\n />\n ))}\n </ChartComponent>\n </ResponsiveContainer>\n </Styles.ChartContainer>\n )\n}\n"],"names":["CustomTooltip","active","payload","label","length","_jsxs","Styles","direction","gap","children","_jsx","jsx","Text","size","fontWeight","map","entry","index","jsxs","color","name","value","LineChart","width","height","data","series","showArea","showGrid","xAxisLabel","yAxisLabel","yAxisFormatter","theme","useTheme","chartColors","CHART_COLOR_ORDER","getThemeColor","colorOf","ChartComponent","AreaChartRecharts","AreaChart","LineChartRecharts","ResponsiveContainer","margin","top","right","left","bottom","CartesianGrid","strokeDasharray","stroke","horizontal","vertical","XAxis","dataKey","tick","fill","fontSize","position","offset","style","undefined","YAxis","tickFormatter","angle","Tooltip","content","serie","Area","type","fillOpacity","strokeWidth","Line","dot","r","activeDot"],"mappings":"02BAoBA,MAAMA,EAAgBA,EAAGC,SAAQC,UAASC,WACnCF,GAAWC,GAAYA,EAAQE,OAGlCC,EAAAA,KAACC,EAAAA,cAAoB,CAACC,UAAU,SAASC,IAAK,EAC5CC,SAAA,CAAAC,EAAAC,IAACC,OAAI,CAACC,KAAK,QAAQC,WAAY,IAC5BL,SAAAN,IAEFD,EAAQa,KAAI,CAACC,EAAYC,IACxBZ,EAACa,KAAAN,OAAiB,CAAAC,KAAK,QAAQM,MAAOH,EAAMG,MAAKV,SAAA,CAC9CO,EAAMI,KAAI,KAAIJ,EAAMK,QADZJ,QARkC,uBAsB5BK,EACvBC,QAAQ,IACRC,SAAS,IACTC,OACAC,SACAC,YAAW,EACXC,YAAW,EACXC,aACAC,aACAC,qBAEA,MAAMC,EAAQC,EAAAA,WACRC,EAAcC,EAAAA,kBAAkBpB,KAAKK,GACzCgB,EAAAA,uBAAuBhB,IAAQY,KAE3BK,EAAUA,CAAClB,EAA2BF,IAC1CmB,EAAAA,cAAcjB,GAASe,EAAYjB,EAAQiB,EAAY9B,QAAS4B,GAE5DM,EAAiBX,EAAWY,EAAiBC,UAAGC,YAEtD,OACE/B,EAAAA,IAACJ,EAAAA,eAAqB,CAAA,cACR,aACZiB,MAAOA,EACPC,OAAQA,EAAMf,SAEdC,EAACC,IAAA+B,sBAAoB,CAAAnB,MAAM,OAAOC,OAAO,OACvCf,SAAAJ,EAAAa,KAACoB,EAAc,CACbf,MAAOA,EACPC,OAAQA,EACRC,KAAMA,EACNkB,OAAQ,CAAEC,IAAK,EAAGC,MAAO,GAAIC,KAAM,GAAIC,OAAQ,GAAGtC,SAAA,CAEjDmB,GACClB,EAAAC,IAACqC,gBAAa,CACZC,gBAAgB,MAChBC,OAAQd,EAAAA,cAAc,SAAUJ,GAChCmB,YACA,EAAAC,UAAU,IAGd1C,EAAAC,IAAC0C,QAAK,CACJC,QAAQ,OACRJ,OAAQd,EAAAA,cAAc,SAAUJ,GAChCuB,KAAM,CAAEC,KAAMpB,EAAAA,cAAc,SAAUJ,GAAQyB,SAAU,IACxDtD,MACE0B,EACI,CACER,MAAOQ,EACP6B,SAAU,eACVC,QAAS,EACTC,MAAO,CACLJ,KAAMpB,EAAAA,cAAc,SAAUJ,GAC9ByB,SAAU,UAGdI,IAGRnD,EAAAC,IAACmD,QACC,CAAAZ,OAAQd,EAAAA,cAAc,SAAUJ,GAChCuB,KAAM,CAAEC,KAAMpB,EAAAA,cAAc,SAAUJ,GAAQyB,SAAU,IACxDM,cAAehC,EACf5B,MACE2B,EACI,CACET,MAAOS,EACPkC,OAAQ,GACRN,SAAU,aACVE,MAAO,CACLJ,KAAMpB,EAAAA,cAAc,SAAUJ,GAC9ByB,SAAU,UAGdI,IAGRnD,MAACuD,UAAO,CAACC,QAASxD,EAAAA,IAACV,EAAgB,MAClC2B,EACGD,EAAOX,KAAI,CAACoD,EAAOlD,IACjBP,MAAC0D,OAAI,CAEHC,KAAK,WACLf,QAASa,EAAMb,QACflC,KAAM+C,EAAM/C,KACZ8B,OAAQb,EAAQ8B,EAAMhD,MAAOF,GAC7BuC,KAAMnB,EAAQ8B,EAAMhD,MAAOF,GAC3BqD,YAAa,GACbC,YAAaJ,EAAMI,aAAe,GAP7BJ,EAAMb,WAUf5B,EAAOX,KAAI,CAACoD,EAAOlD,IACjBP,EAACC,IAAA6D,QAECH,KAAK,WACLf,QAASa,EAAMb,QACflC,KAAM+C,EAAM/C,KACZ8B,OAAQb,EAAQ8B,EAAMhD,MAAOF,GAC7BsD,YAAaJ,EAAMI,aAAe,EAClCE,IAAK,CAAEC,EAAG,GACVC,UAAW,CAAED,EAAG,IAPXP,EAAMb,iBAYD"}
|