An open source design system that's fully customizable and agent ready
TypeScript
docs: add Thumbnail translations, Markdown/CodeBlock missing props, fix Chat @example (#1300)
Joey4c1632d08043
diff --git a/packages/core/src/Chat/Chat.doc.mjs b/packages/core/src/Chat/Chat.doc.mjsindex 563829af43..4530d31f41 100644--- a/packages/core/src/Chat/Chat.doc.mjs+++ b/packages/core/src/Chat/Chat.doc.mjs@@ -26,6 +26,7 @@ export const docs = {],theming: {targets: [+ {className: 'xds-chat-layout', visualProps: ['density']},{className: 'xds-chat-composer', visualProps: ['density']},{className: 'xds-chat-composer-input'},{className: 'xds-chat-composer-attachments', visualProps: ['collapsed']},diff --git a/packages/core/src/Chat/XDSChatTokenizedText.tsx b/packages/core/src/Chat/XDSChatTokenizedText.tsxindex 7be0808b24..66625de094 100644--- a/packages/core/src/Chat/XDSChatTokenizedText.tsx+++ b/packages/core/src/Chat/XDSChatTokenizedText.tsx@@ -37,11 +37,6 @@ export interface XDSChatTokenizedTextProps {* label: `@${c.label}`,* variant: 'blue' as const,* }));- *- * // Input trigger- * { character: '@', onSelect: (item) => mentionTokens.find(...) }- *- * // Display* <XDSChatTokenizedText tokens={mentionTokens}>* {message.text}* </XDSChatTokenizedText>diff --git a/packages/core/src/CodeBlock/XDSCodeBlock.doc.mjs b/packages/core/src/CodeBlock/XDSCodeBlock.doc.mjsindex 61de8f865c..9a7a47a84e 100644--- a/packages/core/src/CodeBlock/XDSCodeBlock.doc.mjs+++ b/packages/core/src/CodeBlock/XDSCodeBlock.doc.mjs@@ -35,6 +35,8 @@ export const docs = {{name: 'maxHeight', type: 'number | string', description: 'Max height before the block scrolls vertically.'},{name: 'size', type: "'sm' | 'md'", description: 'Text size variant.', default: "'md'"},{name: 'tokenizer', type: '(code: string, language: string) => Array<{type: string; start: number; end: number}>', description: 'Custom tokenizer override for unsupported languages.'},+ {name: 'isCollapsible', type: 'boolean', description: 'Allow collapsing the code body into just the header bar. Starts expanded; the header becomes clickable to toggle. Only shows the toggle when the code exceeds collapsibleThreshold lines.', default: 'false'},+ {name: 'collapsibleThreshold', type: 'number', description: 'Minimum number of lines before the collapse toggle appears. Below this threshold the code block renders normally even when isCollapsible is true.', default: '10'},{name: 'xstyle', type: 'StyleXStyles', description: 'StyleX styles for layout customization. Must be a stylex.create() value.'},{name: 'className', type: 'string', description: 'CSS class name for the root element. Prefer xstyle for styling.'},{name: 'style', type: 'CSSProperties', description: 'Inline styles. Prefer xstyle for StyleX-optimized styling.'},@@ -129,6 +131,8 @@ export const docsZh = {maxHeight: '代码块垂直滚动前的最大高度。',size: '文字大小变体。',tokenizer: '用于不支持语言的自定义分词器。',+ isCollapsible: '允许将代码折叠为仅标题栏。当代码超过 collapsibleThreshold 行时显示切换按钮。',+ collapsibleThreshold: '折叠切换出现前的最小行数。低于此阈值时即使 isCollapsible 为 true 也正常渲染。',xstyle: 'StyleX 布局自定义样式。必须是 stylex.create() 的值。',className: '根元素的 CSS 类名。优先使用 xstyle。',style: '内联样式。优先使用 xstyle。',@@ -193,6 +197,8 @@ export const docsDense = {maxHeight: 'max height before vertical scroll',size: 'text size variant',tokenizer: 'custom tokenizer for unsupported languages',+ isCollapsible: 'Collapse code to header bar. Toggle appears when lines > collapsibleThreshold. Default: false.',+ collapsibleThreshold: 'Min lines before collapse toggle shows. Default: 10.',xstyle: 'StyleX layout styles; must be stylex.create() value',className: 'CSS class for root; prefer xstyle',style: 'inline styles; prefer xstyle',diff --git a/packages/core/src/Markdown/Markdown.doc.mjs b/packages/core/src/Markdown/Markdown.doc.mjsindex 16153ebbf7..c6269cea1c 100644--- a/packages/core/src/Markdown/Markdown.doc.mjs+++ b/packages/core/src/Markdown/Markdown.doc.mjs@@ -24,6 +24,8 @@ export const docs = {"Density — default and compact spacing modes","Task lists — GitHub Flavored Markdown checkboxes rendered via XDSCheckboxList in isReadOnly mode",'Tables — rendered as accessible HTML tables with XDS typography',+ 'Citation chips — sources prop renders [id] and 【id】 markers as linked chips with label or number style',+ 'Content width — contentWidth constrains prose to a readable width while tables and code blocks expand to the full container',],props: [{@@ -58,6 +60,32 @@ export const docs = {description:'Handler for link clicks. Return false to prevent the default navigation behavior.',},+ {+ name: 'sources',+ type: 'Record<string, XDSMarkdownSource>',+ description:+ 'Citation sources keyed by ID. When provided, [id] and 【id】 markers in the markdown that match a key are rendered as citation chips.',+ },+ {+ name: 'citationStyle',+ type: "'label' | 'number'",+ description:+ "How citations are displayed inline. 'label' shows a chip with source title, icon, and border. 'number' shows a compact numbered badge.",+ default: "'label'",+ },+ {+ name: 'contentWidth',+ type: 'number | string',+ description:+ 'Max width for prose content (paragraphs, headings, lists, blockquotes). Tables and code blocks are unconstrained and can expand to the full container width. Use for readable line lengths in wide layouts.',+ },+ {+ name: 'contentAlign',+ type: "'start' | 'center'",+ description:+ "Alignment of prose content within the container when contentWidth is narrower than the available space.",+ default: "'start'",+ },{name: 'xstyle',type: 'StyleXStyles',@@ -132,6 +160,8 @@ export const docsZh = {'密度 — 默认和紧凑间距模式','任务列表 — GitHub 风格 Markdown 复选框通过 XDSCheckboxList 以只读模式渲染','表格 — 渲染为带 XDS 排版的语义 HTML 表格',+ '引用标签 — sources 属性将 [id] 和 【id】 标记渲染为带链接的标签或编号徽章',+ '内容宽度 — contentWidth 将正文限制在可读宽度内,表格和代码块扩展到完整容器宽度',],props: [{@@ -165,6 +195,32 @@ export const docsZh = {type: '(href: string, event: MouseEvent) => void | false',description: '链接点击处理器。返回 false 可阻止默认导航行为。',},+ {+ name: 'sources',+ type: 'Record<string, XDSMarkdownSource>',+ description:+ '按 ID 索引的引用来源。提供后,Markdown 中匹配的 [id] 和 【id】 标记将渲染为引用标签。',+ },+ {+ name: 'citationStyle',+ type: "'label' | 'number'",+ description:+ "引用的内联显示方式。'label' 显示带标题、图标和边框的标签。'number' 显示紧凑编号徽章。",+ default: "'label'",+ },+ {+ name: 'contentWidth',+ type: 'number | string',+ description:+ '正文内容的最大宽度(段落、标题、列表、引用块)。表格和代码块不受限制,可扩展到完整容器宽度。用于在宽布局中保持可读行长。',+ },+ {+ name: 'contentAlign',+ type: "'start' | 'center'",+ description:+ "当 contentWidth 小于可用空间时,正文内容在容器内的对齐方式。",+ default: "'start'",+ },{name: 'xstyle',type: 'StyleXStyles',@@ -225,6 +281,8 @@ export const docsDense = {'onLinkClick: intercept/prevent link nav. Return false to cancel.','density: default/compact block spacing.','Task lists via XDSCheckboxList isReadOnly. Tables as semantic HTML.',+ 'Citation chips: sources prop + [id]/【id】 markers. label or number style.',+ 'contentWidth constrains prose; tables/code expand to full width.',],p: {children: 'Markdown string. Required.',@@ -232,6 +290,10 @@ export const docsDense = {headingLevelStart: 'Maps # to this heading level (1-6). Clamped to h6. Default: 1.',isStreaming: 'Incremental parse + fade-in for streamed chunks. Default: false.',onLinkClick: '(href, event) => void|false. Return false prevents navigation.',+ sources: 'Record<string, XDSMarkdownSource>. Citation sources by ID. [id]/【id】 markers render as chips.',+ citationStyle: "'label'|'number'. label=chip w/ title+icon, number=compact badge. Default: 'label'.",+ contentWidth: 'number|string. Max width for prose (headings, paragraphs, lists). Tables/code unconstrained.',+ contentAlign: "'start'|'center'. Prose alignment when contentWidth < container. Default: 'start'.",xstyle: 'stylex.create() for layout (margins, sizing).',className: 'CSS class. Prefer xstyle.',style: 'Inline styles. Prefer xstyle.',diff --git a/packages/core/src/Thumbnail/Thumbnail.doc.mjs b/packages/core/src/Thumbnail/Thumbnail.doc.mjsindex 3c1f05fb94..64882f1cd9 100644--- a/packages/core/src/Thumbnail/Thumbnail.doc.mjs+++ b/packages/core/src/Thumbnail/Thumbnail.doc.mjs@@ -55,6 +55,26 @@ export const docs = {description: 'Whether the thumbnail is disabled.',default: 'false',},+ {+ name: 'xstyle',+ type: 'StyleXStyles',+ description: 'StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value — not an inline style object like style={{}}.',+ },+ {+ name: 'className',+ type: 'string',+ description: 'CSS class name for the root element. Prefer xstyle for styling — className is provided for integration with non-StyleX systems.',+ },+ {+ name: 'style',+ type: 'CSSProperties',+ description: 'Inline styles for the root element. Prefer xstyle for styling — inline styles bypass StyleX optimization.',+ },+ {+ name: 'data-testid',+ type: 'string',+ description: 'Test selector for automated testing frameworks.',+ },],examples: [{@@ -66,4 +86,79 @@ export const docs = {code: '<XDSThumbnail src="/preview.png" alt="Preview" onClick={openLightbox} />',},],+ theming: {+ targets: [+ {className: 'xds-thumbnail'},+ ],+ },+ accessibility: [+ 'label prop provides aria-label for the thumbnail and its remove button.',+ 'onClick renders as a button for keyboard and screen reader access.',+ 'Remove button uses aria-label derived from the label prop.',+ ],+};++/** @type {import('../docs-types').TranslationDoc} */+export const docsZh = {+ description:+ '图片附件的方形预览卡片。上传时显示骨架屏动画,成功时显示图片,无图片源时显示占位图标。',+ features: [+ '通过 CSS aspect-ratio 实现 1:1 正方形比例',+ '上传时骨架屏闪烁效果(isLoading)',+ 'isLoading + src 时显示上传覆盖层和加载指示器',+ '通过 object-fit: cover 预览图片',+ '基于 APCA 亮度检测的自适应移除按钮对比度',+ '同心圆角:按钮圆角由容器圆角减去内边距推导',+ '可交互缩略图(onClick)的悬停阴影',+ '标签作为悬停提示工具和 aria-label 显示',+ '无 src 时显示占位图标',+ '禁用状态阻止所有交互并降低不透明度',+ ],+ propDescriptions: {+ src: '图片源 URL。',+ alt: '图片的替代文本。',+ label: '无障碍标签(如文件名)。悬停时以提示工具显示。',+ onRemove: '覆盖层移除按钮的回调。',+ onClick: '点击处理器。添加按钮语义和悬停阴影。',+ isLoading: '显示骨架屏(无 src)或上传覆盖层(有 src)。',+ isDisabled: '是否禁用缩略图。',+ xstyle: '用于布局自定义的 StyleX 样式。必须是 stylex.create() 的值,而非内联样式对象。',+ className: '根元素的 CSS 类名。建议使用 xstyle。',+ style: '根元素的内联样式。建议使用 xstyle。',+ 'data-testid': '用于自动化测试框架的测试选择器。',+ },+ accessibility: [+ 'label 属性为缩略图及其移除按钮提供 aria-label。',+ 'onClick 渲染为按钮以支持键盘和屏幕阅读器访问。',+ '移除按钮使用从 label 属性推导的 aria-label。',+ ],+};++export const docsDense = {+ n: 'Thumbnail',+ d: 'Square preview card for image attachments. Skeleton shimmer on upload, image on success, placeholder when no src.',+ kw: ['thumbnail', 'attachment', 'preview', 'image', 'upload', 'dismiss', 'remove', 'loading'],+ f: [+ '1:1 aspect-ratio. Skeleton shimmer (isLoading). Upload overlay w/ spinner.',+ 'APCA luminance for adaptive remove button contrast. Concentric radius.',+ 'Hover shadow on onClick. Tooltip from label. Placeholder icon when no src.',+ 'Disabled state blocks interactions, reduces opacity.',+ ],+ p: {+ src: 'Image source URL.',+ alt: 'Alt text for image.',+ label: 'Accessible label (file name). Tooltip on hover, aria-label.',+ onRemove: '(e) => void. Overlaid remove button callback.',+ onClick: '(e) => void. Adds button semantics + hover shadow.',+ isLoading: 'Skeleton (no src) or upload overlay (with src). Default: false.',+ isDisabled: 'Disabled state. Default: false.',+ xstyle: 'stylex.create() for layout.',+ className: 'CSS class. Prefer xstyle.',+ style: 'Inline styles. Prefer xstyle.',+ 'data-testid': 'Test selector.',+ },+ ex: [+ '<XDSThumbnail src="/photo.jpg" alt="Vacation" label="vacation.jpg" onRemove={() => {}} />',+ '<XDSThumbnail src="/preview.png" alt="Preview" onClick={openLightbox} />',+ ],};