An open source design system that's fully customizable and agent ready
TypeScript
use XDS component prefix (#9)
Cindy Zhang0be45b589926
diff --git a/.context/explorations/component-naming-conventions.md b/.context/explorations/component-naming-conventions.mdnew file mode 100644index 0000000000..60d767306e--- /dev/null+++ b/.context/explorations/component-naming-conventions.md@@ -0,0 +1,72 @@+# Component Naming Conventions++## Context++XDS uses the `XDS` prefix for all design system components (e.g., `XDSButton`, `XDSVStack`). This document explores how file naming affects LLM discoverability and contribution patterns.++## Empirical Observation++When asked to create a new component `XDSVStack`, an LLM (Claude) naturally created files with the prefix included:+- `XDSVStack.tsx`+- `XDSVStack.test.tsx`++This happened despite an earlier discussion about keeping files unprefixed. This suggests:++1. **Prefixed filenames are the natural LLM default** — When the component name includes a prefix, LLMs instinctively name files to match+2. **Re-export pattern requires extra context** — The pattern `Button.tsx → export as XDSButton` is a learned convention, not intuitive+3. **Consistency reduces cognitive load** — Matching file names to export names eliminates a layer of indirection++## Options++### Option A: Files match export names (prefixed)++```+Button/+├── XDSButton.tsx → exports XDSButton+├── XDSButton.test.tsx+└── index.ts+```++**Evidence for:**+- LLMs naturally default to this pattern+- No mental translation between file name and component name+- Editor tabs show the exact component name+- Grep/search for "XDSButton" finds both file and component++**Evidence against:**+- Redundancy with directory name (`Button/XDSButton.tsx`)+- Harder to change prefix in the future (affects all file names)++### Option B: Files unprefixed, re-export with prefix++```+Button/+├── Button.tsx → exports Button internally+├── Button.test.tsx+└── index.ts → export { Button as XDSButton }+```++**Evidence for:**+- Simpler file names+- Easier to support prefix customization for forks+- Follows some existing library patterns++**Evidence against:**+- LLMs don't naturally follow this pattern without explicit instruction+- Requires learning and maintaining a convention+- `import { XDSButton } from './Button'` may cause confusion++## Decision++Given the empirical evidence that LLMs naturally default to prefixed file names:++**Use prefixed file names (`XDSButton.tsx`)** for maximum LLM-friendliness.++The slight redundancy with directory names is a minor cost compared to:+- More intuitive LLM contributions+- No need for explicit re-export conventions+- Direct match between file names and what developers see in code++## Key Insight++> When LLMs are given a component name with a prefix, they naturally create files with that prefix. Fighting this instinct requires explicit conventions that must be re-learned in each context. It's simpler to align file naming with LLM intuition.diff --git a/.context/explorations/component-swizzling.md b/.context/explorations/component-swizzling.mdindex f1745cd0d7..2fe2180403 100644--- a/.context/explorations/component-swizzling.md+++ b/.context/explorations/component-swizzling.md@@ -30,8 +30,8 @@ Themes are self-contained files that can be copied and modified. Could component### 1. Component Recipes (like shadcn)Provide component source files that consumers copy into their project:```-npx xds add button-→ copies Button.tsx into your project+npx xds add XDSButton+→ copies XDSButton.tsx into your project```Pros: Full control, no abstraction leak@@ -43,7 +43,7 @@ Extend the theme object to include component-specific overrides:const myTheme = {...defaultTheme,components: {- Button: {+ XDSButton: {variants: {primary: { /* custom styles */ },},@@ -58,7 +58,7 @@ Cons: Limited to style overrides, can't change structure### 3. Component Slots/CompositionDesign components with explicit customization points:```tsx-<Button+<XDSButtonrenderIcon={(props) => <CustomIcon {...props} />}styles={{ hover: customHoverStyles }}/>@@ -71,9 +71,9 @@ Cons: API complexity, can't anticipate all needsAllow registering custom component implementations:```tsximport { registerComponent } from '@xds/core';-import { MyButton } from './MyButton';+import { MyXDSButton } from './MyXDSButton';-registerComponent('Button', MyButton);+registerComponent('XDSButton', MyXDSButton);```Pros: Clean swap mechanismdiff --git a/.context/explorations/required-props-pattern.md b/.context/explorations/required-props-pattern.mdindex aa6a15c422..16f07a0f9b 100644--- a/.context/explorations/required-props-pattern.md+++ b/.context/explorations/required-props-pattern.md@@ -80,16 +80,16 @@ More important than required-vs-optional is error quality:```// Bad: silent wrong behavior-<Button>Click</Button> // defaults to type="button", looks like submit+<XDSButton>Click</XDSButton> // defaults to type="button", looks like submit// Better: required prop-<Button>Click</Button> // Error: missing required prop 'type'+<XDSButton>Click</XDSButton> // Error: missing required prop 'type'// Best: actionable error with guidance-<Button>Click</Button>-// Error: Button requires 'type' prop.+<XDSButton>Click</XDSButton>+// Error: XDSButton requires 'type' prop.// Options: "button" | "submit" | "reset"-// Example: <Button type="button">Click</Button>+// Example: <XDSButton type="button">Click</XDSButton>```---diff --git a/.context/explorations/stylex-vs-tailwind.md b/.context/explorations/stylex-vs-tailwind.mdindex effef8885b..e7300350ae 100644--- a/.context/explorations/stylex-vs-tailwind.md+++ b/.context/explorations/stylex-vs-tailwind.md@@ -343,7 +343,7 @@ Research recommends a three-tier structure where only the outermost layer is pub│ --spacing-component-gap: var(--spacing-16) │├─────────────────────────────────────────────────────┤│ COMPONENT API (the public contract) │-│ <Button variant="primary" /> │+│ <XDSButton variant="primary" /> ││ NOT: style={{ color: 'var(--xds-color-primary)' }}│└─────────────────────────────────────────────────────┘```@@ -388,7 +388,7 @@ This creates a tiered access model:```┌─────────────────────────────────────────────────────────────┐│ PUBLIC API (versioned, stable) │-│ - Component props: <Button variant="primary" /> │+│ - Component props: <XDSButton variant="primary" /> ││ - Theme customization: <Theme theme={myTheme} /> ││ - Zero styling — no CSS exposure │├─────────────────────────────────────────────────────────────┤@@ -559,7 +559,7 @@ const Button = classed('button', {});// Usage-<Button variant="secondary" size="lg">Click me</Button>+<XDSButton variant="secondary" size="lg">Click me</XDSButton>```**Strengths**:@@ -698,8 +698,8 @@ All Tailwind-based tools (tw-classed, Tailwind Variants, CVA with Tailwind) **st```typescript// All of these would work even with variant tools-<Button className="mt-[13px]" />-<Button className="bg-[#ff0000]" />+<XDSButton className="mt-[13px]" />+<XDSButton className="bg-[#ff0000]" />```Only StyleX prevents this at compile time through TypeScript.@@ -1103,7 +1103,7 @@ The "AI gap" with StyleX is primarily for **component authors**, not **component| Role | API Surface | AI Difficulty ||------|-------------|---------------|-| **Consumer** | `<Button variant="primary" size="md">` | Trivial — typed props, autocomplete |+| **Consumer** | `<XDSButton variant="primary" size="md">` | Trivial — typed props, autocomplete || **Author** | `createVariants({ ... stylex.create() ... })` | Higher — unfamiliar StyleX patterns || **Swizzler** | Semantic CSS variables + custom StyleX | Medium — documented patterns |@@ -1280,7 +1280,7 @@ Sources: [Netguru: Design System Adoption Pitfalls](https://www.netguru.com/blog| Testable individually | Side effects hard to trace || AI can learn discrete patterns | AI generates arbitrary styling |-Creating a `<ButtonWithIcon>` variant costs minutes. Debugging why `<Button className="custom-override">` broke in a refactor costs hours.+Creating a `<XDSButtonWithIcon>` variant costs minutes. Debugging why `<XDSButton className="custom-override">` broke in a refactor costs hours.### When Over-Componentization IS a Problemdiff --git a/.context/explorations/swizzle-layer-ergonomics.md b/.context/explorations/swizzle-layer-ergonomics.mdindex e1e7ed382a..7e69f73f64 100644--- a/.context/explorations/swizzle-layer-ergonomics.md+++ b/.context/explorations/swizzle-layer-ergonomics.md@@ -53,7 +53,7 @@ The swizzle layer has competing tensions:│ SWIZZLE PATH A: STYLING CUSTOMIZATION ││ Target: DS teams, styling-focused ││ │-│ npx xds customize Button --theme=myTheme │+│ npx xds customize XDSButton --theme=myTheme ││ → Generates theme extension (AI-friendly) ││ ││ Format: Theme config (JSON-like) │@@ -63,7 +63,7 @@ The swizzle layer has competing tensions:│ SWIZZLE PATH B: FUNCTIONAL OVERRIDE ││ Target: Regular builders, functionality-focused ││ │-│ npx xds swizzle Button │+│ npx xds swizzle XDSButton ││ → Copies component source with AI-friendly annotations ││ ││ Format: Full source (StyleX + detailed comments) │@@ -78,7 +78,7 @@ For DS teams that want to customize appearance without changing structure.**Command**:```bash-npx xds customize Button --theme=corporate+npx xds customize XDSButton --theme=corporate```**Generated file** (`themes/corporate/button.ts`):@@ -133,7 +133,7 @@ import { Theme } from '@xds/core';import { corporateButtonTheme } from './themes/corporate/button';<Theme theme={corporateButtonTheme}>- <Button variant="brand-primary">Corporate CTA</Button>+ <XDSButton variant="brand-primary">Corporate CTA</XDSButton></Theme>```@@ -143,13 +143,13 @@ For builders who need to change behavior or structure.**Command**:```bash-npx xds swizzle Button+npx xds swizzle XDSButton```**Generated file** (`components/xds/Button/Button.tsx`):```typescript/**- * 🎨 SWIZZLED COMPONENT: Button+ * 🎨 SWIZZLED COMPONENT: XDSButton** Source: @xds/[email protected]* Swizzled: 2026-01-09@@ -266,7 +266,7 @@ export function Button({ variant = 'primary', children, onClick }: ButtonProps)- Type-safe with theme validation**DX improvements**:-- `npx xds customize Button --interactive` — CLI prompts+- `npx xds customize XDSButton --interactive` — CLI prompts- Auto-generates TypeScript types from config- Preview in Storybook@@ -286,7 +286,7 @@ export function Button({ variant = 'primary', children, onClick }: ButtonProps)### Phase 3: AI Tooling**Build**: AI-specific helpers-- `npx xds customize Button --with-ai-context` — generates extra context file+- `npx xds customize XDSButton --with-ai-context` — generates extra context file- `.xds/ai-context.md` — component customization guide for AI- Cursor/Claude rules for XDS patterns@@ -300,7 +300,7 @@ For builders who prefer Tailwind patterns, we can offer a Tailwind-flavored swiz**Command**:```bash-npx xds customize Button --theme=corporate --format=tailwind+npx xds customize XDSButton --theme=corporate --format=tailwind```**Generated file** (`themes/corporate/button.config.ts`):@@ -342,13 +342,13 @@ export const corporateButton = defineButtonTheme({**Command**:```bash-npx xds swizzle Button --format=tailwind+npx xds swizzle XDSButton --format=tailwind```**Generated file** (`components/xds/Button.tsx`):```tsx/**- * 🎨 SWIZZLED COMPONENT: Button+ * 🎨 SWIZZLED COMPONENT: XDSButton** Format: Tailwind Variants (familiar to most builders)* Tokens: XDS theme tokens (via Tailwind preset)@@ -434,10 +434,10 @@ export function Button({ variant, size, children, onClick }: ButtonProps) {**Command with format**:```bash# Default (StyleX)-npx xds swizzle Button+npx xds swizzle XDSButton# Tailwind format-npx xds swizzle Button --format=tailwind+npx xds swizzle XDSButton --format=tailwind```### Constraints Still Applydiff --git a/.context/proposals/xds-architecture.md b/.context/proposals/xds-architecture.mdindex 0ef0d995b2..e39bb55850 100644--- a/.context/proposals/xds-architecture.md+++ b/.context/proposals/xds-architecture.md@@ -39,8 +39,8 @@ XDS serves developers across their workflow phases. Based on research in `fronte┌─────────────────────────────────────────────────────────────────────┐│ JOB 3: CONSTRUCT PAGES (Component API) ││ │-│ <Button variant="primary" size="md" /> │-│ <Stack gap="md"><Card>...</Card></Stack> │+│ <XDSButton variant="primary" size="md" /> │+│ <XDSStack gap="md"><XDSCard>...</XDSCard></XDSStack> ││ ││ Builder experience: ││ - Typed props, autocomplete-driven │@@ -49,7 +49,7 @@ XDS serves developers across their workflow phases. Based on research in `fronte├─────────────────────────────────────────────────────────────────────┤│ JOB 2: OVERRIDE/CREATE COMPONENTS (Swizzle Layer) ││ │-│ npx xds swizzle Button │+│ npx xds swizzle XDSButton ││ → src/components/xds/Button/Button.tsx ││ ││ Builder experience: │@@ -115,8 +115,8 @@ Designing the architecture for XDS based on explorations in:┌─────────────────────────────────────────────────────────────────┐│ LAYER 3: COMPONENT API (Public) ││ │-│ <Button variant="primary" size="md" /> │-│ <ListItem variant="default" iconSlot={<Icon />} /> │+│ <XDSButton variant="primary" size="md" /> │+│ <XDSListItem variant="default" iconSlot={<Icon />} /> ││ ││ - Props define intent, not style ││ - Components define their own variants │@@ -222,10 +222,10 @@ type ButtonProps = {};// ✅ Valid-<Button variant="tertiary">Click</Button>+<XDSButton variant="tertiary">Click</XDSButton>// ❌ TypeScript error - 'ghost' not in this component's variants-<Button variant="ghost">Click</Button>+<XDSButton variant="ghost">Click</XDSButton>```### How This Simplifies Things@@ -366,24 +366,24 @@ export function Button({// App.tsximport { Theme } from '@xds/core';import { theme } from './theme';-import { Button } from './components/Button';+import { XDSButton } from './components/Button';import { PlusIcon } from './icons';function App() {return (<Theme theme={theme}>{/* Tokens flow through CSS variables */}- <Button variant="primary" size="md" icon={<PlusIcon />}>+ <XDSButton variant="primary" size="md" icon={<PlusIcon />}>Add Item- </Button>+ </XDSButton>- <Button variant="ghost" size="sm">+ <XDSButton variant="ghost" size="sm">Cancel- </Button>+ </XDSButton>- <Button variant="secondary" size="lg" isLoading>+ <XDSButton variant="secondary" size="lg" isLoading>Saving...- </Button>+ </XDSButton></Theme>);}@@ -412,7 +412,7 @@ function App() {↓┌─────────────────────────────────────────────────────────────────┐│ USAGE │-│ <Button variant="primary" icon={<Plus />}>Add</Button> │+│ <XDSButton variant="primary" icon={<Plus />}>Add</XDSButton> ││ Props are typed, tokens flow through, slots render correctly │└─────────────────────────────────────────────────────────────────┘```@@ -732,7 +732,7 @@ The "AI gap" is primarily for **component authors**, not **component consumers**| Role | API Surface | AI Difficulty ||------|-------------|---------------|-| **Consumer** (Job 3) | `<Button variant="primary" size="md">` | Trivial — typed props, autocomplete |+| **Consumer** (Job 3) | `<XDSButton variant="primary" size="md">` | Trivial — typed props, autocomplete || **Theme author** (Job 1) | `createTheme({ ... })` | Medium — structured, learnable || **Swizzler** (Job 2) | StyleX + semantic CSS variables | Medium — documented patterns || **Component author** | `createVariants({ ... stylex.create() ... })` | Higher — unfamiliar patterns |@@ -833,10 +833,10 @@ With token-only themes, swizzle is the path for **any component-level customizat```bash# Default: Tailwind Variants format (recommended)-npx xds swizzle Button+npx xds swizzle XDSButton# StyleX format (for advanced users)-npx xds swizzle Button --format=stylex+npx xds swizzle XDSButton --format=stylex```### Generated Code: Tailwind Variants (Default)@@ -937,7 +937,7 @@ export function Button({ variant, size, icon, children, onClick }: ButtonProps)For advanced users who want maximum encapsulation:```bash-npx xds swizzle Button --format=stylex+npx xds swizzle XDSButton --format=stylex``````typescript@@ -1047,12 +1047,12 @@ export type DarkTheme = typeof darkTheme;// src/App.tsximport { Theme } from '@xds/core';import { darkTheme } from '@company/dark-theme';-import { Button } from '@xds/core';+import { XDSButton } from '@xds/core';function App() {return (<Theme theme={darkTheme}>- <Button variant="primary">Click me</Button>+ <XDSButton variant="primary">Click me</XDSButton></Theme>);}@@ -1106,11 +1106,11 @@ Components have their own types based on their variant definitions — no cross-### Swizzle Layer (Not Yet Implemented)4. **Swizzle CLI?**- - `npx xds swizzle Button` to eject component?+ - `npx xds swizzle XDSButton` to eject component?- Currently, component variant overrides are theme-based, not file-based5. **Swizzle sync command?**- - `npx xds sync Button` to see upstream changes?+ - `npx xds sync XDSButton` to see upstream changes?- How do we help users stay up-to-date?### Future Considerations@@ -1228,7 +1228,7 @@ This provides tw-classed ergonomics without exposed CSS classes.- Component template (`/create-component` slash command)### Phase 2: Component Library-- Additional components (Input, Text, Box, Stack, Card, etc.)+- Additional components (XDSInput, XDSText, XDSBox, XDSStack, XDSCard, etc.)- Slot-level styling (icon, label, prefix, suffix)- Full variant/size matrix across componentsdiff --git a/apps/storybook/stories/Button.stories.tsx b/apps/storybook/stories/Button.stories.tsxindex f44b124e06..bdbb772958 100644--- a/apps/storybook/stories/Button.stories.tsx+++ b/apps/storybook/stories/Button.stories.tsx@@ -1,9 +1,9 @@import type { Meta, StoryObj } from '@storybook/react';-import { Button } from '@xds/core/Button';+import { XDSButton } from '@xds/core/Button';-const meta: Meta<typeof Button> = {- title: 'Core/Button',- component: Button,+const meta: Meta<typeof XDSButton> = {+ title: 'Core/XDSButton',+ component: XDSButton,tags: ['autodocs'],argTypes: {variant: {@@ -23,7 +23,7 @@ const meta: Meta<typeof Button> = {};export default meta;-type Story = StoryObj<typeof Button>;+type Story = StoryObj<typeof XDSButton>;export const Primary: Story = {args: {@@ -73,22 +73,22 @@ export const AllVariants: Story = {render: () => (<div style={{ display: 'flex', flexDirection: 'column', gap: '12px', maxWidth: '600px' }}><div style={{ display: 'flex', gap: '12px' }}>- <Button variant="primary">Primary</Button>- <Button variant="secondary">Secondary</Button>- <Button variant="ghost">Ghost</Button>- <Button variant="destructive">Destructive</Button>+ <XDSButton variant="primary">Primary</XDSButton>+ <XDSButton variant="secondary">Secondary</XDSButton>+ <XDSButton variant="ghost">Ghost</XDSButton>+ <XDSButton variant="destructive">Destructive</XDSButton></div><div style={{ display: 'flex', gap: '12px' }}>- <Button variant="primary" loading>Loading...</Button>- <Button variant="secondary" loading>Loading...</Button>- <Button variant="ghost" loading>Loading...</Button>- <Button variant="destructive" loading>Loading...</Button>+ <XDSButton variant="primary" loading>Loading...</XDSButton>+ <XDSButton variant="secondary" loading>Loading...</XDSButton>+ <XDSButton variant="ghost" loading>Loading...</XDSButton>+ <XDSButton variant="destructive" loading>Loading...</XDSButton></div><div style={{ display: 'flex', gap: '12px' }}>- <Button variant="primary" disabled>Disabled</Button>- <Button variant="secondary" disabled>Disabled</Button>- <Button variant="ghost" disabled>Disabled</Button>- <Button variant="destructive" disabled>Disabled</Button>+ <XDSButton variant="primary" disabled>Disabled</XDSButton>+ <XDSButton variant="secondary" disabled>Disabled</XDSButton>+ <XDSButton variant="ghost" disabled>Disabled</XDSButton>+ <XDSButton variant="destructive" disabled>Disabled</XDSButton></div></div>),diff --git a/packages/core/src/Button/README.md b/packages/core/src/Button/README.mdindex 3345ff678e..f6e0982a0f 100644--- a/packages/core/src/Button/README.md+++ b/packages/core/src/Button/README.md@@ -1,6 +1,6 @@# /packages/core/src/Button-Button component with multiple variants and loading state support.+XDSButton component with multiple variants and loading state support.<!-- SYNC: When files in this directory change, update this document. -->@@ -14,16 +14,16 @@ Button component with multiple variants and loading state support.## Usage```tsx-import { Button } from '@xds/core/Button';+import { XDSButton } from '@xds/core/Button';// Basic usage-<Button variant="primary">Click me</Button>+<XDSButton variant="primary">Click me</XDSButton>// With loading state-<Button variant="primary" loading>Saving...</Button>+<XDSButton variant="primary" loading>Saving...</XDSButton>// Destructive action-<Button variant="destructive">Delete</Button>+<XDSButton variant="destructive">Delete</XDSButton>```## Props@@ -39,12 +39,12 @@ import { Button } from '@xds/core/Button';| File | Role | Purpose ||------|------|---------|-| `index.ts` | Entry | Exports Button component and types |-| `Button.tsx` | Core | Button component implementation |-| `Button.test.tsx` | Test | Unit tests for Button component |+| `index.ts` | Entry | Exports XDSButton component and types |+| `XDSButton.tsx` | Core | XDSButton component implementation |+| `XDSButton.test.tsx` | Test | Unit tests for XDSButton component |## Implementation Notes-- `ButtonVariant` type is derived from the `variants` StyleX object using `keyof typeof variants`+- `XDSButtonVariant` type is derived from the `variants` StyleX object using `keyof typeof variants`- Hover/active states use `backgroundImage` with `linear-gradient` to layer overlay colors on top of the base background- Destructive variant uses `colorTokens.negative` for its focus outline colordiff --git a/packages/core/src/Button/Button.test.tsx b/packages/core/src/Button/XDSButton.test.tsxsimilarity index 63%rename from packages/core/src/Button/Button.test.tsxrename to packages/core/src/Button/XDSButton.test.tsxindex 5d03975ba1..89672cd231 100644--- a/packages/core/src/Button/Button.test.tsx+++ b/packages/core/src/Button/XDSButton.test.tsx@@ -1,39 +1,39 @@/**- * @file Button.test.tsx- * @input Uses vitest, @testing-library/react, Button component- * @output Unit tests for Button component behavior- * @position Testing; validates Button.tsx implementation+ * @file XDSButton.test.tsx+ * @input Uses vitest, @testing-library/react, XDSButton component+ * @output Unit tests for XDSButton component behavior+ * @position Testing; validates XDSButton.tsx implementation*- * SYNC: When Button.tsx changes, update tests to match new behavior+ * SYNC: When XDSButton.tsx changes, update tests to match new behavior*/import { describe, it, expect, vi } from 'vitest';import { render, screen } from '@testing-library/react';import userEvent from '@testing-library/user-event';-import { Button } from './Button';+import { XDSButton } from './XDSButton';-describe('Button', () => {+describe('XDSButton', () => {it('renders children correctly', () => {- render(<Button>Click me</Button>);+ render(<XDSButton>Click me</XDSButton>);expect(screen.getByRole('button', { name: 'Click me' })).toBeInTheDocument();});it('renders with different variants', () => {- const { rerender } = render(<Button variant="primary">Primary</Button>);+ const { rerender } = render(<XDSButton variant="primary">Primary</XDSButton>);expect(screen.getByRole('button')).toBeInTheDocument();- rerender(<Button variant="secondary">Secondary</Button>);+ rerender(<XDSButton variant="secondary">Secondary</XDSButton>);expect(screen.getByRole('button')).toBeInTheDocument();- rerender(<Button variant="ghost">Ghost</Button>);+ rerender(<XDSButton variant="ghost">Ghost</XDSButton>);expect(screen.getByRole('button')).toBeInTheDocument();- rerender(<Button variant="destructive">Destructive</Button>);+ rerender(<XDSButton variant="destructive">Destructive</XDSButton>);expect(screen.getByRole('button')).toBeInTheDocument();});it('shows loading state with spinner', () => {- render(<Button loading>Submit</Button>);+ render(<XDSButton loading>Submit</XDSButton>);const button = screen.getByRole('button');// Button should be disabled when loadingexpect(button).toBeDisabled();@@ -44,7 +44,7 @@ describe('Button', () => {it('handles click events', async () => {const user = userEvent.setup();const handleClick = vi.fn();- render(<Button onClick={handleClick}>Click me</Button>);+ render(<XDSButton onClick={handleClick}>Click me</XDSButton>);await user.click(screen.getByRole('button'));expect(handleClick).toHaveBeenCalledTimes(1);@@ -53,7 +53,7 @@ describe('Button', () => {it('does not fire click when disabled', async () => {const user = userEvent.setup();const handleClick = vi.fn();- render(<Button disabled onClick={handleClick}>Click me</Button>);+ render(<XDSButton disabled onClick={handleClick}>Click me</XDSButton>);await user.click(screen.getByRole('button'));expect(handleClick).not.toHaveBeenCalled();@@ -62,7 +62,7 @@ describe('Button', () => {it('does not fire click when loading', async () => {const user = userEvent.setup();const handleClick = vi.fn();- render(<Button loading onClick={handleClick}>Click me</Button>);+ render(<XDSButton loading onClick={handleClick}>Click me</XDSButton>);await user.click(screen.getByRole('button'));expect(handleClick).not.toHaveBeenCalled();@@ -70,7 +70,7 @@ describe('Button', () => {it('forwards ref correctly', () => {const ref = vi.fn();- render(<Button ref={ref}>Test</Button>);+ render(<XDSButton ref={ref}>Test</XDSButton>);expect(ref).toHaveBeenCalledWith(expect.any(HTMLButtonElement));});});diff --git a/packages/core/src/Button/Button.tsx b/packages/core/src/Button/XDSButton.tsxsimilarity index 90%rename from packages/core/src/Button/Button.tsxrename to packages/core/src/Button/XDSButton.tsxindex 463322b8df..7e7d4dcb0b 100644--- a/packages/core/src/Button/Button.tsx+++ b/packages/core/src/Button/XDSButton.tsx@@ -1,12 +1,12 @@/**- * @file Button.tsx+ * @file XDSButton.tsx* @input Uses React forwardRef, ButtonHTMLAttributes, ReactNode- * @output Exports Button component, ButtonProps, ButtonVariant types- * @position Core implementation; consumed by index.ts, tested by Button.test.tsx+ * @output Exports XDSButton component, XDSButtonProps, XDSButtonVariant types+ * @position Core implementation; consumed by index.ts, tested by XDSButton.test.tsx** SYNC: When modified, update these files to stay in sync:* - /packages/core/src/Button/README.md (props table, features, implementation notes)- * - /packages/core/src/Button/Button.test.tsx (tests for new/changed behavior)+ * - /packages/core/src/Button/XDSButton.test.tsx (tests for new/changed behavior)* - /packages/core/src/Button/index.ts (exports if types change)* - /apps/storybook/stories/Button.stories.tsx (storybook stories)*/@@ -141,7 +141,7 @@ const variants = stylex.create({/*** Button variant type derived from the variants StyleX object*/-export type ButtonVariant = keyof typeof variants;+export type XDSButtonVariant = keyof typeof variants;// =============================================================================// Module Augmentation - Register Button's variant type with ComponentStyles@@ -152,17 +152,17 @@ export type ButtonVariant = keyof typeof variants;declare module '../theme/types' {interface ComponentStyles {button?: {- variants?: Partial<Record<ButtonVariant, StyleXStyles>>;+ variants?: Partial<Record<XDSButtonVariant, StyleXStyles>>;};}}-export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {+export interface XDSButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {/*** The visual style variant of the button.* @default 'primary'*/- variant?: ButtonVariant;+ variant?: XDSButtonVariant;/*** Whether the button is in a loading state.* @default false@@ -221,12 +221,12 @@ const loadingStyles = stylex.create({** @example* ```tsx- * <Button variant="primary">Click me</Button>- * <Button variant="secondary" loading>Saving...</Button>- * <Button variant="destructive">Delete</Button>+ * <XDSButton variant="primary">Click me</XDSButton>+ * <XDSButton variant="secondary" loading>Saving...</XDSButton>+ * <XDSButton variant="destructive">Delete</XDSButton>* ```*/-export const Button = forwardRef<HTMLButtonElement, ButtonProps>(+export const XDSButton = forwardRef<HTMLButtonElement, XDSButtonProps>(({ variant = 'primary', loading = false, disabled, children, ...props }, ref) => {const isDisabled = disabled || loading;const useLightSpinner = variant === 'primary' || variant === 'destructive';@@ -262,4 +262,4 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(});-Button.displayName = 'Button';+XDSButton.displayName = 'XDSButton';diff --git a/packages/core/src/Button/index.ts b/packages/core/src/Button/index.tsindex 91663463e8..396f571b48 100644--- a/packages/core/src/Button/index.ts+++ b/packages/core/src/Button/index.ts@@ -1,11 +1,11 @@/*** @file index.ts- * @input Imports Button component and types from Button.tsx- * @output Exports Button, ButtonProps, ButtonVariant+ * @input Imports XDSButton component and types from XDSButton.tsx+ * @output Exports XDSButton, XDSButtonProps, XDSButtonVariant* @position Component entry point; re-exported by /packages/core/src/index.ts** SYNC: When modified, update this header and /packages/core/src/Button/README.md*/-export { Button } from './Button';-export type { ButtonProps, ButtonVariant } from './Button';+export { XDSButton } from './XDSButton';+export type { XDSButtonProps, XDSButtonVariant } from './XDSButton';