Skip to content

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

TypeScript

fix(core): migrate ProgressBar/Section to XDSBaseProps, fix RadioList double-apply (#1253)

Cindy Zhang7f20b6eb283e
diff --git a/packages/core/src/ProgressBar/XDSProgressBar.tsx b/packages/core/src/ProgressBar/XDSProgressBar.tsx
index 4cd244abf0..7ca4b10cc2 100644
--- a/packages/core/src/ProgressBar/XDSProgressBar.tsx
+++ b/packages/core/src/ProgressBar/XDSProgressBar.tsx
@@ -15,7 +15,7 @@
import {useId} from 'react';
import * as stylex from '@stylexjs/stylex';
-import type {StyleXStyles} from '@stylexjs/stylex';
+
import {
colorVars,
spacingVars,
@@ -26,6 +26,7 @@ import {
typeScaleVars,
} from '../theme/tokens.stylex';
import {xdsClassName, mergeProps} from '../utils';
+import type {XDSBaseProps} from '../XDSBaseProps';
/**
* Extensible variant map for XDSProgressBar.
@@ -54,7 +55,7 @@ export interface XDSProgressBarVariantMap {
*/
export type XDSProgressBarVariant = keyof XDSProgressBarVariantMap;
-export interface XDSProgressBarProps {
+export interface XDSProgressBarProps extends XDSBaseProps<HTMLDivElement> {
/** Ref forwarded to the root element */
ref?: React.Ref<HTMLDivElement>;
/**
@@ -101,27 +102,6 @@ export interface XDSProgressBarProps {
* @default false
*/
isIndeterminate?: 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 } });
- * <Component 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. Spread after StyleX
- * inline styles, so these values take priority.
- */
- style?: React.CSSProperties;
/**
* Test ID for testing utilities.
*/
diff --git a/packages/core/src/RadioList/XDSRadioList.tsx b/packages/core/src/RadioList/XDSRadioList.tsx
index 79ceb31691..3ae3291de9 100644
--- a/packages/core/src/RadioList/XDSRadioList.tsx
+++ b/packages/core/src/RadioList/XDSRadioList.tsx
@@ -234,10 +234,7 @@ export function XDSRadioList({
stylex.props(
styles.radiogroup,
orientation === 'vertical' ? styles.vertical : styles.horizontal,
- xstyle,
),
- className,
- style,
)}>
<XDSRadioListContext.Provider value={contextValue}>
{children}
diff --git a/packages/core/src/Section/XDSSection.tsx b/packages/core/src/Section/XDSSection.tsx
index 77f026a821..6ec0a7f380 100644
--- a/packages/core/src/Section/XDSSection.tsx
+++ b/packages/core/src/Section/XDSSection.tsx
@@ -14,8 +14,8 @@
import {type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
-import type {StyleXStyles} from '@stylexjs/stylex';
import {colorVars} from '../theme/tokens.stylex';
+import type {XDSBaseProps} from '../XDSBaseProps';
import {container} from '../Layout/container.stylex';
import type {SpacingToken} from '../Layout/container.stylex';
import {
@@ -130,27 +130,8 @@ const dynamicStyles = stylex.create({
}),
});
-export interface XDSSectionProps {
+export interface XDSSectionProps extends XDSBaseProps<HTMLElement> {
ref?: React.Ref<HTMLElement>;
- /**
- * StyleX styles created via `stylex.create()`. Merged with the component's
- * base styles inside a single `stylex.props()` call on the outer wrapper.
- *
- * @example
- * ```
- * const overrides = stylex.create({ root: { marginBottom: 8 } });
- * <XDSSection xstyle={overrides.root} />
- * ```
- */
- xstyle?: StyleXStyles;
- /**
- * CSS class name(s) appended to the root element.
- */
- className?: string;
- /**
- * Inline styles to apply to the root element.
- */
- style?: React.CSSProperties;
/**
* Visual variant of the section.
* - 'section': Surface background color