@apipass/design-system 5.2.0 → 5.4.0

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.
Files changed (47) hide show
  1. package/dist/lib/charts.index.cjs +1 -1
  2. package/dist/lib/charts.index.js +10 -6
  3. package/dist/lib/charts.index.js.map +1 -1
  4. package/dist/lib/embedded-styles.js +2 -2
  5. package/dist/lib/style.css +1 -1
  6. package/dist/lib/ui/components/charts/BarChart/BarChart.cjs +1 -1
  7. package/dist/lib/ui/components/charts/BarChart/BarChart.cjs.map +1 -1
  8. package/dist/lib/ui/components/charts/BarChart/BarChart.js +66 -48
  9. package/dist/lib/ui/components/charts/BarChart/BarChart.js.map +1 -1
  10. package/dist/lib/ui/components/charts/BarChart/bar-chart-option.cjs +1 -1
  11. package/dist/lib/ui/components/charts/BarChart/bar-chart-option.cjs.map +1 -1
  12. package/dist/lib/ui/components/charts/BarChart/bar-chart-option.js +71 -81
  13. package/dist/lib/ui/components/charts/BarChart/bar-chart-option.js.map +1 -1
  14. package/dist/lib/ui/components/charts/ChartColorPicker/ChartColorPicker.cjs +2 -0
  15. package/dist/lib/ui/components/charts/ChartColorPicker/ChartColorPicker.cjs.map +1 -0
  16. package/dist/lib/ui/components/charts/ChartColorPicker/ChartColorPicker.js +99 -0
  17. package/dist/lib/ui/components/charts/ChartColorPicker/ChartColorPicker.js.map +1 -0
  18. package/dist/lib/ui/components/charts/ChartLegend/ChartLegend.cjs +2 -0
  19. package/dist/lib/ui/components/charts/ChartLegend/ChartLegend.cjs.map +1 -0
  20. package/dist/lib/ui/components/charts/ChartLegend/ChartLegend.js +47 -0
  21. package/dist/lib/ui/components/charts/ChartLegend/ChartLegend.js.map +1 -0
  22. package/dist/lib/ui/components/charts/ChartLegend/use-chart-legend.cjs +2 -0
  23. package/dist/lib/ui/components/charts/ChartLegend/use-chart-legend.cjs.map +1 -0
  24. package/dist/lib/ui/components/charts/ChartLegend/use-chart-legend.js +34 -0
  25. package/dist/lib/ui/components/charts/ChartLegend/use-chart-legend.js.map +1 -0
  26. package/dist/lib/ui/components/charts/TimeSeriesChart/TimeSeriesChart.cjs +1 -1
  27. package/dist/lib/ui/components/charts/TimeSeriesChart/TimeSeriesChart.cjs.map +1 -1
  28. package/dist/lib/ui/components/charts/TimeSeriesChart/TimeSeriesChart.js +63 -45
  29. package/dist/lib/ui/components/charts/TimeSeriesChart/TimeSeriesChart.js.map +1 -1
  30. package/dist/lib/ui/components/charts/TimeSeriesChart/time-series-option.cjs +1 -1
  31. package/dist/lib/ui/components/charts/TimeSeriesChart/time-series-option.cjs.map +1 -1
  32. package/dist/lib/ui/components/charts/TimeSeriesChart/time-series-option.js +31 -41
  33. package/dist/lib/ui/components/charts/TimeSeriesChart/time-series-option.js.map +1 -1
  34. package/dist/lib/ui/primitives/Table/Table.cjs +1 -1
  35. package/dist/lib/ui/primitives/Table/Table.cjs.map +1 -1
  36. package/dist/lib/ui/primitives/Table/Table.js +68 -52
  37. package/dist/lib/ui/primitives/Table/Table.js.map +1 -1
  38. package/dist/types/charts.index.d.ts +2 -0
  39. package/dist/types/ui/components/charts/BarChart/BarChart.d.ts +4 -1
  40. package/dist/types/ui/components/charts/BarChart/bar-chart-option.d.ts +0 -1
  41. package/dist/types/ui/components/charts/ChartColorPicker/ChartColorPicker.d.ts +18 -0
  42. package/dist/types/ui/components/charts/ChartLegend/ChartLegend.d.ts +21 -0
  43. package/dist/types/ui/components/charts/ChartLegend/use-chart-legend.d.ts +14 -0
  44. package/dist/types/ui/components/charts/TimeSeriesChart/TimeSeriesChart.d.ts +4 -1
  45. package/dist/types/ui/components/charts/TimeSeriesChart/time-series-option.d.ts +0 -1
  46. package/dist/types/ui/primitives/Table/Table.d.ts +2 -1
  47. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TimeSeriesChart.js","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/TimeSeriesChart.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, useEffect } from \"react\";\nimport { useChartInstance, type ChartInstance } from \"../useChartInstance\";\nimport {\n buildTimeSeriesOption,\n type TimeSeriesData,\n type TimeSeriesDisplayType,\n type TimeSeriesLegendMode,\n type TimeSeriesLineOptions,\n type TimeSeriesYAxisOptions,\n} from \"./time-series-option\";\nimport \"./time-series-chart.css\";\n\nexport type {\n TimeSeriesData,\n TimeSeriesDisplayType,\n TimeSeriesLegendMode,\n TimeSeriesLineOptions,\n TimeSeriesLineStyle,\n TimeSeriesLineWidth,\n TimeSeriesPoint,\n TimeSeriesYAxisOptions,\n} from \"./time-series-option\";\n\nexport type TimeSeriesChartProps = Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> & {\n series: TimeSeriesData[];\n displayType?: TimeSeriesDisplayType;\n legend?: TimeSeriesLegendMode;\n line?: TimeSeriesLineOptions;\n yAxis?: TimeSeriesYAxisOptions;\n showSymbols?: boolean;\n showValueLabels?: boolean;\n valueFormatter?: (value: number) => string;\n};\n\nconst EMPTY_Y_AXIS_OPTIONS: TimeSeriesYAxisOptions = {};\n\nconst EMPTY_LINE_OPTIONS: TimeSeriesLineOptions = {};\n\nexport function TimeSeriesChart({\n series,\n displayType = \"line\",\n legend = \"inline\",\n line = EMPTY_LINE_OPTIONS,\n yAxis = EMPTY_Y_AXIS_OPTIONS,\n showSymbols = false,\n showValueLabels = false,\n valueFormatter,\n className,\n ...props\n}: TimeSeriesChartProps) {\n const { containerRef, chart, theme, resolveSeriesColor }: ChartInstance = useChartInstance();\n\n useEffect(() => {\n if (!chart || !theme) return;\n\n const seriesColorOverrides: Record<string, string> = {};\n for (const data of series) {\n if (!data.colorToken) continue;\n const color: string | undefined = resolveSeriesColor(data.colorToken);\n if (color) seriesColorOverrides[data.id] = color;\n }\n\n // `notMerge` evita que uma série removida da configuração continue desenhada: o ECharts\n // casa séries por id e mantém as que não aparecem na opção nova.\n chart.setOption(\n buildTimeSeriesOption({\n series,\n displayType,\n legend,\n line,\n yAxis,\n theme,\n showSymbols,\n showValueLabels,\n seriesColorOverrides,\n valueFormatter,\n }),\n { notMerge: true },\n );\n }, [\n chart,\n theme,\n resolveSeriesColor,\n series,\n displayType,\n legend,\n line,\n yAxis,\n showSymbols,\n showValueLabels,\n valueFormatter,\n ]);\n\n return <div ref={containerRef} className={clsx(\"time-series-chart\", className)} {...props} />;\n}\n"],"names":["EMPTY_Y_AXIS_OPTIONS","EMPTY_LINE_OPTIONS","TimeSeriesChart","series","displayType","legend","line","yAxis","showSymbols","showValueLabels","valueFormatter","className","props","containerRef","chart","theme","resolveSeriesColor","useChartInstance","useEffect","seriesColorOverrides","data","color","buildTimeSeriesOption","jsx","clsx"],"mappings":";;;;;;AAmCA,MAAMA,IAA+C,CAAA,GAE/CC,IAA4C,CAAA;AAE3C,SAASC,EAAgB;AAAA,EAC9B,QAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,MAAAC,IAAOL;AAAA,EACP,OAAAM,IAAQP;AAAA,EACR,aAAAQ,IAAc;AAAA,EACd,iBAAAC,IAAkB;AAAA,EAClB,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,GAAyB;AACvB,QAAM,EAAE,cAAAC,GAAc,OAAAC,GAAO,OAAAC,GAAO,oBAAAC,EAAA,IAAsCC,EAAA;AAE1E,SAAAC,EAAU,MAAM;AACd,QAAI,CAACJ,KAAS,CAACC,EAAO;AAEtB,UAAMI,IAA+C,CAAA;AACrD,eAAWC,KAAQjB,GAAQ;AACzB,UAAI,CAACiB,EAAK,WAAY;AACtB,YAAMC,IAA4BL,EAAmBI,EAAK,UAAU;AACpE,MAAIC,MAAOF,EAAqBC,EAAK,EAAE,IAAIC;AAAA,IAC7C;AAIA,IAAAP,EAAM;AAAA,MACJQ,EAAsB;AAAA,QACpB,QAAAnB;AAAA,QACA,aAAAC;AAAA,QACA,QAAAC;AAAA,QACA,MAAAC;AAAA,QACA,OAAAC;AAAA,QACA,OAAAQ;AAAA,QACA,aAAAP;AAAA,QACA,iBAAAC;AAAA,QACA,sBAAAU;AAAA,QACA,gBAAAT;AAAA,MAAA,CACD;AAAA,MACD,EAAE,UAAU,GAAA;AAAA,IAAK;AAAA,EAErB,GAAG;AAAA,IACDI;AAAA,IACAC;AAAA,IACAC;AAAA,IACAb;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,EAAA,CACD,GAEM,gBAAAa,EAAC,OAAA,EAAI,KAAKV,GAAc,WAAWW,EAAK,qBAAqBb,CAAS,GAAI,GAAGC,EAAA,CAAO;AAC7F;"}
1
+ {"version":3,"file":"TimeSeriesChart.js","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/TimeSeriesChart.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, useEffect, useMemo } from \"react\";\nimport { useChartInstance, type ChartInstance } from \"../useChartInstance\";\nimport { ChartLegend, type ChartLegendLabels } from \"../ChartLegend/ChartLegend\";\nimport { useChartLegend, type ChartLegendState } from \"../ChartLegend/use-chart-legend\";\nimport {\n buildTimeSeriesOption,\n type TimeSeriesData,\n type TimeSeriesDisplayType,\n type TimeSeriesLegendMode,\n type TimeSeriesLineOptions,\n type TimeSeriesYAxisOptions,\n} from \"./time-series-option\";\nimport \"./time-series-chart.css\";\n\nexport type {\n TimeSeriesData,\n TimeSeriesDisplayType,\n TimeSeriesLegendMode,\n TimeSeriesLineOptions,\n TimeSeriesLineStyle,\n TimeSeriesLineWidth,\n TimeSeriesPoint,\n TimeSeriesYAxisOptions,\n} from \"./time-series-option\";\n\nexport type TimeSeriesChartProps = Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> & {\n series: TimeSeriesData[];\n displayType?: TimeSeriesDisplayType;\n legend?: TimeSeriesLegendMode;\n line?: TimeSeriesLineOptions;\n yAxis?: TimeSeriesYAxisOptions;\n showSymbols?: boolean;\n showValueLabels?: boolean;\n valueFormatter?: (value: number) => string;\n // Habilita o seletor de cor no marcador da legenda. Sem ele o marcador é só desenho — o gráfico\n // que não tem onde guardar a escolha não pode oferecê-la.\n onSeriesColorChange?: (seriesId: string, colorToken: string | null) => void;\n legendLabels?: Partial<ChartLegendLabels>;\n};\n\nconst EMPTY_Y_AXIS_OPTIONS: TimeSeriesYAxisOptions = {};\n\nconst EMPTY_LINE_OPTIONS: TimeSeriesLineOptions = {};\n\nexport function TimeSeriesChart({\n series,\n displayType = \"line\",\n legend = \"inline\",\n line = EMPTY_LINE_OPTIONS,\n yAxis = EMPTY_Y_AXIS_OPTIONS,\n showSymbols = false,\n showValueLabels = false,\n valueFormatter,\n onSeriesColorChange,\n legendLabels,\n className,\n ...props\n}: TimeSeriesChartProps) {\n const { containerRef, chart, theme, resolveSeriesColor }: ChartInstance = useChartInstance();\n\n const {\n items,\n colorsBySeriesId,\n colorTokensBySeriesId,\n hiddenSeriesIds,\n toggleSeries,\n }: ChartLegendState =\n useChartLegend(series, theme?.seriesColors ?? [], resolveSeriesColor);\n\n // A série escondida sai da opção inteira, em vez de ficar com a seleção desligada do ECharts: é\n // o que faz o eixo reescalar sobre o que restou.\n const visibleSeries: TimeSeriesData[] = useMemo(\n () => series.filter((data: TimeSeriesData) => !hiddenSeriesIds.has(data.id)),\n [series, hiddenSeriesIds],\n );\n\n useEffect(() => {\n if (!chart || !theme) return;\n\n // `notMerge` evita que uma série removida da configuração continue desenhada: o ECharts\n // casa séries por id e mantém as que não aparecem na opção nova.\n chart.setOption(\n buildTimeSeriesOption({\n series: visibleSeries,\n displayType,\n line,\n yAxis,\n theme,\n showSymbols,\n showValueLabels,\n seriesColorOverrides: colorsBySeriesId,\n valueFormatter,\n }),\n { notMerge: true },\n );\n }, [\n chart,\n theme,\n visibleSeries,\n displayType,\n line,\n yAxis,\n showSymbols,\n showValueLabels,\n colorsBySeriesId,\n valueFormatter,\n ]);\n\n const isLegendVisible: boolean = legend !== \"none\" && series.length > 0;\n\n return (\n <div className={clsx(\"time-series-chart\", className)} {...props}>\n {isLegendVisible && (\n <ChartLegend\n items={items}\n onToggle={toggleSeries}\n onColorChange={onSeriesColorChange}\n colorTokensBySeriesId={colorTokensBySeriesId}\n labels={legendLabels}\n />\n )}\n <div ref={containerRef} className=\"time-series-chart__canvas\" />\n </div>\n );\n}\n"],"names":["EMPTY_Y_AXIS_OPTIONS","EMPTY_LINE_OPTIONS","TimeSeriesChart","series","displayType","legend","line","yAxis","showSymbols","showValueLabels","valueFormatter","onSeriesColorChange","legendLabels","className","props","containerRef","chart","theme","resolveSeriesColor","useChartInstance","items","colorsBySeriesId","colorTokensBySeriesId","hiddenSeriesIds","toggleSeries","useChartLegend","visibleSeries","useMemo","data","useEffect","buildTimeSeriesOption","isLegendVisible","jsxs","clsx","jsx","ChartLegend"],"mappings":";;;;;;;;AAyCA,MAAMA,IAA+C,CAAA,GAE/CC,IAA4C,CAAA;AAE3C,SAASC,EAAgB;AAAA,EAC9B,QAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,MAAAC,IAAOL;AAAA,EACP,OAAAM,IAAQP;AAAA,EACR,aAAAQ,IAAc;AAAA,EACd,iBAAAC,IAAkB;AAAA,EAClB,gBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,GAAyB;AACvB,QAAM,EAAE,cAAAC,GAAc,OAAAC,GAAO,OAAAC,GAAO,oBAAAC,EAAA,IAAsCC,EAAA,GAEpE;AAAA,IACJ,OAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IAEAC,EAAetB,IAAQc,KAAA,gBAAAA,EAAO,iBAAgB,CAAA,GAAIC,CAAkB,GAIhEQ,IAAkCC;AAAA,IACtC,MAAMxB,EAAO,OAAO,CAACyB,MAAyB,CAACL,EAAgB,IAAIK,EAAK,EAAE,CAAC;AAAA,IAC3E,CAACzB,GAAQoB,CAAe;AAAA,EAAA;AAG1B,EAAAM,EAAU,MAAM;AACd,IAAI,CAACb,KAAS,CAACC,KAIfD,EAAM;AAAA,MACJc,EAAsB;AAAA,QACpB,QAAQJ;AAAA,QACR,aAAAtB;AAAA,QACA,MAAAE;AAAA,QACA,OAAAC;AAAA,QACA,OAAAU;AAAA,QACA,aAAAT;AAAA,QACA,iBAAAC;AAAA,QACA,sBAAsBY;AAAA,QACtB,gBAAAX;AAAA,MAAA,CACD;AAAA,MACD,EAAE,UAAU,GAAA;AAAA,IAAK;AAAA,EAErB,GAAG;AAAA,IACDM;AAAA,IACAC;AAAA,IACAS;AAAA,IACAtB;AAAA,IACAE;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAY;AAAA,IACAX;AAAA,EAAA,CACD;AAED,QAAMqB,IAA2B1B,MAAW,UAAUF,EAAO,SAAS;AAEtE,SACE,gBAAA6B,EAAC,SAAI,WAAWC,EAAK,qBAAqBpB,CAAS,GAAI,GAAGC,GACvD,UAAA;AAAA,IAAAiB,KACC,gBAAAG;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAAf;AAAA,QACA,UAAUI;AAAA,QACV,eAAeb;AAAA,QACf,uBAAAW;AAAA,QACA,QAAQV;AAAA,MAAA;AAAA,IAAA;AAAA,IAGZ,gBAAAsB,EAAC,OAAA,EAAI,KAAKnB,GAAc,WAAU,4BAAA,CAA4B;AAAA,EAAA,GAChE;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=32,n={top:16,right:16,bottom:24,left:56},f=6,y=.15,L={thin:1,normal:2,thick:4},g="solid",b="normal",h=new Intl.DateTimeFormat(void 0,{year:"numeric"}),p=new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit"}),S=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}),E=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function T(o){const e=new Date(o);return e.getSeconds()!==0||e.getMilliseconds()!==0?E.format(e):e.getHours()!==0||e.getMinutes()!==0?S.format(e):e.getMonth()===0&&e.getDate()===1?h.format(e):p.format(e)}function c(o){const{valueFormatter:e}=o;if(e)return i=>i===null?"":e(i)}function C(o){const{showValueLabels:e,theme:i}=o,l=c(o);return{show:e,position:"top",color:i.labelColor,formatter:l?t=>l(t.value[1]):void 0}}function x(o,e,i){const l=o.points.map(r=>[r.timestamp,r.value]),t=C(e);return e.displayType==="bar"?{id:o.id,name:o.name,type:"bar",data:l,itemStyle:{color:i},label:t}:{id:o.id,name:o.name,type:"line",data:l,showSymbol:e.showSymbols,symbolSize:f,lineStyle:{color:i,type:e.line.style??g,width:L[e.line.width??b]},itemStyle:{color:i},areaStyle:e.displayType==="area"?{color:i,opacity:y}:void 0,label:t}}function _(o){const{series:e,legend:i,yAxis:l,theme:t,seriesColorOverrides:r}=o,s=i!=="none"&&e.length>0,a=c(o);return{animation:!1,color:t.seriesColors,textStyle:{fontFamily:t.fontFamily,color:t.labelColor},grid:{...n,top:s?n.top+u:n.top,containLabel:!1},legend:s?{type:"scroll",top:0,left:0,icon:"roundRect",itemHeight:8,itemWidth:12,textStyle:{color:t.labelColor}}:{show:!1},tooltip:{trigger:"axis",backgroundColor:t.tooltipBackgroundColor,borderColor:t.tooltipBorderColor,textStyle:{color:t.labelColor},valueFormatter:a},xAxis:{type:"time",axisLine:{lineStyle:{color:t.axisLineColor}},axisTick:{show:!1},axisLabel:{color:t.labelColor,hideOverlap:!0,formatter:T},splitLine:{show:!1}},yAxis:{type:l.scale==="log"?"log":"value",scale:l.includeZero!==!0,min:l.min,max:l.max,axisLine:{show:!1},axisLabel:{color:t.labelColor,formatter:a},splitLine:{lineStyle:{color:t.splitLineColor}}},series:e.map((m,d)=>x(m,o,r[m.id]??t.seriesColors[d%t.seriesColors.length]))}}exports.buildTimeSeriesOption=_;
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 legend: TimeSeriesLegendMode;\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\nconst LEGEND_HEIGHT_PX: number = 32;\n\nconst GRID_WITHOUT_LEGEND = { 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, legend, yAxis, theme, seriesColorOverrides } = input;\n const isLegendVisible: boolean = legend !== \"none\" && series.length > 0;\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_WITHOUT_LEGEND,\n top: isLegendVisible ? GRID_WITHOUT_LEGEND.top + LEGEND_HEIGHT_PX : GRID_WITHOUT_LEGEND.top,\n containLabel: false,\n },\n legend: isLegendVisible\n ? {\n type: \"scroll\",\n top: 0,\n left: 0,\n icon: \"roundRect\",\n itemHeight: 8,\n itemWidth: 12,\n textStyle: { color: theme.labelColor },\n }\n : { show: false },\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":["LEGEND_HEIGHT_PX","GRID_WITHOUT_LEGEND","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","buildTim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,QAAS,CACP,QAAS,OACT,gBAAiBA,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,KAAMqB,EAAM,QAAU,MAAQ,MAAQ,QACtC,MAAOA,EAAM,cAAgB,GAC7B,IAAKA,EAAM,IACX,IAAKA,EAAM,IACX,SAAU,CAAE,KAAM,EAAA,EAClB,UAAW,CAAE,MAAOZ,EAAM,WAAY,UAAWC,CAAA,EACjD,UAAW,CAAE,UAAW,CAAE,MAAOD,EAAM,eAAe,CAAE,EAE1D,OAAQU,EAAO,IAAI,CAACN,EAAsBW,IACxCZ,EACEC,EACAT,EACAkB,EAAqBT,EAAK,EAAE,GAAKJ,EAAM,aAAae,EAAQf,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) => 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,EACjGA,EAAQ,aAAe,GAAKA,EAAQ,WAAA,IAAiB,EAAUJ,EAAa,OAAOI,CAAO,EAE1FA,EAAQ,aAAe,GAAKA,EAAQ,QAAA,IAAc,EAAUN,EAAW,OAAOM,CAAO,EAClFL,EAAU,OAAOK,CAAO,CACjC,CAKA,SAASC,EACPC,EACgD,CAChD,KAAM,CAAE,eAAAC,GAAmBD,EAC3B,GAAKC,EACL,OAAQC,GAA0B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M,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,11 +1,11 @@
1
- const n = { top: 16, right: 16, bottom: 24, left: 56 }, u = 6, f = 0.15, y = { thin: 1, normal: 2, thick: 4 }, L = "solid", g = "normal", h = new Intl.DateTimeFormat(void 0, { year: "numeric" }), E = new Intl.DateTimeFormat(void 0, {
1
+ const m = { top: 16, right: 16, bottom: 24, left: 56 }, c = 6, d = 0.15, u = { thin: 1, normal: 2, thick: 4 }, f = "solid", y = "normal", L = new Intl.DateTimeFormat(void 0, { year: "numeric" }), g = new Intl.DateTimeFormat(void 0, {
2
2
  day: "2-digit",
3
3
  month: "2-digit"
4
- }), b = new Intl.DateTimeFormat(void 0, {
4
+ }), h = new Intl.DateTimeFormat(void 0, {
5
5
  hour: "2-digit",
6
6
  minute: "2-digit",
7
7
  hour12: !1
8
- }), p = new Intl.DateTimeFormat(void 0, {
8
+ }), b = new Intl.DateTimeFormat(void 0, {
9
9
  hour: "2-digit",
10
10
  minute: "2-digit",
11
11
  second: "2-digit",
@@ -13,70 +13,60 @@ const n = { top: 16, right: 16, bottom: 24, left: 56 }, u = 6, f = 0.15, y = { t
13
13
  });
14
14
  function S(t) {
15
15
  const e = new Date(t);
16
- return e.getSeconds() !== 0 || e.getMilliseconds() !== 0 ? p.format(e) : e.getHours() !== 0 || e.getMinutes() !== 0 ? b.format(e) : e.getMonth() === 0 && e.getDate() === 1 ? h.format(e) : E.format(e);
16
+ return e.getSeconds() !== 0 || e.getMilliseconds() !== 0 ? b.format(e) : e.getHours() !== 0 || e.getMinutes() !== 0 ? h.format(e) : e.getMonth() === 0 && e.getDate() === 1 ? L.format(e) : g.format(e);
17
17
  }
18
- function c(t) {
18
+ function n(t) {
19
19
  const { valueFormatter: e } = t;
20
20
  if (e)
21
21
  return (i) => i === null ? "" : e(i);
22
22
  }
23
- function T(t) {
24
- const { showValueLabels: e, theme: i } = t, l = c(t);
23
+ function p(t) {
24
+ const { showValueLabels: e, theme: i } = t, o = n(t);
25
25
  return {
26
26
  show: e,
27
27
  position: "top",
28
28
  color: i.labelColor,
29
- formatter: l ? (o) => l(o.value[1]) : void 0
29
+ formatter: o ? (l) => o(l.value[1]) : void 0
30
30
  };
31
31
  }
32
- function _(t, e, i) {
33
- const l = t.points.map((r) => [
32
+ function x(t, e, i) {
33
+ const o = t.points.map((r) => [
34
34
  r.timestamp,
35
35
  r.value
36
- ]), o = T(e);
37
- return e.displayType === "bar" ? { id: t.id, name: t.name, type: "bar", data: l, itemStyle: { color: i }, label: o } : {
36
+ ]), l = p(e);
37
+ return e.displayType === "bar" ? { id: t.id, name: t.name, type: "bar", data: o, itemStyle: { color: i }, label: l } : {
38
38
  id: t.id,
39
39
  name: t.name,
40
40
  type: "line",
41
- data: l,
41
+ data: o,
42
42
  showSymbol: e.showSymbols,
43
- symbolSize: u,
43
+ symbolSize: c,
44
44
  lineStyle: {
45
45
  color: i,
46
- type: e.line.style ?? L,
47
- width: y[e.line.width ?? g]
46
+ type: e.line.style ?? f,
47
+ width: u[e.line.width ?? y]
48
48
  },
49
49
  itemStyle: { color: i },
50
- areaStyle: e.displayType === "area" ? { color: i, opacity: f } : void 0,
51
- label: o
50
+ areaStyle: e.displayType === "area" ? { color: i, opacity: d } : void 0,
51
+ label: l
52
52
  };
53
53
  }
54
- function x(t) {
55
- const { series: e, legend: i, yAxis: l, theme: o, seriesColorOverrides: r } = t, s = i !== "none" && e.length > 0, a = c(t);
54
+ function C(t) {
55
+ const { series: e, yAxis: i, theme: o, seriesColorOverrides: l } = t, r = n(t);
56
56
  return {
57
57
  animation: !1,
58
58
  color: o.seriesColors,
59
59
  textStyle: { fontFamily: o.fontFamily, color: o.labelColor },
60
60
  grid: {
61
- ...n,
62
- top: s ? n.top + 32 : n.top,
61
+ ...m,
63
62
  containLabel: !1
64
63
  },
65
- legend: s ? {
66
- type: "scroll",
67
- top: 0,
68
- left: 0,
69
- icon: "roundRect",
70
- itemHeight: 8,
71
- itemWidth: 12,
72
- textStyle: { color: o.labelColor }
73
- } : { show: !1 },
74
64
  tooltip: {
75
65
  trigger: "axis",
76
66
  backgroundColor: o.tooltipBackgroundColor,
77
67
  borderColor: o.tooltipBorderColor,
78
68
  textStyle: { color: o.labelColor },
79
- valueFormatter: a
69
+ valueFormatter: r
80
70
  },
81
71
  xAxis: {
82
72
  type: "time",
@@ -86,24 +76,24 @@ function x(t) {
86
76
  splitLine: { show: !1 }
87
77
  },
88
78
  yAxis: {
89
- type: l.scale === "log" ? "log" : "value",
90
- scale: l.includeZero !== !0,
91
- min: l.min,
92
- max: l.max,
79
+ type: i.scale === "log" ? "log" : "value",
80
+ scale: i.includeZero !== !0,
81
+ min: i.min,
82
+ max: i.max,
93
83
  axisLine: { show: !1 },
94
- axisLabel: { color: o.labelColor, formatter: a },
84
+ axisLabel: { color: o.labelColor, formatter: r },
95
85
  splitLine: { lineStyle: { color: o.splitLineColor } }
96
86
  },
97
87
  series: e.map(
98
- (m, d) => _(
99
- m,
88
+ (s, a) => x(
89
+ s,
100
90
  t,
101
- r[m.id] ?? o.seriesColors[d % o.seriesColors.length]
91
+ l[s.id] ?? o.seriesColors[a % o.seriesColors.length]
102
92
  )
103
93
  )
104
94
  };
105
95
  }
106
96
  export {
107
- x as buildTimeSeriesOption
97
+ C as buildTimeSeriesOption
108
98
  };
109
99
  //# sourceMappingURL=time-series-option.js.map
@@ -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 legend: TimeSeriesLegendMode;\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\nconst LEGEND_HEIGHT_PX: number = 32;\n\nconst GRID_WITHOUT_LEGEND = { 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, legend, yAxis, theme, seriesColorOverrides } = input;\n const isLegendVisible: boolean = legend !== \"none\" && series.length > 0;\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_WITHOUT_LEGEND,\n top: isLegendVisible ? GRID_WITHOUT_LEGEND.top + LEGEND_HEIGHT_PX : GRID_WITHOUT_LEGEND.top,\n containLabel: false,\n },\n legend: isLegendVisible\n ? {\n type: \"scroll\",\n top: 0,\n left: 0,\n icon: \"roundRect\",\n itemHeight: 8,\n itemWidth: 12,\n textStyle: { color: theme.labelColor },\n }\n : { show: false },\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_WITHOUT_LEGEND","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","legend","yAxis","seriesColorOverrides","isLegendVisible","index"],"mappings":"AAqDA,MAAMA,IAAsB,EAAE,KAAK,IAAI,OAAO,IAAI,QAAQ,IAAI,MAAM,GAAA,GAE9DC,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;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AACV,CAAC;AAED,SAASC,EAAcC,GAA2B;AAChD,QAAMC,IAAgB,IAAI,KAAKD,CAAS;AACxC,SAAIC,EAAQ,iBAAiB,KAAKA,EAAQ,gBAAA,MAAsB,IAAUH,EAAa,OAAOG,CAAO,IACjGA,EAAQ,eAAe,KAAKA,EAAQ,WAAA,MAAiB,IAAUJ,EAAa,OAAOI,CAAO,IAE1FA,EAAQ,eAAe,KAAKA,EAAQ,QAAA,MAAc,IAAUN,EAAW,OAAOM,CAAO,IAClFL,EAAU,OAAOK,CAAO;AACjC;AAKA,SAASC,EACPC,GACgD;AAChD,QAAM,EAAE,gBAAAC,MAAmBD;AAC3B,MAAKC;AACL,WAAO,CAACC,MAA0BA,MAAU,OAAO,KAAKD,EAAeC,CAAK;AAC9E;AAEA,SAASC,EAAYH,GAAuD;AAC1E,QAAM,EAAE,iBAAAI,GAAiB,OAAAC,EAAA,IAAUL,GAC7BM,IAA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;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) => 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,E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A,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;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../../vendor/clsx/dist/clsx.cjs"),s=require("react-aria-components");;/* empty css */const m=require("../../icons/IconChevronUp.cjs"),h=require("../../icons/IconChevronDown.cjs"),u=require("../Checkbox/Checkbox.cjs");function j({bleed:l=!1,dense:a=!1,grid:n=!1,striped:c=!1,className:t,...o}){const i=r.clsx(t,"table-container",l&&"table-container-bleed"),b=r.clsx("sds-table",l&&"table-bleed",a&&"table-dense",n&&"table-grid",c&&"sds-table-striped");return e.jsx("div",{className:i,children:e.jsx(s.Table,{className:b,...o})})}function x({align:l="start",className:a,...n}){const c=r.clsx(a,"table-column",`table-align-${l}`);return e.jsx(s.Column,{className:c,...n,children:({allowsSorting:t,sortDirection:o})=>e.jsx("div",{className:r.clsx("table-column-inner"),children:e.jsxs(e.Fragment,{children:[n.children,t&&e.jsx("span",{"aria-hidden":"true",className:"sort-indicator",children:o==="ascending"?e.jsx(m.IconChevronUp,{}):e.jsx(h.IconChevronDown,{})})]})})})}function C({className:l,...a}){return e.jsx(s.TableBody,{...a})}function N({className:l,columns:a,children:n,...c}){const{selectionBehavior:t,selectionMode:o,allowsDragging:i}=s.useTableOptions(),b=r.clsx(l,"table-head");return e.jsxs(s.TableHeader,{className:b,...c,children:[i&&e.jsx(x,{}),t==="toggle"&&e.jsx(x,{className:"table-selection-col",children:o==="multiple"&&e.jsx(s.Checkbox,{slot:"selection",className:"table-selection-checkbox",children:e.jsx(u.Checkbox,{})})}),e.jsx(s.Collection,{items:a,children:n})]})}function g({id:l,columns:a,children:n,className:c,...t}){const{selectionBehavior:o,allowsDragging:i}=s.useTableOptions(),b=r.clsx(c,"table-row");return e.jsxs(s.Row,{id:l,...t,className:b,children:[i&&e.jsx(d,{children:e.jsx(s.Button,{slot:"drag",children:"≡"})}),o==="toggle"&&e.jsx(d,{className:"table-selection-cell",children:e.jsx(s.Checkbox,{slot:"selection",className:"table-selection-checkbox",children:e.jsx(u.Checkbox,{})})}),e.jsx(s.Collection,{items:a,children:n})]})}function d({align:l="start",className:a,...n}){const c=r.clsx(a,"table-cell",`table-align-${l}`);return e.jsx(s.Cell,{className:c,...n})}exports.Table=j;exports.TableBody=C;exports.TableCell=d;exports.TableColumn=x;exports.TableHead=N;exports.TableRow=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../../vendor/clsx/dist/clsx.cjs"),n=require("react-aria-components");;/* empty css */const N=require("../../icons/IconChevronDown.cjs"),C=require("../../icons/IconChevronUp.cjs"),u=require("../Checkbox/Checkbox.cjs");function g(s){const l=Number(s);return`${s}`.trim()!==""&&Number.isFinite(l)?`${l}px`:`${s}`}function T({bleed:s=!1,dense:l=!1,grid:a=!1,striped:t=!1,maxHeight:c,className:o,...b}){const i=c!==void 0,m=r.clsx(o,"table-container",s&&"table-container-bleed",i&&"table-container-scrollable"),h=i?{"--table-max-height":g(c)}:void 0,j=r.clsx("sds-table",s&&"table-bleed",l&&"table-dense",a&&"table-grid",t&&"sds-table-striped");return e.jsx("div",{className:m,style:h,children:e.jsx(n.Table,{className:j,...b})})}function d({align:s="start",className:l,...a}){const t=r.clsx(l,"table-column",`table-align-${s}`);return e.jsx(n.Column,{className:t,...a,children:({allowsSorting:c,sortDirection:o})=>e.jsx("div",{className:r.clsx("table-column-inner"),children:e.jsxs(e.Fragment,{children:[a.children,c&&e.jsx("span",{"aria-hidden":"true",className:r.clsx("sort-indicator",!o&&"sort-indicator-unsorted"),children:o==="descending"?e.jsx(N.IconChevronDown,{}):e.jsx(C.IconChevronUp,{})})]})})})}function f({className:s,...l}){return e.jsx(n.TableBody,{...l})}function v({className:s,columns:l,children:a,...t}){const{selectionBehavior:c,selectionMode:o,allowsDragging:b}=n.useTableOptions(),i=r.clsx(s,"table-head");return e.jsxs(n.TableHeader,{className:i,...t,children:[b&&e.jsx(d,{}),c==="toggle"&&e.jsx(d,{className:"table-selection-col",children:o==="multiple"&&e.jsx(n.Checkbox,{slot:"selection",className:"table-selection-checkbox",children:e.jsx(u.Checkbox,{})})}),e.jsx(n.Collection,{items:l,children:a})]})}function p({id:s,columns:l,children:a,className:t,...c}){const{selectionBehavior:o,allowsDragging:b}=n.useTableOptions(),i=r.clsx(t,"table-row");return e.jsxs(n.Row,{id:s,...c,className:i,children:[b&&e.jsx(x,{children:e.jsx(n.Button,{slot:"drag",children:"≡"})}),o==="toggle"&&e.jsx(x,{className:"table-selection-cell",children:e.jsx(n.Checkbox,{slot:"selection",className:"table-selection-checkbox",children:e.jsx(u.Checkbox,{})})}),e.jsx(n.Collection,{items:l,children:a})]})}function x({align:s="start",className:l,...a}){const t=r.clsx(l,"table-cell",`table-align-${s}`);return e.jsx(n.Cell,{className:t,...a})}exports.Table=T;exports.TableBody=f;exports.TableCell=x;exports.TableColumn=d;exports.TableHead=v;exports.TableRow=p;
2
2
  //# sourceMappingURL=Table.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.cjs","sources":["../../../../../src/ui/primitives/Table/Table.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconChevronDown, IconChevronUp } from \"icons\";\nimport { Checkbox } from \"primitives\";\nimport {\n Button as RACButton,\n Cell as RACCell,\n Checkbox as RACSelectionCheckbox,\n Collection as RACCollection,\n Column as RACColumn,\n Row as RACRow,\n Table as RACTable,\n TableBody as RACTableBody,\n TableHeader as RACTableHeader,\n useTableOptions,\n type CellProps as RACCellProps,\n type ColumnProps as RACColumnProps,\n type RowProps as RACRowProps,\n type TableBodyProps as RACTableBodyProps,\n type TableHeaderProps as RACTableHeaderProps,\n type TableProps as RACTableProps,\n} from \"react-aria-components\";\nimport \"./table.css\";\n\ntype TableAlign = \"start\" | \"center\" | \"right\";\n\nexport type TableProps = RACTableProps & {\n bleed?: boolean;\n dense?: boolean;\n grid?: boolean;\n striped?: boolean;\n};\nexport function Table({\n bleed = false,\n dense = false,\n grid = false,\n striped = false,\n className,\n ...props\n}: TableProps) {\n const containerClassNames = clsx(\n className,\n \"table-container\",\n bleed && \"table-container-bleed\",\n );\n const tableClassNames = clsx(\n \"sds-table\",\n bleed && \"table-bleed\",\n dense && \"table-dense\",\n grid && \"table-grid\",\n striped && \"sds-table-striped\",\n );\n return (\n <div className={containerClassNames}>\n <RACTable className={tableClassNames} {...props} />\n </div>\n );\n}\n\nexport type TableColumnProps = RACColumnProps & {\n align?: TableAlign;\n};\nexport function TableColumn({\n align = \"start\",\n className,\n ...props\n}: TableColumnProps) {\n const classNames = clsx(className, \"table-column\", `table-align-${align}`);\n return (\n <RACColumn className={classNames} {...props}>\n {({ allowsSorting, sortDirection }) => (\n <div className={clsx(\"table-column-inner\")}>\n <>\n {props.children}\n {allowsSorting && (\n <span aria-hidden=\"true\" className=\"sort-indicator\">\n {sortDirection === \"ascending\" ? (\n <IconChevronUp />\n ) : (\n <IconChevronDown />\n )}\n </span>\n )}\n </>\n </div>\n )}\n </RACColumn>\n );\n}\n\nexport type TableBodyProps<T> = RACTableBodyProps<T>;\nexport function TableBody<T extends object>({\n className,\n ...props\n}: TableBodyProps<T>) {\n return <RACTableBody {...props} />;\n}\n\nexport type TableHeadProps<T> = RACTableHeaderProps<T>;\nexport function TableHead<T extends object>({\n className,\n columns,\n children,\n ...props\n}: TableHeadProps<T>) {\n const { selectionBehavior, selectionMode, allowsDragging } =\n useTableOptions();\n const classNames = clsx(className, \"table-head\");\n return (\n <RACTableHeader className={classNames} {...props}>\n {/* Add extra columns for drag and drop and selection. */}\n {allowsDragging && <TableColumn />}\n {selectionBehavior === \"toggle\" && (\n <TableColumn className=\"table-selection-col\">\n {selectionMode === \"multiple\" && (\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n <Checkbox />\n </RACSelectionCheckbox>\n )}\n </TableColumn>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACTableHeader>\n );\n}\n\nexport type TableRowProps<T> = RACRowProps<T>;\nexport function TableRow<T extends object>({\n id,\n columns,\n children,\n className,\n ...otherProps\n}: TableRowProps<T>) {\n const { selectionBehavior, allowsDragging } = useTableOptions();\n const classNames = clsx(className, \"table-row\");\n return (\n <RACRow id={id} {...otherProps} className={classNames}>\n {allowsDragging && (\n <TableCell>\n <RACButton slot=\"drag\">≡</RACButton>\n </TableCell>\n )}\n {selectionBehavior === \"toggle\" && (\n <TableCell className=\"table-selection-cell\">\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n <Checkbox />\n </RACSelectionCheckbox>\n </TableCell>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACRow>\n );\n}\n\nexport type TableCellProps = RACCellProps & { align?: TableAlign };\nexport function TableCell({\n align = \"start\",\n className,\n ...props\n}: TableCellProps) {\n const classNames = clsx(className, \"table-cell\", `table-align-${align}`);\n return <RACCell className={classNames} {...props} />;\n}\n"],"names":["Table","bleed","dense","grid","striped","className","props","containerClassNames","clsx","tableClassNames","jsx","RACTable","TableColumn","align","classNames","RACColumn","allowsSorting","sortDirection","jsxs","Fragment","IconChevronUp","IconChevronDown","TableBody","RACTableBody","TableHead","columns","children","selectionBehavior","selectionMode","allowsDragging","useTableOptions","RACTableHeader","RACSelectionCheckbox","Checkbox","RACCollection","TableRow","id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CACjB,MAAMQ,EAAaN,EAAAA,KAAKH,EAAW,aAAc,eAAeQ,CAAK,EAAE,EACvE,OAAOH,EAAAA,IAAC+B,EAAAA,KAAA,CAAQ,UAAW3B,EAAa,GAAGR,EAAO,CACpD"}
1
+ {"version":3,"file":"Table.cjs","sources":["../../../../../src/ui/primitives/Table/Table.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconChevronDown, IconChevronUp } from \"icons\";\nimport type { CSSProperties } from \"react\";\nimport { Checkbox } from \"primitives\";\nimport {\n Button as RACButton,\n Cell as RACCell,\n Checkbox as RACSelectionCheckbox,\n Collection as RACCollection,\n Column as RACColumn,\n Row as RACRow,\n Table as RACTable,\n TableBody as RACTableBody,\n TableHeader as RACTableHeader,\n useTableOptions,\n type CellProps as RACCellProps,\n type ColumnProps as RACColumnProps,\n type RowProps as RACRowProps,\n type TableBodyProps as RACTableBodyProps,\n type TableHeaderProps as RACTableHeaderProps,\n type TableProps as RACTableProps,\n} from \"react-aria-components\";\nimport \"./table.css\";\n\ntype TableAlign = \"start\" | \"center\" | \"right\";\n\nfunction toCssLength(value: number | string): string {\n const numericValue = Number(value);\n const isUnitlessNumber =\n `${value}`.trim() !== \"\" && Number.isFinite(numericValue);\n return isUnitlessNumber ? `${numericValue}px` : `${value}`;\n}\n\nexport type TableProps = RACTableProps & {\n bleed?: boolean;\n dense?: boolean;\n grid?: boolean;\n striped?: boolean;\n maxHeight?: number | string;\n};\nexport function Table({\n bleed = false,\n dense = false,\n grid = false,\n striped = false,\n maxHeight,\n className,\n ...props\n}: TableProps) {\n const scrollsVertically = maxHeight !== undefined;\n const containerClassNames = clsx(\n className,\n \"table-container\",\n bleed && \"table-container-bleed\",\n scrollsVertically && \"table-container-scrollable\",\n );\n const containerStyle = scrollsVertically\n ? ({ \"--table-max-height\": toCssLength(maxHeight) } as CSSProperties)\n : undefined;\n const tableClassNames = clsx(\n \"sds-table\",\n bleed && \"table-bleed\",\n dense && \"table-dense\",\n grid && \"table-grid\",\n striped && \"sds-table-striped\",\n );\n return (\n <div className={containerClassNames} style={containerStyle}>\n <RACTable className={tableClassNames} {...props} />\n </div>\n );\n}\n\nexport type TableColumnProps = RACColumnProps & {\n align?: TableAlign;\n};\nexport function TableColumn({\n align = \"start\",\n className,\n ...props\n}: TableColumnProps) {\n const classNames = clsx(className, \"table-column\", `table-align-${align}`);\n return (\n <RACColumn className={classNames} {...props}>\n {({ allowsSorting, sortDirection }) => (\n <div className={clsx(\"table-column-inner\")}>\n <>\n {props.children}\n {allowsSorting && (\n <span\n aria-hidden=\"true\"\n className={clsx(\n \"sort-indicator\",\n !sortDirection && \"sort-indicator-unsorted\",\n )}\n >\n {sortDirection === \"descending\" ? (\n <IconChevronDown />\n ) : (\n <IconChevronUp />\n )}\n </span>\n )}\n </>\n </div>\n )}\n </RACColumn>\n );\n}\n\nexport type TableBodyProps<T> = RACTableBodyProps<T>;\nexport function TableBody<T extends object>({\n className,\n ...props\n}: TableBodyProps<T>) {\n return <RACTableBody {...props} />;\n}\n\nexport type TableHeadProps<T> = RACTableHeaderProps<T>;\nexport function TableHead<T extends object>({\n className,\n columns,\n children,\n ...props\n}: TableHeadProps<T>) {\n const { selectionBehavior, selectionMode, allowsDragging } =\n useTableOptions();\n const classNames = clsx(className, \"table-head\");\n return (\n <RACTableHeader className={classNames} {...props}>\n {/* Add extra columns for drag and drop and selection. */}\n {allowsDragging && <TableColumn />}\n {selectionBehavior === \"toggle\" && (\n <TableColumn className=\"table-selection-col\">\n {selectionMode === \"multiple\" && (\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n <Checkbox />\n </RACSelectionCheckbox>\n )}\n </TableColumn>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACTableHeader>\n );\n}\n\nexport type TableRowProps<T> = RACRowProps<T>;\nexport function TableRow<T extends object>({\n id,\n columns,\n children,\n className,\n ...otherProps\n}: TableRowProps<T>) {\n const { selectionBehavior, allowsDragging } = useTableOptions();\n const classNames = clsx(className, \"table-row\");\n return (\n <RACRow id={id} {...otherProps} className={classNames}>\n {allowsDragging && (\n <TableCell>\n <RACButton slot=\"drag\">≡</RACButton>\n </TableCell>\n )}\n {selectionBehavior === \"toggle\" && (\n <TableCell className=\"table-selection-cell\">\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n <Checkbox />\n </RACSelectionCheckbox>\n </TableCell>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACRow>\n );\n}\n\nexport type TableCellProps = RACCellProps & { align?: TableAlign };\nexport function TableCell({\n align = \"start\",\n className,\n ...props\n}: TableCellProps) {\n const classNames = clsx(className, \"table-cell\", `table-align-${align}`);\n return <RACCell className={classNames} {...props} />;\n}\n"],"names":["toCssLength","value","numericValue","Table","bleed","dense","grid","striped","maxHeight","className","props","scrollsVertically","containerClassNames","clsx","containerStyle","tableClassNames","jsx","RACTable","TableColumn","align","classNames","RACColumn","allowsSorting","sortDirection","jsxs","Fragment","IconChevronDown","IconChevronUp","TableBody","RACTableBody","TableHead","columns","children","selectionBehavior","selectionMode","allowsDragging","useTableOptions","RACTableHeader","RACSelectionCheckbox","Checkbox","RACCollection","TableRow","id","otherProps","RACRow","TableCell","RACButton","RACCell"],"mappings":"uWA0BA,SAASA,EAAYC,EAAgC,CACnD,MAAMC,EAAe,OAAOD,CAAK,EAGjC,MADE,GAAGA,CAAK,GAAG,SAAW,IAAM,OAAO,SAASC,CAAY,EAChC,GAAGA,CAAY,KAAO,GAAGD,CAAK,EAC1D,CASO,SAASE,EAAM,CACpB,MAAAC,EAAQ,GACR,MAAAC,EAAQ,GACR,KAAAC,EAAO,GACP,QAAAC,EAAU,GACV,UAAAC,EACA,UAAAC,EACA,GAAGC,CACL,EAAe,CACb,MAAMC,EAAoBH,IAAc,OAClCI,EAAsBC,EAAAA,KAC1BJ,EACA,kBACAL,GAAS,wBACTO,GAAqB,4BAAA,EAEjBG,EAAiBH,EAClB,CAAE,qBAAsBX,EAAYQ,CAAS,GAC9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
- import { jsx as e, jsxs as m, Fragment as g } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as m, Fragment as T } from "react/jsx-runtime";
2
2
  import { clsx as c } from "../../../vendor/clsx/dist/clsx.js";
3
- import { Table as C, Column as T, TableBody as p, useTableOptions as h, TableHeader as x, Checkbox as u, Collection as N, Row as v, Button as w, Cell as B } from "react-aria-components";
3
+ import { Table as x, Column as $, TableBody as v, useTableOptions as h, TableHeader as w, Checkbox as u, Collection as N, Row as y, Button as B, Cell as k } from "react-aria-components";
4
4
  /* empty css */
5
- import { IconChevronUp as k } from "../../icons/IconChevronUp.js";
6
- import { IconChevronDown as $ } from "../../icons/IconChevronDown.js";
5
+ import { IconChevronDown as U } from "../../icons/IconChevronDown.js";
6
+ import { IconChevronUp as j } from "../../icons/IconChevronUp.js";
7
7
  import { Checkbox as f } from "../Checkbox/Checkbox.js";
8
- function M({
8
+ function D(l) {
9
+ const s = Number(l);
10
+ return `${l}`.trim() !== "" && Number.isFinite(s) ? `${s}px` : `${l}`;
11
+ }
12
+ function O({
9
13
  bleed: l = !1,
10
- dense: a = !1,
11
- grid: s = !1,
12
- striped: n = !1,
13
- className: t,
14
- ...o
14
+ dense: s = !1,
15
+ grid: a = !1,
16
+ striped: t = !1,
17
+ maxHeight: n,
18
+ className: o,
19
+ ...r
15
20
  }) {
16
- const r = c(
17
- t,
21
+ const i = n !== void 0, g = c(
22
+ o,
18
23
  "table-container",
19
- l && "table-container-bleed"
20
- ), i = c(
24
+ l && "table-container-bleed",
25
+ i && "table-container-scrollable"
26
+ ), C = i ? { "--table-max-height": D(n) } : void 0, p = c(
21
27
  "sds-table",
22
28
  l && "table-bleed",
23
- a && "table-dense",
24
- s && "table-grid",
25
- n && "sds-table-striped"
29
+ s && "table-dense",
30
+ a && "table-grid",
31
+ t && "sds-table-striped"
26
32
  );
27
- return /* @__PURE__ */ e("div", { className: r, children: /* @__PURE__ */ e(C, { className: i, ...o }) });
33
+ return /* @__PURE__ */ e("div", { className: g, style: C, children: /* @__PURE__ */ e(x, { className: p, ...r }) });
28
34
  }
29
35
  function b({
30
36
  align: l = "start",
31
- className: a,
32
- ...s
37
+ className: s,
38
+ ...a
33
39
  }) {
34
- const n = c(a, "table-column", `table-align-${l}`);
35
- return /* @__PURE__ */ e(T, { className: n, ...s, children: ({ allowsSorting: t, sortDirection: o }) => /* @__PURE__ */ e("div", { className: c("table-column-inner"), children: /* @__PURE__ */ m(g, { children: [
36
- s.children,
37
- t && /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "sort-indicator", children: o === "ascending" ? /* @__PURE__ */ e(k, {}) : /* @__PURE__ */ e($, {}) })
40
+ const t = c(s, "table-column", `table-align-${l}`);
41
+ return /* @__PURE__ */ e($, { className: t, ...a, children: ({ allowsSorting: n, sortDirection: o }) => /* @__PURE__ */ e("div", { className: c("table-column-inner"), children: /* @__PURE__ */ m(T, { children: [
42
+ a.children,
43
+ n && /* @__PURE__ */ e(
44
+ "span",
45
+ {
46
+ "aria-hidden": "true",
47
+ className: c(
48
+ "sort-indicator",
49
+ !o && "sort-indicator-unsorted"
50
+ ),
51
+ children: o === "descending" ? /* @__PURE__ */ e(U, {}) : /* @__PURE__ */ e(j, {})
52
+ }
53
+ )
38
54
  ] }) }) });
39
55
  }
40
- function O({
56
+ function S({
41
57
  className: l,
42
- ...a
58
+ ...s
43
59
  }) {
44
- return /* @__PURE__ */ e(p, { ...a });
60
+ return /* @__PURE__ */ e(v, { ...s });
45
61
  }
46
- function U({
62
+ function q({
47
63
  className: l,
48
- columns: a,
49
- children: s,
50
- ...n
64
+ columns: s,
65
+ children: a,
66
+ ...t
51
67
  }) {
52
- const { selectionBehavior: t, selectionMode: o, allowsDragging: r } = h(), i = c(l, "table-head");
53
- return /* @__PURE__ */ m(x, { className: i, ...n, children: [
68
+ const { selectionBehavior: n, selectionMode: o, allowsDragging: r } = h(), i = c(l, "table-head");
69
+ return /* @__PURE__ */ m(w, { className: i, ...t, children: [
54
70
  r && /* @__PURE__ */ e(b, {}),
55
- t === "toggle" && /* @__PURE__ */ e(b, { className: "table-selection-col", children: o === "multiple" && /* @__PURE__ */ e(u, { slot: "selection", className: "table-selection-checkbox", children: /* @__PURE__ */ e(f, {}) }) }),
56
- /* @__PURE__ */ e(N, { items: a, children: s })
71
+ n === "toggle" && /* @__PURE__ */ e(b, { className: "table-selection-col", children: o === "multiple" && /* @__PURE__ */ e(u, { slot: "selection", className: "table-selection-checkbox", children: /* @__PURE__ */ e(f, {}) }) }),
72
+ /* @__PURE__ */ e(N, { items: s, children: a })
57
73
  ] });
58
74
  }
59
- function q({
75
+ function z({
60
76
  id: l,
61
- columns: a,
62
- children: s,
63
- className: n,
64
- ...t
77
+ columns: s,
78
+ children: a,
79
+ className: t,
80
+ ...n
65
81
  }) {
66
- const { selectionBehavior: o, allowsDragging: r } = h(), i = c(n, "table-row");
67
- return /* @__PURE__ */ m(v, { id: l, ...t, className: i, children: [
68
- r && /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(w, { slot: "drag", children: "≡" }) }),
82
+ const { selectionBehavior: o, allowsDragging: r } = h(), i = c(t, "table-row");
83
+ return /* @__PURE__ */ m(y, { id: l, ...n, className: i, children: [
84
+ r && /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(B, { slot: "drag", children: "≡" }) }),
69
85
  o === "toggle" && /* @__PURE__ */ e(d, { className: "table-selection-cell", children: /* @__PURE__ */ e(u, { slot: "selection", className: "table-selection-checkbox", children: /* @__PURE__ */ e(f, {}) }) }),
70
- /* @__PURE__ */ e(N, { items: a, children: s })
86
+ /* @__PURE__ */ e(N, { items: s, children: a })
71
87
  ] });
72
88
  }
73
89
  function d({
74
90
  align: l = "start",
75
- className: a,
76
- ...s
91
+ className: s,
92
+ ...a
77
93
  }) {
78
- const n = c(a, "table-cell", `table-align-${l}`);
79
- return /* @__PURE__ */ e(B, { className: n, ...s });
94
+ const t = c(s, "table-cell", `table-align-${l}`);
95
+ return /* @__PURE__ */ e(k, { className: t, ...a });
80
96
  }
81
97
  export {
82
- M as Table,
83
- O as TableBody,
98
+ O as Table,
99
+ S as TableBody,
84
100
  d as TableCell,
85
101
  b as TableColumn,
86
- U as TableHead,
87
- q as TableRow
102
+ q as TableHead,
103
+ z as TableRow
88
104
  };
89
105
  //# sourceMappingURL=Table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sources":["../../../../../src/ui/primitives/Table/Table.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconChevronDown, IconChevronUp } from \"icons\";\nimport { Checkbox } from \"primitives\";\nimport {\n Button as RACButton,\n Cell as RACCell,\n Checkbox as RACSelectionCheckbox,\n Collection as RACCollection,\n Column as RACColumn,\n Row as RACRow,\n Table as RACTable,\n TableBody as RACTableBody,\n TableHeader as RACTableHeader,\n useTableOptions,\n type CellProps as RACCellProps,\n type ColumnProps as RACColumnProps,\n type RowProps as RACRowProps,\n type TableBodyProps as RACTableBodyProps,\n type TableHeaderProps as RACTableHeaderProps,\n type TableProps as RACTableProps,\n} from \"react-aria-components\";\nimport \"./table.css\";\n\ntype TableAlign = \"start\" | \"center\" | \"right\";\n\nexport type TableProps = RACTableProps & {\n bleed?: boolean;\n dense?: boolean;\n grid?: boolean;\n striped?: boolean;\n};\nexport function Table({\n bleed = false,\n dense = false,\n grid = false,\n striped = false,\n className,\n ...props\n}: TableProps) {\n const containerClassNames = clsx(\n className,\n \"table-container\",\n bleed && \"table-container-bleed\",\n );\n const tableClassNames = clsx(\n \"sds-table\",\n bleed && \"table-bleed\",\n dense && \"table-dense\",\n grid && \"table-grid\",\n striped && \"sds-table-striped\",\n );\n return (\n <div className={containerClassNames}>\n <RACTable className={tableClassNames} {...props} />\n </div>\n );\n}\n\nexport type TableColumnProps = RACColumnProps & {\n align?: TableAlign;\n};\nexport function TableColumn({\n align = \"start\",\n className,\n ...props\n}: TableColumnProps) {\n const classNames = clsx(className, \"table-column\", `table-align-${align}`);\n return (\n <RACColumn className={classNames} {...props}>\n {({ allowsSorting, sortDirection }) => (\n <div className={clsx(\"table-column-inner\")}>\n <>\n {props.children}\n {allowsSorting && (\n <span aria-hidden=\"true\" className=\"sort-indicator\">\n {sortDirection === \"ascending\" ? (\n <IconChevronUp />\n ) : (\n <IconChevronDown />\n )}\n </span>\n )}\n </>\n </div>\n )}\n </RACColumn>\n );\n}\n\nexport type TableBodyProps<T> = RACTableBodyProps<T>;\nexport function TableBody<T extends object>({\n className,\n ...props\n}: TableBodyProps<T>) {\n return <RACTableBody {...props} />;\n}\n\nexport type TableHeadProps<T> = RACTableHeaderProps<T>;\nexport function TableHead<T extends object>({\n className,\n columns,\n children,\n ...props\n}: TableHeadProps<T>) {\n const { selectionBehavior, selectionMode, allowsDragging } =\n useTableOptions();\n const classNames = clsx(className, \"table-head\");\n return (\n <RACTableHeader className={classNames} {...props}>\n {/* Add extra columns for drag and drop and selection. */}\n {allowsDragging && <TableColumn />}\n {selectionBehavior === \"toggle\" && (\n <TableColumn className=\"table-selection-col\">\n {selectionMode === \"multiple\" && (\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n <Checkbox />\n </RACSelectionCheckbox>\n )}\n </TableColumn>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACTableHeader>\n );\n}\n\nexport type TableRowProps<T> = RACRowProps<T>;\nexport function TableRow<T extends object>({\n id,\n columns,\n children,\n className,\n ...otherProps\n}: TableRowProps<T>) {\n const { selectionBehavior, allowsDragging } = useTableOptions();\n const classNames = clsx(className, \"table-row\");\n return (\n <RACRow id={id} {...otherProps} className={classNames}>\n {allowsDragging && (\n <TableCell>\n <RACButton slot=\"drag\">≡</RACButton>\n </TableCell>\n )}\n {selectionBehavior === \"toggle\" && (\n <TableCell className=\"table-selection-cell\">\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n <Checkbox />\n </RACSelectionCheckbox>\n </TableCell>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACRow>\n );\n}\n\nexport type TableCellProps = RACCellProps & { align?: TableAlign };\nexport function TableCell({\n align = \"start\",\n className,\n ...props\n}: TableCellProps) {\n const classNames = clsx(className, \"table-cell\", `table-align-${align}`);\n return <RACCell className={classNames} {...props} />;\n}\n"],"names":["Table","bleed","dense","grid","striped","className","props","containerClassNames","clsx","tableClassNames","jsx","RACTable","TableColumn","align","classNames","RACColumn","allowsSorting","sortDirection","jsxs","Fragment","IconChevronUp","IconChevronDown","TableBody","RACTableBody","TableHead","columns","children","selectionBehavior","selectionMode","allowsDragging","useTableOptions","RACTableHeader","RACSelectionCheckbox","Checkbox","RACCollection","TableRow","id","otherProps","RACRow","TableCell","RACButton","RACCell"],"mappings":";;;;;;;AA+BO,SAASA,EAAM;AAAA,EACpB,OAAAC,IAAQ;AAAA,EACR,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AAAA,EACP,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,GAAGC;AACL,GAAe;AACb,QAAMC,IAAsBC;AAAA,IAC1BH;AAAA,IACA;AAAA,IACAJ,KAAS;AAAA,EAAA,GAELQ,IAAkBD;AAAA,IACtB;AAAA,IACAP,KAAS;AAAA,IACTC,KAAS;AAAA,IACTC,KAAQ;AAAA,IACRC,KAAW;AAAA,EAAA;AAEb,SACE,gBAAAM,EAAC,OAAA,EAAI,WAAWH,GACd,UAAA,gBAAAG,EAACC,KAAS,WAAWF,GAAkB,GAAGH,EAAA,CAAO,EAAA,CACnD;AAEJ;AAKO,SAASM,EAAY;AAAA,EAC1B,OAAAC,IAAQ;AAAA,EACR,WAAAR;AAAA,EACA,GAAGC;AACL,GAAqB;AACnB,QAAMQ,IAAaN,EAAKH,GAAW,gBAAgB,eAAeQ,CAAK,EAAE;AACzE,2BACGE,GAAA,EAAU,WAAWD,GAAa,GAAGR,GACnC,UAAA,CAAC,EAAE,eAAAU,GAAe,eAAAC,EAAA,MACjB,gBAAAP,EAAC,OAAA,EAAI,WAAWF,EAAK,oBAAoB,GACvC,UAAA,gBAAAU,EAAAC,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9C,2BACGiC,GAAA,EAAO,IAAAF,GAAS,GAAGC,GAAY,WAAWvB,GACxC,UAAA;AAAA,IAAAe,uBACEU,GAAA,EACC,UAAA,gBAAA7B,EAAC8B,KAAU,MAAK,QAAO,eAAC,EAAA,CAC1B;AAAA,IAEDb,MAAsB,YACrB,gBAAAjB,EAAC6B,GAAA,EAAU,WAAU,wBACnB,UAAA,gBAAA7B,EAACsB,GAAA,EAAqB,MAAK,aAAY,WAAU,4BAC/C,UAAA,gBAAAtB,EAACuB,GAAA,CAAA,CAAS,GACZ,GACF;AAAA,IAEF,gBAAAvB,EAACwB,GAAA,EAAc,OAAOT,GAAU,UAAAC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;AAGO,SAASa,EAAU;AAAA,EACxB,OAAA1B,IAAQ;AAAA,EACR,WAAAR;AAAA,EACA,GAAGC;AACL,GAAmB;AACjB,QAAMQ,IAAaN,EAAKH,GAAW,cAAc,eAAeQ,CAAK,EAAE;AACvE,SAAO,gBAAAH,EAAC+B,GAAA,EAAQ,WAAW3B,GAAa,GAAGR,GAAO;AACpD;"}
1
+ {"version":3,"file":"Table.js","sources":["../../../../../src/ui/primitives/Table/Table.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconChevronDown, IconChevronUp } from \"icons\";\nimport type { CSSProperties } from \"react\";\nimport { Checkbox } from \"primitives\";\nimport {\n Button as RACButton,\n Cell as RACCell,\n Checkbox as RACSelectionCheckbox,\n Collection as RACCollection,\n Column as RACColumn,\n Row as RACRow,\n Table as RACTable,\n TableBody as RACTableBody,\n TableHeader as RACTableHeader,\n useTableOptions,\n type CellProps as RACCellProps,\n type ColumnProps as RACColumnProps,\n type RowProps as RACRowProps,\n type TableBodyProps as RACTableBodyProps,\n type TableHeaderProps as RACTableHeaderProps,\n type TableProps as RACTableProps,\n} from \"react-aria-components\";\nimport \"./table.css\";\n\ntype TableAlign = \"start\" | \"center\" | \"right\";\n\nfunction toCssLength(value: number | string): string {\n const numericValue = Number(value);\n const isUnitlessNumber =\n `${value}`.trim() !== \"\" && Number.isFinite(numericValue);\n return isUnitlessNumber ? `${numericValue}px` : `${value}`;\n}\n\nexport type TableProps = RACTableProps & {\n bleed?: boolean;\n dense?: boolean;\n grid?: boolean;\n striped?: boolean;\n maxHeight?: number | string;\n};\nexport function Table({\n bleed = false,\n dense = false,\n grid = false,\n striped = false,\n maxHeight,\n className,\n ...props\n}: TableProps) {\n const scrollsVertically = maxHeight !== undefined;\n const containerClassNames = clsx(\n className,\n \"table-container\",\n bleed && \"table-container-bleed\",\n scrollsVertically && \"table-container-scrollable\",\n );\n const containerStyle = scrollsVertically\n ? ({ \"--table-max-height\": toCssLength(maxHeight) } as CSSProperties)\n : undefined;\n const tableClassNames = clsx(\n \"sds-table\",\n bleed && \"table-bleed\",\n dense && \"table-dense\",\n grid && \"table-grid\",\n striped && \"sds-table-striped\",\n );\n return (\n <div className={containerClassNames} style={containerStyle}>\n <RACTable className={tableClassNames} {...props} />\n </div>\n );\n}\n\nexport type TableColumnProps = RACColumnProps & {\n align?: TableAlign;\n};\nexport function TableColumn({\n align = \"start\",\n className,\n ...props\n}: TableColumnProps) {\n const classNames = clsx(className, \"table-column\", `table-align-${align}`);\n return (\n <RACColumn className={classNames} {...props}>\n {({ allowsSorting, sortDirection }) => (\n <div className={clsx(\"table-column-inner\")}>\n <>\n {props.children}\n {allowsSorting && (\n <span\n aria-hidden=\"true\"\n className={clsx(\n \"sort-indicator\",\n !sortDirection && \"sort-indicator-unsorted\",\n )}\n >\n {sortDirection === \"descending\" ? (\n <IconChevronDown />\n ) : (\n <IconChevronUp />\n )}\n </span>\n )}\n </>\n </div>\n )}\n </RACColumn>\n );\n}\n\nexport type TableBodyProps<T> = RACTableBodyProps<T>;\nexport function TableBody<T extends object>({\n className,\n ...props\n}: TableBodyProps<T>) {\n return <RACTableBody {...props} />;\n}\n\nexport type TableHeadProps<T> = RACTableHeaderProps<T>;\nexport function TableHead<T extends object>({\n className,\n columns,\n children,\n ...props\n}: TableHeadProps<T>) {\n const { selectionBehavior, selectionMode, allowsDragging } =\n useTableOptions();\n const classNames = clsx(className, \"table-head\");\n return (\n <RACTableHeader className={classNames} {...props}>\n {/* Add extra columns for drag and drop and selection. */}\n {allowsDragging && <TableColumn />}\n {selectionBehavior === \"toggle\" && (\n <TableColumn className=\"table-selection-col\">\n {selectionMode === \"multiple\" && (\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n <Checkbox />\n </RACSelectionCheckbox>\n )}\n </TableColumn>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACTableHeader>\n );\n}\n\nexport type TableRowProps<T> = RACRowProps<T>;\nexport function TableRow<T extends object>({\n id,\n columns,\n children,\n className,\n ...otherProps\n}: TableRowProps<T>) {\n const { selectionBehavior, allowsDragging } = useTableOptions();\n const classNames = clsx(className, \"table-row\");\n return (\n <RACRow id={id} {...otherProps} className={classNames}>\n {allowsDragging && (\n <TableCell>\n <RACButton slot=\"drag\">≡</RACButton>\n </TableCell>\n )}\n {selectionBehavior === \"toggle\" && (\n <TableCell className=\"table-selection-cell\">\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n <Checkbox />\n </RACSelectionCheckbox>\n </TableCell>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACRow>\n );\n}\n\nexport type TableCellProps = RACCellProps & { align?: TableAlign };\nexport function TableCell({\n align = \"start\",\n className,\n ...props\n}: TableCellProps) {\n const classNames = clsx(className, \"table-cell\", `table-align-${align}`);\n return <RACCell className={classNames} {...props} />;\n}\n"],"names":["toCssLength","value","numericValue","Table","bleed","dense","grid","striped","maxHeight","className","props","scrollsVertically","containerClassNames","clsx","containerStyle","tableClassNames","jsx","RACTable","TableColumn","align","classNames","RACColumn","allowsSorting","sortDirection","jsxs","Fragment","IconChevronDown","IconChevronUp","TableBody","RACTableBody","TableHead","columns","children","selectionBehavior","selectionMode","allowsDragging","useTableOptions","RACTableHeader","RACSelectionCheckbox","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,GACxChB,IAAaP,EAAKJ,GAAW,WAAW;AAC9C,2BACGmC,GAAA,EAAO,IAAAF,GAAS,GAAGC,GAAY,WAAWvB,GACxC,UAAA;AAAA,IAAAe,uBACEU,GAAA,EACC,UAAA,gBAAA7B,EAAC8B,KAAU,MAAK,QAAO,eAAC,EAAA,CAC1B;AAAA,IAEDb,MAAsB,YACrB,gBAAAjB,EAAC6B,GAAA,EAAU,WAAU,wBACnB,UAAA,gBAAA7B,EAACsB,GAAA,EAAqB,MAAK,aAAY,WAAU,4BAC/C,UAAA,gBAAAtB,EAACuB,GAAA,CAAA,CAAS,GACZ,GACF;AAAA,IAEF,gBAAAvB,EAACwB,GAAA,EAAc,OAAOT,GAAU,UAAAC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;AAGO,SAASa,EAAU;AAAA,EACxB,OAAA1B,IAAQ;AAAA,EACR,WAAAV;AAAA,EACA,GAAGC;AACL,GAAmB;AACjB,QAAMU,IAAaP,EAAKJ,GAAW,cAAc,eAAeU,CAAK,EAAE;AACvE,SAAO,gBAAAH,EAAC+B,GAAA,EAAQ,WAAW3B,GAAa,GAAGV,GAAO;AACpD;"}
@@ -1,3 +1,5 @@
1
1
  export * from "./ui/components/charts/BarChart/BarChart";
2
2
  export * from "./ui/components/charts/chart-palette";
3
+ export * from "./ui/components/charts/ChartColorPicker/ChartColorPicker";
4
+ export * from "./ui/components/charts/ChartLegend/ChartLegend";
3
5
  export * from "./ui/components/charts/TimeSeriesChart/TimeSeriesChart";