@apipass/design-system 1.21.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/lib/embedded-styles.js +1 -1
  2. package/dist/lib/lib.index.cjs +1 -1
  3. package/dist/lib/lib.index.js +195 -191
  4. package/dist/lib/lib.index.js.map +1 -1
  5. package/dist/lib/style.css +1 -1
  6. package/dist/lib/ui/components/Widget/Widget.cjs +1 -1
  7. package/dist/lib/ui/components/Widget/Widget.cjs.map +1 -1
  8. package/dist/lib/ui/components/Widget/Widget.js +73 -27
  9. package/dist/lib/ui/components/Widget/Widget.js.map +1 -1
  10. package/dist/lib/ui/components/charts/TimeSeriesChart/TimeSeriesChart.cjs +2 -0
  11. package/dist/lib/ui/components/charts/TimeSeriesChart/TimeSeriesChart.cjs.map +1 -0
  12. package/dist/lib/ui/components/charts/TimeSeriesChart/TimeSeriesChart.js +61 -0
  13. package/dist/lib/ui/components/charts/TimeSeriesChart/TimeSeriesChart.js.map +1 -0
  14. package/dist/lib/ui/components/charts/TimeSeriesChart/time-series-option.cjs +2 -0
  15. package/dist/lib/ui/components/charts/TimeSeriesChart/time-series-option.cjs.map +1 -0
  16. package/dist/lib/ui/components/charts/TimeSeriesChart/time-series-option.js +93 -0
  17. package/dist/lib/ui/components/charts/TimeSeriesChart/time-series-option.js.map +1 -0
  18. package/dist/lib/ui/components/charts/chart-palette.cjs +2 -0
  19. package/dist/lib/ui/components/charts/chart-palette.cjs.map +1 -0
  20. package/dist/lib/ui/components/charts/chart-palette.js +16 -0
  21. package/dist/lib/ui/components/charts/chart-palette.js.map +1 -0
  22. package/dist/lib/ui/components/charts/chart-theme.cjs +2 -0
  23. package/dist/lib/ui/components/charts/chart-theme.cjs.map +1 -0
  24. package/dist/lib/ui/components/charts/chart-theme.js +35 -0
  25. package/dist/lib/ui/components/charts/chart-theme.js.map +1 -0
  26. package/dist/lib/ui/components/charts/echarts-modules.cjs +2 -0
  27. package/dist/lib/ui/components/charts/echarts-modules.cjs.map +1 -0
  28. package/dist/lib/ui/components/charts/echarts-modules.js +19 -0
  29. package/dist/lib/ui/components/charts/echarts-modules.js.map +1 -0
  30. package/dist/lib/ui/components/charts/useChartInstance.cjs +2 -0
  31. package/dist/lib/ui/components/charts/useChartInstance.cjs.map +1 -0
  32. package/dist/lib/ui/components/charts/useChartInstance.js +32 -0
  33. package/dist/lib/ui/components/charts/useChartInstance.js.map +1 -0
  34. package/dist/types/ui/components/Widget/Widget.d.ts +16 -1
  35. package/dist/types/ui/components/charts/TimeSeriesChart/TimeSeriesChart.d.ts +15 -0
  36. package/dist/types/ui/components/charts/TimeSeriesChart/time-series-option.d.ts +39 -0
  37. package/dist/types/ui/components/charts/chart-palette.d.ts +1 -0
  38. package/dist/types/ui/components/charts/chart-theme.d.ts +11 -0
  39. package/dist/types/ui/components/charts/echarts-modules.d.ts +3 -0
  40. package/dist/types/ui/components/charts/useChartInstance.d.ts +10 -0
  41. package/dist/types/ui/components/index.d.ts +2 -0
  42. package/package.json +6 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../../../vendor/clsx/dist/clsx.cjs"),l=require("react");;/* empty css */const g=require("../../primitives/Tooltip/Tooltip.cjs"),u=require("../../icons/IconInfo.cjs"),h=require("../../primitives/IconButton/IconButton.cjs"),m=l.forwardRef(function({title:i,description:t,descriptionButtonLabel:r,headerActions:s,children:n,className:a,...c},d){return e.jsxs("div",{ref:d,className:o.clsx("widget",a),...c,children:[e.jsxs("div",{className:"widget-header widget-drag-handle",children:[e.jsxs("span",{className:"widget-header-title-group",children:[e.jsx("span",{className:"widget-header-title",children:i}),t&&e.jsx(g.Tooltip,{content:t,placement:"bottom",offset:4,children:e.jsx(h.IconButton,{"aria-label":r,variant:"subtle",size:"small",className:"widget-header-description-trigger",children:e.jsx(u.IconInfo,{size:"14"})})})]}),s&&e.jsx("div",{className:"widget-header-actions",children:s})]}),e.jsx("div",{className:"widget-body",children:n})]})});exports.Widget=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("../../../vendor/clsx/dist/clsx.cjs"),i=require("react");;/* empty css */const y=require("../../primitives/Tooltip/Tooltip.cjs"),z=require("../../icons/IconInfo.cjs"),B=require("../../icons/IconChevronDown.cjs"),u=require("../../primitives/IconButton/IconButton.cjs"),S=i.forwardRef(function({title:g,description:o,descriptionButtonLabel:x,headerActions:n,isCollapsible:s,collapseButtonLabel:m,expandButtonLabel:h,collapsed:a,defaultCollapsed:j,onCollapsedChange:r,children:w,className:f,...v},I){const d=i.useId(),c=a!==void 0,[p,N]=i.useState(j??!1),t=s===!0&&(c?a===!0:p);function q(){const l=!t;c||N(l),r==null||r(l)}return e.jsxs("div",{ref:I,className:b.clsx("widget",f),...v,"data-collapsed":t||void 0,children:[e.jsxs("div",{className:"widget-header widget-drag-handle",children:[e.jsxs("span",{className:"widget-header-title-group",children:[e.jsx("span",{className:"widget-header-title",children:g}),o&&e.jsx(y.Tooltip,{content:o,placement:"bottom",offset:4,children:e.jsx(u.IconButton,{"aria-label":x,variant:"subtle",size:"small",className:"widget-header-description-trigger",children:e.jsx(z.IconInfo,{size:"14"})})})]}),(n||s)&&e.jsxs("div",{className:"widget-header-actions",children:[n,s&&e.jsx(u.IconButton,{"aria-label":t?h:m,"aria-expanded":!t,"aria-controls":d,variant:"subtle",size:"small",className:"widget-header-collapse-trigger",onPress:q,children:e.jsx(B.IconChevronDown,{size:"16",className:"widget-header-collapse-indicator"})})]})]}),e.jsx("div",{id:d,className:"widget-body",hidden:t,children:w})]})});exports.Widget=S;
2
2
  //# sourceMappingURL=Widget.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Widget.cjs","sources":["../../../../../src/ui/components/Widget/Widget.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, type ReactNode, forwardRef } from \"react\";\nimport { IconInfo } from \"icons\";\nimport { IconButton, Tooltip } from \"primitives\";\nimport \"./widget.css\";\n\ntype WidgetDescriptionProps =\n | { description?: undefined; descriptionButtonLabel?: undefined }\n | { description: ReactNode; descriptionButtonLabel: string };\n\nexport type WidgetProps = Omit<ComponentPropsWithoutRef<\"div\">, \"title\"> &\n WidgetDescriptionProps & {\n title: ReactNode;\n headerActions?: ReactNode;\n };\n\nexport const Widget = forwardRef<HTMLDivElement, WidgetProps>(function Widget(\n { title, description, descriptionButtonLabel, headerActions, children, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={clsx(\"widget\", className)} {...props}>\n <div className=\"widget-header widget-drag-handle\">\n <span className=\"widget-header-title-group\">\n <span className=\"widget-header-title\">{title}</span>\n {description && (\n <Tooltip content={description} placement=\"bottom\" offset={4}>\n <IconButton\n aria-label={descriptionButtonLabel}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-description-trigger\"\n >\n <IconInfo size=\"14\" />\n </IconButton>\n </Tooltip>\n )}\n </span>\n {headerActions && <div className=\"widget-header-actions\">{headerActions}</div>}\n </div>\n <div className=\"widget-body\">{children}</div>\n </div>\n );\n});\n"],"names":["Widget","forwardRef","title","description","descriptionButtonLabel","headerActions","children","className","props","ref","jsxs","clsx","jsx","Tooltip","IconButton","IconInfo"],"mappings":"0WAgBaA,EAASC,EAAAA,WAAwC,SAC5D,CAAE,MAAAC,EAAO,YAAAC,EAAa,uBAAAC,EAAwB,cAAAC,EAAe,SAAAC,EAAU,UAAAC,EAAW,GAAGC,CAAA,EACrFC,EACA,CACA,OACEC,OAAC,OAAI,IAAAD,EAAU,UAAWE,OAAK,SAAUJ,CAAS,EAAI,GAAGC,EACvD,SAAA,CAAAE,EAAAA,KAAC,MAAA,CAAI,UAAU,mCACb,SAAA,CAAAA,EAAAA,KAAC,OAAA,CAAK,UAAU,4BACd,SAAA,CAAAE,EAAAA,IAAC,OAAA,CAAK,UAAU,sBAAuB,SAAAV,EAAM,EAC5CC,SACEU,UAAA,CAAQ,QAASV,EAAa,UAAU,SAAS,OAAQ,EACxD,SAAAS,EAAAA,IAACE,EAAAA,WAAA,CACC,aAAYV,EACZ,QAAQ,SACR,KAAK,QACL,UAAU,oCAEV,SAAAQ,EAAAA,IAACG,EAAAA,SAAA,CAAS,KAAK,IAAA,CAAK,CAAA,CAAA,CACtB,CACF,CAAA,EAEJ,EACCV,GAAiBO,EAAAA,IAAC,MAAA,CAAI,UAAU,wBAAyB,SAAAP,CAAA,CAAc,CAAA,EAC1E,EACAO,EAAAA,IAAC,MAAA,CAAI,UAAU,cAAe,SAAAN,CAAA,CAAS,CAAA,EACzC,CAEJ,CAAC"}
1
+ {"version":3,"file":"Widget.cjs","sources":["../../../../../src/ui/components/Widget/Widget.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, type ReactNode, forwardRef, useId, useState } from \"react\";\nimport { IconChevronDown, IconInfo } from \"icons\";\nimport { IconButton, Tooltip } from \"primitives\";\nimport \"./widget.css\";\n\ntype WidgetDescriptionProps =\n | { description?: undefined; descriptionButtonLabel?: undefined }\n | { description: ReactNode; descriptionButtonLabel: string };\n\ntype WidgetCollapseProps =\n | {\n isCollapsible?: false;\n collapseButtonLabel?: undefined;\n expandButtonLabel?: undefined;\n collapsed?: undefined;\n defaultCollapsed?: undefined;\n onCollapsedChange?: undefined;\n }\n | {\n isCollapsible: true;\n collapseButtonLabel: string;\n expandButtonLabel: string;\n collapsed?: boolean;\n defaultCollapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n };\n\nexport type WidgetProps = Omit<ComponentPropsWithoutRef<\"div\">, \"title\"> &\n WidgetDescriptionProps &\n WidgetCollapseProps & {\n title: ReactNode;\n headerActions?: ReactNode;\n };\n\nexport const Widget = forwardRef<HTMLDivElement, WidgetProps>(function Widget(\n {\n title,\n description,\n descriptionButtonLabel,\n headerActions,\n isCollapsible,\n collapseButtonLabel,\n expandButtonLabel,\n collapsed,\n defaultCollapsed,\n onCollapsedChange,\n children,\n className,\n ...props\n },\n ref,\n) {\n const bodyId: string = useId();\n const isCollapsedControlled: boolean = collapsed !== undefined;\n const [uncontrolledCollapsed, setUncontrolledCollapsed] = useState<boolean>(\n defaultCollapsed ?? false,\n );\n const isCollapsed: boolean =\n isCollapsible === true && (isCollapsedControlled ? collapsed === true : uncontrolledCollapsed);\n\n function toggleCollapsed(): void {\n const nextCollapsed: boolean = !isCollapsed;\n if (!isCollapsedControlled) setUncontrolledCollapsed(nextCollapsed);\n onCollapsedChange?.(nextCollapsed);\n }\n\n return (\n <div\n ref={ref}\n className={clsx(\"widget\", className)}\n {...props}\n data-collapsed={isCollapsed || undefined}\n >\n <div className=\"widget-header widget-drag-handle\">\n <span className=\"widget-header-title-group\">\n <span className=\"widget-header-title\">{title}</span>\n {description && (\n <Tooltip content={description} placement=\"bottom\" offset={4}>\n <IconButton\n aria-label={descriptionButtonLabel}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-description-trigger\"\n >\n <IconInfo size=\"14\" />\n </IconButton>\n </Tooltip>\n )}\n </span>\n {(headerActions || isCollapsible) && (\n <div className=\"widget-header-actions\">\n {headerActions}\n {isCollapsible && (\n <IconButton\n aria-label={isCollapsed ? expandButtonLabel : collapseButtonLabel}\n aria-expanded={!isCollapsed}\n aria-controls={bodyId}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-collapse-trigger\"\n onPress={toggleCollapsed}\n >\n <IconChevronDown size=\"16\" className=\"widget-header-collapse-indicator\" />\n </IconButton>\n )}\n </div>\n )}\n </div>\n <div id={bodyId} className=\"widget-body\" hidden={isCollapsed}>\n {children}\n </div>\n </div>\n );\n});\n"],"names":["Widget","forwardRef","title","description","descriptionButtonLabel","headerActions","isCollapsible","collapseButtonLabel","expandButtonLabel","collapsed","defaultCollapsed","onCollapsedChange","children","className","props","ref","bodyId","useId","isCollapsedControlled","uncontrolledCollapsed","setUncontrolledCollapsed","useState","isCollapsed","toggleC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CACC,aAAYP,EAAcd,EAAoBD,EAC9C,gBAAe,CAACe,EAChB,gBAAeN,EACf,QAAQ,SACR,KAAK,QACL,UAAU,iCACV,QAASO,EAET,SAAAI,EAAAA,IAACI,kBAAA,CAAgB,KAAK,KAAK,UAAU,kCAAA,CAAmC,CAAA,CAAA,CAC1E,CAAA,CAEJ,CAAA,EAEJ,EACAJ,MAAC,OAAI,GAAIX,EAAQ,UAAU,cAAc,OAAQM,EAC9C,SAAAV,CAAA,CACH,CAAA,CAAA,CAAA,CAGN,CAAC"}
@@ -1,32 +1,78 @@
1
- import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
- import { clsx as n } from "../../../vendor/clsx/dist/clsx.js";
3
- import { forwardRef as c } from "react";
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import { clsx as j } from "../../../vendor/clsx/dist/clsx.js";
3
+ import { forwardRef as y, useId as W, useState as B } from "react";
4
4
  /* empty css */
5
- import { Tooltip as g } from "../../primitives/Tooltip/Tooltip.js";
6
- import { IconInfo as p } from "../../icons/IconInfo.js";
7
- import { IconButton as f } from "../../primitives/IconButton/IconButton.js";
8
- const j = c(function({ title: a, description: t, descriptionButtonLabel: d, headerActions: r, children: o, className: s, ...l }, m) {
9
- return /* @__PURE__ */ i("div", { ref: m, className: n("widget", s), ...l, children: [
10
- /* @__PURE__ */ i("div", { className: "widget-header widget-drag-handle", children: [
11
- /* @__PURE__ */ i("span", { className: "widget-header-title-group", children: [
12
- /* @__PURE__ */ e("span", { className: "widget-header-title", children: a }),
13
- t && /* @__PURE__ */ e(g, { content: t, placement: "bottom", offset: 4, children: /* @__PURE__ */ e(
14
- f,
15
- {
16
- "aria-label": d,
17
- variant: "subtle",
18
- size: "small",
19
- className: "widget-header-description-trigger",
20
- children: /* @__PURE__ */ e(p, { size: "14" })
21
- }
22
- ) })
23
- ] }),
24
- r && /* @__PURE__ */ e("div", { className: "widget-header-actions", children: r })
25
- ] }),
26
- /* @__PURE__ */ e("div", { className: "widget-body", children: o })
27
- ] });
5
+ import { Tooltip as D } from "../../primitives/Tooltip/Tooltip.js";
6
+ import { IconInfo as P } from "../../icons/IconInfo.js";
7
+ import { IconChevronDown as R } from "../../icons/IconChevronDown.js";
8
+ import { IconButton as m } from "../../primitives/IconButton/IconButton.js";
9
+ const J = y(function({
10
+ title: p,
11
+ description: a,
12
+ descriptionButtonLabel: f,
13
+ headerActions: d,
14
+ isCollapsible: i,
15
+ collapseButtonLabel: g,
16
+ expandButtonLabel: h,
17
+ collapsed: s,
18
+ defaultCollapsed: u,
19
+ onCollapsedChange: o,
20
+ children: w,
21
+ className: v,
22
+ ...N
23
+ }, x) {
24
+ const l = W(), c = s !== void 0, [I, b] = B(
25
+ u ?? !1
26
+ ), t = i === !0 && (c ? s === !0 : I);
27
+ function z() {
28
+ const n = !t;
29
+ c || b(n), o == null || o(n);
30
+ }
31
+ return /* @__PURE__ */ r(
32
+ "div",
33
+ {
34
+ ref: x,
35
+ className: j("widget", v),
36
+ ...N,
37
+ "data-collapsed": t || void 0,
38
+ children: [
39
+ /* @__PURE__ */ r("div", { className: "widget-header widget-drag-handle", children: [
40
+ /* @__PURE__ */ r("span", { className: "widget-header-title-group", children: [
41
+ /* @__PURE__ */ e("span", { className: "widget-header-title", children: p }),
42
+ a && /* @__PURE__ */ e(D, { content: a, placement: "bottom", offset: 4, children: /* @__PURE__ */ e(
43
+ m,
44
+ {
45
+ "aria-label": f,
46
+ variant: "subtle",
47
+ size: "small",
48
+ className: "widget-header-description-trigger",
49
+ children: /* @__PURE__ */ e(P, { size: "14" })
50
+ }
51
+ ) })
52
+ ] }),
53
+ (d || i) && /* @__PURE__ */ r("div", { className: "widget-header-actions", children: [
54
+ d,
55
+ i && /* @__PURE__ */ e(
56
+ m,
57
+ {
58
+ "aria-label": t ? h : g,
59
+ "aria-expanded": !t,
60
+ "aria-controls": l,
61
+ variant: "subtle",
62
+ size: "small",
63
+ className: "widget-header-collapse-trigger",
64
+ onPress: z,
65
+ children: /* @__PURE__ */ e(R, { size: "16", className: "widget-header-collapse-indicator" })
66
+ }
67
+ )
68
+ ] })
69
+ ] }),
70
+ /* @__PURE__ */ e("div", { id: l, className: "widget-body", hidden: t, children: w })
71
+ ]
72
+ }
73
+ );
28
74
  });
29
75
  export {
30
- j as Widget
76
+ J as Widget
31
77
  };
32
78
  //# sourceMappingURL=Widget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Widget.js","sources":["../../../../../src/ui/components/Widget/Widget.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, type ReactNode, forwardRef } from \"react\";\nimport { IconInfo } from \"icons\";\nimport { IconButton, Tooltip } from \"primitives\";\nimport \"./widget.css\";\n\ntype WidgetDescriptionProps =\n | { description?: undefined; descriptionButtonLabel?: undefined }\n | { description: ReactNode; descriptionButtonLabel: string };\n\nexport type WidgetProps = Omit<ComponentPropsWithoutRef<\"div\">, \"title\"> &\n WidgetDescriptionProps & {\n title: ReactNode;\n headerActions?: ReactNode;\n };\n\nexport const Widget = forwardRef<HTMLDivElement, WidgetProps>(function Widget(\n { title, description, descriptionButtonLabel, headerActions, children, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={clsx(\"widget\", className)} {...props}>\n <div className=\"widget-header widget-drag-handle\">\n <span className=\"widget-header-title-group\">\n <span className=\"widget-header-title\">{title}</span>\n {description && (\n <Tooltip content={description} placement=\"bottom\" offset={4}>\n <IconButton\n aria-label={descriptionButtonLabel}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-description-trigger\"\n >\n <IconInfo size=\"14\" />\n </IconButton>\n </Tooltip>\n )}\n </span>\n {headerActions && <div className=\"widget-header-actions\">{headerActions}</div>}\n </div>\n <div className=\"widget-body\">{children}</div>\n </div>\n );\n});\n"],"names":["Widget","forwardRef","title","description","descriptionButtonLabel","headerActions","children","className","props","ref","jsxs","clsx","jsx","Tooltip","IconButton","IconInfo"],"mappings":";;;;;;;AAgBO,MAAMA,IAASC,EAAwC,SAC5D,EAAE,OAAAC,GAAO,aAAAC,GAAa,wBAAAC,GAAwB,eAAAC,GAAe,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GACrFC,GACA;AACA,SACE,gBAAAC,EAAC,SAAI,KAAAD,GAAU,WAAWE,EAAK,UAAUJ,CAAS,GAAI,GAAGC,GACvD,UAAA;AAAA,IAAA,gBAAAE,EAAC,OAAA,EAAI,WAAU,oCACb,UAAA;AAAA,MAAA,gBAAAA,EAAC,QAAA,EAAK,WAAU,6BACd,UAAA;AAAA,QAAA,gBAAAE,EAAC,QAAA,EAAK,WAAU,uBAAuB,UAAAV,GAAM;AAAA,QAC5CC,uBACEU,GAAA,EAAQ,SAASV,GAAa,WAAU,UAAS,QAAQ,GACxD,UAAA,gBAAAS;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,cAAYV;AAAA,YACZ,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,WAAU;AAAA,YAEV,UAAA,gBAAAQ,EAACG,GAAA,EAAS,MAAK,KAAA,CAAK;AAAA,UAAA;AAAA,QAAA,EACtB,CACF;AAAA,MAAA,GAEJ;AAAA,MACCV,KAAiB,gBAAAO,EAAC,OAAA,EAAI,WAAU,yBAAyB,UAAAP,EAAA,CAAc;AAAA,IAAA,GAC1E;AAAA,IACA,gBAAAO,EAAC,OAAA,EAAI,WAAU,eAAe,UAAAN,EAAA,CAAS;AAAA,EAAA,GACzC;AAEJ,CAAC;"}
1
+ {"version":3,"file":"Widget.js","sources":["../../../../../src/ui/components/Widget/Widget.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, type ReactNode, forwardRef, useId, useState } from \"react\";\nimport { IconChevronDown, IconInfo } from \"icons\";\nimport { IconButton, Tooltip } from \"primitives\";\nimport \"./widget.css\";\n\ntype WidgetDescriptionProps =\n | { description?: undefined; descriptionButtonLabel?: undefined }\n | { description: ReactNode; descriptionButtonLabel: string };\n\ntype WidgetCollapseProps =\n | {\n isCollapsible?: false;\n collapseButtonLabel?: undefined;\n expandButtonLabel?: undefined;\n collapsed?: undefined;\n defaultCollapsed?: undefined;\n onCollapsedChange?: undefined;\n }\n | {\n isCollapsible: true;\n collapseButtonLabel: string;\n expandButtonLabel: string;\n collapsed?: boolean;\n defaultCollapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n };\n\nexport type WidgetProps = Omit<ComponentPropsWithoutRef<\"div\">, \"title\"> &\n WidgetDescriptionProps &\n WidgetCollapseProps & {\n title: ReactNode;\n headerActions?: ReactNode;\n };\n\nexport const Widget = forwardRef<HTMLDivElement, WidgetProps>(function Widget(\n {\n title,\n description,\n descriptionButtonLabel,\n headerActions,\n isCollapsible,\n collapseButtonLabel,\n expandButtonLabel,\n collapsed,\n defaultCollapsed,\n onCollapsedChange,\n children,\n className,\n ...props\n },\n ref,\n) {\n const bodyId: string = useId();\n const isCollapsedControlled: boolean = collapsed !== undefined;\n const [uncontrolledCollapsed, setUncontrolledCollapsed] = useState<boolean>(\n defaultCollapsed ?? false,\n );\n const isCollapsed: boolean =\n isCollapsible === true && (isCollapsedControlled ? collapsed === true : uncontrolledCollapsed);\n\n function toggleCollapsed(): void {\n const nextCollapsed: boolean = !isCollapsed;\n if (!isCollapsedControlled) setUncontrolledCollapsed(nextCollapsed);\n onCollapsedChange?.(nextCollapsed);\n }\n\n return (\n <div\n ref={ref}\n className={clsx(\"widget\", className)}\n {...props}\n data-collapsed={isCollapsed || undefined}\n >\n <div className=\"widget-header widget-drag-handle\">\n <span className=\"widget-header-title-group\">\n <span className=\"widget-header-title\">{title}</span>\n {description && (\n <Tooltip content={description} placement=\"bottom\" offset={4}>\n <IconButton\n aria-label={descriptionButtonLabel}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-description-trigger\"\n >\n <IconInfo size=\"14\" />\n </IconButton>\n </Tooltip>\n )}\n </span>\n {(headerActions || isCollapsible) && (\n <div className=\"widget-header-actions\">\n {headerActions}\n {isCollapsible && (\n <IconButton\n aria-label={isCollapsed ? expandButtonLabel : collapseButtonLabel}\n aria-expanded={!isCollapsed}\n aria-controls={bodyId}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-collapse-trigger\"\n onPress={toggleCollapsed}\n >\n <IconChevronDown size=\"16\" className=\"widget-header-collapse-indicator\" />\n </IconButton>\n )}\n </div>\n )}\n </div>\n <div id={bodyId} className=\"widget-body\" hidden={isCollapsed}>\n {children}\n </div>\n </div>\n );\n});\n"],"names":["Widget","forwardRef","title","description","descriptionButtonLabel","headerActions","isCollapsible","collapseButtonLabel","expandButtonLabel","collapsed","defaultCollapsed","onCollapsedChange","children","className","props","ref","bodyId","useId","isCollapsedControlled","uncontrolledCollapsed","setUncontrolledCollapsed","useState","isCollapsed","toggleCollapsed","nextCollapsed","jsxs","clsx","jsx","Tooltip","IconButton","IconInfo","IconChevronDown"],"mappings":";;;;;;;;AAmCO,MAAMA,IAASC,EAAwC,SAC5D;AAAA,EACE,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAiBC,EAAA,GACjBC,IAAiCT,MAAc,QAC/C,CAACU,GAAuBC,CAAwB,IAAIC;AAAA,IACxDX,KAAoB;AAAA,EAAA,GAEhBY,IACJhB,MAAkB,OAASY,IAAwBT,MAAc,KAAOU;AAE1E,WAASI,IAAwB;AAC/B,UAAMC,IAAyB,CAACF;AAChC,IAAKJ,KAAuBE,EAAyBI,CAAa,GAClEb,KAAA,QAAAA,EAAoBa;AAAA,EACtB;AAEA,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAV;AAAA,MACA,WAAWW,EAAK,UAAUb,CAAS;AAAA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../../../../vendor/clsx/dist/clsx.cjs"),d=require("react"),h=require("../useChartInstance.cjs"),P=require("./time-series-option.cjs");;/* empty css */const _={},E={};function M({series:e,displayType:n="line",legend:o="inline",line:c=E,yAxis:s=_,showSymbols:u=!1,showValueLabels:a=!1,valueFormatter:f,className:T,...m}){const{containerRef:q,chart:r,theme:t,resolveSeriesColor:l}=h.useChartInstance();return d.useEffect(()=>{if(!r||!t)return;const O={};for(const i of e){if(!i.colorToken)continue;const S=l(i.colorToken);S&&(O[i.id]=S)}r.setOption(P.buildTimeSeriesOption({series:e,displayType:n,legend:o,line:c,yAxis:s,theme:t,showSymbols:u,showValueLabels:a,seriesColorOverrides:O,valueFormatter:f}),{notMerge:!0})},[r,t,l,e,n,o,c,s,u,a,f]),C.jsx("div",{ref:q,className:I.clsx("time-series-chart",T),...m})}exports.TimeSeriesChart=M;
2
+ //# sourceMappingURL=TimeSeriesChart.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeSeriesChart.cjs","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/TimeSeriesChart.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, useEffect } from \"react\";\nimport { useChartInstance, type ChartInstance } from \"../useChartInstance\";\nimport {\n buildTimeSeriesOption,\n type TimeSeriesData,\n type TimeSeriesDisplayType,\n type TimeSeriesLegendMode,\n type TimeSeriesLineOptions,\n type TimeSeriesYAxisOptions,\n} from \"./time-series-option\";\nimport \"./time-series-chart.css\";\n\nexport type {\n TimeSeriesData,\n TimeSeriesDisplayType,\n TimeSeriesLegendMode,\n TimeSeriesLineOptions,\n TimeSeriesLineStyle,\n TimeSeriesLineWidth,\n TimeSeriesPoint,\n TimeSeriesYAxisOptions,\n} from \"./time-series-option\";\n\nexport type TimeSeriesChartProps = Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> & {\n series: TimeSeriesData[];\n displayType?: TimeSeriesDisplayType;\n legend?: TimeSeriesLegendMode;\n line?: TimeSeriesLineOptions;\n yAxis?: TimeSeriesYAxisOptions;\n showSymbols?: boolean;\n showValueLabels?: boolean;\n valueFormatter?: (value: number) => string;\n};\n\nconst EMPTY_Y_AXIS_OPTIONS: TimeSeriesYAxisOptions = {};\n\nconst EMPTY_LINE_OPTIONS: TimeSeriesLineOptions = {};\n\nexport function TimeSeriesChart({\n series,\n displayType = \"line\",\n legend = \"inline\",\n line = EMPTY_LINE_OPTIONS,\n yAxis = EMPTY_Y_AXIS_OPTIONS,\n showSymbols = false,\n showValueLabels = false,\n valueFormatter,\n className,\n ...props\n}: TimeSeriesChartProps) {\n const { containerRef, chart, theme, resolveSeriesColor }: ChartInstance = useChartInstance();\n\n useEffect(() => {\n if (!chart || !theme) return;\n\n const seriesColorOverrides: Record<string, string> = {};\n for (const data of series) {\n if (!data.colorToken) continue;\n const color: string | undefined = resolveSeriesColor(data.colorToken);\n if (color) seriesColorOverrides[data.id] = color;\n }\n\n // `notMerge` evita que uma série removida da configuração continue desenhada: o ECharts\n // casa séries por id e mantém as que não aparecem na opção nova.\n chart.setOption(\n buildTimeSeriesOption({\n series,\n displayType,\n legend,\n line,\n yAxis,\n theme,\n showSymbols,\n showValueLabels,\n seriesColorOverrides,\n valueFormatter,\n }),\n { notMerge: true },\n );\n }, [\n chart,\n theme,\n resolveSeriesColor,\n series,\n displayType,\n legend,\n line,\n yAxis,\n showSymbols,\n showValueLabels,\n valueFormatter,\n ]);\n\n return <div ref={containerRef} className={clsx(\"time-series-chart\", className)} {...props} />;\n}\n"],"names":["EMPTY_Y_AXIS_OPTIONS","EMPTY_LINE_OPTIONS","TimeSeriesChart","series","displayType","legend","line","yAxis","showSymbols","showValueLabels","valueFormatter","className","props","containerRef","chart","theme","resolveSeriesColor","useChartInstance","useEffect","seriesColorOverrides","data","color","buildTimeSeriesOption","jsx","clsx"],"mappings":"6SAmCA,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,UAAAC,EACA,GAAGC,CACL,EAAyB,CACvB,KAAM,CAAE,aAAAC,EAAc,MAAAC,EAAO,MAAAC,EAAO,mBAAAC,CAAA,EAAsCC,EAAAA,iBAAA,EAE1EC,OAAAA,EAAAA,UAAU,IAAM,CACd,GAAI,CAACJ,GAAS,CAACC,EAAO,OAEtB,MAAMI,EAA+C,CAAA,EACrD,UAAWC,KAAQjB,EAAQ,CACzB,GAAI,CAACiB,EAAK,WAAY,SACtB,MAAMC,EAA4BL,EAAmBI,EAAK,UAAU,EAChEC,IAAOF,EAAqBC,EAAK,EAAE,EAAIC,EAC7C,CAIAP,EAAM,UACJQ,wBAAsB,CACpB,OAAAnB,EACA,YAAAC,EACA,OAAAC,EACA,KAAAC,EACA,MAAAC,EACA,MAAAQ,EACA,YAAAP,EACA,gBAAAC,EACA,qBAAAU,EACA,eAAAT,CAAA,CACD,EACD,CAAE,SAAU,EAAA,CAAK,CAErB,EAAG,CACDI,EACAC,EACAC,EACAb,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,CAAA,CACD,EAEMa,MAAC,MAAA,CAAI,IAAKV,EAAc,UAAWW,EAAAA,KAAK,oBAAqBb,CAAS,EAAI,GAAGC,CAAA,CAAO,CAC7F"}
@@ -0,0 +1,61 @@
1
+ import { jsx as S } from "react/jsx-runtime";
2
+ import { clsx as _ } from "../../../../vendor/clsx/dist/clsx.js";
3
+ import { useEffect as C } from "react";
4
+ import { useChartInstance as E } from "../useChartInstance.js";
5
+ import { buildTimeSeriesOption as N } from "./time-series-option.js";
6
+ /* empty css */
7
+ const P = {}, d = {};
8
+ function j({
9
+ series: o,
10
+ displayType: i = "line",
11
+ legend: n = "inline",
12
+ line: c = d,
13
+ yAxis: f = P,
14
+ showSymbols: s = !1,
15
+ showValueLabels: m = !1,
16
+ valueFormatter: a,
17
+ className: l,
18
+ ...u
19
+ }) {
20
+ const { containerRef: I, chart: r, theme: t, resolveSeriesColor: p } = E();
21
+ return C(() => {
22
+ if (!r || !t) return;
23
+ const O = {};
24
+ for (const e of o) {
25
+ if (!e.colorToken) continue;
26
+ const T = p(e.colorToken);
27
+ T && (O[e.id] = T);
28
+ }
29
+ r.setOption(
30
+ N({
31
+ series: o,
32
+ displayType: i,
33
+ legend: n,
34
+ line: c,
35
+ yAxis: f,
36
+ theme: t,
37
+ showSymbols: s,
38
+ showValueLabels: m,
39
+ seriesColorOverrides: O,
40
+ valueFormatter: a
41
+ }),
42
+ { notMerge: !0 }
43
+ );
44
+ }, [
45
+ r,
46
+ t,
47
+ p,
48
+ o,
49
+ i,
50
+ n,
51
+ c,
52
+ f,
53
+ s,
54
+ m,
55
+ a
56
+ ]), /* @__PURE__ */ S("div", { ref: I, className: _("time-series-chart", l), ...u });
57
+ }
58
+ export {
59
+ j as TimeSeriesChart
60
+ };
61
+ //# sourceMappingURL=TimeSeriesChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeSeriesChart.js","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/TimeSeriesChart.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, useEffect } from \"react\";\nimport { useChartInstance, type ChartInstance } from \"../useChartInstance\";\nimport {\n buildTimeSeriesOption,\n type TimeSeriesData,\n type TimeSeriesDisplayType,\n type TimeSeriesLegendMode,\n type TimeSeriesLineOptions,\n type TimeSeriesYAxisOptions,\n} from \"./time-series-option\";\nimport \"./time-series-chart.css\";\n\nexport type {\n TimeSeriesData,\n TimeSeriesDisplayType,\n TimeSeriesLegendMode,\n TimeSeriesLineOptions,\n TimeSeriesLineStyle,\n TimeSeriesLineWidth,\n TimeSeriesPoint,\n TimeSeriesYAxisOptions,\n} from \"./time-series-option\";\n\nexport type TimeSeriesChartProps = Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> & {\n series: TimeSeriesData[];\n displayType?: TimeSeriesDisplayType;\n legend?: TimeSeriesLegendMode;\n line?: TimeSeriesLineOptions;\n yAxis?: TimeSeriesYAxisOptions;\n showSymbols?: boolean;\n showValueLabels?: boolean;\n valueFormatter?: (value: number) => string;\n};\n\nconst EMPTY_Y_AXIS_OPTIONS: TimeSeriesYAxisOptions = {};\n\nconst EMPTY_LINE_OPTIONS: TimeSeriesLineOptions = {};\n\nexport function TimeSeriesChart({\n series,\n displayType = \"line\",\n legend = \"inline\",\n line = EMPTY_LINE_OPTIONS,\n yAxis = EMPTY_Y_AXIS_OPTIONS,\n showSymbols = false,\n showValueLabels = false,\n valueFormatter,\n className,\n ...props\n}: TimeSeriesChartProps) {\n const { containerRef, chart, theme, resolveSeriesColor }: ChartInstance = useChartInstance();\n\n useEffect(() => {\n if (!chart || !theme) return;\n\n const seriesColorOverrides: Record<string, string> = {};\n for (const data of series) {\n if (!data.colorToken) continue;\n const color: string | undefined = resolveSeriesColor(data.colorToken);\n if (color) seriesColorOverrides[data.id] = color;\n }\n\n // `notMerge` evita que uma série removida da configuração continue desenhada: o ECharts\n // casa séries por id e mantém as que não aparecem na opção nova.\n chart.setOption(\n buildTimeSeriesOption({\n series,\n displayType,\n legend,\n line,\n yAxis,\n theme,\n showSymbols,\n showValueLabels,\n seriesColorOverrides,\n valueFormatter,\n }),\n { notMerge: true },\n );\n }, [\n chart,\n theme,\n resolveSeriesColor,\n series,\n displayType,\n legend,\n line,\n yAxis,\n showSymbols,\n showValueLabels,\n valueFormatter,\n ]);\n\n return <div ref={containerRef} className={clsx(\"time-series-chart\", className)} {...props} />;\n}\n"],"names":["EMPTY_Y_AXIS_OPTIONS","EMPTY_LINE_OPTIONS","TimeSeriesChart","series","displayType","legend","line","yAxis","showSymbols","showValueLabels","valueFormatter","className","props","containerRef","chart","theme","resolveSeriesColor","useChartInstance","useEffect","seriesColorOverrides","data","color","buildTimeSeriesOption","jsx","clsx"],"mappings":";;;;;;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1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=32,s={top:16,right:16,bottom:24,left:56},b=6,u=.15,p={thin:1,normal:2,thick:4},f="solid",L="normal";function m(o){const{valueFormatter:l}=o;if(l)return t=>t===null?"":l(t)}function h(o){const{showValueLabels:l,theme:t}=o,i=m(o);return{show:l,position:"top",color:t.labelColor,formatter:i?e=>i(e.value[1]):void 0}}function S(o,l,t){const i=o.points.map(r=>[r.timestamp,r.value]),e=h(l);return l.displayType==="bar"?{id:o.id,name:o.name,type:"bar",data:i,itemStyle:{color:t},label:e}:{id:o.id,name:o.name,type:"line",data:i,showSymbol:l.showSymbols,symbolSize:b,lineStyle:{color:t,type:l.line.style??f,width:p[l.line.width??L]},itemStyle:{color:t},areaStyle:l.displayType==="area"?{color:t,opacity:u}:void 0,label:e}}function C(o){const{series:l,legend:t,yAxis:i,theme:e,seriesColorOverrides:r}=o,a=t!=="none"&&l.length>0,n=m(o);return{animation:!1,color:e.seriesColors,textStyle:{fontFamily:e.fontFamily,color:e.labelColor},grid:{...s,top:a?s.top+d:s.top,containLabel:!1},legend:a?{type:"scroll",top:0,left:0,icon:"roundRect",itemHeight:8,itemWidth:12,textStyle:{color:e.labelColor}}:{show:!1},tooltip:{trigger:"axis",backgroundColor:e.tooltipBackgroundColor,borderColor:e.tooltipBorderColor,textStyle:{color:e.labelColor},valueFormatter:n},xAxis:{type:"time",axisLine:{lineStyle:{color:e.axisLineColor}},axisTick:{show:!1},axisLabel:{color:e.labelColor,hideOverlap:!0},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:e.labelColor,formatter:n},splitLine:{lineStyle:{color:e.splitLineColor}}},series:l.map((c,y)=>S(c,o,r[c.id]??e.seriesColors[y%e.seriesColors.length]))}}exports.buildTimeSeriesOption=C;
2
+ //# sourceMappingURL=time-series-option.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-series-option.cjs","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/time-series-option.ts"],"sourcesContent":["import type { ChartTheme } from \"../chart-theme\";\n\nexport interface TimeSeriesPoint {\n timestamp: number;\n value: number | null;\n}\n\nexport interface TimeSeriesData {\n id: string;\n name: string;\n points: TimeSeriesPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type TimeSeriesDisplayType = \"line\" | \"bar\" | \"area\";\n\nexport type TimeSeriesLineStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport type TimeSeriesLineWidth = \"thin\" | \"normal\" | \"thick\";\n\nexport interface TimeSeriesLineOptions {\n style?: TimeSeriesLineStyle;\n width?: TimeSeriesLineWidth;\n}\n\nexport type TimeSeriesLegendMode = \"inline\" | \"none\";\n\nexport type TimeSeriesAxisScale = \"linear\" | \"log\";\n\nexport interface TimeSeriesYAxisOptions {\n scale?: TimeSeriesAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface TimeSeriesOptionInput {\n series: TimeSeriesData[];\n displayType: TimeSeriesDisplayType;\n legend: TimeSeriesLegendMode;\n line: TimeSeriesLineOptions;\n yAxis: TimeSeriesYAxisOptions;\n theme: ChartTheme;\n showSymbols: boolean;\n showValueLabels: boolean;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\nconst LEGEND_HEIGHT_PX: number = 32;\n\nconst GRID_WITHOUT_LEGEND = { top: 16, right: 16, bottom: 24, left: 56 } as const;\n\nconst SYMBOL_SIZE_PX: number = 6;\n\nconst AREA_OPACITY: number = 0.15;\n\nconst LINE_WIDTH_PX: Record<TimeSeriesLineWidth, number> = { thin: 1, normal: 2, thick: 4 };\n\nconst DEFAULT_LINE_STYLE: TimeSeriesLineStyle = \"solid\";\n\nconst DEFAULT_LINE_WIDTH: TimeSeriesLineWidth = \"normal\";\n\n// O ponto de gap chega ao formatter como `null` — o ECharts monta o bloco do tooltip sem marcar\n// `noValue`, então formata o vazio junto com o resto. O tipo público promete `number` ao\n// consumidor, e é esta guarda que mantém a promessa em vez de transformá-la em aviso.\nfunction nullSafeValueFormatter(\n input: TimeSeriesOptionInput,\n): ((value: number | null) => string) | undefined {\n const { valueFormatter } = input;\n if (!valueFormatter) return undefined;\n return (value: number | null) => (value === null ? \"\" : valueFormatter(value));\n}\n\nfunction seriesLabel(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { showValueLabels, theme } = input;\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n return {\n show: showValueLabels,\n position: \"top\",\n color: theme.labelColor,\n formatter: formatValue\n ? (params: { value: [number, number | null] }) => formatValue(params.value[1])\n : undefined,\n };\n}\n\nfunction seriesEntry(\n data: TimeSeriesData,\n input: TimeSeriesOptionInput,\n color: string,\n): Record<string, unknown> {\n const values: Array<[number, number | null]> = data.points.map((point: TimeSeriesPoint) => [\n point.timestamp,\n point.value,\n ]);\n const label: Record<string, unknown> = seriesLabel(input);\n\n if (input.displayType === \"bar\") {\n return { id: data.id, name: data.name, type: \"bar\", data: values, itemStyle: { color }, label };\n }\n\n return {\n id: data.id,\n name: data.name,\n type: \"line\",\n data: values,\n showSymbol: input.showSymbols,\n symbolSize: SYMBOL_SIZE_PX,\n lineStyle: {\n color,\n type: input.line.style ?? DEFAULT_LINE_STYLE,\n width: LINE_WIDTH_PX[input.line.width ?? DEFAULT_LINE_WIDTH],\n },\n itemStyle: { color },\n areaStyle: input.displayType === \"area\" ? { color, opacity: AREA_OPACITY } : undefined,\n label,\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildTimeSeriesOption(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { series, legend, yAxis, theme, seriesColorOverrides } = input;\n const isLegendVisible: boolean = legend !== \"none\" && series.length > 0;\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_WITHOUT_LEGEND,\n top: isLegendVisible ? GRID_WITHOUT_LEGEND.top + LEGEND_HEIGHT_PX : GRID_WITHOUT_LEGEND.top,\n containLabel: false,\n },\n legend: isLegendVisible\n ? {\n type: \"scroll\",\n top: 0,\n left: 0,\n icon: \"roundRect\",\n itemHeight: 8,\n itemWidth: 12,\n textStyle: { color: theme.labelColor },\n }\n : { show: false },\n tooltip: {\n trigger: \"axis\",\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: {\n type: \"time\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: { color: theme.labelColor, hideOverlap: true },\n splitLine: { show: false },\n },\n yAxis: {\n type: yAxis.scale === \"log\" ? \"log\" : \"value\",\n scale: yAxis.includeZero !== true,\n min: yAxis.min,\n max: yAxis.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n },\n series: series.map((data: TimeSeriesData, index: number) =>\n seriesEntry(\n data,\n input,\n seriesColorOverrides[data.id] ?? theme.seriesColors[index % theme.seriesColors.length],\n ),\n ),\n };\n}\n"],"names":["LEGEND_HEIGHT_PX","GRID_WITHOUT_LEGEND","SYMBOL_SIZE_PX","AREA_OPACITY","LINE_WIDTH_PX","DEFAULT_LINE_STYLE","DEFAULT_LINE_WIDTH","nullSafeValueFormatter","input","valueFormatter","value","seriesLabel","showValueLabels","theme","formatValue","params","seriesEntry","data","color","values","point","label","buildTimeSeriesOption","series","legend","yAxis","seriesColorOverrides","isLegendVisible","index"],"mappings":"gFAmDA,MAAMA,EAA2B,GAE3BC,EAAsB,CAAE,IAAK,GAAI,MAAO,GAAI,OAA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56 }, d = 6, b = 0.15, p = { thin: 1, normal: 2, thick: 4 }, L = "solid", f = "normal";
2
+ function m(o) {
3
+ const { valueFormatter: l } = o;
4
+ if (l)
5
+ return (t) => t === null ? "" : l(t);
6
+ }
7
+ function h(o) {
8
+ const { showValueLabels: l, theme: t } = o, i = m(o);
9
+ return {
10
+ show: l,
11
+ position: "top",
12
+ color: t.labelColor,
13
+ formatter: i ? (e) => i(e.value[1]) : void 0
14
+ };
15
+ }
16
+ function u(o, l, t) {
17
+ const i = o.points.map((r) => [
18
+ r.timestamp,
19
+ r.value
20
+ ]), e = h(l);
21
+ return l.displayType === "bar" ? { id: o.id, name: o.name, type: "bar", data: i, itemStyle: { color: t }, label: e } : {
22
+ id: o.id,
23
+ name: o.name,
24
+ type: "line",
25
+ data: i,
26
+ showSymbol: l.showSymbols,
27
+ symbolSize: d,
28
+ lineStyle: {
29
+ color: t,
30
+ type: l.line.style ?? L,
31
+ width: p[l.line.width ?? f]
32
+ },
33
+ itemStyle: { color: t },
34
+ areaStyle: l.displayType === "area" ? { color: t, opacity: b } : void 0,
35
+ label: e
36
+ };
37
+ }
38
+ function x(o) {
39
+ const { series: l, legend: t, yAxis: i, theme: e, seriesColorOverrides: r } = o, a = t !== "none" && l.length > 0, n = m(o);
40
+ return {
41
+ animation: !1,
42
+ color: e.seriesColors,
43
+ textStyle: { fontFamily: e.fontFamily, color: e.labelColor },
44
+ grid: {
45
+ ...s,
46
+ top: a ? s.top + 32 : s.top,
47
+ containLabel: !1
48
+ },
49
+ legend: a ? {
50
+ type: "scroll",
51
+ top: 0,
52
+ left: 0,
53
+ icon: "roundRect",
54
+ itemHeight: 8,
55
+ itemWidth: 12,
56
+ textStyle: { color: e.labelColor }
57
+ } : { show: !1 },
58
+ tooltip: {
59
+ trigger: "axis",
60
+ backgroundColor: e.tooltipBackgroundColor,
61
+ borderColor: e.tooltipBorderColor,
62
+ textStyle: { color: e.labelColor },
63
+ valueFormatter: n
64
+ },
65
+ xAxis: {
66
+ type: "time",
67
+ axisLine: { lineStyle: { color: e.axisLineColor } },
68
+ axisTick: { show: !1 },
69
+ axisLabel: { color: e.labelColor, hideOverlap: !0 },
70
+ splitLine: { show: !1 }
71
+ },
72
+ yAxis: {
73
+ type: i.scale === "log" ? "log" : "value",
74
+ scale: i.includeZero !== !0,
75
+ min: i.min,
76
+ max: i.max,
77
+ axisLine: { show: !1 },
78
+ axisLabel: { color: e.labelColor, formatter: n },
79
+ splitLine: { lineStyle: { color: e.splitLineColor } }
80
+ },
81
+ series: l.map(
82
+ (c, y) => u(
83
+ c,
84
+ o,
85
+ r[c.id] ?? e.seriesColors[y % e.seriesColors.length]
86
+ )
87
+ )
88
+ };
89
+ }
90
+ export {
91
+ x as buildTimeSeriesOption
92
+ };
93
+ //# sourceMappingURL=time-series-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-series-option.js","sources":["../../../../../../src/ui/components/charts/TimeSeriesChart/time-series-option.ts"],"sourcesContent":["import type { ChartTheme } from \"../chart-theme\";\n\nexport interface TimeSeriesPoint {\n timestamp: number;\n value: number | null;\n}\n\nexport interface TimeSeriesData {\n id: string;\n name: string;\n points: TimeSeriesPoint[];\n // Nome de token, nunca hex: é o que mantém a cor válida nos dois temas. Sem ele a série\n // recebe a próxima cor da paleta.\n colorToken?: string;\n}\n\nexport type TimeSeriesDisplayType = \"line\" | \"bar\" | \"area\";\n\nexport type TimeSeriesLineStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport type TimeSeriesLineWidth = \"thin\" | \"normal\" | \"thick\";\n\nexport interface TimeSeriesLineOptions {\n style?: TimeSeriesLineStyle;\n width?: TimeSeriesLineWidth;\n}\n\nexport type TimeSeriesLegendMode = \"inline\" | \"none\";\n\nexport type TimeSeriesAxisScale = \"linear\" | \"log\";\n\nexport interface TimeSeriesYAxisOptions {\n scale?: TimeSeriesAxisScale;\n min?: number;\n max?: number;\n includeZero?: boolean;\n}\n\nexport interface TimeSeriesOptionInput {\n series: TimeSeriesData[];\n displayType: TimeSeriesDisplayType;\n legend: TimeSeriesLegendMode;\n line: TimeSeriesLineOptions;\n yAxis: TimeSeriesYAxisOptions;\n theme: ChartTheme;\n showSymbols: boolean;\n showValueLabels: boolean;\n seriesColorOverrides: Record<string, string>;\n valueFormatter?: (value: number) => string;\n}\n\nconst LEGEND_HEIGHT_PX: number = 32;\n\nconst GRID_WITHOUT_LEGEND = { top: 16, right: 16, bottom: 24, left: 56 } as const;\n\nconst SYMBOL_SIZE_PX: number = 6;\n\nconst AREA_OPACITY: number = 0.15;\n\nconst LINE_WIDTH_PX: Record<TimeSeriesLineWidth, number> = { thin: 1, normal: 2, thick: 4 };\n\nconst DEFAULT_LINE_STYLE: TimeSeriesLineStyle = \"solid\";\n\nconst DEFAULT_LINE_WIDTH: TimeSeriesLineWidth = \"normal\";\n\n// O ponto de gap chega ao formatter como `null` — o ECharts monta o bloco do tooltip sem marcar\n// `noValue`, então formata o vazio junto com o resto. O tipo público promete `number` ao\n// consumidor, e é esta guarda que mantém a promessa em vez de transformá-la em aviso.\nfunction nullSafeValueFormatter(\n input: TimeSeriesOptionInput,\n): ((value: number | null) => string) | undefined {\n const { valueFormatter } = input;\n if (!valueFormatter) return undefined;\n return (value: number | null) => (value === null ? \"\" : valueFormatter(value));\n}\n\nfunction seriesLabel(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { showValueLabels, theme } = input;\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n return {\n show: showValueLabels,\n position: \"top\",\n color: theme.labelColor,\n formatter: formatValue\n ? (params: { value: [number, number | null] }) => formatValue(params.value[1])\n : undefined,\n };\n}\n\nfunction seriesEntry(\n data: TimeSeriesData,\n input: TimeSeriesOptionInput,\n color: string,\n): Record<string, unknown> {\n const values: Array<[number, number | null]> = data.points.map((point: TimeSeriesPoint) => [\n point.timestamp,\n point.value,\n ]);\n const label: Record<string, unknown> = seriesLabel(input);\n\n if (input.displayType === \"bar\") {\n return { id: data.id, name: data.name, type: \"bar\", data: values, itemStyle: { color }, label };\n }\n\n return {\n id: data.id,\n name: data.name,\n type: \"line\",\n data: values,\n showSymbol: input.showSymbols,\n symbolSize: SYMBOL_SIZE_PX,\n lineStyle: {\n color,\n type: input.line.style ?? DEFAULT_LINE_STYLE,\n width: LINE_WIDTH_PX[input.line.width ?? DEFAULT_LINE_WIDTH],\n },\n itemStyle: { color },\n areaStyle: input.displayType === \"area\" ? { color, opacity: AREA_OPACITY } : undefined,\n label,\n };\n}\n\n// O retorno é `Record<string, unknown>` de propósito, e não `EChartsOption`: é o que impede\n// um tipo da biblioteca de vazar para o resto do design system.\nexport function buildTimeSeriesOption(input: TimeSeriesOptionInput): Record<string, unknown> {\n const { series, legend, yAxis, theme, seriesColorOverrides } = input;\n const isLegendVisible: boolean = legend !== \"none\" && series.length > 0;\n const formatValue: ((value: number | null) => string) | undefined = nullSafeValueFormatter(input);\n\n return {\n animation: false,\n color: theme.seriesColors,\n textStyle: { fontFamily: theme.fontFamily, color: theme.labelColor },\n grid: {\n ...GRID_WITHOUT_LEGEND,\n top: isLegendVisible ? GRID_WITHOUT_LEGEND.top + LEGEND_HEIGHT_PX : GRID_WITHOUT_LEGEND.top,\n containLabel: false,\n },\n legend: isLegendVisible\n ? {\n type: \"scroll\",\n top: 0,\n left: 0,\n icon: \"roundRect\",\n itemHeight: 8,\n itemWidth: 12,\n textStyle: { color: theme.labelColor },\n }\n : { show: false },\n tooltip: {\n trigger: \"axis\",\n backgroundColor: theme.tooltipBackgroundColor,\n borderColor: theme.tooltipBorderColor,\n textStyle: { color: theme.labelColor },\n valueFormatter: formatValue,\n },\n xAxis: {\n type: \"time\",\n axisLine: { lineStyle: { color: theme.axisLineColor } },\n axisTick: { show: false },\n axisLabel: { color: theme.labelColor, hideOverlap: true },\n splitLine: { show: false },\n },\n yAxis: {\n type: yAxis.scale === \"log\" ? \"log\" : \"value\",\n scale: yAxis.includeZero !== true,\n min: yAxis.min,\n max: yAxis.max,\n axisLine: { show: false },\n axisLabel: { color: theme.labelColor, formatter: formatValue },\n splitLine: { lineStyle: { color: theme.splitLineColor } },\n },\n series: series.map((data: TimeSeriesData, index: number) =>\n seriesEntry(\n data,\n input,\n seriesColorOverrides[data.id] ?? theme.seriesColors[index % theme.seriesColors.length],\n ),\n ),\n };\n}\n"],"names":["GRID_WITHOUT_LEGEND","SYMBOL_SIZE_PX","AREA_OPACITY","LINE_WIDTH_PX","DEFAULT_LINE_STYLE","DEFAULT_LINE_WIDTH","nullSafeValueFormatter","input","valueFormatter","value","seriesLabel","showValueLabels","theme","formatValue","params","seriesEntry","data","color","values","point","label","buildTimeSeriesOption","series","legend","yAxis","seriesColorOverrides","isLegendVisible","index"],"mappings":"AAqDA,MAAMA,IAAsB,EAAE,KAAK,IAAI,OAAO,IAAI,QAAQ,IAAI,MAAM,GAAA,GAE9DC,IAAyB,GAEzBC,IAAuB,MAEvBC,IAAqD,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,EAAA,GAElFC,IAA0C,SAE1CC,IAA0C;AAKhD,SAASC,EACPC,GACgD;AAChD,QAAM,EAAE,gBAAAC,MAAmBD;AAC3B,MAAKC;AACL,WAAO,CAACC,MAA0BA,MAAU,OAAO,KAAKD,EAAeC,CAAK;AAC9E;AAEA,SAASC,EAAYH,GAAuD;AAC1E,QAAM,EAAE,iBAAAI,GAAiB,OAAAC,EAAA,IAAUL,GAC7BM,IAA8DP,EAAuBC,CAAK;AAChG,SAAO;AAAA,IACL,MAAMI;AAAA,IACN,UAAU;AAAA,IACV,OAAOC,EAAM;AAAA,IACb,WAAWC,IACP,CAACC,MAA+CD,EAAYC,EAAO,MAAM,CAAC,CAAC,IAC3E;AAAA,EAAA;AAER;AAEA,SAASC,EACPC,GACAT,GACAU,GACyB;AACzB,QAAMC,IAAyCF,EAAK,OAAO,IAAI,CAACG,MAA2B;AAAA,IACzFA,EAAM;AAAA,IACNA,EAAM;AAAA,EAAA,CACP,GACKC,IAAiCV,EAAYH,CAAK;AAExD,SAAIA,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AAS;AAAA,MACT,iBAAiBA,EAAM;AAAA,MACvB,aAAaA,EAAM;AAAA,MACnB,WAAW,EAAE,OAAOA,EAAM,WAAA;AAAA,MAC1B,gBAAgBC;AAAA,IAAA;AAAA,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,GAAA;AAAA,MACnD,WAAW,EAAE,MAAM,GAAA;AAAA,IAAM;AAAA,IAE3B,OAAO;AAAA,MACL,MAAMY,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,OAAOZ,EAAM,YAAY,WAAWC,EAAA;AAAA,MACjD,WAAW,EAAE,WAAW,EAAE,OAAOD,EAAM,iBAAe;AAAA,IAAE;AAAA,IAE1D,QAAQU,EAAO;AAAA,MAAI,CAACN,GAAsBW,MACxCZ;AAAA,QACEC;AAAA,QACAT;AAAA,QACAkB,EAAqBT,EAAK,EAAE,KAAKJ,EAAM,aAAae,IAAQf,EAAM,aAAa,MAAM;AAAA,MAAA;AAAA,IACvF;AAAA,EACF;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=["--sds-color-blue-500","--sds-color-green-500","--sds-color-pink-500","--sds-color-yellow-500","--sds-color-red-500","--sds-color-blue-700","--sds-color-green-700","--sds-color-pink-700","--sds-color-yellow-700","--sds-color-red-700"];exports.CHART_SERIES_COLOR_TOKENS=o;
2
+ //# sourceMappingURL=chart-palette.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-palette.cjs","sources":["../../../../../src/ui/components/charts/chart-palette.ts"],"sourcesContent":["// Ordenada para afastar ao máximo os matizes de séries vizinhas: os cinco cromáticos do tema\n// no passo 500, e só depois os mesmos cinco no 700. As rampas neutras ficam de fora porque se\n// confundem com grade e eixo — a `brand-500` deste tema é cinza.\nexport const CHART_SERIES_COLOR_TOKENS: string[] = [\n \"--sds-color-blue-500\",\n \"--sds-color-green-500\",\n \"--sds-color-pink-500\",\n \"--sds-color-yellow-500\",\n \"--sds-color-red-500\",\n \"--sds-color-blue-700\",\n \"--sds-color-green-700\",\n \"--sds-color-pink-700\",\n \"--sds-color-yellow-700\",\n \"--sds-color-red-700\",\n];\n"],"names":["CHART_SERIES_COLOR_TOKENS"],"mappings":"gFAGO,MAAMA,EAAsC,CACjD,uBACA,wBACA,uBACA,yBACA,sBACA,uBACA,wBACA,uBACA,yBACA,qBACF"}
@@ -0,0 +1,16 @@
1
+ const o = [
2
+ "--sds-color-blue-500",
3
+ "--sds-color-green-500",
4
+ "--sds-color-pink-500",
5
+ "--sds-color-yellow-500",
6
+ "--sds-color-red-500",
7
+ "--sds-color-blue-700",
8
+ "--sds-color-green-700",
9
+ "--sds-color-pink-700",
10
+ "--sds-color-yellow-700",
11
+ "--sds-color-red-700"
12
+ ];
13
+ export {
14
+ o as CHART_SERIES_COLOR_TOKENS
15
+ };
16
+ //# sourceMappingURL=chart-palette.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-palette.js","sources":["../../../../../src/ui/components/charts/chart-palette.ts"],"sourcesContent":["// Ordenada para afastar ao máximo os matizes de séries vizinhas: os cinco cromáticos do tema\n// no passo 500, e só depois os mesmos cinco no 700. As rampas neutras ficam de fora porque se\n// confundem com grade e eixo — a `brand-500` deste tema é cinza.\nexport const CHART_SERIES_COLOR_TOKENS: string[] = [\n \"--sds-color-blue-500\",\n \"--sds-color-green-500\",\n \"--sds-color-pink-500\",\n \"--sds-color-yellow-500\",\n \"--sds-color-red-500\",\n \"--sds-color-blue-700\",\n \"--sds-color-green-700\",\n \"--sds-color-pink-700\",\n \"--sds-color-yellow-700\",\n \"--sds-color-red-700\",\n];\n"],"names":["CHART_SERIES_COLOR_TOKENS"],"mappings":"AAGO,MAAMA,IAAsC;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./chart-palette.cjs");function a(t,e){const r=window.getComputedStyle(t).getPropertyValue(e).trim();return r===""?void 0:r}function o(t,e,r){const l=t.getPropertyValue(e).trim();return l===""?r:l}function s(t){const e=window.getComputedStyle(t);return{seriesColors:d.CHART_SERIES_COLOR_TOKENS.map(r=>o(e,r,"#4b5563")),axisLineColor:o(e,"--sds-color-border-default-secondary","#9ca3af"),splitLineColor:o(e,"--sds-color-border-default-default","#e5e7eb"),labelColor:o(e,"--sds-color-text-default-secondary","#6b7280"),tooltipBackgroundColor:o(e,"--sds-color-background-default-default","#ffffff"),tooltipBorderColor:o(e,"--sds-color-border-default-default","#d1d5db"),fontFamily:o(e,"--sds-typography-body-font-family","inherit")}}exports.readChartTheme=s;exports.resolveColorToken=a;
2
+ //# sourceMappingURL=chart-theme.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-theme.cjs","sources":["../../../../../src/ui/components/charts/chart-theme.ts"],"sourcesContent":["import { CHART_SERIES_COLOR_TOKENS } from \"./chart-palette\";\n\nexport interface ChartTheme {\n seriesColors: string[];\n axisLineColor: string;\n splitLineColor: string;\n labelColor: string;\n tooltipBackgroundColor: string;\n tooltipBorderColor: string;\n fontFamily: string;\n}\n\n// O renderizador canvas não entende `var(--token)`, então a cor precisa chegar resolvida. A\n// resolução é contra o elemento hospedeiro para que tema aplicado em escopo menor que `:root`\n// continue valendo.\nexport function resolveColorToken(element: HTMLElement, token: string): string | undefined {\n const value: string = window.getComputedStyle(element).getPropertyValue(token).trim();\n return value === \"\" ? undefined : value;\n}\n\nfunction resolveToken(styles: CSSStyleDeclaration, token: string, fallback: string): string {\n const value: string = styles.getPropertyValue(token).trim();\n return value === \"\" ? fallback : value;\n}\n\nexport function readChartTheme(element: HTMLElement): ChartTheme {\n const styles: CSSStyleDeclaration = window.getComputedStyle(element);\n return {\n seriesColors: CHART_SERIES_COLOR_TOKENS.map((token: string) =>\n resolveToken(styles, token, \"#4b5563\"),\n ),\n // A escala de borda deste tema vai do claro para o escuro: `tertiary` é a mais escura,\n // não a mais suave. A grade fica na `default` para ficar atrás do dado, e o eixo na\n // `secondary` para se separar da grade sem competir com as linhas.\n axisLineColor: resolveToken(styles, \"--sds-color-border-default-secondary\", \"#9ca3af\"),\n splitLineColor: resolveToken(styles, \"--sds-color-border-default-default\", \"#e5e7eb\"),\n labelColor: resolveToken(styles, \"--sds-color-text-default-secondary\", \"#6b7280\"),\n tooltipBackgroundColor: resolveToken(\n styles,\n \"--sds-color-background-default-default\",\n \"#ffffff\",\n ),\n tooltipBorderColor: resolveToken(styles, \"--sds-color-border-default-default\", \"#d1d5db\"),\n fontFamily: resolveToken(styles, \"--sds-typography-body-font-family\", \"inherit\"),\n };\n}\n"],"names":["resolveColorToken","element","token","value","resolveToken","styles","fallback","readChartTheme","CHART_SERIES_COLOR_TOKENS"],"mappings":"uHAeO,SAASA,EAAkBC,EAAsBC,EAAmC,CACzF,MAAMC,EAAgB,OAAO,iBAAiBF,CAAO,EAAE,iBAAiBC,CAAK,EAAE,KAAA,EAC/E,OAAOC,IAAU,GAAK,OAAYA,CACpC,CAEA,SAASC,EAAaC,EAA6BH,EAAeI,EAA0B,CAC1F,MAAMH,EAAgBE,EAAO,iBAAiBH,CAAK,EAAE,KAAA,EACrD,OAAOC,IAAU,GAAKG,EAAWH,CACnC,CAEO,SAASI,EAAeN,EAAkC,CAC/D,MAAMI,EAA8B,OAAO,iBAAiBJ,CAAO,EACnE,MAAO,CACL,aAAcO,EAAAA,0BAA0B,IAAKN,GAC3CE,EAAaC,EAAQH,EAAO,SAAS,CAAA,EAKvC,cAAeE,EAAaC,EAAQ,uCAAwC,SAAS,EACrF,eAAgBD,EAAaC,EAAQ,qCAAsC,SAAS,EACpF,WAAYD,EAAaC,EAAQ,qCAAsC,SAAS,EAChF,uBAAwBD,EACtBC,EACA,yCACA,SAAA,EAEF,mBAAoBD,EAAaC,EAAQ,qCAAsC,SAAS,EACxF,WAAYD,EAAaC,EAAQ,oCAAqC,SAAS,CAAA,CAEnF"}
@@ -0,0 +1,35 @@
1
+ import { CHART_SERIES_COLOR_TOKENS as d } from "./chart-palette.js";
2
+ function s(t, o) {
3
+ const r = window.getComputedStyle(t).getPropertyValue(o).trim();
4
+ return r === "" ? void 0 : r;
5
+ }
6
+ function e(t, o, r) {
7
+ const l = t.getPropertyValue(o).trim();
8
+ return l === "" ? r : l;
9
+ }
10
+ function n(t) {
11
+ const o = window.getComputedStyle(t);
12
+ return {
13
+ seriesColors: d.map(
14
+ (r) => e(o, r, "#4b5563")
15
+ ),
16
+ // A escala de borda deste tema vai do claro para o escuro: `tertiary` é a mais escura,
17
+ // não a mais suave. A grade fica na `default` para ficar atrás do dado, e o eixo na
18
+ // `secondary` para se separar da grade sem competir com as linhas.
19
+ axisLineColor: e(o, "--sds-color-border-default-secondary", "#9ca3af"),
20
+ splitLineColor: e(o, "--sds-color-border-default-default", "#e5e7eb"),
21
+ labelColor: e(o, "--sds-color-text-default-secondary", "#6b7280"),
22
+ tooltipBackgroundColor: e(
23
+ o,
24
+ "--sds-color-background-default-default",
25
+ "#ffffff"
26
+ ),
27
+ tooltipBorderColor: e(o, "--sds-color-border-default-default", "#d1d5db"),
28
+ fontFamily: e(o, "--sds-typography-body-font-family", "inherit")
29
+ };
30
+ }
31
+ export {
32
+ n as readChartTheme,
33
+ s as resolveColorToken
34
+ };
35
+ //# sourceMappingURL=chart-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-theme.js","sources":["../../../../../src/ui/components/charts/chart-theme.ts"],"sourcesContent":["import { CHART_SERIES_COLOR_TOKENS } from \"./chart-palette\";\n\nexport interface ChartTheme {\n seriesColors: string[];\n axisLineColor: string;\n splitLineColor: string;\n labelColor: string;\n tooltipBackgroundColor: string;\n tooltipBorderColor: string;\n fontFamily: string;\n}\n\n// O renderizador canvas não entende `var(--token)`, então a cor precisa chegar resolvida. A\n// resolução é contra o elemento hospedeiro para que tema aplicado em escopo menor que `:root`\n// continue valendo.\nexport function resolveColorToken(element: HTMLElement, token: string): string | undefined {\n const value: string = window.getComputedStyle(element).getPropertyValue(token).trim();\n return value === \"\" ? undefined : value;\n}\n\nfunction resolveToken(styles: CSSStyleDeclaration, token: string, fallback: string): string {\n const value: string = styles.getPropertyValue(token).trim();\n return value === \"\" ? fallback : value;\n}\n\nexport function readChartTheme(element: HTMLElement): ChartTheme {\n const styles: CSSStyleDeclaration = window.getComputedStyle(element);\n return {\n seriesColors: CHART_SERIES_COLOR_TOKENS.map((token: string) =>\n resolveToken(styles, token, \"#4b5563\"),\n ),\n // A escala de borda deste tema vai do claro para o escuro: `tertiary` é a mais escura,\n // não a mais suave. A grade fica na `default` para ficar atrás do dado, e o eixo na\n // `secondary` para se separar da grade sem competir com as linhas.\n axisLineColor: resolveToken(styles, \"--sds-color-border-default-secondary\", \"#9ca3af\"),\n splitLineColor: resolveToken(styles, \"--sds-color-border-default-default\", \"#e5e7eb\"),\n labelColor: resolveToken(styles, \"--sds-color-text-default-secondary\", \"#6b7280\"),\n tooltipBackgroundColor: resolveToken(\n styles,\n \"--sds-color-background-default-default\",\n \"#ffffff\",\n ),\n tooltipBorderColor: resolveToken(styles, \"--sds-color-border-default-default\", \"#d1d5db\"),\n fontFamily: resolveToken(styles, \"--sds-typography-body-font-family\", \"inherit\"),\n };\n}\n"],"names":["resolveColorToken","element","token","value","resolveToken","styles","fallback","readChartTheme","CHART_SERIES_COLOR_TOKENS"],"mappings":";AAeO,SAASA,EAAkBC,GAAsBC,GAAmC;AACzF,QAAMC,IAAgB,OAAO,iBAAiBF,CAAO,EAAE,iBAAiBC,CAAK,EAAE,KAAA;AAC/E,SAAOC,MAAU,KAAK,SAAYA;AACpC;AAEA,SAASC,EAAaC,GAA6BH,GAAeI,GAA0B;AAC1F,QAAMH,IAAgBE,EAAO,iBAAiBH,CAAK,EAAE,KAAA;AACrD,SAAOC,MAAU,KAAKG,IAAWH;AACnC;AAEO,SAASI,EAAeN,GAAkC;AAC/D,QAAMI,IAA8B,OAAO,iBAAiBJ,CAAO;AACnE,SAAO;AAAA,IACL,cAAcO,EAA0B;AAAA,MAAI,CAACN,MAC3CE,EAAaC,GAAQH,GAAO,SAAS;AAAA,IAAA;AAAA;AAAA;AAAA;AAAA,IAKvC,eAAeE,EAAaC,GAAQ,wCAAwC,SAAS;AAAA,IACrF,gBAAgBD,EAAaC,GAAQ,sCAAsC,SAAS;AAAA,IACpF,YAAYD,EAAaC,GAAQ,sCAAsC,SAAS;AAAA,IAChF,wBAAwBD;AAAA,MACtBC;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,oBAAoBD,EAAaC,GAAQ,sCAAsC,SAAS;AAAA,IACxF,YAAYD,EAAaC,GAAQ,qCAAqC,SAAS;AAAA,EAAA;AAEnF;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("echarts/charts"),n=require("echarts/components"),a=require("echarts/core"),i=require("echarts/renderers");function u(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const s=u(a);function l(){s.use([c.LineChart,c.BarChart,n.GridComponent,n.TooltipComponent,n.LegendComponent,i.CanvasRenderer])}exports.echarts=s;exports.registerEchartsModules=l;
2
+ //# sourceMappingURL=echarts-modules.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"echarts-modules.cjs","sources":["../../../../../src/ui/components/charts/echarts-modules.ts"],"sourcesContent":["import { BarChart, LineChart } from \"echarts/charts\";\nimport { GridComponent, LegendComponent, TooltipComponent } from \"echarts/components\";\nimport * as echarts from \"echarts/core\";\nimport { CanvasRenderer } from \"echarts/renderers\";\n\n// Precisa ser função, e não efeito de módulo: no topo do arquivo o rollup apaga a chamada ao\n// empacotar a lib (retorno não usado = código morto), e o consumidor recebe os imports sem\n// registro nenhum, quebrando em runtime com \"series.type: line not exists\".\nexport function registerEchartsModules(): void {\n echarts.use([\n LineChart,\n BarChart,\n GridComponent,\n TooltipComponent,\n LegendComponent,\n CanvasRenderer,\n ]);\n}\n\nexport { echarts };\n"],"names":["registerEchartsModules","echarts","LineChart","BarChart","GridComponent","TooltipComponent","LegendComponent","CanvasRenderer"],"mappings":"qeAQO,SAASA,GAA+B,CAC7CC,EAAQ,IAAI,CACVC,EAAAA,UACAC,EAAAA,SACAC,EAAAA,cACAC,EAAAA,iBACAC,EAAAA,gBACAC,EAAAA,cAAA,CACD,CACH"}
@@ -0,0 +1,19 @@
1
+ import { LineChart as o, BarChart as r } from "echarts/charts";
2
+ import { GridComponent as e, TooltipComponent as t, LegendComponent as n } from "echarts/components";
3
+ import * as m from "echarts/core";
4
+ import { CanvasRenderer as p } from "echarts/renderers";
5
+ function C() {
6
+ m.use([
7
+ o,
8
+ r,
9
+ e,
10
+ t,
11
+ n,
12
+ p
13
+ ]);
14
+ }
15
+ export {
16
+ m as echarts,
17
+ C as registerEchartsModules
18
+ };
19
+ //# sourceMappingURL=echarts-modules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"echarts-modules.js","sources":["../../../../../src/ui/components/charts/echarts-modules.ts"],"sourcesContent":["import { BarChart, LineChart } from \"echarts/charts\";\nimport { GridComponent, LegendComponent, TooltipComponent } from \"echarts/components\";\nimport * as echarts from \"echarts/core\";\nimport { CanvasRenderer } from \"echarts/renderers\";\n\n// Precisa ser função, e não efeito de módulo: no topo do arquivo o rollup apaga a chamada ao\n// empacotar a lib (retorno não usado = código morto), e o consumidor recebe os imports sem\n// registro nenhum, quebrando em runtime com \"series.type: line not exists\".\nexport function registerEchartsModules(): void {\n echarts.use([\n LineChart,\n BarChart,\n GridComponent,\n TooltipComponent,\n LegendComponent,\n CanvasRenderer,\n ]);\n}\n\nexport { echarts };\n"],"names":["registerEchartsModules","echarts","LineChart","BarChart","GridComponent","TooltipComponent","LegendComponent","CanvasRenderer"],"mappings":";;;;AAQO,SAASA,IAA+B;AAC7C,EAAAC,EAAQ,IAAI;AAAA,IACVC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,EAAA,CACD;AACH;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),a=require("./chart-theme.cjs"),f=require("./echarts-modules.cjs"),m=require("echarts/core");function b(e){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(c,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return c.default=e,Object.freeze(c)}const v=b(m);function g(){const e=s.useRef(null),[c,t]=s.useState(null),[o,u]=s.useState(null);s.useEffect(()=>{const r=e.current;if(!r)return;f.registerEchartsModules();const n=v.init(r);t(n),u(a.readChartTheme(r));const i=new ResizeObserver(()=>n.resize());i.observe(r);const l=window.matchMedia("(prefers-color-scheme: dark)");function h(){u(a.readChartTheme(r))}return l.addEventListener("change",h),()=>{l.removeEventListener("change",h),i.disconnect(),n.dispose(),t(null)}},[]);const d=s.useCallback(r=>{const n=e.current;return n?a.resolveColorToken(n,r):void 0},[]);return{containerRef:e,chart:c,theme:o,resolveSeriesColor:d}}exports.useChartInstance=g;
2
+ //# sourceMappingURL=useChartInstance.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChartInstance.cjs","sources":["../../../../../src/ui/components/charts/useChartInstance.ts"],"sourcesContent":["import { type RefObject, useCallback, useEffect, useRef, useState } from \"react\";\nimport { readChartTheme, resolveColorToken, type ChartTheme } from \"./chart-theme\";\nimport { echarts, registerEchartsModules } from \"./echarts-modules\";\n\nexport interface ChartInstance {\n containerRef: RefObject<HTMLDivElement>;\n chart: echarts.ECharts | null;\n theme: ChartTheme | null;\n resolveSeriesColor: (token: string) => string | undefined;\n}\n\nexport function useChartInstance(): ChartInstance {\n const containerRef = useRef<HTMLDivElement>(null);\n const [chart, setChart] = useState<echarts.ECharts | null>(null);\n const [theme, setTheme] = useState<ChartTheme | null>(null);\n\n useEffect(() => {\n const container: HTMLDivElement | null = containerRef.current;\n if (!container) return undefined;\n\n registerEchartsModules();\n const createdChart: echarts.ECharts = echarts.init(container);\n setChart(createdChart);\n setTheme(readChartTheme(container));\n\n const resizeObserver: ResizeObserver = new ResizeObserver(() => createdChart.resize());\n resizeObserver.observe(container);\n\n // O tema escuro chega só por `prefers-color-scheme`: não há atributo no DOM para\n // observar, então é a media query que avisa quando as cores resolvidas deixam de valer.\n const colorSchemeQuery: MediaQueryList = window.matchMedia(\"(prefers-color-scheme: dark)\");\n function rereadTheme(): void {\n setTheme(readChartTheme(container as HTMLDivElement));\n }\n colorSchemeQuery.addEventListener(\"change\", rereadTheme);\n\n return () => {\n colorSchemeQuery.removeEventListener(\"change\", rereadTheme);\n resizeObserver.disconnect();\n createdChart.dispose();\n setChart(null);\n };\n }, []);\n\n const resolveSeriesColor = useCallback((token: string): string | undefined => {\n const container: HTMLDivElement | null = containerRef.current;\n return container ? resolveColorToken(container, token) : undefined;\n }, []);\n\n return { containerRef, chart, theme, resolveSeriesColor };\n}\n"],"names":["useChartInstance","containerRef","useRef","chart","setChart","useState","theme","setTheme","useEffect","container","registerEchartsModules","createdChart","echarts","readChartTheme","resizeObserver","colorSchemeQuery","rereadTheme","resolveSeriesColor","useCallback","token","resolveColorToken"],"mappings":"+dAWO,SAASA,GAAkC,CAChD,MAAMC,EAAeC,EAAAA,OAAuB,IAAI,EAC1C,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAiC,IAAI,EACzD,CAACC,EAAOC,CAAQ,EAAIF,EAAAA,SAA4B,IAAI,EAE1DG,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAmCR,EAAa,QACtD,GAAI,CAACQ,EAAW,OAEhBC,yBAAA,EACA,MAAMC,EAAgCC,EAAQ,KAAKH,CAAS,EAC5DL,EAASO,CAAY,EACrBJ,EAASM,EAAAA,eAAeJ,CAAS,CAAC,EAElC,MAAMK,EAAiC,IAAI,eAAe,IAAMH,EAAa,QAAQ,EACrFG,EAAe,QAAQL,CAAS,EAIhC,MAAMM,EAAmC,OAAO,WAAW,8BAA8B,EACzF,SAASC,GAAoB,CAC3BT,EAASM,EAAAA,eAAeJ,CAA2B,CAAC,CACtD,CACA,OAAAM,EAAiB,iBAAiB,SAAUC,CAAW,EAEhD,IAAM,CACXD,EAAiB,oBAAoB,SAAUC,CAAW,EAC1DF,EAAe,WAAA,EACfH,EAAa,QAAA,EACbP,EAAS,IAAI,CACf,CACF,EAAG,CAAA,CAAE,EAEL,MAAMa,EAAqBC,cAAaC,GAAsC,CAC5E,MAAMV,EAAmCR,EAAa,QACtD,OAAOQ,EAAYW,EAAAA,kBAAkBX,EAAWU,CAAK,EAAI,MAC3D,EAAG,CAAA,CAAE,EAEL,MAAO,CAAE,aAAAlB,EAAc,MAAAE,EAAO,MAAAG,EAAO,mBAAAW,CAAA,CACvC"}
@@ -0,0 +1,32 @@
1
+ import { useRef as d, useState as a, useEffect as f, useCallback as v } from "react";
2
+ import { readChartTheme as u, resolveColorToken as p } from "./chart-theme.js";
3
+ import { registerEchartsModules as C } from "./echarts-modules.js";
4
+ import * as b from "echarts/core";
5
+ function k() {
6
+ const t = d(null), [l, n] = a(null), [h, o] = a(null);
7
+ f(() => {
8
+ const e = t.current;
9
+ if (!e) return;
10
+ C();
11
+ const r = b.init(e);
12
+ n(r), o(u(e));
13
+ const s = new ResizeObserver(() => r.resize());
14
+ s.observe(e);
15
+ const c = window.matchMedia("(prefers-color-scheme: dark)");
16
+ function i() {
17
+ o(u(e));
18
+ }
19
+ return c.addEventListener("change", i), () => {
20
+ c.removeEventListener("change", i), s.disconnect(), r.dispose(), n(null);
21
+ };
22
+ }, []);
23
+ const m = v((e) => {
24
+ const r = t.current;
25
+ return r ? p(r, e) : void 0;
26
+ }, []);
27
+ return { containerRef: t, chart: l, theme: h, resolveSeriesColor: m };
28
+ }
29
+ export {
30
+ k as useChartInstance
31
+ };
32
+ //# sourceMappingURL=useChartInstance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChartInstance.js","sources":["../../../../../src/ui/components/charts/useChartInstance.ts"],"sourcesContent":["import { type RefObject, useCallback, useEffect, useRef, useState } from \"react\";\nimport { readChartTheme, resolveColorToken, type ChartTheme } from \"./chart-theme\";\nimport { echarts, registerEchartsModules } from \"./echarts-modules\";\n\nexport interface ChartInstance {\n containerRef: RefObject<HTMLDivElement>;\n chart: echarts.ECharts | null;\n theme: ChartTheme | null;\n resolveSeriesColor: (token: string) => string | undefined;\n}\n\nexport function useChartInstance(): ChartInstance {\n const containerRef = useRef<HTMLDivElement>(null);\n const [chart, setChart] = useState<echarts.ECharts | null>(null);\n const [theme, setTheme] = useState<ChartTheme | null>(null);\n\n useEffect(() => {\n const container: HTMLDivElement | null = containerRef.current;\n if (!container) return undefined;\n\n registerEchartsModules();\n const createdChart: echarts.ECharts = echarts.init(container);\n setChart(createdChart);\n setTheme(readChartTheme(container));\n\n const resizeObserver: ResizeObserver = new ResizeObserver(() => createdChart.resize());\n resizeObserver.observe(container);\n\n // O tema escuro chega só por `prefers-color-scheme`: não há atributo no DOM para\n // observar, então é a media query que avisa quando as cores resolvidas deixam de valer.\n const colorSchemeQuery: MediaQueryList = window.matchMedia(\"(prefers-color-scheme: dark)\");\n function rereadTheme(): void {\n setTheme(readChartTheme(container as HTMLDivElement));\n }\n colorSchemeQuery.addEventListener(\"change\", rereadTheme);\n\n return () => {\n colorSchemeQuery.removeEventListener(\"change\", rereadTheme);\n resizeObserver.disconnect();\n createdChart.dispose();\n setChart(null);\n };\n }, []);\n\n const resolveSeriesColor = useCallback((token: string): string | undefined => {\n const container: HTMLDivElement | null = containerRef.current;\n return container ? resolveColorToken(container, token) : undefined;\n }, []);\n\n return { containerRef, chart, theme, resolveSeriesColor };\n}\n"],"names":["useChartInstance","containerRef","useRef","chart","setChart","useState","theme","setTheme","useEffect","container","registerEchartsModules","createdChart","echarts","readChartTheme","resizeObserver","colorSchemeQuery","rereadTheme","resolveSeriesColor","useCallback","token","resolveColorToken"],"mappings":";;;;AAWO,SAASA,IAAkC;AAChD,QAAMC,IAAeC,EAAuB,IAAI,GAC1C,CAACC,GAAOC,CAAQ,IAAIC,EAAiC,IAAI,GACzD,CAACC,GAAOC,CAAQ,IAAIF,EAA4B,IAAI;AAE1D,EAAAG,EAAU,MAAM;AACd,UAAMC,IAAmCR,EAAa;AACtD,QAAI,CAACQ,EAAW;AAEhB,IAAAC,EAAA;AACA,UAAMC,IAAgCC,EAAQ,KAAKH,CAAS;AAC5D,IAAAL,EAASO,CAAY,GACrBJ,EAASM,EAAeJ,CAAS,CAAC;AAElC,UAAMK,IAAiC,IAAI,eAAe,MAAMH,EAAa,QAAQ;AACrF,IAAAG,EAAe,QAAQL,CAAS;AAIhC,UAAMM,IAAmC,OAAO,WAAW,8BAA8B;AACzF,aAASC,IAAoB;AAC3B,MAAAT,EAASM,EAAeJ,CAA2B,CAAC;AAAA,IACtD;AACA,WAAAM,EAAiB,iBAAiB,UAAUC,CAAW,GAEhD,MAAM;AACX,MAAAD,EAAiB,oBAAoB,UAAUC,CAAW,GAC1DF,EAAe,WAAA,GACfH,EAAa,QAAA,GACbP,EAAS,IAAI;AAAA,IACf;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,QAAMa,IAAqBC,EAAY,CAACC,MAAsC;AAC5E,UAAMV,IAAmCR,EAAa;AACtD,WAAOQ,IAAYW,EAAkBX,GAAWU,CAAK,IAAI;AAAA,EAC3D,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,cAAAlB,GAAc,OAAAE,GAAO,OAAAG,GAAO,oBAAAW,EAAA;AACvC;"}