diff --git a/desktop-next/README.md b/desktop-next/README.md index 216df79a4a..aa6dcc8890 100644 --- a/desktop-next/README.md +++ b/desktop-next/README.md @@ -17,18 +17,16 @@ Open `http://localhost:1430/design`. Use another port when needed: Click a section’s eyebrow link (the category followed by →) in the catalog to open `/design/components/` (for example, `/design/components/input`). Every catalog -entry has a dedicated URL with an isolated live playground, component-specific -state guidance, and its example module. Source is shown only on these focused pages. Fields, checkboxes, switches, tabs, -progress, and meters also include side-by-side state samples using the production -components. Reset example restores both the playground and its state samples. +entry has a dedicated URL with its title and live example in a small shared Card. +The examples retain their interactions and variants. Component pages have no +playground label, state guide, source disclosure, picker, or extra page actions. -Every component is also indented beneath All components in the navigation, like -Token table beneath Color. The navigation list scrolls independently so theme and -density controls remain available. Use these links, the component picker, or -Previous / Next links to move through the catalog. -All components returns to that component's original catalog anchor. Direct links -and refreshes work with the same SPA fallback as the rest of the site; unknown -component IDs have a recovery link. Theme and density preferences are shared. +Every component is indented beneath All components in the navigation, like Token +table beneath Color. The navigation list scrolls independently so theme and +density controls remain available. Use these links to move through the catalog. +Direct links and refreshes work with the same SPA fallback as the rest of the +site; unknown component IDs have a recovery link. Theme and density preferences +are shared. ## Appearance diff --git a/desktop-next/TESTING.md b/desktop-next/TESTING.md index 60fce71561..2fe483fe2b 100644 --- a/desktop-next/TESTING.md +++ b/desktop-next/TESTING.md @@ -50,9 +50,8 @@ stored values, save failure and retry, live foundation values, compositions, Glass tab selection, and all 55 examples at 390/884/1440 in both themes. Focused-page coverage visits all 55 catalog deep links and checks that only the -selected playground renders. It exercises catalog links, previous/next navigation, -the component picker, anchor return, unknown-ID recovery, reset of live and state -examples, invalid/read-only/disabled fields, indeterminate checkbox interaction, -disabled and selected tabs, portal density, refresh, and appearance preferences. -Representative pages are checked at 390/884/1440 in both densities and audited in -both themes, with distinct per-component screenshots. +selected component renders in its shared container. It exercises eyebrow and +nested navigation links, unknown-ID recovery, input and keyboard interactions, +portal density, refresh, and appearance preferences. Representative pages are +checked at 390/884/1440 in both densities and audited in both themes, with distinct +per-component screenshots. diff --git a/desktop-next/src/features/design-system/catalog/catalog.css b/desktop-next/src/features/design-system/catalog/catalog.css index cc94cca40d..8d30a5b24c 100644 --- a/desktop-next/src/features/design-system/catalog/catalog.css +++ b/desktop-next/src/features/design-system/catalog/catalog.css @@ -43,34 +43,13 @@ outline: 2px solid var(--ring-focus); outline-offset: 4px; } -.component-workspace { - display: grid; - gap: var(--space-page-inset); - grid-template-columns: minmax(0, 1fr); -} -.component-playground { - display: grid; - align-items: center; - min-height: var(--size-catalog-preview); - padding-block: var(--space-panel-inset); -} -.component-playground > * { +.component-preview > * { min-width: 0; max-width: 100%; } -.component-state-grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); - gap: var(--space-panel-inset); -} .component-page > header h1:focus { outline: none; } -@media (min-width: 1280px) { - .component-workspace { - grid-template-columns: minmax(0, 1fr) 16rem; - } -} @media (max-width: 760px) { .catalog-grid { grid-template-columns: minmax(0, 1fr); diff --git a/desktop-next/src/features/design-system/catalog/registry.ts b/desktop-next/src/features/design-system/catalog/registry.ts index 435d7c343c..2628bb559e 100644 --- a/desktop-next/src/features/design-system/catalog/registry.ts +++ b/desktop-next/src/features/design-system/catalog/registry.ts @@ -1,23 +1,17 @@ import type { ComponentType } from "react"; import { ComposerDemo } from "./composer"; -import composerSource from "./composer.tsx?raw"; import * as forms from "./forms"; -import formsSource from "./forms.tsx?raw"; import * as overlays from "./overlays"; -import overlaysSource from "./overlays.tsx?raw"; import * as navigation from "./navigation"; -import navigationSource from "./navigation.tsx?raw"; import * as display from "./display"; -import displaySource from "./display.tsx?raw"; -/** A live example and its source, grouped by the job it does. */ +/** A live example, grouped by the job it does. */ export interface CatalogEntry { id: string; name: string; description: string; category: string; Preview: ComponentType; - source: string; } export const CATALOG: readonly CatalogEntry[] = [ { @@ -27,7 +21,6 @@ export const CATALOG: readonly CatalogEntry[] = [ "A multiline prompt with context, attachments, model controls, and send/stop states.", category: "Inputs", Preview: ComposerDemo, - source: composerSource, }, { id: "buttons", @@ -35,7 +28,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Six emphasis variants, three sizes, and named icon actions.", category: "Inputs", Preview: forms.ButtonsDemo, - source: formsSource, }, { id: "input", @@ -43,7 +35,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A single-line field with an associated label.", category: "Inputs", Preview: forms.InputDemo, - source: formsSource, }, { id: "textarea", @@ -51,7 +42,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A growing space for longer thoughts.", category: "Inputs", Preview: forms.TextareaDemo, - source: formsSource, }, { id: "input-group", @@ -59,7 +49,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Accessories around one clearly labeled input.", category: "Inputs", Preview: forms.InputGroupDemo, - source: formsSource, }, { id: "form-field", @@ -68,7 +57,6 @@ export const CATALOG: readonly CatalogEntry[] = [ "Native submission with inline validation and a recovery path.", category: "Inputs", Preview: forms.FormDemo, - source: formsSource, }, { id: "checkbox", @@ -76,7 +64,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "An independent choice with checked and unchecked states.", category: "Inputs", Preview: forms.CheckboxDemo, - source: formsSource, }, { id: "checkbox-group-fieldset", @@ -84,7 +71,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Related choices share a visible group label.", category: "Inputs", Preview: forms.CheckboxGroupDemo, - source: formsSource, }, { id: "radio-group", @@ -92,7 +78,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "One choice from a named set.", category: "Inputs", Preview: forms.RadioDemo, - source: formsSource, }, { id: "switch", @@ -100,7 +85,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "An immediate on or off setting.", category: "Inputs", Preview: forms.SwitchDemo, - source: formsSource, }, { id: "slider", @@ -108,7 +92,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A continuous value with keyboard adjustment.", category: "Inputs", Preview: forms.SliderDemo, - source: formsSource, }, { id: "number-field", @@ -116,7 +99,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A bounded value with increment and decrement actions.", category: "Inputs", Preview: forms.NumberDemo, - source: formsSource, }, { id: "input-otp", @@ -124,7 +106,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A six-digit code with ordered input labels.", category: "Inputs", Preview: forms.OTPDemo, - source: formsSource, }, { id: "combobox", @@ -132,7 +113,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Search and select from known values.", category: "Inputs", Preview: forms.ComboboxDemo, - source: formsSource, }, { id: "autocomplete", @@ -140,7 +120,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Suggestions that still allow a new value.", category: "Inputs", Preview: forms.AutocompleteDemo, - source: formsSource, }, { id: "command", @@ -148,7 +127,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Search actions; execute only after explicit selection.", category: "Inputs", Preview: forms.CommandDemo, - source: formsSource, }, { id: "calendar", @@ -157,7 +135,6 @@ export const CATALOG: readonly CatalogEntry[] = [ "Single, multiple, and range selection through the calendar API.", category: "Inputs", Preview: forms.CalendarDemo, - source: formsSource, }, { id: "dialog", @@ -165,7 +142,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A focused modal with a title, description, and close action.", category: "Overlays", Preview: overlays.DialogDemo, - source: overlaysSource, }, { id: "alert-dialog", @@ -173,7 +149,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A deliberate decision before a destructive action.", category: "Overlays", Preview: overlays.AlertDialogDemo, - source: overlaysSource, }, { id: "sheet", @@ -181,7 +156,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Related detail in a side surface.", category: "Overlays", Preview: overlays.SheetDemo, - source: overlaysSource, }, { id: "drawer", @@ -189,7 +163,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Focused actions in a bottom surface.", category: "Overlays", Preview: overlays.DrawerDemo, - source: overlaysSource, }, { id: "popover", @@ -197,7 +170,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Contextual controls anchored to a trigger.", category: "Overlays", Preview: overlays.PopoverDemo, - source: overlaysSource, }, { id: "tooltip", @@ -205,7 +177,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Brief help available on pointer hover and keyboard focus.", category: "Overlays", Preview: overlays.TooltipDemo, - source: overlaysSource, }, { id: "hover-card", @@ -214,7 +185,6 @@ export const CATALOG: readonly CatalogEntry[] = [ "A preview of a link; essential information remains on the page.", category: "Overlays", Preview: overlays.PreviewCardDemo, - source: overlaysSource, }, { id: "dropdown-menu", @@ -222,7 +192,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A keyboard-navigable set of actions.", category: "Overlays", Preview: overlays.MenuDemo, - source: overlaysSource, }, { id: "context-menu", @@ -230,7 +199,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Contextual actions, including a keyboard entry point.", category: "Overlays", Preview: overlays.ContextMenuDemo, - source: overlaysSource, }, { id: "select", @@ -238,7 +206,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A finite selection with readable value labels.", category: "Overlays", Preview: overlays.SelectDemo, - source: overlaysSource, }, { id: "toast", @@ -246,7 +213,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A transient announcement with an explicit dismiss action.", category: "Overlays", Preview: overlays.ToastDemo, - source: overlaysSource, }, { id: "accordion", @@ -254,7 +220,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Related disclosures with independently focusable headings.", category: "Navigation", Preview: navigation.AccordionDemo, - source: navigationSource, }, { id: "collapsible", @@ -262,7 +227,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Optional detail without leaving the current view.", category: "Navigation", Preview: navigation.CollapsibleDemo, - source: navigationSource, }, { id: "tabs", @@ -270,7 +234,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Switch between sibling panels using pointer or arrow keys.", category: "Navigation", Preview: navigation.TabsDemo, - source: navigationSource, }, { id: "toggle", @@ -278,7 +241,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "An action that stays pressed until toggled again.", category: "Navigation", Preview: navigation.ToggleDemo, - source: navigationSource, }, { id: "toggle-group", @@ -286,7 +248,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A coordinated set of pressed choices.", category: "Navigation", Preview: navigation.ToggleGroupDemo, - source: navigationSource, }, { id: "toolbar", @@ -294,7 +255,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Related controls with shared keyboard navigation.", category: "Navigation", Preview: navigation.ToolbarDemo, - source: navigationSource, }, { id: "menubar", @@ -302,7 +262,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Persistent menus for an application workspace.", category: "Navigation", Preview: navigation.MenubarDemo, - source: navigationSource, }, { id: "navigation-menu", @@ -310,7 +269,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Links and nested destinations.", category: "Navigation", Preview: navigation.NavigationDemo, - source: navigationSource, }, { id: "breadcrumb", @@ -318,7 +276,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A location path with one current destination.", category: "Navigation", Preview: navigation.BreadcrumbDemo, - source: navigationSource, }, { id: "sidebar", @@ -326,7 +283,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A named set of primary destinations.", category: "Navigation", Preview: navigation.SidebarDemo, - source: navigationSource, }, { id: "pagination", @@ -334,7 +290,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Bounded page navigation with explicit current state.", category: "Navigation", Preview: navigation.PaginationDemo, - source: navigationSource, }, { id: "card", @@ -342,7 +297,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A contained widget or settings group.", category: "Display & layout", Preview: display.CardDemo, - source: displaySource, }, { id: "badge", @@ -350,7 +304,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Status expressed with text as well as color.", category: "Display & layout", Preview: display.BadgeDemo, - source: displaySource, }, { id: "alert", @@ -358,7 +311,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Inline information, success, warning, or failure.", category: "Display & layout", Preview: display.AlertDemo, - source: displaySource, }, { id: "avatar", @@ -366,7 +318,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Identity with a deterministic fallback.", category: "Display & layout", Preview: display.AvatarDemo, - source: displaySource, }, { id: "progress", @@ -374,7 +325,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Completion of ongoing work.", category: "Display & layout", Preview: display.ProgressDemo, - source: displaySource, }, { id: "meter", @@ -382,7 +332,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A measurement in a known range.", category: "Display & layout", Preview: display.MeterDemo, - source: displaySource, }, { id: "skeleton", @@ -390,7 +339,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A decorative loading placeholder owned by its region.", category: "Display & layout", Preview: display.SkeletonDemo, - source: displaySource, }, { id: "spinner", @@ -398,7 +346,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "One named loading announcement.", category: "Display & layout", Preview: display.SpinnerDemo, - source: displaySource, }, { id: "empty-state", @@ -406,7 +353,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Purpose and a useful next step.", category: "Display & layout", Preview: display.EmptyDemo, - source: displaySource, }, { id: "separator", @@ -414,7 +360,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A quiet boundary between related regions.", category: "Display & layout", Preview: display.SeparatorDemo, - source: displaySource, }, { id: "table", @@ -422,7 +367,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Semantic rows with horizontal overflow on narrow screens.", category: "Display & layout", Preview: display.TableDemo, - source: displaySource, }, { id: "chart", @@ -430,7 +374,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Nonnegative categorical bars with readable table values.", category: "Display & layout", Preview: display.ChartDemo, - source: displaySource, }, { id: "aspect-ratio", @@ -438,7 +381,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A stable media frame without a layout shift.", category: "Display & layout", Preview: display.AspectRatioDemo, - source: displaySource, }, { id: "carousel", @@ -446,7 +388,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Manual slide navigation with announced positions.", category: "Display & layout", Preview: display.CarouselDemo, - source: displaySource, }, { id: "scroll-area", @@ -454,7 +395,6 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "A bounded region with accessible scrolling.", category: "Display & layout", Preview: display.ScrollAreaDemo, - source: displaySource, }, { id: "resizable", @@ -462,6 +402,5 @@ export const CATALOG: readonly CatalogEntry[] = [ description: "Adjustable regions with pointer and keyboard controls.", category: "Display & layout", Preview: display.ResizableDemo, - source: displaySource, }, ]; diff --git a/desktop-next/src/features/design-system/catalog/state-guides.ts b/desktop-next/src/features/design-system/catalog/state-guides.ts deleted file mode 100644 index 9b06368481..0000000000 --- a/desktop-next/src/features/design-system/catalog/state-guides.ts +++ /dev/null @@ -1,228 +0,0 @@ -/** States reachable in the live examples, rather than simulated screenshots. */ -export const STATE_GUIDES: Record = { - "ai-composer": [ - "Start empty, then write a multiline draft with Shift+Enter.", - "Add or remove context and attachments; choose a model and action policy.", - "Send to see generation and Stop. Simulate a send failure to inspect recovery.", - ], - buttons: [ - "Compare all six emphasis variants and the three sizes.", - "Inspect disabled and loading actions alongside enabled buttons.", - "Hover, press, or Tab to a button to compare pointer and keyboard feedback.", - ], - input: [ - "Compare empty, filled, invalid, read-only, and disabled fields below.", - "Tab into the editable field and type to inspect its focus and content states.", - ], - textarea: [ - "Compare empty, filled, invalid, read-only, and disabled writing areas.", - "Write multiple lines and resize the editable example.", - ], - "input-group": [ - "Type a query and inspect how the leading icon and shortcut stay aligned.", - "Tab into the input to see the shared focus treatment.", - ], - "form-field": [ - "Submit empty or malformed email to inspect validation.", - "Enter a valid email and submit to see confirmation.", - ], - checkbox: [ - "Toggle the live choice with a click or Space.", - "Compare unchecked, checked, indeterminate, and disabled states below.", - ], - "checkbox-group-fieldset": [ - "Select several channels, then deselect them independently.", - "Tab between choices and use Space to change selection.", - ], - "radio-group": [ - "Select either visibility option.", - "Use arrow keys to move the single selection within the group.", - ], - switch: [ - "Switch the live setting on and off with a click or Space.", - "Compare on, off, and disabled examples below.", - ], - slider: [ - "Drag the thumb or use arrow keys to adjust the value.", - "Use Home and End to inspect the minimum and maximum.", - ], - "number-field": [ - "Type a number, or use the increment and decrement actions.", - "Try the bounds of 1 and 12 to inspect unavailable step actions.", - ], - "input-otp": [ - "Enter a six-digit code; inspect the active digit as focus advances.", - "Paste a code, or use Backspace to edit earlier digits.", - ], - combobox: [ - "Open the choices, then type to filter them.", - "Search for a nonexistent project to see the empty state.", - "Use arrow keys and Enter to select; Escape dismisses the popup.", - ], - autocomplete: [ - "Type a known project to inspect suggestions.", - "Enter a new project name to retain free text.", - "Use arrow keys to explore suggestions and Escape to dismiss.", - ], - command: [ - "Type to filter actions or show an empty result.", - "Choose with Enter or a click; filtering alone does not execute an action.", - ], - calendar: [ - "Select or clear a date and navigate between months.", - "Compare today and the selected day, including keyboard focus.", - ], - dialog: [ - "Open the dialog to inspect its title, description, and action.", - "Tab through the modal, then dismiss with Done or Escape to restore trigger focus.", - ], - "alert-dialog": [ - "Open the decision and cancel with Keep draft.", - "Confirm deletion to see the local result, then Restore.", - ], - sheet: [ - "Open the side surface and inspect its content at different widths.", - "Dismiss with Close details or Escape to return focus.", - ], - drawer: [ - "Open the bottom surface and inspect its anchored position.", - "Use Continue building or Escape to dismiss.", - ], - popover: [ - "Open the anchored share options.", - "Dismiss with Got it, Escape, or a click outside.", - ], - tooltip: [ - "Hover the trigger or focus it with the keyboard.", - "Move away or press Escape to dismiss the help.", - ], - "hover-card": [ - "Hover the team link to inspect its preview.", - "Move away to close; essential link text stays on the page.", - ], - "dropdown-menu": [ - "Open the menu and explore the highlighted item with arrow keys.", - "Choose an action to see the local result, or Escape to dismiss.", - ], - "context-menu": [ - "Right-click the target, or focus it and press Shift+F10.", - "Choose Copy link or Mark as unread to inspect the result.", - ], - select: [ - "Open the choices and inspect the selected indicator.", - "Use arrow keys and Enter to choose another digest frequency.", - ], - toast: [ - "Show a notification to inspect its entrance and status text.", - "Show several to inspect stacking; dismiss with the close action.", - ], - accordion: [ - "Expand and collapse each heading.", - "Use Tab and Enter or Space to compare keyboard interaction.", - ], - collapsible: [ - "Reveal the implementation notes and hide them again.", - "Focus the trigger to inspect its expanded and collapsed semantics.", - ], - tabs: [ - "Switch between Overview, Activity, and Files to inspect the sliding indicator.", - "Use arrow keys to focus a tab, then Enter to select it.", - "Compare the solid and glass tracks and the disabled tab below.", - ], - toggle: [ - "Press to pin, then press again to unpin.", - "Use Space to compare the same states with the keyboard.", - ], - "toggle-group": [ - "Switch the timeline scale between day, week, and month.", - "Inspect selected and unselected choices with keyboard navigation.", - ], - toolbar: [ - "Use arrow keys to move among the grouped actions.", - "Activate an action to inspect its local status result.", - ], - menubar: [ - "Open Project or View, then move among their menu items.", - "Choose an action or dismiss with Escape.", - ], - "navigation-menu": [ - "Open Foundations to reveal its nested destinations.", - "Follow a link to inspect navigation into a foundation page.", - ], - breadcrumb: [ - "Compare linked ancestors and the current location.", - "Tab to an ancestor and follow it back to the catalog.", - ], - sidebar: [ - "Inspect the current destination alongside the other links.", - "Tab through the destinations and follow a link.", - ], - pagination: [ - "Move through pages 1 to 3.", - "Compare the current page and the disabled Previous or Next action at each bound.", - ], - card: [ - "Inspect the label, grouped heading, body, and action as one composition.", - "Switch density to compare panel insets and heading spacing.", - ], - badge: [ - "Compare neutral, accent, success, warning, danger, and information tones.", - "Compare the text-only badges with the icon and text success badge.", - ], - alert: [ - "Compare information, success, warning, and failure messages.", - "Switch theme to inspect text and fill pairings.", - ], - avatar: [ - "Compare initials and the agent icon fallback.", - "Switch theme and density to inspect identity at the shared control size.", - ], - progress: [ - "Compare empty, in-progress, and complete values below.", - "Inspect both the visual fill and the accessible value.", - ], - meter: [ - "Compare low, medium, and full measurements below.", - "Inspect the value label alongside the fill.", - ], - skeleton: [ - "Inspect the loading region and its differently sized placeholders.", - "Enable reduced motion in your system to remove the pulse.", - ], - spinner: [ - "Inspect the named loading indicator.", - "Enable reduced motion in your system to remove rotation.", - ], - "empty-state": [ - "Inspect the purpose, explanation, and next action together.", - "Follow the action to see a populated composition.", - ], - separator: [ - "Inspect the boundary between two related text regions.", - "Switch theme to compare the quiet divider treatment.", - ], - table: [ - "Inspect column headings, left alignment, and status cells.", - "At a narrow width, scroll within the table rather than the whole page.", - ], - chart: [ - "Compare category labels, values, and proportional bars.", - "Switch density to inspect the spacing between data rows.", - ], - "aspect-ratio": [ - "Resize the viewport to inspect the preserved 16:9 frame.", - "Content keeps its proportions in either density.", - ], - carousel: [ - "Move through the three slides using Next and Previous.", - "Inspect the announced position and disabled actions at the ends.", - ], - "scroll-area": [ - "Scroll through all 20 activities.", - "Inspect the thin thumb as its position changes; keyboard scrolling works in the viewport.", - ], - resizable: [ - "Drag the separator to resize the two regions.", - "Focus the separator and use arrow keys to resize; the visible grip remains separate from its hit area.", - ], -}; diff --git a/desktop-next/src/features/design-system/catalog/states/fields.tsx b/desktop-next/src/features/design-system/catalog/states/fields.tsx deleted file mode 100644 index c51dacb414..0000000000 --- a/desktop-next/src/features/design-system/catalog/states/fields.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { Field, Input, Textarea } from "@buzz/ui"; - -/** Field states use the production field and input semantics. */ -export function FieldStates({ - kind = "input", -}: { - kind?: "input" | "textarea"; -}) { - const Control = kind === "textarea" ? Textarea : Input; - return ( -
- {(["Empty", "Filled", "Invalid", "Read-only", "Disabled"] as const).map( - (state) => ( - - {state} - - {state === "Invalid" && ( - Choose a different project name. - )} - - ), - )} -
- ); -} - -export function TextareaStates() { - return ; -} diff --git a/desktop-next/src/features/design-system/catalog/states/measurements.tsx b/desktop-next/src/features/design-system/catalog/states/measurements.tsx deleted file mode 100644 index 414864e507..0000000000 --- a/desktop-next/src/features/design-system/catalog/states/measurements.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { Meter, Progress } from "@buzz/ui"; - -/** Empty, partial, and complete values rendered by the actual progress API. */ -export function ProgressStates() { - return ( -
- {[0, 50, 100].map((value) => ( - -
- - {value === 0 - ? "Not started" - : value === 100 - ? "Complete" - : "In progress"} - - -
- - - -
- ))} -
- ); -} - -/** A meter measures a bounded quantity independently of task completion. */ -export function MeterStates() { - return ( -
- {[10, 50, 100].map((value) => ( - -
- - {value === 10 ? "Low usage" : value === 50 ? "Half used" : "Full"} - - -
- - - -
- ))} -
- ); -} diff --git a/desktop-next/src/features/design-system/catalog/states/selection.tsx b/desktop-next/src/features/design-system/catalog/states/selection.tsx deleted file mode 100644 index 18d5f7ef63..0000000000 --- a/desktop-next/src/features/design-system/catalog/states/selection.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import { useId, useState } from "react"; -import { Checkbox, Switch, Tabs } from "@buzz/ui"; -import { Check, Minus } from "lucide-react"; - -function CheckboxSample({ label }: { label: string }) { - const id = useId(); - const [checked, setChecked] = useState( - label === "Indeterminate" ? "mixed" : label === "Checked", - ); - return ( - - ); -} - -/** Independent, interactive check states with native disabled semantics. */ -export function CheckboxStates() { - return ( -
- {["Unchecked", "Checked", "Indeterminate", "Disabled"].map((label) => ( - - ))} -
- ); -} - -/** Switch samples retain the same keyboard and pointer behavior as the catalog. */ -export function SwitchStates() { - const id = useId(); - return ( -
- {["Off", "On", "Disabled off", "Disabled on"].map((state) => ( - - ))} -
- ); -} - -/** Both supported tab materials and a disabled destination. */ -export function TabsStates() { - return ( -
- {(["solid", "glass"] as const).map((variant) => ( -
-

- {variant === "glass" ? "Glass" : "Solid"} -

- - - Overview - Activity - - Files - - - - People building together. - Three tasks completed. - -
- ))} -
- ); -} diff --git a/desktop-next/src/features/design-system/ui/ComponentPage.tsx b/desktop-next/src/features/design-system/ui/ComponentPage.tsx index 2d0f48d8b8..10788bfba6 100644 --- a/desktop-next/src/features/design-system/ui/ComponentPage.tsx +++ b/desktop-next/src/features/design-system/ui/ComponentPage.tsx @@ -1,81 +1,12 @@ -import { useEffect, useRef, useState } from "react"; -import { Link, useNavigate } from "@tanstack/react-router"; -import { Button, Select } from "@buzz/ui"; -import { Check, ChevronDown, RotateCcw } from "lucide-react"; -import { CATALOG, type CatalogEntry } from "../catalog/registry"; -import { STATE_GUIDES } from "../catalog/state-guides"; -import { FieldStates, TextareaStates } from "../catalog/states/fields"; -import { - CheckboxStates, - SwitchStates, - TabsStates, -} from "../catalog/states/selection"; -import { MeterStates, ProgressStates } from "../catalog/states/measurements"; +import { useEffect, useRef } from "react"; +import { Link } from "@tanstack/react-router"; +import { Card } from "@buzz/ui"; +import type { CatalogEntry } from "../catalog/registry"; import { PageHeader } from "./primitives"; -const STATE_EXAMPLES = { - input: FieldStates, - textarea: TextareaStates, - checkbox: CheckboxStates, - switch: SwitchStates, - tabs: TabsStates, - progress: ProgressStates, - meter: MeterStates, -}; -const choices = CATALOG.map((entry) => ({ - value: entry.id, - label: entry.name, -})); - -function ComponentPicker({ entry }: { entry: CatalogEntry }) { - const navigate = useNavigate(); - return ( - { - if (value) - void navigate({ - to: "/design/components/$componentId", - params: { componentId: value }, - }); - }} - > - - - - - - - - - - {choices.map((choice) => ( - - {choice.label} - - - - ))} - - - - - - ); -} - -/** One component's live behavior, visible states, and navigation through the catalog. */ +/** A focused component example, using the shared card geometry and appearance. */ export function ComponentPage({ entry }: { entry: CatalogEntry }) { - const [revision, setRevision] = useState(0); const heading = useRef(null); - const index = CATALOG.findIndex((candidate) => candidate.id === entry.id); - const previous = CATALOG[index - 1]; - const next = CATALOG[index + 1]; - const StateExamples = STATE_EXAMPLES[entry.id as keyof typeof STATE_EXAMPLES]; - useEffect(() => { const originalTitle = document.title; document.title = `${entry.name} — Buzz Design System`; @@ -87,18 +18,7 @@ export function ComponentPage({ entry }: { entry: CatalogEntry }) { return (
-
- - ← All components - - -
-
-

{entry.category}

+

{entry.name}

-

- {entry.description} -

-
-
-
-

- Playground -

- -
-
- -
-
- -
- {StateExamples && ( -
-

- State examples -

-
- -
-
- )} -
- - View example module - -
-          {entry.source}
-        
-
- + +
); } diff --git a/desktop-next/tests/component-pages.spec.ts b/desktop-next/tests/component-pages.spec.ts index 7a3207826a..e3a422b022 100644 --- a/desktop-next/tests/component-pages.spec.ts +++ b/desktop-next/tests/component-pages.spec.ts @@ -31,19 +31,18 @@ test("every catalog entry links to its own focused component page", async ({ await expect( page.getByRole("heading", { level: 1, name: entry.name, exact: true }), ).toBeVisible(); - await expect(page.locator(".component-playground")).toHaveCount(1); + await expect(page.locator(".component-preview")).toHaveCount(1); await expect(page.locator(".catalog-entry")).toHaveCount(0); - expect( - await page - .getByRole("complementary", { name: "States to explore" }) - .getByRole("listitem") - .count(), - ).toBeGreaterThan(0); + await expect( + page.getByRole("heading", { name: "Playground", exact: true }), + ).toHaveCount(0); + await expect(page.getByRole("complementary")).toHaveCount(0); + await expect(page.locator(".component-page details")).toHaveCount(0); await expect(page).toHaveTitle(`${entry.name} — Buzz Design System`); } }); -test("catalog navigation, picker, previous/next, reset, and invalid links work", async ({ +test("catalog and nested navigation preserve working examples and recover invalid links", async ({ page, }) => { await page.goto("/design/components"); @@ -57,8 +56,6 @@ test("catalog navigation, picker, previous/next, reset, and invalid links work", }); await input.fill("A temporary draft"); await expect(input).toHaveCSS("height", "32px"); - await page.getByRole("button", { name: "Reset example" }).click(); - await expect(input).toHaveValue(""); const nav = page.getByRole("navigation", { name: "Design system", exact: true, @@ -75,16 +72,8 @@ test("catalog navigation, picker, previous/next, reset, and invalid links work", page.getByRole("button", { name: "Compact", exact: true }), ).toBeInViewport(); await nav.getByRole("link", { name: "Input", exact: true }).click(); - await page - .getByRole("link", { name: "Next: Textarea", exact: false }) - .click(); - await expect(page).toHaveURL(/\/textarea$/); - await page - .getByRole("link", { name: "Previous: Input", exact: false }) - .click(); - await expect(page).toHaveURL(/\/input$/); - await page.getByRole("combobox", { name: "Jump to component" }).click(); - await page.getByRole("option", { name: "Dialog", exact: true }).click(); + await expect(input).toHaveValue(""); + await nav.getByRole("link", { name: "Dialog", exact: true }).click(); await expect(page).toHaveURL(/\/dialog$/); await page.getByRole("button", { name: "Edit project", exact: true }).click(); await expect(page.getByRole("dialog")).toBeVisible(); @@ -94,12 +83,8 @@ test("catalog navigation, picker, previous/next, reset, and invalid links work", await expect( page.getByRole("heading", { level: 1, name: "Dialog" }), ).toBeVisible(); - await page - .getByRole("link", { name: "All components", exact: false }) - .filter({ hasText: "←" }) - .click(); - await expect(page).toHaveURL(/\/design\/components#dialog$/); - await expect(page.locator("#dialog")).toBeInViewport(); + await nav.getByRole("link", { name: "All components", exact: true }).click(); + await expect(page).toHaveURL(/\/design\/components$/); await page.goto("/design/components/not-a-component"); await expect( page.getByRole("heading", { name: "Component not found" }), @@ -108,49 +93,40 @@ test("catalog navigation, picker, previous/next, reset, and invalid links work", await expect(page.locator(".catalog-entry")).toHaveCount(55); }); -test("state samples use real validation, disabled, selection, and reset behavior", async ({ +test("focused examples retain input, disabled, and keyboard selection behavior", async ({ page, }) => { await page.goto("/design/components/input"); - const invalid = page.getByRole("textbox", { name: "Invalid", exact: true }); - await expect(invalid).toHaveAttribute("aria-invalid", "true"); - await expect( - page.getByText("Choose a different project name."), - ).toBeVisible(); - await expect( - page.getByRole("textbox", { name: "Disabled", exact: true }), - ).toBeDisabled(); - await expect( - page.getByRole("textbox", { name: "Read-only", exact: true }), - ).not.toBeEditable(); - await page.goto("/design/components/checkbox"); - const mixed = page.getByRole("checkbox", { - name: "Indeterminate", + const input = page.getByRole("textbox", { + name: "Project name", exact: true, }); - await expect(mixed).toHaveAttribute("aria-checked", "mixed"); - await mixed.focus(); - await mixed.press("Space"); - await expect(mixed).toBeChecked(); - await expect(mixed).not.toHaveAttribute("aria-checked", "mixed"); - await page.getByRole("button", { name: "Reset example" }).click(); - await expect(mixed).toHaveAttribute("aria-checked", "mixed"); + await input.fill("Keep my draft"); + await page.getByRole("button", { name: "Compact", exact: true }).click(); + await expect(input).toHaveValue("Keep my draft"); + await expect(page.locator(".component-preview")).toHaveCSS("padding", "16px"); + await page.goto("/design/components/buttons"); + await expect( + page.getByRole("button", { name: "Unavailable", exact: true }), + ).toBeDisabled(); + await page.getByRole("button", { name: "Continue", exact: true }).click(); + await expect( + page.getByText("1 actions taken", { exact: true }), + ).toBeVisible(); + await page.goto("/design/components/checkbox"); + const checkbox = page.getByRole("checkbox", { + name: "Notify me about replies", + }); + await expect(checkbox).toBeChecked(); + await checkbox.press("Space"); + await expect(checkbox).not.toBeChecked(); await page.goto("/design/components/tabs"); - const tabs = page.getByRole("tablist", { name: "glass example" }); - await expect(tabs.getByRole("tab", { name: "Files" })).toHaveAttribute( - "aria-disabled", - "true", - ); + const tabs = page.getByRole("tablist", { name: "Project views" }); await tabs.getByRole("tab", { name: "Activity" }).click(); await expect(tabs.getByRole("tab", { name: "Activity" })).toHaveAttribute( "aria-selected", "true", ); - await page.getByRole("button", { name: "Reset example" }).click(); - await expect(tabs.getByRole("tab", { name: "Overview" })).toHaveAttribute( - "aria-selected", - "true", - ); }); test("focused pages remain readable and accessible in both themes and densities", async ({ diff --git a/desktop-next/tests/layout-refinements.spec.ts b/desktop-next/tests/layout-refinements.spec.ts index b9611bc7a5..2ee8af12e8 100644 --- a/desktop-next/tests/layout-refinements.spec.ts +++ b/desktop-next/tests/layout-refinements.spec.ts @@ -24,8 +24,8 @@ test("table cells align to the reading edge and scroll surfaces use thin bars", await expect .poll(() => viewport.evaluate((node) => node.scrollTop)) .toBeGreaterThan(0); - await page.goto("/design/components/input"); - await page.getByText("View example module", { exact: true }).click(); + await page.goto("/design/compositions"); + await page.getByText("View the response data", { exact: true }).click(); await expect(page.locator(".catalog-source pre")).toHaveCSS( "scrollbar-width", "thin",