@apipass/design-system 8.1.0 → 8.3.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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),L=require("../../../../vendor/clsx/dist/clsx.cjs"),S=require("react"),M=require("../useChartInstance.cjs"),N=require("../ChartLegend/ChartLegend.cjs"),P=require("../ChartLegend/use-chart-legend.cjs"),b=require("./time-series-option.cjs");;/* empty css */const E={},R={};function Y({series:r,displayType:t="line",legend:h="inline",line:n=R,yAxis:o=E,showSymbols:c=!1,showValueLabels:a=!1,valueFormatter:l,onSeriesColorChange:C,legendLabels:f,className:m,...I}){const{containerRef:O,chart:s,theme:e,resolveSeriesColor:T}=M.useChartInstance(),{items:q,colorsBySeriesId:u,colorTokensBySeriesId:_,hiddenSeriesIds:d,toggleSeries:v}=P.useChartLegend(r,(e==null?void 0:e.seriesColors)??[],T),g=S.useMemo(()=>r.filter(x=>!d.has(x.id)),[r,d]);S.useEffect(()=>{!s||!e||s.setOption(b.buildTimeSeriesOption({series:g,displayType:t,line:n,yAxis:o,theme:e,showSymbols:c,showValueLabels:a,seriesColorOverrides:u,valueFormatter:l}),{notMerge:!0})},[s,e,g,t,n,o,c,a,u,l]);const j=h!=="none"&&r.length>0;return i.jsxs("div",{className:L.clsx("time-series-chart",m),...I,children:[j&&i.jsx(N.ChartLegend,{items:q,onToggle:v,onColorChange:C,colorTokensBySeriesId:_,labels:f}),i.jsx("div",{ref:O,className:"time-series-chart__canvas"})]})}exports.TimeSeriesChart=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),j=require("../../../../vendor/clsx/dist/clsx.cjs"),h=require("react"),E=require("../useChartInstance.cjs"),L=require("../ChartLegend/ChartLegend.cjs"),b=require("../ChartLegend/use-chart-legend.cjs"),Y=require("./time-series-option.cjs");;/* empty css */const x={},R={},X={};function p({series:r,displayType:i="line",legend:C="inline",line:n=X,xAxis:o=x,yAxis:c=R,showSymbols:a=!1,showValueLabels:l=!1,valueFormatter:u,onSeriesColorChange:I,legendLabels:O,className:T,...f}){const{containerRef:_,chart:s,theme:e,resolveSeriesColor:m}=E.useChartInstance(),{items:q,colorsBySeriesId:d,colorTokensBySeriesId:P,hiddenSeriesIds:S,toggleSeries:v}=b.useChartLegend(r,(e==null?void 0:e.seriesColors)??[],m),g=h.useMemo(()=>r.filter(N=>!S.has(N.id)),[r,S]);h.useEffect(()=>{!s||!e||s.setOption(Y.buildTimeSeriesOption({series:g,displayType:i,line:n,xAxis:o,yAxis:c,theme:e,showSymbols:a,showValueLabels:l,seriesColorOverrides:d,valueFormatter:u}),{notMerge:!0})},[s,e,g,i,n,o,c,a,l,d,u]);const M=C!=="none"&&r.length>0;return t.jsxs("div",{className:j.clsx("time-series-chart",T),...f,children:[M&&t.jsx(L.ChartLegend,{items:q,onToggle:v,onColorChange:I,colorTokensBySeriesId:P,labels:O}),t.jsx("div",{ref:_,className:"time-series-chart__canvas"})]})}exports.TimeSeriesChart=p;
2
2
  //# sourceMappingURL=TimeSeriesChart.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"TimeSeriesChart.cjs","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":"0YAyCA,MAAMA,EAA+C,CAAA,EAE/CC,EAA4C,CAAA,EAE3C,SAASC,EAAgB,CAC9B,OAAAC,EACA,YAAAC,EAAc,OACd,OAAAC,EAAS,SACT,KAAAC,EAAOL,EACP,MAAAM,EAAQP,EACR,YAAAQ,EAAc,GACd,gBAAAC,EAAkB,GAClB,eAAAC,EACA,oBAAAC,EACA,aAAAC,EACA,UAAAC,EACA,GAAGC,CACL,EAAyB,CACvB,KAAM,CAAE,aAAAC,EAAc,MAAAC,EAAO,MAAAC,EAAO,mBAAAC,CAAA,EAAsCC,EAAAA,iBAAA,EAEpE,CACJ,MAAAC,EACA,iBAAAC,EACA,sBAAAC,EACA,gBAAAC,EACA,aAAAC,CAAA,EAEAC,EAAAA,eAAetB,GAAQc,GAAA,YAAAA,EAAO,eAAgB,CAAA,EAAIC,CAAkB,EAIhEQ,EAAkCC,EAAAA,QACtC,IAAMxB,EAAO,OAAQyB,GAAyB,CAACL,EAAgB,IAAIK,EAAK,EAAE,CAAC,EAC3E,CAACzB,EAAQoB,CAAe,CAAA,EAG1BM,EAAAA,UAAU,IAAM,CACV,CAACb,GAAS,CAACC,GAIfD,EAAM,UACJc,wBAAsB,CACpB,OAAQJ,EACR,YAAAtB,EACA,KAAAE,EACA,MAAAC,EACA,MAAAU,EACA,YAAAT,EACA,gBAAAC,EACA,qBAAsBY,EACtB,eAAAX,CAAA,CACD,EACD,CAAE,SAAU,EAAA,CAAK,CAErB,EAAG,CACDM,EACAC,EACAS,EACAtB,EACAE,EACAC,EACAC,EACAC,EACAY,EACAX,CAAA,CACD,EAED,MAAMqB,EAA2B1B,IAAW,QAAUF,EAAO,OAAS,EAEtE,OACE6B,EAAAA,KAAC,OAAI,UAAWC,EAAAA,KAAK,oBAAqBpB,CAAS,EAAI,GAAGC,EACvD,SAAA,CAAAiB,GACCG,EAAAA,IAACC,EAAAA,YAAA,CACC,MAAAf,EACA,SAAUI,EACV,cAAeb,EACf,sBAAAW,EACA,OAAQV,CAAA,CAAA,EAGZsB,EAAAA,IAAC,MAAA,CAAI,IAAKnB,EAAc,UAAU,2BAAA,CAA4B,CAAA,EAChE,CAEJ"}
1
+ {"version":3,"file":"TimeSeriesChart.cjs","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 TimeSeriesXAxisOptions,\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 TimeSeriesXAxisOptions,\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 xAxis?: TimeSeriesXAxisOptions;\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_X_AXIS_OPTIONS: TimeSeriesXAxisOptions = {};\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 xAxis = EMPTY_X_AXIS_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 xAxis,\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 xAxis,\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_X_AXIS_OPTIONS","EMPTY_Y_AXIS_OPTIONS","EMPTY_LINE_OPTIONS","TimeSeriesChart","series","displayType","legend","line","xAxis","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","cls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,EAAAA,YAAA,CACC,MAAAf,EACA,SAAUI,EACV,cAAeb,EACf,sBAAAW,EACA,OAAQV,CAAA,CAAA,EAGZsB,EAAAA,IAAC,MAAA,CAAI,IAAKnB,EAAc,UAAU,2BAAA,CAA4B,CAAA,EAChE,CAEJ"}
@@ -1,79 +1,82 @@
1
- import { jsxs as E, jsx as d } from "react/jsx-runtime";
1
+ import { jsxs as E, jsx as S } from "react/jsx-runtime";
2
2
  import { clsx as M } from "../../../../vendor/clsx/dist/clsx.js";
3
- import { useMemo as P, useEffect as x } from "react";
4
- import { useChartInstance as L } from "../useChartInstance.js";
5
- import { ChartLegend as Y } from "../ChartLegend/ChartLegend.js";
6
- import { useChartLegend as b } from "../ChartLegend/use-chart-legend.js";
7
- import { buildTimeSeriesOption as j } from "./time-series-option.js";
3
+ import { useMemo as Y, useEffect as L } from "react";
4
+ import { useChartInstance as X } from "../useChartInstance.js";
5
+ import { ChartLegend as b } from "../ChartLegend/ChartLegend.js";
6
+ import { useChartLegend as j } from "../ChartLegend/use-chart-legend.js";
7
+ import { buildTimeSeriesOption as B } from "./time-series-option.js";
8
8
  /* empty css */
9
- const B = {}, k = {};
10
- function J({
9
+ const k = {}, x = {}, R = {};
10
+ function Q({
11
11
  series: r,
12
- displayType: i = "line",
12
+ displayType: s = "line",
13
13
  legend: g = "inline",
14
- line: s = k,
15
- yAxis: t = B,
16
- showSymbols: n = !1,
17
- showValueLabels: c = !1,
18
- valueFormatter: m,
19
- onSeriesColorChange: S,
20
- legendLabels: h,
21
- className: p,
22
- ...C
14
+ line: i = R,
15
+ xAxis: t = k,
16
+ yAxis: n = x,
17
+ showSymbols: c = !1,
18
+ showValueLabels: m = !1,
19
+ valueFormatter: l,
20
+ onSeriesColorChange: I,
21
+ legendLabels: _,
22
+ className: h,
23
+ ...p
23
24
  }) {
24
- const { containerRef: I, chart: o, theme: e, resolveSeriesColor: u } = L(), {
25
- items: O,
26
- colorsBySeriesId: l,
27
- colorTokensBySeriesId: T,
28
- hiddenSeriesIds: f,
29
- toggleSeries: _
30
- } = b(r, (e == null ? void 0 : e.seriesColors) ?? [], u), a = P(
31
- () => r.filter((N) => !f.has(N.id)),
32
- [r, f]
25
+ const { containerRef: C, chart: o, theme: e, resolveSeriesColor: O } = X(), {
26
+ items: T,
27
+ colorsBySeriesId: f,
28
+ colorTokensBySeriesId: u,
29
+ hiddenSeriesIds: a,
30
+ toggleSeries: N
31
+ } = j(r, (e == null ? void 0 : e.seriesColors) ?? [], O), d = Y(
32
+ () => r.filter((v) => !a.has(v.id)),
33
+ [r, a]
33
34
  );
34
- x(() => {
35
+ L(() => {
35
36
  !o || !e || o.setOption(
36
- j({
37
- series: a,
38
- displayType: i,
39
- line: s,
40
- yAxis: t,
37
+ B({
38
+ series: d,
39
+ displayType: s,
40
+ line: i,
41
+ xAxis: t,
42
+ yAxis: n,
41
43
  theme: e,
42
- showSymbols: n,
43
- showValueLabels: c,
44
- seriesColorOverrides: l,
45
- valueFormatter: m
44
+ showSymbols: c,
45
+ showValueLabels: m,
46
+ seriesColorOverrides: f,
47
+ valueFormatter: l
46
48
  }),
47
49
  { notMerge: !0 }
48
50
  );
49
51
  }, [
50
52
  o,
51
53
  e,
52
- a,
53
- i,
54
+ d,
54
55
  s,
56
+ i,
55
57
  t,
56
58
  n,
57
59
  c,
58
- l,
59
- m
60
+ m,
61
+ f,
62
+ l
60
63
  ]);
61
- const v = g !== "none" && r.length > 0;
62
- return /* @__PURE__ */ E("div", { className: M("time-series-chart", p), ...C, children: [
63
- v && /* @__PURE__ */ d(
64
- Y,
64
+ const P = g !== "none" && r.length > 0;
65
+ return /* @__PURE__ */ E("div", { className: M("time-series-chart", h), ...p, children: [
66
+ P && /* @__PURE__ */ S(
67
+ b,
65
68
  {
66
- items: O,
67
- onToggle: _,
68
- onColorChange: S,
69
- colorTokensBySeriesId: T,
70
- labels: h
69
+ items: T,
70
+ onToggle: N,
71
+ onColorChange: I,
72
+ colorTokensBySeriesId: u,
73
+ labels: _
71
74
  }
72
75
  ),
73
- /* @__PURE__ */ d("div", { ref: I, className: "time-series-chart__canvas" })
76
+ /* @__PURE__ */ S("div", { ref: C, className: "time-series-chart__canvas" })
74
77
  ] });
75
78
  }
76
79
  export {
77
- J as TimeSeriesChart
80
+ Q as TimeSeriesChart
78
81
  };
79
82
  //# sourceMappingURL=TimeSeriesChart.js.map
@@ -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, 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
+ {"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 TimeSeriesXAxisOptions,\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 TimeSeriesXAxisOptions,\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 xAxis?: TimeSeriesXAxisOptions;\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_X_AXIS_OPTIONS: TimeSeriesXAxisOptions = {};\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 xAxis = EMPTY_X_AXIS_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 xAxis,\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 xAxis,\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_X_AXIS_OPTIONS","EMPTY_Y_AXIS_OPTIONS","EMPTY_LINE_OPTIONS","TimeSeriesChart","series","displayType","legend","line","xAxis","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":";;;;;;;;AA4CA,MAAMA,IAA+C,CAAA,GAE/CC,IAA+C,CAAA,GAE/CC,IAA4C,CAAA;AAE3C,SAASC,EAAgB;AAAA,EAC9B,QAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;A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AC,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 m={top:16,right:16,bottom:24,left:56},c=6,d=.15,u={thin:1,normal:2,thick:4},f="solid",y="normal",L=new Intl.DateTimeFormat(void 0,{year:"numeric"}),b=new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit"}),g=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}),h=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function S(t){const e=new Date(t);return e.getSeconds()!==0||e.getMilliseconds()!==0?h.format(e):e.getHours()!==0||e.getMinutes()!==0?g.format(e):e.getMonth()===0&&e.getDate()===1?L.format(e):b.format(e)}function n(t){const{valueFormatter:e}=t;if(e)return i=>i==null?"":e(i)}function p(t){const{showValueLabels:e,theme:i}=t,o=n(t);return{show:e,position:"top",color:i.labelColor,formatter:o?l=>o(l.value[1]):void 0}}function C(t,e,i){const o=t.points.map(r=>[r.timestamp,r.value]),l=p(e);return e.displayType==="bar"?{id:t.id,name:t.name,type:"bar",data:o,itemStyle:{color:i},label:l}:{id:t.id,name:t.name,type:"line",data:o,showSymbol:e.showSymbols,symbolSize:c,lineStyle:{color:i,type:e.line.style??f,width:u[e.line.width??y]},itemStyle:{color:i},areaStyle:e.displayType==="area"?{color:i,opacity:d}:void 0,label:l}}function T(t){const{series:e,yAxis:i,theme:o,seriesColorOverrides:l}=t,r=n(t);return{animation:!1,color:o.seriesColors,textStyle:{fontFamily:o.fontFamily,color:o.labelColor},grid:{...m,containLabel:!1},tooltip:{trigger:"axis",backgroundColor:o.tooltipBackgroundColor,borderColor:o.tooltipBorderColor,textStyle:{color:o.labelColor},valueFormatter:r},xAxis:{type:"time",axisLine:{lineStyle:{color:o.axisLineColor}},axisTick:{show:!1},axisLabel:{color:o.labelColor,hideOverlap:!0,formatter:S},splitLine:{show:!1}},yAxis:{type:i.scale==="log"?"log":"value",scale:i.includeZero!==!0,min:i.min,max:i.max,axisLine:{show:!1},axisLabel:{color:o.labelColor,formatter:r},splitLine:{lineStyle:{color:o.splitLineColor}}},series:e.map((s,a)=>C(s,t,l[s.id]??o.seriesColors[a%o.seriesColors.length]))}}exports.buildTimeSeriesOption=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c={top:16,right:16,bottom:8,left:8},u=6,d=.15,f={thin:1,normal:2,thick:4},y="solid",L="normal",b=new Intl.DateTimeFormat(void 0,{year:"numeric"}),g=new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit"}),h=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}),S=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function x(t){const e=new Date(t);return e.getSeconds()!==0||e.getMilliseconds()!==0?S.format(e):e.getHours()!==0||e.getMinutes()!==0?h.format(e):e.getMonth()===0&&e.getDate()===1?b.format(e):g.format(e)}function a(t){const{valueFormatter:e}=t;if(e)return i=>i==null?"":e(i)}function p(t){const{showValueLabels:e,theme:i}=t,r=a(t);return{show:e,position:"top",color:i.labelColor,formatter:r?o=>r(o.value[1]):void 0}}function A(t,e,i){const r=t.points.map(l=>[l.timestamp,l.value]),o=p(e);return e.displayType==="bar"?{id:t.id,name:t.name,type:"bar",data:r,itemStyle:{color:i},label:o}:{id:t.id,name:t.name,type:"line",data:r,showSymbol:e.showSymbols,symbolSize:u,lineStyle:{color:i,type:e.line.style??y,width:f[e.line.width??L]},itemStyle:{color:i},areaStyle:e.displayType==="area"?{color:i,opacity:d}:void 0,label:o}}function C(t){const{series:e,xAxis:i,yAxis:r,theme:o,seriesColorOverrides:l}=t,n=a(t);return{animation:!1,color:o.seriesColors,textStyle:{fontFamily:o.fontFamily,color:o.labelColor},grid:{...c,containLabel:!0},tooltip:{trigger:"axis",confine:!0,backgroundColor:o.tooltipBackgroundColor,borderColor:o.tooltipBorderColor,textStyle:{color:o.labelColor},valueFormatter:n},xAxis:{type:"time",min:i.min,max:i.max,axisLine:{lineStyle:{color:o.axisLineColor}},axisTick:{show:!1},axisLabel:{color:o.labelColor,hideOverlap:!0,formatter:x},splitLine:{show:!1}},yAxis:{type:r.scale==="log"?"log":"value",scale:r.includeZero!==!0,min:r.min,max:r.max,axisLine:{show:!1},axisLabel:{color:o.labelColor,formatter:n},splitLine:{lineStyle:{color:o.splitLineColor}}},series:e.map((s,m)=>A(s,t,l[s.id]??o.seriesColors[m%o.seriesColors.length]))}}exports.buildTimeSeriesOption=C;
2
2
  //# sourceMappingURL=time-series-option.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"time-series-option.cjs","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/time-series-option.ts"],"sourcesContent":["import type { ChartTheme } from \"../chart-theme\";\n\nexport interface TimeSeriesPoint {\n timestamp: number;\n value: number | null;\n}\n\nexport interface TimeSeriesData {\n id: string;\n name: string;\n points: TimeSeriesPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type TimeSeriesDisplayType = \"line\" | \"bar\" | \"area\";\n\nexport type TimeSeriesLineStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport type TimeSeriesLineWidth = \"thin\" | \"normal\" | \"thick\";\n\nexport interface TimeSeriesLineOptions {\n style?: TimeSeriesLineStyle;\n width?: TimeSeriesLineWidth;\n}\n\nexport type TimeSeriesLegendMode = \"inline\" | \"none\";\n\nexport type TimeSeriesAxisScale = \"linear\" | \"log\";\n\nexport interface TimeSeriesYAxisOptions {\n scale?: TimeSeriesAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface TimeSeriesOptionInput {\n series: TimeSeriesData[];\n displayType: TimeSeriesDisplayType;\n line: TimeSeriesLineOptions;\n yAxis: TimeSeriesYAxisOptions;\n theme: ChartTheme;\n showSymbols: boolean;\n showValueLabels: boolean;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\n// A legenda saiu do canvas e virou HTML (`ChartLegend`), entao a grade nao reserva mais faixa\n// para ela: quem divide a altura agora e o flex do componente.\nconst GRID_PADDING = { top: 16, right: 16, bottom: 24, left: 56 } as const;\n\nconst SYMBOL_SIZE_PX: number = 6;\n\nconst AREA_OPACITY: number = 0.15;\n\nconst LINE_WIDTH_PX: Record<TimeSeriesLineWidth, number> = { thin: 1, normal: 2, thick: 4 };\n\nconst DEFAULT_LINE_STYLE: TimeSeriesLineStyle = \"solid\";\n\nconst DEFAULT_LINE_WIDTH: TimeSeriesLineWidth = \"normal\";\n\n// O eixo de tempo do ECharts rotula a marca de dia so com o numero do dia -- \"2\", \"3\", \"4\" --, que\n// sozinho nao diz nem o mes. Aqui a marca de dia vira data e a marca dentro do dia vira hora, que e\n// o que se espera de uma serie temporal.\n//\n// A precisao sai do proprio instante, e nao de um nivel pedido ao ECharts: ele alinha as marcas ao\n// nivel que cabe no eixo, entao meia-noite e marca de dia, minuto cheio e marca de hora, e assim por\n// diante. Ler o instante e o que permite usar `Intl` e escrever a data na convencao de quem le -- o\n// objeto de niveis do ECharts so aceita template, e um `{dd}/{MM}` fixo seria lido como mes/dia por\n// metade dos usuarios.\nconst YEAR_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, { year: \"numeric\" });\n\nconst DAY_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n day: \"2-digit\",\n month: \"2-digit\",\n});\n\nconst MINUTE_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n});\n\nconst SECOND_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n});\n\nfunction timeAxisLabel(timestamp: number): string {\n const instant: Date = new Date(timestamp);\n if (instant.getSeconds() !== 0 || instant.getMilliseconds() !== 0) return SECOND_LABEL.format(instant);\n if (instant.getHours() !== 0 || instant.getMinutes() !== 0) return MINUTE_LABEL.format(instant);\n // Primeiro de janeiro e a marca de ano do ECharts, e ali a data sem o ano nao situa ninguem.\n if (instant.getMonth() === 0 && instant.getDate() === 1) return YEAR_LABEL.format(instant);\n return DAY_LABEL.format(instant);\n}\n\n// O ponto de gap chega ao formatter como `null` — o ECharts monta o bloco do tooltip sem marcar\n// `noValue`, então formata o vazio junto com o resto. O tipo público promete `number` ao\n// consumidor, e é esta guarda que mantém a promessa em vez de transformá-la em aviso.\nfunction nullSafeValueFormatter(\n input: TimeSeriesOptionInput,\n): ((value: number | null | undefined) => string) | undefined {\n const { valueFormatter } = input;\n if (!valueFormatter) return undefined;\n return (value: number | null | undefined) => (value == null ? \"\" : valueFormatter(value));\n}\n\nfunction seriesLabel(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { showValueLabels, theme } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n return {\n show: showValueLabels,\n position: \"top\",\n color: theme.labelColor,\n formatter: formatValue\n ? (params: { value: [number, number | null] }) => formatValue(params.value[1])\n : undefined,\n };\n}\n\nfunction seriesEntry(\n data: TimeSeriesData,\n input: TimeSeriesOptionInput,\n color: string,\n): Record<string, unknown> {\n const values: Array<[number, number | null]> = data.points.map((point: TimeSeriesPoint) => [\n point.timestamp,\n point.value,\n ]);\n const label: Record<string, unknown> = seriesLabel(input);\n\n if (input.displayType === \"bar\") {\n return { id: data.id, name: data.name, type: \"bar\", data: values, itemStyle: { color }, label };\n }\n\n return {\n id: data.id,\n name: data.name,\n type: \"line\",\n data: values,\n showSymbol: input.showSymbols,\n symbolSize: SYMBOL_SIZE_PX,\n lineStyle: {\n color,\n type: input.line.style ?? DEFAULT_LINE_STYLE,\n width: LINE_WIDTH_PX[input.line.width ?? DEFAULT_LINE_WIDTH],\n },\n itemStyle: { color },\n areaStyle: input.displayType === \"area\" ? { color, opacity: AREA_OPACITY } : undefined,\n label,\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildTimeSeriesOption(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { series, yAxis, theme, seriesColorOverrides } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING,\n containLabel: false,\n },\n tooltip: {\n trigger: \"axis\",\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: {\n type: \"time\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: { color: theme.labelColor, hideOverlap: true, formatter: timeAxisLabel },\n splitLine: { show: false },\n },\n yAxis: {\n type: yAxis.scale === \"log\" ? \"log\" : \"value\",\n scale: yAxis.includeZero !== true,\n min: yAxis.min,\n max: yAxis.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n },\n series: series.map((data: TimeSeriesData, index: number) =>\n seriesEntry(\n data,\n input,\n seriesColorOverrides[data.id] ?? theme.seriesColors[index % theme.seriesColors.length],\n ),\n ),\n };\n}\n"],"names":["GRID_PADDING","SYMBOL_SIZE_PX","AREA_OPACITY","LINE_WIDTH_PX","DEFAULT_LINE_STYLE","DEFAULT_LINE_WIDTH","YEAR_LABEL","DAY_LABEL","MINUTE_LABEL","SECOND_LABEL","timeAxisLabel","timestamp","instant","nullSafeValueFormatter","input","valueFormatter","value","seriesLabel","showValueLabels","theme","formatValue","params","seriesEntry","data","color","values","point","label","buildTimeSeriesOption","series","yAxis","seriesColorOverrides","index"],"mappings":"gFAoDA,MAAMA,EAAe,CAAE,IAAK,GAAI,MAAO,GAAI,OAAQ,GAAI,KAAM,EAAA,EAEvDC,EAAyB,EAEzBC,EAAuB,IAEvBC,EAAqD,CAAE,KAAM,EAAG,OAAQ,EAAG,MAAO,CAAA,EAElFC,EAA0C,QAE1CC,EAA0C,SAW1CC,EAAkC,IAAI,KAAK,eAAe,OAAW,CAAE,KAAM,UAAW,EAExFC,EAAiC,IAAI,KAAK,eAAe,OAAW,CACxE,IAAK,UACL,MAAO,SACT,CAAC,EAEKC,EAAoC,IAAI,KAAK,eAAe,OAAW,CAC3E,KAAM,UACN,OAAQ,UACR,OAAQ,EACV,CAAC,EAEKC,EAAoC,IAAI,KAAK,eAAe,OAAW,CAC3E,KAAM,UACN,OAAQ,UACR,OAAQ,UACR,OAAQ,EACV,CAAC,EAED,SAASC,EAAcC,EAA2B,CAChD,MAAMC,EAAgB,IAAI,KAAKD,CAAS,EACxC,OAAIC,EAAQ,eAAiB,GAAKA,EAAQ,gBAAA,IAAsB,EAAUH,EAAa,OAAOG,CAAO,EACjGA,EAAQ,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,EAC4D,CAC5D,KAAM,CAAE,eAAAC,GAAmBD,EAC3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AS,OACT,gBAAiBmB,EAAM,uBACvB,YAAaA,EAAM,mBACnB,UAAW,CAAE,MAAOA,EAAM,UAAA,EAC1B,eAAgBC,CAAA,EAElB,MAAO,CACL,KAAM,OACN,SAAU,CAAE,UAAW,CAAE,MAAOD,EAAM,cAAc,EACpD,SAAU,CAAE,KAAM,EAAA,EAClB,UAAW,CAAE,MAAOA,EAAM,WAAY,YAAa,GAAM,UAAWT,CAAA,EACpE,UAAW,CAAE,KAAM,EAAA,CAAM,EAE3B,MAAO,CACL,KAAMoB,EAAM,QAAU,MAAQ,MAAQ,QACtC,MAAOA,EAAM,cAAgB,GAC7B,IAAKA,EAAM,IACX,IAAKA,EAAM,IACX,SAAU,CAAE,KAAM,EAAA,EAClB,UAAW,CAAE,MAAOX,EAAM,WAAY,UAAWC,CAAA,EACjD,UAAW,CAAE,UAAW,CAAE,MAAOD,EAAM,eAAe,CAAE,EAE1D,OAAQU,EAAO,IAAI,CAACN,EAAsBS,IACxCV,EACEC,EACAT,EACAiB,EAAqBR,EAAK,EAAE,GAAKJ,EAAM,aAAaa,EAAQb,EAAM,aAAa,MAAM,CAAA,CACvF,CACF,CAEJ"}
1
+ {"version":3,"file":"time-series-option.cjs","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/time-series-option.ts"],"sourcesContent":["import type { ChartTheme } from \"../chart-theme\";\n\nexport interface TimeSeriesPoint {\n timestamp: number;\n value: number | null;\n}\n\nexport interface TimeSeriesData {\n id: string;\n name: string;\n points: TimeSeriesPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type TimeSeriesDisplayType = \"line\" | \"bar\" | \"area\";\n\nexport type TimeSeriesLineStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport type TimeSeriesLineWidth = \"thin\" | \"normal\" | \"thick\";\n\nexport interface TimeSeriesLineOptions {\n style?: TimeSeriesLineStyle;\n width?: TimeSeriesLineWidth;\n}\n\nexport type TimeSeriesLegendMode = \"inline\" | \"none\";\n\nexport type TimeSeriesAxisScale = \"linear\" | \"log\";\n\nexport interface TimeSeriesYAxisOptions {\n scale?: TimeSeriesAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface TimeSeriesXAxisOptions {\n min?: number;\n max?: number;\n}\n\nexport interface TimeSeriesOptionInput {\n series: TimeSeriesData[];\n displayType: TimeSeriesDisplayType;\n line: TimeSeriesLineOptions;\n xAxis: TimeSeriesXAxisOptions;\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_PX: { top: number; right: number; bottom: number; left: number } = {\n top: 16,\n right: 16,\n bottom: 8,\n left: 8,\n};\n\nconst SYMBOL_SIZE_PX: number = 6;\n\nconst AREA_OPACITY: number = 0.15;\n\nconst LINE_WIDTH_PX: Record<TimeSeriesLineWidth, number> = { thin: 1, normal: 2, thick: 4 };\n\nconst DEFAULT_LINE_STYLE: TimeSeriesLineStyle = \"solid\";\n\nconst DEFAULT_LINE_WIDTH: TimeSeriesLineWidth = \"normal\";\n\n// O eixo de tempo do ECharts rotula a marca de dia so com o numero do dia -- \"2\", \"3\", \"4\" --, que\n// sozinho nao diz nem o mes. Aqui a marca de dia vira data e a marca dentro do dia vira hora, que e\n// o que se espera de uma serie temporal.\n//\n// A precisao sai do proprio instante, e nao de um nivel pedido ao ECharts: ele alinha as marcas ao\n// nivel que cabe no eixo, entao meia-noite e marca de dia, minuto cheio e marca de hora, e assim por\n// diante. Ler o instante e o que permite usar `Intl` e escrever a data na convencao de quem le -- o\n// objeto de niveis do ECharts so aceita template, e um `{dd}/{MM}` fixo seria lido como mes/dia por\n// metade dos usuarios.\nconst YEAR_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, { year: \"numeric\" });\n\nconst DAY_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n day: \"2-digit\",\n month: \"2-digit\",\n});\n\nconst MINUTE_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n});\n\nconst SECOND_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n});\n\nfunction timeAxisLabel(timestamp: number): string {\n const instant: Date = new Date(timestamp);\n if (instant.getSeconds() !== 0 || instant.getMilliseconds() !== 0) return SECOND_LABEL.format(instant);\n if (instant.getHours() !== 0 || instant.getMinutes() !== 0) return MINUTE_LABEL.format(instant);\n // Primeiro de janeiro e a marca de ano do ECharts, e ali a data sem o ano nao situa ninguem.\n if (instant.getMonth() === 0 && instant.getDate() === 1) return YEAR_LABEL.format(instant);\n return DAY_LABEL.format(instant);\n}\n\n// O ponto de gap chega ao formatter como `null` — o ECharts monta o bloco do tooltip sem marcar\n// `noValue`, então formata o vazio junto com o resto. O tipo público promete `number` ao\n// consumidor, e é esta guarda que mantém a promessa em vez de transformá-la em aviso.\nfunction nullSafeValueFormatter(\n input: TimeSeriesOptionInput,\n): ((value: number | null | undefined) => string) | undefined {\n const { valueFormatter } = input;\n if (!valueFormatter) return undefined;\n return (value: number | null | undefined) => (value == null ? \"\" : valueFormatter(value));\n}\n\nfunction seriesLabel(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { showValueLabels, theme } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n return {\n show: showValueLabels,\n position: \"top\",\n color: theme.labelColor,\n formatter: formatValue\n ? (params: { value: [number, number | null] }) => formatValue(params.value[1])\n : undefined,\n };\n}\n\nfunction seriesEntry(\n data: TimeSeriesData,\n input: TimeSeriesOptionInput,\n color: string,\n): Record<string, unknown> {\n const values: Array<[number, number | null]> = data.points.map((point: TimeSeriesPoint) => [\n point.timestamp,\n point.value,\n ]);\n const label: Record<string, unknown> = seriesLabel(input);\n\n if (input.displayType === \"bar\") {\n return { id: data.id, name: data.name, type: \"bar\", data: values, itemStyle: { color }, label };\n }\n\n return {\n id: data.id,\n name: data.name,\n type: \"line\",\n data: values,\n showSymbol: input.showSymbols,\n symbolSize: SYMBOL_SIZE_PX,\n lineStyle: {\n color,\n type: input.line.style ?? DEFAULT_LINE_STYLE,\n width: LINE_WIDTH_PX[input.line.width ?? DEFAULT_LINE_WIDTH],\n },\n itemStyle: { color },\n areaStyle: input.displayType === \"area\" ? { color, opacity: AREA_OPACITY } : undefined,\n label,\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildTimeSeriesOption(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { series, xAxis, yAxis, theme, seriesColorOverrides } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING_PX,\n containLabel: true,\n },\n tooltip: {\n trigger: \"axis\",\n confine: true,\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: {\n type: \"time\",\n min: xAxis.min,\n max: xAxis.max,\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_PX","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","xAxis","yAxis","seriesColorOverrides","index"],"mappings":"gFA0DA,MAAMA,EAAgF,CACpF,IAAK,GACL,MAAO,GACP,OAAQ,EACR,KAAM,CACR,EAEMC,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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E9B,MAAO,CACL,UAAW,GACX,MAAOK,EAAM,aACb,UAAW,CAAE,WAAYA,EAAM,WAAY,MAAOA,EAAM,UAAA,EACxD,KAAM,CACJ,GAAGnB,EACH,aAAc,EAAA,EAEhB,QAAS,CACP,QAAS,OACT,QAAS,GACT,gBAAiBmB,EAAM,uBACvB,YAAaA,EAAM,mBACnB,UAAW,CAAE,MAAOA,EAAM,UAAA,EAC1B,eAAgBC,CAAA,EAElB,MAAO,CACL,KAAM,OACN,IAAKU,EAAM,IACX,IAAKA,EAAM,IACX,SAAU,CAAE,UAAW,CAAE,MAAOX,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,EAAsBU,IACxCX,EACEC,EACAT,EACAkB,EAAqBT,EAAK,EAAE,GAAKJ,EAAM,aAAac,EAAQd,EAAM,aAAa,MAAM,CAAA,CACvF,CACF,CAEJ"}
@@ -1,11 +1,16 @@
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, {
1
+ const c = {
2
+ top: 16,
3
+ right: 16,
4
+ bottom: 8,
5
+ left: 8
6
+ }, u = 6, d = 0.15, f = { thin: 1, normal: 2, thick: 4 }, y = "solid", L = "normal", g = new Intl.DateTimeFormat(void 0, { year: "numeric" }), h = new Intl.DateTimeFormat(void 0, {
2
7
  day: "2-digit",
3
8
  month: "2-digit"
4
- }), h = new Intl.DateTimeFormat(void 0, {
9
+ }), b = new Intl.DateTimeFormat(void 0, {
5
10
  hour: "2-digit",
6
11
  minute: "2-digit",
7
12
  hour12: !1
8
- }), b = new Intl.DateTimeFormat(void 0, {
13
+ }), x = new Intl.DateTimeFormat(void 0, {
9
14
  hour: "2-digit",
10
15
  minute: "2-digit",
11
16
  second: "2-digit",
@@ -13,82 +18,85 @@ const m = { top: 16, right: 16, bottom: 24, left: 56 }, c = 6, d = 0.15, u = { t
13
18
  });
14
19
  function S(t) {
15
20
  const e = new Date(t);
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);
21
+ return e.getSeconds() !== 0 || e.getMilliseconds() !== 0 ? x.format(e) : e.getHours() !== 0 || e.getMinutes() !== 0 ? b.format(e) : e.getMonth() === 0 && e.getDate() === 1 ? g.format(e) : h.format(e);
17
22
  }
18
- function n(t) {
23
+ function a(t) {
19
24
  const { valueFormatter: e } = t;
20
25
  if (e)
21
26
  return (i) => i == null ? "" : e(i);
22
27
  }
23
28
  function p(t) {
24
- const { showValueLabels: e, theme: i } = t, o = n(t);
29
+ const { showValueLabels: e, theme: i } = t, r = a(t);
25
30
  return {
26
31
  show: e,
27
32
  position: "top",
28
33
  color: i.labelColor,
29
- formatter: o ? (l) => o(l.value[1]) : void 0
34
+ formatter: r ? (o) => r(o.value[1]) : void 0
30
35
  };
31
36
  }
32
- function x(t, e, i) {
33
- const o = t.points.map((r) => [
34
- r.timestamp,
35
- r.value
36
- ]), l = p(e);
37
- return e.displayType === "bar" ? { id: t.id, name: t.name, type: "bar", data: o, itemStyle: { color: i }, label: l } : {
37
+ function A(t, e, i) {
38
+ const r = t.points.map((l) => [
39
+ l.timestamp,
40
+ l.value
41
+ ]), o = p(e);
42
+ return e.displayType === "bar" ? { id: t.id, name: t.name, type: "bar", data: r, itemStyle: { color: i }, label: o } : {
38
43
  id: t.id,
39
44
  name: t.name,
40
45
  type: "line",
41
- data: o,
46
+ data: r,
42
47
  showSymbol: e.showSymbols,
43
- symbolSize: c,
48
+ symbolSize: u,
44
49
  lineStyle: {
45
50
  color: i,
46
- type: e.line.style ?? f,
47
- width: u[e.line.width ?? y]
51
+ type: e.line.style ?? y,
52
+ width: f[e.line.width ?? L]
48
53
  },
49
54
  itemStyle: { color: i },
50
55
  areaStyle: e.displayType === "area" ? { color: i, opacity: d } : void 0,
51
- label: l
56
+ label: o
52
57
  };
53
58
  }
54
59
  function C(t) {
55
- const { series: e, yAxis: i, theme: o, seriesColorOverrides: l } = t, r = n(t);
60
+ const { series: e, xAxis: i, yAxis: r, theme: o, seriesColorOverrides: l } = t, n = a(t);
56
61
  return {
57
62
  animation: !1,
58
63
  color: o.seriesColors,
59
64
  textStyle: { fontFamily: o.fontFamily, color: o.labelColor },
60
65
  grid: {
61
- ...m,
62
- containLabel: !1
66
+ ...c,
67
+ containLabel: !0
63
68
  },
64
69
  tooltip: {
65
70
  trigger: "axis",
71
+ confine: !0,
66
72
  backgroundColor: o.tooltipBackgroundColor,
67
73
  borderColor: o.tooltipBorderColor,
68
74
  textStyle: { color: o.labelColor },
69
- valueFormatter: r
75
+ valueFormatter: n
70
76
  },
71
77
  xAxis: {
72
78
  type: "time",
79
+ min: i.min,
80
+ max: i.max,
73
81
  axisLine: { lineStyle: { color: o.axisLineColor } },
74
82
  axisTick: { show: !1 },
75
83
  axisLabel: { color: o.labelColor, hideOverlap: !0, formatter: S },
76
84
  splitLine: { show: !1 }
77
85
  },
78
86
  yAxis: {
79
- type: i.scale === "log" ? "log" : "value",
80
- scale: i.includeZero !== !0,
81
- min: i.min,
82
- max: i.max,
87
+ type: r.scale === "log" ? "log" : "value",
88
+ scale: r.includeZero !== !0,
89
+ min: r.min,
90
+ max: r.max,
83
91
  axisLine: { show: !1 },
84
- axisLabel: { color: o.labelColor, formatter: r },
92
+ axisLabel: { color: o.labelColor, formatter: n },
85
93
  splitLine: { lineStyle: { color: o.splitLineColor } }
86
94
  },
87
95
  series: e.map(
88
- (s, a) => x(
96
+ (s, m) => A(
89
97
  s,
90
98
  t,
91
- l[s.id] ?? o.seriesColors[a % o.seriesColors.length]
99
+ l[s.id] ?? o.seriesColors[m % o.seriesColors.length]
92
100
  )
93
101
  )
94
102
  };
@@ -1 +1 @@
1
- {"version":3,"file":"time-series-option.js","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/time-series-option.ts"],"sourcesContent":["import type { ChartTheme } from \"../chart-theme\";\n\nexport interface TimeSeriesPoint {\n timestamp: number;\n value: number | null;\n}\n\nexport interface TimeSeriesData {\n id: string;\n name: string;\n points: TimeSeriesPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type TimeSeriesDisplayType = \"line\" | \"bar\" | \"area\";\n\nexport type TimeSeriesLineStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport type TimeSeriesLineWidth = \"thin\" | \"normal\" | \"thick\";\n\nexport interface TimeSeriesLineOptions {\n style?: TimeSeriesLineStyle;\n width?: TimeSeriesLineWidth;\n}\n\nexport type TimeSeriesLegendMode = \"inline\" | \"none\";\n\nexport type TimeSeriesAxisScale = \"linear\" | \"log\";\n\nexport interface TimeSeriesYAxisOptions {\n scale?: TimeSeriesAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface TimeSeriesOptionInput {\n series: TimeSeriesData[];\n displayType: TimeSeriesDisplayType;\n line: TimeSeriesLineOptions;\n yAxis: TimeSeriesYAxisOptions;\n theme: ChartTheme;\n showSymbols: boolean;\n showValueLabels: boolean;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\n// A legenda saiu do canvas e virou HTML (`ChartLegend`), entao a grade nao reserva mais faixa\n// para ela: quem divide a altura agora e o flex do componente.\nconst GRID_PADDING = { top: 16, right: 16, bottom: 24, left: 56 } as const;\n\nconst SYMBOL_SIZE_PX: number = 6;\n\nconst AREA_OPACITY: number = 0.15;\n\nconst LINE_WIDTH_PX: Record<TimeSeriesLineWidth, number> = { thin: 1, normal: 2, thick: 4 };\n\nconst DEFAULT_LINE_STYLE: TimeSeriesLineStyle = \"solid\";\n\nconst DEFAULT_LINE_WIDTH: TimeSeriesLineWidth = \"normal\";\n\n// O eixo de tempo do ECharts rotula a marca de dia so com o numero do dia -- \"2\", \"3\", \"4\" --, que\n// sozinho nao diz nem o mes. Aqui a marca de dia vira data e a marca dentro do dia vira hora, que e\n// o que se espera de uma serie temporal.\n//\n// A precisao sai do proprio instante, e nao de um nivel pedido ao ECharts: ele alinha as marcas ao\n// nivel que cabe no eixo, entao meia-noite e marca de dia, minuto cheio e marca de hora, e assim por\n// diante. Ler o instante e o que permite usar `Intl` e escrever a data na convencao de quem le -- o\n// objeto de niveis do ECharts so aceita template, e um `{dd}/{MM}` fixo seria lido como mes/dia por\n// metade dos usuarios.\nconst YEAR_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, { year: \"numeric\" });\n\nconst DAY_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n day: \"2-digit\",\n month: \"2-digit\",\n});\n\nconst MINUTE_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n});\n\nconst SECOND_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n});\n\nfunction timeAxisLabel(timestamp: number): string {\n const instant: Date = new Date(timestamp);\n if (instant.getSeconds() !== 0 || instant.getMilliseconds() !== 0) return SECOND_LABEL.format(instant);\n if (instant.getHours() !== 0 || instant.getMinutes() !== 0) return MINUTE_LABEL.format(instant);\n // Primeiro de janeiro e a marca de ano do ECharts, e ali a data sem o ano nao situa ninguem.\n if (instant.getMonth() === 0 && instant.getDate() === 1) return YEAR_LABEL.format(instant);\n return DAY_LABEL.format(instant);\n}\n\n// O ponto de gap chega ao formatter como `null` — o ECharts monta o bloco do tooltip sem marcar\n// `noValue`, então formata o vazio junto com o resto. O tipo público promete `number` ao\n// consumidor, e é esta guarda que mantém a promessa em vez de transformá-la em aviso.\nfunction nullSafeValueFormatter(\n input: TimeSeriesOptionInput,\n): ((value: number | null | undefined) => string) | undefined {\n const { valueFormatter } = input;\n if (!valueFormatter) return undefined;\n return (value: number | null | undefined) => (value == null ? \"\" : valueFormatter(value));\n}\n\nfunction seriesLabel(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { showValueLabels, theme } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n return {\n show: showValueLabels,\n position: \"top\",\n color: theme.labelColor,\n formatter: formatValue\n ? (params: { value: [number, number | null] }) => formatValue(params.value[1])\n : undefined,\n };\n}\n\nfunction seriesEntry(\n data: TimeSeriesData,\n input: TimeSeriesOptionInput,\n color: string,\n): Record<string, unknown> {\n const values: Array<[number, number | null]> = data.points.map((point: TimeSeriesPoint) => [\n point.timestamp,\n point.value,\n ]);\n const label: Record<string, unknown> = seriesLabel(input);\n\n if (input.displayType === \"bar\") {\n return { id: data.id, name: data.name, type: \"bar\", data: values, itemStyle: { color }, label };\n }\n\n return {\n id: data.id,\n name: data.name,\n type: \"line\",\n data: values,\n showSymbol: input.showSymbols,\n symbolSize: SYMBOL_SIZE_PX,\n lineStyle: {\n color,\n type: input.line.style ?? DEFAULT_LINE_STYLE,\n width: LINE_WIDTH_PX[input.line.width ?? DEFAULT_LINE_WIDTH],\n },\n itemStyle: { color },\n areaStyle: input.displayType === \"area\" ? { color, opacity: AREA_OPACITY } : undefined,\n label,\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildTimeSeriesOption(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { series, yAxis, theme, seriesColorOverrides } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING,\n containLabel: false,\n },\n tooltip: {\n trigger: \"axis\",\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: {\n type: \"time\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: { color: theme.labelColor, hideOverlap: true, formatter: timeAxisLabel },\n splitLine: { show: false },\n },\n yAxis: {\n type: yAxis.scale === \"log\" ? \"log\" : \"value\",\n scale: yAxis.includeZero !== true,\n min: yAxis.min,\n max: yAxis.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n },\n series: series.map((data: TimeSeriesData, index: number) =>\n seriesEntry(\n data,\n input,\n seriesColorOverrides[data.id] ?? theme.seriesColors[index % theme.seriesColors.length],\n ),\n ),\n };\n}\n"],"names":["GRID_PADDING","SYMBOL_SIZE_PX","AREA_OPACITY","LINE_WIDTH_PX","DEFAULT_LINE_STYLE","DEFAULT_LINE_WIDTH","YEAR_LABEL","DAY_LABEL","MINUTE_LABEL","SECOND_LABEL","timeAxisLabel","timestamp","instant","nullSafeValueFormatter","input","valueFormatter","value","seriesLabel","showValueLabels","theme","formatValue","params","seriesEntry","data","color","values","point","label","buildTimeSeriesOption","series","yAxis","seriesColorOverrides","index"],"mappings":"AAoDA,MAAMA,IAAe,EAAE,KAAK,IAAI,OAAO,IAAI,QAAQ,IAAI,MAAM,GAAA,GAE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A,IAElB,OAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU,EAAE,WAAW,EAAE,OAAOD,EAAM,gBAAc;AAAA,MACpD,UAAU,EAAE,MAAM,GAAA;AAAA,MAClB,WAAW,EAAE,OAAOA,EAAM,YAAY,aAAa,IAAM,WAAWT,EAAA;AAAA,MACpE,WAAW,EAAE,MAAM,GAAA;AAAA,IAAM;AAAA,IAE3B,OAAO;AAAA,MACL,MAAMoB,EAAM,UAAU,QAAQ,QAAQ;AAAA,MACtC,OAAOA,EAAM,gBAAgB;AAAA,MAC7B,KAAKA,EAAM;AAAA,MACX,KAAKA,EAAM;AAAA,MACX,UAAU,EAAE,MAAM,GAAA;AAAA,MAClB,WAAW,EAAE,OAAOX,EAAM,YAAY,WAAWC,EAAA;AAAA,MACjD,WAAW,EAAE,WAAW,EAAE,OAAOD,EAAM,iBAAe;AAAA,IAAE;AAAA,IAE1D,QAAQU,EAAO;AAAA,MAAI,CAACN,GAAsBS,MACxCV;AAAA,QACEC;AAAA,QACAT;AAAA,QACAiB,EAAqBR,EAAK,EAAE,KAAKJ,EAAM,aAAaa,IAAQb,EAAM,aAAa,MAAM;AAAA,MAAA;AAAA,IACvF;AAAA,EACF;AAEJ;"}
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 TimeSeriesXAxisOptions {\n min?: number;\n max?: number;\n}\n\nexport interface TimeSeriesOptionInput {\n series: TimeSeriesData[];\n displayType: TimeSeriesDisplayType;\n line: TimeSeriesLineOptions;\n xAxis: TimeSeriesXAxisOptions;\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_PX: { top: number; right: number; bottom: number; left: number } = {\n top: 16,\n right: 16,\n bottom: 8,\n left: 8,\n};\n\nconst SYMBOL_SIZE_PX: number = 6;\n\nconst AREA_OPACITY: number = 0.15;\n\nconst LINE_WIDTH_PX: Record<TimeSeriesLineWidth, number> = { thin: 1, normal: 2, thick: 4 };\n\nconst DEFAULT_LINE_STYLE: TimeSeriesLineStyle = \"solid\";\n\nconst DEFAULT_LINE_WIDTH: TimeSeriesLineWidth = \"normal\";\n\n// O eixo de tempo do ECharts rotula a marca de dia so com o numero do dia -- \"2\", \"3\", \"4\" --, que\n// sozinho nao diz nem o mes. Aqui a marca de dia vira data e a marca dentro do dia vira hora, que e\n// o que se espera de uma serie temporal.\n//\n// A precisao sai do proprio instante, e nao de um nivel pedido ao ECharts: ele alinha as marcas ao\n// nivel que cabe no eixo, entao meia-noite e marca de dia, minuto cheio e marca de hora, e assim por\n// diante. Ler o instante e o que permite usar `Intl` e escrever a data na convencao de quem le -- o\n// objeto de niveis do ECharts so aceita template, e um `{dd}/{MM}` fixo seria lido como mes/dia por\n// metade dos usuarios.\nconst YEAR_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, { year: \"numeric\" });\n\nconst DAY_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n day: \"2-digit\",\n month: \"2-digit\",\n});\n\nconst MINUTE_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n});\n\nconst SECOND_LABEL: Intl.DateTimeFormat = new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n});\n\nfunction timeAxisLabel(timestamp: number): string {\n const instant: Date = new Date(timestamp);\n if (instant.getSeconds() !== 0 || instant.getMilliseconds() !== 0) return SECOND_LABEL.format(instant);\n if (instant.getHours() !== 0 || instant.getMinutes() !== 0) return MINUTE_LABEL.format(instant);\n // Primeiro de janeiro e a marca de ano do ECharts, e ali a data sem o ano nao situa ninguem.\n if (instant.getMonth() === 0 && instant.getDate() === 1) return YEAR_LABEL.format(instant);\n return DAY_LABEL.format(instant);\n}\n\n// O ponto de gap chega ao formatter como `null` — o ECharts monta o bloco do tooltip sem marcar\n// `noValue`, então formata o vazio junto com o resto. O tipo público promete `number` ao\n// consumidor, e é esta guarda que mantém a promessa em vez de transformá-la em aviso.\nfunction nullSafeValueFormatter(\n input: TimeSeriesOptionInput,\n): ((value: number | null | undefined) => string) | undefined {\n const { valueFormatter } = input;\n if (!valueFormatter) return undefined;\n return (value: number | null | undefined) => (value == null ? \"\" : valueFormatter(value));\n}\n\nfunction seriesLabel(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { showValueLabels, theme } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n return {\n show: showValueLabels,\n position: \"top\",\n color: theme.labelColor,\n formatter: formatValue\n ? (params: { value: [number, number | null] }) => formatValue(params.value[1])\n : undefined,\n };\n}\n\nfunction seriesEntry(\n data: TimeSeriesData,\n input: TimeSeriesOptionInput,\n color: string,\n): Record<string, unknown> {\n const values: Array<[number, number | null]> = data.points.map((point: TimeSeriesPoint) => [\n point.timestamp,\n point.value,\n ]);\n const label: Record<string, unknown> = seriesLabel(input);\n\n if (input.displayType === \"bar\") {\n return { id: data.id, name: data.name, type: \"bar\", data: values, itemStyle: { color }, label };\n }\n\n return {\n id: data.id,\n name: data.name,\n type: \"line\",\n data: values,\n showSymbol: input.showSymbols,\n symbolSize: SYMBOL_SIZE_PX,\n lineStyle: {\n color,\n type: input.line.style ?? DEFAULT_LINE_STYLE,\n width: LINE_WIDTH_PX[input.line.width ?? DEFAULT_LINE_WIDTH],\n },\n itemStyle: { color },\n areaStyle: input.displayType === \"area\" ? { color, opacity: AREA_OPACITY } : undefined,\n label,\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildTimeSeriesOption(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { series, xAxis, yAxis, theme, seriesColorOverrides } = input;\n const formatValue: ((value: number | null | undefined) => string) | undefined =\n nullSafeValueFormatter(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_PADDING_PX,\n containLabel: true,\n },\n tooltip: {\n trigger: \"axis\",\n confine: true,\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: {\n type: \"time\",\n min: xAxis.min,\n max: xAxis.max,\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_PX","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","xAxis","yAxis","seriesColorOverrides","index"],"mappings":"AA0DA,MAAMA,IAAgF;AAAA,EACpF,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACR,GAEMC,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,O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IAAE;AAAA,IAE1D,QAAQU,EAAO;AAAA,MAAI,CAACN,GAAsBU,MACxCX;AAAA,QACEC;AAAA,QACAT;AAAA,QACAkB,EAAqBT,EAAK,EAAE,KAAKJ,EAAM,aAAac,IAAQd,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 n=require("react/jsx-runtime"),E=require("../../../vendor/clsx/dist/clsx.cjs"),s=require("react"),h=require("react-aria-components");;/* empty css */const F=require("../../icons/IconChevronDown.cjs"),N=require("../../hooks/useOverlayPortal.cjs"),u=require("../Fieldset/Fieldset.cjs"),R=require("../ListBox/ListBox.cjs");function v(t){const{id:e}=t.props;return String(e??t.key??"")}function I(t){const{textValue:e,children:r}=t.props;return e!==void 0?e:typeof r=="string"?r:""}function m(t,e){s.Children.forEach(t,r=>{s.isValidElement(r)&&e(r)})}function M(t){const e=new Set;return m(t,r=>e.add(v(r))),e}function O(t,e){const r=new Set([...e].map(String)),o=[];return m(t,c=>{r.has(v(c))&&o.push(I(c))}),o.join(", ")}function B({className:t,label:e,description:r,errorMessage:o,placeholder:c,children:d,selectedKeys:x,onSelectionChange:j,isDisabled:S,isInvalid:y,disallowEmptySelection:q,"aria-label":g}){const C=E.clsx(t,"select-container"),b=N.useOverlayPortalContainer(),l=s.useRef(null),[T,w]=s.useState(),f=s.useCallback(()=>{l.current&&w(`${l.current.offsetWidth}px`)},[]);s.useLayoutEffect(()=>{f();const i=l.current;if(!i||typeof ResizeObserver>"u")return;const p=new ResizeObserver(f);return p.observe(i),()=>p.disconnect()},[f]);const a=O(d,x);return n.jsx("div",{className:C,children:n.jsxs(u.Field,{children:[e&&n.jsx(u.Label,{children:e}),n.jsxs(h.MenuTrigger,{children:[n.jsxs(h.Button,{ref:l,className:"select","aria-label":g,isDisabled:S,"data-invalid":y||void 0,children:[n.jsx("span",{className:"select-value","data-placeholder":a===""||void 0,title:a||void 0,children:a===""?c:a}),n.jsx(F.IconChevronDown,{"aria-hidden":"true"})]}),n.jsx(h.Popover,{className:"select-popover",style:{"--trigger-width":T},UNSTABLE_portalContainer:b,children:n.jsx(R.ListBox,{"aria-label":e??g,autoFocus:!0,selectionMode:"multiple",disallowEmptySelection:q,selectedKeys:x,onSelectionChange:i=>j(i==="all"?M(d):new Set(i)),children:d})})]}),r&&n.jsx(u.Description,{children:r}),n.jsx(u.FieldError,{children:o})]})})}exports.MultiSelectField=B;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),R=require("../../../vendor/clsx/dist/clsx.cjs"),i=require("react"),m=require("react-aria-components");;/* empty css */const B=require("../../icons/IconChevronDown.cjs"),E=require("../../hooks/useOverlayPortal.cjs"),j=require("../Fieldset/Fieldset.cjs"),C=require("../ListBox/ListBox.cjs"),D=require("../Input/Input.cjs");function q(n){const{id:e}=n.props;return e??n.key??""}function F(n){const{textValue:e,children:t}=n.props;return e!==void 0?e:typeof t=="string"?t:""}function I(n,e){i.Children.forEach(n,t=>{i.isValidElement(t)&&e(t)})}function L(n){const e=new Set;return I(n,t=>e.add(q(t))),e}function M(n,e,t){return i.Children.toArray(n).filter(s=>i.isValidElement(s)&&t(F(s),e))}function O(n,e,t){const s=new Set(e.map(String)),o=l=>s.has(String(l)),c=[...n].filter(l=>!o(l)),a=t==="all"?e:[...t].filter(o);return new Set([...c,...a])}function k(n,e){const t=new Set([...e].map(String)),s=[];return I(n,o=>{t.has(String(q(o)))&&s.push(F(o))}),s.join(", ")}function A({children:n,selectedKeys:e,onSelectionChange:t,disallowEmptySelection:s,listLabel:o,searchPlaceholder:c,emptyStateText:a}){const{contains:l}=m.useFilter({sensitivity:"base"}),[v,y]=i.useState(""),f=i.useRef(null),u=M(n,v,l),p=u.map(q);function b(h){var d,g;h.key!=="ArrowDown"||u.length===0||(h.preventDefault(),(g=(d=f.current)==null?void 0:d.querySelector('[role="listbox"]'))==null||g.focus())}return r.jsxs("div",{ref:f,className:"select-search-panel",children:[r.jsx(m.TextField,{"aria-label":c,value:v,onChange:y,autoFocus:!0,children:r.jsx(D.Input,{className:"select-search-input",placeholder:c,onKeyDown:b})}),r.jsx(C.ListBox,{"aria-label":o,selectionMode:"multiple",escapeKeyBehavior:"none",disallowEmptySelection:s,selectedKeys:e,onSelectionChange:h=>t(O(e,p,h)),renderEmptyState:()=>r.jsx("span",{className:"select-empty-state",children:a}),children:u})]})}function V({className:n,label:e,description:t,errorMessage:s,placeholder:o,children:c,selectedKeys:a,onSelectionChange:l,isDisabled:v,isInvalid:y,disallowEmptySelection:f,"aria-label":u,...p}){const b=R.clsx(n,"select-container"),h=E.useOverlayPortalContainer(),d=i.useRef(null),[g,N]=i.useState(),T=i.useCallback(()=>{d.current&&N(`${d.current.offsetWidth}px`)},[]);i.useLayoutEffect(()=>{T();const x=d.current;if(!x||typeof ResizeObserver>"u")return;const w=new ResizeObserver(T);return w.observe(x),()=>w.disconnect()},[T]);const S=k(c,a);return r.jsx("div",{className:b,children:r.jsxs(j.Field,{children:[e&&r.jsx(j.Label,{children:e}),r.jsxs(m.MenuTrigger,{children:[r.jsxs(m.Button,{ref:d,className:"select","aria-label":u,isDisabled:v,"data-invalid":y||void 0,children:[r.jsx("span",{className:"select-value","data-placeholder":S===""||void 0,title:S||void 0,children:S===""?o:S}),r.jsx(B.IconChevronDown,{"aria-hidden":"true"})]}),r.jsx(m.Popover,{className:"select-popover",style:{"--trigger-width":g},UNSTABLE_portalContainer:h,children:p.isSearchable?r.jsx(A,{listLabel:e??u,selectedKeys:a,onSelectionChange:l,disallowEmptySelection:f,searchPlaceholder:p.searchPlaceholder,emptyStateText:p.emptyStateText,children:c}):r.jsx(C.ListBox,{"aria-label":e??u,autoFocus:!0,selectionMode:"multiple",escapeKeyBehavior:"none",disallowEmptySelection:f,selectedKeys:a,onSelectionChange:x=>l(x==="all"?L(c):new Set(x)),children:c})})]}),t&&r.jsx(j.Description,{children:t}),r.jsx(j.FieldError,{children:s})]})})}exports.MultiSelectField=V;
2
2
  //# sourceMappingURL=MultiSelect.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.cjs","sources":["../../../../../src/ui/primitives/Select/MultiSelect.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Label,\n ListBox,\n SharedFieldProps,\n} from \"primitives\";\nimport React, { useCallback, useLayoutEffect, useRef, useState } from \"react\";\nimport {\n Button as RACButton,\n MenuTrigger as RACMenuTrigger,\n Popover as RACPopover,\n type Key as RACKey,\n type Selection as RACSelection,\n} from \"react-aria-components\";\nimport \"./select.css\";\n\nfunction itemKey(item: React.ReactElement): string {\n const { id } = item.props as { id?: RACKey };\n return String(id ?? item.key ?? \"\");\n}\n\nfunction itemText(item: React.ReactElement): string {\n const { textValue, children } = item.props as {\n textValue?: string;\n children?: React.ReactNode;\n };\n if (textValue !== undefined) return textValue;\n return typeof children === \"string\" ? children : \"\";\n}\n\nfunction forEachItem(\n children: React.ReactNode,\n visit: (item: React.ReactElement) => void,\n) {\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child)) visit(child);\n });\n}\n\nfunction allItemKeys(children: React.ReactNode): Set<RACKey> {\n const keys = new Set<RACKey>();\n forEachItem(children, (item) => keys.add(itemKey(item)));\n return keys;\n}\n\nfunction selectedItemsText(\n children: React.ReactNode,\n selectedKeys: Iterable<RACKey>,\n): string {\n const selected = new Set([...selectedKeys].map(String));\n const texts: string[] = [];\n forEachItem(children, (item) => {\n if (selected.has(itemKey(item))) texts.push(itemText(item));\n });\n return texts.join(\", \");\n}\n\nexport interface MultiSelectFieldProps extends SharedFieldProps {\n children: React.ReactNode;\n selectedKeys: Iterable<RACKey>;\n onSelectionChange: (keys: Set<RACKey>) => void;\n className?: string;\n isDisabled?: boolean;\n isInvalid?: boolean;\n disallowEmptySelection?: boolean;\n \"aria-label\"?: string;\n}\n\nexport function MultiSelectField({\n className,\n label,\n description,\n errorMessage,\n placeholder,\n children,\n selectedKeys,\n onSelectionChange,\n isDisabled,\n isInvalid,\n disallowEmptySelection,\n \"aria-label\": ariaLabel,\n}: MultiSelectFieldProps) {\n const classNames = clsx(className, \"select-container\");\n const portalContainer = useOverlayPortalContainer();\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [triggerWidth, setTriggerWidth] = useState<string>();\n\n const measureTrigger = useCallback(() => {\n if (triggerRef.current) {\n setTriggerWidth(`${triggerRef.current.offsetWidth}px`);\n }\n }, []);\n\n useLayoutEffect(() => {\n measureTrigger();\n const trigger = triggerRef.current;\n if (!trigger || typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measureTrigger);\n observer.observe(trigger);\n return () => observer.disconnect();\n }, [measureTrigger]);\n\n const chosenText = selectedItemsText(children, selectedKeys);\n\n return (\n <div className={classNames}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACMenuTrigger>\n <RACButton\n ref={triggerRef}\n className=\"select\"\n aria-label={ariaLabel}\n isDisabled={isDisabled}\n data-invalid={isInvalid || undefined}\n >\n <span\n className=\"select-value\"\n data-placeholder={chosenText === \"\" || undefined}\n title={chosenText || undefined}\n >\n {chosenText === \"\" ? placeholder : chosenText}\n </span>\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n <RACPopover\n className=\"select-popover\"\n style={{ \"--trigger-width\": triggerWidth } as React.CSSProperties}\n UNSTABLE_portalContainer={portalContainer}\n >\n <ListBox\n aria-label={label ?? ariaLabel}\n autoFocus\n selectionMode=\"multiple\"\n disallowEmptySelection={disallowEmptySelection}\n selectedKeys={selectedKeys}\n onSelectionChange={(keys: RACSelection) =>\n onSelectionChange(\n keys === \"all\" ? allItemKeys(children) : new Set(keys),\n )\n }\n >\n {children}\n </ListBox>\n </RACPopover>\n </RACMenuTrigger>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </div>\n );\n}\n"],"names":["itemKey","item","id","itemText","textValue","children","forEachItem","visit","React","child","allItemKeys","keys","selectedItemsText","selectedKeys","selected","texts","MultiSelectField","className","label","description","errorMessage","placeholder","onSelectionChange","isDisabled","isInvalid","disallowEmptySelection","ariaLabel","classNames","clsx","portalContainer","useOverlayPortalContainer","triggerRef","useRef","triggerWidth","setTriggerWidth","useState","measureTrigger","useCallback","useLayoutEffect","trigger","observer","chosenText","jsx","Field","Label","RACMenuTrigger","jsxs","RACButton","IconChevronDown","RACPopover","ListBox","Description","FieldError"],"mappings":"kaAqBA,SAASA,EAAQC,EAAkC,CACjD,KAAM,CAAE,GAAAC,GAAOD,EAAK,MACpB,OAAO,OAAOC,GAAMD,EAAK,KAAO,EAAE,CACpC,CAEA,SAASE,EAASF,EAAkC,CAClD,KAAM,CAAE,UAAAG,EAAW,SAAAC,CAAA,EAAaJ,EAAK,MAIrC,OAAIG,IAAc,OAAkBA,EAC7B,OAAOC,GAAa,SAAWA,EAAW,EACnD,CAEA,SAASC,EACPD,EACAE,EACA,CACAC,EAAM,SAAS,QAAQH,EAAWI,GAAU,CACtCD,EAAM,eAAeC,CAAK,KAASA,CAAK,CAC9C,CAAC,CACH,CAEA,SAASC,EAAYL,EAAwC,CAC3D,MAAMM,MAAW,IACjB,OAAAL,EAAYD,EAAWJ,GAASU,EAAK,IAAIX,EAAQC,CAAI,CAAC,CAAC,EAChDU,CACT,CAEA,SAASC,EACPP,EACAQ,EACQ,CACR,MAAMC,EAAW,IAAI,IAAI,CAAC,GAAGD,CAAY,EAAE,IAAI,MAAM,CAAC,EAChDE,EAAkB,CAAA,EACxB,OAAAT,EAAYD,EAAWJ,GAAS,CAC1Ba,EAAS,IAAId,EAAQC,CAAI,CAAC,GAAGc,EAAM,KAAKZ,EAASF,CAAI,CAAC,CAC5D,CAAC,EACMc,EAAM,KAAK,IAAI,CACxB,CAaO,SAASC,EAAiB,CAC/B,UAAAC,EACA,MAAAC,EACA,YAAAC,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BACV,MAAO,CAAE,kBAAmBhB,CAAA,EAC5B,yBAA0BJ,EAE1B,SAAAa,EAAAA,IAACQ,EAAAA,QAAA,CACC,aAAYhC,GAASQ,EACrB,UAAS,GACT,cAAc,WACd,uBAAAD,EACA,aAAAZ,EACA,kBAAoBF,GAClBW,EACEX,IAAS,MAAQD,EAAYL,CAAQ,EAAI,IAAI,IAAIM,CAAI,CAAA,EAIxD,SAAAN,CAAA,CAAA,CACH,CAAA,CACF,EACF,EACCc,GAAeuB,EAAAA,IAACS,EAAAA,YAAA,CAAa,SAAAhC,CAAA,CAAY,EAC1CuB,EAAAA,IAACU,EAAAA,YAAY,SAAAhC,CAAA,CAAa,CAAA,CAAA,CAC5B,CAAA,CACF,CAEJ"}
1
+ {"version":3,"file":"MultiSelect.cjs","sources":["../../../../../src/ui/primitives/Select/MultiSelect.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Input,\n Label,\n ListBox,\n SharedFieldProps,\n} from \"primitives\";\nimport React, { useCallback, useLayoutEffect, useRef, useState } from \"react\";\nimport {\n Button as RACButton,\n MenuTrigger as RACMenuTrigger,\n Popover as RACPopover,\n TextField as RACTextField,\n useFilter,\n type Key as RACKey,\n type Selection as RACSelection,\n} from \"react-aria-components\";\nimport \"./select.css\";\n\nfunction itemKey(item: React.ReactElement): RACKey {\n const { id } = item.props as { id?: RACKey };\n return id ?? item.key ?? \"\";\n}\n\nfunction itemText(item: React.ReactElement): string {\n const { textValue, children } = item.props as {\n textValue?: string;\n children?: React.ReactNode;\n };\n if (textValue !== undefined) return textValue;\n return typeof children === \"string\" ? children : \"\";\n}\n\nfunction forEachItem(\n children: React.ReactNode,\n visit: (item: React.ReactElement) => void,\n) {\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child)) visit(child);\n });\n}\n\nfunction allItemKeys(children: React.ReactNode): Set<RACKey> {\n const keys = new Set<RACKey>();\n forEachItem(children, (item) => keys.add(itemKey(item)));\n return keys;\n}\n\ntype TextMatcher = (text: string, searchText: string) => boolean;\n\nfunction matchingItems(\n children: React.ReactNode,\n searchText: string,\n matches: TextMatcher,\n): React.ReactElement[] {\n return React.Children.toArray(children).filter(\n (child): child is React.ReactElement =>\n React.isValidElement(child) && matches(itemText(child), searchText),\n );\n}\n\nfunction keepHiddenSelection(\n previousKeys: Iterable<RACKey>,\n visibleKeys: RACKey[],\n visibleSelection: RACSelection,\n): Set<RACKey> {\n const visible = new Set(visibleKeys.map(String));\n const isVisible = (key: RACKey) => visible.has(String(key));\n const hiddenSelected = [...previousKeys].filter((key) => !isVisible(key));\n const visibleSelected =\n visibleSelection === \"all\"\n ? visibleKeys\n : [...visibleSelection].filter(isVisible);\n return new Set([...hiddenSelected, ...visibleSelected]);\n}\n\nfunction selectedItemsText(\n children: React.ReactNode,\n selectedKeys: Iterable<RACKey>,\n): string {\n const selected = new Set([...selectedKeys].map(String));\n const texts: string[] = [];\n forEachItem(children, (item) => {\n if (selected.has(String(itemKey(item)))) texts.push(itemText(item));\n });\n return texts.join(\", \");\n}\n\ninterface MultiSelectOptionsProps {\n children: React.ReactNode;\n selectedKeys: Iterable<RACKey>;\n onSelectionChange: (keys: Set<RACKey>) => void;\n disallowEmptySelection?: boolean;\n}\n\ninterface MultiSelectFieldBaseProps\n extends SharedFieldProps,\n MultiSelectOptionsProps {\n className?: string;\n isDisabled?: boolean;\n isInvalid?: boolean;\n \"aria-label\"?: string;\n}\n\nexport interface MultiSelectSearchProps {\n isSearchable: true;\n searchPlaceholder: string;\n emptyStateText: string;\n}\n\ninterface MultiSelectWithoutSearchProps {\n isSearchable?: false;\n searchPlaceholder?: never;\n emptyStateText?: never;\n}\n\nexport type MultiSelectFieldProps = MultiSelectFieldBaseProps &\n (MultiSelectSearchProps | MultiSelectWithoutSearchProps);\n\nfunction SearchableOptions({\n children,\n selectedKeys,\n onSelectionChange,\n disallowEmptySelection,\n listLabel,\n searchPlaceholder,\n emptyStateText,\n}: MultiSelectOptionsProps &\n Omit<MultiSelectSearchProps, \"isSearchable\"> & { listLabel?: string }) {\n const { contains } = useFilter({ sensitivity: \"base\" });\n const [searchText, setSearchText] = useState(\"\");\n const panelRef = useRef<HTMLDivElement>(null);\n const visibleItems = matchingItems(children, searchText, contains);\n const visibleKeys = visibleItems.map(itemKey);\n\n function moveFocusToList(event: React.KeyboardEvent<HTMLInputElement>) {\n if (event.key !== \"ArrowDown\" || visibleItems.length === 0) return;\n event.preventDefault();\n panelRef.current?.querySelector<HTMLElement>('[role=\"listbox\"]')?.focus();\n }\n\n return (\n <div ref={panelRef} className=\"select-search-panel\">\n <RACTextField\n aria-label={searchPlaceholder}\n value={searchText}\n onChange={setSearchText}\n autoFocus\n >\n <Input\n className=\"select-search-input\"\n placeholder={searchPlaceholder}\n onKeyDown={moveFocusToList}\n />\n </RACTextField>\n <ListBox\n aria-label={listLabel}\n selectionMode=\"multiple\"\n escapeKeyBehavior=\"none\"\n disallowEmptySelection={disallowEmptySelection}\n selectedKeys={selectedKeys}\n onSelectionChange={(keys: RACSelection) =>\n onSelectionChange(keepHiddenSelection(selectedKeys, visibleKeys, keys))\n }\n renderEmptyState={() => (\n <span className=\"select-empty-state\">{emptyStateText}</span>\n )}\n >\n {visibleItems}\n </ListBox>\n </div>\n );\n}\n\nexport function MultiSelectField({\n className,\n label,\n description,\n errorMessage,\n placeholder,\n children,\n selectedKeys,\n onSelectionChange,\n isDisabled,\n isInvalid,\n disallowEmptySelection,\n \"aria-label\": ariaLabel,\n ...searchProps\n}: MultiSelectFieldProps) {\n const classNames = clsx(className, \"select-container\");\n const portalContainer = useOverlayPortalContainer();\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [triggerWidth, setTriggerWidth] = useState<string>();\n\n const measureTrigger = useCallback(() => {\n if (triggerRef.current) {\n setTriggerWidth(`${triggerRef.current.offsetWidth}px`);\n }\n }, []);\n\n useLayoutEffect(() => {\n measureTrigger();\n const trigger = triggerRef.current;\n if (!trigger || typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measureTrigger);\n observer.observe(trigger);\n return () => observer.disconnect();\n }, [measureTrigger]);\n\n const chosenText = selectedItemsText(children, selectedKeys);\n\n return (\n <div className={classNames}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACMenuTrigger>\n <RACButton\n ref={triggerRef}\n className=\"select\"\n aria-label={ariaLabel}\n isDisabled={isDisabled}\n data-invalid={isInvalid || undefined}\n >\n <span\n className=\"select-value\"\n data-placeholder={chosenText === \"\" || undefined}\n title={chosenText || undefined}\n >\n {chosenText === \"\" ? placeholder : chosenText}\n </span>\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n <RACPopover\n className=\"select-popover\"\n style={{ \"--trigger-width\": triggerWidth } as React.CSSProperties}\n UNSTABLE_portalContainer={portalContainer}\n >\n {searchProps.isSearchable ? (\n <SearchableOptions\n listLabel={label ?? ariaLabel}\n selectedKeys={selectedKeys}\n onSelectionChange={onSelectionChange}\n disallowEmptySelection={disallowEmptySelection}\n searchPlaceholder={searchProps.searchPlaceholder}\n emptyStateText={searchProps.emptyStateText}\n >\n {children}\n </SearchableOptions>\n ) : (\n <ListBox\n aria-label={label ?? ariaLabel}\n autoFocus\n selectionMode=\"multiple\"\n escapeKeyBehavior=\"none\"\n disallowEmptySelection={disallowEmptySelection}\n selectedKeys={selectedKeys}\n onSelectionChange={(keys: RACSelection) =>\n onSelectionChange(\n keys === \"all\" ? allItemKeys(children) : new Set(keys),\n )\n }\n >\n {children}\n </ListBox>\n )}\n </RACPopover>\n </RACMenuTrigger>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </div>\n );\n}\n"],"names":["itemKey","item","id","itemText","textValue","children","forEachItem","visit","React","child","allItemKeys","keys","matchingItems","searchText","matches","keepHiddenSelection","previousKeys","visibleKeys","visibleSelection","visible","isVisible","key","hiddenSelected","visibleSelected","selectedItemsText","selectedKeys","selected","texts","SearchableOptions","onSelectionChange","disallowEmptySelection","listLabel","searchPlaceholder","emptyStateText","contains","useFilter","setSearchText","useState","panelRef","useRef","visibleItems","moveFocusToList","event","_b","_a","jsxs","jsx","RACTextField","Input","ListBox","MultiSelectField","className","label","description","errorMessage","placeholder","isDisabled","isInvalid","ariaLabel","searchProps","classNames","clsx","portalContainer","useOverlayPortalContainer","triggerRef","triggerWidth","setTriggerWidth","measureTrigger","useCallback","useLayoutEffect","trigger","observer","chosenText","Field","Label","RACMenuTrigger","RACButton","IconChevronDown","RACPopover","Description","FieldError"],"mappings":"kcAwBA,SAASA,EAAQC,EAAkC,CACjD,KAAM,CAAE,GAAAC,GAAOD,EAAK,MACpB,OAAOC,GAAMD,EAAK,KAAO,EAC3B,CAEA,SAASE,EAASF,EAAkC,CAClD,KAAM,CAAE,UAAAG,EAAW,SAAAC,CAAA,EAAaJ,EAAK,MAIrC,OAAIG,IAAc,OAAkBA,EAC7B,OAAOC,GAAa,SAAWA,EAAW,EACnD,CAEA,SAASC,EACPD,EACAE,EACA,CACAC,EAAM,SAAS,QAAQH,EAAWI,GAAU,CACtCD,EAAM,eAAeC,CAAK,KAASA,CAAK,CAC9C,CAAC,CACH,CAEA,SAASC,EAAYL,EAAwC,CAC3D,MAAMM,MAAW,IACjB,OAAAL,EAAYD,EAAWJ,GAASU,EAAK,IAAIX,EAAQC,CAAI,CAAC,CAAC,EAChDU,CACT,CAIA,SAASC,EACPP,EACAQ,EACAC,EACsB,CACtB,OAAON,EAAM,SAAS,QAAQH,CAAQ,EAAE,OACrCI,GACCD,EAAM,eAAeC,CAAK,GAAKK,EAAQX,EAASM,CAAK,EAAGI,CAAU,CAAA,CAExE,CAEA,SAASE,EACPC,EACAC,EACAC,EACa,CACb,MAAMC,EAAU,IAAI,IAAIF,EAAY,IAAI,MAAM,CAAC,EACzCG,EAAaC,GAAgBF,EAAQ,IAAI,OAAOE,CAAG,CAAC,EACpDC,EAAiB,CAAC,GAAGN,CAAY,EAAE,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