Skip to content

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

TypeScript

Fix lint (#74)

Andrey Goder3162da30ad1f
diff --git a/.prettierrc.json b/.prettierrc.json
index d8ee628a4a..7bd3f6a770 100644
--- a/.prettierrc.json
+++ b/.prettierrc.json
@@ -2,5 +2,6 @@
"arrowParens": "avoid",
"bracketSameLine": true,
"bracketSpacing": false,
+ "trailingComma": "all",
"singleQuote": true
}
diff --git a/apps/storybook/stories/Switch.stories.tsx b/apps/storybook/stories/Switch.stories.tsx
index 1f91966636..139ff1266b 100644
--- a/apps/storybook/stories/Switch.stories.tsx
+++ b/apps/storybook/stories/Switch.stories.tsx
@@ -61,7 +61,7 @@ type Story = StoryObj<typeof XDSSwitch>;
export const Default: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? false);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<XDSSwitch
{...restArgs}
@@ -78,7 +78,7 @@ export const Default: Story = {
export const On: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? true);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<XDSSwitch
{...restArgs}
@@ -96,7 +96,7 @@ export const On: Story = {
export const WithDescription: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? false);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<XDSSwitch
{...restArgs}
@@ -114,7 +114,7 @@ export const WithDescription: Story = {
export const WithHiddenLabel: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? false);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<XDSSwitch
{...restArgs}
@@ -132,7 +132,7 @@ export const WithHiddenLabel: Story = {
export const Disabled: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? false);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<XDSSwitch
{...restArgs}
@@ -151,7 +151,7 @@ export const Disabled: Story = {
export const DisabledOn: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? true);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<XDSSwitch
{...restArgs}
@@ -170,7 +170,7 @@ export const DisabledOn: Story = {
export const Required: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? false);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<XDSSwitch
{...restArgs}
@@ -188,7 +188,7 @@ export const Required: Story = {
export const Optional: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? false);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<XDSSwitch
{...restArgs}
@@ -206,7 +206,7 @@ export const Optional: Story = {
export const WithLabelIcon: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? false);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<XDSSwitch
{...restArgs}
@@ -225,7 +225,7 @@ export const WithLabelIcon: Story = {
export const WithLabelTooltip: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? false);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<XDSSwitch
{...restArgs}
@@ -244,7 +244,7 @@ export const WithLabelTooltip: Story = {
export const LabelPositionStart: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? false);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<XDSSwitch
{...restArgs}
@@ -263,7 +263,7 @@ export const LabelPositionStart: Story = {
export const LabelSpacingSpread: Story = {
render: args => {
const [value, setValue] = useState(args.value ?? false);
- const {value: _, onChange: __, ...restArgs} = args;
+ const {value: _value, onChange: _onChange, ...restArgs} = args;
return (
<div style={{width: 300, border: '1px solid #ccc', padding: 16}}>
<XDSSwitch
diff --git a/package.json b/package.json
index 7bc7e63f88..2364691c3c 100644
--- a/package.json
+++ b/package.json
@@ -47,6 +47,9 @@
"typescript-eslint": "^8.53.1",
"vitest": "^2.1.0"
},
+ "resolutions": {
+ "prettier": "^3.4.0"
+ },
"packageManager": "[email protected]",
"lint-staged": {
"*.{ts,tsx}": "eslint --cache --fix",
diff --git a/packages/agent-tools/bin/agents-md.mjs b/packages/agent-tools/bin/agents-md.mjs
index ea546ab25b..1b79b7611d 100755
--- a/packages/agent-tools/bin/agents-md.mjs
+++ b/packages/agent-tools/bin/agents-md.mjs
@@ -12,7 +12,7 @@
import * as fs from 'node:fs';
import * as path from 'node:path';
-import { fileURLToPath } from 'node:url';
+import {fileURLToPath} from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const STATIC_DOCS = path.resolve(__dirname, '..', 'docs');
@@ -101,7 +101,7 @@ function findComponentReadmes(coreDir) {
return readmes;
}
- const entries = fs.readdirSync(srcDir, { withFileTypes: true });
+ const entries = fs.readdirSync(srcDir, {withFileTypes: true});
for (const entry of entries) {
if (entry.isDirectory()) {
@@ -115,7 +115,7 @@ function findComponentReadmes(coreDir) {
// Check for nested components (e.g., Layout/XDSLayout)
const nestedDir = path.join(srcDir, entry.name);
- const nestedEntries = fs.readdirSync(nestedDir, { withFileTypes: true });
+ const nestedEntries = fs.readdirSync(nestedDir, {withFileTypes: true});
for (const nested of nestedEntries) {
if (nested.isDirectory()) {
const nestedReadme = path.join(nestedDir, nested.name, 'README.md');
@@ -143,17 +143,24 @@ function discoverComponents(coreDir) {
const layoutComponents = new Set();
// Layout-related directory names
- const LAYOUT_DIRS = ['Layout', 'Grid', 'Center', 'Divider', 'AspectRatio', 'Section'];
+ const LAYOUT_DIRS = [
+ 'Layout',
+ 'Grid',
+ 'Center',
+ 'Divider',
+ 'AspectRatio',
+ 'Section',
+ ];
if (!fs.existsSync(srcDir)) {
- return { components: [], layout: [] };
+ return {components: [], layout: []};
}
/**
* Recursively scan a directory for XDS*.tsx files
*/
function scanDir(dirPath, isLayoutContext) {
- const entries = fs.readdirSync(dirPath, { withFileTypes: true });
+ const entries = fs.readdirSync(dirPath, {withFileTypes: true});
for (const entry of entries) {
const fullPath = path.join(dirPath, entry.name);
@@ -176,7 +183,7 @@ function discoverComponents(coreDir) {
}
}
- const entries = fs.readdirSync(srcDir, { withFileTypes: true });
+ const entries = fs.readdirSync(srcDir, {withFileTypes: true});
for (const entry of entries) {
if (!entry.isDirectory()) continue;
@@ -200,13 +207,15 @@ function discoverComponents(coreDir) {
*/
function generateCompressedIndex(version, discoveredComponents) {
// Use discovered components if available, otherwise use defaults
- const componentList = discoveredComponents?.components?.length > 0
- ? discoveredComponents.components.join('|')
- : 'Button|TextInput|TextArea|CheckboxInput|Field|Layout|Layer|Avatar|Skeleton|Text|Icon';
+ const componentList =
+ discoveredComponents?.components?.length > 0
+ ? discoveredComponents.components.join('|')
+ : 'Button|TextInput|TextArea|CheckboxInput|Field|Layout|Layer|Avatar|Skeleton|Text|Icon';
- const layoutList = discoveredComponents?.layout?.length > 0
- ? discoveredComponents.layout.join('|')
- : 'XDSLayout|XDSLayoutHeader|XDSLayoutContent|XDSLayoutPanel|XDSHStack|XDSVStack|XDSCard';
+ const layoutList =
+ discoveredComponents?.layout?.length > 0
+ ? discoveredComponents.layout.join('|')
+ : 'XDSLayout|XDSLayoutHeader|XDSLayoutContent|XDSLayoutPanel|XDSHStack|XDSVStack|XDSCard';
return `${XDS_MARKER_START}
[XDS Component Library v${version}]|root: ./${XDS_DOCS_DIR}
@@ -270,7 +279,7 @@ function installDocs(targetDir) {
// Create directory if it doesn't exist
if (!fs.existsSync(docsDir)) {
- fs.mkdirSync(docsDir, { recursive: true });
+ fs.mkdirSync(docsDir, {recursive: true});
}
let extracted = 0;
@@ -283,7 +292,7 @@ function installDocs(targetDir) {
// Extract from component READMEs
const readmes = findComponentReadmes(coreDir);
- for (const { name, path: readmePath } of readmes) {
+ for (const {name, path: readmePath} of readmes) {
const content = fs.readFileSync(readmePath, 'utf-8');
const extracted_content = extractEssentialSections(content, name);
// Capitalize first letter for file name (e.g., "theme" -> "Theme.md")
@@ -322,7 +331,10 @@ function installDocs(targetDir) {
*/
function injectAgentsMd(targetDir, version, discoveredComponents) {
const agentsPath = path.join(targetDir, AGENTS_MD);
- const compressedIndex = generateCompressedIndex(version, discoveredComponents);
+ const compressedIndex = generateCompressedIndex(
+ version,
+ discoveredComponents,
+ );
let content = '';
@@ -335,7 +347,10 @@ function injectAgentsMd(targetDir, version, discoveredComponents) {
if (startIdx !== -1 && endIdx !== -1) {
// Replace existing section
- content = content.slice(0, startIdx) + compressedIndex + content.slice(endIdx + XDS_MARKER_END.length);
+ content =
+ content.slice(0, startIdx) +
+ compressedIndex +
+ content.slice(endIdx + XDS_MARKER_END.length);
} else {
// Append to end
content = content.trimEnd() + '\n\n' + compressedIndex + '\n';
@@ -362,7 +377,7 @@ function removeXdsDocs(targetDir) {
// Remove docs directory
if (fs.existsSync(docsDir)) {
- fs.rmSync(docsDir, { recursive: true });
+ fs.rmSync(docsDir, {recursive: true});
console.log(`✓ Removed ${XDS_DOCS_DIR}/`);
}
@@ -457,7 +472,9 @@ if (args.includes('--remove')) {
// Discover components dynamically
const discoveredComponents = coreDir ? discoverComponents(coreDir) : null;
if (discoveredComponents) {
- console.log(`✓ Discovered ${discoveredComponents.layout.length} layout + ${discoveredComponents.components.length} other components`);
+ console.log(
+ `✓ Discovered ${discoveredComponents.layout.length} layout + ${discoveredComponents.components.length} other components`,
+ );
}
injectAgentsMd(targetDir, version, discoveredComponents);
diff --git a/packages/agent-tools/bin/ai-skill.mjs b/packages/agent-tools/bin/ai-skill.mjs
index 1d49d0c6a7..fb71f6d35b 100755
--- a/packages/agent-tools/bin/ai-skill.mjs
+++ b/packages/agent-tools/bin/ai-skill.mjs
@@ -10,7 +10,7 @@
import * as fs from 'node:fs';
import * as path from 'node:path';
-import { fileURLToPath } from 'node:url';
+import {fileURLToPath} from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const docsDir = path.resolve(__dirname, '..', 'docs');
@@ -43,7 +43,10 @@ if (args.includes('--path')) {
console.log('Available docs:');
files.forEach(f => console.log(` ${f}`));
} else if (args.includes('--all')) {
- const files = fs.readdirSync(docsDir).filter(f => f.endsWith('.md')).sort();
+ const files = fs
+ .readdirSync(docsDir)
+ .filter(f => f.endsWith('.md'))
+ .sort();
for (const file of files) {
const content = fs.readFileSync(path.join(docsDir, file), 'utf-8');
console.log(`\n${'='.repeat(60)}\n${file}\n${'='.repeat(60)}\n`);
diff --git a/packages/core/src/Badge/README.md b/packages/core/src/Badge/README.md
index 8307ad7ebf..ed36b931ec 100644
--- a/packages/core/src/Badge/README.md
+++ b/packages/core/src/Badge/README.md
@@ -4,19 +4,19 @@ A badge component for displaying status indicators, counts, or labels.
## Exports
-| Export | Type | Description |
-|--------|------|-------------|
-| `XDSBadge` | Component | Main badge component |
-| `XDSBadgeProps` | Type | Props interface |
-| `XDSBadgeVariant` | Type | Variant union type |
+| Export | Type | Description |
+| ----------------- | --------- | -------------------- |
+| `XDSBadge` | Component | Main badge component |
+| `XDSBadgeProps` | Type | Props interface |
+| `XDSBadgeVariant` | Type | Variant union type |
## Props
-| Prop | Type | Default | Description |
-|------|------|---------|-------------|
-| `variant` | `'neutral' \| 'info' \| 'success' \| 'warning' \| 'error'` | `'neutral'` | Visual style variant |
-| `children` | `ReactNode` | - | Badge content. Omit for dot indicator |
-| `icon` | `ReactNode` | - | Optional leading icon |
+| Prop | Type | Default | Description |
+| ---------- | ---------------------------------------------------------- | ----------- | ------------------------------------- |
+| `variant` | `'neutral' \| 'info' \| 'success' \| 'warning' \| 'error'` | `'neutral'` | Visual style variant |
+| `children` | `ReactNode` | - | Badge content. Omit for dot indicator |
+| `icon` | `ReactNode` | - | Optional leading icon |
## Usage
@@ -40,8 +40,8 @@ import {XDSBadge} from '@xds/core/Badge';
## Files
-| File | Purpose |
-|------|---------|
-| `XDSBadge.tsx` | Component implementation |
-| `XDSBadge.test.tsx` | Unit tests |
-| `index.ts` | Barrel exports |
+| File | Purpose |
+| ------------------- | ------------------------ |
+| `XDSBadge.tsx` | Component implementation |
+| `XDSBadge.test.tsx` | Unit tests |
+| `index.ts` | Barrel exports |
diff --git a/packages/core/src/Badge/XDSBadge.test-violations.tsx b/packages/core/src/Badge/XDSBadge.test-violations.tsx
index 5a704d39fe..70ba6061d9 100644
--- a/packages/core/src/Badge/XDSBadge.test-violations.tsx
+++ b/packages/core/src/Badge/XDSBadge.test-violations.tsx
@@ -59,4 +59,4 @@ const badStyles = stylex.create({
},
});
-export { badStyles };
+export {badStyles};
diff --git a/packages/core/src/Badge/XDSBadge.test.tsx b/packages/core/src/Badge/XDSBadge.test.tsx
index f65d73b6bd..9f09a7da91 100644
--- a/packages/core/src/Badge/XDSBadge.test.tsx
+++ b/packages/core/src/Badge/XDSBadge.test.tsx
@@ -31,9 +31,7 @@ describe('XDSBadge', () => {
it('renders with icon', () => {
render(
- <XDSBadge icon={<span data-testid="icon">*</span>}>
- With Icon
- </XDSBadge>
+ <XDSBadge icon={<span data-testid="icon">*</span>}>With Icon</XDSBadge>,
);
expect(screen.getByTestId('icon')).toBeInTheDocument();
expect(screen.getByText('With Icon')).toBeInTheDocument();
diff --git a/packages/core/src/Badge/XDSBadge.tsx b/packages/core/src/Badge/XDSBadge.tsx
index 41bf478884..8bf7d03ad7 100644
--- a/packages/core/src/Badge/XDSBadge.tsx
+++ b/packages/core/src/Badge/XDSBadge.tsx
@@ -116,11 +116,7 @@ export const XDSBadge = forwardRef<HTMLSpanElement, XDSBadgeProps>(
return (
<span
ref={ref}
- {...stylex.props(
- styles.base,
- variants[variant],
- isDot && styles.dot,
- )}
+ {...stylex.props(styles.base, variants[variant], isDot && styles.dot)}
{...props}>
{icon}
{children}
diff --git a/packages/core/src/CheckboxInput/README.md b/packages/core/src/CheckboxInput/README.md
index 5a019964c6..2148b97dcb 100644
--- a/packages/core/src/CheckboxInput/README.md
+++ b/packages/core/src/CheckboxInput/README.md
@@ -59,22 +59,22 @@ import { XDSCheckboxInput } from '@xds/core/CheckboxInput';
## Props
-| Prop | Type | Default | Description |
-|------|------|---------|-------------|
-| `label` | `string` | — | Label text for the checkbox (always rendered for accessibility) |
-| `isLabelHidden` | `boolean` | `false` | Whether to visually hide the label |
-| `description` | `string` | — | Description text displayed below the label |
-| `value` | `boolean \| 'indeterminate'` | — | Whether the checkbox is checked, unchecked, or indeterminate |
-| `onChange` | `(checked: boolean, e: ChangeEvent) => void` | — | Callback fired when the checkbox state changes |
-| `isDisabled` | `boolean` | `false` | Whether the checkbox is disabled |
+| Prop | Type | Default | Description |
+| --------------- | -------------------------------------------- | ------- | --------------------------------------------------------------- |
+| `label` | `string` | — | Label text for the checkbox (always rendered for accessibility) |
+| `isLabelHidden` | `boolean` | `false` | Whether to visually hide the label |
+| `description` | `string` | — | Description text displayed below the label |
+| `value` | `boolean \| 'indeterminate'` | — | Whether the checkbox is checked, unchecked, or indeterminate |
+| `onChange` | `(checked: boolean, e: ChangeEvent) => void` | — | Callback fired when the checkbox state changes |
+| `isDisabled` | `boolean` | `false` | Whether the checkbox is disabled |
## Files
-| File | Role | Purpose |
-|------|------|---------|
-| `index.ts` | Entry | Exports component and types |
-| `XDSCheckboxInput.tsx` | Core | Component implementation |
-| `XDSCheckboxInput.test.tsx` | Test | Unit tests |
+| File | Role | Purpose |
+| --------------------------- | ----- | --------------------------- |
+| `index.ts` | Entry | Exports component and types |
+| `XDSCheckboxInput.tsx` | Core | Component implementation |
+| `XDSCheckboxInput.test.tsx` | Test | Unit tests |
## Implementation Notes
diff --git a/packages/core/src/DateInput/XDSDateInput.test.tsx b/packages/core/src/DateInput/XDSDateInput.test.tsx
index 1dc6746423..839306c3c4 100644
--- a/packages/core/src/DateInput/XDSDateInput.test.tsx
+++ b/packages/core/src/DateInput/XDSDateInput.test.tsx
@@ -9,7 +9,6 @@
import {describe, it, expect, vi} from 'vitest';
import {render, screen, fireEvent} from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
import {XDSDateInput} from './XDSDateInput';
describe('XDSDateInput', () => {
diff --git a/packages/core/src/Field/XDSField.test.tsx b/packages/core/src/Field/XDSField.test.tsx
index de0ea87d38..1e60319759 100644
--- a/packages/core/src/Field/XDSField.test.tsx
+++ b/packages/core/src/Field/XDSField.test.tsx
@@ -16,7 +16,7 @@ describe('XDSField', () => {
render(
<XDSField label="Email" inputID="email-input">
<input id="email-input" />
- </XDSField>
+ </XDSField>,
);
expect(screen.getByLabelText('Email')).toBeInTheDocument();
});
@@ -29,10 +29,10 @@ describe('XDSField', () => {
description="We'll never share your email"
descriptionID="email-desc">
<input id="email-input" aria-describedby="email-desc" />
- </XDSField>
+ </XDSField>,
);
expect(
- screen.getByText("We'll never share your email")
+ screen.getByText("We'll never share your email"),
).toBeInTheDocument();
});
@@ -44,7 +44,7 @@ describe('XDSField', () => {
description="Description text"
descriptionID="email-desc">
<input id="email-input" aria-describedby="email-desc" />
- </XDSField>
+ </XDSField>,
);
const description = screen.getByText('Description text');
expect(description).toHaveAttribute('id', 'email-desc');
@@ -54,7 +54,7 @@ describe('XDSField', () => {
render(
<XDSField label="Search" isLabelHidden inputID="search-input">
<input id="search-input" />
- </XDSField>
+ </XDSField>,
);
const label = screen.getByText('Search');
expect(label).toBeInTheDocument();
@@ -66,7 +66,7 @@ describe('XDSField', () => {
render(
<XDSField label="Email" inputID="email-input">
<input id="email-input" />
- </XDSField>
+ </XDSField>,
);
const label = screen.getByText('Email');
expect(label).toBeVisible();
@@ -77,7 +77,7 @@ describe('XDSField', () => {
render(
<XDSField ref={ref} label="Name" inputID="name-input">
<input id="name-input" />
- </XDSField>
+ </XDSField>,
);
expect(ref).toHaveBeenCalledWith(expect.any(HTMLDivElement));
});
@@ -89,7 +89,7 @@ describe('XDSField', () => {
inputID="email-input"
description="Description text">
<input id="email-input" />
- </XDSField>
+ </XDSField>,
);
const description = screen.getByText('Description text');
expect(description).toBeInTheDocument();
@@ -100,7 +100,7 @@ describe('XDSField', () => {
render(
<XDSField label="Name" inputID="name-input" isOptional>
<input id="name-input" />
- </XDSField>
+ </XDSField>,
);
expect(screen.getByText('Name')).toBeInTheDocument();
expect(screen.getByText(/Optional/)).toBeInTheDocument();
@@ -110,7 +110,7 @@ describe('XDSField', () => {
render(
<XDSField label="Name" inputID="name-input" isRequired>
<input id="name-input" />
- </XDSField>
+ </XDSField>,
);
expect(screen.getByText('Name')).toBeInTheDocument();
expect(screen.getByText(/Required/)).toBeInTheDocument();
@@ -125,7 +125,7 @@ describe('XDSField', () => {
descriptionID="name-desc"
isOptional>
<input id="name-input" aria-describedby="name-desc" />
- </XDSField>
+ </XDSField>,
);
expect(screen.getByText('Enter your name')).toBeInTheDocument();
expect(screen.getByText(/Optional/)).toBeInTheDocument();
@@ -140,7 +140,7 @@ describe('XDSField', () => {
descriptionID="name-desc"
isRequired>
<input id="name-input" aria-describedby="name-desc" />
- </XDSField>
+ </XDSField>,
);
expect(screen.getByText('This field is mandatory')).toBeInTheDocument();
expect(screen.getByText(/Required/)).toBeInTheDocument();
@@ -150,7 +150,7 @@ describe('XDSField', () => {
render(
<XDSField label="Name" inputID="name-input" isOptional>
<input id="name-input" />
- </XDSField>
+ </XDSField>,
);
expect(screen.getByText('Name')).toBeInTheDocument();
expect(screen.getByText(/∙.*Optional/)).toBeInTheDocument();
@@ -160,7 +160,7 @@ describe('XDSField', () => {
render(
<XDSField label="Help" inputID="help-input" labelTooltip="Helpful info">
<input id="help-input" />
- </XDSField>
+ </XDSField>,
);
// Info icon should be present
expect(document.querySelector('svg')).toBeInTheDocument();
@@ -170,7 +170,7 @@ describe('XDSField', () => {
render(
<XDSField label="Name" inputID="name-input">
<input id="name-input" />
- </XDSField>
+ </XDSField>,
);
expect(document.querySelector('svg')).not.toBeInTheDocument();
});
diff --git a/packages/core/src/Field/XDSField.tsx b/packages/core/src/Field/XDSField.tsx
index a05748d48d..5811e27bce 100644
--- a/packages/core/src/Field/XDSField.tsx
+++ b/packages/core/src/Field/XDSField.tsx
@@ -115,8 +115,10 @@ export interface XDSFieldStatus {
messageID?: string;
}
-export interface XDSFieldProps
- extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
+export interface XDSFieldProps extends Omit<
+ HTMLAttributes<HTMLDivElement>,
+ 'children'
+> {
/**
* Label text for the field (always rendered for accessibility).
*/
@@ -195,7 +197,7 @@ export const XDSField = forwardRef<HTMLDivElement, XDSFieldProps>(
children,
...props
},
- ref
+ ref,
) => {
return (
<div ref={ref} {...stylex.props(styles.container)} {...props}>
@@ -220,7 +222,7 @@ export const XDSField = forwardRef<HTMLDivElement, XDSFieldProps>(
id={status.messageID}
{...stylex.props(
styles.statusMessage,
- statusMessageColorStyles[status.type]
+ statusMessageColorStyles[status.type],
)}>
{status.message}
</div>
@@ -228,7 +230,7 @@ export const XDSField = forwardRef<HTMLDivElement, XDSFieldProps>(
</div>
</div>
);
- }
+ },
);
XDSField.displayName = 'XDSField';
diff --git a/packages/core/src/Field/XDSFieldLabel.test.tsx b/packages/core/src/Field/XDSFieldLabel.test.tsx
index 0bed53cab6..0b9d2cd453 100644
--- a/packages/core/src/Field/XDSFieldLabel.test.tsx
+++ b/packages/core/src/Field/XDSFieldLabel.test.tsx
@@ -36,7 +36,7 @@ describe('XDSFieldLabel', () => {
it('shows Optional when both isOptional and isRequired are true', () => {
render(
- <XDSFieldLabel label="Name" inputID="name-input" isOptional isRequired />
+ <XDSFieldLabel label="Name" inputID="name-input" isOptional isRequired />,
);
expect(screen.getByText(/Optional/)).toBeInTheDocument();
expect(screen.queryByText(/Required/)).not.toBeInTheDocument();
@@ -48,7 +48,7 @@ describe('XDSFieldLabel', () => {
label="Starred"
inputID="starred-input"
startIcon={StarIcon}
- />
+ />,
);
const svg = document.querySelector('svg');
expect(svg).toBeInTheDocument();
@@ -66,7 +66,7 @@ describe('XDSFieldLabel', () => {
label="Help"
inputID="help-input"
tooltip="This is helpful information"
- />
+ />,
);
// Two SVGs: the info icon is wrapped in tooltip
const svgs = document.querySelectorAll('svg');
@@ -86,7 +86,7 @@ describe('XDSFieldLabel', () => {
inputID="field-input"
isOptional
tooltip="Help text"
- />
+ />,
);
expect(screen.getByText(/Optional/)).toBeInTheDocument();
// Info icon should be present
diff --git a/packages/core/src/Field/XDSFieldLabel.tsx b/packages/core/src/Field/XDSFieldLabel.tsx
index 2965ae2a4a..88f295c5d3 100644
--- a/packages/core/src/Field/XDSFieldLabel.tsx
+++ b/packages/core/src/Field/XDSFieldLabel.tsx
@@ -115,7 +115,7 @@ export const XDSFieldLabel = forwardRef<HTMLLabelElement, XDSFieldLabelProps>(
startIcon,
tooltip,
},
- ref
+ ref,
) => {
const statusText = isOptional ? 'Optional' : isRequired ? 'Required' : null;
@@ -127,7 +127,7 @@ export const XDSFieldLabel = forwardRef<HTMLLabelElement, XDSFieldLabelProps>(
styles.label,
!isDisabled && styles.labelClickable,
isDisabled && styles.labelDisabled,
- isLabelHidden && styles.labelHidden
+ isLabelHidden && styles.labelHidden,
)}>
{startIcon && (
<XDSIcon
@@ -154,7 +154,7 @@ export const XDSFieldLabel = forwardRef<HTMLLabelElement, XDSFieldLabelProps>(
)}
</label>
);
- }
+ },
);
XDSFieldLabel.displayName = 'XDSFieldLabel';
diff --git a/packages/core/src/Icon/XDSIcon.test.tsx b/packages/core/src/Icon/XDSIcon.test.tsx
index e54cb24316..aaff4f669c 100644
--- a/packages/core/src/Icon/XDSIcon.test.tsx
+++ b/packages/core/src/Icon/XDSIcon.test.tsx
@@ -31,7 +31,7 @@ describe('XDSIcon', () => {
it('renders with different color variants', () => {
const {rerender} = render(
- <XDSIcon icon={HomeIcon} color="primary" data-testid="icon" />
+ <XDSIcon icon={HomeIcon} color="primary" data-testid="icon" />,
);
expect(screen.getByTestId('icon')).toBeInTheDocument();
@@ -56,7 +56,7 @@ describe('XDSIcon', () => {
it('renders with different size variants', () => {
const {rerender} = render(
- <XDSIcon icon={HomeIcon} size="xsm" data-testid="icon" />
+ <XDSIcon icon={HomeIcon} size="xsm" data-testid="icon" />,
);
expect(screen.getByTestId('icon')).toBeInTheDocument();
@@ -83,7 +83,7 @@ describe('XDSIcon', () => {
data-testid="icon"
role="img"
aria-label="Home"
- />
+ />,
);
const icon = screen.getByTestId('icon');
expect(icon).toHaveAttribute('role', 'img');
diff --git a/packages/core/src/Icon/XDSIcon.tsx b/packages/core/src/Icon/XDSIcon.tsx
index 6df05f6996..550b17a2ad 100644
--- a/packages/core/src/Icon/XDSIcon.tsx
+++ b/packages/core/src/Icon/XDSIcon.tsx
@@ -91,8 +91,10 @@ export type XDSIconType = ComponentType<SVGProps<SVGSVGElement>>;
* Props for XDSIcon component.
* Extends SVGProps to allow passing additional SVG attributes.
*/
-export interface XDSIconProps
- extends Omit<SVGProps<SVGSVGElement>, 'ref' | 'color'> {
+export interface XDSIconProps extends Omit<
+ SVGProps<SVGSVGElement>,
+ 'ref' | 'color'
+> {
/**
* The Hero Icon component to render.
* Import from @heroicons/react/24/outline or @heroicons/react/24/solid.
@@ -128,7 +130,7 @@ export const XDSIcon = forwardRef<SVGSVGElement, XDSIconProps>(
{...props}
/>
);
- }
+ },
);
XDSIcon.displayName = 'XDSIcon';
diff --git a/packages/core/src/Layer/useXDSHoverCard.tsx b/packages/core/src/Layer/useXDSHoverCard.tsx
index 255669d3e9..0f071e586a 100644
--- a/packages/core/src/Layer/useXDSHoverCard.tsx
+++ b/packages/core/src/Layer/useXDSHoverCard.tsx
@@ -18,7 +18,6 @@ import {
type RefCallback,
} from 'react';
import * as stylex from '@stylexjs/stylex';
-import type {StyleXStyles} from '../theme/types';
import {ThemeContext} from '../theme/ThemeContext';
import {
useXDSLayer,
diff --git a/packages/core/src/Layer/useXDSTooltip.tsx b/packages/core/src/Layer/useXDSTooltip.tsx
index 3477da576b..c0a3ecb0cd 100644
--- a/packages/core/src/Layer/useXDSTooltip.tsx
+++ b/packages/core/src/Layer/useXDSTooltip.tsx
@@ -18,7 +18,6 @@ import {
type RefCallback,
} from 'react';
import * as stylex from '@stylexjs/stylex';
-import type {StyleXStyles} from '../theme/types';
import {ThemeContext} from '../theme/ThemeContext';
import {
useXDSLayer,
diff --git a/packages/core/src/Layout/Container/XDSCard.tsx b/packages/core/src/Layout/Container/XDSCard.tsx
index b6dd96892a..0187571a72 100644
--- a/packages/core/src/Layout/Container/XDSCard.tsx
+++ b/packages/core/src/Layout/Container/XDSCard.tsx
@@ -7,11 +7,7 @@
import {forwardRef, useContext, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
-import {
- colorVars,
- radiusVars,
- elevationVars,
-} from '../../theme/tokens.stylex';
+import {colorVars, radiusVars, elevationVars} from '../../theme/tokens.stylex';
import {ThemeContext} from '../../theme/ThemeContext';
import type {StyleXStyles as ThemeStyleXStyles} from '../../theme/types';
import {container} from './container.stylex';
@@ -140,7 +136,15 @@ export interface XDSCardProps {
*/
export const XDSCard = forwardRef<HTMLDivElement, XDSCardProps>(
function XDSCard(
- {width, height, maxWidth, minHeight, children, isFullBleed = false, ...props},
+ {
+ width,
+ height,
+ maxWidth,
+ minHeight,
+ children,
+ isFullBleed = false,
+ ...props
+ },
ref,
) {
// Get theme context for component-level overrides
diff --git a/packages/core/src/Layout/Container/XDSSection.tsx b/packages/core/src/Layout/Container/XDSSection.tsx
index 432d075ee8..249b103db1 100644
--- a/packages/core/src/Layout/Container/XDSSection.tsx
+++ b/packages/core/src/Layout/Container/XDSSection.tsx
@@ -208,7 +208,8 @@ export const XDSSection = forwardRef<HTMLDivElement, XDSSectionProps>(
) {
// Get theme context for component-level overrides
const themeContext = useContext(ThemeContext);
- const containerOverride = themeContext?.theme.components?.section?.container;
+ const containerOverride =
+ themeContext?.theme.components?.section?.container;
const contentOverride = themeContext?.theme.components?.section?.content;
const variantOverride =
themeContext?.theme.components?.section?.variants?.[variant];
diff --git a/packages/core/src/Selector/XDSSelector.tsx b/packages/core/src/Selector/XDSSelector.tsx
index 4d1b499389..51a660751a 100644
--- a/packages/core/src/Selector/XDSSelector.tsx
+++ b/packages/core/src/Selector/XDSSelector.tsx
@@ -422,7 +422,7 @@ export function XDSSelector<T extends XDSSelectorOption>({
// Selector behavior (keyboard nav, typeahead, selection)
const {
highlightedIndex,
- setHighlightedIndex: _,
+ setHighlightedIndex: _setHighlightedIndex,
getItemId,
onTriggerClick,
onKeyDown,
diff --git a/packages/core/src/Switch/XDSSwitch.test.tsx b/packages/core/src/Switch/XDSSwitch.test.tsx
index 6af2c3e55f..46cfbf59b5 100644
--- a/packages/core/src/Switch/XDSSwitch.test.tsx
+++ b/packages/core/src/Switch/XDSSwitch.test.tsx
@@ -19,7 +19,7 @@ describe('XDSSwitch', () => {
label="Enable notifications"
value={false}
onChange={() => {}}
- />
+ />,
);
expect(screen.getByLabelText('Enable notifications')).toBeInTheDocument();
});
@@ -30,7 +30,7 @@ describe('XDSSwitch', () => {
label="Enable notifications"
value={false}
onChange={() => {}}
- />
+ />,
);
expect(screen.getByRole('switch')).not.toBeChecked();
});
@@ -41,7 +41,7 @@ describe('XDSSwitch', () => {
label="Enable notifications"
value={true}
onChange={() => {}}
- />
+ />,
);
expect(screen.getByRole('switch')).toBeChecked();
});
@@ -54,7 +54,7 @@ describe('XDSSwitch', () => {
label="Enable notifications"
value={false}
onChange={handleChange}
- />
+ />,
);
const switchEl = screen.getByRole('switch');
@@ -71,7 +71,7 @@ describe('XDSSwitch', () => {
label="Enable notifications"
value={true}
onChange={handleChange}
- />
+ />,
);
const switchEl = screen.getByRole('switch');
@@ -87,7 +87,7 @@ describe('XDSSwitch', () => {
label="Enable notifications"
value={false}
onChange={handleChange}
- />
+ />,
);
const label = screen.getByText('Enable notifications');
@@ -102,10 +102,10 @@ describe('XDSSwitch', () => {
description="Switch to a darker color scheme"
value={false}
onChange={() => {}}
- />
+ />,
);
expect(
- screen.getByText('Switch to a darker color scheme')
+ screen.getByText('Switch to a darker color scheme'),
).toBeInTheDocument();
});
@@ -116,7 +116,7 @@ describe('XDSSwitch', () => {
description="Switch to a darker color scheme"
value={false}
onChange={() => {}}
- />
+ />,
);
const switchEl = screen.getByRole('switch');
const description = screen.getByText('Switch to a darker color scheme');
@@ -130,7 +130,7 @@ describe('XDSSwitch', () => {
value={false}
onChange={() => {}}
isDisabled
- />
+ />,
);
expect(screen.getByRole('switch')).toBeDisabled();
});
@@ -144,7 +144,7 @@ describe('XDSSwitch', () => {
value={false}
onChange={handleChange}
isDisabled
- />
+ />,
);
const switchEl = screen.getByRole('switch');
@@ -160,7 +160,7 @@ describe('XDSSwitch', () => {
label="Enable notifications"
value={false}
onChange={() => {}}
- />
+ />,
);
expect(ref).toHaveBeenCalledWith(expect.any(HTMLInputElement));
});
@@ -172,7 +172,7 @@ describe('XDSSwitch', () => {
isLabelHidden
value={false}
onChange={() => {}}
- />
+ />,
);
const label = screen.getByText('Toggle row');
expect(label).toBeInTheDocument();
@@ -186,7 +186,7 @@ describe('XDSSwitch', () => {
label="Enable notifications"
value={false}
onChange={() => {}}
- />
+ />,
);
const label = screen.getByText('Enable notifications');
expect(label).toBeVisible();
@@ -199,7 +199,7 @@ describe('XDSSwitch', () => {
value={false}
onChange={() => {}}
labelPosition="start"
- />
+ />,
);
const containerDiv = container.firstChild as HTMLElement;
const children = Array.from(containerDiv.children);
@@ -214,7 +214,7 @@ describe('XDSSwitch', () => {
value={false}
onChange={() => {}}
labelPosition="end"
- />
+ />,
);
const containerDiv = container.firstChild as HTMLElement;
const children = Array.from(containerDiv.children);
@@ -228,7 +228,7 @@ describe('XDSSwitch', () => {
label="Enable notifications"
value={false}
onChange={() => {}}
- />
+ />,
);
expect(screen.getByRole('switch')).toBeInTheDocument();
});
diff --git a/packages/core/src/Switch/XDSSwitch.tsx b/packages/core/src/Switch/XDSSwitch.tsx
index a35eb9500d..6c72a2530f 100644
--- a/packages/core/src/Switch/XDSSwitch.tsx
+++ b/packages/core/src/Switch/XDSSwitch.tsx
@@ -20,6 +20,7 @@ import {
transitionVars,
typographyVars,
elevationVars,
+ textSizeVars,
} from '../theme/tokens.stylex';
import {XDSFieldLabel} from '../Field/XDSFieldLabel';
import type {XDSIconType} from '../Icon';
@@ -141,7 +142,7 @@ const styles = stylex.create({
},
description: {
fontFamily: typographyVars['--font-body'],
- fontSize: '0.75rem',
+ fontSize: textSizeVars['--text-xsm'],
color: colorVars['--color-text-secondary'],
},
});
@@ -254,7 +255,7 @@ export const XDSSwitch = forwardRef<HTMLInputElement, XDSSwitchProps>(
labelPosition = 'end',
labelSpacing = 'default',
},
- ref
+ ref,
) => {
const id = useId();
const descriptionID = useId();
@@ -282,12 +283,12 @@ export const XDSSwitch = forwardRef<HTMLInputElement, XDSSwitchProps>(
{...stylex.props(
styles.track,
isDisabled && styles.trackDisabled,
- isDisabled && !isOn && styles.trackDisabledOff
+ isDisabled && !isOn && styles.trackDisabledOff,
)}>
<div
{...stylex.props(
styles.thumb,
- isOn ? styles.thumbOn : styles.thumbOff
+ isOn ? styles.thumbOn : styles.thumbOff,
)}
/>
</div>
@@ -321,7 +322,7 @@ export const XDSSwitch = forwardRef<HTMLInputElement, XDSSwitchProps>(
labelSpacing === 'spread' && styles.containerSpread,
isOn ? styles.containerOn : styles.containerOff,
!isDisabled &&
- (isOn ? styles.containerHoverOn : styles.containerHoverOff)
+ (isOn ? styles.containerHoverOn : styles.containerHoverOff),
)}>
{labelPosition === 'start' ? (
<>
@@ -336,7 +337,7 @@ export const XDSSwitch = forwardRef<HTMLInputElement, XDSSwitchProps>(
)}
</div>
);
- }
+ },
);
XDSSwitch.displayName = 'XDSSwitch';
diff --git a/packages/core/src/Text/XDSHeading.tsx b/packages/core/src/Text/XDSHeading.tsx
index 705dd77547..9ca266b0a4 100644
--- a/packages/core/src/Text/XDSHeading.tsx
+++ b/packages/core/src/Text/XDSHeading.tsx
@@ -221,8 +221,7 @@ export const XDSHeading = forwardRef<HTMLHeadingElement, XDSHeadingProps>(
wordBreak ?? (maxLines === 1 ? 'break-all' : 'break-word');
// Resolve display - force block when maxLines > 0 or hasCapsize
- const resolvedDisplay =
- maxLines > 0 || hasCapsize ? 'block' : display;
+ const resolvedDisplay = maxLines > 0 || hasCapsize ? 'block' : display;
// Truncation detection
const truncation = useTruncation({maxLines});
@@ -256,8 +255,7 @@ export const XDSHeading = forwardRef<HTMLHeadingElement, XDSHeadingProps>(
);
// Build inline style for -webkit-line-clamp (dynamic value)
- const inlineStyle =
- maxLines > 1 ? {WebkitLineClamp: maxLines} : undefined;
+ const inlineStyle = maxLines > 1 ? {WebkitLineClamp: maxLines} : undefined;
return (
<>
@@ -286,8 +284,7 @@ export const XDSHeading = forwardRef<HTMLHeadingElement, XDSHeadingProps>(
style={inlineStyle}
aria-describedby={tooltipEnabled ? tooltip.describedBy : undefined}
{...ariaProps}
- {...props}
- >
+ {...props}>
{children}
</Component>
{tooltipEnabled &&
diff --git a/packages/core/src/Text/XDSText.tsx b/packages/core/src/Text/XDSText.tsx
index cf6a7e2a0a..452013a9b3 100644
--- a/packages/core/src/Text/XDSText.tsx
+++ b/packages/core/src/Text/XDSText.tsx
@@ -177,7 +177,7 @@ const defaultColorByType: Record<XDSTextType, XDSTextColor> = {
export const XDSText = forwardRef<HTMLElement, XDSTextProps>(function XDSText(
{
type,
- size,
+ size: _size,
color,
weight,
display = 'inline',
@@ -207,8 +207,7 @@ export const XDSText = forwardRef<HTMLElement, XDSTextProps>(function XDSText(
wordBreak ?? (maxLines === 1 ? 'break-all' : 'break-word');
// Resolve display - force block when maxLines > 0 or hasCapsize
- const resolvedDisplay =
- maxLines > 0 || hasCapsize ? 'block' : display;
+ const resolvedDisplay = maxLines > 0 || hasCapsize ? 'block' : display;
// Truncation detection
const truncation = useTruncation({maxLines});
@@ -242,8 +241,7 @@ export const XDSText = forwardRef<HTMLElement, XDSTextProps>(function XDSText(
);
// Build inline style for -webkit-line-clamp (dynamic value)
- const inlineStyle =
- maxLines > 1 ? {WebkitLineClamp: maxLines} : undefined;
+ const inlineStyle = maxLines > 1 ? {WebkitLineClamp: maxLines} : undefined;
return (
<>
@@ -273,8 +271,7 @@ export const XDSText = forwardRef<HTMLElement, XDSTextProps>(function XDSText(
)}
style={inlineStyle}
aria-describedby={tooltipEnabled ? tooltip.describedBy : undefined}
- {...props}
- >
+ {...props}>
{children}
</Component>
{tooltipEnabled &&
diff --git a/packages/core/src/Text/text.stylex.ts b/packages/core/src/Text/text.stylex.ts
index 7a8127f751..07aac939a8 100644
--- a/packages/core/src/Text/text.stylex.ts
+++ b/packages/core/src/Text/text.stylex.ts
@@ -9,10 +9,7 @@
*/
import * as stylex from '@stylexjs/stylex';
-import {
- colorVars,
- fontWeightVars,
-} from '../theme/tokens.stylex';
+import {colorVars, fontWeightVars} from '../theme/tokens.stylex';
// =============================================================================
// Color Styles
diff --git a/packages/core/src/TextArea/XDSTextArea.test.tsx b/packages/core/src/TextArea/XDSTextArea.test.tsx
index 1b6efce1e4..6eb2762f51 100644
--- a/packages/core/src/TextArea/XDSTextArea.test.tsx
+++ b/packages/core/src/TextArea/XDSTextArea.test.tsx
@@ -26,10 +26,10 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
placeholder="Enter description"
- />
+ />,
);
expect(
- screen.getByPlaceholderText('Enter description')
+ screen.getByPlaceholderText('Enter description'),
).toBeInTheDocument();
});
@@ -37,7 +37,7 @@ describe('XDSTextArea', () => {
const user = userEvent.setup();
const handleChange = vi.fn();
render(
- <XDSTextArea label="Description" value="" onChange={handleChange} />
+ <XDSTextArea label="Description" value="" onChange={handleChange} />,
);
const textarea = screen.getByRole('textbox');
@@ -62,7 +62,7 @@ describe('XDSTextArea', () => {
label="Description"
value="Controlled value"
onChange={() => {}}
- />
+ />,
);
expect(screen.getByRole('textbox')).toHaveValue('Controlled value');
});
@@ -70,7 +70,12 @@ describe('XDSTextArea', () => {
it('forwards ref correctly', () => {
const ref = vi.fn();
render(
- <XDSTextArea ref={ref} label="Description" value="" onChange={() => {}} />
+ <XDSTextArea
+ ref={ref}
+ label="Description"
+ value=""
+ onChange={() => {}}
+ />,
);
expect(ref).toHaveBeenCalledWith(expect.any(HTMLTextAreaElement));
});
@@ -82,7 +87,7 @@ describe('XDSTextArea', () => {
isLabelHidden
value=""
onChange={() => {}}
- />
+ />,
);
const label = screen.getByText('Comments');
expect(label).toBeInTheDocument();
@@ -98,11 +103,11 @@ describe('XDSTextArea', () => {
it('sets aria-required when isRequired is true', () => {
render(
- <XDSTextArea label="Feedback" isRequired value="" onChange={() => {}} />
+ <XDSTextArea label="Feedback" isRequired value="" onChange={() => {}} />,
);
expect(screen.getByRole('textbox')).toHaveAttribute(
'aria-required',
- 'true'
+ 'true',
);
});
@@ -113,7 +118,7 @@ describe('XDSTextArea', () => {
it('renders with custom rows', () => {
render(
- <XDSTextArea label="Description" value="" onChange={() => {}} rows={5} />
+ <XDSTextArea label="Description" value="" onChange={() => {}} rows={5} />,
);
expect(screen.getByRole('textbox')).toHaveAttribute('rows', '5');
});
@@ -130,7 +135,7 @@ describe('XDSTextArea', () => {
isDisabled
value=""
onChange={() => {}}
- />
+ />,
);
expect(screen.getByRole('textbox')).toBeDisabled();
});
@@ -149,7 +154,7 @@ describe('XDSTextArea', () => {
isDisabled
value=""
onChange={handleChange}
- />
+ />,
);
const textarea = screen.getByRole('textbox');
@@ -164,7 +169,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
startIcon={MagnifyingGlassIcon}
- />
+ />,
);
expect(screen.getByRole('textbox')).toBeInTheDocument();
// Icon should be rendered (as an SVG element)
@@ -174,7 +179,7 @@ describe('XDSTextArea', () => {
it('renders without icon wrapper when startIcon is not provided', () => {
const {container} = render(
- <XDSTextArea label="Description" value="" onChange={() => {}} />
+ <XDSTextArea label="Description" value="" onChange={() => {}} />,
);
// No SVG should be present
expect(container.querySelector('svg')).not.toBeInTheDocument();
@@ -188,7 +193,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
status={{type: 'error'}}
- />
+ />,
);
expect(container.querySelector('svg')).toBeInTheDocument();
});
@@ -200,7 +205,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
status={{type: 'warning'}}
- />
+ />,
);
expect(container.querySelector('svg')).toBeInTheDocument();
});
@@ -212,7 +217,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
status={{type: 'success'}}
- />
+ />,
);
expect(container.querySelector('svg')).toBeInTheDocument();
});
@@ -224,7 +229,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
status={{type: 'error', message: 'Description is required'}}
- />
+ />,
);
expect(screen.getByText('Description is required')).toBeInTheDocument();
});
@@ -236,7 +241,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
status={{type: 'error'}}
- />
+ />,
);
expect(screen.queryByText(/required/i)).not.toBeInTheDocument();
});
@@ -248,11 +253,11 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
status={{type: 'error'}}
- />
+ />,
);
expect(screen.getByRole('textbox')).toHaveAttribute(
'aria-invalid',
- 'true'
+ 'true',
);
});
@@ -263,7 +268,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
status={{type: 'warning'}}
- />
+ />,
);
expect(screen.getByRole('textbox')).not.toHaveAttribute('aria-invalid');
});
@@ -275,7 +280,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
status={{type: 'success'}}
- />
+ />,
);
expect(screen.getByRole('textbox')).not.toHaveAttribute('aria-invalid');
});
@@ -287,7 +292,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
status={{type: 'error', message: 'Too short'}}
- />
+ />,
);
const textarea = screen.getByRole('textbox');
const describedBy = textarea.getAttribute('aria-describedby');
@@ -306,7 +311,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
labelTooltip="Enter a detailed description"
- />
+ />,
);
// Info icon should be present
expect(document.querySelector('svg')).toBeInTheDocument();
@@ -330,7 +335,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
hasSpellCheck={true}
- />
+ />,
);
expect(screen.getByRole('textbox')).toHaveAttribute('spellcheck', 'true');
});
@@ -342,11 +347,11 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
hasSpellCheck={false}
- />
+ />,
);
expect(screen.getByRole('textbox')).toHaveAttribute(
'spellcheck',
- 'false'
+ 'false',
);
});
});
@@ -360,7 +365,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
onPaste={handlePaste}
- />
+ />,
);
const textarea = screen.getByRole('textbox');
@@ -390,14 +395,14 @@ describe('XDSTextArea', () => {
value="Hello"
onChange={() => {}}
maxLength={20}
- />
+ />,
);
expect(screen.getByText('5/20')).toBeInTheDocument();
});
it('does not display counter when maxLength is not provided', () => {
render(
- <XDSTextArea label="Description" value="Hello" onChange={() => {}} />
+ <XDSTextArea label="Description" value="Hello" onChange={() => {}} />,
);
expect(screen.queryByText(/\/\d+/)).not.toBeInTheDocument();
});
@@ -409,7 +414,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
maxLength={100}
- />
+ />,
);
expect(screen.getByText('0/100')).toBeInTheDocument();
@@ -419,7 +424,7 @@ describe('XDSTextArea', () => {
value="Hello World"
onChange={() => {}}
maxLength={100}
- />
+ />,
);
expect(screen.getByText('11/100')).toBeInTheDocument();
});
@@ -431,7 +436,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
maxLength={50}
- />
+ />,
);
expect(screen.getByRole('textbox')).toHaveAttribute('maxlength', '50');
});
@@ -450,7 +455,7 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
hasAutoFocus
- />
+ />,
);
expect(screen.getByRole('textbox')).toHaveFocus();
});
@@ -469,11 +474,11 @@ describe('XDSTextArea', () => {
value=""
onChange={() => {}}
htmlName="description"
- />
+ />,
);
expect(screen.getByRole('textbox')).toHaveAttribute(
'name',
- 'description'
+ 'description',
);
});
diff --git a/packages/core/src/TextArea/XDSTextArea.tsx b/packages/core/src/TextArea/XDSTextArea.tsx
index 93d2987c4c..a6a85fa59c 100644
--- a/packages/core/src/TextArea/XDSTextArea.tsx
+++ b/packages/core/src/TextArea/XDSTextArea.tsx
@@ -239,7 +239,7 @@ export const XDSTextArea = forwardRef<HTMLTextAreaElement, XDSTextAreaProps>(
hasAutoFocus = false,
htmlName,
},
- ref
+ ref,
) => {
const id = useId();
const descriptionID = useId();
@@ -291,7 +291,7 @@ export const XDSTextArea = forwardRef<HTMLTextAreaElement, XDSTextAreaProps>(
{...stylex.props(
styles.wrapper,
isDisabled && styles.wrapperDisabled,
- status && statusBorderStyles[status.type]
+ status && statusBorderStyles[status.type],
)}>
{startIcon && <XDSIcon icon={startIcon} size="sm" color="primary" />}
<textarea
@@ -312,7 +312,7 @@ export const XDSTextArea = forwardRef<HTMLTextAreaElement, XDSTextAreaProps>(
aria-invalid={status?.type === 'error' ? 'true' : undefined}
{...stylex.props(
styles.textarea,
- isDisabled && styles.textareaDisabled
+ isDisabled && styles.textareaDisabled,
)}
/>
{status && (
@@ -327,14 +327,14 @@ export const XDSTextArea = forwardRef<HTMLTextAreaElement, XDSTextAreaProps>(
<div
{...stylex.props(
styles.counter,
- value.length > maxLength && styles.counterError
+ value.length > maxLength && styles.counterError,
)}>
{value.length}/{maxLength}
</div>
)}
</XDSField>
);
- }
+ },
);
XDSTextArea.displayName = 'XDSTextArea';
diff --git a/packages/core/src/TextInput/XDSTextInput.test.tsx b/packages/core/src/TextInput/XDSTextInput.test.tsx
index 23cc9a16cc..7b9f140f0e 100644
--- a/packages/core/src/TextInput/XDSTextInput.test.tsx
+++ b/packages/core/src/TextInput/XDSTextInput.test.tsx
@@ -26,7 +26,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
placeholder="Enter text"
- />
+ />,
);
expect(screen.getByPlaceholderText('Enter text')).toBeInTheDocument();
});
@@ -54,7 +54,11 @@ describe('XDSTextInput', () => {
it('displays controlled value', () => {
render(
- <XDSTextInput label="Name" value="Controlled value" onChange={() => {}} />
+ <XDSTextInput
+ label="Name"
+ value="Controlled value"
+ onChange={() => {}}
+ />,
);
expect(screen.getByRole('textbox')).toHaveValue('Controlled value');
});
@@ -62,14 +66,19 @@ describe('XDSTextInput', () => {
it('forwards ref correctly', () => {
const ref = vi.fn();
render(
- <XDSTextInput ref={ref} label="Name" value="" onChange={() => {}} />
+ <XDSTextInput ref={ref} label="Name" value="" onChange={() => {}} />,
);
expect(ref).toHaveBeenCalledWith(expect.any(HTMLInputElement));
});
it('visually hides label when isLabelHidden is true', () => {
render(
- <XDSTextInput label="Search" isLabelHidden value="" onChange={() => {}} />
+ <XDSTextInput
+ label="Search"
+ isLabelHidden
+ value=""
+ onChange={() => {}}
+ />,
);
const label = screen.getByText('Search');
expect(label).toBeInTheDocument();
@@ -85,11 +94,11 @@ describe('XDSTextInput', () => {
it('sets aria-required when isRequired is true', () => {
render(
- <XDSTextInput label="Username" isRequired value="" onChange={() => {}} />
+ <XDSTextInput label="Username" isRequired value="" onChange={() => {}} />,
);
expect(screen.getByRole('textbox')).toHaveAttribute(
'aria-required',
- 'true'
+ 'true',
);
});
@@ -100,7 +109,7 @@ describe('XDSTextInput', () => {
it('sets disabled attribute when isDisabled is true', () => {
render(
- <XDSTextInput label="Name" isDisabled value="" onChange={() => {}} />
+ <XDSTextInput label="Name" isDisabled value="" onChange={() => {}} />,
);
expect(screen.getByRole('textbox')).toBeDisabled();
});
@@ -109,7 +118,7 @@ describe('XDSTextInput', () => {
const user = userEvent.setup();
const handleChange = vi.fn();
render(
- <XDSTextInput label="Name" isDisabled value="" onChange={handleChange} />
+ <XDSTextInput label="Name" isDisabled value="" onChange={handleChange} />,
);
const input = screen.getByRole('textbox');
@@ -129,7 +138,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
startIcon={MagnifyingGlassIcon}
- />
+ />,
);
expect(screen.getByRole('textbox')).toBeInTheDocument();
// Icon should be rendered (as an SVG element)
@@ -139,7 +148,7 @@ describe('XDSTextInput', () => {
it('renders without icon wrapper when startIcon is not provided', () => {
const {container} = render(
- <XDSTextInput label="Name" value="" onChange={() => {}} />
+ <XDSTextInput label="Name" value="" onChange={() => {}} />,
);
// No SVG should be present
expect(container.querySelector('svg')).not.toBeInTheDocument();
@@ -153,7 +162,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
status={{type: 'error'}}
- />
+ />,
);
expect(container.querySelector('svg')).toBeInTheDocument();
});
@@ -165,7 +174,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
status={{type: 'warning'}}
- />
+ />,
);
expect(container.querySelector('svg')).toBeInTheDocument();
});
@@ -177,7 +186,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
status={{type: 'success'}}
- />
+ />,
);
expect(container.querySelector('svg')).toBeInTheDocument();
});
@@ -189,7 +198,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
status={{type: 'error', message: 'Invalid email address'}}
- />
+ />,
);
expect(screen.getByText('Invalid email address')).toBeInTheDocument();
});
@@ -201,7 +210,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
status={{type: 'error'}}
- />
+ />,
);
expect(screen.queryByText(/invalid/i)).not.toBeInTheDocument();
});
@@ -213,11 +222,11 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
status={{type: 'error'}}
- />
+ />,
);
expect(screen.getByRole('textbox')).toHaveAttribute(
'aria-invalid',
- 'true'
+ 'true',
);
});
@@ -228,7 +237,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
status={{type: 'warning'}}
- />
+ />,
);
expect(screen.getByRole('textbox')).not.toHaveAttribute('aria-invalid');
});
@@ -240,7 +249,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
status={{type: 'success'}}
- />
+ />,
);
expect(screen.getByRole('textbox')).not.toHaveAttribute('aria-invalid');
});
@@ -252,7 +261,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
status={{type: 'error', message: 'Invalid email'}}
- />
+ />,
);
const input = screen.getByRole('textbox');
const describedBy = input.getAttribute('aria-describedby');
@@ -271,7 +280,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
labelTooltip="Helpful info"
- />
+ />,
);
// Info icon should be present
expect(document.querySelector('svg')).toBeInTheDocument();
@@ -285,7 +294,7 @@ describe('XDSTextInput', () => {
describe('hasAutoFocus prop', () => {
it('focuses the input when hasAutoFocus is true', () => {
render(
- <XDSTextInput label="Name" value="" onChange={() => {}} hasAutoFocus />
+ <XDSTextInput label="Name" value="" onChange={() => {}} hasAutoFocus />,
);
expect(screen.getByRole('textbox')).toHaveFocus();
});
@@ -304,7 +313,7 @@ describe('XDSTextInput', () => {
value=""
onChange={() => {}}
htmlName="username"
- />
+ />,
);
expect(screen.getByRole('textbox')).toHaveAttribute('name', 'username');
});
diff --git a/packages/core/src/TimeInput/XDSTimeInput.tsx b/packages/core/src/TimeInput/XDSTimeInput.tsx
index 1a79c0d42c..20847bbad2 100644
--- a/packages/core/src/TimeInput/XDSTimeInput.tsx
+++ b/packages/core/src/TimeInput/XDSTimeInput.tsx
@@ -389,7 +389,7 @@ export const XDSTimeInput = forwardRef<HTMLInputElement, XDSTimeInputProps>(
// Handle blur - validate and clear pending input
const handleBlur = useCallback(
- (e: FocusEvent<HTMLInputElement>) => {
+ (_e: FocusEvent<HTMLInputElement>) => {
setIsFocused(false);
if (pendingInput === null) {
diff --git a/packages/core/src/theme/defaultTheme.stylex.ts b/packages/core/src/theme/defaultTheme.stylex.ts
index c723a7f083..af347fe89c 100644
--- a/packages/core/src/theme/defaultTheme.stylex.ts
+++ b/packages/core/src/theme/defaultTheme.stylex.ts
@@ -248,47 +248,47 @@ const fontWeightRaw = {
const colorTheme = stylex.createTheme(
colorVars,
- colorRaw as unknown as BaseColorRaw
+ colorRaw as unknown as BaseColorRaw,
);
const spacingTheme = stylex.createTheme(
spacingVars,
- spacingRaw as unknown as BaseSpacingRaw
+ spacingRaw as unknown as BaseSpacingRaw,
);
const radiusTheme = stylex.createTheme(
radiusVars,
- radiusRaw as unknown as BaseRadiusRaw
+ radiusRaw as unknown as BaseRadiusRaw,
);
const elevationTheme = stylex.createTheme(
elevationVars,
- elevationRaw as unknown as BaseElevationRaw
+ elevationRaw as unknown as BaseElevationRaw,
);
const transitionTheme = stylex.createTheme(
transitionVars,
- transitionRaw as unknown as BaseTransitionRaw
+ transitionRaw as unknown as BaseTransitionRaw,
);
const typographyTheme = stylex.createTheme(
typographyVars,
- typographyRaw as unknown as BaseTypographyRaw
+ typographyRaw as unknown as BaseTypographyRaw,
);
const textSizeTheme = stylex.createTheme(
textSizeVars,
- textSizeRaw as unknown as BaseTextSizeRaw
+ textSizeRaw as unknown as BaseTextSizeRaw,
);
const lineHeightTheme = stylex.createTheme(
lineHeightVars,
- lineHeightRaw as unknown as BaseLineHeightRaw
+ lineHeightRaw as unknown as BaseLineHeightRaw,
);
const fontWeightTheme = stylex.createTheme(
fontWeightVars,
- fontWeightRaw as unknown as BaseFontWeightRaw
+ fontWeightRaw as unknown as BaseFontWeightRaw,
);
// =============================================================================
diff --git a/yarn.lock b/yarn.lock
index aa707303bd..0a55400a20 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4104,12 +4104,7 @@ prelude-ls@^1.2.1:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
-prettier@^2.7.1:
- version "2.8.8"
- resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
- integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
-
-prettier@^3.4.0:
+prettier@^2.7.1, prettier@^3.4.0:
version "3.7.4"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.7.4.tgz#d2f8335d4b1cec47e1c8098645411b0c9dff9c0f"
integrity sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==