wimui 0.27.0 → 0.29.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 (71) hide show
  1. package/dist/charts.cjs +1 -1
  2. package/dist/charts.d.ts +4 -0
  3. package/dist/charts.js +5 -1
  4. package/dist/components/_internal/barSpan.cjs +2 -0
  5. package/dist/components/_internal/barSpan.d.ts +60 -0
  6. package/dist/components/_internal/barSpan.js +13 -0
  7. package/dist/components/_internal/chartTableData.cjs +0 -0
  8. package/dist/components/_internal/chartTableData.d.ts +55 -0
  9. package/dist/components/_internal/chartTableData.js +0 -0
  10. package/dist/components/charts/BoxPlot/BoxPlot.cjs +2 -0
  11. package/dist/components/charts/BoxPlot/BoxPlot.d.ts +50 -0
  12. package/dist/components/charts/BoxPlot/BoxPlot.js +130 -0
  13. package/dist/components/charts/BoxPlot/box-plot.module.cjs +2 -0
  14. package/dist/components/charts/BoxPlot/box-plot.module.js +11 -0
  15. package/dist/components/charts/CandlestickChart/CandlestickChart.cjs +2 -0
  16. package/dist/components/charts/CandlestickChart/CandlestickChart.d.ts +48 -0
  17. package/dist/components/charts/CandlestickChart/CandlestickChart.js +119 -0
  18. package/dist/components/charts/CandlestickChart/candlestick-chart.module.cjs +2 -0
  19. package/dist/components/charts/CandlestickChart/candlestick-chart.module.js +13 -0
  20. package/dist/components/charts/SankeyChart/SankeyChart.cjs +2 -0
  21. package/dist/components/charts/SankeyChart/SankeyChart.d.ts +54 -0
  22. package/dist/components/charts/SankeyChart/SankeyChart.js +106 -0
  23. package/dist/components/charts/SankeyChart/sankey-chart.module.cjs +2 -0
  24. package/dist/components/charts/SankeyChart/sankey-chart.module.js +9 -0
  25. package/dist/components/charts/SankeyChart/warn-unknown-node.cjs +2 -0
  26. package/dist/components/charts/SankeyChart/warn-unknown-node.d.ts +9 -0
  27. package/dist/components/charts/SankeyChart/warn-unknown-node.js +5 -0
  28. package/dist/components/charts/WaterfallChart/WaterfallChart.cjs +2 -0
  29. package/dist/components/charts/WaterfallChart/WaterfallChart.d.ts +53 -0
  30. package/dist/components/charts/WaterfallChart/WaterfallChart.js +128 -0
  31. package/dist/components/charts/WaterfallChart/waterfall-chart.module.cjs +2 -0
  32. package/dist/components/charts/WaterfallChart/waterfall-chart.module.js +9 -0
  33. package/dist/components/data-display/Barcode/Barcode.cjs +2 -0
  34. package/dist/components/data-display/Barcode/Barcode.d.ts +86 -0
  35. package/dist/components/data-display/Barcode/Barcode.js +120 -0
  36. package/dist/components/data-display/Barcode/barcode.module.cjs +2 -0
  37. package/dist/components/data-display/Barcode/barcode.module.js +13 -0
  38. package/dist/components/data-display/Barcode/encode.cjs +2 -0
  39. package/dist/components/data-display/Barcode/encode.d.ts +64 -0
  40. package/dist/components/data-display/Barcode/encode.js +113 -0
  41. package/dist/components/data-display/Barcode/warn-unencodable-value.cjs +2 -0
  42. package/dist/components/data-display/Barcode/warn-unencodable-value.d.ts +3 -0
  43. package/dist/components/data-display/Barcode/warn-unencodable-value.js +4 -0
  44. package/dist/components/data-display/Comment/Comment.cjs +2 -0
  45. package/dist/components/data-display/Comment/Comment.d.ts +132 -0
  46. package/dist/components/data-display/Comment/Comment.js +86 -0
  47. package/dist/components/data-display/Comment/comment.module.cjs +2 -0
  48. package/dist/components/data-display/Comment/comment.module.js +19 -0
  49. package/dist/data-display-core.d.ts +2 -0
  50. package/dist/data-display.cjs +1 -1
  51. package/dist/data-display.js +5 -3
  52. package/dist/i18n/generated/keys.d.ts +1 -1
  53. package/dist/i18n/generated/resources.cjs +1 -1
  54. package/dist/i18n/generated/resources.js +33 -0
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.js +42 -40
  57. package/dist/llms-full.txt +82 -1
  58. package/dist/llms.txt +7 -1
  59. package/dist/locales/en/common.json +20 -7
  60. package/dist/locales/en/components.json +3 -1
  61. package/dist/locales/en/data-display.json +1 -2
  62. package/dist/locales/ja/common.json +20 -7
  63. package/dist/locales/ja/components.json +3 -1
  64. package/dist/locales/ja/data-display.json +1 -2
  65. package/dist/locales/pt/common.json +20 -7
  66. package/dist/locales/pt/components.json +3 -1
  67. package/dist/locales/pt/data-display.json +1 -2
  68. package/dist/styles.css +1 -1
  69. package/dist/wimui.umd.css +1 -1
  70. package/dist/wimui.umd.js +5 -5
  71. package/package.json +2 -2
package/dist/charts.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./components/charts/AreaChart/AreaChart.cjs"),t=require("./components/charts/BarChart/BarChart.cjs"),n=require("./components/charts/FunnelChart/FunnelChart.cjs"),r=require("./components/charts/GanttChart/GanttChart.cjs"),i=require("./components/charts/GaugeChart/GaugeChart.cjs"),a=require("./components/charts/Heatmap/Heatmap.cjs"),o=require("./components/charts/LineChart/LineChart.cjs"),s=require("./components/charts/PieChart/PieChart.cjs"),c=require("./components/charts/RadarChart/RadarChart.cjs"),l=require("./components/charts/ScatterChart/ScatterChart.cjs"),u=require("./components/charts/Treemap/Treemap.cjs"),d=require("./components/charts/Sparkline/Sparkline.cjs");exports.AreaChart=e.AreaChart,exports.BarChart=t.BarChart,exports.FunnelChart=n.FunnelChart,exports.GanttChart=r.GanttChart,exports.GaugeChart=i.GaugeChart,exports.Heatmap=a.Heatmap,exports.LineChart=o.LineChart,exports.PieChart=s.PieChart,exports.RadarChart=c.RadarChart,exports.ScatterChart=l.ScatterChart,exports.Sparkline=d.Sparkline,exports.Treemap=u.Treemap;
2
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./components/charts/AreaChart/AreaChart.cjs"),t=require("./components/charts/BarChart/BarChart.cjs"),n=require("./components/charts/FunnelChart/FunnelChart.cjs"),r=require("./components/charts/GanttChart/GanttChart.cjs"),i=require("./components/charts/GaugeChart/GaugeChart.cjs"),a=require("./components/charts/Heatmap/Heatmap.cjs"),o=require("./components/charts/LineChart/LineChart.cjs"),s=require("./components/charts/PieChart/PieChart.cjs"),c=require("./components/charts/RadarChart/RadarChart.cjs"),l=require("./components/charts/ScatterChart/ScatterChart.cjs"),u=require("./components/charts/Treemap/Treemap.cjs"),d=require("./components/charts/Sparkline/Sparkline.cjs"),f=require("./components/charts/SankeyChart/SankeyChart.cjs"),p=require("./components/charts/WaterfallChart/WaterfallChart.cjs"),m=require("./components/charts/BoxPlot/BoxPlot.cjs"),h=require("./components/charts/CandlestickChart/CandlestickChart.cjs");exports.AreaChart=e.AreaChart,exports.BarChart=t.BarChart,exports.BoxPlot=m.BoxPlot,exports.CandlestickChart=h.CandlestickChart,exports.FunnelChart=n.FunnelChart,exports.GanttChart=r.GanttChart,exports.GaugeChart=i.GaugeChart,exports.Heatmap=a.Heatmap,exports.LineChart=o.LineChart,exports.PieChart=s.PieChart,exports.RadarChart=c.RadarChart,exports.SankeyChart=f.SankeyChart,exports.ScatterChart=l.ScatterChart,exports.Sparkline=d.Sparkline,exports.Treemap=u.Treemap,exports.WaterfallChart=p.WaterfallChart;
package/dist/charts.d.ts CHANGED
@@ -11,3 +11,7 @@ export * from './components/charts/RadarChart/RadarChart';
11
11
  export * from './components/charts/ScatterChart/ScatterChart';
12
12
  export * from './components/charts/Treemap/Treemap';
13
13
  export * from './components/charts/Sparkline/Sparkline';
14
+ export * from './components/charts/SankeyChart/SankeyChart';
15
+ export * from './components/charts/WaterfallChart/WaterfallChart';
16
+ export * from './components/charts/BoxPlot/BoxPlot';
17
+ export * from './components/charts/CandlestickChart/CandlestickChart';
package/dist/charts.js CHANGED
@@ -11,4 +11,8 @@ import { RadarChart as c } from "./components/charts/RadarChart/RadarChart.js";
11
11
  import { ScatterChart as l } from "./components/charts/ScatterChart/ScatterChart.js";
12
12
  import { Treemap as u } from "./components/charts/Treemap/Treemap.js";
13
13
  import { Sparkline as d } from "./components/charts/Sparkline/Sparkline.js";
14
- export { e as AreaChart, t as BarChart, n as FunnelChart, r as GanttChart, i as GaugeChart, a as Heatmap, o as LineChart, s as PieChart, c as RadarChart, l as ScatterChart, d as Sparkline, u as Treemap };
14
+ import { SankeyChart as f } from "./components/charts/SankeyChart/SankeyChart.js";
15
+ import { WaterfallChart as p } from "./components/charts/WaterfallChart/WaterfallChart.js";
16
+ import { BoxPlot as m } from "./components/charts/BoxPlot/BoxPlot.js";
17
+ import { CandlestickChart as h } from "./components/charts/CandlestickChart/CandlestickChart.js";
18
+ export { e as AreaChart, t as BarChart, m as BoxPlot, h as CandlestickChart, n as FunnelChart, r as GanttChart, i as GaugeChart, a as Heatmap, o as LineChart, s as PieChart, c as RadarChart, f as SankeyChart, l as ScatterChart, d as Sparkline, u as Treemap, p as WaterfallChart };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ var e=(e,t,n)=>{let[r,i]=t,a=i-r;return a===0?n.y:n.y+(i-e)/a*n.height},t=e=>typeof e==`number`&&Number.isFinite(e),n=(e,n=.06)=>{let r=(e??[]).flat().filter(e=>t(e));if(r.length===0)return;let i=Math.min(...r),a=Math.max(...r),o=a-i,s=o>0?o*n:Math.max(Math.abs(a)*n,1),c=10**(Math.floor(Math.log10(o>0?o:Math.abs(a)||1))-1),l=Math.max(0,-Math.floor(Math.log10(c))),u=(e,t)=>Number(((t<0?Math.floor(e/c):Math.ceil(e/c))*c).toFixed(l)),d=u(i-s,-1),f=u(a+s,1);return[i>=0&&d<0?0:d,f]};exports.isFiniteNumber=t,exports.spanDomain=n,exports.spanPixel=e;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * 「1 本の `<Bar>` + 配列 `dataKey` + カスタム shape」で描くチャートの共有部分
3
+ * (`WaterfallChart` / `BoxPlot` / `CandlestickChart`)。
4
+ *
5
+ * ── なぜ `<Bar>` を 2 本重ねないのか ────────────────────────────────────
6
+ * ヒゲと実体を別々の `<Bar>` にすると、**recharts がカテゴリ帯の中で横に並べる**ので
7
+ * 中心が揃わない(実測: 104 と 116 で 12px ずれた)。1 本にしてカスタム shape の中で
8
+ * 描き分けると一致する(実測: どちらも cx 112.5)。
9
+ *
10
+ * ── shape に `yAxis.scale` は渡ってこない ──────────────────────────────
11
+ * それに頼った版は矩形が 0 個だった。**そして必要ない** ── recharts は
12
+ * `dataKey` が `[lo, hi]` を返すと `y = scale(hi)` / `height = scale(lo) - scale(hi)`
13
+ * の**画素の矩形**をくれる(`recharts/es6/cartesian/Bar.js` の horizontal 分岐)。
14
+ * その矩形の中で値を比で置けば、軸の目盛りと必ず一致する。
15
+ */
16
+ /** `dataKey` が返す形。**昇順で渡すこと** ── 逆にすると `height` が負になる。 */
17
+ export type BarSpan = [low: number, high: number];
18
+ export type SpanRect = {
19
+ /** `high` 側の画素。矩形の上端。 */
20
+ y: number;
21
+ /** `high` から `low` までの画素の高さ。 */
22
+ height: number;
23
+ };
24
+ /**
25
+ * 値 → 画素。矩形が覆う値域 `[low, high]` の中で比を取る。
26
+ *
27
+ * `high === low`(幅の無い span)のときは矩形の高さが 0 なので、比は取れない。
28
+ * その場合は上端を返す ── 呼び出し側は線として描く。
29
+ */
30
+ export declare const spanPixel: (value: number, span: BarSpan, rect: SpanRect) => number;
31
+ /**
32
+ * 数として扱えるか。`null` / `undefined` / `NaN` を「0」に読み替えない
33
+ * ── 欠測を 0 として描くと、**無かった値が「ゼロだった」という主張**になる。
34
+ */
35
+ export declare const isFiniteNumber: (value: unknown) => value is number;
36
+ /**
37
+ * 値域に合わせた軸の domain(上下に少しだけ余白を足し、切りのいい数に丸める)。
38
+ *
39
+ * **分布や四本値に 0 起点の軸を使わない。** 棒の長さは 0 からの量そのものなので
40
+ * 0 を含めないと嘘になるが、箱ヒゲやローソク足が語るのは**値域の中の位置**で、
41
+ * 0 を入れると図の大半が空白になって形が潰れる。
42
+ *
43
+ * 余白が要るのは、`dataMin` をそのまま使うと**いちばん低いヒゲが軸線に乗る**ため
44
+ * (実測: `CandlestickChart` の Wed のヒゲが下端の格子線と同じ y=265 になった)。
45
+ *
46
+ * ── 3 つとも実測から出た条件 ──────────────────────────────────────────
47
+ * 1. **recharts の関数 domain(`[(dataMin) => …, (dataMax) => …]`)では書けない。**
48
+ * 片側ずつしか呼ばれないので、関数の中から値幅が見えない ── 最初にそう書いて、
49
+ * 両側とも「値幅 0」の分岐に落ちていた。
50
+ * 2. **端を丸めないと、その数がそのまま目盛りに出る。**(実測: 軸に
51
+ * `-11.399999999999999` と描かれた。余白は生の掛け算なので当然そうなる。)
52
+ * 3. **正の値しか無いデータに負の目盛りを作らない。**(実測: 応答時間の軸が
53
+ * `-113` から始まった。ミリ秒に負は無い。)ただし丸めた下端が正なら
54
+ * そのまま使う ── ここで 0 に寄せると、値が 0 から遠いデータ(給与など)で
55
+ * 図の下半分が空になって箱が潰れる。
56
+ *
57
+ * 空の data では domain を決められないので `undefined` を返す(recharts の既定に
58
+ * 任せる)── 0 と 1 を勝手に置くと、**データが無いのに軸だけが在る**図になる。
59
+ */
60
+ export declare const spanDomain: (spans: BarSpan[], ratio?: number) => [number, number] | undefined;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ //#region src/components/_internal/barSpan.ts
3
+ var e = (e, t, n) => {
4
+ let [r, i] = t, a = i - r;
5
+ return a === 0 ? n.y : n.y + (i - e) / a * n.height;
6
+ }, t = (e) => typeof e == "number" && Number.isFinite(e), n = (e, n = .06) => {
7
+ let r = (e ?? []).flat().filter((e) => t(e));
8
+ if (r.length === 0) return;
9
+ let i = Math.min(...r), a = Math.max(...r), o = a - i, s = o > 0 ? o * n : Math.max(Math.abs(a) * n, 1), c = 10 ** (Math.floor(Math.log10(o > 0 ? o : Math.abs(a) || 1)) - 1), l = Math.max(0, -Math.floor(Math.log10(c))), u = (e, t) => Number(((t < 0 ? Math.floor(e / c) : Math.ceil(e / c)) * c).toFixed(l)), d = u(i - s, -1), f = u(a + s, 1);
10
+ return [i >= 0 && d < 0 ? 0 : d, f];
11
+ };
12
+ //#endregion
13
+ export { t as isFiniteNumber, n as spanDomain, e as spanPixel };
@@ -51,3 +51,58 @@ export declare const pointTable: (data: {
51
51
  z?: number;
52
52
  name: string;
53
53
  }[], xLabel: string, yLabel: string, zLabel: string) => ChartTable;
54
+ /**
55
+ * 流れ型: 1 行が 1 本の流れ(どこから・どこへ・いくつ)。`SankeyChart` がこれ。
56
+ *
57
+ * **ノードの一覧は出さない。** 描かれているのは流れで、ノードはその端点だから
58
+ * ── 端点は from / to の列にすべて現れる。両方を出すと同じ名前が 2 か所に並び、
59
+ * 読み上げが長くなるだけで情報は増えない。
60
+ *
61
+ * 見出しは既定の英語を持つ(`PieChart` / `GanttChart` と同じ扱い)。呼び出し側が
62
+ * キー名を決める形ではないため。
63
+ */
64
+ export declare const linkTable: (links: {
65
+ source: string;
66
+ target: string;
67
+ value: number;
68
+ }[]) => ChartTable;
69
+ /**
70
+ * 増減型: 1 行が 1 段(何が・いくつ動いて・合計がいくつになったか)。
71
+ * `WaterfallChart` がこれ。
72
+ *
73
+ * **running total の列を落とさない。** 図では棒の高さと位置の両方が意味を持つが、
74
+ * 表に増減だけを並べると「その時点の合計」が消え、読み手が足し算をやり直す
75
+ * ことになる ── 図が見えている人だけが答えを持っている状態になる。
76
+ */
77
+ export declare const stepTable: (steps: {
78
+ name: string;
79
+ change: string;
80
+ running: number;
81
+ }[]) => ChartTable;
82
+ /**
83
+ * 五数要約型: 1 行が 1 群。`BoxPlot` がこれ。
84
+ *
85
+ * 図は箱とヒゲの**位置**でしか分布を語らないので、表には 5 つの数をそのまま出す
86
+ * ── 「中央値がどこか」は箱を見れば分かるが、見えない人には数が要る。
87
+ */
88
+ export declare const summaryTable: (groups: {
89
+ name: string;
90
+ min: number;
91
+ q1: number;
92
+ median: number;
93
+ q3: number;
94
+ max: number;
95
+ }[]) => ChartTable;
96
+ /**
97
+ * 四本値型: 1 行が 1 期間。`CandlestickChart` がこれ。
98
+ *
99
+ * 列の順は始値 → 高値 → 安値 → 終値(OHLC)── 相場の慣習の順で、
100
+ * 「上げか下げか」は始値と終値を並べれば読める。色の説明を表に足さない。
101
+ */
102
+ export declare const ohlcTable: (candles: {
103
+ name: string;
104
+ open: number;
105
+ high: number;
106
+ low: number;
107
+ close: number;
108
+ }[]) => ChartTable;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../typography/Title/Title.cjs"),n=require("../../helpers.cjs"),r=require("../../_internal/ChartDataTable.cjs"),i=require("../../_internal/chartTableData.cjs"),a=require("../../_internal/barSpan.cjs"),o=require("./box-plot.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("react/jsx-runtime"),l=require("recharts");var u=.62,d=.32,f=({x:e=0,y:t=0,width:n=0,height:r=0,payload:i})=>{if(!i)return null;let s={y:t,height:r},l=e=>a.spanPixel(e,i.span,s),f=e+n/2,p=n*u,m=n*d,h=l(i.q3),g=l(i.q1),_=Math.max(g-h,1);return(0,c.jsxs)(`g`,{children:[(0,c.jsx)(`line`,{className:o.default.whisker,x1:f,x2:f,y1:l(i.min),y2:l(i.max)}),(0,c.jsx)(`line`,{className:o.default.whisker,x1:f-m/2,x2:f+m/2,y1:l(i.min),y2:l(i.min)}),(0,c.jsx)(`line`,{className:o.default.whisker,x1:f-m/2,x2:f+m/2,y1:l(i.max),y2:l(i.max)}),(0,c.jsx)(`rect`,{className:o.default.box,x:f-p/2,y:h,width:p,height:_,rx:2}),(0,c.jsx)(`line`,{className:o.default.median,x1:f-p/2,x2:f+p/2,y1:l(i.median),y2:l(i.median)})]})},p=({data:e,height:s=300,width:u=`100%`,title:d,"aria-label":p})=>{let m=p??d,h=(e??[]).map(e=>({...e,span:[e.min,e.max]})),g=i.summaryTable(e??[]),_=a.spanDomain(h.map(e=>e.span));return(0,c.jsxs)(`div`,{className:`wim-box-plot ${o.default.root}`,style:{width:u},role:m?`figure`:void 0,"aria-label":m,children:[d&&(0,c.jsx)(t.Title,{tag:`h3`,size:`md`,style:{marginBottom:`var(--wim-spacing-md)`},children:d}),(0,c.jsx)(`div`,{className:o.default.container,style:{height:s},"aria-hidden":`true`,children:(0,c.jsx)(l.ResponsiveContainer,{width:`100%`,height:`100%`,children:(0,c.jsxs)(l.BarChart,{...n.CHART_HIDDEN_A11Y_PROPS,data:h,margin:{top:8,right:30,left:0,bottom:5},children:[(0,c.jsx)(l.CartesianGrid,{...n.CHART_THEME.grid,vertical:!1}),(0,c.jsx)(l.XAxis,{dataKey:`name`,interval:0,...n.CHART_THEME.axis,tickLine:!1,axisLine:!1}),(0,c.jsx)(l.YAxis,{width:44,domain:_,...n.CHART_THEME.axis,tickLine:!1,axisLine:!1}),(0,c.jsx)(l.Tooltip,{contentStyle:n.CHART_THEME.tooltip.contentStyle,cursor:n.CHART_THEME.tooltip.cursor}),(0,c.jsx)(l.Bar,{dataKey:`span`,shape:(0,c.jsx)(f,{}),isAnimationActive:!1})]})})}),(0,c.jsx)(r.ChartDataTable,{caption:m,columns:g.columns,rows:g.rows})]})};exports.BoxPlot=p;
@@ -0,0 +1,50 @@
1
+ import { default as React } from 'react';
2
+ export type BoxPlotItem = {
3
+ /** Label for this group, shown on the X axis. */
4
+ name: string;
5
+ /** The smallest value that is not an outlier. */
6
+ min: number;
7
+ /** First quartile — a quarter of the values are below this. */
8
+ q1: number;
9
+ /** The middle value. */
10
+ median: number;
11
+ /** Third quartile — a quarter of the values are above this. */
12
+ q3: number;
13
+ /** The largest value that is not an outlier. */
14
+ max: number;
15
+ };
16
+ export type BoxPlotProps = {
17
+ /** One entry per group. Each is a five-number summary, already computed. */
18
+ data: BoxPlotItem[];
19
+ /**
20
+ * The height of the chart in pixels.
21
+ * @default 300
22
+ */
23
+ height?: number;
24
+ /**
25
+ * The width of the chart (e.g., "100%", 500).
26
+ * @default "100%"
27
+ */
28
+ width?: string | number;
29
+ /** Optional title displayed above the chart. */
30
+ title?: string;
31
+ /**
32
+ * Accessible name for the chart. Defaults to `title` when omitted; pass this
33
+ * when the chart has no visible title, or when the title is not descriptive
34
+ * enough on its own.
35
+ */
36
+ "aria-label"?: string;
37
+ };
38
+ /**
39
+ * Shows how values are spread within each group — response times per endpoint,
40
+ * salaries per role, scores per class.
41
+ *
42
+ * **A box plot shows the shape of a distribution, not one number for it.** Two
43
+ * groups with the same average can have completely different boxes, which is
44
+ * exactly what a `BarChart` of averages hides.
45
+ *
46
+ * Composition Contract:
47
+ * - Managed by: App consumption
48
+ * - Scroll lock: No
49
+ */
50
+ export declare const BoxPlot: ({ data, height, width, title, "aria-label": ariaLabel, }: BoxPlotProps) => React.JSX.Element;
@@ -0,0 +1,130 @@
1
+ "use client";
2
+ import { Title as e } from "../../typography/Title/Title.js";
3
+ import { CHART_HIDDEN_A11Y_PROPS as t, CHART_THEME as n } from "../../helpers.js";
4
+ import { ChartDataTable as r } from "../../_internal/ChartDataTable.js";
5
+ import { summaryTable as i } from "../../_internal/chartTableData.js";
6
+ import { spanDomain as a, spanPixel as o } from "../../_internal/barSpan.js";
7
+ import s from "./box-plot.module.js";
8
+ import "react";
9
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
10
+ import { Bar as u, BarChart as d, CartesianGrid as f, ResponsiveContainer as p, Tooltip as m, XAxis as h, YAxis as g } from "recharts";
11
+ //#region src/components/charts/BoxPlot/BoxPlot.tsx
12
+ var _ = .62, v = .32, y = ({ x: e = 0, y: t = 0, width: n = 0, height: r = 0, payload: i }) => {
13
+ if (!i) return null;
14
+ let a = {
15
+ y: t,
16
+ height: r
17
+ }, u = (e) => o(e, i.span, a), d = e + n / 2, f = n * _, p = n * v, m = u(i.q3), h = u(i.q1), g = Math.max(h - m, 1);
18
+ return /* @__PURE__ */ l("g", { children: [
19
+ /* @__PURE__ */ c("line", {
20
+ className: s.whisker,
21
+ x1: d,
22
+ x2: d,
23
+ y1: u(i.min),
24
+ y2: u(i.max)
25
+ }),
26
+ /* @__PURE__ */ c("line", {
27
+ className: s.whisker,
28
+ x1: d - p / 2,
29
+ x2: d + p / 2,
30
+ y1: u(i.min),
31
+ y2: u(i.min)
32
+ }),
33
+ /* @__PURE__ */ c("line", {
34
+ className: s.whisker,
35
+ x1: d - p / 2,
36
+ x2: d + p / 2,
37
+ y1: u(i.max),
38
+ y2: u(i.max)
39
+ }),
40
+ /* @__PURE__ */ c("rect", {
41
+ className: s.box,
42
+ x: d - f / 2,
43
+ y: m,
44
+ width: f,
45
+ height: g,
46
+ rx: 2
47
+ }),
48
+ /* @__PURE__ */ c("line", {
49
+ className: s.median,
50
+ x1: d - f / 2,
51
+ x2: d + f / 2,
52
+ y1: u(i.median),
53
+ y2: u(i.median)
54
+ })
55
+ ] });
56
+ }, b = ({ data: o, height: _ = 300, width: v = "100%", title: b, "aria-label": x }) => {
57
+ let S = x ?? b, C = (o ?? []).map((e) => ({
58
+ ...e,
59
+ span: [e.min, e.max]
60
+ })), w = i(o ?? []), T = a(C.map((e) => e.span));
61
+ return /* @__PURE__ */ l("div", {
62
+ className: `wim-box-plot ${s.root}`,
63
+ style: { width: v },
64
+ role: S ? "figure" : void 0,
65
+ "aria-label": S,
66
+ children: [
67
+ b && /* @__PURE__ */ c(e, {
68
+ tag: "h3",
69
+ size: "md",
70
+ style: { marginBottom: "var(--wim-spacing-md)" },
71
+ children: b
72
+ }),
73
+ /* @__PURE__ */ c("div", {
74
+ className: s.container,
75
+ style: { height: _ },
76
+ "aria-hidden": "true",
77
+ children: /* @__PURE__ */ c(p, {
78
+ width: "100%",
79
+ height: "100%",
80
+ children: /* @__PURE__ */ l(d, {
81
+ ...t,
82
+ data: C,
83
+ margin: {
84
+ top: 8,
85
+ right: 30,
86
+ left: 0,
87
+ bottom: 5
88
+ },
89
+ children: [
90
+ /* @__PURE__ */ c(f, {
91
+ ...n.grid,
92
+ vertical: !1
93
+ }),
94
+ /* @__PURE__ */ c(h, {
95
+ dataKey: "name",
96
+ interval: 0,
97
+ ...n.axis,
98
+ tickLine: !1,
99
+ axisLine: !1
100
+ }),
101
+ /* @__PURE__ */ c(g, {
102
+ width: 44,
103
+ domain: T,
104
+ ...n.axis,
105
+ tickLine: !1,
106
+ axisLine: !1
107
+ }),
108
+ /* @__PURE__ */ c(m, {
109
+ contentStyle: n.tooltip.contentStyle,
110
+ cursor: n.tooltip.cursor
111
+ }),
112
+ /* @__PURE__ */ c(u, {
113
+ dataKey: "span",
114
+ shape: /* @__PURE__ */ c(y, {}),
115
+ isAnimationActive: !1
116
+ })
117
+ ]
118
+ })
119
+ })
120
+ }),
121
+ /* @__PURE__ */ c(r, {
122
+ caption: S,
123
+ columns: w.columns,
124
+ rows: w.rows
125
+ })
126
+ ]
127
+ });
128
+ };
129
+ //#endregion
130
+ export { b as BoxPlot };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ var e=`_root_10hv1_3`,t=`_container_10hv1_6`,n=`_box_10hv1_15`,r=`_whisker_10hv1_20`,i=`_median_10hv1_25`,a={root:e,container:t,box:n,whisker:r,median:i};exports.box=n,exports.container=t,exports.default=a,exports.median=i,exports.root=e,exports.whisker=r;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ //#region src/components/charts/BoxPlot/box-plot.module.scss
3
+ var e = "_root_10hv1_3", t = "_container_10hv1_6", n = "_box_10hv1_15", r = "_whisker_10hv1_20", i = "_median_10hv1_25", a = {
4
+ root: e,
5
+ container: t,
6
+ box: n,
7
+ whisker: r,
8
+ median: i
9
+ };
10
+ //#endregion
11
+ export { n as box, t as container, a as default, i as median, e as root, r as whisker };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../typography/Title/Title.cjs"),n=require("../../helpers.cjs"),r=require("../../_internal/ChartDataTable.cjs"),i=require("../../_internal/chartTableData.cjs"),a=require("../../_internal/barSpan.cjs"),o=require("./candlestick-chart.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("react/jsx-runtime"),l=require("recharts");var u=.62,d=({x:e=0,y:t=0,width:n=0,height:r=0,payload:i})=>{if(!i)return null;let s={y:t,height:r},l=e=>a.spanPixel(e,i.span,s),d=e+n/2,f=n*u,p=l(Math.max(i.open,i.close)),m=l(Math.min(i.open,i.close)),h=Math.max(m-p,1);return(0,c.jsxs)(`g`,{className:i.rising?o.default.rising:o.default.falling,children:[(0,c.jsx)(`line`,{className:o.default.wick,x1:d,x2:d,y1:l(i.low),y2:p+h}),(0,c.jsx)(`line`,{className:o.default.wick,x1:d,x2:d,y1:p,y2:l(i.high)}),(0,c.jsx)(`rect`,{className:i.rising?o.default.hollowBody:o.default.filledBody,x:d-f/2,y:p,width:f,height:h})]})},f=({data:e,height:s=300,width:u=`100%`,title:f,"aria-label":p})=>{let m=p??f,h=(e??[]).map(e=>({...e,span:[e.low,e.high],rising:e.close>=e.open})),g=i.ohlcTable(e??[]),_=a.spanDomain(h.map(e=>e.span));return(0,c.jsxs)(`div`,{className:`wim-candlestick-chart ${o.default.root}`,style:{width:u},role:m?`figure`:void 0,"aria-label":m,children:[f&&(0,c.jsx)(t.Title,{tag:`h3`,size:`md`,style:{marginBottom:`var(--wim-spacing-md)`},children:f}),(0,c.jsx)(`div`,{className:o.default.container,style:{height:s},"aria-hidden":`true`,children:(0,c.jsx)(l.ResponsiveContainer,{width:`100%`,height:`100%`,children:(0,c.jsxs)(l.BarChart,{...n.CHART_HIDDEN_A11Y_PROPS,data:h,margin:{top:8,right:30,left:0,bottom:5},children:[(0,c.jsx)(l.CartesianGrid,{...n.CHART_THEME.grid,vertical:!1}),(0,c.jsx)(l.XAxis,{dataKey:`name`,interval:0,...n.CHART_THEME.axis,tickLine:!1,axisLine:!1}),(0,c.jsx)(l.YAxis,{width:44,domain:_,...n.CHART_THEME.axis,tickLine:!1,axisLine:!1}),(0,c.jsx)(l.Tooltip,{contentStyle:n.CHART_THEME.tooltip.contentStyle,cursor:n.CHART_THEME.tooltip.cursor}),(0,c.jsx)(l.Bar,{dataKey:`span`,shape:(0,c.jsx)(d,{}),isAnimationActive:!1})]})})}),(0,c.jsx)(r.ChartDataTable,{caption:m,columns:g.columns,rows:g.rows})]})};exports.CandlestickChart=f;
@@ -0,0 +1,48 @@
1
+ import { default as React } from 'react';
2
+ export type Candle = {
3
+ /** Label for this period, shown on the X axis. */
4
+ name: string;
5
+ /** Value at the start of the period. */
6
+ open: number;
7
+ /** Highest value reached during the period. */
8
+ high: number;
9
+ /** Lowest value reached during the period. */
10
+ low: number;
11
+ /** Value at the end of the period. */
12
+ close: number;
13
+ };
14
+ export type CandlestickChartProps = {
15
+ /** One entry per period, oldest first. */
16
+ data: Candle[];
17
+ /**
18
+ * The height of the chart in pixels.
19
+ * @default 300
20
+ */
21
+ height?: number;
22
+ /**
23
+ * The width of the chart (e.g., "100%", 500).
24
+ * @default "100%"
25
+ */
26
+ width?: string | number;
27
+ /** Optional title displayed above the chart. */
28
+ title?: string;
29
+ /**
30
+ * Accessible name for the chart. Defaults to `title` when omitted; pass this
31
+ * when the chart has no visible title, or when the title is not descriptive
32
+ * enough on its own.
33
+ */
34
+ "aria-label"?: string;
35
+ };
36
+ /**
37
+ * Shows how a value opened, ranged, and closed within each period — a price
38
+ * series, a daily temperature range, a load metric per hour.
39
+ *
40
+ * **Each mark carries four numbers, not one**, which is what a `LineChart` of
41
+ * closing values drops: the line says where the period ended and nothing about
42
+ * how far it travelled to get there.
43
+ *
44
+ * Composition Contract:
45
+ * - Managed by: App consumption
46
+ * - Scroll lock: No
47
+ */
48
+ export declare const CandlestickChart: ({ data, height, width, title, "aria-label": ariaLabel, }: CandlestickChartProps) => React.JSX.Element;
@@ -0,0 +1,119 @@
1
+ "use client";
2
+ import { Title as e } from "../../typography/Title/Title.js";
3
+ import { CHART_HIDDEN_A11Y_PROPS as t, CHART_THEME as n } from "../../helpers.js";
4
+ import { ChartDataTable as r } from "../../_internal/ChartDataTable.js";
5
+ import { ohlcTable as i } from "../../_internal/chartTableData.js";
6
+ import { spanDomain as a, spanPixel as o } from "../../_internal/barSpan.js";
7
+ import s from "./candlestick-chart.module.js";
8
+ import "react";
9
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
10
+ import { Bar as u, BarChart as d, CartesianGrid as f, ResponsiveContainer as p, Tooltip as m, XAxis as h, YAxis as g } from "recharts";
11
+ //#region src/components/charts/CandlestickChart/CandlestickChart.tsx
12
+ var _ = .62, v = ({ x: e = 0, y: t = 0, width: n = 0, height: r = 0, payload: i }) => {
13
+ if (!i) return null;
14
+ let a = {
15
+ y: t,
16
+ height: r
17
+ }, u = (e) => o(e, i.span, a), d = e + n / 2, f = n * _, p = u(Math.max(i.open, i.close)), m = u(Math.min(i.open, i.close)), h = Math.max(m - p, 1);
18
+ return /* @__PURE__ */ l("g", {
19
+ className: i.rising ? s.rising : s.falling,
20
+ children: [
21
+ /* @__PURE__ */ c("line", {
22
+ className: s.wick,
23
+ x1: d,
24
+ x2: d,
25
+ y1: u(i.low),
26
+ y2: p + h
27
+ }),
28
+ /* @__PURE__ */ c("line", {
29
+ className: s.wick,
30
+ x1: d,
31
+ x2: d,
32
+ y1: p,
33
+ y2: u(i.high)
34
+ }),
35
+ /* @__PURE__ */ c("rect", {
36
+ className: i.rising ? s.hollowBody : s.filledBody,
37
+ x: d - f / 2,
38
+ y: p,
39
+ width: f,
40
+ height: h
41
+ })
42
+ ]
43
+ });
44
+ }, y = ({ data: o, height: _ = 300, width: y = "100%", title: b, "aria-label": x }) => {
45
+ let S = x ?? b, C = (o ?? []).map((e) => ({
46
+ ...e,
47
+ span: [e.low, e.high],
48
+ rising: e.close >= e.open
49
+ })), w = i(o ?? []), T = a(C.map((e) => e.span));
50
+ return /* @__PURE__ */ l("div", {
51
+ className: `wim-candlestick-chart ${s.root}`,
52
+ style: { width: y },
53
+ role: S ? "figure" : void 0,
54
+ "aria-label": S,
55
+ children: [
56
+ b && /* @__PURE__ */ c(e, {
57
+ tag: "h3",
58
+ size: "md",
59
+ style: { marginBottom: "var(--wim-spacing-md)" },
60
+ children: b
61
+ }),
62
+ /* @__PURE__ */ c("div", {
63
+ className: s.container,
64
+ style: { height: _ },
65
+ "aria-hidden": "true",
66
+ children: /* @__PURE__ */ c(p, {
67
+ width: "100%",
68
+ height: "100%",
69
+ children: /* @__PURE__ */ l(d, {
70
+ ...t,
71
+ data: C,
72
+ margin: {
73
+ top: 8,
74
+ right: 30,
75
+ left: 0,
76
+ bottom: 5
77
+ },
78
+ children: [
79
+ /* @__PURE__ */ c(f, {
80
+ ...n.grid,
81
+ vertical: !1
82
+ }),
83
+ /* @__PURE__ */ c(h, {
84
+ dataKey: "name",
85
+ interval: 0,
86
+ ...n.axis,
87
+ tickLine: !1,
88
+ axisLine: !1
89
+ }),
90
+ /* @__PURE__ */ c(g, {
91
+ width: 44,
92
+ domain: T,
93
+ ...n.axis,
94
+ tickLine: !1,
95
+ axisLine: !1
96
+ }),
97
+ /* @__PURE__ */ c(m, {
98
+ contentStyle: n.tooltip.contentStyle,
99
+ cursor: n.tooltip.cursor
100
+ }),
101
+ /* @__PURE__ */ c(u, {
102
+ dataKey: "span",
103
+ shape: /* @__PURE__ */ c(v, {}),
104
+ isAnimationActive: !1
105
+ })
106
+ ]
107
+ })
108
+ })
109
+ }),
110
+ /* @__PURE__ */ c(r, {
111
+ caption: S,
112
+ columns: w.columns,
113
+ rows: w.rows
114
+ })
115
+ ]
116
+ });
117
+ };
118
+ //#endregion
119
+ export { y as CandlestickChart };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ var e=`_root_wvf5o_3`,t=`_container_wvf5o_6`,n=`_rising_wvf5o_14`,r=`_falling_wvf5o_17`,i=`_wick_wvf5o_20`,a=`_hollowBody_wvf5o_11`,o=`_filledBody_wvf5o_11`,s={root:e,container:t,rising:n,falling:r,wick:i,hollowBody:a,filledBody:o};exports.container=t,exports.default=s,exports.falling=r,exports.filledBody=o,exports.hollowBody=a,exports.rising=n,exports.root=e,exports.wick=i;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ //#region src/components/charts/CandlestickChart/candlestick-chart.module.scss
3
+ var e = "_root_wvf5o_3", t = "_container_wvf5o_6", n = "_rising_wvf5o_14", r = "_falling_wvf5o_17", i = "_wick_wvf5o_20", a = "_hollowBody_wvf5o_11", o = "_filledBody_wvf5o_11", s = {
4
+ root: e,
5
+ container: t,
6
+ rising: n,
7
+ falling: r,
8
+ wick: i,
9
+ hollowBody: a,
10
+ filledBody: o
11
+ };
12
+ //#endregion
13
+ export { t as container, s as default, r as falling, o as filledBody, a as hollowBody, n as rising, e as root, i as wick };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../typography/Title/Title.cjs"),n=require("../../helpers.cjs"),r=require("../../_internal/ChartDataTable.cjs"),i=require("../../_internal/chartTableData.cjs"),a=require("./warn-unknown-node.cjs"),o=require("./sankey-chart.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("react/jsx-runtime"),l=require("recharts");var u=12,d=24,f=8,p=({x:e=0,y:t=0,width:r=0,height:i=0,index:a=0,payload:s})=>{let l=(s?.targetNodes?.length??0)===0;return(0,c.jsxs)(`g`,{children:[(0,c.jsx)(`rect`,{x:e,y:t,width:r,height:i,fill:n.CHART_COLORS[a%n.CHART_COLORS.length],rx:2}),(0,c.jsx)(`text`,{className:o.default.label,x:l?e-f:e+r+f,y:t+i/2,textAnchor:l?`end`:`start`,dominantBaseline:`middle`,children:s?.name})]})},m=({sourceX:e=0,targetX:t=0,sourceY:r=0,targetY:i=0,sourceControlX:a=0,targetControlX:o=0,linkWidth:s=0,payload:l,colorIndexOf:u})=>{let d=l?.source?.name,f=(d===void 0?void 0:u?.get(d))??0;return(0,c.jsx)(`path`,{d:`M${e},${r}C${a},${r} ${o},${i} ${t},${i}`,fill:`none`,stroke:n.CHART_COLORS[f%n.CHART_COLORS.length],strokeWidth:s,strokeOpacity:.28})},h=({nodes:e,links:s,height:f=300,width:h=`100%`,title:g,"aria-label":_})=>{let v=_??g,y=new Map;e.forEach((e,t)=>{if(y.has(e)){a.warnDuplicateSankeyNode(e);return}y.set(e,t)});let b=s.filter(t=>{let n=y.has(t.source)?y.has(t.target)?null:t.target:t.source;return n===null?!0:(a.warnUnknownSankeyNode(n,e),!1)}),x=i.linkTable(b);return(0,c.jsxs)(`div`,{className:`wim-sankey-chart ${o.default.root}`,style:{width:h},role:v?`figure`:void 0,"aria-label":v,children:[g&&(0,c.jsx)(t.Title,{tag:`h3`,size:`md`,style:{marginBottom:`var(--wim-spacing-md)`},children:g}),(0,c.jsx)(`div`,{className:o.default.container,style:{height:f},"aria-hidden":`true`,children:(0,c.jsx)(l.ResponsiveContainer,{width:`100%`,height:`100%`,children:(0,c.jsx)(l.Sankey,{...n.CHART_HIDDEN_A11Y_PROPS,data:{nodes:e.map(e=>({name:e})),links:b.map(e=>({source:y.get(e.source),target:y.get(e.target),value:e.value}))},nodeWidth:u,nodePadding:d,margin:{top:8,right:8,bottom:8,left:8},node:(0,c.jsx)(p,{}),link:(0,c.jsx)(m,{colorIndexOf:y}),children:(0,c.jsx)(l.Tooltip,{contentStyle:n.CHART_THEME.tooltip.contentStyle,cursor:n.CHART_THEME.tooltip.cursor})})})}),(0,c.jsx)(r.ChartDataTable,{caption:v,columns:x.columns,rows:x.rows})]})};exports.SankeyChart=h;
@@ -0,0 +1,54 @@
1
+ import { default as React } from 'react';
2
+ export type SankeyLink = {
3
+ /** Name of the node the flow leaves. */
4
+ source: string;
5
+ /** Name of the node the flow arrives at. */
6
+ target: string;
7
+ /** Size of the flow. The band's thickness is this value. */
8
+ value: number;
9
+ };
10
+ export type SankeyChartProps = {
11
+ /**
12
+ * Every node in the diagram, in the order their colors are assigned. Names
13
+ * are what `links` refers to, so they have to be unique.
14
+ */
15
+ nodes: string[];
16
+ /**
17
+ * Flows between nodes, by node name. A link naming a node that is not in
18
+ * `nodes` is dropped (and reported in the console during development).
19
+ */
20
+ links: SankeyLink[];
21
+ /**
22
+ * The height of the chart in pixels.
23
+ * @default 300
24
+ */
25
+ height?: number;
26
+ /**
27
+ * The width of the chart (e.g., "100%", 500).
28
+ * @default "100%"
29
+ */
30
+ width?: string | number;
31
+ /**
32
+ * Optional title displayed above the chart.
33
+ */
34
+ title?: string;
35
+ /**
36
+ * Accessible name for the chart. Defaults to `title` when omitted; pass this
37
+ * when the chart has no visible title, or when the title is not descriptive
38
+ * enough on its own.
39
+ */
40
+ "aria-label"?: string;
41
+ };
42
+ /**
43
+ * Shows how a quantity splits and recombines as it moves through stages —
44
+ * where traffic goes, where a budget ends up, where applicants drop out.
45
+ *
46
+ * **The width of a band is the amount that flows through it**, which is what
47
+ * `NodeGraph` cannot express: its edges show that two things are connected, not
48
+ * how much moves between them.
49
+ *
50
+ * Composition Contract:
51
+ * - Managed by: App consumption
52
+ * - Scroll lock: No
53
+ */
54
+ export declare const SankeyChart: ({ nodes, links, height, width, title, "aria-label": ariaLabel, }: SankeyChartProps) => React.JSX.Element;