An open source design system that's fully customizable and agent ready
TypeScript
docsite: add dedicated /themes/<name> pages with per-theme previews (#2421)
rubyycheung7e30f508387d
diff --git a/apps/docsite/public/neutral/preview-backpack.png b/apps/docsite/public/neutral/preview-backpack.pngnew file mode 100644index 0000000000..673dcb78f9Binary files /dev/null and b/apps/docsite/public/neutral/preview-backpack.png differdiff --git a/apps/docsite/public/neutral/preview-headphones.png b/apps/docsite/public/neutral/preview-headphones.pngnew file mode 100644index 0000000000..4339238aa6Binary files /dev/null and b/apps/docsite/public/neutral/preview-headphones.png differdiff --git a/apps/docsite/public/neutral/preview-mug.png b/apps/docsite/public/neutral/preview-mug.pngnew file mode 100644index 0000000000..391aa74cdaBinary files /dev/null and b/apps/docsite/public/neutral/preview-mug.png differdiff --git a/apps/docsite/public/neutral/preview-throw.png b/apps/docsite/public/neutral/preview-throw.pngnew file mode 100644index 0000000000..8b6c6d8dbbBinary files /dev/null and b/apps/docsite/public/neutral/preview-throw.png differdiff --git a/apps/docsite/public/neutral/preview-wallet.png b/apps/docsite/public/neutral/preview-wallet.pngnew file mode 100644index 0000000000..99040320afBinary files /dev/null and b/apps/docsite/public/neutral/preview-wallet.png differdiff --git a/apps/docsite/public/neutral/preview-watch.png b/apps/docsite/public/neutral/preview-watch.pngnew file mode 100644index 0000000000..6930b32b54Binary files /dev/null and b/apps/docsite/public/neutral/preview-watch.png differdiff --git a/apps/docsite/src/app/(docs)/packages/[name]/page.tsx b/apps/docsite/src/app/(docs)/packages/[name]/page.tsxindex bc98ac3096..dc72cb9b1a 100644--- a/apps/docsite/src/app/(docs)/packages/[name]/page.tsx+++ b/apps/docsite/src/app/(docs)/packages/[name]/page.tsx@@ -4,11 +4,12 @@* Page type: package* Adapts based on the package type:* - component-pkg (@xds/core): component grid from componentRegistry- * - theme-pkg (@xds/theme-*): live theme preview with light/dark toggle+ * - theme-pkg (@xds/theme-*): redirects to the canonical /themes/<name>+ * page on the themes side of the site (one URL per theme).* - generic (@xds/cli, etc.): README rendered via XDSMarkdown*/-import {notFound} from 'next/navigation';+import {notFound, redirect} from 'next/navigation';import {XDSHeading, XDSText} from '@xds/core/Text';import {XDSVStack} from '@xds/core/Layout';import {XDSSection} from '@xds/core/Section';@@ -19,10 +20,7 @@ import {groupedComponents,type ComponentItem,} from '../../../../generated/groupedComponentRegistry';-import {- ThemePackagePage,- type InstallStep,-} from '../../../../components/ThemePackagePage';+import {type InstallStep} from './PackageHeading';import {themeObjects} from '../../../../generated/themeRegistry';import {PackageHeading} from './PackageHeading';import {PackageStubPage} from './PackageStubPage';@@ -86,22 +84,14 @@ export default async function PackagePage({const isComponentPkg = pkg.name === '@xds/core';const grouped = groupedComponents[pkg.name];- if (isTheme) {- const theme = themeObjects[pkg.name];- if (theme) {- return (- <XDSSection maxWidth="lg" padding={6}>- <ThemePackagePage- name={pkg.name}- description={pkg.description}- version={pkg.version}- readme={pkg.readme}- installSteps={getInstallSteps(pkg.name)}- theme={theme}- />- </XDSSection>- );- }+ // Theme packages live on /themes/<name> — the canonical surface for+ // each theme, hosting the full ThemeShowcasePreview alongside the+ // install affordance and README. Redirect every /packages/theme-*+ // hit (incoming links, search results, bookmarks) to that page so+ // there is one URL per theme.+ if (isTheme && themeObjects[pkg.name]) {+ const themeSlug = pkg.name.replace('@xds/theme-', '');+ redirect(`/themes/${themeSlug}`);}if (!isComponentPkg) {diff --git a/apps/docsite/src/app/(site)/layout.module.css b/apps/docsite/src/app/(site)/layout.module.cssnew file mode 100644index 0000000000..ff97a21a9b--- /dev/null+++ b/apps/docsite/src/app/(site)/layout.module.css@@ -0,0 +1,30 @@+/* Copyright (c) Meta Platforms, Inc. and affiliates. */++/* Make the marketing-site (site)-group layout a flex column so the+ <SiteFooter /> sticks to the bottom of the viewport when page+ content is shorter than one screen. Without this, short pages+ like /themes leave a visible gap between the footer and the+ bottom of the viewport.++ The min-height subtracts the AppShell header height (set as a CSS+ var by the AppShell once it measures the rendered header,+ falling back to 64px on first paint per the convention used in+ globals.css for #xds-app-shell-main scroll-padding-top). */+.shell {+ display: flex;+ flex-direction: column;+ min-height: calc(100vh - var(--appshell-header-height, 64px));+ width: 100%;+}++/* Stretch the main content area so the footer pins to the bottom on+ short pages. Critically, this is NOT a flex container — making it+ a flex container interacts poorly with XDSSection's outer wrapper+ (which uses negative inline margins to break out of container+ padding) and ends up squishing the section to its min-content+ width. The simple `flex: 1` on a non-flex block is enough to push+ <SiteFooter /> to the bottom of .shell. */+.main {+ flex: 1 0 auto;+ width: 100%;+}diff --git a/apps/docsite/src/app/(site)/layout.tsx b/apps/docsite/src/app/(site)/layout.tsxindex 991a08ff8a..7c0846a9bd 100644--- a/apps/docsite/src/app/(site)/layout.tsx+++ b/apps/docsite/src/app/(site)/layout.tsx@@ -4,6 +4,7 @@ import {headers} from 'next/headers';import {XDSAppShell} from '@xds/core/AppShell';import {SharedTopNav} from '../../components/SharedTopNav';import {SiteFooter} from '../../components/SiteFooter';+import styles from './layout.module.css';export default async function MarketingLayout({children,@@ -20,8 +21,10 @@ export default async function MarketingLayout({height="auto"mobileNav={{defaultIsMobile}}topNav={<SharedTopNav />}>- {children}- <SiteFooter />+ <div className={styles.shell}>+ <div className={styles.main}>{children}</div>+ <SiteFooter />+ </div></XDSAppShell>);}diff --git a/apps/docsite/src/app/(site)/themes/[name]/page.tsx b/apps/docsite/src/app/(site)/themes/[name]/page.tsxnew file mode 100644index 0000000000..b8b6769452--- /dev/null+++ b/apps/docsite/src/app/(site)/themes/[name]/page.tsx@@ -0,0 +1,66 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * Dedicated theme page — /themes/<name>+ *+ * Each XDS theme (@xds/theme-*) gets a canonical page on the themes+ * side of the site that hosts the full live ThemeShowcasePreview+ * (top nav + hero + product grid + table + components). The+ * light/dark mode toggle lives in the page header beside the+ * Install button so the preview surface stays uncluttered. This is+ * the destination for the "Preview" affordance on the /themes+ * gallery cards.+ *+ * The /packages/theme-* route redirects here so there is a single+ * canonical URL per theme (see (docs)/packages/[name]/page.tsx).+ */++import {notFound} from 'next/navigation';+import {XDSSection} from '@xds/core/Section';+import {packages} from '../../../../generated/packageRegistry';+import {themeObjects} from '../../../../generated/themeRegistry';+import {ThemePackagePage} from '../../../../components/ThemePackagePage';++function slugToPackageName(slug: string): string {+ return `@xds/theme-${slug}`;+}++export function generateStaticParams() {+ return packages+ .filter(p => p.name.startsWith('@xds/theme-'))+ .map(p => ({name: p.name.replace('@xds/theme-', '')}));+}++export default async function ThemePage({+ params,+}: {+ params: Promise<{name: string}>;+}) {+ const {name: slug} = await params;+ const pkgName = slugToPackageName(slug);+ const pkg = packages.find(p => p.name === pkgName);+ const theme = themeObjects[pkgName];+ if (!pkg || !theme) {+ notFound();+ }++ // Vanity title: strip the trailing " Theme" suffix from displayName+ // so the title reads as a brand-style wordmark ("Neutral", "Butter",+ // "Y2K") rather than the redundant "Neutral Theme" on a page that's+ // already, by definition, about a theme. Falls back to displayName+ // verbatim if the suffix isn't present (e.g. legacy entries).+ const vanityTitle = pkg.displayName.replace(/\s*Theme$/i, '').trim();++ return (+ <XDSSection maxWidth="lg" padding={6}>+ <ThemePackagePage+ title={vanityTitle || pkg.displayName}+ packageName={pkg.name}+ description={pkg.description}+ version={pkg.version}+ readme={pkg.readme}+ theme={theme}+ />+ </XDSSection>+ );+}diff --git a/apps/docsite/src/app/globals.css b/apps/docsite/src/app/globals.cssindex 6f7420a87d..983bbcd8c5 100644--- a/apps/docsite/src/app/globals.css+++ b/apps/docsite/src/app/globals.css@@ -63,3 +63,14 @@ body:has([data-home-page]) .xds-top-nav {body[data-nav-mode='surface'] .xds-top-nav {background: color-mix(in srgb, var(--color-background-surface) 80%, transparent);}++/* The /themes/<name> dedicated page renders a faux app top nav INSIDE+ its preview surface. The global `.xds-top-nav` rule above gives it a+ surface-tinted frosted background, which leaks through and makes the+ preview's nav look distinct from its themed body. Scope it back to+ the theme's body color so the preview reads as one continuous app+ surface. */+[data-theme-preview='true'] .xds-top-nav {+ background: var(--color-background-body);+ backdrop-filter: none;+}diff --git a/apps/docsite/src/components/ThemeCardShowcase.tsx b/apps/docsite/src/components/ThemeCardShowcase.tsxnew file mode 100644index 0000000000..f0f3979480--- /dev/null+++ b/apps/docsite/src/components/ThemeCardShowcase.tsx@@ -0,0 +1,1243 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++'use client';++/**+ * Real-world card showcase for a theme.+ *+ * Three realistic product surfaces rendered with the theme's components+ * — meant to demonstrate how the theme behaves in compositions people+ * actually build (stats card, task card, profile card) rather than as+ * an abstract sample-each-component list.+ *+ * Lives outside the live ThemeShowcasePreview card on the dedicated+ * /themes/<name> page. Always renders in light mode regardless of+ * the page-header toggle, so the cards work as a static reference.+ */++import {type ReactNode} from 'react';+import * as stylex from '@stylexjs/stylex';+import {+ PlusIcon,+ MagnifyingGlassIcon,+ TagIcon,+ FolderIcon,+ MapPinIcon,+ ListBulletIcon,+ Squares2X2Icon,+ ShoppingBagIcon,+ BanknotesIcon,+ MicrophoneIcon,+ CreditCardIcon,+ LockClosedIcon,+ XMarkIcon,+ ArrowDownTrayIcon,+ DevicePhoneMobileIcon,+ WalletIcon,+} from '@heroicons/react/24/outline';+import {XDSText, XDSHeading} from '@xds/core/Text';+import {XDSVStack, XDSHStack} from '@xds/core/Layout';+import {XDSGrid, XDSGridSpan} from '@xds/core/Grid';+import {XDSCard} from '@xds/core/Card';+import {XDSButton} from '@xds/core/Button';+import {XDSLink} from '@xds/core/Link';+import {XDSBadge} from '@xds/core/Badge';+import {XDSBanner} from '@xds/core/Banner';+import {XDSDivider} from '@xds/core/Divider';+import {XDSCheckboxInput} from '@xds/core/CheckboxInput';+import {XDSItem} from '@xds/core/Item';+import {XDSTable, proportional, pixel} from '@xds/core/Table';+import {XDSTextInput} from '@xds/core/TextInput';+import {XDSSelector} from '@xds/core/Selector';+import {XDSRadioList, XDSRadioListItem} from '@xds/core/RadioList';+import {XDSSelectableCard} from '@xds/core/SelectableCard';+import {XDSMoreMenu} from '@xds/core/MoreMenu';+import {+ XDSChatComposer,+ XDSChatMessage,+ XDSChatMessageBubble,+ XDSChatMessageList,+ XDSChatSystemMessage,+} from '@xds/core/Chat';+import {XDSTheme} from '@xds/core/theme';+import type {XDSDefinedTheme} from '@xds/core/theme';+import type {ThemeImageSet} from './themeImages';++const styles = stylex.create({+ // Each card paints the theme's body color so the showcase reads as+ // a coherent product surface against the docsite's chrome.+ // Border is forced transparent so the cards float on the surface+ // chrome without visible chrome of their own.+ card: {+ backgroundColor: 'var(--color-background-body)',+ color: 'var(--color-text-primary)',+ minWidth: 0,+ borderColor: 'transparent',+ },+ // Nested flex columns inherit `min-width: auto` which equals+ // content-min-width — causing form inputs to overflow the card+ // at narrow viewports. Force min-width: 0 + width: 100% so the+ // stack always respects the parent's available width and lets+ // its children (XDSTextInput, etc.) shrink with it.+ checkoutStack: {+ minWidth: 0,+ width: '100%',+ },+ // Content inside a payment-method SelectableCard. Constrains the+ // inner stack to the card's available width and wraps long+ // labels (e.g. "Apple Pay", "Google Pay") to a second line+ // instead of overflowing the card boundary at narrow widths.+ paymentCardContent: {+ minWidth: 0,+ width: '100%',+ textAlign: 'center',+ wordBreak: 'break-word',+ },+ // KNOWN-GAP (XDSGridSpan): when an auto-fit XDSGrid produces+ // fewer tracks than an XDSGridSpan claims, the span keeps its+ // original count and leaves empty tracks beside smaller cards+ // (e.g. Chat claims 2-of-3, but if only 2 tracks fit, Checkout+ // ends up alone on its row with one empty track beside it).+ // Forcing every span to `grid-column: 1 / -1` below 1024px (the+ // threshold where the worst-case 4-track + 3-gap layout stops+ // fitting) collapses each row to a single column at narrow+ // widths so cards always reach the row edge.+ //+ // Ideally XDSGridSpan would clamp `span N` to the available+ // track count automatically; until that lands in @xds/core,+ // this xstyle is the load-bearing workaround for both grid rows+ // below.+ fullSpanAtNarrow: {+ gridColumn: {+ default: null,+ '@media (max-width: 1024px)': '1 / -1',+ },+ },+ // Inventory card uses padding={0} since the header, filter row,+ // and table each own their own padding. Background uses --color-+ // background-surface (the lifted-above-body tone) so the inventory+ // reads as a distinct interactive surface against the page chrome.+ // Keeps the XDSCard default variant's border (via --color-border-+ // emphasized) so it reads as a bordered card.+ inventoryCard: {+ backgroundColor: 'var(--color-background-surface)',+ color: 'var(--color-text-primary)',+ overflow: 'hidden',+ },+ inventoryHeader: {+ paddingBlock: 'var(--spacing-6)',+ paddingInline: 'var(--spacing-6)',+ },+ inventoryFilterRow: {+ paddingBlock: 'var(--spacing-4)',+ paddingInline: 'var(--spacing-6)',+ width: '100%',+ },+ // Wraps the low-stock XDSBanner above the table so it inherits the+ // table's horizontal padding rather than running edge-to-edge.+ inventoryBannerWrap: {+ paddingInline: 'var(--spacing-6)',+ paddingBottom: 'var(--spacing-4)',+ },+ searchInput: {+ flex: 1,+ minWidth: 0,+ maxWidth: 240,+ },+ // Square thumbnail used in the Item column. Falls back to a+ // colored letter chip via styles.thumbnailFallback when no image+ // is provided.+ thumbnail: {+ width: 32,+ height: 32,+ borderRadius: 'var(--radius-element)',+ objectFit: 'cover' as const,+ display: 'block',+ flexShrink: 0,+ },+ thumbnailFallback: {+ width: 32,+ height: 32,+ borderRadius: 'var(--radius-element)',+ backgroundColor: 'var(--color-background-muted)',+ color: 'var(--color-text-secondary)',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ fontSize: 'var(--font-size-sm)',+ fontWeight: 600,+ flexShrink: 0,+ },+ // Latest activity card uses surface bg so it reads as a distinct+ // analytics surface beside Inventory (which also uses surface).+ activityCard: {+ backgroundColor: 'var(--color-background-surface)',+ color: 'var(--color-text-primary)',+ minWidth: 0,+ height: '100%',+ },+ // Hand-rolled sparkline — 5 vertical bars rendered as flex children.+ // Theme-aware fill uses --color-success for the on-trend green tone+ // (matches the categorical "green" badge palette used elsewhere).+ // Each bar's height is set inline via --bar-h percentage.+ sparkline: {+ display: 'flex',+ alignItems: 'flex-end',+ justifyContent: 'space-around',+ height: 120,+ width: '100%',+ gap: 8,+ },+ sparkBar: {+ flex: 1,+ minWidth: 0,+ borderRadius: 'var(--radius-element)',+ // Categorical green background tint — the soft pastel surface+ // stop, not the saturated icon/text stop. Reads as a quiet+ // chart fill rather than an alert/status color.+ backgroundColor: 'var(--color-background-green)',+ // Bar height comes from inline `height` style per bar.+ },+ sparkLabels: {+ display: 'flex',+ justifyContent: 'space-around',+ width: '100%',+ color: 'var(--color-text-secondary)',+ fontSize: 'var(--font-size-xs)',+ },+ // Big KPI value (e.g. "18K"). Uses the theme's heading font so it+ // tracks the theme's typography decisions.+ kpiValue: {+ fontSize: 24,+ fontWeight: 700,+ lineHeight: 1.1,+ color: 'var(--color-text-primary)',+ fontFamily: 'var(--font-family-heading)',+ letterSpacing: '-0.01em',+ },+ // Chat card uses padding={0} since the header, message list, and+ // composer each own their own padding. Uses surface bg to match+ // the chat-app pattern people expect (chat surfaces typically+ // lift above body to read as a focused conversation panel).+ chatCard: {+ backgroundColor: 'var(--color-background-surface)',+ color: 'var(--color-text-primary)',+ minWidth: 0,+ overflow: 'hidden',+ display: 'flex',+ flexDirection: 'column' as const,+ },+ // Chat header — avatar + name + status row pinned to the top of+ // the card. Sits flush above the message canvas divider.+ chatHeader: {+ paddingBlock: 'var(--spacing-4)',+ paddingInline: 'var(--spacing-4)',+ },+ // Body wraps XDSChatMessageList in a flex-grow cell so the list+ // expands to fill the card. The list owns its own internal+ // padding (density-based, balanced = spacing-4), so we don't add+ // any here — otherwise the first message ends up double-padded+ // away from the header divider.+ chatBody: {+ flex: 1,+ minHeight: 0,+ overflow: 'hidden',+ },+ // Suggested-question chips above the composer. Centered so the+ // chips feel like a "tap one of these" affordance rather than a+ // left-aligned toolbar. Same horizontal padding as the composer+ // for visual alignment.+ chatSuggestions: {+ paddingInline: 'var(--spacing-4)',+ paddingBottom: 'var(--spacing-2)',+ },+ chatComposer: {+ paddingInline: 'var(--spacing-4)',+ paddingBottom: 'var(--spacing-4)',+ },+ // Compact activity row icon — circular muted disc holding a heroicon.+ activityIcon: {+ width: 32,+ height: 32,+ borderRadius: 'var(--radius-full)',+ backgroundColor: 'var(--color-background-muted)',+ color: 'var(--color-text-secondary)',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ flexShrink: 0,+ },+ // Negative inline margin to cancel out XDSItem's --spacing-2+ // internal padding so item content sits flush with the heading+ // above. The item's hover/focus background still extends+ // correctly because the padding is preserved on each row.+ itemListFlush: {+ marginInline: 'calc(var(--spacing-2) * -1)',+ },+ // Lets the outer card content stack fill the full card height+ // so the activity list flex:1 child can absorb the remaining+ // space below the chart + KPI summary + activity heading.+ activityCardStack: {+ height: '100%',+ },+ // Activity list fills remaining vertical space in the card,+ // clips overflow, and fades the bottom edge so longer feeds+ // visually suggest "more below" without rendering a scrollbar.+ // The mask-image is the same value applied to both standard+ // and -webkit- properties for Safari compatibility.+ activityListFade: {+ flex: 1,+ minHeight: 0,+ overflow: 'hidden',+ maskImage:+ 'linear-gradient(to bottom, black calc(100% - 48px), transparent)',+ WebkitMaskImage:+ 'linear-gradient(to bottom, black calc(100% - 48px), transparent)',+ marginInline: 'calc(var(--spacing-2) * -1)',+ },+});++interface ThemeCardShowcaseProps {+ theme: XDSDefinedTheme;+ images: ThemeImageSet;+ /**+ * Color mode forwarded from ThemePackagePage's mode toggle in the+ * floating footer. Lets the inventory + checkout + top customers+ * cards flip light/dark in sync with the live preview above.+ */+ mode: 'light' | 'dark';+}++export function ThemeCardShowcase({+ theme,+ images,+ mode,+}: ThemeCardShowcaseProps) {+ return (+ <XDSTheme theme={theme} mode={mode}>+ <XDSVStack gap={8}>+ {/* Top row: Checkout (1/3) + Chat (2/3) via XDSGridSpan.+ Uses `repeat: 'fit'` so when the viewport is too narrow+ to fit 3 tracks of at least 200px, the remaining tracks+ collapse and the occupied ones stretch to fill the row+ edge-to-edge. NOTE: no `max` cap here — capping the+ track-max forces each cell to `(100% - gaps) / max`,+ which prevents auto-fit from stretching cells beyond+ that fraction at narrow widths (the cards would never+ fill the full row even with one card per row). */}+ <XDSGrid columns={{minWidth: 200, repeat: 'fit'}} gap={4}>+ <XDSGridSpan columns={1} xstyle={styles.fullSpanAtNarrow}>+ <CheckoutCard />+ </XDSGridSpan>+ <XDSGridSpan columns={2} xstyle={styles.fullSpanAtNarrow}>+ <ChatCard />+ </XDSGridSpan>+ </XDSGrid>+ {/* Bottom row: Inventory (3 cols) + Latest activity sidebar+ (1 col). `repeat: 'fit'` (auto-fit) stretches occupied+ tracks to fill the row when columns collapse at narrow+ viewports — same reasoning as the top row: no `max`+ cap so cells can stretch beyond the (100% / max)+ fraction when only one card per row fits. */}+ <XDSGrid columns={{minWidth: 200, repeat: 'fit'}} gap={4}>+ <XDSGridSpan columns={3} xstyle={styles.fullSpanAtNarrow}>+ <InventoryCard images={images} />+ </XDSGridSpan>+ <XDSGridSpan columns={1} xstyle={styles.fullSpanAtNarrow}>+ <LatestActivityCard />+ </XDSGridSpan>+ </XDSGrid>+ </XDSVStack>+ </XDSTheme>+ );+}++// =============================================================================+// Card 4 — Checkout form+// Components exercised: heading + supporting subtitle, XDSTextInput+// (email), XDSTextInput with startIcon (card number), 2-column grid+// for expiry + CVC, XDSSelector (country dropdown), full-width+// primary button with leading icon. Demonstrates a realistic+// multi-input form composition.+// =============================================================================++function CheckoutCard() {+ return (+ <XDSCard padding={5} xstyle={styles.card}>+ <XDSVStack gap={4} xstyle={styles.checkoutStack}>+ <XDSHeading level={2}>Checkout</XDSHeading>++ <XDSVStack gap={3} xstyle={styles.checkoutStack}>+ <XDSTextInput+ label="Email"+ placeholder="[email protected]"+ value=""+ onChange={() => {}}+ size="lg"+ />++ {/* Shipping method picker — vertical radio list. Each+ row pairs a label + a per-row helper description with+ a trailing price in endContent so the price reads+ right-aligned (typical shipping-options layout). The+ group itself has a `description` for the universal+ caveat under all three options. Static demo: value is+ hard-coded to "economy"; tapping other rows does+ nothing. */}+ <XDSRadioList+ label="Shipping method"+ description="Delivery time may vary based on location and availability."+ value="economy"+ onChange={() => {}}>+ <XDSRadioListItem+ value="economy"+ label="Economy Shipping"+ description="Delivered in 5–7 business days"+ endContent={+ <XDSText type="body" weight="bold">+ $12.00+ </XDSText>+ }+ />+ <XDSRadioListItem+ value="standard"+ label="Standard Shipping"+ description="Delivered in 3–5 business days"+ endContent={+ <XDSText type="body" weight="bold">+ $16.00+ </XDSText>+ }+ />+ <XDSRadioListItem+ value="express"+ label="Express Shipping"+ description="Delivered in 1–2 business days"+ endContent={+ <XDSText type="body" weight="bold">+ $24.00+ </XDSText>+ }+ />+ </XDSRadioList>++ {/* Payment method picker — 3 horizontal XDSSelectableCards+ in an equal-width grid. Each card has a centered icon+ above a short label. Selected card gets the built-in+ accent border treatment. Static demo: "card" is hard-+ coded selected; tapping other cards does nothing.+ Uses the responsive {minWidth, max} grid pattern so+ cards collapse to fewer columns when the Checkout+ column itself is too narrow to fit 3 abreast. */}+ <XDSVStack gap={2} xstyle={styles.checkoutStack}>+ <XDSText type="supporting" weight="bold">+ Payment method+ </XDSText>+ <XDSGrid columns={{minWidth: 70, max: 3}} gap={2}>+ <XDSSelectableCard+ label="Pay with card"+ isSelected={true}+ onChange={() => {}}+ padding={3}>+ <XDSVStack+ gap={1}+ hAlign="center"+ xstyle={styles.paymentCardContent}>+ <CreditCardIcon width={20} height={20} />+ <XDSText type="supporting" weight="bold">+ Card+ </XDSText>+ </XDSVStack>+ </XDSSelectableCard>+ <XDSSelectableCard+ label="Pay with Apple Pay"+ isSelected={false}+ onChange={() => {}}+ padding={3}>+ <XDSVStack+ gap={1}+ hAlign="center"+ xstyle={styles.paymentCardContent}>+ <DevicePhoneMobileIcon width={20} height={20} />+ <XDSText type="supporting" weight="bold">+ Apple Pay+ </XDSText>+ </XDSVStack>+ </XDSSelectableCard>+ <XDSSelectableCard+ label="Pay with Google Pay"+ isSelected={false}+ onChange={() => {}}+ padding={3}>+ <XDSVStack+ gap={1}+ hAlign="center"+ xstyle={styles.paymentCardContent}>+ <WalletIcon width={20} height={20} />+ <XDSText type="supporting" weight="bold">+ Google Pay+ </XDSText>+ </XDSVStack>+ </XDSSelectableCard>+ </XDSGrid>+ </XDSVStack>++ <XDSTextInput+ label="Card number"+ placeholder="1234 1234 1234 1234"+ value=""+ onChange={() => {}}+ startIcon={<CreditCardIcon width={16} height={16} />}+ size="lg"+ />++ {/* Expiry + CVC in a responsive 2-col grid. At narrow+ widths (Checkout column shrinks below the+ {minWidth: 90} threshold per cell) the grid collapses+ to a single column stack so neither input clips past+ the card edge. */}+ <XDSGrid columns={{minWidth: 90, max: 2}} gap={2}>+ <XDSTextInput+ label="Expiry"+ placeholder="MM / YY"+ value=""+ onChange={() => {}}+ size="lg"+ />+ <XDSTextInput+ label="CVC"+ placeholder="123"+ value=""+ onChange={() => {}}+ size="lg"+ />+ </XDSGrid>++ {/* Country — XDSSelector (dropdown). */}+ <XDSSelector+ label="Country"+ value="us"+ onChange={() => {}}+ size="lg"+ options={[+ {value: 'us', label: 'United States'},+ {value: 'ca', label: 'Canada'},+ {value: 'uk', label: 'United Kingdom'},+ {value: 'de', label: 'Germany'},+ {value: 'jp', label: 'Japan'},+ {value: 'au', label: 'Australia'},+ ]}+ />+ </XDSVStack>++ {/* 1-click checkout opt-in — pre-checked, with a helper+ description underneath. Uses XDSCheckboxInput's built-in+ `description` slot rather than hand-stacking a second+ text row, so the helper inherits the right indentation+ and secondary text color from the primitive. */}+ <XDSCheckboxInput+ label="Securely save my information for 1-click checkout"+ description="Pay faster on Studio and everywhere Link is accepted."+ value={true}+ onChange={() => {}}+ />++ <XDSButton+ variant="primary"+ size="lg"+ label="Pay now"+ icon={<LockClosedIcon width={16} height={16} />}+ />+ </XDSVStack>+ </XDSCard>+ );+}++// =============================================================================+// Card 5 — Chat+//+// Compact chat surface modeled after a typical product messaging UI.+// Header has avatar + name + status, followed by a short message+// thread (date divider + 4 alternating-sender bubbles), and an+// XDSChatComposer at the bottom. All built from real XDS chat+// primitives (XDSChatMessage, XDSChatMessageBubble, XDSChatMessageList,+// XDSChatSystemMessage, XDSChatComposer) so the showcase demonstrates+// theme tokens flowing through the full chat surface.+// =============================================================================++const SUGGESTED_QUESTIONS = [+ 'Reschedule delivery',+ 'Update shipping address',+ 'Start a return',+];++// Copilot-style canvas: bare user prompt (filled, right-aligned) ++// plain-prose assistant response (ghost, flat) + a rich composer+// with attach / mode picker / voice icon. No avatar header — the+// canvas IS the surface, not a conversation window.+function ChatCard() {+ return (+ <XDSCard padding={0} xstyle={styles.chatCard}>+ {/* Header — heading on the left, action chrome (Export, Close)+ on the right. Uses level=2 so it matches the heading scale+ of the other cards (Inventory, Revenue, Checkout). Common+ chat-panel pattern where the surface owns its own dismiss+ and export affordances. */}+ <XDSHStack+ hAlign="between"+ vAlign="center"+ gap={3}+ xstyle={styles.chatHeader}>+ <XDSHeading level={2}>Studio AI</XDSHeading>++ <XDSHStack gap={1} vAlign="center">+ <XDSButton+ variant="ghost"+ size="sm"+ isIconOnly+ label="Export conversation"+ icon={<ArrowDownTrayIcon width={16} height={16} />}+ />+ <XDSButton+ variant="ghost"+ size="sm"+ isIconOnly+ label="Close chat"+ icon={<XMarkIcon width={16} height={16} />}+ />+ </XDSHStack>+ </XDSHStack>++ <XDSDivider variant="subtle" />++ {/* Message canvas — wider Copilot-style layout. Thread is a+ multi-turn concierge session about order #1043, with a+ "Today" system divider at the top and one structured-data+ block (compact order summary rendered as XDSItem rows+ with a trailing track-package link). */}+ <div {...stylex.props(styles.chatBody)}>+ <XDSChatMessageList>+ <XDSChatSystemMessage>Today</XDSChatSystemMessage>++ <XDSChatMessage sender="user">+ <XDSChatMessageBubble variant="filled">+ Where’s my order?+ </XDSChatMessageBubble>+ </XDSChatMessage>++ <XDSChatMessage sender="assistant">+ <XDSVStack gap={3}>+ <XDSText type="body">+ Your order #1043 — the Minimalist Watch and Linen Throw —+ shipped this morning from the Aisle 3 warehouse and is currently+ in transit with UPS. It’s on track to arrive at your address by+ end of day tomorrow.+ </XDSText>+ <XDSText type="body">+ Let me know if you’d like to reschedule the delivery, redirect+ it to a pickup point, or start a return once it arrives.+ </XDSText>+ </XDSVStack>+ </XDSChatMessage>++ <XDSChatMessage sender="user">+ <XDSChatMessageBubble variant="filled">+ Can you show me the full details?+ </XDSChatMessageBubble>+ </XDSChatMessage>++ <XDSChatMessage sender="assistant">+ <XDSVStack gap={3}>+ <XDSText type="body">+ Here’s everything I have on order #1043:+ </XDSText>+ {/* Compact order-summary block — XDSItem rows give+ a label/description + trailing value pair without+ any custom layout code. Wrapped in XDSCard so the+ block reads as a distinct artifact within the+ prose, similar to a Copilot tool-call result. */}+ <XDSCard padding={3}>+ <XDSVStack gap={1}>+ <XDSItem+ label="Items"+ description="Minimalist Watch · Linen Throw"+ trailing={+ <XDSText type="body" weight="bold">+ $248+ </XDSText>+ }+ />+ <XDSItem+ label="Shipping"+ description="UPS Ground"+ trailing={+ <XDSText type="body" weight="bold">+ $12+ </XDSText>+ }+ />+ <XDSItem+ label="Estimated arrival"+ description="Tomorrow by 8pm"+ trailing={<XDSBadge variant="green" label="On time" />}+ />+ <XDSItem+ label="Tracking"+ description="UPS 1Z 999 AA1 0123 4567 84"+ trailing={<XDSLink href="#">Track →</XDSLink>}+ />+ </XDSVStack>+ </XDSCard>+ </XDSVStack>+ </XDSChatMessage>+ </XDSChatMessageList>+ </div>++ {/* Suggested follow-up questions — quick chips above composer.+ Centered so they read as "tap one of these" affordances+ rather than a left-anchored toolbar. Static demo: no real+ send wiring; tapping does nothing. */}+ <div {...stylex.props(styles.chatSuggestions)}>+ <XDSHStack gap={1} hAlign="center" wrap="wrap">+ {SUGGESTED_QUESTIONS.map(question => (+ <XDSButton+ key={question}+ variant="secondary"+ size="sm"+ label={question}+ />+ ))}+ </XDSHStack>+ </div>++ {/* Composer — full Copilot pattern via XDSChatComposer slots:+ footerActions = attach + Smart mode picker+ sendActions = voice/dictation icon */}+ <div {...stylex.props(styles.chatComposer)}>+ <XDSChatComposer+ value=""+ onChange={() => {}}+ onSubmit={() => {}}+ placeholder="Ask Studio AI…"+ footerActions={+ <XDSButton+ variant="ghost"+ size="md"+ isIconOnly+ label="Attach"+ icon={<PlusIcon width={16} height={16} />}+ />+ }+ sendActions={+ <XDSButton+ variant="ghost"+ size="md"+ isIconOnly+ label="Voice input"+ icon={<MicrophoneIcon width={16} height={16} />}+ />+ }+ />+ </div>+ </XDSCard>+ );+}++// =============================================================================+// Card 7 — Latest activity (sidebar beside Inventory)+//+// Vertical analytics sidebar that sits to the right of the Inventory+// card. Tops out with a small CSS-only sparkline (5 bars, no chart+// library) + a "Monthly" badge, two KPI summary numbers below the+// chart, then a 4-item activity feed at the bottom.+//+// Components exercised: XDSCard (surface bg), XDSHeading, XDSBadge+// (categorical), XDSItem (avatar + label + description rows),+// XDSDivider, XDSLink, hand-rolled CSS sparkline.+// =============================================================================++const SPARKLINE_DATA = [55, 70, 92, 78, 60];+const SPARKLINE_LABELS = ['Jan', 'Feb', 'Mar', 'Apr', 'May'];++interface ActivityRow {+ id: string;+ icon: ReactNode;+ /** Order label, e.g. "Order #1043". */+ label: string;+ /** Activity type displayed under the label. */+ detail: string;+ time: string;+ /** Signed dollar amount. Negative values are refunds. */+ amount: number;+}++const ACTIVITY: ActivityRow[] = [+ {+ id: '1',+ icon: <ShoppingBagIcon width={16} height={16} />,+ label: 'Order #1043',+ detail: 'Placed · 1:59 pm',+ time: '1:59 pm',+ amount: 248,+ },+ {+ id: '2',+ icon: <BanknotesIcon width={16} height={16} />,+ label: 'Order #1041',+ detail: 'Refunded · 12:40 pm',+ time: '12:40 pm',+ amount: -89,+ },+ {+ id: '3',+ icon: <ShoppingBagIcon width={16} height={16} />,+ label: 'Order #1040',+ detail: 'Placed · 10:30 am',+ time: '10:30 am',+ amount: 156,+ },+ {+ id: '4',+ icon: <ShoppingBagIcon width={16} height={16} />,+ label: 'Order #1038',+ detail: 'Placed · 9:11 am',+ time: '9:11 am',+ amount: 412,+ },+ {+ id: '5',+ icon: <ShoppingBagIcon width={16} height={16} />,+ label: 'Order #1037',+ detail: 'Placed · 8:42 am',+ time: '8:42 am',+ amount: 95,+ },+];++function formatAmount(amount: number): string {+ const sign = amount < 0 ? '−' : '+';+ return `${sign}$${Math.abs(amount).toLocaleString()}`;+}++function LatestActivityCard() {+ return (+ <XDSCard padding={5} xstyle={styles.activityCard}>+ <XDSVStack gap={4} xstyle={styles.activityCardStack}>+ <XDSHeading level={2}>Revenue</XDSHeading>++ {/* Hand-rolled CSS sparkline — 5 vertical bars. Heights set+ via inline `height` so the bars are data-driven without+ generating a stylex class per row. */}+ <XDSVStack gap={2}>+ <div {...stylex.props(styles.sparkline)} aria-hidden="true">+ {SPARKLINE_DATA.map((value, i) => (+ <div+ key={i}+ {...stylex.props(styles.sparkBar)}+ style={{height: `${value}%`}}+ />+ ))}+ </div>+ <div {...stylex.props(styles.sparkLabels)} aria-hidden="true">+ {SPARKLINE_LABELS.map(label => (+ <span key={label}>{label}</span>+ ))}+ </div>+ </XDSVStack>++ <XDSGrid columns={2} gap={3}>+ <XDSVStack gap={0}>+ <span {...stylex.props(styles.kpiValue)}>18K</span>+ <XDSText type="supporting" color="secondary">+ Monthly revenue+ </XDSText>+ </XDSVStack>+ <XDSVStack gap={0}>+ <span {...stylex.props(styles.kpiValue)}>+12%</span>+ <XDSText type="supporting" color="secondary">+ Order growth+ </XDSText>+ </XDSVStack>+ </XDSGrid>++ <XDSDivider variant="subtle" />++ <XDSHStack hAlign="between" vAlign="center">+ <XDSHeading level={3}>Activity</XDSHeading>+ <XDSLink href="#">See all</XDSLink>+ </XDSHStack>++ <XDSVStack gap={1} xstyle={styles.activityListFade}>+ {ACTIVITY.map(item => (+ <XDSItem+ key={item.id}+ media={+ <div {...stylex.props(styles.activityIcon)} aria-hidden="true">+ {item.icon}+ </div>+ }+ label={item.label}+ description={item.detail}+ trailing={+ <XDSText+ type="body"+ weight="bold"+ color={item.amount < 0 ? 'secondary' : 'primary'}>+ {formatAmount(item.amount)}+ </XDSText>+ }+ href="#"+ />+ ))}+ </XDSVStack>+ </XDSVStack>+ </XDSCard>+ );+}++// =============================================================================+// Card 7 — Inventory table+//+// Rich product-app inventory pattern with a heading + primary action,+// a filter row (search + 3 filter pills + view toggle), a table with+// thumbnails / multi-badge tags / per-row overflow menus / selection+// checkboxes, and a floating bulk-action toolbar showing "3 selected".+// Everything is a static demo — no real filtering, sorting, or+// selection wiring — to keep the focus on theme component fidelity.+//+// Components exercised: XDSHeading, XDSButton (primary + ghost),+// XDSTextInput (with start icon), XDSCheckboxInput, XDSTable (custom+// renderers + proportional widths + dividers + hover), XDSBadge+// (categorical variants), XDSMoreMenu, XDSCard, XDSDivider, XDSIcon+// (via heroicons).+// =============================================================================++type TagSpec = {label: string; variant: 'blue' | 'green' | 'orange' | 'yellow'};++// `extends Record<string, unknown>` is load-bearing: XDSTable's+// generic constraint requires it, and Next.js's production build+// enforces it strictly (dev builds let it slide). Without it the+// Vercel preview fails to compile at `<XDSTable<InventoryRow>>`+// below. The `unknown` value type is broad enough to accept+// `tags: TagSpec[]` and any other field shape we add later.+interface InventoryRow extends Record<string, unknown> {+ id: string;+ name: string;+ meta: string;+ available: number;+ location: string;+ tags: TagSpec[];+ /**+ * Key into the active ThemeImageSet. The actual URL is resolved+ * at render time via the `images` prop passed down from+ * ThemePackagePage, so each theme can swap its own product+ * photos without touching this data.+ */+ imageKey?: keyof ThemeImageSet;+ thumbnailFallback: string;+ selected: boolean;+}++const INVENTORY: InventoryRow[] = [+ {+ id: 'a',+ name: 'Minimalist Watch',+ meta: 'Stainless steel, sapphire crystal',+ available: 42,+ location: 'Aisle 3',+ tags: [{label: 'New', variant: 'blue'}],+ imageKey: 'watch',+ thumbnailFallback: 'M',+ selected: false,+ },+ {+ id: 'b',+ name: 'Wireless Headphones',+ meta: 'ANC, 30hr battery',+ available: 128,+ location: 'Aisle 1',+ tags: [{label: 'Popular', variant: 'green'}],+ imageKey: 'headphones',+ thumbnailFallback: 'W',+ selected: true,+ },+ {+ id: 'c',+ name: 'Canvas Backpack',+ meta: 'Water-resistant, 25L',+ available: 63,+ location: 'Aisle 2',+ tags: [{label: 'Limited', variant: 'yellow'}],+ imageKey: 'backpack',+ thumbnailFallback: 'C',+ selected: false,+ },+ {+ id: 'd',+ name: 'Leather Wallet',+ meta: 'Full-grain, RFID blocking',+ available: 15,+ location: 'Aisle 4',+ tags: [{label: 'Leather', variant: 'yellow'}],+ imageKey: 'wallet',+ thumbnailFallback: 'L',+ selected: true,+ },+ {+ id: 'e',+ name: 'Travel Mug',+ meta: 'Vacuum insulated, 16oz',+ available: 87,+ location: 'Aisle 5',+ tags: [{label: 'Drinkware', variant: 'green'}],+ imageKey: 'mug',+ thumbnailFallback: 'T',+ selected: false,+ },+ {+ id: 'f',+ name: 'Linen Throw',+ meta: 'Heavyweight, oat',+ available: 24,+ location: 'Aisle 6',+ tags: [{label: 'Home', variant: 'orange'}],+ imageKey: 'throw_',+ thumbnailFallback: 'L',+ selected: true,+ },+];++// Reorder threshold — items with `available` below this surface a+// warning banner above the table. Kept here next to the INVENTORY+// data so the threshold and the data stay co-located.+const LOW_STOCK_THRESHOLD = 25;+const LOW_STOCK_COUNT = INVENTORY.filter(+ row => row.available < LOW_STOCK_THRESHOLD,+).length;++// -- Cell renderers ---------------------------------------------------------++function SelectCell({row}: {row: InventoryRow}) {+ return (+ <XDSCheckboxInput+ label={`Select ${row.name}`}+ isLabelHidden+ value={row.selected}+ onChange={() => {}}+ />+ );+}++function ItemCell({row, images}: {row: InventoryRow; images: ThemeImageSet}) {+ const thumbnailSrc = row.imageKey ? images[row.imageKey] : undefined;+ return (+ <XDSHStack gap={3} vAlign="center">+ {thumbnailSrc ? (+ <img src={thumbnailSrc} alt="" {...stylex.props(styles.thumbnail)} />+ ) : (+ <div {...stylex.props(styles.thumbnailFallback)} aria-hidden="true">+ {row.thumbnailFallback}+ </div>+ )}+ <XDSVStack gap={0} style={{minWidth: 0}}>+ <XDSText type="body" weight="bold">+ {row.name}+ </XDSText>+ <XDSText type="supporting" color="secondary">+ {row.meta}+ </XDSText>+ </XDSVStack>+ </XDSHStack>+ );+}++function TagsCell({row}: {row: InventoryRow}) {+ return (+ <XDSHStack gap={1} wrap="wrap" hAlign="end">+ {row.tags.map(tag => (+ <XDSBadge key={tag.label} label={tag.label} variant={tag.variant} />+ ))}+ </XDSHStack>+ );+}++function ActionsCell() {+ return (+ <XDSMoreMenu+ label="Row actions"+ items={[+ {label: 'Edit'},+ {label: 'Duplicate'},+ {label: 'Move to…'},+ {type: 'divider'},+ {label: 'Delete'},+ ]}+ />+ );+}++// -- Inventory card --------------------------------------------------------++function InventoryCard({images}: {images: ThemeImageSet}) {+ return (+ <XDSCard padding={0} xstyle={styles.inventoryCard}>+ {/* Heading + primary action */}+ <XDSHStack+ hAlign="between"+ vAlign="center"+ xstyle={styles.inventoryHeader}>+ <XDSHeading level={2}>Inventory</XDSHeading>+ <XDSButton+ label="Add item"+ variant="primary"+ size="sm"+ icon={<PlusIcon width={16} height={16} />}+ />+ </XDSHStack>++ <XDSDivider variant="subtle" />++ {/* Filter row — search, filter pills, view toggle */}+ <XDSHStack+ gap={3}+ vAlign="center"+ hAlign="between"+ xstyle={styles.inventoryFilterRow}>+ <XDSHStack gap={2} vAlign="center" style={{flex: 1, minWidth: 0}}>+ <XDSTextInput+ label="Search inventory"+ isLabelHidden+ placeholder="Type and hit enter…"+ value=""+ onChange={() => {}}+ startIcon={<MagnifyingGlassIcon width={16} height={16} />}+ xstyle={styles.searchInput}+ />+ <XDSSelector+ label="Categories"+ isLabelHidden+ placeholder="Categories"+ size="sm"+ startIcon={<FolderIcon width={16} height={16} />}+ value={undefined}+ onChange={() => {}}+ options={['Wearables', 'Audio', 'Bags', 'Drinkware', 'Home']}+ />+ <XDSSelector+ label="Locations"+ isLabelHidden+ placeholder="Locations"+ size="sm"+ startIcon={<MapPinIcon width={16} height={16} />}+ value={undefined}+ onChange={() => {}}+ options={[+ 'Aisle 1',+ 'Aisle 2',+ 'Aisle 3',+ 'Aisle 4',+ 'Aisle 5',+ 'Aisle 6',+ ]}+ />+ <XDSSelector+ label="Tags"+ isLabelHidden+ placeholder="Tags"+ size="sm"+ startIcon={<TagIcon width={16} height={16} />}+ value={undefined}+ onChange={() => {}}+ options={[+ 'New',+ 'Popular',+ 'Limited',+ 'Leather',+ 'Drinkware',+ 'Home',+ ]}+ />+ </XDSHStack>+ <XDSHStack gap={1} vAlign="center">+ <XDSButton+ variant="ghost"+ size="sm"+ isIconOnly+ label="List view"+ icon={<ListBulletIcon width={18} height={18} />}+ />+ <XDSButton+ variant="ghost"+ size="sm"+ isIconOnly+ label="Grid view"+ icon={<Squares2X2Icon width={18} height={18} />}+ />+ </XDSHStack>+ </XDSHStack>++ {/* Low-stock warning — surfaces a contextual XDSBanner above+ the table when any inventory rows fall below LOW_STOCK_+ THRESHOLD. Wrapped in inventoryBannerWrap so the banner+ inherits the table's horizontal padding. */}+ {LOW_STOCK_COUNT > 0 && (+ <div {...stylex.props(styles.inventoryBannerWrap)}>+ <XDSBanner+ status="warning"+ title={`${LOW_STOCK_COUNT} items are running low`}+ />+ </div>+ )}++ <XDSTable<InventoryRow>+ data={INVENTORY}+ columns={[+ {+ key: 'select',+ header: '',+ width: pixel(48),+ renderCell: row => <SelectCell row={row} />,+ },+ {+ key: 'item',+ header: 'Item',+ width: proportional(3),+ renderCell: row => <ItemCell row={row} images={images} />,+ },+ {+ key: 'available',+ header: 'Available',+ // Fixed pixel width since the data is short (2-3 digit+ // counts) and the header label is the widest piece.+ // Frees the remaining horizontal space for Item and+ // pushes Available/Location closer to Tags.+ width: pixel(100),+ renderCell: row => <XDSText type="body">{row.available}</XDSText>,+ },+ {+ key: 'location',+ header: 'Location',+ width: pixel(100),+ renderCell: row => <XDSText type="body">{row.location}</XDSText>,+ },+ {+ key: 'tags',+ header: 'Tags',+ width: proportional(2),+ align: 'end',+ renderCell: row => <TagsCell row={row} />,+ },+ {+ key: 'actions',+ header: '',+ width: pixel(48),+ renderCell: () => <ActionsCell />,+ },+ ]}+ density="spacious"+ dividers="rows"+ hasHover+ />+ </XDSCard>+ );+}diff --git a/apps/docsite/src/components/ThemePackagePage.tsx b/apps/docsite/src/components/ThemePackagePage.tsxindex 94ac69130b..379793ed19 100644--- a/apps/docsite/src/components/ThemePackagePage.tsx+++ b/apps/docsite/src/components/ThemePackagePage.tsx@@ -4,111 +4,265 @@import {useState} from 'react';import stylex from '@stylexjs/stylex';+import {ArrowLeftIcon, SunIcon, MoonIcon} from '@heroicons/react/24/outline';import {XDSText} from '@xds/core/Text';-import {XDSVStack, XDSHStack} from '@xds/core/Layout';+import {+ XDSVStack,+ XDSHStack,+ XDSLayout,+ XDSLayoutContent,+} from '@xds/core/Layout';import {XDSCard} from '@xds/core/Card';+import {XDSToolbar} from '@xds/core/Toolbar';import {XDSTheme} from '@xds/core/theme';import type {XDSDefinedTheme} from '@xds/core/theme';import {XDSMarkdown} from '@xds/core/Markdown';-import {XDSCodeBlock} from '@xds/core/CodeBlock';import {XDSButton} from '@xds/core/Button';-import {XDSPopover} from '@xds/core/Popover';+import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';import {ThemeShowcasePreview} from './ThemeShowcasePreview';+import {ThemeCardShowcase} from './ThemeCardShowcase';+import {getThemeImages} from './themeImages';const styles = stylex.create({- prose: {- maxWidth: 800,- marginInline: 'auto',+ // Reserves bottom space equal to the floating footer's height ++ // surrounding margin so the last card row can scroll clear of the+ // pinned footer rather than disappearing behind it.+ page: {+ paddingBottom: 'calc(72px + var(--spacing-6))',+ },+ // Matches the preview card's 1200px max-width so the card+ // showcase visually aligns with the preview above it.+ showcaseBlock: {width: '100%',+ maxWidth: 1200,+ marginInline: 'auto',},previewCard: {overflow: 'hidden',+ // Match the "wide content" max-width used across the site+ // (home page showcases, docs index). Keeps the showcase from+ // running viewport-edge to viewport-edge on very wide screens+ // while staying noticeably wider than the 800px prose column+ // above it so the showcase grid still has room to breathe.+ maxWidth: 1200,+ width: '100%',+ marginInline: 'auto',+ // Use the theme's body background (not the card/muted surface)+ // so the preview reads as a real themed app — the surrounding+ // chrome (top nav, hero, etc.) sits on the theme's true body+ // color, which is what users would see in their own app.+ backgroundColor: 'var(--color-background-body)',+ },+ // Floating footer wrapper — fixed-positioned strip across the+ // viewport bottom. `pointerEvents: 'none'` lets clicks pass+ // through the empty space on either side of the centered pill;+ // the pill itself overrides this back to 'auto'.+ floatingFooter: {+ position: 'fixed',+ bottom: 'var(--spacing-4)',+ left: 'var(--spacing-4)',+ right: 'var(--spacing-4)',+ zIndex: 100,+ pointerEvents: 'none',+ },+ // Pill chrome — uses XDSCard default variant (which already+ // applies --color-background-card + --color-border) wrapped in+ // an XDSToolbar for layout + a11y. We layer max-width, centering,+ // pill radius, and shadow on top via xstyle.+ floatingFooterCard: {+ pointerEvents: 'auto',+ maxWidth: 960,+ marginInline: 'auto',+ borderRadius: 'var(--radius-full)',+ boxShadow: 'var(--shadow-high)',+ },+ // Take the remaining horizontal space between the back button+ // and the action cluster so title/description align nicely.+ floatingFooterTitle: {+ flex: 1,+ minWidth: 0,+ },+ // Single-line truncation keeps the pill compact; on narrow+ // viewports the description hides entirely so the action+ // cluster stays reachable.+ floatingFooterDescription: {+ overflow: 'hidden',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ display: {+ default: 'block',+ '@media (max-width: 640px)': 'none',+ },},});-export interface InstallStep {- label: string;- code: string;- language?: string;-}-interface ThemePackagePageProps {- name: string;+ /** Vanity display title shown as the page heading (e.g. "Neutral"). */+ title: string;+ /** Full npm package name shown as small metadata below the title. */+ packageName: string;description?: string;version?: string;+ /**+ * Raw README markdown for the package. Rendered inside the Install+ * dialog (verbatim minus the top-level H1) — the dedicated page+ * itself doesn't surface README content inline, so the brand+ * experience (title + description + live themed preview) isn't+ * crowded by setup docs.+ */readme: string | null;- installSteps: InstallStep[];theme: XDSDefinedTheme;}export function ThemePackagePage({- name,+ title,+ packageName,description,version,readme,- installSteps,theme,}: ThemePackagePageProps) {- const body = readme ? readme.replace(/^# .+\n+/, '') : null;+ // Strip the leading "# <title>" since the dialog header already+ // shows the title — avoids a redundant heading at the top of the+ // rendered markdown body.+ const readmeBody = readme ? readme.replace(/^# .+\n+/, '') : null;const [mode, setMode] = useState<'light' | 'dark'>('light');+ const [isInstallOpen, setIsInstallOpen] = useState(false);+ const versionSuffix = version ? ` · ${version}` : '';+ // Resolve the product image set for this theme (falls back to+ // neutral if the theme doesn't have its own set yet).+ const images = getThemeImages(theme.name);return (- <XDSVStack gap={8}>- <XDSVStack gap={2} xstyle={styles.prose}>- <XDSVStack gap={1}>- <XDSHStack vAlign="center" hAlign="between">- <XDSHStack gap={3} vAlign="end">- <XDSText type="display-3">{name}</XDSText>- {version && (- <XDSText type="supporting" color="secondary">- {version}- </XDSText>- )}- </XDSHStack>- <XDSPopover- width={360}- content={- <XDSVStack gap={3}>- {installSteps.map((step, i) => (- <XDSVStack key={i} gap={1}>- <XDSText type="body" weight="bold">- {i + 1}. {step.label}- </XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- code={step.code}- language={step.language ?? 'bash'}- hasCopyButton- />- </XDSCard>- </XDSVStack>- ))}- </XDSVStack>- }>- <XDSButton label="Install" variant="primary" />- </XDSPopover>- </XDSHStack>- {description && (- <XDSText type="body" color="secondary">- {description}- </XDSText>- )}- </XDSVStack>- </XDSVStack>-+ <XDSVStack gap={8} xstyle={styles.page}><XDSTheme theme={theme} mode={mode}>- <XDSCard padding={0} variant="muted" xstyle={styles.previewCard}>- <ThemeShowcasePreview mode={mode} onModeChange={setMode} />+ <XDSCard padding={0} variant="transparent" xstyle={styles.previewCard}>+ <ThemeShowcasePreview images={images} /></XDSCard></XDSTheme>- {body && (- <div {...stylex.props(styles.prose)}>- <XDSMarkdown headingLevelStart={3} contentWidth={800}>- {body}- </XDSMarkdown>- </div>- )}+ {/* Real-world card showcase — sits OUTSIDE the live preview+ card so it renders on the docsite's own astryx chrome+ rather than nested inside the theme's body color.+ Inventory + Checkout + Top customers cards flip light/+ dark in sync with the preview above via the mode prop. */}+ <div {...stylex.props(styles.showcaseBlock)}>+ <ThemeCardShowcase theme={theme} images={images} mode={mode} />+ </div>++ {/* Install dialog — the single canonical surface for setup+ info. Renders the full README inline so the dedicated+ page stays focused on the brand/preview experience and+ all install + advanced setup docs live behind the+ explicit "Install" CTA. */}+ <XDSDialog+ isOpen={isInstallOpen}+ onOpenChange={setIsInstallOpen}+ width={720}>+ <XDSLayout+ header={+ <XDSDialogHeader+ title={`Install ${title}`}+ subtitle={`${packageName}${versionSuffix}`}+ onOpenChange={setIsInstallOpen}+ />+ }+ content={+ <XDSLayoutContent>+ {readmeBody ? (+ <XDSMarkdown headingLevelStart={3} contentWidth={680}>+ {readmeBody}+ </XDSMarkdown>+ ) : (+ <XDSText type="body" color="secondary">+ No setup documentation is available for this theme yet.+ </XDSText>+ )}+ </XDSLayoutContent>+ }+ />+ </XDSDialog>++ {/* Floating footer — pinned to the bottom of the viewport with+ the page's title, description, mode toggle, and Install+ CTA. Uses XDSToolbar (for layout slots + roving tabindex+ a11y) nested inside an XDSCard (for the pill chrome —+ card surface, border, and shadow tokens). Bottom padding+ on the outer page wrapper (styles.page) ensures the last+ card row can scroll clear of the footer. */}+ <div {...stylex.props(styles.floatingFooter)}>+ <XDSCard+ padding={3}+ variant="default"+ xstyle={styles.floatingFooterCard}>+ <XDSToolbar+ label="Theme actions"+ gap={3}+ startContent={+ // Back button + title cluster. Lives together in+ // startContent so the title stays left-aligned with+ // the back button rather than centered between the+ // slots (XDSToolbar's centerContent uses an auto-+ // width center column, which would shrink the title+ // instead of letting it fill the space).+ <XDSHStack gap={3} vAlign="center">+ <XDSButton+ variant="ghost"+ size="md"+ label="Back to all themes"+ isIconOnly+ icon={<ArrowLeftIcon />}+ href="/themes"+ />+ <XDSVStack gap={0} xstyle={styles.floatingFooterTitle}>+ <XDSText type="body" weight="bold">+ {title}+ </XDSText>+ {description && (+ <XDSText+ type="supporting"+ color="secondary"+ xstyle={styles.floatingFooterDescription}>+ {description}+ </XDSText>+ )}+ </XDSVStack>+ </XDSHStack>+ }+ endContent={+ <XDSHStack gap={2} vAlign="center">+ <XDSButton+ variant="ghost"+ isIconOnly+ label={+ mode === 'light'+ ? 'Switch preview to dark mode'+ : 'Switch preview to light mode'+ }+ icon={+ mode === 'light' ? (+ <MoonIcon width={20} height={20} />+ ) : (+ <SunIcon width={20} height={20} />+ )+ }+ onClick={() => setMode(mode === 'light' ? 'dark' : 'light')}+ />+ <XDSButton+ label="Customize"+ variant="secondary"+ href="/playground"+ />+ <XDSButton+ label="Install"+ variant="primary"+ onClick={() => setIsInstallOpen(true)}+ />+ </XDSHStack>+ }+ />+ </XDSCard>+ </div></XDSVStack>);}diff --git a/apps/docsite/src/components/ThemeShowcasePreview.tsx b/apps/docsite/src/components/ThemeShowcasePreview.tsxindex df2ac3a675..8ad87c21a5 100644--- a/apps/docsite/src/components/ThemeShowcasePreview.tsx+++ b/apps/docsite/src/components/ThemeShowcasePreview.tsx@@ -2,8 +2,13 @@'use client';-import {useState, useEffect, useRef} from 'react';+import {useState} from 'react';import stylex from '@stylexjs/stylex';+import {+ MagnifyingGlassIcon,+ UserIcon,+ ShoppingBagIcon,+} from '@heroicons/react/24/outline';import {XDSText, XDSHeading} from '@xds/core/Text';import {XDSVStack, XDSHStack} from '@xds/core/Layout';import {XDSButton} from '@xds/core/Button';@@ -12,17 +17,15 @@ import {XDSCenter} from '@xds/core/Center';import {XDSSection} from '@xds/core/Section';import {XDSGrid} from '@xds/core/Grid';import {XDSBadge} from '@xds/core/Badge';-import {XDSTable, proportional} from '@xds/core/Table';import {XDSAspectRatio} from '@xds/core/AspectRatio';-import {XDSTopNav, XDSTopNavHeading} from '@xds/core/TopNav';+import {XDSTopNav, XDSTopNavHeading, XDSTopNavItem} from '@xds/core/TopNav';import {XDSRadioList, XDSRadioListItem} from '@xds/core/RadioList';-import {XDSList, XDSListItem} from '@xds/core/List';-import {XDSIcon} from '@xds/core/Icon';import {XDSTextInput} from '@xds/core/TextInput';+import {XDSNumberInput} from '@xds/core/NumberInput';+import type {ThemeImageSet} from './themeImages';import {XDSProgressBar} from '@xds/core/ProgressBar';import {XDSSwitch} from '@xds/core/Switch';import {XDSBanner} from '@xds/core/Banner';-const styles = stylex.create({productImage: {width: '100%',@@ -31,6 +34,37 @@ const styles = stylex.create({},cardBody: {padding: 'var(--spacing-4)',+ // Body fills the remaining vertical space below the image so+ // descriptions of different lengths don't push the "Learn more"+ // button to different vertical positions across cards.+ flex: 1,+ display: 'flex',+ flexDirection: 'column' as const,+ },+ cardStack: {+ // Card content stack fills the card height so cardBody (flex:1)+ // can stretch — without this the stack collapses to its content+ // height and the body doesn't have room to grow.+ height: '100%',+ },+ cardDescription: {+ // Pushes the bottom action row (quantity + Add to cart) to the+ // bottom of the card by absorbing any extra vertical space, so+ // every card's action row aligns horizontally regardless of+ // description length.+ flex: 1,+ },+ // Compact quantity stepper to the left of the Add to cart button.+ // Capped width keeps the stepper from competing with the button+ // for the row's horizontal space.+ quantityInput: {+ width: 40,+ flexShrink: 0,+ },+ // Cart button grows to fill the remaining row width next to the+ // quantity stepper so the action stays the dominant target.+ cartButton: {+ flex: 1,},heroText: {textAlign: 'center' as const,@@ -40,33 +74,14 @@ const styles = stylex.create({maxWidth: 960,marginInline: 'auto',},- swatch: {- width: 32,- height: 32,- borderRadius: 'var(--radius-element)',- flexShrink: 0,- },- fontCard: {- borderColor: 'transparent',- minWidth: 0,- },- fontSample: {- height: '100%',- },- fontSampleInner: {- flex: 1,- },- componentCard: {- borderColor: 'transparent',- overflow: 'hidden',- minWidth: 0,- },});-const PRODUCT_IMAGES = [- 'https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=400&h=300&fit=crop',- 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=300&fit=crop',- 'https://images.unsplash.com/photo-1553062407-98eeb64c6a62?w=400&h=300&fit=crop',+// Keys into the active ThemeImageSet, in the same order as PRODUCTS.+// The actual URLs are resolved per-theme via the `images` prop.+const PRODUCT_IMAGE_KEYS: ReadonlyArray<keyof ThemeImageSet> = [+ 'watch',+ 'headphones',+ 'backpack',];const PRODUCTS = [@@ -74,340 +89,143 @@ const PRODUCTS = [name: 'Minimalist Watch',description: 'Clean design meets everyday durability.',badge: 'New',- badgeVariant: 'info' as const,+ badgeVariant: 'blue' as const,},{name: 'Wireless Headphones',description: 'Immersive sound, all-day comfort.',badge: 'Popular',- badgeVariant: 'success' as const,- },- {- name: 'Leather Wallet',- description: 'Handcrafted from full-grain leather.',- badge: 'Limited',- badgeVariant: 'warning' as const,- },-];--const TABLE_DATA = [- {- name: 'Minimalist Watch',- description: 'Stainless steel, sapphire crystal',- price: '$189',- stock: '42',- },- {- name: 'Wireless Headphones',- description: 'ANC, 30hr battery',- price: '$249',- stock: '128',- },- {- name: 'Leather Wallet',- description: 'Full-grain, RFID blocking',- price: '$79',- stock: '15',+ badgeVariant: 'green' as const,},{name: 'Canvas Backpack',- description: 'Water-resistant, 25L',- price: '$119',- stock: '63',+ description: 'Water-resistant canvas with a quiet, modern profile.',+ badge: 'Limited',+ badgeVariant: 'yellow' as const,},-] as Record<string, unknown>[];--const COLOR_ROWS = [- [- 'var(--color-accent)',- 'var(--color-accent-muted)',- 'var(--color-neutral)',- 'var(--color-background-surface)',- 'var(--color-background-body)',- ],- [- 'var(--color-success)',- 'var(--color-error)',- 'var(--color-warning)',- 'var(--color-text-primary)',- 'var(--color-text-secondary)',- ],];-function ColorSwatches({swatches}: {swatches: string[]}) {- return (- <XDSHStack gap={1}>- {swatches.map(color => (- <div- key={color}- {...stylex.props(styles.swatch)}- style={{backgroundColor: color}}- />- ))}- </XDSHStack>- );-}--function FontLabel({cssVar, fallback}: {cssVar: string; fallback: string}) {- const ref = useRef<HTMLSpanElement>(null);- const [label, setLabel] = useState(fallback);-- useEffect(() => {- if (!ref.current) {- return;- }- const computed = getComputedStyle(ref.current)- .getPropertyValue(cssVar)- .trim();- if (computed) {- setLabel(computed.split(',')[0].replace(/['"]/g, '').trim());- }- }, [cssVar]);-- return (- <span ref={ref}>- <XDSText type="supporting" color="secondary">- {label}- </XDSText>- </span>- );-}-interface ThemeShowcasePreviewProps {- mode: 'light' | 'dark';- onModeChange: (mode: 'light' | 'dark') => void;+ images: ThemeImageSet;}-export function ThemeShowcasePreview({- mode,- onModeChange,-}: ThemeShowcasePreviewProps) {+export function ThemeShowcasePreview({images}: ThemeShowcasePreviewProps) {return (- <XDSVStack gap={0}>- <XDSTopNav- label="Theme Preview"- heading={<XDSTopNavHeading heading="Theme Preview" />}- endContent={- <XDSSwitch- label={mode === 'dark' ? 'Dark' : 'Light'}- value={mode === 'dark'}- onChange={v => onModeChange(v ? 'dark' : 'light')}- />- }- />-- <XDSSection padding={8}>- <XDSVStack gap={10} xstyle={styles.content}>- <XDSCenter>- <XDSVStack gap={4} hAlign="center" xstyle={styles.heroText}>- <XDSText type="display-3">- Little joys,- <br />- everywhere you go- </XDSText>- <XDSText type="body" color="secondary">- We believe the smallest details are the ones that matter most.- Turn an ordinary day into something worth remembering.- </XDSText>- <XDSHStack gap={3} hAlign="center">- <XDSButton label="Get started" variant="primary" href="#" />- <XDSButton label="Learn more" variant="secondary" href="#" />+ <div data-theme-preview="true">+ <XDSVStack gap={0}>+ {/* Fake app top nav — sits at the top of the preview so the+ surface reads like a real product chrome (brand · primary+ nav · actions) rather than a bare design canvas. The+ brand wordmark, nav items, and end-content actions stay+ generic so the same nav makes sense across every theme+ (neutral, butter, y2k, stone, etc.). */}+ <XDSTopNav+ label="Theme preview navigation"+ heading={<XDSTopNavHeading heading="Studio" />}+ centerContent={+ <>+ <XDSTopNavItem label="Shop" href="#" isSelected />+ <XDSTopNavItem label="New In" href="#" />+ <XDSTopNavItem label="Stories" href="#" />+ <XDSTopNavItem label="Help" href="#" />+ </>+ }+ endContent={+ <XDSHStack gap={2} vAlign="center">+ <XDSHStack gap={0.5}>+ <XDSButton+ label="Search"+ variant="ghost"+ isIconOnly+ icon={<MagnifyingGlassIcon width={20} height={20} />}+ href="#"+ />+ <XDSButton+ label="Account"+ variant="ghost"+ isIconOnly+ icon={<UserIcon width={20} height={20} />}+ href="#"+ />+ <XDSButton+ label="Cart"+ variant="ghost"+ isIconOnly+ icon={<ShoppingBagIcon width={20} height={20} />}+ href="#"+ /></XDSHStack>- </XDSVStack>- </XDSCenter>-- <XDSGrid columns={{minWidth: 240}} gap={4}>- {PRODUCTS.map((p, i) => (- <XDSCard key={p.name} padding={0}>- <XDSVStack gap={0}>- <XDSAspectRatio ratio={4 / 3}>- <img- src={PRODUCT_IMAGES[i]}- alt={p.name}- {...stylex.props(styles.productImage)}- />- </XDSAspectRatio>- <div {...stylex.props(styles.cardBody)}>- <XDSVStack gap={2}>- <XDSHStack>- <XDSBadge label={p.badge} variant={p.badgeVariant} />- </XDSHStack>- <XDSHeading level={4}>{p.name}</XDSHeading>- <XDSText type="supporting" color="secondary">- {p.description}- </XDSText>- <XDSButton- label="Learn more"- variant="secondary"- href="#"- />- </XDSVStack>- </div>- </XDSVStack>- </XDSCard>- ))}- </XDSGrid>-- <XDSTable- data={TABLE_DATA}- columns={[- {key: 'name', header: 'Name', width: proportional(1)},- {- key: 'description',- header: 'Description',- width: proportional(2),- },- {key: 'price', header: 'Price', width: proportional(1)},- {key: 'stock', header: 'Stock', width: proportional(1)},- ]}- density="spacious"- dividers="rows"- hasHover- />-- <ThemeShowcaseDetails />- </XDSVStack>- </XDSSection>- </XDSVStack>- );-}--function ThemeShowcaseDetails() {- const [radioValue, setRadioValue] = useState('a');-- return (- <XDSVStack gap={4}>- <XDSGrid columns={{minWidth: 280}} gap={4}>- <XDSCard padding={6} xstyle={styles.fontCard}>- <XDSVStack gap={4}>- <XDSText type="label" weight="bold">- Colors- </XDSText>- {COLOR_ROWS.map((row, i) => (- <ColorSwatches key={i} swatches={row} />- ))}- </XDSVStack>- </XDSCard>-- <XDSCard padding={6} xstyle={styles.fontCard}>- <XDSVStack gap={0} xstyle={styles.fontSample}>- <XDSText type="label" weight="bold">- Fonts- </XDSText>- <XDSHStack- gap={8}- hAlign="center"- vAlign="center"- xstyle={styles.fontSampleInner}>- <XDSVStack gap={2} hAlign="center">- <XDSText- type="display-1"- style={{fontFamily: 'var(--font-family-body, system-ui)'}}>- Aa- </XDSText>- <FontLabel cssVar="--font-family-body" fallback="Body" />- </XDSVStack>- <XDSVStack gap={2} hAlign="center">- <XDSText- type="display-1"- style={{fontFamily: 'var(--font-family-code, monospace)'}}>- Aa- </XDSText>- <FontLabel cssVar="--font-family-code" fallback="Code" />- </XDSVStack>+ <XDSButton label="Sign in" variant="primary" href="#" /></XDSHStack>- </XDSVStack>- </XDSCard>- </XDSGrid>+ }+ />- <XDSCard padding={6} xstyle={styles.componentCard}>- <XDSGrid columns={{minWidth: 240}} gap={8}>- <XDSVStack gap={4}>- <XDSText type="label" weight="bold">- Components- </XDSText>- <XDSHStack gap={2} wrap="wrap">- <XDSButton label="Primary" variant="primary" size="sm" href="#" />- <XDSButton- label="Secondary"- variant="secondary"- size="sm"- href="#"- />- <XDSButton label="Ghost" variant="ghost" size="sm" href="#" />- </XDSHStack>- <XDSHStack gap={2} wrap="wrap">- <XDSBadge label="Badge" />- <XDSBadge label="Info" variant="info" />- <XDSBadge label="Success" variant="success" />- <XDSBadge label="Warning" variant="warning" />- <XDSBadge label="Error" variant="error" />- </XDSHStack>- <XDSGrid columns={{minWidth: 180}} gap={4}>- <XDSVStack gap={2}>- <XDSText type="supporting" weight="bold">- Label+ <XDSSection padding={8} variant="transparent">+ <XDSVStack gap={10} xstyle={styles.content}>+ <XDSCenter>+ <XDSVStack gap={4} hAlign="center" xstyle={styles.heroText}>+ <XDSText type="display-3">+ Little joys,+ <br />+ everywhere you go</XDSText>- <XDSRadioList- label="Options"- value={radioValue}- onChange={setRadioValue}>- <XDSRadioListItem value="a" label="Option A" />- <XDSRadioListItem value="b" label="Option B" />- <XDSRadioListItem value="c" label="Option C" />- </XDSRadioList>- </XDSVStack>- <XDSVStack gap={2}>- <XDSText type="supporting" weight="bold">- List Header- </XDSText>- <XDSList density="compact">- <XDSListItem- label="Notifications"- startContent={<XDSIcon icon="info" size="sm" />}- />- <XDSListItem- label="Privacy"- startContent={<XDSIcon icon="warning" size="sm" />}- />- <XDSListItem- label="Security"- startContent={<XDSIcon icon="check" size="sm" />}- />- </XDSList>- </XDSVStack>- </XDSGrid>- <XDSCard padding={4}>- <XDSVStack gap={2}>- <XDSHeading level={4}>Card Title</XDSHeading><XDSText type="body" color="secondary">- A flexible surface for grouping related content and actions.+ We believe the smallest details are the ones that matter most.+ Turn an ordinary day into something worth remembering.</XDSText>- <XDSButton- label="Action"- variant="secondary"- size="sm"- href="#"- /></XDSVStack>- </XDSCard>- </XDSVStack>-- <XDSVStack gap={4}>- <XDSTextInput- label="Example"- placeholder="Type something..."- value=""- onChange={() => {}}- />- <XDSProgressBar value={75} label="Progress" />- <XDSSwitch label="Toggle" value={true} onChange={() => {}} />- <XDSBanner status="success" title="Banner Title" />- <XDSBanner status="warning" title="Banner Title" />- <XDSBanner status="error" title="Banner Title" />+ </XDSCenter>++ <XDSGrid columns={{minWidth: 240}} gap={4}>+ {PRODUCTS.map((p, i) => (+ <XDSCard key={p.name} padding={0} height="100%">+ <XDSVStack gap={0} xstyle={styles.cardStack}>+ <XDSAspectRatio ratio={1}>+ <img+ src={images[PRODUCT_IMAGE_KEYS[i]]}+ alt={p.name}+ {...stylex.props(styles.productImage)}+ />+ </XDSAspectRatio>+ <div {...stylex.props(styles.cardBody)}>+ <XDSVStack gap={2} xstyle={styles.cardStack}>+ <XDSHStack>+ <XDSBadge label={p.badge} variant={p.badgeVariant} />+ </XDSHStack>+ <XDSHeading level={2}>{p.name}</XDSHeading>+ <XDSText+ type="supporting"+ color="secondary"+ xstyle={styles.cardDescription}>+ {p.description}+ </XDSText>+ <XDSHStack gap={2} vAlign="center">+ <XDSNumberInput+ label="Quantity"+ isLabelHidden+ value={1}+ onChange={() => {}}+ min={1}+ max={99}+ size="sm"+ xstyle={styles.quantityInput}+ />+ <XDSButton+ label="Add to cart"+ variant="secondary"+ href="#"+ xstyle={styles.cartButton}+ />+ </XDSHStack>+ </XDSVStack>+ </div>+ </XDSVStack>+ </XDSCard>+ ))}+ </XDSGrid></XDSVStack>- </XDSGrid>- </XDSCard>- </XDSVStack>+ </XDSSection>+ </XDSVStack>+ </div>);}diff --git a/apps/docsite/src/components/themeImages.ts b/apps/docsite/src/components/themeImages.tsnew file mode 100644index 0000000000..8bff64b5a3--- /dev/null+++ b/apps/docsite/src/components/themeImages.ts@@ -0,0 +1,67 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * Per-theme product image registry.+ *+ * Each theme can ship its own set of 6 product photos (watch, headphones,+ * backpack, wallet, mug, throw). These images appear in two places on the+ * dedicated /themes/<name> page:+ *+ * 1. ThemeShowcasePreview — the live themed fake "Studio" app, where the+ * first three (watch, headphones, backpack) render as 1:1 product+ * card photos.+ * 2. ThemeCardShowcase — the inventory table thumbnails, which use all+ * six.+ *+ * Adding photos for a new theme:+ * 1. Drop the 6 PNGs into public/<theme-slug>/preview-<item>.png+ * 2. Add an entry to THEME_IMAGES below pointing at those paths+ * 3. That's it — both consumers pick them up automatically+ *+ * Themes not listed in THEME_IMAGES fall back to the neutral image set,+ * so the page never has missing thumbnails — just the most neutral+ * possible product photos until a bespoke set lands.+ */++export interface ThemeImageSet {+ watch: string;+ headphones: string;+ backpack: string;+ wallet: string;+ mug: string;+ throw_: string;+}++const NEUTRAL_IMAGES: ThemeImageSet = {+ watch: '/neutral/preview-watch.png',+ headphones: '/neutral/preview-headphones.png',+ backpack: '/neutral/preview-backpack.png',+ wallet: '/neutral/preview-wallet.png',+ mug: '/neutral/preview-mug.png',+ throw_: '/neutral/preview-throw.png',+};++/**+ * Per-theme image overrides. Keyed by theme name (matches XDSDefinedTheme.name+ * and the slug used in /themes/<slug> URLs). Themes not listed here fall back+ * to the neutral set via getThemeImages().+ *+ * To add a new theme:+ * 1. Drop images into public/<theme-name>/preview-*.png+ * 2. Add an entry below:+ * butter: {+ * watch: '/butter/preview-watch.png',+ * ...etc+ * }+ */+const THEME_IMAGES: Record<string, ThemeImageSet> = {+ neutral: NEUTRAL_IMAGES,+};++/**+ * Resolve the image set for a theme name. Falls back to NEUTRAL_IMAGES for+ * themes that don't have their own image set yet.+ */+export function getThemeImages(themeName: string): ThemeImageSet {+ return THEME_IMAGES[themeName] ?? NEUTRAL_IMAGES;+}