@krizaka/charts 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/README.md +1 -1
  2. package/dist/actions-5VG352VZ.js +53 -0
  3. package/dist/actions-5VG352VZ.js.map +1 -0
  4. package/dist/bar.d.ts +3 -3
  5. package/dist/bar.js +7 -6
  6. package/dist/candlestick.d.ts +2 -2
  7. package/dist/candlestick.js +6 -5
  8. package/dist/card.d.ts +52 -0
  9. package/dist/card.js +19 -0
  10. package/dist/card.js.map +1 -0
  11. package/dist/{cartesian-BRhNQ3ib.d.ts → cartesian-CEY_wwe_.d.ts} +12 -2
  12. package/dist/chart.d.ts +2 -2
  13. package/dist/chart.js +5 -4
  14. package/dist/{chunk-BV4DBGN7.js → chunk-7W4T255Q.js} +4 -4
  15. package/dist/{chunk-W5ILLSPK.js → chunk-AGSSNMK5.js} +5 -5
  16. package/dist/{chunk-VKZZY2QD.js → chunk-FE4LUGAE.js} +5 -5
  17. package/dist/{chunk-ARARFMNE.js → chunk-FIQHMJZK.js} +5 -5
  18. package/dist/chunk-FIQHMJZK.js.map +1 -0
  19. package/dist/{chunk-ANUCSRUN.js → chunk-GD7TWEN3.js} +3 -3
  20. package/dist/chunk-GRRFPI27.js +89 -0
  21. package/dist/chunk-GRRFPI27.js.map +1 -0
  22. package/dist/{chunk-SLEJDQ3A.js → chunk-HH65IEUV.js} +3 -3
  23. package/dist/{chunk-OIRHLJBC.js → chunk-IJTI6VJD.js} +3 -3
  24. package/dist/{chunk-WVTIKOII.js → chunk-IURCLBUQ.js} +2 -2
  25. package/dist/{chunk-CVWSMUUB.js → chunk-JST4HJC3.js} +33 -15
  26. package/dist/chunk-JST4HJC3.js.map +1 -0
  27. package/dist/{chunk-IKQV3NSL.js → chunk-KERGFVSN.js} +3 -3
  28. package/dist/{chunk-XDDALY4C.js → chunk-KMQ7RANJ.js} +5 -5
  29. package/dist/{chunk-NCIQMRV3.js → chunk-LLUQEK5J.js} +5 -5
  30. package/dist/{chunk-AA5EWWYV.js → chunk-LZPZWBBY.js} +2 -2
  31. package/dist/{chunk-PBQV3B6O.js → chunk-MK2ZFUWM.js} +31 -16
  32. package/dist/chunk-MK2ZFUWM.js.map +1 -0
  33. package/dist/{chunk-CSSZLFLO.js → chunk-MRGMLDNS.js} +5 -5
  34. package/dist/{chunk-I3D7KUGN.js → chunk-NLTZWJLV.js} +3 -3
  35. package/dist/{chunk-PWMMXRMC.js → chunk-NV52AKHG.js} +3 -3
  36. package/dist/{chunk-MXLITIGU.js → chunk-NWJ5VDN7.js} +5 -5
  37. package/dist/{chunk-3CJHBJXA.js → chunk-OVASCEGF.js} +12 -73
  38. package/dist/chunk-OVASCEGF.js.map +1 -0
  39. package/dist/{chunk-EQLC2QVN.js → chunk-OZOAKP5F.js} +4 -4
  40. package/dist/chunk-OZOAKP5F.js.map +1 -0
  41. package/dist/{chunk-KNDHO67X.js → chunk-P2NK5L3B.js} +3 -3
  42. package/dist/{chunk-JTKR7ZWP.js → chunk-P6RS2L23.js} +140 -36
  43. package/dist/chunk-P6RS2L23.js.map +1 -0
  44. package/dist/{chunk-W5FX4TU3.js → chunk-PGD6SH5I.js} +30 -2
  45. package/dist/chunk-PGD6SH5I.js.map +1 -0
  46. package/dist/{chunk-4LBXEAGC.js → chunk-PWZHIGPO.js} +5 -5
  47. package/dist/{chunk-L2EKYWVI.js → chunk-VEOJNMPF.js} +3 -3
  48. package/dist/chunk-YHQFW2PR.js +71 -0
  49. package/dist/chunk-YHQFW2PR.js.map +1 -0
  50. package/dist/{chunk-C4MFZLJM.js → chunk-Z4T3JFNU.js} +2 -2
  51. package/dist/{chunk-EEP7PS2L.js → chunk-ZF7LVQTR.js} +3 -3
  52. package/dist/{context-BgYUymEO.d.ts → context-DNW7bJYw.d.ts} +19 -0
  53. package/dist/credits.d.ts +1 -1
  54. package/dist/credits.js +7 -6
  55. package/dist/earnings.d.ts +3 -3
  56. package/dist/earnings.js +8 -7
  57. package/dist/{frame-I7_xYGy5.d.ts → frame-B1HDNm7c.d.ts} +9 -5
  58. package/dist/funnel.d.ts +2 -2
  59. package/dist/funnel.js +6 -5
  60. package/dist/gauge.d.ts +2 -2
  61. package/dist/gauge.js +4 -3
  62. package/dist/geo.d.ts +2 -2
  63. package/dist/geo.js +5 -4
  64. package/dist/globe.d.ts +2 -2
  65. package/dist/globe.js +4 -3
  66. package/dist/goal.d.ts +2 -2
  67. package/dist/goal.js +5 -4
  68. package/dist/heatmap.d.ts +2 -2
  69. package/dist/heatmap.js +6 -5
  70. package/dist/index.d.ts +5 -3
  71. package/dist/index.js +45 -37
  72. package/dist/latency.d.ts +3 -3
  73. package/dist/latency.js +8 -7
  74. package/dist/line.d.ts +3 -3
  75. package/dist/line.js +7 -6
  76. package/dist/native.d.ts +19 -0
  77. package/dist/native.js +13 -1
  78. package/dist/native.js.map +1 -1
  79. package/dist/pie.d.ts +2 -2
  80. package/dist/pie.js +6 -5
  81. package/dist/provider.d.ts +2 -2
  82. package/dist/provider.js +4 -2
  83. package/dist/radar.d.ts +2 -2
  84. package/dist/radar.js +6 -5
  85. package/dist/sankey.d.ts +2 -2
  86. package/dist/sankey.js +6 -5
  87. package/dist/scatter.d.ts +2 -2
  88. package/dist/scatter.js +6 -5
  89. package/dist/sparkline.d.ts +2 -2
  90. package/dist/sparkline.js +6 -5
  91. package/dist/table-sheet-CQBIAV5N.js +36 -0
  92. package/dist/table-sheet-CQBIAV5N.js.map +1 -0
  93. package/dist/throughput.d.ts +3 -3
  94. package/dist/throughput.js +8 -7
  95. package/dist/ticker.d.ts +3 -3
  96. package/dist/ticker.js +8 -7
  97. package/dist/treemap.d.ts +2 -2
  98. package/dist/treemap.js +7 -6
  99. package/package.json +295 -53
  100. package/registry/area-chart.json +82 -12
  101. package/registry/bar-chart.json +82 -12
  102. package/registry/calendar-heatmap.json +46 -18
  103. package/registry/candlestick.json +46 -18
  104. package/registry/chart-card.json +235 -0
  105. package/registry/chart.json +40 -12
  106. package/registry/charts-provider.json +2 -2
  107. package/registry/earnings-chart.json +82 -12
  108. package/registry/examples/chart-card/before-after.d.ts +4 -0
  109. package/registry/examples/chart-card/before-after.js +22 -0
  110. package/registry/examples/chart-card/before-after.tsx +22 -0
  111. package/registry/examples/chart-card/jobs-activity.d.ts +4 -0
  112. package/registry/examples/chart-card/jobs-activity.js +20 -0
  113. package/registry/examples/chart-card/jobs-activity.tsx +20 -0
  114. package/registry/examples/chart-card/sparse-and-empty.d.ts +4 -0
  115. package/registry/examples/chart-card/sparse-and-empty.js +16 -0
  116. package/registry/examples/chart-card/sparse-and-empty.tsx +18 -0
  117. package/registry/examples/chart-card/usage-donut.d.ts +4 -0
  118. package/registry/examples/chart-card/usage-donut.js +18 -0
  119. package/registry/examples/chart-card/usage-donut.tsx +18 -0
  120. package/registry/examples/charts-provider/french-orazaka.js +1 -1
  121. package/registry/examples/charts-provider/french-orazaka.tsx +1 -1
  122. package/registry/examples/kpi-stat/dashboard-row.d.ts +4 -0
  123. package/registry/examples/kpi-stat/dashboard-row.js +19 -0
  124. package/registry/examples/kpi-stat/dashboard-row.tsx +17 -0
  125. package/registry/examples/kpi-stat/single.d.ts +4 -0
  126. package/registry/examples/kpi-stat/single.js +11 -0
  127. package/registry/examples/kpi-stat/single.tsx +6 -0
  128. package/registry/funnel.json +46 -18
  129. package/registry/gauge.json +42 -14
  130. package/registry/geo-map.json +46 -18
  131. package/registry/globe.json +40 -12
  132. package/registry/goal-progress.json +36 -8
  133. package/registry/heatmap.json +46 -18
  134. package/registry/index.json +49 -1
  135. package/registry/job-throughput.json +82 -12
  136. package/registry/kpi-stat.json +296 -0
  137. package/registry/latency-chart.json +82 -12
  138. package/registry/line-chart.json +82 -12
  139. package/registry/pie-chart.json +92 -36
  140. package/registry/price-ticker.json +82 -12
  141. package/registry/radar-chart.json +46 -18
  142. package/registry/sankey.json +46 -18
  143. package/registry/scatter-chart.json +46 -18
  144. package/registry/sparkline.json +38 -10
  145. package/registry/treemap.json +40 -12
  146. package/dist/chunk-3CJHBJXA.js.map +0 -1
  147. package/dist/chunk-ARARFMNE.js.map +0 -1
  148. package/dist/chunk-CVWSMUUB.js.map +0 -1
  149. package/dist/chunk-EQLC2QVN.js.map +0 -1
  150. package/dist/chunk-JTKR7ZWP.js.map +0 -1
  151. package/dist/chunk-PBQV3B6O.js.map +0 -1
  152. package/dist/chunk-W5FX4TU3.js.map +0 -1
  153. /package/dist/{chunk-BV4DBGN7.js.map → chunk-7W4T255Q.js.map} +0 -0
  154. /package/dist/{chunk-W5ILLSPK.js.map → chunk-AGSSNMK5.js.map} +0 -0
  155. /package/dist/{chunk-VKZZY2QD.js.map → chunk-FE4LUGAE.js.map} +0 -0
  156. /package/dist/{chunk-ANUCSRUN.js.map → chunk-GD7TWEN3.js.map} +0 -0
  157. /package/dist/{chunk-SLEJDQ3A.js.map → chunk-HH65IEUV.js.map} +0 -0
  158. /package/dist/{chunk-OIRHLJBC.js.map → chunk-IJTI6VJD.js.map} +0 -0
  159. /package/dist/{chunk-WVTIKOII.js.map → chunk-IURCLBUQ.js.map} +0 -0
  160. /package/dist/{chunk-IKQV3NSL.js.map → chunk-KERGFVSN.js.map} +0 -0
  161. /package/dist/{chunk-XDDALY4C.js.map → chunk-KMQ7RANJ.js.map} +0 -0
  162. /package/dist/{chunk-NCIQMRV3.js.map → chunk-LLUQEK5J.js.map} +0 -0
  163. /package/dist/{chunk-AA5EWWYV.js.map → chunk-LZPZWBBY.js.map} +0 -0
  164. /package/dist/{chunk-CSSZLFLO.js.map → chunk-MRGMLDNS.js.map} +0 -0
  165. /package/dist/{chunk-I3D7KUGN.js.map → chunk-NLTZWJLV.js.map} +0 -0
  166. /package/dist/{chunk-PWMMXRMC.js.map → chunk-NV52AKHG.js.map} +0 -0
  167. /package/dist/{chunk-MXLITIGU.js.map → chunk-NWJ5VDN7.js.map} +0 -0
  168. /package/dist/{chunk-KNDHO67X.js.map → chunk-P2NK5L3B.js.map} +0 -0
  169. /package/dist/{chunk-4LBXEAGC.js.map → chunk-PWZHIGPO.js.map} +0 -0
  170. /package/dist/{chunk-L2EKYWVI.js.map → chunk-VEOJNMPF.js.map} +0 -0
  171. /package/dist/{chunk-C4MFZLJM.js.map → chunk-Z4T3JFNU.js.map} +0 -0
  172. /package/dist/{chunk-EEP7PS2L.js.map → chunk-ZF7LVQTR.js.map} +0 -0
package/README.md CHANGED
@@ -5,7 +5,7 @@ chart libraries leave to you built in — a data table and a written summary in
5
5
  loading / empty / error states, SSR without layout shift, export, thresholds, live data — and React Native for the
6
6
  simple types.
7
7
 
8
- **Documentation: [krizaka.com/docs/ui](https://www.krizaka.com/docs/ui)** (generated from this package's registry).
8
+ **Documentation: [ui.krizaka.com](https://ui.krizaka.com)** (generated from this package's registry).
9
9
 
10
10
  ```bash
11
11
  npm install @krizaka/charts
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ "use client";
3
+
4
+ // src/web/actions.tsx
5
+ import { IconButton } from "@krizaka/ui/button";
6
+ import { DropdownMenu } from "@krizaka/ui/dropdown-menu";
7
+ import { lazy, Suspense, useState } from "react";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ var TableSheet = lazy(() => import("./table-sheet-CQBIAV5N.js"));
10
+ var icon = (d) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d }) });
11
+ var ICONS = {
12
+ table: "M3 5h18v14H3zM3 10h18M9 5v14",
13
+ download: "M12 3v12M7 10l5 5 5-5M5 21h14",
14
+ copy: "M9 9h11v11H9zM5 15V4h11"
15
+ };
16
+ function ChartActions({ title, table, labels, formats, viewTable, onExport, onCopy }) {
17
+ const [sheet, setSheet] = useState(false);
18
+ const entry = { csv: labels.downloadCsv, png: labels.downloadPng, svg: labels.downloadSvg };
19
+ let sheetNode = null;
20
+ if (sheet) {
21
+ sheetNode = /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(TableSheet, { title, table, labels, onClose: () => setSheet(false) }) });
22
+ }
23
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
24
+ /* @__PURE__ */ jsxs(DropdownMenu.Root, { modal: false, children: [
25
+ /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { label: `${labels.actions} \u2014 ${title}`, variant: "ghost", size: "icon", className: "kzc-more", "data-testid": "kzc-actions", children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: [
26
+ /* @__PURE__ */ jsx("circle", { cx: "5", cy: "12", r: "1.8" }),
27
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "1.8" }),
28
+ /* @__PURE__ */ jsx("circle", { cx: "19", cy: "12", r: "1.8" })
29
+ ] }) }) }),
30
+ /* @__PURE__ */ jsxs(DropdownMenu.Content, { align: "end", children: [
31
+ viewTable && /* @__PURE__ */ jsxs(DropdownMenu.Item, { onSelect: () => setSheet(true), children: [
32
+ icon(ICONS.table),
33
+ labels.viewTable
34
+ ] }),
35
+ viewTable && formats.length > 0 && /* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
36
+ formats.map((format) => /* @__PURE__ */ jsxs(DropdownMenu.Item, { onSelect: () => onExport(format), children: [
37
+ icon(ICONS.download),
38
+ entry[format]
39
+ ] }, format)),
40
+ /* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
41
+ /* @__PURE__ */ jsxs(DropdownMenu.Item, { onSelect: onCopy, children: [
42
+ icon(ICONS.copy),
43
+ labels.copyData
44
+ ] })
45
+ ] })
46
+ ] }),
47
+ sheetNode
48
+ ] });
49
+ }
50
+ export {
51
+ ChartActions as default
52
+ };
53
+ //# sourceMappingURL=actions-5VG352VZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/web/actions.tsx"],"sourcesContent":["\"use client\";\n// The actions menu (⋯) of a chart, built from the kit: @krizaka/ui's DropdownMenu and IconButton. Loaded by the frame\n// once the chart is in the browser (its own chunk): View as table (a Sheet holding the kit DataTable, loaded when it\n// opens), Download CSV / PNG / SVG, Copy data. The accessible table stays in the page whether this is used or not.\nimport { IconButton } from \"@krizaka/ui/button\";\nimport { DropdownMenu } from \"@krizaka/ui/dropdown-menu\";\nimport { lazy, type ReactNode, Suspense, useState } from \"react\";\n\nimport type { ChartLabels } from \"../core/labels\";\nimport type { ExportFormat, TableModel } from \"./frame\";\n\nconst TableSheet = lazy(() => import(\"./table-sheet\"));\n\nexport interface ChartActionsProps {\n readonly title: string;\n readonly table: TableModel;\n readonly labels: ChartLabels;\n /** Entries to offer, in this order. */\n readonly formats: readonly ExportFormat[];\n readonly viewTable: boolean;\n readonly onExport: (format: ExportFormat) => void;\n readonly onCopy: () => void;\n}\n\nconst icon = (d: string) => (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d={d} />\n </svg>\n);\nconst ICONS = {\n table: \"M3 5h18v14H3zM3 10h18M9 5v14\",\n download: \"M12 3v12M7 10l5 5 5-5M5 21h14\",\n copy: \"M9 9h11v11H9zM5 15V4h11\",\n} as const;\n\nexport default function ChartActions({ title, table, labels, formats, viewTable, onExport, onCopy }: ChartActionsProps) {\n const [sheet, setSheet] = useState(false);\n const entry: Record<ExportFormat, string> = { csv: labels.downloadCsv, png: labels.downloadPng, svg: labels.downloadSvg };\n let sheetNode: ReactNode = null;\n if (sheet) {\n sheetNode = (\n <Suspense fallback={null}>\n <TableSheet title={title} table={table} labels={labels} onClose={() => setSheet(false)} />\n </Suspense>\n );\n }\n return (\n <>\n <DropdownMenu.Root modal={false}>\n <DropdownMenu.Trigger asChild>\n <IconButton label={`${labels.actions} — ${title}`} variant=\"ghost\" size=\"icon\" className=\"kzc-more\" data-testid=\"kzc-actions\">\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden>\n <circle cx=\"5\" cy=\"12\" r=\"1.8\" />\n <circle cx=\"12\" cy=\"12\" r=\"1.8\" />\n <circle cx=\"19\" cy=\"12\" r=\"1.8\" />\n </svg>\n </IconButton>\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"end\">\n {viewTable && (\n <DropdownMenu.Item onSelect={() => setSheet(true)}>\n {icon(ICONS.table)}\n {labels.viewTable}\n </DropdownMenu.Item>\n )}\n {viewTable && formats.length > 0 && <DropdownMenu.Separator />}\n {formats.map((format) => (\n <DropdownMenu.Item key={format} onSelect={() => onExport(format)}>\n {icon(ICONS.download)}\n {entry[format]}\n </DropdownMenu.Item>\n ))}\n <DropdownMenu.Separator />\n <DropdownMenu.Item onSelect={onCopy}>\n {icon(ICONS.copy)}\n {labels.copyData}\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n {sheetNode}\n </>\n );\n}\n"],"mappings":";;;;AAIA,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,MAAsB,UAAU,gBAAgB;AAoBrD,SAqBA,UArBA,KAyBQ,YAzBR;AAfJ,IAAM,aAAa,KAAK,MAAM,OAAO,2BAAe,CAAC;AAarD,IAAM,OAAO,CAAC,MACZ,oBAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,QAAO,gBAAe,aAAY,KAAI,eAAc,SAAQ,gBAAe,SAAQ,eAAW,MACjI,8BAAC,UAAK,GAAM,GACd;AAEF,IAAM,QAAQ;AAAA,EACZ,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AACR;AAEe,SAAR,aAA8B,EAAE,OAAO,OAAO,QAAQ,SAAS,WAAW,UAAU,OAAO,GAAsB;AACtH,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,KAAK;AACxC,QAAM,QAAsC,EAAE,KAAK,OAAO,aAAa,KAAK,OAAO,aAAa,KAAK,OAAO,YAAY;AACxH,M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ts CHANGED
@@ -1,7 +1,7 @@
1
- import { C as CartesianProps } from './cartesian-BRhNQ3ib.js';
1
+ import { C as CartesianProps } from './cartesian-CEY_wwe_.js';
2
2
  import * as react from 'react';
3
- import { g as Datum } from './context-BgYUymEO.js';
4
- import './frame-I7_xYGy5.js';
3
+ import { g as Datum } from './context-DNW7bJYw.js';
4
+ import './frame-B1HDNm7c.js';
5
5
 
6
6
  interface BarChartProps<T extends Datum> extends CartesianProps<T> {
7
7
  /** Stack the series in one bar per category (a total and its parts); default: grouped side by side. */
package/dist/bar.js CHANGED
@@ -2,15 +2,16 @@
2
2
  import "./chunk-FINOPIDN.js";
3
3
  import {
4
4
  BarChart
5
- } from "./chunk-WVTIKOII.js";
6
- import "./chunk-CVWSMUUB.js";
5
+ } from "./chunk-IURCLBUQ.js";
6
+ import "./chunk-JST4HJC3.js";
7
7
  import "./chunk-BISL7DYW.js";
8
- import "./chunk-ANUCSRUN.js";
9
- import "./chunk-W5FX4TU3.js";
8
+ import "./chunk-GD7TWEN3.js";
9
+ import "./chunk-PGD6SH5I.js";
10
10
  import "./chunk-OB5EFDDH.js";
11
11
  import "./chunk-XLLYNNC6.js";
12
- import "./chunk-JTKR7ZWP.js";
13
- import "./chunk-3CJHBJXA.js";
12
+ import "./chunk-P6RS2L23.js";
13
+ import "./chunk-OVASCEGF.js";
14
+ import "./chunk-GRRFPI27.js";
14
15
  export {
15
16
  BarChart
16
17
  };
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
- import { g as Datum, A as Accessor, V as ValueFormat, C as CategoryFormat, T as Threshold } from './context-BgYUymEO.js';
2
+ import { g as Datum, A as Accessor, V as ValueFormat, C as CategoryFormat, T as Threshold } from './context-DNW7bJYw.js';
3
3
  import { E as EngineProps } from './host-_F8RgiIz.js';
4
- import { C as ChartFrameProps } from './frame-I7_xYGy5.js';
4
+ import { C as ChartFrameProps } from './frame-B1HDNm7c.js';
5
5
 
6
6
  interface CandlestickProps<T extends Datum> extends ChartFrameProps, EngineProps {
7
7
  /** One row per period, oldest first. */
@@ -1,12 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  Candlestick
4
- } from "./chunk-NCIQMRV3.js";
5
- import "./chunk-PWMMXRMC.js";
6
- import "./chunk-W5FX4TU3.js";
4
+ } from "./chunk-LLUQEK5J.js";
5
+ import "./chunk-NV52AKHG.js";
6
+ import "./chunk-PGD6SH5I.js";
7
7
  import "./chunk-XLLYNNC6.js";
8
- import "./chunk-JTKR7ZWP.js";
9
- import "./chunk-3CJHBJXA.js";
8
+ import "./chunk-P6RS2L23.js";
9
+ import "./chunk-OVASCEGF.js";
10
+ import "./chunk-GRRFPI27.js";
10
11
  export {
11
12
  Candlestick
12
13
  };
package/dist/card.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { StatProps } from '@krizaka/ui/stat';
4
+ import { f as ChartsSettings, V as ValueFormat, S as SeriesColor } from './context-DNW7bJYw.js';
5
+
6
+ interface ChartCardProps {
7
+ /** What the chart shows, in a few words (a heading and the chart's accessible name). */
8
+ title: string;
9
+ /** One line that says what the chart shows: “100 jobs · +100 % vs last week”. Written by the app, from its data. */
10
+ insight?: ReactNode;
11
+ /** The period, the unit, the source — under the insight. */
12
+ description?: ReactNode;
13
+ /** Controls beside the actions menu: a period switch, a filter. */
14
+ actions?: ReactNode;
15
+ /** A line under the chart: the source, the freshness, a link. */
16
+ footer?: ReactNode;
17
+ /** The chart (`LineChart`, `BarChart`, `DonutChart`…), without its own title. */
18
+ children: ReactNode;
19
+ /** A class on the card (layout: grid placement). */
20
+ className?: string;
21
+ /** The id of the card. */
22
+ id?: string;
23
+ }
24
+ /** The frame of a chart: title, insight, actions, chart, footer — used everywhere a chart is shown. */
25
+ declare function ChartCard({ title, insight, description, actions, footer, children, className, id }: ChartCardProps): react.JSX.Element;
26
+
27
+ interface KpiStatProps extends ChartsSettings, Omit<StatProps, "value" | "trend" | "trendLabel" | "chart" | "label" | "color"> {
28
+ /** What the figure is (“Jobs”). */
29
+ label: string;
30
+ /** The figure for the period. */
31
+ value: number;
32
+ /** How it is written. Default `"number"`. */
33
+ format?: ValueFormat;
34
+ /** The same figure for the previous period: the trend is computed from it. */
35
+ previous?: number;
36
+ /** Which direction is good news. Default `"up"`; `"down"` for latency, failures, spend. */
37
+ good?: "up" | "down";
38
+ /** The shape of the period, oldest first (`null` for a gap). Without it, no sparkline. */
39
+ data?: readonly (number | null)[];
40
+ /** The labels of `data` (dates), for the sparkline's summary and table. */
41
+ categories?: readonly unknown[];
42
+ /** `bar` for discrete counts (jobs per day), `area` (default) or `line`. */
43
+ variant?: "line" | "area" | "bar";
44
+ /** The sparkline's colour. Default: the brand's. */
45
+ color?: SeriesColor;
46
+ /** Your own words for the change instead of “+12 % vs previous period”. */
47
+ trendLabel?: ReactNode;
48
+ }
49
+ /** A key figure, its change against the previous period and the shape of the period. */
50
+ declare function KpiStat({ label, value, format, previous, good, data, categories, variant, color, trendLabel, hint, locale, brand, labels, className, ...rest }: KpiStatProps): react.JSX.Element;
51
+
52
+ export { ChartCard, type ChartCardProps, KpiStat, type KpiStatProps };
package/dist/card.js ADDED
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import {
3
+ ChartCard,
4
+ KpiStat
5
+ } from "./chunk-YHQFW2PR.js";
6
+ import "./chunk-FIQHMJZK.js";
7
+ import "./chunk-BISL7DYW.js";
8
+ import "./chunk-GD7TWEN3.js";
9
+ import "./chunk-PGD6SH5I.js";
10
+ import "./chunk-OB5EFDDH.js";
11
+ import "./chunk-XLLYNNC6.js";
12
+ import "./chunk-P6RS2L23.js";
13
+ import "./chunk-OVASCEGF.js";
14
+ import "./chunk-GRRFPI27.js";
15
+ export {
16
+ ChartCard,
17
+ KpiStat
18
+ };
19
+ //# sourceMappingURL=card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,5 +1,5 @@
1
- import { g as Datum, A as Accessor, h as SeriesSpec, V as ValueFormat, C as CategoryFormat, T as Threshold, M as Marker } from './context-BgYUymEO.js';
2
- import { C as ChartFrameProps } from './frame-I7_xYGy5.js';
1
+ import { g as Datum, A as Accessor, h as SeriesSpec, V as ValueFormat, C as CategoryFormat, T as Threshold, M as Marker } from './context-DNW7bJYw.js';
2
+ import { C as ChartFrameProps } from './frame-B1HDNm7c.js';
3
3
 
4
4
  /** What every cartesian chart takes: rows, the category field, the series, the formats, thresholds and markers. */
5
5
  interface CartesianProps<T extends Datum> extends ChartFrameProps {
@@ -29,6 +29,16 @@ interface CartesianProps<T extends Datum> extends ChartFrameProps {
29
29
  zero?: boolean;
30
30
  /** Called with the row when a point or a bar is clicked (or Enter is pressed on it). */
31
31
  onSelect?: (datum: T, index: number) => void;
32
+ /**
33
+ * Zoom the time axis on the period that has data: the empty days before the first and after the last value are
34
+ * left out (never fewer than `minPoints`), and a sparse period says so under the chart instead of drawing 13 empty
35
+ * days around one bar. Default false.
36
+ */
37
+ autoRange?: boolean;
38
+ /** With `autoRange`, the fewest categories to keep so a short burst still has a time scale. Default 7. */
39
+ minPoints?: number;
40
+ /** The legend chips switch the series on and off. Default true. */
41
+ filterable?: boolean;
32
42
  }
33
43
 
34
44
  export type { CartesianProps as C };
package/dist/chart.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { E as EngineProps, W as WalkItem } from './host-_F8RgiIz.js';
2
- import { C as ChartFrameProps, T as TableModel } from './frame-I7_xYGy5.js';
2
+ import { C as ChartFrameProps, T as TableModel } from './frame-B1HDNm7c.js';
3
3
  import * as react from 'react';
4
4
  import { EChartsCoreOption } from 'echarts/core';
5
- import './context-BgYUymEO.js';
5
+ import './context-DNW7bJYw.js';
6
6
 
7
7
  interface ResolvedTheme {
8
8
  readonly text: string;
package/dist/chart.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use client";
2
2
  import {
3
3
  Chart
4
- } from "./chunk-AA5EWWYV.js";
5
- import "./chunk-PWMMXRMC.js";
6
- import "./chunk-JTKR7ZWP.js";
7
- import "./chunk-3CJHBJXA.js";
4
+ } from "./chunk-LZPZWBBY.js";
5
+ import "./chunk-NV52AKHG.js";
6
+ import "./chunk-P6RS2L23.js";
7
+ import "./chunk-OVASCEGF.js";
8
+ import "./chunk-GRRFPI27.js";
8
9
  export {
9
10
  Chart
10
11
  };
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-6FINSUOS.js";
6
6
  import {
7
7
  read
8
- } from "./chunk-W5FX4TU3.js";
8
+ } from "./chunk-PGD6SH5I.js";
9
9
  import {
10
10
  shareFormatter,
11
11
  valueFormatter
@@ -17,11 +17,11 @@ import {
17
17
  stepColor,
18
18
  useMounted,
19
19
  useSettings
20
- } from "./chunk-JTKR7ZWP.js";
20
+ } from "./chunk-P6RS2L23.js";
21
21
  import {
22
22
  capitalize,
23
23
  fill
24
- } from "./chunk-3CJHBJXA.js";
24
+ } from "./chunk-GRRFPI27.js";
25
25
 
26
26
  // src/geo/geo-map.tsx
27
27
  import { geoEqualEarth, geoPath } from "d3-geo";
@@ -175,4 +175,4 @@ function GeoMap(props) {
175
175
  export {
176
176
  GeoMap
177
177
  };
178
- //# sourceMappingURL=chunk-BV4DBGN7.js.map
178
+ //# sourceMappingURL=chunk-7W4T255Q.js.map
@@ -3,20 +3,20 @@ import {
3
3
  EChartHost,
4
4
  baseOption,
5
5
  tooltipHtml
6
- } from "./chunk-PWMMXRMC.js";
6
+ } from "./chunk-NV52AKHG.js";
7
7
  import {
8
8
  describeParts
9
- } from "./chunk-ANUCSRUN.js";
9
+ } from "./chunk-GD7TWEN3.js";
10
10
  import {
11
11
  shareFormatter,
12
12
  valueFormatter
13
13
  } from "./chunk-XLLYNNC6.js";
14
14
  import {
15
15
  useSettings
16
- } from "./chunk-JTKR7ZWP.js";
16
+ } from "./chunk-P6RS2L23.js";
17
17
  import {
18
18
  contrast
19
- } from "./chunk-3CJHBJXA.js";
19
+ } from "./chunk-OVASCEGF.js";
20
20
 
21
21
  // src/treemap/treemap.tsx
22
22
  import { useCallback, useMemo } from "react";
@@ -104,4 +104,4 @@ ${fmt.value(p.value)}` },
104
104
  export {
105
105
  Treemap
106
106
  };
107
- //# sourceMappingURL=chunk-W5ILLSPK.js.map
107
+ //# sourceMappingURL=chunk-AGSSNMK5.js.map
@@ -3,12 +3,12 @@ import {
3
3
  EChartHost,
4
4
  baseOption,
5
5
  tooltipHtml
6
- } from "./chunk-PWMMXRMC.js";
6
+ } from "./chunk-NV52AKHG.js";
7
7
  import {
8
8
  normalizeSeries,
9
9
  summarize,
10
10
  tabulate
11
- } from "./chunk-W5FX4TU3.js";
11
+ } from "./chunk-PGD6SH5I.js";
12
12
  import {
13
13
  categoryFormatter,
14
14
  valueFormatter
@@ -16,10 +16,10 @@ import {
16
16
  import {
17
17
  Legend,
18
18
  useSettings
19
- } from "./chunk-JTKR7ZWP.js";
19
+ } from "./chunk-P6RS2L23.js";
20
20
  import {
21
21
  fill
22
- } from "./chunk-3CJHBJXA.js";
22
+ } from "./chunk-GRRFPI27.js";
23
23
 
24
24
  // src/radar/radar-chart.tsx
25
25
  import { useCallback, useMemo } from "react";
@@ -100,4 +100,4 @@ function RadarChart(props) {
100
100
  export {
101
101
  RadarChart
102
102
  };
103
- //# sourceMappingURL=chunk-VKZZY2QD.js.map
103
+ //# sourceMappingURL=chunk-FE4LUGAE.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-BISL7DYW.js";
5
5
  import {
6
6
  describeSeries
7
- } from "./chunk-ANUCSRUN.js";
7
+ } from "./chunk-GD7TWEN3.js";
8
8
  import {
9
9
  areaPath,
10
10
  barPath,
@@ -20,7 +20,7 @@ import {
20
20
  ChartFrame,
21
21
  colorOf,
22
22
  useSettings
23
- } from "./chunk-JTKR7ZWP.js";
23
+ } from "./chunk-P6RS2L23.js";
24
24
 
25
25
  // src/sparkline/sparkline.tsx
26
26
  import { useMemo } from "react";
@@ -28,7 +28,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
28
28
  function Sparkline(props) {
29
29
  const { data, categories, variant = "line", color, trendTone, threshold, format, width: fixed, height = 32 } = props;
30
30
  const { locale, labels } = useSettings(props);
31
- const table = useMemo(() => ({ categories: categories ?? data.map((_, i) => i + 1), series: [{ id: "v", label: props.title, values: data, slot: 1 }] }), [data, categories, props.title]);
31
+ const table = useMemo(() => ({ categories: categories ?? data.map((_, i) => i + 1), series: [{ id: "v", label: props.title ?? "", values: data, slot: 1 }] }), [data, categories, props.title]);
32
32
  const fmt = useMemo(() => ({ value: valueFormatter(format, locale, labels.noValue), category: categoryFormatter(void 0, locale), share: shareFormatter(locale) }), [format, locale, labels.noValue]);
33
33
  const values = data.filter((v) => v != null);
34
34
  const isEmpty = values.length === 0;
@@ -44,7 +44,7 @@ function Sparkline(props) {
44
44
  kind: "sparkline",
45
45
  frame: { ...props, hideTitle: true, dataTable: false, height, style: { ...fixed ? { width: fixed, display: "inline-flex" } : {}, ...props.style } },
46
46
  defaultHeight: 32,
47
- table: { columns: [labels.category, props.title], rows: table.categories.map((c, i) => [fmt.category(c), fmt.value(data[i])]) },
47
+ table: { columns: [labels.category, props.title ?? ""], rows: table.categories.map((c, i) => [fmt.category(c), fmt.value(data[i])]) },
48
48
  summary,
49
49
  isEmpty,
50
50
  navigable: false,
@@ -85,4 +85,4 @@ function Sparkline(props) {
85
85
  export {
86
86
  Sparkline
87
87
  };
88
- //# sourceMappingURL=chunk-ARARFMNE.js.map
88
+ //# sourceMappingURL=chunk-FIQHMJZK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sparkline/sparkline.tsx"],"sourcesContent":["\"use client\";\n// A word-sized chart: the shape of a series inside a sentence, a table cell or a stat. With a `width` it is drawn on\n// the server too (no placeholder); otherwise it fills its container. No axes: its title and summary carry the figures.\nimport { useMemo } from \"react\";\n\nimport { describeSeries } from \"../core/describe\";\nimport { categoryFormatter, shareFormatter, valueFormatter } from \"../core/format\";\nimport { niceDomain } from \"../core/scale\";\nimport { areaPath, barPath, linePath, type Point, segments } from \"../core/shape\";\nimport type { SeriesColor, Threshold, ValueFormat } from \"../core/types\";\nimport { ChartFrame, type ChartFrameProps, useSettings } from \"../web/frame\";\nimport { colorOf } from \"../web/parts\";\n\nexport interface SparklineProps extends Omit<ChartFrameProps, \"hideTitle\" | \"dataTable\" | \"exportable\" | \"description\"> {\n /** The values, oldest first (`null` for a gap). */\n data: readonly (number | null)[];\n /** The labels of the values (dates, ISO or `Date`), for the summary and the table. Default: their positions. */\n categories?: readonly unknown[];\n /** `line` (default), `area` (line over a wash) or `bar` (discrete counts: jobs per hour). */\n variant?: \"line\" | \"area\" | \"bar\";\n /** A palette slot, a tone or a CSS colour. Default: the trend's tone when `trendTone`, else slot 1. */\n color?: SeriesColor;\n /** Colour by the trend: success up, danger down (or the reverse with `\"inverse\"`: costs, latency). */\n trendTone?: boolean | \"inverse\";\n /** A dashed reference line (yesterday's average, a quota). */\n threshold?: Threshold;\n /** How the values are written in the summary and table. */\n format?: ValueFormat;\n /** A fixed width in pixels: drawn on the server too. Default: the container's width. */\n width?: number;\n}\n\n/** The shape of a trend in a few pixels: a stat's last 30 days, a job's throughput. */\nexport function Sparkline(props: SparklineProps) {\n const { data, categories, variant = \"line\", color, trendTone, threshold, format, width: fixed, height = 32 } = props;\n const { locale, labels } = useSettings(props);\n const table = useMemo(() => ({ categories: categories ?? data.map((_, i) => i + 1), series: [{ id: \"v\", label: props.title ?? \"\", values: data, slot: 1 }] }), [data, categories, props.title]);\n const fmt = useMemo(() => ({ value: valueFormatter(format, locale, labels.noValue), category: categoryFormatter(undefined, locale), share: shareFormatter(locale) }), [format, locale, labels.noValue]);\n const values = data.filter((v): v is number => v != null);\n const isEmpty = values.length === 0;\n const summary = isEmpty ? labels.empty : describeSeries(table, { kind: \"sparkline\", labels, value: fmt.value, category: fmt.category, share: fmt.share, thresholds: threshold ? [threshold] : [] });\n const first = values[0] ?? 0;\n const last = values[values.length - 1] ?? 0;\n const up = last >= first;\n const tone = trendTone ? ((trendTone === \"inverse\" ? !up : up) ? \"success\" : \"danger\") : undefined;\n const stroke = colorOf(color ?? tone, 1);\n\n return (\n <ChartFrame\n kind=\"sparkline\"\n frame={{ ...props, hideTitle: true, dataTable: false, height, style: { ...(fixed ? { width: fixed, display: \"inline-flex\" } : {}), ...props.style } }}\n defaultHeight={32}\n table={{ columns: [labels.category, props.title ?? \"\"], rows: table.categories.map((c, i) => [fmt.category(c), fmt.value(data[i])]) }}\n summary={summary}\n isEmpty={isEmpty}\n navigable={false}\n ssrWidth={fixed}\n compact\n >\n {(width, h) => {\n let lo = Math.min(...values, threshold?.value ?? Number.POSITIVE_INFINITY);\n let hi = Math.max(...values, threshold?.value ?? Number.NEGATIVE_INFINITY);\n if (variant === \"bar\") {\n lo = Math.min(0, lo);\n hi = Math.max(0, hi);\n }\n const [d0, d1] = lo === hi ? niceDomain(lo, hi).domain : [lo, hi];\n const pad = variant === \"bar\" ? 0 : 3;\n const yOf = (v: number) => pad + (1 - (v - d0) / (d1 - d0 || 1)) * (h - pad * 2);\n const n = data.length;\n const xOf = (i: number) => (variant === \"bar\" ? (i + 0.5) * (width / n) : n > 1 ? pad + (i / (n - 1)) * (width - pad * 2) : width / 2);\n const pts = data.map((v, i) => (v == null ? null : ([xOf(i), yOf(v)] as Point)));\n const lastPoint = [...pts].reverse().find(Boolean);\n return (\n <svg className=\"kzc-svg\" width={width} height={h} viewBox={`0 0 ${width} ${h}`} aria-hidden>\n {threshold && <line x1={0} x2={width} y1={yOf(threshold.value)} y2={yOf(threshold.value)} data-tone={threshold.tone ?? \"neutral\"} className=\"kzc-threshold\" style={{ strokeWidth: 1 }} />}\n {variant === \"bar\"\n ? data.map((v, i) => {\n if (v == null || v === 0) return null;\n const bw = Math.max(1, Math.min(8, (width / n) * 0.7));\n const top = Math.min(yOf(v), yOf(0));\n return <path key={i} d={barPath(xOf(i) - bw / 2, top, bw, Math.abs(yOf(v) - yOf(0)), 1.5, false, v < 0)} style={{ fill: stroke }} />;\n })\n : segments(pts).map((seg) => (\n <g key={seg[0]![0]}>\n {variant === \"area\" && <path d={areaPath(seg, h, \"monotone\")} className=\"kzc-area\" style={{ fill: stroke }} />}\n <path d={linePath(seg, \"monotone\")} className=\"kzc-line\" style={{ stroke, strokeWidth: 1.75 }} />\n </g>\n ))}\n {variant !== \"bar\" && lastPoint && <circle cx={lastPoint[0]} cy={lastPoint[1]} r={2.75} style={{ fill: stroke }} />}\n </svg>\n );\n }}\n </ChartFrame>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,eAAe;AAwEE,cASR,YATQ;AA1CnB,SAAS,UAAU,OAAuB;AAC/C,QAAM,EAAE,MAAM,YAAY,UAAU,QAAQ,OAAO,WAAW,WAAW,QAAQ,OAAO,OAAO,SAAS,GAAG,IAAI;AAC/G,QAAM,EAAE,QAAQ,OAAO,IAAI,YAAY,KAAK;AAC5C,QAAM,QAAQ,QAAQ,OAAO,EAAE,YAAY,cAAc,KAAK,IAAI,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI,KAAK,OAAO,MAAM,SAAS,IAAI,QAAQ,MAAM,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,YAAY,MAAM,KAAK,CAAC;AAC9L,QAAM,MAAM,QAAQ,OAAO,EAAE,OAAO,eAAe,QAAQ,QAAQ,OAAO,OAAO,GAAG,UAAU,kBAAkB,QAAW,MAAM,GAAG,OAAO,eAAe,MAAM,EAAE,IAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO,CAAC;AACtM,QAAM,SAAS,KAAK,OAAO,CAAC,MAAmB,KAAK,IAAI;AACxD,QAAM,UAAU,OAAO,WAAW;AAClC,QAAM,UAAU,UAAU,OAAO,QAAQ,eAAe,OAAO,EAAE,MAAM,aAAa,QAAQ,OAAO,IAAI,OAAO,UAAU,IAAI,UAAU,OAAO,IAAI,OAAO,YAAY,YAAY,CAAC,SAAS,IAAI,CAAC,EAAE,C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GAAG;AAAA,YAC5G,oBAAC,UAAK,GAAG,SAAS,KAAK,UAAU,GAAG,WAAU,YAAW,OAAO,EAAE,QAAQ,aAAa,KAAK,GAAG;AAAA,eAFzF,IAAI,CAAC,EAAG,CAAC,CAGjB,CACD;AAAA,UACJ,YAAY,SAAS,aAAa,oBAAC,YAAO,IAAI,UAAU,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,GAAG,MAAM,OAAO,EAAE,MAAM,OAAO,GAAG;AAAA,WACnH;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import {
3
3
  summarize
4
- } from "./chunk-W5FX4TU3.js";
4
+ } from "./chunk-PGD6SH5I.js";
5
5
  import {
6
6
  capitalize,
7
7
  fill
8
- } from "./chunk-3CJHBJXA.js";
8
+ } from "./chunk-GRRFPI27.js";
9
9
 
10
10
  // src/core/describe.ts
11
11
  function describeSeries(table, { kind, labels, value, category, share, thresholds = [] }) {
@@ -40,4 +40,4 @@ export {
40
40
  describeSeries,
41
41
  describeParts
42
42
  };
43
- //# sourceMappingURL=chunk-ANUCSRUN.js.map
43
+ //# sourceMappingURL=chunk-GD7TWEN3.js.map
@@ -0,0 +1,89 @@
1
+ "use client";
2
+
3
+ // src/core/labels.ts
4
+ var DEFAULT_LABELS = {
5
+ showData: "Show data",
6
+ hideData: "Hide data",
7
+ tableCaption: "{title} \u2014 data",
8
+ exportPng: "PNG",
9
+ exportSvg: "SVG",
10
+ exportCsv: "CSV",
11
+ actions: "Chart actions",
12
+ viewTable: "View as table",
13
+ downloadCsv: "Download CSV",
14
+ downloadPng: "Download PNG",
15
+ downloadSvg: "Download SVG",
16
+ copyData: "Copy data",
17
+ copied: "Data copied",
18
+ close: "Close",
19
+ tableRows: "{count} rows",
20
+ toggleSeries: "Show or hide {label}",
21
+ sparse: "{count} of {total} periods have data.",
22
+ trendVsPrevious: "{change} vs previous period",
23
+ loading: "Loading chart\u2026",
24
+ empty: "No data for this period yet.",
25
+ error: "The chart could not be loaded.",
26
+ keyboardHint: "Use the arrow keys to move between points, Home and End to jump to the ends.",
27
+ roleDescription: "chart",
28
+ summaryIntro: "{kind}, {count}.",
29
+ summarySeries: "{label}: from {first} to {last}",
30
+ summaryRange: "lowest {min} ({minAt}), highest {max} ({maxAt})",
31
+ summaryTrendUp: "up {change}",
32
+ summaryTrendDown: "down {change}",
33
+ summaryTrendFlat: "stable",
34
+ summaryTotal: "total {total}",
35
+ summaryThreshold: "{label} at {value}",
36
+ summaryShare: "{label} {value} ({share})",
37
+ summaryCorrelation: "correlation {r}",
38
+ summaryConversion: "{from} \u2192 {to} {rate}",
39
+ summaryOverall: "overall {rate}",
40
+ summaryPeak: "peak {value} ({at})",
41
+ summaryActive: "{count} with a value",
42
+ summaryOhlc: "opened at {open}, closed at {close}, low {low}, high {high}",
43
+ kinds: {
44
+ line: "Line chart",
45
+ area: "Area chart",
46
+ bar: "Bar chart",
47
+ pie: "Pie chart",
48
+ donut: "Donut chart",
49
+ gauge: "Gauge",
50
+ sparkline: "Sparkline",
51
+ radar: "Radar chart",
52
+ heatmap: "Heatmap",
53
+ calendar: "Calendar heatmap",
54
+ sankey: "Flow diagram",
55
+ funnel: "Funnel",
56
+ candlestick: "Candlestick chart",
57
+ treemap: "Treemap",
58
+ scatter: "Scatter chart",
59
+ map: "Map",
60
+ globe: "Globe",
61
+ chart: "Chart"
62
+ },
63
+ category: "Category",
64
+ value: "Value",
65
+ total: "Total",
66
+ noValue: "\u2014"
67
+ };
68
+ function mergeLabels(...layers) {
69
+ let out = DEFAULT_LABELS;
70
+ for (const layer of layers) {
71
+ if (!layer) continue;
72
+ out = { ...out, ...layer, kinds: { ...out.kinds, ...layer.kinds } };
73
+ }
74
+ return out;
75
+ }
76
+ function capitalize(text) {
77
+ return text.charAt(0).toLocaleUpperCase() + text.slice(1);
78
+ }
79
+ function fill(template, values) {
80
+ return template.replace(/\{(\w+)\}/g, (match, name) => name in values ? String(values[name]) : match);
81
+ }
82
+
83
+ export {
84
+ DEFAULT_LABELS,
85
+ mergeLabels,
86
+ capitalize,
87
+ fill
88
+ };
89
+ //# sourceMappingURL=chunk-GRRFPI27.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/labels.ts"],"sourcesContent":["// The words a chart says on its own: its controls, its states and its written summary. English by default; an app\n// passes its own (translated through its catalogue) once, to `ChartsProvider labels`, or to one chart's `labels`.\n// Placeholders are written `{name}`.\n\nexport interface ChartLabels {\n /** The button that shows the data table. */\n showData: string;\n /** The button that hides it. */\n hideData: string;\n /** The caption of the data table: `{title}`. */\n tableCaption: string;\n /** The export buttons. */\n exportPng: string;\n exportSvg: string;\n exportCsv: string;\n /** The actions menu (⋯) of a chart: its accessible name, and its entries. */\n actions: string;\n viewTable: string;\n downloadCsv: string;\n downloadPng: string;\n downloadSvg: string;\n copyData: string;\n /** Announced once the data is on the clipboard. */\n copied: string;\n /** The close button of the table sheet. */\n close: string;\n /** The sheet's description: `{count}` rows. */\n tableRows: string;\n /** Legend chips filter: the chip's accessible name, `{label}`. */\n toggleSeries: string;\n /** Sparse data: under the chart, `{count}` periods with data out of `{total}`. */\n sparse: string;\n /** A KPI's change: `{change}` (`+12 %`) against the previous period. */\n trendVsPrevious: string;\n /** Announced while the data loads. */\n loading: string;\n /** Shown when there is nothing to draw. */\n empty: string;\n /** Shown when the data could not be loaded. */\n error: string;\n /** The keyboard hint, read once when the plot takes the focus. */\n keyboardHint: string;\n /** The role description of the plot (`chart`). */\n roleDescription: string;\n /** Summary pieces. `{kind}` is the chart's name (`Line chart`), `{count}` a number of points or series. */\n summaryIntro: string;\n summarySeries: string;\n summaryRange: string;\n summaryTrendUp: string;\n summaryTrendDown: string;\n summaryTrendFlat: string;\n summaryTotal: string;\n summaryThreshold: string;\n summaryShare: string;\n /** Scatter: the correlation of x and y (Pearson's r). */\n summaryCorrelation: string;\n /** Funnel: from one stage to the next, and from the first to the last. */\n summaryConversion: string;\n summaryOverall: string;\n /** Heatmap, calendar: the largest cell and the number of cells with a value. */\n summaryPeak: string;\n summaryActive: string;\n /** Candlestick: the period's range. */\n summaryOhlc: string;\n /** The names of the charts, read first in the summary. */\n kinds: Record<ChartKind, string>;\n /** The column of the values, when the chart has no value label. */\n value: string;\n /** The column of the categories in the data table, when the chart has no x label. */\n category: string;\n /** The total row of a stacked chart, a pie, a funnel. */\n total: string;\n /** What a missing value reads as. */\n noValue: string;\n}\n\nexport type ChartKind =\n | \"line\"\n | \"area\"\n | \"bar\"\n | \"pie\"\n | \"donut\"\n | \"gauge\"\n | \"sparkline\"\n | \"radar\"\n | \"heatmap\"\n | \"calendar\"\n | \"sankey\"\n | \"funnel\"\n | \"candlestick\"\n | \"treemap\"\n | \"scatter\"\n | \"map\"\n | \"globe\"\n | \"chart\";\n\nexport const DEFAULT_LABELS: ChartLabels = {\n showData: \"Show data\",\n hideData: \"Hide data\",\n tableCaption: \"{title} — data\",\n exportPng: \"PNG\",\n exportSvg: \"SVG\",\n exportCsv: \"CSV\",\n actions: \"Chart actions\",\n viewTable: \"View as table\",\n downloadCsv: \"Download CSV\",\n downloadPng: \"Download PNG\",\n downloadSvg: \"Download SVG\",\n copyData: \"Copy data\",\n copied: \"Data copied\",\n close: \"Close\",\n tableRows: \"{count} rows\",\n toggleSeries: \"Show or hide {label}\",\n sparse: \"{count} of {total} periods have data.\",\n trendVsPrevious: \"{change} vs previous period\",\n loading: \"Loading chart…\",\n empty: \"No data for this period yet.\",\n error: \"The chart could not be loaded.\",\n keyboardHint: \"Use the arrow keys to move between points, Home and End to jump to the ends.\",\n roleDescription: \"chart\",\n summaryIntro: \"{kind}, {count}.\",\n summarySeries: \"{label}: from {first} to {last}\",\n summaryRange: \"lowest {min} ({minAt}), highest {max} ({maxAt})\",\n summaryTrendUp: \"up {change}\",\n summaryTrendDown: \"down {change}\",\n summaryTrendFlat: \"stable\",\n summaryTotal: \"total {total}\",\n summaryThreshold: \"{label} at {value}\",\n summaryShare: \"{label} {value} ({share})\",\n summaryCorrelation: \"correlation {r}\",\n summaryConversion: \"{from} → {to} {rate}\",\n summaryOverall: \"overall {rate}\",\n summaryPeak: \"peak {value} ({at})\",\n summaryActive: \"{count} with a value\",\n summaryOhlc: \"opened at {open}, closed at {close}, low {low}, high {high}\",\n kinds: {\n line: \"Line chart\",\n area: \"Area chart\",\n bar: \"Bar chart\",\n pie: \"Pie chart\",\n donut: \"Donut chart\",\n gauge: \"Gauge\",\n sparkline: \"Sparkline\",\n radar: \"Radar chart\",\n heatmap: \"Heatmap\",\n calendar: \"Calendar heatmap\",\n sankey: \"Flow diagram\",\n funnel: \"Funnel\",\n candlestick: \"Candlestick chart\",\n treemap: \"Treemap\",\n scatter: \"Scatter chart\",\n map: \"Map\",\n globe: \"Globe\",\n chart: \"Chart\",\n },\n category: \"Category\",\n value: \"Value\",\n total: \"Total\",\n noValue: \"—\",\n};\n\n/** The words an app or a chart passes: any of them, and any of the chart names. */\nexport type ChartLabelsInput = Partial<Omit<ChartLabels, \"kinds\">> & { kinds?: Partial<Record<ChartKind, string>> };\n\n/** The default labels with an app's and a chart's on top (`kinds` merged too). */\nexport function mergeLabels(...layers: (ChartLabelsInput | undefined)[]): ChartLabels {\n let out = DEFAULT_LABELS;\n for (const layer of layers) {\n if (!layer) continue;\n out = { ...out, ...layer, kinds: { ...out.kinds, ...layer.kinds } };\n }\n return out;\n}\n\n/** A sentence's first letter in upper case (a template that may open a sentence: `total {total}`). */\nexport function capitalize(text: string): string {\n return text.charAt(0).toLocaleUpperCase() + text.slice(1);\n}\n\n/** `{name}` → its value; an unknown placeholder stays as written. */\nexport function fill(template: string, values: Record<string, string | number>): string {\n return template.replace(/\\{(\\w+)\\}/g, (match, name: string) => (name in values ? String(values[name]) : match));\n}\n"],"mappings":";;;AAgGO,IAAM,iBAA8B;AAAA,EACzC,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SA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,CAAC,EAAE,kBAAkB,IAAI,KAAK,MAAM,CAAC;AAC1D;AAGO,SAAS,KAAK,UAAkB,QAAiD;AACtF,SAAO,SAAS,QAAQ,cAAc,CAAC,OAAO,SAAkB,QAAQ,SAAS,OAAO,OAAO,IAAI,CAAC,IAAI,KAAM;AAChH;","names":[]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  BarChart
4
- } from "./chunk-WVTIKOII.js";
4
+ } from "./chunk-IURCLBUQ.js";
5
5
  import {
6
6
  Kpi
7
7
  } from "./chunk-WBHFVBSK.js";
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-XLLYNNC6.js";
17
17
  import {
18
18
  useSettings
19
- } from "./chunk-JTKR7ZWP.js";
19
+ } from "./chunk-P6RS2L23.js";
20
20
 
21
21
  // src/needs/statuses.ts
22
22
  var DEFAULT_STATUSES = [
@@ -78,4 +78,4 @@ export {
78
78
  DEFAULT_STATUSES,
79
79
  JobThroughput
80
80
  };
81
- //# sourceMappingURL=chunk-SLEJDQ3A.js.map
81
+ //# sourceMappingURL=chunk-HH65IEUV.js.map
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  BarChart
4
- } from "./chunk-WVTIKOII.js";
4
+ } from "./chunk-IURCLBUQ.js";
5
5
  import {
6
6
  Kpi,
7
7
  toneOf
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-XLLYNNC6.js";
21
21
  import {
22
22
  useSettings
23
- } from "./chunk-JTKR7ZWP.js";
23
+ } from "./chunk-P6RS2L23.js";
24
24
 
25
25
  // src/earnings/earnings-chart.tsx
26
26
  import { useMemo } from "react";
@@ -80,4 +80,4 @@ function EarningsChart({
80
80
  export {
81
81
  EarningsChart
82
82
  };
83
- //# sourceMappingURL=chunk-OIRHLJBC.js.map
83
+ //# sourceMappingURL=chunk-IJTI6VJD.js.map
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Cartesian
4
- } from "./chunk-CVWSMUUB.js";
4
+ } from "./chunk-JST4HJC3.js";
5
5
 
6
6
  // src/bar/bar-chart.tsx
7
7
  import { jsx } from "react/jsx-runtime";
@@ -12,4 +12,4 @@ function BarChart({ stacked, horizontal, valueLabels = true, ...props }) {
12
12
  export {
13
13
  BarChart
14
14
  };
15
- //# sourceMappingURL=chunk-WVTIKOII.js.map
15
+ //# sourceMappingURL=chunk-IURCLBUQ.js.map