An open source design system that's fully customizable and agent ready
TypeScript
fix(core): add missing style escape hatches to Spinner, TabList, Tab (#1301)
Cindy Zhang80a30b1b4fc7
diff --git a/packages/core/src/Spinner/XDSSpinner.tsx b/packages/core/src/Spinner/XDSSpinner.tsxindex 2cc7f169c1..967d2ed570 100644--- a/packages/core/src/Spinner/XDSSpinner.tsx+++ b/packages/core/src/Spinner/XDSSpinner.tsx@@ -115,6 +115,11 @@ export interface XDSSpinnerProps {* If you're using StyleX, prefer `xstyle` for optimal style deduplication.*/className?: string;+ /**+ * Inline styles to apply to the root element. Spread after StyleX+ * inline styles, so these values take priority.+ */+ style?: React.CSSProperties;/*** Visible content displayed below the spinner.* Accepts a string or ReactNode for rich content.@@ -162,6 +167,7 @@ export function XDSSpinner({label,xstyle,className,+ style,'aria-label': ariaLabel,'data-testid': testId,ref,@@ -245,8 +251,8 @@ export function XDSSpinner({hasLabel ? '' : xdsClassName('spinner', {size, shade}),stylex.props(styles.spinner, !hasLabel && xstyle),hasLabel ? undefined : className,- )}- style={{width: frameSize, height: frameSize}}>+ {...(hasLabel ? {} : style), width: frameSize, height: frameSize},+ )}><canvas ref={canvasRef} {...stylex.props(styles.canvas)} /></span>);@@ -263,6 +269,7 @@ export function XDSSpinner({xdsClassName('spinner', {size, shade}),stylex.props(styles.wrapper, xstyle),className,+ style,)}>{spinner}{typeof label === 'string' ? (diff --git a/packages/core/src/TabList/XDSTab.tsx b/packages/core/src/TabList/XDSTab.tsxindex 46ef3e7d99..16522841b9 100644--- a/packages/core/src/TabList/XDSTab.tsx+++ b/packages/core/src/TabList/XDSTab.tsx@@ -14,6 +14,7 @@import {useCallback, type ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';+import type {StyleXStyles} from '@stylexjs/stylex';import {colorVars,spacingVars,@@ -57,6 +58,26 @@ export interface XDSTabProps {* Icon element shown when tab is selected. Falls back to `icon` if not provided.*/selectedIcon?: ReactNode;+ /**+ * StyleX styles created via `stylex.create()`. Merged with the component's+ * base styles inside a single `stylex.props()` call for optimal deduplication.+ *+ * @example+ * ```+ * const overrides = stylex.create({ root: { paddingInline: 16 } });+ * <XDSTab xstyle={overrides.root} ... />+ * ```+ */+ xstyle?: StyleXStyles;+ /**+ * CSS class name(s) appended to the root element.+ * If you're using StyleX, prefer `xstyle` for optimal style deduplication.+ */+ className?: string;+ /**+ * Inline styles to apply to the root element.+ */+ style?: React.CSSProperties;}// =============================================================================@@ -176,6 +197,9 @@ export function XDSTab({href,icon,selectedIcon,+ xstyle,+ className,+ style,}: XDSTabProps) {const tabListCtx = useXDSTabListContext();const LinkComponent = useXDSLinkComponent(as);@@ -205,7 +229,10 @@ export function XDSTab({sizeStyles[size],isSelected && styles.selected,!isSelected && stylex.defaultMarker(),+ xstyle,),+ className,+ style,),};diff --git a/packages/core/src/TabList/XDSTabList.tsx b/packages/core/src/TabList/XDSTabList.tsxindex 279952c4a5..db55ac6562 100644--- a/packages/core/src/TabList/XDSTabList.tsx+++ b/packages/core/src/TabList/XDSTabList.tsx@@ -14,6 +14,7 @@import {useMemo, type ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';+import type {StyleXStyles} from '@stylexjs/stylex';import {borderVars, colorVars, spacingVars} from '../theme/tokens.stylex';import {XDSTabListContext} from './XDSTabListContext';import type {XDSTabListSize} from './XDSTabListContext';@@ -38,6 +39,26 @@ export interface XDSTabListProps {* @default false*/hasDivider?: boolean;+ /**+ * StyleX styles created via `stylex.create()`. Merged with the component's+ * base styles inside a single `stylex.props()` call for optimal deduplication.+ *+ * @example+ * ```+ * const overrides = stylex.create({ root: { marginBottom: 8 } });+ * <XDSTabList xstyle={overrides.root} ... />+ * ```+ */+ xstyle?: StyleXStyles;+ /**+ * CSS class name(s) appended to the root element.+ * If you're using StyleX, prefer `xstyle` for optimal style deduplication.+ */+ className?: string;+ /**+ * Inline styles to apply to the root element.+ */+ style?: React.CSSProperties;/*** XDSTab and XDSTabMenu children.*/@@ -78,6 +99,9 @@ export function XDSTabList({onChange,size = 'md',hasDivider = false,+ xstyle,+ className,+ style,children,}: XDSTabListProps) {const contextValue = useMemo(@@ -91,7 +115,9 @@ export function XDSTabList({aria-label="Tabs"{...mergeProps(xdsClassName('tab-list', {size}),- stylex.props(styles.nav, hasDivider && styles.divider),+ stylex.props(styles.nav, hasDivider && styles.divider, xstyle),+ className,+ style,)}>{children}</nav>