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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{List as
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as i}from"react/jsx-runtime";import{List as l,Item as a,Marker as t,Label as d,Value as n}from"./chart-legend.styles.js";const o=({items:o,direction:c="row",variant:h="dot"})=>e(l,{$direction:c,$variant:h,"data-testid":"chart-legend",children:o.map((l=>r(a,{$variant:h,children:[e(t,{$color:l.color,$variant:h,"aria-hidden":"true"}),"square"===h?r(d,{title:l.label,children:[l.label,void 0!==l.value&&r(i,{children:[": ",l.value]})]}):r(i,{children:[e(d,{title:l.label,children:l.label}),void 0!==l.value&&e(n,{$direction:c,children:l.value})]})]},l.label)))});export{o as ChartLegend};
|
|
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","color","title","label","undefined","value","_Fragment"],"mappings":"4JAWO,MAAMA,EAAcA,EACzBC,QACAC,YAAY,MACZC,UAAU,SAEVC,EAACC,EACa,CAAAC,WAAAJ,EACFK,SAAAJ,gBACE,eAAcK,SAEzBP,EAAMQ,KAAKC,GACVC,EAACN,EAAuC,CAAAE,SAAAJ,YACtCC,EAACC,UACSK,EAAKE,MAAKL,SACRJ,EAAO,cACL,SAED,WAAZA,EACCQ,EAACN,EAAY,CAACQ,MAAOH,EAAKI,MAAKN,SAAA,CAC5BE,EAAKI,WACUC,IAAfL,EAAKM,OAAuBL,oBAAKD,EAAKM,YAGzCL,EAAAM,EAAA,CAAAT,SAAA,CACEJ,EAACC,EAAY,CAACQ,MAAOH,EAAKI,MAAQN,SAAAE,EAAKI,aACvBC,IAAfL,EAAKM,OACJZ,EAACC,EAAyB,CAAAC,WAAAJ,EAAYM,SAAAE,EAAKM,aAfjCN,EAAKI"}
|
|
@@ -1,40 +1,47 @@
|
|
|
1
|
-
import{styled as e,css as t}from"styled-components";import{getThemeColor as
|
|
1
|
+
import{styled as e,css as t}from"styled-components";import{getThemeColor as i}from"../../../theme/theme.util.js";const o=e.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:e,theme:o})=>"row"===e?t`
|
|
8
|
+
${({$direction:e,$variant:i,theme:o})=>"row"===e?t`
|
|
9
9
|
flex-wrap: wrap;
|
|
10
10
|
gap: ${o.spacing.xs} ${o.spacing.md};
|
|
11
11
|
`:t`
|
|
12
12
|
flex-direction: column;
|
|
13
|
-
gap: ${o.spacing.sm};
|
|
13
|
+
gap: ${"square"===i?o.spacing.xs:o.spacing.sm};
|
|
14
14
|
`}
|
|
15
|
-
`,
|
|
15
|
+
`,a=e.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
|
+
`,n=e.span`
|
|
23
23
|
flex: none;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
background: ${({$color:e,theme:t})=>i(e,t)};
|
|
25
|
+
|
|
26
|
+
${({$variant:e,theme:i})=>"square"===e?t`
|
|
27
|
+
width: ${i.spacing.md};
|
|
28
|
+
height: ${i.spacing.md};
|
|
29
|
+
border-radius: ${i.radius.sm};
|
|
30
|
+
`:t`
|
|
31
|
+
width: 10px;
|
|
32
|
+
height: 10px;
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
`}
|
|
35
|
+
`,r=e.span`
|
|
29
36
|
min-width: 0;
|
|
30
37
|
overflow: hidden;
|
|
31
38
|
text-overflow: ellipsis;
|
|
32
39
|
white-space: nowrap;
|
|
33
|
-
`,
|
|
40
|
+
`,s=e.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
|
-
`;export{
|
|
46
|
+
`;export{a as Item,r as Label,o as List,n as Marker,s as Value};
|
|
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":"iHAMaA,MAAAA,EAAOC,EAAOC,EAGzB;;;;;iBAKe,EAAGC,WAAYA,EAAMC,WAAWC;;IAE7C,EAAGC,aAAYC,WAAUJ,WACV,QAAfG,EACIE,CAAG;;iBAEML,EAAMM,QAAQC,MAAMP,EAAMM,QAAQE;UAE3CH,CAAG;;iBAEmB,WAAbD,EAAwBJ,EAAMM,QAAQC,GAAKP,EAAMM,QAAQG;;EAI7DC,EAAOZ,EAAOa,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,EAAOqB,IAG3B;;gBAEc,EAAGC,SAAQpB,WAAYqB,EAAcD,EAAQpB;;IAEzD,EAAGI,WAAUJ,WACA,WAAbI,EACIC,CAAG;mBACQL,EAAMM,QAAQE;oBACbR,EAAMM,QAAQE;2BACPR,EAAMsB,OAAOb;UAEhCJ,CAAG;;;;;EAOEkB,EAAQzB,EAAOqB,IAAI;;;;;EAOnBK,EAAQ1B,EAAOqB,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
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useState as r,useId as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useState as r,useId as a,useEffect as l}from"react";import{useTheme as i}from"styled-components";import{ChartContainer as n,CenterText as s,TotalText as m,WithLegend as c,CustomTooltip as d}from"./doughnut-chart.styles.js";import{CHART_COLOR_ORDER as h}from"../../../theme/chart-colors.js";import{PieChart as p}from"../../../node_modules/recharts/es6/chart/PieChart.js";import{Pie as u}from"../../../node_modules/recharts/es6/polar/Pie.js";import{Cell as f}from"../../../node_modules/recharts/es6/component/Cell.js";import{Tooltip as g}from"../../../node_modules/recharts/es6/component/Tooltip.js";import{ChartLegend as v}from"../chart-legend/chart-legend.comp.js";import{getThemeColor as y}from"../../../theme/theme.util.js";import{Text as j}from"../../typography/text/text.comp.js";const A=e=>e.name?{"aria-label":`${e.name}: ${e.display??e.value}`}:{"aria-hidden":"true"},$=({size:$=200,totalValue:z,parts:_,fontSize:w,showTotalValue:x=!0,showTooltip:T=!1,tooltipValueFormatter:b,disableAnimation:C=!1,customContent:R,legend:V})=>{const P=i(),S=h.map((e=>y(`chart.${e}`,P))),D=(e,t)=>y(e.color??S[t%S.length],P),[F,K]=r([]),[W,k]=r(!1),q=a();l((()=>{const e=_.reduce(((e,t)=>e+t.value),0),t=[..._];e!==z&&(1===_.length?(k(!0),t.push({value:z-e,color:"transparent",display:"none"})):t.push({value:z-e,color:y("grey_5",P)})),K([...t])}),[_]);const B={dataKey:"value",innerRadius:$/2*.75,outerRadius:$/2,startAngle:90,endAngle:-270},E=e(n,{"data-testid":"doughnut-chart",size:$,children:[R?t(s,{children:R}):x&&e(m,{fontSize:w,children:[t("small",{children:"Total"}),t("p",{children:z})]}),e(p,{width:$,height:$,id:q,children:[(W||!z)&&t(u,{data:[{value:1}],fill:y("grey_5",P),animationDuration:0,isAnimationActive:!C,...B,children:t(f,{"aria-hidden":"true"})}),z&&t(u,{data:F,paddingAngle:1===F.length?0:3,cornerRadius:10,isAnimationActive:!C,...B,children:F.map(((e,o)=>t(f,{fill:D(e,o),...A(e)},`cell-${o}`)))}),T&&t(g,{content:({active:r,payload:a})=>{const l=a?.[0]?.name&&"string"==typeof a[0].name;return r?t(d,{direction:"column",children:l?e(o,{children:[t(j,{size:"small",fontWeight:500,children:`${a[0].name}`}),t(j,{size:"small",children:`${b?b(a[0].value):a[0].value}`})]}):t(j,{size:"small",children:`${b?b(a[0].value):a[0].value}`})}):null}})]})]});return V?e(c,{$position:V,children:[E,t(v,{direction:"side"===V?"column":"row",items:_.map(((e,t)=>({part:e,color:D(e,t)}))).filter((({part:e})=>e.name)).map((({part:e,color:t})=>({label:e.name,color:t,value:e.display??e.value})))})]}):E};export{$ as DoughnutChart};
|
|
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","Styles","_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":"u1BAcA,MAAMA,EAAoBC,GACxBA,EAAKC,KACD,CAAE,aAAc,GAAGD,EAAKC,SAASD,EAAKE,SAAWF,EAAKG,SACtD,CAAE,cAAe,QAWVC,EAAgBA,EAC3BC,OAAO,IACPC,aACAC,QACAC,WACAC,kBAAiB,EACjBC,eAAc,EACdC,wBACAC,oBAAmB,EACnBC,gBACAC,aAEA,MAAMC,EAAQC,IACRC,EAAcC,EAAkBC,KAAKlB,GACzCmB,WAAuBnB,IAAQc,KAE3BM,EAAUA,CAACrB,EAAkBsB,IACjCF,EAAcpB,EAAKuB,O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AAMlC,EAAQrB,EAAMsB,MAChBvB,EAAiBC,YAFRsB,SAQpBZ,GAAeqC,EAACc,GAAQC,QA9DTC,EAAGC,SAAQC,cAC/B,MAAMC,EAAUD,IAAU,IAAIhE,MAAmC,iBAApBgE,EAAQ,GAAGhE,KAExD,OAAK+D,EAGHjB,EAACD,GAAqBqB,UAAU,SAAQnB,SACrCkB,EACCrB,EACEuB,EAAA,CAAApB,SAAA,CAAAD,EAACsB,EAAI,CAAChE,KAAK,QAAQiE,WAAY,aAAS,GAAAL,EAAQ,GAAGhE,SACnD8C,EAACsB,EAAI,CAAChE,KAAK,QAAS2C,SAAA,GAAGrC,EAAwBA,EAAsBsD,EAAQ,GAAG9D,OAAS8D,EAAQ,GAAG9D,aAGtG4C,EAACsB,EAAK,CAAAhE,KAAK,QAAS2C,SAAA,GAAGrC,EAAwBA,EAAsBsD,EAAQ,GAAG9D,OAAS8D,EAAQ,GAAG9D,YAVtF,IAYK,UAoD3B,OAAKW,EAGH+B,EAACC,EAAiB,CAAAyB,UAAYzD,EAAMkC,SAAA,CACjCJ,EACDG,EAACyB,EACC,CAAAL,UAAsB,SAAXrD,EAAoB,SAAW,MAC1C2D,MAAOlE,EACJY,KAAI,CAACnB,EAAMsB,KAAW,CAAEtB,OAAMuB,MAAOF,EAAQrB,EAAMsB,OACnDoD,QAAO,EAAG1E,UAAWA,EAAKC,OAC1BkB,KAAI,EAAGnB,OAAMuB,YAAa,CACzBoD,MAAO3E,EAAKC,KACZsB,QACApB,MAAOH,EAAKE,SAAWF,EAAKG,eAblByC,CAgBE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useTheme as o}from"styled-components";import{ChartContainer as r,CustomTooltip as i}from"./line-chart.styles.js";import{ResponsiveContainer as a}from"../../../node_modules/recharts/es6/component/ResponsiveContainer.js";import{CartesianGrid as s}from"../../../node_modules/recharts/es6/cartesian/CartesianGrid.js";import{XAxis as
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useTheme as o}from"styled-components";import{ChartContainer as r,CustomTooltip as i}from"./line-chart.styles.js";import{ResponsiveContainer as a}from"../../../node_modules/recharts/es6/component/ResponsiveContainer.js";import{CartesianGrid as s}from"../../../node_modules/recharts/es6/cartesian/CartesianGrid.js";import{XAxis as m}from"../../../node_modules/recharts/es6/cartesian/XAxis.js";import{YAxis as n}from"../../../node_modules/recharts/es6/cartesian/YAxis.js";import{Tooltip as l}from"../../../node_modules/recharts/es6/component/Tooltip.js";import{Area as d}from"../../../node_modules/recharts/es6/cartesian/Area.js";import{Line as h}from"../../../node_modules/recharts/es6/cartesian/Line.js";import{AreaChart as c}from"../../../node_modules/recharts/es6/chart/AreaChart.js";import{LineChart as p}from"../../../node_modules/recharts/es6/chart/LineChart.js";import{CHART_COLOR_ORDER as f}from"../../../theme/chart-colors.js";import{getThemeColor as y}from"../../../theme/theme.util.js";import{Text as g}from"../../typography/text/text.comp.js";const u=({active:o,payload:r,label:a})=>o&&r&&r.length?t(i,{direction:"column",gap:1,children:[e(g,{size:"small",fontWeight:500,children:a}),r.map(((e,o)=>t(g,{size:"small",color:e.color,children:[e.name,": ",e.value]},o)))]}):null,_=({width:i=500,height:g=300,data:_,series:j,showArea:k=!1,showGrid:x=!0,xAxisLabel:v,yAxisLabel:A,yAxisFormatter:z})=>{const K=o(),b=f.map((e=>y(`chart.${e}`,K))),w=(e,t)=>y(e??b[t%b.length],K);return e(r,{"data-testid":"line-chart",width:i,height:g,children:e(a,{width:"100%",height:"100%",children:t(k?c:p,{width:i,height:g,data:_,margin:{top:5,right:30,left:20,bottom:5},children:[x&&e(s,{strokeDasharray:"3 3",stroke:y("grey_4",K),horizontal:!0,vertical:!1}),e(m,{dataKey:"name",stroke:y("grey_3",K),tick:{fill:y("grey_2",K),fontSize:12},label:v?{value:v,position:"insideBottom",offset:-5,style:{fill:y("grey_2",K),fontSize:12}}:void 0}),e(n,{stroke:y("grey_3",K),tick:{fill:y("grey_2",K),fontSize:12},tickFormatter:z,label:A?{value:A,angle:-90,position:"insideLeft",style:{fill:y("grey_2",K),fontSize:12}}:void 0}),e(l,{content:e(u,{})}),k?j.map(((t,o)=>e(d,{type:"monotone",dataKey:t.dataKey,name:t.name,stroke:w(t.color,o),fill:w(t.color,o),fillOpacity:.2,strokeWidth:t.strokeWidth||2},t.dataKey))):j.map(((t,o)=>e(h,{type:"monotone",dataKey:t.dataKey,name:t.name,stroke:w(t.color,o),strokeWidth:t.strokeWidth||2,dot:{r:4},activeDot:{r:6}},t.dataKey)))]})})})};export{_ as LineChart};
|
|
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","Text","size","fontWeight","map","entry","index","color","name","value","LineChart","width","height","data","series","showArea","showGrid","xAxisLabel","yAxisLabel","yAxisFormatter","theme","useTheme","chartColors","CHART_COLOR_ORDER","getThemeColor","colorOf","ResponsiveContainer","AreaChartRecharts","LineChartRecharts","margin","top","right","left","bottom","CartesianGrid","strokeDasharray","stroke","horizontal","vertical","XAxis","dataKey","tick","fill","fontSize","position","offset","style","undefined","YAxis","tickFormatter","angle","Tooltip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AAS,EACTC,MAAO,CACLJ,KAAMlB,EAAc,SAAUJ,GAC9BuB,SAAU,UAGdI,IAGR/C,EAACgD,EACC,CAAAZ,OAAQZ,EAAc,SAAUJ,GAChCqB,KAAM,CAAEC,KAAMlB,EAAc,SAAUJ,GAAQuB,SAAU,IACxDM,cAAe9B,EACf1B,MACEyB,EACI,CACET,MAAOS,EACPgC,OAAQ,GACRN,SAAU,aACVE,MAAO,CACLJ,KAAMlB,EAAc,SAAUJ,GAC9BuB,SAAU,UAGdI,IAGR/C,EAACmD,EAAO,CAACC,QAASpD,EAACV,EAAgB,MAClCyB,EACGD,EAAOV,KAAI,CAACiD,EAAO/C,IACjBN,EAACsD,EAAI,CAEHC,KAAK,WACLf,QAASa,EAAMb,QACfhC,KAAM6C,EAAM7C,KACZ4B,OAAQX,EAAQ4B,EAAM9C,MAAOD,GAC7BoC,KAAMjB,EAAQ4B,EAAM9C,MAAOD,GAC3BkD,YAAa,GACbC,YAAaJ,EAAMI,aAAe,GAP7BJ,EAAMb,WAUf1B,EAAOV,KAAI,CAACiD,EAAO/C,IACjBN,EAAC0D,GAECH,KAAK,WACLf,QAASa,EAAMb,QACfhC,KAAM6C,EAAM7C,KACZ4B,OAAQX,EAAQ4B,EAAM9C,MAAOD,GAC7BmD,YAAaJ,EAAMI,aAAe,EAClCE,IAAK,CAAEC,EAAG,GACVC,UAAW,CAAED,EAAG,IAPXP,EAAMb,iBAYD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useTheme as r}from"styled-components";import{ChartContainer as o,CustomTooltip as n}from"./treemap-chart.styles.js";import{ResponsiveContainer as a}from"../../../node_modules/recharts/es6/component/ResponsiveContainer.js";import{Treemap as l}from"../../../node_modules/recharts/es6/chart/Treemap.js";import{Tooltip as i}from"../../../node_modules/recharts/es6/component/Tooltip.js";import{Text as c}from"../../typography/text/text.comp.js";
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useTheme as r}from"styled-components";import{ChartContainer as o,CustomTooltip as n}from"./treemap-chart.styles.js";import{ResponsiveContainer as a}from"../../../node_modules/recharts/es6/component/ResponsiveContainer.js";import{Treemap as l}from"../../../node_modules/recharts/es6/chart/Treemap.js";import{Tooltip as i}from"../../../node_modules/recharts/es6/component/Tooltip.js";import{CHART_COLOR_ORDER as m}from"../../../theme/chart-colors.js";import{getThemeColor as h}from"../../../theme/theme.util.js";import{Text as c}from"../../typography/text/text.comp.js";function s({x:o=0,y:n=0,width:a=0,height:l=0,name:i,value:m,fill:c,valueFormatter:s}){const d=a>=60&&l>=40,p=a>=60&&l>=60,u=r(),f=function(e){const t=e.replace("#","");if(6!==t.length)return!1;const r=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),n=parseInt(t.slice(4,6),16);return(.299*r+.587*o+.114*n)/255<.5}(c??h("chart.grey",u)),g=f?u.colors.white:u.colors.grey_1,x=f?"rgba(255,255,255,0.75)":u.colors.grey_2;return t("g",{children:[e("rect",{x:o+1,y:n+1,width:Math.max(0,a-2),height:Math.max(0,l-2),fill:c??h("chart.grey",u),rx:3,ry:3}),d&&i&&e("text",{x:o+a/2,y:n+l/2-(p?10:0),textAnchor:"middle",dominantBaseline:"middle",fill:g,fontSize:Math.min(13,Math.max(9,a/10)),fontWeight:600,pointerEvents:"none",children:i.length>Math.floor(a/7)?`${i.slice(0,Math.floor(a/7)-1)}…`:i}),p&&null!=m&&e("text",{x:o+a/2,y:n+l/2+12,textAnchor:"middle",dominantBaseline:"middle",fill:x,fontSize:Math.min(11,Math.max(9,a/12)),pointerEvents:"none",children:s?s(m):m})]})}const d=({active:r,payload:o,valueFormatter:a})=>{if(!r||!o?.length)return null;const l=o[0].payload;return t(n,{direction:"column",gap:1,children:[e(c,{size:"small",fontWeight:500,children:l.name}),e(c,{size:"small",color:"grey_2",children:a?a(l.value):l.value})]})},p=({width:t="100%",height:n=300,data:c,valueFormatter:p})=>{const u=r(),f=m.map((e=>h(`chart.${e}`,u))),g=c.map(((e,t)=>({name:e.name,value:e.value>0?e.value:.01,fill:h(e.color??f[t%f.length],u)})));return e(o,{"data-testid":"treemap-chart",width:t,height:n,children:e(a,{width:"100%",height:"100%",children:e(l,{data:g,dataKey:"value",content:t=>e(s,{...t,valueFormatter:p}),children:e(i,{content:t=>e(d,{...t,valueFormatter:p})})})})})};export{p as TreemapChart};
|
|
2
2
|
//# sourceMappingURL=treemap-chart.comp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treemap-chart.comp.js","sources":["../../../../../src/components/charts/treemap-chart/treemap-chart.comp.tsx"],"sourcesContent":["import { ResponsiveContainer, Tooltip, Treemap } from 'recharts'\nimport { useTheme } from 'styled-components'\n\nimport { Text } from '../../typography'\n\nimport { TreemapChartProps } from './treemap-chart.types'\n\nimport * as Styles from './treemap-chart.styles'\n\ninterface ContentProps {\n x?: number\n y?: number\n width?: number\n height?: number\n name?: string\n value?: number\n fill?: string\n}\n\nconst
|
|
1
|
+
{"version":3,"file":"treemap-chart.comp.js","sources":["../../../../../src/components/charts/treemap-chart/treemap-chart.comp.tsx"],"sourcesContent":["import { ResponsiveContainer, Tooltip, Treemap } from 'recharts'\nimport { useTheme } from 'styled-components'\n\nimport { CHART_COLOR_ORDER, getThemeColor } from '../../../theme'\nimport { Text } from '../../typography'\n\nimport { TreemapChartProps } from './treemap-chart.types'\n\nimport * as Styles from './treemap-chart.styles'\n\ninterface ContentProps {\n x?: number\n y?: number\n width?: number\n height?: number\n name?: string\n value?: number\n fill?: string\n}\n\nconst MIN_WIDTH_FOR_TEXT = 60\nconst MIN_HEIGHT_FOR_TEXT = 40\nconst MIN_HEIGHT_FOR_VALUE = 60\n\nfunction CustomContent({\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n name,\n value,\n fill,\n valueFormatter,\n}: ContentProps & { valueFormatter?: (v: number) => string }) {\n const showText = width >= MIN_WIDTH_FOR_TEXT && height >= MIN_HEIGHT_FOR_TEXT\n const showValue =\n width >= MIN_WIDTH_FOR_TEXT && height >= MIN_HEIGHT_FOR_VALUE\n\n const theme = useTheme()\n const isDark = isDarkColor(fill ?? getThemeColor('chart.grey', theme))\n const textColor = isDark ? theme.colors.white : theme.colors.grey_1\n const subTextColor = isDark ? 'rgba(255,255,255,0.75)' : theme.colors.grey_2\n\n return (\n <g>\n <rect\n x={x + 1}\n y={y + 1}\n width={Math.max(0, width - 2)}\n height={Math.max(0, height - 2)}\n fill={fill ?? getThemeColor('chart.grey', theme)}\n rx={3}\n ry={3}\n />\n {showText && name && (\n <text\n x={x + width / 2}\n y={y + height / 2 - (showValue ? 10 : 0)}\n textAnchor=\"middle\"\n dominantBaseline=\"middle\"\n fill={textColor}\n fontSize={Math.min(13, Math.max(9, width / 10))}\n fontWeight={600}\n pointerEvents=\"none\"\n >\n {name.length > Math.floor(width / 7)\n ? `${name.slice(0, Math.floor(width / 7) - 1)}…`\n : name}\n </text>\n )}\n {showValue && value != null && (\n <text\n x={x + width / 2}\n y={y + height / 2 + 12}\n textAnchor=\"middle\"\n dominantBaseline=\"middle\"\n fill={subTextColor}\n fontSize={Math.min(11, Math.max(9, width / 12))}\n pointerEvents=\"none\"\n >\n {valueFormatter ? valueFormatter(value) : value}\n </text>\n )}\n </g>\n )\n}\n\nfunction isDarkColor(hex: string): boolean {\n const clean = hex.replace('#', '')\n if (clean.length !== 6) return false\n const r = parseInt(clean.slice(0, 2), 16)\n const g = parseInt(clean.slice(2, 4), 16)\n const b = parseInt(clean.slice(4, 6), 16)\n const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255\n return luminance < 0.5\n}\n\nconst CustomTooltip = ({\n active,\n payload,\n valueFormatter,\n}: {\n active?: boolean\n payload?: Array<{ payload: { name: string; value: number; fill: string } }>\n valueFormatter?: (v: number) => string\n}) => {\n if (!active || !payload?.length) return null\n const item = payload[0].payload\n return (\n <Styles.CustomTooltip direction=\"column\" gap={1}>\n <Text size=\"small\" fontWeight={500}>\n {item.name}\n </Text>\n <Text size=\"small\" color=\"grey_2\">\n {valueFormatter ? valueFormatter(item.value) : item.value}\n </Text>\n </Styles.CustomTooltip>\n )\n}\n\n/**\n * Retângulos com área proporcional ao valor, para mostrar o peso de muitas categorias de uma vez (ex.: volume por material).\n * Para poucas categorias use BarChart ou DoughnutChart.\n * Cor de cada bloco pela paleta de gráfico (`color: 'chart.lilac'`); sem cor, segue a ordem de\n * `getChartColors`.\n * @example <TreemapChart data={[{ name: 'Algodão', value: 120 }, { name: 'Poliéster', value: 40 }]} />\n */\nexport const TreemapChart = ({\n width = '100%',\n height = 300,\n data,\n valueFormatter,\n}: TreemapChartProps) => {\n const theme = useTheme()\n const chartColors = CHART_COLOR_ORDER.map((name) =>\n getThemeColor(`chart.${name}`, theme),\n )\n const rechartsData = data.map((item, index) => ({\n name: item.name,\n value: item.value > 0 ? item.value : 0.01,\n fill: getThemeColor(\n item.color ?? chartColors[index % chartColors.length],\n theme,\n ),\n }))\n\n return (\n <Styles.ChartContainer\n data-testid=\"treemap-chart\"\n width={width}\n height={height}\n >\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}\n <Treemap\n data={rechartsData}\n dataKey=\"value\"\n content={\n ((props: ContentProps) => (\n <CustomContent {...props} valueFormatter={valueFormatter} />\n )) as any\n }\n >\n <Tooltip\n content={\n ((props: any) => (\n <CustomTooltip {...props} valueFormatter={valueFormatter} />\n )) as any\n }\n />\n </Treemap>\n </ResponsiveContainer>\n </Styles.ChartContainer>\n )\n}\n"],"names":["CustomContent","x","y","width","height","name","value","fill","valueFormatter","showText","showValue","theme","useTheme","isDark","hex","clean","replace","length","r","parseInt","slice","g","b","isDarkColor","getThemeColor","textColor","colors","white","grey_1","subTextColor","grey_2","_jsxs","children","_jsx","Math","max","rx","ry","textAnchor","dominantBaseline","fontSize","min","fontWeight","pointerEvents","floor","CustomTooltip","active","payload","item","Styles","direction","gap","Text","size","color","TreemapChart","data","chartColors","CH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B,EAAoB,CAAA3D,MAAM,OAAOC,OAAO,OAEvC4B,SAAAC,EAAC8B,EACC,CAAAP,KAAMI,EACNI,QAAQ,QACRC,QACIC,GACAjC,EAACjC,EAAkB,IAAAkE,EAAO1D,eAAgBA,IAI9CwB,SAAAC,EAACkC,EACC,CAAAF,QACIC,GACAjC,EAACY,EAAa,IAAKqB,EAAO1D,eAAgBA,WAM9B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import{Wrapper as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{Wrapper as r}from"./icon-box.styles.js";import{Icon as e}from"../icon/icon.comp.js";const i=({icon:i,color:t,size:n=24,shape:s="square",gradientBorder:a})=>o(r,{"data-testid":"icon-box",$shape:s,$gradientBorder:a,children:o(e,t?{name:i,size:n,color:t}:{name:i,size:n,gradient:!0})});export{i as IconBox};
|
|
2
2
|
//# sourceMappingURL=icon-box.comp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-box.comp.js","sources":["../../../../../src/components/icons/icon-box/icon-box.comp.tsx"],"sourcesContent":["import { Icon } from '../icon'\n\nimport { IconBoxProps } from './icon-box.types'\n\nimport * as Styles from './icon-box.styles'\n\n/**\n * Ícone dentro de uma caixinha com borda e sombra leve. É o ícone dos títulos de card e dos números\n * das dashboards. Sem `color`, o ícone vem no gradiente da marca.\n * Use para identificar um bloco; não use como botão (use IconButton).\n * @example <IconBox icon=\"file_list3\" />\n */\nexport const IconBox = ({
|
|
1
|
+
{"version":3,"file":"icon-box.comp.js","sources":["../../../../../src/components/icons/icon-box/icon-box.comp.tsx"],"sourcesContent":["import { Icon } from '../icon'\n\nimport { IconBoxProps } from './icon-box.types'\n\nimport * as Styles from './icon-box.styles'\n\n/**\n * Ícone dentro de uma caixinha com borda e sombra leve. É o ícone dos títulos de card e dos números\n * das 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.\n * Use para identificar um bloco; não use como botão (use IconButton).\n * @example <IconBox icon=\"file_list3\" />\n * @example <IconBox icon=\"robot2\" shape=\"circle\" gradientBorder=\"animated\" />\n */\nexport const IconBox = ({\n icon,\n color,\n size = 24,\n shape = 'square',\n gradientBorder,\n}: IconBoxProps) => (\n <Styles.Wrapper\n data-testid=\"icon-box\"\n $shape={shape}\n $gradientBorder={gradientBorder}\n >\n {color ? (\n <Icon name={icon} size={size} color={color} />\n ) : (\n <Icon name={icon} size={size} gradient />\n )}\n </Styles.Wrapper>\n)\n"],"names":["IconBox","icon","color","size","shape","gradientBorder","_jsx","Styles","$gradientBorder","children","Icon","name","gradient"],"mappings":"mIAcO,MAAMA,EAAUA,EACrBC,OACAC,QACAC,OAAO,GACPC,QAAQ,SACRC,oBAEAC,EAACC,EACa,CAAA,cAAA,kBACJH,EAAKI,gBACIH,EAAcI,SAG7BH,EAACI,EADFR,EACM,CAACS,KAAMV,EAAME,KAAMA,EAAMD,MAAOA,GAEhC,CAACS,KAAMV,EAAME,KAAMA,EAAMS,UAAQ"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import{styled as e}from"styled-components";import{Box as o}from"../../layout/box/box.comp.js";import{getThemeColor as
|
|
1
|
+
import{styled as e,css as r}from"styled-components";import{gradientBorder as t}from"../../../theme/gradient-border.js";import{Box as o}from"../../layout/box/box.comp.js";import{getThemeColor as i}from"../../../theme/theme.util.js";const d=e(o)`
|
|
2
2
|
flex: none;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
padding: 10px;
|
|
6
|
-
border:
|
|
7
|
-
border-radius: ${({theme:e})=>e.radius.lg};
|
|
6
|
+
border-radius: ${({$shape:e,theme:r})=>"circle"===e?r.radius.full:r.radius.lg};
|
|
8
7
|
box-shadow: ${({theme:e})=>e.box_shadow.input};
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
${({$gradientBorder:e,$shape:o,theme:d})=>e?t({animated:"animated"===e,width:"animated"===e?2:1,radius:"circle"===o?d.radius.full:d.radius.lg,theme:d}):r`
|
|
10
|
+
border: 1px solid ${i("grey_5",d)};
|
|
11
|
+
`}
|
|
12
|
+
`;export{d as Wrapper};
|
|
10
13
|
//# sourceMappingURL=icon-box.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-box.styles.js","sources":["../../../../../src/components/icons/icon-box/icon-box.styles.tsx"],"sourcesContent":["import { styled } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme'\nimport { Box } from '../../layout/box'\n\nexport const Wrapper = styled(Box)
|
|
1
|
+
{"version":3,"file":"icon-box.styles.js","sources":["../../../../../src/components/icons/icon-box/icon-box.styles.tsx"],"sourcesContent":["import { css, styled } from 'styled-components'\n\nimport { getThemeColor } from '../../../theme'\nimport { gradientBorder } from '../../../theme/gradient-border'\nimport { Box } from '../../layout/box'\n\nimport { IconBoxShape } from './icon-box.types'\n\nexport const Wrapper = styled(Box)<{\n $shape: IconBoxShape\n $gradientBorder?: boolean | 'animated'\n}>`\n flex: none;\n align-items: center;\n justify-content: center;\n padding: 10px;\n border-radius: ${({ $shape, theme }) =>\n $shape === 'circle' ? theme.radius.full : theme.radius.lg};\n box-shadow: ${({ theme }) => theme.box_shadow.input};\n\n ${({ $gradientBorder, $shape, theme }) =>\n $gradientBorder\n ? gradientBorder({\n animated: $gradientBorder === 'animated',\n width: $gradientBorder === 'animated' ? 2 : 1,\n radius: $shape === 'circle' ? theme.radius.full : theme.radius.lg,\n theme,\n })\n : css`\n border: 1px solid ${getThemeColor('grey_5', theme)};\n `}\n`\n"],"names":["Wrapper","styled","Box","$shape","theme","radius","full","lg","box_shadow","input","$gradientBorder","gradientBorder","animated","width","css","getThemeColor"],"mappings":"6OAQaA,EAAUC,EAAOC,EAG5B;;;;;mBAKiB,EAAGC,SAAQC,WACf,WAAXD,EAAsBC,EAAMC,OAAOC,KAAOF,EAAMC,OAAOE;gBAC3C,EAAGH,WAAYA,EAAMI,WAAWC;;IAE5C,EAAGC,kBAAiBP,SAAQC,WAC5BM,EACIC,EAAe,CACbC,SAA8B,aAApBF,EACVG,MAA2B,aAApBH,EAAiC,EAAI,EAC5CL,OAAmB,WAAXF,EAAsBC,EAAMC,OAAOC,KAAOF,EAAMC,OAAOE,GAC/DH,UAEFU,CAAG;8BACmBC,EAAc,SAAUX;;"}
|
|
@@ -1,53 +1,4 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
`,a=r(t)`
|
|
6
|
-
${({$animated:o,$width:r,$radius:t,theme:a})=>o?e`
|
|
7
|
-
position: relative;
|
|
8
|
-
isolation: isolate;
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
border: none;
|
|
11
|
-
background: transparent;
|
|
12
|
-
|
|
13
|
-
&::before {
|
|
14
|
-
content: '';
|
|
15
|
-
position: absolute;
|
|
16
|
-
top: 50%;
|
|
17
|
-
left: 50%;
|
|
18
|
-
z-index: -2;
|
|
19
|
-
width: max(250%, 1200px);
|
|
20
|
-
aspect-ratio: 1;
|
|
21
|
-
background: conic-gradient(
|
|
22
|
-
${a.colors.primary},
|
|
23
|
-
${a.colors.secondary},
|
|
24
|
-
${a.colors.primary}
|
|
25
|
-
);
|
|
26
|
-
transform: translate(-50%, -50%);
|
|
27
|
-
animation: ${n} 4s linear infinite;
|
|
28
|
-
will-change: transform;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&::after {
|
|
32
|
-
content: '';
|
|
33
|
-
position: absolute;
|
|
34
|
-
inset: ${r}px;
|
|
35
|
-
z-index: -1;
|
|
36
|
-
border-radius: max(0px, calc(${t} - ${r}px));
|
|
37
|
-
background: ${a.colors.white};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@media (prefers-reduced-motion: reduce) {
|
|
41
|
-
&::before {
|
|
42
|
-
animation: none;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
`:e`
|
|
46
|
-
border: ${r}px solid transparent;
|
|
47
|
-
background:
|
|
48
|
-
linear-gradient(${a.colors.white}, ${a.colors.white})
|
|
49
|
-
padding-box,
|
|
50
|
-
${a.colors.brand.gradient} border-box;
|
|
51
|
-
`}
|
|
52
|
-
`;export{a as GradientCard};
|
|
1
|
+
import{styled as t}from"styled-components";import{gradientBorder as o}from"../../../theme/gradient-border.js";import{Box as e}from"../box/box.comp.js";const m=t(e)`
|
|
2
|
+
${({$animated:t,$width:e,$radius:m,theme:r})=>o({animated:t,width:e,radius:m,theme:r})}
|
|
3
|
+
`;export{m as GradientCard};
|
|
53
4
|
//# sourceMappingURL=card.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.styles.js","sources":["../../../../../src/components/layout/card/card.styles.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"card.styles.js","sources":["../../../../../src/components/layout/card/card.styles.tsx"],"sourcesContent":["import { styled } from 'styled-components'\n\nimport { gradientBorder } from '../../../theme/gradient-border'\nimport { Box } from '../box'\n\nexport const GradientCard = styled(Box)<{\n $animated: boolean\n $width: number\n $radius: string\n}>`\n ${({ $animated, $width, $radius, theme }) =>\n gradientBorder({\n animated: $animated,\n width: $width,\n radius: $radius,\n theme,\n })}\n`\n"],"names":["GradientCard","styled","Box","$animated","$width","$radius","theme","gradientBorder","animated","width","radius"],"mappings":"6JAKaA,EAAeC,EAAOC,EAIjC;IACE,EAAGC,YAAWC,SAAQC,UAASC,WAC/BC,EAAe,CACbC,SAAUL,EACVM,MAAOL,EACPM,OAAQL,EACRC;"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{Button}from"./components/buttons/button/button.comp.js";export{IconButton}from"./components/buttons/icon-button/icon-button.comp.js";export{DoughnutChart}from"./components/charts/doughnut-chart/doughnut-chart.comp.js";export{BarChart}from"./components/charts/bar-chart/bar-chart.comp.js";export{LineChart}from"./components/charts/line-chart/line-chart.comp.js";export{TreemapChart}from"./components/charts/treemap-chart/treemap-chart.comp.js";export{ChartLegend}from"./components/charts/chart-legend/chart-legend.comp.js";export{Calendar}from"./components/data-display/calendar/calendar.comp.js";export{InfoItem}from"./components/data-display/info-item/info-item.comp.js";export{Matrix,getBand}from"./components/data-display/matrix/matrix.comp.js";export{TintedSection}from"./components/data-display/tinted-section/tinted-section.comp.js";export{TreeNode}from"./components/data-display/tree-node/tree-node.comp.js";export{CanvasButton,CanvasPanel,DirectionToggle,FullscreenToggle}from"./components/data-display/canvas-controls/canvas-controls.comp.js";export{SelectableItem,SidePanel}from"./components/data-display/side-panel/side-panel.comp.js";export{Spinner}from"./components/feedback/spinner/spinner.comp.js";export{Tooltip}from"./components/feedback/tooltip/tooltip.comp.js";export{Skeleton}from"./components/feedback/skeleton/skeleton.comp.js";export{Tag}from"./components/feedback/tag/tag.comp.js";export{Toast,ToastStackStyles}from"./components/feedback/toast/toast.comp.js";export{ToastProvider,useToast}from"./components/feedback/toast/toast.provider.js";export{EmptyState}from"./components/feedback/empty-state/empty-state.comp.js";export{Alert}from"./components/feedback/alert/alert.comp.js";export{ProgressBar}from"./components/feedback/progress-bar/progress-bar.comp.js";export{ConfirmDialog}from"./components/feedback/confirm-dialog/confirm-dialog.comp.js";export{ConfirmDialogProvider,useConfirm}from"./components/feedback/confirm-dialog/confirm-dialog.provider.js";export{Autocomplete,CustomAutocomplete}from"./components/forms/autocomplete/autocomplete.comp.js";export{CheckBox,Checkbox,CustomCheckBox}from"./components/forms/checkbox/checkbox.comp.js";export{MonthPicker}from"./components/forms/date/month-picker/month-picker.comp.js";export{formatDateKey,parseDateText}from"./components/forms/date/date-picker/date.utils.js";export{DEFAULT_DATE_LABELS,DatePicker,initialDay}from"./components/forms/date/date-picker/date-picker.comp.js";export{DateRangePicker}from"./components/forms/date/date-picker/date-range-picker.comp.js";export{DragNDrop,FileDropzone}from"./components/forms/file/drag-n-drop/drag-n-drop.comp.js";export{FilePreview}from"./components/forms/file/file-preview/file-preview.comp.js";export{FileImagePreview}from"./components/forms/file/file-image-preview/file-image-preview.comp.js";export{FilePreviewList}from"./components/forms/file/file-preview-list/file-preview-list.comp.js";export{FileImagePreviewList}from"./components/forms/file/file-image-preview-list/file-image-preview-list.comp.js";export{CustomInput,Input}from"./components/forms/input/input.comp.js";export{Select}from"./components/forms/select/select.comp.js";export{CustomSwitch,Switch}from"./components/forms/switch/switch.comp.js";export{CustomTextArea,TextArea}from"./components/forms/textarea/textarea.comp.js";export{SearchInput}from"./components/forms/search-input/search-input.comp.js";export{RadioGroup}from"./components/forms/radio-group/radio-group.comp.js";export{Icon}from"./components/icons/icon/icon.comp.js";export{LUCIDE_PREFIX,allIconsOptions,customIconsOptions,isLucideName,parseIconNameToLucide,parseIconNameToRemixIcon}from"./components/icons/icon/icon.utils.js";export{IconBox}from"./components/icons/icon-box/icon-box.comp.js";export{Image}from"./components/images/image/image.comp.js";export{Avatar}from"./components/images/avatar/avatar.comp.js";export{Accordion}from"./components/layout/accordion/accordion.comp.js";export{Box,CustomBox}from"./components/layout/box/box.comp.js";export{Modal}from"./components/layout/modal/modal.comp.js";export{Timeline}from"./components/layout/timeline/timeline.comp.js";export{TreeView,Treeview}from"./components/layout/treeview/treeview.comp.js";export{Popover}from"./components/layout/popover/popover.comp.js";export{Table}from"./components/layout/table/table.comp.js";export{Carousel,Slider}from"./components/layout/slider/slider.comp.js";export{Drawer}from"./components/layout/drawer/drawer.comp.js";export{Card}from"./components/layout/card/card.comp.js";export{TitleCard}from"./components/layout/title-card/title-card.comp.js";export{StatCard}from"./components/layout/stat-card/stat-card.comp.js";export{Divider}from"./components/layout/divider/divider.comp.js";export{Pagination}from"./components/navigation/pagination/pagination.comp.js";export{Tabs}from"./components/navigation/tabs/tabs.comp.js";export{TextLink}from"./components/navigation/text-link/text-link.comp.js";export{TablePagination}from"./components/navigation/table-pagination/table-pagination.comp.js";export{Breadcrumb}from"./components/navigation/breadcrumb/breadcrumb.comp.js";export{ActionMenu}from"./components/navigation/action-menu/action-menu.comp.js";export{Stepper}from"./components/navigation/stepper/stepper.comp.js";export{ViewToggle}from"./components/navigation/view-toggle/view-toggle.comp.js";export{NavigationCard}from"./components/navigation/navigation-card/navigation-card.comp.js";export{NavigationCards}from"./components/navigation/navigation-card/navigation-cards.comp.js";export{NavigationSections}from"./components/navigation/navigation-sections/navigation-sections.comp.js";export{Text}from"./components/typography/text/text.comp.js";export{useBreakpoint,useIsMobile,useIsTablet,useMediaQuery}from"./hooks/use-breakpoint.js";export{tokens}from"./theme/generated/tokens.js";export{createTheme}from"./theme/create-theme.js";export{CHART_COLOR_ORDER,CHART_OTHER_COLOR,getChartColors}from"./theme/chart-colors.js";export{SUPPORTED_CLIENT_FONTS,createClientTheme,getClientThemeIssues}from"./theme/client-theme.js";export{defaultTheme,legacyTheme}from"./theme/default-theme.js";export{GlobalStyle}from"./theme/global-styles.js";export{breakpointValues,media}from"./theme/media.js";export{thinScrollbar,thinScrollbarOnHover}from"./theme/scrollbar.js";export{ThemeProvider}from"./theme/theme-provider.js";export{adjustColorBrightness,getContrastRatio,getLuminance,getReadableTextColor,getThemeColor,getThemeContrastColor,getThemeSize,getThemeSpacing,mixColors}from"./theme/theme.util.js";
|
|
1
|
+
export{Button}from"./components/buttons/button/button.comp.js";export{IconButton}from"./components/buttons/icon-button/icon-button.comp.js";export{DoughnutChart}from"./components/charts/doughnut-chart/doughnut-chart.comp.js";export{BarChart}from"./components/charts/bar-chart/bar-chart.comp.js";export{LineChart}from"./components/charts/line-chart/line-chart.comp.js";export{TreemapChart}from"./components/charts/treemap-chart/treemap-chart.comp.js";export{ChartLegend}from"./components/charts/chart-legend/chart-legend.comp.js";export{Calendar}from"./components/data-display/calendar/calendar.comp.js";export{InfoItem}from"./components/data-display/info-item/info-item.comp.js";export{Matrix,getBand}from"./components/data-display/matrix/matrix.comp.js";export{TintedSection}from"./components/data-display/tinted-section/tinted-section.comp.js";export{TreeNode}from"./components/data-display/tree-node/tree-node.comp.js";export{CanvasButton,CanvasPanel,DirectionToggle,FullscreenToggle}from"./components/data-display/canvas-controls/canvas-controls.comp.js";export{SelectableItem,SidePanel}from"./components/data-display/side-panel/side-panel.comp.js";export{Spinner}from"./components/feedback/spinner/spinner.comp.js";export{Tooltip}from"./components/feedback/tooltip/tooltip.comp.js";export{Skeleton}from"./components/feedback/skeleton/skeleton.comp.js";export{Tag}from"./components/feedback/tag/tag.comp.js";export{Toast,ToastStackStyles}from"./components/feedback/toast/toast.comp.js";export{ToastProvider,useToast}from"./components/feedback/toast/toast.provider.js";export{EmptyState}from"./components/feedback/empty-state/empty-state.comp.js";export{Alert}from"./components/feedback/alert/alert.comp.js";export{ProgressBar}from"./components/feedback/progress-bar/progress-bar.comp.js";export{ConfirmDialog}from"./components/feedback/confirm-dialog/confirm-dialog.comp.js";export{ConfirmDialogProvider,useConfirm}from"./components/feedback/confirm-dialog/confirm-dialog.provider.js";export{Autocomplete,CustomAutocomplete}from"./components/forms/autocomplete/autocomplete.comp.js";export{CheckBox,Checkbox,CustomCheckBox}from"./components/forms/checkbox/checkbox.comp.js";export{MonthPicker}from"./components/forms/date/month-picker/month-picker.comp.js";export{formatDateKey,parseDateText}from"./components/forms/date/date-picker/date.utils.js";export{DEFAULT_DATE_LABELS,DatePicker,initialDay}from"./components/forms/date/date-picker/date-picker.comp.js";export{DateRangePicker}from"./components/forms/date/date-picker/date-range-picker.comp.js";export{DragNDrop,FileDropzone}from"./components/forms/file/drag-n-drop/drag-n-drop.comp.js";export{FilePreview}from"./components/forms/file/file-preview/file-preview.comp.js";export{FileImagePreview}from"./components/forms/file/file-image-preview/file-image-preview.comp.js";export{FilePreviewList}from"./components/forms/file/file-preview-list/file-preview-list.comp.js";export{FileImagePreviewList}from"./components/forms/file/file-image-preview-list/file-image-preview-list.comp.js";export{CustomInput,Input}from"./components/forms/input/input.comp.js";export{Select}from"./components/forms/select/select.comp.js";export{CustomSwitch,Switch}from"./components/forms/switch/switch.comp.js";export{CustomTextArea,TextArea}from"./components/forms/textarea/textarea.comp.js";export{SearchInput}from"./components/forms/search-input/search-input.comp.js";export{RadioGroup}from"./components/forms/radio-group/radio-group.comp.js";export{Icon}from"./components/icons/icon/icon.comp.js";export{LUCIDE_PREFIX,allIconsOptions,customIconsOptions,isLucideName,parseIconNameToLucide,parseIconNameToRemixIcon}from"./components/icons/icon/icon.utils.js";export{IconBox}from"./components/icons/icon-box/icon-box.comp.js";export{Image}from"./components/images/image/image.comp.js";export{Avatar}from"./components/images/avatar/avatar.comp.js";export{Accordion}from"./components/layout/accordion/accordion.comp.js";export{Box,CustomBox}from"./components/layout/box/box.comp.js";export{Modal}from"./components/layout/modal/modal.comp.js";export{Timeline}from"./components/layout/timeline/timeline.comp.js";export{TreeView,Treeview}from"./components/layout/treeview/treeview.comp.js";export{Popover}from"./components/layout/popover/popover.comp.js";export{Table}from"./components/layout/table/table.comp.js";export{Carousel,Slider}from"./components/layout/slider/slider.comp.js";export{Drawer}from"./components/layout/drawer/drawer.comp.js";export{Card}from"./components/layout/card/card.comp.js";export{TitleCard}from"./components/layout/title-card/title-card.comp.js";export{StatCard}from"./components/layout/stat-card/stat-card.comp.js";export{Divider}from"./components/layout/divider/divider.comp.js";export{Pagination}from"./components/navigation/pagination/pagination.comp.js";export{Tabs}from"./components/navigation/tabs/tabs.comp.js";export{TextLink}from"./components/navigation/text-link/text-link.comp.js";export{TablePagination}from"./components/navigation/table-pagination/table-pagination.comp.js";export{Breadcrumb}from"./components/navigation/breadcrumb/breadcrumb.comp.js";export{ActionMenu}from"./components/navigation/action-menu/action-menu.comp.js";export{Stepper}from"./components/navigation/stepper/stepper.comp.js";export{ViewToggle}from"./components/navigation/view-toggle/view-toggle.comp.js";export{NavigationCard}from"./components/navigation/navigation-card/navigation-card.comp.js";export{NavigationCards}from"./components/navigation/navigation-card/navigation-cards.comp.js";export{NavigationSections}from"./components/navigation/navigation-sections/navigation-sections.comp.js";export{Text}from"./components/typography/text/text.comp.js";export{useBreakpoint,useIsMobile,useIsTablet,useMediaQuery}from"./hooks/use-breakpoint.js";export{tokens}from"./theme/generated/tokens.js";export{createTheme}from"./theme/create-theme.js";export{CHART_COLOR_ORDER,CHART_OTHER_COLOR,getChartColors}from"./theme/chart-colors.js";export{SUPPORTED_CLIENT_FONTS,createClientTheme,getClientThemeIssues}from"./theme/client-theme.js";export{defaultTheme,legacyTheme}from"./theme/default-theme.js";export{GlobalStyle}from"./theme/global-styles.js";export{gradientBorder}from"./theme/gradient-border.js";export{breakpointValues,media}from"./theme/media.js";export{thinScrollbar,thinScrollbarOnHover}from"./theme/scrollbar.js";export{ThemeProvider}from"./theme/theme-provider.js";export{adjustColorBrightness,getContrastRatio,getLuminance,getReadableTextColor,getThemeColor,getThemeContrastColor,getThemeSize,getThemeSpacing,mixColors}from"./theme/theme.util.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import{keyframes as o,css as r}from"styled-components";const e=o`
|
|
2
|
+
to {
|
|
3
|
+
transform: translate(-50%, -50%) rotate(360deg);
|
|
4
|
+
}
|
|
5
|
+
`,t=({animated:o,width:t,radius:n,theme:a})=>{const i=a;return o?r`
|
|
6
|
+
position: relative;
|
|
7
|
+
isolation: isolate;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
border: none;
|
|
10
|
+
background: transparent;
|
|
11
|
+
|
|
12
|
+
&::before {
|
|
13
|
+
content: '';
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 50%;
|
|
16
|
+
left: 50%;
|
|
17
|
+
z-index: -2;
|
|
18
|
+
width: max(250%, 1200px);
|
|
19
|
+
aspect-ratio: 1;
|
|
20
|
+
background: conic-gradient(
|
|
21
|
+
${i.colors.primary},
|
|
22
|
+
${i.colors.secondary},
|
|
23
|
+
${i.colors.primary}
|
|
24
|
+
);
|
|
25
|
+
transform: translate(-50%, -50%);
|
|
26
|
+
animation: ${e} 4s linear infinite;
|
|
27
|
+
will-change: transform;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&::after {
|
|
31
|
+
content: '';
|
|
32
|
+
position: absolute;
|
|
33
|
+
inset: ${t}px;
|
|
34
|
+
z-index: -1;
|
|
35
|
+
border-radius: max(0px, calc(${n} - ${t}px));
|
|
36
|
+
background: ${i.colors.white};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@media (prefers-reduced-motion: reduce) {
|
|
40
|
+
&::before {
|
|
41
|
+
animation: none;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`:r`
|
|
45
|
+
border: ${t}px solid transparent;
|
|
46
|
+
background:
|
|
47
|
+
linear-gradient(${i.colors.white}, ${i.colors.white})
|
|
48
|
+
padding-box,
|
|
49
|
+
${i.colors.brand.gradient} border-box;
|
|
50
|
+
`};export{t as gradientBorder};
|
|
51
|
+
//# sourceMappingURL=gradient-border.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient-border.js","sources":["../../../src/theme/gradient-border.ts"],"sourcesContent":["import { css, DefaultTheme, keyframes } from 'styled-components'\n\nimport type { ThemeProps } from './theme.types'\n\nconst spin = keyframes`\n to {\n transform: translate(-50%, -50%) rotate(360deg);\n }\n`\n\n/** Opções da borda no gradiente da marca. */\nexport interface GradientBorderOptions {\n /** Gira as cores da marca devagar. Quem pediu menos movimento no sistema vê a borda parada. */\n animated?: boolean\n /** Grossura da borda em px. */\n width: number\n /** Raio externo da peça (ex. `'12px'`, `'9999px'`), para arredondar o fundo de dentro. */\n radius: string\n /** Tema do styled-components (o `theme` das props do styled). */\n theme: DefaultTheme | ThemeProps\n}\n\n/**\n * 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`.\n * A animada gira só uma camada com `transform`, sem repintar o conteúdo.\n * @example\n * const Box = styled.div`\n * ${({ theme }) => gradientBorder({ animated: true, width: 2, radius: theme.radius.full, theme })}\n * `\n */\nexport const gradientBorder = ({\n animated,\n width,\n radius,\n theme: styledTheme,\n}: GradientBorderOptions) => {\n const theme = styledTheme as ThemeProps\n return animated\n ? css`\n position: relative;\n isolation: isolate;\n overflow: hidden;\n border: none;\n background: transparent;\n\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: -2;\n width: max(250%, 1200px);\n aspect-ratio: 1;\n background: conic-gradient(\n ${theme.colors.primary},\n ${theme.colors.secondary},\n ${theme.colors.primary}\n );\n transform: translate(-50%, -50%);\n animation: ${spin} 4s linear infinite;\n will-change: transform;\n }\n\n &::after {\n content: '';\n position: absolute;\n inset: ${width}px;\n z-index: -1;\n border-radius: max(0px, calc(${radius} - ${width}px));\n background: ${theme.colors.white};\n }\n\n @media (prefers-reduced-motion: reduce) {\n &::before {\n animation: none;\n }\n }\n `\n : css`\n border: ${width}px solid transparent;\n background:\n linear-gradient(${theme.colors.white}, ${theme.colors.white})\n padding-box,\n ${theme.colors.brand.gradient} border-box;\n `\n}\n"],"names":["spin","keyframes","gradientBorder","animated","width","radius","theme","styledTheme","css","colors","primary","secondary","white","brand","gradient"],"mappings":"uDAIA,MAAMA,EAAOC,CAAS;;;;EA2BTC,EAAiBA,EAC5BC,WACAC,QACAC,SACAC,MAAOC,MAEP,MAAMD,EAAQC,EACd,OAAOJ,EACHK,CAAG;;;;;;;;;;;;;;;;cAgBKF,EAAMG,OAAOC;cACbJ,EAAMG,OAAOE;cACbL,EAAMG,OAAOC;;;uBAGJV;;;;;;;mBAOJI;;yCAEsBC,OAAYD;wBAC7BE,EAAMG,OAAOG;;;;;;;;QAS/BJ,CAAG;kBACSJ;;4BAEUE,EAAMG,OAAOG,UAAUN,EAAMG,OAAOG;;YAEpDN,EAAMG,OAAOI,MAAMC;OACxB"}
|