An open source design system that's fully customizable and agent ready
TypeScript
docs(cli): Tokenizer blocks and stories fit a phone-sized screen (#8002)
Xinzi Zhou51c62ca66a8f
diff --git a/.changeset/cli-tokenizer-blocks-mobile-width.md b/.changeset/cli-tokenizer-blocks-mobile-width.mdnew file mode 100644index 0000000000..b14da5963a--- /dev/null+++ b/.changeset/cli-tokenizer-blocks-mobile-width.md@@ -0,0 +1,7 @@+---+'@astryxdesign/cli': patch+---++[docs] The Tokenizer block templates (`Tokenizer`, `Clear`, `Creatable`, `End Content`, `Icon`, `Max Entries`, `Overflow`, `States`) size their field through a column that is 400px wide where there is room and shrinks with its container, instead of a fixed 400px width, so the live examples fit a phone-sized screen without clipping.++@imdreamrunnerdiff --git a/apps/storybook/stories/Tokenizer.stories.tsx b/apps/storybook/stories/Tokenizer.stories.tsxindex f4c4669430..0e5bc98aa7 100644--- a/apps/storybook/stories/Tokenizer.stories.tsx+++ b/apps/storybook/stories/Tokenizer.stories.tsx@@ -70,8 +70,10 @@ const meta: Meta<typeof Tokenizer> = {},},decorators: [+ // A 400px column where there is room that shrinks with the viewport, so+ // the stories read the same on a phone-sized canvas.Story => (- <div style={{width: 400}}>+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 400px)'}}><Story /></div>),@@ -454,8 +456,7 @@ export const StatusVariantComparison: Story = {const [a, setA] = useState<SearchableItem[]>([]);const [b, setB] = useState<SearchableItem[]>([]);return (- <div- style={{display: 'flex', flexDirection: 'column', gap: 24, width: 320}}>+ <div style={{display: 'flex', flexDirection: 'column', gap: 24}}><Tokenizerlabel="Attached (default)"searchSource={userSource}@@ -506,14 +507,12 @@ export const LogicalOrder: Story = {render: args => {const [value, setValue] = useState([users[0], users[2]]);return (- <div style={{width: 420}}>- <Tokenizer- {...args}- searchSource={userSource}- value={value}- onChange={items => setValue(items)}- />- </div>+ <Tokenizer+ {...args}+ searchSource={userSource}+ value={value}+ onChange={items => setValue(items)}+ />);},args: {diff --git a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsxindex abd51e1948..a3943bf9e1 100644--- a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx+++ b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx@@ -26,19 +26,20 @@ export default function TokenizerClear() {const [value, setValue] = useState<SearchableItem[]>([users[0], users[1]]);return (- <Stack direction="vertical" gap={2}>- <Text type="supporting" color="secondary">- Clear-all button appears when tokens are selected- </Text>- <Tokenizer- label="Team Members"- placeholder="Search people..."- searchSource={userSource}- value={value}- onChange={items => setValue(items)}- hasClear- containerStyle={{width: 400}}- />- </Stack>+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 400px)'}}>+ <Stack direction="vertical" gap={2}>+ <Text type="supporting" color="secondary">+ Clear-all button appears when tokens are selected+ </Text>+ <Tokenizer+ label="Team Members"+ placeholder="Search people..."+ searchSource={userSource}+ value={value}+ onChange={items => setValue(items)}+ hasClear+ />+ </Stack>+ </div>);}diff --git a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsxindex e3384e822a..42012ef16f 100644--- a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx+++ b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx@@ -32,36 +32,36 @@ export default function TokenizerCreatable() {const [members, setMembers] = useState<SearchableItem[]>([]);return (- <Stack direction="vertical" gap={4}>- <Stack direction="vertical" gap={1}>- <Text type="supporting" color="secondary">- Free-text only- </Text>- <Tokenizer- label="Tags"- searchSource={emptySource}- value={tags}- onChange={items => setTags(items)}- hasCreate- placeholder="Type a tag and press Enter..."- containerStyle={{width: 400}}- />+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 400px)'}}>+ <Stack direction="vertical" gap={4}>+ <Stack direction="vertical" gap={1}>+ <Text type="supporting" color="secondary">+ Free-text only+ </Text>+ <Tokenizer+ label="Tags"+ searchSource={emptySource}+ value={tags}+ onChange={items => setTags(items)}+ hasCreate+ placeholder="Type a tag and press Enter..."+ />+ </Stack>+ <Stack direction="vertical" gap={1}>+ <Text type="supporting" color="secondary">+ Create or search+ </Text>+ <Tokenizer+ label="Team Members"+ searchSource={userSource}+ value={members}+ onChange={items => setMembers(items)}+ hasCreate+ hasEntriesOnFocus+ placeholder="Search or type a new name..."+ />+ </Stack></Stack>- <Stack direction="vertical" gap={1}>- <Text type="supporting" color="secondary">- Create or search- </Text>- <Tokenizer- label="Team Members"- searchSource={userSource}- value={members}- onChange={items => setMembers(items)}- hasCreate- hasEntriesOnFocus- placeholder="Search or type a new name..."- containerStyle={{width: 400}}- />- </Stack>- </Stack>+ </div>);}diff --git a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsxindex 56b0510d9b..b4547edb77 100644--- a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx+++ b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx@@ -28,19 +28,20 @@ export default function TokenizerEndContent() {const [value, setValue] = useState<SearchableItem[]>([users[0], users[2]]);return (- <Stack direction="vertical" gap={2}>- <Text type="supporting" color="secondary">- Action button in the end slot- </Text>- <Tokenizer- label="Team Members"- placeholder="Search people..."- searchSource={userSource}- value={value}- onChange={items => setValue(items)}- endContent={<Button label="Apply" variant="primary" size="sm" />}- containerStyle={{width: 400}}- />- </Stack>+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 400px)'}}>+ <Stack direction="vertical" gap={2}>+ <Text type="supporting" color="secondary">+ Action button in the end slot+ </Text>+ <Tokenizer+ label="Team Members"+ placeholder="Search people..."+ searchSource={userSource}+ value={value}+ onChange={items => setValue(items)}+ endContent={<Button label="Apply" variant="primary" size="sm" />}+ />+ </Stack>+ </div>);}diff --git a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsxindex d629859e39..b60233343b 100644--- a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx+++ b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx@@ -27,19 +27,20 @@ export default function TokenizerIcon() {const [value, setValue] = useState<SearchableItem[]>([users[0], users[2]]);return (- <Stack direction="vertical" gap={2}>- <Text type="supporting" color="secondary">- Leading icon reinforces the search affordance- </Text>- <Tokenizer- label="Team Members"- placeholder="Search people..."- searchSource={userSource}- value={value}- onChange={items => setValue(items)}- startIcon={MagnifyingGlassIcon}- containerStyle={{width: 400}}- />- </Stack>+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 400px)'}}>+ <Stack direction="vertical" gap={2}>+ <Text type="supporting" color="secondary">+ Leading icon reinforces the search affordance+ </Text>+ <Tokenizer+ label="Team Members"+ placeholder="Search people..."+ searchSource={userSource}+ value={value}+ onChange={items => setValue(items)}+ startIcon={MagnifyingGlassIcon}+ />+ </Stack>+ </div>);}diff --git a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsxindex d4c2459411..c91fd7e942 100644--- a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx+++ b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx@@ -31,21 +31,22 @@ export default function TokenizerMaxEntries() {const [value, setValue] = useState<SearchableItem[]>([skills[0], skills[1]]);return (- <Stack direction="vertical" gap={2}>- <Text type="supporting" color="secondary">- Limited to {MAX_SKILLS} selections — {MAX_SKILLS - value.length}{' '}- remaining- </Text>- <Tokenizer- label="Top Skills"- placeholder="Search skills..."- description={`Choose up to ${MAX_SKILLS} skills`}- searchSource={skillSource}- value={value}- onChange={items => setValue(items)}- maxEntries={MAX_SKILLS}- containerStyle={{width: 400}}- />- </Stack>+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 400px)'}}>+ <Stack direction="vertical" gap={2}>+ <Text type="supporting" color="secondary">+ Limited to {MAX_SKILLS} selections — {MAX_SKILLS - value.length}{' '}+ remaining+ </Text>+ <Tokenizer+ label="Top Skills"+ placeholder="Search skills..."+ description={`Choose up to ${MAX_SKILLS} skills`}+ searchSource={skillSource}+ value={value}+ onChange={items => setValue(items)}+ maxEntries={MAX_SKILLS}+ />+ </Stack>+ </div>);}diff --git a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsxindex 891babc405..39291741bb 100644--- a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx+++ b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx@@ -28,35 +28,35 @@ export default function TokenizerOverflow() {const [layerValue, setLayerValue] = useState<SearchableItem[]>(users);return (- <Stack direction="vertical" gap={4}>- <Stack direction="vertical" gap={1}>- <Text type="supporting" color="secondary">- Inline overflow — content shifts down on expand- </Text>- <Tokenizer- label="Inline Overflow"- placeholder="Add more..."- searchSource={userSource}- value={inlineValue}- onChange={items => setInlineValue(items)}- tokenOverflowBehavior="unfocusedInline"- containerStyle={{width: 400, maxWidth: 400}}- />+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 400px)'}}>+ <Stack direction="vertical" gap={4}>+ <Stack direction="vertical" gap={1}>+ <Text type="supporting" color="secondary">+ Inline overflow — content shifts down on expand+ </Text>+ <Tokenizer+ label="Inline Overflow"+ placeholder="Add more..."+ searchSource={userSource}+ value={inlineValue}+ onChange={items => setInlineValue(items)}+ tokenOverflowBehavior="unfocusedInline"+ />+ </Stack>+ <Stack direction="vertical" gap={1}>+ <Text type="supporting" color="secondary">+ Layer overflow — expands as overlay, no layout shift+ </Text>+ <Tokenizer+ label="Layer Overflow"+ placeholder="Add more..."+ searchSource={userSource}+ value={layerValue}+ onChange={items => setLayerValue(items)}+ tokenOverflowBehavior="unfocusedLayer"+ />+ </Stack></Stack>- <Stack direction="vertical" gap={1}>- <Text type="supporting" color="secondary">- Layer overflow — expands as overlay, no layout shift- </Text>- <Tokenizer- label="Layer Overflow"- placeholder="Add more..."- searchSource={userSource}- value={layerValue}- onChange={items => setLayerValue(items)}- tokenOverflowBehavior="unfocusedLayer"- containerStyle={{width: 400, maxWidth: 400}}- />- </Stack>- </Stack>+ </div>);}diff --git a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsxindex 06ec2b775d..52d838e4a1 100644--- a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx+++ b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx@@ -17,13 +17,14 @@ export default function TokenizerShowcase() {{id: '2', label: 'Engineering'},]);return (- <Tokenizer- label="Tags"- placeholder="Search..."- searchSource={source}- value={value}- onChange={setValue}- containerStyle={{width: 400}}- />+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 400px)'}}>+ <Tokenizer+ label="Tags"+ placeholder="Search..."+ searchSource={source}+ value={value}+ onChange={setValue}+ />+ </div>);}diff --git a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsxindex dc13ec0b4d..5cee5f52b9 100644--- a/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx+++ b/packages/cli/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx@@ -32,46 +32,44 @@ export default function TokenizerStates() {]);return (- <Stack direction="vertical" gap={4}>- <Tokenizer- label="Disabled field"- searchSource={userSource}- value={[users[0], users[2]]}- onChange={() => {}}- isDisabled- containerStyle={{width: 400}}- />- <Tokenizer- label="Error message"- placeholder="Search people..."- searchSource={userSource}- value={errorValue}- onChange={items => setErrorValue(items)}- isRequired- status={{type: 'error', message: 'At least one reviewer is required'}}- containerStyle={{width: 400}}- />- <Tokenizer- label="Warning message"- placeholder="Search people..."- searchSource={userSource}- value={warningValue}- onChange={items => setWarningValue(items)}- status={{- type: 'warning',- message: 'Consider adding at least 2 approvers',- }}- containerStyle={{width: 400}}- />- <Tokenizer- label="Success message"- placeholder="Search people..."- searchSource={userSource}- value={successValue}- onChange={items => setSuccessValue(items)}- status={{type: 'success', message: 'All required reviewers added'}}- containerStyle={{width: 400}}- />- </Stack>+ <div style={{display: 'grid', gridTemplateColumns: 'minmax(0, 400px)'}}>+ <Stack direction="vertical" gap={4}>+ <Tokenizer+ label="Disabled field"+ searchSource={userSource}+ value={[users[0], users[2]]}+ onChange={() => {}}+ isDisabled+ />+ <Tokenizer+ label="Error message"+ placeholder="Search people..."+ searchSource={userSource}+ value={errorValue}+ onChange={items => setErrorValue(items)}+ isRequired+ status={{type: 'error', message: 'At least one reviewer is required'}}+ />+ <Tokenizer+ label="Warning message"+ placeholder="Search people..."+ searchSource={userSource}+ value={warningValue}+ onChange={items => setWarningValue(items)}+ status={{+ type: 'warning',+ message: 'Consider adding at least 2 approvers',+ }}+ />+ <Tokenizer+ label="Success message"+ placeholder="Search people..."+ searchSource={userSource}+ value={successValue}+ onChange={items => setSuccessValue(items)}+ status={{type: 'success', message: 'All required reviewers added'}}+ />+ </Stack>+ </div>);}