import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle, Legend, Progress, } from "@godxjp/ui/data-display"; import { Text } from "@godxjp/ui/general"; import { Flex, PageContainer } from "@godxjp/ui/layout"; const COMPLIANCE = [ { name: "株式会社山田製作所", over: 2, near: 3, done: 12 }, { name: "佐藤食品株式会社", over: 1, near: 2, done: 9 }, { name: "東海精密工業株式会社", over: 0, near: 3, done: 21 }, ]; const STATUS_KEYS = [ { tone: "destructive", label: "期限超過" }, { tone: "warning", label: "期限間近" }, { tone: "success", label: "対応済" }, ] as const; /** * Legend — the KEY for a colour-coded surface: which tone means what, in words, once. * Composed only from real @godxjp/ui components. */ export default function Demo() { return ( Progress の breakdown と組む CardAction に置くと、カード見出しと同じ行に凡例が並びます。色の意味をカードで 一度だけ言い、各行では繰り返しません。 {COMPLIANCE.map((row) => ( {row.name} {/* A COLUMN OF NUMBERS NEEDS COLUMNS, not a row of shrink-to-fit boxes. `tabular` makes DIGITS equal-width inside one Text; it cannot align two Texts with different digit COUNTS. Laid out as a flex row and right-aligned as a group, a row ending in "9" sat 8px right of one ending in "21" — measured on the published site, and the reason this readout looked crooked. Fixed tracks give each value its own cell, so every row lines up whatever the digits. */}
{row.over} {row.near} {row.done} 計 {row.over + row.near + row.done}
))}
Tones vocabulary の 7 tone すべてに塗りがあります。色だけで意味を運ばないため label は必須です(WCAG 1.4.1)。 Named legend aria-label を渡すと、その凡例が「何のキーか」を読み上げます。項目は list / listitem として並びます。 Wrapping 狭い幅では折り返します(横スクロールしません)。凡例が視界の外に出ると、色の意味 そのものが失われるためです。
); }