An open source design system that's fully customizable and agent ready
TypeScript
feat(types): tighten XDSBaseProps — omit title and obscure HTML attrs (#1505)
Cindy Zhang2f465ee73f58
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsxindex ba29b1848c..5093d606da 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx@@ -1607,8 +1607,7 @@ function DocsiteLandingTemplate() {isOpen={isSettingsOpen}onOpenChange={setIsSettingsOpen}width={560}- purpose="form"- title="Settings">+ purpose="form"><XDSStack direction="vertical" gap={4} style={{padding: '8px 0'}}><XDSStack direction="horizontal" hAlign="between" vAlign="center"><XDSStack direction="vertical" gap={1}>diff --git a/packages/core/src/XDSBaseProps.ts b/packages/core/src/XDSBaseProps.tsindex fd891e777b..46f6594391 100644--- a/packages/core/src/XDSBaseProps.ts+++ b/packages/core/src/XDSBaseProps.ts@@ -4,9 +4,9 @@* @output Exports XDSBaseProps — the shared base interface for all XDS components* @position Type foundation; extended by all component prop interfaces*- * Starts with full HTMLAttributes and omits props that should require- * intentional opt-in. `children` is excluded so slot-based components- * don't silently accept and drop JSX children at runtime.+ * Keeps: event handlers, aria-*, role, tabIndex, hidden, draggable, inert,+ * dir, className, style, id, xstyle, data-*.+ * Omits: title, contentEditable, and obscure/non-standard HTML attributes.*/import type React from 'react';@@ -15,17 +15,65 @@ import type {StyleXStyles} from '@stylexjs/stylex';/*** Base props shared by all XDS components.*- * Extends HTMLAttributes minus props that should be opt-in per component.- * `children` is omitted so slot-based components don't silently accept- * and drop JSX children; components that use children declare it explicitly.+ * Omits props that are footguns, deprecated, or irrelevant to component APIs.+ * Components that genuinely need an omitted prop can declare it explicitly.*/export interface XDSBaseProps<T extends HTMLElement = HTMLElement> extends Omit<React.HTMLAttributes<T>,| 'children'+ | 'title'| 'contentEditable'| 'dangerouslySetInnerHTML'| 'suppressContentEditableWarning'| 'suppressHydrationWarning'+ // Obscure+ | 'accessKey'+ | 'autoCapitalize'+ | 'autoFocus'+ | 'contextMenu'+ | 'enterKeyHint'+ | 'lang'+ | 'nonce'+ | 'slot'+ | 'spellCheck'+ | 'translate'+ | 'radioGroup'+ | 'inputMode'+ | 'is'+ // RDFa+ | 'about'+ | 'content'+ | 'datatype'+ | 'inlist'+ | 'prefix'+ | 'property'+ | 'rel'+ | 'resource'+ | 'rev'+ | 'typeof'+ | 'vocab'+ // Non-standard+ | 'autoCorrect'+ | 'autoSave'+ | 'color'+ | 'results'+ | 'security'+ | 'unselectable'+ // Microdata+ | 'itemProp'+ | 'itemScope'+ | 'itemType'+ | 'itemID'+ | 'itemRef'+ // Popover API (use XDSPopover)+ | 'popover'+ | 'popoverTargetAction'+ | 'popoverTarget'+ // Shadow DOM+ | 'exportparts'+ // Form defaults+ | 'defaultChecked'+ | 'defaultValue'> {/*** StyleX styles created via `stylex.create()`. Merged with the component's@@ -39,6 +87,6 @@ export interface XDSBaseProps<T extends HTMLElement = HTMLElement> extends Omit<*/xstyle?: StyleXStyles;- /** Allow data-* attributes in object literals (not just JSX). */+ /** Allow data-* attributes for telemetry, testing, and integration hooks. */[key: `data-${string}`]: string | undefined;}