@squadbase/vantage 0.6.2-dev1.42c4e48 → 0.6.2-dev1.81c1bbe

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 (240) hide show
  1. package/dist/{build-MFWRPYKW.js → build-X5NVCQKT.js} +4 -4
  2. package/dist/{build-MFWRPYKW.js.map → build-X5NVCQKT.js.map} +1 -1
  3. package/dist/chunk-2IAPIOPS.js +152 -0
  4. package/dist/chunk-2IAPIOPS.js.map +1 -0
  5. package/dist/{chunk-IBGOCWJB.js → chunk-2ICNHUG6.js} +186 -82
  6. package/dist/chunk-2ICNHUG6.js.map +1 -0
  7. package/dist/{chunk-5ZOP4SQR.js → chunk-2N72FKLB.js} +12 -7
  8. package/dist/chunk-2N72FKLB.js.map +1 -0
  9. package/dist/chunk-57GHR5LN.js +163 -0
  10. package/dist/chunk-57GHR5LN.js.map +1 -0
  11. package/dist/{chunk-OB6UBJXF.js → chunk-7S52M2SL.js} +127 -36
  12. package/dist/chunk-7S52M2SL.js.map +1 -0
  13. package/dist/chunk-JXFCSF3K.js +673 -0
  14. package/dist/chunk-JXFCSF3K.js.map +1 -0
  15. package/dist/{chunk-PXRX5PEC.js → chunk-PDOBHMUQ.js} +3 -3
  16. package/dist/chunk-PDOBHMUQ.js.map +1 -0
  17. package/dist/chunk-RU6WKEOG.js +7048 -0
  18. package/dist/chunk-RU6WKEOG.js.map +1 -0
  19. package/dist/{chunk-A2UUGASH.js → chunk-U736PVHY.js} +2 -2
  20. package/dist/chunk-U736PVHY.js.map +1 -0
  21. package/dist/{chunk-QEWCYW3I.js → chunk-WAMZWZJB.js} +13 -3
  22. package/dist/chunk-WAMZWZJB.js.map +1 -0
  23. package/dist/cli.js +3 -3
  24. package/dist/components/index.d.ts +1592 -100
  25. package/dist/components/index.js +7 -4
  26. package/dist/{dev-DCTOHQ6W.js → dev-4XEDTELV.js} +4 -4
  27. package/dist/{dev-DCTOHQ6W.js.map → dev-4XEDTELV.js.map} +1 -1
  28. package/dist/doc/index.d.ts +194 -2
  29. package/dist/doc/index.js +336 -5
  30. package/dist/doc/index.js.map +1 -1
  31. package/dist/format-U0cQl069.d.ts +243 -0
  32. package/dist/markdown/index.js +1 -1
  33. package/dist/markdown/index.js.map +1 -1
  34. package/dist/slide/index.d.ts +177 -1
  35. package/dist/slide/index.js +866 -3
  36. package/dist/slide/index.js.map +1 -1
  37. package/dist/table/index.js +9 -6
  38. package/dist/table/index.js.map +1 -1
  39. package/dist/ui/index.d.ts +8 -2
  40. package/dist/ui/index.js +22 -112
  41. package/dist/ui/index.js.map +1 -1
  42. package/dist/{upgrade-DBBE6GIR.js → upgrade-JHXZBGQS.js} +3 -3
  43. package/dist/{upgrade-DBBE6GIR.js.map → upgrade-JHXZBGQS.js.map} +1 -1
  44. package/dist/vite/index.js +2 -2
  45. package/docs/en/components.md +40 -17
  46. package/docs/en/doc/doc-action-items.md +49 -0
  47. package/docs/en/doc/doc-callout.md +38 -0
  48. package/docs/en/doc/doc-data-table.md +60 -0
  49. package/docs/en/doc/doc-executive-summary.md +64 -0
  50. package/docs/en/doc/doc-figure.md +56 -0
  51. package/docs/en/doc/doc-key-findings.md +61 -0
  52. package/docs/en/doc/doc-kpi-scorecard.md +80 -0
  53. package/docs/en/doc/doc-report-header.md +46 -0
  54. package/docs/en/parts/area-chart.md +99 -0
  55. package/docs/en/parts/bar-chart.md +91 -0
  56. package/docs/en/parts/bar-list.md +50 -0
  57. package/docs/en/parts/category-bar.md +37 -0
  58. package/docs/en/parts/chart-frame.md +39 -0
  59. package/docs/en/parts/data-table.md +22 -0
  60. package/docs/en/parts/delta.md +50 -0
  61. package/docs/en/parts/donut-chart.md +72 -0
  62. package/docs/en/parts/format.md +43 -0
  63. package/docs/en/parts/funnel-steps.md +2 -1
  64. package/docs/en/parts/heatmap.md +53 -0
  65. package/docs/en/parts/kpi-card.md +57 -0
  66. package/docs/en/parts/legend.md +35 -0
  67. package/docs/en/parts/line-chart.md +94 -0
  68. package/docs/en/parts/metric-value.md +3 -2
  69. package/docs/en/parts/progress-circle.md +33 -0
  70. package/docs/en/parts/sample-data.md +39 -0
  71. package/docs/en/parts/scatter-chart.md +56 -0
  72. package/docs/en/parts/sparkline.md +1 -1
  73. package/docs/en/parts/tracker.md +36 -0
  74. package/docs/en/parts/trend-indicator.md +17 -1
  75. package/docs/en/parts/updated-at.md +30 -0
  76. package/docs/en/parts/waterfall-chart.md +56 -0
  77. package/docs/en/slide/slide-chart-insight.md +52 -0
  78. package/docs/en/slide/slide-cover.md +39 -0
  79. package/docs/en/slide/slide-exec-summary.md +47 -0
  80. package/docs/en/slide/slide-kpi-grid.md +55 -0
  81. package/docs/en/slide/slide-kpi-hero.md +58 -0
  82. package/docs/en/slide/slide-next-actions.md +49 -0
  83. package/docs/en/slide/slide-scorecard-table.md +54 -0
  84. package/docs/en/ui/alert-dialog.md +42 -0
  85. package/docs/en/ui/avatar.md +31 -0
  86. package/docs/en/ui/combobox.md +74 -0
  87. package/docs/en/ui/drawer.md +41 -0
  88. package/docs/en/ui/empty.md +1 -1
  89. package/docs/en/ui/error-state.md +4 -3
  90. package/docs/en/ui/field.md +42 -0
  91. package/docs/en/ui/hover-card.md +21 -0
  92. package/docs/en/ui/kbd.md +17 -0
  93. package/docs/en/ui/loading.md +1 -1
  94. package/docs/en/ui/pagination.md +36 -0
  95. package/docs/en/ui/radio-group.md +21 -0
  96. package/docs/en/ui/toast.md +44 -0
  97. package/docs/en/ui/toggle-group.md +4 -3
  98. package/docs/en/ui-and-theming.md +1 -1
  99. package/docs/index.json +753 -73
  100. package/docs/ja/components.md +37 -16
  101. package/docs/ja/doc/doc-action-items.md +49 -0
  102. package/docs/ja/doc/doc-callout.md +38 -0
  103. package/docs/ja/doc/doc-data-table.md +60 -0
  104. package/docs/ja/doc/doc-executive-summary.md +64 -0
  105. package/docs/ja/doc/doc-figure.md +56 -0
  106. package/docs/ja/doc/doc-key-findings.md +61 -0
  107. package/docs/ja/doc/doc-kpi-scorecard.md +80 -0
  108. package/docs/ja/doc/doc-report-header.md +46 -0
  109. package/docs/ja/parts/area-chart.md +49 -25
  110. package/docs/ja/parts/bar-chart.md +50 -24
  111. package/docs/ja/parts/bar-list.md +31 -8
  112. package/docs/ja/parts/chart-frame.md +36 -0
  113. package/docs/ja/parts/data-table.md +22 -0
  114. package/docs/ja/parts/delta.md +50 -0
  115. package/docs/ja/parts/donut-chart.md +45 -26
  116. package/docs/ja/parts/format.md +44 -0
  117. package/docs/ja/parts/funnel-steps.md +27 -8
  118. package/docs/ja/parts/heatmap.md +45 -0
  119. package/docs/ja/parts/kpi-card.md +55 -0
  120. package/docs/ja/parts/legend.md +36 -0
  121. package/docs/ja/parts/line-chart.md +48 -22
  122. package/docs/ja/parts/metric-value.md +3 -2
  123. package/docs/ja/parts/sample-data.md +61 -0
  124. package/docs/ja/parts/scatter-chart.md +69 -0
  125. package/docs/ja/parts/sparkline.md +1 -1
  126. package/docs/ja/parts/trend-indicator.md +17 -1
  127. package/docs/ja/parts/updated-at.md +27 -0
  128. package/docs/ja/parts/waterfall-chart.md +61 -0
  129. package/docs/ja/slide/slide-chart-insight.md +52 -0
  130. package/docs/ja/slide/slide-cover.md +39 -0
  131. package/docs/ja/slide/slide-exec-summary.md +47 -0
  132. package/docs/ja/slide/slide-kpi-grid.md +55 -0
  133. package/docs/ja/slide/slide-kpi-hero.md +58 -0
  134. package/docs/ja/slide/slide-next-actions.md +49 -0
  135. package/docs/ja/slide/slide-scorecard-table.md +54 -0
  136. package/docs/ja/ui/empty.md +1 -1
  137. package/docs/ja/ui/error-state.md +4 -3
  138. package/docs/ja/ui/loading.md +1 -1
  139. package/docs/ja/ui/toggle-group.md +4 -3
  140. package/docs/ja/ui-and-theming.md +2 -2
  141. package/package.json +26 -24
  142. package/registry/ui/accordion.tsx +4 -2
  143. package/registry/ui/alert-dialog.tsx +3 -3
  144. package/registry/ui/alert.tsx +3 -1
  145. package/registry/ui/app-shell.tsx +7 -1
  146. package/registry/ui/area-chart.tsx +2852 -166
  147. package/registry/ui/attention-list.tsx +303 -0
  148. package/registry/ui/avatar.tsx +1 -1
  149. package/registry/ui/badge.tsx +3 -1
  150. package/registry/ui/bar-chart.tsx +2851 -166
  151. package/registry/ui/bar-list.tsx +3531 -90
  152. package/registry/ui/box-plot-chart.tsx +3906 -0
  153. package/registry/ui/breadcrumb.tsx +3 -1
  154. package/registry/ui/button.tsx +3 -1
  155. package/registry/ui/calendar.tsx +3 -1
  156. package/registry/ui/card.tsx +4 -2
  157. package/registry/ui/category-bar.tsx +1025 -16
  158. package/registry/ui/chart-frame.tsx +1393 -0
  159. package/registry/ui/checkbox.tsx +3 -1
  160. package/registry/ui/collapsible.tsx +3 -1
  161. package/registry/ui/combobox.tsx +2 -2
  162. package/registry/ui/command.tsx +3 -1
  163. package/registry/ui/dashboard-card.tsx +71 -28
  164. package/registry/ui/data-table.tsx +678 -56
  165. package/registry/ui/date-range-picker.tsx +245 -64
  166. package/registry/ui/delta.tsx +188 -0
  167. package/registry/ui/dialog.tsx +5 -3
  168. package/registry/ui/donut-chart.tsx +2929 -182
  169. package/registry/ui/drawer.tsx +1 -1
  170. package/registry/ui/dropdown-menu.tsx +5 -3
  171. package/registry/ui/echart.tsx +621 -67
  172. package/registry/ui/field.tsx +1 -1
  173. package/registry/ui/filter-bar.tsx +33 -6
  174. package/registry/ui/funnel-steps.tsx +3344 -49
  175. package/registry/ui/heatmap.tsx +1786 -0
  176. package/registry/ui/histogram-chart.tsx +3986 -0
  177. package/registry/ui/hover-card.tsx +2 -2
  178. package/registry/ui/input-group.tsx +3 -1
  179. package/registry/ui/input.tsx +3 -1
  180. package/registry/ui/kbd.tsx +3 -1
  181. package/registry/ui/kpi-card.tsx +699 -0
  182. package/registry/ui/label.tsx +3 -1
  183. package/registry/ui/legend.tsx +3563 -0
  184. package/registry/ui/line-chart.tsx +2852 -160
  185. package/registry/ui/metric-value.tsx +9 -1
  186. package/registry/ui/multi-select.tsx +11 -5
  187. package/registry/ui/page-shell.tsx +106 -51
  188. package/registry/ui/pagination.tsx +3 -1
  189. package/registry/ui/paired-chart.tsx +3827 -0
  190. package/registry/ui/placeholder.tsx +8 -2
  191. package/registry/ui/popover.tsx +4 -2
  192. package/registry/ui/progress-circle.tsx +607 -12
  193. package/registry/ui/progress.tsx +3 -1
  194. package/registry/ui/radio-group.tsx +1 -1
  195. package/registry/ui/sample-data.tsx +86 -0
  196. package/registry/ui/scatter-chart.tsx +4212 -0
  197. package/registry/ui/scroll-area.tsx +3 -2
  198. package/registry/ui/searchable-select.tsx +8 -3
  199. package/registry/ui/section-header.tsx +5 -3
  200. package/registry/ui/segmented-control.tsx +7 -2
  201. package/registry/ui/select.tsx +4 -2
  202. package/registry/ui/separator.tsx +3 -1
  203. package/registry/ui/sheet.tsx +4 -2
  204. package/registry/ui/sidebar.tsx +4 -2
  205. package/registry/ui/skeleton.tsx +4 -2
  206. package/registry/ui/slider.tsx +4 -2
  207. package/registry/ui/sparkline.tsx +84 -9
  208. package/registry/ui/spinner.tsx +3 -1
  209. package/registry/ui/states.tsx +34 -5
  210. package/registry/ui/status-badge.tsx +83 -41
  211. package/registry/ui/switch.tsx +3 -1
  212. package/registry/ui/table.tsx +4 -2
  213. package/registry/ui/tabs.tsx +5 -3
  214. package/registry/ui/textarea.tsx +3 -1
  215. package/registry/ui/toast.tsx +2 -2
  216. package/registry/ui/toggle-group.tsx +3 -1
  217. package/registry/ui/toggle.tsx +3 -1
  218. package/registry/ui/tooltip.tsx +10 -4
  219. package/registry/ui/tracker.tsx +632 -19
  220. package/registry/ui/trend-indicator.tsx +15 -3
  221. package/registry/ui/updated-at.tsx +122 -0
  222. package/registry/ui/waterfall-chart.tsx +4248 -0
  223. package/skills/vantage-design/SKILL.md +34 -24
  224. package/skills/vantage-design/references/extract.md +16 -14
  225. package/skills/vantage-design/references/format.md +6 -5
  226. package/skills/vantage-design/references/presets.md +60 -110
  227. package/skills/vantage-slide/SKILL.md +54 -36
  228. package/templates/AGENTS.md +15 -3
  229. package/templates/agents/doc.md +45 -0
  230. package/templates/agents/page.md +32 -1
  231. package/templates/agents/slide.md +55 -2
  232. package/theme.css +244 -149
  233. package/dist/chunk-5ZOP4SQR.js.map +0 -1
  234. package/dist/chunk-A2UUGASH.js.map +0 -1
  235. package/dist/chunk-AG6RZ2RR.js +0 -3208
  236. package/dist/chunk-AG6RZ2RR.js.map +0 -1
  237. package/dist/chunk-IBGOCWJB.js.map +0 -1
  238. package/dist/chunk-OB6UBJXF.js.map +0 -1
  239. package/dist/chunk-PXRX5PEC.js.map +0 -1
  240. package/dist/chunk-QEWCYW3I.js.map +0 -1
@@ -1,17 +1,49 @@
1
1
  import * as class_variance_authority_types from 'class-variance-authority/types';
2
2
  import * as React from 'react';
3
- import { HTMLAttributes, ComponentType, ReactNode, ElementType, ComponentProps, SVGAttributes } from 'react';
3
+ import { HTMLAttributes, ReactNode, ComponentType, ElementType, Ref, ReactElement, ComponentProps, SVGAttributes } from 'react';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
  import { EChartsOption } from 'echarts';
6
6
  export { EChartsOption } from 'echarts';
7
- import { ColumnDef, SortingState, OnChangeFn, ColumnFiltersState, PaginationState, RowSelectionState, VisibilityState, TableMeta, Table } from '@tanstack/react-table';
7
+ import { V as ValueFormat, a as DateStyle } from '../format-U0cQl069.js';
8
+ export { D as DEFAULT_LOCALE, E as EMPTY_VALUE, F as FormatDateOptions, b as FormatKind, c as FormatValueOptions, M as MINUS_SIGN, f as formatDate, d as formatDateRange, e as formatDatesInText, g as formatDelta, h as formatKind, i as formatPoints, j as formatValue, t as toValueFormatter } from '../format-U0cQl069.js';
9
+ import { RowData, ColumnDef, SortingState, OnChangeFn, ColumnFiltersState, PaginationState, RowSelectionState, VisibilityState, TableMeta, Table } from '@tanstack/react-table';
8
10
  export { ColumnDef, ColumnFiltersState, PaginationState, RowSelectionState, SortingState, VisibilityState } from '@tanstack/react-table';
9
11
  export { DateRange as RdpDateRange } from 'react-day-picker';
10
12
 
13
+ interface UpdatedAtProps {
14
+ /** When the data was last updated. */
15
+ at: Date | string | number;
16
+ /** `"relative"` (default): "23 分前に更新". `"absolute-first"`: "16:41 更新(23 分前)" — for pages where "now" matters. */
17
+ variant?: "relative" | "absolute-first";
18
+ /** IANA time zone (e.g. `"Asia/Tokyo"`) for the absolute time. Defaults to the runtime's zone. */
19
+ timeZone?: string;
20
+ /** Text placed before the label, e.g. `"売上データ: "`. */
21
+ prefix?: string;
22
+ /** Fixed "current time" for tests and fixtures. Disables the 60 s refresh. */
23
+ now?: Date | number;
24
+ className?: string;
25
+ }
26
+ declare const UpdatedAt: React.ForwardRefExoticComponent<UpdatedAtProps & React.RefAttributes<HTMLTimeElement>>;
27
+
11
28
  interface PageShellProps extends HTMLAttributes<HTMLDivElement> {
12
29
  }
13
30
  declare const PageShell: React.ForwardRefExoticComponent<PageShellProps & React.RefAttributes<HTMLDivElement>>;
14
31
  interface PageShellHeaderProps extends HTMLAttributes<HTMLDivElement> {
32
+ /** When the data was last updated. Drawn by `UpdatedAt` at the right end of the title row. */
33
+ updatedAt?: UpdatedAtProps["at"];
34
+ /** `"relative"` (default) or `"absolute-first"` ("16:41 更新(23 分前)") for pages where "now" matters. */
35
+ updatedAtVariant?: UpdatedAtProps["variant"];
36
+ /** IANA time zone for the absolute time of `updatedAt`. Defaults to the runtime's zone. */
37
+ timeZone?: string;
38
+ /** Where the data comes from. Shown as a chip "出典:○○" on the second row. */
39
+ source?: string;
40
+ /** The period the data covers. Shown as a chip "2026/9/23〜10/20" on the second row. */
41
+ period?: {
42
+ start: Date | string | number;
43
+ end: Date | string | number;
44
+ };
45
+ /** The page's overall state (an alert, a status badge). Shown on the third row; no row when absent. */
46
+ status?: ReactNode;
15
47
  }
16
48
  /**
17
49
  * A wrapping flex row, not a two-column grid: when the heading cannot keep its
@@ -19,6 +51,11 @@ interface PageShellHeaderProps extends HTMLAttributes<HTMLDivElement> {
19
51
  * `1fr auto` grid would instead hand the heading whatever the end block leaves,
20
52
  * and a CJK title — breakable between any two characters — collapses into a
21
53
  * one-character column.
54
+ *
55
+ * The meta props (`updatedAt`, `source`, `period`, `status`) fix the order every
56
+ * page head shares: title and update time (right end) → source / period chips →
57
+ * overall status → summary cards. Empty rows are not drawn. Rows are placed with
58
+ * flex `order`, so they land before `PageShellSummary` whatever the child order.
22
59
  */
23
60
  declare const PageShellHeader: React.ForwardRefExoticComponent<PageShellHeaderProps & React.RefAttributes<HTMLDivElement>>;
24
61
  interface PageShellHeadingProps extends HTMLAttributes<HTMLDivElement> {
@@ -42,13 +79,8 @@ declare const PageShellActions: React.ForwardRefExoticComponent<PageShellActions
42
79
  interface PageShellSummaryProps extends HTMLAttributes<HTMLDivElement> {
43
80
  }
44
81
  declare const PageShellSummary: React.ForwardRefExoticComponent<PageShellSummaryProps & React.RefAttributes<HTMLDivElement>>;
45
- /**
46
- * Accent colours are spelled out one utility set per colour rather than built
47
- * from a template string — Tailwind only emits classes it can see literally in
48
- * the source.
49
- */
50
82
  declare const pageShellSummaryCardVariants: (props?: ({
51
- accent?: "accent" | "default" | "amber" | "blue" | "emerald" | "red" | "violet" | "orange" | "cyan" | "slate" | "green" | "teal" | "sky" | "indigo" | "purple" | "pink" | "rose" | "yellow" | "lime" | "gray" | "zinc" | "neutral" | "stone" | "fuchsia" | null | undefined;
83
+ accent?: "default" | "accent" | "amber" | "blue" | "emerald" | "red" | "violet" | "orange" | "cyan" | "slate" | "green" | "teal" | "sky" | "indigo" | "purple" | "pink" | "rose" | "yellow" | "lime" | "gray" | "zinc" | "neutral" | "stone" | "fuchsia" | null | undefined;
52
84
  } & class_variance_authority_types.ClassProp) | undefined) => string;
53
85
  interface PageShellSummaryCardProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof pageShellSummaryCardVariants> {
54
86
  }
@@ -80,6 +112,8 @@ interface FilterConfig {
80
112
  options?: FilterOption[];
81
113
  /** Placeholder text */
82
114
  placeholder?: string;
115
+ /** `select` のみ。渡すと先頭に「絞り込まない」項目をこの文言で足す(例: `"すべて"`)。 */
116
+ allLabel?: string;
83
117
  /** Default value */
84
118
  defaultValue?: string | string[];
85
119
  }
@@ -179,6 +213,170 @@ type ChartEventPayload = {
179
213
  /** The clicked row of `data`, spread in. */
180
214
  [key: string]: unknown;
181
215
  } | null;
216
+ /** The theme's series tokens — the only colours a typed chart's `colors` accepts. Fixed order. */
217
+ type ChartColorToken = "chart-1" | "chart-2" | "chart-3" | "chart-4" | "chart-5";
218
+ /**
219
+ * 意味色。`"positive"`(良い)・`"warning"`(注意)・`"negative"`(悪い)・`"neutral"`(中立)。
220
+ * テーマの `--positive` / `--warning` / `--negative` / `--neutral` に解決され、light/dark に追従する。
221
+ */
222
+ type ChartTone = "positive" | "warning" | "negative" | "neutral";
223
+ /** A typed chart's series colour: a series token or a meaning colour (`ChartTone`). */
224
+ type ChartSeriesColor = ChartColorToken | ChartTone;
225
+ /**
226
+ * Series colours for a typed chart: tokens / meaning colours by series position
227
+ * (cycled), or a record from category to colour (unlisted categories keep their
228
+ * positional token).
229
+ */
230
+ type ChartColors<T extends Record<string, unknown> = Record<string, unknown>> = ChartSeriesColor[] | Partial<Record<keyof T & string, ChartSeriesColor>>;
231
+ /**
232
+ * 値の範囲で棒・セルの色(意味色)を決める 1 つの規則。`lt`(未満)・`lte`(以下)・`gt`(より大きい)・`gte`(以上)を
233
+ * 1 つ以上書く。複数書いたら全部を満たす値だけが当たる(`gte: 40, lt: 70` なら `40 <= 値 < 70`)。
234
+ * 規則は配列の上から順に見て、**最初に当たった規則**の意味色になる(どれにも当たらない値は通常色)。
235
+ * そのため厳しい規則(`gt: 10`)を先に、ゆるい規則(`gt: 7`)を後に書く。条件が 1 つも無い規則は当たらない。
236
+ * 例 `[{ gt: 10, tone: "negative" }, { gt: 7, tone: "warning" }]`(10 超は赤、7 超は黄)
237
+ */
238
+ interface ChartThreshold {
239
+ /** この値未満に当たる。 */
240
+ lt?: number;
241
+ /** この値以下に当たる。 */
242
+ lte?: number;
243
+ /** この値より大きいときに当たる(「10% 超で赤」)。 */
244
+ gt?: number;
245
+ /** この値以上に当たる。 */
246
+ gte?: number;
247
+ tone: ChartTone;
248
+ }
249
+ /** What an empty chart says instead of a blank plot. The frame keeps its height. */
250
+ interface ChartEmptyState {
251
+ /** 既定「表示できるデータがありません」。 */
252
+ title?: string;
253
+ description?: string;
254
+ /** 1 つだけ置ける操作(「期間を広げる」ボタンなど)。 */
255
+ action?: ReactNode;
256
+ }
257
+ /** `"auto"`: label the max and latest point of the first series (≤ 2 series only). */
258
+ type ChartHighlight = "auto" | "none";
259
+ /** A forecast row: the same `index` key as `data`, plus the predicted value and an optional range. */
260
+ type ChartForecastRow = Record<string, unknown> & {
261
+ value: number | null;
262
+ lower?: number;
263
+ upper?: number;
264
+ };
265
+ /**
266
+ * Forecast continuing one series (Line / Area). Always drawn as a 2px dashed, lighter
267
+ * line starting at the last actual point, with a boundary line labelled 「予測 →」
268
+ * (the same word as the legend) — there is no way to draw it solid.
269
+ */
270
+ interface ChartForecast<T extends Record<string, unknown> = Record<string, unknown>> {
271
+ /** 予測の行。`index` の列は実績と同じキーで持つ。 */
272
+ data: ChartForecastRow[];
273
+ /** 予測が続ける系列。既定 `categories[0]`(比較系列は除く)。 */
274
+ category?: keyof T & string;
275
+ /** 凡例・ツールチップ・境目の縦線の上端に出す名前。既定「予測」(境目では「予測 →」と矢印が付く)。 */
276
+ label?: string;
277
+ }
278
+ /**
279
+ * The series a Line / Area chart compares the others against (last year, the plan…): `category`
280
+ * is one of `categories`, `vs` says what it is (the same enum as `KpiCard`'s `comparison.vs`).
281
+ * It is drawn as a thin muted line with no markers and no `--chart-*` colour, and the tooltip adds
282
+ * the main series' difference from it ("↑ +12.4% 前年同月比"). Colour, width and wording are not props.
283
+ * With `vs: "custom"` the `label` names the baseline ("昨日比"); for the other `vs` it is optional.
284
+ */
285
+ type ChartComparison<K extends string = string> = {
286
+ category: K;
287
+ } & ({
288
+ vs: "prior-period" | "prior-year" | "target";
289
+ label?: string;
290
+ } | {
291
+ vs: "custom";
292
+ label: string;
293
+ });
294
+ /**
295
+ * 任意の位置への注記(折れ線・面・縦の棒)。`at` は `index` の値(例 `"2026-04"`)。`to` を足すと
296
+ * `at`〜`to` の区間(薄い帯)、無ければ `at` の位置の縦線。色は中立(意味色は使わない)で、
297
+ * `index` に無い値の注記は描かない。例 `{ at: "2026-04", label: "料金改定" }`、
298
+ * `{ at: "2026-08", to: "2026-09", label: "キャンペーン" }`
299
+ */
300
+ interface ChartAnnotation {
301
+ /** 注記の位置(区間なら始点)。`index` 列の値と同じ形で渡す。 */
302
+ at: string | number;
303
+ /** 注記の文言(短く。事実の記述だけ)。 */
304
+ label: string;
305
+ /** 区間の終点(`index` の値)。省略すると `at` の縦線。 */
306
+ to?: string | number;
307
+ }
308
+ /**
309
+ * `actions` に渡せる PNG 操作の設定。`actions={true}` は `{}` と同じ。
310
+ */
311
+ interface ChartActionsOptions {
312
+ /**
313
+ * 保存・コピーする PNG に、グラフの見出し(`title`)と要約(`summary`)を画像の上に含める。
314
+ * 見出しが無いグラフでは何も変わらない。既定 `true`(画像だけ切り出されても何のグラフか分かるように)。
315
+ * 図だけが欲しいときは `false`。
316
+ */
317
+ includeTitle?: boolean;
318
+ }
319
+ /**
320
+ * 型付きグラフのルート要素(`<figure>`)へ渡る属性。`data-*` と `aria-*` も渡る(型は不要)。
321
+ * 最小限だけ型に出す。`className` / `ariaLabel` は別に持つ。
322
+ */
323
+ type ChartRootAttributes = Pick<HTMLAttributes<HTMLElement>, "id" | "style" | "role" | "tabIndex" | "lang" | "hidden">;
324
+ /**
325
+ * Columns of `T` whose values are numbers (null / undefined allowed for gaps).
326
+ * `categories` only accepts these, so a text column like `"month"` is a type error.
327
+ * Untyped rows (`unknown` / `any` values, e.g. `Record<string, unknown>`) keep every key.
328
+ */
329
+ type NumericKeys<T> = {
330
+ [K in keyof T]-?: unknown extends T[K] ? K : T[K] extends number | bigint | null | undefined ? K : never;
331
+ }[keyof T] & string;
332
+ /** Props every typed chart shares. Per-type differences live in `areaOptions` / `lineOptions` / `barOptions`. */
333
+ interface ChartCommonProps<T extends Record<string, unknown> = Record<string, unknown>> extends ChartRootAttributes {
334
+ /** 行の配列。1 行 = x 軸の 1 点。数値の列は number か数値文字列(SQL の DECIMAL など)。 */
335
+ data: T[];
336
+ /** x 軸(カテゴリ軸)に使う列名。 */
337
+ index: keyof T & string;
338
+ /** 系列として描く列名。並び順が凡例と配色の順になる。6 つ以上は合計の大きい 5 つ +「その他」にまとめる。 */
339
+ categories: NumericKeys<T>[];
340
+ /** 系列色(`"chart-1"`〜`"chart-5"` か意味色 `"positive"` / `"warning"` / `"negative"` / `"neutral"`)。配列は系列の順、record は系列名ごと。省略時はトークン順。 */
341
+ colors?: ChartColors<T>;
342
+ /**
343
+ * index の値・系列名 → 表示名(軸・凡例・ツールチップ・データ表に反映)。例 `{ jan: "1月", sales: "売上" }`。無いキーはそのまま。
344
+ */
345
+ labels?: Record<string, string>;
346
+ /**
347
+ * 数値の書式(`"compact"` / `"number"` / `"currency"` / `"percent"` / `"multiple"` / `"duration"`、
348
+ * または `{ type, digits, currency, notation, unit, divisor, durationUnit }`)。例 `format={{ type: "number", unit: "件" }}`。
349
+ * 軸は短縮、ツールチップも同じ書式。KPI 系の `format` と同じ値を渡せる。既定 `"compact"`。
350
+ */
351
+ format?: ValueFormat;
352
+ /** 書式を関数で直接渡す逃げ道。`format` より優先する(互換のために残す)。 */
353
+ valueFormatter?: ValueFormatter;
354
+ /** グラフの見出し。 */
355
+ title?: string;
356
+ /** グラフが言っていることの 1 文要約。見出しの下に出し、グラフの `aria-describedby` になる。 */
357
+ summary?: string;
358
+ /** 読み込み中。最終形と同じ形・高さのスケルトンを出す。 */
359
+ isLoading?: boolean;
360
+ /** `data` が空のときの表示。 */
361
+ emptyState?: ChartEmptyState;
362
+ /**
363
+ * プロット領域の高さ(px)。既定 288。
364
+ * 文字列(CSS の長さ)は互換のために受けるだけで非推奨 — 数値(px)で渡す。
365
+ */
366
+ height?: number | string;
367
+ /** 生成した EChartsOption に最後に深くマージする逃げ道。 */
368
+ chartOptions?: EChartsOption;
369
+ /**
370
+ * グラフ右上に PNG 保存/コピーのボタンを出す(ホバー時。凡例とは重ならない)。既定 `false`。
371
+ * 見出し(`title` / `summary`)があれば PNG の上に含める。含めないなら `actions={{ includeTitle: false }}`。
372
+ * 例: `actions`
373
+ */
374
+ actions?: boolean | ChartActionsOptions;
375
+ /** PNG 保存時のファイル名(拡張子つき)。`actions` と使う。既定 `"chart.png"`。例: `fileName="monthly-sales.png"` */
376
+ fileName?: string;
377
+ className?: string;
378
+ ariaLabel?: string;
379
+ }
182
380
 
183
381
  interface AppShellSidebarProps {
184
382
  variant?: "sidebar";
@@ -206,8 +404,8 @@ declare const AppShell: React.ForwardRefExoticComponent<AppShellProps & React.Re
206
404
 
207
405
  declare const headingStyles: {
208
406
  readonly h1: "text-3xl font-bold tracking-tight";
209
- readonly h2: "text-2xl font-semibold tracking-tight";
210
- readonly h3: "text-xl font-semibold";
407
+ readonly h2: "text-base font-semibold tracking-tight";
408
+ readonly h3: "text-base font-semibold";
211
409
  readonly h4: "text-lg font-semibold";
212
410
  };
213
411
  interface SectionHeaderProps {
@@ -220,6 +418,10 @@ interface SectionHeaderProps {
220
418
  declare const SectionHeader: React.ForwardRefExoticComponent<SectionHeaderProps & React.RefAttributes<HTMLDivElement>>;
221
419
 
222
420
  interface DashboardCardProps extends HTMLAttributes<HTMLDivElement> {
421
+ /** 親の grid の何行にまたがって subgrid で揃えるか(ヘッダー・本文・フッターなら 3、ヘッダー・本文なら 2)。未指定なら通常のブロック。 */
422
+ subgrid?: 2 | 3;
423
+ /** `"sm"` は一段小さい余白。Sheet の中などで 2 枚を横に並べるとき。既定 `"default"`。 */
424
+ size?: "default" | "sm";
223
425
  }
224
426
  declare const DashboardCard: React.ForwardRefExoticComponent<DashboardCardProps & React.RefAttributes<HTMLDivElement>>;
225
427
  interface DashboardCardHeaderProps extends HTMLAttributes<HTMLDivElement> {
@@ -244,7 +446,7 @@ interface DashboardCardSkeletonProps {
244
446
  className?: string;
245
447
  }
246
448
  declare function DashboardCardSkeleton({ className }: DashboardCardSkeletonProps): React.JSX.Element;
247
- interface DashboardCardPresetProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
449
+ interface DashboardCardPresetProps extends Omit<HTMLAttributes<HTMLDivElement>, "title">, Pick<DashboardCardProps, "subgrid" | "size"> {
248
450
  title?: ReactNode;
249
451
  description?: ReactNode;
250
452
  actions?: ReactNode;
@@ -253,7 +455,7 @@ interface DashboardCardPresetProps extends Omit<HTMLAttributes<HTMLDivElement>,
253
455
  contentClassName?: string;
254
456
  footerClassName?: string;
255
457
  }
256
- declare function DashboardCardPreset({ title, description, actions, footer, children, headerClassName, contentClassName, footerClassName, className, ...props }: DashboardCardPresetProps): React.JSX.Element;
458
+ declare function DashboardCardPreset({ title, description, actions, footer, children, headerClassName, contentClassName, footerClassName, className, subgrid, ...props }: DashboardCardPresetProps): React.JSX.Element;
257
459
 
258
460
  interface EChartProps {
259
461
  /**
@@ -264,7 +466,7 @@ interface EChartProps {
264
466
  * literal が `string` に拡張され、ビルドが失敗する。
265
467
  *
266
468
  * @example
267
- * import type { EChartsOption } from "@squadbase/vantage/components"
469
+ * import type { EChartsOption } from "@/components/echart"
268
470
  *
269
471
  * const option: EChartsOption = {
270
472
  * xAxis: { type: "category", data: ["A", "B"] },
@@ -295,29 +497,265 @@ interface EChartProps {
295
497
  onEvents?: Record<string, (params: unknown) => void>;
296
498
  ariaLabel?: string;
297
499
  className?: string;
298
- /** true にするとチャート右上に PNG コピー / ダウンロードボタンを表示する */
299
- actions?: boolean;
500
+ /**
501
+ * true にするとチャート右上に PNG コピー / ダウンロードボタンを表示する。
502
+ * `exportHeader` があれば PNG の上にその見出しを含める(`{ includeTitle: false }` で含めない)。
503
+ */
504
+ actions?: boolean | ChartActionsOptions;
300
505
  /** ダウンロード時のファイル名(拡張子含む)。省略時は "chart.png" */
301
506
  fileName?: string;
507
+ /**
508
+ * PNG の上に含める見出しと要約。型付きグラフは自分の `title` / `summary` を渡す。
509
+ * 自分で `ChartFrame` を組むときも同じものを渡すと、保存した画像だけで何のグラフか分かる。
510
+ */
511
+ exportHeader?: ChartExportHeader;
512
+ }
513
+ /** The heading a saved PNG carries above the plot. */
514
+ interface ChartExportHeader {
515
+ title?: string;
516
+ summary?: string;
302
517
  }
518
+ /**
519
+ * Canvas-safe versions of theme colours, kept current across light/dark.
520
+ * Takes `"chart-1"`〜`"chart-5"`, `"var(--token)"` or any CSS colour; one that
521
+ * can't be resolved comes back as `""` (ECharts then uses the palette).
522
+ * Use it whenever a colour goes into a raw `EChart` option by hand.
523
+ *
524
+ * @example
525
+ * const [line, band] = useResolvedChartColors(["chart-1", "var(--muted-foreground)"])
526
+ */
527
+ declare function useResolvedChartColors(colors: readonly string[]): string[];
303
528
  declare const EChart: React.ForwardRefExoticComponent<EChartProps & React.RefAttributes<HTMLDivElement>>;
304
529
 
530
+ /**
531
+ * Period-over-period / target comparison for KPIs. A rate is only produced when
532
+ * the baseline is a non-zero number; small moves inside the neutral band read
533
+ * as flat, and polarity decides whether up is good or bad.
534
+ *
535
+ * Labels follow Japanese business usage and come from the grain of the period:
536
+ * a monthly KPI compares "前月比" / "前年同月比", a quarterly one "前四半期比" /
537
+ * "前年同期比". Without a grain the label is the generic "前期比".
538
+ *
539
+ * A running total of a period still in progress (年初来・月初来 = YTD / MTD) sets
540
+ * `toDate: true`: a `prior-year` baseline is then the same stretch of the prior year,
541
+ * and the label is always "前年同期比" (never "前年比", which would mean a whole year
542
+ * against a whole year), whatever the grain.
543
+ *
544
+ * Any other baseline is `vs: "custom"` with a `label` ("昨日比"). The baseline of
545
+ * the previous-actual line is derived from that label ("昨日"), so the badge and
546
+ * the line never name different things.
547
+ */
548
+
549
+ type ComparisonKind = "prior-period" | "prior-year" | "target" | "custom";
550
+ /**
551
+ * 増減の良し悪しの向き。`"neutral"` は増減どちらでも sentiment を neutral にする(例: 在庫数)。
552
+ * @example polarity="neutral"
553
+ */
554
+ type Polarity = "higher-is-better" | "lower-is-better" | "neutral";
555
+ /** Length of the period a value covers. */
556
+ type PeriodGrain = "day" | "week" | "month" | "quarter" | "year";
557
+ interface ComparisonBase {
558
+ previous: number | null | undefined;
559
+ /** Grain of the period, which picks the label: `"month"` → "前月比" / "前年同月比". */
560
+ grain?: PeriodGrain;
561
+ /**
562
+ * The value is a running total of the period so far (年初来・月初来), not a closed period.
563
+ * With `vs: "prior-year"` the label is "前年同期比" (the same stretch of last year) whatever the `grain`.
564
+ * Leave it off for a closed period: a full year against the prior year is "前年比".
565
+ */
566
+ toDate?: boolean;
567
+ }
568
+ type Comparison = (ComparisonBase & {
569
+ vs: Exclude<ComparisonKind, "custom">;
570
+ /** The badge's full name ("先週比"). Overrides the derived label; the previous-actual line takes its name from it too. */
571
+ label?: string;
572
+ }) | (ComparisonBase & {
573
+ /** Any other baseline ("昨日", "先週の同じ曜日"): the `label` names it. */
574
+ vs: "custom";
575
+ /** The badge's full name: `"昨日比"` / `"先週の同じ曜日比"`. The previous-actual line drops one trailing "比" ("昨日 617"). */
576
+ label: string;
577
+ });
578
+ /** Labels used when the grain is unknown. A `custom` comparison always brings its own `label`. */
579
+ declare const COMPARISON_LABELS: Record<Exclude<ComparisonKind, "custom">, string>;
580
+ /**
581
+ * What the previous value is called: "前月" / "前年同月" / "目標"; with a `label`, that label minus one trailing "比" ("昨日比" → "昨日").
582
+ * `toDate` (a running total such as YTD) turns a `prior-year` baseline into "前年同期" whatever the grain.
583
+ */
584
+ declare function comparisonBaseline(vs: ComparisonKind, grain?: PeriodGrain, label?: string, toDate?: boolean): string;
585
+ /**
586
+ * The comparison label: "前月比" for `("prior-period", "month")`, "前期比" without a grain; a given `label` as is.
587
+ * A running total (`toDate`) against the prior year is "前年同期比", not "前年比".
588
+ */
589
+ declare function comparisonLabel(vs: ComparisonKind, grain?: PeriodGrain, label?: string, toDate?: boolean): string;
590
+ type DeltaDirection = "up" | "down" | "flat" | "none";
591
+ type DeltaSentiment = "positive" | "negative" | "neutral";
592
+ interface ComparisonResult {
593
+ current: number | null;
594
+ previous: number | null;
595
+ /** `current − previous` in the metric's own unit (a ratio difference for a rate). `null` when either is missing. */
596
+ difference: number | null;
597
+ /** `difference / |previous|`. `null` when it cannot be computed (missing values or a zero baseline). */
598
+ ratio: number | null;
599
+ direction: DeltaDirection;
600
+ sentiment: DeltaSentiment;
601
+ label: string;
602
+ vs: ComparisonKind;
603
+ }
604
+ interface ComparisonOptions {
605
+ polarity?: Polarity;
606
+ /** Absolute ratio below which the change reads as flat (0.01 = 1%). Default 0.01. */
607
+ neutralBand?: number;
608
+ }
609
+ declare function computeComparison(current: number | null | undefined, comparison: Comparison, options?: ComparisonOptions): ComparisonResult;
610
+ /**
611
+ * How a change is expressed: `"relative"` = change rate ("+12.4%"), `"points"` =
612
+ * difference of two rates in percentage points ("−0.5pt"), `"difference"` =
613
+ * absolute difference in the metric's own format ("+¥530万"; pass `format` to `formatChange`).
614
+ */
615
+ type ChangeDisplay = "relative" | "points" | "difference";
616
+ /** `"points"` for a `percent` metric (a rate), else `"relative"`. */
617
+ declare function defaultChangeDisplay(format: ValueFormat | undefined): ChangeDisplay;
618
+ /**
619
+ * The change as shown next to a KPI: "+12.4%" (relative) or "−0.5pt" (points).
620
+ * Returns `null` when the values cannot be compared.
621
+ *
622
+ * @param digits - Fixed fraction digits of the change, for `"relative"` and `"points"`
623
+ * (not `"difference"`, which follows `format`). Default `PERCENT_DIGITS` (1), so
624
+ * "+14.0%" and "+11.9%" line up. Pass the same count to every card in a group.
625
+ */
626
+ declare function formatChange(result: ComparisonResult, display?: ChangeDisplay, locale?: string,
627
+ /** `"difference"` 表示で使う値の format。例: `"currency"`。 */
628
+ format?: ValueFormat,
629
+ /** `"relative"` / `"points"` 表示の小数桁数(固定)。例: `2` → "+0.14pt"。未指定は 1 桁。 */
630
+ digits?: number): string | null;
631
+ /**
632
+ * The size of the change with **no sign**, for a sentence or a screen-reader text that
633
+ * already says the direction with a verb ("0.5pt 下がりました", "前月比 12.4% 減少"): a signed
634
+ * "−0.5pt 下がりました" negates twice. Same arguments as `formatChange`; `null` when the
635
+ * values cannot be compared.
636
+ */
637
+ declare function formatChangeAmount(result: ComparisonResult, display?: ChangeDisplay, locale?: string, format?: ValueFormat, digits?: number): string | null;
638
+ /**
639
+ * The tone of the first threshold rule `value` falls in, or `undefined` (a value
640
+ * no rule matches keeps the normal colour). A rule matches when every bound it
641
+ * carries holds: `value < lt`, `value <= lte`, `value > gt`, `value >= gte`
642
+ * (`gt` / `lte` are the strict-inclusive counterparts, so「10% 超」is `gt: 10`).
643
+ * Rules are tried in array order and the first match wins — put the strict rule
644
+ * first (`gt: 10` before `gt: 7`). A rule with no bound never matches. Gaps (`null`) match nothing.
645
+ */
646
+ declare function toneForValue(value: number | null | undefined, thresholds: readonly ChartThreshold[] | undefined): ChartTone | undefined;
647
+
648
+ /**
649
+ * ECharts option builders behind the typed charts (AreaChart, BarChart,
650
+ * LineChart, DonutChart). They turn the Tremor-style props — `data` rows, an
651
+ * `index` key and `categories` — into an `EChartsOption` for `EChart`, which
652
+ * keeps owning the canvas and the token theme.
653
+ *
654
+ * Pure functions of their input: colours arrive already resolved to
655
+ * canvas-safe strings (`resolveChartColors` in `chart-theme.ts`), so everything
656
+ * here is unit-testable without a DOM. Internal; inlined into each copy.
657
+ */
658
+
305
659
  type CartesianStackType = "default" | "stacked" | "percent";
306
660
  type CartesianCurveType = "linear" | "smooth" | "step";
307
661
  type AreaFill = "gradient" | "solid" | "none";
308
662
  type BarLayout = "horizontal" | "vertical";
663
+ /** AreaChart-only settings. */
664
+ interface AreaChartOptions {
665
+ /** `"stacked"` は積み上げ、`"percent"` は各点の合計を 100% にした積み上げ。既定 `"default"`。 */
666
+ type?: CartesianStackType;
667
+ /** 線の形。既定 `"linear"`。 */
668
+ curveType?: CartesianCurveType;
669
+ /** 面の塗り。既定 `"gradient"`。 */
670
+ fill?: AreaFill;
671
+ /** 値の欠けた点(`null` など)をまたいで線をつなぐ。既定 `false`。 */
672
+ connectNulls?: boolean;
673
+ }
674
+ /** LineChart-only settings. */
675
+ interface LineChartOptions {
676
+ /** 線の形。既定 `"linear"`。 */
677
+ curveType?: CartesianCurveType;
678
+ /** 値の欠けた点(`null` など)をまたいで線をつなぐ。既定 `false`。 */
679
+ connectNulls?: boolean;
680
+ /** 値軸を 0 からではなくデータの範囲に合わせる。既定 `false`(0 起点)。最小の目盛ラベルは先頭の x ラベルと重なるので出さない(グリッド線は残る)。 */
681
+ fitToData?: boolean;
682
+ /**
683
+ * 目標線(`target`)のラベルの置き場所。`"start"`(既定)は線の左端の上(最大・最新の強調と近いときは下)。
684
+ * `"end"` は線の右端の上。`"legend"` は凡例だけに出し、線の上には出さない(線の周りが混み合うとき)。
685
+ * 目標の呼び名は、どれを選んでも凡例に出る。
686
+ */
687
+ targetLabelPosition?: LineTargetLabelPosition;
688
+ }
689
+ /** Where a line chart prints its target label: at the line's left end, its right end, or in the legend only. */
690
+ type LineTargetLabelPosition = "start" | "end" | "legend";
691
+ /** BarChart-only settings. */
692
+ interface BarChartOptions<T extends Record<string, unknown> = Record<string, unknown>> {
693
+ /** `"stacked"` は積み上げ、`"percent"` は各カテゴリの合計を 100% にした積み上げ。既定 `"default"`(横並び)。 */
694
+ type?: CartesianStackType;
695
+ /**
696
+ * 棒の向き。既定 `"horizontal"`(カテゴリが横に並ぶ縦棒)。`"vertical"` はカテゴリを
697
+ * 縦に並べた横棒で、ラベルの長いランキングに向く(先頭の行が一番上)。
698
+ */
699
+ layout?: BarLayout;
700
+ /** カテゴリ間の隙間(`"20%"` や px)。省略時は ECharts の既定。 */
701
+ barCategoryGap?: string | number;
702
+ /**
703
+ * 値が 0 の棒に「0」の値ラベルを付ける。棒が描かれない 0 が「データなし」に見えるのを防ぐ
704
+ * (在庫 0・件数 0 など)。積み上げでは付けない。0 以外の棒の見た目は変わらない。既定 `true`。
705
+ */
706
+ showZeroValues?: boolean;
707
+ /**
708
+ * 棒ごとの目標値が入った `data` の列名(行ごとの目標。店舗別の月次目標など)。各棒に短い目標マーカーを
709
+ * 引き、ツールチップに「目標 … (達成率 …%)」を足す。凡例に目標の呼び名(`targetLabel`、既定「目標」)が出る。
710
+ * 1 系列の棒と積み上げ(達成率は合計に対して)で使える。横並びの複数系列と 100% 積み上げでは描かない。
711
+ * 値が欠けた(null・0 以下の)行はマーカーを引かない。
712
+ *
713
+ * 優先順位: `targetKey` を渡すと 1 本の目標線 `target` は描かない(`targetLabel` はマーカーの呼び名として使う)。
714
+ * 値による色分け `thresholds` とは併用できる(色は棒、マーカーは目標)。値軸は最大の目標を含む。
715
+ * 例: `barOptions={{ targetKey: "月次目標" }}`
716
+ */
717
+ targetKey?: NumericKeys<T>;
718
+ /**
719
+ * 横棒(`layout: "vertical"`)の 1 系列で伝えたい 1 本。`index` の値で渡す(例 `"東京店"`)。
720
+ * 横棒は淡い色(`--chart-1` の薄い塗り)が既定で、この 1 本だけ濃い色(系列色そのまま)になる。省略すると全部が淡い色。
721
+ * 縦棒・複数系列・積み上げでは効かない(色は変わらない)。意味色の `thresholds` に当たった棒はそちらの色が優先。
722
+ * 例: `barOptions={{ layout: "vertical", highlight: "東京店" }}`
723
+ */
724
+ highlight?: string | number;
725
+ }
309
726
  /** Props every cartesian typed chart (Area / Bar / Line) shares. */
310
- interface CartesianChartBaseProps {
311
- /** 行の配列。1 行 = x 軸の 1 点。数値の列は number か数値文字列(SQL の DECIMAL など)。 */
312
- data: Record<string, unknown>[];
313
- /** x 軸(カテゴリ軸)に使う列名。 */
314
- index: string;
315
- /** 系列として描く列名。並び順が凡例と配色の順になる。 */
316
- categories: string[];
317
- /** 系列色。`"chart-1"`〜`"chart-5"` か CSS カラー。省略時はテーマのトークン順。足りなければ繰り返す。 */
318
- colors?: ChartColor[];
319
- /** 軸目盛りとツールチップの数値の書式。 */
320
- valueFormatter?: ValueFormatter;
727
+ interface CartesianChartBaseProps<T extends Record<string, unknown> = Record<string, unknown>> extends ChartCommonProps<T> {
728
+ /**
729
+ * 最大値と最新値に値ラベルを付ける(最初の系列だけ・系列が 2 つ以下のときだけ・最大 2 つ)。
730
+ * 100% 積み上げの面グラフでは、最初の系列(一番下の帯)の最初と最新の比率(「24%」「31%」)を帯の中に付ける。
731
+ * 既定は Line / Area が `"auto"`、Bar は `index` が日付・年月・年のときだけ `"auto"`。
732
+ */
733
+ highlight?: ChartHighlight;
734
+ /**
735
+ * ここから先は確定前(速報)の点。index の値で渡す(例 `"2026-09"`)。薄い色・点線(棒は薄い塗りと破線の縁)で
736
+ * 描き、凡例・ツールチップに `provisionalLabel` を出す。線・面は確定の最終点とつなぐ。`forecast`(予測)とは別物。
737
+ * 例: `provisionalFrom="2026-09"`
738
+ */
739
+ provisionalFrom?: string | number;
740
+ /** 速報の呼び名(凡例・ツールチップ)。既定「速報」。例: `provisionalLabel="暫定"` */
741
+ provisionalLabel?: string;
742
+ /**
743
+ * グラフが言っていることの 1 文要約(自由文)。`"auto"` なら data から機械的に組む
744
+ * (「<見出し>: 最新 <index値> は <値>、前の点より増加/減少」。向きは最新 2 点の値で決まる)。
745
+ * 増減の向きを文に書くなら `"auto"` を使うか data から作る — 手書きの向きは data とずれて誤る。
746
+ * 省略時は要約なし(既存どおり)。例: `summary="auto"`
747
+ */
748
+ summary?: string | "auto";
749
+ /** 目標値。点線の水平線で示し、値軸は必ずこの値を含む。棒ごとの目標(`barOptions.targetKey`)を渡したときは描かない。 */
750
+ target?: number;
751
+ /** 目標線のラベル。既定「目標 <書式化した値>」。`barOptions.targetKey` のときはマーカーの呼び名(既定「目標」)。 */
752
+ targetLabel?: string;
753
+ /**
754
+ * 任意の位置への注記(縦の線、または `to` で区間の帯)。折れ線・面・縦の棒(`barOptions.layout` が既定のとき)で使え、
755
+ * 横棒では描かない。`at` / `to` は `index` の値。色は中立で、ツールチップにも文言が出る。例:
756
+ * `annotations={[{ at: "2026-04", label: "料金改定" }, { at: "2026-08", to: "2026-09", label: "キャンペーン" }]}`
757
+ */
758
+ annotations?: ChartAnnotation[];
321
759
  /** 凡例を出す。既定 `true`。 */
322
760
  showLegend?: boolean;
323
761
  /** ホバー時のツールチップを出す。既定 `true`。 */
@@ -330,9 +768,18 @@ interface CartesianChartBaseProps {
330
768
  startEndOnly?: boolean;
331
769
  /** y 軸ラベルの幅(px)。並べた複数グラフのプロット領域を揃えたいときに固定する。 */
332
770
  yAxisWidth?: number;
771
+ /**
772
+ * 値軸の下限。Bar / Area は常に 0 起点なので、0 以下の値だけ有効(負の値の下に余白を取る。正の値は無視)。
773
+ * Line は指定した値から始める。データが下限を下回るときは軸を広げる(切り詰めない)。
774
+ * 並べて比べる複数のグラフには同じ値を渡して軸をそろえる。
775
+ */
333
776
  minValue?: number;
777
+ /**
778
+ * 値軸の上限(横棒は横軸)。データが上限を超えるときは軸を広げる(切り詰めない)。
779
+ * 並べて比べる複数のグラフには同じ値を渡して軸をそろえる。
780
+ */
334
781
  maxValue?: number;
335
- /** 値軸を 0 からではなくデータの範囲に合わせる。 */
782
+ /** @deprecated `lineOptions.fitToData` を使う。Bar / Area では無視される(常に 0 起点)。 */
336
783
  autoMinValue?: boolean;
337
784
  /** `false` で値軸の目盛りを整数に限る。 */
338
785
  allowDecimals?: boolean;
@@ -343,73 +790,195 @@ interface CartesianChartBaseProps {
343
790
  * 足して渡し、同じ点をもう一度クリックすると `null`。渡すと選択以外が薄くなる。
344
791
  */
345
792
  onValueChange?: (value: ChartEventPayload) => void;
346
- /** 高さ。数値は px。省略時は `h-80`(320px)で、`className` の高さクラスが勝つ。 */
347
- height?: string | number;
793
+ /** @deprecated `isLoading` を使う。 */
348
794
  loading?: boolean;
349
- ariaLabel?: string;
350
- className?: string;
351
795
  }
352
796
  type DonutVariant = "donut" | "pie";
797
+ /** What the donut prints in its hole (`donutOptions.centerLabel`). */
798
+ type DonutCenterLabel = "none" | "total" | "top";
799
+ /** DonutChart-only settings. */
800
+ interface DonutChartOptions {
801
+ /** `"donut"`(中央に穴とラベル)か `"pie"`。既定 `"donut"`。 */
802
+ variant?: DonutVariant;
803
+ /** @deprecated `centerLabel` を使う。`false` は `centerLabel: "none"` と同じ。`true` を明示すると `"total"` 扱い(以前の既定)。 */
804
+ showLabel?: boolean;
805
+ /**
806
+ * 穴の中央に出すもの。`"none"`(既定。何も出さない。合計は KPI と重複しがち)/ `"total"`(「合計」と
807
+ * 合計を書式化した値。`totalLabel` / `unit` を添える)/ `"top"`(最大の切片の名前と構成比)。
808
+ * それ以外のノードを渡すとそのまま中央に置く。donut のみ。
809
+ */
810
+ centerLabel?: DonutCenterLabel | ReactNode;
811
+ /** 中央ラベルの見出し(何の合計か)。既定「合計」。 */
812
+ totalLabel?: string;
813
+ /** 中央ラベルの合計に添える単位(`"セッション"` → 「9.2万 セッション」)。 */
814
+ unit?: string;
815
+ /** 凡例(名前と構成比、大きい順)を出す。広いときは右、狭いときは下。既定 `true`。構成比は凡例だけが持つ(凡例を消すと、広いときだけ大きい 2 切片に外ラベルで名前と構成比が出る)。 */
816
+ showLegend?: boolean;
817
+ /** 個別に描く切片の数。超えた分は大きさ順の残りを「その他」1 切片にまとめる。既定 5。 */
818
+ maxSlices?: number;
819
+ }
353
820
 
354
- interface AreaChartProps extends CartesianChartBaseProps {
355
- /** `"stacked"` は積み上げ、`"percent"` は各点の合計を 100% にした積み上げ。既定 `"default"`。 */
821
+ /**
822
+ * AreaChart — a typed area chart over `EChart`: pass rows, the x-axis key
823
+ * (`index`) and the series keys (`categories`) instead of an ECharts option.
824
+ * Colours are the `--chart-1..5` tokens in fixed order (more than 5 series fold
825
+ * into「その他」) and follow light/dark. The value axis always starts at 0.
826
+ * Renders inside `ChartFrame` (title, summary, loading skeleton, empty state).
827
+ * Reach for `chartOptions` — or `EChart` itself — only when this API lacks something.
828
+ */
829
+
830
+ interface AreaChartProps<T extends Record<string, unknown> = Record<string, unknown>> extends CartesianChartBaseProps<T> {
831
+ /** 面グラフ固有の設定(積み上げ・線の形・塗り・欠損の扱い)。同名のフラットな props より優先。 */
832
+ areaOptions?: AreaChartOptions;
833
+ /** 予測。最初の系列(または `forecast.category`)の続きを点線と薄い帯で描く。 */
834
+ forecast?: ChartForecast<T>;
835
+ /**
836
+ * 比較系列。`categories` のうち 1 つを「前年」「計画」などの比較の線にする(`vs` は KpiCard と同じ語彙)。
837
+ * 比較系列は `--chart-*` を使わず、細い(1.5px)灰色の実線でマーカーなし・塗りなし。主系列の色は比較の有無で変わらない。
838
+ * ツールチップは最初の主系列の行に「↑ +12.4% 前年同月比」を添え、比較系列の行は値のみ。
839
+ * 例: `comparison={{ category: "前年", vs: "prior-year" }}`
840
+ */
841
+ comparison?: ChartComparison<NumericKeys<T>>;
842
+ /** @deprecated `areaOptions.type` を使う。 */
356
843
  type?: CartesianStackType;
357
- /** 線の形。既定 `"linear"`。 */
844
+ /** @deprecated `areaOptions.curveType` を使う。 */
358
845
  curveType?: CartesianCurveType;
359
- /** 面の塗り。既定 `"gradient"`。 */
846
+ /** @deprecated `areaOptions.fill` を使う。 */
360
847
  fill?: AreaFill;
361
- /** 値の欠けた点(`null` など)をまたいで線をつなぐ。既定 `false`。 */
848
+ /** @deprecated `areaOptions.connectNulls` を使う。 */
362
849
  connectNulls?: boolean;
363
850
  }
364
- declare const AreaChart: React.ForwardRefExoticComponent<AreaChartProps & React.RefAttributes<HTMLDivElement>>;
851
+ /** Generic over the row type, so `index` / `categories` / `colors` keys are checked against `data`. */
852
+ declare const AreaChart: (<T extends Record<string, unknown>>(props: AreaChartProps<T> & {
853
+ ref?: Ref<HTMLDivElement>;
854
+ }) => ReactElement) & {
855
+ displayName?: string;
856
+ };
365
857
 
366
- interface BarChartProps extends CartesianChartBaseProps {
367
- /** `"stacked"` は積み上げ、`"percent"` は各カテゴリの合計を 100% にした積み上げ。既定 `"default"`(横並び)。 */
368
- type?: CartesianStackType;
858
+ /**
859
+ * BarChart — a typed bar chart over `EChart`: pass rows, the category key
860
+ * (`index`) and the series keys (`categories`) instead of an ECharts option.
861
+ * Grouped, stacked or 100%-stacked; vertical or horizontal bars. Colours are the
862
+ * `--chart-1..5` tokens in fixed order (more than 5 series fold into「その他」)
863
+ * and follow light/dark. The value axis always starts at 0. A horizontal bar chart of one
864
+ * series (`barOptions.layout: "vertical"`) is a light tint by default, like BarList; `barOptions.highlight`
865
+ * names the one bar the page is about, drawn in the full colour.
866
+ * Renders inside `ChartFrame` (title, summary, loading skeleton, empty state).
867
+ * Reach for `chartOptions` — or `EChart` itself — only when this API lacks something.
868
+ */
869
+
870
+ interface BarChartProps<T extends Record<string, unknown> = Record<string, unknown>> extends CartesianChartBaseProps<T> {
871
+ /** 棒グラフ固有の設定(積み上げ・向き・カテゴリ間の隙間)。同名のフラットな props より優先。予測は持たない。 */
872
+ barOptions?: BarChartOptions<T>;
369
873
  /**
370
- * 棒の向き。既定 `"horizontal"`(カテゴリが横に並ぶ縦棒)。`"vertical"` はカテゴリを
371
- * 縦に並べた横棒で、ラベルの長いランキングに向く(先頭の行が一番上)。
874
+ * 棒を値で色分けする(上から順に最初に当たった規則の意味色。棒の面なので文字用の `--<tone>` ではなく面用の `--<tone>-fill` で塗る。どれにも当たらない棒は通常色)。
875
+ * 規則は `lt`(未満)・`lte`(以下)・`gt`(より大きい)・`gte`(以上)。複数系列(横並び)では系列ごとの棒に効き、当たった棒は意味色で塗って縁に系列色を残す(凡例と結べる)。
876
+ * 積み上げでは無視(一部分の値は良し悪しを判定する量ではないため。系列色のまま)。
877
+ * 例 `[{ gt: 2, tone: "negative" }, { gt: 1.5, tone: "warning" }]`(2 超は赤、1.5 超は黄)
372
878
  */
879
+ thresholds?: ChartThreshold[];
880
+ /** @deprecated `barOptions.type` を使う。 */
881
+ type?: CartesianStackType;
882
+ /** @deprecated `barOptions.layout` を使う。 */
373
883
  layout?: BarLayout;
374
- /** カテゴリ間の隙間(`"20%"` や px)。省略時は ECharts の既定。 */
884
+ /** @deprecated `barOptions.barCategoryGap` を使う。 */
375
885
  barCategoryGap?: string | number;
376
886
  }
377
- declare const BarChart: React.ForwardRefExoticComponent<BarChartProps & React.RefAttributes<HTMLDivElement>>;
887
+ /** Generic over the row type, so `index` / `categories` / `colors` keys are checked against `data`. */
888
+ declare const BarChart: (<T extends Record<string, unknown>>(props: BarChartProps<T> & {
889
+ ref?: Ref<HTMLDivElement>;
890
+ }) => ReactElement) & {
891
+ displayName?: string;
892
+ };
378
893
 
379
- interface LineChartProps extends CartesianChartBaseProps {
380
- /** 線の形。既定 `"linear"`。 */
894
+ /**
895
+ * LineChart — a typed line chart over `EChart`: pass rows, the x-axis key
896
+ * (`index`) and the series keys (`categories`) instead of an ECharts option.
897
+ * Colours are the `--chart-1..5` tokens in fixed order (more than 5 series fold
898
+ * into「その他」) and follow light/dark. The value axis starts at 0 unless
899
+ * `lineOptions.fitToData`.
900
+ * Renders inside `ChartFrame` (title, summary, loading skeleton, empty state).
901
+ * Reach for `chartOptions` — or `EChart` itself — only when this API lacks something.
902
+ */
903
+
904
+ interface LineChartProps<T extends Record<string, unknown> = Record<string, unknown>> extends CartesianChartBaseProps<T> {
905
+ /** 折れ線固有の設定(線の形・欠損の扱い・値軸をデータに合わせるか・目標ラベルの位置 `targetLabelPosition`)。同名のフラットな props より優先。 */
906
+ lineOptions?: LineChartOptions;
907
+ /** 予測。最初の系列(または `forecast.category`)の続きを点線と薄い帯で描く。 */
908
+ forecast?: ChartForecast<T>;
909
+ /**
910
+ * 比較系列。`categories` のうち 1 つを「前年」「計画」などの比較の線にする(`vs` は KpiCard と同じ語彙)。
911
+ * 比較系列は `--chart-*` を使わず、細い(1.5px)灰色の実線でマーカーなし。主系列の色は比較の有無で変わらない。
912
+ * ツールチップは最初の主系列の行に「↑ +12.4% 前年同月比」を添え、比較系列の行は値のみ。
913
+ * 例: `comparison={{ category: "前年", vs: "prior-year" }}`
914
+ */
915
+ comparison?: ChartComparison<NumericKeys<T>>;
916
+ /** @deprecated `lineOptions.curveType` を使う。 */
381
917
  curveType?: CartesianCurveType;
382
- /** 値の欠けた点(`null` など)をまたいで線をつなぐ。既定 `false`。 */
918
+ /** @deprecated `lineOptions.connectNulls` を使う。 */
383
919
  connectNulls?: boolean;
384
920
  }
385
- declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<HTMLDivElement>>;
921
+ /** Generic over the row type, so `index` / `categories` / `colors` keys are checked against `data`. */
922
+ declare const LineChart: (<T extends Record<string, unknown>>(props: LineChartProps<T> & {
923
+ ref?: Ref<HTMLDivElement>;
924
+ }) => ReactElement) & {
925
+ displayName?: string;
926
+ };
927
+
928
+ /**
929
+ * DonutChart — a typed donut / pie chart over `EChart`: pass rows, the label
930
+ * key (`index`) and the value key (`categories: [valueKey]`). Slices are sorted
931
+ * largest first and coloured with the `--chart-1..5` tokens in fixed order;
932
+ * more than 5 fold into one「その他」slice. The hole is empty by default (the
933
+ * total usually repeats a KPI); `donutOptions.centerLabel` picks `"total"`
934
+ * (「合計」+ the formatted total, plus `unit`), `"top"` (the largest slice and its
935
+ * share) or a custom node — plain HTML over the canvas, so it takes the page's
936
+ * type and colours. A share is printed once: the HTML legend lists every slice
937
+ * with its share, right of the ring when there is room, below it otherwise, and
938
+ * with the legend there are no outside labels (without it, a plot at least
939
+ * `DONUT_OUTSIDE_LABEL_MIN_WIDTH` wide labels its 2 largest slices).
940
+ * Renders inside `ChartFrame` (title, summary, loading skeleton, empty state,
941
+ * and a visually-hidden table of the slices).
942
+ */
386
943
 
387
- interface DonutChartProps {
388
- /** 行の配列。1 行 = 1 切片。 */
389
- data: Record<string, unknown>[];
944
+ interface DonutChartProps<T extends Record<string, unknown> = Record<string, unknown>> extends Omit<ChartCommonProps<T>, "index" | "categories" | "colors"> {
390
945
  /** 切片の名前に使う列名。 */
391
- category: string;
392
- /** 切片の大きさに使う列名(number か数値文字列)。0 以下と欠損は 0 扱い。 */
393
- value: string;
394
- /** 切片の色(行の順)。`"chart-1"`〜`"chart-5"` か CSS カラー。省略時はトークン順で、足りなければ繰り返す。 */
395
- colors?: ChartColor[];
396
- /** `"donut"`(中央に穴とラベル)か `"pie"`。既定 `"donut"`。 */
397
- variant?: DonutVariant;
398
- /** ツールチップと中央ラベルの数値の書式。 */
399
- valueFormatter?: ValueFormatter;
400
- /** 中央ラベル。省略時は合計を `valueFormatter` で書いたもの。donut のみ。 */
401
- label?: ReactNode;
402
- /** 中央ラベルを出す。既定 `true`(donut のみ)。 */
403
- showLabel?: boolean;
946
+ index?: keyof T & string;
947
+ /** 切片の大きさに使う列名を 1 つだけ入れた配列(`["売上"]`)。2 つ以上渡しても最初の 1 つだけを使う。 */
948
+ categories?: (keyof T & string)[];
949
+ /** 切片の色(大きい順)。`"chart-1"`〜`"chart-5"` か意味色(`"positive"` など。面用の `--<tone>-fill` で塗る)。省略時はトークン順。「その他」は常に灰色。 */
950
+ colors?: ChartSeriesColor[];
951
+ /** 切片の名前(`index` の値)→ 表示名。凡例・ツールチップ・外ラベル・データ表に反映。例 `{ organic: "自然検索" }`。無いキーはそのまま。データ表の列名を直すには、`index` と値のキーも渡す(`{ source: "流入元", sessions: "セッション" }`。既定は「項目」「値」)。 */
952
+ labels?: Record<string, string>;
953
+ /** ドーナツ固有の設定(形・中央に出すもの `centerLabel`・凡例・切片の上限)。同名のフラットな props より優先。 */
954
+ donutOptions?: DonutChartOptions;
955
+ /**
956
+ * グラフが言っていることの 1 文要約(自由文)。`"auto"` なら slices から「<見出し>: 最大は <名前>(<構成比>)」を組む。
957
+ * 順位や構成比を文に書くなら `"auto"` を使うか data から作る。省略時は要約なし。例: `summary="auto"`
958
+ */
959
+ summary?: string | "auto";
404
960
  showTooltip?: boolean;
405
961
  /** 切片のクリックで呼ばれる。同じ切片をもう一度クリックすると `null`。渡すと選択以外が薄くなる。 */
406
962
  onValueChange?: (value: ChartEventPayload) => void;
963
+ /** @deprecated `index` を使う。 */
964
+ category?: keyof T & string;
965
+ /** @deprecated `categories={[value]}` を使う。 */
966
+ value?: keyof T & string;
967
+ /** @deprecated `donutOptions.variant` を使う。 */
968
+ variant?: DonutVariant;
969
+ /** @deprecated `donutOptions.centerLabel` を使う。 */
970
+ label?: ReactNode;
971
+ /** @deprecated `donutOptions.centerLabel`(`"none"` で消す)を使う。 */
972
+ showLabel?: boolean;
973
+ /** @deprecated `isLoading` を使う。 */
407
974
  loading?: boolean;
408
- ariaLabel?: string;
409
- /** 外枠のクラス。既定の大きさは `size-40`(160px 四方)。 */
410
- className?: string;
411
975
  }
412
- declare const DonutChart: React.ForwardRefExoticComponent<DonutChartProps & React.RefAttributes<HTMLDivElement>>;
976
+ /** Generic over the row type, so `index` / `categories` keys are checked against `data`. */
977
+ declare const DonutChart: (<T extends Record<string, unknown>>(props: DonutChartProps<T> & {
978
+ ref?: Ref<HTMLDivElement>;
979
+ }) => ReactElement) & {
980
+ displayName?: string;
981
+ };
413
982
 
414
983
  /**
415
984
  * Chart helpers shared by the typed charts — colour tokens, number handling and
@@ -419,6 +988,44 @@ declare const DonutChart: React.ForwardRefExoticComponent<DonutChartProps & Reac
419
988
  */
420
989
 
421
990
  type BarListSortOrder = "ascending" | "descending" | "none";
991
+ /** BarList-only settings. */
992
+ interface BarListOptions {
993
+ /** 並べ順。既定 `"descending"`(大きい順)。`"none"` は渡した順。「その他」は常に最後。 */
994
+ sortOrder?: BarListSortOrder;
995
+ /** 個別に出す行の数。超えた分は合計して「その他」の 1 行にまとめる。既定 5。 */
996
+ maxItems?: number;
997
+ /** まとめた行のラベル。既定「その他」。 */
998
+ otherLabel?: string;
999
+ /** 順位に入れず、常に「その他」へ足す行の名前。例 `["(not set)", "Unassigned"]`。 */
1000
+ exclude?: readonly string[];
1001
+ /** 値の横に構成比(「その他」も含めた全行の合計に対する割合。整数 %)を添える。例「¥8,240万 · 43%」。既定 `false`。 */
1002
+ showShare?: boolean;
1003
+ }
1004
+ /** The visually-hidden table `ChartFrame` renders next to the plot (`dataTable`). */
1005
+ interface ChartDataTable {
1006
+ /** 表の見出し(`<caption>`)。 */
1007
+ caption?: string;
1008
+ /** 列見出し。先頭がラベル列。 */
1009
+ columns: string[];
1010
+ /** 行。セルは書式済みの文字列。 */
1011
+ rows: string[][];
1012
+ }
1013
+
1014
+ /**
1015
+ * BarList — a ranked list of horizontal bars with the value at the end of each
1016
+ * row: top pages, sales by store, error counts by type. Plain HTML/CSS (no
1017
+ * ECharts), so it stays cheap inside cards and follows the theme natively.
1018
+ *
1019
+ * Pass rows plus the name key (`index`) and the value key (`categories: [valueKey]`),
1020
+ * or the legacy `{ name, value, href?, color? }` items. More than
1021
+ * `barListOptions.maxItems` (5) rows fold into one「その他」row; rows named in
1022
+ * `barListOptions.exclude` always do (outside the ranking). Every row is
1023
+ * painted the same light tint of the colour (rank is the bar's length; `highlight` names the one
1024
+ * row drawn in the full colour),「その他」
1025
+ * in the subdued other colour; `barListOptions.showShare` adds each row's share
1026
+ * of the total after its value (「¥8,240万 · 43%」). Always renders in `ChartFrame` (title, summary,
1027
+ * loading / empty states, a visually-hidden table); the list is as tall as its rows.
1028
+ */
422
1029
 
423
1030
  interface BarListItem {
424
1031
  /** React の key。省略時は `name`。 */
@@ -428,41 +1035,70 @@ interface BarListItem {
428
1035
  value: number;
429
1036
  /** 渡すとラベルがリンクになる。 */
430
1037
  href?: string;
431
- /** この行だけ色を変える。省略時は `color`。 */
1038
+ /** @deprecated この行だけ色を変える。`colors` を使う(行ごとの色は持たない)。 */
432
1039
  color?: ChartColor;
433
1040
  }
434
- interface BarListProps extends Omit<ComponentProps<"div">, "children"> {
435
- data: BarListItem[];
436
- /** 右端の数値の書式。 */
437
- valueFormatter?: ValueFormatter;
438
- /** 並べ順。既定 `"descending"`(大きい順)。`"none"` は渡した順。 */
1041
+ interface BarListProps<T extends object = BarListItem> extends Omit<ComponentProps<"div">, "children" | "title" | "color">, Pick<ChartCommonProps, "format" | "valueFormatter" | "title" | "summary" | "isLoading" | "emptyState"> {
1042
+ /** 行の配列。`index` / `categories` を省くと `{ name, value, href? }` の形として読む。 */
1043
+ data: T[];
1044
+ /** 行の名前に使う列名。既定 `"name"`。 */
1045
+ index?: keyof T & string;
1046
+ /** 値に使う列名を 1 つだけ入れた配列(`["売上"]`)。最初の 1 つだけを使う。既定 `["value"]`。 */
1047
+ categories?: (keyof T & string)[];
1048
+ /** バーの色(`"chart-1"`〜`"chart-5"` か意味色、最初の 1 つだけを使う)。既定 `"chart-1"`。全行を同じ淡い色で塗る(順位はバーの長さで読む)。 */
1049
+ colors?: ChartSeriesColor | ChartSeriesColor[];
1050
+ /** 行の名前(`index` の値)→ 表示名。行のラベル・データ表に反映。例 `{ tokyo: "東京店" }`。無いキーはそのまま。データ表の列名を直すには、列のキーも渡す(`{ store: "店舗", sales: "売上" }`。既定は「項目」「値」)。 */
1051
+ labels?: Record<string, string>;
1052
+ /** 行の値で意味色に塗り分ける(最初に当たった規則。どれにも当たらない行は通常色)。例 `[{ lt: 40, tone: "negative" }, { lt: 70, tone: "warning" }]` */
1053
+ thresholds?: ChartThreshold[];
1054
+ /** 伝えたい 1 行。`index` の値(行の名前。例 `"東京店"`)で渡す。行は淡い色が既定で、この 1 行だけ濃い色(`colors` の色そのまま)になる。省略すると全部が淡い色。「その他」は選べない。 */
1055
+ highlight?: string;
1056
+ /** BarList 固有の設定(並べ順・行数の上限・「その他」のラベル・順位から外す行 `exclude`・値の横の構成比 `showShare`)。同名のフラットな props より優先。 */
1057
+ barListOptions?: BarListOptions;
1058
+ /** 渡すと行がボタンになり、クリックした行を受け取る(「その他」の行は押せない)。 */
1059
+ onValueChange?: (item: T) => void;
1060
+ /**
1061
+ * 行の並べ順(`"descending"` / `"ascending"` / `"none"`)。既定 `"descending"`。
1062
+ * @deprecated `barListOptions.sortOrder` を使う(両方あれば `barListOptions` が優先)。
1063
+ */
439
1064
  sortOrder?: BarListSortOrder;
440
- /** バーの色。`"chart-1"`〜`"chart-5"` か CSS カラー。既定 `"chart-1"`(淡く塗る)。 */
1065
+ /** @deprecated `colors` を使う。 */
441
1066
  color?: ChartColor;
442
- /** マウント時にバーを伸ばす。 */
1067
+ /** @deprecated マウント時にバーを伸ばす。入場アニメーションは既定で持たない。 */
443
1068
  showAnimation?: boolean;
444
- /** 渡すと行がボタンになり、クリックした行を受け取る。 */
445
- onValueChange?: (item: BarListItem) => void;
1069
+ /** @deprecated `valueFormatter` か `format` を使う。 */
1070
+ formatValue?: (value: number) => string;
1071
+ ariaLabel?: string;
446
1072
  }
447
- declare const BarList: React.ForwardRefExoticComponent<Omit<BarListProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
1073
+ /** Generic over the row type, so `index` / `categories` keys are checked against `data`. */
1074
+ declare const BarList: (<T extends object = BarListItem>(props: BarListProps<T> & {
1075
+ ref?: Ref<HTMLDivElement>;
1076
+ }) => ReactElement) & {
1077
+ displayName?: string;
1078
+ };
448
1079
 
449
1080
  interface CategoryBarMarker {
450
1081
  /** マーカーの位置(`values` の合計と同じ尺度)。 */
451
1082
  value: number;
452
1083
  /** ホバーで出す説明。 */
453
1084
  tooltip?: string;
454
- /** 位置の変化をアニメーションする。 */
1085
+ /** 位置の変化をアニメーションする。既定 `false`(`prefers-reduced-motion` では常に無効)。 */
455
1086
  showAnimation?: boolean;
456
1087
  }
457
1088
  interface CategoryBarProps extends Omit<ComponentProps<"div">, "children"> {
458
1089
  /** 各区間の幅(相対値)。合計が 100 である必要はない。負の値は 0 扱い。 */
459
1090
  values: number[];
460
- /** 区間の色(順に対応)。`"chart-1"`〜`"chart-5"` か CSS カラー。省略時はトークン順。 */
1091
+ /** 区間の色(順に対応)。`"chart-1"`〜`"chart-5"`・意味色(`"positive"` など。面用の `--<tone>-fill` で塗る)・CSS カラー。省略時はトークン順。 */
461
1092
  colors?: ChartColor[];
462
1093
  marker?: CategoryBarMarker;
463
1094
  /** バーの上に区切りの累計値を出す。既定 `true`。 */
464
1095
  showLabels?: boolean;
465
- /** 区切りの数値の書式。 */
1096
+ /**
1097
+ * 区切りの数値の書式(`"compact"` / `"currency"` / `{ type, currency }`)。他のグラフの
1098
+ * 軸と同じ短縮形で出す(`"currency"` → `¥780万`)。既定 `"compact"`。
1099
+ */
1100
+ format?: ValueFormat;
1101
+ /** 書式を関数で直接渡す逃げ道。`format` より優先する。 */
466
1102
  valueFormatter?: ValueFormatter;
467
1103
  }
468
1104
  declare const CategoryBar: React.ForwardRefExoticComponent<Omit<CategoryBarProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -476,9 +1112,9 @@ interface ProgressCircleProps extends ComponentProps<"div"> {
476
1112
  radius?: number;
477
1113
  /** 線の太さ(px)。既定 `6`。 */
478
1114
  strokeWidth?: number;
479
- /** 色。`"chart-1"`〜`"chart-5"` か CSS カラー。既定 `"chart-1"`。地のリングは同じ色を淡くしたもの。 */
1115
+ /** 色。`"chart-1"`〜`"chart-5"`・意味色(`"positive"` など。面用の `--<tone>-fill` で塗る)・CSS カラー。既定 `"chart-1"`。地のリングは同じ色を淡くしたもの。 */
480
1116
  color?: ChartColor;
481
- /** マウント時と値の変化をアニメーションする。既定 `true`。 */
1117
+ /** マウント時と値の変化をアニメーションする。既定 `false`(`prefers-reduced-motion` では常に無効)。 */
482
1118
  showAnimation?: boolean;
483
1119
  }
484
1120
  declare const ProgressCircle: React.ForwardRefExoticComponent<Omit<ProgressCircleProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -486,9 +1122,9 @@ declare const ProgressCircle: React.ForwardRefExoticComponent<Omit<ProgressCircl
486
1122
  interface TrackerBlock {
487
1123
  /** React の key。省略時は位置。 */
488
1124
  key?: string | number;
489
- /** ブロックの色。`"chart-1"`〜`"chart-5"` か CSS カラー(`"var(--destructive)"` など)。省略時は `defaultColor`。 */
1125
+ /** ブロックの色。`"positive"` / `"negative"` / `"warning"` / `"info"`(面用の `--<tone>-fill`)、`"chart-1"`〜`"chart-5"`、CSS カラー。省略時は `defaultColor`。 */
490
1126
  color?: ChartColor;
491
- /** ホバーで出す説明(例: `"10/12 稼働率 99.2%"`)。 */
1127
+ /** ホバーで出す説明。日付と状態・件数を入れる(例: `"10/12 失敗 3 件"`)。ブロックの accessible name にもなる。 */
492
1128
  tooltip?: string;
493
1129
  }
494
1130
  interface TrackerProps extends Omit<ComponentProps<"div">, "children"> {
@@ -500,12 +1136,249 @@ interface TrackerProps extends Omit<ComponentProps<"div">, "children"> {
500
1136
  }
501
1137
  declare const Tracker: React.ForwardRefExoticComponent<Omit<TrackerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
502
1138
 
1139
+ /**
1140
+ * WaterfallChart — a typed waterfall chart over `EChart`: pass the steps as rows,
1141
+ * the name key (`index`) and the amount key (`categories: [valueKey]`) instead of
1142
+ * an ECharts option. 売上 → 原価 → 粗利 の内訳、前期からの増減要因。
1143
+ *
1144
+ * Each row is a step that moves the running total by its value; rows named in
1145
+ * `totals` are totals — a bar from 0 to the running total (or to their own value
1146
+ * when they carry one). The bars are a stacked bar chart over a transparent base,
1147
+ * so the value axis always starts at 0. Increase / decrease bars use the
1148
+ * area tokens (`--positive-fill` / `--negative-fill`, swapped by `polarity`), totals are
1149
+ * `--chart-1`; every step also prints its signed amount (+ / -), so the colour is
1150
+ * never the only carrier of the direction. Missing values (null) draw no bar and read「—」.
1151
+ * `mode="delta"` draws only the moves: the axis is the cumulative change from 0 (the start),
1152
+ * totals are not bars (their numbers go in a note above the plot), so a small change against
1153
+ * a large total is not a hairline on a tall axis; the axis still starts at 0 and can go negative.
1154
+ * A closing「純増」bar (the net change, `--chart-1`, signed) is appended in `delta`. Value-axis ticks carry no "+" in
1155
+ * both modes; the sign is on the bar labels only.
1156
+ * Renders inside `ChartFrame` (title, summary, loading skeleton, empty state, and
1157
+ * a visually-hidden table of the steps).
1158
+ */
1159
+
1160
+ /**
1161
+ * `"total"`: 合計の段を 0 からの棒として描く(既定)。`"delta"`: 増減の段だけを描く(開始を 0 とした累計増減の軸)。
1162
+ */
1163
+ type WaterfallMode = "total" | "delta";
1164
+ interface WaterfallChartProps<T extends Record<string, unknown> = Record<string, unknown>> extends Omit<ChartCommonProps<T>, "index" | "categories" | "colors" | "summary"> {
1165
+ /** 段の名前に使う列名。行の並びがそのままグラフの左から右の順。 */
1166
+ index: keyof T & string;
1167
+ /** 増減額(合計の行は合計値)の列名を 1 つだけ入れた配列(`["金額"]`)。2 つ以上渡しても最初の 1 つだけを使う。値は number か数値文字列。 */
1168
+ categories: NumericKeys<T>[];
1169
+ /**
1170
+ * 合計の段にする行の `index` の値(例 `["売上", "粗利"]`)。合計の段は 0 から累計まで届く棒で、色は `--chart-1`。
1171
+ * 合計の行の値が null なら直前までの累計になる(計算に任せるのが確実)。値があればその値が合計になり、以降の累計はそこから続く。
1172
+ * 最初の段が増減の行なら 0 から始まる。`mode="delta"` では棒にならず、先頭の行が「開始」、末尾の行が「終了」の注記になる。
1173
+ */
1174
+ totals?: string[];
1175
+ /**
1176
+ * 増えるのが良いか。`"higher-is-better"`(既定)は増加が `--positive-fill`・減少が `--negative-fill`(棒用の面のトークン)。
1177
+ * 解約数のように増えて悪い指標は `"lower-is-better"` で色が入れ替わる。`"neutral"` は増減とも `--neutral-fill`(符号は付く)。
1178
+ */
1179
+ polarity?: Polarity;
1180
+ /**
1181
+ * 描き方。`"total"`(既定)は合計の段を 0 からの棒で描く。
1182
+ * `"delta"` は開始を 0 とした累計増減の軸で増減の段だけを描き、`totals` の行は棒にせず、
1183
+ * 開始・終了の値は図の上の注記(と要約・データ表)に出し、末尾に「純増」棒(増減の合計。`--chart-1`、符号つき)を足す。値軸の目盛に `+` は付かない。合計に対して増減が小さい(目安: 総額の 5% 未満)ときに使う。
1184
+ * 軸は 0 起点のまま(累計が負になる段も 0 の下に描く)。例 `mode="delta"`
1185
+ */
1186
+ mode?: WaterfallMode;
1187
+ /** 段の名前(`index` の値)→ 表示名。軸・ツールチップ・データ表に反映。例 `{ cogs: "売上原価" }`。無いキーはそのまま。データ表の先頭列名を直すには `index` のキーも渡す(既定は「項目」)。 */
1188
+ labels?: Record<string, string>;
1189
+ /**
1190
+ * 縦軸の下限。軸は常に 0 を含むので、0 以下の値だけ有効(累計が負になる段の下に余白を取る。正の値は無視)。
1191
+ * データが下限を下回るときは軸を広げる(切り詰めない)。`mode="total"` / `"delta"` の両方で効く。
1192
+ * 部署別などを並べて比べるときは、全部のグラフに同じ `minValue` / `maxValue` を渡して縦軸をそろえる。
1193
+ */
1194
+ minValue?: number;
1195
+ /**
1196
+ * 縦軸の上限。データが上限を超えるときは軸を広げる(切り詰めない)。`mode="total"` / `"delta"` の両方で効く。
1197
+ * 並べて比べるときは、全部のグラフに同じ `minValue` / `maxValue` を渡して縦軸をそろえる。
1198
+ */
1199
+ maxValue?: number;
1200
+ /** y 軸ラベルの幅(px)。並べた複数グラフのプロット領域を揃えたいときに固定する。 */
1201
+ yAxisWidth?: number;
1202
+ /** 各棒に符号つきの増減額(合計は累計)を書く。既定 `true`。 */
1203
+ showValues?: boolean;
1204
+ /** ホバー時のツールチップ(増減と累計)を出す。既定 `true`。 */
1205
+ showTooltip?: boolean;
1206
+ /**
1207
+ * グラフが言っていることの 1 文要約(自由文)。`"auto"` なら steps から「<見出し>: <最初> <値> → <最後> <値>。最大の増加は …、最大の減少は …」を組む(`mode="delta"` は「<開始> <値> → <終了> <値>(<増減>)」)。
1208
+ * 省略時は要約なし。例: `summary="auto"`
1209
+ */
1210
+ summary?: string | "auto";
1211
+ /** 見出しが無いときのプロット領域の読み上げ名。省略時は「<金額の列>のウォーターフォールチャート」。 */
1212
+ ariaLabel?: string;
1213
+ }
1214
+ /** Generic over the row type, so `index` / `categories` keys are checked against `data`. */
1215
+ declare const WaterfallChart: (<T extends Record<string, unknown>>(props: WaterfallChartProps<T> & {
1216
+ ref?: Ref<HTMLDivElement>;
1217
+ }) => ReactElement) & {
1218
+ displayName?: string;
1219
+ };
1220
+
1221
+ /**
1222
+ * ScatterChart — a typed scatter / bubble chart over `EChart`: pass rows and the
1223
+ * two numeric column keys for the axes (`x` / `y`) instead of an ECharts option.
1224
+ * 広告費 × 売上、客単価 × 購入頻度 のように 2 つの数値の関係と外れ値を見る。
1225
+ *
1226
+ * `size` turns the dots into bubbles (area proportional to the value, from 0),
1227
+ * `series` splits the dots into series coloured with the `--chart-1..5` tokens in
1228
+ * fixed order (more than 5 fold into one grey「その他」series), `index` names each
1229
+ * dot in the tooltip. Both axes fit the data by default — a scatter is read by
1230
+ * position, not by length, so it does not start at 0 (`fitToData={false}` does).
1231
+ * Rows whose x or y is missing are left out. `labelKey` prints each dot's name beside it (dots whose
1232
+ * labels would collide are thinned, never overprinted; on a narrow plot (under 480px) only the 2 highest dots are
1233
+ * named, each label turned inward so it stays inside the plot, the legend moves under the plot and the y axis carries
1234
+ * 3 intervals), `referenceLines` draws neutral guide lines at
1235
+ * fixed x / y values, `highlight` brings some series forward and fades the rest. Renders inside `ChartFrame` (title,
1236
+ * summary, loading skeleton, empty state, and a visually-hidden table of the dots).
1237
+ */
1238
+
1239
+ /** 散布図に引く基準線 1 本(`x` なら縦線、`y` なら横線)。中立色の破線で、点の色とは混ざらない。 */
1240
+ interface ScatterReferenceLine {
1241
+ /** `"x"` は横軸の値に縦線、`"y"` は縦軸の値に横線を引く。 */
1242
+ axis: "x" | "y";
1243
+ /** 線を引く位置(軸の値そのまま。`format` が percent の列でも、列と同じ単位の数値を渡す)。軸の範囲に収まらないときは軸が線まで広がる。 */
1244
+ value: number;
1245
+ /** 線の脇に書く短い名前(「目標 25%」)。省略すると線だけ。 */
1246
+ label?: string;
1247
+ }
1248
+ interface ScatterChartProps<T extends Record<string, unknown> = Record<string, unknown>> extends Omit<ChartCommonProps<T>, "index" | "categories" | "colors" | "summary" | "labels" | "format" | "valueFormatter"> {
1249
+ /** 行の配列。1 行 = 1 つの点。数値の列は number か数値文字列。x か y が数値でない行は描かない。 */
1250
+ data: T[];
1251
+ /** 横軸に使う数値の列名。例 `"adSpend"`。 */
1252
+ x: NumericKeys<T>;
1253
+ /** 縦軸に使う数値の列名。例 `"revenue"`。 */
1254
+ y: NumericKeys<T>;
1255
+ /** 点の大きさ(面積)に使う数値の列名。渡すとバブルチャートになる。0 を基準に面積が比例し、null・0 以下は最小の大きさ。ツールチップに値が出る。 */
1256
+ size?: NumericKeys<T>;
1257
+ /** 点の名前に使う列名(店舗名・キャンペーン名など)。ツールチップの見出しとデータ表の先頭列になる。 */
1258
+ index?: keyof T & string;
1259
+ /**
1260
+ * 点の脇に書く文字の列名(店舗名など)。重なる点のラベルは自動で間引く(ホバーのツールチップには常に出る)。
1261
+ * `index` が無いときはツールチップの見出しとデータ表の名前にもなる。`highlight` を使うと、強調しない系列のラベルは出さない。
1262
+ */
1263
+ labelKey?: keyof T & string;
1264
+ /** 系列分けに使う列名(`"channel"` など)。値ごとに色を分け、凡例を出す。6 つ以上は点の多い 5 つ +「その他」(灰色)にまとまる。 */
1265
+ series?: keyof T & string;
1266
+ /** 凡例の見出し(「店の規模」)。`series` があって凡例が出るときだけ、凡例の左に小さく書く。 */
1267
+ seriesLabel?: string;
1268
+ /**
1269
+ * 前面に出す系列(`series` 列の値。`"退職"` か `["退職", "休職"]`)。指定した系列は不透明で手前に、指定外は薄く背面に描く。
1270
+ * 数が多い点の中に埋もれる少数の系列を見せたいときに使う。値が系列に一つも当たらないときは強調しない。
1271
+ */
1272
+ highlight?: string | string[];
1273
+ /**
1274
+ * 基準線(目標・平均・しきい値)。`axis: "x" | "y"` と軸の値で縦線・横線を引く。例 `[{ axis: "y", value: 25, label: "粗利率 25%" }]`
1275
+ * 色は中立色(点の系列色とは別)。線は点の下に敷かず、軸の範囲を線まで広げる。
1276
+ */
1277
+ referenceLines?: ScatterReferenceLine[];
1278
+ /** 系列色(`"chart-1"`〜`"chart-5"` か意味色)。配列は系列の出現順、record は系列名ごと。省略時はトークン順。「その他」は常に灰色。 */
1279
+ colors?: ChartSeriesColor[] | Partial<Record<string, ChartSeriesColor>>;
1280
+ /** 列名・系列の値 → 表示名(軸のタイトル・凡例・ツールチップ・データ表に反映)。例 `{ adSpend: "広告費", revenue: "売上" }`。無いキーはそのまま。データ表の列名の既定は「名前」「系列」「横軸」「縦軸」「大きさ」で、直すには各キーを渡す。 */
1281
+ labels?: Record<string, string>;
1282
+ /** 数値の書式。x・y・size の既定の書式(`"compact"` など。`{ type: "number", unit: "件" }` も可)。軸ごとに変えるなら `xFormat` / `yFormat` / `sizeFormat`。既定 `"compact"`。 */
1283
+ format?: ValueFormat;
1284
+ /** 横軸と x の値の書式。`format` より優先。 */
1285
+ xFormat?: ValueFormat;
1286
+ /** 縦軸と y の値の書式。`format` より優先。 */
1287
+ yFormat?: ValueFormat;
1288
+ /** `size` の値の書式(ツールチップ・データ表)。`format` より優先。 */
1289
+ sizeFormat?: ValueFormat;
1290
+ /** 書式を関数で直接渡す逃げ道。x・y・size すべてに使われ、`format` 系より優先する。 */
1291
+ valueFormatter?: ValueFormatter;
1292
+ /**
1293
+ * 縦軸(y)の下限。散布図は 0 起点にしないので、指定した値から始める。データが下限を下回るときは軸を広げる(切り詰めない)。
1294
+ * 並べて比べる複数の散布図には同じ `minValue` / `maxValue` と `xMinValue` / `xMaxValue` を渡して軸をそろえる。
1295
+ */
1296
+ minValue?: number;
1297
+ /** 縦軸(y)の上限。データが上限を超えるときは軸を広げる(切り詰めない)。並べて比べるときは同じ値を渡す。 */
1298
+ maxValue?: number;
1299
+ /** 横軸(x)の下限。データが下限を下回るときは軸を広げる。並べて比べるときは同じ値を渡す。 */
1300
+ xMinValue?: number;
1301
+ /** 横軸(x)の上限。データが上限を超えるときは軸を広げる。並べて比べるときは同じ値を渡す。 */
1302
+ xMaxValue?: number;
1303
+ /** 両軸をデータの範囲に合わせる。既定 `true`(散布図は位置で読むので 0 起点にしない)。`false` で両軸を 0 から始める。 */
1304
+ fitToData?: boolean;
1305
+ /** 凡例(系列が 2 つ以上のときだけ)を出す。既定 `true`。 */
1306
+ showLegend?: boolean;
1307
+ /** ホバー時のツールチップを出す。既定 `true`。 */
1308
+ showTooltip?: boolean;
1309
+ /**
1310
+ * グラフが言っていることの 1 文要約(自由文)。`"auto"` なら「<見出し>: <点の数>点。<y の列> が最大なのは <名前>(<値>)」を組む(`index` が無いときは最大値だけ)。
1311
+ * 省略時は要約なし。例: `summary="auto"`
1312
+ */
1313
+ summary?: string | "auto";
1314
+ /** `data` が空(または描ける点が無い)ときの表示。 */
1315
+ emptyState?: ChartEmptyState;
1316
+ /** 見出しが無いときのプロット領域の読み上げ名。省略時は「<y の列>×<x の列>の散布図」。 */
1317
+ ariaLabel?: string;
1318
+ }
1319
+ /** Generic over the row type, so `x` / `y` / `size` / `index` / `series` keys are checked against `data`. */
1320
+ declare const ScatterChart: (<T extends Record<string, unknown>>(props: ScatterChartProps<T> & {
1321
+ ref?: Ref<HTMLDivElement>;
1322
+ }) => ReactElement) & {
1323
+ displayName?: string;
1324
+ };
1325
+
1326
+ interface LegendProps {
1327
+ /** 凡例に並べる系列名。並び順が配色の順(グラフの `categories` と同じものを渡す)。6 つ以上はグラフ側で「その他」にまとまるので、凡例も 5 つ +「その他」で渡す。 */
1328
+ categories: string[];
1329
+ /** 系列色(`"chart-1"`〜`"chart-5"` か意味色)。配列は系列の順、record は系列名ごと。グラフに渡した `colors` と同じものを渡す。省略時はトークン順。「その他」は常に灰色。 */
1330
+ colors?: ChartSeriesColor[] | Partial<Record<string, ChartSeriesColor>>;
1331
+ /** 系列名 → 表示名。グラフの `labels` と同じものを渡す。例 `{ sales: "売上" }`。無いキーはそのまま。 */
1332
+ labels?: Record<string, string>;
1333
+ /** 並べ方。`"horizontal"`(既定。折り返す横並び)か `"vertical"`(縦並び)。 */
1334
+ layout?: "horizontal" | "vertical";
1335
+ /** 凡例の読み上げ名。省略時は「凡例」。 */
1336
+ ariaLabel?: string;
1337
+ className?: string;
1338
+ }
1339
+ /** Plain-HTML legend. Renders nothing for an empty `categories`. */
1340
+ declare const Legend: React.ForwardRefExoticComponent<LegendProps & React.RefAttributes<HTMLUListElement>>;
1341
+
1342
+ /** The shape the loading skeleton takes, matching the chart it stands in for. */
1343
+ type ChartSkeletonVariant = "line" | "area" | "bar" | "donut" | "list";
1344
+ interface ChartFrameProps extends Omit<HTMLAttributes<HTMLElement>, "title" | "children"> {
1345
+ /** グラフの見出し。プロット領域の `aria-labelledby` になる。 */
1346
+ title?: string;
1347
+ /** 1 文の要約。見出しの下に出し、プロット領域の `aria-describedby` になる。 */
1348
+ summary?: string;
1349
+ /** 読み込み中。`variant` の形のスケルトンを同じ高さで出す。 */
1350
+ isLoading?: boolean;
1351
+ /** データが無い。高さを保ったまま `emptyState` を出す。 */
1352
+ isEmpty?: boolean;
1353
+ emptyState?: ChartEmptyState;
1354
+ /** プロット領域の高さ。数値は px。既定 288。 */
1355
+ height?: number | string;
1356
+ /** スケルトンの形。既定 `"line"`。 */
1357
+ variant?: ChartSkeletonVariant;
1358
+ /** 見出しが無いときのプロット領域のラベル。 */
1359
+ ariaLabel?: string;
1360
+ /**
1361
+ * プロット領域の役割。既定 `"img"`(canvas のグラフ)。行がボタンやリンクになる
1362
+ * HTML のグラフ(BarList・FunnelSteps)は `"group"` にして、中身を読ませる。
1363
+ */
1364
+ plotRole?: "img" | "group";
1365
+ /** 値の表。画面には出さず(`sr-only`)、スクリーンリーダー向けに図の中に置く。`chartDataTable` で作る。 */
1366
+ dataTable?: ChartDataTable;
1367
+ /** プロット(チャート本体)。読み込み中・空のときは描かない。 */
1368
+ children?: ReactNode;
1369
+ }
1370
+ /**
1371
+ * The frame. `ref` points at the plot area (the element with the fixed height),
1372
+ * `className` / other attributes go to the outer `<figure>`.
1373
+ */
1374
+ declare const ChartFrame: React.ForwardRefExoticComponent<ChartFrameProps & React.RefAttributes<HTMLDivElement>>;
1375
+
503
1376
  interface FunnelStep {
504
1377
  /** ステップのラベル(例: "ページビュー") */
505
1378
  label: string;
506
1379
  /** このステップの数値 */
507
1380
  value: number;
508
- /** Tailwind bg カラークラス(例: "bg-chart-1")。未指定時は自動割り当て */
1381
+ /** @deprecated Tailwind bg カラークラス(例: "bg-chart-1")。`colors` を使う。未指定時は `bg-chart-1` */
509
1382
  color?: string;
510
1383
  /** クリック時のハンドラ */
511
1384
  onClick?: () => void;
@@ -514,17 +1387,141 @@ declare const funnelStepsVariants: (props?: ({
514
1387
  size?: "sm" | "lg" | "md" | null | undefined;
515
1388
  direction?: "horizontal" | "vertical" | null | undefined;
516
1389
  } & class_variance_authority_types.ClassProp) | undefined) => string;
517
- interface FunnelStepsProps extends ComponentProps<"div">, VariantProps<typeof funnelStepsVariants> {
518
- /** ファネルステップの配列(先頭が最大幅) */
519
- data: FunnelStep[];
1390
+ interface FunnelStepsProps<T extends object = FunnelStep> extends Omit<ComponentProps<"div">, "title" | "color">, Pick<ChartCommonProps, "format" | "valueFormatter" | "title" | "summary" | "isLoading" | "emptyState">, VariantProps<typeof funnelStepsVariants> {
1391
+ /** ファネルステップの配列(先頭が最大幅)。`index` / `categories` を省くと `{ label, value }` の形として読む。 */
1392
+ data: T[];
1393
+ /** ステップのラベルに使う列名。既定 `"label"`。 */
1394
+ index?: keyof T & string;
1395
+ /** 値に使う列名を 1 つだけ入れた配列(`["件数"]`)。最初の 1 つだけを使う。既定 `["value"]`。 */
1396
+ categories?: (keyof T & string)[];
1397
+ /** 段の色(`"chart-1"`〜`"chart-5"`、段の順に繰り返す)。省略時はすべて `"chart-1"`(段は同じ量の絞り込みなので 1 色)。 */
1398
+ colors?: ChartColorToken[];
1399
+ /** ステップの名前(`index` の値)→ 表示名。ラベル・データ表に反映。例 `{ visit: "訪問" }`。無いキーはそのまま。データ表の列名を直すには、列のキーも渡す(`{ label: "工程", value: "人数" }`。既定は「ステップ」「値」)。 */
1400
+ labels?: Record<string, string>;
1401
+ /** 伝えたい 1 段。`index` の値(ステップ名。例 `"購入"`)で渡す。段は淡い色が既定で、この 1 段だけ濃い色(`colors` の色そのまま)になる。省略すると全部が淡い色。 */
1402
+ highlight?: string;
520
1403
  /** ステップ間のコンバージョン率を表示する */
521
1404
  showConversion?: boolean;
522
- /** 値の表示フォーマット関数 */
1405
+ /** 前期の各段の値(`data` と同じ順)。渡すと転換率の横に前期比(pt)を出し、最も下がった率を強調する。`label` は列見出し・注記の名前(既定「前期」)。KpiCard の `comparison` と同じ形。例 `comparison={{ values: [231_400, 1_210, 402] }}` */
1406
+ comparison?: {
1407
+ values: readonly (number | null)[];
1408
+ label?: string;
1409
+ };
1410
+ /** @deprecated `valueFormatter` か `format` を使う。 */
523
1411
  formatValue?: (value: number) => string;
524
- /** マウント時のエントリアニメーションを有効にする */
1412
+ /** マウント時のエントリアニメーションを有効にする。既定 `false`。 */
525
1413
  animate?: boolean;
1414
+ ariaLabel?: string;
526
1415
  }
527
- declare const FunnelSteps: React.ForwardRefExoticComponent<Omit<FunnelStepsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
1416
+ /** Generic over the row type, so `index` / `categories` keys are checked against `data`. */
1417
+ declare const FunnelSteps: (<T extends object = FunnelStep>(props: FunnelStepsProps<T> & {
1418
+ ref?: Ref<HTMLDivElement>;
1419
+ }) => ReactElement) & {
1420
+ displayName?: string;
1421
+ };
1422
+
1423
+ /**
1424
+ * Heatmap — a typed heatmap over `EChart`: pass rows, the column keys for the
1425
+ * x axis / y axis (`x` / `y`) and the number to shade by (`value`) instead of an
1426
+ * ECharts option. Cohort retention (週 × コホート), weekday × hour counts, …
1427
+ *
1428
+ * Shading is a single-colour ramp (light → dark) of one theme colour
1429
+ * (`--chart-1` by default; `tone` moves it to another series token or a meaning
1430
+ * colour) and follows light/dark. A cell with no value (null / missing row) is left
1431
+ * unpainted (transparent, no text), never shaded like 0; the tooltip and the table say「—」.
1432
+ * The shading range is the data's min–max unless `scale` fixes it. The ramp's lowest end is the tone mixed 20% into
1433
+ * the surface (`color-mix(in oklch, var(--chart-1) 20%, var(--card))`), so the lowest cell never melts into the
1434
+ * background in dark mode; the legend's gradient starts at the same colour.
1435
+ * Renders inside `ChartFrame` (title, summary, loading skeleton, empty state)
1436
+ * with the numbers as a screen-reader table.
1437
+ */
1438
+
1439
+ /** Columns of `T` that hold numbers (null / undefined allowed for gaps); untyped rows keep every key. */
1440
+ type NumericColumn<T> = {
1441
+ [K in keyof T]-?: unknown extends T[K] ? K : T[K] extends number | bigint | null | undefined ? K : never;
1442
+ }[keyof T] & string;
1443
+ interface HeatmapProps<T extends Record<string, unknown> = Record<string, unknown>> extends ChartRootAttributes {
1444
+ /** 行の配列。1 行 = 1 マス(x と y の組)。同じ組が複数あれば後の行が勝つ。値は number か数値文字列。 */
1445
+ data: T[];
1446
+ /** 横軸(列)に使う列名。例 `"hour"`・`"week"`。 */
1447
+ x: keyof T & string;
1448
+ /** 縦軸(行)に使う列名。例 `"weekday"`・`"cohort"`。先頭の行が一番上。 */
1449
+ y: keyof T & string;
1450
+ /** マスの濃さを決める数値の列名。null・欠損・数値でない値のマスは塗らない(0 とは別。ツールチップとデータ表は「—」)。 */
1451
+ value: NumericColumn<T>;
1452
+ /** 横軸の並び順(と表示するマス)。省略時は `data` の出現順。ここに無い x の行は描かない。 */
1453
+ xLabels?: string[];
1454
+ /** 縦軸の並び順(と表示するマス)。省略時は `data` の出現順。ここに無い y の行は描かない。 */
1455
+ yLabels?: string[];
1456
+ /**
1457
+ * 列名・軸の値 → 表示名(軸・ツールチップ・データ表に反映)。
1458
+ * 例 `{ mon: "月曜", value: "件数", breached: "SLA 未達" }`。無いキーはそのまま。データ表の先頭列名は `y` のキーを渡すと直る(既定は「項目」)。
1459
+ */
1460
+ labels?: Record<string, string>;
1461
+ /** 数値の書式(`"number"` / `"percent"` / `{ type: "number", unit: "件" }` など)。マス内・ツールチップ・データ表で同じ書式。既定 `"number"`。 */
1462
+ format?: ValueFormat;
1463
+ /** 書式を関数で直接渡す逃げ道。`format` より優先する。 */
1464
+ valueFormatter?: ValueFormatter;
1465
+ /**
1466
+ * 濃淡の色。`"chart-1"`〜`"chart-5"` か意味色(`"positive"` / `"warning"` / `"negative"` / `"neutral"`)。
1467
+ * 薄い → 濃いの単色グラデーション(レインボーにしない)。既定 `"chart-1"`。
1468
+ */
1469
+ tone?: ChartSeriesColor;
1470
+ /**
1471
+ * 濃さの固定スケール。省略時はデータの最小〜最大(自動)。比べたい上限・下限が決まっているときだけ渡す。`min` 以下が最も薄く、`max` 以上が最も濃い(範囲外の値は端に丸める)。凡例の両端もこの値になる。
1472
+ * 継続率(0〜100)なら `{ min: 0, max: 100 }`。片方だけでもよく、省略した側はデータの最小・最大。
1473
+ * `minValue` / `maxValue` より優先する。
1474
+ */
1475
+ scale?: {
1476
+ min?: number;
1477
+ max?: number;
1478
+ };
1479
+ /** @deprecated `scale={{ min }}` を使う。濃さの下限(この値以下が最も薄い)。 */
1480
+ minValue?: number;
1481
+ /** @deprecated `scale={{ max }}` を使う。濃さの上限(この値以上が最も濃い)。 */
1482
+ maxValue?: number;
1483
+ /** マスの中に値を書く(`format` どおり)。既定 `false`。 */
1484
+ showValues?: boolean;
1485
+ /** 凡例(薄い → 濃いの帯と両端の値)を出す。既定 `true`。 */
1486
+ showLegend?: boolean;
1487
+ /** ホバーでツールチップを出す。既定 `true`。 */
1488
+ showTooltip?: boolean;
1489
+ /**
1490
+ * ツールチップとデータ表に添える列(同じ行の別の数値)。例 `["breached"]` →「月曜 9時台 電話 12件・SLA 未達 2件」の「SLA 未達 2件」。
1491
+ * 列名の表示は `labels`、値は `format`(単位つきの書式なら同じ単位)で出る。
1492
+ */
1493
+ details?: NumericColumn<T>[];
1494
+ /**
1495
+ * この列が真(`true` / 0 でない数)の行のマスに、注意色(`--negative`)の枠を付ける。
1496
+ * 例 SLA 未達が集中したマス。色だけでなく枠の太さでも区別でき、ツールチップに「要注意」と出る。
1497
+ */
1498
+ flag?: keyof T & string;
1499
+ /** グラフの見出し。 */
1500
+ title?: string;
1501
+ /** グラフが言っていることの 1 文要約。`"auto"` で最大のマスから自動生成。 */
1502
+ summary?: string | "auto";
1503
+ /** 読み込み中。最終形と同じ高さのスケルトンを出す。 */
1504
+ isLoading?: boolean;
1505
+ /** `data` が空のときの表示。 */
1506
+ emptyState?: ChartEmptyState;
1507
+ /** プロット領域の高さ(px)。既定 288。 */
1508
+ height?: number;
1509
+ /** 生成した EChartsOption に最後に深くマージする逃げ道。 */
1510
+ chartOptions?: EChartsOption;
1511
+ /** グラフ右上に PNG 保存/コピーのボタンを出す。見出しがあれば PNG の上に含める(`{ includeTitle: false }` で含めない)。 */
1512
+ actions?: boolean | ChartActionsOptions;
1513
+ /** PNG 保存時のファイル名(拡張子つき)。 */
1514
+ fileName?: string;
1515
+ className?: string;
1516
+ /** スクリーンリーダー向けのラベル。省略時は `<yの列>×<xの列>のヒートマップ`。 */
1517
+ ariaLabel?: string;
1518
+ }
1519
+ /** Generic over the row type, so `x` / `y` / `value` keys are checked against `data`. */
1520
+ declare const Heatmap: (<T extends Record<string, unknown>>(props: HeatmapProps<T> & {
1521
+ ref?: Ref<HTMLDivElement>;
1522
+ }) => ReactElement) & {
1523
+ displayName?: string;
1524
+ };
528
1525
 
529
1526
  type SparklineVariant = "line" | "bar";
530
1527
  interface SparklineDataPoint {
@@ -538,11 +1535,103 @@ interface SparklineProps extends SVGAttributes<SVGSVGElement> {
538
1535
  /** Tailwind text-colour class; drives both stroke and fill via `currentColor`. */
539
1536
  color?: string;
540
1537
  area?: boolean;
1538
+ /** マウント時に線を引く / 棒を伸ばす。既定 `false`(`prefers-reduced-motion` では常に無効)。 */
541
1539
  animate?: boolean;
1540
+ /**
1541
+ * 点の強調(Tufte 流)。`"auto"` は最新・最大・最小の 3 点だけに小さな点を打つ
1542
+ * (最新は系列の色、最大・最小は muted)。`"latest"` は最新の 1 点だけ、`"none"` は線だけ。`variant="line"` のときだけ効く。既定 `"auto"`。
1543
+ */
1544
+ highlight?: ChartHighlight | "latest";
1545
+ /** 指定すると `role="img"` で読み上げ対象にする。省略時は装飾として `aria-hidden`。 */
1546
+ "aria-label"?: string;
542
1547
  className?: string;
543
1548
  }
544
1549
  declare const Sparkline: React.ForwardRefExoticComponent<SparklineProps & React.RefAttributes<SVGSVGElement>>;
545
1550
 
1551
+ declare module "@tanstack/react-table" {
1552
+ interface ColumnMeta<TData extends RowData, TValue> {
1553
+ /**
1554
+ * Classes put on the column's header and body cells — e.g.
1555
+ * `"hidden md:table-cell"` to drop a column on narrow screens.
1556
+ */
1557
+ className?: string;
1558
+ /**
1559
+ * 列の数値書式。`cell` を持たない列だけに効き、右寄せ・tabular-nums で描く。
1560
+ * 行ごとに通貨が変わるときは関数で行を受ける。CSV の「表示」値にも使われる。
1561
+ *
1562
+ * @example
1563
+ * meta: { format: "currency" }
1564
+ * meta: { format: (row) => ({ type: "currency", currency: row.currency, notation: "standard" }) }
1565
+ */
1566
+ format?: ValueFormat | ((row: TData) => ValueFormat);
1567
+ /**
1568
+ * 日付の列の書式(`formatDate` の `style`)。`cell` を持たない列だけに効く。左寄せ・tabular-nums で描き、
1569
+ * 値は `Date`・エポックミリ秒・日付文字列(`"2026-10-20"`、ISO 8601)。CSV の「表示」値にも使われる。
1570
+ * `format`(数値)とは併用しない。
1571
+ *
1572
+ * @example
1573
+ * meta: { dateFormat: "date" }
1574
+ * meta: { dateFormat: "datetime", nullLabel: "未更新" }
1575
+ */
1576
+ dateFormat?: DateStyle;
1577
+ /**
1578
+ * `dateFormat` の列の日時を出すタイムゾーン(IANA 名。例 `"Asia/Tokyo"`)。既定は実行環境(ブラウザ)のタイムゾーン。
1579
+ * サーバーとブラウザで表示が食い違う(SSR)なら固定する。`dateFormat` の列だけに効き、CSV の「表示」値にも同じ値を使う。
1580
+ * `"2026-10-20"` のような日付だけの文字列は、どのタイムゾーンでもその暦日のまま。
1581
+ *
1582
+ * @example
1583
+ * meta: { dateFormat: "datetime", timeZone: "Asia/Tokyo" }
1584
+ */
1585
+ timeZone?: string;
1586
+ /**
1587
+ * 値が無いときの表示。既定 `"—"`。null / undefined(数値は NaN も)に効き、文字列の列では空文字 `""` も値なしとして扱う。
1588
+ * `format` / `dateFormat` を持つ列と、書式なしの文字列の列に効く。`cell` を自前で書いた列には効かない(`cell` の中で扱う)。
1589
+ * CSV の「表示」値は、書式付き・日付の列だけ `nullLabel` で書き、書式なしの文字列の列は空欄のまま。
1590
+ *
1591
+ * @example
1592
+ * meta: { format: "number", nullLabel: "未集計" }
1593
+ * meta: { nullLabel: "未設定" } // 書式なしの文字列の列
1594
+ */
1595
+ nullLabel?: string;
1596
+ /**
1597
+ * 値の範囲でセルを意味色に塗り分ける規則(最初に当たった規則。どれにも当たらない値は通常色)。
1598
+ * `cell` を持たない列だけに効き、BarChart / BarList の `thresholds` と同じ型・同じ判定。
1599
+ * 色だけに頼らず、色に応じた記号(○ / △ / × / −)を値の前に添える。CSV は生の値のまま。
1600
+ *
1601
+ * @example
1602
+ * meta: { format: { type: "percent", divisor: 100 }, thresholds: [{ lt: 40, tone: "negative" }, { lt: 70, tone: "warning" }] }
1603
+ */
1604
+ thresholds?: ChartThreshold[];
1605
+ /**
1606
+ * 狭い幅で列を隠す順。数が小さい列から隠れる(表の置き場の幅が 1 は 640px 未満、2 は 520px 未満、3 は 400px 未満)。
1607
+ * 書かない列と 4 以上の列は、どの幅でも出す(部署名・離職率のような肝心の列に使う)。
1608
+ * 画面の幅ではなく、表を置いた場所の幅(コンテナ幅)で決まる。隠した列は DOM にも読み上げにも出ず、CSV の出力には含まれる。
1609
+ *
1610
+ * @example
1611
+ * meta: { format: "number", priority: 1 } // 幅が足りないときに最初に隠す
1612
+ */
1613
+ priority?: number;
1614
+ /**
1615
+ * true にすると、増減(`Delta`)など「直前の列の値との比較」を表示する列になる。表の置き場が 320px 未満に狭まると、
1616
+ * この列は隠れる代わりに、直前の列(値の列)のセルの下に同じ内容を小さく(text-xs)積んで出す。比較は消えない。
1617
+ * `priority` で隠す順は最後(どの列よりも後)になり、この列の `priority` は無視される。直前の列も `priority` に関わらず残る。
1618
+ * 列の `cell` に `<Delta variant="inline" … />` を書く。直前に列が無いときは積まず、通常の列として出す。CSV には通常の列として含まれる。
1619
+ *
1620
+ * @example
1621
+ * { accessorKey: "revenue", header: "売上", meta: { format: "currency" } },
1622
+ * { id: "revenueDelta", header: "前月比", meta: { comparison: true }, cell: ({ row }) => <Delta variant="inline" value={row.original.revenue} comparison={{ previous: row.original.prev, vs: "prior-period", grain: "month" }} /> }
1623
+ */
1624
+ comparison?: boolean;
1625
+ /**
1626
+ * 列の寄せ。見出し(ソートボタンを含む)とセルの両方に効く。既定は、`format` / `thresholds` の列と
1627
+ * `comparison` の列(増減 `Delta`)が `"right"`、それ以外は `"left"`。右寄せの列は tabular-nums で描く。
1628
+ *
1629
+ * @example
1630
+ * meta: { align: "right" }
1631
+ */
1632
+ align?: "left" | "right";
1633
+ }
1634
+ }
546
1635
  interface DataTableContextValue<TData> {
547
1636
  table: Table<TData>;
548
1637
  selectedRows: TData[];
@@ -553,6 +1642,7 @@ interface DataTableContextValue<TData> {
553
1642
  enablePagination: boolean;
554
1643
  enableRowSelection: boolean;
555
1644
  visibleColumnCount: number;
1645
+ isLoading: boolean;
556
1646
  }
557
1647
  /**
558
1648
  * @template TData 行データ型
@@ -567,7 +1657,8 @@ interface DataTableProps<TData, TValue> {
567
1657
  * literal が `string` に拡張され型エラーになる。
568
1658
  *
569
1659
  * @example
570
- * import type { ColumnDef } from "@squadbase/vantage/components"
1660
+ * import { DataTable, type ColumnDef } from "@/components/data-table"
1661
+ * // Vantage: import { DataTable, type ColumnDef } from "@squadbase/vantage/components"
571
1662
  *
572
1663
  * const columns: ColumnDef<User>[] = [
573
1664
  * { accessorKey: "id", header: "ID" },
@@ -588,12 +1679,54 @@ interface DataTableProps<TData, TValue> {
588
1679
  enablePagination?: boolean;
589
1680
  pagination?: PaginationState;
590
1681
  onPaginationChange?: OnChangeFn<PaginationState>;
1682
+ /**
1683
+ * サーバー側ページング時の総ページ数。指定すると manualPagination になる。
1684
+ *
1685
+ * @example
1686
+ * <DataTable pageCount={data.pageCount} … />
1687
+ */
591
1688
  pageCount?: number;
1689
+ /**
1690
+ * サーバー側ページング時の総件数。指定すると manualPagination になり、ページ数は
1691
+ * `rowCount / pageSize` から導かれ、「N件中」もこの値を使う(`pageCount` を同時に渡せばそちらが優先)。
1692
+ *
1693
+ * @example
1694
+ * <DataTable rowCount={1240} pagination={pagination} onPaginationChange={setPagination} … />
1695
+ */
1696
+ rowCount?: number;
1697
+ /**
1698
+ * true にすると絞り込みを表では行わず、`data` をそのまま使う(サーバー側で絞り込む)。
1699
+ *
1700
+ * @example
1701
+ * <DataTable manualFiltering globalFilter={q} onGlobalFilterChange={setQ} … />
1702
+ */
1703
+ manualFiltering?: boolean;
1704
+ /**
1705
+ * true にすると並べ替えを表では行わず、`data` の順をそのまま使う(サーバー側で並べ替える)。
1706
+ *
1707
+ * @example
1708
+ * <DataTable manualSorting sorting={sorting} onSortingChange={setSorting} … />
1709
+ */
1710
+ manualSorting?: boolean;
1711
+ /**
1712
+ * 読み込み中。Content はスケルトン行、Pagination のボタンは無効、表は aria-busy になる。
1713
+ *
1714
+ * @example
1715
+ * <DataTable isLoading={query.isFetching} … />
1716
+ */
1717
+ isLoading?: boolean;
592
1718
  enableRowSelection?: boolean;
593
1719
  rowSelection?: RowSelectionState;
594
1720
  onRowSelectionChange?: OnChangeFn<RowSelectionState>;
595
1721
  columnVisibility?: VisibilityState;
596
1722
  onColumnVisibilityChange?: OnChangeFn<VisibilityState>;
1723
+ /**
1724
+ * TanStack Table の `meta`。表全体で共有する値(行を更新する関数など)を渡し、列定義の `cell` から
1725
+ * `table.options.meta` で読む。列ごとの書式は列定義の `meta.format` に書く(こちらではない)。
1726
+ *
1727
+ * @example
1728
+ * <DataTable meta={{ updateRow: (id, patch) => mutate({ id, patch }) }} … />
1729
+ */
597
1730
  meta?: TableMeta<TData>;
598
1731
  className?: string;
599
1732
  /** Required — the parts to render (toolbar, content, pagination). */
@@ -606,6 +1739,32 @@ interface DataTableToolbarProps extends HTMLAttributes<HTMLDivElement> {
606
1739
  }
607
1740
  interface DataTableContentProps extends HTMLAttributes<HTMLDivElement> {
608
1741
  }
1742
+ interface DataTableExportProps {
1743
+ /**
1744
+ * 保存するファイル名。既定 `"export.csv"`。
1745
+ *
1746
+ * @example
1747
+ * <DataTableExport fileName="sales-2025.csv" />
1748
+ */
1749
+ fileName?: string;
1750
+ /**
1751
+ * `"display"`(既定)は `meta.format` どおりの表示文字列、`"raw"` は生の値を書き出す。
1752
+ *
1753
+ * @example
1754
+ * <DataTableExport values="raw" />
1755
+ */
1756
+ values?: CsvValues;
1757
+ /**
1758
+ * `"filtered"`(既定)は並べ替え・絞り込み後の全ページ、`"page"` は表示中のページだけ。
1759
+ *
1760
+ * @example
1761
+ * <DataTableExport scope="page" />
1762
+ */
1763
+ scope?: CsvScope;
1764
+ /** ボタンの文言。既定 `"CSV を書き出す"`。 */
1765
+ children?: ReactNode;
1766
+ className?: string;
1767
+ }
609
1768
  interface DataTablePaginationProps extends HTMLAttributes<HTMLDivElement> {
610
1769
  pageSizeOptions?: number[];
611
1770
  }
@@ -618,12 +1777,26 @@ interface DataTableColumnVisibilityProps {
618
1777
  type DataTablePresetProps<TData, TValue> = Omit<DataTableProps<TData, TValue>, "children"> & {
619
1778
  enableColumnVisibility?: boolean;
620
1779
  columnLabels?: Record<string, string>;
1780
+ /**
1781
+ * true にすると toolbar に CSV 書き出しボタン(`DataTableExport`)を置く。既定 false。
1782
+ *
1783
+ * @example
1784
+ * <DataTablePreset exportable … />
1785
+ */
1786
+ exportable?: boolean;
1787
+ /**
1788
+ * `exportable` のときの保存ファイル名。既定 `"export.csv"`。
1789
+ *
1790
+ * @example
1791
+ * <DataTablePreset exportable exportFileName="sales.csv" … />
1792
+ */
1793
+ exportFileName?: string;
621
1794
  /** Extension slots */
622
1795
  toolbar?: ReactNode;
623
1796
  bulkActions?: (selectedRows: TData[]) => ReactNode;
624
1797
  };
625
1798
  declare function useDataTable<TData>(): DataTableContextValue<TData>;
626
- declare function DataTable<TData, TValue>({ columns, data, enableSorting, sorting: sortingProp, onSortingChange, enableFiltering, columnFilters: columnFiltersProp, onColumnFiltersChange, globalFilter: globalFilterProp, onGlobalFilterChange, enablePagination, pagination: paginationProp, onPaginationChange, pageCount, enableRowSelection, rowSelection: rowSelectionProp, onRowSelectionChange, columnVisibility: columnVisibilityProp, onColumnVisibilityChange, meta, className, children, }: DataTableProps<TData, TValue>): React.JSX.Element;
1799
+ declare function DataTable<TData, TValue>({ columns, data, enableSorting, sorting: sortingProp, onSortingChange, enableFiltering, columnFilters: columnFiltersProp, onColumnFiltersChange, globalFilter: globalFilterProp, onGlobalFilterChange, enablePagination, pagination: paginationProp, onPaginationChange, pageCount, rowCount, manualFiltering, manualSorting, isLoading, enableRowSelection, rowSelection: rowSelectionProp, onRowSelectionChange, columnVisibility: columnVisibilityProp, onColumnVisibilityChange, meta, className, children, }: DataTableProps<TData, TValue>): React.JSX.Element;
627
1800
  declare namespace DataTable {
628
1801
  var displayName: string;
629
1802
  }
@@ -631,8 +1804,39 @@ declare const DataTableToolbar: React.ForwardRefExoticComponent<DataTableToolbar
631
1804
  declare const DataTableContent: React.ForwardRefExoticComponent<DataTableContentProps & React.RefAttributes<HTMLDivElement>>;
632
1805
  declare const DataTablePagination: React.ForwardRefExoticComponent<DataTablePaginationProps & React.RefAttributes<HTMLDivElement>>;
633
1806
  declare const DataTableColumnVisibility: React.ForwardRefExoticComponent<DataTableColumnVisibilityProps & React.RefAttributes<HTMLButtonElement>>;
1807
+ type CsvCell = string | number | null | undefined;
1808
+ type CsvValues = "display" | "raw";
1809
+ type CsvScope = "filtered" | "page";
1810
+ /**
1811
+ * CSV 文字列を作る純関数(RFC 4180: CRLF、`,` `"` 改行を含む欄は `"` で囲み `"` は二重化)。
1812
+ * 既定で BOM 付き UTF-8(Excel で文字化けしない)。`guardFormulas` が true の間、先頭が
1813
+ * `= + - @` の文字列欄には `'` を付けて数式として実行されないようにする(数値と符号付きの数値表記は除く)。
1814
+ *
1815
+ * @example
1816
+ * toCsv(["月", "売上"], [["2025-01", 1200], ["2025-02", null]])
1817
+ * // "\uFEFF月,売上\r\n2025-01,1200\r\n2025-02,"
1818
+ */
1819
+ declare function toCsv(header: string[], rows: CsvCell[][], options?: {
1820
+ bom?: boolean;
1821
+ guardFormulas?: boolean;
1822
+ }): string;
1823
+ /**
1824
+ * 表の現在の状態から CSV を作る。行は画面と同じ並べ替え・絞り込み後の順、列は表示中の列のみ。
1825
+ *
1826
+ * @example
1827
+ * const csv = tableToCsv(table, { values: "raw", scope: "page" })
1828
+ */
1829
+ declare function tableToCsv<TData>(table: Table<TData>, { values, scope }?: {
1830
+ values?: CsvValues;
1831
+ scope?: CsvScope;
1832
+ }): string;
1833
+ /** toolbar に置く CSV 書き出しボタン。`useDataTable()` の table から画面と同じ順・同じ集合を書き出す。 */
1834
+ declare function DataTableExport({ fileName, values, scope, children, className, }: DataTableExportProps): React.JSX.Element;
1835
+ declare namespace DataTableExport {
1836
+ var displayName: string;
1837
+ }
634
1838
  /** The usual arrangement — toolbar, body and pagination — in one component. */
635
- declare function DataTablePreset<TData, TValue>({ enableColumnVisibility, columnLabels, toolbar, bulkActions, ...tableProps }: DataTablePresetProps<TData, TValue>): React.JSX.Element;
1839
+ declare function DataTablePreset<TData, TValue>({ enableColumnVisibility, columnLabels, exportable, exportFileName, toolbar, bulkActions, ...tableProps }: DataTablePresetProps<TData, TValue>): React.JSX.Element;
636
1840
  declare namespace DataTablePreset {
637
1841
  var displayName: string;
638
1842
  }
@@ -650,9 +1854,15 @@ interface FilterBarSelectProps {
650
1854
  label: string;
651
1855
  options: FilterOption[];
652
1856
  placeholder?: string;
1857
+ /**
1858
+ * 渡すと、選択肢の先頭に「絞り込まない」項目をこの文言で足す(例: `"すべて"`)。選ぶとこのキーを値から外す(`undefined`)ので、
1859
+ * アクティブチップにも出ない。絞り込んでいないときのトリガーは `placeholder`(既定は `label`)のまま。既定は足さない。
1860
+ * @example allLabel="すべて"
1861
+ */
1862
+ allLabel?: string;
653
1863
  className?: string;
654
1864
  }
655
- declare function FilterBarSelect({ filterKey, label, options, placeholder, className, }: FilterBarSelectProps): React.JSX.Element;
1865
+ declare function FilterBarSelect({ filterKey, label, options, placeholder, allLabel, className, }: FilterBarSelectProps): React.JSX.Element;
656
1866
  declare namespace FilterBarSelect {
657
1867
  var displayName: string;
658
1868
  }
@@ -698,23 +1908,47 @@ declare namespace FilterBarPreset {
698
1908
  var displayName: string;
699
1909
  }
700
1910
 
1911
+ /** 既定のプリセット(英語・4 月始まり)。`locale` / `fiscalYearStartMonth` を変えるなら `createDatePresets` か DateRangePicker の同名 props。 */
701
1912
  declare const defaultPresets: PresetItem[];
702
1913
  interface DateRangePickerProps {
703
1914
  /**
704
- * 選択中の日付範囲。型は Vantage 独自の `DateRange`。
1915
+ * 選択中の日付範囲。型はこの部品独自の `DateRange`。
705
1916
  * react-day-picker の `DateRange` とは別物なので注意 — そちらが必要なら
706
1917
  * このファイルの末尾で re-export している `RdpDateRange` を使う。
707
1918
  *
708
1919
  * @example
709
- * import type { DateRange } from "@squadbase/vantage/components"
1920
+ * import { DateRangePicker, type DateRange } from "@/components/date-range-picker"
1921
+ * // Vantage: import { DateRangePicker, type DateRange } from "@squadbase/vantage/components"
710
1922
  *
711
1923
  * const [range, setRange] = useState<DateRange | undefined>()
712
1924
  * <DateRangePicker value={range} onChange={setRange} />
713
1925
  */
714
1926
  value?: DateRange;
715
1927
  onChange?: (range: DateRange) => void;
1928
+ /**
1929
+ * ショートカットの一覧。指定すると `locale` / `fiscalYearStartMonth` による既定の一覧の代わりに使う。
1930
+ *
1931
+ * @example
1932
+ * presets={[{ label: "直近 10 日", getValue: () => ({ from: subDays(new Date(), 9), to: new Date() }) }]}
1933
+ */
716
1934
  presets?: PresetItem[];
717
1935
  showPresets?: boolean;
1936
+ /**
1937
+ * プリセットのラベルとカレンダーの月名・曜日の言語。`ja*` なら日本語、それ以外は英語。既定 `"en-US"`(英語)。
1938
+ * 他部品の既定は ja-JP だが、この部品は従来のプリセットが英語だったので既存の見た目を保つため英語を既定にしている。
1939
+ *
1940
+ * @example
1941
+ * <DateRangePicker locale="ja-JP" />
1942
+ */
1943
+ locale?: string;
1944
+ /**
1945
+ * 年度の開始月(1-12)。「今年度」「前年度」と、年度基準の「今四半期」「前四半期」の区切りになる。既定 `4`(4 月始まり)。
1946
+ * 範囲外・整数でない値は 4 として扱う。
1947
+ *
1948
+ * @example
1949
+ * <DateRangePicker fiscalYearStartMonth={1} />
1950
+ */
1951
+ fiscalYearStartMonth?: number;
718
1952
  maxDate?: Date;
719
1953
  minDate?: Date;
720
1954
  placeholder?: string;
@@ -775,29 +2009,287 @@ declare const metricValueVariants: (props?: ({
775
2009
  } & class_variance_authority_types.ClassProp) | undefined) => string;
776
2010
  interface MetricValueProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof metricValueVariants> {
777
2011
  }
2012
+ /** @deprecated KPI の数字は KpiCard を使う。 */
778
2013
  declare const MetricValue: React.ForwardRefExoticComponent<MetricValueProps & React.RefAttributes<HTMLDivElement>>;
779
2014
  interface MetricUnitProps extends HTMLAttributes<HTMLSpanElement> {
780
2015
  }
2016
+ /** @deprecated KPI の単位は KpiCard の `format`(`{ type: "number", unit: "社" }`)で付ける。 */
781
2017
  declare const MetricUnit: React.ForwardRefExoticComponent<MetricUnitProps & React.RefAttributes<HTMLSpanElement>>;
782
2018
 
2019
+ /**
2020
+ * Lightweight KPI insights: progress toward a target (with a simple linear pace
2021
+ * projection) and "highest / lowest in N periods" record detection. No statistics.
2022
+ *
2023
+ * Both follow `polarity`: for a lower-is-better metric (churn, cost) the target
2024
+ * is met at or below it, and the record is the lowest value, never the highest.
2025
+ */
2026
+
2027
+ interface KpiPeriod {
2028
+ start: Date | string | number;
2029
+ end: Date | string | number;
2030
+ }
2031
+ interface TargetProgress {
2032
+ target: number;
2033
+ /**
2034
+ * Distance left to the target, never negative: `target − current` when higher
2035
+ * is better, `current − target` when lower is better. 0 once achieved.
2036
+ */
2037
+ remaining: number;
2038
+ /** Whether the current value meets the target (≥ for higher-is-better, ≤ for lower-is-better). */
2039
+ achieved: boolean;
2040
+ /**
2041
+ * How far the target is met, as a ratio: `current / target` when higher is
2042
+ * better, `target / current` when lower is better (1 = exactly on target).
2043
+ */
2044
+ achievement: number;
2045
+ /** achievement / elapsed when the period is in progress, else null. Higher-is-better only. */
2046
+ projected: number | null;
2047
+ /** Fraction of the period elapsed at `now`, or null without a valid period. */
2048
+ elapsed: number | null;
2049
+ }
2050
+ declare function computeTargetProgress(current: number | null | undefined, target: number | null | undefined, options?: {
2051
+ period?: KpiPeriod;
2052
+ now?: Date | number;
2053
+ polarity?: Polarity;
2054
+ }): TargetProgress | null;
2055
+ /** @deprecated Use `PeriodGrain` (same values). */
2056
+ type HistoryGrain = PeriodGrain;
2057
+ /**
2058
+ * The grain of a period from its length: ~1 day, 7 days, 28–31 days, 89–92 days
2059
+ * or 365–366 days. Anything else (a custom range) returns undefined.
2060
+ */
2061
+ declare function inferPeriodGrain(period: KpiPeriod | null | undefined): PeriodGrain | undefined;
2062
+ interface RecordInsight {
2063
+ span: number;
2064
+ grain: PeriodGrain;
2065
+ /** "highest" for higher-is-better, "lowest" for lower-is-better. */
2066
+ kind: "highest" | "lowest";
2067
+ label: string;
2068
+ }
2069
+ /** Fewer finite points than this never yields a record. */
2070
+ declare const RECORD_MIN_POINTS = 6;
2071
+ /**
2072
+ * The latest point is a record when it beats every earlier finite point:
2073
+ * strictly highest for higher-is-better, strictly lowest for lower-is-better.
2074
+ */
2075
+ declare function detectRecord(history: ReadonlyArray<number | null | undefined> | null | undefined, grain?: PeriodGrain, polarity?: Polarity): RecordInsight | null;
2076
+
2077
+ interface KpiCardSource {
2078
+ /** Period the data covers (e.g. "2023-04 以降"). ISO year-months / dates in it are written by the card ("2023年4月 以降"). */
2079
+ period?: string;
2080
+ /** Number of rows aggregated; formatted by the card ("48,210件から集計"). */
2081
+ count?: number;
2082
+ /**
2083
+ * 集計から除いた行数。出典の脚注に「12件を除外」と添える(ja 以外は「12 excluded」)。0 や負の値は出さない。
2084
+ * 除外の理由(テスト用アカウント、欠損など)は `note` に書く。
2085
+ * @example source={{ count: 48_210, excluded: 12, note: "テスト用アカウントを除外" }}
2086
+ */
2087
+ excluded?: number;
2088
+ /** Data source name (e.g. "Snowflake"). */
2089
+ name?: string;
2090
+ /** 換算・税抜などの脚注。フッターに出す。例: `note: "税抜、1 ドル=150 円で換算"`。数字を使う説明は summary ではなくここへ。 */
2091
+ note?: string;
2092
+ }
2093
+ interface KpiCardProps extends Omit<ComponentProps<"div">, "children"> {
2094
+ /** Metric name (tier 1). */
2095
+ label: string;
2096
+ /** Current value (tier 2). null / undefined renders "—". */
2097
+ value: number | null | undefined;
2098
+ /**
2099
+ * Value format, also used for previous / target / remaining. Default `"compact"`.
2100
+ * `"currency"` is JPY in 万・億; `"percent"` takes a ratio (0.021 → 2.1%) and
2101
+ * switches the delta to points. See `formatValue` for the full table.
2102
+ */
2103
+ format?: ValueFormat;
2104
+ /** Default `"ja-JP"`. */
2105
+ locale?: string;
2106
+ /**
2107
+ * What the value is compared against; drives the delta (tier 3) and previous line (tier 4).
2108
+ * 前期・前年・目標以外は `vs: "custom"` + `label`(バッジの呼び名。末尾の「比」を外した語が前期実績行の呼び名になる)。
2109
+ * @example comparison={{ previous: 617, vs: "custom", label: "昨日比" }}
2110
+ */
2111
+ comparison?: Comparison;
2112
+ /**
2113
+ * 前年比と前月比など、複数の比較を併記する。先頭だけが前期実績行と summary に使われ、2 つ目以降は Delta 行のみ。`comparison` も渡したらそれが先頭。バッジは値の下に並ぶ。
2114
+ * @example comparisons={[{ previous: 4_290, vs: "prior-period", grain: "month" }, { previous: 3_900, vs: "prior-year", grain: "month" }]} / comparisons={[{ previous: 617, vs: "custom", label: "昨日比" }, { previous: 590, vs: "custom", label: "先週の同じ曜日比" }]}
2115
+ */
2116
+ comparisons?: Comparison[];
2117
+ /**
2118
+ * 確定前の値。値の隣に「速報」バッジを出し、目標の「達成」を言い切らず、最高記録の判定も出さない。
2119
+ * @example provisional / provisional={{ label: "暫定" }}
2120
+ */
2121
+ provisional?: boolean | {
2122
+ label?: string;
2123
+ };
2124
+ /** Whether a rise is good. Default `"higher-is-better"`. `"neutral"` never colours the change and skips the target and record logic. */
2125
+ polarity?: Polarity;
2126
+ /** `"relative"` ("+12.4%"), `"points"` ("-0.5pt") or `"difference"` ("+¥530万", in `format`). Default: points for a `percent` format, else relative. */
2127
+ change?: ChangeDisplay;
2128
+ /** Absolute ratio below which the change reads as flat. Default 0.01. */
2129
+ neutralBand?: number;
2130
+ /** Show the previous actual ("前月 400"). Default true; needs `comparison`. */
2131
+ showPrevious?: boolean;
2132
+ /** Conclusion sentence template (tier 5); see the placeholders above. */
2133
+ summary?: string;
2134
+ /**
2135
+ * Target for the current period. Under the value it adds a 6px bar (actual, the pace
2136
+ * projection, a tick at the target) and one line "目標の 49%・このペースなら 98%"
2137
+ * (the projection only while `period` is in progress). With `polarity="lower-is-better"`
2138
+ * or a rate target (points) there is no bar: "目標 … まであと …" in the footer.
2139
+ */
2140
+ target?: number;
2141
+ /**
2142
+ * 目標行・見込み行での目標の呼び名。既定「目標」。予算・計画・ノルマなど業務の言葉に合わせる。
2143
+ * @example targetLabel="予算" // 予算まであと ¥2,934万(98.1% 達成)
2144
+ */
2145
+ targetLabel?: string;
2146
+ /**
2147
+ * 目標に対する進み具合の出し方。`"achievement"` は達成率(現在値 ÷ 目標。「98.1% 達成」)、`"points"` は目標との差(「あと 2.8pt」)。
2148
+ * 既定は `format` から決まる: `percent`(率)は `"points"`(率を率で割った達成度は読めない)、それ以外は `"achievement"`。
2149
+ * `"points"` のとき `{achievement}` は目標との符号付きの差("-2.8pt")になり、見込み行は出ない。
2150
+ */
2151
+ targetDisplay?: "achievement" | "points";
2152
+ /** Current period; with `target`, adds a pace projection while the period is in progress. */
2153
+ period?: KpiPeriod;
2154
+ /** Series ending at the current period (last point = `value`); adds a record badge. */
2155
+ history?: ReadonlyArray<number | null | undefined>;
2156
+ /** Grain of `history` (and of the comparison labels). Default: inferred from `period`, else `"month"` for the record. */
2157
+ historyGrain?: PeriodGrain;
2158
+ /**
2159
+ * `history` が 6 点以上あるとき、フッター末尾に軸なしのスパークライン(高さ 32px・`--chart-1`・最新点だけドット)を出す。既定 true。
2160
+ * 推移を出したくないカードは `showHistory={false}`(記録バッジは `history` があれば出る)。
2161
+ * @example showHistory={false}
2162
+ */
2163
+ showHistory?: boolean;
2164
+ /** Data source footnote. */
2165
+ source?: KpiCardSource;
2166
+ /** When the data was last refreshed: "3 分前に更新". 出し方は `updatedAtDisplay`。 */
2167
+ updatedAt?: Date | string | number;
2168
+ /**
2169
+ * `updatedAt` の出し方。`"relative"`(既定)は「3 分前に更新」、`"absolute"` は「2026/10/20 14:30 に更新」、
2170
+ * `"both"` は「2026/10/20 14:30 に更新(3 分前)」。絶対時刻は実行環境のタイムゾーンで出す(`timeZone` で固定できる)。
2171
+ * 画面を印刷・スクリーンショットで残すなら、時間が経っても読める `"absolute"` か `"both"`。
2172
+ * @example updatedAtDisplay="absolute"
2173
+ */
2174
+ updatedAtDisplay?: "relative" | "absolute" | "both";
2175
+ /**
2176
+ * `updatedAt` の絶対時刻(`updatedAtDisplay` が `"absolute"` / `"both"`)を出すタイムゾーン(IANA 名。例 `"Asia/Tokyo"`)。
2177
+ * 既定は実行環境(ブラウザ)のタイムゾーン。サーバーとブラウザで表示が食い違う(SSR)なら固定する。「3 分前」には影響しない。
2178
+ * @example updatedAtDisplay="absolute" timeZone="Asia/Tokyo"
2179
+ */
2180
+ timeZone?: string;
2181
+ /** Reference time for the projection and relative time (for deterministic rendering). */
2182
+ now?: Date | number;
2183
+ /** Render a skeleton with the final shape instead of the values. */
2184
+ isLoading?: boolean;
2185
+ /**
2186
+ * `"sm"` は Sheet の中など狭い場所で 2 枚を横に並べるときの小さいサイズ。値の文字と余白が一段小さくなり、スパークラインは出さない。既定 `"default"`。
2187
+ * @example size="sm"
2188
+ */
2189
+ size?: "default" | "sm";
2190
+ }
2191
+ /**
2192
+ * Fill `{name}` placeholders from `values`. Unknown names stay as written.
2193
+ *
2194
+ * Without `fallback`, a known name whose value is null / undefined / empty
2195
+ * becomes "—". With `fallback`, any such missing value replaces the whole
2196
+ * sentence with `fallback` (which may be null to drop it).
2197
+ */
2198
+ declare function fillKpiTemplate(template: string, values: Readonly<Record<string, string | null | undefined>>): string;
2199
+ declare function fillKpiTemplate(template: string, values: Readonly<Record<string, string | null | undefined>>, fallback: string | null): string | null;
2200
+ declare function KpiCard({ label, value, format, locale, comparison: comparisonProp, comparisons, provisional, polarity, change, neutralBand, showPrevious, summary, target, targetLabel, targetDisplay, period, history, historyGrain, showHistory, source, updatedAt, updatedAtDisplay, timeZone, now, isLoading, size, className, ...props }: KpiCardProps): React.JSX.Element;
2201
+
2202
+ declare const deltaVariants: (props?: ({
2203
+ variant?: "inline" | "badge" | null | undefined;
2204
+ sentiment?: "negative" | "neutral" | "positive" | null | undefined;
2205
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
2206
+ interface DeltaProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children">, Pick<VariantProps<typeof deltaVariants>, "variant"> {
2207
+ /** The current value. The previous one comes from `comparison`. */
2208
+ value: number | null | undefined;
2209
+ /** What the value is compared against. Required so the delta always carries its label. */
2210
+ comparison: Comparison;
2211
+ /** Whether a rise is good. Default `"higher-is-better"`. */
2212
+ polarity?: Polarity;
2213
+ /** Absolute ratio below which the change reads as flat (0.01 = 1%). Default 0.01. */
2214
+ neutralBand?: number;
2215
+ /** Format of the metric itself; a `percent` metric shows its change in points. */
2216
+ format?: ValueFormat;
2217
+ /**
2218
+ * `"relative"` ("+12.4%"), `"points"` ("-0.5pt") or `"difference"` (the absolute difference in the
2219
+ * metric's own `format`, "+¥530万"). Default: points for a `percent` format, else relative.
2220
+ */
2221
+ change?: ChangeDisplay;
2222
+ /**
2223
+ * 変化(`"relative"` の率・`"points"` の pt)の小数桁数。固定で、末尾の 0 も出す。例: `digits={2}` → "+0.14pt"。
2224
+ * 同じカード群で桁がばらつかないよう、全部に同じ値を渡す。未指定は 1 桁("+14.0%")。`"points"` は未指定のとき `format.digits` に従う。
2225
+ */
2226
+ digits?: number;
2227
+ /** Locale for the change. Default `"ja-JP"`. */
2228
+ locale?: string;
2229
+ /** Show the comparison label ("前月比") after the change. Default true. */
2230
+ showLabel?: boolean;
2231
+ }
2232
+ /** Text shown when the values cannot be compared (no previous value, or a zero baseline): the same "—" as every missing value. */
2233
+ declare const DELTA_NOT_COMPARABLE = "\u2014";
2234
+ declare const Delta: React.ForwardRefExoticComponent<DeltaProps & React.RefAttributes<HTMLSpanElement>>;
2235
+
2236
+ /**
2237
+ * @deprecated 新規は Delta を使う。value/direction を別々に受けるため食い違える(C4)。
2238
+ */
783
2239
  interface TrendIndicatorProps {
784
2240
  value: number;
785
2241
  direction: TrendDirection;
786
2242
  positiveIsGood?: boolean;
787
2243
  className?: string;
788
2244
  }
2245
+ /**
2246
+ * Arrow plus percentage change.
2247
+ *
2248
+ * @deprecated 新規は Delta を使う。value/direction を別々に受けるため食い違える(C4)。
2249
+ */
789
2250
  declare const TrendIndicator: React.ForwardRefExoticComponent<TrendIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
790
2251
 
791
2252
  interface StatusBadgeProps {
792
2253
  status: string;
793
2254
  label?: string;
2255
+ /** status → tone (`positive` | `negative` | `warning` | `info` | `neutral`) or legacy colour name. */
794
2256
  colorMap?: Partial<Record<string, string>>;
795
2257
  className?: string;
796
2258
  }
797
2259
  declare const StatusBadge: React.ForwardRefExoticComponent<StatusBadgeProps & React.RefAttributes<HTMLSpanElement>>;
798
2260
 
2261
+ declare function formatRelativeTime(date: Date | string | number, options?: {
2262
+ now?: Date | number;
2263
+ locale?: string;
2264
+ }): string;
2265
+
799
2266
  interface PlaceholderProps extends HTMLAttributes<HTMLSpanElement> {
800
2267
  }
801
2268
  declare const Placeholder: React.ForwardRefExoticComponent<PlaceholderProps & React.RefAttributes<HTMLSpanElement>>;
802
2269
 
803
- export { AppShell, type AppShellHeaderProps, type AppShellProps, type AppShellSidebarProps, AreaChart, type AreaChartProps, BarChart, type BarChartProps, BarList, type BarListItem, type BarListProps, CategoryBar, type CategoryBarMarker, type CategoryBarProps, type ChartColor, type ChartEventPayload, DashboardCard, DashboardCardAction, type DashboardCardActionProps, DashboardCardContent, type DashboardCardContentProps, DashboardCardDescription, type DashboardCardDescriptionProps, DashboardCardFooter, type DashboardCardFooterProps, DashboardCardHeader, type DashboardCardHeaderProps, DashboardCardPreset, type DashboardCardPresetProps, type DashboardCardProps, DashboardCardSkeleton, type DashboardCardSkeletonProps, DashboardCardTitle, type DashboardCardTitleProps, DataTable, DataTableColumnVisibility, type DataTableColumnVisibilityProps, DataTableContent, type DataTableContentProps, DataTablePagination, type DataTablePaginationProps, DataTablePreset, type DataTablePresetProps, type DataTableProps, DataTableToolbar, type DataTableToolbarProps, type DateRange, DateRangePicker, type DateRangePickerProps, DonutChart, type DonutChartProps, EChart, type EChartProps, FilterBar, FilterBarActiveChips, type FilterBarActiveChipsProps, FilterBarClearButton, type FilterBarClearButtonProps, FilterBarMultiSelect, type FilterBarMultiSelectProps, FilterBarPreset, type FilterBarPresetProps, type FilterBarProps, FilterBarSelect, type FilterBarSelectProps, type FilterConfig, type FilterOption, type FilterType, type FilterValues, type FunnelStep, FunnelSteps, type FunnelStepsProps, LineChart, type LineChartProps, type MetricItem, MetricUnit, type MetricUnitProps, MetricValue, type MetricValueProps, type MetricVariant, MultiSelect, type MultiSelectProps, type NavGroup, type NavItem, PageShell, PageShellActions, type PageShellActionsProps, PageShellContent, type PageShellContentProps, PageShellDescription, type PageShellDescriptionProps, PageShellHeader, PageShellHeaderEnd, type PageShellHeaderEndProps, type PageShellHeaderProps, PageShellHeading, type PageShellHeadingProps, PageShellMeta, type PageShellMetaProps, type PageShellProps, PageShellSummary, PageShellSummaryCard, type PageShellSummaryCardProps, type PageShellSummaryProps, PageShellTitle, type PageShellTitleProps, Placeholder, type PlaceholderProps, type PresetItem, ProgressCircle, type ProgressCircleProps, SearchableSelect, type SearchableSelectProps, SectionHeader, type SectionHeaderProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SelectOption, type SelectOptionGroup, type SelectOptions, Sparkline, type SparklineDataPoint, type SparklineProps, type SparklineVariant, StatusBadge, type StatusBadgeProps, Tracker, type TrackerBlock, type TrackerProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, type ValueFormatter, defaultPresets, flattenOptions, funnelStepsVariants, isGroupedOptions, metricValueVariants, pageShellSummaryCardVariants, useDataTable };
2270
+ declare const DEFAULT_SAMPLE_LABEL = "\u898B\u672C\u306E\u5024";
2271
+ interface SampleState {
2272
+ label: string;
2273
+ }
2274
+ /**
2275
+ * The mark a card inside `SampleData` should show, or null. A card that shows it wraps its
2276
+ * content in `<SampleClaim>` so the parts inside do not show it again.
2277
+ */
2278
+ declare function useSampleMark(): SampleState | null;
2279
+ /** Ends the `SampleData` scope for the parts inside a card that already shows the mark. */
2280
+ declare function SampleClaim({ children }: {
2281
+ children?: ReactNode;
2282
+ }): React.JSX.Element;
2283
+ interface SampleBadgeProps extends HTMLAttributes<HTMLSpanElement> {
2284
+ /** 印の文言。既定「見本の値」。 */
2285
+ label?: string;
2286
+ }
2287
+ declare function SampleBadge({ label, className, ...props }: SampleBadgeProps): React.JSX.Element;
2288
+ interface SampleDataProps {
2289
+ /** 印の文言。既定「見本の値」。 */
2290
+ label?: string;
2291
+ children?: ReactNode;
2292
+ }
2293
+ declare function SampleData({ label, children }: SampleDataProps): React.JSX.Element;
2294
+
2295
+ export { AppShell, type AppShellHeaderProps, type AppShellProps, type AppShellSidebarProps, AreaChart, type AreaChartProps, BarChart, type BarChartProps, BarList, type BarListItem, type BarListOptions, type BarListProps, type BarListSortOrder, COMPARISON_LABELS, CategoryBar, type CategoryBarMarker, type CategoryBarProps, type ChangeDisplay, type ChartActionsOptions, type ChartAnnotation, type ChartColor, type ChartColorToken, type ChartColors, type ChartCommonProps, type ChartComparison, type ChartEmptyState, type ChartEventPayload, type ChartForecast, type ChartForecastRow, ChartFrame, type ChartFrameProps, type ChartHighlight, type ChartRootAttributes, type ChartSeriesColor, type ChartSkeletonVariant, type ChartThreshold, type ChartTone, type Comparison, type ComparisonKind, type ComparisonOptions, type ComparisonResult, DEFAULT_SAMPLE_LABEL, DELTA_NOT_COMPARABLE, DashboardCard, DashboardCardAction, type DashboardCardActionProps, DashboardCardContent, type DashboardCardContentProps, DashboardCardDescription, type DashboardCardDescriptionProps, DashboardCardFooter, type DashboardCardFooterProps, DashboardCardHeader, type DashboardCardHeaderProps, DashboardCardPreset, type DashboardCardPresetProps, type DashboardCardProps, DashboardCardSkeleton, type DashboardCardSkeletonProps, DashboardCardTitle, type DashboardCardTitleProps, DataTable, DataTableColumnVisibility, type DataTableColumnVisibilityProps, DataTableContent, type DataTableContentProps, DataTableExport, type DataTableExportProps, DataTablePagination, type DataTablePaginationProps, DataTablePreset, type DataTablePresetProps, type DataTableProps, DataTableToolbar, type DataTableToolbarProps, type DateRange, DateRangePicker, type DateRangePickerProps, DateStyle, Delta, type DeltaDirection, type DeltaProps, type DeltaSentiment, DonutChart, type DonutChartOptions, type DonutChartProps, type DonutVariant, EChart, type EChartProps, FilterBar, FilterBarActiveChips, type FilterBarActiveChipsProps, FilterBarClearButton, type FilterBarClearButtonProps, FilterBarMultiSelect, type FilterBarMultiSelectProps, FilterBarPreset, type FilterBarPresetProps, type FilterBarProps, FilterBarSelect, type FilterBarSelectProps, type FilterConfig, type FilterOption, type FilterType, type FilterValues, type FunnelStep, FunnelSteps, type FunnelStepsProps, Heatmap, type HeatmapProps, type HistoryGrain, KpiCard, type KpiCardProps, type KpiCardSource, type KpiPeriod, Legend, type LegendProps, LineChart, type LineChartProps, type MetricItem, MetricUnit, type MetricUnitProps, MetricValue, type MetricValueProps, type MetricVariant, MultiSelect, type MultiSelectProps, type NavGroup, type NavItem, type NumericKeys, PageShell, PageShellActions, type PageShellActionsProps, PageShellContent, type PageShellContentProps, PageShellDescription, type PageShellDescriptionProps, PageShellHeader, PageShellHeaderEnd, type PageShellHeaderEndProps, type PageShellHeaderProps, PageShellHeading, type PageShellHeadingProps, PageShellMeta, type PageShellMetaProps, type PageShellProps, PageShellSummary, PageShellSummaryCard, type PageShellSummaryCardProps, type PageShellSummaryProps, PageShellTitle, type PageShellTitleProps, type PeriodGrain, Placeholder, type PlaceholderProps, type Polarity, type PresetItem, ProgressCircle, type ProgressCircleProps, RECORD_MIN_POINTS, type RecordInsight, SampleBadge, type SampleBadgeProps, SampleClaim, SampleData, type SampleDataProps, ScatterChart, type ScatterChartProps, type ScatterReferenceLine, SearchableSelect, type SearchableSelectProps, SectionHeader, type SectionHeaderProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SelectOption, type SelectOptionGroup, type SelectOptions, Sparkline, type SparklineDataPoint, type SparklineProps, type SparklineVariant, StatusBadge, type StatusBadgeProps, type TargetProgress, Tracker, type TrackerBlock, type TrackerProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, UpdatedAt, type UpdatedAtProps, ValueFormat, type ValueFormatter, WaterfallChart, type WaterfallChartProps, type WaterfallMode, comparisonBaseline, comparisonLabel, computeComparison, computeTargetProgress, defaultChangeDisplay, defaultPresets, deltaVariants, detectRecord, fillKpiTemplate, flattenOptions, formatChange, formatChangeAmount, formatRelativeTime, funnelStepsVariants, inferPeriodGrain, isGroupedOptions, metricValueVariants, pageShellSummaryCardVariants, tableToCsv, toCsv, toneForValue, useDataTable, useResolvedChartColors, useSampleMark };