@squadbase/vantage 0.6.1 → 0.6.2-dev1.05a930b

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 (237) hide show
  1. package/dist/add-4GHF2TX2.js +6 -0
  2. package/dist/add-4GHF2TX2.js.map +1 -0
  3. package/dist/{build-O5TVNH4E.js → build-X5NVCQKT.js} +9 -9
  4. package/dist/{build-O5TVNH4E.js.map → build-X5NVCQKT.js.map} +1 -1
  5. package/dist/{check-WFBEDHDR.js → check-ZBIH422T.js} +7 -7
  6. package/dist/{check-WFBEDHDR.js.map → check-ZBIH422T.js.map} +1 -1
  7. package/dist/chunk-2ICNHUG6.js +1820 -0
  8. package/dist/chunk-2ICNHUG6.js.map +1 -0
  9. package/dist/{chunk-5ZOP4SQR.js → chunk-2N72FKLB.js} +12 -7
  10. package/dist/chunk-2N72FKLB.js.map +1 -0
  11. package/dist/{chunk-BCE22JSM.js → chunk-7DZGJQ3P.js} +33 -14
  12. package/dist/chunk-7DZGJQ3P.js.map +1 -0
  13. package/dist/{chunk-MXI3PZFT.js → chunk-7S52M2SL.js} +257 -210
  14. package/dist/chunk-7S52M2SL.js.map +1 -0
  15. package/dist/{chunk-QDZA5JSL.js → chunk-AABMKHEU.js} +4 -4
  16. package/dist/{chunk-QDZA5JSL.js.map → chunk-AABMKHEU.js.map} +1 -1
  17. package/dist/{chunk-KLEIVDUV.js → chunk-CEXAQQ5W.js} +150 -11
  18. package/dist/chunk-CEXAQQ5W.js.map +1 -0
  19. package/dist/{chunk-3G43C6OL.js → chunk-GNXCX4WE.js} +46 -3
  20. package/dist/chunk-GNXCX4WE.js.map +1 -0
  21. package/dist/chunk-IUPSBD6W.js +7914 -0
  22. package/dist/chunk-IUPSBD6W.js.map +1 -0
  23. package/dist/{chunk-JGRMRXXZ.js → chunk-JKLLFVEU.js} +3 -3
  24. package/dist/{chunk-JGRMRXXZ.js.map → chunk-JKLLFVEU.js.map} +1 -1
  25. package/dist/chunk-PDOBHMUQ.js +54 -0
  26. package/dist/chunk-PDOBHMUQ.js.map +1 -0
  27. package/dist/{chunk-ZVANIULZ.js → chunk-RNTDBX6S.js} +4 -4
  28. package/dist/{chunk-ZVANIULZ.js.map → chunk-RNTDBX6S.js.map} +1 -1
  29. package/dist/{chunk-A2UUGASH.js → chunk-U736PVHY.js} +2 -2
  30. package/dist/chunk-U736PVHY.js.map +1 -0
  31. package/dist/{chunk-PVTHHV7X.js → chunk-V3LF7BE7.js} +27 -5
  32. package/dist/chunk-V3LF7BE7.js.map +1 -0
  33. package/dist/{chunk-EP6JHXSR.js → chunk-WAMZWZJB.js} +54 -9
  34. package/dist/chunk-WAMZWZJB.js.map +1 -0
  35. package/dist/{chunk-DTDVSFRY.js → chunk-XQUSGIDG.js} +17 -3
  36. package/dist/chunk-XQUSGIDG.js.map +1 -0
  37. package/dist/cli.js +15 -11
  38. package/dist/cli.js.map +1 -1
  39. package/dist/client/index.d.ts +32 -3
  40. package/dist/client/index.js +205 -12
  41. package/dist/client/index.js.map +1 -1
  42. package/dist/components/index.d.ts +1983 -29
  43. package/dist/components/index.js +4 -3
  44. package/dist/{dev-NZRLOQCL.js → dev-4XEDTELV.js} +24 -13
  45. package/dist/dev-4XEDTELV.js.map +1 -0
  46. package/dist/doc/index.d.ts +4 -0
  47. package/dist/doc/index.js +107 -11
  48. package/dist/doc/index.js.map +1 -1
  49. package/dist/{docs-ZGDJUHJI.js → docs-JVP4RPKT.js} +3 -3
  50. package/dist/{docs-ZGDJUHJI.js.map → docs-JVP4RPKT.js.map} +1 -1
  51. package/dist/{doctor-VFKEMR54.js → doctor-5E2VEZPK.js} +8 -8
  52. package/dist/doctor-5E2VEZPK.js.map +1 -0
  53. package/dist/markdown/index.js +1 -1
  54. package/dist/markdown/index.js.map +1 -1
  55. package/dist/{preview-QDCIVVSR.js → preview-T6CLSQVX.js} +12 -4
  56. package/dist/preview-T6CLSQVX.js.map +1 -0
  57. package/dist/query/index.d.ts +0 -11
  58. package/dist/query/index.js +2 -2
  59. package/dist/{routes-RHP5FVGD.js → routes-3SGAFDMC.js} +6 -6
  60. package/dist/{routes-RHP5FVGD.js.map → routes-3SGAFDMC.js.map} +1 -1
  61. package/dist/{search-RFBELGY7.js → search-5LC4XPB5.js} +3 -3
  62. package/dist/{search-RFBELGY7.js.map → search-5LC4XPB5.js.map} +1 -1
  63. package/dist/slide/index.js +63 -17
  64. package/dist/slide/index.js.map +1 -1
  65. package/dist/table/index.js +11 -9
  66. package/dist/table/index.js.map +1 -1
  67. package/dist/ui/index.d.ts +148 -12
  68. package/dist/ui/index.js +1340 -87
  69. package/dist/ui/index.js.map +1 -1
  70. package/dist/{upgrade-GF2P67M6.js → upgrade-JHXZBGQS.js} +7 -7
  71. package/dist/{upgrade-GF2P67M6.js.map → upgrade-JHXZBGQS.js.map} +1 -1
  72. package/dist/vite/index.d.ts +10 -0
  73. package/dist/vite/index.js +4 -4
  74. package/docs/en/changelog.md +24 -0
  75. package/docs/en/cli-reference.md +30 -0
  76. package/docs/en/components.md +29 -15
  77. package/docs/en/parts/data-table.md +22 -0
  78. package/docs/en/parts/delta.md +50 -0
  79. package/docs/en/parts/format.md +43 -0
  80. package/docs/en/parts/kpi-card.md +57 -0
  81. package/docs/en/parts/metric-value.md +3 -2
  82. package/docs/en/parts/page-shell.md +1 -1
  83. package/docs/en/parts/sparkline.md +1 -1
  84. package/docs/en/parts/trend-indicator.md +17 -1
  85. package/docs/en/routing.md +4 -2
  86. package/docs/en/ui-and-theming.md +1 -1
  87. package/docs/index.json +366 -76
  88. package/docs/ja/changelog.md +55 -0
  89. package/docs/ja/cli-reference.md +29 -0
  90. package/docs/ja/components.md +57 -101
  91. package/docs/ja/page-types/csv.md +83 -0
  92. package/docs/ja/page-types/doc.md +83 -0
  93. package/docs/ja/page-types/excel.md +82 -0
  94. package/docs/ja/page-types/slide.md +132 -0
  95. package/docs/ja/page-types.md +47 -0
  96. package/docs/ja/parts/area-chart.md +61 -0
  97. package/docs/ja/parts/bar-chart.md +69 -0
  98. package/docs/ja/parts/bar-list.md +35 -0
  99. package/docs/ja/parts/category-bar.md +36 -0
  100. package/docs/ja/parts/data-table.md +22 -0
  101. package/docs/ja/parts/delta.md +50 -0
  102. package/docs/ja/parts/donut-chart.md +47 -0
  103. package/docs/ja/parts/echart.md +3 -0
  104. package/docs/ja/parts/format.md +44 -0
  105. package/docs/ja/parts/kpi-card.md +55 -0
  106. package/docs/ja/parts/line-chart.md +58 -0
  107. package/docs/ja/parts/metric-value.md +3 -2
  108. package/docs/ja/parts/page-shell.md +1 -1
  109. package/docs/ja/parts/progress-circle.md +34 -0
  110. package/docs/ja/parts/sparkline.md +2 -2
  111. package/docs/ja/parts/tracker.md +32 -0
  112. package/docs/ja/parts/trend-indicator.md +17 -1
  113. package/docs/ja/routing.md +8 -84
  114. package/docs/ja/ui/alert-dialog.md +41 -0
  115. package/docs/ja/ui/avatar.md +31 -0
  116. package/docs/ja/ui/combobox.md +74 -0
  117. package/docs/ja/ui/drawer.md +41 -0
  118. package/docs/ja/ui/field.md +42 -0
  119. package/docs/ja/ui/hover-card.md +21 -0
  120. package/docs/ja/ui/kbd.md +16 -0
  121. package/docs/ja/ui/pagination.md +36 -0
  122. package/docs/ja/ui/radio-group.md +21 -0
  123. package/docs/ja/ui/toast.md +46 -0
  124. package/docs/ja/ui-and-theming.md +14 -7
  125. package/package.json +43 -29
  126. package/registry/ui/accordion.tsx +76 -0
  127. package/registry/ui/alert-dialog.tsx +189 -0
  128. package/registry/ui/alert.tsx +80 -0
  129. package/registry/ui/app-shell.tsx +287 -0
  130. package/registry/ui/area-chart.tsx +3701 -0
  131. package/registry/ui/attention-list.tsx +303 -0
  132. package/registry/ui/avatar.tsx +110 -0
  133. package/registry/ui/badge.tsx +56 -0
  134. package/registry/ui/bar-chart.tsx +3698 -0
  135. package/registry/ui/bar-list.tsx +3743 -0
  136. package/registry/ui/box-plot-chart.tsx +3906 -0
  137. package/registry/ui/breadcrumb.tsx +128 -0
  138. package/registry/ui/button.tsx +62 -0
  139. package/registry/ui/calendar.tsx +223 -0
  140. package/registry/ui/card.tsx +107 -0
  141. package/registry/ui/category-bar.tsx +1290 -0
  142. package/registry/ui/chart-frame.tsx +1393 -0
  143. package/registry/ui/checkbox.tsx +30 -0
  144. package/registry/ui/collapsible.tsx +23 -0
  145. package/registry/ui/combobox.tsx +310 -0
  146. package/registry/ui/command.tsx +198 -0
  147. package/registry/ui/dashboard-card.tsx +217 -0
  148. package/registry/ui/data-table.tsx +693 -146
  149. package/registry/ui/date-range-picker.tsx +390 -0
  150. package/registry/ui/delta.tsx +188 -0
  151. package/registry/ui/dialog.tsx +161 -0
  152. package/registry/ui/donut-chart.tsx +3751 -0
  153. package/registry/ui/drawer.tsx +229 -0
  154. package/registry/ui/dropdown-menu.tsx +274 -0
  155. package/registry/ui/echart.tsx +918 -0
  156. package/registry/ui/field.tsx +240 -0
  157. package/registry/ui/filter-bar.tsx +392 -0
  158. package/registry/ui/funnel-steps.tsx +3569 -0
  159. package/registry/ui/heatmap.tsx +1786 -0
  160. package/registry/ui/histogram-chart.tsx +3986 -0
  161. package/registry/ui/hover-card.tsx +52 -0
  162. package/registry/ui/input-group.tsx +160 -0
  163. package/registry/ui/input.tsx +24 -0
  164. package/registry/ui/kbd.tsx +30 -0
  165. package/registry/ui/kpi-card.tsx +699 -0
  166. package/registry/ui/label.tsx +22 -0
  167. package/registry/ui/legend.tsx +3563 -0
  168. package/registry/ui/line-chart.tsx +3699 -0
  169. package/registry/ui/metric-value.tsx +62 -0
  170. package/registry/ui/multi-select.tsx +232 -0
  171. package/registry/ui/page-shell.tsx +282 -0
  172. package/registry/ui/pagination.tsx +140 -0
  173. package/registry/ui/paired-chart.tsx +3827 -0
  174. package/registry/ui/placeholder.tsx +36 -0
  175. package/registry/ui/popover.tsx +92 -0
  176. package/registry/ui/progress-circle.tsx +867 -0
  177. package/registry/ui/progress.tsx +85 -0
  178. package/registry/ui/radio-group.tsx +39 -0
  179. package/registry/ui/sample-data.tsx +86 -0
  180. package/registry/ui/scatter-chart.tsx +4212 -0
  181. package/registry/ui/scroll-area.tsx +56 -0
  182. package/registry/ui/searchable-select.tsx +214 -0
  183. package/registry/ui/section-header.tsx +43 -0
  184. package/registry/ui/segmented-control.tsx +76 -0
  185. package/registry/ui/select.tsx +255 -0
  186. package/registry/ui/separator.tsx +27 -0
  187. package/registry/ui/sheet.tsx +139 -0
  188. package/registry/ui/sidebar.tsx +725 -0
  189. package/registry/ui/skeleton.tsx +17 -0
  190. package/registry/ui/slider.tsx +56 -0
  191. package/registry/ui/sparkline.tsx +230 -0
  192. package/registry/ui/spinner.tsx +14 -0
  193. package/registry/ui/states.tsx +90 -0
  194. package/registry/ui/status-badge.tsx +121 -0
  195. package/registry/ui/switch.tsx +34 -0
  196. package/registry/ui/table.tsx +118 -0
  197. package/registry/ui/tabs.tsx +84 -0
  198. package/registry/ui/textarea.tsx +22 -0
  199. package/registry/ui/toast.tsx +250 -0
  200. package/registry/ui/toggle-group.tsx +91 -0
  201. package/registry/ui/toggle.tsx +47 -0
  202. package/registry/ui/tooltip.tsx +72 -0
  203. package/registry/ui/tracker.tsx +849 -0
  204. package/registry/ui/trend-indicator.tsx +74 -0
  205. package/registry/ui/updated-at.tsx +122 -0
  206. package/registry/ui/waterfall-chart.tsx +4248 -0
  207. package/skills/vantage-add-feature/SKILL.md +9 -7
  208. package/skills/vantage-design/SKILL.md +12 -2
  209. package/skills/vantage-design/references/format.md +1 -1
  210. package/skills/vantage-pitfalls/SKILL.md +5 -1
  211. package/skills/vantage-slide/SKILL.md +17 -0
  212. package/templates/AGENTS.md +22 -1
  213. package/templates/agents/api.md +29 -0
  214. package/templates/agents/csv.md +2 -1
  215. package/templates/agents/doc.md +6 -3
  216. package/templates/agents/page.md +32 -8
  217. package/templates/agents/slide.md +13 -1
  218. package/templates/agents/xlsx.md +2 -1
  219. package/theme.css +284 -128
  220. package/dist/add-EISGSZAH.js +0 -6
  221. package/dist/add-EISGSZAH.js.map +0 -1
  222. package/dist/chunk-3G43C6OL.js.map +0 -1
  223. package/dist/chunk-5ZOP4SQR.js.map +0 -1
  224. package/dist/chunk-A2UUGASH.js.map +0 -1
  225. package/dist/chunk-BCE22JSM.js.map +0 -1
  226. package/dist/chunk-DTDVSFRY.js.map +0 -1
  227. package/dist/chunk-EP6JHXSR.js.map +0 -1
  228. package/dist/chunk-KLEIVDUV.js.map +0 -1
  229. package/dist/chunk-MXI3PZFT.js.map +0 -1
  230. package/dist/chunk-PLST5Q7T.js +0 -2221
  231. package/dist/chunk-PLST5Q7T.js.map +0 -1
  232. package/dist/chunk-PVTHHV7X.js.map +0 -1
  233. package/dist/chunk-T3FLAGI6.js +0 -316
  234. package/dist/chunk-T3FLAGI6.js.map +0 -1
  235. package/dist/dev-NZRLOQCL.js.map +0 -1
  236. package/dist/doctor-VFKEMR54.js.map +0 -1
  237. package/dist/preview-QDCIVVSR.js.map +0 -1
@@ -0,0 +1,50 @@
1
+ # Delta
2
+
3
+ > The change against a comparison — arrow, signed rate and label, all derived from the values.
4
+
5
+ Shows a change as one line: "↑ +12.4% 前期比". **Direction, rate, colour and wording are all computed
6
+ from `value` and `comparison`** and cannot be passed in, so the arrow and the colour can never disagree.
7
+ Colour is never the only signal — the arrow and the sign always accompany it. For metrics where a rise
8
+ is bad (churn, error rate), pass `polarity="lower-is-better"`.
9
+
10
+ It replaces the deprecated [`TrendIndicator`](parts/trend-indicator).
11
+
12
+ ```tsx
13
+ import { Delta } from "@squadbase/vantage/components";
14
+ import type { DeltaProps, Comparison, Polarity } from "@squadbase/vantage/components";
15
+ ```
16
+
17
+ | Prop | Type | Default | Description |
18
+ | --- | --- | --- | --- |
19
+ | `value` | `number \| null \| undefined` | | The current value. **Required.** The previous one comes from `comparison`. |
20
+ | `comparison` | `Comparison` | | What the value is compared against. **Required**, so the change always carries its label. See below. |
21
+ | `polarity` | `"higher-is-better" \| "lower-is-better"` | `"higher-is-better"` | Whether a rise is good. |
22
+ | `neutralBand` | `number` | `0.01` | Absolute ratio below which the change reads as flat. Default 1%. |
23
+ | `variant` | `"badge" \| "inline"` | `"badge"` | A bordered badge, or plain text for use inline. |
24
+ | `locale` | `string` | `"ja-JP"` | Locale for the percent. |
25
+ | `showLabel` | `boolean` | `true` | Show the comparison label ("前期比") after the percent. |
26
+ | `className` | `string` | | Classes to add. |
27
+
28
+ ## Comparison
29
+
30
+ | Prop | Type | Description |
31
+ | --- | --- | --- |
32
+ | `previous` | `number \| null \| undefined` | The value compared against. `null` or `0` yields no rate, shown as "—". |
33
+ | `vs` | `"prior-period" \| "prior-year" \| "target"` | The kind of comparison. Default labels: 前期比 / 前年同期比 / 目標比. |
34
+ | `label` | `string` | Override the label (e.g. "vs last week"). |
35
+
36
+ ## Migrating from TrendIndicator
37
+
38
+ ```tsx
39
+ // Before: direction and colour chosen by hand
40
+ <TrendIndicator value={12.4} direction="up" />
41
+
42
+ // After: pass the current and previous values
43
+ <Delta value={1_240_000} comparison={{ previous: 1_103_000, vs: "prior-period" }} />
44
+
45
+ // A metric where down is good
46
+ <Delta value={0.021} comparison={{ previous: 0.026, vs: "prior-period" }} polarity="lower-is-better" />
47
+ ```
48
+
49
+ The colours come from the `--positive` / `--negative` / `--neutral` tokens. To show a KPI as a whole
50
+ card, [`KpiCard`](parts/kpi-card) uses `Delta` inside.
@@ -0,0 +1,43 @@
1
+ # format / comparison
2
+
3
+ > The number formatting (formatValue) and change calculation (computeComparison) shared by KPIs, tables and charts.
4
+
5
+ The formatting and comparison logic that `KpiCard` / `Delta` use internally, exposed as functions. Use
6
+ them when a table cell or a chart's `valueFormatter` should match the KPIs. Shortening (e.g. "4.8億")
7
+ is left to `Intl.NumberFormat`; no unit strings are hard-coded.
8
+
9
+ ```tsx
10
+ import {
11
+ formatValue,
12
+ formatDelta,
13
+ toValueFormatter,
14
+ computeComparison,
15
+ } from "@squadbase/vantage/components";
16
+ import type { ValueFormat, Comparison, ComparisonResult } from "@squadbase/vantage/components";
17
+ ```
18
+
19
+ ## ValueFormat
20
+
21
+ One of `"number" | "compact" | "currency" | "percent" | "multiple"`, or `{ type, digits?, currency? }`.
22
+ The default format is `"compact"`, the default currency `JPY`, the default locale `"ja-JP"`. `percent`
23
+ takes a ratio (`0.124` → 12.4%). `null` / `undefined` / `NaN` format as "—".
24
+
25
+ | Prop | Type | Description |
26
+ | --- | --- | --- |
27
+ | `formatValue(value, format?, locale?)` | `string` | Format a value. |
28
+ | `formatDelta(value, format?, locale?)` | `string` | For differences: always signed except zero (`+12.4%`). |
29
+ | `toValueFormatter(format?, locale?)` | `(value) => string` | A one-argument formatter with the format and locale bound — fits a chart's `valueFormatter`. |
30
+
31
+ ```tsx
32
+ formatValue(48_200_000, "currency"); // "¥48,200,000"
33
+ formatValue(0.021, { type: "percent", digits: 1 }); // "2.1%"
34
+ <LineChart valueFormatter={toValueFormatter("compact")} … />
35
+ ```
36
+
37
+ ## computeComparison
38
+
39
+ `computeComparison(current, comparison, { polarity?, neutralBand? })` returns
40
+ `{ current, previous, difference, ratio, direction, sentiment, label, vs }`. A rate is produced only
41
+ when the previous value is a non-zero number; moves inside `neutralBand` (default 0.01) give
42
+ `direction: "flat"`. `sentiment` (`"positive" | "negative" | "neutral"`) follows `polarity`. Leave the
43
+ rendering to [`Delta`](parts/delta) rather than building arrows and colours yourself.
@@ -0,0 +1,57 @@
1
+ # KpiCard
2
+
3
+ > One KPI as a card — value, change, previous actual and a one-line conclusion, all derived from numbers.
4
+
5
+ A card that shows one KPI. **Pass numbers and enums only**, and it lays out, top to bottom: the metric
6
+ name → the value → the change ([`Delta`](parts/delta)) → the previous actual → a
7
+ one-sentence conclusion. Direction, rate, colour, remaining-to-target, achievement and record highs are
8
+ all computed inside the card, so no two props can disagree. Reach for this before composing a KPI tile
9
+ from `DashboardCardPreset` + `MetricValue`.
10
+
11
+ ```tsx
12
+ import { KpiCard } from "@squadbase/vantage/components";
13
+ import type { KpiCardProps, KpiCardSource, Comparison, Polarity, ValueFormat } from "@squadbase/vantage/components";
14
+ ```
15
+
16
+ | Prop | Type | Default | Description |
17
+ | --- | --- | --- | --- |
18
+ | `label` | `string` | | The metric name. **Required.** |
19
+ | `value` | `number \| null \| undefined` | | The current value. **Required.** `null` / `undefined` renders "—". |
20
+ | `format` | `ValueFormat` | `"compact"` | How the value is formatted (see the format / comparison page); also used for previous, target and remaining. |
21
+ | `locale` | `string` | `"ja-JP"` | The formatting locale. |
22
+ | `comparison` | `Comparison` | | What the value is compared against (`{ previous, vs, label? }`). Adds the change and the previous-actual line. |
23
+ | `polarity` | `"higher-is-better" \| "lower-is-better"` | `"higher-is-better"` | Whether a rise is good. Use `"lower-is-better"` for metrics like churn. |
24
+ | `neutralBand` | `number` | `0.01` | Absolute ratio below which the change reads as flat. |
25
+ | `showPrevious` | `boolean` | `true` | Show the previous actual ("前期 400"). Needs `comparison`. |
26
+ | `summary` | `string` | | The conclusion sentence, as a **template** whose placeholders (below) the card fills. |
27
+ | `target` | `number` | | Target for the current period; adds a remaining / achievement line. |
28
+ | `period` | `{ start: Date \| string \| number; end: Date \| string \| number }` | | The current period. With `target`, adds a pace projection (marked 見込み) while the period is in progress. |
29
+ | `history` | `ReadonlyArray<number \| null \| undefined>` | | Series ending at the current period (last point = `value`); adds a record badge. |
30
+ | `historyGrain` | `"day" \| "week" \| "month" \| "quarter" \| "year"` | `"month"` | The grain of `history`. |
31
+ | `source` | `{ period?: string; count?: number; name?: string }` | | A data-source footnote (period, row count, source name). |
32
+ | `updatedAt` | `Date \| string \| number` | | When the data was last refreshed; shown as relative time. |
33
+ | `now` | `Date \| number` | | Reference time for the projection and relative time (for deterministic rendering). |
34
+ | `isLoading` | `boolean` | `false` | Render a skeleton with the final shape instead of the values. |
35
+ | `className` | `string` | | Classes to add. |
36
+
37
+ ## Summary placeholders
38
+
39
+ `{value}` `{delta}` `{difference}` `{previous}` `{label}` `{target}` `{achievement}` `{remaining}`.
40
+ Unknown placeholders are left as written; a known one whose value is missing becomes "—".
41
+
42
+ > [!WARNING]
43
+ > **Never put numbers in the template itself.** Insert every number through a placeholder, so the
44
+ > sentence can't go stale when the value changes.
45
+
46
+ ```tsx
47
+ <KpiCard
48
+ label="Revenue"
49
+ value={48_200_000}
50
+ format="currency"
51
+ comparison={{ previous: 42_900_000, vs: "prior-period" }}
52
+ summary="{label} grew {difference} ({delta}) on last month."
53
+ />
54
+ ```
55
+
56
+ The card's built-in wording (labels such as 前期比 and 目標まであと) is Japanese. To place just the
57
+ change inside a table or tile, use [`Delta`](parts/delta) on its own.
@@ -2,7 +2,8 @@
2
2
 
3
3
  > The KPI number, with MetricUnit for the unit.
4
4
 
5
- A tight-tracking display for a KPI's number. Units and other trailing text go in `MetricUnit`.
5
+ A tight-tracking display for a KPI's number. Units and other trailing text go in `MetricUnit`. For a whole KPI
6
+ tile, consider [`KpiCard`](parts/kpi-card) first — it also shows the change and the previous actual.
6
7
 
7
8
  ```tsx
8
9
  import { MetricValue, MetricUnit, metricValueVariants } from "@squadbase/vantage/components";
@@ -18,6 +19,6 @@ It carries vertical margin (`my-4`) by default. Inside a card, pass `className="
18
19
  ```tsx
19
20
  <DashboardCardPreset title="Revenue">
20
21
  <MetricValue className="my-0">$12,400</MetricValue>
21
- <TrendIndicator value={12.4} direction="up" />
22
+ <Delta value={12_400} comparison={{ previous: 11_030, vs: "prior-period" }} />
22
23
  </DashboardCardPreset>
23
24
  ```
@@ -27,7 +27,7 @@ import {
27
27
  | Part | Role |
28
28
  | --- | --- |
29
29
  | `PageShell` | The outer stack |
30
- | `PageShellHeader` | The underlined header band: heading on the left, `HeaderEnd` on the right |
30
+ | `PageShellHeader` | The underlined header band: heading on the left, `HeaderEnd` on the right. When the row is too narrow, `HeaderEnd` wraps below the heading |
31
31
  | `PageShellHeading` / `PageShellTitle` / `PageShellDescription` | The heading block |
32
32
  | `PageShellHeaderEnd` | The right-hand stack |
33
33
  | `PageShellMeta` | Asides such as "updated 10 minutes ago" |
@@ -44,4 +44,4 @@ series. `Sparkline` conveys the *shape* of a series and nothing else — **no ti
44
44
  > [!NOTE]
45
45
  > It is `aria-hidden="true"`, so screen readers skip it. Put the actual number next to it as text —
46
46
  > [`MetricValue`](parts/metric-value) or
47
- > [`TrendIndicator`](parts/trend-indicator).
47
+ > [`Delta`](parts/delta).
@@ -1,6 +1,22 @@
1
1
  # TrendIndicator
2
2
 
3
- > An arrow and a percentage; positiveIsGood decides the colour.
3
+ > Deprecated — use Delta for new code. An arrow and a percentage.
4
+
5
+ > [!WARNING]
6
+ > **Deprecated. Use [`Delta`](parts/delta) in new code.** `TrendIndicator` takes the
7
+ > direction and colour by hand, so the value and the arrow can disagree. `Delta` computes direction,
8
+ > rate, colour and label from the current and compared values. To show a KPI as a card, use
9
+ > [`KpiCard`](parts/kpi-card).
10
+
11
+ ```tsx
12
+ // Before
13
+ <TrendIndicator value={12.4} direction="up" />
14
+ <TrendIndicator value={0.4} direction="down" positiveIsGood={false} />
15
+
16
+ // After
17
+ <Delta value={1_240_000} comparison={{ previous: 1_103_000, vs: "prior-period" }} />
18
+ <Delta value={0.021} comparison={{ previous: 0.026, vs: "prior-period" }} polarity="lower-is-better" />
19
+ ```
4
20
 
5
21
  Shows a change as an arrow plus a percentage. **Up doesn't always mean good**, so the colour comes
6
22
  from `direction` combined with `positiveIsGood` — pass `positiveIsGood={false}` for metrics like
@@ -133,8 +133,10 @@ export default function JuneSummary() {
133
133
  ```
134
134
 
135
135
  Headings, paragraphs, lists, tables, quotes and code inside `<Document>` are styled with no classes
136
- written. See [UI & theming](ui-and-theming). As with `.slide`, only a page module that becomes a
137
- route may carry `.doc`.
136
+ written. See [UI & theming](ui-and-theming). The "Save as PDF" button at the bottom right
137
+ (labelled "PDF として保存" in a Japanese browser) opens the print dialog. Only the document body is
138
+ printed — the app's header and sidebar are left out — and it prints in the light palette even in dark
139
+ mode. As with `.slide`, only a page module that becomes a route may carry `.doc`.
138
140
 
139
141
  ## Directories that are never routed
140
142
 
@@ -36,7 +36,7 @@ In `/ui` (a selection): `Button`, `Card`, the `Table` primitives, `Tabs`, `Input
36
36
  `DropdownMenu`, `Sidebar`, `Alert` / `Skeleton` / `Spinner`, `Loading` / `Empty` / `ErrorState`.
37
37
 
38
38
  In `/components` (a selection): `PageShell`, `AppShell`, `DashboardCard`, `DataTable`, `EChart`,
39
- `FunnelSteps`, `FilterBar`, `DateRangePicker`, `MetricValue`, `TrendIndicator`.
39
+ `FunnelSteps`, `FilterBar`, `DateRangePicker`, `KpiCard`, `Delta`.
40
40
 
41
41
  Props and usage for every component live in the [Components](components) tab.
42
42