@squadbase/vantage 0.6.2-dev1.b332e5a → 0.6.2-dev1.d7c0911

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 (212) hide show
  1. package/dist/add-4GHF2TX2.js +6 -0
  2. package/dist/add-4GHF2TX2.js.map +1 -0
  3. package/dist/{build-TVKFIVFQ.js → build-X5NVCQKT.js} +7 -7
  4. package/dist/{build-TVKFIVFQ.js.map → build-X5NVCQKT.js.map} +1 -1
  5. package/dist/{check-3KHZXZMQ.js → check-ZBIH422T.js} +5 -5
  6. package/dist/{check-3KHZXZMQ.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-P7W4LR3Z.js → chunk-7DZGJQ3P.js} +3 -3
  12. package/dist/{chunk-P7W4LR3Z.js.map → chunk-7DZGJQ3P.js.map} +1 -1
  13. package/dist/{chunk-U2M6HGKQ.js → chunk-AABMKHEU.js} +4 -4
  14. package/dist/{chunk-U2M6HGKQ.js.map → chunk-AABMKHEU.js.map} +1 -1
  15. package/dist/{chunk-QI3XQKHS.js → chunk-GNXCX4WE.js} +10 -3
  16. package/dist/chunk-GNXCX4WE.js.map +1 -0
  17. package/dist/{chunk-PXRX5PEC.js → chunk-PDOBHMUQ.js} +3 -3
  18. package/dist/chunk-PDOBHMUQ.js.map +1 -0
  19. package/dist/{chunk-ZVANIULZ.js → chunk-RNTDBX6S.js} +4 -4
  20. package/dist/{chunk-ZVANIULZ.js.map → chunk-RNTDBX6S.js.map} +1 -1
  21. package/dist/{chunk-A2UUGASH.js → chunk-U736PVHY.js} +2 -2
  22. package/dist/chunk-U736PVHY.js.map +1 -0
  23. package/dist/{chunk-PVTHHV7X.js → chunk-V3LF7BE7.js} +27 -5
  24. package/dist/chunk-V3LF7BE7.js.map +1 -0
  25. package/dist/{chunk-LMUACBMA.js → chunk-WAMZWZJB.js} +53 -8
  26. package/dist/chunk-WAMZWZJB.js.map +1 -0
  27. package/dist/chunk-WRSX2MDK.js +7866 -0
  28. package/dist/chunk-WRSX2MDK.js.map +1 -0
  29. package/dist/{chunk-RPZAALCX.js → chunk-XPQSTZUU.js} +254 -164
  30. package/dist/chunk-XPQSTZUU.js.map +1 -0
  31. package/dist/{chunk-DTDVSFRY.js → chunk-XQUSGIDG.js} +17 -3
  32. package/dist/chunk-XQUSGIDG.js.map +1 -0
  33. package/dist/cli.js +12 -11
  34. package/dist/cli.js.map +1 -1
  35. package/dist/client/index.d.ts +32 -3
  36. package/dist/client/index.js +205 -12
  37. package/dist/client/index.js.map +1 -1
  38. package/dist/components/index.d.ts +1975 -28
  39. package/dist/components/index.js +4 -4
  40. package/dist/{dev-GDKATCC7.js → dev-4XEDTELV.js} +8 -8
  41. package/dist/dev-4XEDTELV.js.map +1 -0
  42. package/dist/doc/index.js +2 -2
  43. package/dist/doc/index.js.map +1 -1
  44. package/dist/{docs-EJJ3BECT.js → docs-JVP4RPKT.js} +3 -3
  45. package/dist/{docs-EJJ3BECT.js.map → docs-JVP4RPKT.js.map} +1 -1
  46. package/dist/{doctor-WQXPXP6K.js → doctor-5E2VEZPK.js} +5 -5
  47. package/dist/{doctor-WQXPXP6K.js.map → doctor-5E2VEZPK.js.map} +1 -1
  48. package/dist/markdown/index.js +1 -1
  49. package/dist/markdown/index.js.map +1 -1
  50. package/dist/{preview-OGMCNQUO.js → preview-T6CLSQVX.js} +3 -3
  51. package/dist/{preview-OGMCNQUO.js.map → preview-T6CLSQVX.js.map} +1 -1
  52. package/dist/query/index.d.ts +0 -11
  53. package/dist/query/index.js +2 -2
  54. package/dist/{routes-MWBWWOJ2.js → routes-3SGAFDMC.js} +4 -4
  55. package/dist/{routes-MWBWWOJ2.js.map → routes-3SGAFDMC.js.map} +1 -1
  56. package/dist/{search-6Y422SV6.js → search-5LC4XPB5.js} +3 -3
  57. package/dist/{search-6Y422SV6.js.map → search-5LC4XPB5.js.map} +1 -1
  58. package/dist/table/index.js +10 -9
  59. package/dist/table/index.js.map +1 -1
  60. package/dist/ui/index.d.ts +144 -11
  61. package/dist/ui/index.js +1339 -87
  62. package/dist/ui/index.js.map +1 -1
  63. package/dist/{upgrade-HCANX4GQ.js → upgrade-JHXZBGQS.js} +6 -6
  64. package/dist/{upgrade-HCANX4GQ.js.map → upgrade-JHXZBGQS.js.map} +1 -1
  65. package/dist/vite/index.d.ts +10 -0
  66. package/dist/vite/index.js +3 -3
  67. package/docs/en/components.md +29 -15
  68. package/docs/en/parts/data-table.md +22 -0
  69. package/docs/en/parts/delta.md +50 -0
  70. package/docs/en/parts/format.md +43 -0
  71. package/docs/en/parts/kpi-card.md +57 -0
  72. package/docs/en/parts/metric-value.md +3 -2
  73. package/docs/en/parts/sparkline.md +1 -1
  74. package/docs/en/parts/trend-indicator.md +17 -1
  75. package/docs/en/ui-and-theming.md +1 -1
  76. package/docs/index.json +366 -76
  77. package/docs/ja/changelog.md +31 -0
  78. package/docs/ja/components.md +57 -101
  79. package/docs/ja/page-types/csv.md +83 -0
  80. package/docs/ja/page-types/doc.md +83 -0
  81. package/docs/ja/page-types/excel.md +82 -0
  82. package/docs/ja/page-types/slide.md +132 -0
  83. package/docs/ja/page-types.md +47 -0
  84. package/docs/ja/parts/area-chart.md +61 -0
  85. package/docs/ja/parts/bar-chart.md +69 -0
  86. package/docs/ja/parts/bar-list.md +35 -0
  87. package/docs/ja/parts/category-bar.md +36 -0
  88. package/docs/ja/parts/data-table.md +22 -0
  89. package/docs/ja/parts/delta.md +50 -0
  90. package/docs/ja/parts/donut-chart.md +47 -0
  91. package/docs/ja/parts/echart.md +3 -0
  92. package/docs/ja/parts/format.md +44 -0
  93. package/docs/ja/parts/kpi-card.md +55 -0
  94. package/docs/ja/parts/line-chart.md +58 -0
  95. package/docs/ja/parts/metric-value.md +3 -2
  96. package/docs/ja/parts/progress-circle.md +34 -0
  97. package/docs/ja/parts/sparkline.md +2 -2
  98. package/docs/ja/parts/tracker.md +32 -0
  99. package/docs/ja/parts/trend-indicator.md +17 -1
  100. package/docs/ja/routing.md +8 -86
  101. package/docs/ja/ui/alert-dialog.md +41 -0
  102. package/docs/ja/ui/avatar.md +31 -0
  103. package/docs/ja/ui/combobox.md +74 -0
  104. package/docs/ja/ui/drawer.md +41 -0
  105. package/docs/ja/ui/field.md +42 -0
  106. package/docs/ja/ui/hover-card.md +21 -0
  107. package/docs/ja/ui/kbd.md +16 -0
  108. package/docs/ja/ui/pagination.md +36 -0
  109. package/docs/ja/ui/radio-group.md +21 -0
  110. package/docs/ja/ui/toast.md +46 -0
  111. package/docs/ja/ui-and-theming.md +14 -7
  112. package/package.json +13 -4
  113. package/registry/ui/accordion.tsx +76 -0
  114. package/registry/ui/alert-dialog.tsx +189 -0
  115. package/registry/ui/alert.tsx +80 -0
  116. package/registry/ui/app-shell.tsx +287 -0
  117. package/registry/ui/area-chart.tsx +3639 -0
  118. package/registry/ui/avatar.tsx +110 -0
  119. package/registry/ui/badge.tsx +56 -0
  120. package/registry/ui/bar-chart.tsx +3636 -0
  121. package/registry/ui/bar-list.tsx +3680 -0
  122. package/registry/ui/breadcrumb.tsx +128 -0
  123. package/registry/ui/button.tsx +62 -0
  124. package/registry/ui/calendar.tsx +223 -0
  125. package/registry/ui/card.tsx +107 -0
  126. package/registry/ui/category-bar.tsx +1255 -0
  127. package/registry/ui/chart-frame.tsx +1358 -0
  128. package/registry/ui/checkbox.tsx +30 -0
  129. package/registry/ui/collapsible.tsx +23 -0
  130. package/registry/ui/combobox.tsx +310 -0
  131. package/registry/ui/command.tsx +198 -0
  132. package/registry/ui/dashboard-card.tsx +217 -0
  133. package/registry/ui/data-table.tsx +693 -146
  134. package/registry/ui/date-range-picker.tsx +390 -0
  135. package/registry/ui/delta.tsx +188 -0
  136. package/registry/ui/dialog.tsx +161 -0
  137. package/registry/ui/donut-chart.tsx +3688 -0
  138. package/registry/ui/drawer.tsx +229 -0
  139. package/registry/ui/dropdown-menu.tsx +274 -0
  140. package/registry/ui/echart.tsx +890 -0
  141. package/registry/ui/field.tsx +240 -0
  142. package/registry/ui/filter-bar.tsx +392 -0
  143. package/registry/ui/funnel-steps.tsx +3541 -0
  144. package/registry/ui/heatmap.tsx +1752 -0
  145. package/registry/ui/hover-card.tsx +52 -0
  146. package/registry/ui/input-group.tsx +160 -0
  147. package/registry/ui/input.tsx +24 -0
  148. package/registry/ui/kbd.tsx +30 -0
  149. package/registry/ui/kpi-card.tsx +677 -0
  150. package/registry/ui/label.tsx +22 -0
  151. package/registry/ui/legend.tsx +3500 -0
  152. package/registry/ui/line-chart.tsx +3637 -0
  153. package/registry/ui/metric-value.tsx +62 -0
  154. package/registry/ui/multi-select.tsx +232 -0
  155. package/registry/ui/page-shell.tsx +282 -0
  156. package/registry/ui/pagination.tsx +140 -0
  157. package/registry/ui/placeholder.tsx +36 -0
  158. package/registry/ui/popover.tsx +92 -0
  159. package/registry/ui/progress-circle.tsx +867 -0
  160. package/registry/ui/progress.tsx +85 -0
  161. package/registry/ui/radio-group.tsx +39 -0
  162. package/registry/ui/sample-data.tsx +86 -0
  163. package/registry/ui/scatter-chart.tsx +4150 -0
  164. package/registry/ui/scroll-area.tsx +56 -0
  165. package/registry/ui/searchable-select.tsx +214 -0
  166. package/registry/ui/section-header.tsx +43 -0
  167. package/registry/ui/segmented-control.tsx +76 -0
  168. package/registry/ui/select.tsx +255 -0
  169. package/registry/ui/separator.tsx +27 -0
  170. package/registry/ui/sheet.tsx +139 -0
  171. package/registry/ui/sidebar.tsx +725 -0
  172. package/registry/ui/skeleton.tsx +17 -0
  173. package/registry/ui/slider.tsx +56 -0
  174. package/registry/ui/sparkline.tsx +230 -0
  175. package/registry/ui/spinner.tsx +14 -0
  176. package/registry/ui/states.tsx +90 -0
  177. package/registry/ui/status-badge.tsx +121 -0
  178. package/registry/ui/switch.tsx +34 -0
  179. package/registry/ui/table.tsx +118 -0
  180. package/registry/ui/tabs.tsx +84 -0
  181. package/registry/ui/textarea.tsx +22 -0
  182. package/registry/ui/toast.tsx +250 -0
  183. package/registry/ui/toggle-group.tsx +91 -0
  184. package/registry/ui/toggle.tsx +47 -0
  185. package/registry/ui/tooltip.tsx +68 -0
  186. package/registry/ui/tracker.tsx +843 -0
  187. package/registry/ui/trend-indicator.tsx +74 -0
  188. package/registry/ui/updated-at.tsx +122 -0
  189. package/registry/ui/waterfall-chart.tsx +4186 -0
  190. package/skills/vantage-add-feature/SKILL.md +9 -7
  191. package/skills/vantage-pitfalls/SKILL.md +5 -1
  192. package/templates/AGENTS.md +22 -1
  193. package/templates/agents/csv.md +2 -1
  194. package/templates/agents/doc.md +4 -3
  195. package/templates/agents/page.md +20 -6
  196. package/templates/agents/xlsx.md +2 -1
  197. package/theme.css +237 -136
  198. package/dist/add-DY4AXANK.js +0 -6
  199. package/dist/add-DY4AXANK.js.map +0 -1
  200. package/dist/chunk-5ZOP4SQR.js.map +0 -1
  201. package/dist/chunk-A2UUGASH.js.map +0 -1
  202. package/dist/chunk-DTDVSFRY.js.map +0 -1
  203. package/dist/chunk-LMUACBMA.js.map +0 -1
  204. package/dist/chunk-NKFBFDRZ.js +0 -2241
  205. package/dist/chunk-NKFBFDRZ.js.map +0 -1
  206. package/dist/chunk-PVTHHV7X.js.map +0 -1
  207. package/dist/chunk-PXRX5PEC.js.map +0 -1
  208. package/dist/chunk-QI3XQKHS.js.map +0 -1
  209. package/dist/chunk-RPZAALCX.js.map +0 -1
  210. package/dist/chunk-VA776YE5.js +0 -316
  211. package/dist/chunk-VA776YE5.js.map +0 -1
  212. package/dist/dev-GDKATCC7.js.map +0 -1
@@ -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
  ```
@@ -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
@@ -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