@nocoo/basalt 2.0.0-rc.1 → 2.0.2

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 (130) hide show
  1. package/dist/charts/area.d.ts +8 -4
  2. package/dist/charts/area.js +41 -42
  3. package/dist/charts/area.js.map +1 -1
  4. package/dist/charts/bar.d.ts +7 -4
  5. package/dist/charts/bar.js +34 -27
  6. package/dist/charts/bar.js.map +1 -1
  7. package/dist/charts/bullet.d.ts +6 -4
  8. package/dist/charts/bullet.js +18 -23
  9. package/dist/charts/bullet.js.map +1 -1
  10. package/dist/charts/chart-colors.d.ts +3 -0
  11. package/dist/charts/charts.d.ts +6 -4
  12. package/dist/charts/charts.js +4 -3
  13. package/dist/charts/charts.js.map +1 -1
  14. package/dist/charts/config.d.ts +26 -15
  15. package/dist/charts/config.js +58 -44
  16. package/dist/charts/config.js.map +1 -1
  17. package/dist/charts/custom-chart.d.ts +6 -4
  18. package/dist/charts/custom-chart.js +4 -3
  19. package/dist/charts/custom-chart.js.map +1 -1
  20. package/dist/charts/date-navigation.d.ts +5 -0
  21. package/dist/charts/date-navigation.js.map +1 -1
  22. package/dist/charts/donut.d.ts +6 -4
  23. package/dist/charts/donut.js +38 -28
  24. package/dist/charts/donut.js.map +1 -1
  25. package/dist/charts/frame.d.ts +7 -3
  26. package/dist/charts/frame.js +30 -7
  27. package/dist/charts/frame.js.map +1 -1
  28. package/dist/charts/funnel.d.ts +6 -4
  29. package/dist/charts/funnel.js +16 -17
  30. package/dist/charts/funnel.js.map +1 -1
  31. package/dist/charts/gauge.d.ts +6 -3
  32. package/dist/charts/gauge.js +18 -17
  33. package/dist/charts/gauge.js.map +1 -1
  34. package/dist/charts/grouped-bar.d.ts +8 -4
  35. package/dist/charts/grouped-bar.js +36 -29
  36. package/dist/charts/grouped-bar.js.map +1 -1
  37. package/dist/charts/heatmap-calendar.d.ts +11 -5
  38. package/dist/charts/heatmap-calendar.js +25 -20
  39. package/dist/charts/heatmap-calendar.js.map +1 -1
  40. package/dist/charts/item-list.d.ts +9 -7
  41. package/dist/charts/item-list.js +1 -5
  42. package/dist/charts/item-list.js.map +1 -1
  43. package/dist/charts/legend.d.ts +7 -0
  44. package/dist/charts/legend.js +56 -0
  45. package/dist/charts/legend.js.map +1 -0
  46. package/dist/charts/line.d.ts +7 -4
  47. package/dist/charts/line.js +33 -41
  48. package/dist/charts/line.js.map +1 -1
  49. package/dist/charts/palette.d.ts +3 -2
  50. package/dist/charts/palette.js.map +1 -1
  51. package/dist/charts/radar.d.ts +6 -4
  52. package/dist/charts/radar.js +18 -18
  53. package/dist/charts/radar.js.map +1 -1
  54. package/dist/charts/sample.d.ts +8 -42
  55. package/dist/charts/sample.js.map +1 -1
  56. package/dist/charts/sankey.d.ts +5 -4
  57. package/dist/charts/sankey.js +15 -16
  58. package/dist/charts/sankey.js.map +1 -1
  59. package/dist/charts/series.d.ts +48 -0
  60. package/dist/charts/series.js +19 -0
  61. package/dist/charts/series.js.map +1 -0
  62. package/dist/charts/slot-bar.d.ts +12 -5
  63. package/dist/charts/slot-bar.js +27 -22
  64. package/dist/charts/slot-bar.js.map +1 -1
  65. package/dist/charts/sparkline.d.ts +6 -4
  66. package/dist/charts/sparkline.js +12 -11
  67. package/dist/charts/sparkline.js.map +1 -1
  68. package/dist/charts/stacked-bar.d.ts +8 -4
  69. package/dist/charts/stacked-bar.js +40 -37
  70. package/dist/charts/stacked-bar.js.map +1 -1
  71. package/dist/charts/stat-card.d.ts +7 -5
  72. package/dist/charts/stat-card.js +1 -1
  73. package/dist/charts/stat-card.js.map +1 -1
  74. package/dist/charts/timeline.d.ts +15 -8
  75. package/dist/charts/timeline.js +9 -14
  76. package/dist/charts/timeline.js.map +1 -1
  77. package/dist/charts/timeseries.d.ts +6 -4
  78. package/dist/charts/timeseries.js +4 -3
  79. package/dist/charts/timeseries.js.map +1 -1
  80. package/dist/charts/tooltip.d.ts +16 -0
  81. package/dist/charts/tooltip.js +105 -0
  82. package/dist/charts/tooltip.js.map +1 -0
  83. package/dist/components/alert-dialog.js +1 -0
  84. package/dist/components/alert-dialog.js.map +1 -1
  85. package/dist/components/button.js +2 -2
  86. package/dist/components/button.js.map +1 -1
  87. package/dist/components/confirm-dialog.d.ts +5 -1
  88. package/dist/components/confirm-dialog.js +52 -25
  89. package/dist/components/confirm-dialog.js.map +1 -1
  90. package/dist/components/delete-resource.d.ts +5 -0
  91. package/dist/components/delete-resource.js +38 -0
  92. package/dist/components/delete-resource.js.map +1 -0
  93. package/dist/components/description-list.d.ts +21 -0
  94. package/dist/components/description-list.js +35 -0
  95. package/dist/components/description-list.js.map +1 -0
  96. package/dist/components/dialog.js +2 -1
  97. package/dist/components/dialog.js.map +1 -1
  98. package/dist/components/layer-card.d.ts +23 -4
  99. package/dist/components/layer-card.js +83 -50
  100. package/dist/components/layer-card.js.map +1 -1
  101. package/dist/components/loading-screen.js +9 -5
  102. package/dist/components/loading-screen.js.map +1 -1
  103. package/dist/components/page-header.d.ts +4 -4
  104. package/dist/components/page-header.js +20 -23
  105. package/dist/components/page-header.js.map +1 -1
  106. package/dist/components/resource-list.d.ts +10 -0
  107. package/dist/components/resource-list.js +30 -0
  108. package/dist/components/resource-list.js.map +1 -0
  109. package/dist/components/section-rule.d.ts +10 -0
  110. package/dist/components/section-rule.js +44 -0
  111. package/dist/components/section-rule.js.map +1 -0
  112. package/dist/components/sheet.d.ts +4 -4
  113. package/dist/components/sheet.js +5 -4
  114. package/dist/components/sheet.js.map +1 -1
  115. package/dist/components/sidebar.js +1 -0
  116. package/dist/components/sidebar.js.map +1 -1
  117. package/dist/components/table.js +6 -5
  118. package/dist/components/table.js.map +1 -1
  119. package/dist/index.d.ts +1 -0
  120. package/dist/index.js +26 -25
  121. package/dist/providers/accent.d.ts +23 -0
  122. package/dist/providers/accent.js +232 -0
  123. package/dist/providers/accent.js.map +1 -0
  124. package/dist/styles/standalone.css +274 -111
  125. package/dist/styles/tailwind.css +1 -0
  126. package/dist/styles/tokens.css +69 -0
  127. package/dist/utils/control-surface.d.ts +1 -1
  128. package/dist/utils/control-surface.js +1 -1
  129. package/dist/utils/control-surface.js.map +1 -1
  130. package/package.json +1 -1
@@ -1,8 +1,12 @@
1
- import { type XYPoint } from "./sample.js";
2
- export declare function AreaChart({ data, ariaLabel, className, showAxes, stacked, }: {
3
- data?: XYPoint[];
1
+ import { type XYPoint, type XYSeriesDescriptor } from "./series.js";
2
+ export type AreaChartProps = {
3
+ data: XYPoint[];
4
+ series?: XYSeriesDescriptor[];
4
5
  ariaLabel?: string;
5
6
  className?: string;
6
7
  showAxes?: boolean;
8
+ showLegend?: boolean;
7
9
  stacked?: boolean;
8
- }): import("react").JSX.Element;
10
+ valueFormatter?: (value: number) => string;
11
+ };
12
+ export declare function AreaChart({ data, series, ariaLabel, className, showAxes, showLegend, stacked, valueFormatter, }: AreaChartProps): import("react").JSX.Element;
@@ -1,55 +1,54 @@
1
1
  "use client";
2
- import { CHART_COLORS as e } from "./palette.js";
3
- import { ANIMATION_PROPS as t, CHART_TYPE as n, GRID_PROPS as r, cartesianAxisProps as i, chartTooltipProps as a } from "./config.js";
4
- import { SAMPLE as o } from "./sample.js";
5
- import { ChartFrame as s } from "./frame.js";
6
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
- import { Area as u, AreaChart as d, CartesianGrid as f, Tooltip as p, XAxis as m, YAxis as h } from "recharts";
2
+ import { ANIMATION_PROPS as e, CHART_PLOT_MARGIN as t, CHART_PLOT_MARGIN_BARE as n, CHART_TYPE as r, GRID_PROPS as i, cartesianAxisProps as a, chartTooltipProps as o, seriesColor as s } from "./config.js";
3
+ import { resolveChartSeries as c, xyFallbackKeys as l } from "./series.js";
4
+ import { ChartShell as u } from "./frame.js";
5
+ import { ChartLegend as d } from "./legend.js";
6
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
7
+ import { Area as m, AreaChart as h, CartesianGrid as g, Tooltip as _, XAxis as v, YAxis as y } from "recharts";
8
8
  //#region src/charts/area.tsx
9
- function g({ data: g = o, ariaLabel: _ = "Area chart", className: v, showAxes: y = !1, stacked: b = !1 }) {
10
- let x = g.some((e) => e.y2 != null), S = g.some((e) => e.y3 != null), C = b ? "stack" : void 0;
11
- return /* @__PURE__ */ c(s, {
12
- ariaLabel: _,
13
- className: v,
14
- children: /* @__PURE__ */ l(d, {
15
- data: g,
9
+ function b({ data: b, series: x, ariaLabel: S = "Area chart", className: C, showAxes: w = !1, showLegend: T = !1, stacked: E = !1, valueFormatter: D }) {
10
+ let O = c(x, l(b)), k = E ? "stack" : void 0;
11
+ return /* @__PURE__ */ f(u, {
12
+ ariaLabel: S,
13
+ className: C,
14
+ legend: T ? /* @__PURE__ */ f(d, {
15
+ items: O,
16
+ shape: "area"
17
+ }) : void 0,
18
+ children: /* @__PURE__ */ p(h, {
19
+ data: b,
20
+ margin: w ? t : n,
16
21
  children: [
17
- y ? /* @__PURE__ */ c(f, { ...r }) : null,
18
- /* @__PURE__ */ c(m, {
22
+ w ? /* @__PURE__ */ f(g, { ...i }) : null,
23
+ /* @__PURE__ */ f(v, {
19
24
  dataKey: "x",
20
- ...i(!y)
25
+ ...a(!w)
21
26
  }),
22
- /* @__PURE__ */ c(h, { ...i(!y) }),
23
- /* @__PURE__ */ c(p, { ...a({ cursor: "line" }) }),
24
- /* @__PURE__ */ c(u, {
25
- dataKey: "y",
26
- stackId: C,
27
- stroke: e[0],
28
- fill: e[0],
29
- fillOpacity: n.areaFillAlpha,
30
- ...t
27
+ /* @__PURE__ */ f(y, {
28
+ ...a(!w),
29
+ tickFormatter: D
31
30
  }),
32
- x ? /* @__PURE__ */ c(u, {
33
- dataKey: "y2",
34
- stackId: C,
35
- stroke: e[2],
36
- fill: e[2],
37
- fillOpacity: n.areaFillAlpha,
38
- ...t
39
- }) : null,
40
- S ? /* @__PURE__ */ c(u, {
41
- dataKey: "y3",
42
- stackId: C,
43
- stroke: e[4],
44
- fill: e[4],
45
- fillOpacity: n.areaFillAlpha,
46
- ...t
47
- }) : null
31
+ /* @__PURE__ */ f(_, { ...o({
32
+ formatter: D,
33
+ cursor: "line"
34
+ }) }),
35
+ O.map((t, n) => {
36
+ let i = s(t, n);
37
+ return /* @__PURE__ */ f(m, {
38
+ dataKey: t.key,
39
+ name: t.label ?? t.key,
40
+ stackId: k,
41
+ stroke: i,
42
+ fill: i,
43
+ fillOpacity: r.areaFillAlpha,
44
+ ...e
45
+ }, t.key);
46
+ })
48
47
  ]
49
48
  })
50
49
  });
51
50
  }
52
51
  //#endregion
53
- export { g as AreaChart };
52
+ export { b as AreaChart };
54
53
 
55
54
  //# sourceMappingURL=area.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"area.js","names":[],"sources":["../../src/charts/area.tsx"],"sourcesContent":["import { Area, CartesianGrid, AreaChart as RechartsArea, Tooltip, XAxis, YAxis } from \"recharts\";\nimport {\n\tANIMATION_PROPS,\n\tCHART_TYPE,\n\tcartesianAxisProps,\n\tchartTooltipProps,\n\tGRID_PROPS,\n} from \"./config\";\nimport { ChartFrame } from \"./frame\";\nimport { CHART_COLORS } from \"./palette\";\nimport { SAMPLE, type XYPoint } from \"./sample\";\n\nexport function AreaChart({\n\tdata = SAMPLE,\n\tariaLabel = \"Area chart\",\n\tclassName,\n\tshowAxes = false,\n\tstacked = false,\n}: {\n\tdata?: XYPoint[];\n\tariaLabel?: string;\n\tclassName?: string;\n\tshowAxes?: boolean;\n\tstacked?: boolean;\n}) {\n\tconst dual = data.some((point) => point.y2 != null);\n\tconst triple = data.some((point) => point.y3 != null);\n\tconst stackId = stacked ? \"stack\" : undefined;\n\treturn (\n\t\t<ChartFrame ariaLabel={ariaLabel} className={className}>\n\t\t\t<RechartsArea data={data}>\n\t\t\t\t{showAxes ? <CartesianGrid {...GRID_PROPS} /> : null}\n\t\t\t\t<XAxis dataKey=\"x\" {...cartesianAxisProps(!showAxes)} />\n\t\t\t\t<YAxis {...cartesianAxisProps(!showAxes)} />\n\t\t\t\t<Tooltip {...chartTooltipProps({ cursor: \"line\" })} />\n\t\t\t\t<Area\n\t\t\t\t\tdataKey=\"y\"\n\t\t\t\t\tstackId={stackId}\n\t\t\t\t\tstroke={CHART_COLORS[0]}\n\t\t\t\t\tfill={CHART_COLORS[0]}\n\t\t\t\t\tfillOpacity={CHART_TYPE.areaFillAlpha}\n\t\t\t\t\t{...ANIMATION_PROPS}\n\t\t\t\t/>\n\t\t\t\t{dual ? (\n\t\t\t\t\t<Area\n\t\t\t\t\t\tdataKey=\"y2\"\n\t\t\t\t\t\tstackId={stackId}\n\t\t\t\t\t\tstroke={CHART_COLORS[2]}\n\t\t\t\t\t\tfill={CHART_COLORS[2]}\n\t\t\t\t\t\tfillOpacity={CHART_TYPE.areaFillAlpha}\n\t\t\t\t\t\t{...ANIMATION_PROPS}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t\t{triple ? (\n\t\t\t\t\t<Area\n\t\t\t\t\t\tdataKey=\"y3\"\n\t\t\t\t\t\tstackId={stackId}\n\t\t\t\t\t\tstroke={CHART_COLORS[4]}\n\t\t\t\t\t\tfill={CHART_COLORS[4]}\n\t\t\t\t\t\tfillOpacity={CHART_TYPE.areaFillAlpha}\n\t\t\t\t\t\t{...ANIMATION_PROPS}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t</RechartsArea>\n\t\t</ChartFrame>\n\t);\n}\n"],"mappings":";;;;;;;;AAYA,SAAgB,EAAU,EACzB,UAAO,GACP,eAAY,cACZ,cACA,cAAW,IACX,aAAU,MAOR;CACF,IAAM,IAAO,EAAK,MAAM,MAAU,EAAM,MAAM,IAAI,GAC5C,IAAS,EAAK,MAAM,MAAU,EAAM,MAAM,IAAI,GAC9C,IAAU,IAAU,UAAU,KAAA;CACpC,OACC,kBAAC,GAAD;EAAuB;EAAsB;EAC5C,UAAA,kBAAC,GAAD;GAAoB;GAApB,UAAA;IACE,IAAW,kBAAC,GAAD,EAAe,GAAI,EAAa,CAAA,IAAI;IAChD,kBAAC,GAAD;KAAO,SAAQ;KAAI,GAAI,EAAmB,CAAC,CAAQ;IAAI,CAAA;IACvD,kBAAC,GAAD,EAAO,GAAI,EAAmB,CAAC,CAAQ,EAAI,CAAA;IAC3C,kBAAC,GAAD,EAAS,GAAI,EAAkB,EAAE,QAAQ,OAAO,CAAC,EAAI,CAAA;IACrD,kBAAC,GAAD;KACC,SAAQ;KACC;KACT,QAAQ,EAAa;KACrB,MAAM,EAAa;KACnB,aAAa,EAAW;KACxB,GAAI;IACJ,CAAA;IACA,IACA,kBAAC,GAAD;KACC,SAAQ;KACC;KACT,QAAQ,EAAa;KACrB,MAAM,EAAa;KACnB,aAAa,EAAW;KACxB,GAAI;IACJ,CAAA,IACE;IACH,IACA,kBAAC,GAAD;KACC,SAAQ;KACC;KACT,QAAQ,EAAa;KACrB,MAAM,EAAa;KACnB,aAAa,EAAW;KACxB,GAAI;IACJ,CAAA,IACE;GACS;;CACH,CAAA;AAEd"}
1
+ {"version":3,"file":"area.js","names":[],"sources":["../../src/charts/area.tsx"],"sourcesContent":["import { Area, CartesianGrid, AreaChart as RechartsArea, Tooltip, XAxis, YAxis } from \"recharts\";\nimport {\n\tANIMATION_PROPS,\n\tCHART_PLOT_MARGIN,\n\tCHART_PLOT_MARGIN_BARE,\n\tCHART_TYPE,\n\tcartesianAxisProps,\n\tchartTooltipProps,\n\tGRID_PROPS,\n\tseriesColor,\n} from \"./config\";\nimport { ChartShell } from \"./frame\";\nimport { ChartLegend } from \"./legend\";\nimport {\n\tresolveChartSeries,\n\ttype XYPoint,\n\ttype XYSeriesDescriptor,\n\txyFallbackKeys,\n} from \"./series\";\n\nexport type AreaChartProps = {\n\tdata: XYPoint[];\n\tseries?: XYSeriesDescriptor[];\n\tariaLabel?: string;\n\tclassName?: string;\n\tshowAxes?: boolean;\n\tshowLegend?: boolean;\n\tstacked?: boolean;\n\tvalueFormatter?: (value: number) => string;\n};\n\nexport function AreaChart({\n\tdata,\n\tseries,\n\tariaLabel = \"Area chart\",\n\tclassName,\n\tshowAxes = false,\n\tshowLegend = false,\n\tstacked = false,\n\tvalueFormatter,\n}: AreaChartProps) {\n\tconst areas = resolveChartSeries(series, xyFallbackKeys(data));\n\tconst stackId = stacked ? \"stack\" : undefined;\n\treturn (\n\t\t<ChartShell\n\t\t\tariaLabel={ariaLabel}\n\t\t\tclassName={className}\n\t\t\tlegend={showLegend ? <ChartLegend items={areas} shape=\"area\" /> : undefined}\n\t\t>\n\t\t\t<RechartsArea data={data} margin={showAxes ? CHART_PLOT_MARGIN : CHART_PLOT_MARGIN_BARE}>\n\t\t\t\t{showAxes ? <CartesianGrid {...GRID_PROPS} /> : null}\n\t\t\t\t<XAxis dataKey=\"x\" {...cartesianAxisProps(!showAxes)} />\n\t\t\t\t<YAxis {...cartesianAxisProps(!showAxes)} tickFormatter={valueFormatter} />\n\t\t\t\t<Tooltip {...chartTooltipProps({ formatter: valueFormatter, cursor: \"line\" })} />\n\t\t\t\t{areas.map((item, index) => {\n\t\t\t\t\tconst fill = seriesColor(item, index);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Area\n\t\t\t\t\t\t\tkey={item.key}\n\t\t\t\t\t\t\tdataKey={item.key}\n\t\t\t\t\t\t\tname={item.label ?? item.key}\n\t\t\t\t\t\t\tstackId={stackId}\n\t\t\t\t\t\t\tstroke={fill}\n\t\t\t\t\t\t\tfill={fill}\n\t\t\t\t\t\t\tfillOpacity={CHART_TYPE.areaFillAlpha}\n\t\t\t\t\t\t\t{...ANIMATION_PROPS}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</RechartsArea>\n\t\t</ChartShell>\n\t);\n}\n"],"mappings":";;;;;;;;AA+BA,SAAgB,EAAU,EACzB,SACA,WACA,eAAY,cACZ,cACA,cAAW,IACX,gBAAa,IACb,aAAU,IACV,qBACkB;CAClB,IAAM,IAAQ,EAAmB,GAAQ,EAAe,CAAI,CAAC,GACvD,IAAU,IAAU,UAAU,KAAA;CACpC,OACC,kBAAC,GAAD;EACY;EACA;EACX,QAAQ,IAAa,kBAAC,GAAD;GAAa,OAAO;GAAO,OAAM;EAAQ,CAAA,IAAI,KAAA;EAElE,UAAA,kBAAC,GAAD;GAAoB;GAAM,QAAQ,IAAW,IAAoB;GAAjE,UAAA;IACE,IAAW,kBAAC,GAAD,EAAe,GAAI,EAAa,CAAA,IAAI;IAChD,kBAAC,GAAD;KAAO,SAAQ;KAAI,GAAI,EAAmB,CAAC,CAAQ;IAAI,CAAA;IACvD,kBAAC,GAAD;KAAO,GAAI,EAAmB,CAAC,CAAQ;KAAG,eAAe;IAAiB,CAAA;IAC1E,kBAAC,GAAD,EAAS,GAAI,EAAkB;KAAE,WAAW;KAAgB,QAAQ;IAAO,CAAC,EAAI,CAAA;IAC/E,EAAM,KAAK,GAAM,MAAU;KAC3B,IAAM,IAAO,EAAY,GAAM,CAAK;KACpC,OACC,kBAAC,GAAD;MAEC,SAAS,EAAK;MACd,MAAM,EAAK,SAAS,EAAK;MAChB;MACT,QAAQ;MACF;MACN,aAAa,EAAW;MACxB,GAAI;KACJ,GARK,EAAK,GAQV;IAEH,CAAC;GACY;;CACH,CAAA;AAEd"}
@@ -1,9 +1,12 @@
1
- import { type XYPoint } from "./sample.js";
2
- export declare function BarChart({ data, ariaLabel, className, showAxes, color, valueFormatter, }: {
3
- data?: XYPoint[];
1
+ import { type XYPoint, type XYSeriesDescriptor } from "./series.js";
2
+ export type BarChartProps = {
3
+ data: XYPoint[];
4
+ series?: XYSeriesDescriptor[];
4
5
  ariaLabel?: string;
5
6
  className?: string;
6
7
  showAxes?: boolean;
8
+ showLegend?: boolean;
7
9
  color?: string;
8
10
  valueFormatter?: (value: number) => string;
9
- }): import("react").JSX.Element;
11
+ };
12
+ export declare function BarChart({ data, series, ariaLabel, className, showAxes, showLegend, color, valueFormatter, }: BarChartProps): import("react").JSX.Element;
@@ -1,42 +1,49 @@
1
1
  "use client";
2
- import { CHART_COLORS as e } from "./palette.js";
3
- import { ANIMATION_PROPS as t, BAR_RADIUS as n, GRID_PROPS as r, cartesianAxisProps as i, chartTooltipProps as a } from "./config.js";
4
- import { SAMPLE as o } from "./sample.js";
5
- import { ChartFrame as s } from "./frame.js";
6
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
- import { Bar as u, BarChart as d, CartesianGrid as f, Tooltip as p, XAxis as m, YAxis as h } from "recharts";
2
+ import { ANIMATION_PROPS as e, BAR_RADIUS as t, CHART_PLOT_MARGIN as n, CHART_PLOT_MARGIN_BARE as r, GRID_PROPS as i, cartesianAxisProps as a, chartTooltipProps as o, seriesColor as s } from "./config.js";
3
+ import { applyLeadColor as c, resolveChartSeries as l } from "./series.js";
4
+ import { ChartShell as u } from "./frame.js";
5
+ import { ChartLegend as d } from "./legend.js";
6
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
7
+ import { Bar as m, BarChart as h, CartesianGrid as g, Tooltip as _, XAxis as v, YAxis as y } from "recharts";
8
8
  //#region src/charts/bar.tsx
9
- function g({ data: g = o, ariaLabel: _ = "Bar chart", className: v, showAxes: y = !1, color: b, valueFormatter: x }) {
10
- return /* @__PURE__ */ c(s, {
11
- ariaLabel: _,
12
- className: v,
13
- children: /* @__PURE__ */ l(d, {
14
- data: g,
9
+ function b({ data: b, series: x, ariaLabel: S = "Bar chart", className: C, showAxes: w = !1, showLegend: T = !1, color: E, valueFormatter: D }) {
10
+ let O = c(l(x, ["y"]), E);
11
+ return /* @__PURE__ */ f(u, {
12
+ ariaLabel: S,
13
+ className: C,
14
+ legend: T ? /* @__PURE__ */ f(d, {
15
+ items: O,
16
+ shape: "bar"
17
+ }) : void 0,
18
+ children: /* @__PURE__ */ p(h, {
19
+ data: b,
20
+ margin: w ? n : r,
15
21
  children: [
16
- y ? /* @__PURE__ */ c(f, { ...r }) : null,
17
- /* @__PURE__ */ c(m, {
22
+ w ? /* @__PURE__ */ f(g, { ...i }) : null,
23
+ /* @__PURE__ */ f(v, {
18
24
  dataKey: "x",
19
- ...i(!y)
25
+ ...a(!w)
20
26
  }),
21
- /* @__PURE__ */ c(h, {
22
- ...i(!y),
23
- tickFormatter: x
27
+ /* @__PURE__ */ f(y, {
28
+ ...a(!w),
29
+ tickFormatter: D
24
30
  }),
25
- /* @__PURE__ */ c(p, { ...a({
26
- formatter: x,
31
+ /* @__PURE__ */ f(_, { ...o({
32
+ formatter: D,
27
33
  cursor: "bar"
28
34
  }) }),
29
- /* @__PURE__ */ c(u, {
30
- dataKey: "y",
31
- fill: b ?? e[0],
32
- radius: n.vertical,
33
- ...t
34
- })
35
+ O.map((n, r) => /* @__PURE__ */ f(m, {
36
+ dataKey: n.key,
37
+ name: n.label ?? n.key,
38
+ fill: s(n, r),
39
+ radius: t.vertical,
40
+ ...e
41
+ }, n.key))
35
42
  ]
36
43
  })
37
44
  });
38
45
  }
39
46
  //#endregion
40
- export { g as BarChart };
47
+ export { b as BarChart };
41
48
 
42
49
  //# sourceMappingURL=bar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bar.js","names":[],"sources":["../../src/charts/bar.tsx"],"sourcesContent":["import { Bar, CartesianGrid, BarChart as RechartsBar, Tooltip, XAxis, YAxis } from \"recharts\";\nimport {\n\tANIMATION_PROPS,\n\tBAR_RADIUS,\n\tcartesianAxisProps,\n\tchartTooltipProps,\n\tGRID_PROPS,\n} from \"./config\";\nimport { ChartFrame } from \"./frame\";\nimport { CHART_COLORS } from \"./palette\";\nimport { SAMPLE, type XYPoint } from \"./sample\";\n\nexport function BarChart({\n\tdata = SAMPLE,\n\tariaLabel = \"Bar chart\",\n\tclassName,\n\tshowAxes = false,\n\tcolor,\n\tvalueFormatter,\n}: {\n\tdata?: XYPoint[];\n\tariaLabel?: string;\n\tclassName?: string;\n\tshowAxes?: boolean;\n\tcolor?: string;\n\tvalueFormatter?: (value: number) => string;\n}) {\n\treturn (\n\t\t<ChartFrame ariaLabel={ariaLabel} className={className}>\n\t\t\t<RechartsBar data={data}>\n\t\t\t\t{showAxes ? <CartesianGrid {...GRID_PROPS} /> : null}\n\t\t\t\t<XAxis dataKey=\"x\" {...cartesianAxisProps(!showAxes)} />\n\t\t\t\t<YAxis {...cartesianAxisProps(!showAxes)} tickFormatter={valueFormatter} />\n\t\t\t\t<Tooltip {...chartTooltipProps({ formatter: valueFormatter, cursor: \"bar\" })} />\n\t\t\t\t<Bar\n\t\t\t\t\tdataKey=\"y\"\n\t\t\t\t\tfill={color ?? CHART_COLORS[0]}\n\t\t\t\t\tradius={BAR_RADIUS.vertical}\n\t\t\t\t\t{...ANIMATION_PROPS}\n\t\t\t\t/>\n\t\t\t</RechartsBar>\n\t\t</ChartFrame>\n\t);\n}\n"],"mappings":";;;;;;;;AAYA,SAAgB,EAAS,EACxB,UAAO,GACP,eAAY,aACZ,cACA,cAAW,IACX,UACA,qBAQE;CACF,OACC,kBAAC,GAAD;EAAuB;EAAsB;EAC5C,UAAA,kBAAC,GAAD;GAAmB;GAAnB,UAAA;IACE,IAAW,kBAAC,GAAD,EAAe,GAAI,EAAa,CAAA,IAAI;IAChD,kBAAC,GAAD;KAAO,SAAQ;KAAI,GAAI,EAAmB,CAAC,CAAQ;IAAI,CAAA;IACvD,kBAAC,GAAD;KAAO,GAAI,EAAmB,CAAC,CAAQ;KAAG,eAAe;IAAiB,CAAA;IAC1E,kBAAC,GAAD,EAAS,GAAI,EAAkB;KAAE,WAAW;KAAgB,QAAQ;IAAM,CAAC,EAAI,CAAA;IAC/E,kBAAC,GAAD;KACC,SAAQ;KACR,MAAM,KAAS,EAAa;KAC5B,QAAQ,EAAW;KACnB,GAAI;IACJ,CAAA;GACW;;CACF,CAAA;AAEd"}
1
+ {"version":3,"file":"bar.js","names":[],"sources":["../../src/charts/bar.tsx"],"sourcesContent":["import { Bar, CartesianGrid, BarChart as RechartsBar, Tooltip, XAxis, YAxis } from \"recharts\";\nimport {\n\tANIMATION_PROPS,\n\tBAR_RADIUS,\n\tCHART_PLOT_MARGIN,\n\tCHART_PLOT_MARGIN_BARE,\n\tcartesianAxisProps,\n\tchartTooltipProps,\n\tGRID_PROPS,\n\tseriesColor,\n} from \"./config\";\nimport { ChartShell } from \"./frame\";\nimport { ChartLegend } from \"./legend\";\nimport {\n\tapplyLeadColor,\n\tresolveChartSeries,\n\ttype XYPoint,\n\ttype XYSeriesDescriptor,\n} from \"./series\";\n\nexport type BarChartProps = {\n\tdata: XYPoint[];\n\tseries?: XYSeriesDescriptor[];\n\tariaLabel?: string;\n\tclassName?: string;\n\tshowAxes?: boolean;\n\tshowLegend?: boolean;\n\tcolor?: string;\n\tvalueFormatter?: (value: number) => string;\n};\n\nexport function BarChart({\n\tdata,\n\tseries,\n\tariaLabel = \"Bar chart\",\n\tclassName,\n\tshowAxes = false,\n\tshowLegend = false,\n\tcolor,\n\tvalueFormatter,\n}: BarChartProps) {\n\tconst bars = applyLeadColor(resolveChartSeries(series, [\"y\"]), color);\n\treturn (\n\t\t<ChartShell\n\t\t\tariaLabel={ariaLabel}\n\t\t\tclassName={className}\n\t\t\tlegend={showLegend ? <ChartLegend items={bars} shape=\"bar\" /> : undefined}\n\t\t>\n\t\t\t<RechartsBar data={data} margin={showAxes ? CHART_PLOT_MARGIN : CHART_PLOT_MARGIN_BARE}>\n\t\t\t\t{showAxes ? <CartesianGrid {...GRID_PROPS} /> : null}\n\t\t\t\t<XAxis dataKey=\"x\" {...cartesianAxisProps(!showAxes)} />\n\t\t\t\t<YAxis {...cartesianAxisProps(!showAxes)} tickFormatter={valueFormatter} />\n\t\t\t\t<Tooltip {...chartTooltipProps({ formatter: valueFormatter, cursor: \"bar\" })} />\n\t\t\t\t{bars.map((item, index) => (\n\t\t\t\t\t<Bar\n\t\t\t\t\t\tkey={item.key}\n\t\t\t\t\t\tdataKey={item.key}\n\t\t\t\t\t\tname={item.label ?? item.key}\n\t\t\t\t\t\tfill={seriesColor(item, index)}\n\t\t\t\t\t\tradius={BAR_RADIUS.vertical}\n\t\t\t\t\t\t{...ANIMATION_PROPS}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</RechartsBar>\n\t\t</ChartShell>\n\t);\n}\n"],"mappings":";;;;;;;;AA+BA,SAAgB,EAAS,EACxB,SACA,WACA,eAAY,aACZ,cACA,cAAW,IACX,gBAAa,IACb,UACA,qBACiB;CACjB,IAAM,IAAO,EAAe,EAAmB,GAAQ,CAAC,GAAG,CAAC,GAAG,CAAK;CACpE,OACC,kBAAC,GAAD;EACY;EACA;EACX,QAAQ,IAAa,kBAAC,GAAD;GAAa,OAAO;GAAM,OAAM;EAAO,CAAA,IAAI,KAAA;EAEhE,UAAA,kBAAC,GAAD;GAAmB;GAAM,QAAQ,IAAW,IAAoB;GAAhE,UAAA;IACE,IAAW,kBAAC,GAAD,EAAe,GAAI,EAAa,CAAA,IAAI;IAChD,kBAAC,GAAD;KAAO,SAAQ;KAAI,GAAI,EAAmB,CAAC,CAAQ;IAAI,CAAA;IACvD,kBAAC,GAAD;KAAO,GAAI,EAAmB,CAAC,CAAQ;KAAG,eAAe;IAAiB,CAAA;IAC1E,kBAAC,GAAD,EAAS,GAAI,EAAkB;KAAE,WAAW;KAAgB,QAAQ;IAAM,CAAC,EAAI,CAAA;IAC9E,EAAK,KAAK,GAAM,MAChB,kBAAC,GAAD;KAEC,SAAS,EAAK;KACd,MAAM,EAAK,SAAS,EAAK;KACzB,MAAM,EAAY,GAAM,CAAK;KAC7B,QAAQ,EAAW;KACnB,GAAI;IACJ,GANK,EAAK,GAMV,CACD;GACW;;CACF,CAAA;AAEd"}
@@ -1,8 +1,10 @@
1
- import { type BulletPoint } from "./sample.js";
2
- export declare function BulletChart({ data, ariaLabel, className, showAxes, valueFormatter, }: {
3
- data?: BulletPoint[];
1
+ import { type BulletPoint, type BulletSeriesDescriptor } from "./series.js";
2
+ export type BulletChartProps = {
3
+ data: BulletPoint[];
4
+ series?: BulletSeriesDescriptor[];
4
5
  ariaLabel?: string;
5
6
  className?: string;
6
7
  showAxes?: boolean;
7
8
  valueFormatter?: (value: number) => string;
8
- }): import("react").JSX.Element;
9
+ };
10
+ export declare function BulletChart({ data, series, ariaLabel, className, showAxes, valueFormatter, }: BulletChartProps): import("react").JSX.Element;
@@ -1,45 +1,40 @@
1
1
  "use client";
2
- import { CHART_COLORS as e } from "./palette.js";
3
- import { ANIMATION_PROPS as t, cartesianAxisProps as n, chartTooltipProps as r } from "./config.js";
4
- import { BULLET_SAMPLE as i } from "./sample.js";
2
+ import { ANIMATION_PROPS as e, cartesianAxisProps as t, chartTooltipProps as n, seriesColor as r } from "./config.js";
3
+ import { resolveChartSeries as i } from "./series.js";
5
4
  import { ChartFrame as a } from "./frame.js";
6
5
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
6
  import { Bar as c, BarChart as l, Tooltip as u, XAxis as d, YAxis as f } from "recharts";
8
7
  //#region src/charts/bullet.tsx
9
- function p({ data: p = i, ariaLabel: m = "Bullet chart", className: h, showAxes: g = !0, valueFormatter: _ }) {
8
+ function p({ data: p, series: m, ariaLabel: h = "Bullet chart", className: g, showAxes: _ = !0, valueFormatter: v }) {
9
+ let y = i(m, ["target", "value"]);
10
10
  return /* @__PURE__ */ o(a, {
11
- ariaLabel: m,
12
- className: h,
11
+ ariaLabel: h,
12
+ className: g,
13
13
  children: /* @__PURE__ */ s(l, {
14
14
  data: p,
15
15
  layout: "vertical",
16
16
  children: [
17
17
  /* @__PURE__ */ o(d, {
18
18
  type: "number",
19
- ...n(!g),
20
- tickFormatter: _
19
+ ...t(!_),
20
+ tickFormatter: v
21
21
  }),
22
22
  /* @__PURE__ */ o(f, {
23
23
  type: "category",
24
24
  dataKey: "name",
25
- ...n(!g)
25
+ ...t(!_)
26
26
  }),
27
- /* @__PURE__ */ o(u, { ...r({
28
- formatter: _,
27
+ /* @__PURE__ */ o(u, { ...n({
28
+ formatter: v,
29
29
  cursor: "bar"
30
30
  }) }),
31
- /* @__PURE__ */ o(c, {
32
- dataKey: "target",
33
- fill: e[6],
34
- barSize: 10,
35
- ...t
36
- }),
37
- /* @__PURE__ */ o(c, {
38
- dataKey: "value",
39
- fill: e[1],
40
- barSize: 6,
41
- ...t
42
- })
31
+ y.map((t) => /* @__PURE__ */ o(c, {
32
+ dataKey: t.key,
33
+ name: t.label ?? t.key,
34
+ fill: r(t, t.key === "target" ? 6 : 1),
35
+ barSize: t.key === "target" ? 10 : 6,
36
+ ...e
37
+ }, t.key))
43
38
  ]
44
39
  })
45
40
  });
@@ -1 +1 @@
1
- {"version":3,"file":"bullet.js","names":[],"sources":["../../src/charts/bullet.tsx"],"sourcesContent":["import { Bar, BarChart as RechartsBar, Tooltip, XAxis, YAxis } from \"recharts\";\nimport { ANIMATION_PROPS, cartesianAxisProps, chartTooltipProps } from \"./config\";\nimport { ChartFrame } from \"./frame\";\nimport { CHART_COLORS } from \"./palette\";\nimport { BULLET_SAMPLE, type BulletPoint } from \"./sample\";\n\nexport function BulletChart({\n\tdata = BULLET_SAMPLE,\n\tariaLabel = \"Bullet chart\",\n\tclassName,\n\tshowAxes = true,\n\tvalueFormatter,\n}: {\n\tdata?: BulletPoint[];\n\tariaLabel?: string;\n\tclassName?: string;\n\tshowAxes?: boolean;\n\tvalueFormatter?: (value: number) => string;\n}) {\n\treturn (\n\t\t<ChartFrame ariaLabel={ariaLabel} className={className}>\n\t\t\t<RechartsBar data={data} layout=\"vertical\">\n\t\t\t\t<XAxis type=\"number\" {...cartesianAxisProps(!showAxes)} tickFormatter={valueFormatter} />\n\t\t\t\t<YAxis type=\"category\" dataKey=\"name\" {...cartesianAxisProps(!showAxes)} />\n\t\t\t\t<Tooltip {...chartTooltipProps({ formatter: valueFormatter, cursor: \"bar\" })} />\n\t\t\t\t<Bar dataKey=\"target\" fill={CHART_COLORS[6]} barSize={10} {...ANIMATION_PROPS} />\n\t\t\t\t<Bar dataKey=\"value\" fill={CHART_COLORS[1]} barSize={6} {...ANIMATION_PROPS} />\n\t\t\t</RechartsBar>\n\t\t</ChartFrame>\n\t);\n}\n"],"mappings":";;;;;;;;AAMA,SAAgB,EAAY,EAC3B,UAAO,GACP,eAAY,gBACZ,cACA,cAAW,IACX,qBAOE;CACF,OACC,kBAAC,GAAD;EAAuB;EAAsB;EAC5C,UAAA,kBAAC,GAAD;GAAmB;GAAM,QAAO;GAAhC,UAAA;IACC,kBAAC,GAAD;KAAO,MAAK;KAAS,GAAI,EAAmB,CAAC,CAAQ;KAAG,eAAe;IAAiB,CAAA;IACxF,kBAAC,GAAD;KAAO,MAAK;KAAW,SAAQ;KAAO,GAAI,EAAmB,CAAC,CAAQ;IAAI,CAAA;IAC1E,kBAAC,GAAD,EAAS,GAAI,EAAkB;KAAE,WAAW;KAAgB,QAAQ;IAAM,CAAC,EAAI,CAAA;IAC/E,kBAAC,GAAD;KAAK,SAAQ;KAAS,MAAM,EAAa;KAAI,SAAS;KAAI,GAAI;IAAkB,CAAA;IAChF,kBAAC,GAAD;KAAK,SAAQ;KAAQ,MAAM,EAAa;KAAI,SAAS;KAAG,GAAI;IAAkB,CAAA;GAClE;;CACF,CAAA;AAEd"}
1
+ {"version":3,"file":"bullet.js","names":[],"sources":["../../src/charts/bullet.tsx"],"sourcesContent":["import { Bar, BarChart as RechartsBar, Tooltip, XAxis, YAxis } from \"recharts\";\nimport { ANIMATION_PROPS, cartesianAxisProps, chartTooltipProps, seriesColor } from \"./config\";\nimport { ChartFrame } from \"./frame\";\nimport { type BulletPoint, type BulletSeriesDescriptor, resolveChartSeries } from \"./series\";\n\nexport type BulletChartProps = {\n\tdata: BulletPoint[];\n\tseries?: BulletSeriesDescriptor[];\n\tariaLabel?: string;\n\tclassName?: string;\n\tshowAxes?: boolean;\n\tvalueFormatter?: (value: number) => string;\n};\n\nexport function BulletChart({\n\tdata,\n\tseries,\n\tariaLabel = \"Bullet chart\",\n\tclassName,\n\tshowAxes = true,\n\tvalueFormatter,\n}: BulletChartProps) {\n\tconst bars = resolveChartSeries(series, [\"target\", \"value\"]);\n\treturn (\n\t\t<ChartFrame ariaLabel={ariaLabel} className={className}>\n\t\t\t<RechartsBar data={data} layout=\"vertical\">\n\t\t\t\t<XAxis type=\"number\" {...cartesianAxisProps(!showAxes)} tickFormatter={valueFormatter} />\n\t\t\t\t<YAxis type=\"category\" dataKey=\"name\" {...cartesianAxisProps(!showAxes)} />\n\t\t\t\t<Tooltip {...chartTooltipProps({ formatter: valueFormatter, cursor: \"bar\" })} />\n\t\t\t\t{bars.map((item) => (\n\t\t\t\t\t<Bar\n\t\t\t\t\t\tkey={item.key}\n\t\t\t\t\t\tdataKey={item.key}\n\t\t\t\t\t\tname={item.label ?? item.key}\n\t\t\t\t\t\tfill={seriesColor(item, item.key === \"target\" ? 6 : 1)}\n\t\t\t\t\t\tbarSize={item.key === \"target\" ? 10 : 6}\n\t\t\t\t\t\t{...ANIMATION_PROPS}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</RechartsBar>\n\t\t</ChartFrame>\n\t);\n}\n"],"mappings":";;;;;;;AAcA,SAAgB,EAAY,EAC3B,SACA,WACA,eAAY,gBACZ,cACA,cAAW,IACX,qBACoB;CACpB,IAAM,IAAO,EAAmB,GAAQ,CAAC,UAAU,OAAO,CAAC;CAC3D,OACC,kBAAC,GAAD;EAAuB;EAAsB;EAC5C,UAAA,kBAAC,GAAD;GAAmB;GAAM,QAAO;GAAhC,UAAA;IACC,kBAAC,GAAD;KAAO,MAAK;KAAS,GAAI,EAAmB,CAAC,CAAQ;KAAG,eAAe;IAAiB,CAAA;IACxF,kBAAC,GAAD;KAAO,MAAK;KAAW,SAAQ;KAAO,GAAI,EAAmB,CAAC,CAAQ;IAAI,CAAA;IAC1E,kBAAC,GAAD,EAAS,GAAI,EAAkB;KAAE,WAAW;KAAgB,QAAQ;IAAM,CAAC,EAAI,CAAA;IAC9E,EAAK,KAAK,MACV,kBAAC,GAAD;KAEC,SAAS,EAAK;KACd,MAAM,EAAK,SAAS,EAAK;KACzB,MAAM,EAAY,GAAM,EAAK,QAAQ,WAAW,IAAI,CAAC;KACrD,SAAS,EAAK,QAAQ,WAAW,KAAK;KACtC,GAAI;IACJ,GANK,EAAK,GAMV,CACD;GACW;;CACF,CAAA;AAEd"}
@@ -1 +1,4 @@
1
+ export type ColorsProps = {
2
+ ariaLabel?: string;
3
+ };
1
4
  export { CHART_COLORS, ChartPalette as Colors } from "./palette.js";
@@ -1,6 +1,8 @@
1
- import type { XYPoint } from "./sample.js";
2
- export declare function Charts({ data, ariaLabel, className, }: {
3
- data?: XYPoint[];
1
+ import type { XYPoint, XYSeriesDescriptor } from "./series.js";
2
+ export type ChartsProps = {
3
+ data: XYPoint[];
4
+ series?: XYSeriesDescriptor[];
4
5
  ariaLabel?: string;
5
6
  className?: string;
6
- }): import("react").JSX.Element;
7
+ };
8
+ export declare function Charts({ data, series, ariaLabel, className }: ChartsProps): import("react").JSX.Element;
@@ -2,11 +2,12 @@
2
2
  import { LineChart as e } from "./line.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  //#region src/charts/charts.tsx
5
- function n({ data: n, ariaLabel: r = "Charts", className: i }) {
5
+ function n({ data: n, series: r, ariaLabel: i = "Charts", className: a }) {
6
6
  return /* @__PURE__ */ t(e, {
7
7
  data: n,
8
- ariaLabel: r,
9
- className: i
8
+ series: r,
9
+ ariaLabel: i,
10
+ className: a
10
11
  });
11
12
  }
12
13
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"charts.js","names":[],"sources":["../../src/charts/charts.tsx"],"sourcesContent":["import { LineChart } from \"./line\";\nimport type { XYPoint } from \"./sample\";\n\nexport function Charts({\n\tdata,\n\tariaLabel = \"Charts\",\n\tclassName,\n}: {\n\tdata?: XYPoint[];\n\tariaLabel?: string;\n\tclassName?: string;\n}) {\n\treturn <LineChart data={data} ariaLabel={ariaLabel} className={className} />;\n}\n"],"mappings":";;;;AAGA,SAAgB,EAAO,EACtB,SACA,eAAY,UACZ,gBAKE;CACF,OAAO,kBAAC,GAAD;EAAiB;EAAiB;EAAsB;CAAY,CAAA;AAC5E"}
1
+ {"version":3,"file":"charts.js","names":[],"sources":["../../src/charts/charts.tsx"],"sourcesContent":["import { LineChart } from \"./line\";\nimport type { XYPoint, XYSeriesDescriptor } from \"./series\";\n\nexport type ChartsProps = {\n\tdata: XYPoint[];\n\tseries?: XYSeriesDescriptor[];\n\tariaLabel?: string;\n\tclassName?: string;\n};\n\nexport function Charts({ data, series, ariaLabel = \"Charts\", className }: ChartsProps) {\n\treturn <LineChart data={data} series={series} ariaLabel={ariaLabel} className={className} />;\n}\n"],"mappings":";;;;AAUA,SAAgB,EAAO,EAAE,SAAM,WAAQ,eAAY,UAAU,gBAA0B;CACtF,OAAO,kBAAC,GAAD;EAAiB;EAAc;EAAmB;EAAsB;CAAY,CAAA;AAC5F"}
@@ -1,3 +1,5 @@
1
+ import type { ChartSeriesDescriptor } from "./series.js";
2
+ export type { ChartSeriesDescriptor } from "./series.js";
1
3
  export type ChartTypeFace = "axis" | "legend" | "tooltipTitle" | "tooltipBody";
2
4
  export declare const CHART_TYPE: {
3
5
  readonly axisFontSize: 11;
@@ -62,8 +64,10 @@ export declare function chartTooltipContentStyle(): {
62
64
  background: string;
63
65
  border: string;
64
66
  borderRadius: string;
67
+ boxShadow: string;
65
68
  fontSize: number;
66
69
  color: string;
70
+ padding: string;
67
71
  };
68
72
  export declare function chartTooltipProps(options?: {
69
73
  formatter?: (value: number) => string;
@@ -72,6 +76,10 @@ export declare function chartTooltipProps(options?: {
72
76
  isAnimationActive: boolean;
73
77
  animationDuration: number;
74
78
  offset: number;
79
+ allowEscapeViewBox: {
80
+ x: boolean;
81
+ y: boolean;
82
+ };
75
83
  cursor: boolean | {
76
84
  readonly stroke: string;
77
85
  readonly strokeOpacity: 0.35;
@@ -84,30 +92,21 @@ export declare function chartTooltipProps(options?: {
84
92
  outline: string;
85
93
  zIndex: number;
86
94
  pointerEvents: "none";
95
+ transition: string;
96
+ animation: string;
87
97
  };
88
98
  contentStyle: {
89
99
  background: string;
90
100
  border: string;
91
101
  borderRadius: string;
102
+ boxShadow: string;
92
103
  fontSize: number;
93
104
  color: string;
105
+ padding: string;
94
106
  };
95
- labelStyle: {
96
- fontSize: number;
97
- color: string;
98
- };
99
- itemStyle: {
100
- fontSize: number;
101
- };
102
- formatter: ((value: unknown) => string | undefined) | undefined;
103
- };
104
- export declare function chartLegendProps(): {
105
- wrapperStyle: {
106
- fontSize: number;
107
- color: string;
108
- };
109
- iconSize: number;
107
+ content: never;
110
108
  };
109
+ export declare function seriesColor(series: ChartSeriesDescriptor | undefined, index: number): string | undefined;
111
110
  export declare const RESPONSIVE_CONTAINER_PROPS: {
112
111
  width: "100%";
113
112
  height: "100%";
@@ -115,3 +114,15 @@ export declare const RESPONSIVE_CONTAINER_PROPS: {
115
114
  minHeight: number;
116
115
  debounce: number;
117
116
  };
117
+ export declare const CHART_PLOT_MARGIN: {
118
+ readonly top: 4;
119
+ readonly right: 4;
120
+ readonly bottom: 0;
121
+ readonly left: 0;
122
+ };
123
+ export declare const CHART_PLOT_MARGIN_BARE: {
124
+ readonly top: 2;
125
+ readonly right: 2;
126
+ readonly bottom: 2;
127
+ readonly left: 2;
128
+ };
@@ -1,7 +1,9 @@
1
1
  "use client";
2
2
  import { CHART_COLORS as e, chartAxis as t, withAlpha as n } from "./palette.js";
3
+ import { ChartTooltipContent as r } from "./tooltip.js";
4
+ import { createElement as i } from "react";
3
5
  //#region src/charts/config.ts
4
- var r = {
6
+ var a = {
5
7
  axisFontSize: 11,
6
8
  legendFontSize: 12,
7
9
  tooltipTitleSize: 12,
@@ -12,40 +14,40 @@ var r = {
12
14
  gridOpacity: .15,
13
15
  areaFillAlpha: .2
14
16
  };
15
- function i(e) {
16
- return e === "legend" ? r.legendFontSize : e === "tooltipTitle" ? r.tooltipTitleSize : e === "tooltipBody" ? r.tooltipBodySize : r.axisFontSize;
17
+ function o(e) {
18
+ return e === "legend" ? a.legendFontSize : e === "tooltipTitle" ? a.tooltipTitleSize : e === "tooltipBody" ? a.tooltipBodySize : a.axisFontSize;
17
19
  }
18
- function a(e) {
19
- return { fontSize: i(e) };
20
+ function s(e) {
21
+ return { fontSize: o(e) };
20
22
  }
21
- function o(e = "axis") {
23
+ function c(e = "axis") {
22
24
  return {
23
- fontSize: i(e),
25
+ fontSize: o(e),
24
26
  fill: t
25
27
  };
26
28
  }
27
- function s(t) {
29
+ function l(t) {
28
30
  return e[t % e.length] ?? e[0];
29
31
  }
30
- var c = {
32
+ var u = {
31
33
  get tick() {
32
- return o("axis");
34
+ return c("axis");
33
35
  },
34
36
  axisLine: !1,
35
37
  tickLine: !1
36
38
  };
37
- function l(e = !1) {
39
+ function d(e = !1) {
38
40
  return {
39
41
  hide: e,
40
- ...c
42
+ ...u
41
43
  };
42
44
  }
43
- var u = {
45
+ var f = {
44
46
  vertical: !1,
45
47
  stroke: t,
46
- strokeOpacity: r.gridOpacity,
47
- strokeDasharray: r.gridDash
48
- }, d = {
48
+ strokeOpacity: a.gridOpacity,
49
+ strokeDasharray: a.gridDash
50
+ }, p = {
49
51
  horizontal: [
50
52
  0,
51
53
  4,
@@ -58,60 +60,72 @@ var u = {
58
60
  0,
59
61
  0
60
62
  ]
61
- }, f = { isAnimationActive: !1 }, p = {
63
+ }, m = { isAnimationActive: !1 }, h = {
62
64
  stroke: t,
63
65
  strokeOpacity: .35,
64
66
  strokeWidth: 1
65
- }, m = {
67
+ }, g = {
66
68
  fill: n("foreground", .06),
67
69
  stroke: "none"
68
70
  };
69
- function h() {
71
+ function _() {
70
72
  return {
71
- background: "hsl(var(--basalt-popover))",
72
- border: "1px solid hsl(var(--basalt-border))",
73
- borderRadius: "8px",
74
- fontSize: i("tooltipBody"),
75
- color: "hsl(var(--basalt-foreground))"
73
+ background: "transparent",
74
+ border: "none",
75
+ borderRadius: "0",
76
+ boxShadow: "none",
77
+ fontSize: o("tooltipBody"),
78
+ color: "hsl(var(--basalt-foreground))",
79
+ padding: "0"
76
80
  };
77
81
  }
78
- function g(e) {
82
+ function v(e) {
79
83
  return {
80
84
  isAnimationActive: !1,
81
85
  animationDuration: 0,
82
86
  offset: 12,
83
- cursor: e?.cursor === !1 ? !1 : e?.cursor === "line" ? p : m,
87
+ allowEscapeViewBox: {
88
+ x: !1,
89
+ y: !1
90
+ },
91
+ cursor: e?.cursor === !1 ? !1 : e?.cursor === "line" ? h : g,
84
92
  wrapperStyle: {
85
93
  outline: "none",
86
94
  zIndex: 40,
87
- pointerEvents: "none"
88
- },
89
- contentStyle: h(),
90
- labelStyle: {
91
- fontSize: i("tooltipTitle"),
92
- color: "hsl(var(--basalt-foreground))"
95
+ pointerEvents: "none",
96
+ transition: "none",
97
+ animation: "none"
93
98
  },
94
- itemStyle: a("tooltipBody"),
95
- formatter: e?.formatter ? (t) => e.formatter?.(Number(t)) : void 0
99
+ contentStyle: _(),
100
+ content: ((t) => i(r, {
101
+ active: t.active,
102
+ payload: t.payload,
103
+ label: t.label,
104
+ formatter: e?.formatter
105
+ }))
96
106
  };
97
107
  }
98
- function _() {
99
- return {
100
- wrapperStyle: {
101
- fontSize: i("legend"),
102
- color: t
103
- },
104
- iconSize: 8
105
- };
108
+ function y(t, n) {
109
+ return t?.color ?? e[n % e.length];
106
110
  }
107
- var v = {
111
+ var b = {
108
112
  width: "100%",
109
113
  height: "100%",
110
114
  minWidth: 0,
111
115
  minHeight: 0,
112
116
  debounce: 150
117
+ }, x = {
118
+ top: 4,
119
+ right: 4,
120
+ bottom: 0,
121
+ left: 0
122
+ }, S = {
123
+ top: 2,
124
+ right: 2,
125
+ bottom: 2,
126
+ left: 2
113
127
  };
114
128
  //#endregion
115
- export { f as ANIMATION_PROPS, c as AXIS_CONFIG, d as BAR_RADIUS, m as CHART_TOOLTIP_CURSOR_BAR, p as CHART_TOOLTIP_CURSOR_LINE, r as CHART_TYPE, u as GRID_PROPS, v as RESPONSIVE_CONTAINER_PROPS, l as cartesianAxisProps, i as chartFontSize, _ as chartLegendProps, a as chartTextStyle, o as chartTickStyle, h as chartTooltipContentStyle, g as chartTooltipProps, s as getChartColor };
129
+ export { m as ANIMATION_PROPS, u as AXIS_CONFIG, p as BAR_RADIUS, x as CHART_PLOT_MARGIN, S as CHART_PLOT_MARGIN_BARE, g as CHART_TOOLTIP_CURSOR_BAR, h as CHART_TOOLTIP_CURSOR_LINE, a as CHART_TYPE, f as GRID_PROPS, b as RESPONSIVE_CONTAINER_PROPS, d as cartesianAxisProps, o as chartFontSize, s as chartTextStyle, c as chartTickStyle, _ as chartTooltipContentStyle, v as chartTooltipProps, l as getChartColor, y as seriesColor };
116
130
 
117
131
  //# sourceMappingURL=config.js.map