Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fit(sandbox): Template Upgrades (#1776)

Kenton Quatmanc2eb4fdfb5a9
diff --git a/packages/cli/templates/pages/ai-chat/page.tsx b/packages/cli/templates/pages/ai-chat/page.tsx
index f2fb74489a..4bfc38d827 100644
--- a/packages/cli/templates/pages/ai-chat/page.tsx
+++ b/packages/cli/templates/pages/ai-chat/page.tsx
@@ -11,7 +11,12 @@ import {
} from '@xds/core/SideNav';
import {XDSNavIcon} from '@xds/core/NavIcon';
import {XDSBadge} from '@xds/core/Badge';
-import {XDSVStack, XDSHStack} from '@xds/core/Layout';
+import {
+ XDSLayout,
+ XDSLayoutContent,
+ XDSVStack,
+ XDSHStack,
+} from '@xds/core/Layout';
import {XDSText, XDSHeading} from '@xds/core/Text';
import {
XDSChatComposer,
@@ -40,6 +45,7 @@ import {XDSButton} from '@xds/core/Button';
import {XDSToken} from '@xds/core/Token';
import {XDSCard} from '@xds/core/Card';
import {XDSGrid} from '@xds/core/Grid';
+import {XDSIcon} from '@xds/core/Icon';
import {XDSDropdownMenu, XDSDropdownMenuItem} from '@xds/core/DropdownMenu';
import {
@@ -273,19 +279,17 @@ type ChatMessage =
| {id: number; role: 'system'; text: string};
const SIMULATED_RESPONSE =
- 'Thanks for your message! I\u2019m looking into this now.\n\nHere\u2019s what I found so far:\n\n1. **First**, I reviewed the relevant context from the attached files\n2. **Next**, I cross-referenced with the latest documentation\n3. **Finally**, I have a few recommendations\n\nLet me know if you\u2019d like me to dive deeper into any of these areas, or if you have follow-up questions.';
+ 'Thanks for your message! I’m looking into this now.\n\nHere’s what I found so far:\n\n1. **First**, I reviewed the relevant context from the attached files\n2. **Next**, I cross-referenced with the latest documentation\n3. **Finally**, I have a few recommendations\n\nLet me know if you’d like me to dive deeper into any of these areas, or if you have follow-up questions.';
// ============= SIDENAV =============
function AIChatSideNav() {
- const [active, setActive] = useState('dashboard');
+ const [active, setActive] = useState('ai-chat');
return (
<XDSSideNav
header={
<XDSSideNavHeading
- icon={
- <XDSNavIcon icon={<CubeIcon style={{width: 16, height: 16}} />} />
- }
+ icon={<XDSNavIcon icon={<XDSIcon icon={CubeIcon} size="sm" />} />}
heading="My App"
headingHref="/"
/>
@@ -295,8 +299,8 @@ function AIChatSideNav() {
label="AI Chat"
icon={ChatBubbleOvalLeftIcon}
selectedIcon={ChatBubbleOvalLeftIconSolid}
- isSelected={active === 'dashboard'}
- onClick={() => setActive('dashboard')}
+ isSelected={active === 'ai-chat'}
+ onClick={() => setActive('ai-chat')}
/>
<XDSSideNavItem
label="Projects"
@@ -405,7 +409,10 @@ export default function AIChatTemplate() {
};
if (view === 'landing') {
- setMessages([{id: 1, role: 'system', text: 'Today'}, userMsg]);
+ setMessages([
+ {id: userMsg.id - 1, role: 'system', text: 'Today'},
+ userMsg,
+ ]);
setAttachments([]);
setView('chat');
setTimeout(() => streamResponse(SIMULATED_RESPONSE), 600);
@@ -417,21 +424,178 @@ export default function AIChatTemplate() {
[view, attachments, streamResponse],
);
- const appendSuggestion = (prompt: string) => {
+ const replaceWithSuggestion = (prompt: string) => {
const input = composerInputRef.current;
if (!input) return;
input.focus();
- // Move cursor to end so text is always appended
+ // Select all existing content so insertText replaces it
const sel = window.getSelection();
if (sel) {
sel.selectAllChildren(document.activeElement!);
- sel.collapseToEnd();
}
input.insertText(prompt);
// Dispatch input event to trigger emitChange and clear placeholder
document.activeElement?.dispatchEvent(new Event('input', {bubbles: true}));
};
+ // ---------------------------------------------------------------------------
+ // Composer (shared between landing and chat views)
+ // ---------------------------------------------------------------------------
+
+ const insertMentionToken = (item: (typeof MENTION_ITEMS)[number]) => {
+ composerInputRef.current?.focus();
+ // Move cursor to end so token is appended
+ const sel = window.getSelection();
+ if (sel && document.activeElement) {
+ sel.selectAllChildren(document.activeElement);
+ sel.collapseToEnd();
+ }
+ composerInputRef.current?.insertToken({
+ value: `@${item.id}`,
+ label: item.label,
+ variant: 'blue',
+ });
+ document.activeElement?.dispatchEvent(new Event('input', {bubbles: true}));
+ };
+
+ const insertModeToken = (label: string) => {
+ composerInputRef.current?.focus();
+ composerInputRef.current?.insertToken({
+ value: label,
+ label,
+ variant: 'orange',
+ });
+ // Dispatch input event to trigger emitChange and clear placeholder
+ document.activeElement?.dispatchEvent(new Event('input', {bubbles: true}));
+ };
+
+ const fileInput = (
+ <input
+ ref={fileInputRef}
+ type="file"
+ multiple
+ style={{display: 'none'}}
+ onChange={e => {
+ const files = Array.from(e.target.files ?? []);
+ setAttachments(prev => [...prev, ...files.map(f => f.name)]);
+ e.target.value = '';
+ }}
+ />
+ );
+
+ const renderComposer = ({
+ inputMinHeight,
+ extraFooterActions = null,
+ }: {
+ inputMinHeight: string;
+ extraFooterActions?: React.ReactNode;
+ }) => (
+ <XDSChatComposer
+ onSubmit={handleSubmit}
+ onStop={handleStop}
+ isStreaming={isStreaming}
+ placeholder="Ask anything"
+ input={
+ <XDSChatComposerInput
+ ref={composerInputRef}
+ triggers={composerTriggers}
+ style={{minHeight: inputMinHeight}}
+ />
+ }
+ drawer={
+ attachments.length > 0 ? (
+ <XDSChatComposerDrawer count={attachments.length}>
+ {attachments.map(name => (
+ <XDSToken
+ key={name}
+ label={name}
+ onRemove={() =>
+ setAttachments(prev => prev.filter(n => n !== name))
+ }
+ />
+ ))}
+ </XDSChatComposerDrawer>
+ ) : undefined
+ }
+ headerActions={
+ <>
+ <XDSDropdownMenu
+ button={{
+ label: 'Reference',
+ variant: 'ghost',
+ size: 'sm',
+ icon: <XDSIcon icon={AtSymbolIcon} size="sm" />,
+ isIconOnly: true,
+ }}
+ hasChevron={false}
+ menuWidth={240}>
+ {MENTION_ITEMS.map(item => (
+ <XDSDropdownMenuItem
+ key={item.id}
+ label={item.label}
+ description={item.auxiliaryData?.role}
+ onClick={() => insertMentionToken(item)}
+ />
+ ))}
+ </XDSDropdownMenu>
+ <XDSButton
+ label="Attach"
+ variant="ghost"
+ size="sm"
+ icon={<XDSIcon icon={PaperClipIcon} size="sm" />}
+ isIconOnly
+ onClick={() => fileInputRef.current?.click()}
+ />
+ </>
+ }
+ footerActions={
+ <>
+ <XDSDropdownMenu
+ button={{
+ label: activeMode.label,
+ variant: 'ghost',
+ size: 'md',
+ icon: <XDSIcon icon={activeMode.icon} size="sm" />,
+ children: activeMode.label,
+ }}
+ menuWidth={200}
+ isMenuOpen={isModeMenuOpen}
+ onOpenChange={(isOpen: boolean) => {
+ setIsModeMenuOpen(isOpen);
+ if (!isOpen && shouldFocusComposerRef.current) {
+ shouldFocusComposerRef.current = false;
+ // Delay focus until after menu restores focus to its trigger button
+ setTimeout(() => {
+ composerInputRef.current?.focus();
+ }, 50);
+ }
+ }}
+ items={MODE_OPTIONS.flatMap(opt => {
+ const item = {
+ label: opt.label,
+ icon: opt.icon,
+ onClick: () => {
+ const tokenLabel = TOKEN_MODES[opt.key];
+ if (tokenLabel) {
+ insertModeToken(tokenLabel);
+ shouldFocusComposerRef.current = true;
+ } else {
+ setMode(opt.key);
+ }
+ },
+ };
+ return opt.key === 'sensitive'
+ ? [{type: 'divider' as const}, item]
+ : [item];
+ })}
+ />
+ {extraFooterActions}
+ </>
+ }
+ sendActions={<XDSChatDictationButton dictation={dictation} />}
+ />
+ );
+
// ---------------------------------------------------------------------------
// Chat view
// ---------------------------------------------------------------------------
@@ -439,226 +603,62 @@ export default function AIChatTemplate() {
if (view === 'chat') {
return (
<XDSAppShell sideNav={<AIChatSideNav />} variant="elevated">
- <div style={{height: '100%', display: 'flex', flexDirection: 'column'}}>
- <XDSChatLayout
- composer={
- <>
- <input
- ref={fileInputRef}
- type="file"
- multiple
- style={{display: 'none'}}
- onChange={e => {
- const files = Array.from(e.target.files ?? []);
- setAttachments(prev => [
- ...prev,
- ...files.map(f => f.name),
- ]);
- e.target.value = '';
- }}
- />
- <XDSChatComposer
- onSubmit={handleSubmit}
- onStop={handleStop}
- isStreaming={isStreaming}
- placeholder="Ask anything"
- input={
- <XDSChatComposerInput
- ref={composerInputRef}
- triggers={composerTriggers}
- style={{minHeight: '44px'}}
- />
- }
- drawer={
- attachments.length > 0 ? (
- <XDSChatComposerDrawer count={attachments.length}>
- {attachments.map((name, i) => (
- <XDSToken
- key={i}
- label={name}
- onRemove={() =>
- setAttachments(prev =>
- prev.filter((_, j) => j !== i),
- )
- }
- />
- ))}
- </XDSChatComposerDrawer>
- ) : undefined
- }
- headerActions={
- <>
- <XDSDropdownMenu
- button={{
- label: 'Reference',
- variant: 'ghost',
- size: 'sm',
- icon: (
- <AtSymbolIcon style={{width: 16, height: 16}} />
- ),
- isIconOnly: true,
- }}
- hasChevron={false}
- menuWidth={240}>
- {MENTION_ITEMS.map(item => (
- <XDSDropdownMenuItem
- key={item.id}
- label={item.label}
- description={item.auxiliaryData?.role}
- onClick={() => {
- composerInputRef.current?.focus();
- // Move cursor to end so token is appended
- const sel = window.getSelection();
- if (sel && document.activeElement) {
- sel.selectAllChildren(document.activeElement);
- sel.collapseToEnd();
- }
- composerInputRef.current?.insertToken({
- value: `@${item.id}`,
- label: item.label,
- variant: 'blue',
- });
- document.activeElement?.dispatchEvent(
- new Event('input', {bubbles: true}),
- );
- }}
- />
+ <XDSChatLayout
+ style={{height: '100%'}}
+ composer={
+ <>
+ {fileInput}
+ {renderComposer({inputMinHeight: '44px'})}
+ </>
+ }>
+ <XDSChatMessageList>
+ {messages.map(msg => {
+ if (msg.role === 'system') {
+ return (
+ <XDSChatSystemMessage key={msg.id} variant="divider">
+ {msg.text}
+ </XDSChatSystemMessage>
+ );
+ }
+ if (msg.role === 'user') {
+ return (
+ <XDSChatMessage key={msg.id} sender="user">
+ {msg.attachments && msg.attachments.length > 0 && (
+ <XDSHStack gap={1} style={{flexWrap: 'wrap'}}>
+ {msg.attachments.map(f => (
+ <XDSToken key={f} label={f} />
))}
- </XDSDropdownMenu>
- <XDSButton
- label="Attach"
- variant="ghost"
- size="sm"
- icon={<PaperClipIcon style={{width: 16, height: 16}} />}
- isIconOnly
- onClick={() => fileInputRef.current?.click()}
- />
- </>
- }
- footerActions={
- <>
- <XDSDropdownMenu
- button={{
- label: activeMode.label,
- variant: 'ghost',
- size: 'md',
- icon: (
- <activeMode.icon style={{width: 16, height: 16}} />
- ),
- children: activeMode.label,
- }}
- menuWidth={200}
- isMenuOpen={isModeMenuOpen}
- onOpenChange={(isOpen: boolean) => {
- setIsModeMenuOpen(isOpen);
- if (!isOpen && shouldFocusComposerRef.current) {
- shouldFocusComposerRef.current = false;
- setTimeout(() => {
- composerInputRef.current?.focus();
- }, 50);
+ </XDSHStack>
+ )}
+ <XDSChatMessageBubble
+ metadata={
+ <XDSChatMessageMetadata
+ timestamp={
+ <XDSTimestamp
+ value={msg.sentAt.getTime()}
+ format="time"
+ />
}
- }}
- items={MODE_OPTIONS.flatMap(opt => {
- const item = {
- label: opt.label,
- icon: opt.icon,
- onClick: () => {
- const tokenLabel = TOKEN_MODES[opt.key];
- if (tokenLabel) {
- composerInputRef.current?.focus();
- composerInputRef.current?.insertToken({
- value: tokenLabel,
- label: tokenLabel,
- variant: 'orange',
- });
- document.activeElement?.dispatchEvent(
- new Event('input', {bubbles: true}),
- );
- shouldFocusComposerRef.current = true;
- } else {
- setMode(opt.key);
- }
- },
- };
- return opt.key === 'sensitive'
- ? [{type: 'divider' as const}, item]
- : [item];
- })}
- />
- <XDSDropdownMenu
- button={{
- label: 'Settings',
- variant: 'ghost',
- size: 'md',
- icon: (
- <Cog6ToothIcon style={{width: 16, height: 16}} />
- ),
- children: 'Settings',
- }}
- menuWidth={200}
- items={[
- {label: 'Preferences', onClick: () => {}},
- {label: 'Keyboard shortcuts', onClick: () => {}},
- {label: 'About', onClick: () => {}},
- ]}
- />
- </>
- }
- sendActions={<XDSChatDictationButton dictation={dictation} />}
- />
- </>
- }>
- <XDSChatMessageList>
- {messages.map(msg => {
- if (msg.role === 'system') {
- return (
- <XDSChatSystemMessage key={msg.id} variant="divider">
+ />
+ }>
{msg.text}
- </XDSChatSystemMessage>
- );
- }
- if (msg.role === 'user') {
- return (
- <XDSChatMessage key={msg.id} sender="user">
- {msg.attachments && msg.attachments.length > 0 && (
- <XDSHStack gap={1} style={{flexWrap: 'wrap'}}>
- {msg.attachments.map(f => (
- <XDSToken key={f} label={f} />
- ))}
- </XDSHStack>
- )}
- <XDSChatMessageBubble
- metadata={
- <XDSChatMessageMetadata
- timestamp={
- <XDSTimestamp
- value={msg.sentAt.getTime()}
- format="time"
- />
- }
- />
- }>
- {msg.text}
- </XDSChatMessageBubble>
- </XDSChatMessage>
- );
- }
- return (
- <XDSChatMessage key={msg.id} sender="assistant">
- <XDSMarkdown density="compact">{msg.text}</XDSMarkdown>
- {!msg.isStreaming && msg.text && (
- <XDSChatMessageMetadata
- timestamp={
- <XDSTimestamp value={msg.id} format="time" />
- }
- />
- )}
+ </XDSChatMessageBubble>
</XDSChatMessage>
);
- })}
- </XDSChatMessageList>
- </XDSChatLayout>
- </div>
+ }
+ return (
+ <XDSChatMessage key={msg.id} sender="assistant">
+ <XDSMarkdown density="compact">{msg.text}</XDSMarkdown>
+ {!msg.isStreaming && msg.text && (
+ <XDSChatMessageMetadata
+ timestamp={<XDSTimestamp value={msg.id} format="time" />}
+ />
+ )}
+ </XDSChatMessage>
+ );
+ })}
+ </XDSChatMessageList>
+ </XDSChatLayout>
</XDSAppShell>
);
}
@@ -669,244 +669,104 @@ export default function AIChatTemplate() {
return (
<XDSAppShell sideNav={<AIChatSideNav />} variant="elevated">
- <XDSVStack
- gap={8}
- style={{
- maxWidth: 720,
- margin: '0 auto',
- paddingBlock: 'var(--spacing-8)',
- paddingInline: 'var(--spacing-4)',
- minHeight: '100%',
- justifyContent: 'center',
- }}>
- {/* Greeting */}
- <XDSVStack gap={1} style={{paddingInline: 'var(--spacing-4)'}}>
- <XDSHStack gap={2} vAlign="center">
- <SparklesIcon
- style={{
- width: 20,
- height: 20,
- color: 'var(--color-primary, #5B5BD6)',
- }}
- />
- <XDSText type="large" as="h2">
- Hi, Andrew
- </XDSText>
- </XDSHStack>
- <XDSText type="display-2" as="h1">
- Where should we start?
- </XDSText>
- </XDSVStack>
-
- {/* Composer */}
- <input
- ref={fileInputRef}
- type="file"
- multiple
- style={{display: 'none'}}
- onChange={e => {
- const files = Array.from(e.target.files ?? []);
- setAttachments(prev => [...prev, ...files.map(f => f.name)]);
- e.target.value = '';
- }}
- />
- <XDSChatComposer
- onSubmit={handleSubmit}
- onStop={handleStop}
- isStreaming={isStreaming}
- placeholder="Ask anything"
- input={
- <XDSChatComposerInput
- ref={composerInputRef}
- triggers={composerTriggers}
- style={{minHeight: '44px'}}
- />
- }
- drawer={
- attachments.length > 0 ? (
- <XDSChatComposerDrawer
- count={attachments.length}
- defaultIsCollapsed>
- {attachments.map((name, i) => (
- <XDSToken
- key={i}
- label={name}
- onRemove={() =>
- setAttachments(prev => prev.filter((_, j) => j !== i))
- }
- />
- ))}
- </XDSChatComposerDrawer>
- ) : undefined
- }
- headerActions={
- <>
- <XDSDropdownMenu
- button={{
- label: 'Reference',
- variant: 'ghost',
- size: 'sm',
- icon: <AtSymbolIcon style={{width: 16, height: 16}} />,
- isIconOnly: true,
- }}
- hasChevron={false}
- menuWidth={240}>
- {MENTION_ITEMS.map(item => (
- <XDSDropdownMenuItem
- key={item.id}
- label={item.label}
- description={item.auxiliaryData?.role}
- onClick={() => {
- composerInputRef.current?.focus();
- // Move cursor to end so token is appended
- const sel = window.getSelection();
- if (sel && document.activeElement) {
- sel.selectAllChildren(document.activeElement);
- sel.collapseToEnd();
- }
- composerInputRef.current?.insertToken({
- value: `@${item.id}`,
- label: item.label,
- variant: 'blue',
- });
- document.activeElement?.dispatchEvent(
- new Event('input', {bubbles: true}),
- );
+ <XDSLayout
+ contentWidth={720}
+ padding={6}
+ content={
+ <XDSLayoutContent>
+ <XDSVStack gap={8} vAlign="center" style={{minHeight: '100%'}}>
+ {/* Greeting */}
+ <XDSVStack gap={1}>
+ <XDSHStack gap={2} vAlign="center">
+ <XDSIcon icon={SparklesIcon} size="md" color="accent" />
+ <XDSText type="large" as="h2">
+ Hi, Andrew
+ </XDSText>
+ </XDSHStack>
+ <XDSText type="display-2" as="h1">
+ Where should we start?
+ </XDSText>
+ </XDSVStack>
+
+ {/* Composer */}
+ {fileInput}
+ {renderComposer({
+ inputMinHeight: '84px',
+ extraFooterActions: (
+ <XDSDropdownMenu
+ button={{
+ label: 'Settings',
+ variant: 'ghost',
+ size: 'md',
+ icon: <XDSIcon icon={Cog6ToothIcon} size="sm" />,
+ children: 'Settings',
}}
+ menuWidth={200}
+ items={[
+ {label: 'Preferences', onClick: () => {}},
+ {label: 'Keyboard shortcuts', onClick: () => {}},
+ {label: 'About', onClick: () => {}},
+ ]}
/>
- ))}
- </XDSDropdownMenu>
- <XDSButton
- label="Attach"
- variant="ghost"
- size="sm"
- icon={<PaperClipIcon style={{width: 16, height: 16}} />}
- isIconOnly
- onClick={() => fileInputRef.current?.click()}
- />
- </>
- }
- footerActions={
- <>
- <XDSDropdownMenu
- button={{
- label: activeMode.label,
- variant: 'ghost',
- size: 'md',
- icon: <activeMode.icon style={{width: 16, height: 16}} />,
- children: activeMode.label,
- }}
- menuWidth={200}
- isMenuOpen={isModeMenuOpen}
- onOpenChange={(isOpen: boolean) => {
- setIsModeMenuOpen(isOpen);
- if (!isOpen && shouldFocusComposerRef.current) {
- shouldFocusComposerRef.current = false;
- // Delay focus until after menu restores focus to its trigger button
- setTimeout(() => {
- composerInputRef.current?.focus();
- }, 50);
- }
- }}
- items={MODE_OPTIONS.flatMap(opt => {
- const item = {
- label: opt.label,
- icon: opt.icon,
- onClick: () => {
- const tokenLabel = TOKEN_MODES[opt.key];
- if (tokenLabel) {
- composerInputRef.current?.focus();
- composerInputRef.current?.insertToken({
- value: tokenLabel,
- label: tokenLabel,
- variant: 'orange',
- });
- // Dispatch input event to trigger emitChange and clear placeholder
- document.activeElement?.dispatchEvent(
- new Event('input', {bubbles: true}),
- );
- shouldFocusComposerRef.current = true;
- } else {
- setMode(opt.key);
- }
- },
- };
- return opt.key === 'sensitive'
- ? [{type: 'divider' as const}, item]
- : [item];
- })}
- />
- <XDSDropdownMenu
- button={{
- label: 'Settings',
- variant: 'ghost',
- size: 'md',
- icon: <Cog6ToothIcon style={{width: 16, height: 16}} />,
- children: 'Settings',
- }}
- menuWidth={200}
- items={[
- {label: 'Preferences', onClick: () => {}},
- {label: 'Keyboard shortcuts', onClick: () => {}},
- {label: 'About', onClick: () => {}},
- ]}
- />
- </>
- }
- sendActions={<XDSChatDictationButton dictation={dictation} />}
- />
+ ),
+ })}
- {/* Category toggle buttons */}
- <XDSVStack gap={6} style={{paddingInline: 'var(--spacing-3)'}}>
- <XDSToggleButtonGroup
- label="Category"
- value={category}
- onChange={setCategory}
- size="lg">
- {CATEGORIES.map(cat => (
- <XDSToggleButton
- key={cat.key}
- value={cat.key}
- label={cat.label}
- icon={<cat.icon style={{width: 16, height: 16}} />}
- />
- ))}
- </XDSToggleButtonGroup>
-
- {/* Suggestion cards */}
- {suggestions && (
- <XDSGrid minChildWidth={280} gap={3}>
- {suggestions.map(suggestion => (
- <XDSCard
- variant="muted"
- key={suggestion.heading}
- padding={3}
- style={{cursor: 'pointer'}}
- role="button"
- tabIndex={0}
- onClick={() => {
- appendSuggestion(suggestion.prompt);
- setMode(category);
- }}
- onKeyDown={(e: React.KeyboardEvent) => {
- if (e.key === 'Enter' || e.key === ' ') {
- e.preventDefault();
- appendSuggestion(suggestion.prompt);
- setMode(category);
- }
- }}>
- <XDSVStack gap={0.5}>
- <XDSHeading level={4}>{suggestion.heading}</XDSHeading>
- <XDSText type="body" color="secondary" size="xsm">
- {suggestion.body}
- </XDSText>
- </XDSVStack>
- </XDSCard>
- ))}
- </XDSGrid>
- )}
- </XDSVStack>
- </XDSVStack>
+ {/* Category toggle buttons */}
+ <XDSVStack gap={6} style={{paddingInline: 'var(--spacing-3)'}}>
+ <XDSToggleButtonGroup
+ label="Category"
+ value={category}
+ onChange={setCategory}
+ size="lg">
+ {CATEGORIES.map(cat => (
+ <XDSToggleButton
+ key={cat.key}
+ value={cat.key}
+ label={cat.label}
+ icon={<XDSIcon icon={cat.icon} size="sm" />}
+ />
+ ))}
+ </XDSToggleButtonGroup>
+
+ {/* Suggestion cards */}
+ {suggestions && (
+ <XDSGrid columns={{minWidth: 280}} gap={3}>
+ {suggestions.map(suggestion => (
+ <XDSCard
+ variant="muted"
+ key={suggestion.heading}
+ padding={3}
+ style={{cursor: 'pointer'}}
+ role="button"
+ tabIndex={0}
+ onClick={() => {
+ replaceWithSuggestion(suggestion.prompt);
+ setMode(category);
+ }}
+ onKeyDown={(e: React.KeyboardEvent) => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ e.preventDefault();
+ replaceWithSuggestion(suggestion.prompt);
+ setMode(category);
+ }
+ }}>
+ <XDSVStack gap={0.5}>
+ <XDSHeading level={4}>
+ {suggestion.heading}
+ </XDSHeading>
+ <XDSText type="body" color="secondary" size="xsm">
+ {suggestion.body}
+ </XDSText>
+ </XDSVStack>
+ </XDSCard>
+ ))}
+ </XDSGrid>
+ )}
+ </XDSVStack>
+ </XDSVStack>
+ </XDSLayoutContent>
+ }
+ />
</XDSAppShell>
);
}
diff --git a/packages/cli/templates/pages/dashboard/page.tsx b/packages/cli/templates/pages/dashboard/page.tsx
index c68af47c28..348637829a 100644
--- a/packages/cli/templates/pages/dashboard/page.tsx
+++ b/packages/cli/templates/pages/dashboard/page.tsx
@@ -31,6 +31,7 @@ import {XDSTable, proportional, pixel} from '@xds/core/Table';
import type {XDSTableColumn} from '@xds/core/Table';
import {XDSDivider} from '@xds/core/Divider';
import {XDSLink} from '@xds/core/Link';
+import {XDSIcon} from '@xds/core/Icon';
// ============= ICONS =============
@@ -47,6 +48,7 @@ import {
import {
Squares2X2Icon as Squares2X2IconSolid,
ChartBarIcon as ChartBarIconSolid,
+ StopIcon,
} from '@heroicons/react/24/solid';
// ============= DATA =============
@@ -371,6 +373,32 @@ const topPagesData: PageRow[] = [
},
];
+const topPagesMaxViews = Math.max(...topPagesData.map(d => d.views));
+
+const topPagesColumns: XDSTableColumn<PageRow>[] = [
+ {key: 'page', header: 'Page', width: pixel(160)},
+ {
+ key: 'views',
+ header: 'Views',
+ width: proportional(1),
+ renderCell: (item: PageRow) => (
+ <XDSVStack gap={1}>
+ <XDSProgressBar
+ value={item.views}
+ max={topPagesMaxViews}
+ label={`${item.page} views`}
+ isLabelHidden
+ />
+ <XDSText type="supporting">
+ {item.views.toLocaleString()} views
+ </XDSText>
+ </XDSVStack>
+ ),
+ },
+ {key: 'newUsers', header: 'New Users', width: pixel(120)},
+ {key: 'avgTime', header: 'Avg. Time', width: pixel(120)},
+];
+
// Engagement — Top events
interface EventRow extends Record<string, unknown> {
id: string;
@@ -393,6 +421,40 @@ const topEventsData: EventRow[] = [
{id: '10', event: 'share', count: 580, users: 410, newUsers: 160},
];
+const topEventsMaxCount = Math.max(...topEventsData.map(d => d.count));
+
+const topEventsColumns: XDSTableColumn<EventRow>[] = [
+ {key: 'event', header: 'Event', width: pixel(160)},
+ {
+ key: 'count',
+ header: 'Count',
+ width: proportional(1),
+ renderCell: (item: EventRow) => (
+ <XDSVStack gap={1}>
+ <XDSProgressBar
+ value={item.count}
+ max={topEventsMaxCount}
+ label={`${item.count}`}
+ isLabelHidden
+ />
+ <XDSText type="supporting">{item.count.toLocaleString()}</XDSText>
+ </XDSVStack>
+ ),
+ },
+ {
+ key: 'users',
+ header: 'Users',
+ width: pixel(120),
+ renderCell: (item: EventRow) => item.users.toLocaleString(),
+ },
+ {
+ key: 'newUsers',
+ header: 'New Users',
+ width: pixel(120),
+ renderCell: (item: EventRow) => item.newUsers.toLocaleString(),
+ },
+];
+
// ============= CHART COMPONENTS =============
// Chart line colors via XDS design tokens (CSS custom properties)
@@ -405,9 +467,7 @@ const chartColors = {
function ChartLegendItem({color, label}: {color: string; label: string}) {
return (
<XDSHStack gap={2} vAlign="center">
- <svg width="16" height="3">
- <line x1="0" y1="1.5" x2="16" y2="1.5" stroke={color} strokeWidth="2" />
- </svg>
+ <XDSIcon icon={StopIcon} size="xsm" style={{color}} />
<XDSText type="supporting" color="secondary">
{label}
</XDSText>
@@ -427,30 +487,21 @@ function ChartTooltip({
if (!active || !payload?.length) return null;
const point = activeUsersData.find(d => d.hour === label);
return (
- <div
- style={{
- backgroundColor: 'var(--color-background-popover, #fff)',
- border: '1px solid var(--color-border, rgba(5, 54, 89, 0.1))',
- borderRadius: 'var(--radius-element, 8px)',
- padding: 'var(--spacing-3, 12px)',
- boxShadow: 'var(--shadow-med)',
- }}>
+ <XDSCard padding={3}>
<XDSVStack gap={1}>
<XDSText type="supporting" color="secondary">
{point?.label ?? ''}
</XDSText>
{payload.map(entry => (
<XDSHStack key={entry.name} gap={2} vAlign="center">
- <svg width={8} height={8} style={{flexShrink: 0}}>
- <circle cx={4} cy={4} r={4} fill={entry.color} />
- </svg>
+ <XDSIcon icon={StopIcon} size="xsm" style={{color: entry.color}} />
<XDSText type="supporting">
{entry.name}: {entry.value}
</XDSText>
</XDSHStack>
))}
</XDSVStack>
- </div>
+ </XDSCard>
);
}
@@ -570,21 +621,9 @@ function MetricCard({
<XDSHeading level={2}>{value}</XDSHeading>
<XDSHStack gap={1} vAlign="center">
{positive ? (
- <ArrowUpIcon
- style={{
- width: 12,
- height: 12,
- color: 'var(--color-success, #0D8626)',
- }}
- />
+ <XDSIcon icon={ArrowUpIcon} size="xsm" color="positive" />
) : (
- <ArrowDownIcon
- style={{
- width: 12,
- height: 12,
- color: 'var(--color-error, #E3193B)',
- }}
- />
+ <XDSIcon icon={ArrowDownIcon} size="xsm" color="negative" />
)}
<XDSText type="body" color="secondary">
{change}
@@ -646,9 +685,7 @@ function StackedBarCard({
{data.map(d => (
<XDSVStack key={d.label} gap={0}>
<XDSHStack gap={2} vAlign="center">
- <svg width={8} height={8} style={{flexShrink: 0}}>
- <circle cx={4} cy={4} r={4} fill={d.color} />
- </svg>
+ <XDSIcon icon={StopIcon} size="xsm" style={{color: d.color}} />
<XDSText type="supporting">{d.label}</XDSText>
</XDSHStack>
<XDSText type="supporting" color="secondary">
@@ -664,117 +701,30 @@ function StackedBarCard({
// ============= TABLE COMPONENTS =============
-function TopPagesCard() {
- const maxViews = Math.max(...topPagesData.map(d => d.views));
-
- const columns: XDSTableColumn<PageRow>[] = [
- {key: 'page', header: 'Page', width: pixel(160)},
- {
- key: 'views',
- header: 'Views',
- width: proportional(1),
- renderCell: (item: PageRow) => (
- <XDSVStack gap={1}>
- <XDSProgressBar
- value={item.views}
- max={maxViews}
- label={`${item.page} views`}
- isLabelHidden
- />
- <XDSText type="supporting">
- {item.views.toLocaleString()} views
- </XDSText>
- </XDSVStack>
- ),
- },
- {
- key: 'newUsers',
- header: 'New Users',
- width: pixel(120),
- },
- {
- key: 'avgTime',
- header: 'Avg. Time',
- width: pixel(120),
- },
- ];
-
- return (
- <XDSCard padding={0}>
- <XDSVStack>
- <XDSHStack
- hAlign="between"
- vAlign="center"
- style={{padding: 'var(--spacing-4, 16px)'}}>
- <XDSHeading level={4}>Top pages</XDSHeading>
- <XDSLink label="All pages" href="#">
- All pages
- </XDSLink>
- </XDSHStack>
- <XDSTable<PageRow>
- data={topPagesData}
- columns={columns}
- idKey="id"
- density="compact"
- dividers="rows"
- hasHover
- />
- </XDSVStack>
- </XDSCard>
- );
-}
-
-function TopEventsCard() {
- const maxCount = Math.max(...topEventsData.map(d => d.count));
-
- const columns: XDSTableColumn<EventRow>[] = [
- {key: 'event', header: 'Event', width: pixel(160)},
- {
- key: 'count',
- header: 'Count',
- width: proportional(1),
- renderCell: (item: EventRow) => (
- <XDSVStack gap={1}>
- <XDSProgressBar
- value={item.count}
- max={maxCount}
- label={`${item.count}`}
- isLabelHidden
- />
- <XDSText type="supporting">{item.count.toLocaleString()}</XDSText>
- </XDSVStack>
- ),
- },
- {
- key: 'users',
- header: 'Users',
- width: pixel(120),
- renderCell: (item: EventRow) => item.users.toLocaleString(),
- },
- {
- key: 'newUsers',
- header: 'New Users',
- width: pixel(120),
- renderCell: (item: EventRow) => item.newUsers.toLocaleString(),
- },
- ];
-
+function TableCard<T extends {id: string}>({
+ title,
+ linkLabel,
+ linkHref,
+ data,
+ columns,
+}: {
+ title: string;
+ linkLabel: string;
+ linkHref: string;
+ data: T[];
+ columns: XDSTableColumn<T>[];
+}) {
return (
- <XDSCard padding={0}>
- <XDSVStack>
- <XDSHStack
- vAlign="center"
- hAlign="between"
- style={{
- padding: 'var(--spacing-4, 16px)',
- }}>
- <XDSHeading level={4}>Top events</XDSHeading>
- <XDSLink label="All events" href="#">
- All events
+ <XDSCard>
+ <XDSVStack gap={6}>
+ <XDSHStack hAlign="between" vAlign="center">
+ <XDSHeading level={4}>{title}</XDSHeading>
+ <XDSLink label={linkLabel} href={linkHref}>
+ {linkLabel}
</XDSLink>
</XDSHStack>
- <XDSTable<EventRow>
- data={topEventsData}
+ <XDSTable<T>
+ data={data}
columns={columns}
idKey="id"
density="compact"
@@ -796,7 +746,7 @@ function DashboardSideNav() {
<XDSSideNavHeading
icon={
<XDSNavIcon
- icon={<ChartBarIconSolid style={{width: 16, height: 16}} />}
+ icon={<XDSIcon icon={ChartBarIconSolid} size="sm" />}
/>
}
heading="Analytics"
@@ -850,25 +800,36 @@ export default function DashboardTemplate() {
variant="elevated"
height="auto"
contentPadding={6}>
- <XDSVStack gap={6} style={{paddingBottom: 'var(--spacing-12, 48px)'}}>
+ <XDSVStack gap={6}>
{/* Active Users Chart */}
- <XDSVStack gap={4}>
+ <XDSVStack gap={6}>
<XDSHStack hAlign="between" vAlign="center">
<XDSHeading level={3}>Active users</XDSHeading>
<XDSButton
label="Reload"
variant="secondary"
size="md"
- icon={<ArrowPathIcon style={{width: 16, height: 16}} />}
+ icon={<XDSIcon icon={ArrowPathIcon} size="sm" />}
/>
</XDSHStack>
<ActiveUsersChart />
</XDSVStack>
{/* Metric Cards */}
- <XDSGrid minChildWidth={240} gap={4}>
- {metrics.map((m, i) => (
- <MetricCard key={m.label} {...m} sparkline={sparklines[i]} />
+ <XDSGrid columns={{minWidth: 320, repeat: 'fit'}} gap={4}>
+ {[0, 2].map((start) => (
+ <XDSGrid
+ key={start}
+ columns={{minWidth: 240, repeat: 'fit'}}
+ gap={4}>
+ {metrics.slice(start, start + 2).map((m, i) => (
+ <MetricCard
+ key={m.label}
+ {...m}
+ sparkline={sparklines[start + i]}
+ />
+ ))}
+ </XDSGrid>
))}
</XDSGrid>
@@ -879,7 +840,7 @@ export default function DashboardTemplate() {
<XDSHeading level={3}>Demographics</XDSHeading>
<XDSButton label="View more" variant="secondary" size="md" />
</XDSHStack>
- <XDSGrid minChildWidth={480} gap={4}>
+ <XDSGrid columns={{minWidth: 320, repeat: 'fit'}} gap={4}>
<StackedBarCard title="Region" data={regionData} />
<StackedBarCard title="Role" data={roleData} />
</XDSGrid>
@@ -891,9 +852,21 @@ export default function DashboardTemplate() {
<XDSHeading level={3}>Engagement</XDSHeading>
<XDSButton label="View more" variant="secondary" size="md" />
</XDSHStack>
- <XDSGrid minChildWidth={480} gap={4}>
- <TopPagesCard />
- <TopEventsCard />
+ <XDSGrid columns={{minWidth: 320, repeat: 'fit'}} gap={4}>
+ <TableCard
+ title="Top pages"
+ linkLabel="All pages"
+ linkHref="#"
+ data={topPagesData}
+ columns={topPagesColumns}
+ />
+ <TableCard
+ title="Top events"
+ linkLabel="All events"
+ linkHref="#"
+ data={topEventsData}
+ columns={topEventsColumns}
+ />
</XDSGrid>
</XDSVStack>
</XDSAppShell>
diff --git a/packages/cli/templates/pages/library/page.tsx b/packages/cli/templates/pages/library/page.tsx
index c4e888f29d..8cd8de89ca 100644
--- a/packages/cli/templates/pages/library/page.tsx
+++ b/packages/cli/templates/pages/library/page.tsx
@@ -9,10 +9,11 @@ import {XDSAspectRatio} from '@xds/core/AspectRatio';
import {XDSToggleButton, XDSToggleButtonGroup} from '@xds/core/ToggleButton';
import {XDSTextInput} from '@xds/core/TextInput';
import {XDSDivider} from '@xds/core/Divider';
+import {XDSSection} from '@xds/core/Section';
import {XDSGrid} from '@xds/core/Grid';
-import {XDSHStack, XDSVStack} from '@xds/core/Stack';
+import {XDSHStack, XDSVStack, XDSStackItem} from '@xds/core/Stack';
import {XDSDropdownMenu} from '@xds/core/DropdownMenu';
-import {colorVars, spacingVars} from '@xds/core/theme/tokens.stylex';
+import {XDSOverflowList} from '@xds/core/OverflowList';
import {XDSAppShell} from '@xds/core/AppShell';
import {
XDSSideNav,
@@ -42,12 +43,9 @@ interface LibraryItem {
description: string;
category: string;
type: 'Component' | 'Pattern' | 'Utility';
- image: string;
imageUrl?: string;
}
-const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? '';
-
const CATEGORIES = ['All', 'Layout', 'Forms', 'Navigation', 'Feedback', 'Data'];
const ITEMS: LibraryItem[] = [
@@ -58,9 +56,7 @@ const ITEMS: LibraryItem[] = [
'Vertical and horizontal stack layouts with configurable gap and alignment.',
category: 'Layout',
type: 'Component',
- image: 'colorful-home-horizontal-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/672709173_900474269697313_6817386054486922176_n.png?_nc_cat=100&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=iIKb1WSCA14Q7kNvwGlNbtn&_nc_oc=AdrykiMeaxgFAE7bYt7z3hrFgV9LYf_9OAEl0WKkCvVeRM5d-vwPK4CSUS6UcBY2w32qurQLty2efstnWXpTWLlW&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=lByw0uq5VDQ8mcm62_f1LQ&_nc_ss=7a30f&oh=00_Af0U55E1N7MKjOx-TgGtLKR0kOjec6KNYS-grrcKKw4umw&oe=69E748BB',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/colorful-home-horizontal-1.png',
},
{
id: '2',
@@ -69,9 +65,7 @@ const ITEMS: LibraryItem[] = [
'Responsive grid container with auto-fit columns and gap control.',
category: 'Layout',
type: 'Component',
- image: 'illustrative-horizontal-3.jpg',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/672674636_1739232910577387_6597229795491381664_n.jpg?_nc_cat=102&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=BHpXUpN7WVUQ7kNvwEoQ0_b&_nc_oc=AdoVUiw3wwLFb0IrwYYyhIJ0-tqsnKcrjtjVvJaGJ9KicJIy5yvMkoDtTuSwNjaWlGI3V7m6vaCvhuUxGyaAswes&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=rPIUj9G_99-PoGk-J_CpMw&_nc_ss=7a30f&oh=00_Af31VV984jck27zRyjZg9HBF1NBm4B2-euqQkM-xHKFdwQ&oe=69E724D2',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/illustrative-horizontal-3.jpg',
},
{
id: '3',
@@ -80,9 +74,7 @@ const ITEMS: LibraryItem[] = [
'Surface container with optional padding, border, and shadow variants.',
category: 'Layout',
type: 'Component',
- image: 'light-working-horizontal-2.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/671588323_987740997112258_5691335682748609046_n.png?_nc_cat=105&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=WfIfjZO9-6sQ7kNvwET2M4I&_nc_oc=AdrsKKSvOhHILrhSNxECxKHSnMiOUwFs-gPh4MEUaOYJNwNfN_pcmEiOgD8ciJnwQZw_j5lHk7GqMDbnsDtOU1HO&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=YgeO6a-1uDi2whRBCAa7Dg&_nc_ss=7a30f&oh=00_Af0_221vTnLTwGIvpURmeFou_8FA2JwR83Cdz9ynLmWp1A&oe=69E74B08',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/light-working-horizontal-2.png',
},
{
id: '4',
@@ -90,9 +82,7 @@ const ITEMS: LibraryItem[] = [
description: 'Centers its child both horizontally and vertically.',
category: 'Layout',
type: 'Utility',
- image: 'moody-scene-horizontal-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/672863405_1398068472358179_8859473259447111379_n.png?_nc_cat=100&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=-wV2jHO2HVUQ7kNvwHII-Es&_nc_oc=AdobiagnGPar0u1nxTOwq9u6H-QVDvZGi4KE3WIhesgGIMcw2F55ipAAHIuXzMEmV9ywAH8vKhaOJHGKmh6UD1T0&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=OuLzeHkv5fq8T3II_JVUPg&_nc_ss=7a30f&oh=00_Af1K-F656__KQnYSFduAeNg-umQEbvABm3hxJ7CALSkzLg&oe=69E71FCA',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/moody-scene-horizontal-1.png',
},
{
id: '5',
@@ -100,9 +90,7 @@ const ITEMS: LibraryItem[] = [
description: 'Semantic page section with optional heading and divider.',
category: 'Layout',
type: 'Pattern',
- image: 'colorful-lifestyle-horizontal-2.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/671434591_1481606660072800_8012368080583907436_n.png?_nc_cat=111&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=1jIzvQ3OhF4Q7kNvwEoj_Gm&_nc_oc=Adrj9SBr9bUSpxL-EY9wc30ipgEcYIfB4iiq8igirMRQYEQ7oq5X5GAEQkZ6NTizrR2HYSsBKnp1wHNRQuWc7cEK&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=48TBZohsWnEw9HKapVXTxQ&_nc_ss=7a30f&oh=00_Af02FH4Ts_KZsOOraMrIwb5MUWKf_EYPkbeokaTVsR27aA&oe=69E74E03',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/colorful-lifestyle-horizontal-2.png',
},
{
id: '6',
@@ -110,9 +98,7 @@ const ITEMS: LibraryItem[] = [
description: 'Expandable region with animated height transition.',
category: 'Layout',
type: 'Component',
- image: 'light-scene-horizontal-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/670900322_26625087630454957_5308285999469581630_n.png?_nc_cat=108&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=uACEMOhCsoIQ7kNvwF3ME1M&_nc_oc=AdqwA4epXgqLkKkURZ7TQ6cuG_sMElGDJQ1ycxqDoQnOSH28h85A4RGCoaByKQqkgH1Z1QVvSyt3dx1IPyvrVUt9&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=p_Pm4pNbFaXCdziuHy7INA&_nc_ss=7a30f&oh=00_Af2ek2MJbu2tKRgGyzg4RATqxcDziUHQ7fRRNhZ0z_DdyQ&oe=69E73804',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/light-scene-horizontal-1.png',
},
{
id: '7',
@@ -121,9 +107,7 @@ const ITEMS: LibraryItem[] = [
'Single-line text field with label, placeholder, and validation states.',
category: 'Forms',
type: 'Component',
- image: 'moody-working-horizontal-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/672159311_4447867172115241_7002602233372379744_n.png?_nc_cat=103&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=bEIa0XYhihoQ7kNvwG92GtN&_nc_oc=Ado8n5cUXW_AF8dkBxE6zoKRGaNh5pihVSTt9HJh6WZ_b7gMfOk75oyXWsDKx9ITKL7oZOelQtQkPM12dEynS7VS&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=6kTkFzsznxojh0657IsK_Q&_nc_ss=7a30f&oh=00_Af31Y-cyfQiRA4TNjUEWb8l_aSeCUJO8paZ-1K6uYecSsA&oe=69E756DD',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/moody-working-horizontal-1.png',
},
{
id: '8',
@@ -131,9 +115,7 @@ const ITEMS: LibraryItem[] = [
description: 'Multi-line text field with auto-resize and character count.',
category: 'Forms',
type: 'Component',
- image: 'colorful-working-horizontal-3.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/673504783_1487897739608810_1925416936910686772_n.png?_nc_cat=104&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=yNTx65GXD_kQ7kNvwHv_Urw&_nc_oc=AdofHQuLGAHKN_pEOGasb3eOYPn9s91MnmYahXX2q6vB6bRDeGkmrrBckgidP26f420sZ3XtEN0kUoe1zehdPIgB&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=VpzOQXA2qYAF3C_RKo1mqQ&_nc_ss=7a30f&oh=00_Af0v3wkloCLB4H6IaITDZS1t5rL8hl0LBobKfqD4sa-q4Q&oe=69E730B5',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/colorful-working-horizontal-3.png',
},
{
id: '9',
@@ -141,9 +123,7 @@ const ITEMS: LibraryItem[] = [
description: 'Checkbox with label, indeterminate state, and group support.',
category: 'Forms',
type: 'Component',
- image: 'illustrative-horizontal-1.jpg',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/670836735_2461791954280697_1048571955964692895_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=NE4GxGlZyM4Q7kNvwFvh2dn&_nc_oc=AdqA_axYcnif8e7X3F_08gK0eFVqvwMHvodahTa1yiG4tjAf1QVEyTcgs0N_O7LnNF8wc6bYGN051y0SS5XHnPGU&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=yoM-5mc94Qw5KMkDII0Dmg&_nc_ss=7a30f&oh=00_Af3Ng9srmSE0jG3NRRcyTh0RMObfG7AHok0p_mqPNUxu4w&oe=69E732EB',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/illustrative-horizontal-1.jpg',
},
{
id: '10',
@@ -151,9 +131,7 @@ const ITEMS: LibraryItem[] = [
description: 'Group of radio buttons with accessible fieldset wrapper.',
category: 'Forms',
type: 'Component',
- image: 'light-home-horizontal-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/672683340_1522469159433922_7776167798061220106_n.png?_nc_cat=101&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=Qpd2UWP6VgEQ7kNvwESFt5K&_nc_oc=AdqEX8phEGjPJBOBrUiZY3HZNVQxII6j-cz4H6hBlNDUdGLOpKxDJv_oDECxUHu0UoYd_bWTEdLwpdfedgx-tYxw&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=6qjfHI4jCN_yeerKAI-Ccg&_nc_ss=7a30f&oh=00_Af334kbGGZUHHMBe9bzaqTnEWI6O6lP2rX9Pq1NfBL646A&oe=69E75514',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/light-home-horizontal-1.png',
},
{
id: '11',
@@ -161,9 +139,7 @@ const ITEMS: LibraryItem[] = [
description: 'Toggle switch for binary on/off settings.',
category: 'Forms',
type: 'Component',
- image: 'moody-home-horizontal-2.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/671154433_1690063268839561_5090150051169696390_n.png?_nc_cat=104&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=4OEnOHJ_CqEQ7kNvwHCDrrW&_nc_oc=AdpGok83uauCw-axF6-3SkecVRTT5R24qvFw2Y6MF8dS26snubO2VAjK9MgjHBUWeYuI7DiX-7zZuqNo_ycZtueE&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=f5YlFZMpCAD5hTnQFSA_Cw&_nc_ss=7a30f&oh=00_Af3KrcrwaATyNjVXpeoOYyz5DJ5_GSx1Ln5Y73mRlvjxuw&oe=69E75256',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/moody-home-horizontal-2.png',
},
{
id: '12',
@@ -172,9 +148,7 @@ const ITEMS: LibraryItem[] = [
'Dropdown or inline option selector with single and multi-select modes.',
category: 'Forms',
type: 'Component',
- image: 'colorful-product-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/670431376_2105383320320432_5814727365028419900_n.png?_nc_cat=100&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=ReoRfmbGsCsQ7kNvwFlXC-A&_nc_oc=Adr5Y-gt_d62iycutG1Zi958UparRSdkEdn42N6xkOeTMzzv4Jx1nK_caBsRXKHM-LZhAw7_tQcIHCZE4k_40RWP&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=_cim9u3VWjUrUazZk7pjlQ&_nc_ss=7a30f&oh=00_Af04wvI_DuxPoklNexvJr2_-P6b0JXjK0wFWoEu8c8vJOQ&oe=69E7219D',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/colorful-product-1.png',
},
{
id: '13',
@@ -183,9 +157,7 @@ const ITEMS: LibraryItem[] = [
'Horizontal tab navigation with underline indicator and keyboard support.',
category: 'Navigation',
type: 'Component',
- image: 'illustrative-horizontal-5.jpg',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/671996506_1459966745508173_9056303866152525429_n.jpg?_nc_cat=103&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=w0UFY5p0b5oQ7kNvwE6jyis&_nc_oc=AdrgGt_0Hil_5lsoaiRamp5vZ-v5PcHHjLDls2fNJwJWrsoZ7y0TJ2CBV2ZcN02qprSEWG98savkQfwa1vqcmQLs&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=tPcVNKagtFV1KJ1ed9fFIQ&_nc_ss=7a30f&oh=00_Af3XdWQ3oP8MZPJbQI8eQSYYDTOMaY-VRstnYvTr8r-IEw&oe=69E75380',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/illustrative-horizontal-5.jpg',
},
{
id: '14',
@@ -193,9 +165,7 @@ const ITEMS: LibraryItem[] = [
description: 'Application top bar with logo, nav links, and action slots.',
category: 'Navigation',
type: 'Pattern',
- image: 'light-working-horizontal-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/672683095_926730176788181_131978982706421059_n.png?_nc_cat=111&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=SwQeB8Ch8QQQ7kNvwGnRPa7&_nc_oc=AdpR1vWOj6y2UnFjArt9ozlTmDmt_v_GNZpmepQJILtTy53i-E9joQhuBI8QIoxZt3Da6nsC9YuAfoLYsg7Vn5Th&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=ha069IrkcZ8XB5d2u5p6Qg&_nc_ss=7a30f&oh=00_Af3ba1vZqPqEW_QBK0Tx46p-navZTCBrn1Luz8c5Ci2OAg&oe=69E73D29',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/light-working-horizontal-1.png',
},
{
id: '15',
@@ -204,9 +174,7 @@ const ITEMS: LibraryItem[] = [
'Vertical sidebar navigation with collapsible groups and active states.',
category: 'Navigation',
type: 'Pattern',
- image: 'moody-lifestyle-horizontal-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/672683283_927387496774236_4070733631712753485_n.png?_nc_cat=106&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=zunS4L-kPCIQ7kNvwEwWkz1&_nc_oc=Adqcan8m196zBZtNvWy0aWWHZyA5K1mCP5Q7qeboS8s4J8NOxyaUjsw8_dLg8AZD-nux6IeqzeaN9E_dRPLW0sQO&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=VX8GZ5LhkQu_NGXTuZMX1A&_nc_ss=7a30f&oh=00_Af0rcs3BPHgzcFKIxZGW2XQZIsfv9JZPHFIdLcuP3JTC1Q&oe=69E71F38',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/moody-lifestyle-horizontal-1.png',
},
{
id: '16',
@@ -214,9 +182,7 @@ const ITEMS: LibraryItem[] = [
description: 'Path trail navigation with separator and truncation support.',
category: 'Navigation',
type: 'Component',
- image: 'colorful-home-horizontal-2.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/670881450_1516722106735012_4194149430288072444_n.png?_nc_cat=100&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=0D9gv2qI-FIQ7kNvwF3_NCl&_nc_oc=AdqJGqxaSuzUZKou7L7Tkz1ds8zeg7rgAsncs1zifbxzhF1LsIJhltcVgSdsjjeS7mELDpojUATUy0c2iOzTAlBB&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=FfAWGOtY7TVrEMjYAvjZgQ&_nc_ss=7a30f&oh=00_Af0_gTkerUQ4_tTUM69LJHv63eMATps4KyN9sCvHQGvXaA&oe=69E7462A',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/colorful-home-horizontal-2.png',
},
{
id: '17',
@@ -225,9 +191,7 @@ const ITEMS: LibraryItem[] = [
'Page navigation with prev/next controls and page count display.',
category: 'Navigation',
type: 'Component',
- image: 'colorful-working-horizontal-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/670744023_3535923059888739_5550832236433536986_n.png?_nc_cat=100&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=XsEB8JQy7oYQ7kNvwFA-gN2&_nc_oc=Adqaf_tLomimdUolWeCuqDhkSUsrUirJ-GDWNgRO0J8G6FGM3oV1PPVXMkKOYGNp3Rw_aTg8BKoo2rvXhvK76HMq&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=_sNOTrHCWzF_rO5odgcLbw&_nc_ss=7a30f&oh=00_Af3tMVt2BG56V2DudVJIBEPWlh9hd_b5GCtF-FYj3A4lAA&oe=69E73449',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/colorful-working-horizontal-1.png',
},
{
id: '18',
@@ -236,9 +200,7 @@ const ITEMS: LibraryItem[] = [
'Bottom tab bar for mobile viewports with icon and label slots.',
category: 'Navigation',
type: 'Pattern',
- image: 'light-working-horizontal-3.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/673941911_26516873217954372_8426801068656596725_n.png?_nc_cat=103&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=jyp_gpiGVO8Q7kNvwEL0lJS&_nc_oc=AdpqyKit2i58CmhBpOXXcItj3QNRqROkrc-dDf5f0IXOjKnu9o4yAaVLJvs4h2PfSwRfyJ_AU-acxGuViZi6HXt_&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=AwOqDUeqjU1TY_A_BIJ6_g&_nc_ss=7a30f&oh=00_Af1eke4KFZHL8xKZAW9o9lBm8imFN_zuFZ_ZlKtINez8Ew&oe=69E72391',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/light-working-horizontal-3.png',
},
{
id: '19',
@@ -247,9 +209,7 @@ const ITEMS: LibraryItem[] = [
'Compact label for status, count, or category with semantic color variants.',
category: 'Feedback',
type: 'Component',
- image: 'moody-working-horizontal-2.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/672681829_1455818443002340_3278091928414998674_n.png?_nc_cat=111&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=vCRXkxiQIzAQ7kNvwFBqK6q&_nc_oc=Adp_33IHyMy66cMoKYWVZrjMjJeTxQT-50D10Jxg_oou9OkgjOGrCdQwFHNGmbJ5AjOMhSrQHpEzgs7KXDGmb2tm&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=d2Iq9kq-Nrr8cW2NOcufsg&_nc_ss=7a30f&oh=00_Af0_EAo3WEnWC7PYt6OzOHOzm3FeXixnteqPTq4ubNTAQg&oe=69E73A10',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/moody-working-horizontal-2.png',
},
{
id: '20',
@@ -258,9 +218,7 @@ const ITEMS: LibraryItem[] = [
'Full-width alert bar for info, success, warning, and error messages.',
category: 'Feedback',
type: 'Component',
- image: 'illustrative-horizontal-2.jpg',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/672815225_1876405093020036_2561561570479095601_n.jpg?_nc_cat=103&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=PSy-GTVfE0UQ7kNvwH690eQ&_nc_oc=AdqhOtKGbSX_adJ3Fa6LFL2c1xTmlbhcsqQYHctZ5SpxfJff64DWNm2LBXbGkiSzYZKpxwqnrW5rNpQkm6DTBn37&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=y1Gbx96VY_8wpsolyUdM9w&_nc_ss=7a30f&oh=00_Af0VOkJLPNKG42BbYeOaQQRdC_3I4M5JA1dF1wOaKxn-WQ&oe=69E7559E',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/illustrative-horizontal-2.jpg',
},
{
id: '21',
@@ -268,9 +226,7 @@ const ITEMS: LibraryItem[] = [
description: 'Animated loading indicator with size and color variants.',
category: 'Feedback',
type: 'Component',
- image: 'colorful-lifestyle-horizontal-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/670869277_2384531585379073_4187196261303804271_n.png?_nc_cat=109&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=k42Doxes-E8Q7kNvwHnm_Pl&_nc_oc=Adpt6QPDf1U4EkSOEbFoz4GxnzlDikgTBxxYvycB8schEpeFjU1aGU-yRkGOOAKGZ71dGOCmsCiG1zT-pB-Hxkw5&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=2jVTNXR1Pi2BZsn6Jr1MhQ&_nc_ss=7a30f&oh=00_Af3ibqe2LFfDrXWzuJm3H5KMJCua1uM_xRz7T5b5RYkrhg&oe=69E74AEF',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/colorful-lifestyle-horizontal-1.png',
},
{
id: '22',
@@ -278,9 +234,7 @@ const ITEMS: LibraryItem[] = [
description: 'Horizontal bar indicating task completion percentage.',
category: 'Feedback',
type: 'Component',
- image: 'light-lifestyle-horizontal-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/673173617_1842726693762408_2908608806392112143_n.png?_nc_cat=107&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=y8uaA8M8_e4Q7kNvwGEJXk-&_nc_oc=AdpMxtpsxksfsuD3TQyVW48cn6SFvah41MABc0Xaz0gdCzOztfcGTJvczrJE0s87rXruPjf-i_NAMzRngeqlz2oG&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=2yxu1WO0OG_L8M-D3lfPsQ&_nc_ss=7a30f&oh=00_Af3tnODxWJ9xoSXgzPy1EWLRHUQplbsmMbZP08pX1taAQA&oe=69E74B16',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/light-lifestyle-horizontal-1.png',
},
{
id: '23',
@@ -289,9 +243,7 @@ const ITEMS: LibraryItem[] = [
'Small dot indicator for presence, health, or pipeline status.',
category: 'Feedback',
type: 'Component',
- image: 'moody-home-horizontal-1.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/671420383_1473260394292788_982123928249290692_n.png?_nc_cat=106&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=yi-ios3IYhMQ7kNvwEoRhJg&_nc_oc=AdrhOasEIgHy2jJFMtBZS49J1zLJJ3TYIrbrDAVLJgTiYzHrLaWSx-KjMDyhE-mB_ut9P563-SGU9EkUarT_HJtD&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=T4LBo43crSQ65qS7Hf8Hkg&_nc_ss=7a30f&oh=00_Af0IXAO-geyl3Bo9vnbbVdr7Cony-FSC6V8QgsjgdOwRpQ&oe=69E74A7A',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/moody-home-horizontal-1.png',
},
{
id: '24',
@@ -300,9 +252,7 @@ const ITEMS: LibraryItem[] = [
'Contextual label that appears on hover with configurable placement.',
category: 'Feedback',
type: 'Component',
- image: 'colorful-working-horizontal-2.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/671960592_1009710475063658_2065693335736770676_n.png?_nc_cat=110&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=d1I34HzGJIgQ7kNvwE76zBz&_nc_oc=AdrTjXcjX8m02E351dP7IA0f_qzdwIc4rj5NfWZUcroCJwwkmdZ4VwBmnPK7MryEQfAl9uJZoBB3BxzevYn1Gix7&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=fOIN55siBUYYDqShZz41SQ&_nc_ss=7a30f&oh=00_Af0ddX5F4DYMqu7vRcvFgXu3vTFCJsvmb4X3PRB_GECb-Q&oe=69E74041',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/colorful-working-horizontal-2.png',
},
{
id: '25',
@@ -311,9 +261,7 @@ const ITEMS: LibraryItem[] = [
'Feature-rich data table with sorting, selection, and column resizing.',
category: 'Data',
type: 'Component',
- image: 'illustrative-horizontal-4.jpg',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/673819168_896838673380430_7926069171483718115_n.jpg?_nc_cat=102&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=E_bUfMuhz4YQ7kNvwHeTnX4&_nc_oc=AdoWBgfFaWe5LHPefccZpIg8PyVxNpIvtPyeYF1_dsi-7mzo6fGPvRvKc81VeNJ2Mf3-OaHEpNmw1Iz8dHghwCuh&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=QUE2D2INKK-crEd-07Oaww&_nc_ss=7a30f&oh=00_Af1j46BN2ZB8VXq0dCfAMsWnqf0V76aZYaYUb36KzYod3A&oe=69E73137',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/illustrative-horizontal-4.jpg',
},
{
id: '26',
@@ -322,9 +270,7 @@ const ITEMS: LibraryItem[] = [
'User profile image with fallback initials and status dot support.',
category: 'Data',
type: 'Component',
- image: 'light-working-horizontal-4.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/670782061_1465787481666092_4758309193867168327_n.png?_nc_cat=108&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=kiWta8Q-B5cQ7kNvwFG-zhL&_nc_oc=AdpDM5oMLbozn80LUq67-YNd1X9Q3R4G8qlfLFF-03UgAO33GBmTBpyHQszqG3LkIsKI5XRIq0kjzYdj0DxZ97go&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=lVwu1Oe7ADW3rpKGaHKB8w&_nc_ss=7a30f&oh=00_Af0hYeq2MeAgBQbckZ3TczCvZ8fy2z-rKM9SaxrmdaNifg&oe=69E72542',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/light-working-horizontal-4.png',
},
{
id: '27',
@@ -333,9 +279,7 @@ const ITEMS: LibraryItem[] = [
'Placeholder shimmer for loading states matching content shapes.',
category: 'Data',
type: 'Utility',
- image: 'moody-lifestyle-horizontal-2.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/672246966_2022228332030059_1486026254113745156_n.png?_nc_cat=102&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=Db-kiXIpRagQ7kNvwF3i3VR&_nc_oc=AdoibvMuexh6CU0sRu5UUIcS8OyAg0TtdmhDrNgwicabAutlJEO2mbv0zv87BcmI7voqmhizar4MtaX9K-eHoIPw&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=mB9th-kxGXONckJrV3nvNQ&_nc_ss=7a30f&oh=00_Af0CSzEEVsruF6wADGXMIWv8CP7ZiAkPSlOIvXGpP7utkg&oe=69E74E15',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/moody-lifestyle-horizontal-2.png',
},
{
id: '28',
@@ -343,9 +287,7 @@ const ITEMS: LibraryItem[] = [
description: 'Rich popover that appears on hover with arbitrary content.',
category: 'Data',
type: 'Component',
- image: 'moody-scene-horizontal-2.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/670453429_1910969922884172_3094228467578042834_n.png?_nc_cat=108&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=YeICz52KdJEQ7kNvwG6zl45&_nc_oc=AdqYEHq-qOh59wMFxQD3TCOtRX1Se7PNk2TnKFYKYeoCaLYa2QoyVJXgVJVwq_3Q1QklgCdIQIxfnTy4GYThl8YA&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=QSACCIkk-b-VRoYlvgoH1g&_nc_ss=7a30f&oh=00_Af20Nx1Vp40iNSp2OzZzDUECElFi3MewFaWwQcPWF3elPQ&oe=69E74CE6',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/moody-scene-horizontal-2.png',
},
{
id: '29',
@@ -354,9 +296,7 @@ const ITEMS: LibraryItem[] = [
'Command-palette style search with grouped results and keyboard nav.',
category: 'Data',
type: 'Pattern',
- image: 'colorful-product-2.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/671278299_2157174751769935_4279004491845469910_n.png?_nc_cat=103&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=izE9T3P8DIsQ7kNvwFLOTcb&_nc_oc=AdpG1igzhXXs0FXlQP1fnIkxQnO8ckNSByC6ttELHnEtWoNrELMBaZGgg4z5Q8US81J9TXq1VSLBy7IyP5w4wiXO&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=0TN5EU9a1uXOJ0ek6CJukQ&_nc_ss=7a30f&oh=00_Af1vLg89rqmR-cXwNDdaglipjq6NBzGJbdsgw6q1jGisEA&oe=69E73766',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/colorful-product-2.png',
},
{
id: '30',
@@ -365,40 +305,16 @@ const ITEMS: LibraryItem[] = [
'Autocomplete input with async suggestion loading and selection.',
category: 'Data',
type: 'Component',
- image: 'moody-working-horizontal-3.png',
- imageUrl:
- 'https://scontent.xx.fbcdn.net/v/t39.6806-6/673879002_1270196958005953_766590773162291_n.png?_nc_cat=105&ccb=1-7&_nc_sid=56bbc2&_nc_ohc=rJzYEsicq4kQ7kNvwF2PAr6&_nc_oc=Adppyqa2FWPcX_w_31qGyJXN4HMi9sFkOomdNPp5k8cYJzx0lNk26KFRsr9OwyZowrDpWDIaBd-GiUOb8xei8StE&_nc_zt=14&_nc_ht=scontent.xx&_nc_gid=7g2E2PaaP4wVp5kprcvUuQ&_nc_ss=7a30f&oh=00_Af3UGlsMFJs8zwMC8Ofh9UfPsWBE1u1gkcNlAKPzqrWtgw&oe=69E730EB',
+ imageUrl: 'https://lookaside.facebook.com/assets/xds_oss/moody-working-horizontal-3.png',
},
];
const styles = stylex.create({
- sectionTop: {
- paddingTop: spacingVars['--spacing-4'],
- },
- thumbnail: {
- backgroundColor: colorVars['--color-background-muted'],
- width: '100%',
- },
thumbnailImage: {
width: '100%',
height: '100%',
objectFit: 'cover',
},
- cardBody: {
- padding: spacingVars['--spacing-4'],
- },
- hideOnSmall: {
- display: {
- default: 'none',
- '@media (min-width: 840px)': 'block',
- },
- },
- hideOnLarge: {
- display: {
- default: 'block',
- '@media (min-width: 840px)': 'none',
- },
- },
});
// =============================================================================
@@ -449,19 +365,21 @@ function LibraryNav() {
function LibraryCard({item}: {item: LibraryItem}) {
return (
<XDSCard padding={0}>
- <XDSAspectRatio ratio={16 / 9} xstyle={styles.thumbnail}>
+ <XDSAspectRatio ratio={16 / 9}>
<img
- {...stylex.props(styles.thumbnailImage)}
src={item.imageUrl}
alt={item.name}
+ {...stylex.props(styles.thumbnailImage)}
/>
</XDSAspectRatio>
- <XDSVStack gap={1} xstyle={styles.cardBody}>
- <XDSHeading level={3}>{item.name}</XDSHeading>
- <XDSText type="body" size="sm" color="secondary">
- {item.description}
- </XDSText>
- </XDSVStack>
+ <XDSSection variant="transparent" padding={4}>
+ <XDSVStack gap={1}>
+ <XDSHeading level={3}>{item.name}</XDSHeading>
+ <XDSText type="body" size="sm" color="secondary">
+ {item.description}
+ </XDSText>
+ </XDSVStack>
+ </XDSSection>
</XDSCard>
);
}
@@ -501,8 +419,16 @@ export default function LibraryPage() {
i.description.toLowerCase().includes(q),
);
}
- return items;
- }, [activeTab, search]);
+ const sorted = [...items];
+ if (sortOrder === 'A-Z') {
+ sorted.sort((a, b) => a.name.localeCompare(b.name));
+ } else if (sortOrder === 'Z-A') {
+ sorted.sort((a, b) => b.name.localeCompare(a.name));
+ } else if (sortOrder === 'Newest') {
+ sorted.sort((a, b) => Number(b.id) - Number(a.id));
+ }
+ return sorted;
+ }, [activeTab, search, sortOrder]);
const groupedSections = useMemo(() => {
if (activeTab !== 'All') return null;
@@ -538,31 +464,41 @@ export default function LibraryPage() {
startIcon={MagnifyingGlassIcon}
size="lg"
/>
- <XDSHStack vAlign="center" hAlign="between">
- <div {...stylex.props(styles.hideOnSmall)}>
- <XDSToggleButtonGroup
- label="Filter by category"
- value={activeTab}
- onChange={v => setActiveTab(v ?? 'All')}>
- {CATEGORIES.map(cat => (
- <XDSToggleButton
- key={cat}
- label={cat}
- value={cat}
- size="lg"
- />
- ))}
- </XDSToggleButtonGroup>
- </div>
- <div {...stylex.props(styles.hideOnLarge)}>
- <XDSDropdownMenu
- button={{label: activeTab, size: 'lg'}}
- items={CATEGORIES.map(cat => ({
- label: cat,
- onClick: () => setActiveTab(cat),
- }))}
- />
- </div>
+ <XDSHStack vAlign="center" gap={4}>
+ <XDSStackItem size="fill">
+ <XDSVStack>
+ <XDSToggleButtonGroup
+ label="Filter by category"
+ value={activeTab}
+ onChange={v => setActiveTab(v ?? 'All')}>
+ <XDSOverflowList
+ gap={1}
+ behavior="observeParent"
+ overflowRenderer={overflowItems => (
+ <XDSDropdownMenu
+ button={{
+ label: `+${overflowItems.length}`,
+ variant: 'ghost',
+ size: 'lg',
+ }}
+ items={overflowItems.map(({index}) => ({
+ label: CATEGORIES[index],
+ onClick: () => setActiveTab(CATEGORIES[index]),
+ }))}
+ />
+ )}>
+ {CATEGORIES.map(cat => (
+ <XDSToggleButton
+ key={cat}
+ label={cat}
+ value={cat}
+ size="lg"
+ />
+ ))}
+ </XDSOverflowList>
+ </XDSToggleButtonGroup>
+ </XDSVStack>
+ </XDSStackItem>
<XDSDropdownMenu
button={{label: sortOrder, size: 'lg'}}
items={[
@@ -580,9 +516,9 @@ export default function LibraryPage() {
No results found.
</XDSText>
</XDSCenter>
- ) : groupedSections != null ? (
+ ) : (
<XDSVStack gap={6}>
- {groupedSections.flatMap(section => [
+ {(groupedSections ?? [{category: activeTab, items: filtered}]).flatMap(section => [
<XDSDivider key={`d-${section.category}`} />,
<LibrarySection
key={section.category}
@@ -591,15 +527,6 @@ export default function LibraryPage() {
/>,
])}
</XDSVStack>
- ) : (
- <XDSGrid
- columns={{minWidth: 320}}
- gap={4}
- xstyle={styles.sectionTop}>
- {filtered.map(item => (
- <LibraryCard key={item.id} item={item} />
- ))}
- </XDSGrid>
)}
</XDSVStack>
</XDSLayoutContent>