"use client" /** * Maps registry slugs → live preview sections (shadcn-style stacked examples). */ import * as React from "react" import { AnimatedBlobBackgroundPreview, LeoPulseBorderPreview, LeoAmbientSurfacePreview, LeoAmbienceSettingsPreview, AskLeoComposerPreview, AskLeoShellSchematicPreview, DedicatedSearchComposerPreview, DedicatedSearchLandingPreview, DedicatedSearchResultsPreview, DiscoveryHubSchematicPreview, } from "@/components/design-system/previews-leo-search" import { CommandMenuSchematicPreview, DataRowListPreview, FinderPanelViewPreview, FolderGridViewPreview, ListPageBoardCardPreview, ListPageBoardTemplatePreview, ListPageTemplateSchematicPreview, ListPageTreePanelShellPreview, ListPageViewFramePreview, OutlineTreeMenuPreview, } from "@/components/design-system/previews-data-views" import { ExportDrawerPreview, InviteCollaboratorsDrawerPreview, ExamLockTemplatePreview, FocusWorkflowTemplatePreview, NewFocusTemplatePreview, LoginPagePreview, ProductMarketingPagePreview, ProductsHomePreview, } from "@/components/design-system/previews-overlays-pages" import { DotPatternPreview, DragHandleGripPreview, HorizontalScrollControlsPreview, HorizontalScrollRegionPreview, ResizablePreview, NestedSecondaryPanelShellPreview, SecondaryHubNavPrimitivesPreview, SecondaryPanelHubTemplatePreview, SettingsFormRowPreview, SiteHeaderPreview, } from "@/components/design-system/previews-layout-chrome" import { CarouselPreview, DropdownButtonPreview, DropdownButtonSplitPreview, } from "@/components/design-system/action-layout-previews" import { CommandPreview, SelectGroupsPreview, SelectPreview, SelectScrollablePreview, SelectStatesPreview, SelectionTileGridPreview, TableBulkActionBarPreview, } from "@/components/design-system/data-display-previews" import { DesignSystemExampleCanvas } from "@/components/design-system/component-doc-shell" import { designSystemPreviewIsWide } from "@/lib/design-system/component-doc-shell" import { DS_DOC_SECTION_TITLE } from "@/lib/design-system/doc-typography" import { CalendarDropdownCaptionPreview, CalendarPreview, CalendarRangePreview, CalendarTwoMonthPreview, DatePickerPreview, DateRangePickerPreview, DateTextInputPreview, } from "@/components/design-system/date-previews" import { CheckboxFieldPreview, FieldBasicPreview, FieldDisabledPreview, FieldInvalidPreview, FieldLayoutsPreview, FormRhfPreview, RadioGroupChoiceCardPreview, RadioGroupDefaultPreview, RadioGroupDescriptionPreview, RadioGroupFieldsetPreview, RadioGroupInvalidPreview, } from "@/components/design-system/form-previews" import { InputDefaultPreview, InputGroupPreview, InputMaskPreview, InputOTPPreview, InputWithPrimaryButtonPreview, LabelPreview, PasswordValidationPreview, PaymentCardFieldsPreview, SliderPreview, TextareaDefaultPreview, } from "@/components/design-system/input-previews" import { WizardAllVariantsPreview, WizardErrorStatePreview, WizardHorizontalCompactPreview, WizardHorizontalIconsPreview, WizardHorizontalNumberedPreview, WizardManyStepsPreview, WizardVerticalIconsPreview, WizardVerticalNumberedPreview, } from "@/components/design-system/wizard-previews" import { AccordionPreview, CollapsiblePreview, ScrollAreaPreview, SeparatorPreview, } from "@/components/design-system/layout-previews" import { BreadcrumbPreview, TabsPrimaryVariantsPreview, TabsResponsiveCollapsePreview, TabsSecondaryVariantsPreview, } from "@/components/design-system/navigation-previews" import { AlertDialogPreview, ContextMenuPreview, DialogPreview, DropdownMenuIconPreview, DropdownMenuPreview, DropdownMenuRichPreview, HoverCardPreview, PopoverPreview, TextSelectionToolbarPreview, TipPreview, TooltipPreview, } from "@/components/design-system/overlay-previews" import { AttachmentCountCellPreview, BooleanToggleCellPreview, EmptyCellPreview, FavoriteNameCellPreview, StatusCellPreview, TableNewRowDotPreview, CurrencyCellPreview, ExternalLinkCellPreview, NumericCellPreview, PeopleAvatarRailCellPreview, PillCellPreview, ProgressCellPreview, RatingCellPreview, RelativeTimeCellPreview, RowActionsCellPreview, SignalBarsCellPreview, TagListCellPreview, } from "@/components/design-system/table-cell-previews" const CatalogChartCardVariantPreview = React.lazy(() => import("@/components/catalog-live-previews").then((m) => ({ default: m.CatalogChartCardVariantPreview, })), ) const CatalogLeoSectionTablePreview = React.lazy(() => import("@/components/catalog-live-previews").then((m) => ({ default: m.CatalogLeoSectionTablePreview, })), ) const CatalogRowTypesPreview = React.lazy(() => import("@/components/catalog-live-previews").then((m) => ({ default: m.CatalogRowTypesPreview, })), ) const CatalogDataTablePreview = React.lazy(() => import("@/components/catalog-live-previews").then((m) => ({ default: m.CatalogDataTablePreview, })), ) const CatalogPaginatedTablePreview = React.lazy(() => import("@/components/catalog-live-previews").then((m) => ({ default: m.CatalogPaginatedTablePreview, })), ) const CatalogPageScrollNavPreview = React.lazy(() => import("@/components/catalog-live-previews").then((m) => ({ default: m.CatalogPageScrollNavPreview, })), ) const CatalogRowReorderPreview = React.lazy(() => import("@/components/catalog-live-previews").then((m) => ({ default: m.CatalogRowReorderPreview, })), ) const CatalogHubTablePreview = React.lazy(() => import("@/components/catalog-live-previews").then((m) => ({ default: m.CatalogHubTablePreview, })), ) const CatalogKeyMetricsPreview = React.lazy(() => import("@/components/catalog-live-previews").then((m) => ({ default: m.CatalogKeyMetricsPreview, })), ) const CatalogPageHeaderPreview = React.lazy(() => import("@/components/catalog-live-previews").then((m) => ({ default: m.CatalogPageHeaderPreview, })), ) function SuspendedPreview({ children }: { children: React.ReactNode }) { return {children} } export interface DesignSystemPreviewSection { id: string title: string description?: string bare?: boolean children: React.ReactNode } function section( id: string, title: string, children: React.ReactNode, description?: string, bare?: boolean, ): DesignSystemPreviewSection { return { id, title, description, children, bare } } const PREVIEW_SECTIONS: Record = { // button, avatar, toggle-switch → component-docs/*.tsx "animated-blob-background": [ section("blob-density", "Blob densities", , "Panel and bar blob washes with a thinking toggle."), ], "leo-pulse-border": [ section("pulse-border", "Pulse border", , "Breathing brand perimeter with active and strength controls."), ], "leo-ambient-surface": [ section("ambient-surface", "Ambient surface", , "Ambient wash with thinking and empty or thread toggles."), ], "leo-ambience-settings": [ section("ambience-settings", "Ambience settings", , "Opens the floating settings window with a live readout of the prefs."), ], "ask-leo-composer": [ section("composer", "Composer", , "Animated placeholders and a submit echo."), ], "ask-leo-shell": [ section("shell-schematic", "Docked panel schematic", , "Workspace beside a docked Ask Leo panel."), ], "dedicated-search": [ section("url-composer", "Search composer", , "Search bar that shows the q parameter it would write."), ], "dedicated-search-landing-template": [ section("landing", "Landing template", , "Hero composer with a static recents list."), ], "dedicated-search-results-template": [ section("results", "Results template", , "Results header chrome with placeholder rows."), ], "discovery-hub-template": [ section("hub-schematic", "Discovery hub schematic", , "Centered search command, result rows, and Ask Leo promo."), ], "command-menu": [ section("command-menu-schematic", "Command palette", , "Inline palette: search, Navigate and Actions groups, shortcuts."), ], "data-row-list": [ section("data-row-list-default", "Row list", , "Rows as cards with a click-to-set open-row ring."), ], "finder-panel-view": [ section("finder-panel-view-default", "Finder panel", , "Groups, list, and detail columns."), ], "folder-grid-view": [ section("folder-grid-view-default", "Folder grid", , "Folder tiles built from DS tokens."), ], "list-page-board-card": [ section("board-card-stack-row", "Board card layouts", , "One stack card and two row-layout cards."), ], "list-page-board-template": [ section("board-template-default", "Board columns", , "Pending, Active, and Completed columns with cards."), ], "list-page-template": [ section("list-page-template-schematic", "View tabs shell", , "Header, view tabs, toolbar strip, and row list body."), ], "list-page-tree-panel-shell": [ section("tree-panel-shell-default", "Tree and details", , "Resizable split with outline tree and detail pane."), ], "list-page-view-frame": [ section("view-frame-default", "View frame gutter", , "Centered body outlined to show the gutter."), ], "outline-tree-menu": [ section("outline-tree-menu-default", "Outline tree", , "A folder row with two selectable leaves."), ], "export-drawer": [ section("preview", "Export sheet", , "Title, file name, format choice, and footer actions."), ], "invite-collaborators-drawer": [ section("preview", "Invite sheet", , "Email, access, people with access, footer actions."), ], "exam-lock-template": [ section("preview", "Exam lock frame", , "Timer header, question, options, and navigator."), ], "focus-workflow-template": [ section("preview", "Focus workflow frame", , "Exit header, step progress, form, and pinned footer."), ], "new-focus-template": [ section("preview", "New focus frame", , "Form column with a right-hand inspector."), ], "login-page": [ section("preview", "Sign in frame", , "Centered identifier-step card."), ], "product-marketing-page": [ section("preview", "Marketing page frame", , "Hero, proof stats, gallery, and sticky demo bar."), ], "products-home": [ section("preview", "Products home frame", , "Greeting, product cards, and What's new digest."), ], "dot-pattern": [ section("dot-pattern-glow", "Dot Pattern", , "Glow-masked dot grid behind content."), ], "drag-handle-grip": [ section("drag-handle-grip-list", "Drag Handle Grip", , "Grip on reorderable rows with Alt+Arrow reorder."), ], "horizontal-scroll-controls": [ section("hscroll-controls", "Horizontal Scroll Controls", , "Overflowing chip row with prev and next control."), ], "horizontal-scroll-region": [ section("hscroll-region", "Horizontal Scroll Region", , "View-tab row and an end-aligned breadcrumb row."), ], "resizable": [ section("resizable-split", "Resizable", , "Two-panel group with a handle separator."), ], "nested-secondary-panel-shell": [ section("nested-secondary-panel-shell", "Nested Secondary Panel Shell", , "Resizable rail beside content with an expand toggle."), ], "secondary-hub-nav-primitives": [ section("secondary-hub-nav", "Secondary Hub Nav Primitives", , "Expanded rail and compact icon rail."), ], "secondary-panel-hub-template": [ section("secondary-panel-hub", "Secondary Panel Hub", , "Sidebar, secondary panel, header, page header, body."), ], "settings-form-row": [ section("settings-form-row", "Settings Form Row", , "Label and helper left, control right."), ], "site-header": [ section("site-header", "SiteHeader", , "Breadcrumb bar with a trailing slot."), ], "dropdown-button": [ section("default", "Menu trigger", , "Single trigger that only opens the menu. Variant follows Button hierarchy."), section("split", "Split action", , "Label runs the primary action. The chevron opens alternates."), ], carousel: [ section("default", "Carousel", , "Swipe, arrow keys, or the previous and next buttons."), ], // ── Forms (fallback when component-docs/*.tsx has no sections) ────────── // Form + Input live specs are in forms-family.tsx (takes precedence). form: [ section("field", "Field layouts", , "Vertical and horizontal Field compositions."), section("field-basic", "Basic field", ), section("field-invalid", "Invalid field", ), section("field-disabled", "Disabled field", ), section("field-set", "FieldSet (checkboxes)", ), section("rhf", "react-hook-form", ), ], input: [ section("default", "Input", ), section("textarea", "Textarea", ), section("input-group", "Input group", , "Leading and trailing addons."), section("input-button", "Input with primary action", ), section("password", "Password with validation", ), section("otp", "One time password", ), section("input-mask", "Input mask", , "Phone, ZIP, date, custom."), section("label", "Label", , "Prefer FieldLabel in product forms."), section("slider", "Slider", ), section("payment-card-fields", "Payment card fields", ), ], select: [ section("default", "Item-aligned", ), section("popper", "Popper", ), section("groups", "Groups and separators", ), section("scrollable", "Scrollable list", ), section("states", "Invalid, disabled, and size", ), ], // checkbox → component-docs/checkbox.tsx "radio-group": [ section("default", "Default", ), section("fieldset", "Fieldset", ), section("description", "With description", ), section("choice-card", "Choice card", ), section("invalid", "Invalid", ), section("selection-tile-grid", "Selection tiles", , "Radio/checkbox tile grid."), ], "date-picker": [ section("calendar", "Calendar (label caption)", , "Low-level date grid primitive."), section("calendar-dropdown", "Calendar (dropdown caption)", ), section("calendar-range", "Calendar range (one month)", ), section("calendar-two-month", "Calendar range (two months)", ), section("date-picker", "Date picker field", ), section("date-range", "Date range field", , "One- and two-month popovers."), section("date-text", "Masked date text field", , "DateTextInputField for filters."), ], wizard: [ section("all-variants", "All variants", , "Full matrix for QA — numbered, icons, compact, vertical, error, 8-step scroll."), section("horizontal-numbered", "Horizontal numbered", , "Brand completed · tint active · muted upcoming. Min 12px type."), section("horizontal-icons", "Horizontal icons", , "Icon markers; check replaces icon when done."), section("horizontal-compact", "Horizontal compact", , "Dot rail + Step N of M for dense flows."), section("vertical-numbered", "Vertical numbered", , "Sidebar rail — PatternFly wizard."), section("vertical-icons", "Vertical icons", , "Vertical icon rail with descriptions."), section("error", "Error state", , "Current-step validation failure."), section("many-steps", "Edge case: overflow", , "8-step stress test for scroll + guidance — not a product pattern."), ], // ── Overlays ──────────────────────────────────────────────────────────── dialog: [ section("default", "Default", ), section("alert-dialog", "Alert dialog", , "Destructive / ack with actions."), ], popover: [ section("default", "Default", ), section("hover-card", "Hover card", , "Row identity preview on hover."), ], "dropdown-menu": [ section("default", "Dropdown menu", ), section("rich", "Checkboxes, radios, and submenu", ), section("icon", "Icon trigger", ), section("context-menu", "Context menu", , "Right-click the surface."), section( "selection-toolbar", "Text selection toolbar", , "Select text to show the floating toolbar.", ), ], tip: [ section("default", "Default", , "Product tooltip wrapper; prefer in app code."), section("tooltip", "Tooltip primitive", , "Low-level primitive; Tip is the default."), ], command: [section("default", "Default", )], // ── Navigation ────────────────────────────────────────────────────────── breadcrumb: [section("default", "Default", )], tabs: [ section( "default-variant", "Default variant", , "Pill tablist (`variant` default). Label only, with icon, or with TabsCountBadge.", ), section( "line-variant", "Line variant", , "Underline tablist (`variant=\"line\"`). Same three trigger shapes.", ), section( "responsive-collapse", "Responsive collapse", , "`TabsListScrollRegion` + `TabsTriggerIcon` / `TabsTriggerLabel`, on both variants. Inactive tabs drop to icon only when the labels stop fitting, then whole tabs move into an overflow menu.", ), ], // badge, card, coach-mark, kbd, skeleton → component-docs/*.tsx // ── Layout ────────────────────────────────────────────────────────────── accordion: [ section("default", "Default", ), section("collapsible", "Collapsible", ), ], separator: [ section("default", "Default", ), section("scroll-area", "Scroll area", ), ], // ── Data display ──────────────────────────────────────────────────────── // avatar → component-docs/avatar.tsx // table → component-docs/table.tsx "chart-card": [ section("normal", "Normal", , "Title, description, chart body, Ask Leo on card hover."), section( "tabs", "Tabs", , "Chart and Trend panels. Uses the same line tab chrome as metrics tabs.", ), section("selector", "Selector", , "Header filter select."), section( "metrics-tabs", "Metrics tabs", , "Metric cells are tab triggers.", ), section("kpi-chart", "KPI + chart", , "Hero metric above the chart."), ], // ── Patterns · Data views ─────────────────────────────────────────────── "data-table": [ section("grid", "Core grid", , "Sortable headers, column filters, resize, and drag or keyboard (Alt+←/→) column reorder."), section("pagination", "Pagination", , "DataTablePaginated: page size, range, first / previous / next / last."), section("row-reorder", "Row reorder", , "Opt-in with onRowsReorder: drag the grip, Alt+↑/↓ on it, or its Move menu. Paused while sorted or grouped."), section("leo-section", "Leo adding rows to a section", , "The section is the parent and shows Leo working; the table is its child and adds rows, each with Stop."), section("row-types", "Row types", , "Data, split, and Leo rows (inited, thinking, completed), one or two rows each."), section("hub-table", "HubTable", , "useTableState + toolbar + Properties."), section( "bulk-actions", "Bulk action bar", , "Floating bar when rows are selected; Esc clears.", ), ], "page-scroll-nav": [ section("demo", "Back to top and outline", , "Mounted once by PrimaryPageTemplate, so every page gets it. Mark sections with data-outline-section; three or more shows the outline."), ], "key-metrics": [section("variants", "Flat, card strip, and metric cards", )], "page-header": [section("default", "Hub header", )], // ── Table cells ───────────────────────────────────────────────────────── "table-cells": [ section("progress-cell", "Progress", ), section("currency-cell", "Currency", ), section("numeric-cell", "Numeric", ), section("rating-cell", "Rating", ), section("signal-bars-cell", "Signal bars", ), section("status-cell", "Status", ), section("table-new-row-dot", "New row", ), section("favorite-name-cell", "Name + favorite", ), section("empty-cell", "Empty value", ), section("boolean-toggle-cell", "Boolean toggle", ), section("pill-cell", "Pill", ), section("tag-list-cell", "Tag list", ), section("people-avatar-rail-cell", "People rail", ), section("external-link-cell", "External link", ), section("relative-time-cell", "Relative time", ), section("attachment-count-cell", "Attachment count", ), section("row-actions-cell", "Row actions", ), ], } export function getDesignSystemPreviewSections(slug: string): DesignSystemPreviewSection[] | null { const sections = PREVIEW_SECTIONS[slug] return sections && sections.length > 0 ? sections : null } export function DesignSystemPreviewSections({ slug }: { slug: string }) { const sections = getDesignSystemPreviewSections(slug) if (!sections) return null const wideCanvas = designSystemPreviewIsWide(slug) return (
{sections.map((block) => (
{block.bare ? null : (

{block.title}

)} {block.children}
))}
) } export { designSystemHasLivePreview } from "@/components/design-system/design-system-preview-meta"