@squadbase/vantage 0.6.2-dev1.48b34e1 → 0.6.2-dev1.51e401a
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/{chunk-57GHR5LN.js → chunk-3RJEOP3J.js} +29 -18
- package/dist/chunk-3RJEOP3J.js.map +1 -0
- package/dist/{chunk-QOXXOFGL.js → chunk-77CISBMG.js} +994 -464
- package/dist/chunk-77CISBMG.js.map +1 -0
- package/dist/{chunk-JXFCSF3K.js → chunk-EG4PX726.js} +12 -7
- package/dist/chunk-EG4PX726.js.map +1 -0
- package/dist/{chunk-2N72FKLB.js → chunk-NZ5QIIG4.js} +33 -11
- package/dist/chunk-NZ5QIIG4.js.map +1 -0
- package/dist/{chunk-7S52M2SL.js → chunk-QNOX7WLZ.js} +3 -3
- package/dist/{chunk-7S52M2SL.js.map → chunk-QNOX7WLZ.js.map} +1 -1
- package/dist/{chunk-PDOBHMUQ.js → chunk-ROHNXP7J.js} +72 -3
- package/dist/chunk-ROHNXP7J.js.map +1 -0
- package/dist/{chunk-6OTTGAPO.js → chunk-TRMHNMMZ.js} +24 -7
- package/dist/chunk-TRMHNMMZ.js.map +1 -0
- package/dist/components/index.d.ts +49 -29
- package/dist/components/index.js +5 -5
- package/dist/{delta-text-CvwBGJ95.d.ts → delta-text-CbrOaW83.d.ts} +4 -2
- package/dist/doc/index.d.ts +14 -14
- package/dist/doc/index.js +198 -84
- package/dist/doc/index.js.map +1 -1
- package/dist/{format-U0cQl069.d.ts → format-DihQkL1N.d.ts} +17 -11
- package/dist/slide/index.d.ts +2 -2
- package/dist/slide/index.js +95 -44
- package/dist/slide/index.js.map +1 -1
- package/dist/table/index.js +6 -6
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +5 -5
- package/package.json +2 -2
- package/registry/ui/app-shell.tsx +138 -1
- package/registry/ui/area-chart.tsx +344 -85
- package/registry/ui/attention-list.tsx +177 -15
- package/registry/ui/bar-chart.tsx +341 -85
- package/registry/ui/bar-list.tsx +332 -77
- package/registry/ui/box-plot-chart.tsx +405 -97
- package/registry/ui/category-bar.tsx +248 -40
- package/registry/ui/chart-frame.tsx +257 -46
- package/registry/ui/data-table.tsx +229 -37
- package/registry/ui/date-range-picker.tsx +190 -36
- package/registry/ui/delta.tsx +171 -12
- package/registry/ui/donut-chart.tsx +339 -84
- package/registry/ui/echart.tsx +142 -4
- package/registry/ui/filter-bar.tsx +179 -20
- package/registry/ui/funnel-steps.tsx +354 -80
- package/registry/ui/heatmap.tsx +293 -52
- package/registry/ui/histogram-chart.tsx +395 -97
- package/registry/ui/kpi-card.tsx +245 -44
- package/registry/ui/legend.tsx +330 -76
- package/registry/ui/line-chart.tsx +344 -85
- package/registry/ui/multi-select.tsx +159 -9
- package/registry/ui/page-shell.tsx +141 -3
- package/registry/ui/paired-chart.tsx +349 -90
- package/registry/ui/progress-circle.tsx +205 -39
- package/registry/ui/sample-data.tsx +153 -9
- package/registry/ui/scatter-chart.tsx +391 -100
- package/registry/ui/searchable-select.tsx +145 -7
- package/registry/ui/states.tsx +170 -13
- package/registry/ui/status-badge.tsx +193 -28
- package/registry/ui/tracker.tsx +205 -39
- package/registry/ui/trend-indicator.tsx +149 -6
- package/registry/ui/updated-at.tsx +170 -16
- package/registry/ui/waterfall-chart.tsx +415 -102
- package/skills/vantage-add-feature/SKILL.md +5 -0
- package/templates/AGENTS.md +10 -8
- package/templates/agents/api.md +7 -0
- package/templates/agents/page.md +36 -0
- package/dist/chunk-2N72FKLB.js.map +0 -1
- package/dist/chunk-57GHR5LN.js.map +0 -1
- package/dist/chunk-6OTTGAPO.js.map +0 -1
- package/dist/chunk-JXFCSF3K.js.map +0 -1
- package/dist/chunk-PDOBHMUQ.js.map +0 -1
- package/dist/chunk-QOXXOFGL.js.map +0 -1
|
@@ -2,6 +2,7 @@ import { cn } from './chunk-U736PVHY.js';
|
|
|
2
2
|
import { Button as Button$1 } from '@base-ui/react/button';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
import { useSyncExternalStore } from 'react';
|
|
5
6
|
|
|
6
7
|
// @squadbase/vantage — generated build. Do not edit.
|
|
7
8
|
var buttonVariants = cva(
|
|
@@ -49,6 +50,74 @@ function Button({
|
|
|
49
50
|
);
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
// ../squadkit/registry/lib/locale.ts
|
|
54
|
+
var FALLBACK_LOCALE = "en-US";
|
|
55
|
+
function uiLanguage(locale) {
|
|
56
|
+
return typeof locale === "string" && locale.trim().toLowerCase().startsWith("ja") ? "ja" : "en";
|
|
57
|
+
}
|
|
58
|
+
function normalizeLocale(tag) {
|
|
59
|
+
const value = tag?.trim();
|
|
60
|
+
if (!value) return FALLBACK_LOCALE;
|
|
61
|
+
try {
|
|
62
|
+
return Intl.getCanonicalLocales(value)[0] ?? FALLBACK_LOCALE;
|
|
63
|
+
} catch {
|
|
64
|
+
return FALLBACK_LOCALE;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function documentLocale() {
|
|
68
|
+
if (typeof document === "undefined") return FALLBACK_LOCALE;
|
|
69
|
+
return normalizeLocale(document.documentElement?.getAttribute("lang"));
|
|
70
|
+
}
|
|
71
|
+
function resolveLocale(locale) {
|
|
72
|
+
return locale || documentLocale();
|
|
73
|
+
}
|
|
74
|
+
function defaultCurrency(locale) {
|
|
75
|
+
return uiLanguage(resolveLocale(locale)) === "ja" ? "JPY" : "USD";
|
|
76
|
+
}
|
|
77
|
+
function defaultFiscalYearStartMonth(locale) {
|
|
78
|
+
return uiLanguage(resolveLocale(locale)) === "ja" ? 4 : 1;
|
|
79
|
+
}
|
|
80
|
+
var SUNDAY_FIRST = /* @__PURE__ */ new Set(["en", "en-US", "en-CA"]);
|
|
81
|
+
function weekStartsOn(locale) {
|
|
82
|
+
const tag = normalizeLocale(resolveLocale(locale));
|
|
83
|
+
if (uiLanguage(tag) === "ja") return 1;
|
|
84
|
+
try {
|
|
85
|
+
const info = new Intl.Locale(tag);
|
|
86
|
+
const firstDay = info.getWeekInfo?.().firstDay ?? info.weekInfo?.firstDay;
|
|
87
|
+
if (typeof firstDay === "number" && firstDay >= 1 && firstDay <= 7) return firstDay % 7;
|
|
88
|
+
} catch {
|
|
89
|
+
}
|
|
90
|
+
return SUNDAY_FIRST.has(tag) ? 0 : 1;
|
|
91
|
+
}
|
|
92
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
93
|
+
var observer = null;
|
|
94
|
+
function subscribe(onChange) {
|
|
95
|
+
if (typeof document === "undefined" || typeof MutationObserver === "undefined") return () => {
|
|
96
|
+
};
|
|
97
|
+
listeners.add(onChange);
|
|
98
|
+
if (!observer) {
|
|
99
|
+
observer = new MutationObserver(() => {
|
|
100
|
+
for (const listener of [...listeners]) listener();
|
|
101
|
+
});
|
|
102
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["lang"] });
|
|
103
|
+
}
|
|
104
|
+
return () => {
|
|
105
|
+
listeners.delete(onChange);
|
|
106
|
+
if (listeners.size === 0 && observer) {
|
|
107
|
+
observer.disconnect();
|
|
108
|
+
observer = null;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
var serverLocale = () => FALLBACK_LOCALE;
|
|
113
|
+
function useDocumentLocale() {
|
|
114
|
+
return useSyncExternalStore(subscribe, documentLocale, serverLocale);
|
|
115
|
+
}
|
|
116
|
+
function useLocale(locale) {
|
|
117
|
+
const page = useDocumentLocale();
|
|
118
|
+
return locale || page;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { Button, FALLBACK_LOCALE, buttonVariants, defaultCurrency, defaultFiscalYearStartMonth, resolveLocale, uiLanguage, useLocale, weekStartsOn };
|
|
122
|
+
//# sourceMappingURL=chunk-ROHNXP7J.js.map
|
|
123
|
+
//# sourceMappingURL=chunk-ROHNXP7J.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../squadkit/registry/ui/button.tsx","../../squadkit/registry/lib/locale.ts","../../squadkit/registry/hooks/use-locale.ts"],"names":["ButtonPrimitive"],"mappings":";;;;;;;AAOA,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB,4lBAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,wDAAA;AAAA,QACT,OAAA,EACE,iLAAA;AAAA,QACF,SAAA,EACE,gLAAA;AAAA,QACF,KAAA,EACE,kHAAA;AAAA,QACF,WAAA,EACE,6NAAA;AAAA,QACF,IAAA,EAAM;AAAA,OACR;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,OAAA,EACE,sFAAA;AAAA,QACF,EAAA,EAAI,+MAAA;AAAA,QACJ,EAAA,EAAI,yNAAA;AAAA,QACJ,EAAA,EAAI,sFAAA;AAAA,QACJ,IAAA,EAAM,QAAA;AAAA,QACN,SAAA,EACE,yHAAA;AAAA,QACF,SAAA,EACE,oFAAA;AAAA,QACF,SAAA,EAAW;AAAA;AACb,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS,SAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACR;AAEJ;AAEA,SAAS,MAAA,CAAO;AAAA,EACd,SAAA;AAAA,EACA,OAAA,GAAU,SAAA;AAAA,EACV,IAAA,GAAO,SAAA;AAAA,EACP,GAAG;AACL,CAAA,EAAgE;AAC9D,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,QAAA;AAAA,MACV,SAAA,EAAW,GAAG,cAAA,CAAe,EAAE,SAAS,IAAA,EAAM,SAAA,EAAW,CAAC,CAAA;AAAA,MACzD,GAAG;AAAA;AAAA,GACN;AAEJ;;;AC1CO,IAAM,eAAA,GAAkB;AAGxB,SAAS,WAAW,MAAA,EAA+C;AACxE,EAAA,OAAO,OAAO,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4B;AAC1C,EAAA,OAAO,oBAAA,CAAqB,SAAA,EAAW,cAAA,EAAgB,YAAY,CAAA;AACrE;AAGO,SAAS,UAAU,MAAA,EAAgC;AACxD,EAAA,MAAM,OAAO,iBAAA,EAAkB;AAC/B,EAAA,OAAO,MAAA,IAAU,IAAA;AACnB","file":"chunk-ROHNXP7J.js","sourcesContent":["\"use client\"\n\nimport { Button as ButtonPrimitive } from \"@base-ui/react/button\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"../lib/utils\"\n\nconst buttonVariants = cva(\n \"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n outline:\n \"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n ghost:\n \"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n destructive:\n \"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default:\n \"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n xs: \"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: \"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n lg: \"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n icon: \"size-8\",\n \"icon-xs\":\n \"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3\",\n \"icon-sm\":\n \"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg\",\n \"icon-lg\": \"size-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction Button({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {\n return (\n <ButtonPrimitive\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nexport { Button, buttonVariants }\n","/**\n * The display language of the parts and the defaults that follow it.\n *\n * The language comes from `<html lang>`: a tag starting with `ja` reads Japanese, anything else English.\n * Without a usable `lang` (missing, invalid, or no `document` — SSR, Node) the locale is `FALLBACK_LOCALE`\n * (`en-US`). A `locale` passed explicitly (a prop, an argument) always wins.\n *\n * Parts read the locale through `useLocale` (`hooks/use-locale`) and pass it down; the pure helpers here\n * and in `format` / `comparison` / `chart-*` take it as an argument and fall back to `documentLocale()`.\n */\n\n/** The language of the built-in wording: Japanese or English. */\nexport type UiLanguage = \"ja\" | \"en\"\n\n/** The locale used when `<html lang>` gives none (and on the server). */\nexport const FALLBACK_LOCALE = \"en-US\"\n\n/** `\"ja\"` when `locale` starts with `ja` (`ja`, `ja-JP`), else `\"en\"`. A missing locale is `\"en\"`. */\nexport function uiLanguage(locale: string | null | undefined): UiLanguage {\n return typeof locale === \"string\" && locale.trim().toLowerCase().startsWith(\"ja\") ? \"ja\" : \"en\"\n}\n\n/** A BCP 47 tag in its canonical form (`en-gb` → `en-GB`), or `FALLBACK_LOCALE` when it is empty or invalid. */\nexport function normalizeLocale(tag: string | null | undefined): string {\n const value = tag?.trim()\n if (!value) return FALLBACK_LOCALE\n try {\n return Intl.getCanonicalLocales(value)[0] ?? FALLBACK_LOCALE\n } catch {\n return FALLBACK_LOCALE\n }\n}\n\n/**\n * The locale of the page: `document.documentElement.lang`, canonicalized. `FALLBACK_LOCALE` when it is empty or\n * invalid, or there is no `document`. Parts read it through `useLocale`, never while rendering.\n */\nexport function documentLocale(): string {\n if (typeof document === \"undefined\") return FALLBACK_LOCALE\n return normalizeLocale(document.documentElement?.getAttribute(\"lang\"))\n}\n\n/** `locale` when given, else the page's locale (`documentLocale()`). */\nexport function resolveLocale(locale?: string | null): string {\n return locale || documentLocale()\n}\n\n/** Picks the wording table of the locale's language. */\nexport function pickLocale<T>(table: { ja: T; en: T }, locale?: string | null): T {\n return table[uiLanguage(resolveLocale(locale))]\n}\n\n/** The currency `format=\"currency\"` uses without a `currency`: JPY for Japanese, USD otherwise. */\nexport function defaultCurrency(locale?: string | null): string {\n return uiLanguage(resolveLocale(locale)) === \"ja\" ? \"JPY\" : \"USD\"\n}\n\n/** The month a fiscal year starts in (1–12) when none is given: April for Japanese, January otherwise. */\nexport function defaultFiscalYearStartMonth(locale?: string | null): number {\n return uiLanguage(resolveLocale(locale)) === \"ja\" ? 4 : 1\n}\n\n/** A day of the week, 0 = Sunday … 6 = Saturday (the `Date#getDay` / date-fns numbering). */\nexport type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6\n\n/** Locales whose week starts on Sunday when the runtime has no week data. */\nconst SUNDAY_FIRST = new Set([\"en\", \"en-US\", \"en-CA\"])\n\n/**\n * The first day of the week: Monday for Japanese; otherwise the locale's convention from `Intl.Locale`\n * (`en-US` Sunday, `en-GB` Monday). Without week data in the runtime: Sunday for `en` / `en-US` / `en-CA`,\n * Monday for the rest.\n */\nexport function weekStartsOn(locale?: string | null): WeekDay {\n const tag = normalizeLocale(resolveLocale(locale))\n if (uiLanguage(tag) === \"ja\") return 1\n try {\n const info = new Intl.Locale(tag) as Intl.Locale & {\n getWeekInfo?: () => { firstDay: number }\n weekInfo?: { firstDay: number }\n }\n const firstDay = info.getWeekInfo?.().firstDay ?? info.weekInfo?.firstDay\n if (typeof firstDay === \"number\" && firstDay >= 1 && firstDay <= 7) return (firstDay % 7) as WeekDay\n } catch {\n // Fall through to the table below.\n }\n return SUNDAY_FIRST.has(tag) ? 0 : 1\n}\n","import { useSyncExternalStore } from \"react\"\n\nimport { documentLocale, FALLBACK_LOCALE } from \"../lib/locale\"\n\nconst listeners = new Set<() => void>()\nlet observer: MutationObserver | null = null\n\n/** One observer on `<html lang>` for every subscribed part. */\nfunction subscribe(onChange: () => void): () => void {\n if (typeof document === \"undefined\" || typeof MutationObserver === \"undefined\") return () => {}\n listeners.add(onChange)\n if (!observer) {\n observer = new MutationObserver(() => {\n for (const listener of [...listeners]) listener()\n })\n observer.observe(document.documentElement, { attributes: true, attributeFilter: [\"lang\"] })\n }\n return () => {\n listeners.delete(onChange)\n if (listeners.size === 0 && observer) {\n observer.disconnect()\n observer = null\n }\n }\n}\n\nconst serverLocale = () => FALLBACK_LOCALE\n\n/**\n * The page's locale (`<html lang>`), following changes made while the page runs. On the server and during\n * hydration it is `FALLBACK_LOCALE` (`en-US`), so the markup matches; it switches right after.\n */\nexport function useDocumentLocale(): string {\n return useSyncExternalStore(subscribe, documentLocale, serverLocale)\n}\n\n/** The locale a part renders in: its `locale` prop when given, else the page's (`useDocumentLocale`). */\nexport function useLocale(locale?: string | null): string {\n const page = useDocumentLocale()\n return locale || page\n}\n"]}
|
|
@@ -1,9 +1,26 @@
|
|
|
1
|
-
import { formatDelta } from './chunk-
|
|
1
|
+
import { formatDelta } from './chunk-3RJEOP3J.js';
|
|
2
|
+
import { useLocale, uiLanguage } from './chunk-ROHNXP7J.js';
|
|
2
3
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
4
|
|
|
4
5
|
// @squadbase/vantage — generated build. Do not edit.
|
|
5
6
|
var MUTED = { color: "var(--doc-muted)" };
|
|
6
|
-
|
|
7
|
+
var TEXT = {
|
|
8
|
+
ja: {
|
|
9
|
+
up: "\u5897",
|
|
10
|
+
down: "\u6E1B",
|
|
11
|
+
flat: "\u6A2A\u3070\u3044",
|
|
12
|
+
label: (word, text, good) => `${word}\u3001${text}${good === void 0 ? "" : good ? "\u3001\u6539\u5584" : "\u3001\u60AA\u5316"}`
|
|
13
|
+
},
|
|
14
|
+
en: {
|
|
15
|
+
up: "Up",
|
|
16
|
+
down: "Down",
|
|
17
|
+
flat: "Flat",
|
|
18
|
+
label: (word, text, good) => `${word}, ${text}${good === void 0 ? "" : good ? ", improved" : ", worsened"}`
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function DeltaText({ value, format, betterWhen = "up", comparisonLabel, locale: localeProp }) {
|
|
22
|
+
const locale = useLocale(localeProp);
|
|
23
|
+
const t = TEXT[uiLanguage(locale)];
|
|
7
24
|
const label = comparisonLabel ? /* @__PURE__ */ jsxs("span", { style: MUTED, children: [
|
|
8
25
|
comparisonLabel,
|
|
9
26
|
" "
|
|
@@ -16,10 +33,10 @@ function DeltaText({ value, format, betterWhen = "up", comparisonLabel }) {
|
|
|
16
33
|
}
|
|
17
34
|
const dir = value > 0 ? "up" : value < 0 ? "down" : "flat";
|
|
18
35
|
const mark = dir === "up" ? "\u25B2" : dir === "down" ? "\u25BC" : "\u2192";
|
|
19
|
-
const word = dir
|
|
36
|
+
const word = t[dir];
|
|
20
37
|
const good = dir === "flat" ? void 0 : dir === "up" === (betterWhen === "up");
|
|
21
38
|
const tone = good === void 0 ? void 0 : good ? "text-positive" : "text-negative";
|
|
22
|
-
const text = formatDelta(value, format);
|
|
39
|
+
const text = formatDelta(value, format, locale);
|
|
23
40
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
41
|
label,
|
|
25
42
|
/* @__PURE__ */ jsxs(
|
|
@@ -28,7 +45,7 @@ function DeltaText({ value, format, betterWhen = "up", comparisonLabel }) {
|
|
|
28
45
|
"data-slot": "delta-text",
|
|
29
46
|
className: tone,
|
|
30
47
|
style: tone ? void 0 : MUTED,
|
|
31
|
-
"aria-label":
|
|
48
|
+
"aria-label": t.label(word, text, good),
|
|
32
49
|
children: [
|
|
33
50
|
mark,
|
|
34
51
|
" ",
|
|
@@ -40,5 +57,5 @@ function DeltaText({ value, format, betterWhen = "up", comparisonLabel }) {
|
|
|
40
57
|
}
|
|
41
58
|
|
|
42
59
|
export { DeltaText };
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
44
|
-
//# sourceMappingURL=chunk-
|
|
60
|
+
//# sourceMappingURL=chunk-TRMHNMMZ.js.map
|
|
61
|
+
//# sourceMappingURL=chunk-TRMHNMMZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../squadkit/registry/blocks/delta-text/delta-text.tsx"],"names":[],"mappings":";;;;;AAgCA,IAAM,KAAA,GAAQ,EAAE,KAAA,EAAO,kBAAA,EAAmB;AAE1C,IAAM,IAAA,GAAO;AAAA,EACX,EAAA,EAAI;AAAA,IACF,EAAA,EAAI,QAAA;AAAA,IACJ,IAAA,EAAM,QAAA;AAAA,IACN,IAAA,EAAM,oBAAA;AAAA,IACN,KAAA,EAAO,CAAC,IAAA,EAAc,IAAA,EAAc,SAClC,CAAA,EAAG,IAAI,CAAA,MAAA,EAAI,IAAI,GAAG,IAAA,KAAS,MAAA,GAAY,EAAA,GAAK,IAAA,GAAO,uBAA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AA;AAClB,EAAA,MAAM,OAAO,GAAA,KAAQ,MAAA,GAAS,MAAA,GAAa,GAAA,KAAQ,UAAW,UAAA,KAAe,IAAA,CAAA;AAC7E,EAAA,MAAM,IAAA,GAAO,IAAA,KAAS,MAAA,GAAY,MAAA,GAAY,OAAO,eAAA,GAAkB,eAAA;AACvE,EAAA,MAAM,IAAA,GAAO,WAAA,CAAY,KAAA,EAAO,MAAA,EAAQ,MAAM,CAAA;AAC9C,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,IAAA,KAAA;AAAA,oBACD,IAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,WAAA,EAAU,YAAA;AAAA,QACV,SAAA,EAAW,IAAA;AAAA,QACX,KAAA,EAAO,OAAO,MAAA,GAAY,KAAA;AAAA,QAC1B,YAAA,EAAY,CAAA,CAAE,KAAA,CAAM,IAAA,EAAM,MAAM,IAAI,CAAA;AAAA,QAEnC,QAAA,EAAA;AAAA,UAAA,IAAA;AAAA,UAAK,GAAA;AAAA,UAAE;AAAA;AAAA;AAAA;AACV,GAAA,EACF,CAAA;AAEJ","file":"chunk-TRMHNMMZ.js","sourcesContent":["\"use client\"\n\n/**\n * delta-text — a change as a bare inline `span`: mark + signed value (\"▲ +3.2%\"), so print and\n * colour-blind readers get the direction; colour only adds good / bad. It sets no text size, so it\n * takes the size of the line it sits in (doc blocks, slide text).\n *\n * - The direction comes from the sign of `value`; `betterWhen` (\"up\" by default; `\"down\"` for churn,\n * cost) decides good / bad. Zero is \"→\" in the muted colour; `null` is \"—\".\n * - `value` is the change itself, formatted by `format` with an explicit sign.\n * - `comparisonLabel` (\"前月比\") is printed in front, muted.\n *\n * @example\n * import { DeltaText } from \"@/blocks/delta-text/delta-text\"\n * <DeltaText value={0.032} format=\"percent\" comparisonLabel=\"前月比\" />\n */\nimport { useLocale } from \"../../hooks/use-locale\"\nimport { formatDelta, type ValueFormat } from \"../../lib/format\"\nimport { uiLanguage } from \"../../lib/locale\"\n\nexport interface DeltaTextProps {\n /** The change itself; its direction comes from the sign. `null` shows \"—\". */\n value: number | null\n format?: ValueFormat\n /** Which way is good. Default `\"up\"`. */\n betterWhen?: \"up\" | \"down\"\n /** Name of the comparison, e.g. \"前月比\". Printed before the change; omit to print only the change. */\n comparisonLabel?: string\n /** Locale of the value and the screen-reader text. Default the page's (`<html lang>`). */\n locale?: string\n}\n\nconst MUTED = { color: \"var(--doc-muted)\" } as const\n\nconst TEXT = {\n ja: {\n up: \"増\",\n down: \"減\",\n flat: \"横ばい\",\n label: (word: string, text: string, good: boolean | undefined) =>\n `${word}、${text}${good === undefined ? \"\" : good ? \"、改善\" : \"、悪化\"}`,\n },\n en: {\n up: \"Up\",\n down: \"Down\",\n flat: \"Flat\",\n label: (word: string, text: string, good: boolean | undefined) =>\n `${word}, ${text}${good === undefined ? \"\" : good ? \", improved\" : \", worsened\"}`,\n },\n}\n\nexport function DeltaText({ value, format, betterWhen = \"up\", comparisonLabel, locale: localeProp }: DeltaTextProps) {\n const locale = useLocale(localeProp)\n const t = TEXT[uiLanguage(locale)]\n const label = comparisonLabel ? <span style={MUTED}>{comparisonLabel} </span> : null\n if (value === null) {\n return (\n <>\n {label}\n <span data-slot=\"delta-text\" style={MUTED}>\n —\n </span>\n </>\n )\n }\n const dir = value > 0 ? \"up\" : value < 0 ? \"down\" : \"flat\"\n const mark = dir === \"up\" ? \"▲\" : dir === \"down\" ? \"▼\" : \"→\"\n const word = t[dir]\n const good = dir === \"flat\" ? undefined : (dir === \"up\") === (betterWhen === \"up\")\n const tone = good === undefined ? undefined : good ? \"text-positive\" : \"text-negative\"\n const text = formatDelta(value, format, locale)\n return (\n <>\n {label}\n <span\n data-slot=\"delta-text\"\n className={tone}\n style={tone ? undefined : MUTED}\n aria-label={t.label(word, text, good)}\n >\n {mark} {text}\n </span>\n </>\n )\n}\n\nexport default DeltaText\n"]}
|
|
@@ -4,8 +4,8 @@ import { HTMLAttributes, ReactNode, ComponentType, ElementType, Ref, ReactElemen
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
import { EChartsOption } from 'echarts';
|
|
6
6
|
export { EChartsOption } from 'echarts';
|
|
7
|
-
import { V as ValueFormat, a as DateStyle } from '../format-
|
|
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-
|
|
7
|
+
import { V as ValueFormat, a as DateStyle } from '../format-DihQkL1N.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-DihQkL1N.js';
|
|
9
9
|
import { RowData, ColumnDef, SortingState, OnChangeFn, ColumnFiltersState, PaginationState, RowSelectionState, VisibilityState, TableMeta, Table } from '@tanstack/react-table';
|
|
10
10
|
export { ColumnDef, ColumnFiltersState, PaginationState, RowSelectionState, SortingState, VisibilityState } from '@tanstack/react-table';
|
|
11
11
|
export { DateRange as RdpDateRange } from 'react-day-picker';
|
|
@@ -35,7 +35,7 @@ interface PageShellHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
35
35
|
updatedAtVariant?: UpdatedAtProps["variant"];
|
|
36
36
|
/** IANA time zone for the absolute time of `updatedAt`. Defaults to the runtime's zone. */
|
|
37
37
|
timeZone?: string;
|
|
38
|
-
/** Where the data comes from. Shown as a chip "出典:○○" on the second row. */
|
|
38
|
+
/** Where the data comes from. Shown as a chip "Source: ○○" (ja: "出典:○○") on the second row. */
|
|
39
39
|
source?: string;
|
|
40
40
|
/** The period the data covers. Shown as a chip "2026/9/23〜10/20" on the second row. */
|
|
41
41
|
period?: {
|
|
@@ -532,9 +532,10 @@ declare const EChart: React.ForwardRefExoticComponent<EChartProps & React.RefAtt
|
|
|
532
532
|
* the baseline is a non-zero number; small moves inside the neutral band read
|
|
533
533
|
* as flat, and polarity decides whether up is good or bad.
|
|
534
534
|
*
|
|
535
|
-
* Labels
|
|
536
|
-
* a monthly KPI compares "
|
|
537
|
-
* "
|
|
535
|
+
* Labels come from the grain of the period, in the locale's language (`<html lang>` unless a
|
|
536
|
+
* `locale` is passed): a monthly KPI compares "vs. prior month" / "vs. same month last year"
|
|
537
|
+
* (ja: "前月比" / "前年同月比"), a quarterly one "前四半期比" / "前年同期比" in ja. Without a
|
|
538
|
+
* grain the label is the generic "vs. prior period" (ja: "前期比").
|
|
538
539
|
*
|
|
539
540
|
* A running total of a period still in progress (年初来・月初来 = YTD / MTD) sets
|
|
540
541
|
* `toDate: true`: a `prior-year` baseline is then the same stretch of the prior year,
|
|
@@ -575,18 +576,24 @@ type Comparison = (ComparisonBase & {
|
|
|
575
576
|
/** The badge's full name: `"昨日比"` / `"先週の同じ曜日比"`. The previous-actual line drops one trailing "比" ("昨日 617"). */
|
|
576
577
|
label: string;
|
|
577
578
|
});
|
|
578
|
-
/**
|
|
579
|
+
/**
|
|
580
|
+
* Labels used when the grain is unknown, in English (the fallback language). A `custom` comparison always brings
|
|
581
|
+
* its own `label`. The parts pick the language from `<html lang>` (`comparisonLabel`): ja reads "前期比" / "前年同期比" / "目標比".
|
|
582
|
+
*/
|
|
579
583
|
declare const COMPARISON_LABELS: Record<Exclude<ComparisonKind, "custom">, string>;
|
|
580
584
|
/**
|
|
581
|
-
* What the previous value is called: "
|
|
582
|
-
*
|
|
585
|
+
* What the previous value is called: "prior month" / "same month last year" / "target" (ja: "前月" / "前年同月" / "目標");
|
|
586
|
+
* with a `label`, that label minus its comparison word ("昨日比" → "昨日", "vs. yesterday" → "yesterday").
|
|
587
|
+
* `toDate` (a running total such as YTD) turns a `prior-year` baseline into "same period last year" (ja: "前年同期") whatever the grain.
|
|
588
|
+
* `locale` picks the language; default the page's (`<html lang>`).
|
|
583
589
|
*/
|
|
584
|
-
declare function comparisonBaseline(vs: ComparisonKind, grain?: PeriodGrain, label?: string, toDate?: boolean): string;
|
|
590
|
+
declare function comparisonBaseline(vs: ComparisonKind, grain?: PeriodGrain, label?: string, toDate?: boolean, locale?: string): string;
|
|
585
591
|
/**
|
|
586
|
-
* The comparison label: "前月比" for `("prior-period", "month")`, "
|
|
587
|
-
* A running total (`toDate`) against the prior year is "
|
|
592
|
+
* The comparison label: "vs. prior month" (ja: "前月比") for `("prior-period", "month")`, "vs. prior period" (ja: "前期比")
|
|
593
|
+
* without a grain; a given `label` as is. A running total (`toDate`) against the prior year is "vs. same period last year"
|
|
594
|
+
* (ja: "前年同期比"), not "vs. prior year" (ja: "前年比"). `locale` picks the language; default the page's (`<html lang>`).
|
|
588
595
|
*/
|
|
589
|
-
declare function comparisonLabel(vs: ComparisonKind, grain?: PeriodGrain, label?: string, toDate?: boolean): string;
|
|
596
|
+
declare function comparisonLabel(vs: ComparisonKind, grain?: PeriodGrain, label?: string, toDate?: boolean, locale?: string): string;
|
|
590
597
|
type DeltaDirection = "up" | "down" | "flat" | "none";
|
|
591
598
|
type DeltaSentiment = "positive" | "negative" | "neutral";
|
|
592
599
|
interface ComparisonResult {
|
|
@@ -605,6 +612,8 @@ interface ComparisonOptions {
|
|
|
605
612
|
polarity?: Polarity;
|
|
606
613
|
/** Absolute ratio below which the change reads as flat (0.01 = 1%). Default 0.01. */
|
|
607
614
|
neutralBand?: number;
|
|
615
|
+
/** Locale of the derived `label`. Default the page's (`<html lang>`). */
|
|
616
|
+
locale?: string;
|
|
608
617
|
}
|
|
609
618
|
declare function computeComparison(current: number | null | undefined, comparison: Comparison, options?: ComparisonOptions): ComparisonResult;
|
|
610
619
|
/**
|
|
@@ -1761,7 +1770,7 @@ interface DataTableExportProps {
|
|
|
1761
1770
|
* <DataTableExport scope="page" />
|
|
1762
1771
|
*/
|
|
1763
1772
|
scope?: CsvScope;
|
|
1764
|
-
/**
|
|
1773
|
+
/** ボタンの文言。既定はページの言語で `"CSV を書き出す"`(英語は `"Export CSV"`)。 */
|
|
1765
1774
|
children?: ReactNode;
|
|
1766
1775
|
className?: string;
|
|
1767
1776
|
}
|
|
@@ -1822,13 +1831,15 @@ declare function toCsv(header: string[], rows: CsvCell[][], options?: {
|
|
|
1822
1831
|
}): string;
|
|
1823
1832
|
/**
|
|
1824
1833
|
* 表の現在の状態から CSV を作る。行は画面と同じ並べ替え・絞り込み後の順、列は表示中の列のみ。
|
|
1834
|
+
* `"display"` の書式のロケールは `locale`(既定はページのロケール、`<html lang>`)。
|
|
1825
1835
|
*
|
|
1826
1836
|
* @example
|
|
1827
1837
|
* const csv = tableToCsv(table, { values: "raw", scope: "page" })
|
|
1828
1838
|
*/
|
|
1829
|
-
declare function tableToCsv<TData>(table: Table<TData>, { values, scope }?: {
|
|
1839
|
+
declare function tableToCsv<TData>(table: Table<TData>, { values, scope, locale: localeArg }?: {
|
|
1830
1840
|
values?: CsvValues;
|
|
1831
1841
|
scope?: CsvScope;
|
|
1842
|
+
locale?: string;
|
|
1832
1843
|
}): string;
|
|
1833
1844
|
/** toolbar に置く CSV 書き出しボタン。`useDataTable()` の table から画面と同じ順・同じ集合を書き出す。 */
|
|
1834
1845
|
declare function DataTableExport({ fileName, values, scope, children, className, }: DataTableExportProps): React.JSX.Element;
|
|
@@ -1887,7 +1898,7 @@ declare namespace FilterBarActiveChips {
|
|
|
1887
1898
|
var displayName: string;
|
|
1888
1899
|
}
|
|
1889
1900
|
interface FilterBarClearButtonProps {
|
|
1890
|
-
/** Override the button label. Defaults to "クリア". */
|
|
1901
|
+
/** Override the button label. Defaults to "Clear" (ja: "クリア"). */
|
|
1891
1902
|
label?: string;
|
|
1892
1903
|
className?: string;
|
|
1893
1904
|
}
|
|
@@ -1908,7 +1919,11 @@ declare namespace FilterBarPreset {
|
|
|
1908
1919
|
var displayName: string;
|
|
1909
1920
|
}
|
|
1910
1921
|
|
|
1911
|
-
/**
|
|
1922
|
+
/**
|
|
1923
|
+
* フォールバック(`en-US`:英語・1 月始まり・日曜始まり)のプリセット。DateRangePicker は `presets` を渡さなければ
|
|
1924
|
+
* ページのロケールからプリセットを作るので、これを渡す必要はない。`locale` / `fiscalYearStartMonth` を変えるなら
|
|
1925
|
+
* `createDatePresets` か DateRangePicker の同名 props。
|
|
1926
|
+
*/
|
|
1912
1927
|
declare const defaultPresets: PresetItem[];
|
|
1913
1928
|
interface DateRangePickerProps {
|
|
1914
1929
|
/**
|
|
@@ -1934,16 +1949,16 @@ interface DateRangePickerProps {
|
|
|
1934
1949
|
presets?: PresetItem[];
|
|
1935
1950
|
showPresets?: boolean;
|
|
1936
1951
|
/**
|
|
1937
|
-
*
|
|
1938
|
-
*
|
|
1952
|
+
* プリセットのラベル・日付の書式・カレンダーの月名と曜日・週の始まりのロケール。`ja*` なら日本語、それ以外は英語。
|
|
1953
|
+
* 既定はページのロケール(`<html lang>`、無ければ `"en-US"`)。
|
|
1939
1954
|
*
|
|
1940
1955
|
* @example
|
|
1941
1956
|
* <DateRangePicker locale="ja-JP" />
|
|
1942
1957
|
*/
|
|
1943
1958
|
locale?: string;
|
|
1944
1959
|
/**
|
|
1945
|
-
* 年度の開始月(1-12
|
|
1946
|
-
*
|
|
1960
|
+
* 年度の開始月(1-12)。「今年度」「前年度」と、年度基準の「今四半期」「前四半期」の区切りになる。
|
|
1961
|
+
* 既定はロケールで決まる(ja は `4`、それ以外は `1`)。範囲外・整数でない値はその既定として扱う。
|
|
1947
1962
|
*
|
|
1948
1963
|
* @example
|
|
1949
1964
|
* <DateRangePicker fiscalYearStartMonth={1} />
|
|
@@ -2071,8 +2086,9 @@ declare const RECORD_MIN_POINTS = 6;
|
|
|
2071
2086
|
/**
|
|
2072
2087
|
* The latest point is a record when it beats every earlier finite point:
|
|
2073
2088
|
* strictly highest for higher-is-better, strictly lowest for lower-is-better.
|
|
2089
|
+
* `locale` picks the language of `label` ("Highest in 12 months" / "過去 12 か月で最高"); default the page's (`<html lang>`).
|
|
2074
2090
|
*/
|
|
2075
|
-
declare function detectRecord(history: ReadonlyArray<number | null | undefined> | null | undefined, grain?: PeriodGrain, polarity?: Polarity): RecordInsight | null;
|
|
2091
|
+
declare function detectRecord(history: ReadonlyArray<number | null | undefined> | null | undefined, grain?: PeriodGrain, polarity?: Polarity, locale?: string): RecordInsight | null;
|
|
2076
2092
|
|
|
2077
2093
|
interface KpiCardSource {
|
|
2078
2094
|
/** Period the data covers (e.g. "2023-04 以降"). ISO year-months / dates in it are written by the card ("2023年4月 以降"). */
|
|
@@ -2097,11 +2113,11 @@ interface KpiCardProps extends Omit<ComponentProps<"div">, "children"> {
|
|
|
2097
2113
|
value: number | null | undefined;
|
|
2098
2114
|
/**
|
|
2099
2115
|
* Value format, also used for previous / target / remaining. Default `"compact"`.
|
|
2100
|
-
* `"currency"` is JPY in
|
|
2116
|
+
* `"currency"` is JPY in 万・億 on a ja page (USD in K・M・B otherwise); `"percent"` takes a ratio (0.021 → 2.1%) and
|
|
2101
2117
|
* switches the delta to points. See `formatValue` for the full table.
|
|
2102
2118
|
*/
|
|
2103
2119
|
format?: ValueFormat;
|
|
2104
|
-
/** Default `"
|
|
2120
|
+
/** Locale of the numbers and the built-in wording. Default: the page's (`<html lang>`, else `"en-US"`). */
|
|
2105
2121
|
locale?: string;
|
|
2106
2122
|
/**
|
|
2107
2123
|
* What the value is compared against; drives the delta (tier 3) and previous line (tier 4).
|
|
@@ -2199,7 +2215,7 @@ interface KpiCardProps extends Omit<ComponentProps<"div">, "children"> {
|
|
|
2199
2215
|
*/
|
|
2200
2216
|
declare function fillKpiTemplate(template: string, values: Readonly<Record<string, string | null | undefined>>): string;
|
|
2201
2217
|
declare function fillKpiTemplate(template: string, values: Readonly<Record<string, string | null | undefined>>, fallback: string | null): string | null;
|
|
2202
|
-
declare function KpiCard({ label, value, format, locale, comparison: comparisonProp, comparisons, provisional, betterWhen, polarity: polarityProp, change, neutralBand, showPrevious, summary, target, targetLabel, targetDisplay, period, history, historyGrain, showHistory, source, updatedAt, updatedAtDisplay, timeZone, now, isLoading, size, className, ...props }: KpiCardProps): React.JSX.Element;
|
|
2218
|
+
declare function KpiCard({ label, value, format, locale: localeProp, comparison: comparisonProp, comparisons, provisional, betterWhen, polarity: polarityProp, change, neutralBand, showPrevious, summary, target, targetLabel, targetDisplay, period, history, historyGrain, showHistory, source, updatedAt, updatedAtDisplay, timeZone, now, isLoading, size, className, ...props }: KpiCardProps): React.JSX.Element;
|
|
2203
2219
|
|
|
2204
2220
|
declare const deltaVariants: (props?: ({
|
|
2205
2221
|
variant?: "inline" | "badge" | null | undefined;
|
|
@@ -2228,7 +2244,7 @@ interface DeltaProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children">,
|
|
|
2228
2244
|
* 同じカード群で桁がばらつかないよう、全部に同じ値を渡す。未指定は 1 桁("+14.0%")。`"points"` は未指定のとき `format.digits` に従う。
|
|
2229
2245
|
*/
|
|
2230
2246
|
digits?: number;
|
|
2231
|
-
/** Locale for the change. Default `"
|
|
2247
|
+
/** Locale for the change and its label. Default: the page's (`<html lang>`, else `"en-US"`). */
|
|
2232
2248
|
locale?: string;
|
|
2233
2249
|
/** Show the comparison label ("前月比") after the change. Default true. */
|
|
2234
2250
|
showLabel?: boolean;
|
|
@@ -2271,7 +2287,11 @@ interface PlaceholderProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
2271
2287
|
}
|
|
2272
2288
|
declare const Placeholder: React.ForwardRefExoticComponent<PlaceholderProps & React.RefAttributes<HTMLSpanElement>>;
|
|
2273
2289
|
|
|
2274
|
-
|
|
2290
|
+
/**
|
|
2291
|
+
* The mark's wording in English (the fallback language). Without a `label`, the mark follows the page's
|
|
2292
|
+
* language (`<html lang>`): ja reads「見本の値」.
|
|
2293
|
+
*/
|
|
2294
|
+
declare const DEFAULT_SAMPLE_LABEL: string;
|
|
2275
2295
|
interface SampleState {
|
|
2276
2296
|
label: string;
|
|
2277
2297
|
}
|
|
@@ -2285,12 +2305,12 @@ declare function SampleClaim({ children }: {
|
|
|
2285
2305
|
children?: ReactNode;
|
|
2286
2306
|
}): React.JSX.Element;
|
|
2287
2307
|
interface SampleBadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
2288
|
-
/**
|
|
2308
|
+
/** 印の文言。既定はページの言語で「見本の値」(英語は "Sample data")。 */
|
|
2289
2309
|
label?: string;
|
|
2290
2310
|
}
|
|
2291
2311
|
declare function SampleBadge({ label, className, ...props }: SampleBadgeProps): React.JSX.Element;
|
|
2292
2312
|
interface SampleDataProps {
|
|
2293
|
-
/**
|
|
2313
|
+
/** 印の文言。既定はページの言語で「見本の値」(英語は "Sample data")。 */
|
|
2294
2314
|
label?: string;
|
|
2295
2315
|
children?: ReactNode;
|
|
2296
2316
|
}
|
package/dist/components/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { AppShell, AreaChart, BarChart, BarList, COMPARISON_LABELS, CategoryBar, ChartFrame, DEFAULT_SAMPLE_LABEL, DELTA_NOT_COMPARABLE, DashboardCard, DashboardCardAction, DashboardCardContent, DashboardCardDescription, DashboardCardFooter, DashboardCardHeader, DashboardCardPreset, DashboardCardSkeleton, DashboardCardTitle, DataTable, DataTableColumnVisibility, DataTableContent, DataTableExport, DataTablePagination, DataTablePreset, DataTableToolbar, DateRangePicker, Delta, DonutChart, FilterBar, FilterBarActiveChips, FilterBarClearButton, FilterBarMultiSelect, FilterBarPreset, FilterBarSelect, FunnelSteps, Heatmap, KpiCard, Legend, LineChart, MetricUnit, MetricValue, MultiSelect, PageShell, PageShellActions, PageShellContent, PageShellDescription, PageShellHeader, PageShellHeaderEnd, PageShellHeading, PageShellMeta, PageShellSummary, PageShellSummaryCard, PageShellTitle, Placeholder, ProgressCircle, RECORD_MIN_POINTS, SampleBadge, SampleClaim, SampleData, ScatterChart, SearchableSelect, SectionHeader, SegmentedControl, StatusBadge, Tracker, TrendIndicator, UpdatedAt, WaterfallChart, comparisonBaseline, comparisonLabel, computeComparison, computeTargetProgress, defaultChangeDisplay, defaultPresets, deltaVariants, detectRecord, fillKpiTemplate, flattenOptions, formatChange, formatChangeAmount, formatRelativeTime, funnelStepsVariants, inferPeriodGrain, isGroupedOptions, metricValueVariants, pageShellSummaryCardVariants, tableToCsv, toCsv, toneForValue, useDataTable, useSampleMark } from '../chunk-
|
|
2
|
-
export { EChart, useResolvedChartColors } from '../chunk-
|
|
1
|
+
export { AppShell, AreaChart, BarChart, BarList, COMPARISON_LABELS, CategoryBar, ChartFrame, DEFAULT_SAMPLE_LABEL, DELTA_NOT_COMPARABLE, DashboardCard, DashboardCardAction, DashboardCardContent, DashboardCardDescription, DashboardCardFooter, DashboardCardHeader, DashboardCardPreset, DashboardCardSkeleton, DashboardCardTitle, DataTable, DataTableColumnVisibility, DataTableContent, DataTableExport, DataTablePagination, DataTablePreset, DataTableToolbar, DateRangePicker, Delta, DonutChart, FilterBar, FilterBarActiveChips, FilterBarClearButton, FilterBarMultiSelect, FilterBarPreset, FilterBarSelect, FunnelSteps, Heatmap, KpiCard, Legend, LineChart, MetricUnit, MetricValue, MultiSelect, PageShell, PageShellActions, PageShellContent, PageShellDescription, PageShellHeader, PageShellHeaderEnd, PageShellHeading, PageShellMeta, PageShellSummary, PageShellSummaryCard, PageShellTitle, Placeholder, ProgressCircle, RECORD_MIN_POINTS, SampleBadge, SampleClaim, SampleData, ScatterChart, SearchableSelect, SectionHeader, SegmentedControl, StatusBadge, Tracker, TrendIndicator, UpdatedAt, WaterfallChart, comparisonBaseline, comparisonLabel, computeComparison, computeTargetProgress, defaultChangeDisplay, defaultPresets, deltaVariants, detectRecord, fillKpiTemplate, flattenOptions, formatChange, formatChangeAmount, formatRelativeTime, funnelStepsVariants, inferPeriodGrain, isGroupedOptions, metricValueVariants, pageShellSummaryCardVariants, tableToCsv, toCsv, toneForValue, useDataTable, useSampleMark } from '../chunk-77CISBMG.js';
|
|
2
|
+
export { EChart, useResolvedChartColors } from '../chunk-EG4PX726.js';
|
|
3
3
|
export { Sparkline } from '../chunk-2IAPIOPS.js';
|
|
4
|
-
export { DEFAULT_LOCALE, EMPTY_VALUE, MINUS_SIGN, formatDate, formatDateRange, formatDatesInText, formatDelta, formatKind, formatPoints, formatValue, toValueFormatter } from '../chunk-
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
4
|
+
export { DEFAULT_LOCALE, EMPTY_VALUE, MINUS_SIGN, formatDate, formatDateRange, formatDatesInText, formatDelta, formatKind, formatPoints, formatValue, toValueFormatter } from '../chunk-3RJEOP3J.js';
|
|
5
|
+
import '../chunk-QNOX7WLZ.js';
|
|
6
|
+
import '../chunk-ROHNXP7J.js';
|
|
7
7
|
import '../chunk-U736PVHY.js';
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { V as ValueFormat } from './format-
|
|
2
|
+
import { V as ValueFormat } from './format-DihQkL1N.js';
|
|
3
3
|
|
|
4
4
|
interface DeltaTextProps {
|
|
5
5
|
/** The change itself; its direction comes from the sign. `null` shows "—". */
|
|
@@ -9,7 +9,9 @@ interface DeltaTextProps {
|
|
|
9
9
|
betterWhen?: "up" | "down";
|
|
10
10
|
/** Name of the comparison, e.g. "前月比". Printed before the change; omit to print only the change. */
|
|
11
11
|
comparisonLabel?: string;
|
|
12
|
+
/** Locale of the value and the screen-reader text. Default the page's (`<html lang>`). */
|
|
13
|
+
locale?: string;
|
|
12
14
|
}
|
|
13
|
-
declare function DeltaText({ value, format, betterWhen, comparisonLabel }: DeltaTextProps): React.JSX.Element;
|
|
15
|
+
declare function DeltaText({ value, format, betterWhen, comparisonLabel, locale: localeProp }: DeltaTextProps): React.JSX.Element;
|
|
14
16
|
|
|
15
17
|
export { DeltaText as D, type DeltaTextProps as a };
|
package/dist/doc/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
-
import { V as ValueFormat } from '../format-
|
|
4
|
-
export { D as DeltaText, a as DeltaTextProps } from '../delta-text-
|
|
3
|
+
import { V as ValueFormat } from '../format-DihQkL1N.js';
|
|
4
|
+
export { D as DeltaText, a as DeltaTextProps } from '../delta-text-CbrOaW83.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Per-document token overrides. Anything left out falls through to `--doc-*`
|
|
@@ -53,7 +53,7 @@ interface DocActionItem {
|
|
|
53
53
|
priority?: DocActionPriority;
|
|
54
54
|
}
|
|
55
55
|
interface DocActionItemsProps {
|
|
56
|
-
/** Heading text. Default "推奨する対応". */
|
|
56
|
+
/** Heading text. Default "Recommended actions" (ja: "推奨する対応"). */
|
|
57
57
|
title?: string;
|
|
58
58
|
/** `2` directly under the document, `3` inside another section. Default 2. */
|
|
59
59
|
headingLevel?: 2 | 3;
|
|
@@ -97,7 +97,7 @@ interface DocDataTableProps {
|
|
|
97
97
|
text: string;
|
|
98
98
|
}[];
|
|
99
99
|
source?: string;
|
|
100
|
-
/** When the data was taken: a date only, e.g. "2026-10-03". "データ時点" is added here. */
|
|
100
|
+
/** When the data was taken: a date only, e.g. "2026-10-03". "Data as of" (ja: "データ時点") is added here. */
|
|
101
101
|
asOf?: string;
|
|
102
102
|
}
|
|
103
103
|
declare function DocDataTable({ title, unit, columns, rows, total, highlightRows, footnotes, source, asOf }: DocDataTableProps): React.JSX.Element;
|
|
@@ -113,13 +113,13 @@ interface DocSummaryMetric {
|
|
|
113
113
|
value: number;
|
|
114
114
|
format?: ValueFormat;
|
|
115
115
|
};
|
|
116
|
-
/** Name of the comparison, e.g. "前月比". Default "前期比". */
|
|
116
|
+
/** Name of the comparison, e.g. "前月比". Default "vs. prior period" (ja: "前期比"). */
|
|
117
117
|
comparisonLabel?: string;
|
|
118
118
|
/** Which way is good. Default `"up"`. */
|
|
119
119
|
betterWhen?: "up" | "down";
|
|
120
120
|
}
|
|
121
121
|
interface DocExecutiveSummaryProps {
|
|
122
|
-
/** Heading text. Default "要旨". */
|
|
122
|
+
/** Heading text. Default "Executive summary" (ja: "要旨"). */
|
|
123
123
|
title?: string;
|
|
124
124
|
/** `2` directly under the document, `3` inside another section. Default 2. */
|
|
125
125
|
headingLevel?: 2 | 3;
|
|
@@ -137,7 +137,7 @@ interface DocFigureProps {
|
|
|
137
137
|
title: string;
|
|
138
138
|
/** Unit or scale, e.g. "単位: 百万円". */
|
|
139
139
|
unit?: string;
|
|
140
|
-
/** Figure number; shown as "図 N" in the caption. */
|
|
140
|
+
/** Figure number; shown as "Figure N" (ja: "図 N") in the caption. */
|
|
141
141
|
number?: number;
|
|
142
142
|
/** Where the data comes from. */
|
|
143
143
|
source?: string;
|
|
@@ -161,7 +161,7 @@ interface DocFindingMetric {
|
|
|
161
161
|
value: number;
|
|
162
162
|
format?: ValueFormat;
|
|
163
163
|
};
|
|
164
|
-
/** Name of the comparison, e.g. "前月比". Default "前期比". */
|
|
164
|
+
/** Name of the comparison, e.g. "前月比". Default "vs. prior period" (ja: "前期比"). */
|
|
165
165
|
comparisonLabel?: string;
|
|
166
166
|
/** Which way is good. Default `"up"`. */
|
|
167
167
|
betterWhen?: "up" | "down";
|
|
@@ -173,7 +173,7 @@ interface DocFinding {
|
|
|
173
173
|
metric?: DocFindingMetric;
|
|
174
174
|
}
|
|
175
175
|
interface DocKeyFindingsProps {
|
|
176
|
-
/** Heading text. Default "主要な発見". */
|
|
176
|
+
/** Heading text. Default "Key findings" (ja: "主要な発見"). */
|
|
177
177
|
title?: string;
|
|
178
178
|
/** `2` directly under the document, `3` inside another section. Default 2. */
|
|
179
179
|
headingLevel?: 2 | 3;
|
|
@@ -193,7 +193,7 @@ interface DocScorecardMetric {
|
|
|
193
193
|
value: number;
|
|
194
194
|
format?: ValueFormat;
|
|
195
195
|
};
|
|
196
|
-
/** Name of the comparison, e.g. "前年同期比". Default "前期比". */
|
|
196
|
+
/** Name of the comparison, e.g. "前年同期比". Default "vs. prior period" (ja: "前期比"). */
|
|
197
197
|
comparisonLabel?: string;
|
|
198
198
|
/** Which way is good. Default `"up"`. */
|
|
199
199
|
betterWhen?: "up" | "down";
|
|
@@ -206,13 +206,13 @@ interface DocScorecardMetric {
|
|
|
206
206
|
}[];
|
|
207
207
|
}
|
|
208
208
|
interface DocKpiScorecardProps {
|
|
209
|
-
/** Heading text. Default "主要指標". */
|
|
209
|
+
/** Heading text. Default "Key metrics" (ja: "主要指標"). */
|
|
210
210
|
title?: string;
|
|
211
211
|
/** `2` directly under the document, `3` inside another section. Default 2. */
|
|
212
212
|
headingLevel?: 2 | 3;
|
|
213
213
|
metrics: DocScorecardMetric[];
|
|
214
214
|
variant?: "table" | "grid";
|
|
215
|
-
/** When the numbers were taken: a date only, e.g. "2026-10-03". "データ時点" is added here. */
|
|
215
|
+
/** When the numbers were taken: a date only, e.g. "2026-10-03". "Data as of" (ja: "データ時点") is added here. */
|
|
216
216
|
asOf?: string;
|
|
217
217
|
source?: string;
|
|
218
218
|
}
|
|
@@ -225,7 +225,7 @@ interface DocReportHeaderProps {
|
|
|
225
225
|
subtitle?: ReactNode;
|
|
226
226
|
/** The period the numbers cover, e.g. "2026 年 9 月" or "2026-07-01 〜 2026-09-30". */
|
|
227
227
|
period?: string;
|
|
228
|
-
/** When the data was taken: a date only, e.g. "2026-10-03". Shown under "データ時点". */
|
|
228
|
+
/** When the data was taken: a date only, e.g. "2026-10-03". Shown under "Data as of" (ja: "データ時点"). */
|
|
229
229
|
asOf?: string;
|
|
230
230
|
author?: string;
|
|
231
231
|
/** Where the numbers come from, e.g. "受注管理システム、会計システム". */
|
|
@@ -243,7 +243,7 @@ interface DocSource {
|
|
|
243
243
|
asOf?: string;
|
|
244
244
|
}
|
|
245
245
|
interface DocNotesAndSourcesProps {
|
|
246
|
-
/** Heading text. Default "注記・出典". */
|
|
246
|
+
/** Heading text. Default "Notes and sources" (ja: "注記・出典"). */
|
|
247
247
|
title?: string;
|
|
248
248
|
/** `2` directly under the document, `3` inside another section. Default 2. */
|
|
249
249
|
headingLevel?: 2 | 3;
|