Skip to content

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

TypeScript

fix(FileInput): use semantic upload icon (#6612)

rubyycheung00f1ed9da760
diff --git a/.changeset/add-upload-semantic-icon.md b/.changeset/add-upload-semantic-icon.md
new file mode 100644
index 0000000000..f7f17a0fe1
--- /dev/null
+++ b/.changeset/add-upload-semantic-icon.md
@@ -0,0 +1,18 @@
+---
+'@astryxdesign/core': patch
+'@astryxdesign/cli': patch
+'@astryxdesign/theme-butter': patch
+'@astryxdesign/theme-chocolate': patch
+'@astryxdesign/theme-gothic': patch
+'@astryxdesign/theme-matcha': patch
+'@astryxdesign/theme-neutral': patch
+'@astryxdesign/theme-stone': patch
+'@astryxdesign/theme-y2k': patch
+---
+
+[feat] Add a shared `upload` icon, and use it for FileInput's upload affordance instead of the directional `arrowUp`
+@rubyycheung
+
+Themes draw `upload` through `icons.upload`, separately from `arrowUp`, so sort arrows and every other `arrowUp` use stay unchanged. Every bundled theme and theme template draws `upload` in its own icon style. FileInput keeps its icon size, placement, color, and accessibility in both modes; a theme with no `upload` artwork shows the default upload-into-tray glyph there.
+
+A complete `IconRegistry` may still omit `upload` in this release. The next minor makes it required, so add an `upload` entry to any registry you type as `IconRegistry`.
diff --git a/packages/cli/assets/docs/icons.doc.mjs b/packages/cli/assets/docs/icons.doc.mjs
index aaf5dbbc1d..d93088cc60 100644
--- a/packages/cli/assets/docs/icons.doc.mjs
+++ b/packages/cli/assets/docs/icons.doc.mjs
@@ -42,6 +42,7 @@ export const docs = {
['menu', 'Hamburger menu, navigation toggle'],
['moreHorizontal', 'Overflow menu, additional actions'],
['search', 'Search inputs, find'],
+ ['upload', 'Upload files or content'],
['arrowUp', 'Sort ascending, move up'],
['arrowDown', 'Sort descending, move down'],
['arrowsUpDown', 'Sortable column indicator'],
diff --git a/packages/cli/assets/templates/themes/butter/icons.tsx b/packages/cli/assets/templates/themes/butter/icons.tsx
index b20f421dcc..742c41ec1b 100644
--- a/packages/cli/assets/templates/themes/butter/icons.tsx
+++ b/packages/cli/assets/templates/themes/butter/icons.tsx
@@ -31,6 +31,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -67,6 +68,7 @@ export const butterIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/cli/assets/templates/themes/chocolate/icons.tsx b/packages/cli/assets/templates/themes/chocolate/icons.tsx
index 15ec323f17..4c2e7f6523 100644
--- a/packages/cli/assets/templates/themes/chocolate/icons.tsx
+++ b/packages/cli/assets/templates/themes/chocolate/icons.tsx
@@ -31,6 +31,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -67,6 +68,7 @@ export const chocolateIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/cli/assets/templates/themes/gothic/icons.tsx b/packages/cli/assets/templates/themes/gothic/icons.tsx
index b71af76ad6..f4f9c71822 100644
--- a/packages/cli/assets/templates/themes/gothic/icons.tsx
+++ b/packages/cli/assets/templates/themes/gothic/icons.tsx
@@ -31,6 +31,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -67,6 +68,7 @@ export const gothicIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/cli/assets/templates/themes/matcha/icons.tsx b/packages/cli/assets/templates/themes/matcha/icons.tsx
index 4de1bca1c0..e4416a0df2 100644
--- a/packages/cli/assets/templates/themes/matcha/icons.tsx
+++ b/packages/cli/assets/templates/themes/matcha/icons.tsx
@@ -21,6 +21,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -57,6 +58,7 @@ export const matchaIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/cli/assets/templates/themes/neutral/icons.tsx b/packages/cli/assets/templates/themes/neutral/icons.tsx
index 83d243854c..0a1fd9830d 100644
--- a/packages/cli/assets/templates/themes/neutral/icons.tsx
+++ b/packages/cli/assets/templates/themes/neutral/icons.tsx
@@ -31,6 +31,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -67,6 +68,7 @@ export const neutralIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/cli/assets/templates/themes/stone/icons.tsx b/packages/cli/assets/templates/themes/stone/icons.tsx
index 6a80ea5c0f..4ea0b338f2 100644
--- a/packages/cli/assets/templates/themes/stone/icons.tsx
+++ b/packages/cli/assets/templates/themes/stone/icons.tsx
@@ -31,6 +31,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -67,6 +68,7 @@ export const stoneIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/cli/assets/templates/themes/y2k/icons.tsx b/packages/cli/assets/templates/themes/y2k/icons.tsx
index b84634e1f4..82a7852a48 100644
--- a/packages/cli/assets/templates/themes/y2k/icons.tsx
+++ b/packages/cli/assets/templates/themes/y2k/icons.tsx
@@ -21,6 +21,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -57,6 +58,7 @@ export const y2kIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/core/src/FileInput/FileInput.doc.mjs b/packages/core/src/FileInput/FileInput.doc.mjs
index c79ce7ab31..01f72dff2d 100644
--- a/packages/core/src/FileInput/FileInput.doc.mjs
+++ b/packages/core/src/FileInput/FileInput.doc.mjs
@@ -161,7 +161,7 @@ export const docs = {
{name: 'Label', required: true, description: 'Text that identifies the field. Always rendered for accessibility even when visually hidden.'},
{name: 'Description', required: false, description: 'Helper text between the label and the drop zone explaining accepted formats or size limits.'},
{name: 'Drop zone', required: true, description: 'The clickable area for file selection. In dropzone mode, also accepts dragged files.'},
- {name: 'Upload icon', required: false, description: 'An arrow icon in the drop zone hinting at the upload action.'},
+ {name: 'Upload icon', required: false, description: 'An upload-to-tray icon in the drop zone hinting at the upload action.'},
{name: 'Placeholder', required: false, description: 'Hint text shown when no files are selected.'},
{name: 'File name display', required: false, description: 'Shows the name(s) of selected files.'},
{name: 'Clear button', required: false, description: 'A close button that removes selected files and returns focus to the input.'},
diff --git a/packages/core/src/FileInput/FileInput.test.tsx b/packages/core/src/FileInput/FileInput.test.tsx
index a615881282..aa6bdbba25 100644
--- a/packages/core/src/FileInput/FileInput.test.tsx
+++ b/packages/core/src/FileInput/FileInput.test.tsx
@@ -21,6 +21,8 @@ import userEvent from '@testing-library/user-event';
import {FileInput} from './FileInput';
import {__resetLiveRegionsForTest} from '../hooks/useAnnounce';
import {InternationalizationProvider} from '../i18n';
+import {Theme} from '../theme/Theme';
+import {defineTheme} from '../theme/defineTheme';
// The `=1` branch names the file; the `other` branch must not. Both come from
// this test, so neither can pass against a hardcoded English string.
@@ -122,16 +124,36 @@ describe('FileInput', () => {
it.each([
{mode: 'input' as const, size: 'sm'},
{mode: 'dropzone' as const, size: 'md'},
- ])('exposes the upload icon as a $mode theme target', ({mode, size}) => {
- render(
- <FileInput label="Upload" mode={mode} value={null} onChange={() => {}} />,
- );
+ ])(
+ 'uses the shared upload icon registry and preserves the $mode theme target',
+ ({mode, size}) => {
+ const theme = {
+ ...defineTheme({
+ name: `file-input-semantic-icon-${mode}`,
+ icons: {upload: <svg data-testid={`themed-upload-${mode}`} />},
+ }),
+ __built: true as const,
+ };
- const icon = document.querySelector('.astryx-file-input-icon');
- expect(icon).toHaveClass('astryx-icon');
- expect(icon).toHaveAttribute('data-mode', mode);
- expect(icon).toHaveAttribute('data-size', size);
- });
+ render(
+ <Theme theme={theme}>
+ <FileInput
+ label="Upload"
+ mode={mode}
+ value={null}
+ onChange={() => {}}
+ />
+ </Theme>,
+ );
+
+ const icon = screen
+ .getByTestId(`themed-upload-${mode}`)
+ .closest('.astryx-file-input-icon');
+ expect(icon).toHaveClass('astryx-icon');
+ expect(icon).toHaveAttribute('data-mode', mode);
+ expect(icon).toHaveAttribute('data-size', size);
+ },
+ );
it('displays selected file name', () => {
const file = createFile('report.pdf', 1024, 'application/pdf');
diff --git a/packages/core/src/FileInput/FileInput.tsx b/packages/core/src/FileInput/FileInput.tsx
index 61fee82382..e7b641c59d 100644
--- a/packages/core/src/FileInput/FileInput.tsx
+++ b/packages/core/src/FileInput/FileInput.tsx
@@ -717,7 +717,7 @@ export function FileInput({
return (
<>
<Icon
- icon="arrowUp"
+ icon="upload"
size="md"
color="secondary"
{...themeProps('file-input-icon', {mode})}
@@ -743,7 +743,7 @@ export function FileInput({
return (
<>
<Icon
- icon="arrowUp"
+ icon="upload"
size="sm"
color="secondary"
{...themeProps('file-input-icon', {mode})}
diff --git a/packages/core/src/Icon/Icon.doc.mjs b/packages/core/src/Icon/Icon.doc.mjs
index 25643174bd..eb6637fc8a 100644
--- a/packages/core/src/Icon/Icon.doc.mjs
+++ b/packages/core/src/Icon/Icon.doc.mjs
@@ -37,7 +37,7 @@ export const docs = {
name: 'icon',
type: 'IconName | ComponentType<SVGProps>',
description:
- 'Semantic icon name or SVG component. Valid semantic names: close, chevronDown, chevronLeft, chevronRight, chevronsLeft, chevronsRight, check, success, error, warning, info, calendar, clock, externalLink, menu, moreHorizontal, search, arrowUp, arrowDown, arrowsUpDown, funnel, eyeSlash, viewColumns, copy, checkDouble, wrench, stop, microphone. For any icon not in this list, pass an SVG component directly (e.g. import from lucide-react or @heroicons/react). Note: this prop is called `icon`, not `name`.',
+ 'Semantic icon name or SVG component. Valid semantic names: close, chevronDown, chevronLeft, chevronRight, chevronsLeft, chevronsRight, check, success, error, warning, info, calendar, clock, externalLink, menu, moreHorizontal, search, upload, arrowUp, arrowDown, arrowsUpDown, funnel, eyeSlash, viewColumns, copy, checkDouble, wrench, stop, microphone. For any icon not in this list, pass an SVG component directly (e.g. import from lucide-react or @heroicons/react). Note: this prop is called `icon`, not `name`.',
required: true,
},
{
@@ -142,7 +142,7 @@ export const docsZh = {
name: 'icon',
type: 'IconName | ComponentType<SVGProps>',
description:
- '语义图标名称或 SVG 组件。有效语义名称:close, chevronDown, chevronLeft, chevronRight, chevronsLeft, chevronsRight, check, success, error, warning, info, calendar, clock, externalLink, menu, moreHorizontal, search, arrowUp, arrowDown, arrowsUpDown, funnel, eyeSlash, viewColumns, copy, checkDouble, wrench, stop, microphone。列表之外的图标请直接传入 SVG 组件。',
+ '语义图标名称或 SVG 组件。有效语义名称:close, chevronDown, chevronLeft, chevronRight, chevronsLeft, chevronsRight, check, success, error, warning, info, calendar, clock, externalLink, menu, moreHorizontal, search, upload, arrowUp, arrowDown, arrowsUpDown, funnel, eyeSlash, viewColumns, copy, checkDouble, wrench, stop, microphone。列表之外的图标请直接传入 SVG 组件。',
required: true,
},
{
@@ -294,7 +294,7 @@ export const docsDense = {
],
},
propDescriptions: {
- icon: 'Semantic icon name or SVG component. Valid names: close, chevronDown, chevronLeft, chevronRight, chevronsLeft, chevronsRight, check, success, error, warning, info, calendar, clock, externalLink, menu, moreHorizontal, search, arrowUp, arrowDown, arrowsUpDown, funnel, eyeSlash, viewColumns, copy, checkDouble, wrench, stop, microphone. For others, pass an SVG component.',
+ icon: 'Semantic icon name or SVG component. Valid names: close, chevronDown, chevronLeft, chevronRight, chevronsLeft, chevronsRight, check, success, error, warning, info, calendar, clock, externalLink, menu, moreHorizontal, search, upload, arrowUp, arrowDown, arrowsUpDown, funnel, eyeSlash, viewColumns, copy, checkDouble, wrench, stop, microphone. For others, pass an SVG component.',
color: 'Color variant mapped to Astryx icon color tokens.',
size: "explicit Icon size; otherwise nearest owning-component default, then 'md' when no contextual default exists",
label:
diff --git a/packages/core/src/Icon/defaultIcons.tsx b/packages/core/src/Icon/defaultIcons.tsx
index 0fa1050275..8bd4b70b6a 100644
--- a/packages/core/src/Icon/defaultIcons.tsx
+++ b/packages/core/src/Icon/defaultIcons.tsx
@@ -24,7 +24,7 @@
*/
import type {ReactNode} from 'react';
-import type {IconRegistry, NamespacedIconName} from './globalIconRegistry';
+import type {IconName, NamespacedIconName} from './globalIconRegistry';
const svgProps = {
xmlns: 'http://www.w3.org/2000/svg',
@@ -54,7 +54,7 @@ const solidSvgProps = {
'aria-hidden': true as const,
};
-export const defaultIcons: IconRegistry &
+export const defaultIcons: Record<IconName, ReactNode> &
Partial<Record<NamespacedIconName, ReactNode>> = {
/** ✕ — two diagonal lines */
close: (
@@ -205,6 +205,13 @@ export const defaultIcons: IconRegistry &
</svg>
),
+ /** ⇧ — upload into a tray */
+ upload: (
+ <svg {...svgProps}>
+ <path d="M12 16V4m0 0L7 9m5-5l5 5M4 15v4a2 2 0 002 2h12a2 2 0 002-2v-4" />
+ </svg>
+ ),
+
/** ↑ — arrow up (sort ascending) */
arrowUp: (
<svg {...svgProps}>
diff --git a/packages/core/src/Icon/globalIconRegistry.test.tsx b/packages/core/src/Icon/globalIconRegistry.test.tsx
index 1deb79db62..f6e1bb0836 100644
--- a/packages/core/src/Icon/globalIconRegistry.test.tsx
+++ b/packages/core/src/Icon/globalIconRegistry.test.tsx
@@ -1,6 +1,7 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
import {describe, it, expect, beforeEach, afterEach, vi} from 'vitest';
+import {render} from '@testing-library/react';
import {defineTheme} from '../theme/defineTheme';
import {resetThemes} from '../theme/themeRegistry';
import {__resetDevWarnings} from '../utils/devWarning';
@@ -11,7 +12,9 @@ import {
getIcon,
getExtendedIcon,
resetIcons,
+ type IconRegistry,
} from './globalIconRegistry';
+import {Icon} from './Icon';
describe('iconRegistry (global, RSC-compatible)', () => {
beforeEach(() => {
@@ -43,6 +46,47 @@ describe('iconRegistry (global, RSC-compatible)', () => {
expect(icon).not.toBe(defaultIcons.chevronDown);
});
+ it('draws the default upload distinctly from arrowUp', () => {
+ const {container: upload} = render(<Icon icon="upload" />);
+ const {container: arrowUp} = render(<Icon icon="arrowUp" />);
+
+ expect(getIcon('upload')).toBe(defaultIcons.upload);
+ expect(upload.querySelector('svg')).not.toBeNull();
+ expect(upload.querySelector('svg')?.innerHTML).not.toBe(
+ arrowUp.querySelector('svg')?.innerHTML,
+ );
+ });
+
+ it('keeps complete registries authored before upload assignable', () => {
+ const {upload: _upload, ...legacyIcons} = defaultIcons;
+ const legacyRegistry: IconRegistry = legacyIcons;
+
+ expect(legacyRegistry.search).toBe(defaultIcons.search);
+ });
+
+ it('lets a theme draw upload without changing arrowUp', () => {
+ const theme = defineTheme({
+ name: 'upload-only',
+ icons: {upload: 'theme-upload'},
+ });
+
+ expect(getIcon('upload', theme)).toBe('theme-upload');
+ expect(getIcon('arrowUp', theme)).toBe(defaultIcons.arrowUp);
+ expect(getIconRegistry(theme).arrowUp).toBe(defaultIcons.arrowUp);
+ });
+
+ it('resolves the default upload for a theme that only draws arrowUp', () => {
+ const {upload: _upload, ...legacyIcons} = defaultIcons;
+ const theme = defineTheme({
+ name: 'legacy-complete',
+ icons: {...legacyIcons, arrowUp: 'theme-arrow-up'},
+ });
+
+ expect(getIcon('arrowUp', theme)).toBe('theme-arrow-up');
+ expect(getIcon('upload', theme)).toBe(defaultIcons.upload);
+ expect(getIconRegistry(theme).upload).toBe(defaultIcons.upload);
+ });
+
it('returns default icons when nothing is registered', () => {
const icon = getIcon('close');
expect(icon).toBeDefined();
diff --git a/packages/core/src/Icon/globalIconRegistry.tsx b/packages/core/src/Icon/globalIconRegistry.tsx
index 0c7ba77c18..37fb60f2e3 100644
--- a/packages/core/src/Icon/globalIconRegistry.tsx
+++ b/packages/core/src/Icon/globalIconRegistry.tsx
@@ -45,6 +45,7 @@ export type IconName =
| 'menu'
| 'moreHorizontal'
| 'search'
+ | 'upload'
| 'arrowUp'
| 'arrowDown'
| 'arrowsUpDown'
@@ -83,9 +84,15 @@ export type NamespacedIconName = `${string}:${string}`;
export type ExtendedIconName = IconName | (string & {});
/**
- * Icon registry mapping semantic names to React nodes.
+ * A complete icon registry: every semantic name mapped to a React node.
+ *
+ * `upload` is the one name a complete registry may still omit. Requiring it
+ * would break registries written before it existed, so it becomes required in
+ * the next scheduled minor (`spec:AST-032` FR6). An omitted `upload` resolves
+ * the default artwork, so resolved registry snapshots are always complete.
*/
-export type IconRegistry = Record<IconName, ReactNode>;
+export type IconRegistry = Record<Exclude<IconName, 'upload'>, ReactNode> &
+ Partial<Record<'upload', ReactNode>>;
export type IconRegistrySource = DefinedTheme | string | null | undefined;
@@ -163,7 +170,7 @@ export function registerIcons(
*/
export function getIconRegistry(
source?: IconRegistrySource,
-): Readonly<IconRegistry> {
+): Readonly<Record<IconName, ReactNode>> {
const registry: Record<string, ReactNode> = {};
// Only surface built-in IconName keys here — namespaced keys, whether
@@ -187,7 +194,7 @@ export function getIconRegistry(
}
}
- return registry as IconRegistry;
+ return registry as Record<IconName, ReactNode>;
}
/**
diff --git a/packages/core/src/Table/useTableRowStatus.doc.mjs b/packages/core/src/Table/useTableRowStatus.doc.mjs
index 25e7c2776a..08b3138f15 100644
--- a/packages/core/src/Table/useTableRowStatus.doc.mjs
+++ b/packages/core/src/Table/useTableRowStatus.doc.mjs
@@ -13,7 +13,7 @@ export const docs = {
name: 'getStatus',
type: "(item: T) => ({ status: 'success' | 'warning' | 'error'; color?: never; icon?: never; label: string } | { status?: never; color: 'accent' | 'success' | 'error' | 'warning' | 'red' | 'orange' | 'green' | 'yellow' | 'blue' | 'gray' | string; icon?: IconName; label: string }) | null",
description:
- 'Derive either a semantic outcome or a custom marker. {status, label} accepts the closed success/error/warning vocabulary and resolves its glyph and tone through the active theme. {color, icon?, label} preserves the stable custom-marker path: color always selects paint, no icon renders an 8px dot, and icon renders the explicit caller glyph. Even color values named success/error/warning remain dots without icon. Valid icon names: close, chevronDown, chevronLeft, chevronRight, chevronsLeft, chevronsRight, check, success, error, warning, info, calendar, clock, externalLink, menu, moreHorizontal, search, arrowUp, arrowDown, arrowsUpDown, funnel, eyeSlash, viewColumns, copy, checkDouble, wrench, stop, microphone. The branches are exclusive, label is required and announced via role="img", and null leaves the row status cell empty. Memoize with useCallback for a stable plugin identity.',
+ 'Derive either a semantic outcome or a custom marker. {status, label} accepts the closed success/error/warning vocabulary and resolves its glyph and tone through the active theme. {color, icon?, label} preserves the stable custom-marker path: color always selects paint, no icon renders an 8px dot, and icon renders the explicit caller glyph. Even color values named success/error/warning remain dots without icon. Valid icon names: close, chevronDown, chevronLeft, chevronRight, chevronsLeft, chevronsRight, check, success, error, warning, info, calendar, clock, externalLink, menu, moreHorizontal, search, upload, arrowUp, arrowDown, arrowsUpDown, funnel, eyeSlash, viewColumns, copy, checkDouble, wrench, stop, microphone. The branches are exclusive, label is required and announced via role="img", and null leaves the row status cell empty. Memoize with useCallback for a stable plugin identity.',
required: true,
},
],
diff --git a/packages/themes/butter/src/icons.tsx b/packages/themes/butter/src/icons.tsx
index b20f421dcc..742c41ec1b 100644
--- a/packages/themes/butter/src/icons.tsx
+++ b/packages/themes/butter/src/icons.tsx
@@ -31,6 +31,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -67,6 +68,7 @@ export const butterIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/themes/chocolate/src/icons.tsx b/packages/themes/chocolate/src/icons.tsx
index 15ec323f17..4c2e7f6523 100644
--- a/packages/themes/chocolate/src/icons.tsx
+++ b/packages/themes/chocolate/src/icons.tsx
@@ -31,6 +31,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -67,6 +68,7 @@ export const chocolateIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/themes/gothic/src/icons.tsx b/packages/themes/gothic/src/icons.tsx
index b71af76ad6..f4f9c71822 100644
--- a/packages/themes/gothic/src/icons.tsx
+++ b/packages/themes/gothic/src/icons.tsx
@@ -31,6 +31,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -67,6 +68,7 @@ export const gothicIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/themes/matcha/src/icons.tsx b/packages/themes/matcha/src/icons.tsx
index 4de1bca1c0..e4416a0df2 100644
--- a/packages/themes/matcha/src/icons.tsx
+++ b/packages/themes/matcha/src/icons.tsx
@@ -21,6 +21,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -57,6 +58,7 @@ export const matchaIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/themes/neutral/src/icons.tsx b/packages/themes/neutral/src/icons.tsx
index 83d243854c..0a1fd9830d 100644
--- a/packages/themes/neutral/src/icons.tsx
+++ b/packages/themes/neutral/src/icons.tsx
@@ -31,6 +31,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -67,6 +68,7 @@ export const neutralIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/themes/stone/src/icons.tsx b/packages/themes/stone/src/icons.tsx
index 6a80ea5c0f..4ea0b338f2 100644
--- a/packages/themes/stone/src/icons.tsx
+++ b/packages/themes/stone/src/icons.tsx
@@ -31,6 +31,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -67,6 +68,7 @@ export const stoneIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/packages/themes/y2k/src/icons.tsx b/packages/themes/y2k/src/icons.tsx
index b84634e1f4..82a7852a48 100644
--- a/packages/themes/y2k/src/icons.tsx
+++ b/packages/themes/y2k/src/icons.tsx
@@ -21,6 +21,7 @@ import {
Menu,
MoreHorizontal,
Search,
+ Upload,
ArrowUp,
ArrowDown,
ArrowUpDown,
@@ -57,6 +58,7 @@ export const y2kIconRegistry: IconRegistry = {
menu: <Menu {...iconProps} />,
moreHorizontal: <MoreHorizontal {...iconProps} />,
search: <Search {...iconProps} />,
+ upload: <Upload {...iconProps} />,
arrowUp: <ArrowUp {...iconProps} />,
arrowDown: <ArrowDown {...iconProps} />,
arrowsUpDown: <ArrowUpDown {...iconProps} />,
diff --git a/scripts/check-theme-icon-coverage.test.mjs b/scripts/check-theme-icon-coverage.test.mjs
new file mode 100644
index 0000000000..d932119c34
--- /dev/null
+++ b/scripts/check-theme-icon-coverage.test.mjs
@@ -0,0 +1,57 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file Every bundled theme draws every shared icon name.
+ *
+ * `spec:AST-032` FR6: the default registry, each bundled theme, and each CLI
+ * theme template supply `upload` artwork in their own style. Until the next
+ * scheduled minor makes `upload` a required `IconRegistry` key, the type
+ * checker cannot see a theme that leaves it out, and that theme would quietly
+ * render the default glyph inside its own icon family. The CLI templates are
+ * byte-pinned copies of these sources (`check-cli-theme-bundle.test.mjs`), so
+ * checking the packages covers both.
+ */
+
+import path from 'node:path';
+import {fileURLToPath} from 'node:url';
+import {describe, it, expect} from 'vitest';
+import {defaultIcons} from '../packages/core/src/Icon/defaultIcons.tsx';
+import {listThemeSlugs} from './generate-cli-themes.mjs';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const THEMES_ROOT = path.resolve(__dirname, '..', 'packages', 'themes');
+
+// Namespaced extension keys (`numberInput:stepperDown`) are component-owned
+// defaults, not shared names a theme registry is expected to draw.
+const sharedIconNames = Object.keys(defaultIcons)
+ .filter(name => !name.includes(':'))
+ .sort();
+
+async function loadIconRegistry(slug) {
+ const module = await import(path.join(THEMES_ROOT, slug, 'src', 'icons.tsx'));
+ const registries = Object.entries(module).filter(([name]) =>
+ name.endsWith('IconRegistry'),
+ );
+ expect(registries, `${slug}/src/icons.tsx exports one registry`).toHaveLength(
+ 1,
+ );
+ return registries[0][1];
+}
+
+describe('bundled theme icon coverage', () => {
+ const slugs = listThemeSlugs(THEMES_ROOT);
+
+ it('finds the bundled themes and the shared names to check', () => {
+ expect(slugs.length).toBeGreaterThan(0);
+ expect(sharedIconNames).toContain('upload');
+ });
+
+ for (const slug of slugs) {
+ it(`${slug} draws every shared icon name`, async () => {
+ const registry = await loadIconRegistry(slug);
+ const missing = sharedIconNames.filter(name => registry[name] == null);
+
+ expect(missing).toEqual([]);
+ });
+ }
+});