Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
412 changes: 209 additions & 203 deletions packages/ui-kit/dist/index.cjs

Large diffs are not rendered by default.

412 changes: 209 additions & 203 deletions packages/ui-kit/dist/index.js

Large diffs are not rendered by default.

36 changes: 34 additions & 2 deletions packages/ui-kit/eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,31 @@ const SSR_SAFETY_RULES = [
// it. Any PR that brings a directory to 0 warnings MUST add it here in the
// same PR (see apps/ui/CONTRIBUTING.md); removing an entry requires an issue
// explaining why. Initial set (2026-07-24 audit): src/hooks/** and src/lib/**
// were the only ui-kit directories clean end-to-end -- src/components/** is
// not (19 of 109 files still warn) and stays un-ratcheted.
// were the only ui-kit directories clean end-to-end -- src/components/** was
// not (19 of 109 files warned). #8172 cleaned 16 of those 19; the remaining
// 3 files (see RATCHETED_COMPONENT_EXCEPTIONS below) each keep one genuinely
// missing token, so src/components/** ratchets everywhere except them rather
// than staying un-ratcheted repo-wide over 3 residual sites.
const RATCHETED_DIRS = ["src/hooks/**/*.{ts,tsx}", "src/lib/**/*.{ts,tsx}"];

// Excluded from the src/components/** ratchet below -- each still carries one
// no-restricted-syntax warning with no existing design-system-token
// equivalent (not invented ad hoc per #8172's own guidance):
// - entity-hero.tsx / page-hero.tsx: the "display"-size hero <h1> and its
// KPI-strip value use text-[2.5rem]/text-[1.75rem] -- the mg-type-* scale
// tops out at mg-type-caption-lg (13px, see styles.css); no hero/display
// heading tier is authored yet (--mg-type-h1..h4 are reserved CSS
// variables, not yet exposed as .mg-type-h* utility classes).
// - section-anchor.tsx: `scroll-mt-32` compensates for the sticky header's
// pixel height on anchor scroll, not a spacing-scale choice -- the exact
// same site class #7810 already left unconverted elsewhere (see that
// commit's own "endpoint-detail-drawer.tsx ... scroll-mt-32" note).
const RATCHETED_COMPONENT_EXCEPTIONS = [
"src/components/metagraphed/entity-hero.tsx",
"src/components/metagraphed/page-hero.tsx",
"src/components/metagraphed/section-anchor.tsx",
];

const PRIMITIVE_FILES = [
"src/components/metagraphed/panel.tsx",
"src/components/metagraphed/panel-header.tsx",
Expand Down Expand Up @@ -248,6 +269,17 @@ export default tseslint.config(
"no-restricted-syntax": ["error", ...DESIGN_RULES, ...SSR_SAFETY_RULES],
},
},
{
// #8172: src/components/** joins the ratchet -- every file is clean
// except the 3 in RATCHETED_COMPONENT_EXCEPTIONS (documented above),
// which `ignores` keeps at the warn tier from the block above instead
// of failing CI on their one pre-existing, genuinely-missing-token site.
files: ["src/components/**/*.{ts,tsx}"],
ignores: RATCHETED_COMPONENT_EXCEPTIONS,
rules: {
"no-restricted-syntax": ["error", ...DESIGN_RULES, ...SSR_SAFETY_RULES],
},
},
{
files: PRIMITIVE_FILES,
rules: { "no-restricted-syntax": "off" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function AccentBand({
) : null}
<div
className={classNames(
"relative max-w-shell-max mx-auto px-4 md:px-8 py-14 md:py-20",
"relative max-w-shell-max mx-auto px-4 md:px-8 py-12 md:py-20",
innerClassName,
)}
>
Expand Down
14 changes: 7 additions & 7 deletions packages/ui-kit/src/components/metagraphed/action-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactNode } from "react";
import { classNames } from "@/lib/format";
import { Panel } from "./panel";

/**
* Segmented container for one-shot page actions (share, download, reset
Expand All @@ -17,13 +17,13 @@ export function ActionBar({
className?: string;
}) {
return (
<div
className={classNames(
"inline-flex items-center gap-0.5 rounded-md border border-border bg-card p-0.5",
className,
)}
<Panel
as="div"
flush
className={className}
bodyClassName="inline-flex items-center gap-0.5 p-0.5"
>
{children}
</div>
</Panel>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function SparkLegend({
sideOffset={6}
collisionPadding={8}
avoidCollisions
className="max-w-xs text-[11px] leading-relaxed"
className="max-w-xs mg-type-caption"
>
<div className="mg-type-micro mb-1">
{metric}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,18 @@ export function StatWithSpark({
</div>
{viz ? <div className="mt-0.5 min-h-[18px]">{viz}</div> : null}
{hint ? (
<div className="font-mono text-[9.5px] text-ink-muted/80 truncate">
<div className="mg-type-data-sm text-ink-muted/80 truncate">
{hint}
</div>
) : null}
{freshLine ? (
<div className="font-mono text-[9px] tracking-wide text-ink-muted/70 truncate">
<div className="mg-type-data-sm tracking-wide text-ink-muted/70 truncate">
{freshLine}
</div>
) : null}
</div>
</TooltipTrigger>
<TooltipContent
side="bottom"
className="max-w-xs text-[11px] leading-relaxed"
>
<TooltipContent side="bottom" className="max-w-xs mg-type-caption">
<div>{full ?? hint ?? label}</div>
{freshAbs || windowLabel ? (
<div className="mt-1 mg-type-data-sm text-primary-foreground/70">
Expand Down Expand Up @@ -273,10 +270,7 @@ export function NoDataSpark({
</span>
</div>
</TooltipTrigger>
<TooltipContent
side="top"
className="max-w-xs text-[11px] leading-relaxed"
>
<TooltipContent side="top" className="max-w-xs mg-type-caption">
{reason}.{" "}
{freshAbs
? `Last checked ${freshAbs}${windowLabel ? ` · ${windowLabel} window` : ""}.`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export function TreemapMini({
{t.label}
</span>
{t.w > MIN_TILE_W_FOR_VALUE && t.h > MIN_TILE_H_FOR_VALUE ? (
<span className="truncate font-mono text-[9px] leading-none text-accent-foreground/80">
<span className="truncate mg-type-data-sm leading-none text-accent-foreground/80">
{formatValue(t.value)}
</span>
) : null}
Expand Down
10 changes: 5 additions & 5 deletions packages/ui-kit/src/components/metagraphed/chips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function HealthDot({
return (
<span className="inline-flex items-center gap-1.5">
{dot}
<span className="text-[11px] font-medium text-ink">{label}</span>
<span className="mg-type-caption font-medium text-ink">{label}</span>
</span>
);
}
Expand All @@ -109,7 +109,7 @@ export function HealthPill({
return (
<span className="inline-flex items-center gap-1.5">
<HealthDot state={state} />
<span className="text-[11px] font-medium text-ink">{label}</span>
<span className="mg-type-caption font-medium text-ink">{label}</span>
</span>
);
}
Expand Down Expand Up @@ -172,7 +172,7 @@ export function CurationChip({ level }: { level?: CurationLevel | string }) {
return (
<span
className={classNames(
"inline-flex items-center rounded border px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider",
"inline-flex items-center rounded border px-1.5 py-0.5 mg-type-caption font-medium uppercase tracking-wider",
cls,
)}
>
Expand Down Expand Up @@ -200,7 +200,7 @@ export function ReviewChip({ state }: { state?: string }) {
return (
<span
className={classNames(
"inline-flex items-center rounded border px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider",
"inline-flex items-center rounded border px-1.5 py-0.5 mg-type-caption font-medium uppercase tracking-wider",
reviewCls[key],
)}
title={`Maintainer review: ${key}`}
Expand All @@ -212,7 +212,7 @@ export function ReviewChip({ state }: { state?: string }) {

export function CandidateChip() {
return (
<span className="inline-flex items-center rounded border border-dashed border-ink-subtle bg-transparent px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider text-ink-muted">
<span className="inline-flex items-center rounded border border-dashed border-ink-subtle bg-transparent px-1.5 py-0.5 mg-type-caption font-medium uppercase tracking-wider text-ink-muted">
Unverified
</span>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export function DownloadCsvButton({
title={label}
className={classNames(
bare
? "inline-flex items-center gap-1.5 rounded px-2 py-1 min-h-8 text-[11px] font-medium text-ink-muted hover:text-ink-strong hover:bg-surface transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
? "inline-flex items-center gap-1.5 rounded px-2 py-1 min-h-8 mg-type-caption font-medium text-ink-muted hover:text-ink-strong hover:bg-surface transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
: // rounded-full matches the pill idiom shared by SectionBadge/FilterChip/
// other compact header controls it commonly sits next to — a plain
// `rounded` rectangle reads as a mismatched shape beside a pill.
"inline-flex items-center gap-1.5 rounded-full border border-border bg-card p-1.5 text-[11px] font-medium text-ink hover:border-ink/30 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:px-2.5 sm:py-1",
"inline-flex items-center gap-1.5 rounded-full border border-border bg-card p-1.5 mg-type-caption font-medium text-ink hover:border-ink/30 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:px-2.5 sm:py-1",
className,
)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,19 @@ export function EligibilityChip({
<span
tabIndex={0}
className={classNames(
"inline-flex items-center gap-1.5 rounded-full border bg-transparent font-mono uppercase tracking-wider whitespace-nowrap cursor-help transition-colors",
"inline-flex items-center gap-1.5 rounded-full border bg-transparent whitespace-nowrap cursor-help transition-colors",
"before:content-[''] before:size-1.5 before:rounded-full",
"hover:bg-surface/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
size === "xs"
? "px-2 py-0 text-[9px] h-5"
: "px-2.5 py-0 text-[10px] h-6",
? "px-2 py-0 h-5 mg-type-micro"
: "px-2.5 py-0 h-6 mg-type-label",
TONE[eligibility],
)}
>
{ELIGIBILITY_LABEL[eligibility]}
</span>
</TooltipTrigger>
<TooltipContent
side="top"
className="max-w-[240px] text-[11px] leading-relaxed"
>
<TooltipContent side="top" className="max-w-[240px] mg-type-caption">
<div className="mg-type-micro opacity-70 mb-1">
{ELIGIBILITY_LABEL[eligibility]}
</div>
Expand Down
8 changes: 4 additions & 4 deletions packages/ui-kit/src/components/metagraphed/entity-hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
className={classNames(
"mg-hero-slab relative",
display
? "mb-12 md:mb-16 pt-12 md:pt-20 pb-10 md:pb-14"
? "mb-12 md:mb-16 pt-12 md:pt-20 pb-10 md:pb-12"
: "pt-8 md:pt-12 pb-8 md:pb-10 mb-6",
className,
)}
Expand All @@ -92,7 +92,7 @@
</div>
) : null}

{banner ? <div className="mb-5">{banner}</div> : null}
{banner ? <div className="mb-4">{banner}</div> : null}

<div
className={classNames(
Expand All @@ -119,7 +119,7 @@
className={classNames(
"mg-fade-in mg-fade-in-delay-1 font-display font-semibold text-ink-strong",
display
? "mt-4 text-[2.5rem] sm:text-5xl md:text-[3.75rem] leading-[1.02] tracking-[-0.025em]"
? "mt-4 text-[2.5rem] sm:text-5xl md:text-6xl leading-[1.02] tracking-[-0.025em]"

Check warning on line 122 in packages/ui-kit/src/components/metagraphed/entity-hero.tsx

View workflow job for this annotation

GitHub Actions / ui

Bare arbitrary text sizes are drift. Use <SectionLabel> or the .mg-type-* utilities
: "text-3xl md:text-4xl tracking-[-0.01em]",
)}
>
Expand All @@ -136,7 +136,7 @@
className={classNames(
"mg-fade-in mg-fade-in-delay-2 text-ink-muted leading-relaxed",
display
? "mt-5 max-w-xl text-base md:text-lg"
? "mt-4 max-w-xl text-base md:text-lg"
: "mt-3 max-w-3xl text-sm md:text-base",
)}
>
Expand Down Expand Up @@ -178,7 +178,7 @@
className={classNames(
"font-display font-semibold tabular-nums text-ink-strong leading-none",
display
? "text-2xl md:text-[1.75rem] tracking-[-0.01em]"

Check warning on line 181 in packages/ui-kit/src/components/metagraphed/entity-hero.tsx

View workflow job for this annotation

GitHub Actions / ui

Bare arbitrary text sizes are drift. Use <SectionLabel> or the .mg-type-* utilities
: "text-xl md:text-2xl",
)}
>
Expand Down
39 changes: 39 additions & 0 deletions packages/ui-kit/src/components/metagraphed/external-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ interface Props {
authRequired?: boolean;
publicSafe?: boolean;
className?: string;
/**
* Skip the external-icon glyph, underline styling, and auth/publicSafe
* badges -- for composing into an icon-only segmented bar (e.g.
* PrimaryLinksRail) where the icon itself is the only content and a
* trailing external-icon/underline would be redundant. Still runs the
* same safeExternalUrl filtering and target/rel handling.
*/
bare?: boolean;
title?: string;
ariaLabel?: string;
}

const SAFE_EXTERNAL_PROTOCOLS = new Set(["http:", "https:"]);
Expand Down Expand Up @@ -98,8 +108,37 @@ export function ExternalLink({
authRequired,
publicSafe = true,
className,
bare,
title,
ariaLabel,
}: Props) {
const safeHref = safeExternalUrl(href);

if (bare) {
if (!safeHref) {
return (
<span
className={className}
title={title ?? "Blocked unsafe external URL"}
>
{children}
</span>
);
}
return (
<a
href={safeHref}
target="_blank"
rel="noopener noreferrer"
title={title}
aria-label={ariaLabel}
className={className}
>
{children}
</a>
);
}

const content = (
<>
<span className="truncate">{children}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function HoverPreview({
{open ? (
<span
role="tooltip"
className="absolute left-0 top-full z-[var(--mg-z-overlay)] mt-1.5 w-72 max-w-[80vw] rounded border border-border bg-card p-3 shadow-lg text-[11px] text-ink leading-relaxed"
className="absolute left-0 top-full z-[var(--mg-z-overlay)] mt-1.5 w-72 max-w-[80vw] rounded border border-border bg-card p-3 shadow-lg mg-type-caption text-ink"
>
{content}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ export function InfoTooltip({
<Info className="size-3.5" />
</button>
</TooltipTrigger>
<TooltipContent
side="top"
className="max-w-xs text-[11px] leading-relaxed"
>
<TooltipContent side="top" className="max-w-xs mg-type-caption">
{label}
</TooltipContent>
</Tooltip>
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-kit/src/components/metagraphed/list-shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export function LoadMore({

if (error) {
return (
<div className="flex items-center justify-between gap-3 border-t border-health-down/30 bg-health-down/5 px-4 py-2 text-[11px]">
<div className="flex items-center justify-between gap-3 border-t border-health-down/30 bg-health-down/5 px-4 py-2 mg-type-caption">
<span className="inline-flex items-center gap-1.5 text-health-down">
<AlertCircle className="size-3" />
Couldn&rsquo;t load more — {error.message || "network error"}.
Expand All @@ -168,7 +168,7 @@ export function LoadMore({

if (cursorInvalid) {
return (
<div className="flex items-center justify-between gap-3 border-t border-health-warn/30 bg-health-warn/5 px-4 py-2 text-[11px] text-health-warn">
<div className="flex items-center justify-between gap-3 border-t border-health-warn/30 bg-health-warn/5 px-4 py-2 mg-type-caption text-health-warn">
<span className="inline-flex items-center gap-1.5">
<AlertCircle className="size-3" />
Pagination stopped — the server returned an invalid next cursor.
Expand All @@ -191,7 +191,7 @@ export function LoadMore({
<button
type="button"
onClick={onLoadMore}
className="inline-flex items-center rounded border border-border bg-card px-3 py-1.5 text-[11px] font-medium hover:border-ink/30 min-h-9"
className="inline-flex items-center rounded border border-border bg-card px-3 py-1.5 mg-type-caption font-medium hover:border-ink/30 min-h-9"
>
Load more
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function MethodologyCallout({
/>
</button>
{open ? (
<div className="grid gap-3 border-t border-border px-3 py-3 text-[11.5px] leading-relaxed text-ink-muted md:grid-cols-2">
<div className="grid gap-3 border-t border-border px-3 py-3 mg-type-caption text-ink-muted md:grid-cols-2">
<div>
<div className="mg-type-micro text-ink-strong">Sparklines</div>
<p className="mt-1">
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-kit/src/components/metagraphed/page-hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
return (
<section
className={classNames(
"mg-hero-slab relative mb-12 md:mb-16 pt-12 md:pt-20 pb-10 md:pb-14",
"mg-hero-slab relative mb-12 md:mb-16 pt-12 md:pt-20 pb-10 md:pb-12",
className,
)}
>
Expand All @@ -60,11 +60,11 @@
{eyebrow}
</div>
) : null}
<h1 className="mg-fade-in mg-fade-in-delay-1 mt-4 font-display text-[2.5rem] sm:text-5xl md:text-[3.75rem] font-semibold leading-[1.02] tracking-[-0.025em] text-ink-strong">
<h1 className="mg-fade-in mg-fade-in-delay-1 mt-4 font-display text-[2.5rem] sm:text-5xl md:text-6xl font-semibold leading-[1.02] tracking-[-0.025em] text-ink-strong">

Check warning on line 63 in packages/ui-kit/src/components/metagraphed/page-hero.tsx

View workflow job for this annotation

GitHub Actions / ui

Bare arbitrary text sizes are drift. Use <SectionLabel> or the .mg-type-* utilities
{title}
</h1>
{description ? (
<p className="mg-fade-in mg-fade-in-delay-2 mt-5 max-w-xl text-base md:text-lg text-ink-muted leading-relaxed">
<p className="mg-fade-in mg-fade-in-delay-2 mt-4 max-w-xl text-base md:text-lg text-ink-muted leading-relaxed">
{description}
</p>
) : null}
Expand All @@ -87,7 +87,7 @@
<div key={k.label}>
<div className="mg-type-micro text-ink-muted">{k.label}</div>
<div className="mt-1.5 flex items-baseline gap-2">
<span className="font-display text-2xl md:text-[1.75rem] font-semibold tabular-nums text-ink-strong leading-none tracking-[-0.01em]">

Check warning on line 90 in packages/ui-kit/src/components/metagraphed/page-hero.tsx

View workflow job for this annotation

GitHub Actions / ui

Bare arbitrary text sizes are drift. Use <SectionLabel> or the .mg-type-* utilities
{k.value}
</span>
{k.hint ? (
Expand Down
Loading
Loading