An open source design system that's fully customizable and agent ready
TypeScript
fix(RadioList, PowerSearch): typography leading tokens and dead props (#1902)
Cindy Zhang0c036286135f
diff --git a/packages/core/src/PowerSearch/XDSPowerSearch.tsx b/packages/core/src/PowerSearch/XDSPowerSearch.tsxindex b39efad556..3e40af81ac 100644--- a/packages/core/src/PowerSearch/XDSPowerSearch.tsx+++ b/packages/core/src/PowerSearch/XDSPowerSearch.tsx@@ -345,10 +345,10 @@ export interface XDSPowerSearchProps {* Accepts a ReactNode (e.g. `<XDSIcon icon={SearchIcon} />`) or an SVG icon component directly.*/startIcon?: ReactNode | XDSIconType;- /** Focus callback. */- onFocus?: () => void;- /** Blur callback. */- onBlur?: () => void;+ /** Fires when focus enters the search input from outside. */+ onFocus?: (e: React.FocusEvent) => void;+ /** Fires when focus leaves the search input entirely. */+ onBlur?: (e: React.FocusEvent) => void;/** Validation status. */status?: XDSInputStatus;/** Max width for dropdown menu. */@@ -843,6 +843,8 @@ export function XDSPowerSearch({hasEntriesOnFocusdebounceMs={0}status={status}+ onFocus={onFocus}+ onBlur={onBlur}xstyle={xstyle}className={className}style={style}diff --git a/packages/core/src/RadioList/XDSRadioListItem.tsx b/packages/core/src/RadioList/XDSRadioListItem.tsxindex e509472b20..16100dcac2 100644--- a/packages/core/src/RadioList/XDSRadioListItem.tsx+++ b/packages/core/src/RadioList/XDSRadioListItem.tsx@@ -124,6 +124,7 @@ const styles = stylex.create({label: {fontFamily: typographyVars['--font-family-body'],fontSize: typeScaleVars['--text-label-size'],+ lineHeight: typeScaleVars['--text-label-leading'],fontWeight: fontWeightVars['--font-weight-medium'],color: colorVars['--color-text-primary'],cursor: 'pointer',@@ -135,6 +136,7 @@ const styles = stylex.create({description: {fontFamily: typographyVars['--font-family-body'],fontSize: typeScaleVars['--text-supporting-size'],+ lineHeight: typeScaleVars['--text-supporting-leading'],color: colorVars['--color-text-secondary'],},startContent: {diff --git a/packages/core/src/Tokenizer/XDSTokenizer.tsx b/packages/core/src/Tokenizer/XDSTokenizer.tsxindex c360653de2..fd929009a3 100644--- a/packages/core/src/Tokenizer/XDSTokenizer.tsx+++ b/packages/core/src/Tokenizer/XDSTokenizer.tsx@@ -166,6 +166,10 @@ export interface XDSTokenizerProps<T extends XDSSearchableItem> {hasCreate?: boolean;/** Query change callback. */onChangeQuery?: (query: string) => void;+ /** Fires when focus enters the tokenizer from outside. */+ onFocus?: (e: React.FocusEvent) => void;+ /** Fires when focus leaves the tokenizer entirely. */+ onBlur?: (e: React.FocusEvent) => void;/*** StyleX styles created via `stylex.create()`. Merged with the component's* base styles inside a single `stylex.props()` call for optimal deduplication.@@ -364,6 +368,8 @@ export function XDSTokenizer<T extends XDSSearchableItem>({debounceMs,hasCreate = false,onChangeQuery,+ onFocus,+ onBlur,xstyle,className,style,@@ -424,30 +430,34 @@ export function XDSTokenizer<T extends XDSSearchableItem>({const handleFocusCapture = useCallback((e: React.FocusEvent) => {+ const comingFromOutside = !isFocusInTokenizer(e.relatedTarget as Node);setIsFocusedWithin(true);if (isLayerMode) {layer.show();}- // When focus enters from outside, redirect to the input so the user- // doesn't have to tab through every token remove button.- const comingFromOutside = !isFocusInTokenizer(e.relatedTarget as Node);- if (comingFromOutside && e.target !== inputRef.current) {- inputRef.current?.focus();+ if (comingFromOutside) {+ onFocus?.(e);+ // Redirect to the input so the user doesn't have to tab through+ // every token remove button.+ if (e.target !== inputRef.current) {+ inputRef.current?.focus();+ }}},- [isLayerMode, layer, isFocusInTokenizer],+ [isLayerMode, layer, isFocusInTokenizer, onFocus],);const handleBlurCapture = useCallback((e: React.FocusEvent) => {if (!isFocusInTokenizer(e.relatedTarget as Node)) {setIsFocusedWithin(false);+ onBlur?.(e);if (isLayerMode) {layer.hide();}}},- [isLayerMode, layer, isFocusInTokenizer],+ [isLayerMode, layer, isFocusInTokenizer, onBlur],);const isAtMax = maxEntries != null && value.length >= maxEntries;