@squadbase/vantage 0.6.2-dev1.42c4e48 → 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/{build-MFWRPYKW.js → build-U7GO26HR.js} +7 -7
- package/dist/{build-MFWRPYKW.js.map → build-U7GO26HR.js.map} +1 -1
- package/dist/{check-ZBIH422T.js → check-MRVAIHG5.js} +5 -5
- package/dist/{check-ZBIH422T.js.map → check-MRVAIHG5.js.map} +1 -1
- package/dist/chunk-2IAPIOPS.js +152 -0
- package/dist/chunk-2IAPIOPS.js.map +1 -0
- package/dist/chunk-3RJEOP3J.js +174 -0
- package/dist/chunk-3RJEOP3J.js.map +1 -0
- package/dist/chunk-77CISBMG.js +7581 -0
- package/dist/chunk-77CISBMG.js.map +1 -0
- package/dist/{chunk-V3LF7BE7.js → chunk-ANZLVSEP.js} +4 -5
- package/dist/chunk-ANZLVSEP.js.map +1 -0
- package/dist/{chunk-XQUSGIDG.js → chunk-CKWPK4RO.js} +10 -3
- package/dist/chunk-CKWPK4RO.js.map +1 -0
- package/dist/chunk-EG4PX726.js +678 -0
- package/dist/chunk-EG4PX726.js.map +1 -0
- package/dist/chunk-NZ5QIIG4.js +74 -0
- package/dist/chunk-NZ5QIIG4.js.map +1 -0
- package/dist/{chunk-7DZGJQ3P.js → chunk-PJ4SPXHS.js} +23 -6
- package/dist/chunk-PJ4SPXHS.js.map +1 -0
- package/dist/{chunk-OB6UBJXF.js → chunk-QNOX7WLZ.js} +127 -36
- package/dist/chunk-QNOX7WLZ.js.map +1 -0
- package/dist/{chunk-PXRX5PEC.js → chunk-ROHNXP7J.js} +73 -4
- package/dist/chunk-ROHNXP7J.js.map +1 -0
- package/dist/{chunk-CEXAQQ5W.js → chunk-S5MDTHH7.js} +180 -18
- package/dist/chunk-S5MDTHH7.js.map +1 -0
- package/dist/{chunk-IBGOCWJB.js → chunk-SDJTTMLK.js} +247 -86
- package/dist/chunk-SDJTTMLK.js.map +1 -0
- package/dist/{chunk-QEWCYW3I.js → chunk-SHZM3EXB.js} +29 -8
- package/dist/chunk-SHZM3EXB.js.map +1 -0
- package/dist/chunk-TRMHNMMZ.js +61 -0
- package/dist/chunk-TRMHNMMZ.js.map +1 -0
- package/dist/{chunk-A2UUGASH.js → chunk-U736PVHY.js} +2 -2
- package/dist/chunk-U736PVHY.js.map +1 -0
- package/dist/{chunk-JKLLFVEU.js → chunk-UWSQUHX6.js} +4 -99
- package/dist/chunk-UWSQUHX6.js.map +1 -0
- package/dist/cli.js +6 -6
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +8 -2
- package/dist/client/index.js.map +1 -1
- package/dist/components/index.d.ts +1617 -101
- package/dist/components/index.js +7 -4
- package/dist/delta-text-CbrOaW83.d.ts +17 -0
- package/dist/{dev-DCTOHQ6W.js → dev-O42JFQ64.js} +7 -7
- package/dist/{dev-DCTOHQ6W.js.map → dev-O42JFQ64.js.map} +1 -1
- package/dist/doc/index.d.ts +215 -2
- package/dist/doc/index.js +423 -5
- package/dist/doc/index.js.map +1 -1
- package/dist/{doctor-5E2VEZPK.js → doctor-YD3XAAOT.js} +5 -5
- package/dist/{doctor-5E2VEZPK.js.map → doctor-YD3XAAOT.js.map} +1 -1
- package/dist/format-DihQkL1N.d.ts +249 -0
- package/dist/markdown/index.js +1 -1
- package/dist/markdown/index.js.map +1 -1
- package/dist/query/index.js +2 -2
- package/dist/{routes-3SGAFDMC.js → routes-PVKNT777.js} +4 -4
- package/dist/{routes-3SGAFDMC.js.map → routes-PVKNT777.js.map} +1 -1
- package/dist/slide/index.d.ts +272 -1
- package/dist/slide/index.js +1025 -4
- package/dist/slide/index.js.map +1 -1
- package/dist/table/index.js +11 -8
- package/dist/table/index.js.map +1 -1
- package/dist/ui/index.d.ts +8 -2
- package/dist/ui/index.js +22 -112
- package/dist/ui/index.js.map +1 -1
- package/dist/{upgrade-DBBE6GIR.js → upgrade-6DT7ADRP.js} +4 -4
- package/dist/{upgrade-DBBE6GIR.js.map → upgrade-6DT7ADRP.js.map} +1 -1
- package/dist/vite/index.js +3 -3
- package/docs/en/agent-skills.md +1 -1
- package/docs/en/changelog.md +2 -0
- package/docs/en/components.md +42 -17
- package/docs/en/doc/delta-text.md +40 -0
- package/docs/en/doc/doc-action-items.md +49 -0
- package/docs/en/doc/doc-callout.md +38 -0
- package/docs/en/doc/doc-data-table.md +60 -0
- package/docs/en/doc/doc-executive-summary.md +64 -0
- package/docs/en/doc/doc-figure.md +56 -0
- package/docs/en/doc/doc-key-findings.md +61 -0
- package/docs/en/doc/doc-kpi-scorecard.md +80 -0
- package/docs/en/doc/doc-notes-and-sources.md +43 -0
- package/docs/en/doc/doc-report-header.md +46 -0
- package/docs/en/pages-and-metadata.md +15 -0
- package/docs/en/parts/area-chart.md +99 -0
- package/docs/en/parts/bar-chart.md +91 -0
- package/docs/en/parts/bar-list.md +50 -0
- package/docs/en/parts/category-bar.md +37 -0
- package/docs/en/parts/chart-frame.md +39 -0
- package/docs/en/parts/data-table.md +22 -0
- package/docs/en/parts/delta.md +51 -0
- package/docs/en/parts/donut-chart.md +72 -0
- package/docs/en/parts/format.md +43 -0
- package/docs/en/parts/funnel-steps.md +2 -1
- package/docs/en/parts/heatmap.md +53 -0
- package/docs/en/parts/kpi-card.md +58 -0
- package/docs/en/parts/legend.md +35 -0
- package/docs/en/parts/line-chart.md +94 -0
- package/docs/en/parts/metric-value.md +3 -2
- package/docs/en/parts/progress-circle.md +33 -0
- package/docs/en/parts/sample-data.md +39 -0
- package/docs/en/parts/scatter-chart.md +56 -0
- package/docs/en/parts/sparkline.md +1 -1
- package/docs/en/parts/tracker.md +36 -0
- package/docs/en/parts/trend-indicator.md +17 -1
- package/docs/en/parts/updated-at.md +30 -0
- package/docs/en/parts/waterfall-chart.md +56 -0
- package/docs/en/slide/slide-chart-full.md +48 -0
- package/docs/en/slide/slide-chart-insight.md +52 -0
- package/docs/en/slide/slide-columns.md +46 -0
- package/docs/en/slide/slide-comparison.md +68 -0
- package/docs/en/slide/slide-cover.md +39 -0
- package/docs/en/slide/slide-exec-summary.md +47 -0
- package/docs/en/slide/slide-heading.md +38 -0
- package/docs/en/slide/slide-kpi-grid.md +55 -0
- package/docs/en/slide/slide-kpi-hero.md +58 -0
- package/docs/en/slide/slide-next-actions.md +49 -0
- package/docs/en/slide/slide-scorecard-table.md +54 -0
- package/docs/en/slide/slide-section.md +44 -0
- package/docs/en/slide/slide-source-line.md +34 -0
- package/docs/en/ui/alert-dialog.md +42 -0
- package/docs/en/ui/avatar.md +31 -0
- package/docs/en/ui/combobox.md +74 -0
- package/docs/en/ui/drawer.md +41 -0
- package/docs/en/ui/empty.md +1 -1
- package/docs/en/ui/error-state.md +4 -3
- package/docs/en/ui/field.md +42 -0
- package/docs/en/ui/hover-card.md +21 -0
- package/docs/en/ui/kbd.md +17 -0
- package/docs/en/ui/loading.md +1 -1
- package/docs/en/ui/pagination.md +36 -0
- package/docs/en/ui/radio-group.md +21 -0
- package/docs/en/ui/toast.md +44 -0
- package/docs/en/ui/toggle-group.md +4 -3
- package/docs/en/ui-and-theming.md +1 -1
- package/docs/index.json +917 -77
- package/docs/ja/agent-skills.md +1 -1
- package/docs/ja/changelog.md +2 -0
- package/docs/ja/components.md +39 -16
- package/docs/ja/doc/delta-text.md +40 -0
- package/docs/ja/doc/doc-action-items.md +49 -0
- package/docs/ja/doc/doc-callout.md +38 -0
- package/docs/ja/doc/doc-data-table.md +60 -0
- package/docs/ja/doc/doc-executive-summary.md +64 -0
- package/docs/ja/doc/doc-figure.md +56 -0
- package/docs/ja/doc/doc-key-findings.md +61 -0
- package/docs/ja/doc/doc-kpi-scorecard.md +80 -0
- package/docs/ja/doc/doc-notes-and-sources.md +43 -0
- package/docs/ja/doc/doc-report-header.md +46 -0
- package/docs/ja/page-types/slide.md +1 -0
- package/docs/ja/pages-and-metadata.md +15 -0
- package/docs/ja/parts/area-chart.md +49 -25
- package/docs/ja/parts/bar-chart.md +50 -24
- package/docs/ja/parts/bar-list.md +31 -8
- package/docs/ja/parts/chart-frame.md +36 -0
- package/docs/ja/parts/data-table.md +22 -0
- package/docs/ja/parts/delta.md +51 -0
- package/docs/ja/parts/donut-chart.md +45 -26
- package/docs/ja/parts/format.md +44 -0
- package/docs/ja/parts/funnel-steps.md +27 -8
- package/docs/ja/parts/heatmap.md +45 -0
- package/docs/ja/parts/kpi-card.md +56 -0
- package/docs/ja/parts/legend.md +36 -0
- package/docs/ja/parts/line-chart.md +48 -22
- package/docs/ja/parts/metric-value.md +3 -2
- package/docs/ja/parts/sample-data.md +61 -0
- package/docs/ja/parts/scatter-chart.md +69 -0
- package/docs/ja/parts/sparkline.md +1 -1
- package/docs/ja/parts/trend-indicator.md +17 -1
- package/docs/ja/parts/updated-at.md +27 -0
- package/docs/ja/parts/waterfall-chart.md +61 -0
- package/docs/ja/slide/slide-chart-full.md +48 -0
- package/docs/ja/slide/slide-chart-insight.md +52 -0
- package/docs/ja/slide/slide-columns.md +46 -0
- package/docs/ja/slide/slide-comparison.md +68 -0
- package/docs/ja/slide/slide-cover.md +39 -0
- package/docs/ja/slide/slide-exec-summary.md +47 -0
- package/docs/ja/slide/slide-heading.md +38 -0
- package/docs/ja/slide/slide-kpi-grid.md +55 -0
- package/docs/ja/slide/slide-kpi-hero.md +58 -0
- package/docs/ja/slide/slide-next-actions.md +49 -0
- package/docs/ja/slide/slide-scorecard-table.md +54 -0
- package/docs/ja/slide/slide-section.md +44 -0
- package/docs/ja/slide/slide-source-line.md +34 -0
- package/docs/ja/ui/empty.md +1 -1
- package/docs/ja/ui/error-state.md +4 -3
- package/docs/ja/ui/loading.md +1 -1
- package/docs/ja/ui/toggle-group.md +4 -3
- package/docs/ja/ui-and-theming.md +2 -2
- package/package.json +26 -24
- package/registry/ui/accordion.tsx +4 -2
- package/registry/ui/alert-dialog.tsx +3 -3
- package/registry/ui/alert.tsx +3 -1
- package/registry/ui/app-shell.tsx +145 -2
- package/registry/ui/area-chart.tsx +3111 -166
- package/registry/ui/attention-list.tsx +465 -0
- package/registry/ui/avatar.tsx +1 -1
- package/registry/ui/badge.tsx +3 -1
- package/registry/ui/bar-chart.tsx +3105 -164
- package/registry/ui/bar-list.tsx +3877 -181
- package/registry/ui/box-plot-chart.tsx +4214 -0
- package/registry/ui/breadcrumb.tsx +3 -1
- package/registry/ui/button.tsx +3 -1
- package/registry/ui/calendar.tsx +3 -1
- package/registry/ui/card.tsx +4 -2
- package/registry/ui/category-bar.tsx +1233 -16
- package/registry/ui/chart-frame.tsx +1604 -0
- package/registry/ui/checkbox.tsx +3 -1
- package/registry/ui/collapsible.tsx +3 -1
- package/registry/ui/combobox.tsx +2 -2
- package/registry/ui/command.tsx +3 -1
- package/registry/ui/dashboard-card.tsx +71 -28
- package/registry/ui/data-table.tsx +882 -68
- package/registry/ui/date-range-picker.tsx +400 -65
- package/registry/ui/delta.tsx +350 -0
- package/registry/ui/dialog.tsx +5 -3
- package/registry/ui/donut-chart.tsx +3184 -182
- package/registry/ui/drawer.tsx +1 -1
- package/registry/ui/dropdown-menu.tsx +5 -3
- package/registry/ui/echart.tsx +761 -69
- package/registry/ui/field.tsx +1 -1
- package/registry/ui/filter-bar.tsx +212 -26
- package/registry/ui/funnel-steps.tsx +3622 -53
- package/registry/ui/heatmap.tsx +2027 -0
- package/registry/ui/histogram-chart.tsx +4284 -0
- package/registry/ui/hover-card.tsx +2 -2
- package/registry/ui/input-group.tsx +3 -1
- package/registry/ui/input.tsx +3 -1
- package/registry/ui/kbd.tsx +3 -1
- package/registry/ui/kpi-card.tsx +905 -0
- package/registry/ui/label.tsx +3 -1
- package/registry/ui/legend.tsx +3817 -0
- package/registry/ui/line-chart.tsx +3109 -158
- package/registry/ui/metric-value.tsx +9 -1
- package/registry/ui/multi-select.tsx +170 -14
- package/registry/ui/page-shell.tsx +244 -51
- package/registry/ui/pagination.tsx +3 -1
- package/registry/ui/paired-chart.tsx +4086 -0
- package/registry/ui/placeholder.tsx +8 -2
- package/registry/ui/popover.tsx +4 -2
- package/registry/ui/progress-circle.tsx +773 -12
- package/registry/ui/progress.tsx +3 -1
- package/registry/ui/radio-group.tsx +1 -1
- package/registry/ui/sample-data.tsx +230 -0
- package/registry/ui/scatter-chart.tsx +4503 -0
- package/registry/ui/scroll-area.tsx +3 -2
- package/registry/ui/searchable-select.tsx +153 -10
- package/registry/ui/section-header.tsx +5 -3
- package/registry/ui/segmented-control.tsx +7 -2
- package/registry/ui/select.tsx +4 -2
- package/registry/ui/separator.tsx +3 -1
- package/registry/ui/sheet.tsx +4 -2
- package/registry/ui/sidebar.tsx +4 -2
- package/registry/ui/skeleton.tsx +4 -2
- package/registry/ui/slider.tsx +4 -2
- package/registry/ui/sparkline.tsx +84 -9
- package/registry/ui/spinner.tsx +3 -1
- package/registry/ui/states.tsx +194 -8
- package/registry/ui/status-badge.tsx +246 -39
- package/registry/ui/switch.tsx +3 -1
- package/registry/ui/table.tsx +4 -2
- package/registry/ui/tabs.tsx +5 -3
- package/registry/ui/textarea.tsx +3 -1
- package/registry/ui/toast.tsx +2 -2
- package/registry/ui/toggle-group.tsx +3 -1
- package/registry/ui/toggle.tsx +3 -1
- package/registry/ui/tooltip.tsx +10 -4
- package/registry/ui/tracker.tsx +798 -19
- package/registry/ui/trend-indicator.tsx +164 -9
- package/registry/ui/updated-at.tsx +276 -0
- package/registry/ui/waterfall-chart.tsx +4561 -0
- package/skills/vantage-add-feature/SKILL.md +5 -0
- package/skills/vantage-design/SKILL.md +60 -52
- package/skills/vantage-design/references/extract.md +26 -27
- package/skills/vantage-design/references/format.md +12 -172
- package/skills/vantage-design/references/presets.md +50 -110
- package/skills/vantage-pitfalls/SKILL.md +5 -0
- package/skills/vantage-slide/SKILL.md +54 -36
- package/templates/AGENTS.md +45 -16
- package/templates/agents/api.md +7 -0
- package/templates/agents/doc.md +48 -0
- package/templates/agents/page.md +69 -2
- package/templates/agents/slide.md +77 -3
- package/theme.css +247 -149
- package/dist/chunk-5ZOP4SQR.js +0 -47
- package/dist/chunk-5ZOP4SQR.js.map +0 -1
- package/dist/chunk-7DZGJQ3P.js.map +0 -1
- package/dist/chunk-A2UUGASH.js.map +0 -1
- package/dist/chunk-AG6RZ2RR.js +0 -3208
- package/dist/chunk-AG6RZ2RR.js.map +0 -1
- package/dist/chunk-CEXAQQ5W.js.map +0 -1
- package/dist/chunk-IBGOCWJB.js.map +0 -1
- package/dist/chunk-JKLLFVEU.js.map +0 -1
- package/dist/chunk-OB6UBJXF.js.map +0 -1
- package/dist/chunk-PXRX5PEC.js.map +0 -1
- package/dist/chunk-QEWCYW3I.js.map +0 -1
- package/dist/chunk-V3LF7BE7.js.map +0 -1
- package/dist/chunk-XQUSGIDG.js.map +0 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
// Copied by `vantage add ui metric-value`. This file is yours to edit.
|
|
2
|
-
// Generated from @squadbase/
|
|
2
|
+
// Generated from @squadbase/squadkit registry/components/metric-value.tsx by `pnpm run registry` (in Vantage, edit packages/squadkit, not registry/).
|
|
3
|
+
"use client"
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* MetricValue / MetricUnit — the large number in a dashboard tile and its
|
|
5
7
|
* trailing unit, sized as a pair so the unit stays subordinate at every size.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated KPI の数字は KpiCard を使う。KpiCard は書式(`format`、単位は
|
|
10
|
+
* `{ type: "number", unit: "社" }`)・比較ラベル・増減を値から計算するので、
|
|
11
|
+
* 手書きの数字と TrendIndicator の組み合わせのように食い違わない。
|
|
6
12
|
*/
|
|
7
13
|
import { forwardRef, type HTMLAttributes } from "react"
|
|
8
14
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
@@ -27,6 +33,7 @@ export interface MetricValueProps
|
|
|
27
33
|
extends HTMLAttributes<HTMLDivElement>,
|
|
28
34
|
VariantProps<typeof metricValueVariants> {}
|
|
29
35
|
|
|
36
|
+
/** @deprecated KPI の数字は KpiCard を使う。 */
|
|
30
37
|
export const MetricValue = forwardRef<HTMLDivElement, MetricValueProps>(
|
|
31
38
|
({ className, size, ...props }, ref) => (
|
|
32
39
|
<div
|
|
@@ -41,6 +48,7 @@ MetricValue.displayName = "MetricValue"
|
|
|
41
48
|
|
|
42
49
|
export interface MetricUnitProps extends HTMLAttributes<HTMLSpanElement> {}
|
|
43
50
|
|
|
51
|
+
/** @deprecated KPI の単位は KpiCard の `format`(`{ type: "number", unit: "社" }`)で付ける。 */
|
|
44
52
|
export const MetricUnit = forwardRef<HTMLSpanElement, MetricUnitProps>(
|
|
45
53
|
({ className, ...props }, ref) => (
|
|
46
54
|
<span
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Copied by `vantage add ui multi-select`. This file is yours to edit.
|
|
2
|
-
// Generated from @squadbase/
|
|
2
|
+
// Generated from @squadbase/squadkit registry/components/multi-select.tsx by `pnpm run registry` (in Vantage, edit packages/squadkit, not registry/).
|
|
3
|
+
"use client"
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* MultiSelect — a multi-value combobox that shows the selection as removable
|
|
5
|
-
* badges. Past `maxCount` badges the rest collapse into a "+N件" counter.
|
|
7
|
+
* badges. Past `maxCount` badges the rest collapse into a "+N more" (ja: "+N件") counter.
|
|
6
8
|
* Pass `onSearch` to take filtering over yourself (server-side search).
|
|
7
9
|
*/
|
|
8
10
|
import { forwardRef, useId, useMemo, useState } from "react"
|
|
@@ -12,12 +14,144 @@ import { cn } from "@squadbase/vantage/ui"
|
|
|
12
14
|
import { Badge } from "@squadbase/vantage/ui"
|
|
13
15
|
import { Popover, PopoverContent, PopoverTrigger } from "@squadbase/vantage/ui"
|
|
14
16
|
import { flattenOptions, type SelectOptions } from "@squadbase/vantage/components"
|
|
17
|
+
import { useSyncExternalStore } from "react"
|
|
15
18
|
import type { KeyboardEvent, MouseEvent } from "react"
|
|
16
19
|
import { CheckIcon, LoaderIcon, XIcon } from "lucide-react"
|
|
17
20
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@squadbase/vantage/ui"
|
|
18
21
|
import { isGroupedOptions, type SelectOption } from "@squadbase/vantage/components"
|
|
19
22
|
|
|
20
|
-
/* ---------- inlined from
|
|
23
|
+
/* ---------- inlined from @squadbase/squadkit registry/lib/locale.ts (internal to @squadbase/vantage) ---------- */
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The display language of the parts and the defaults that follow it.
|
|
27
|
+
*
|
|
28
|
+
* The language comes from `<html lang>`: a tag starting with `ja` reads Japanese, anything else English.
|
|
29
|
+
* Without a usable `lang` (missing, invalid, or no `document` — SSR, Node) the locale is `FALLBACK_LOCALE`
|
|
30
|
+
* (`en-US`). A `locale` passed explicitly (a prop, an argument) always wins.
|
|
31
|
+
*
|
|
32
|
+
* Parts read the locale through `useLocale` (`hooks/use-locale`) and pass it down; the pure helpers here
|
|
33
|
+
* and in `format` / `comparison` / `chart-*` take it as an argument and fall back to `documentLocale()`.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/** The language of the built-in wording: Japanese or English. */
|
|
37
|
+
type UiLanguage = "ja" | "en"
|
|
38
|
+
|
|
39
|
+
/** The locale used when `<html lang>` gives none (and on the server). */
|
|
40
|
+
const FALLBACK_LOCALE = "en-US"
|
|
41
|
+
|
|
42
|
+
/** `"ja"` when `locale` starts with `ja` (`ja`, `ja-JP`), else `"en"`. A missing locale is `"en"`. */
|
|
43
|
+
function uiLanguage(locale: string | null | undefined): UiLanguage {
|
|
44
|
+
return typeof locale === "string" && locale.trim().toLowerCase().startsWith("ja") ? "ja" : "en"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** A BCP 47 tag in its canonical form (`en-gb` → `en-GB`), or `FALLBACK_LOCALE` when it is empty or invalid. */
|
|
48
|
+
function normalizeLocale(tag: string | null | undefined): string {
|
|
49
|
+
const value = tag?.trim()
|
|
50
|
+
if (!value) return FALLBACK_LOCALE
|
|
51
|
+
try {
|
|
52
|
+
return Intl.getCanonicalLocales(value)[0] ?? FALLBACK_LOCALE
|
|
53
|
+
} catch {
|
|
54
|
+
return FALLBACK_LOCALE
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The locale of the page: `document.documentElement.lang`, canonicalized. `FALLBACK_LOCALE` when it is empty or
|
|
60
|
+
* invalid, or there is no `document`. Parts read it through `useLocale`, never while rendering.
|
|
61
|
+
*/
|
|
62
|
+
function documentLocale(): string {
|
|
63
|
+
if (typeof document === "undefined") return FALLBACK_LOCALE
|
|
64
|
+
return normalizeLocale(document.documentElement?.getAttribute("lang"))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** `locale` when given, else the page's locale (`documentLocale()`). */
|
|
68
|
+
function resolveLocale(locale?: string | null): string {
|
|
69
|
+
return locale || documentLocale()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Picks the wording table of the locale's language. */
|
|
73
|
+
function pickLocale<T>(table: { ja: T; en: T }, locale?: string | null): T {
|
|
74
|
+
return table[uiLanguage(resolveLocale(locale))]
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** The currency `format="currency"` uses without a `currency`: JPY for Japanese, USD otherwise. */
|
|
78
|
+
function defaultCurrency(locale?: string | null): string {
|
|
79
|
+
return uiLanguage(resolveLocale(locale)) === "ja" ? "JPY" : "USD"
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** The month a fiscal year starts in (1–12) when none is given: April for Japanese, January otherwise. */
|
|
83
|
+
function defaultFiscalYearStartMonth(locale?: string | null): number {
|
|
84
|
+
return uiLanguage(resolveLocale(locale)) === "ja" ? 4 : 1
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** A day of the week, 0 = Sunday … 6 = Saturday (the `Date#getDay` / date-fns numbering). */
|
|
88
|
+
type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6
|
|
89
|
+
|
|
90
|
+
/** Locales whose week starts on Sunday when the runtime has no week data. */
|
|
91
|
+
const SUNDAY_FIRST = new Set(["en", "en-US", "en-CA"])
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The first day of the week: Monday for Japanese; otherwise the locale's convention from `Intl.Locale`
|
|
95
|
+
* (`en-US` Sunday, `en-GB` Monday). Without week data in the runtime: Sunday for `en` / `en-US` / `en-CA`,
|
|
96
|
+
* Monday for the rest.
|
|
97
|
+
*/
|
|
98
|
+
function weekStartsOn(locale?: string | null): WeekDay {
|
|
99
|
+
const tag = normalizeLocale(resolveLocale(locale))
|
|
100
|
+
if (uiLanguage(tag) === "ja") return 1
|
|
101
|
+
try {
|
|
102
|
+
const info = new Intl.Locale(tag) as Intl.Locale & {
|
|
103
|
+
getWeekInfo?: () => { firstDay: number }
|
|
104
|
+
weekInfo?: { firstDay: number }
|
|
105
|
+
}
|
|
106
|
+
const firstDay = info.getWeekInfo?.().firstDay ?? info.weekInfo?.firstDay
|
|
107
|
+
if (typeof firstDay === "number" && firstDay >= 1 && firstDay <= 7) return (firstDay % 7) as WeekDay
|
|
108
|
+
} catch {
|
|
109
|
+
// Fall through to the table below.
|
|
110
|
+
}
|
|
111
|
+
return SUNDAY_FIRST.has(tag) ? 0 : 1
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* ---------- inlined from @squadbase/squadkit registry/hooks/use-locale.ts (internal to @squadbase/vantage) ---------- */
|
|
115
|
+
|
|
116
|
+
const listeners = new Set<() => void>()
|
|
117
|
+
let observer: MutationObserver | null = null
|
|
118
|
+
|
|
119
|
+
/** One observer on `<html lang>` for every subscribed part. */
|
|
120
|
+
function subscribe(onChange: () => void): () => void {
|
|
121
|
+
if (typeof document === "undefined" || typeof MutationObserver === "undefined") return () => {}
|
|
122
|
+
listeners.add(onChange)
|
|
123
|
+
if (!observer) {
|
|
124
|
+
observer = new MutationObserver(() => {
|
|
125
|
+
for (const listener of [...listeners]) listener()
|
|
126
|
+
})
|
|
127
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["lang"] })
|
|
128
|
+
}
|
|
129
|
+
return () => {
|
|
130
|
+
listeners.delete(onChange)
|
|
131
|
+
if (listeners.size === 0 && observer) {
|
|
132
|
+
observer.disconnect()
|
|
133
|
+
observer = null
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const serverLocale = () => FALLBACK_LOCALE
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The page's locale (`<html lang>`), following changes made while the page runs. On the server and during
|
|
142
|
+
* hydration it is `FALLBACK_LOCALE` (`en-US`), so the markup matches; it switches right after.
|
|
143
|
+
*/
|
|
144
|
+
function useDocumentLocale(): string {
|
|
145
|
+
return useSyncExternalStore(subscribe, documentLocale, serverLocale)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** The locale a part renders in: its `locale` prop when given, else the page's (`useDocumentLocale`). */
|
|
149
|
+
function useLocale(locale?: string | null): string {
|
|
150
|
+
const page = useDocumentLocale()
|
|
151
|
+
return locale || page
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* ---------- inlined from @squadbase/squadkit registry/components/option-command.tsx (internal to @squadbase/vantage) ---------- */
|
|
21
155
|
|
|
22
156
|
interface OptionCommandListProps {
|
|
23
157
|
options: SelectOptions
|
|
@@ -134,16 +268,37 @@ export interface MultiSelectProps {
|
|
|
134
268
|
className?: string
|
|
135
269
|
}
|
|
136
270
|
|
|
271
|
+
const TEXT = {
|
|
272
|
+
ja: {
|
|
273
|
+
placeholder: "選択してください",
|
|
274
|
+
search: "検索...",
|
|
275
|
+
empty: "見つかりませんでした",
|
|
276
|
+
remove: (label: string) => `${label}を削除`,
|
|
277
|
+
more: (count: number) => `+${count}件`,
|
|
278
|
+
},
|
|
279
|
+
en: {
|
|
280
|
+
placeholder: "Select options",
|
|
281
|
+
search: "Search...",
|
|
282
|
+
empty: "No results found.",
|
|
283
|
+
remove: (label: string) => `Remove ${label}`,
|
|
284
|
+
more: (count: number) => `+${count} more`,
|
|
285
|
+
},
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** Not given yet (a draft fills props in steps): render empty, keep the same value between renders. */
|
|
289
|
+
const NO_OPTIONS: never[] = []
|
|
290
|
+
const NO_VALUES: string[] = []
|
|
291
|
+
|
|
137
292
|
export const MultiSelect = forwardRef<HTMLDivElement, MultiSelectProps>(function MultiSelect(
|
|
138
293
|
{
|
|
139
|
-
options,
|
|
140
|
-
value,
|
|
294
|
+
options = NO_OPTIONS,
|
|
295
|
+
value = NO_VALUES,
|
|
141
296
|
onChange,
|
|
142
297
|
onSearch,
|
|
143
298
|
maxCount = 3,
|
|
144
|
-
placeholder
|
|
145
|
-
searchPlaceholder
|
|
146
|
-
emptyText
|
|
299
|
+
placeholder,
|
|
300
|
+
searchPlaceholder,
|
|
301
|
+
emptyText,
|
|
147
302
|
isLoading = false,
|
|
148
303
|
disabled = false,
|
|
149
304
|
className,
|
|
@@ -152,6 +307,7 @@ export const MultiSelect = forwardRef<HTMLDivElement, MultiSelectProps>(function
|
|
|
152
307
|
) {
|
|
153
308
|
const [open, setOpen] = useState(false)
|
|
154
309
|
const listId = useId()
|
|
310
|
+
const t = TEXT[uiLanguage(useLocale())]
|
|
155
311
|
|
|
156
312
|
const allOptions = useMemo(() => flattenOptions(options), [options])
|
|
157
313
|
const selectedOptions = useMemo(
|
|
@@ -179,20 +335,20 @@ export const MultiSelect = forwardRef<HTMLDivElement, MultiSelectProps>(function
|
|
|
179
335
|
aria-controls={listId}
|
|
180
336
|
disabled={disabled}
|
|
181
337
|
className={cn(
|
|
182
|
-
"inline-flex min-h-9 w-full items-center justify-between gap-2 rounded-md border bg-background px-3 py-1.5 text-sm shadow-xs transition-
|
|
338
|
+
"inline-flex min-h-9 w-full items-center justify-between gap-2 rounded-md border bg-background px-3 py-1.5 text-sm shadow-xs transition-[color,background-color,border-color,box-shadow] outline-none hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
183
339
|
className,
|
|
184
340
|
)}
|
|
185
341
|
>
|
|
186
342
|
<span className="flex min-w-0 flex-1 flex-wrap items-center gap-1">
|
|
187
343
|
{selectedOptions.length === 0 ? (
|
|
188
|
-
<span className="text-muted-foreground">{placeholder}</span>
|
|
344
|
+
<span className="text-muted-foreground">{placeholder ?? t.placeholder}</span>
|
|
189
345
|
) : (
|
|
190
346
|
<>
|
|
191
347
|
{visibleBadges.map((option) => (
|
|
192
348
|
<Badge key={option.value} variant="secondary" className="shrink-0 gap-1 pr-1">
|
|
193
349
|
<span className="max-w-[120px] truncate">{option.label}</span>
|
|
194
350
|
<RemoveButton
|
|
195
|
-
label={
|
|
351
|
+
label={t.remove(option.label)}
|
|
196
352
|
onRemove={() => onChange?.(value.filter((v) => v !== option.value))}
|
|
197
353
|
iconClassName="size-3"
|
|
198
354
|
/>
|
|
@@ -200,7 +356,7 @@ export const MultiSelect = forwardRef<HTMLDivElement, MultiSelectProps>(function
|
|
|
200
356
|
))}
|
|
201
357
|
{overflowCount > 0 && (
|
|
202
358
|
<Badge variant="secondary" className="shrink-0">
|
|
203
|
-
|
|
359
|
+
{t.more(overflowCount)}
|
|
204
360
|
</Badge>
|
|
205
361
|
)}
|
|
206
362
|
</>
|
|
@@ -215,8 +371,8 @@ export const MultiSelect = forwardRef<HTMLDivElement, MultiSelectProps>(function
|
|
|
215
371
|
onSelect={handleSelect}
|
|
216
372
|
onSearch={onSearch}
|
|
217
373
|
isLoading={isLoading}
|
|
218
|
-
searchPlaceholder={searchPlaceholder}
|
|
219
|
-
emptyText={emptyText}
|
|
374
|
+
searchPlaceholder={searchPlaceholder ?? t.search}
|
|
375
|
+
emptyText={emptyText ?? t.empty}
|
|
220
376
|
/>
|
|
221
377
|
</PopoverContent>
|
|
222
378
|
</Popover>
|
|
@@ -1,14 +1,153 @@
|
|
|
1
1
|
// Copied by `vantage add ui page-shell`. This file is yours to edit.
|
|
2
|
-
// Generated from @squadbase/
|
|
2
|
+
// Generated from @squadbase/squadkit registry/components/page-shell.tsx by `pnpm run registry` (in Vantage, edit packages/squadkit, not registry/).
|
|
3
|
+
"use client"
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* PageShell — the standard page frame: a bordered header band (title,
|
|
5
7
|
* description, meta, actions), an optional summary card row, and the content
|
|
6
8
|
* area. Composed from parts so a page can use only what it needs.
|
|
7
9
|
*/
|
|
8
|
-
import { forwardRef, type HTMLAttributes } from "react"
|
|
10
|
+
import { forwardRef, type HTMLAttributes, type ReactNode } from "react"
|
|
9
11
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
10
12
|
|
|
13
|
+
import { formatDateRange, EMPTY_VALUE } from "@squadbase/vantage/components"
|
|
11
14
|
import { cn } from "@squadbase/vantage/ui"
|
|
15
|
+
import { Badge } from "@squadbase/vantage/ui"
|
|
16
|
+
import { UpdatedAt, type UpdatedAtProps } from "@squadbase/vantage/components"
|
|
17
|
+
import { useSyncExternalStore } from "react"
|
|
18
|
+
|
|
19
|
+
/* ---------- inlined from @squadbase/squadkit registry/lib/locale.ts (internal to @squadbase/vantage) ---------- */
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The display language of the parts and the defaults that follow it.
|
|
23
|
+
*
|
|
24
|
+
* The language comes from `<html lang>`: a tag starting with `ja` reads Japanese, anything else English.
|
|
25
|
+
* Without a usable `lang` (missing, invalid, or no `document` — SSR, Node) the locale is `FALLBACK_LOCALE`
|
|
26
|
+
* (`en-US`). A `locale` passed explicitly (a prop, an argument) always wins.
|
|
27
|
+
*
|
|
28
|
+
* Parts read the locale through `useLocale` (`hooks/use-locale`) and pass it down; the pure helpers here
|
|
29
|
+
* and in `format` / `comparison` / `chart-*` take it as an argument and fall back to `documentLocale()`.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/** The language of the built-in wording: Japanese or English. */
|
|
33
|
+
type UiLanguage = "ja" | "en"
|
|
34
|
+
|
|
35
|
+
/** The locale used when `<html lang>` gives none (and on the server). */
|
|
36
|
+
const FALLBACK_LOCALE = "en-US"
|
|
37
|
+
|
|
38
|
+
/** `"ja"` when `locale` starts with `ja` (`ja`, `ja-JP`), else `"en"`. A missing locale is `"en"`. */
|
|
39
|
+
function uiLanguage(locale: string | null | undefined): UiLanguage {
|
|
40
|
+
return typeof locale === "string" && locale.trim().toLowerCase().startsWith("ja") ? "ja" : "en"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** A BCP 47 tag in its canonical form (`en-gb` → `en-GB`), or `FALLBACK_LOCALE` when it is empty or invalid. */
|
|
44
|
+
function normalizeLocale(tag: string | null | undefined): string {
|
|
45
|
+
const value = tag?.trim()
|
|
46
|
+
if (!value) return FALLBACK_LOCALE
|
|
47
|
+
try {
|
|
48
|
+
return Intl.getCanonicalLocales(value)[0] ?? FALLBACK_LOCALE
|
|
49
|
+
} catch {
|
|
50
|
+
return FALLBACK_LOCALE
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The locale of the page: `document.documentElement.lang`, canonicalized. `FALLBACK_LOCALE` when it is empty or
|
|
56
|
+
* invalid, or there is no `document`. Parts read it through `useLocale`, never while rendering.
|
|
57
|
+
*/
|
|
58
|
+
function documentLocale(): string {
|
|
59
|
+
if (typeof document === "undefined") return FALLBACK_LOCALE
|
|
60
|
+
return normalizeLocale(document.documentElement?.getAttribute("lang"))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** `locale` when given, else the page's locale (`documentLocale()`). */
|
|
64
|
+
function resolveLocale(locale?: string | null): string {
|
|
65
|
+
return locale || documentLocale()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Picks the wording table of the locale's language. */
|
|
69
|
+
function pickLocale<T>(table: { ja: T; en: T }, locale?: string | null): T {
|
|
70
|
+
return table[uiLanguage(resolveLocale(locale))]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** The currency `format="currency"` uses without a `currency`: JPY for Japanese, USD otherwise. */
|
|
74
|
+
function defaultCurrency(locale?: string | null): string {
|
|
75
|
+
return uiLanguage(resolveLocale(locale)) === "ja" ? "JPY" : "USD"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** The month a fiscal year starts in (1–12) when none is given: April for Japanese, January otherwise. */
|
|
79
|
+
function defaultFiscalYearStartMonth(locale?: string | null): number {
|
|
80
|
+
return uiLanguage(resolveLocale(locale)) === "ja" ? 4 : 1
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** A day of the week, 0 = Sunday … 6 = Saturday (the `Date#getDay` / date-fns numbering). */
|
|
84
|
+
type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6
|
|
85
|
+
|
|
86
|
+
/** Locales whose week starts on Sunday when the runtime has no week data. */
|
|
87
|
+
const SUNDAY_FIRST = new Set(["en", "en-US", "en-CA"])
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The first day of the week: Monday for Japanese; otherwise the locale's convention from `Intl.Locale`
|
|
91
|
+
* (`en-US` Sunday, `en-GB` Monday). Without week data in the runtime: Sunday for `en` / `en-US` / `en-CA`,
|
|
92
|
+
* Monday for the rest.
|
|
93
|
+
*/
|
|
94
|
+
function weekStartsOn(locale?: string | null): WeekDay {
|
|
95
|
+
const tag = normalizeLocale(resolveLocale(locale))
|
|
96
|
+
if (uiLanguage(tag) === "ja") return 1
|
|
97
|
+
try {
|
|
98
|
+
const info = new Intl.Locale(tag) as Intl.Locale & {
|
|
99
|
+
getWeekInfo?: () => { firstDay: number }
|
|
100
|
+
weekInfo?: { firstDay: number }
|
|
101
|
+
}
|
|
102
|
+
const firstDay = info.getWeekInfo?.().firstDay ?? info.weekInfo?.firstDay
|
|
103
|
+
if (typeof firstDay === "number" && firstDay >= 1 && firstDay <= 7) return (firstDay % 7) as WeekDay
|
|
104
|
+
} catch {
|
|
105
|
+
// Fall through to the table below.
|
|
106
|
+
}
|
|
107
|
+
return SUNDAY_FIRST.has(tag) ? 0 : 1
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* ---------- inlined from @squadbase/squadkit registry/hooks/use-locale.ts (internal to @squadbase/vantage) ---------- */
|
|
111
|
+
|
|
112
|
+
const listeners = new Set<() => void>()
|
|
113
|
+
let observer: MutationObserver | null = null
|
|
114
|
+
|
|
115
|
+
/** One observer on `<html lang>` for every subscribed part. */
|
|
116
|
+
function subscribe(onChange: () => void): () => void {
|
|
117
|
+
if (typeof document === "undefined" || typeof MutationObserver === "undefined") return () => {}
|
|
118
|
+
listeners.add(onChange)
|
|
119
|
+
if (!observer) {
|
|
120
|
+
observer = new MutationObserver(() => {
|
|
121
|
+
for (const listener of [...listeners]) listener()
|
|
122
|
+
})
|
|
123
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["lang"] })
|
|
124
|
+
}
|
|
125
|
+
return () => {
|
|
126
|
+
listeners.delete(onChange)
|
|
127
|
+
if (listeners.size === 0 && observer) {
|
|
128
|
+
observer.disconnect()
|
|
129
|
+
observer = null
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const serverLocale = () => FALLBACK_LOCALE
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The page's locale (`<html lang>`), following changes made while the page runs. On the server and during
|
|
138
|
+
* hydration it is `FALLBACK_LOCALE` (`en-US`), so the markup matches; it switches right after.
|
|
139
|
+
*/
|
|
140
|
+
function useDocumentLocale(): string {
|
|
141
|
+
return useSyncExternalStore(subscribe, documentLocale, serverLocale)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** The locale a part renders in: its `locale` prop when given, else the page's (`useDocumentLocale`). */
|
|
145
|
+
function useLocale(locale?: string | null): string {
|
|
146
|
+
const page = useDocumentLocale()
|
|
147
|
+
return locale || page
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* ---------- end of inlined code ---------- */
|
|
12
151
|
|
|
13
152
|
export interface PageShellProps extends HTMLAttributes<HTMLDivElement> {}
|
|
14
153
|
|
|
@@ -19,7 +158,22 @@ export const PageShell = forwardRef<HTMLDivElement, PageShellProps>(
|
|
|
19
158
|
)
|
|
20
159
|
PageShell.displayName = "PageShell"
|
|
21
160
|
|
|
22
|
-
|
|
161
|
+
const SOURCE_PREFIX = { ja: "出典:", en: "Source: " }
|
|
162
|
+
|
|
163
|
+
export interface PageShellHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
164
|
+
/** When the data was last updated. Drawn by `UpdatedAt` at the right end of the title row. */
|
|
165
|
+
updatedAt?: UpdatedAtProps["at"]
|
|
166
|
+
/** `"relative"` (default) or `"absolute-first"` ("16:41 更新(23 分前)") for pages where "now" matters. */
|
|
167
|
+
updatedAtVariant?: UpdatedAtProps["variant"]
|
|
168
|
+
/** IANA time zone for the absolute time of `updatedAt`. Defaults to the runtime's zone. */
|
|
169
|
+
timeZone?: string
|
|
170
|
+
/** Where the data comes from. Shown as a chip "Source: ○○" (ja: "出典:○○") on the second row. */
|
|
171
|
+
source?: string
|
|
172
|
+
/** The period the data covers. Shown as a chip "2026/9/23〜10/20" on the second row. */
|
|
173
|
+
period?: { start: Date | string | number; end: Date | string | number }
|
|
174
|
+
/** The page's overall state (an alert, a status badge). Shown on the third row; no row when absent. */
|
|
175
|
+
status?: ReactNode
|
|
176
|
+
}
|
|
23
177
|
|
|
24
178
|
/**
|
|
25
179
|
* A wrapping flex row, not a two-column grid: when the heading cannot keep its
|
|
@@ -27,16 +181,54 @@ export interface PageShellHeaderProps extends HTMLAttributes<HTMLDivElement> {}
|
|
|
27
181
|
* `1fr auto` grid would instead hand the heading whatever the end block leaves,
|
|
28
182
|
* and a CJK title — breakable between any two characters — collapses into a
|
|
29
183
|
* one-character column.
|
|
184
|
+
*
|
|
185
|
+
* The meta props (`updatedAt`, `source`, `period`, `status`) fix the order every
|
|
186
|
+
* page head shares: title and update time (right end) → source / period chips →
|
|
187
|
+
* overall status → summary cards. Empty rows are not drawn. Rows are placed with
|
|
188
|
+
* flex `order`, so they land before `PageShellSummary` whatever the child order.
|
|
30
189
|
*/
|
|
31
190
|
export const PageShellHeader = forwardRef<HTMLDivElement, PageShellHeaderProps>(
|
|
32
|
-
({ className, ...props }, ref) =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
191
|
+
({ className, updatedAt, updatedAtVariant, timeZone, source, period, status, children, ...props }, ref) => {
|
|
192
|
+
const locale = useLocale()
|
|
193
|
+
const periodText = period ? formatDateRange(period.start, period.end, { timeZone, locale }) : undefined
|
|
194
|
+
const hasChips = Boolean(source) || (periodText !== undefined && periodText !== EMPTY_VALUE)
|
|
195
|
+
const hasStatus = status !== undefined && status !== null && status !== false && status !== ""
|
|
196
|
+
return (
|
|
197
|
+
<div
|
|
198
|
+
ref={ref}
|
|
199
|
+
data-slot="page-shell-header"
|
|
200
|
+
className={cn("flex flex-wrap items-start gap-x-4 gap-y-4 px-6 pt-8", className)}
|
|
201
|
+
{...props}
|
|
202
|
+
>
|
|
203
|
+
{children}
|
|
204
|
+
{updatedAt !== undefined && updatedAt !== null ? (
|
|
205
|
+
<div data-slot="page-shell-updated-at" className="ml-auto max-w-full shrink-0 text-right">
|
|
206
|
+
<UpdatedAt at={updatedAt} variant={updatedAtVariant} timeZone={timeZone} />
|
|
207
|
+
</div>
|
|
208
|
+
) : null}
|
|
209
|
+
{hasChips ? (
|
|
210
|
+
<div data-slot="page-shell-chips" className="order-1 flex basis-full flex-wrap gap-1.5">
|
|
211
|
+
{source ? (
|
|
212
|
+
<Badge variant="outline" className="h-auto max-w-full whitespace-normal text-muted-foreground">
|
|
213
|
+
{SOURCE_PREFIX[uiLanguage(locale)]}
|
|
214
|
+
{source}
|
|
215
|
+
</Badge>
|
|
216
|
+
) : null}
|
|
217
|
+
{periodText && periodText !== EMPTY_VALUE ? (
|
|
218
|
+
<Badge variant="outline" className="tabular-nums text-muted-foreground">
|
|
219
|
+
{periodText}
|
|
220
|
+
</Badge>
|
|
221
|
+
) : null}
|
|
222
|
+
</div>
|
|
223
|
+
) : null}
|
|
224
|
+
{hasStatus ? (
|
|
225
|
+
<div data-slot="page-shell-status" className="order-2 min-w-0 basis-full">
|
|
226
|
+
{status}
|
|
227
|
+
</div>
|
|
228
|
+
) : null}
|
|
229
|
+
</div>
|
|
230
|
+
)
|
|
231
|
+
},
|
|
40
232
|
)
|
|
41
233
|
PageShellHeader.displayName = "PageShellHeader"
|
|
42
234
|
|
|
@@ -61,7 +253,7 @@ export const PageShellTitle = forwardRef<HTMLHeadingElement, PageShellTitleProps
|
|
|
61
253
|
<h1
|
|
62
254
|
ref={ref}
|
|
63
255
|
data-slot="page-shell-title"
|
|
64
|
-
className={cn("text-2xl font-
|
|
256
|
+
className={cn("text-2xl font-semibold tracking-tight text-foreground", className)}
|
|
65
257
|
{...props}
|
|
66
258
|
/>
|
|
67
259
|
),
|
|
@@ -132,7 +324,7 @@ export const PageShellSummary = forwardRef<HTMLDivElement, PageShellSummaryProps
|
|
|
132
324
|
ref={ref}
|
|
133
325
|
data-slot="page-shell-summary"
|
|
134
326
|
className={cn(
|
|
135
|
-
"grid basis-full grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",
|
|
327
|
+
"order-3 grid basis-full grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",
|
|
136
328
|
className,
|
|
137
329
|
)}
|
|
138
330
|
{...props}
|
|
@@ -142,10 +334,23 @@ export const PageShellSummary = forwardRef<HTMLDivElement, PageShellSummaryProps
|
|
|
142
334
|
PageShellSummary.displayName = "PageShellSummary"
|
|
143
335
|
|
|
144
336
|
/**
|
|
145
|
-
* Accent
|
|
146
|
-
*
|
|
147
|
-
*
|
|
337
|
+
* Accent tints come from theme tokens, never Tailwind palette colours: the
|
|
338
|
+
* semantic tones (`--positive` / `--negative` / `--warning` / `--info` /
|
|
339
|
+
* `--neutral` and their `*-subtle`) and, for hues with no status meaning,
|
|
340
|
+
* `--chart-4` / `--chart-5`. The colour-named accents are kept for compatibility
|
|
341
|
+
* and map to the nearest tone. Each set is a literal string — Tailwind only
|
|
342
|
+
* emits classes it can see literally in the source.
|
|
148
343
|
*/
|
|
344
|
+
const summaryCardTones = {
|
|
345
|
+
positive: "border-positive/20 dark:border-positive/25 bg-positive-subtle [&>svg]:text-positive",
|
|
346
|
+
negative: "border-negative/20 dark:border-negative/25 bg-negative-subtle [&>svg]:text-negative",
|
|
347
|
+
warning: "border-warning/20 dark:border-warning/25 bg-warning-subtle [&>svg]:text-warning",
|
|
348
|
+
info: "border-info/20 dark:border-info/25 bg-info-subtle [&>svg]:text-info",
|
|
349
|
+
neutral: "border-neutral/20 dark:border-neutral/25 bg-neutral-subtle [&>svg]:text-neutral",
|
|
350
|
+
violet: "border-chart-4/30 bg-chart-4/5 [&>svg]:text-chart-4",
|
|
351
|
+
pink: "border-chart-5/30 bg-chart-5/5 [&>svg]:text-chart-5",
|
|
352
|
+
} as const
|
|
353
|
+
|
|
149
354
|
export const pageShellSummaryCardVariants = cva(
|
|
150
355
|
"relative flex items-start gap-3 rounded-lg border bg-background px-4 py-3 text-sm [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
151
356
|
{
|
|
@@ -154,40 +359,28 @@ export const pageShellSummaryCardVariants = cva(
|
|
|
154
359
|
default: "text-card-foreground",
|
|
155
360
|
accent:
|
|
156
361
|
"border-[var(--chart-1)]/30 bg-linear-to-r from-[var(--chart-1)]/5 to-[var(--chart-1)]/5 [&>svg]:text-[var(--chart-1)]",
|
|
157
|
-
amber:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
rose: "border-rose-300 bg-rose-50 [&>svg]:text-rose-600 dark:border-rose-800 dark:bg-rose-950/50 dark:[&>svg]:text-rose-400",
|
|
180
|
-
yellow:
|
|
181
|
-
"border-yellow-300 bg-yellow-50 [&>svg]:text-yellow-600 dark:border-yellow-800 dark:bg-yellow-950/50 dark:[&>svg]:text-yellow-400",
|
|
182
|
-
lime: "border-lime-300 bg-lime-50 [&>svg]:text-lime-600 dark:border-lime-800 dark:bg-lime-950/50 dark:[&>svg]:text-lime-400",
|
|
183
|
-
gray: "border-gray-300 bg-gray-50 [&>svg]:text-gray-600 dark:border-gray-800 dark:bg-gray-950/50 dark:[&>svg]:text-gray-400",
|
|
184
|
-
zinc: "border-zinc-300 bg-zinc-50 [&>svg]:text-zinc-600 dark:border-zinc-800 dark:bg-zinc-950/50 dark:[&>svg]:text-zinc-400",
|
|
185
|
-
neutral:
|
|
186
|
-
"border-neutral-300 bg-neutral-50 [&>svg]:text-neutral-600 dark:border-neutral-800 dark:bg-neutral-950/50 dark:[&>svg]:text-neutral-400",
|
|
187
|
-
stone:
|
|
188
|
-
"border-stone-300 bg-stone-50 [&>svg]:text-stone-600 dark:border-stone-800 dark:bg-stone-950/50 dark:[&>svg]:text-stone-400",
|
|
189
|
-
fuchsia:
|
|
190
|
-
"border-fuchsia-300 bg-fuchsia-50 [&>svg]:text-fuchsia-600 dark:border-fuchsia-800 dark:bg-fuchsia-950/50 dark:[&>svg]:text-fuchsia-400",
|
|
362
|
+
amber: summaryCardTones.warning,
|
|
363
|
+
blue: summaryCardTones.info,
|
|
364
|
+
emerald: summaryCardTones.positive,
|
|
365
|
+
red: summaryCardTones.negative,
|
|
366
|
+
violet: summaryCardTones.violet,
|
|
367
|
+
orange: summaryCardTones.warning,
|
|
368
|
+
cyan: summaryCardTones.info,
|
|
369
|
+
slate: summaryCardTones.neutral,
|
|
370
|
+
green: summaryCardTones.positive,
|
|
371
|
+
teal: summaryCardTones.positive,
|
|
372
|
+
sky: summaryCardTones.info,
|
|
373
|
+
indigo: summaryCardTones.info,
|
|
374
|
+
purple: summaryCardTones.violet,
|
|
375
|
+
pink: summaryCardTones.pink,
|
|
376
|
+
rose: summaryCardTones.negative,
|
|
377
|
+
yellow: summaryCardTones.warning,
|
|
378
|
+
lime: summaryCardTones.positive,
|
|
379
|
+
gray: summaryCardTones.neutral,
|
|
380
|
+
zinc: summaryCardTones.neutral,
|
|
381
|
+
neutral: summaryCardTones.neutral,
|
|
382
|
+
stone: summaryCardTones.neutral,
|
|
383
|
+
fuchsia: summaryCardTones.violet,
|
|
191
384
|
},
|
|
192
385
|
},
|
|
193
386
|
defaultVariants: {
|
|
@@ -219,7 +412,7 @@ export const PageShellContent = forwardRef<HTMLDivElement, PageShellContentProps
|
|
|
219
412
|
<div
|
|
220
413
|
ref={ref}
|
|
221
414
|
data-slot="page-shell-content"
|
|
222
|
-
className={cn("flex-1 p-6", className)}
|
|
415
|
+
className={cn("flex min-w-0 flex-1 flex-col gap-6 p-6", className)}
|
|
223
416
|
{...props}
|
|
224
417
|
/>
|
|
225
418
|
),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Copied by `vantage add ui pagination`. This file is yours to edit.
|
|
2
|
-
// Generated from @squadbase/
|
|
2
|
+
// Generated from @squadbase/squadkit registry/ui/pagination.tsx by `pnpm run registry` (in Vantage, edit packages/squadkit, not registry/).
|
|
3
|
+
"use client"
|
|
4
|
+
|
|
3
5
|
import * as React from "react"
|
|
4
6
|
import { cn } from "@squadbase/vantage/ui"
|
|
5
7
|
|