An open source design system that's fully customizable and agent ready
TypeScript
feat(theme): add ComponentStyles overrides to all components (#234)
Cindy Zhang9746eaa76465
diff --git a/packages/core/src/AspectRatio/README.md b/packages/core/src/AspectRatio/README.mdindex 6f425c6363..bc9ea18b0d 100644--- a/packages/core/src/AspectRatio/README.md+++ b/packages/core/src/AspectRatio/README.md@@ -25,3 +25,25 @@ import {XDSAspectRatio} from '@xds/core/AspectRatio';<video src="video.mp4" /></XDSAspectRatio>```++## Theming++Themes can override `AspectRatio` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ aspectRatio: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | --------------------- |+| `root` | Root container styles |diff --git a/packages/core/src/AspectRatio/XDSAspectRatio.tsx b/packages/core/src/AspectRatio/XDSAspectRatio.tsxindex a70604740e..6a66277aa0 100644--- a/packages/core/src/AspectRatio/XDSAspectRatio.tsx+++ b/packages/core/src/AspectRatio/XDSAspectRatio.tsx@@ -10,10 +10,29 @@* - /apps/storybook/stories/AspectRatio.stories.tsx*/-import {forwardRef, type HTMLAttributes, type ReactNode} from 'react';+import {+ forwardRef,+ useContext,+ type HTMLAttributes,+ type ReactNode,+} from 'react';import * as stylex from '@stylexjs/stylex';import type {StyleXStyles} from '@stylexjs/stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ aspectRatio?: {+ /** Root container styles */+ root?: ThemeStyleXStyles;+ };+ }+}export interface XDSAspectRatioProps extends Omit<HTMLAttributes<HTMLElement>,'style' | 'className'@@ -65,10 +84,12 @@ const styles = stylex.create({*/export const XDSAspectRatio = forwardRef<HTMLElement, XDSAspectRatioProps>(function XDSAspectRatio({ratio, children, xstyle, ...props}, ref) {+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.aspectRatio?.root;return (<divref={ref as React.Ref<HTMLDivElement>}- {...stylex.props(styles.container, xstyle)}+ {...stylex.props(styles.container, xstyle, rootOverride)}style={{aspectRatio: ratio}}{...props}><div {...stylex.props(styles.child)}>{children}</div>diff --git a/packages/core/src/Avatar/README.md b/packages/core/src/Avatar/README.mdindex fd332814a9..f65d9a65c5 100644--- a/packages/core/src/Avatar/README.md+++ b/packages/core/src/Avatar/README.md@@ -52,6 +52,30 @@ import { XDSAvatar } from '@xds/core/Avatar';3. `fallbackSrc` fails/missing → show initials from `name`4. No `name` → show generic person icon+## Theming++Themes can override `Avatar` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ avatar: {+ root: myStyles,+ fallback: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ---------- | ---------------------------------- |+| `root` | Root wrapper styles |+| `fallback` | Fallback/initials container styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/Avatar/XDSAvatar.tsx b/packages/core/src/Avatar/XDSAvatar.tsxindex b4ea067c4a..7f31ae6f64 100644--- a/packages/core/src/Avatar/XDSAvatar.tsx+++ b/packages/core/src/Avatar/XDSAvatar.tsx@@ -11,13 +11,21 @@* - /apps/storybook/stories/Avatar.stories.tsx (storybook stories)*/-import {forwardRef, useState, type HTMLAttributes, type ReactNode} from 'react';+import {+ forwardRef,+ useContext,+ useState,+ type HTMLAttributes,+ type ReactNode,+} from 'react';import * as stylex from '@stylexjs/stylex';import {colorVars,typographyVars,fontWeightVars,} from '../theme/tokens.stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';/*** The offset ratio for positioning elements on a circle's edge at 45°.@@ -153,6 +161,19 @@ const dynamicStyles = stylex.create({}),});+// =============================================================================+// Module Augmentation - Register Avatar's style surfaces with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ avatar?: {+ root?: ThemeStyleXStyles;+ fallback?: ThemeStyleXStyles;+ };+ }+}+export interface XDSAvatarProps extends Omit<HTMLAttributes<HTMLDivElement>,'children'@@ -260,13 +281,18 @@ export const XDSAvatar = forwardRef<HTMLDivElement, XDSAvatarProps>(const accessibleName = alt || name || 'Avatar';const numericSize = resolveSize(size);+ // Get theme context for component-level overrides (optional)+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.avatar?.root;+ const fallbackOverride = themeContext?.theme.components?.avatar?.fallback;+return (<divref={ref}role="img"aria-label={accessibleName}data-testid={testId}- {...stylex.props(styles.wrapper)}+ {...stylex.props(styles.wrapper, rootOverride)}{...props}><div {...stylex.props(styles.content, dynamicStyles.size(numericSize))}>{showImage && (@@ -290,12 +316,13 @@ export const XDSAvatar = forwardRef<HTMLDivElement, XDSAvatarProps>({...stylex.props(styles.fallback,dynamicStyles.fontSize(numericSize),+ fallbackOverride,)}>{getInitials(name)}</div>)}{showIcon && (- <div {...stylex.props(styles.fallback)}>+ <div {...stylex.props(styles.fallback, fallbackOverride)}><DefaultIcon size={numericSize} /></div>)}diff --git a/packages/core/src/Badge/README.md b/packages/core/src/Badge/README.mdindex ed36b931ec..eedb4d9f4a 100644--- a/packages/core/src/Badge/README.md+++ b/packages/core/src/Badge/README.md@@ -38,6 +38,30 @@ import {XDSBadge} from '@xds/core/Badge';<XDSBadge variant="success" />```+## Theming++Themes can override `Badge` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ badge: {+ root: myStyles,+ variants: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ---------- | ---------------------------------------------------------------------- |+| `root` | Root badge styles |+| `variants` | Per-variant overrides (Partial<Record<XDSBadgeVariant, StyleXStyles>>) |+## Files| File | Purpose |diff --git a/packages/core/src/Badge/XDSBadge.tsx b/packages/core/src/Badge/XDSBadge.tsxindex b071244d03..41aed50a77 100644--- a/packages/core/src/Badge/XDSBadge.tsx+++ b/packages/core/src/Badge/XDSBadge.tsx@@ -11,7 +11,12 @@* - /apps/storybook/stories/Badge.stories.tsx (storybook stories)*/-import {forwardRef, type HTMLAttributes, type ReactNode} from 'react';+import {+ forwardRef,+ useContext,+ type HTMLAttributes,+ type ReactNode,+} from 'react';import * as stylex from '@stylexjs/stylex';import {colorVars,@@ -21,6 +26,8 @@ import {fontWeightVars,lineHeightVars,} from '../theme/tokens.stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';/*** Base badge styles@@ -78,6 +85,19 @@ const variants = stylex.create({*/export type XDSBadgeVariant = keyof typeof variants;+// =============================================================================+// Module Augmentation - Register Badge's style surfaces with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ badge?: {+ root?: ThemeStyleXStyles;+ variants?: Partial<Record<XDSBadgeVariant, ThemeStyleXStyles>>;+ };+ }+}+export interface XDSBadgeProps extends Omit<HTMLAttributes<HTMLSpanElement>,'className' | 'style'@@ -116,10 +136,22 @@ export const XDSBadge = forwardRef<HTMLSpanElement, XDSBadgeProps>(({variant = 'neutral', children, icon, ...props}, ref) => {const isDot = children == null && icon == null;+ // Get theme context for component-level overrides (optional)+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.badge?.root;+ const variantOverride =+ themeContext?.theme.components?.badge?.variants?.[variant];+return (<spanref={ref}- {...stylex.props(styles.base, variants[variant], isDot && styles.dot)}+ {...stylex.props(+ styles.base,+ variants[variant],+ rootOverride,+ variantOverride,+ isDot && styles.dot,+ )}{...props}>{icon}{children}diff --git a/packages/core/src/Calendar/README.md b/packages/core/src/Calendar/README.mdindex 05600032ef..7df7ce42fc 100644--- a/packages/core/src/Calendar/README.md+++ b/packages/core/src/Calendar/README.md@@ -71,6 +71,28 @@ interface DateRange {}```+## Theming++Themes can override `Calendar` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ calendar: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | --------------------- |+| `root` | Root container styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/Calendar/XDSCalendar.tsx b/packages/core/src/Calendar/XDSCalendar.tsxindex 7c9c7df4ec..55eee5bb41 100644--- a/packages/core/src/Calendar/XDSCalendar.tsx+++ b/packages/core/src/Calendar/XDSCalendar.tsx@@ -13,6 +13,7 @@import {forwardRef,+ useContext,useState,useMemo,useCallback,@@ -44,6 +45,8 @@ import {getWeekNumber,formatAccessibleDate,} from './utils';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';// =============================================================================// Types@@ -156,6 +159,18 @@ interface XDSCalendarRangeProps extends XDSCalendarBaseProps {onChange?: (value: DateRange) => void;}+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ calendar?: {+ /** Root container styles */+ root?: ThemeStyleXStyles;+ };+ }+}export type XDSCalendarProps = XDSCalendarSingleProps | XDSCalendarRangeProps;// =============================================================================@@ -188,6 +203,10 @@ export const XDSCalendar = forwardRef<XDSCalendarHandle, XDSCalendarProps>(...rest} = props;+ // Get theme context for component-level overrides+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.calendar?.root;+// Today's date (memoized)const today = useMemo(() => new Date(), []);@@ -337,7 +356,7 @@ export const XDSCalendar = forwardRef<XDSCalendarHandle, XDSCalendarProps>();return (- <div {...stylex.props(calendarStyles.calendar)} {...rest}>+ <div {...stylex.props(calendarStyles.calendar, rootOverride)} {...rest}>{/* Header with navigation */}<div {...stylex.props(calendarStyles.header)}><XDSButtondiff --git a/packages/core/src/Center/README.md b/packages/core/src/Center/README.mdindex e0696d9382..1309dd0fbe 100644--- a/packages/core/src/Center/README.md+++ b/packages/core/src/Center/README.md@@ -26,3 +26,25 @@ import {XDSCenter} from '@xds/core/Center';<XDSIcon icon={StarIcon} /></XDSCenter>```++## Theming++Themes can override `Center` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ center: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | --------------------- |+| `root` | Root container styles |diff --git a/packages/core/src/Center/XDSCenter.tsx b/packages/core/src/Center/XDSCenter.tsxindex 12b2516da6..dede797f28 100644--- a/packages/core/src/Center/XDSCenter.tsx+++ b/packages/core/src/Center/XDSCenter.tsx@@ -10,10 +10,17 @@* - /apps/storybook/stories/Center.stories.tsx*/-import {forwardRef, type HTMLAttributes, type ReactNode} from 'react';+import {+ forwardRef,+ useContext,+ type HTMLAttributes,+ type ReactNode,+} from 'react';import * as stylex from '@stylexjs/stylex';import type {StyleXStyles} from '@stylexjs/stylex';import type {SizeValue} from '../utils/types';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';const styles = stylex.create({base: {@@ -40,6 +47,18 @@ const dynamicStyles = stylex.create({export type CenterAxis = 'both' | 'horizontal' | 'vertical';+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ center?: {+ /** Root container styles */+ root?: ThemeStyleXStyles;+ };+ }+}export interface XDSCenterProps extends Omit<HTMLAttributes<HTMLDivElement>,'style' | 'className'@@ -108,12 +127,16 @@ export const XDSCenter = forwardRef<HTMLDivElement, XDSCenterProps>(},ref,) {+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.center?.root;+const stylexProps = stylex.props(isInline ? styles.inline : styles.base,(axis === 'both' || axis === 'vertical') && styles.alignItemsCenter,(axis === 'both' || axis === 'horizontal') && styles.justifyContentCenter,dynamicStyles.sizing(width ?? null, height ?? null),xstyle,+ rootOverride,);return (diff --git a/packages/core/src/CheckboxInput/README.md b/packages/core/src/CheckboxInput/README.mdindex 2148b97dcb..9a796d5622 100644--- a/packages/core/src/CheckboxInput/README.md+++ b/packages/core/src/CheckboxInput/README.md@@ -68,6 +68,30 @@ import { XDSCheckboxInput } from '@xds/core/CheckboxInput';| `onChange` | `(checked: boolean, e: ChangeEvent) => void` | — | Callback fired when the checkbox state changes || `isDisabled` | `boolean` | `false` | Whether the checkbox is disabled |+## Theming++Themes can override `CheckboxInput` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ checkboxInput: {+ root: myStyles,+ checkbox: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ---------- | ------------------------------ |+| `root` | Root container styles |+| `checkbox` | Visual checkbox element styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx b/packages/core/src/CheckboxInput/XDSCheckboxInput.tsxindex b43cd96fb9..7ccf76f766 100644--- a/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx+++ b/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx@@ -11,7 +11,13 @@* - /apps/storybook/stories/CheckboxInput.stories.tsx (storybook stories)*/-import {forwardRef, useId, type ChangeEvent, type FocusEvent} from 'react';+import {+ forwardRef,+ useContext,+ useId,+ type ChangeEvent,+ type FocusEvent,+} from 'react';import * as stylex from '@stylexjs/stylex';import {colorVars,@@ -25,6 +31,8 @@ import {XDSFieldLabel} from '../Field/XDSFieldLabel';import {XDSFieldStatus} from '../Field/XDSFieldStatus';import type {XDSIconType} from '../Icon';import type {XDSInputStatus} from '../Field/types';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';const styles = stylex.create({container: {@@ -181,6 +189,20 @@ const labelWrapperSizeStyles = stylex.create({export type XDSCheckboxInputSize = keyof typeof wrapperSizeStyles;+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ checkboxInput?: {+ /** Root container styles */+ root?: ThemeStyleXStyles;+ /** Visual checkbox styles */+ checkbox?: ThemeStyleXStyles;+ };+ }+}export interface XDSCheckboxInputProps {/*** Label text for the checkbox (always rendered for accessibility).@@ -278,6 +300,11 @@ export const XDSCheckboxInput = forwardRef<},ref,) => {+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.checkboxInput?.root;+ const checkboxOverride =+ themeContext?.theme.components?.checkboxInput?.checkbox;+const id = useId();const descriptionID = useId();const statusMessageID = useId();@@ -299,6 +326,7 @@ export const XDSCheckboxInput = forwardRef<{...stylex.props(styles.container,isLabelHidden && styles.containerLabelHidden,+ rootOverride,!isDisabled && stylex.defaultMarker(),)}><div@@ -326,6 +354,7 @@ export const XDSCheckboxInput = forwardRef<{...stylex.props(styles.checkbox,checkboxSizeStyles[size],+ checkboxOverride,isCheckedOrIndeterminate? styles.checkboxChecked: styles.checkboxUnchecked,diff --git a/packages/core/src/DateInput/README.md b/packages/core/src/DateInput/README.mdindex 17b0686b8e..535409d3c1 100644--- a/packages/core/src/DateInput/README.md+++ b/packages/core/src/DateInput/README.md@@ -100,6 +100,30 @@ The text input accepts various date formats:Invalid input reverts to the previous valid value on blur.+## Theming++Themes can override `DateInput` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ dateInput: {+ wrapper: myStyles,+ input: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| --------- | ------------------------- |+| `wrapper` | Input wrapper styles |+| `input` | Text input element styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/DateInput/XDSDateInput.tsx b/packages/core/src/DateInput/XDSDateInput.tsxindex 7773761664..795dc720b7 100644--- a/packages/core/src/DateInput/XDSDateInput.tsx+++ b/packages/core/src/DateInput/XDSDateInput.tsx@@ -11,7 +11,15 @@* - /apps/storybook/stories/DateInput.stories.tsx (storybook stories)*/-import {forwardRef, useId, useState, useCallback, useRef, useMemo} from 'react';+import {+ forwardRef,+ useContext,+ useId,+ useState,+ useCallback,+ useRef,+ useMemo,+} from 'react';import * as stylex from '@stylexjs/stylex';import {CalendarDaysIcon} from '@heroicons/react/24/outline';import {@@ -154,7 +162,23 @@ export type {XDSInputStatus as XDSDateInputStatus,XDSInputStatusType as XDSDateInputStatusType,} from '../Field';-+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';++// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ dateInput?: {+ /** Input wrapper styles */+ wrapper?: ThemeStyleXStyles;+ /** Text input styles */+ input?: ThemeStyleXStyles;+ };+ }+}export interface XDSDateInputProps {/*** Label text for the input (required for accessibility).@@ -277,6 +301,10 @@ export const XDSDateInput = forwardRef<HTMLInputElement, XDSDateInputProps>(},ref,) => {+ const themeContext = useContext(ThemeContext);+ const wrapperOverride = themeContext?.theme.components?.dateInput?.wrapper;+ const inputOverride = themeContext?.theme.components?.dateInput?.input;+const id = useId();const descriptionID = useId();const statusMessageID = useId();@@ -454,6 +482,7 @@ export const XDSDateInput = forwardRef<HTMLInputElement, XDSDateInputProps>(sizeStyles[size],isDisabled && styles.wrapperDisabled,status && statusBorderStyles[status.type],+ wrapperOverride,)}><buttontype="button"@@ -485,6 +514,7 @@ export const XDSDateInput = forwardRef<HTMLInputElement, XDSDateInputProps>(styles.input,isDisabled && styles.inputDisabled,!isInputValid && styles.inputInvalid,+ inputOverride,)}/>{status && (diff --git a/packages/core/src/Dialog/README.md b/packages/core/src/Dialog/README.mdindex b5a289eb5d..00f05962bb 100644--- a/packages/core/src/Dialog/README.md+++ b/packages/core/src/Dialog/README.md@@ -99,6 +99,30 @@ Configure a static position instead of centering:</XDSDialog>```+## Theming++Themes can override `Dialog` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ dialog: {+ root: myStyles,+ backdrop: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ---------- | ----------------------- |+| `root` | Dialog element styles |+| `backdrop` | Backdrop overlay styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/Dialog/XDSDialog.tsx b/packages/core/src/Dialog/XDSDialog.tsxindex 06c0dcfc9f..83066755a5 100644--- a/packages/core/src/Dialog/XDSDialog.tsx+++ b/packages/core/src/Dialog/XDSDialog.tsx@@ -13,6 +13,7 @@import {forwardRef,+ useContext,useEffect,useRef,type DialogHTMLAttributes,@@ -25,6 +26,8 @@ import {transitionVars,elevationVars,} from '../theme/tokens.stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';/*** Dialog variant type@@ -133,6 +136,18 @@ function formatPosition(value: number | string | undefined): string | null {return typeof value === 'number' ? `${value}px` : value;}+// =============================================================================+// Module Augmentation - Register Dialog's style surfaces with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ dialog?: {+ root?: ThemeStyleXStyles;+ };+ }+}+export interface XDSDialogProps extends Omit<DialogHTMLAttributes<HTMLDialogElement>,'children'@@ -313,6 +328,10 @@ export const XDSDialog = forwardRef<HTMLDialogElement, XDSDialogProps>(const isFullscreen = variant === 'fullscreen';const hasPosition = position != null && !isFullscreen;+ // Get theme context for component-level overrides (optional)+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.dialog?.root;+return (<dialogref={setRefs}@@ -331,6 +350,7 @@ export const XDSDialog = forwardRef<HTMLDialogElement, XDSDialogProps>(position?.left,),isFullscreen && styles.fullscreen,+ rootOverride,)}{...props}>{children}diff --git a/packages/core/src/Divider/README.md b/packages/core/src/Divider/README.mdindex cc144cac8e..098f36b42c 100644--- a/packages/core/src/Divider/README.md+++ b/packages/core/src/Divider/README.md@@ -26,3 +26,29 @@ import {XDSDivider} from '@xds/core/Divider';// Full bleed (extends to container edges)<XDSDivider isFullBleed />```++## Theming++Themes can override `Divider` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ divider: {+ root: myStyles,+ line: myStyles,+ label: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | --------------------- |+| `root` | Root container styles |+| `line` | Divider line styles |+| `label` | Label text styles |diff --git a/packages/core/src/Divider/XDSDivider.tsx b/packages/core/src/Divider/XDSDivider.tsxindex b0780bf988..7ab8ddc980 100644--- a/packages/core/src/Divider/XDSDivider.tsx+++ b/packages/core/src/Divider/XDSDivider.tsx@@ -10,7 +10,12 @@* - /apps/storybook/stories/Divider.stories.tsx*/-import {forwardRef, type HTMLAttributes, type ReactNode} from 'react';+import {+ forwardRef,+ useContext,+ type HTMLAttributes,+ type ReactNode,+} from 'react';import * as stylex from '@stylexjs/stylex';import type {StyleXStyles} from '@stylexjs/stylex';import {@@ -19,6 +24,22 @@ import {textSizeVars,lineHeightVars,} from '../theme/tokens.stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';++// =============================================================================+// Module Augmentation - Register Divider's style surfaces with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ divider?: {+ root?: ThemeStyleXStyles;+ line?: ThemeStyleXStyles;+ label?: ThemeStyleXStyles;+ };+ }+}export interface XDSDividerProps extends Omit<HTMLAttributes<HTMLElement>,@@ -140,6 +161,12 @@ export const XDSDivider = forwardRef<HTMLElement, XDSDividerProps>() {const isHorizontal = orientation === 'horizontal';+ // Get theme context for component-level overrides (optional)+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.divider?.root;+ const lineOverride = themeContext?.theme.components?.divider?.line;+ const labelOverride = themeContext?.theme.components?.divider?.label;+return (<divref={ref as React.Ref<HTMLDivElement>}@@ -151,6 +178,7 @@ export const XDSDivider = forwardRef<HTMLElement, XDSDividerProps>((isHorizontal? fullBleedStyles.horizontal: fullBleedStyles.vertical),+ rootOverride,xstyle,)}{...props}>@@ -158,6 +186,7 @@ export const XDSDivider = forwardRef<HTMLElement, XDSDividerProps>({...stylex.props(isHorizontal ? lineStyles.horizontalLine : lineStyles.verticalLine,lineStyles[variant],+ lineOverride,)}/>{label && (@@ -165,6 +194,7 @@ export const XDSDivider = forwardRef<HTMLElement, XDSDividerProps>({...stylex.props(labelStyles.label,!isHorizontal && labelStyles.verticalLabel,+ labelOverride,)}>{label}</div>@@ -176,6 +206,7 @@ export const XDSDivider = forwardRef<HTMLElement, XDSDividerProps>(? lineStyles.horizontalLine: lineStyles.verticalLine,lineStyles[variant],+ lineOverride,)}/>)}diff --git a/packages/core/src/DropdownMenu/README.md b/packages/core/src/DropdownMenu/README.mdindex a992a9e2f2..5fb96f8897 100644--- a/packages/core/src/DropdownMenu/README.md+++ b/packages/core/src/DropdownMenu/README.md@@ -144,6 +144,30 @@ Helper component for custom item rendering with consistent styling.| `title` | `string` | — | Optional section header || `items` | `XDSDropdownMenuItemData[]` | — | Items in the section |+## Theming++Themes can override `DropdownMenu` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ dropdownMenu: {+ root: myStyles,+ item: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | ------------------------- |+| `root` | Dropdown container styles |+| `item` | Menu item styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/DropdownMenu/XDSDropdownMenu.tsx b/packages/core/src/DropdownMenu/XDSDropdownMenu.tsxindex bb5da2176c..b4f1a04ac1 100644--- a/packages/core/src/DropdownMenu/XDSDropdownMenu.tsx+++ b/packages/core/src/DropdownMenu/XDSDropdownMenu.tsx@@ -12,6 +12,7 @@*/import React, {+ useContext,useCallback,useId,useMemo,@@ -35,6 +36,8 @@ import {typographyVars,textSizeVars,} from '../theme/tokens.stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';const styles = stylex.create({// Dropdown container@@ -104,6 +107,19 @@ const styles = stylex.create({},});+// =============================================================================+// Module Augmentation - Register DropdownMenu's style surfaces with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ dropdownMenu?: {+ root?: ThemeStyleXStyles;+ item?: ThemeStyleXStyles;+ };+ }+}+// =============================================================================// Types// =============================================================================@@ -303,6 +319,11 @@ export function XDSDropdownMenu({'data-testid': testId,}: XDSDropdownMenuProps) {const menuId = useId();++ // Get theme context for component-level overrides (optional)+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.dropdownMenu?.root;+ const itemOverride = themeContext?.theme.components?.dropdownMenu?.item;const buttonRef = useRef<HTMLButtonElement>(null);// Internal state for uncontrolled mode@@ -491,6 +512,7 @@ export function XDSDropdownMenu({styles.item,isHighlighted && styles.itemHighlighted,item.isDisabled && styles.itemDisabled,+ itemOverride,)}>{children ? children(item) : <DefaultItem item={item} />}</div>@@ -584,7 +606,10 @@ export function XDSDropdownMenu({</XDSButton>{layer.render(- <div id={menuId} role="menu" {...stylex.props(styles.dropdown)}>+ <div+ id={menuId}+ role="menu"+ {...stylex.props(styles.dropdown, rootOverride)}>{renderOptions()}</div>,{diff --git a/packages/core/src/Field/README.md b/packages/core/src/Field/README.mdindex f2a9f7a8b2..9c0dd7e916 100644--- a/packages/core/src/Field/README.md+++ b/packages/core/src/Field/README.md@@ -82,6 +82,30 @@ const bioDescId = useId();| `labelTooltip` | `string` | No | Tooltip text to display in an info icon at the end of the label || `children` | `ReactNode` | Yes | The input or control to render |+## Theming++Themes can override `Field` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ field: {+ root: myStyles,+ description: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------------- | ----------------------- |+| `root` | Root container styles |+| `description` | Description text styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/Field/XDSField.tsx b/packages/core/src/Field/XDSField.tsxindex 5c9c2aab65..a566c2195e 100644--- a/packages/core/src/Field/XDSField.tsx+++ b/packages/core/src/Field/XDSField.tsx@@ -11,7 +11,12 @@* - /apps/storybook/stories/Field.stories.tsx (storybook stories)*/-import {forwardRef, type HTMLAttributes, type ReactNode} from 'react';+import {+ forwardRef,+ useContext,+ type HTMLAttributes,+ type ReactNode,+} from 'react';import * as stylex from '@stylexjs/stylex';import {XDSFieldLabel} from './XDSFieldLabel';import {XDSFieldStatus} from './XDSFieldStatus';@@ -23,6 +28,8 @@ import {typographyVars,} from '../theme/tokens.stylex';import type {XDSIconType} from '../Icon';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';const styles = stylex.create({container: {@@ -90,6 +97,20 @@ export interface XDSFieldStatus {messageID?: string;}+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ field?: {+ /** Root container styles */+ root?: ThemeStyleXStyles;+ /** Description text styles */+ description?: ThemeStyleXStyles;+ };+ }+}export interface XDSFieldProps extends Omit<HTMLAttributes<HTMLDivElement>,'children'@@ -182,8 +203,16 @@ export const XDSField = forwardRef<HTMLDivElement, XDSFieldProps>(},ref,) => {+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.field?.root;+ const descriptionOverride =+ themeContext?.theme.components?.field?.description;+return (- <div ref={ref} {...stylex.props(styles.container)} {...props}>+ <div+ ref={ref}+ {...stylex.props(styles.container, rootOverride)}+ {...props}><XDSFieldLabellabel={label}inputID={inputID}@@ -194,7 +223,9 @@ export const XDSField = forwardRef<HTMLDivElement, XDSFieldProps>(tooltip={labelTooltip}/>{description && (- <span id={descriptionID} {...stylex.props(styles.description)}>+ <span+ id={descriptionID}+ {...stylex.props(styles.description, descriptionOverride)}>{description}</span>)}diff --git a/packages/core/src/Grid/README.md b/packages/core/src/Grid/README.mdindex 4bf0ad741b..392075b37d 100644--- a/packages/core/src/Grid/README.md+++ b/packages/core/src/Grid/README.md@@ -46,3 +46,25 @@ import {XDSGrid, XDSGridSpan} from '@xds/core/Grid';Use `XDSGrid` for any grid layout instead of manual CSS grid (`display: 'grid'`,`gridTemplateColumns`). It handles gap tokens and works with any column count.++## Theming++Themes can override `Grid` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ grid: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | -------------------------- |+| `root` | Root grid container styles |diff --git a/packages/core/src/Grid/XDSGrid.tsx b/packages/core/src/Grid/XDSGrid.tsxindex 086fbe5259..8b4cb33bf5 100644--- a/packages/core/src/Grid/XDSGrid.tsx+++ b/packages/core/src/Grid/XDSGrid.tsx@@ -10,18 +10,37 @@* - /apps/storybook/stories/Grid.stories.tsx*/-import {forwardRef, type HTMLAttributes, type ReactNode} from 'react';+import {+ forwardRef,+ useContext,+ type HTMLAttributes,+ type ReactNode,+} from 'react';import * as stylex from '@stylexjs/stylex';import type {StyleXStyles} from '@stylexjs/stylex';import {spacingVars} from '../theme/tokens.stylex';import type {SpacingScale} from '../Layout';import type {SizeValue} from '../utils/types';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';/*** Grid alignment options for align-items and justify-items.*/export type GridAlignment = 'start' | 'center' | 'end' | 'stretch';+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ grid?: {+ /** Root container styles */+ root?: ThemeStyleXStyles;+ };+ }+}export interface XDSGridProps extends Omit<HTMLAttributes<HTMLElement>,'style' | 'className'@@ -338,6 +357,9 @@ export const XDSGrid = forwardRef<HTMLElement, XDSGridProps>(function XDSGrid(},ref,) {+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.grid?.root;+// Determine grid-template-columns valuelet gridTemplateColumns: string;let calculatedMaxWidth: number | undefined;@@ -386,6 +408,7 @@ export const XDSGrid = forwardRef<HTMLElement, XDSGridProps>(function XDSGrid(align != null && alignStyles[align],justify != null && justifyStyles[justify],xstyle,+ rootOverride,)}style={inlineStyle}{...props}>diff --git a/packages/core/src/Icon/README.md b/packages/core/src/Icon/README.mdindex 4486083b57..1fefe02ddf 100644--- a/packages/core/src/Icon/README.md+++ b/packages/core/src/Icon/README.md@@ -82,6 +82,28 @@ import {HomeIcon} from '@heroicons/react/24/solid';Browse available icons at [heroicons.com](https://heroicons.com).+## Theming++Themes can override `Icon` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ icon: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | ----------------------- |+| `root` | Root SVG element styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/Icon/XDSIcon.tsx b/packages/core/src/Icon/XDSIcon.tsxindex 550b17a2ad..4a6889d615 100644--- a/packages/core/src/Icon/XDSIcon.tsx+++ b/packages/core/src/Icon/XDSIcon.tsx@@ -11,9 +11,11 @@* - /apps/storybook/stories/Icon.stories.tsx (storybook stories)*/-import {forwardRef, type ComponentType, type SVGProps} from 'react';+import {forwardRef, useContext, type ComponentType, type SVGProps} from 'react';import * as stylex from '@stylexjs/stylex';import {colorVars} from '../theme/tokens.stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';// =============================================================================// Styles@@ -87,6 +89,18 @@ export type XDSIconSize = keyof typeof sizeStyles;*/export type XDSIconType = ComponentType<SVGProps<SVGSVGElement>>;+// =============================================================================+// Module Augmentation - Register Icon's style surfaces with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ icon?: {+ root?: ThemeStyleXStyles;+ };+ }+}+/*** Props for XDSIcon component.* Extends SVGProps to allow passing additional SVG attributes.@@ -122,11 +136,20 @@ export interface XDSIconProps extends Omit<export const XDSIcon = forwardRef<SVGSVGElement, XDSIconProps>(({icon: IconComponent, color = 'primary', size = 'md', ...props}, ref) => {+ // Get theme context for component-level overrides (optional)+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.icon?.root;+return (<IconComponentref={ref}aria-hidden="true"- {...stylex.props(styles.root, colorStyles[color], sizeStyles[size])}+ {...stylex.props(+ styles.root,+ colorStyles[color],+ sizeStyles[size],+ rootOverride,+ )}{...props}/>);diff --git a/packages/core/src/Link/README.md b/packages/core/src/Link/README.mdindex cd02c4aff5..9daac5f99f 100644--- a/packages/core/src/Link/README.md+++ b/packages/core/src/Link/README.md@@ -63,6 +63,28 @@ import { XDSLink } from '@xds/core/Link';| `isStandalone` | `boolean` | `false` | Applies base font sizing || `children` | `ReactNode` | — | Link content (required) |+## Theming++Themes can override `Link` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ link: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | -------------------------- |+| `root` | Root anchor element styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/Link/XDSLink.tsx b/packages/core/src/Link/XDSLink.tsxindex b6e0f69c8d..a9726753b8 100644--- a/packages/core/src/Link/XDSLink.tsx+++ b/packages/core/src/Link/XDSLink.tsx@@ -13,12 +13,14 @@import {forwardRef,+ useContext,type AnchorHTMLAttributes,type MouseEventHandler,type ReactNode,} from 'react';import * as stylex from '@stylexjs/stylex';import {ArrowTopRightOnSquareIcon} from '@heroicons/react/16/solid';+import {colorVars,transitionVars,@@ -26,6 +28,8 @@ import {lineHeightVars,spacingVars,} from '../theme/tokens.stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';import {XDSIcon} from '../Icon';import {XDSTooltip} from '../Layer';import {XDSText} from '../Text';@@ -79,6 +83,18 @@ const styles = stylex.create({},});+// =============================================================================+// Module Augmentation - Register Link's style surfaces with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ link?: {+ root?: ThemeStyleXStyles;+ };+ }+}+export interface XDSLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>,'children'@@ -215,6 +231,10 @@ export const XDSLink = forwardRef<HTMLAnchorElement, XDSLinkProps>(: 'noopener noreferrer': rel;+ // Get theme context for component-level overrides (optional)+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.link?.root;+const linkElement = (<aref={ref}@@ -230,6 +250,7 @@ export const XDSLink = forwardRef<HTMLAnchorElement, XDSLinkProps>(hasUnderline && styles.hasUnderline,isStandalone && styles.standalone,isDisabled && styles.disabled,+ rootOverride,)}{...props}><XDSTextdiff --git a/packages/core/src/NumberInput/README.md b/packages/core/src/NumberInput/README.mdindex 78f56a32ac..de9b39c3da 100644--- a/packages/core/src/NumberInput/README.md+++ b/packages/core/src/NumberInput/README.md@@ -103,6 +103,30 @@ import { XDSNumberInput } from '@xds/core/NumberInput';| `onBlur` | `(e: FocusEvent<HTMLInputElement>) => void` | No | Callback fired when the input loses focus || `onEnter` | `() => void` | No | Callback fired when the user presses the Enter key |+## Theming++Themes can override `NumberInput` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ numberInput: {+ wrapper: myStyles,+ input: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| --------- | --------------------------- |+| `wrapper` | Input wrapper styles |+| `input` | Number input element styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/NumberInput/XDSNumberInput.tsx b/packages/core/src/NumberInput/XDSNumberInput.tsxindex 70cb799779..9742719eb2 100644--- a/packages/core/src/NumberInput/XDSNumberInput.tsx+++ b/packages/core/src/NumberInput/XDSNumberInput.tsx@@ -13,6 +13,7 @@import {forwardRef,+ useContext,useId,useState,useMemo,@@ -137,7 +138,23 @@ export type {XDSInputStatus as XDSNumberInputStatus,XDSInputStatusType as XDSNumberInputStatusType,} from '../Field';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ numberInput?: {+ /** Input wrapper styles */+ wrapper?: ThemeStyleXStyles;+ /** Text input styles */+ input?: ThemeStyleXStyles;+ };+ }+}export interface XDSNumberInputProps {/*** Label text for the input (always rendered for accessibility).@@ -339,6 +356,11 @@ export const XDSNumberInput = forwardRef<HTMLInputElement, XDSNumberInputProps>(},ref,) => {+ const themeContext = useContext(ThemeContext);+ const wrapperOverride =+ themeContext?.theme.components?.numberInput?.wrapper;+ const inputOverride = themeContext?.theme.components?.numberInput?.input;+const id = useId();const descriptionID = useId();const statusMessageID = useId();@@ -494,6 +516,7 @@ export const XDSNumberInput = forwardRef<HTMLInputElement, XDSNumberInputProps>(sizeStyles[size],isDisabled && styles.wrapperDisabled,status && statusBorderStyles[status.type],+ wrapperOverride,)}>{startIcon && <XDSIcon icon={startIcon} size="sm" color="primary" />}<input@@ -520,6 +543,7 @@ export const XDSNumberInput = forwardRef<HTMLInputElement, XDSNumberInputProps>(styles.input,isDisabled && styles.inputDisabled,!isInputValid && styles.inputInvalid,+ inputOverride,)}/>{units && <span {...stylex.props(styles.units)}>{units}</span>}diff --git a/packages/core/src/RadioList/README.md b/packages/core/src/RadioList/README.mdindex 5e3faebe77..4beeab9906 100644--- a/packages/core/src/RadioList/README.md+++ b/packages/core/src/RadioList/README.md@@ -86,23 +86,23 @@ import { XDSRadioList, XDSRadioListItem } from '@xds/core/RadioList';## XDSRadioList Props-| Prop | Type | Default | Description |-| --------------- | --------------------------------- | ------------ | ------------------------------------------------------------------- |-| `label` | `string` | — | Label text for the radio group (always rendered for accessibility) |-| `isLabelHidden` | `boolean` | `false` | Whether to visually hide the label |-| `description` | `string` | — | Description text displayed below the label |-| `value` | `string` | — | The currently selected value |-| `onChange` | `(value: string) => void` | — | Callback fired when the selected value changes |-| `orientation` | `'vertical' \| 'horizontal'` | `'vertical'` | Layout direction of the radio items |-| `isDisabled` | `boolean` | `false` | Whether all radio items are disabled |-| `isRequired` | `boolean` | `false` | Whether the radio group is required |-| `isOptional` | `boolean` | `false` | Whether the field is optional (mutually exclusive with `isRequired`) |-| `status` | `XDSInputStatus` | — | Status indicator (`{ type, message }`) |-| `size` | `'sm' \| 'md'` | `'md'` | Size of the radio controls |-| `labelTooltip` | `string` | — | Tooltip text for an info icon next to the label |-| `xstyle` | `StyleXStyles` | — | Additional styles for the outer container |-| `data-testid` | `string` | — | Test ID for the outer container |-| `children` | `ReactNode` | — | `XDSRadioListItem` elements |+| Prop | Type | Default | Description |+| --------------- | ---------------------------- | ------------ | -------------------------------------------------------------------- |+| `label` | `string` | — | Label text for the radio group (always rendered for accessibility) |+| `isLabelHidden` | `boolean` | `false` | Whether to visually hide the label |+| `description` | `string` | — | Description text displayed below the label |+| `value` | `string` | — | The currently selected value |+| `onChange` | `(value: string) => void` | — | Callback fired when the selected value changes |+| `orientation` | `'vertical' \| 'horizontal'` | `'vertical'` | Layout direction of the radio items |+| `isDisabled` | `boolean` | `false` | Whether all radio items are disabled |+| `isRequired` | `boolean` | `false` | Whether the radio group is required |+| `isOptional` | `boolean` | `false` | Whether the field is optional (mutually exclusive with `isRequired`) |+| `status` | `XDSInputStatus` | — | Status indicator (`{ type, message }`) |+| `size` | `'sm' \| 'md'` | `'md'` | Size of the radio controls |+| `labelTooltip` | `string` | — | Tooltip text for an info icon next to the label |+| `xstyle` | `StyleXStyles` | — | Additional styles for the outer container |+| `data-testid` | `string` | — | Test ID for the outer container |+| `children` | `ReactNode` | — | `XDSRadioListItem` elements |## XDSRadioListItem Props@@ -116,14 +116,36 @@ import { XDSRadioList, XDSRadioListItem } from '@xds/core/RadioList';| `endContent` | `ReactNode` | — | Content to render after the label || `data-testid` | `string` | — | Test ID for the radio item container |+## Theming++Themes can override `RadioList` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ radioList: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | ----------------------- |+| `root` | Root radio group styles |+## Files-| File | Role | Purpose |-| ------------------------- | ----- | -------------------------------------------------- |-| `index.ts` | Entry | Exports components and types |-| `XDSRadioList.tsx` | Core | Radio group container with context provider |-| `XDSRadioListItem.tsx` | Core | Individual radio item consuming `RadioListContext` |-| `XDSRadioList.test.tsx` | Test | Unit tests |+| File | Role | Purpose |+| ----------------------- | ----- | -------------------------------------------------- |+| `index.ts` | Entry | Exports components and types |+| `XDSRadioList.tsx` | Core | Radio group container with context provider |+| `XDSRadioListItem.tsx` | Core | Individual radio item consuming `RadioListContext` |+| `XDSRadioList.test.tsx` | Test | Unit tests |## Implementation Notesdiff --git a/packages/core/src/RadioList/XDSRadioList.tsx b/packages/core/src/RadioList/XDSRadioList.tsxindex 43c8a4f46f..ad6ed48669 100644--- a/packages/core/src/RadioList/XDSRadioList.tsx+++ b/packages/core/src/RadioList/XDSRadioList.tsx@@ -11,9 +11,11 @@* - /apps/storybook/stories/RadioList.stories.tsx*/-import {createContext, useId, type ReactNode} from 'react';+import {createContext, useContext, useId, type ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';import type {StyleXStyles} from '@stylexjs/stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';import {spacingVars} from '../theme/tokens.stylex';import {XDSField} from '../Field/XDSField';import type {XDSInputStatus} from '../Field/types';@@ -37,6 +39,18 @@ export const RadioListContext = createContext<RadioListContextValue | null>(null,);+// =============================================================================+// Module Augmentation - Register RadioList's themeable properties+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ radioList?: {+ root?: ThemeStyleXStyles;+ };+ }+}+const styles = stylex.create({radiogroup: {display: 'flex',@@ -155,6 +169,10 @@ export function XDSRadioList({'data-testid': dataTestId,children,}: XDSRadioListProps) {+ // Get theme context for component-level overrides (optional)+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.radioList?.root;+const name = useId();const inputID = useId();const descriptionID = useId();@@ -208,6 +226,7 @@ export function XDSRadioList({{...stylex.props(styles.radiogroup,orientation === 'vertical' ? styles.vertical : styles.horizontal,+ rootOverride,)}><RadioListContext.Provider value={contextValue}>{children}diff --git a/packages/core/src/Selector/README.md b/packages/core/src/Selector/README.mdindex d778632513..d1ddce5a5b 100644--- a/packages/core/src/Selector/README.md+++ b/packages/core/src/Selector/README.md@@ -113,3 +113,27 @@ Helper for custom item rendering:## AccessibilityUses `role="combobox"` trigger, `role="listbox"` dropdown, `role="group"` for sections, `aria-activedescendant` for focus.++## Theming++Themes can override `Selector` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ selector: {+ trigger: myStyles,+ dropdown: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ---------- | ------------------------- |+| `trigger` | Trigger button styles |+| `dropdown` | Dropdown container styles |diff --git a/packages/core/src/Selector/XDSSelector.tsx b/packages/core/src/Selector/XDSSelector.tsxindex 062c462fb9..cc5f2fa395 100644--- a/packages/core/src/Selector/XDSSelector.tsx+++ b/packages/core/src/Selector/XDSSelector.tsx@@ -49,6 +49,8 @@ import {} from './utils';import {useCombobox, useSelectedItemOffset} from './hooks';import {XDSSelectorItem} from './XDSSelectorItem';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';const styles = stylex.create({// Trigger button@@ -245,6 +247,20 @@ export interface XDSSelectorStatus {message?: string;}+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ selector?: {+ /** Trigger button styles */+ trigger?: ThemeStyleXStyles;+ /** Dropdown container styles */+ dropdown?: ThemeStyleXStyles;+ };+ }+}export interface XDSSelectorProps<T extends XDSSelectorOption = XDSSelectorOption,> {@@ -374,6 +390,10 @@ export function XDSSelector<T extends XDSSelectorOption>({children,'data-testid': testId,}: XDSSelectorProps<T>) {+ const themeContext = React.useContext(ThemeContext);+ const triggerOverride = themeContext?.theme.components?.selector?.trigger;+ const dropdownOverride = themeContext?.theme.components?.selector?.dropdown;+const triggerId = useId();const listboxId = useId();const descriptionId = useId();@@ -574,6 +594,7 @@ export function XDSSelector<T extends XDSSelectorOption>({isDisabled && styles.triggerDisabled,!selectedItem && styles.triggerPlaceholder,status && statusBorderStyles[status.type],+ triggerOverride,)}><span>{selectedItem?.label ?? placeholder}</span><span@@ -604,6 +625,7 @@ export function XDSSelector<T extends XDSSelectorOption>({styles.dropdown,!isPositioned && styles.dropdownHidden,styles.dropdownOffset(-selectedItemOffset),+ dropdownOverride,)}>{renderOptions()}</div>,diff --git a/packages/core/src/Skeleton/README.md b/packages/core/src/Skeleton/README.mdindex 346ff8ed7f..de6e362b6e 100644--- a/packages/core/src/Skeleton/README.md+++ b/packages/core/src/Skeleton/README.md@@ -65,6 +65,28 @@ The skeleton uses three timing constants:For element at index `n`, animation starts at: `DELAY_TIME + (STAGGER_TIME × n)`+## Theming++Themes can override `Skeleton` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ skeleton: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | ---------------------------- |+| `root` | Root skeleton element styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/Skeleton/XDSSkeleton.tsx b/packages/core/src/Skeleton/XDSSkeleton.tsxindex 45a8db5209..44b8902251 100644--- a/packages/core/src/Skeleton/XDSSkeleton.tsx+++ b/packages/core/src/Skeleton/XDSSkeleton.tsx@@ -10,9 +10,11 @@* - /apps/storybook/stories/Skeleton.stories.tsx*/-import {forwardRef, type HTMLAttributes} from 'react';+import {forwardRef, useContext, type HTMLAttributes} from 'react';import * as stylex from '@stylexjs/stylex';import {colorVars, radiusVars} from '../theme/tokens.stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';// =============================================================================// Animation Timing Constants@@ -108,6 +110,18 @@ export type XDSSkeletonRadius = keyof typeof radiusStyles;// Component// =============================================================================+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ skeleton?: {+ /** Root skeleton styles */+ root?: ThemeStyleXStyles;+ };+ }+}export interface XDSSkeletonProps extends Omit<HTMLAttributes<HTMLDivElement>,'className' | 'style'@@ -160,6 +174,8 @@ export const XDSSkeleton = forwardRef<HTMLDivElement, XDSSkeletonProps>(},ref,) => {+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.skeleton?.root;return (<divref={ref}@@ -170,6 +186,7 @@ export const XDSSkeleton = forwardRef<HTMLDivElement, XDSSkeletonProps>(radiusStyles[radiusProp],dynamicStyles.dimensions(width, height),dynamicStyles.animationDelay(index),+ rootOverride,)}{...props}/>diff --git a/packages/core/src/Slider/README.md b/packages/core/src/Slider/README.mdindex 5725866324..78f88e6c4d 100644--- a/packages/core/src/Slider/README.md+++ b/packages/core/src/Slider/README.md@@ -100,50 +100,78 @@ import { XDSSlider } from '@xds/core/Slider';## XDSSlider Props (Base)-| Prop | Type | Default | Description |-| --------------- | ----------------------------------------------- | -------------- | --------------------------------------------------------------- |-| `label` | `string` | — | Label text (always rendered for accessibility) |-| `isLabelHidden` | `boolean` | `false` | Whether to visually hide the label |-| `description` | `string` | — | Description text below the label |-| `isDisabled` | `boolean` | `false` | Whether the slider is disabled |-| `isOptional` | `boolean` | `false` | Whether the field is optional |-| `isRequired` | `boolean` | `false` | Whether the field is required |-| `status` | `XDSInputStatus` | — | Status indicator (`{ type, message }`) |-| `labelTooltip` | `string` | — | Tooltip text for an info icon next to the label |-| `min` | `number` | `0` | Minimum value |-| `max` | `number` | `100` | Maximum value |-| `step` | `number` | `1` | Step increment |-| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Orientation of the slider |-| `formatValue` | `(value: number) => string` | — | Custom value formatting for display and `aria-valuetext` |-| `valueDisplay` | `'tooltip' \| 'text' \| 'none'` | `'tooltip'` | How the current value is displayed |-| `marks` | `Array<{ value: number; label?: string }>` | — | Tick marks at specified positions with optional labels |-| `xstyle` | `StyleXStyles` | — | Additional styles |-| `data-testid` | `string` | — | Test ID for the root element |+| Prop | Type | Default | Description |+| --------------- | ------------------------------------------ | -------------- | -------------------------------------------------------- |+| `label` | `string` | — | Label text (always rendered for accessibility) |+| `isLabelHidden` | `boolean` | `false` | Whether to visually hide the label |+| `description` | `string` | — | Description text below the label |+| `isDisabled` | `boolean` | `false` | Whether the slider is disabled |+| `isOptional` | `boolean` | `false` | Whether the field is optional |+| `isRequired` | `boolean` | `false` | Whether the field is required |+| `status` | `XDSInputStatus` | — | Status indicator (`{ type, message }`) |+| `labelTooltip` | `string` | — | Tooltip text for an info icon next to the label |+| `min` | `number` | `0` | Minimum value |+| `max` | `number` | `100` | Maximum value |+| `step` | `number` | `1` | Step increment |+| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Orientation of the slider |+| `formatValue` | `(value: number) => string` | — | Custom value formatting for display and `aria-valuetext` |+| `valueDisplay` | `'tooltip' \| 'text' \| 'none'` | `'tooltip'` | How the current value is displayed |+| `marks` | `Array<{ value: number; label?: string }>` | — | Tick marks at specified positions with optional labels |+| `xstyle` | `StyleXStyles` | — | Additional styles |+| `data-testid` | `string` | — | Test ID for the root element |### Single Value Mode-| Prop | Type | Description |-| ------------- | ---------------------------- | ---------------------------------------------- |-| `value` | `number` | Current value |-| `onChange` | `(value: number) => void` | Callback fired on value change during drag |-| `onChangeEnd` | `(value: number) => void` | Callback fired when drag ends |+| Prop | Type | Description |+| ------------- | ------------------------- | ------------------------------------------ |+| `value` | `number` | Current value |+| `onChange` | `(value: number) => void` | Callback fired on value change during drag |+| `onChangeEnd` | `(value: number) => void` | Callback fired when drag ends |### Range Mode-| Prop | Type | Default | Description |-| ------------------------ | -------------------------------------- | ------- | ---------------------------------------- |-| `value` | `[number, number]` | — | Current range `[min, max]` |-| `onChange` | `(value: [number, number]) => void` | — | Callback fired on value change |-| `onChangeEnd` | `(value: [number, number]) => void` | — | Callback fired when drag ends |-| `minStepsBetweenThumbs` | `number` | `0` | Minimum number of steps between thumbs |+| Prop | Type | Default | Description |+| ----------------------- | ----------------------------------- | ------- | -------------------------------------- |+| `value` | `[number, number]` | — | Current range `[min, max]` |+| `onChange` | `(value: [number, number]) => void` | — | Callback fired on value change |+| `onChangeEnd` | `(value: [number, number]) => void` | — | Callback fired when drag ends |+| `minStepsBetweenThumbs` | `number` | `0` | Minimum number of steps between thumbs |++## Theming++Themes can override `Slider` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ slider: {+ root: myStyles,+ track: myStyles,+ filledTrack: myStyles,+ thumb: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------------- | -------------------------- |+| `root` | Root container styles |+| `track` | Background track styles |+| `filledTrack` | Filled/active track styles |+| `thumb` | Thumb handle styles |## Files-| File | Role | Purpose |-| --------------------- | ----- | ---------------------------------------------------- |-| `index.ts` | Entry | Exports XDSSlider component and all type variants |-| `XDSSlider.tsx` | Core | Slider component with single and range mode support |-| `XDSSlider.test.tsx` | Test | Unit tests |+| File | Role | Purpose |+| -------------------- | ----- | --------------------------------------------------- |+| `index.ts` | Entry | Exports XDSSlider component and all type variants |+| `XDSSlider.tsx` | Core | Slider component with single and range mode support |+| `XDSSlider.test.tsx` | Test | Unit tests |## Implementation Notesdiff --git a/packages/core/src/Slider/XDSSlider.tsx b/packages/core/src/Slider/XDSSlider.tsxindex a48d3fae9a..f27cada65d 100644--- a/packages/core/src/Slider/XDSSlider.tsx+++ b/packages/core/src/Slider/XDSSlider.tsx@@ -13,6 +13,7 @@import {forwardRef,+ useContext,useId,useRef,useCallback,@@ -32,11 +33,31 @@ import {import {XDSField} from '../Field/XDSField';import {XDSTooltip} from '../Layer/XDSTooltip';import type {XDSInputStatus} from '../Field/types';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';// =============================================================================// Types// =============================================================================+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ slider?: {+ /** Root container styles */+ root?: ThemeStyleXStyles;+ /** Track styles */+ track?: ThemeStyleXStyles;+ /** Filled track styles */+ filledTrack?: ThemeStyleXStyles;+ /** Thumb styles */+ thumb?: ThemeStyleXStyles;+ };+ }+}export interface XDSSliderBaseProps {/** Label text for the slider (always rendered for accessibility). */label: string;@@ -322,6 +343,13 @@ export const XDSSlider = forwardRef<HTMLDivElement, XDSSliderProps>(onChangeEnd,} = props;+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.slider?.root;+ const trackOverride = themeContext?.theme.components?.slider?.track;+ const filledTrackOverride =+ themeContext?.theme.components?.slider?.filledTrack;+ const thumbOverride = themeContext?.theme.components?.slider?.thumb;+const isRange = Array.isArray(value);const minStepsBetweenThumbs =isRange && 'minStepsBetweenThumbs' in props@@ -557,6 +585,7 @@ export const XDSSlider = forwardRef<HTMLDivElement, XDSSliderProps>(!isDisabled && styles.thumbHover,!isDisabled && styles.thumbFocusWithin,isDisabled && styles.thumbDisabled,+ thumbOverride,)}/>);@@ -627,7 +656,7 @@ export const XDSSlider = forwardRef<HTMLDivElement, XDSSliderProps>(labelTooltip={labelTooltip}statusVariant="detached"{...stylex.props(xstyle)}>- <div {...stylex.props(styles.sliderRow)}>+ <div {...stylex.props(styles.sliderRow, rootOverride)}><divref={node => {// Merge refs@@ -656,6 +685,7 @@ export const XDSSlider = forwardRef<HTMLDivElement, XDSSliderProps>({...stylex.props(styles.track,isHorizontal ? styles.trackHorizontal : styles.trackVertical,+ trackOverride,)}/>@@ -667,6 +697,7 @@ export const XDSSlider = forwardRef<HTMLDivElement, XDSSliderProps>(isHorizontal? styles.filledTrackHorizontal: styles.filledTrackVertical,+ filledTrackOverride,)}/>diff --git a/packages/core/src/Spinner/README.md b/packages/core/src/Spinner/README.mdindex 621741eb51..23ce7862e2 100644--- a/packages/core/src/Spinner/README.md+++ b/packages/core/src/Spinner/README.md@@ -57,6 +57,28 @@ import {XDSText} from '@xds/core/Text';| `md` | 20×20px | 2px | Default, standalone indicator || `lg` | 28×28px | 3px | Full-page or section loading |+## Theming++Themes can override `Spinner` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ spinner: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | --------------------------- |+| `root` | Root spinner element styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/Spinner/XDSSpinner.tsx b/packages/core/src/Spinner/XDSSpinner.tsxindex 7428f2fe17..ae8908adb0 100644--- a/packages/core/src/Spinner/XDSSpinner.tsx+++ b/packages/core/src/Spinner/XDSSpinner.tsx@@ -11,9 +11,11 @@* - /apps/storybook/stories/Spinner.stories.tsx*/-import {forwardRef, useEffect, useRef} from 'react';+import {forwardRef, useContext, useEffect, useRef} from 'react';import * as stylex from '@stylexjs/stylex';import {colorVars} from '../theme/tokens.stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';// =============================================================================// Constants@@ -66,6 +68,18 @@ const styles = stylex.create({export type XDSSpinnerSize = keyof typeof SIZES;export type XDSSpinnerShade = 'default' | 'onMedia';+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ spinner?: {+ /** Root spinner styles */+ root?: ThemeStyleXStyles;+ };+ }+}export interface XDSSpinnerProps {/*** Spinner size.@@ -106,6 +120,8 @@ export interface XDSSpinnerProps {*/export const XDSSpinner = forwardRef<HTMLSpanElement, XDSSpinnerProps>(({size = 'md', shade = 'default', 'data-testid': testId}, ref) => {+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.spinner?.root;const canvasRef = useRef<HTMLCanvasElement>(null);useEffect(() => {@@ -170,7 +186,7 @@ export const XDSSpinner = forwardRef<HTMLSpanElement, XDSSpinnerProps>(role="status"aria-label="Loading"data-testid={testId}- {...stylex.props(styles.spinner)}+ {...stylex.props(styles.spinner, rootOverride)}style={{width: frameSize, height: frameSize}}><canvas ref={canvasRef} {...stylex.props(styles.canvas)} /></span>diff --git a/packages/core/src/Switch/README.md b/packages/core/src/Switch/README.mdindex 850a3930bd..444dca677a 100644--- a/packages/core/src/Switch/README.md+++ b/packages/core/src/Switch/README.md@@ -72,6 +72,32 @@ import { XDSSwitch } from '@xds/core/Switch';| `labelPosition` | `'start' \| 'end'` | `'end'` | Which side of the switch the label appears on || `labelSpacing` | `'default' \| 'spread'` | `'default'` | Spacing behavior between label and switch |+## Theming++Themes can override `Switch` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ switch: {+ root: myStyles,+ track: myStyles,+ thumb: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | --------------------- |+| `root` | Root container styles |+| `track` | Switch track styles |+| `thumb` | Switch thumb styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/Switch/XDSSwitch.tsx b/packages/core/src/Switch/XDSSwitch.tsxindex 46851d6213..35be724253 100644--- a/packages/core/src/Switch/XDSSwitch.tsx+++ b/packages/core/src/Switch/XDSSwitch.tsx@@ -11,7 +11,13 @@* - /apps/storybook/stories/Switch.stories.tsx (storybook stories)*/-import {forwardRef, useId, type ChangeEvent, type FocusEvent} from 'react';+import {+ forwardRef,+ useContext,+ useId,+ type ChangeEvent,+ type FocusEvent,+} from 'react';import * as stylex from '@stylexjs/stylex';import {colorVars,@@ -26,6 +32,8 @@ import {XDSFieldLabel} from '../Field/XDSFieldLabel';import {XDSFieldStatus} from '../Field/XDSFieldStatus';import type {XDSIconType} from '../Icon';import type {XDSInputStatus} from '../Field/types';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';// Fixed dimensions: 40px width, 24px height, 16px thumb (off), 20px thumb (on)const SWITCH_WIDTH = 40;@@ -151,6 +159,22 @@ const styles = stylex.create({export type XDSSwitchLabelPosition = 'start' | 'end';export type XDSSwitchLabelSpacing = 'default' | 'spread';+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ switch?: {+ /** Root container styles */+ root?: ThemeStyleXStyles;+ /** Track styles */+ track?: ThemeStyleXStyles;+ /** Thumb styles */+ thumb?: ThemeStyleXStyles;+ };+ }+}export interface XDSSwitchProps {/*** Label text for the switch (always rendered for accessibility).@@ -264,6 +288,11 @@ export const XDSSwitch = forwardRef<HTMLInputElement, XDSSwitchProps>(},ref,) => {+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.switch?.root;+ const trackOverride = themeContext?.theme.components?.switch?.track;+ const thumbOverride = themeContext?.theme.components?.switch?.thumb;+const id = useId();const descriptionID = useId();const statusMessageID = useId();@@ -301,11 +330,13 @@ export const XDSSwitch = forwardRef<HTMLInputElement, XDSSwitchProps>(isOn ? styles.trackOn : styles.trackOff,isDisabled && styles.trackDisabled,isDisabled && !isOn && styles.trackDisabledOff,+ trackOverride,)}><div{...stylex.props(styles.thumb,isOn ? styles.thumbOn : styles.thumbOff,+ thumbOverride,)}/></div>@@ -338,6 +369,7 @@ export const XDSSwitch = forwardRef<HTMLInputElement, XDSSwitchProps>({...stylex.props(styles.container,labelSpacing === 'spread' && styles.containerSpread,+ rootOverride,!isDisabled && stylex.defaultMarker(),)}>{labelPosition === 'start' ? (diff --git a/packages/core/src/TabList/README.md b/packages/core/src/TabList/README.mdindex 42266165c0..044fedeab3 100644--- a/packages/core/src/TabList/README.md+++ b/packages/core/src/TabList/README.md@@ -96,6 +96,28 @@ import { XDSTabList, XDSTab, XDSTabMenu } from '@xds/core/TabList';| `label` | `string` | Option display label || `icon` | `XDSIconType` | Optional icon before the label |+## Theming++Themes can override `TabList` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ tabList: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | ------------------------- |+| `root` | Root nav container styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/TabList/XDSTabList.tsx b/packages/core/src/TabList/XDSTabList.tsxindex ea34072deb..369063f16e 100644--- a/packages/core/src/TabList/XDSTabList.tsx+++ b/packages/core/src/TabList/XDSTabList.tsx@@ -10,12 +10,26 @@* - /packages/core/src/TabList/XDSTabList.test.tsx*/-import {useMemo, type ReactNode} from 'react';+import {useContext, useMemo, type ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';import {colorVars, spacingVars} from '../theme/tokens.stylex';import {XDSTabListContext} from './XDSTabListContext';import type {XDSTabListSize} from './XDSTabListContext';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ tabList?: {+ /** Root nav container styles */+ root?: ThemeStyleXStyles;+ };+ }+}export interface XDSTabListProps {/*** The currently selected tab value.@@ -77,6 +91,9 @@ export function XDSTabList({hasDivider = false,children,}: XDSTabListProps) {+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.tabList?.root;+const contextValue = useMemo(() => ({value, onChange, size}),[value, onChange, size],@@ -86,7 +103,11 @@ export function XDSTabList({<XDSTabListContext.Provider value={contextValue}><navaria-label="Tabs"- {...stylex.props(styles.nav, hasDivider && styles.divider)}>+ {...stylex.props(+ styles.nav,+ hasDivider && styles.divider,+ rootOverride,+ )}>{children}</nav></XDSTabListContext.Provider>diff --git a/packages/core/src/Table/README.md b/packages/core/src/Table/README.mdindex 39b2b8ef02..9aab068adc 100644--- a/packages/core/src/Table/README.md+++ b/packages/core/src/Table/README.md@@ -162,3 +162,25 @@ Body rows are memoized via `React.memo` with a custom comparison function. When- `/packages/core/src/theme/tokens.stylex.ts` — Design tokens used by table component styling- `/packages/core/src/CheckboxInput/` — Checkbox component used by selection plugin++## Theming++Themes can override `Table` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ table: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | ----------------- |+| `root` | Root table styles |diff --git a/packages/core/src/Table/XDSTable.tsx b/packages/core/src/Table/XDSTable.tsxindex 87f812b01e..93b4a10966 100644--- a/packages/core/src/Table/XDSTable.tsx+++ b/packages/core/src/Table/XDSTable.tsx@@ -11,7 +11,13 @@* - /apps/storybook/stories/Table.stories.tsx (storybook stories)*/-import {forwardRef, useMemo, type ReactElement, type Ref} from 'react';+import {+ forwardRef,+ useContext,+ useMemo,+ type ReactElement,+ type Ref,+} from 'react';import * as stylex from '@stylexjs/stylex';import {colorVars} from '../theme/tokens.stylex';import {XDSBaseTable} from './XDSBaseTable';@@ -21,6 +27,8 @@ import {XDSTableHeaderCell} from './XDSTableHeaderCell';import {XDSTableContext} from './XDSTableContext';import {useXDSBaseTablePlugins} from './useXDSBaseTablePlugins';import type {XDSBaseTableProps, TablePlugin, TableRenderProps} from './types';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';// =============================================================================// XDSTable Types@@ -38,6 +46,27 @@ export type XDSTableDividers = 'rows' | 'columns' | 'grid' | 'none';** @template T - The row data type*/++// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ table?: {+ /** Root table styles */+ root?: ThemeStyleXStyles;+ /** Header row styles */+ headerRow?: ThemeStyleXStyles;+ /** Body row styles */+ bodyRow?: ThemeStyleXStyles;+ /** Header cell styles */+ headerCell?: ThemeStyleXStyles;+ /** Body cell styles */+ bodyCell?: ThemeStyleXStyles;+ };+ }+}export interface XDSTableProps<T extends Record<string, unknown>> extends Omit<XDSBaseTableProps<T>,'plugins' | 'components'@@ -69,14 +98,18 @@ const tableStyles = stylex.create({// Table-level styling plugin (only transforms the <table> element)// =============================================================================-function buildTableStylePlugin<- T extends Record<string, unknown>,->(): TablePlugin<T> {+function buildTableStylePlugin<T extends Record<string, unknown>>(+ rootOverride?: ThemeStyleXStyles,+): TablePlugin<T> {return {transformTable(props: TableRenderProps): TableRenderProps {return {...props,- styles: [...props.styles, tableStyles.base],+ styles: [+ ...props.styles,+ tableStyles.base,+ ...(rootOverride ? [rootOverride] : []),+ ],};},};@@ -106,8 +139,15 @@ function XDSTableInner<T extends Record<string, unknown>>(}: XDSTableProps<T>,ref: Ref<HTMLTableElement>,): ReactElement {+ // Get theme context for component-level overrides+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.table?.root;+// Table-level styling plugin (just adds font/color to <table>)- const tablePlugin = useMemo(() => buildTableStylePlugin<T>(), []);+ const tablePlugin = useMemo(+ () => buildTableStylePlugin<T>(rootOverride),+ [rootOverride],+ );const basePlugins = useMemo(() => [tablePlugin], [tablePlugin]);// Convert named plugin record to stable memoized arraydiff --git a/packages/core/src/TextArea/README.md b/packages/core/src/TextArea/README.mdindex 4c6bd0473c..f8d871479d 100644--- a/packages/core/src/TextArea/README.md+++ b/packages/core/src/TextArea/README.md@@ -59,6 +59,30 @@ import { XDSTextArea } from '@xds/core/TextArea';| `rows` | `number` | No | Number of visible text rows (default: 3) || `isDisabled` | `boolean` | No | Whether the textarea is disabled (default: false) |+## Theming++Themes can override `TextArea` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ textArea: {+ wrapper: myStyles,+ textarea: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ---------- | ------------------------ |+| `wrapper` | Wrapper container styles |+| `textarea` | Textarea element styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/TextArea/XDSTextArea.tsx b/packages/core/src/TextArea/XDSTextArea.tsxindex 5b5a1ea025..1cf4570870 100644--- a/packages/core/src/TextArea/XDSTextArea.tsx+++ b/packages/core/src/TextArea/XDSTextArea.tsx@@ -11,7 +11,13 @@* - /apps/storybook/stories/TextArea.stories.tsx (storybook stories)*/-import {forwardRef, useId, type ChangeEvent, type ClipboardEvent} from 'react';+import {+ forwardRef,+ useContext,+ useId,+ type ChangeEvent,+ type ClipboardEvent,+} from 'react';import * as stylex from '@stylexjs/stylex';import {CheckCircleIcon,@@ -29,6 +35,8 @@ import {} from '../theme/tokens.stylex';import {XDSField} from '../Field';import {XDSIcon, type XDSIconType} from '../Icon';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';const styles = stylex.create({wrapper: {@@ -124,6 +132,20 @@ export interface XDSTextAreaStatus {message?: string;}+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ textArea?: {+ /** Wrapper container styles */+ wrapper?: ThemeStyleXStyles;+ /** Textarea element styles */+ textarea?: ThemeStyleXStyles;+ };+ }+}export interface XDSTextAreaProps {/*** Label text for the textarea (always rendered for accessibility).@@ -244,6 +266,10 @@ export const XDSTextArea = forwardRef<HTMLTextAreaElement, XDSTextAreaProps>(},ref,) => {+ const themeContext = useContext(ThemeContext);+ const wrapperOverride = themeContext?.theme.components?.textArea?.wrapper;+ const textareaOverride = themeContext?.theme.components?.textArea?.textarea;+const id = useId();const descriptionID = useId();const statusMessageID = useId();@@ -295,6 +321,7 @@ export const XDSTextArea = forwardRef<HTMLTextAreaElement, XDSTextAreaProps>(styles.wrapper,isDisabled && styles.wrapperDisabled,status && statusBorderStyles[status.type],+ wrapperOverride,)}>{startIcon && <XDSIcon icon={startIcon} size="sm" color="primary" />}<textarea@@ -316,6 +343,7 @@ export const XDSTextArea = forwardRef<HTMLTextAreaElement, XDSTextAreaProps>({...stylex.props(styles.textarea,isDisabled && styles.textareaDisabled,+ textareaOverride,)}/>{status && (diff --git a/packages/core/src/TextInput/README.md b/packages/core/src/TextInput/README.mdindex 44bf2a8154..a657566e08 100644--- a/packages/core/src/TextInput/README.md+++ b/packages/core/src/TextInput/README.md@@ -47,20 +47,44 @@ import { XDSTextInput } from '@xds/core/TextInput';## Props-| Prop | Type | Required | Description |-| --------------- | ----------------------------------------------------------- | -------- | ------------------------------------------------------------------ |-| `label` | `string` | Yes | Label text for the input (always rendered for accessibility) |-| `value` | `string` | Yes | Current value of the input |-| `onChange` | `(value: string, e: ChangeEvent<HTMLInputElement>) => void` | Yes | Callback fired when input value changes |-| `size` | `'sm' \| 'md' \| 'lg'` | No | Size variant (default: `'md'`) |-| `isLabelHidden` | `boolean` | No | Visually hide the label (still accessible to screen readers) |-| `description` | `string` | No | Description text displayed between the label and input |-| `isOptional` | `boolean` | No | Whether the field is optional (mutually exclusive with isRequired) |-| `isRequired` | `boolean` | No | Whether the field is required (mutually exclusive with isOptional) |-| `placeholder` | `string` | No | Placeholder text |-| `labelTooltip` | `string` | No | Tooltip text to display in an info icon at the end of the label |+| Prop | Type | Required | Description |+| --------------- | ----------------------------------------------------------- | -------- | --------------------------------------------------------------------- |+| `label` | `string` | Yes | Label text for the input (always rendered for accessibility) |+| `value` | `string` | Yes | Current value of the input |+| `onChange` | `(value: string, e: ChangeEvent<HTMLInputElement>) => void` | Yes | Callback fired when input value changes |+| `size` | `'sm' \| 'md' \| 'lg'` | No | Size variant (default: `'md'`) |+| `isLabelHidden` | `boolean` | No | Visually hide the label (still accessible to screen readers) |+| `description` | `string` | No | Description text displayed between the label and input |+| `isOptional` | `boolean` | No | Whether the field is optional (mutually exclusive with isRequired) |+| `isRequired` | `boolean` | No | Whether the field is required (mutually exclusive with isOptional) |+| `placeholder` | `string` | No | Placeholder text |+| `labelTooltip` | `string` | No | Tooltip text to display in an info icon at the end of the label || `status` | `{type: 'error'\|'warning'\|'success', message?: string}` | No | Validation status with optional message (sets aria-invalid for error) |+## Theming++Themes can override `TextInput` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ textInput: {+ wrapper: myStyles,+ input: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| --------- | ------------------------ |+| `wrapper` | Wrapper container styles |+| `input` | Input element styles |+## Files| File | Role | Purpose |diff --git a/packages/core/src/TextInput/XDSTextInput.tsx b/packages/core/src/TextInput/XDSTextInput.tsxindex 0f089265ed..9eaf0ca5c6 100644--- a/packages/core/src/TextInput/XDSTextInput.tsx+++ b/packages/core/src/TextInput/XDSTextInput.tsx@@ -11,7 +11,7 @@* - /apps/storybook/stories/TextInput.stories.tsx (storybook stories)*/-import {forwardRef, useId, type ChangeEvent} from 'react';+import {forwardRef, useContext, useId, type ChangeEvent} from 'react';import * as stylex from '@stylexjs/stylex';import {CheckCircleIcon,@@ -118,7 +118,23 @@ export type {XDSInputStatus as XDSTextInputStatus,XDSInputStatusType as XDSTextInputStatusType,} from '../Field';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ textInput?: {+ /** Wrapper container styles */+ wrapper?: ThemeStyleXStyles;+ /** Input element styles */+ input?: ThemeStyleXStyles;+ };+ }+}export interface XDSTextInputProps {/*** Label text for the input (always rendered for accessibility).@@ -224,6 +240,10 @@ export const XDSTextInput = forwardRef<HTMLInputElement, XDSTextInputProps>(},ref,) => {+ const themeContext = useContext(ThemeContext);+ const wrapperOverride = themeContext?.theme.components?.textInput?.wrapper;+ const inputOverride = themeContext?.theme.components?.textInput?.input;+const id = useId();const descriptionID = useId();const statusMessageID = useId();@@ -276,6 +296,7 @@ export const XDSTextInput = forwardRef<HTMLInputElement, XDSTextInputProps>(sizeStyles[size],isDisabled && styles.wrapperDisabled,status && statusBorderStyles[status.type],+ wrapperOverride,)}>{startIcon && <XDSIcon icon={startIcon} size="sm" color="primary" />}<input@@ -291,7 +312,11 @@ export const XDSTextInput = forwardRef<HTMLInputElement, XDSTextInputProps>(aria-describedby={ariaDescribedBy}aria-required={isRequired === true ? 'true' : undefined}aria-invalid={status?.type === 'error' ? 'true' : undefined}- {...stylex.props(styles.input, isDisabled && styles.inputDisabled)}+ {...stylex.props(+ styles.input,+ isDisabled && styles.inputDisabled,+ inputOverride,+ )}/>{status && (<XDSIcondiff --git a/packages/core/src/TimeInput/README.md b/packages/core/src/TimeInput/README.mdindex 3afd9b3088..a921a4187a 100644--- a/packages/core/src/TimeInput/README.md+++ b/packages/core/src/TimeInput/README.md@@ -45,3 +45,27 @@ import {XDSTimeInput} from '@xds/core/TimeInput';status={{ type: 'error', message: 'Invalid time' }}/>```++## Theming++Themes can override `TimeInput` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ timeInput: {+ wrapper: myStyles,+ input: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| --------- | ------------------------- |+| `wrapper` | Input wrapper styles |+| `input` | Text input element styles |diff --git a/packages/core/src/TimeInput/XDSTimeInput.tsx b/packages/core/src/TimeInput/XDSTimeInput.tsxindex 44076bbf82..2eeab6559a 100644--- a/packages/core/src/TimeInput/XDSTimeInput.tsx+++ b/packages/core/src/TimeInput/XDSTimeInput.tsx@@ -13,6 +13,7 @@import {forwardRef,+ useContext,useId,useState,useCallback,@@ -163,7 +164,23 @@ export type {XDSInputStatus as XDSTimeInputStatus,XDSInputStatusType as XDSTimeInputStatusType,} from '../Field';-+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';++// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ timeInput?: {+ /** Input wrapper styles */+ wrapper?: ThemeStyleXStyles;+ /** Text input styles */+ input?: ThemeStyleXStyles;+ };+ }+}export interface XDSTimeInputProps {/*** Label text for the input (required for accessibility).@@ -305,6 +322,10 @@ export const XDSTimeInput = forwardRef<HTMLInputElement, XDSTimeInputProps>(},ref,) => {+ const themeContext = useContext(ThemeContext);+ const wrapperOverride = themeContext?.theme.components?.timeInput?.wrapper;+ const inputOverride = themeContext?.theme.components?.timeInput?.input;+const id = useId();const descriptionID = useId();const statusMessageID = useId();@@ -498,6 +519,7 @@ export const XDSTimeInput = forwardRef<HTMLInputElement, XDSTimeInputProps>(sizeStyles[size],isDisabled && styles.wrapperDisabled,status && statusBorderStyles[status.type],+ wrapperOverride,)}><div {...stylex.props(styles.icon)}><XDSIcon icon={ClockIcon} size="sm" color="secondary" />@@ -520,6 +542,7 @@ export const XDSTimeInput = forwardRef<HTMLInputElement, XDSTimeInputProps>(styles.input,isDisabled && styles.inputDisabled,!isInputValid && styles.inputInvalid,+ inputOverride,)}/>{hasClear && value && !isDisabled && (diff --git a/packages/core/src/TopNav/README.md b/packages/core/src/TopNav/README.mdindex 8cb96616a7..68d1a497b7 100644--- a/packages/core/src/TopNav/README.md+++ b/packages/core/src/TopNav/README.md@@ -100,6 +100,28 @@ import {HomeIcon, BellIcon, UserCircleIcon} from '@heroicons/react/24/outline';| `icon` | `ReactNode` | — | Optional icon element || `children` | `ReactNode` | — | Custom content instead of label |+## Theming++Themes can override `TopNav` styles via `ComponentStyles`:++```tsx+// In your theme definition+const theme: Theme = {+ // ...tokens...+ components: {+ topNav: {+ root: myStyles,+ },+ },+};+```++### Available surfaces++| Surface | Description |+| ------- | ------------------- |+| `root` | Root nav bar styles |+## Files| File | Role | Purpose |@@ -139,7 +161,7 @@ import {XDSTopNav, XDSTopNavTitle, XDSTopNavItem} from '@xds/core/TopNav';<MainContent /></XDSLayoutContent>}-/>+/>;```## Slot Layout Structurediff --git a/packages/core/src/TopNav/XDSTopNav.tsx b/packages/core/src/TopNav/XDSTopNav.tsxindex 02c04f4894..5167aef3d5 100644--- a/packages/core/src/TopNav/XDSTopNav.tsx+++ b/packages/core/src/TopNav/XDSTopNav.tsx@@ -11,9 +11,16 @@* - /apps/storybook/stories/TopNav.stories.tsx*/-import {forwardRef, type HTMLAttributes, type ReactNode} from 'react';+import {+ forwardRef,+ useContext,+ type HTMLAttributes,+ type ReactNode,+} from 'react';import * as stylex from '@stylexjs/stylex';import {colorVars, spacingVars} from '../theme/tokens.stylex';+import {ThemeContext} from '../theme/ThemeContext';+import type {StyleXStyles as ThemeStyleXStyles} from '../theme/types';/*** Base TopNav styles@@ -66,6 +73,18 @@ const styles = stylex.create({},});+// =============================================================================+// Module Augmentation - Register component styles with ComponentStyles+// =============================================================================++declare module '../theme/types' {+ interface ComponentStyles {+ topNav?: {+ /** Root nav bar styles */+ root?: ThemeStyleXStyles;+ };+ }+}export interface XDSTopNavProps extends Omit<HTMLAttributes<HTMLElement>,'style' | 'className' | 'title'@@ -132,6 +151,9 @@ export const XDSTopNav = forwardRef<HTMLElement, XDSTopNavProps>({title, startContent, endContent, position = 'static', label, ...props},ref,) {+ const themeContext = useContext(ThemeContext);+ const rootOverride = themeContext?.theme.components?.topNav?.root;+return (<navref={ref}@@ -141,6 +163,7 @@ export const XDSTopNav = forwardRef<HTMLElement, XDSTopNavProps>(styles.base,position === 'sticky' && styles.sticky,position === 'fixed' && styles.fixed,+ rootOverride,)}{...props}><div {...stylex.props(styles.leftSection)}>