import type * as React from "react"; import { Building2, UserPlus } from "lucide-react"; import { CompactBarTrend } from "@godxjp/ui/charts/compact-bar-trend"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, StatCard, } from "@godxjp/ui/data-display"; import { Text } from "@godxjp/ui/general"; import { Flex, PageContainer, ResponsiveGrid } from "@godxjp/ui/layout"; /** * CompactBarTrend — the DEPENDENCY-FREE compact bar trend. * * `BarChart` needs the `recharts` optional peer, so a platform whose policy forbids screen * implementers from adding dependencies cannot use it. The marks here are token-sized CSS * blocks instead, so a dashboard gets a real framework chart with zero consumer CSS, zero * inline height math and zero hardcoded colour. * * Everything below is composed from real @godxjp/ui primitives only. */ /** Seven days of new organizations — the canonical SCR-201 dataset. */ const newOrganizations = [ { date: "7/24", count: 4 }, { date: "7/25", count: 7 }, { date: "7/26", count: 2 }, { date: "7/27", count: 9 }, { date: "7/28", count: 5 }, { date: "7/29", count: 12 }, { date: "7/30", count: 8 }, ]; /** N is not fixed at seven — a fortnight reads at the same density. */ const fortnight = [ { date: "7/17", users: 120 }, { date: "7/18", users: 168 }, { date: "7/19", users: 96 }, { date: "7/20", users: 74 }, { date: "7/21", users: 210 }, { date: "7/22", users: 188 }, { date: "7/23", users: 152 }, { date: "7/24", users: 240 }, { date: "7/25", users: 196 }, { date: "7/26", users: 88 }, { date: "7/27", users: 132 }, { date: "7/28", users: 174 }, { date: "7/29", users: 262 }, { date: "7/30", users: 208 }, ]; /** Three points, zeros and a negative — the edge-data frame. */ const edgeData = [ { period: "第1四半期", revenue: 0 }, { period: "非常に長い期間ラベルの例", revenue: 4200000 }, { period: "第3四半期", revenue: -180000 }, ]; const jpy = { style: "currency", currency: "JPY", notation: "compact" } as const; export default function Demo() { return ( {/* ── 1. The canonical SCR-201 dashboard summary row ─────────────────────── */} 新規組織(7日間) 日別に作成された組織数。当日を強調表示。 アクティビティフッター footer スロットはプロットの外側(role=img の外)に描画されるため、リンクも操作可能。 最終更新 2026-07-30 09:00 JST } /> 空状態 data が空のとき EmptyState を描画します。 {/* ── 2. size — the xs|sm|md|lg plot-height tiers ────────────────────────── */} size · 高さティア xs(ダッシュボード要約カードの既定)· sm · md · lg。高さは --chart-trend-plot-height-* が所有し、px を書くことはありません。 {(["xs", "sm", "md", "lg"] as const).map((size) => ( ))} {/* ── 3. emphasizedIndex + showCategoryLabels + numberFormat ─────────────── */} emphasizedIndex 未指定=強調なし · 正の index · 負の index(-1 は最新)。強調は色だけに頼らず、 代替テキストの該当行にも注記されます(WCAG 1.4.1)。 showCategoryLabels · numberFormat ラベルを消してもデータは代替テキストに残ります。値の書式は Intl.NumberFormat (ロケール自動)。 {/* ── 4. Responsive — 1440 / 1024 / 390 container widths ─────────────────── */} レスポンシブ · 1440 / 1024 / 390 棒は flex 1 1 0 で幅を分け合うため、同じマークアップがどのコンテナ幅にも収まります。 長い目盛りラベルはカードを広げずに省略されます。 {[1440, 1024, 390].map((width) => ( {`コンテナ幅 ${width}px`} 直近のアクティビティを見る } /> ))} {/* ── 5. Token theming (cardinal rules #44/#45) ──────────────────────────── */} トークンでのテーマ適用 サービス側の theme.css が --chart-trend-* を一度上書きするだけで密度も配色も変わります。 ページ固有の CSS は不要です。ベースラインは既定で「静か」(#44)、opt-in で表示します。 ); }