@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.
- package/dist/add-4GHF2TX2.js +6 -0
- package/dist/add-4GHF2TX2.js.map +1 -0
- package/dist/{build-O5TVNH4E.js → build-X5NVCQKT.js} +9 -9
- package/dist/{build-O5TVNH4E.js.map → build-X5NVCQKT.js.map} +1 -1
- package/dist/{check-WFBEDHDR.js → check-ZBIH422T.js} +7 -7
- package/dist/{check-WFBEDHDR.js.map → check-ZBIH422T.js.map} +1 -1
- package/dist/chunk-2ICNHUG6.js +1820 -0
- package/dist/chunk-2ICNHUG6.js.map +1 -0
- package/dist/{chunk-5ZOP4SQR.js → chunk-2N72FKLB.js} +12 -7
- package/dist/chunk-2N72FKLB.js.map +1 -0
- package/dist/{chunk-BCE22JSM.js → chunk-7DZGJQ3P.js} +33 -14
- package/dist/chunk-7DZGJQ3P.js.map +1 -0
- package/dist/{chunk-MXI3PZFT.js → chunk-7S52M2SL.js} +257 -210
- package/dist/chunk-7S52M2SL.js.map +1 -0
- package/dist/{chunk-QDZA5JSL.js → chunk-AABMKHEU.js} +4 -4
- package/dist/{chunk-QDZA5JSL.js.map → chunk-AABMKHEU.js.map} +1 -1
- package/dist/{chunk-KLEIVDUV.js → chunk-CEXAQQ5W.js} +150 -11
- package/dist/chunk-CEXAQQ5W.js.map +1 -0
- package/dist/{chunk-3G43C6OL.js → chunk-GNXCX4WE.js} +46 -3
- package/dist/chunk-GNXCX4WE.js.map +1 -0
- package/dist/chunk-IUPSBD6W.js +7914 -0
- package/dist/chunk-IUPSBD6W.js.map +1 -0
- package/dist/{chunk-JGRMRXXZ.js → chunk-JKLLFVEU.js} +3 -3
- package/dist/{chunk-JGRMRXXZ.js.map → chunk-JKLLFVEU.js.map} +1 -1
- package/dist/chunk-PDOBHMUQ.js +54 -0
- package/dist/chunk-PDOBHMUQ.js.map +1 -0
- package/dist/{chunk-ZVANIULZ.js → chunk-RNTDBX6S.js} +4 -4
- package/dist/{chunk-ZVANIULZ.js.map → chunk-RNTDBX6S.js.map} +1 -1
- package/dist/{chunk-A2UUGASH.js → chunk-U736PVHY.js} +2 -2
- package/dist/chunk-U736PVHY.js.map +1 -0
- package/dist/{chunk-PVTHHV7X.js → chunk-V3LF7BE7.js} +27 -5
- package/dist/chunk-V3LF7BE7.js.map +1 -0
- package/dist/{chunk-EP6JHXSR.js → chunk-WAMZWZJB.js} +54 -9
- package/dist/chunk-WAMZWZJB.js.map +1 -0
- package/dist/{chunk-DTDVSFRY.js → chunk-XQUSGIDG.js} +17 -3
- package/dist/chunk-XQUSGIDG.js.map +1 -0
- package/dist/cli.js +15 -11
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +32 -3
- package/dist/client/index.js +205 -12
- package/dist/client/index.js.map +1 -1
- package/dist/components/index.d.ts +1983 -29
- package/dist/components/index.js +4 -3
- package/dist/{dev-NZRLOQCL.js → dev-4XEDTELV.js} +24 -13
- package/dist/dev-4XEDTELV.js.map +1 -0
- package/dist/doc/index.d.ts +4 -0
- package/dist/doc/index.js +107 -11
- package/dist/doc/index.js.map +1 -1
- package/dist/{docs-ZGDJUHJI.js → docs-JVP4RPKT.js} +3 -3
- package/dist/{docs-ZGDJUHJI.js.map → docs-JVP4RPKT.js.map} +1 -1
- package/dist/{doctor-VFKEMR54.js → doctor-5E2VEZPK.js} +8 -8
- package/dist/doctor-5E2VEZPK.js.map +1 -0
- package/dist/markdown/index.js +1 -1
- package/dist/markdown/index.js.map +1 -1
- package/dist/{preview-QDCIVVSR.js → preview-T6CLSQVX.js} +12 -4
- package/dist/preview-T6CLSQVX.js.map +1 -0
- package/dist/query/index.d.ts +0 -11
- package/dist/query/index.js +2 -2
- package/dist/{routes-RHP5FVGD.js → routes-3SGAFDMC.js} +6 -6
- package/dist/{routes-RHP5FVGD.js.map → routes-3SGAFDMC.js.map} +1 -1
- package/dist/{search-RFBELGY7.js → search-5LC4XPB5.js} +3 -3
- package/dist/{search-RFBELGY7.js.map → search-5LC4XPB5.js.map} +1 -1
- package/dist/slide/index.js +63 -17
- package/dist/slide/index.js.map +1 -1
- package/dist/table/index.js +11 -9
- package/dist/table/index.js.map +1 -1
- package/dist/ui/index.d.ts +148 -12
- package/dist/ui/index.js +1340 -87
- package/dist/ui/index.js.map +1 -1
- package/dist/{upgrade-GF2P67M6.js → upgrade-JHXZBGQS.js} +7 -7
- package/dist/{upgrade-GF2P67M6.js.map → upgrade-JHXZBGQS.js.map} +1 -1
- package/dist/vite/index.d.ts +10 -0
- package/dist/vite/index.js +4 -4
- package/docs/en/changelog.md +24 -0
- package/docs/en/cli-reference.md +30 -0
- package/docs/en/components.md +29 -15
- package/docs/en/parts/data-table.md +22 -0
- package/docs/en/parts/delta.md +50 -0
- package/docs/en/parts/format.md +43 -0
- package/docs/en/parts/kpi-card.md +57 -0
- package/docs/en/parts/metric-value.md +3 -2
- package/docs/en/parts/page-shell.md +1 -1
- package/docs/en/parts/sparkline.md +1 -1
- package/docs/en/parts/trend-indicator.md +17 -1
- package/docs/en/routing.md +4 -2
- package/docs/en/ui-and-theming.md +1 -1
- package/docs/index.json +366 -76
- package/docs/ja/changelog.md +55 -0
- package/docs/ja/cli-reference.md +29 -0
- package/docs/ja/components.md +57 -101
- package/docs/ja/page-types/csv.md +83 -0
- package/docs/ja/page-types/doc.md +83 -0
- package/docs/ja/page-types/excel.md +82 -0
- package/docs/ja/page-types/slide.md +132 -0
- package/docs/ja/page-types.md +47 -0
- package/docs/ja/parts/area-chart.md +61 -0
- package/docs/ja/parts/bar-chart.md +69 -0
- package/docs/ja/parts/bar-list.md +35 -0
- package/docs/ja/parts/category-bar.md +36 -0
- package/docs/ja/parts/data-table.md +22 -0
- package/docs/ja/parts/delta.md +50 -0
- package/docs/ja/parts/donut-chart.md +47 -0
- package/docs/ja/parts/echart.md +3 -0
- package/docs/ja/parts/format.md +44 -0
- package/docs/ja/parts/kpi-card.md +55 -0
- package/docs/ja/parts/line-chart.md +58 -0
- package/docs/ja/parts/metric-value.md +3 -2
- package/docs/ja/parts/page-shell.md +1 -1
- package/docs/ja/parts/progress-circle.md +34 -0
- package/docs/ja/parts/sparkline.md +2 -2
- package/docs/ja/parts/tracker.md +32 -0
- package/docs/ja/parts/trend-indicator.md +17 -1
- package/docs/ja/routing.md +8 -84
- package/docs/ja/ui/alert-dialog.md +41 -0
- package/docs/ja/ui/avatar.md +31 -0
- package/docs/ja/ui/combobox.md +74 -0
- package/docs/ja/ui/drawer.md +41 -0
- package/docs/ja/ui/field.md +42 -0
- package/docs/ja/ui/hover-card.md +21 -0
- package/docs/ja/ui/kbd.md +16 -0
- package/docs/ja/ui/pagination.md +36 -0
- package/docs/ja/ui/radio-group.md +21 -0
- package/docs/ja/ui/toast.md +46 -0
- package/docs/ja/ui-and-theming.md +14 -7
- package/package.json +43 -29
- package/registry/ui/accordion.tsx +76 -0
- package/registry/ui/alert-dialog.tsx +189 -0
- package/registry/ui/alert.tsx +80 -0
- package/registry/ui/app-shell.tsx +287 -0
- package/registry/ui/area-chart.tsx +3701 -0
- package/registry/ui/attention-list.tsx +303 -0
- package/registry/ui/avatar.tsx +110 -0
- package/registry/ui/badge.tsx +56 -0
- package/registry/ui/bar-chart.tsx +3698 -0
- package/registry/ui/bar-list.tsx +3743 -0
- package/registry/ui/box-plot-chart.tsx +3906 -0
- package/registry/ui/breadcrumb.tsx +128 -0
- package/registry/ui/button.tsx +62 -0
- package/registry/ui/calendar.tsx +223 -0
- package/registry/ui/card.tsx +107 -0
- package/registry/ui/category-bar.tsx +1290 -0
- package/registry/ui/chart-frame.tsx +1393 -0
- package/registry/ui/checkbox.tsx +30 -0
- package/registry/ui/collapsible.tsx +23 -0
- package/registry/ui/combobox.tsx +310 -0
- package/registry/ui/command.tsx +198 -0
- package/registry/ui/dashboard-card.tsx +217 -0
- package/registry/ui/data-table.tsx +693 -146
- package/registry/ui/date-range-picker.tsx +390 -0
- package/registry/ui/delta.tsx +188 -0
- package/registry/ui/dialog.tsx +161 -0
- package/registry/ui/donut-chart.tsx +3751 -0
- package/registry/ui/drawer.tsx +229 -0
- package/registry/ui/dropdown-menu.tsx +274 -0
- package/registry/ui/echart.tsx +918 -0
- package/registry/ui/field.tsx +240 -0
- package/registry/ui/filter-bar.tsx +392 -0
- package/registry/ui/funnel-steps.tsx +3569 -0
- package/registry/ui/heatmap.tsx +1786 -0
- package/registry/ui/histogram-chart.tsx +3986 -0
- package/registry/ui/hover-card.tsx +52 -0
- package/registry/ui/input-group.tsx +160 -0
- package/registry/ui/input.tsx +24 -0
- package/registry/ui/kbd.tsx +30 -0
- package/registry/ui/kpi-card.tsx +699 -0
- package/registry/ui/label.tsx +22 -0
- package/registry/ui/legend.tsx +3563 -0
- package/registry/ui/line-chart.tsx +3699 -0
- package/registry/ui/metric-value.tsx +62 -0
- package/registry/ui/multi-select.tsx +232 -0
- package/registry/ui/page-shell.tsx +282 -0
- package/registry/ui/pagination.tsx +140 -0
- package/registry/ui/paired-chart.tsx +3827 -0
- package/registry/ui/placeholder.tsx +36 -0
- package/registry/ui/popover.tsx +92 -0
- package/registry/ui/progress-circle.tsx +867 -0
- package/registry/ui/progress.tsx +85 -0
- package/registry/ui/radio-group.tsx +39 -0
- package/registry/ui/sample-data.tsx +86 -0
- package/registry/ui/scatter-chart.tsx +4212 -0
- package/registry/ui/scroll-area.tsx +56 -0
- package/registry/ui/searchable-select.tsx +214 -0
- package/registry/ui/section-header.tsx +43 -0
- package/registry/ui/segmented-control.tsx +76 -0
- package/registry/ui/select.tsx +255 -0
- package/registry/ui/separator.tsx +27 -0
- package/registry/ui/sheet.tsx +139 -0
- package/registry/ui/sidebar.tsx +725 -0
- package/registry/ui/skeleton.tsx +17 -0
- package/registry/ui/slider.tsx +56 -0
- package/registry/ui/sparkline.tsx +230 -0
- package/registry/ui/spinner.tsx +14 -0
- package/registry/ui/states.tsx +90 -0
- package/registry/ui/status-badge.tsx +121 -0
- package/registry/ui/switch.tsx +34 -0
- package/registry/ui/table.tsx +118 -0
- package/registry/ui/tabs.tsx +84 -0
- package/registry/ui/textarea.tsx +22 -0
- package/registry/ui/toast.tsx +250 -0
- package/registry/ui/toggle-group.tsx +91 -0
- package/registry/ui/toggle.tsx +47 -0
- package/registry/ui/tooltip.tsx +72 -0
- package/registry/ui/tracker.tsx +849 -0
- package/registry/ui/trend-indicator.tsx +74 -0
- package/registry/ui/updated-at.tsx +122 -0
- package/registry/ui/waterfall-chart.tsx +4248 -0
- package/skills/vantage-add-feature/SKILL.md +9 -7
- package/skills/vantage-design/SKILL.md +12 -2
- package/skills/vantage-design/references/format.md +1 -1
- package/skills/vantage-pitfalls/SKILL.md +5 -1
- package/skills/vantage-slide/SKILL.md +17 -0
- package/templates/AGENTS.md +22 -1
- package/templates/agents/api.md +29 -0
- package/templates/agents/csv.md +2 -1
- package/templates/agents/doc.md +6 -3
- package/templates/agents/page.md +32 -8
- package/templates/agents/slide.md +13 -1
- package/templates/agents/xlsx.md +2 -1
- package/theme.css +284 -128
- package/dist/add-EISGSZAH.js +0 -6
- package/dist/add-EISGSZAH.js.map +0 -1
- package/dist/chunk-3G43C6OL.js.map +0 -1
- package/dist/chunk-5ZOP4SQR.js.map +0 -1
- package/dist/chunk-A2UUGASH.js.map +0 -1
- package/dist/chunk-BCE22JSM.js.map +0 -1
- package/dist/chunk-DTDVSFRY.js.map +0 -1
- package/dist/chunk-EP6JHXSR.js.map +0 -1
- package/dist/chunk-KLEIVDUV.js.map +0 -1
- package/dist/chunk-MXI3PZFT.js.map +0 -1
- package/dist/chunk-PLST5Q7T.js +0 -2221
- package/dist/chunk-PLST5Q7T.js.map +0 -1
- package/dist/chunk-PVTHHV7X.js.map +0 -1
- package/dist/chunk-T3FLAGI6.js +0 -316
- package/dist/chunk-T3FLAGI6.js.map +0 -1
- package/dist/dev-NZRLOQCL.js.map +0 -1
- package/dist/doctor-VFKEMR54.js.map +0 -1
- 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
|
-
<
|
|
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
|
-
> [`
|
|
47
|
+
> [`Delta`](parts/delta).
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
# TrendIndicator
|
|
2
2
|
|
|
3
|
-
> An arrow and a percentage
|
|
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
|
package/docs/en/routing.md
CHANGED
|
@@ -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).
|
|
137
|
-
|
|
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`, `
|
|
39
|
+
`FunnelSteps`, `FilterBar`, `DateRangePicker`, `KpiCard`, `Delta`.
|
|
40
40
|
|
|
41
41
|
Props and usage for every component live in the [Components](components) tab.
|
|
42
42
|
|