@apipass/design-system 7.4.2 → 7.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../chart-label-color.cjs"),x={top:16,right:16,bottom:16,left:16},L={vertical:140,horizontal:200},p=48,A="total",s=100,T=new Intl.NumberFormat(void 0,{style:"percent",maximumFractionDigits:1});function _(e){return T.format(e/s)}function w(e){return e.stacking==="percent"?_:e.valueFormatter}function c(e){const o=w(e);if(o)return t=>t===null?"":o(t)}function O(e,o){const t=new Map(e.points.map(r=>[r.category,r.value]));return o.map(r=>t.get(r)??null)}function S(e,o){const t=Array.from({length:o},(r,n)=>e.reduce((l,a)=>l+(a[n]??0),0));return e.map(r=>r.map((n,l)=>{const a=t[l];return n===null||a===0?null:n/a*s}))}function h(e){return e.stacking!=="off"?"inside":e.orientation==="horizontal"?"right":"top"}function P(e){return e.labelRect.width<=e.rect.width&&e.labelRect.height<=e.rect.height}function F(e){const o=e.valueLabel==="auto";return!o||h(e)!=="inside"?{hideOverlap:o}:t=>({hideOverlap:o,fontSize:P(t)?void 0:0})}function V(e,o){const t=h(e),r=c(e);return{show:e.valueLabel!=="never",position:t,color:t==="inside"?v.labelColorOnFill(o):e.theme.labelColor,formatter:r?n=>r(n.value):void 0}}function k(e){const{categories:o,theme:t,orientation:r}=e;return{type:"category",data:o,inverse:r==="horizontal",axisLine:{lineStyle:{color:t.axisLineColor}},axisTick:{show:!1},axisLabel:{color:t.labelColor,hideOverlap:!0,width:L[r],overflow:"truncate"},splitLine:{show:!1}}}function B(e){const{valueAxis:o,stacking:t,theme:r}=e,n=t==="percent",l=c(e);return{type:o.scale==="log"?"log":"value",scale:!n&&o.includeZero===!1,min:n?0:o.min,max:n?s:o.max,axisLine:{show:!1},axisLabel:{color:r.labelColor,formatter:l},splitLine:{lineStyle:{color:r.splitLineColor}}}}function E(e){const{categories:o,series:t,orientation:r,stacking:n,theme:l}=e,a=r==="horizontal",b=c(e),u=t.map(i=>O(i,o)),C=n==="percent"?S(u,o.length):u,y=F(e),f=k(e),m=B(e);return{animation:!1,color:l.seriesColors,textStyle:{fontFamily:l.fontFamily,color:l.labelColor},grid:{...x,containLabel:!0},tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:l.tooltipBackgroundColor,borderColor:l.tooltipBorderColor,textStyle:{color:l.labelColor},valueFormatter:b},xAxis:a?m:f,yAxis:a?f:m,series:t.map((i,g)=>{const d=e.seriesColorOverrides[i.id]??l.seriesColors[g%l.seriesColors.length];return{id:i.id,name:i.name,type:"bar",stack:n==="off"?void 0:A,barMaxWidth:p,data:C[g],itemStyle:{color:d},label:V(e,d),labelLayout:y}})}}exports.buildBarChartOption=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../chart-label-color.cjs"),x={top:16,right:16,bottom:16,left:16},L={vertical:140,horizontal:200},p=48,A="total",s=100,T=new Intl.NumberFormat(void 0,{style:"percent",maximumFractionDigits:1});function _(e){return T.format(e/s)}function w(e){return e.stacking==="percent"?_:e.valueFormatter}function c(e){const o=w(e);if(o)return t=>t==null?"":o(t)}function O(e,o){const t=new Map(e.points.map(r=>[r.category,r.value]));return o.map(r=>t.get(r)??null)}function S(e,o){const t=Array.from({length:o},(r,n)=>e.reduce((l,a)=>l+(a[n]??0),0));return e.map(r=>r.map((n,l)=>{const a=t[l];return n===null||a===0?null:n/a*s}))}function h(e){return e.stacking!=="off"?"inside":e.orientation==="horizontal"?"right":"top"}function P(e){return e.labelRect.width<=e.rect.width&&e.labelRect.height<=e.rect.height}function F(e){const o=e.valueLabel==="auto";return!o||h(e)!=="inside"?{hideOverlap:o}:t=>({hideOverlap:o,fontSize:P(t)?void 0:0})}function V(e,o){const t=h(e),r=c(e);return{show:e.valueLabel!=="never",position:t,color:t==="inside"?v.labelColorOnFill(o):e.theme.labelColor,formatter:r?n=>r(n.value):void 0}}function k(e){const{categories:o,theme:t,orientation:r}=e;return{type:"category",data:o,inverse:r==="horizontal",axisLine:{lineStyle:{color:t.axisLineColor}},axisTick:{show:!1},axisLabel:{color:t.labelColor,hideOverlap:!0,width:L[r],overflow:"truncate"},splitLine:{show:!1}}}function B(e){const{valueAxis:o,stacking:t,theme:r}=e,n=t==="percent",l=c(e);return{type:o.scale==="log"?"log":"value",scale:!n&&o.includeZero===!1,min:n?0:o.min,max:n?s:o.max,axisLine:{show:!1},axisLabel:{color:r.labelColor,formatter:l},splitLine:{lineStyle:{color:r.splitLineColor}}}}function E(e){const{categories:o,series:t,orientation:r,stacking:n,theme:l}=e,a=r==="horizontal",b=c(e),u=t.map(i=>O(i,o)),C=n==="percent"?S(u,o.length):u,y=F(e),f=k(e),m=B(e);return{animation:!1,color:l.seriesColors,textStyle:{fontFamily:l.fontFamily,color:l.labelColor},grid:{...x,containLabel:!0},tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:l.tooltipBackgroundColor,borderColor:l.tooltipBorderColor,textStyle:{color:l.labelColor},valueFormatter:b},xAxis:a?m:f,yAxis:a?f:m,series:t.map((i,g)=>{const d=e.seriesColorOverrides[i.id]??l.seriesColors[g%l.seriesColors.length];return{id:i.id,name:i.name,type:"bar",stack:n==="off"?void 0:A,barMaxWidth:p,data:C[g],itemStyle:{color:d},label:V(e,d),labelLayout:y}})}}exports.buildBarChartOption=E;
2
2
  //# sourceMappingURL=bar-chart-option.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"bar-chart-option.cjs","sources":["../../../../../../src/ui/components/charts/BarChart/bar-chart-option.ts"],"sourcesContent":["import { labelColorOnFill } from \"../chart-label-color\";\nimport type { ChartTheme } from \"../chart-theme\";\n\nexport interface BarChartPoint {\n category: string;\n value: number | null;\n}\n\nexport interface BarChartSeriesData {\n id: string;\n name: string;\n points: BarChartPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type BarChartOrientation = \"vertical\" | \"horizontal\";\n\nexport type BarChartStacking = \"off\" | \"stacked\" | \"percent\";\n\nexport type BarChartValueLabel = \"auto\" | \"always\" | \"never\";\n\nexport type BarChartLegendMode = \"inline\" | \"none\";\n\nexport type BarChartAxisScale = \"linear\" | \"log\";\n\nexport interface BarChartValueAxisOptions {\n scale?: BarChartAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface BarChartOptionInput {\n categories: string[];\n series: BarChartSeriesData[];\n orientation: BarChartOrientation;\n stacking: BarChartStacking;\n valueLabel: BarChartValueLabel;\n valueAxis: BarChartValueAxisOptions;\n theme: ChartTheme;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\n// A legenda saiu do canvas e virou HTML (`ChartLegend`), entao a grade nao reserva mais faixa\n// para ela: quem divide a altura agora e o flex do componente.\nconst GRID_PADDING = { top: 16, right: 16, bottom: 16, left: 16 } as const;\n\n// Na horizontal o rótulo da categoria disputa largura com a própria barra; na vertical ele fica\n// sob a barra e uma faixa mais estreita já dá conta.\nconst CATEGORY_LABEL_MAX_WIDTH_PX: Record<BarChartOrientation, number> = {\n vertical: 140,\n horizontal: 200,\n};\n\nconst BAR_MAX_WIDTH_PX: number = 48;\n\nconst STACK_ID: string = \"total\";\n\nconst PERCENT_SCALE: number = 100;\n\nconst PERCENT_LABEL: Intl.NumberFormat = new Intl.NumberFormat(undefined, {\n style: \"percent\",\n maximumFractionDigits: 1,\n});\n\nfunction formatPercent(value: number): string {\n return PERCENT_LABEL.format(value / PERCENT_SCALE);\n}\n\n// Em `percent` o valor desenhado é a participação na categoria, e não mais o dado do consumidor:\n// aplicar ali o formatador dele escreveria \"31 ms\" numa barra que vale 31%.\nfunction resolveValueFormatter(input: BarChartOptionInput): ((value: number) => string) | undefined {\n return input.stacking === \"percent\" ? formatPercent : input.valueFormatter;\n}\n\n// Categoria sem valor chega ao formatter como `null` — o ECharts formata o vazio junto com o\n// resto. O tipo público promete `number` ao consumidor, e é esta guarda que mantém a promessa.\nfunction nullSafeValueFormatter(\n input: BarChartOptionInput,\n): ((value: number | null) => string) | undefined {\n const formatValue: ((value: number) => string) | undefined = resolveValueFormatter(input);\n if (!formatValue) return undefined;\n return (value: number | null) => (value === null ? \"\" : formatValue(value));\n}\n\nfunction alignValuesToCategories(\n data: BarChartSeriesData,\n categories: string[],\n): Array<number | null> {\n const valueByCategory: Map<string, number | null> = new Map(\n data.points.map((point: BarChartPoint) => [point.category, point.value]),\n );\n return categories.map((category: string) => valueByCategory.get(category) ?? null);\n}\n\nfunction toShareOfCategoryTotal(\n valuesBySeries: Array<Array<number | null>>,\n categoryCount: number,\n): Array<Array<number | null>> {\n const categoryTotals: number[] = Array.from(\n { length: categoryCount },\n (_unused, categoryIndex: number) =>\n valuesBySeries.reduce(\n (total: number, values: Array<number | null>) => total + (values[categoryIndex] ?? 0),\n 0,\n ),\n );\n return valuesBySeries.map((values: Array<number | null>) =>\n values.map((value: number | null, categoryIndex: number) => {\n const categoryTotal: number = categoryTotals[categoryIndex];\n if (value === null || categoryTotal === 0) return null;\n return (value / categoryTotal) * PERCENT_SCALE;\n }),\n );\n}\n\nfunction labelPosition(input: BarChartOptionInput): string {\n if (input.stacking !== \"off\") return \"inside\";\n return input.orientation === \"horizontal\" ? \"right\" : \"top\";\n}\n\ninterface LabelLayoutParams {\n rect: { width: number; height: number };\n labelRect: { width: number; height: number };\n}\n\ninterface LabelLayout {\n hideOverlap: boolean;\n fontSize?: number;\n}\n\ntype SeriesLabelLayout = LabelLayout | ((params: LabelLayoutParams) => LabelLayout);\n\nfunction fitsInsideBar(params: LabelLayoutParams): boolean {\n return (\n params.labelRect.width <= params.rect.width && params.labelRect.height <= params.rect.height\n );\n}\n\n// `hideOverlap` resolve rótulo que encosta em rótulo, mas não rótulo maior que a própria fatia:\n// numa barra empilhada o ECharts desenha o número por cima das fatias vizinhas. `fontSize: 0` é\n// o que o `labelLayout` oferece para sumir com um rótulo caso a caso.\nfunction seriesLabelLayout(input: BarChartOptionInput): SeriesLabelLayout {\n const hideOverlap: boolean = input.valueLabel === \"auto\";\n if (!hideOverlap || labelPosition(input) !== \"inside\") return { hideOverlap };\n return (params: LabelLayoutParams) => ({\n hideOverlap,\n fontSize: fitsInsideBar(params) ? undefined : 0,\n });\n}\n\nfunction seriesLabel(input: BarChartOptionInput, fillColor: string): Record<string, unknown> {\n const position: string = labelPosition(input);\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n return {\n show: input.valueLabel !== \"never\",\n position,\n color: position === \"inside\" ? labelColorOnFill(fillColor) : input.theme.labelColor,\n formatter: formatValue\n ? (params: { value: number | null }) => formatValue(params.value)\n : undefined,\n };\n}\n\nfunction categoryAxis(input: BarChartOptionInput): Record<string, unknown> {\n const { categories, theme, orientation } = input;\n return {\n type: \"category\",\n data: categories,\n // Na horizontal o ECharts empilha a categoria de baixo para cima, invertendo a ordem que o\n // app escolheu ao ordenar as barras.\n inverse: orientation === \"horizontal\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: {\n color: theme.labelColor,\n hideOverlap: true,\n width: CATEGORY_LABEL_MAX_WIDTH_PX[orientation],\n overflow: \"truncate\",\n },\n splitLine: { show: false },\n };\n}\n\nfunction valueAxis(input: BarChartOptionInput): Record<string, unknown> {\n const { valueAxis: options, stacking, theme } = input;\n const isPercent: boolean = stacking === \"percent\";\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n return {\n type: options.scale === \"log\" ? \"log\" : \"value\",\n // Barra mede por comprimento: eixo cortado mente sobre a proporção entre as barras, então\n // aqui o zero entra por padrão — ao contrário da série temporal, que só mostra variação.\n scale: !isPercent && options.includeZero === false,\n min: isPercent ? 0 : options.min,\n max: isPercent ? PERCENT_SCALE : options.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildBarChartOption(input: BarChartOptionInput): Record<string, unknown> {\n const { categories, series, orientation, stacking, theme } = input;\n const isHorizontal: boolean = orientation === \"horizontal\";\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n\n const alignedValues: Array<Array<number | null>> = series.map((data: BarChartSeriesData) =>\n alignValuesToCategories(data, categories),\n );\n // O ECharts não tem empilhamento 100%: a participação precisa chegar calculada no dado.\n const plottedValues: Array<Array<number | null>> =\n stacking === \"percent\"\n ? toShareOfCategoryTotal(alignedValues, categories.length)\n : alignedValues;\n\n const labelLayout: SeriesLabelLayout = seriesLabelLayout(input);\n const categoryAxisOption: Record<string, unknown> = categoryAxis(input);\n const valueAxisOption: Record<string, unknown> = valueAxis(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING,\n containLabel: true,\n },\n tooltip: {\n trigger: \"axis\",\n axisPointer: { type: \"shadow\" },\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: isHorizontal ? valueAxisOption : categoryAxisOption,\n yAxis: isHorizontal ? categoryAxisOption : valueAxisOption,\n series: series.map((data: BarChartSeriesData, index: number) => {\n const fillColor: string =\n input.seriesColorOverrides[data.id] ??\n theme.seriesColors[index % theme.seriesColors.length];\n return {\n id: data.id,\n name: data.name,\n type: \"bar\",\n stack: stacking === \"off\" ? undefined : STACK_ID,\n barMaxWidth: BAR_MAX_WIDTH_PX,\n data: plottedValues[index],\n itemStyle: { color: fillColor },\n label: seriesLabel(input, fillColor),\n labelLayout,\n };\n }),\n };\n}\n"],"names":["GRID_PADDING","CATEGORY_LABEL_MAX_WIDTH_PX","BAR_MAX_WIDTH_PX","STACK_ID","PERCENT_SCALE","PERCENT_LABEL","formatPercent","value","resolveValueFormatter","input","nullSafeValueFormatter","formatValue","alignValuesToCategories","data","categories","valueByCategory","point","category","toShareOfCategoryTotal","valuesBySeries","categoryCount","categoryTotals","_unused","categoryIndex","total","values","categoryTotal","labelPosition","fitsInsideBar","params","seriesLabelLayout","hideOverlap","seriesLabel","fillColor","position","labelColorOnFill","categoryAxis","theme","orientation","valueAxis","options","stacking","isPercent","buildBarChartOption","series","isHorizontal","alignedValues","plottedValues","labelLayout","categoryAxisOption","valueAxisOption","index"],"mappings":"4HAgDMA,EAAe,CAAE,IAAK,GAAI,MAAO,GAAI,OAAQ,GAAI,KAAM,EAAA,EAIvDC,EAAmE,CACvE,SAAU,IACV,WAAY,GACd,EAEMC,EAA2B,GAE3BC,EAAmB,QAEnBC,EAAwB,IAExBC,EAAmC,IAAI,KAAK,aAAa,OAAW,CACxE,MAAO,UACP,sBAAuB,CACzB,CAAC,EAED,SAASC,EAAcC,EAAuB,CAC5C,OAAOF,EAAc,OAAOE,EAAQH,CAAa,CACnD,CAIA,SAASI,EAAsBC,EAAqE,CAClG,OAAOA,EAAM,WAAa,UAAYH,EAAgBG,EAAM,cAC9D,CAIA,SAASC,EACPD,EACgD,CAChD,MAAME,EAAuDH,EAAsBC,CAAK,EACxF,GAAKE,EACL,OAAQJ,GAA0BA,IAAU,KAAO,GAAKI,EAAYJ,CAAK,CAC3E,CAEA,SAASK,EACPC,EACAC,EACsB,CACtB,MAAMC,EAA8C,IAAI,IACtDF,EAAK,OAAO,IAAKG,GAAyB,CAACA,EAAM,SAAUA,EAAM,KAAK,CAAC,CAAA,EAEzE,OAAOF,EAAW,IAAKG,GAAqBF,EAAgB,IAAIE,CAAQ,GAAK,IAAI,CACnF,CAEA,SAASC,EACPC,EACAC,EAC6B,CAC7B,MAAMC,EAA2B,MAAM,KACrC,CAAE,OAAQD,CAAA,EACV,CAACE,EAASC,IACRJ,EAAe,OACb,CAACK,EAAeC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AAOA,EAAM,UAAA,EAC1B,eAAgB1B,CAAA,EAElB,MAAOkC,EAAeK,EAAkBD,EACxC,MAAOJ,EAAeI,EAAqBC,EAC3C,OAAQN,EAAO,IAAI,CAAC/B,EAA0BsC,IAAkB,CAC9D,MAAMlB,EACJxB,EAAM,qBAAqBI,EAAK,EAAE,GAClCwB,EAAM,aAAac,EAAQd,EAAM,aAAa,MAAM,EACtD,MAAO,CACL,GAAIxB,EAAK,GACT,KAAMA,EAAK,KACX,KAAM,MACN,MAAO4B,IAAa,MAAQ,OAAYtC,EACxC,YAAaD,EACb,KAAM6C,EAAcI,CAAK,EACzB,UAAW,CAAE,MAAOlB,CAAA,EACpB,MAAOD,EAAYvB,EAAOwB,CAAS,EACnC,YAAAe,CAAA,CAEJ,CAAC,CAAA,CAEL"}
1
+ {"version":3,"file":"bar-chart-option.cjs","sources":["../../../../../../src/ui/components/charts/BarChart/bar-chart-option.ts"],"sourcesContent":["import { labelColorOnFill } from \"../chart-label-color\";\nimport type { ChartTheme } from \"../chart-theme\";\n\nexport interface BarChartPoint {\n category: string;\n value: number | null;\n}\n\nexport interface BarChartSeriesData {\n id: string;\n name: string;\n points: BarChartPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type BarChartOrientation = \"vertical\" | \"horizontal\";\n\nexport type BarChartStacking = \"off\" | \"stacked\" | \"percent\";\n\nexport type BarChartValueLabel = \"auto\" | \"always\" | \"never\";\n\nexport type BarChartLegendMode = \"inline\" | \"none\";\n\nexport type BarChartAxisScale = \"linear\" | \"log\";\n\nexport interface BarChartValueAxisOptions {\n scale?: BarChartAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface BarChartOptionInput {\n categories: string[];\n series: BarChartSeriesData[];\n orientation: BarChartOrientation;\n stacking: BarChartStacking;\n valueLabel: BarChartValueLabel;\n valueAxis: BarChartValueAxisOptions;\n theme: ChartTheme;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\n// A legenda saiu do canvas e virou HTML (`ChartLegend`), entao a grade nao reserva mais faixa\n// para ela: quem divide a altura agora e o flex do componente.\nconst GRID_PADDING = { top: 16, right: 16, bottom: 16, left: 16 } as const;\n\n// Na horizontal o rótulo da categoria disputa largura com a própria barra; na vertical ele fica\n// sob a barra e uma faixa mais estreita já dá conta.\nconst CATEGORY_LABEL_MAX_WIDTH_PX: Record<BarChartOrientation, number> = {\n vertical: 140,\n horizontal: 200,\n};\n\nconst BAR_MAX_WIDTH_PX: number = 48;\n\nconst STACK_ID: string = \"total\";\n\nconst PERCENT_SCALE: number = 100;\n\nconst PERCENT_LABEL: Intl.NumberFormat = new Intl.NumberFormat(undefined, {\n style: \"percent\",\n maximumFractionDigits: 1,\n});\n\nfunction formatPercent(value: number): string {\n return PERCENT_LABEL.format(value / PERCENT_SCALE);\n}\n\n// Em `percent` o valor desenhado é a participação na categoria, e não mais o dado do consumidor:\n// aplicar ali o formatador dele escreveria \"31 ms\" numa barra que vale 31%.\nfunction resolveValueFormatter(input: BarChartOptionInput): ((value: number) => string) | undefined {\n return input.stacking === \"percent\" ? formatPercent : input.valueFormatter;\n}\n\n// Categoria sem valor chega ao formatter como `null` nos rótulos e como `undefined` no tooltip — o\n// ECharts formata o vazio junto com o resto. O tipo público promete `number` ao consumidor, e é\n// esta guarda que mantém a promessa. Deixar o `undefined` passar derruba o formatter dentro do\n// ECharts, que fica com a flag de processamento presa e ignora todo `resize()` seguinte.\nfunction nullSafeValueFormatter(\n input: BarChartOptionInput,\n): ((value: number | null | undefined) => string) | undefined {\n const formatValue: ((value: number) => string) | undefined = resolveValueFormatter(input);\n if (!formatValue) return undefined;\n return (value: number | null | undefined) => (value == null ? \"\" : formatValue(value));\n}\n\nfunction alignValuesToCategories(\n data: BarChartSeriesData,\n categories: string[],\n): Array<number | null> {\n const valueByCategory: Map<string, number | null> = new Map(\n data.points.map((point: BarChartPoint) => [point.category, point.value]),\n );\n return categories.map((category: string) => valueByCategory.get(category) ?? null);\n}\n\nfunction toShareOfCategoryTotal(\n valuesBySeries: Array<Array<number | null>>,\n categoryCount: number,\n): Array<Array<number | null>> {\n const categoryTotals: number[] = Array.from(\n { length: categoryCount },\n (_unused, categoryIndex: number) =>\n valuesBySeries.reduce(\n (total: number, values: Array<number | null>) => total + (values[categoryIndex] ?? 0),\n 0,\n ),\n );\n return valuesBySeries.map((values: Array<number | null>) =>\n values.map((value: number | null, categoryIndex: number) => {\n const categoryTotal: number = categoryTotals[categoryIndex];\n if (value === null || categoryTotal === 0) return null;\n return (value / categoryTotal) * PERCENT_SCALE;\n }),\n );\n}\n\nfunction labelPosition(input: BarChartOptionInput): string {\n if (input.stacking !== \"off\") return \"inside\";\n return input.orientation === \"horizontal\" ? \"right\" : \"top\";\n}\n\ninterface LabelLayoutParams {\n rect: { width: number; height: number };\n labelRect: { width: number; height: number };\n}\n\ninterface LabelLayout {\n hideOverlap: boolean;\n fontSize?: number;\n}\n\ntype SeriesLabelLayout = LabelLayout | ((params: LabelLayoutParams) => LabelLayout);\n\nfunction fitsInsideBar(params: LabelLayoutParams): boolean {\n return (\n params.labelRect.width <= params.rect.width && params.labelRect.height <= params.rect.height\n );\n}\n\n// `hideOverlap` resolve rótulo que encosta em rótulo, mas não rótulo maior que a própria fatia:\n// numa barra empilhada o ECharts desenha o número por cima das fatias vizinhas. `fontSize: 0` é\n// o que o `labelLayout` oferece para sumir com um rótulo caso a caso.\nfunction seriesLabelLayout(input: BarChartOptionInput): SeriesLabelLayout {\n const hideOverlap: boolean = input.valueLabel === \"auto\";\n if (!hideOverlap || labelPosition(input) !== \"inside\") return { hideOverlap };\n return (params: LabelLayoutParams) => ({\n hideOverlap,\n fontSize: fitsInsideBar(params) ? undefined : 0,\n });\n}\n\nfunction seriesLabel(input: BarChartOptionInput, fillColor: string): Record<string, unknown> {\n const position: string = labelPosition(input);\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n return {\n show: input.valueLabel !== \"never\",\n position,\n color: position === \"inside\" ? labelColorOnFill(fillColor) : input.theme.labelColor,\n formatter: formatValue\n ? (params: { value: number | null }) => formatValue(params.value)\n : undefined,\n };\n}\n\nfunction categoryAxis(input: BarChartOptionInput): Record<string, unknown> {\n const { categories, theme, orientation } = input;\n return {\n type: \"category\",\n data: categories,\n // Na horizontal o ECharts empilha a categoria de baixo para cima, invertendo a ordem que o\n // app escolheu ao ordenar as barras.\n inverse: orientation === \"horizontal\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: {\n color: theme.labelColor,\n hideOverlap: true,\n width: CATEGORY_LABEL_MAX_WIDTH_PX[orientation],\n overflow: \"truncate\",\n },\n splitLine: { show: false },\n };\n}\n\nfunction valueAxis(input: BarChartOptionInput): Record<string, unknown> {\n const { valueAxis: options, stacking, theme } = input;\n const isPercent: boolean = stacking === \"percent\";\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n return {\n type: options.scale === \"log\" ? \"log\" : \"value\",\n // Barra mede por comprimento: eixo cortado mente sobre a proporção entre as barras, então\n // aqui o zero entra por padrão — ao contrário da série temporal, que só mostra variação.\n scale: !isPercent && options.includeZero === false,\n min: isPercent ? 0 : options.min,\n max: isPercent ? PERCENT_SCALE : options.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildBarChartOption(input: BarChartOptionInput): Record<string, unknown> {\n const { categories, series, orientation, stacking, theme } = input;\n const isHorizontal: boolean = orientation === \"horizontal\";\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n\n const alignedValues: Array<Array<number | null>> = series.map((data: BarChartSeriesData) =>\n alignValuesToCategories(data, categories),\n );\n // O ECharts não tem empilhamento 100%: a participação precisa chegar calculada no dado.\n const plottedValues: Array<Array<number | null>> =\n stacking === \"percent\"\n ? toShareOfCategoryTotal(alignedValues, categories.length)\n : alignedValues;\n\n const labelLayout: SeriesLabelLayout = seriesLabelLayout(input);\n const categoryAxisOption: Record<string, unknown> = categoryAxis(input);\n const valueAxisOption: Record<string, unknown> = valueAxis(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING,\n containLabel: true,\n },\n tooltip: {\n trigger: \"axis\",\n axisPointer: { type: \"shadow\" },\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: isHorizontal ? valueAxisOption : categoryAxisOption,\n yAxis: isHorizontal ? categoryAxisOption : valueAxisOption,\n series: series.map((data: BarChartSeriesData, index: number) => {\n const fillColor: string =\n input.seriesColorOverrides[data.id] ??\n theme.seriesColors[index % theme.seriesColors.length];\n return {\n id: data.id,\n name: data.name,\n type: \"bar\",\n stack: stacking === \"off\" ? undefined : STACK_ID,\n barMaxWidth: BAR_MAX_WIDTH_PX,\n data: plottedValues[index],\n itemStyle: { color: fillColor },\n label: seriesLabel(input, fillColor),\n labelLayout,\n };\n }),\n };\n}\n"],"names":["GRID_PADDING","CATEGORY_LABEL_MAX_WIDTH_PX","BAR_MAX_WIDTH_PX","STACK_ID","PERCENT_SCALE","PERCENT_LABEL","formatPercent","value","resolveValueFormatter","input","nullSafeValueFormatter","formatValue","alignValuesToCategories","data","categories","valueByCategory","point","category","toShareOfCategoryTotal","valuesBySeries","categoryCount","categoryTotals","_unused","categoryIndex","total","values","categoryTotal","labelPosition","fitsInsideBar","params","seriesLabelLayout","hideOverlap","seriesLabel","fillColor","position","labelColorOnFill","categoryAxis","theme","orientation","valueAxis","options","stacking","isPercent","buildBarChartOption","series","isHorizontal","alignedValues","plottedValues","labelLayout","categoryAxisOption","valueAxisOption","index"],"mappings":"4HAgDMA,EAAe,CAAE,IAAK,GAAI,MAAO,GAAI,OAAQ,GAAI,KAAM,EAAA,EAIvDC,EAAmE,CACvE,SAAU,IACV,WAAY,GACd,EAEMC,EAA2B,GAE3BC,EAAmB,QAEnBC,EAAwB,IAExBC,EAAmC,IAAI,KAAK,aAAa,OAAW,CACxE,MAAO,UACP,sBAAuB,CACzB,CAAC,EAED,SAASC,EAAcC,EAAuB,CAC5C,OAAOF,EAAc,OAAOE,EAAQH,CAAa,CACnD,CAIA,SAASI,EAAsBC,EAAqE,CAClG,OAAOA,EAAM,WAAa,UAAYH,EAAgBG,EAAM,cAC9D,CAMA,SAASC,EACPD,EAC4D,CAC5D,MAAME,EAAuDH,EAAsBC,CAAK,EACxF,GAAKE,EACL,OAAQJ,GAAsCA,GAAS,KAAO,GAAKI,EAAYJ,CAAK,CACtF,CAEA,SAASK,EACPC,EACAC,EACsB,CACtB,MAAMC,EAA8C,IAAI,IACtDF,EAAK,OAAO,IAAKG,GAAyB,CAACA,EAAM,SAAUA,EAAM,KAAK,CAAC,CAAA,EAEzE,OAAOF,EAAW,IAAKG,GAAqBF,EAAgB,IAAIE,CAAQ,GAAK,IAAI,CACnF,CAEA,SAASC,EACPC,EACAC,EAC6B,CAC7B,MAAMC,EAA2B,MAAM,KACrC,CAAE,OAAQD,CAAA,EACV,CAACE,EAASC,IACRJ,EAAe,OACb,CAACK,EAAeC,IAAiCD,GAASC,EAAOF,CAAa,GAAK,GACnF,CAAA,CACF,EAEJ,OAAOJ,EAAe,IAAKM,GACzBA,EAAO,IAAI,CAAClB,EAAsBgB,IAA0B,CAC1D,MAAMG,EAAwBL,EAAeE,CAAa,EAC1D,OAAIhB,IAAU,MAAQmB,IAAkB,EAAU,KAC1CnB,EAAQmB,EAAiBtB,CACnC,CAAC,CAAA,CAEL,CAEA,SAASuB,EAAclB,EAAoC,CACzD,OAAIA,EAAM,WAAa,M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AAO4B,IAAa,MAAQ,OAAYtC,EACxC,YAAaD,EACb,KAAM6C,EAAcI,CAAK,EACzB,UAAW,CAAE,MAAOlB,CAAA,EACpB,MAAOD,EAAYvB,EAAOwB,CAAS,EACnC,YAAAe,CAAA,CAEJ,CAAC,CAAA,CAEL"}
@@ -15,7 +15,7 @@ function T(o) {
15
15
  function c(o) {
16
16
  const e = T(o);
17
17
  if (e)
18
- return (t) => t === null ? "" : e(t);
18
+ return (t) => t == null ? "" : e(t);
19
19
  }
20
20
  function F(o, e) {
21
21
  const t = new Map(
@@ -1 +1 @@
1
- {"version":3,"file":"bar-chart-option.js","sources":["../../../../../../src/ui/components/charts/BarChart/bar-chart-option.ts"],"sourcesContent":["import { labelColorOnFill } from \"../chart-label-color\";\nimport type { ChartTheme } from \"../chart-theme\";\n\nexport interface BarChartPoint {\n category: string;\n value: number | null;\n}\n\nexport interface BarChartSeriesData {\n id: string;\n name: string;\n points: BarChartPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type BarChartOrientation = \"vertical\" | \"horizontal\";\n\nexport type BarChartStacking = \"off\" | \"stacked\" | \"percent\";\n\nexport type BarChartValueLabel = \"auto\" | \"always\" | \"never\";\n\nexport type BarChartLegendMode = \"inline\" | \"none\";\n\nexport type BarChartAxisScale = \"linear\" | \"log\";\n\nexport interface BarChartValueAxisOptions {\n scale?: BarChartAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface BarChartOptionInput {\n categories: string[];\n series: BarChartSeriesData[];\n orientation: BarChartOrientation;\n stacking: BarChartStacking;\n valueLabel: BarChartValueLabel;\n valueAxis: BarChartValueAxisOptions;\n theme: ChartTheme;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\n// A legenda saiu do canvas e virou HTML (`ChartLegend`), entao a grade nao reserva mais faixa\n// para ela: quem divide a altura agora e o flex do componente.\nconst GRID_PADDING = { top: 16, right: 16, bottom: 16, left: 16 } as const;\n\n// Na horizontal o rótulo da categoria disputa largura com a própria barra; na vertical ele fica\n// sob a barra e uma faixa mais estreita já dá conta.\nconst CATEGORY_LABEL_MAX_WIDTH_PX: Record<BarChartOrientation, number> = {\n vertical: 140,\n horizontal: 200,\n};\n\nconst BAR_MAX_WIDTH_PX: number = 48;\n\nconst STACK_ID: string = \"total\";\n\nconst PERCENT_SCALE: number = 100;\n\nconst PERCENT_LABEL: Intl.NumberFormat = new Intl.NumberFormat(undefined, {\n style: \"percent\",\n maximumFractionDigits: 1,\n});\n\nfunction formatPercent(value: number): string {\n return PERCENT_LABEL.format(value / PERCENT_SCALE);\n}\n\n// Em `percent` o valor desenhado é a participação na categoria, e não mais o dado do consumidor:\n// aplicar ali o formatador dele escreveria \"31 ms\" numa barra que vale 31%.\nfunction resolveValueFormatter(input: BarChartOptionInput): ((value: number) => string) | undefined {\n return input.stacking === \"percent\" ? formatPercent : input.valueFormatter;\n}\n\n// Categoria sem valor chega ao formatter como `null` — o ECharts formata o vazio junto com o\n// resto. O tipo público promete `number` ao consumidor, e é esta guarda que mantém a promessa.\nfunction nullSafeValueFormatter(\n input: BarChartOptionInput,\n): ((value: number | null) => string) | undefined {\n const formatValue: ((value: number) => string) | undefined = resolveValueFormatter(input);\n if (!formatValue) return undefined;\n return (value: number | null) => (value === null ? \"\" : formatValue(value));\n}\n\nfunction alignValuesToCategories(\n data: BarChartSeriesData,\n categories: string[],\n): Array<number | null> {\n const valueByCategory: Map<string, number | null> = new Map(\n data.points.map((point: BarChartPoint) => [point.category, point.value]),\n );\n return categories.map((category: string) => valueByCategory.get(category) ?? null);\n}\n\nfunction toShareOfCategoryTotal(\n valuesBySeries: Array<Array<number | null>>,\n categoryCount: number,\n): Array<Array<number | null>> {\n const categoryTotals: number[] = Array.from(\n { length: categoryCount },\n (_unused, categoryIndex: number) =>\n valuesBySeries.reduce(\n (total: number, values: Array<number | null>) => total + (values[categoryIndex] ?? 0),\n 0,\n ),\n );\n return valuesBySeries.map((values: Array<number | null>) =>\n values.map((value: number | null, categoryIndex: number) => {\n const categoryTotal: number = categoryTotals[categoryIndex];\n if (value === null || categoryTotal === 0) return null;\n return (value / categoryTotal) * PERCENT_SCALE;\n }),\n );\n}\n\nfunction labelPosition(input: BarChartOptionInput): string {\n if (input.stacking !== \"off\") return \"inside\";\n return input.orientation === \"horizontal\" ? \"right\" : \"top\";\n}\n\ninterface LabelLayoutParams {\n rect: { width: number; height: number };\n labelRect: { width: number; height: number };\n}\n\ninterface LabelLayout {\n hideOverlap: boolean;\n fontSize?: number;\n}\n\ntype SeriesLabelLayout = LabelLayout | ((params: LabelLayoutParams) => LabelLayout);\n\nfunction fitsInsideBar(params: LabelLayoutParams): boolean {\n return (\n params.labelRect.width <= params.rect.width && params.labelRect.height <= params.rect.height\n );\n}\n\n// `hideOverlap` resolve rótulo que encosta em rótulo, mas não rótulo maior que a própria fatia:\n// numa barra empilhada o ECharts desenha o número por cima das fatias vizinhas. `fontSize: 0` é\n// o que o `labelLayout` oferece para sumir com um rótulo caso a caso.\nfunction seriesLabelLayout(input: BarChartOptionInput): SeriesLabelLayout {\n const hideOverlap: boolean = input.valueLabel === \"auto\";\n if (!hideOverlap || labelPosition(input) !== \"inside\") return { hideOverlap };\n return (params: LabelLayoutParams) => ({\n hideOverlap,\n fontSize: fitsInsideBar(params) ? undefined : 0,\n });\n}\n\nfunction seriesLabel(input: BarChartOptionInput, fillColor: string): Record<string, unknown> {\n const position: string = labelPosition(input);\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n return {\n show: input.valueLabel !== \"never\",\n position,\n color: position === \"inside\" ? labelColorOnFill(fillColor) : input.theme.labelColor,\n formatter: formatValue\n ? (params: { value: number | null }) => formatValue(params.value)\n : undefined,\n };\n}\n\nfunction categoryAxis(input: BarChartOptionInput): Record<string, unknown> {\n const { categories, theme, orientation } = input;\n return {\n type: \"category\",\n data: categories,\n // Na horizontal o ECharts empilha a categoria de baixo para cima, invertendo a ordem que o\n // app escolheu ao ordenar as barras.\n inverse: orientation === \"horizontal\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: {\n color: theme.labelColor,\n hideOverlap: true,\n width: CATEGORY_LABEL_MAX_WIDTH_PX[orientation],\n overflow: \"truncate\",\n },\n splitLine: { show: false },\n };\n}\n\nfunction valueAxis(input: BarChartOptionInput): Record<string, unknown> {\n const { valueAxis: options, stacking, theme } = input;\n const isPercent: boolean = stacking === \"percent\";\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n return {\n type: options.scale === \"log\" ? \"log\" : \"value\",\n // Barra mede por comprimento: eixo cortado mente sobre a proporção entre as barras, então\n // aqui o zero entra por padrão — ao contrário da série temporal, que só mostra variação.\n scale: !isPercent && options.includeZero === false,\n min: isPercent ? 0 : options.min,\n max: isPercent ? PERCENT_SCALE : options.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildBarChartOption(input: BarChartOptionInput): Record<string, unknown> {\n const { categories, series, orientation, stacking, theme } = input;\n const isHorizontal: boolean = orientation === \"horizontal\";\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n\n const alignedValues: Array<Array<number | null>> = series.map((data: BarChartSeriesData) =>\n alignValuesToCategories(data, categories),\n );\n // O ECharts não tem empilhamento 100%: a participação precisa chegar calculada no dado.\n const plottedValues: Array<Array<number | null>> =\n stacking === \"percent\"\n ? toShareOfCategoryTotal(alignedValues, categories.length)\n : alignedValues;\n\n const labelLayout: SeriesLabelLayout = seriesLabelLayout(input);\n const categoryAxisOption: Record<string, unknown> = categoryAxis(input);\n const valueAxisOption: Record<string, unknown> = valueAxis(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING,\n containLabel: true,\n },\n tooltip: {\n trigger: \"axis\",\n axisPointer: { type: \"shadow\" },\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: isHorizontal ? valueAxisOption : categoryAxisOption,\n yAxis: isHorizontal ? categoryAxisOption : valueAxisOption,\n series: series.map((data: BarChartSeriesData, index: number) => {\n const fillColor: string =\n input.seriesColorOverrides[data.id] ??\n theme.seriesColors[index % theme.seriesColors.length];\n return {\n id: data.id,\n name: data.name,\n type: \"bar\",\n stack: stacking === \"off\" ? undefined : STACK_ID,\n barMaxWidth: BAR_MAX_WIDTH_PX,\n data: plottedValues[index],\n itemStyle: { color: fillColor },\n label: seriesLabel(input, fillColor),\n labelLayout,\n };\n }),\n };\n}\n"],"names":["GRID_PADDING","CATEGORY_LABEL_MAX_WIDTH_PX","BAR_MAX_WIDTH_PX","STACK_ID","PERCENT_SCALE","PERCENT_LABEL","formatPercent","value","resolveValueFormatter","input","nullSafeValueFormatter","formatValue","alignValuesToCategories","data","categories","valueByCategory","point","category","toShareOfCategoryTotal","valuesBySeries","categoryCount","categoryTotals","_unused","categoryIndex","total","values","categoryTotal","labelPosition","fitsInsideBar","params","seriesLabelLayout","hideOverlap","seriesLabel","fillColor","position","labelColorOnFill","categoryAxis","theme","orientation","valueAxis","options","stacking","isPercent","buildBarChartOption","series","isHorizontal","alignedValues","plottedValues","labelLayout","categoryAxisOption","valueAxisOption","index"],"mappings":";AAgDA,MAAMA,IAAe,EAAE,KAAK,IAAI,OAAO,IAAI,QAAQ,IAAI,MAAM,GAAA,GAIvDC,IAAmE;AAAA,EACvE,UAAU;AAAA,EACV,YAAY;AACd,GAEMC,IAA2B,IAE3BC,IAAmB,SAEnBC,IAAwB,KAExBC,IAAmC,IAAI,KAAK,aAAa,QAAW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AA0BsC,MAAkB;AAC9D,YAAMlB,IACJxB,EAAM,qBAAqBI,EAAK,EAAE,KAClCwB,EAAM,aAAac,IAAQd,EAAM,aAAa,MAAM;AACtD,aAAO;AAAA,QACL,IAAIxB,EAAK;AAAA,QACT,MAAMA,EAAK;AAAA,QACX,MAAM;AAAA,QACN,OAAO4B,MAAa,QAAQ,SAAYtC;AAAA,QACxC,aAAaD;AAAA,QACb,MAAM6C,EAAcI,CAAK;AAAA,QACzB,WAAW,EAAE,OAAOlB,EAAA;AAAA,QACpB,OAAOD,EAAYvB,GAAOwB,CAAS;AAAA,QACnC,aAAAe;AAAA,MAAA;AAAA,IAEJ,CAAC;AAAA,EAAA;AAEL;"}
1
+ {"version":3,"file":"bar-chart-option.js","sources":["../../../../../../src/ui/components/charts/BarChart/bar-chart-option.ts"],"sourcesContent":["import { labelColorOnFill } from \"../chart-label-color\";\nimport type { ChartTheme } from \"../chart-theme\";\n\nexport interface BarChartPoint {\n category: string;\n value: number | null;\n}\n\nexport interface BarChartSeriesData {\n id: string;\n name: string;\n points: BarChartPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type BarChartOrientation = \"vertical\" | \"horizontal\";\n\nexport type BarChartStacking = \"off\" | \"stacked\" | \"percent\";\n\nexport type BarChartValueLabel = \"auto\" | \"always\" | \"never\";\n\nexport type BarChartLegendMode = \"inline\" | \"none\";\n\nexport type BarChartAxisScale = \"linear\" | \"log\";\n\nexport interface BarChartValueAxisOptions {\n scale?: BarChartAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface BarChartOptionInput {\n categories: string[];\n series: BarChartSeriesData[];\n orientation: BarChartOrientation;\n stacking: BarChartStacking;\n valueLabel: BarChartValueLabel;\n valueAxis: BarChartValueAxisOptions;\n theme: ChartTheme;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\n// A legenda saiu do canvas e virou HTML (`ChartLegend`), entao a grade nao reserva mais faixa\n// para ela: quem divide a altura agora e o flex do componente.\nconst GRID_PADDING = { top: 16, right: 16, bottom: 16, left: 16 } as const;\n\n// Na horizontal o rótulo da categoria disputa largura com a própria barra; na vertical ele fica\n// sob a barra e uma faixa mais estreita já dá conta.\nconst CATEGORY_LABEL_MAX_WIDTH_PX: Record<BarChartOrientation, number> = {\n vertical: 140,\n horizontal: 200,\n};\n\nconst BAR_MAX_WIDTH_PX: number = 48;\n\nconst STACK_ID: string = \"total\";\n\nconst PERCENT_SCALE: number = 100;\n\nconst PERCENT_LABEL: Intl.NumberFormat = new Intl.NumberFormat(undefined, {\n style: \"percent\",\n maximumFractionDigits: 1,\n});\n\nfunction formatPercent(value: number): string {\n return PERCENT_LABEL.format(value / PERCENT_SCALE);\n}\n\n// Em `percent` o valor desenhado é a participação na categoria, e não mais o dado do consumidor:\n// aplicar ali o formatador dele escreveria \"31 ms\" numa barra que vale 31%.\nfunction resolveValueFormatter(input: BarChartOptionInput): ((value: number) => string) | undefined {\n return input.stacking === \"percent\" ? formatPercent : input.valueFormatter;\n}\n\n// Categoria sem valor chega ao formatter como `null` nos rótulos e como `undefined` no tooltip — o\n// ECharts formata o vazio junto com o resto. O tipo público promete `number` ao consumidor, e é\n// esta guarda que mantém a promessa. Deixar o `undefined` passar derruba o formatter dentro do\n// ECharts, que fica com a flag de processamento presa e ignora todo `resize()` seguinte.\nfunction nullSafeValueFormatter(\n input: BarChartOptionInput,\n): ((value: number | null | undefined) => string) | undefined {\n const formatValue: ((value: number) => string) | undefined = resolveValueFormatter(input);\n if (!formatValue) return undefined;\n return (value: number | null | undefined) => (value == null ? \"\" : formatValue(value));\n}\n\nfunction alignValuesToCategories(\n data: BarChartSeriesData,\n categories: string[],\n): Array<number | null> {\n const valueByCategory: Map<string, number | null> = new Map(\n data.points.map((point: BarChartPoint) => [point.category, point.value]),\n );\n return categories.map((category: string) => valueByCategory.get(category) ?? null);\n}\n\nfunction toShareOfCategoryTotal(\n valuesBySeries: Array<Array<number | null>>,\n categoryCount: number,\n): Array<Array<number | null>> {\n const categoryTotals: number[] = Array.from(\n { length: categoryCount },\n (_unused, categoryIndex: number) =>\n valuesBySeries.reduce(\n (total: number, values: Array<number | null>) => total + (values[categoryIndex] ?? 0),\n 0,\n ),\n );\n return valuesBySeries.map((values: Array<number | null>) =>\n values.map((value: number | null, categoryIndex: number) => {\n const categoryTotal: number = categoryTotals[categoryIndex];\n if (value === null || categoryTotal === 0) return null;\n return (value / categoryTotal) * PERCENT_SCALE;\n }),\n );\n}\n\nfunction labelPosition(input: BarChartOptionInput): string {\n if (input.stacking !== \"off\") return \"inside\";\n return input.orientation === \"horizontal\" ? \"right\" : \"top\";\n}\n\ninterface LabelLayoutParams {\n rect: { width: number; height: number };\n labelRect: { width: number; height: number };\n}\n\ninterface LabelLayout {\n hideOverlap: boolean;\n fontSize?: number;\n}\n\ntype SeriesLabelLayout = LabelLayout | ((params: LabelLayoutParams) => LabelLayout);\n\nfunction fitsInsideBar(params: LabelLayoutParams): boolean {\n return (\n params.labelRect.width <= params.rect.width && params.labelRect.height <= params.rect.height\n );\n}\n\n// `hideOverlap` resolve rótulo que encosta em rótulo, mas não rótulo maior que a própria fatia:\n// numa barra empilhada o ECharts desenha o número por cima das fatias vizinhas. `fontSize: 0` é\n// o que o `labelLayout` oferece para sumir com um rótulo caso a caso.\nfunction seriesLabelLayout(input: BarChartOptionInput): SeriesLabelLayout {\n const hideOverlap: boolean = input.valueLabel === \"auto\";\n if (!hideOverlap || labelPosition(input) !== \"inside\") return { hideOverlap };\n return (params: LabelLayoutParams) => ({\n hideOverlap,\n fontSize: fitsInsideBar(params) ? undefined : 0,\n });\n}\n\nfunction seriesLabel(input: BarChartOptionInput, fillColor: string): Record<string, unknown> {\n const position: string = labelPosition(input);\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n return {\n show: input.valueLabel !== \"never\",\n position,\n color: position === \"inside\" ? labelColorOnFill(fillColor) : input.theme.labelColor,\n formatter: formatValue\n ? (params: { value: number | null }) => formatValue(params.value)\n : undefined,\n };\n}\n\nfunction categoryAxis(input: BarChartOptionInput): Record<string, unknown> {\n const { categories, theme, orientation } = input;\n return {\n type: \"category\",\n data: categories,\n // Na horizontal o ECharts empilha a categoria de baixo para cima, invertendo a ordem que o\n // app escolheu ao ordenar as barras.\n inverse: orientation === \"horizontal\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: {\n color: theme.labelColor,\n hideOverlap: true,\n width: CATEGORY_LABEL_MAX_WIDTH_PX[orientation],\n overflow: \"truncate\",\n },\n splitLine: { show: false },\n };\n}\n\nfunction valueAxis(input: BarChartOptionInput): Record<string, unknown> {\n const { valueAxis: options, stacking, theme } = input;\n const isPercent: boolean = stacking === \"percent\";\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n return {\n type: options.scale === \"log\" ? \"log\" : \"value\",\n // Barra mede por comprimento: eixo cortado mente sobre a proporção entre as barras, então\n // aqui o zero entra por padrão — ao contrário da série temporal, que só mostra variação.\n scale: !isPercent && options.includeZero === false,\n min: isPercent ? 0 : options.min,\n max: isPercent ? PERCENT_SCALE : options.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildBarChartOption(input: BarChartOptionInput): Record<string, unknown> {\n const { categories, series, orientation, stacking, theme } = input;\n const isHorizontal: boolean = orientation === \"horizontal\";\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n\n const alignedValues: Array<Array<number | null>> = series.map((data: BarChartSeriesData) =>\n alignValuesToCategories(data, categories),\n );\n // O ECharts não tem empilhamento 100%: a participação precisa chegar calculada no dado.\n const plottedValues: Array<Array<number | null>> =\n stacking === \"percent\"\n ? toShareOfCategoryTotal(alignedValues, categories.length)\n : alignedValues;\n\n const labelLayout: SeriesLabelLayout = seriesLabelLayout(input);\n const categoryAxisOption: Record<string, unknown> = categoryAxis(input);\n const valueAxisOption: Record<string, unknown> = valueAxis(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING,\n containLabel: true,\n },\n tooltip: {\n trigger: \"axis\",\n axisPointer: { type: \"shadow\" },\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: isHorizontal ? valueAxisOption : categoryAxisOption,\n yAxis: isHorizontal ? categoryAxisOption : valueAxisOption,\n series: series.map((data: BarChartSeriesData, index: number) => {\n const fillColor: string =\n input.seriesColorOverrides[data.id] ??\n theme.seriesColors[index % theme.seriesColors.length];\n return {\n id: data.id,\n name: data.name,\n type: \"bar\",\n stack: stacking === \"off\" ? undefined : STACK_ID,\n barMaxWidth: BAR_MAX_WIDTH_PX,\n data: plottedValues[index],\n itemStyle: { color: fillColor },\n label: seriesLabel(input, fillColor),\n labelLayout,\n };\n }),\n };\n}\n"],"names":["GRID_PADDING","CATEGORY_LABEL_MAX_WIDTH_PX","BAR_MAX_WIDTH_PX","STACK_ID","PERCENT_SCALE","PERCENT_LABEL","formatPercent","value","resolveValueFormatter","input","nullSafeValueFormatter","formatValue","alignValuesToCategories","data","categories","valueByCategory","point","category","toShareOfCategoryTotal","valuesBySeries","categoryCount","categoryTotals","_unused","categoryIndex","total","values","categoryTotal","labelPosition","fitsInsideBar","params","seriesLabelLayout","hideOverlap","seriesLabel","fillColor","position","labelColorOnFill","categoryAxis","theme","orientation","valueAxis","options","stacking","isPercent","buildBarChartOption","series","isHorizontal","alignedValues","plottedValues","labelLayout","categoryAxisOption","valueAxisOption","index"],"mappings":";AAgDA,MA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EAAM;AAAA,MACnB,WAAW,EAAE,OAAOA,EAAM,WAAA;AAAA,MAC1B,gBAAgB1B;AAAA,IAAA;AAAA,IAElB,OAAOkC,IAAeK,IAAkBD;AAAA,IACxC,OAAOJ,IAAeI,IAAqBC;AAAA,IAC3C,QAAQN,EAAO,IAAI,CAAC/B,GAA0BsC,MAAkB;AAC9D,YAAMlB,IACJxB,EAAM,qBAAqBI,EAAK,EAAE,KAClCwB,EAAM,aAAac,IAAQd,EAAM,aAAa,MAAM;AACtD,aAAO;AAAA,QACL,IAAIxB,EAAK;AAAA,QACT,MAAMA,EAAK;AAAA,QACX,MAAM;AAAA,QACN,OAAO4B,MAAa,QAAQ,SAAYtC;AAAA,QACxC,aAAaD;AAAA,QACb,MAAM6C,EAAcI,CAAK;AAAA,QACzB,WAAW,EAAE,OAAOlB,EAAA;AAAA,QACpB,OAAOD,EAAYvB,GAAOwB,CAAS;AAAA,QACnC,aAAAe;AAAA,MAAA;AAAA,IAEJ,CAAC;AAAA,EAAA;AAEL;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m={top:16,right:16,bottom:24,left:56},c=6,d=.15,u={thin:1,normal:2,thick:4},f="solid",y="normal",L=new Intl.DateTimeFormat(void 0,{year:"numeric"}),b=new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit"}),g=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}),h=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function S(t){const e=new Date(t);return e.getSeconds()!==0||e.getMilliseconds()!==0?h.format(e):e.getHours()!==0||e.getMinutes()!==0?g.format(e):e.getMonth()===0&&e.getDate()===1?L.format(e):b.format(e)}function n(t){const{valueFormatter:e}=t;if(e)return i=>i===null?"":e(i)}function p(t){const{showValueLabels:e,theme:i}=t,o=n(t);return{show:e,position:"top",color:i.labelColor,formatter:o?l=>o(l.value[1]):void 0}}function C(t,e,i){const o=t.points.map(r=>[r.timestamp,r.value]),l=p(e);return e.displayType==="bar"?{id:t.id,name:t.name,type:"bar",data:o,itemStyle:{color:i},label:l}:{id:t.id,name:t.name,type:"line",data:o,showSymbol:e.showSymbols,symbolSize:c,lineStyle:{color:i,type:e.line.style??f,width:u[e.line.width??y]},itemStyle:{color:i},areaStyle:e.displayType==="area"?{color:i,opacity:d}:void 0,label:l}}function T(t){const{series:e,yAxis:i,theme:o,seriesColorOverrides:l}=t,r=n(t);return{animation:!1,color:o.seriesColors,textStyle:{fontFamily:o.fontFamily,color:o.labelColor},grid:{...m,containLabel:!1},tooltip:{trigger:"axis",backgroundColor:o.tooltipBackgroundColor,borderColor:o.tooltipBorderColor,textStyle:{color:o.labelColor},valueFormatter:r},xAxis:{type:"time",axisLine:{lineStyle:{color:o.axisLineColor}},axisTick:{show:!1},axisLabel:{color:o.labelColor,hideOverlap:!0,formatter:S},splitLine:{show:!1}},yAxis:{type:i.scale==="log"?"log":"value",scale:i.includeZero!==!0,min:i.min,max:i.max,axisLine:{show:!1},axisLabel:{color:o.labelColor,formatter:r},splitLine:{lineStyle:{color:o.splitLineColor}}},series:e.map((s,a)=>C(s,t,l[s.id]??o.seriesColors[a%o.seriesColors.length]))}}exports.buildTimeSeriesOption=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m={top:16,right:16,bottom:24,left:56},c=6,d=.15,u={thin:1,normal:2,thick:4},f="solid",y="normal",L=new Intl.DateTimeFormat(void 0,{year:"numeric"}),b=new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit"}),g=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}),h=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function S(t){const e=new Date(t);return e.getSeconds()!==0||e.getMilliseconds()!==0?h.format(e):e.getHours()!==0||e.getMinutes()!==0?g.format(e):e.getMonth()===0&&e.getDate()===1?L.format(e):b.format(e)}function n(t){const{valueFormatter:e}=t;if(e)return i=>i==null?"":e(i)}function p(t){const{showValueLabels:e,theme:i}=t,o=n(t);return{show:e,position:"top",color:i.labelColor,formatter:o?l=>o(l.value[1]):void 0}}function C(t,e,i){const o=t.points.map(r=>[r.timestamp,r.value]),l=p(e);return e.displayType==="bar"?{id:t.id,name:t.name,type:"bar",data:o,itemStyle:{color:i},label:l}:{id:t.id,name:t.name,type:"line",data:o,showSymbol:e.showSymbols,symbolSize:c,lineStyle:{color:i,type:e.line.style??f,width:u[e.line.width??y]},itemStyle:{color:i},areaStyle:e.displayType==="area"?{color:i,opacity:d}:void 0,label:l}}function T(t){const{series:e,yAxis:i,theme:o,seriesColorOverrides:l}=t,r=n(t);return{animation:!1,color:o.seriesColors,textStyle:{fontFamily:o.fontFamily,color:o.labelColor},grid:{...m,containLabel:!1},tooltip:{trigger:"axis",backgroundColor:o.tooltipBackgroundColor,borderColor:o.tooltipBorderColor,textStyle:{color:o.labelColor},valueFormatter:r},xAxis:{type:"time",axisLine:{lineStyle:{color:o.axisLineColor}},axisTick:{show:!1},axisLabel:{color:o.labelColor,hideOverlap:!0,formatter:S},splitLine:{show:!1}},yAxis:{type:i.scale==="log"?"log":"value",scale:i.includeZero!==!0,min:i.min,max:i.max,axisLine:{show:!1},axisLabel:{color:o.labelColor,formatter:r},splitLine:{lineStyle:{color:o.splitLineColor}}},series:e.map((s,a)=>C(s,t,l[s.id]??o.seriesColors[a%o.seriesColors.length]))}}exports.buildTimeSeriesOption=T;
2
2
  //# sourceMappingURL=time-series-option.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"time-series-option.cjs","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/time-series-option.ts"],"sourcesContent":["import type { ChartTheme } from \"../chart-theme\";\n\nexport interface TimeSeriesPoint {\n timestamp: number;\n value: number | null;\n}\n\nexport interface TimeSeriesData {\n id: string;\n name: string;\n points: TimeSeriesPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type TimeSeriesDisplayType = \"line\" | \"bar\" | \"area\";\n\nexport type TimeSeriesLineStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport type TimeSeriesLineWidth = \"thin\" | \"normal\" | \"thick\";\n\nexport interface TimeSeriesLineOptions {\n style?: TimeSeriesLineStyle;\n width?: TimeSeriesLineWidth;\n}\n\nexport type TimeSeriesLegendMode = \"inline\" | \"none\";\n\nexport type TimeSeriesAxisScale = \"linear\" | \"log\";\n\nexport interface TimeSeriesYAxisOptions {\n scale?: TimeSeriesAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface TimeSeriesOptionInput {\n series: TimeSeriesData[];\n displayType: TimeSeriesDisplayType;\n line: TimeSeriesLineOptions;\n yAxis: TimeSeriesYAxisOptions;\n theme: ChartTheme;\n showSymbols: boolean;\n showValueLabels: boolean;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\n// A legenda saiu do canvas e virou HTML (`ChartLegend`), entao a grade nao reserva mais faixa\n// para ela: quem divide a altura agora e o flex do componente.\nconst GRID_PADDING = { top: 16, right: 16, bottom: 24, left: 56 } as const;\n\nconst SYMBOL_SIZE_PX: number = 6;\n\nconst AREA_OPACITY: number = 0.15;\n\nconst LINE_WIDTH_PX: Record<TimeSeriesLineWidth, number> = { thin: 1, normal: 2, thick: 4 };\n\nconst DEFAULT_LINE_STYLE: TimeSeriesLineStyle = \"solid\";\n\nconst DEFAULT_LINE_WIDTH: TimeSeriesLineWidth = \"normal\";\n\n// O eixo de tempo do ECharts rotula a marca de dia so com o numero do dia -- \"2\", \"3\", \"4\" --, que\n// sozinho nao diz nem o mes. Aqui a marca de dia vira data e a marca dentro do dia vira hora, que e\n// o que se espera de uma serie temporal.\n//\n// A precisao sai do proprio instante, e nao de um nivel pedido ao ECharts: ele alinha as marcas ao\n// nivel que cabe no eixo, entao meia-noite e marca de dia, minuto cheio e marca de hora, e assim por\n// diante. Ler o instante e o que permite usar `Intl` e escrever a data na convencao de quem le -- o\n// objeto de niveis do ECharts so aceita template, e um `{dd}/{MM}` fixo seria lido como mes/dia por\n// metade dos usuarios.\nconst YEAR_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, { year: \"numeric\" });\n\nconst DAY_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n day: \"2-digit\",\n month: \"2-digit\",\n});\n\nconst MINUTE_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n});\n\nconst SECOND_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n});\n\nfunction timeAxisLabel(timestamp: number): string {\n const instant: Date = new Date(timestamp);\n if (instant.getSeconds() !== 0 || instant.getMilliseconds() !== 0) return SECOND_LABEL.format(instant);\n if (instant.getHours() !== 0 || instant.getMinutes() !== 0) return MINUTE_LABEL.format(instant);\n // Primeiro de janeiro e a marca de ano do ECharts, e ali a data sem o ano nao situa ninguem.\n if (instant.getMonth() === 0 && instant.getDate() === 1) return YEAR_LABEL.format(instant);\n return DAY_LABEL.format(instant);\n}\n\n// O ponto de gap chega ao formatter como `null` — o ECharts monta o bloco do tooltip sem marcar\n// `noValue`, então formata o vazio junto com o resto. O tipo público promete `number` ao\n// consumidor, e é esta guarda que mantém a promessa em vez de transformá-la em aviso.\nfunction nullSafeValueFormatter(\n input: TimeSeriesOptionInput,\n): ((value: number | null) => string) | undefined {\n const { valueFormatter } = input;\n if (!valueFormatter) return undefined;\n return (value: number | null) => (value === null ? \"\" : valueFormatter(value));\n}\n\nfunction seriesLabel(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { showValueLabels, theme } = input;\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n return {\n show: showValueLabels,\n position: \"top\",\n color: theme.labelColor,\n formatter: formatValue\n ? (params: { value: [number, number | null] }) => formatValue(params.value[1])\n : undefined,\n };\n}\n\nfunction seriesEntry(\n data: TimeSeriesData,\n input: TimeSeriesOptionInput,\n color: string,\n): Record<string, unknown> {\n const values: Array<[number, number | null]> = data.points.map((point: TimeSeriesPoint) => [\n point.timestamp,\n point.value,\n ]);\n const label: Record<string, unknown> = seriesLabel(input);\n\n if (input.displayType === \"bar\") {\n return { id: data.id, name: data.name, type: \"bar\", data: values, itemStyle: { color }, label };\n }\n\n return {\n id: data.id,\n name: data.name,\n type: \"line\",\n data: values,\n showSymbol: input.showSymbols,\n symbolSize: SYMBOL_SIZE_PX,\n lineStyle: {\n color,\n type: input.line.style ?? DEFAULT_LINE_STYLE,\n width: LINE_WIDTH_PX[input.line.width ?? DEFAULT_LINE_WIDTH],\n },\n itemStyle: { color },\n areaStyle: input.displayType === \"area\" ? { color, opacity: AREA_OPACITY } : undefined,\n label,\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildTimeSeriesOption(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { series, yAxis, theme, seriesColorOverrides } = input;\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING,\n containLabel: false,\n },\n tooltip: {\n trigger: \"axis\",\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: {\n type: \"time\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: { color: theme.labelColor, hideOverlap: true, formatter: timeAxisLabel },\n splitLine: { show: false },\n },\n yAxis: {\n type: yAxis.scale === \"log\" ? \"log\" : \"value\",\n scale: yAxis.includeZero !== true,\n min: yAxis.min,\n max: yAxis.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n },\n series: series.map((data: TimeSeriesData, index: number) =>\n seriesEntry(\n data,\n input,\n seriesColorOverrides[data.id] ?? theme.seriesColors[index % theme.seriesColors.length],\n ),\n ),\n };\n}\n"],"names":["GRID_PADDING","SYMBOL_SIZE_PX","AREA_OPACITY","LINE_WIDTH_PX","DEFAULT_LINE_STYLE","DEFAULT_LINE_WIDTH","YEAR_LABEL","DAY_LABEL","MINUTE_LABEL","SECOND_LABEL","timeAxisLabel","timestamp","instant","nullSafeValueFormatter","input","valueFormatter","value","seriesLabel","showValueLabels","theme","formatValue","params","seriesEntry","data","color","values","point","label","buildTimeSeriesOption","series","yAxis","seriesColorOverrides","index"],"mappings":"gFAoDA,MAAMA,EAAe,CAAE,IAAK,GAAI,MAAO,GAAI,OAAQ,GAAI,KAAM,EAAA,EAEvDC,EAAyB,EAEzBC,EAAuB,IAEvBC,EAAqD,CAAE,KAAM,EAAG,OAAQ,EAAG,MAAO,CAAA,EAElFC,EAA0C,QAE1CC,EAA0C,SAW1CC,EAAkC,IAAI,KAAK,eAAe,OAAW,CAAE,KAAM,UAAW,EAExFC,EAAiC,IAAI,KAAK,eAAe,OAAW,CACxE,IAAK,UACL,MAAO,SACT,CAAC,EAEKC,EAAoC,IAAI,KAAK,eAAe,OAAW,CAC3E,KAAM,UACN,OAAQ,UACR,OAAQ,EACV,CAAC,EAEKC,EAAoC,IAAI,KAAK,eAAe,OAAW,CAC3E,KAAM,UACN,OAAQ,UACR,OAAQ,UACR,OAAQ,EACV,CAAC,EAED,SAASC,EAAcC,EAA2B,CAChD,MAAMC,EAAgB,IAAI,KAAKD,CAAS,EACxC,OAAIC,EAAQ,eAAiB,GAAKA,EAAQ,gBAAA,IAAsB,EAAUH,EAAa,OAAOG,CAAO,EACj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Ae,EAAQ,MAAAC,EAAO,MAAAX,EAAO,qBAAAY,GAAyBjB,EACjDM,EAA8DP,EAAuBC,CAAK,EAEhG,MAAO,CACL,UAAW,GACX,MAAOK,EAAM,aACb,UAAW,CAAE,WAAYA,EAAM,WAAY,MAAOA,EAAM,UAAA,EACxD,KAAM,CACJ,GAAGnB,EACH,aAAc,EAAA,EAEhB,QAAS,CACP,QAAS,OACT,gBAAiBmB,EAAM,uBACvB,YAAaA,EAAM,mBACnB,UAAW,CAAE,MAAOA,EAAM,UAAA,EAC1B,eAAgBC,CAAA,EAElB,MAAO,CACL,KAAM,OACN,SAAU,CAAE,UAAW,CAAE,MAAOD,EAAM,cAAc,EACpD,SAAU,CAAE,KAAM,EAAA,EAClB,UAAW,CAAE,MAAOA,EAAM,WAAY,YAAa,GAAM,UAAWT,CAAA,EACpE,UAAW,CAAE,KAAM,EAAA,CAAM,EAE3B,MAAO,CACL,KAAMoB,EAAM,QAAU,MAAQ,MAAQ,QACtC,MAAOA,EAAM,cAAgB,GAC7B,IAAKA,EAAM,IACX,IAAKA,EAAM,IACX,SAAU,CAAE,KAAM,EAAA,EAClB,UAAW,CAAE,MAAOX,EAAM,WAAY,UAAWC,CAAA,EACjD,UAAW,CAAE,UAAW,CAAE,MAAOD,EAAM,eAAe,CAAE,EAE1D,OAAQU,EAAO,IAAI,CAACN,EAAsBS,IACxCV,EACEC,EACAT,EACAiB,EAAqBR,EAAK,EAAE,GAAKJ,EAAM,aAAaa,EAAQb,EAAM,aAAa,MAAM,CAAA,CACvF,CACF,CAEJ"}
1
+ {"version":3,"file":"time-series-option.cjs","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/time-series-option.ts"],"sourcesContent":["import type { ChartTheme } from \"../chart-theme\";\n\nexport interface TimeSeriesPoint {\n timestamp: number;\n value: number | null;\n}\n\nexport interface TimeSeriesData {\n id: string;\n name: string;\n points: TimeSeriesPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type TimeSeriesDisplayType = \"line\" | \"bar\" | \"area\";\n\nexport type TimeSeriesLineStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport type TimeSeriesLineWidth = \"thin\" | \"normal\" | \"thick\";\n\nexport interface TimeSeriesLineOptions {\n style?: TimeSeriesLineStyle;\n width?: TimeSeriesLineWidth;\n}\n\nexport type TimeSeriesLegendMode = \"inline\" | \"none\";\n\nexport type TimeSeriesAxisScale = \"linear\" | \"log\";\n\nexport interface TimeSeriesYAxisOptions {\n scale?: TimeSeriesAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface TimeSeriesOptionInput {\n series: TimeSeriesData[];\n displayType: TimeSeriesDisplayType;\n line: TimeSeriesLineOptions;\n yAxis: TimeSeriesYAxisOptions;\n theme: ChartTheme;\n showSymbols: boolean;\n showValueLabels: boolean;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\n// A legenda saiu do canvas e virou HTML (`ChartLegend`), entao a grade nao reserva mais faixa\n// para ela: quem divide a altura agora e o flex do componente.\nconst GRID_PADDING = { top: 16, right: 16, bottom: 24, left: 56 } as const;\n\nconst SYMBOL_SIZE_PX: number = 6;\n\nconst AREA_OPACITY: number = 0.15;\n\nconst LINE_WIDTH_PX: Record<TimeSeriesLineWidth, number> = { thin: 1, normal: 2, thick: 4 };\n\nconst DEFAULT_LINE_STYLE: TimeSeriesLineStyle = \"solid\";\n\nconst DEFAULT_LINE_WIDTH: TimeSeriesLineWidth = \"normal\";\n\n// O eixo de tempo do ECharts rotula a marca de dia so com o numero do dia -- \"2\", \"3\", \"4\" --, que\n// sozinho nao diz nem o mes. Aqui a marca de dia vira data e a marca dentro do dia vira hora, que e\n// o que se espera de uma serie temporal.\n//\n// A precisao sai do proprio instante, e nao de um nivel pedido ao ECharts: ele alinha as marcas ao\n// nivel que cabe no eixo, entao meia-noite e marca de dia, minuto cheio e marca de hora, e assim por\n// diante. Ler o instante e o que permite usar `Intl` e escrever a data na convencao de quem le -- o\n// objeto de niveis do ECharts so aceita template, e um `{dd}/{MM}` fixo seria lido como mes/dia por\n// metade dos usuarios.\nconst YEAR_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, { year: \"numeric\" });\n\nconst DAY_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n day: \"2-digit\",\n month: \"2-digit\",\n});\n\nconst MINUTE_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n});\n\nconst SECOND_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n});\n\nfunction timeAxisLabel(timestamp: number): string {\n const instant: Date = new Date(timestamp);\n if (instant.getSeconds() !== 0 || instant.getMilliseconds() !== 0) return SECOND_LABEL.format(instant);\n if (instant.getHours() !== 0 || instant.getMinutes() !== 0) return MINUTE_LABEL.format(instant);\n // Primeiro de janeiro e a marca de ano do ECharts, e ali a data sem o ano nao situa ninguem.\n if (instant.getMonth() === 0 && instant.getDate() === 1) return YEAR_LABEL.format(instant);\n return DAY_LABEL.format(instant);\n}\n\n// O ponto de gap chega ao formatter como `null` — o ECharts monta o bloco do tooltip sem marcar\n// `noValue`, então formata o vazio junto com o resto. O tipo público promete `number` ao\n// consumidor, e é esta guarda que mantém a promessa em vez de transformá-la em aviso.\nfunction nullSafeValueFormatter(\n input: TimeSeriesOptionInput,\n): ((value: number | null | undefined) => string) | undefined {\n const { valueFormatter } = input;\n if (!valueFormatter) return undefined;\n return (value: number | null | undefined) => (value == null ? \"\" : valueFormatter(value));\n}\n\nfunction seriesLabel(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { showValueLabels, theme } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n return {\n show: showValueLabels,\n position: \"top\",\n color: theme.labelColor,\n formatter: formatValue\n ? (params: { value: [number, number | null] }) => formatValue(params.value[1])\n : undefined,\n };\n}\n\nfunction seriesEntry(\n data: TimeSeriesData,\n input: TimeSeriesOptionInput,\n color: string,\n): Record<string, unknown> {\n const values: Array<[number, number | null]> = data.points.map((point: TimeSeriesPoint) => [\n point.timestamp,\n point.value,\n ]);\n const label: Record<string, unknown> = seriesLabel(input);\n\n if (input.displayType === \"bar\") {\n return { id: data.id, name: data.name, type: \"bar\", data: values, itemStyle: { color }, label };\n }\n\n return {\n id: data.id,\n name: data.name,\n type: \"line\",\n data: values,\n showSymbol: input.showSymbols,\n symbolSize: SYMBOL_SIZE_PX,\n lineStyle: {\n color,\n type: input.line.style ?? DEFAULT_LINE_STYLE,\n width: LINE_WIDTH_PX[input.line.width ?? DEFAULT_LINE_WIDTH],\n },\n itemStyle: { color },\n areaStyle: input.displayType === \"area\" ? { color, opacity: AREA_OPACITY } : undefined,\n label,\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildTimeSeriesOption(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { series, yAxis, theme, seriesColorOverrides } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING,\n containLabel: false,\n },\n tooltip: {\n trigger: \"axis\",\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: {\n type: \"time\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: { color: theme.labelColor, hideOverlap: true, formatter: timeAxisLabel },\n splitLine: { show: false },\n },\n yAxis: {\n type: yAxis.scale === \"log\" ? \"log\" : \"value\",\n scale: yAxis.includeZero !== true,\n min: yAxis.min,\n max: yAxis.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n },\n series: series.map((data: TimeSeriesData, index: number) =>\n seriesEntry(\n data,\n input,\n seriesColorOverrides[data.id] ?? theme.seriesColors[index % theme.seriesColors.length],\n ),\n ),\n };\n}\n"],"names":["GRID_PADDING","SYMBOL_SIZE_PX","AREA_OPACITY","LINE_WIDTH_PX","DEFAULT_LINE_STYLE","DEFAULT_LINE_WIDTH","YEAR_LABEL","DAY_LABEL","MINUTE_LABEL","SECOND_LABEL","timeAxisLabel","timestamp","instant","nullSafeValueFormatter","input","valueFormatter","value","seriesLabel","showValueLabels","theme","formatValue","params","seriesEntry","data","color","values","point","label","buildTimeSeriesOption","series","yAxis","seriesColorOverrides","index"],"mappings":"gFAoDA,MAAMA,EAAe,CAAE,IAAK,GAAI,MAAO,GAAI,OAAQ,GAAI,KAAM,EAAA,EAEvDC,EAAyB,EAEzBC,EAAuB,IAEvBC,EAAqD,CAAE,KAAM,EAAG,OAAQ,EAAG,MAAO,CAAA,EAElFC,EAA0C,QAE1CC,EAA0C,SAW1CC,EAAkC,IAAI,KAAK,eAAe,OAAW,CAAE,KAAM,UAAW,EAExFC,EAAiC,IAAI,KAAK,eAAe,OAAW,CACxE,IAAK,UACL,MAAO,SACT,CAAC,EAEKC,EAAoC,IAAI,KAAK,eAAe,OAAW,CAC3E,KAAM,UACN,OAAQ,UACR,OAAQ,EACV,CAAC,EAEKC,EAAoC,IAAI,KAAK,eAAe,OAAW,CAC3E,KAAM,UACN,OAAQ,UACR,OAAQ,UACR,OAAQ,EACV,CAAC,EAED,SAASC,EAAcC,EAA2B,CAChD,MAAMC,EAAgB,IAAI,KAAKD,CAAS,EACxC,OAAIC,EAAQ,eAAiB,GAAKA,EAAQ,gBAAA,IAAsB,EAAUH,EAAa,OAAOG,CAAO,EACjGA,EAAQ,aA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AAC,EAAO,MAAAX,EAAO,qBAAAY,GAAyBjB,EACjDM,EACJP,EAAuBC,CAAK,EAE9B,MAAO,CACL,UAAW,GACX,MAAOK,EAAM,aACb,UAAW,CAAE,WAAYA,EAAM,WAAY,MAAOA,EAAM,UAAA,EACxD,KAAM,CACJ,GAAGnB,EACH,aAAc,EAAA,EAEhB,QAAS,CACP,QAAS,OACT,gBAAiBmB,EAAM,uBACvB,YAAaA,EAAM,mBACnB,UAAW,CAAE,MAAOA,EAAM,UAAA,EAC1B,eAAgBC,CAAA,EAElB,MAAO,CACL,KAAM,OACN,SAAU,CAAE,UAAW,CAAE,MAAOD,EAAM,cAAc,EACpD,SAAU,CAAE,KAAM,EAAA,EAClB,UAAW,CAAE,MAAOA,EAAM,WAAY,YAAa,GAAM,UAAWT,CAAA,EACpE,UAAW,CAAE,KAAM,EAAA,CAAM,EAE3B,MAAO,CACL,KAAMoB,EAAM,QAAU,MAAQ,MAAQ,QACtC,MAAOA,EAAM,cAAgB,GAC7B,IAAKA,EAAM,IACX,IAAKA,EAAM,IACX,SAAU,CAAE,KAAM,EAAA,EAClB,UAAW,CAAE,MAAOX,EAAM,WAAY,UAAWC,CAAA,EACjD,UAAW,CAAE,UAAW,CAAE,MAAOD,EAAM,eAAe,CAAE,EAE1D,OAAQU,EAAO,IAAI,CAACN,EAAsBS,IACxCV,EACEC,EACAT,EACAiB,EAAqBR,EAAK,EAAE,GAAKJ,EAAM,aAAaa,EAAQb,EAAM,aAAa,MAAM,CAAA,CACvF,CACF,CAEJ"}
@@ -18,7 +18,7 @@ function S(t) {
18
18
  function n(t) {
19
19
  const { valueFormatter: e } = t;
20
20
  if (e)
21
- return (i) => i === null ? "" : e(i);
21
+ return (i) => i == null ? "" : e(i);
22
22
  }
23
23
  function p(t) {
24
24
  const { showValueLabels: e, theme: i } = t, o = n(t);
@@ -1 +1 @@
1
- {"version":3,"file":"time-series-option.js","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/time-series-option.ts"],"sourcesContent":["import type { ChartTheme } from \"../chart-theme\";\n\nexport interface TimeSeriesPoint {\n timestamp: number;\n value: number | null;\n}\n\nexport interface TimeSeriesData {\n id: string;\n name: string;\n points: TimeSeriesPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type TimeSeriesDisplayType = \"line\" | \"bar\" | \"area\";\n\nexport type TimeSeriesLineStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport type TimeSeriesLineWidth = \"thin\" | \"normal\" | \"thick\";\n\nexport interface TimeSeriesLineOptions {\n style?: TimeSeriesLineStyle;\n width?: TimeSeriesLineWidth;\n}\n\nexport type TimeSeriesLegendMode = \"inline\" | \"none\";\n\nexport type TimeSeriesAxisScale = \"linear\" | \"log\";\n\nexport interface TimeSeriesYAxisOptions {\n scale?: TimeSeriesAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface TimeSeriesOptionInput {\n series: TimeSeriesData[];\n displayType: TimeSeriesDisplayType;\n line: TimeSeriesLineOptions;\n yAxis: TimeSeriesYAxisOptions;\n theme: ChartTheme;\n showSymbols: boolean;\n showValueLabels: boolean;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\n// A legenda saiu do canvas e virou HTML (`ChartLegend`), entao a grade nao reserva mais faixa\n// para ela: quem divide a altura agora e o flex do componente.\nconst GRID_PADDING = { top: 16, right: 16, bottom: 24, left: 56 } as const;\n\nconst SYMBOL_SIZE_PX: number = 6;\n\nconst AREA_OPACITY: number = 0.15;\n\nconst LINE_WIDTH_PX: Record<TimeSeriesLineWidth, number> = { thin: 1, normal: 2, thick: 4 };\n\nconst DEFAULT_LINE_STYLE: TimeSeriesLineStyle = \"solid\";\n\nconst DEFAULT_LINE_WIDTH: TimeSeriesLineWidth = \"normal\";\n\n// O eixo de tempo do ECharts rotula a marca de dia so com o numero do dia -- \"2\", \"3\", \"4\" --, que\n// sozinho nao diz nem o mes. Aqui a marca de dia vira data e a marca dentro do dia vira hora, que e\n// o que se espera de uma serie temporal.\n//\n// A precisao sai do proprio instante, e nao de um nivel pedido ao ECharts: ele alinha as marcas ao\n// nivel que cabe no eixo, entao meia-noite e marca de dia, minuto cheio e marca de hora, e assim por\n// diante. Ler o instante e o que permite usar `Intl` e escrever a data na convencao de quem le -- o\n// objeto de niveis do ECharts so aceita template, e um `{dd}/{MM}` fixo seria lido como mes/dia por\n// metade dos usuarios.\nconst YEAR_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, { year: \"numeric\" });\n\nconst DAY_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n day: \"2-digit\",\n month: \"2-digit\",\n});\n\nconst MINUTE_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n});\n\nconst SECOND_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n});\n\nfunction timeAxisLabel(timestamp: number): string {\n const instant: Date = new Date(timestamp);\n if (instant.getSeconds() !== 0 || instant.getMilliseconds() !== 0) return SECOND_LABEL.format(instant);\n if (instant.getHours() !== 0 || instant.getMinutes() !== 0) return MINUTE_LABEL.format(instant);\n // Primeiro de janeiro e a marca de ano do ECharts, e ali a data sem o ano nao situa ninguem.\n if (instant.getMonth() === 0 && instant.getDate() === 1) return YEAR_LABEL.format(instant);\n return DAY_LABEL.format(instant);\n}\n\n// O ponto de gap chega ao formatter como `null` — o ECharts monta o bloco do tooltip sem marcar\n// `noValue`, então formata o vazio junto com o resto. O tipo público promete `number` ao\n// consumidor, e é esta guarda que mantém a promessa em vez de transformá-la em aviso.\nfunction nullSafeValueFormatter(\n input: TimeSeriesOptionInput,\n): ((value: number | null) => string) | undefined {\n const { valueFormatter } = input;\n if (!valueFormatter) return undefined;\n return (value: number | null) => (value === null ? \"\" : valueFormatter(value));\n}\n\nfunction seriesLabel(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { showValueLabels, theme } = input;\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n return {\n show: showValueLabels,\n position: \"top\",\n color: theme.labelColor,\n formatter: formatValue\n ? (params: { value: [number, number | null] }) => formatValue(params.value[1])\n : undefined,\n };\n}\n\nfunction seriesEntry(\n data: TimeSeriesData,\n input: TimeSeriesOptionInput,\n color: string,\n): Record<string, unknown> {\n const values: Array<[number, number | null]> = data.points.map((point: TimeSeriesPoint) => [\n point.timestamp,\n point.value,\n ]);\n const label: Record<string, unknown> = seriesLabel(input);\n\n if (input.displayType === \"bar\") {\n return { id: data.id, name: data.name, type: \"bar\", data: values, itemStyle: { color }, label };\n }\n\n return {\n id: data.id,\n name: data.name,\n type: \"line\",\n data: values,\n showSymbol: input.showSymbols,\n symbolSize: SYMBOL_SIZE_PX,\n lineStyle: {\n color,\n type: input.line.style ?? DEFAULT_LINE_STYLE,\n width: LINE_WIDTH_PX[input.line.width ?? DEFAULT_LINE_WIDTH],\n },\n itemStyle: { color },\n areaStyle: input.displayType === \"area\" ? { color, opacity: AREA_OPACITY } : undefined,\n label,\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildTimeSeriesOption(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { series, yAxis, theme, seriesColorOverrides } = input;\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING,\n containLabel: false,\n },\n tooltip: {\n trigger: \"axis\",\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: {\n type: \"time\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: { color: theme.labelColor, hideOverlap: true, formatter: timeAxisLabel },\n splitLine: { show: false },\n },\n yAxis: {\n type: yAxis.scale === \"log\" ? \"log\" : \"value\",\n scale: yAxis.includeZero !== true,\n min: yAxis.min,\n max: yAxis.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n },\n series: series.map((data: TimeSeriesData, index: number) =>\n seriesEntry(\n data,\n input,\n seriesColorOverrides[data.id] ?? theme.seriesColors[index % theme.seriesColors.length],\n ),\n ),\n };\n}\n"],"names":["GRID_PADDING","SYMBOL_SIZE_PX","AREA_OPACITY","LINE_WIDTH_PX","DEFAULT_LINE_STYLE","DEFAULT_LINE_WIDTH","YEAR_LABEL","DAY_LABEL","MINUTE_LABEL","SECOND_LABEL","timeAxisLabel","timestamp","instant","nullSafeValueFormatter","input","valueFormatter","value","seriesLabel","showValueLabels","theme","formatValue","params","seriesEntry","data","color","values","point","label","buildTimeSeriesOption","series","yAxis","seriesColorOverrides","index"],"mappings":"AAoDA,MAAMA,IAAe,EAAE,KAAK,IAAI,OAAO,IAAI,QAAQ,IAAI,MAAM,GAAA,GAEvDC,IAAyB,GAEzBC,IAAuB,MAEvBC,IAAqD,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,EAAA,GAElFC,IAA0C,SAE1CC,IAA0C,UAW1CC,IAAkC,IAAI,KAAK,eAAe,QAAW,EAAE,MAAM,WAAW,GAExFC,IAAiC,IAAI,KAAK,eAAe,QAAW;AAAA,EACxE,KAAK;AAAA,EACL,OAAO;AACT,CAAC,GAEKC,IAAoC,IAAI,KAAK,eAAe,QAAW;AAAA,EAC3E,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AACV,CAAC,GAEKC,IAAoC,IAAI,KAAK,eAAe,QAAW;AAAA,EAC3E,MAAM;AAAA,EACN,QAAQ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,WAAW,EAAE,OAAOX,EAAM,YAAY,WAAWC,EAAA;AAAA,MACjD,WAAW,EAAE,WAAW,EAAE,OAAOD,EAAM,iBAAe;AAAA,IAAE;AAAA,IAE1D,QAAQU,EAAO;AAAA,MAAI,CAACN,GAAsBS,MACxCV;AAAA,QACEC;AAAA,QACAT;AAAA,QACAiB,EAAqBR,EAAK,EAAE,KAAKJ,EAAM,aAAaa,IAAQb,EAAM,aAAa,MAAM;AAAA,MAAA;AAAA,IACvF;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"time-series-option.js","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/time-series-option.ts"],"sourcesContent":["import type { ChartTheme } from \"../chart-theme\";\n\nexport interface TimeSeriesPoint {\n timestamp: number;\n value: number | null;\n}\n\nexport interface TimeSeriesData {\n id: string;\n name: string;\n points: TimeSeriesPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type TimeSeriesDisplayType = \"line\" | \"bar\" | \"area\";\n\nexport type TimeSeriesLineStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport type TimeSeriesLineWidth = \"thin\" | \"normal\" | \"thick\";\n\nexport interface TimeSeriesLineOptions {\n style?: TimeSeriesLineStyle;\n width?: TimeSeriesLineWidth;\n}\n\nexport type TimeSeriesLegendMode = \"inline\" | \"none\";\n\nexport type TimeSeriesAxisScale = \"linear\" | \"log\";\n\nexport interface TimeSeriesYAxisOptions {\n scale?: TimeSeriesAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface TimeSeriesOptionInput {\n series: TimeSeriesData[];\n displayType: TimeSeriesDisplayType;\n line: TimeSeriesLineOptions;\n yAxis: TimeSeriesYAxisOptions;\n theme: ChartTheme;\n showSymbols: boolean;\n showValueLabels: boolean;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\n// A legenda saiu do canvas e virou HTML (`ChartLegend`), entao a grade nao reserva mais faixa\n// para ela: quem divide a altura agora e o flex do componente.\nconst GRID_PADDING = { top: 16, right: 16, bottom: 24, left: 56 } as const;\n\nconst SYMBOL_SIZE_PX: number = 6;\n\nconst AREA_OPACITY: number = 0.15;\n\nconst LINE_WIDTH_PX: Record<TimeSeriesLineWidth, number> = { thin: 1, normal: 2, thick: 4 };\n\nconst DEFAULT_LINE_STYLE: TimeSeriesLineStyle = \"solid\";\n\nconst DEFAULT_LINE_WIDTH: TimeSeriesLineWidth = \"normal\";\n\n// O eixo de tempo do ECharts rotula a marca de dia so com o numero do dia -- \"2\", \"3\", \"4\" --, que\n// sozinho nao diz nem o mes. Aqui a marca de dia vira data e a marca dentro do dia vira hora, que e\n// o que se espera de uma serie temporal.\n//\n// A precisao sai do proprio instante, e nao de um nivel pedido ao ECharts: ele alinha as marcas ao\n// nivel que cabe no eixo, entao meia-noite e marca de dia, minuto cheio e marca de hora, e assim por\n// diante. Ler o instante e o que permite usar `Intl` e escrever a data na convencao de quem le -- o\n// objeto de niveis do ECharts so aceita template, e um `{dd}/{MM}` fixo seria lido como mes/dia por\n// metade dos usuarios.\nconst YEAR_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, { year: \"numeric\" });\n\nconst DAY_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n day: \"2-digit\",\n month: \"2-digit\",\n});\n\nconst MINUTE_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n});\n\nconst SECOND_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n});\n\nfunction timeAxisLabel(timestamp: number): string {\n const instant: Date = new Date(timestamp);\n if (instant.getSeconds() !== 0 || instant.getMilliseconds() !== 0) return SECOND_LABEL.format(instant);\n if (instant.getHours() !== 0 || instant.getMinutes() !== 0) return MINUTE_LABEL.format(instant);\n // Primeiro de janeiro e a marca de ano do ECharts, e ali a data sem o ano nao situa ninguem.\n if (instant.getMonth() === 0 && instant.getDate() === 1) return YEAR_LABEL.format(instant);\n return DAY_LABEL.format(instant);\n}\n\n// O ponto de gap chega ao formatter como `null` — o ECharts monta o bloco do tooltip sem marcar\n// `noValue`, então formata o vazio junto com o resto. O tipo público promete `number` ao\n// consumidor, e é esta guarda que mantém a promessa em vez de transformá-la em aviso.\nfunction nullSafeValueFormatter(\n input: TimeSeriesOptionInput,\n): ((value: number | null | undefined) => string) | undefined {\n const { valueFormatter } = input;\n if (!valueFormatter) return undefined;\n return (value: number | null | undefined) => (value == null ? \"\" : valueFormatter(value));\n}\n\nfunction seriesLabel(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { showValueLabels, theme } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n return {\n show: showValueLabels,\n position: \"top\",\n color: theme.labelColor,\n formatter: formatValue\n ? (params: { value: [number, number | null] }) => formatValue(params.value[1])\n : undefined,\n };\n}\n\nfunction seriesEntry(\n data: TimeSeriesData,\n input: TimeSeriesOptionInput,\n color: string,\n): Record<string, unknown> {\n const values: Array<[number, number | null]> = data.points.map((point: TimeSeriesPoint) => [\n point.timestamp,\n point.value,\n ]);\n const label: Record<string, unknown> = seriesLabel(input);\n\n if (input.displayType === \"bar\") {\n return { id: data.id, name: data.name, type: \"bar\", data: values, itemStyle: { color }, label };\n }\n\n return {\n id: data.id,\n name: data.name,\n type: \"line\",\n data: values,\n showSymbol: input.showSymbols,\n symbolSize: SYMBOL_SIZE_PX,\n lineStyle: {\n color,\n type: input.line.style ?? DEFAULT_LINE_STYLE,\n width: LINE_WIDTH_PX[input.line.width ?? DEFAULT_LINE_WIDTH],\n },\n itemStyle: { color },\n areaStyle: input.displayType === \"area\" ? { color, opacity: AREA_OPACITY } : undefined,\n label,\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildTimeSeriesOption(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { series, yAxis, theme, seriesColorOverrides } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING,\n containLabel: false,\n },\n tooltip: {\n trigger: \"axis\",\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: {\n type: \"time\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: { color: theme.labelColor, hideOverlap: true, formatter: timeAxisLabel },\n splitLine: { show: false },\n },\n yAxis: {\n type: yAxis.scale === \"log\" ? \"log\" : \"value\",\n scale: yAxis.includeZero !== true,\n min: yAxis.min,\n max: yAxis.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n },\n series: series.map((data: TimeSeriesData, index: number) =>\n seriesEntry(\n data,\n input,\n seriesColorOverrides[data.id] ?? theme.seriesColors[index % theme.seriesColors.length],\n ),\n ),\n };\n}\n"],"names":["GRID_PADDING","SYMBOL_SIZE_PX","AREA_OPACITY","LINE_WIDTH_PX","DEFAULT_LINE_STYLE","DEFAULT_LINE_WIDTH","YEAR_LABEL","DAY_LABEL","MINUTE_LABEL","SECOND_LABEL","timeAxisLabel","timestamp","instant","nullSafeValueFormatter","input","valueFormatter","value","seriesLabel","showValueLabels","theme","formatValue","params","seriesEntry","data","color","values","point","label","buildTimeSeriesOption","series","yAxis","seriesColorOverrides","index"],"mappings":"AAoDA,MAAMA,IAAe,EAAE,KAAK,IAAI,OAAO,IAAI,QAAQ,IAAI,MAAM,GAAA,GAEvDC,IAAy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AAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU,EAAE,WAAW,EAAE,OAAOD,EAAM,gBAAc;AAAA,MACpD,UAAU,EAAE,MAAM,GAAA;AAAA,MAClB,WAAW,EAAE,OAAOA,EAAM,YAAY,aAAa,IAAM,WAAWT,EAAA;AAAA,MACpE,WAAW,EAAE,MAAM,GAAA;AAAA,IAAM;AAAA,IAE3B,OAAO;AAAA,MACL,MAAMoB,EAAM,UAAU,QAAQ,QAAQ;AAAA,MACtC,OAAOA,EAAM,gBAAgB;AAAA,MAC7B,KAAKA,EAAM;AAAA,MACX,KAAKA,EAAM;AAAA,MACX,UAAU,EAAE,MAAM,GAAA;AAAA,MAClB,WAAW,EAAE,OAAOX,EAAM,YAAY,WAAWC,EAAA;AAAA,MACjD,WAAW,EAAE,WAAW,EAAE,OAAOD,EAAM,iBAAe;AAAA,IAAE;AAAA,IAE1D,QAAQU,EAAO;AAAA,MAAI,CAACN,GAAsBS,MACxCV;AAAA,QACEC;AAAA,QACAT;AAAA,QACAiB,EAAqBR,EAAK,EAAE,KAAKJ,EAAM,aAAaa,IAAQb,EAAM,aAAa,MAAM;AAAA,MAAA;AAAA,IACvF;AAAA,EACF;AAEJ;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apipass/design-system",
3
- "version": "7.4.2",
3
+ "version": "7.4.3",
4
4
  "type": "module",
5
5
  "description": "APIPass React Design System",
6
6
  "sideEffects": [