An open source design system that's fully customizable and agent ready
TypeScript
fix(Kbd): extend XDSBaseProps for full HTML attribute passthrough (#1175)
Cindy Zhangc9d6539abeca
diff --git a/packages/core/src/Kbd/XDSKbd.tsx b/packages/core/src/Kbd/XDSKbd.tsxindex c2b1d145a4..9a2de05ede 100644--- a/packages/core/src/Kbd/XDSKbd.tsx+++ b/packages/core/src/Kbd/XDSKbd.tsx@@ -13,8 +13,8 @@import {useState, useLayoutEffect} from 'react';import * as stylex from '@stylexjs/stylex';-import type {StyleXStyles} from '@stylexjs/stylex';import {xdsClassName, mergeProps} from '../utils';+import type {XDSBaseProps} from '../XDSBaseProps';import {colorVars,spacingVars,@@ -99,7 +99,7 @@ function detectMac(): boolean {return /Mac|iPhone|iPad|iPod/.test(navigator.platform ?? '');}-export interface XDSKbdProps {+export interface XDSKbdProps extends XDSBaseProps<HTMLSpanElement> {/*** Keyboard shortcut string. Use "+" to separate keys.* Special keys: mod (Cmd on Mac), ctrl, alt, shift, enter, backspace, escape.@@ -112,28 +112,6 @@ export interface XDSKbdProps {* ```*/keys: string;-- /**- * 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;}/**@@ -152,7 +130,7 @@ export interface XDSKbdProps {* <XDSKbd keys="mod+k" />* ```*/-export function XDSKbd({keys, xstyle, className, style}: XDSKbdProps) {+export function XDSKbd({keys, xstyle, className, style, ...rest}: XDSKbdProps) {const [isMac, setIsMac] = useState(false);useLayoutEffect(() => {@@ -163,6 +141,7 @@ export function XDSKbd({keys, xstyle, className, style}: XDSKbdProps) {return (<span+ {...rest}{...mergeProps(xdsClassName('kbd'),stylex.props(styles.wrapper, xstyle),