An open source design system that's fully customizable and agent ready
TypeScript
fix (sandbox) Block example styling fixes (#2065)
Kenton Quatman5c608524ada4
diff --git a/packages/cli/templates/blocks/components/Card/SelectableCardMulti.tsx b/packages/cli/templates/blocks/components/Card/SelectableCardMulti.tsxindex c59ce7faba..c977f659b3 100644--- a/packages/cli/templates/blocks/components/Card/SelectableCardMulti.tsx+++ b/packages/cli/templates/blocks/components/Card/SelectableCardMulti.tsx@@ -2,7 +2,7 @@import {useState} from 'react';import {XDSSelectableCard} from '@xds/core/SelectableCard';-import {XDSStack} from '@xds/core/Layout';+import {XDSGrid} from '@xds/core/Grid';import {XDSText} from '@xds/core/Text';const tags = [@@ -18,7 +18,7 @@ export default function SelectableCardMulti() {const [selected, setSelected] = useState(new Set(['react', 'typescript']));return (- <XDSStack direction="horizontal" gap={2} wrap="wrap">+ <XDSGrid columns={3} gap={2} width={400}>{tags.map(tag => (<XDSSelectableCardkey={tag.id}@@ -35,13 +35,12 @@ export default function SelectableCardMulti() {}return next;});- }}- width={130}>+ }}><XDSText type="body" weight="bold">{tag.name}</XDSText></XDSSelectableCard>))}- </XDSStack>+ </XDSGrid>);}diff --git a/packages/cli/templates/blocks/components/Resizable/ResizableShowcase.tsx b/packages/cli/templates/blocks/components/Resizable/ResizableShowcase.tsxindex 7cdeace7b5..df0efe573a 100644--- a/packages/cli/templates/blocks/components/Resizable/ResizableShowcase.tsx+++ b/packages/cli/templates/blocks/components/Resizable/ResizableShowcase.tsx@@ -18,7 +18,7 @@ export default function ResizableShowcase() {});return (- <XDSCard variant="muted" height={280}>+ <XDSCard variant="muted" height={280} width={600}><XDSLayoutheight="fill"start={diff --git a/packages/cli/templates/blocks/components/Section/SectionVariants.tsx b/packages/cli/templates/blocks/components/Section/SectionVariants.tsxindex a865fbb551..3594945615 100644--- a/packages/cli/templates/blocks/components/Section/SectionVariants.tsx+++ b/packages/cli/templates/blocks/components/Section/SectionVariants.tsx@@ -3,18 +3,10 @@import {XDSSection} from '@xds/core/Section';import {XDSStack} from '@xds/core/Layout';import {XDSText} from '@xds/core/Text';-import * as stylex from '@stylexjs/stylex';-import {colorVars} from '@xds/core/theme/tokens.stylex';--const styles = stylex.create({- transparentWrapper: {- backgroundColor: colorVars['--color-background-blue'],- },-});export default function SectionVariants() {return (- <XDSStack direction="vertical" gap={0}>+ <XDSStack direction="vertical" gap={6}><XDSSection variant="section" padding={5}><XDSStack direction="vertical" gap={1}><XDSText type="body" weight="bold">@@ -35,7 +27,7 @@ export default function SectionVariants() {</XDSText></XDSStack></XDSSection>- <XDSStack direction="vertical" xstyle={styles.transparentWrapper}>+ <XDSStack direction="vertical"><XDSSection variant="transparent" padding={5}><XDSStack direction="vertical" gap={1}><XDSText type="body" weight="bold">diff --git a/packages/cli/templates/blocks/components/Section/SectionWashHighlight.doc.mjs b/packages/cli/templates/blocks/components/Section/SectionWashHighlight.doc.mjsindex ee17230b0b..8621bad7e2 100644--- a/packages/cli/templates/blocks/components/Section/SectionWashHighlight.doc.mjs+++ b/packages/cli/templates/blocks/components/Section/SectionWashHighlight.doc.mjs@@ -6,6 +6,6 @@ export const doc = {description:'A default section stacked with a full-width wash section. Shows how wash draws attention to a specific region like an upgrade prompt or banner.',isReady: true,- aspectRatio: 16 / 9,+ aspectRatio: 4 / 3,componentsUsed: ['Section', 'Layout', 'Text', 'Button', 'Icon'],};diff --git a/packages/cli/templates/blocks/components/Section/SectionWashHighlight.tsx b/packages/cli/templates/blocks/components/Section/SectionWashHighlight.tsxindex aabdf97129..988dff3cb7 100644--- a/packages/cli/templates/blocks/components/Section/SectionWashHighlight.tsx+++ b/packages/cli/templates/blocks/components/Section/SectionWashHighlight.tsx@@ -16,8 +16,8 @@ const FEATURES = [export default function SectionDefaultWithWash() {return (- <XDSStack direction="vertical" gap={0}>- <XDSSection variant="section" padding={5}>+ <XDSStack direction="vertical" gap={2}>+ <XDSSection variant="section" padding={4}><XDSStack direction="vertical" gap={3} hAlign="center"><XDSStack direction="vertical" gap={1} hAlign="center"><XDSText type="display-3">Pro Plan</XDSText>@@ -39,12 +39,12 @@ export default function SectionDefaultWithWash() {</XDSStack></XDSStack></XDSSection>- <XDSSection variant="wash" padding={5}>+ <XDSSection variant="wash" padding={6}><XDSStack direction="vertical" gap={2} hAlign="center">- <XDSStack direction="horizontal" gap={1} vAlign="end">- <XDSHeading level={3}>$49</XDSHeading>+ <XDSStack direction="horizontal" gap={2} vAlign="center">+ <XDSText type="display-3">$49</XDSText><XDSText type="supporting" color="secondary">- /month+ / month</XDSText></XDSStack><XDSButton label="Upgrade" variant="primary" />diff --git a/packages/cli/templates/blocks/components/Selector/SelectorClearable.doc.mjs b/packages/cli/templates/blocks/components/Selector/SelectorClearable.doc.mjsindex 2e31316ab4..379920e592 100644--- a/packages/cli/templates/blocks/components/Selector/SelectorClearable.doc.mjs+++ b/packages/cli/templates/blocks/components/Selector/SelectorClearable.doc.mjs@@ -6,6 +6,6 @@ export const doc = {description:'Selector with a clear button to reset the selected value.',isReady: true,- aspectRatio: 4 / 3,+ aspectRatio: 16 / 9,componentsUsed: ['Selector', 'Center'],};diff --git a/packages/cli/templates/blocks/components/Selector/SelectorClearable.tsx b/packages/cli/templates/blocks/components/Selector/SelectorClearable.tsxindex 7d10db6f8c..f3e1df5ef8 100644--- a/packages/cli/templates/blocks/components/Selector/SelectorClearable.tsx+++ b/packages/cli/templates/blocks/components/Selector/SelectorClearable.tsx@@ -2,25 +2,23 @@import {useState} from 'react';import {XDSSelector} from '@xds/core/Selector';-import {XDSCenter} from '@xds/core/Center';export default function SelectorClearable() {const [value, setValue] = useState<string | null>('engineering');return (- <XDSCenter width={250}>- <XDSSelector- label="Department"- options={[- {value: 'engineering', label: 'Engineering'},- {value: 'design', label: 'Design'},- {value: 'marketing', label: 'Marketing'},- {value: 'sales', label: 'Sales'},- ]}- value={value}- onChange={setValue}- placeholder="Choose a department..."- hasClear- />- </XDSCenter>+ <XDSSelector+ style={{width: 300}}+ label="Department"+ options={[+ {value: 'engineering', label: 'Engineering'},+ {value: 'design', label: 'Design'},+ {value: 'marketing', label: 'Marketing'},+ {value: 'sales', label: 'Sales'},+ ]}+ value={value}+ onChange={setValue}+ placeholder="Choose a department..."+ hasClear+ />);}diff --git a/packages/cli/templates/blocks/components/Selector/SelectorShowcase.tsx b/packages/cli/templates/blocks/components/Selector/SelectorShowcase.tsxindex e0b2f29af8..91ce1da394 100644--- a/packages/cli/templates/blocks/components/Selector/SelectorShowcase.tsx+++ b/packages/cli/templates/blocks/components/Selector/SelectorShowcase.tsx@@ -5,8 +5,8 @@ import {XDSSelector} from '@xds/core/Selector';export default function SelectorShowcase() {return (<XDSSelector+ style={{width: 300}}label="Fruit"- isDefaultOpenoptions={['Apple', 'Banana', 'Orange', 'Mango', 'Pineapple']}placeholder="Select a fruit..."onChange={() => {}}diff --git a/packages/cli/templates/blocks/components/Selector/SelectorWithSections.doc.mjs b/packages/cli/templates/blocks/components/Selector/SelectorWithSections.doc.mjsindex 1994961597..60e2b70a16 100644--- a/packages/cli/templates/blocks/components/Selector/SelectorWithSections.doc.mjs+++ b/packages/cli/templates/blocks/components/Selector/SelectorWithSections.doc.mjs@@ -6,6 +6,6 @@ export const doc = {description:'Selector with options grouped into labeled sections.',isReady: true,- aspectRatio: 4 / 3,+ aspectRatio: 16 / 9,componentsUsed: ['Selector', 'Center'],};diff --git a/packages/cli/templates/blocks/components/Selector/SelectorWithSections.tsx b/packages/cli/templates/blocks/components/Selector/SelectorWithSections.tsxindex 6c3b93b130..c488e8ea8c 100644--- a/packages/cli/templates/blocks/components/Selector/SelectorWithSections.tsx+++ b/packages/cli/templates/blocks/components/Selector/SelectorWithSections.tsx@@ -2,45 +2,43 @@import {useState} from 'react';import {XDSSelector} from '@xds/core/Selector';-import {XDSCenter} from '@xds/core/Center';export default function SelectorWithSections() {const [value, setValue] = useState<string | undefined>();return (- <XDSCenter width={250}>- <XDSSelector- label="Office"- options={[- {- type: 'section',- title: 'North America',- options: [- {value: 'nyc', label: 'New York'},- {value: 'sf', label: 'San Francisco'},- {value: 'sea', label: 'Seattle'},- ],- },- {- type: 'section',- title: 'Europe',- options: [- {value: 'ldn', label: 'London'},- {value: 'ber', label: 'Berlin'},- ],- },- {- type: 'section',- title: 'Asia Pacific',- options: [- {value: 'tyo', label: 'Tokyo'},- {value: 'sgp', label: 'Singapore'},- ],- },- ]}- value={value}- onChange={setValue}- placeholder="Choose an office..."- />- </XDSCenter>+ <XDSSelector+ style={{width: 300}}+ label="Office"+ options={[+ {+ type: 'section',+ title: 'North America',+ options: [+ {value: 'nyc', label: 'New York'},+ {value: 'sf', label: 'San Francisco'},+ {value: 'sea', label: 'Seattle'},+ ],+ },+ {+ type: 'section',+ title: 'Europe',+ options: [+ {value: 'ldn', label: 'London'},+ {value: 'ber', label: 'Berlin'},+ ],+ },+ {+ type: 'section',+ title: 'Asia Pacific',+ options: [+ {value: 'tyo', label: 'Tokyo'},+ {value: 'sgp', label: 'Singapore'},+ ],+ },+ ]}+ value={value}+ onChange={setValue}+ placeholder="Choose an office..."+ />);}diff --git a/packages/cli/templates/blocks/components/Selector/SelectorWithStatus.tsx b/packages/cli/templates/blocks/components/Selector/SelectorWithStatus.tsxindex 5ab464e9db..06fe6a35f0 100644--- a/packages/cli/templates/blocks/components/Selector/SelectorWithStatus.tsx+++ b/packages/cli/templates/blocks/components/Selector/SelectorWithStatus.tsx@@ -3,15 +3,14 @@import {useState} from 'react';import {XDSSelector} from '@xds/core/Selector';import {XDSVStack} from '@xds/core/Layout';-import {XDSCenter} from '@xds/core/Center';export default function SelectorWithStatus() {const [value1, setValue1] = useState<string | undefined>();const [value2, setValue2] = useState<string | undefined>('viewer');const [value3, setValue3] = useState<string | undefined>('admin');return (- <XDSCenter width={250}>- <XDSVStack gap={4}>+ <div style={{width: 300}}>+ <XDSVStack gap={6}><XDSSelectorlabel="Role"options={[@@ -47,6 +46,6 @@ export default function SelectorWithStatus() {status={{type: 'success'}}/></XDSVStack>- </XDSCenter>+ </div>);}diff --git a/packages/cli/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx b/packages/cli/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsxindex 7b72b1dcc4..66c3f1146c 100644--- a/packages/cli/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx+++ b/packages/cli/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx@@ -2,14 +2,7 @@import {useState} from 'react';import {XDSSelector, XDSSelectorOption} from '@xds/core/Selector';-import {XDSCenter} from '@xds/core/Center';--const UserIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" {...props}>- <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />- <circle cx="12" cy="7" r="4" />- </svg>-);+import {UserIcon} from '@heroicons/react/24/outline';const descriptions: Record<string, string> = {admin: 'Full access to all resources',@@ -29,21 +22,20 @@ export default function SelectorOptionShowcase() {const [value, setValue] = useState<string | undefined>('editor');return (- <XDSCenter width={280}>- <XDSSelector- label="Role"- options={roles}- value={value}- onChange={setValue}- placeholder="Assign a role...">- {option => (- <XDSSelectorOption- icon={UserIcon}- label={option.label}- description={descriptions[option.value]}- />- )}- </XDSSelector>- </XDSCenter>+ <XDSSelector+ style={{width: 300}}+ label="Role"+ options={roles}+ value={value}+ onChange={setValue}+ placeholder="Assign a role...">+ {option => (+ <XDSSelectorOption+ icon={UserIcon}+ label={option.label}+ description={descriptions[option.value]}+ />+ )}+ </XDSSelector>);}diff --git a/packages/cli/templates/blocks/components/Skeleton/SkeletonShowcase.tsx b/packages/cli/templates/blocks/components/Skeleton/SkeletonShowcase.tsxindex 33938bceee..1731295032 100644--- a/packages/cli/templates/blocks/components/Skeleton/SkeletonShowcase.tsx+++ b/packages/cli/templates/blocks/components/Skeleton/SkeletonShowcase.tsx@@ -1,7 +1,23 @@'use client';import {XDSSkeleton} from '@xds/core/Skeleton';+import {XDSHStack, XDSVStack} from '@xds/core/Layout';export default function SkeletonShowcase() {- return <XDSSkeleton width={200} height={20} radius={3} />;+ return (+ <XDSVStack gap={4} width={300}>+ <XDSHStack gap={4} vAlign="center">+ <XDSSkeleton width={64} height={64} radius="rounded" index={0} />+ <XDSVStack gap={2}>+ <XDSSkeleton width={160} height={20} index={1} />+ <XDSSkeleton width={80} height={16} index={2} />+ </XDSVStack>+ </XDSHStack>+ <XDSVStack gap={2}>+ <XDSSkeleton width="90%" height={16} index={3} />+ <XDSSkeleton width="100%" height={16} index={4} />+ <XDSSkeleton width="75%" height={16} index={5} />+ </XDSVStack>+ </XDSVStack>+ );}diff --git a/packages/cli/templates/blocks/components/Slider/SliderFormattedValue.doc.mjs b/packages/cli/templates/blocks/components/Slider/SliderFormattedValue.doc.mjsindex 3b8a19419d..29cb7d9564 100644--- a/packages/cli/templates/blocks/components/Slider/SliderFormattedValue.doc.mjs+++ b/packages/cli/templates/blocks/components/Slider/SliderFormattedValue.doc.mjs@@ -6,6 +6,6 @@ export const doc = {description:'Slider with custom formatting showing temperature in Fahrenheit.',isReady: true,- aspectRatio: 4 / 3,+ aspectRatio: 16 / 9,componentsUsed: ['Slider'],};diff --git a/packages/cli/templates/blocks/components/Slider/SliderFormattedValue.tsx b/packages/cli/templates/blocks/components/Slider/SliderFormattedValue.tsxindex 0a8094bf32..9d3f0054f8 100644--- a/packages/cli/templates/blocks/components/Slider/SliderFormattedValue.tsx+++ b/packages/cli/templates/blocks/components/Slider/SliderFormattedValue.tsx@@ -7,6 +7,7 @@ export default function SliderFormattedValue() {const [value, setValue] = useState(72);return (<XDSSlider+ style={{width: 300}}label="Temperature"value={value}onChange={setValue}diff --git a/packages/cli/templates/blocks/components/Slider/SliderRangeSlider.doc.mjs b/packages/cli/templates/blocks/components/Slider/SliderRangeSlider.doc.mjsindex 1a28a7c372..c34e21c78f 100644--- a/packages/cli/templates/blocks/components/Slider/SliderRangeSlider.doc.mjs+++ b/packages/cli/templates/blocks/components/Slider/SliderRangeSlider.doc.mjs@@ -6,6 +6,6 @@ export const doc = {description:'Range slider for selecting a value range like price bounds.',isReady: true,- aspectRatio: 4 / 3,+ aspectRatio: 16 / 9,componentsUsed: ['Slider'],};diff --git a/packages/cli/templates/blocks/components/Slider/SliderRangeSlider.tsx b/packages/cli/templates/blocks/components/Slider/SliderRangeSlider.tsxindex b83ee76cd8..a6d3fedd6f 100644--- a/packages/cli/templates/blocks/components/Slider/SliderRangeSlider.tsx+++ b/packages/cli/templates/blocks/components/Slider/SliderRangeSlider.tsx@@ -5,5 +5,12 @@ import {XDSSlider} from '@xds/core/Slider';export default function SliderRangeSlider() {const [value, setValue] = useState<[number, number]>([20, 80]);- return <XDSSlider label="Price range" value={value} onChange={setValue} />;+ return (+ <XDSSlider+ label="Price range"+ value={value}+ onChange={setValue}+ style={{width: 300}}+ />+ );}diff --git a/packages/cli/templates/blocks/components/Slider/SliderShowcase.tsx b/packages/cli/templates/blocks/components/Slider/SliderShowcase.tsxindex fc48e85003..37174d9c60 100644--- a/packages/cli/templates/blocks/components/Slider/SliderShowcase.tsx+++ b/packages/cli/templates/blocks/components/Slider/SliderShowcase.tsx@@ -3,5 +3,5 @@import {XDSSlider} from '@xds/core/Slider';export default function SliderShowcase() {- return <XDSSlider label="Volume" value={50} />;+ return <XDSSlider label="Volume" value={50} style={{width: 300}} />;}diff --git a/packages/cli/templates/blocks/components/Slider/SliderWithMarks.doc.mjs b/packages/cli/templates/blocks/components/Slider/SliderWithMarks.doc.mjsindex 3f4bac46ff..096bc2b08b 100644--- a/packages/cli/templates/blocks/components/Slider/SliderWithMarks.doc.mjs+++ b/packages/cli/templates/blocks/components/Slider/SliderWithMarks.doc.mjs@@ -6,6 +6,6 @@ export const doc = {description:'Slider with labeled tick marks at fixed intervals.',isReady: true,- aspectRatio: 4 / 3,+ aspectRatio: 16 / 9,componentsUsed: ['Slider'],};diff --git a/packages/cli/templates/blocks/components/Slider/SliderWithMarks.tsx b/packages/cli/templates/blocks/components/Slider/SliderWithMarks.tsxindex 8977f06395..4660b6225c 100644--- a/packages/cli/templates/blocks/components/Slider/SliderWithMarks.tsx+++ b/packages/cli/templates/blocks/components/Slider/SliderWithMarks.tsx@@ -7,6 +7,7 @@ export default function SliderWithMarks() {const [value, setValue] = useState(50);return (<XDSSlider+ style={{width: 300}}label="Volume"value={value}onChange={setValue}diff --git a/packages/cli/templates/blocks/components/Slider/SliderWithStatus.tsx b/packages/cli/templates/blocks/components/Slider/SliderWithStatus.tsxindex 415d81bf36..792bcf9d82 100644--- a/packages/cli/templates/blocks/components/Slider/SliderWithStatus.tsx+++ b/packages/cli/templates/blocks/components/Slider/SliderWithStatus.tsx@@ -10,7 +10,7 @@ export default function SliderWithStatus() {const [value2, setValue2] = useState(50);const [value3, setValue3] = useState(75);return (- <XDSCenter width={400}>+ <div style={{width: 300}}><XDSVStack gap={6}><XDSSliderlabel="CPU Usage"@@ -31,6 +31,6 @@ export default function SliderWithStatus() {status={{type: 'success', message: 'Disk usage is healthy'}}/></XDSVStack>- </XDSCenter>+ </div>);}