@squadbase/vantage 0.6.2-dev1.ac99e02 → 0.6.2-dev1.d7c0911
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-MFWRPYKW.js → build-X5NVCQKT.js} +4 -4
- package/dist/{build-MFWRPYKW.js.map → build-X5NVCQKT.js.map} +1 -1
- package/dist/{chunk-IBGOCWJB.js → chunk-2ICNHUG6.js} +186 -82
- package/dist/chunk-2ICNHUG6.js.map +1 -0
- package/dist/{chunk-5ZOP4SQR.js → chunk-2N72FKLB.js} +12 -7
- package/dist/chunk-2N72FKLB.js.map +1 -0
- package/dist/{chunk-PXRX5PEC.js → chunk-PDOBHMUQ.js} +3 -3
- package/dist/chunk-PDOBHMUQ.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-QEWCYW3I.js → chunk-WAMZWZJB.js} +13 -3
- package/dist/chunk-WAMZWZJB.js.map +1 -0
- package/dist/chunk-WRSX2MDK.js +7866 -0
- package/dist/chunk-WRSX2MDK.js.map +1 -0
- package/dist/{chunk-OB6UBJXF.js → chunk-XPQSTZUU.js} +125 -35
- package/dist/chunk-XPQSTZUU.js.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/components/index.d.ts +1831 -99
- package/dist/components/index.js +4 -4
- package/dist/{dev-DCTOHQ6W.js → dev-4XEDTELV.js} +4 -4
- package/dist/{dev-DCTOHQ6W.js.map → dev-4XEDTELV.js.map} +1 -1
- package/dist/doc/index.js +2 -2
- package/dist/doc/index.js.map +1 -1
- package/dist/markdown/index.js +1 -1
- package/dist/markdown/index.js.map +1 -1
- package/dist/table/index.js +5 -5
- package/dist/table/index.js.map +1 -1
- package/dist/ui/index.d.ts +4 -1
- package/dist/ui/index.js +21 -111
- package/dist/ui/index.js.map +1 -1
- package/dist/{upgrade-DBBE6GIR.js → upgrade-JHXZBGQS.js} +3 -3
- package/dist/{upgrade-DBBE6GIR.js.map → upgrade-JHXZBGQS.js.map} +1 -1
- package/dist/vite/index.js +2 -2
- package/docs/en/components.md +29 -15
- package/docs/en/parts/data-table.md +22 -0
- package/docs/en/parts/delta.md +50 -0
- package/docs/en/parts/format.md +43 -0
- package/docs/en/parts/kpi-card.md +57 -0
- package/docs/en/parts/metric-value.md +3 -2
- package/docs/en/parts/sparkline.md +1 -1
- package/docs/en/parts/trend-indicator.md +17 -1
- package/docs/en/ui-and-theming.md +1 -1
- package/docs/index.json +92 -32
- package/docs/ja/changelog.md +5 -0
- package/docs/ja/components.md +27 -15
- package/docs/ja/parts/data-table.md +22 -0
- package/docs/ja/parts/delta.md +50 -0
- package/docs/ja/parts/format.md +44 -0
- package/docs/ja/parts/kpi-card.md +55 -0
- package/docs/ja/parts/metric-value.md +3 -2
- package/docs/ja/parts/sparkline.md +1 -1
- package/docs/ja/parts/trend-indicator.md +17 -1
- package/docs/ja/ui-and-theming.md +2 -2
- package/package.json +2 -1
- 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 +7 -1
- package/registry/ui/area-chart.tsx +2781 -157
- package/registry/ui/avatar.tsx +1 -1
- package/registry/ui/badge.tsx +3 -1
- package/registry/ui/bar-chart.tsx +2780 -157
- package/registry/ui/bar-list.tsx +3471 -93
- 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 +990 -16
- package/registry/ui/chart-frame.tsx +1358 -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 +69 -26
- package/registry/ui/data-table.tsx +678 -56
- package/registry/ui/date-range-picker.tsx +245 -64
- package/registry/ui/delta.tsx +188 -0
- package/registry/ui/dialog.tsx +5 -3
- package/registry/ui/donut-chart.tsx +2857 -173
- package/registry/ui/drawer.tsx +1 -1
- package/registry/ui/dropdown-menu.tsx +5 -3
- package/registry/ui/echart.tsx +448 -44
- package/registry/ui/field.tsx +1 -1
- package/registry/ui/filter-bar.tsx +33 -6
- package/registry/ui/funnel-steps.tsx +3316 -49
- package/registry/ui/heatmap.tsx +1752 -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 +677 -0
- package/registry/ui/label.tsx +3 -1
- package/registry/ui/legend.tsx +3500 -0
- package/registry/ui/line-chart.tsx +2781 -151
- package/registry/ui/metric-value.tsx +9 -1
- package/registry/ui/multi-select.tsx +11 -5
- package/registry/ui/page-shell.tsx +104 -49
- package/registry/ui/pagination.tsx +3 -1
- package/registry/ui/placeholder.tsx +8 -2
- package/registry/ui/popover.tsx +4 -2
- package/registry/ui/progress-circle.tsx +607 -12
- package/registry/ui/progress.tsx +3 -1
- package/registry/ui/radio-group.tsx +1 -1
- package/registry/ui/sample-data.tsx +86 -0
- package/registry/ui/scatter-chart.tsx +4150 -0
- package/registry/ui/scroll-area.tsx +3 -2
- package/registry/ui/searchable-select.tsx +8 -3
- package/registry/ui/section-header.tsx +4 -2
- 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 +3 -1
- package/registry/ui/sparkline.tsx +84 -9
- package/registry/ui/spinner.tsx +3 -1
- package/registry/ui/states.tsx +34 -5
- package/registry/ui/status-badge.tsx +81 -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 +4 -2
- package/registry/ui/tracker.tsx +624 -17
- package/registry/ui/trend-indicator.tsx +13 -1
- package/registry/ui/updated-at.tsx +122 -0
- package/registry/ui/waterfall-chart.tsx +4186 -0
- package/templates/AGENTS.md +13 -1
- package/theme.css +237 -136
- package/dist/chunk-5ZOP4SQR.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-IBGOCWJB.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
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// Copied by `vantage add ui trend-indicator`. This file is yours to edit.
|
|
2
|
-
// Generated from @squadbase/
|
|
2
|
+
// Generated from @squadbase/squadkit registry/components/trend-indicator.tsx by `npm run registry` (in Vantage, edit packages/squadkit, not registry/).
|
|
3
|
+
"use client"
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* TrendIndicator — an arrow plus percentage change. Colour tracks *sentiment*,
|
|
5
7
|
* not direction: set `positiveIsGood={false}` for metrics where going up is bad
|
|
6
8
|
* (churn, error rate) and a rise renders as negative.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated 新規は Delta を使う。value/direction を別々に受けるため食い違える(C4)。
|
|
7
11
|
*/
|
|
8
12
|
import { forwardRef } from "react"
|
|
9
13
|
import { ArrowDown, ArrowUp, Minus } from "lucide-react"
|
|
@@ -25,6 +29,9 @@ const trendIndicatorVariants = cva("inline-flex items-center gap-0.5 text-sm fon
|
|
|
25
29
|
},
|
|
26
30
|
})
|
|
27
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated 新規は Delta を使う。value/direction を別々に受けるため食い違える(C4)。
|
|
34
|
+
*/
|
|
28
35
|
export interface TrendIndicatorProps {
|
|
29
36
|
value: number
|
|
30
37
|
direction: TrendDirection
|
|
@@ -32,6 +39,11 @@ export interface TrendIndicatorProps {
|
|
|
32
39
|
className?: string
|
|
33
40
|
}
|
|
34
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Arrow plus percentage change.
|
|
44
|
+
*
|
|
45
|
+
* @deprecated 新規は Delta を使う。value/direction を別々に受けるため食い違える(C4)。
|
|
46
|
+
*/
|
|
35
47
|
export const TrendIndicator = forwardRef<HTMLSpanElement, TrendIndicatorProps>(
|
|
36
48
|
({ value, direction, positiveIsGood = true, className }, ref) => {
|
|
37
49
|
const isGood = direction === "neutral" ? null : (direction === "up") === positiveIsGood
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Copied by `vantage add ui updated-at`. This file is yours to edit.
|
|
2
|
+
// Generated from @squadbase/squadkit registry/components/updated-at.tsx by `npm run registry` (in Vantage, edit packages/squadkit, not registry/).
|
|
3
|
+
"use client"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* UpdatedAt — freshness label. Renders a `<time>` whose `dateTime` is the ISO
|
|
7
|
+
* instant, with the absolute time and zone ("2026/10/20 16:41 JST") in both a
|
|
8
|
+
* tooltip and the `title` attribute.
|
|
9
|
+
*
|
|
10
|
+
* `variant="relative"` (default) reads "23 分前に更新"; `"absolute-first"` reads
|
|
11
|
+
* "16:41 更新(23 分前)" (the date is added when it is not today).
|
|
12
|
+
*
|
|
13
|
+
* Hydration-safe: the first render (server and client) is an empty `<time>`
|
|
14
|
+
* carrying only the ISO `dateTime`, because the text depends on the clock and
|
|
15
|
+
* time zone of whoever renders. After mount it shows the label and refreshes
|
|
16
|
+
* every 60 seconds; the interval is cleared on unmount. `now` pins the clock
|
|
17
|
+
* (tests, fixtures) and skips the timer; `timeZone` pins the zone. The `<time>`
|
|
18
|
+
* sets `suppressHydrationWarning` so sample data built from `Date.now()` at
|
|
19
|
+
* module load (which differs between server and client) does not warn.
|
|
20
|
+
*/
|
|
21
|
+
import { forwardRef, useEffect, useState } from "react"
|
|
22
|
+
|
|
23
|
+
import { EMPTY_VALUE, formatDate } from "@squadbase/vantage/components"
|
|
24
|
+
import { formatRelativeTime } from "@squadbase/vantage/components"
|
|
25
|
+
import { cn } from "@squadbase/vantage/ui"
|
|
26
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "@squadbase/vantage/ui"
|
|
27
|
+
|
|
28
|
+
const REFRESH_MS = 60_000
|
|
29
|
+
|
|
30
|
+
export interface UpdatedAtProps {
|
|
31
|
+
/** When the data was last updated. */
|
|
32
|
+
at: Date | string | number
|
|
33
|
+
/** `"relative"` (default): "23 分前に更新". `"absolute-first"`: "16:41 更新(23 分前)" — for pages where "now" matters. */
|
|
34
|
+
variant?: "relative" | "absolute-first"
|
|
35
|
+
/** IANA time zone (e.g. `"Asia/Tokyo"`) for the absolute time. Defaults to the runtime's zone. */
|
|
36
|
+
timeZone?: string
|
|
37
|
+
/** Text placed before the label, e.g. `"売上データ: "`. */
|
|
38
|
+
prefix?: string
|
|
39
|
+
/** Fixed "current time" for tests and fixtures. Disables the 60 s refresh. */
|
|
40
|
+
now?: Date | number
|
|
41
|
+
className?: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const toMs = (value: Date | string | number) =>
|
|
45
|
+
value instanceof Date ? value.getTime() : new Date(value).getTime()
|
|
46
|
+
|
|
47
|
+
function relative(at: number, now: number): string {
|
|
48
|
+
if (now - at < REFRESH_MS && now - at > -REFRESH_MS) return "たった今"
|
|
49
|
+
return formatRelativeTime(at, { now })
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** "2026/10/20 16:41 JST" */
|
|
53
|
+
function absolute(at: number, timeZone?: string): string | undefined {
|
|
54
|
+
if (!Number.isFinite(at)) return undefined
|
|
55
|
+
const zone = new Intl.DateTimeFormat("ja-JP", { timeZone, timeZoneName: "short" })
|
|
56
|
+
.formatToParts(at)
|
|
57
|
+
.find((part) => part.type === "timeZoneName")?.value
|
|
58
|
+
const text = formatDate(at, "datetime", "ja-JP", { timeZone })
|
|
59
|
+
return zone ? `${text} ${zone}` : text
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function label(at: number, now: number, variant: "relative" | "absolute-first", timeZone?: string): string {
|
|
63
|
+
if (!Number.isFinite(at) || !Number.isFinite(now)) return EMPTY_VALUE
|
|
64
|
+
if (variant === "relative") {
|
|
65
|
+
return now - at < REFRESH_MS && now - at > -REFRESH_MS ? "たった今" : `${relative(at, now)}に更新`
|
|
66
|
+
}
|
|
67
|
+
const today = formatDate(at, "date", "ja-JP", { timeZone }) === formatDate(now, "date", "ja-JP", { timeZone })
|
|
68
|
+
const when = formatDate(at, "datetime", "ja-JP", { timeZone })
|
|
69
|
+
// "2026/10/20 16:41" -> time only when it is today.
|
|
70
|
+
const shown = today ? when.slice(-5) : when
|
|
71
|
+
return `${shown} 更新(${relative(at, now)})`
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const UpdatedAt = forwardRef<HTMLTimeElement, UpdatedAtProps>(
|
|
75
|
+
({ at, variant = "relative", timeZone, prefix, now, className }, ref) => {
|
|
76
|
+
const atMs = toMs(at)
|
|
77
|
+
const [current, setCurrent] = useState<number | null>(null)
|
|
78
|
+
const fixed = now === undefined ? undefined : toMs(now as Date | number)
|
|
79
|
+
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (fixed !== undefined) return
|
|
82
|
+
setCurrent(Date.now())
|
|
83
|
+
const id = setInterval(() => setCurrent(Date.now()), REFRESH_MS)
|
|
84
|
+
return () => clearInterval(id)
|
|
85
|
+
}, [fixed])
|
|
86
|
+
|
|
87
|
+
const clock = fixed ?? current
|
|
88
|
+
const ready = clock !== null
|
|
89
|
+
const dateTime = Number.isFinite(atMs) ? new Date(atMs).toISOString() : undefined
|
|
90
|
+
const full = ready ? absolute(atMs, timeZone) : undefined
|
|
91
|
+
const classes = cn("text-sm text-muted-foreground tabular-nums", className)
|
|
92
|
+
const text = ready ? `${prefix ?? ""}${label(atMs, clock, variant, timeZone)}` : null
|
|
93
|
+
|
|
94
|
+
if (!full) {
|
|
95
|
+
return (
|
|
96
|
+
<time ref={ref} data-slot="updated-at" dateTime={dateTime} className={classes} suppressHydrationWarning>
|
|
97
|
+
{text}
|
|
98
|
+
</time>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
return (
|
|
102
|
+
<Tooltip>
|
|
103
|
+
<TooltipTrigger
|
|
104
|
+
render={
|
|
105
|
+
<time
|
|
106
|
+
ref={ref}
|
|
107
|
+
data-slot="updated-at"
|
|
108
|
+
dateTime={dateTime}
|
|
109
|
+
title={full}
|
|
110
|
+
className={classes}
|
|
111
|
+
suppressHydrationWarning
|
|
112
|
+
/>
|
|
113
|
+
}
|
|
114
|
+
>
|
|
115
|
+
{text}
|
|
116
|
+
</TooltipTrigger>
|
|
117
|
+
<TooltipContent className="tabular-nums">{full}</TooltipContent>
|
|
118
|
+
</Tooltip>
|
|
119
|
+
)
|
|
120
|
+
},
|
|
121
|
+
)
|
|
122
|
+
UpdatedAt.displayName = "UpdatedAt"
|