+ These rules are reused across your app wherever the same values are used, which keeps your
+ bundle size small even as you add features. In addition, you only pay for the values you
+ use – there’s no unnecessary CSS custom properties for colors and other tokens that aren’t
+ used.
+
The Spectrum 2 color palette is available across all color properties. See the following sections for color values available for each property.
+ The Spectrum 2 color palette is available across all color properties. See the following
+ sections for color values available for each property.
+
Spectrum 2 does not include specific components for typography. Instead, you can use the style macro to apply Spectrum typography to any HTML element or component.
There are several different type scales.
Each type scale has a default size, and several t-shirt size modifiers for additional sizes.
+ Each type scale has a default size, and several t-shirt size modifiers for additional
+ sizes.
+
Important Note
- Only use {''} and {''} inside other Spectrum components with predefined styles, such as {''} and {''} . They do not include any styles by default, and should not be used standalone. Use HTML elements with the style macro directly instead.
+
+ Only use{' '}
+
+ {''}
+ {' '}
+ and{' '}
+
+ {''}
+ {' '}
+ inside other Spectrum components with predefined styles, such as{' '}
+
+ {''}
+ {' '}
+ and{' '}
+
+ {''}
+
+ . They do not include any styles by default, and should not be used standalone. Use HTML
+ elements with the style macro directly instead.
+
Conditional styles
-
The style macro also supports conditional styles, such as media queries, UI states such as hover and press, and component variants. Conditional values are defined as an object where each key is a condition. This keeps all values for each property together in one place so it is easy to see where overrides are coming from.
-
This example sets the padding of a div to 8px by default, and 32px at the large media query breakpoint (1024px) defined by Spectrum.
-
{highlight(`
+ The
style macro also supports conditional styles, such as media queries, UI
+ states such as hover and press, and component variants. Conditional values are defined as
+ an object where each key is a condition. This keeps all values for each property together
+ in one place so it is easy to see where overrides are coming from.
+
+
+ This example sets the padding of a div to 8px by default, and 32px at the large media
+ query breakpoint (1024px) defined by Spectrum.
+
+
+ {highlight(`
`)}
-
Conditions are mutually exclusive, following object property order. The style macro uses CSS cascade layers to ensure that there are no specificity issues to worry about. The last matching condition always wins.
+ })} />`)}
+
+
+ Conditions are mutually exclusive, following object property order. The style{' '}
+ macro uses{' '}
+
+ CSS cascade layers
+ {' '}
+ to ensure that there are no specificity issues to worry about. The last matching condition
+ always wins.
+
Runtime conditions
-
The style macro also supports conditions that are resolved in JavaScript at runtime, such as variant props and UI states. When a runtime condition is detected, the style macro returns a function that can be called at runtime to determine which styles to apply.
-
Runtime conditions can be named however you like, and values are defined as an object. This example changes the background color depending on a variant prop:
-
{highlight(`let styles = style({
+
+ The style macro also supports conditions that are resolved in JavaScript at
+ runtime, such as variant props and UI states. When a runtime condition is detected, the{' '}
+ style macro returns a function that can be called at runtime to determine
+ which styles to apply.
+
+
+ Runtime conditions can be named however you like, and values are defined as an object.
+ This example changes the background color depending on a variant prop:
+
+
+ {highlight(`let styles = style({
backgroundColor: {
variant: {
primary: 'accent',
@@ -159,18 +344,33 @@ export function StyleMacro() {
function MyComponent({variant}) {
return
-}`)}
- Boolean conditions starting with is do not need to be nested in an object:
- {highlight(`let styles = style({
+}`)}
+
+
+ Boolean conditions starting with is do not need to be nested in an object:
+
+
+ {highlight(`let styles = style({
backgroundColor: {
default: 'gray-100',
isSelected: 'gray-900'
}
});
-
`)}
- Runtime conditions also work well with the render props in React Aria Components. If you define your styles inline, you’ll even get autocomplete for all of the available conditions.
- {highlight(`import {Checkbox} from 'react-aria-components';
+
`)}
+
+
+ Runtime conditions also work well with the{' '}
+
+ render props
+ {' '}
+ in React Aria Components. If you define your styles inline, you’ll even get autocomplete
+ for all of the available conditions.
+
+
+ {highlight(`import {Checkbox} from 'react-aria-components';
`)}
+ })} />`)}
+
Nesting conditions
-
Conditions can be nested to apply styles when multiple conditions are true. Keep in mind that conditions at the same level are mutually exclusive, with the last matching condition winning. Since only one value can apply at a time, there are no specificity issues to worry about.
-
{highlight(`let styles = style({
+
+ Conditions can be nested to apply styles when multiple conditions are true. Keep in mind
+ that conditions at the same level are mutually exclusive, with the last matching condition
+ winning. Since only one value can apply at a time, there are no specificity issues to
+ worry about.
+
+
+ {highlight(`let styles = style({
backgroundColor: {
default: 'gray-25',
isSelected: {
@@ -197,11 +404,31 @@ function MyComponent({variant}) {
}
});
-
`)}
- The above example has three runtime conditions (isSelected, isEmphasized, and isDisabled), and uses the forcedColors condition to apply styles for Windows High Contrast Mode (WHCM). The order of precedence follows the order the conditions are defined in the object, with the isSelected + isDisabled + forcedColors state having the highest priority.
+
`)}
+
+
+ The above example has three runtime conditions (isSelected,{' '}
+ isEmphasized, and isDisabled), and uses the{' '}
+ forcedColors condition to apply styles for{' '}
+
+ Windows High Contrast Mode
+ {' '}
+ (WHCM). The order of precedence follows the order the conditions are defined in the
+ object, with the isSelected + isDisabled +{' '}
+ forcedColors state having the highest priority.
+
Reusing styles
-
Styles can be reused by extracting common properties into objects, and spreading them into style calls. These must either be constants (declared with const) in the same file, or imported from another file as a macro ({"with {type: 'macro'}"}). Properties can be overridden just like normal JS objects – the last value always wins.
-
{highlight(`const horizontalStack = {
+
+ Styles can be reused by extracting common properties into objects, and spreading them into{' '}
+ style calls. These must either be constants (declared with const
+ ) in the same file, or imported from another file as a macro (
+ {"with {type: 'macro'}"}). Properties can be overridden just like normal JS
+ objects – the last value always wins.
+
+
+ {highlight(`const horizontalStack = {
display: 'flex',
alignItems: 'center',
columnGap: 8
@@ -210,27 +437,39 @@ function MyComponent({variant}) {
const styles = style({
...horizontalStack,
columnGap: 4
-});`)}
- You can also create custom utilities by defining your own macros. These are normal functions so you can do whatever computations you like to generate styles.
- {highlight(`// style-utils.ts
+});`)}
+
+
+ You can also create custom utilities by defining your own macros. These are normal
+ functions so you can do whatever computations you like to generate styles.
+
+
+ {highlight(`// style-utils.ts
export function horizontalStack(gap: number) {
return {
display: 'flex',
alignItems: 'center',
columnGap: gap
} as const;
-}`)}
+}`)}
+
Then, import your macro and use it in a component.
-
{highlight(`// component.tsx
+
+ {highlight(`// component.tsx
import {horizontalStack} from './style-utils' with {type: 'macro'};
const styles = style({
...horizontalStack(4),
backgroundColor: 'base'
-});`)}
+});`)}
+
Built-in Utilities
-
The focusRing utility generates styles for the standard Spectrum focus ring, allowing you to reuse it in custom components.
-
{highlight(`import {style, focusRing} from '@react-spectrum/s2/style' with {type: 'macro'};
+
+ The focusRing utility generates styles for the standard Spectrum focus ring,
+ allowing you to reuse it in custom components.
+
+
+ {highlight(`import {style, focusRing} from '@react-spectrum/s2/style' with {type: 'macro'};
import {Button} from 'react-aria-components';
const buttonStyle = style({
@@ -241,20 +480,56 @@ const buttonStyle = style({
export function CustomButton(props) {
return ;
}
-`)}
+`)}
+
CSS optimization
-
The style macro relies on CSS bundling and minification to generate optimized output. When configuring your build tool, follow these best practices:
+
+ The style macro relies on CSS bundling and minification to generate optimized output. When
+ configuring your build tool, follow these best practices:
+
- Ensure that the styles are extracted into a CSS bundle and not injected at runtime by {'
\ No newline at end of file
+
diff --git a/.storybook-s2/preview.tsx b/.storybook-s2/preview.tsx
index d0081fe3f90..bd9e5fd1bff 100644
--- a/.storybook-s2/preview.tsx
+++ b/.storybook-s2/preview.tsx
@@ -1,10 +1,18 @@
import '@react-spectrum/s2/page.css';
-import { themes } from 'storybook/theming';
-import { DARK_MODE_EVENT_NAME, useDarkMode } from '@vueless/storybook-dark-mode';
-import { addons } from 'storybook/preview-api';
+import {themes} from 'storybook/theming';
+import {DARK_MODE_EVENT_NAME, useDarkMode} from '@vueless/storybook-dark-mode';
+import {addons} from 'storybook/preview-api';
import React from 'react';
import {withProviderSwitcher} from './custom-addons/provider';
-import {DocsContainer, Controls, Description, Primary, Stories, Subtitle, Title} from '@storybook/addon-docs/blocks';
+import {
+ DocsContainer,
+ Controls,
+ Description,
+ Primary,
+ Stories,
+ Subtitle,
+ Title
+} from '@storybook/addon-docs/blocks';
import './global.css';
const DARK_MODE_STORAGE_KEY = 'sb-addon-themes-3';
@@ -14,7 +22,7 @@ function getInitialColorScheme(): 'dark' | 'light' {
try {
const stored = window.localStorage.getItem(DARK_MODE_STORAGE_KEY);
if (stored) {
- const { current } = JSON.parse(stored);
+ const {current} = JSON.parse(stored);
return current === 'dark' ? 'dark' : 'light';
}
} catch {}
@@ -35,10 +43,18 @@ const preview = {
exclude: ['key', 'ref']
},
docs: {
- container: (props) => {
+ container: props => {
const dark = useDarkMode();
var style = getComputedStyle(document.body);
- return ;
+ return (
+
+ );
},
codePanel: true,
source: {
@@ -56,15 +72,16 @@ const preview = {
},
page: () => {
return (
- <>
-
-
-
-
-
-
- >
- )}
+ <>
+
+
+
+
+
+
+ >
+ );
+ }
},
darkMode: {
light: {
@@ -80,7 +97,14 @@ const preview = {
},
options: {
storySort: {
- order: ['Intro', 'Style Macro', 'Workflow Icons', 'Illustrations', 'Migrating', 'Release Notes'],
+ order: [
+ 'Intro',
+ 'Style Macro',
+ 'Workflow Icons',
+ 'Illustrations',
+ 'Migrating',
+ 'Release Notes'
+ ],
method: 'alphabetical'
}
}
@@ -88,15 +112,15 @@ const preview = {
argTypes: {
styles: {
table: {category: 'Styles'},
- control: {disable: true},
+ control: {disable: true}
},
UNSAFE_className: {
table: {category: 'Styles'},
- control: {disable: true},
+ control: {disable: true}
},
UNSAFE_style: {
table: {category: 'Styles'},
- control: {disable: true},
+ control: {disable: true}
}
}
};
@@ -107,18 +131,14 @@ export const parameters = {
rules: [
{
id: 'aria-hidden-focus',
- selector: 'body *:not([data-a11y-ignore="aria-hidden-focus"])',
+ selector: 'body *:not([data-a11y-ignore="aria-hidden-focus"])'
}
]
}
},
- layout: 'fullscreen',
+ layout: 'fullscreen'
};
-
-
-export const decorators = [
- withProviderSwitcher
-];
+export const decorators = [withProviderSwitcher];
export default preview;
diff --git a/.storybook/custom-addons/descriptions/manager.js b/.storybook/custom-addons/descriptions/manager.js
index 22b03b1925e..a1162681137 100644
--- a/.storybook/custom-addons/descriptions/manager.js
+++ b/.storybook/custom-addons/descriptions/manager.js
@@ -1,5 +1,5 @@
import {addons, types, useParameter} from 'storybook/manager-api';
-import { AddonPanel } from 'storybook/internal/components';
+import {AddonPanel} from 'storybook/internal/components';
import React from 'react';
const ADDON_ID = 'descriptionAddon';
@@ -13,7 +13,7 @@ const MyPanel = () => {
return {item}
;
};
-addons.register(ADDON_ID, (api) => {
+addons.register(ADDON_ID, api => {
addons.add(PANEL_ID, {
type: types.PANEL,
title: 'Description',
diff --git a/.storybook/custom-addons/provider/index.js b/.storybook/custom-addons/provider/index.js
index 9859e00acd2..34cf722ca2c 100644
--- a/.storybook/custom-addons/provider/index.js
+++ b/.storybook/custom-addons/provider/index.js
@@ -9,25 +9,27 @@ document.body.style.margin = '0';
function ProviderUpdater(props) {
let params = new URLSearchParams(document.location.search);
- let localeParam = params.get("providerSwitcher-locale") || undefined;
+ let localeParam = params.get('providerSwitcher-locale') || undefined;
let [localeValue, setLocale] = useState(localeParam);
- let themeParam = params.get("providerSwitcher-theme") || undefined;
+ let themeParam = params.get('providerSwitcher-theme') || undefined;
let [themeValue, setTheme] = useState(themeParam);
- let scaleParam = params.get("providerSwitcher-scale") || undefined;
+ let scaleParam = params.get('providerSwitcher-scale') || undefined;
let [scaleValue, setScale] = useState(scaleParam);
- let expressParam = params.get("providerSwitcher-express") || undefined;
+ let expressParam = params.get('providerSwitcher-express') || undefined;
let [expressValue, setExpress] = useState(expressParam === 'true');
- let [storyReady, setStoryReady] = useState(window.parent === window || window.parent !== window.top); // reduce content flash because it takes a moment to get the provider details
+ let [storyReady, setStoryReady] = useState(
+ window.parent === window || window.parent !== window.top
+ ); // reduce content flash because it takes a moment to get the provider details
let isDark = useDarkMode();
// Typically themes are provided with both light + dark, and both scales.
// To build our selector to see all themes, we need to hack it a bit.
let theme = (expressValue ? expressThemes : themes)[themeValue || 'light'] || defaultTheme;
// When the providerSwitcher theme is set explicitly use it, otherwise follow
// the storybook-dark-mode toolbar toggle.
- let colorScheme = themeValue ? themeValue.replace(/est$/, '') : (isDark ? 'dark' : 'light');
+ let colorScheme = themeValue ? themeValue.replace(/est$/, '') : isDark ? 'dark' : 'light';
useEffect(() => {
let channel = addons.getChannel();
- let providerUpdate = (event) => {
+ let providerUpdate = event => {
setLocale(event.locale);
setTheme(event.theme === 'Auto' ? undefined : event.theme);
setScale(event.scale === 'Auto' ? undefined : event.scale);
@@ -45,9 +47,7 @@ function ProviderUpdater(props) {
if (props.options.mainElement == null) {
return (
-
- {storyReady && props.children}
-
+ {storyReady && props.children}
);
} else {
diff --git a/.storybook/custom-addons/provider/manager.js b/.storybook/custom-addons/provider/manager.js
index 5f33181c261..8d17597a38e 100644
--- a/.storybook/custom-addons/provider/manager.js
+++ b/.storybook/custom-addons/provider/manager.js
@@ -2,19 +2,18 @@ import {addons, types} from 'storybook/manager-api';
import {locales} from '../../constants';
import React, {useEffect, useState} from 'react';
-
let THEMES = [
{label: 'Auto', value: ''},
- {label: "Light", value: "light"},
- {label: "Lightest", value: "lightest"},
- {label: "Dark", value: "dark"},
- {label: "Darkest", value: "darkest"}
+ {label: 'Light', value: 'light'},
+ {label: 'Lightest', value: 'lightest'},
+ {label: 'Dark', value: 'dark'},
+ {label: 'Darkest', value: 'darkest'}
];
let SCALES = [
{label: 'Auto', value: ''},
- {label: "Medium", value: "medium"},
- {label: "Large", value: "large"}
+ {label: 'Medium', value: 'medium'},
+ {label: 'Large', value: 'large'}
];
let TOAST_POSITIONS = [
@@ -41,33 +40,33 @@ function ProviderFieldSetter({api}) {
express: expressParam === 'true'
});
let channel = addons.getChannel();
- let onLocaleChange = (e) => {
+ let onLocaleChange = e => {
let newValue = e.target.value || undefined;
- setValues((old) => {
+ setValues(old => {
let next = {...old, locale: newValue};
channel.emit('provider/updated', next);
return next;
});
};
- let onThemeChange = (e) => {
+ let onThemeChange = e => {
let newValue = e.target.value || undefined;
- setValues((old) => {
+ setValues(old => {
let next = {...old, theme: newValue};
channel.emit('provider/updated', next);
return next;
});
};
- let onScaleChange = (e) => {
+ let onScaleChange = e => {
let newValue = e.target.value || undefined;
- setValues((old) => {
+ setValues(old => {
let next = {...old, scale: newValue};
channel.emit('provider/updated', next);
return next;
});
};
- let onExpressChange = (e) => {
+ let onExpressChange = e => {
let newValue = e.target.checked;
- setValues((old) => {
+ setValues(old => {
let next = {...old, express: newValue};
channel.emit('provider/updated', next);
return next;
@@ -88,7 +87,7 @@ function ProviderFieldSetter({api}) {
'providerSwitcher-locale': values.locale || '',
'providerSwitcher-theme': values.theme || '',
'providerSwitcher-scale': values.scale || '',
- 'providerSwitcher-express': String(values.express),
+ 'providerSwitcher-express': String(values.express)
});
});
@@ -97,34 +96,52 @@ function ProviderFieldSetter({api}) {
Locale:
- {locales.map(locale => {locale.label} )}
+ {locales.map(locale => (
+
+ {locale.label}
+
+ ))}
Theme:
- {THEMES.map(theme => {theme.label} )}
+ {THEMES.map(theme => (
+
+ {theme.label}
+
+ ))}
Scale:
- {SCALES.map(scale => {scale.label} )}
+ {SCALES.map(scale => (
+
+ {scale.label}
+
+ ))}
Express:
-
+
- )
+ );
}
-addons.register('ProviderSwitcher', (api) => {
+addons.register('ProviderSwitcher', api => {
addons.add('ProviderSwitcher', {
title: 'viewport',
type: types.TOOL,
- match: ({ viewMode }) => viewMode === 'story',
- render: () => ,
+ match: ({viewMode}) => viewMode === 'story',
+ render: () =>
});
});
diff --git a/.storybook/custom-addons/scrolling/index.js b/.storybook/custom-addons/scrolling/index.js
index a466408fd5b..f137e176362 100644
--- a/.storybook/custom-addons/scrolling/index.js
+++ b/.storybook/custom-addons/scrolling/index.js
@@ -10,7 +10,7 @@ function ScrollingDecorator(props) {
useEffect(() => {
let channel = addons.getChannel();
- let updateScrolling = (val) => {
+ let updateScrolling = val => {
setScrolling(val);
};
channel.on('scrolling/updated', updateScrolling);
@@ -19,40 +19,36 @@ function ScrollingDecorator(props) {
};
}, []);
- let styles = {alignItems: 'center', boxSizing: 'border-box', display: 'flex', justifyContent: 'center'};
+ let styles = {
+ alignItems: 'center',
+ boxSizing: 'border-box',
+ display: 'flex',
+ justifyContent: 'center'
+ };
if (isScrolling) {
return (
-
- {children}
-
+ {children}
);
} else {
- return (
-
- {children}
-
- );
+ return {children} ;
}
}
function StoryWrapper({children, className, style}) {
return (
-
+
{React.version}
{children}
);
}
-export const withScrollingSwitcher = (Story) => {
+export const withScrollingSwitcher = Story => {
return (
- )
-}
+ );
+};
diff --git a/.storybook/custom-addons/scrolling/manager.js b/.storybook/custom-addons/scrolling/manager.js
index 30cb5558b9a..b2904be2a88 100644
--- a/.storybook/custom-addons/scrolling/manager.js
+++ b/.storybook/custom-addons/scrolling/manager.js
@@ -6,35 +6,42 @@ const ScrollingToolbar = ({api}) => {
let scrolling = api.getQueryParam('scrolling');
let [isScrolling, setScrolling] = useState(scrolling === 'true' || false);
let onChange = () => {
- setScrolling((old) => {
+ setScrolling(old => {
channel.emit('scrolling/updated', !old);
return !old;
- })
+ });
};
useEffect(() => {
api.setQueryParams({
- 'scrolling': isScrolling
+ scrolling: isScrolling
});
});
return (
);
};
-addons.register('ScrollingSwitcher', (api) => {
+addons.register('ScrollingSwitcher', api => {
addons.add('ScrollingSwitcher', {
title: 'Scrolling switcher',
type: types.TOOL,
//👇 Shows the Toolbar UI element if either the Canvas or Docs tab is active
- match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)),
+ match: ({viewMode}) => !!(viewMode && viewMode.match(/^(story|docs)$/)),
render: () =>
});
});
diff --git a/.storybook/custom-addons/strictmode/index.js b/.storybook/custom-addons/strictmode/index.js
index 3141a7c9075..8eb270492ed 100644
--- a/.storybook/custom-addons/strictmode/index.js
+++ b/.storybook/custom-addons/strictmode/index.js
@@ -4,12 +4,12 @@ import React, {StrictMode, useEffect, useState} from 'react';
function StrictModeDecorator(props) {
let {children} = props;
let params = new URLSearchParams(document.location.search);
- let strictParam = params.get("strict") || undefined;
+ let strictParam = params.get('strict') || undefined;
let [isStrict, setStrict] = useState(strictParam !== 'false');
useEffect(() => {
let channel = addons.getChannel();
- let updateStrict = (val) => {
+ let updateStrict = val => {
setStrict(val);
};
channel.on('strict/updated', updateStrict);
@@ -18,21 +18,13 @@ function StrictModeDecorator(props) {
};
}, []);
- return isStrict ? (
-
- {children}
-
- ) : children;
+ return isStrict ?
{children} : children;
}
export const withStrictModeSwitcher = makeDecorator({
name: 'withStrictModeSwitcher',
parameterName: 'strictModeSwitcher',
wrapper: (getStory, context) => {
- return (
-
- {getStory(context)}
-
- );
+ return
{getStory(context)} ;
}
});
diff --git a/.storybook/custom-addons/strictmode/manager.js b/.storybook/custom-addons/strictmode/manager.js
index 6db41527ccd..91537ec07db 100644
--- a/.storybook/custom-addons/strictmode/manager.js
+++ b/.storybook/custom-addons/strictmode/manager.js
@@ -6,7 +6,7 @@ const StrictModeToolBar = ({api}) => {
let strictParam = api.getQueryParam('strict');
let [isStrict, setStrict] = useState(strictParam !== 'false');
let onChange = () => {
- setStrict((old) => {
+ setStrict(old => {
channel.emit('strict/updated', !old);
return !old;
});
@@ -14,15 +14,22 @@ const StrictModeToolBar = ({api}) => {
useEffect(() => {
api.setQueryParams({
- 'strict': isStrict
+ strict: isStrict
});
});
return (
@@ -30,12 +37,12 @@ const StrictModeToolBar = ({api}) => {
};
if (process.env.NODE_ENV !== 'production') {
- addons.register('StrictModeSwitcher', (api) => {
+ addons.register('StrictModeSwitcher', api => {
addons.add('StrictModeSwitcher', {
title: 'Strict mode switcher',
type: types.TOOL,
//👇 Shows the Toolbar UI element if either the Canvas or Docs tab is active
- match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)),
+ match: ({viewMode}) => !!(viewMode && viewMode.match(/^(story|docs)$/)),
render: () =>
});
});
diff --git a/.storybook/main.mjs b/.storybook/main.mjs
index 2638bdee8cd..3192edab779 100644
--- a/.storybook/main.mjs
+++ b/.storybook/main.mjs
@@ -1,6 +1,6 @@
-import { fileURLToPath } from "node:url";
+import {fileURLToPath} from 'node:url';
-const localAddon = (rel) => fileURLToPath(import.meta.resolve(rel));
+const localAddon = rel => fileURLToPath(import.meta.resolve(rel));
export default {
stories: [
@@ -20,7 +20,7 @@ export default {
localAddon('./custom-addons/descriptions'),
localAddon('./custom-addons/theme'),
localAddon('./custom-addons/strictmode'),
- localAddon('./custom-addons/scrolling'),
+ localAddon('./custom-addons/scrolling')
],
typescript: {
diff --git a/.storybook/manager.js b/.storybook/manager.js
index f5b5f6f1903..68aee3b6f3e 100644
--- a/.storybook/manager.js
+++ b/.storybook/manager.js
@@ -3,6 +3,6 @@ import {addons} from 'storybook/manager-api';
addons.setConfig({
enableShortcuts: false,
sidebar: {
- showRoots: false,
+ showRoots: false
}
});
diff --git a/.storybook/preview-head.html b/.storybook/preview-head.html
index 072aca784fd..f856ebac9dd 100644
--- a/.storybook/preview-head.html
+++ b/.storybook/preview-head.html
@@ -13,12 +13,32 @@
diff --git a/.storybook/preview.js b/.storybook/preview.js
index a849ff52fb4..574739e70b4 100644
--- a/.storybook/preview.js
+++ b/.storybook/preview.js
@@ -9,7 +9,7 @@ import {withStrictModeSwitcher} from './custom-addons/strictmode';
// decorator order matters, the last one will be the outer most
configureActions({
- depth: 2,
+ depth: 2
});
// Reflect storybook-dark-mode state on the document root so global CSS / consumers
@@ -30,7 +30,7 @@ function getInitialColorScheme() {
if (typeof document !== 'undefined') {
document.documentElement.dataset.colorScheme = getInitialColorScheme();
- addons.getChannel().on(DARK_MODE_EVENT_NAME, (isDark) => {
+ addons.getChannel().on(DARK_MODE_EVENT_NAME, isDark => {
document.documentElement.dataset.colorScheme = isDark ? 'dark' : 'light';
});
}
@@ -38,9 +38,7 @@ if (typeof document !== 'undefined') {
export const parameters = {
options: {
storySort: (a, b) => {
- return a.title === b.title
- ? 0
- : a.id.localeCompare(b.id, undefined, { numeric: true });
+ return a.title === b.title ? 0 : a.id.localeCompare(b.id, undefined, {numeric: true});
}
},
a11y: {
@@ -48,7 +46,7 @@ export const parameters = {
rules: [
{
id: 'aria-hidden-focus',
- selector: 'body *:not([data-a11y-ignore="aria-hidden-focus"])',
+ selector: 'body *:not([data-a11y-ignore="aria-hidden-focus"])'
}
]
}
@@ -69,7 +67,7 @@ export const parameters = {
brandTitle: 'React Spectrum',
brandImage: new URL('raw:logo-dark.svg', import.meta.url).toString()
}
- },
+ }
};
export const decorators = [
diff --git a/.storybook/test-runner.js b/.storybook/test-runner.js
index cf2d9a408e5..2cdfdda034c 100644
--- a/.storybook/test-runner.js
+++ b/.storybook/test-runner.js
@@ -1,11 +1,10 @@
const {configureAxe, checkA11y, injectAxe} = require('axe-playwright');
const {getStoryContext} = require('storybook/test-runner');
-
/*
-* See https://storybook.js.org/docs/react/writing-tests/test-runner#test-hook-api-experimental
-* to learn more about the test-runner hooks API.
-*/
+ * See https://storybook.js.org/docs/react/writing-tests/test-runner#test-hook-api-experimental
+ * to learn more about the test-runner hooks API.
+ */
module.exports = {
async preRender(page) {
await injectAxe(page);
@@ -22,7 +21,7 @@ module.exports = {
rules: [
{
id: 'aria-hidden-focus',
- selector: 'body *:not([data-a11y-ignore="aria-hidden-focus"])',
+ selector: 'body *:not([data-a11y-ignore="aria-hidden-focus"])'
},
...(storyContext.parameters?.a11y?.config?.rules ?? [])
]
@@ -31,9 +30,9 @@ module.exports = {
await checkA11y(page, '#root', {
detailedReport: true,
detailedReportOptions: {
- html: true,
+ html: true
},
- axeOptions: storyContext.parameters?.a11y?.options,
+ axeOptions: storyContext.parameters?.a11y?.options
});
- },
+ }
};
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 00000000000..99e2f7ddf76
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,3 @@
+{
+ "recommendations": ["oxc.oxc-vscode"]
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000000..3441d7ee320
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+ "editor.defaultFormatter": "oxc.oxc-vscode",
+ "editor.formatOnSave": true,
+ "editor.formatOnSaveMode": "file"
+}
diff --git a/.yarn/plugins/plugin-nightly-prep.js b/.yarn/plugins/plugin-nightly-prep.js
index 508b60acd98..49e48dce119 100644
--- a/.yarn/plugins/plugin-nightly-prep.js
+++ b/.yarn/plugins/plugin-nightly-prep.js
@@ -14,7 +14,17 @@ module.exports = {
factory: require => {
const {PortablePath, npath, ppath, xfs} = require('@yarnpkg/fslib');
const {BaseCommand} = require(`@yarnpkg/cli`);
- const {Project, Configuration, Cache, StreamReport, structUtils, Manifest, miscUtils, MessageName, WorkspaceResolver} = require(`@yarnpkg/core`);
+ const {
+ Project,
+ Configuration,
+ Cache,
+ StreamReport,
+ structUtils,
+ Manifest,
+ miscUtils,
+ MessageName,
+ WorkspaceResolver
+ } = require(`@yarnpkg/core`);
const {Command, Option} = require(`clipanion`);
const {parseSyml, stringifySyml} = require(`@yarnpkg/parsers`);
@@ -27,13 +37,11 @@ module.exports = {
details: `
This command will update all references in every workspace package json to point to the exact nightly version, no range.
`,
- examples: [[
- `yarn apply-nightly`,
- ]],
+ examples: [[`yarn apply-nightly`]]
});
all = Option.Boolean(`--all`, false, {
- description: `Apply the deferred version changes on all workspaces`,
+ description: `Apply the deferred version changes on all workspaces`
});
async execute() {
@@ -41,116 +49,160 @@ module.exports = {
const {project, workspace} = await Project.find(configuration, this.context.cwd);
const cache = await Cache.find(configuration);
- const applyReport = await StreamReport.start({
- configuration,
- json: this.json,
- stdout: this.context.stdout,
- }, async report => {
- const prerelease = this.prerelease
- ? typeof this.prerelease !== `boolean` ? this.prerelease : `rc.%n`
- : null;
-
- const allReleases = await resolveVersionFiles(project, xfs, ppath, parseSyml, structUtils, {prerelease});
- let filteredReleases = new Map();
-
- if (this.all) {
- filteredReleases = allReleases;
- } else {
- const relevantWorkspaces = this.recursive
- ? workspace.getRecursiveWorkspaceDependencies()
- : [workspace];
-
- for (const child of relevantWorkspaces) {
- const release = allReleases.get(child);
- if (typeof release !== `undefined`) {
- filteredReleases.set(child, release);
+ const applyReport = await StreamReport.start(
+ {
+ configuration,
+ json: this.json,
+ stdout: this.context.stdout
+ },
+ async report => {
+ const prerelease = this.prerelease
+ ? typeof this.prerelease !== `boolean`
+ ? this.prerelease
+ : `rc.%n`
+ : null;
+
+ const allReleases = await resolveVersionFiles(
+ project,
+ xfs,
+ ppath,
+ parseSyml,
+ structUtils,
+ {prerelease}
+ );
+ let filteredReleases = new Map();
+
+ if (this.all) {
+ filteredReleases = allReleases;
+ } else {
+ const relevantWorkspaces = this.recursive
+ ? workspace.getRecursiveWorkspaceDependencies()
+ : [workspace];
+
+ for (const child of relevantWorkspaces) {
+ const release = allReleases.get(child);
+ if (typeof release !== `undefined`) {
+ filteredReleases.set(child, release);
+ }
}
}
- }
-
- if (filteredReleases.size === 0) {
- const protip = allReleases.size > 0
- ? ` Did you want to add --all?`
- : ``;
- report.reportWarning(MessageName.UNNAMED, `The current workspace doesn't seem to require a version bump.${protip}`);
- return;
- }
+ if (filteredReleases.size === 0) {
+ const protip = allReleases.size > 0 ? ` Did you want to add --all?` : ``;
- applyReleases(project, filteredReleases, Manifest, miscUtils, structUtils, MessageName, npath, WorkspaceResolver, {report});
+ report.reportWarning(
+ MessageName.UNNAMED,
+ `The current workspace doesn't seem to require a version bump.${protip}`
+ );
+ return;
+ }
- if (!this.dryRun) {
- if (!prerelease) {
- if (this.all) {
- await clearVersionFiles(project, xfs);
- } else {
- await updateVersionFiles(project, [...filteredReleases.keys()], xfs, parseSyml, stringifySyml, structUtils);
+ applyReleases(
+ project,
+ filteredReleases,
+ Manifest,
+ miscUtils,
+ structUtils,
+ MessageName,
+ npath,
+ WorkspaceResolver,
+ {report}
+ );
+
+ if (!this.dryRun) {
+ if (!prerelease) {
+ if (this.all) {
+ await clearVersionFiles(project, xfs);
+ } else {
+ await updateVersionFiles(
+ project,
+ [...filteredReleases.keys()],
+ xfs,
+ parseSyml,
+ stringifySyml,
+ structUtils
+ );
+ }
}
- }
- report.reportSeparator();
+ report.reportSeparator();
+ }
}
- });
+ );
- if (this.dryRun || applyReport.hasErrors())
- return applyReport.exitCode();
+ if (this.dryRun || applyReport.hasErrors()) return applyReport.exitCode();
- return await project.installWithNewReport({
- json: this.json,
- stdout: this.context.stdout,
- }, {
- cache,
- });
+ return await project.installWithNewReport(
+ {
+ json: this.json,
+ stdout: this.context.stdout
+ },
+ {
+ cache
+ }
+ );
}
}
return {
- commands: [
- NightlyPrepCommand,
- ],
+ commands: [NightlyPrepCommand]
};
}
};
-async function resolveVersionFiles(project, xfs, ppath, parseSyml, structUtils, miscUtils, {prerelease = null} = {}) {
+async function resolveVersionFiles(
+ project,
+ xfs,
+ ppath,
+ parseSyml,
+ structUtils,
+ miscUtils,
+ {prerelease = null} = {}
+) {
let candidateReleases = new Map();
const deferredVersionFolder = project.configuration.get(`deferredVersionFolder`);
- if (!xfs.existsSync(deferredVersionFolder))
- return candidateReleases;
+ if (!xfs.existsSync(deferredVersionFolder)) return candidateReleases;
const deferredVersionFiles = await xfs.readdirPromise(deferredVersionFolder);
for (const entry of deferredVersionFiles) {
- if (!entry.endsWith(`.yml`))
- continue;
+ if (!entry.endsWith(`.yml`)) continue;
const versionPath = ppath.join(deferredVersionFolder, entry);
const versionContent = await xfs.readFilePromise(versionPath, `utf8`);
const versionData = parseSyml(versionContent);
-
for (const [identStr, decision] of Object.entries(versionData.releases || {})) {
- if (decision === Decision.DECLINE)
- continue;
+ if (decision === Decision.DECLINE) continue;
const ident = structUtils.parseIdent(identStr);
const workspace = project.tryWorkspaceByIdent(ident);
if (workspace === null)
- throw new Error(`Assertion failed: Expected a release definition file to only reference existing workspaces (${ppath.basename(versionPath)} references ${identStr})`);
+ throw new Error(
+ `Assertion failed: Expected a release definition file to only reference existing workspaces (${ppath.basename(versionPath)} references ${identStr})`
+ );
if (workspace.manifest.version === null)
- throw new Error(`Assertion failed: Expected the workspace to have a version (${structUtils.prettyLocator(project.configuration, workspace.anchoredLocator)})`);
+ throw new Error(
+ `Assertion failed: Expected the workspace to have a version (${structUtils.prettyLocator(project.configuration, workspace.anchoredLocator)})`
+ );
// If there's a `stableVersion` field, then we assume that `version`
// contains a prerelease version and that we need to base the version
// bump relative to the latest stable instead.
const baseVersion = workspace.manifest.raw.stableVersion ?? workspace.manifest.version;
- const suggestedRelease = applyStrategy(baseVersion, validateReleaseDecision(decision, miscUtils), miscUtils);
+ const suggestedRelease = applyStrategy(
+ baseVersion,
+ validateReleaseDecision(decision, miscUtils),
+ miscUtils
+ );
if (suggestedRelease === null)
- throw new Error(`Assertion failed: Expected ${baseVersion} to support being bumped via strategy ${decision}`);
+ throw new Error(
+ `Assertion failed: Expected ${baseVersion} to support being bumped via strategy ${decision}`
+ );
const bestRelease = suggestedRelease;
@@ -159,15 +211,30 @@ async function resolveVersionFiles(project, xfs, ppath, parseSyml, structUtils,
}
if (prerelease) {
- candidateReleases = new Map([...candidateReleases].map(([workspace, release]) => {
- return [workspace, applyPrerelease(release, {current: workspace.manifest.version, prerelease})];
- }));
+ candidateReleases = new Map(
+ [...candidateReleases].map(([workspace, release]) => {
+ return [
+ workspace,
+ applyPrerelease(release, {current: workspace.manifest.version, prerelease})
+ ];
+ })
+ );
}
return candidateReleases;
}
-function applyReleases(project, newVersions, Manifest, miscUtils, structUtils, MessageName, npath, WorkspaceResolver, {report}) {
+function applyReleases(
+ project,
+ newVersions,
+ Manifest,
+ miscUtils,
+ structUtils,
+ MessageName,
+ npath,
+ WorkspaceResolver,
+ {report}
+) {
const allDependents = new Map();
// First we compute the reverse map to figure out which workspace is
@@ -182,13 +249,11 @@ function applyReleases(project, newVersions, Manifest, miscUtils, structUtils, M
for (const set of Manifest.allDependencies) {
for (const descriptor of dependent.manifest[set].values()) {
const workspace = project.tryWorkspaceByDescriptor(descriptor);
- if (workspace === null)
- continue;
+ if (workspace === null) continue;
// We only care about workspaces that depend on a workspace that will
// receive a fresh update
- if (!newVersions.has(workspace))
- continue;
+ if (!newVersions.has(workspace)) continue;
const dependents = miscUtils.getArrayWithDefault(allDependents, workspace);
dependents.push([dependent, set, descriptor.identHash]);
@@ -203,16 +268,22 @@ function applyReleases(project, newVersions, Manifest, miscUtils, structUtils, M
const oldVersion = workspace.manifest.version;
workspace.manifest.version = newVersion;
- const identString = workspace.manifest.name !== null
- ? structUtils.stringifyIdent(workspace.manifest.name)
- : null;
+ const identString =
+ workspace.manifest.name !== null ? structUtils.stringifyIdent(workspace.manifest.name) : null;
- report.reportInfo(MessageName.UNNAMED, `${structUtils.prettyLocator(project.configuration, workspace.anchoredLocator)}: Bumped to ${newVersion}`);
- report.reportJson({cwd: npath.fromPortablePath(workspace.cwd), ident: identString, oldVersion, newVersion});
+ report.reportInfo(
+ MessageName.UNNAMED,
+ `${structUtils.prettyLocator(project.configuration, workspace.anchoredLocator)}: Bumped to ${newVersion}`
+ );
+ report.reportJson({
+ cwd: npath.fromPortablePath(workspace.cwd),
+ ident: identString,
+ oldVersion,
+ newVersion
+ });
const dependents = allDependents.get(workspace);
- if (typeof dependents === `undefined`)
- continue;
+ if (typeof dependents === `undefined`) continue;
for (const [dependent, set, identHash] of dependents) {
const descriptor = dependent.manifest[set].get(identHash);
@@ -233,8 +304,7 @@ function applyReleases(project, newVersions, Manifest, miscUtils, structUtils, M
}
let newRange = `${newVersion}`;
- if (useWorkspaceProtocol)
- newRange = `${WorkspaceResolver.protocol}${newRange}`;
+ if (useWorkspaceProtocol) newRange = `${WorkspaceResolver.protocol}${newRange}`;
const newDescriptor = structUtils.makeDescriptor(descriptor, newRange);
dependent.manifest[set].set(identHash, newDescriptor);
@@ -244,8 +314,7 @@ function applyReleases(project, newVersions, Manifest, miscUtils, structUtils, M
async function clearVersionFiles(project, xfs) {
const deferredVersionFolder = project.configuration.get(`deferredVersionFolder`);
- if (!xfs.existsSync(deferredVersionFolder))
- return;
+ if (!xfs.existsSync(deferredVersionFolder)) return;
await xfs.removePromise(deferredVersionFolder);
}
@@ -254,22 +323,19 @@ async function updateVersionFiles(project, workspaces, xfs, parseSyml, stringify
const workspaceSet = new Set(workspaces);
const deferredVersionFolder = project.configuration.get(`deferredVersionFolder`);
- if (!xfs.existsSync(deferredVersionFolder))
- return;
+ if (!xfs.existsSync(deferredVersionFolder)) return;
const deferredVersionFiles = await xfs.readdirPromise(deferredVersionFolder);
for (const entry of deferredVersionFiles) {
- if (!entry.endsWith(`.yml`))
- continue;
+ if (!entry.endsWith(`.yml`)) continue;
const versionPath = ppath.join(deferredVersionFolder, entry);
const versionContent = await xfs.readFilePromise(versionPath, `utf8`);
const versionData = parseSyml(versionContent);
const releases = versionData?.releases;
- if (!releases)
- continue;
+ if (!releases) continue;
for (const locatorStr of Object.keys(releases)) {
const ident = structUtils.parseIdent(locatorStr);
@@ -281,11 +347,10 @@ async function updateVersionFiles(project, workspaces, xfs, parseSyml, stringify
}
if (Object.keys(versionData.releases).length > 0) {
- await xfs.changeFilePromise(versionPath, stringifySyml(
- new stringifySyml.PreserveOrdering(
- versionData,
- ),
- ));
+ await xfs.changeFilePromise(
+ versionPath,
+ stringifySyml(new stringifySyml.PreserveOrdering(versionData))
+ );
} else {
await xfs.unlinkPromise(versionPath);
}
diff --git a/.yarnrc.yml b/.yarnrc.yml
index 3d83d6c5d63..58fa67fa308 100644
--- a/.yarnrc.yml
+++ b/.yarnrc.yml
@@ -1,14 +1,14 @@
changesetIgnorePatterns:
- - "**/*.test.*"
- - "**/*.md"
- - "**/test/**"
+ - '**/*.test.*'
+ - '**/*.md'
+ - '**/test/**'
nodeLinker: node-modules
packageExtensions:
- "@parcel/node-resolver-core@*":
+ '@parcel/node-resolver-core@*':
peerDependencies:
- "@parcel/core": ^2.12.0
+ '@parcel/core': ^2.12.0
plugins:
- .yarn/plugins/plugin-nightly-prep.js
diff --git a/__mocks__/svg.js b/__mocks__/svg.js
index 28b1467bf23..3107f783992 100644
--- a/__mocks__/svg.js
+++ b/__mocks__/svg.js
@@ -1,4 +1,8 @@
export default function SvgrURL() {
- return
;
-};
-export const ReactComponent = (props) =>
;
+ return (
+
+
+
+ );
+}
+export const ReactComponent = props =>
;
diff --git a/babel-esm.config.json b/babel-esm.config.json
index c16bd1b4767..ec4a0020354 100644
--- a/babel-esm.config.json
+++ b/babel-esm.config.json
@@ -2,7 +2,8 @@
"presets": [
"@babel/preset-typescript",
"@babel/preset-react",
- ["@babel/preset-env",
+ [
+ "@babel/preset-env",
{
"loose": true,
"modules": false
@@ -28,9 +29,7 @@
[
"react-remove-properties",
{
- "properties": [
- "data-testid"
- ]
+ "properties": ["data-testid"]
}
]
]
diff --git a/babel.config.json b/babel.config.json
index 015a74f120c..2c459c9c411 100644
--- a/babel.config.json
+++ b/babel.config.json
@@ -2,7 +2,8 @@
"presets": [
"@babel/preset-typescript",
"@babel/preset-react",
- ["@babel/preset-env",
+ [
+ "@babel/preset-env",
{
"loose": true
}
@@ -27,9 +28,7 @@
[
"react-remove-properties",
{
- "properties": [
- "data-testid"
- ]
+ "properties": ["data-testid"]
}
]
]
diff --git a/bin/imports.js b/bin/imports.js
index c6896080870..a9a4835f51f 100644
--- a/bin/imports.js
+++ b/bin/imports.js
@@ -38,7 +38,7 @@ module.exports = {
fixable: 'code'
},
create: function (context) {
- let processNode = (node) => {
+ let processNode = node => {
if (!node.source || node.importKind === 'type') {
return;
}
@@ -70,7 +70,11 @@ module.exports = {
return;
}
- if (!exists(pkg.dependencies, pkgName) && !exists(pkg.peerDependencies, pkgName) && pkgName !== pkg.name) {
+ if (
+ !exists(pkg.dependencies, pkgName) &&
+ !exists(pkg.peerDependencies, pkgName) &&
+ pkgName !== pkg.name
+ ) {
context.report({
node,
message: `Missing dependency on ${pkgName}.`,
@@ -83,7 +87,9 @@ module.exports = {
}
let depPkg = JSON.parse(fs.readFileSync(depPath, 'utf8'));
- let pkgVersion = substrings.some(v => depPkg.version.includes(v)) ? depPkg.version : `^${depPkg.version}`;
+ let pkgVersion = substrings.some(v => depPkg.version.includes(v))
+ ? depPkg.version
+ : `^${depPkg.version}`;
if (pkgName === '@react-spectrum/provider') {
pkg.peerDependencies = insertObject(pkg.peerDependencies, pkgName, pkgVersion);
diff --git a/bin/pure-render.js b/bin/pure-render.js
index 566255178eb..d28d2028669 100644
--- a/bin/pure-render.js
+++ b/bin/pure-render.js
@@ -53,7 +53,7 @@ module.exports = {
node.test.type === 'BinaryExpression' &&
(node.test.operator === '==' || node.test.operator === '===') &&
(isMemberExpressionEqual(node.test.left, member) ||
- isMemberExpressionEqual(node.test.right, member))
+ isMemberExpressionEqual(node.test.right, member))
) {
conditional = node.test;
}
@@ -80,8 +80,7 @@ module.exports = {
return (
init.type === 'CallExpression' &&
- ((init.callee.type === 'Identifier' &&
- init.callee.name === 'useRef') ||
+ ((init.callee.type === 'Identifier' && init.callee.name === 'useRef') ||
(init.callee.type === 'MemberExpression' &&
init.callee.object.type === 'Identifier' &&
init.callee.object.name === 'React' &&
@@ -99,7 +98,10 @@ module.exports = {
type: 'Identifier',
name: 'undefined'
};
- if (isLiteralEqual(conditional.operator, init, conditional.right) || isLiteralEqual(conditional.operator, init, conditional.left)) {
+ if (
+ isLiteralEqual(conditional.operator, init, conditional.right) ||
+ isLiteralEqual(conditional.operator, init, conditional.left)
+ ) {
return;
}
}
@@ -108,8 +110,7 @@ module.exports = {
context.report({
node: member,
message:
- member.parent.type === 'AssignmentExpression' &&
- member.parent.left === member
+ member.parent.type === 'AssignmentExpression' && member.parent.left === member
? 'Writing to refs during rendering is not allowed. Move this into a useEffect or useLayoutEffect. See https://beta.reactjs.org/apis/useref'
: 'Reading from refs during rendering is not allowed. See https://beta.reactjs.org/apis/useref'
});
diff --git a/bin/useLayoutEffectRule.js b/bin/useLayoutEffectRule.js
index b725e563a95..4ed02507c11 100644
--- a/bin/useLayoutEffectRule.js
+++ b/bin/useLayoutEffectRule.js
@@ -18,16 +18,16 @@ module.exports = {
if (source !== 'react') {
return;
}
- const importSpecifiers = node.specifiers.filter(specifier => specifier.type === 'ImportSpecifier');
+ const importSpecifiers = node.specifiers.filter(
+ specifier => specifier.type === 'ImportSpecifier'
+ );
const getName = specifier => specifier.local.name;
- importSpecifiers.map(
- (item) => {
- let itemName = getName(item);
- if (itemName === 'useLayoutEffect') {
- context.report(node, 'Please use useLayoutEffect from @react-aria/utils instead.');
- }
+ importSpecifiers.map(item => {
+ let itemName = getName(item);
+ if (itemName === 'useLayoutEffect') {
+ context.report(node, 'Please use useLayoutEffect from @react-aria/utils instead.');
}
- );
+ });
}
};
}
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 113c7814dcc..0a4f190019e 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -1,534 +1,505 @@
-import react from "eslint-plugin-react";
-import rulesdir from "eslint-plugin-rulesdir";
-import jsxA11Y from "eslint-plugin-jsx-a11y";
-import reactHooks from "eslint-plugin-react-hooks";
-import jest from "eslint-plugin-jest";
-import monorepo from "@jdb8/eslint-plugin-monorepo";
-import * as rspRules from "eslint-plugin-rsp-rules";
-import globals from "globals";
-import babelParser from "@babel/eslint-parser";
-import typescriptEslint from "@typescript-eslint/eslint-plugin";
-import jsdoc from "eslint-plugin-jsdoc";
+import react from 'eslint-plugin-react';
+import rulesdir from 'eslint-plugin-rulesdir';
+import jsxA11Y from 'eslint-plugin-jsx-a11y';
+import reactHooks from 'eslint-plugin-react-hooks';
+import jest from 'eslint-plugin-jest';
+import monorepo from '@jdb8/eslint-plugin-monorepo';
+import * as rspRules from 'eslint-plugin-rsp-rules';
+import globals from 'globals';
+import babelParser from '@babel/eslint-parser';
+import typescriptEslint from '@typescript-eslint/eslint-plugin';
+import jsdoc from 'eslint-plugin-jsdoc';
import tseslint from 'typescript-eslint';
-import path from "node:path";
-import { fileURLToPath } from "node:url";
-import js from "@eslint/js";
-import { FlatCompat } from "@eslint/eslintrc";
-import stylistic from "@stylistic/eslint-plugin-ts";
+import path from 'node:path';
+import {fileURLToPath} from 'node:url';
+import js from '@eslint/js';
+import {FlatCompat} from '@eslint/eslintrc';
-import rulesDirPlugin from "eslint-plugin-rulesdir";
+import rulesDirPlugin from 'eslint-plugin-rulesdir';
rulesDirPlugin.RULES_DIR = './bin';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
- baseDirectory: __dirname,
- recommendedConfig: js.configs.recommended,
- allConfig: js.configs.all
+ baseDirectory: __dirname,
+ recommendedConfig: js.configs.recommended,
+ allConfig: js.configs.all
});
const OFF = 0;
const WARN = 1;
const ERROR = 2;
-export default [{
+export default [
+ {
ignores: [
- "packages/@react-aria/i18n/server",
- "packages/@spectrum-icons/color/**/*",
- "packages/@spectrum-icons/ui/**/*",
- "packages/@spectrum-icons/workflow/**/*",
- "packages/@spectrum-icons/illustrations/**/*",
- "packages/@spectrum-icons/express/**/*",
- "**/node_modules",
- "packages/*/*/dist",
- "packages/*/*/i18n",
- "packages/react-aria/dist",
- "packages/react-aria/i18n",
- "packages/react-aria-components/dist",
- "packages/react-aria-components/i18n",
- "packages/react-stately/dist",
- "packages/dev/storybook-builder-parcel/preview.js",
- "packages/dev/optimize-locales-plugin/LocalesPlugin.d.ts",
- "examples/**/*",
- "starters/**/*",
- "scripts/icon-builder-fixture/**/*",
- "packages/@react-spectrum/s2/icon.d.ts",
- "packages/@react-spectrum/s2/spectrum-illustrations",
- "packages/dev/parcel-config-storybook/*",
- "packages/dev/parcel-resolver-storybook/*",
- "packages/dev/parcel-transformer-storybook/*",
- "packages/dev/storybook-builder-parcel/*",
- "packages/dev/storybook-react-parcel/*",
- "packages/dev/s2-docs/pages/**",
- "packages/dev/mcp/*/dist",
- "packages/dev/codemods/src/s1-to-s2/__testfixtures__/cli/**"
- ],
-}, ...compat.extends("eslint:recommended"), {
+ 'packages/@react-aria/i18n/server',
+ 'packages/@spectrum-icons/color/**/*',
+ 'packages/@spectrum-icons/ui/**/*',
+ 'packages/@spectrum-icons/workflow/**/*',
+ 'packages/@spectrum-icons/illustrations/**/*',
+ 'packages/@spectrum-icons/express/**/*',
+ '**/node_modules',
+ 'packages/*/*/dist',
+ 'packages/*/*/i18n',
+ 'packages/react-aria/dist',
+ 'packages/react-aria/i18n',
+ 'packages/react-aria-components/dist',
+ 'packages/react-aria-components/i18n',
+ 'packages/react-stately/dist',
+ 'packages/dev/storybook-builder-parcel/preview.js',
+ 'packages/dev/optimize-locales-plugin/LocalesPlugin.d.ts',
+ 'examples/**/*',
+ 'starters/**/*',
+ 'scripts/icon-builder-fixture/**/*',
+ 'packages/@react-spectrum/s2/icon.d.ts',
+ 'packages/@react-spectrum/s2/spectrum-illustrations',
+ 'packages/dev/parcel-config-storybook/*',
+ 'packages/dev/parcel-resolver-storybook/*',
+ 'packages/dev/parcel-transformer-storybook/*',
+ 'packages/dev/storybook-builder-parcel/*',
+ 'packages/dev/storybook-react-parcel/*',
+ 'packages/dev/s2-docs/pages/**',
+ 'packages/dev/mcp/*/dist',
+ 'packages/dev/codemods/src/s1-to-s2/__testfixtures__/cli/**'
+ ]
+ },
+ ...compat.extends('eslint:recommended'),
+ {
plugins: {
- react,
- rulesdir,
- "jsx-a11y": jsxA11Y,
- "react-hooks": reactHooks,
- jest,
- monorepo,
- "rsp-rules": rspRules,
+ react,
+ rulesdir,
+ 'jsx-a11y': jsxA11Y,
+ 'react-hooks': reactHooks,
+ jest,
+ monorepo,
+ 'rsp-rules': rspRules
},
languageOptions: {
- globals: {
- ...globals.browser,
- ...globals.node,
- ...globals.mocha,
- ...globals.jest,
- importSpectrumCSS: "readonly",
- jest: true,
- expect: true,
- JSX: "readonly",
- NodeJS: "readonly",
- AsyncIterable: "readonly",
- FileSystemFileEntry: "readonly",
- FileSystemDirectoryEntry: "readonly",
- FileSystemEntry: "readonly",
- IS_REACT_ACT_ENVIRONMENT: "readonly",
- },
-
- parser: babelParser,
- ecmaVersion: 6,
- sourceType: "module",
-
- parserOptions: {
- ecmaFeatures: {
- legacyDecorators: true,
- },
- },
+ globals: {
+ ...globals.browser,
+ ...globals.node,
+ ...globals.mocha,
+ ...globals.jest,
+ importSpectrumCSS: 'readonly',
+ jest: true,
+ expect: true,
+ JSX: 'readonly',
+ NodeJS: 'readonly',
+ AsyncIterable: 'readonly',
+ FileSystemFileEntry: 'readonly',
+ FileSystemDirectoryEntry: 'readonly',
+ FileSystemEntry: 'readonly',
+ IS_REACT_ACT_ENVIRONMENT: 'readonly'
+ },
+
+ parser: babelParser,
+ ecmaVersion: 6,
+ sourceType: 'module',
+
+ parserOptions: {
+ ecmaFeatures: {
+ legacyDecorators: true
+ }
+ }
},
settings: {
- jsdoc: {
- ignorePrivate: true,
- publicFunctionsOnly: true,
- },
-
- react: {
- version: "detect",
- },
+ jsdoc: {
+ ignorePrivate: true,
+ publicFunctionsOnly: true
+ },
+
+ react: {
+ version: 'detect'
+ }
},
rules: {
- "comma-dangle": ERROR,
- indent: OFF,
-
- "indent-legacy": [ERROR, ERROR, {
- SwitchCase: WARN,
- }],
-
- quotes: [ERROR, "single", "avoid-escape"],
- "linebreak-style": [ERROR, "unix"],
- semi: [ERROR, "always"],
-
- "space-before-function-paren": [ERROR, {
- anonymous: "always",
- named: "never",
- asyncArrow: "ignore",
- }],
-
- "keyword-spacing": [ERROR, {
- after: true,
- }],
-
- "jsx-quotes": [ERROR, "prefer-double"],
-
- "brace-style": [ERROR, "1tbs", {
- allowSingleLine: true,
- }],
-
- "object-curly-spacing": [ERROR, "never"],
- curly: ERROR,
- "no-fallthrough": OFF,
- "comma-spacing": ERROR,
- "comma-style": [ERROR, "last"],
- "no-irregular-whitespace": [ERROR],
- eqeqeq: [ERROR, "smart"],
- "no-spaced-func": ERROR,
- "array-bracket-spacing": [ERROR, "never"],
-
- "key-spacing": [ERROR, {
- beforeColon: false,
- afterColon: true,
- }],
-
- "no-console": OFF,
-
- "no-unused-vars": [ERROR, {
- args: "none",
- vars: "all",
- varsIgnorePattern: "[rR]eact",
- }],
- "no-unused-private-class-members": OFF,
-
- "space-in-parens": [ERROR, "never"],
-
- "space-unary-ops": [ERROR, {
- words: true,
- nonwords: false,
- }],
-
- "spaced-comment": [ERROR, "always", {
- exceptions: ["*", "#__PURE__"],
- markers: ["/"],
- }],
-
- "max-depth": [WARN, 4],
- radix: [ERROR, "always"],
- "react/jsx-uses-react": WARN,
- "eol-last": ERROR,
- "arrow-spacing": ERROR,
- "space-before-blocks": [ERROR, "always"],
- "space-infix-ops": ERROR,
- "no-new-wrappers": ERROR,
- "no-self-compare": ERROR,
- "no-nested-ternary": ERROR,
- "no-multiple-empty-lines": ERROR,
- "no-unneeded-ternary": ERROR,
- // "no-duplicate-imports": ERROR,
- "react/display-name": OFF,
- "react/jsx-curly-spacing": [ERROR, "never"],
- "react/jsx-indent-props": [ERROR, ERROR],
- "react/jsx-no-duplicate-props": ERROR,
- "react/jsx-no-literals": OFF,
- "react/jsx-no-undef": ERROR,
- "react/jsx-quotes": OFF,
- "react/jsx-sort-prop-types": OFF,
- "react/jsx-sort-props": OFF,
- "react/jsx-uses-vars": ERROR,
- "react/no-danger": OFF,
- "react/no-did-mount-set-state": OFF,
- "react/no-did-update-set-state": ERROR,
- "react/no-multi-comp": OFF,
- "react/no-set-state": OFF,
-
- "react/no-unknown-property": [ERROR, {
- ignore: ["prefix"],
- }],
-
- "react/react-in-jsx-scope": ERROR,
- "react/require-extension": OFF,
- "react/jsx-equals-spacing": ERROR,
-
- "react/jsx-max-props-per-line": [ERROR, {
- when: "multiline",
- }],
-
- "react/jsx-closing-bracket-location": [ERROR, "after-props"],
- "react/jsx-tag-spacing": ERROR,
- "react/jsx-indent": [ERROR, ERROR],
- "react/jsx-wrap-multilines": ERROR,
- "react/jsx-boolean-value": ERROR,
- "react/jsx-first-prop-new-line": [ERROR, "multiline"],
- "react/self-closing-comp": ERROR,
-
- // Core hooks rules
- "react-hooks/rules-of-hooks": ERROR, // https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/CHANGELOG.md
- "react-hooks/exhaustive-deps": WARN,
-
- // React Compiler rules
- 'react-hooks/config': ERROR,
- 'react-hooks/error-boundaries': ERROR,
- 'react-hooks/component-hook-factories': ERROR,
- 'react-hooks/gating': ERROR,
- 'react-hooks/globals': ERROR,
- // 'react-hooks/immutability': ERROR,
- // 'react-hooks/preserve-manual-memoization': ERROR, // No idea how to turn this one on yet
- 'react-hooks/purity': ERROR,
- // 'react-hooks/refs': ERROR, // can't turn on until https://github.com/facebook/react/issues/34775 is fixed
- 'react-hooks/set-state-in-effect': ERROR,
- 'react-hooks/set-state-in-render': ERROR,
- 'react-hooks/static-components': ERROR,
- 'react-hooks/unsupported-syntax': WARN,
- 'react-hooks/use-memo': ERROR,
- 'react-hooks/incompatible-library': WARN,
-
- "rsp-rules/no-react-key": [ERROR],
- "rsp-rules/sort-imports": [ERROR],
- "rsp-rules/no-non-shadow-contains": [ERROR],
- "rsp-rules/safe-event-target": [ERROR],
- "rsp-rules/shadow-safe-active-element": [ERROR],
- "rsp-rules/faster-node-contains": [ERROR],
- "rulesdir/imports": [ERROR],
- "rulesdir/useLayoutEffectRule": [ERROR],
- "rulesdir/pure-render": [ERROR],
- "jsx-a11y/accessible-emoji": ERROR,
- "jsx-a11y/alt-text": ERROR,
- "jsx-a11y/anchor-has-content": ERROR,
- "jsx-a11y/anchor-is-valid": ERROR,
- "jsx-a11y/aria-activedescendant-has-tabindex": ERROR,
- "jsx-a11y/aria-props": ERROR,
- "jsx-a11y/aria-proptypes": ERROR,
- "jsx-a11y/aria-role": ERROR,
- "jsx-a11y/aria-unsupported-elements": ERROR,
- "jsx-a11y/click-events-have-key-events": ERROR,
- "jsx-a11y/heading-has-content": ERROR,
- "jsx-a11y/html-has-lang": ERROR,
- "jsx-a11y/iframe-has-title": ERROR,
- "jsx-a11y/img-redundant-alt": ERROR,
-
- "jsx-a11y/interactive-supports-focus": [ERROR, {
- tabbable: [
- "button",
- "checkbox",
- "link",
- "searchbox",
- "spinbutton",
- "switch",
- "textbox",
- ],
- }],
-
- "jsx-a11y/label-has-associated-control": [ERROR, {
- assert: "either",
- depth: 3,
- }],
-
- "jsx-a11y/media-has-caption": ERROR,
- "jsx-a11y/mouse-events-have-key-events": ERROR,
- "jsx-a11y/no-access-key": ERROR,
- "jsx-a11y/no-distracting-elements": ERROR,
- "jsx-a11y/no-interactive-element-to-noninteractive-role": ERROR,
-
- "jsx-a11y/no-noninteractive-element-interactions": [WARN, {
- handlers: [
- "onClick",
- "onMouseDown",
- "onMouseUp",
- "onKeyPress",
- "onKeyDown",
- "onKeyUp",
- ],
- }],
-
- "jsx-a11y/no-noninteractive-element-to-interactive-role": [ERROR, {
- ul: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
- ol: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
- li: ["menuitem", "option", "row", "tab", "treeitem"],
- table: ["grid"],
- td: ["gridcell", "columnheader", "rowheader"],
- th: ["columnheader", "rowheader"],
- }],
-
- "jsx-a11y/no-noninteractive-tabindex": [ERROR, {
- tags: [],
- roles: ["alertdialog", "dialog", "tabpanel"],
- }],
-
- "jsx-a11y/no-redundant-roles": ERROR,
-
- "jsx-a11y/no-static-element-interactions": [ERROR, {
- handlers: [
- "onClick",
- "onMouseDown",
- "onMouseUp",
- "onKeyPress",
- "onKeyDown",
- "onKeyUp",
- ],
- }],
-
- "jsx-a11y/role-has-required-aria-props": ERROR,
- "jsx-a11y/role-supports-aria-props": ERROR,
- "jsx-a11y/scope": ERROR,
- "jsx-a11y/tabindex-no-positive": ERROR,
-
- "monorepo/no-relative-import": ERROR,
- },
-}, {
- files: ["packages/**/*.ts", "packages/**/*.tsx"],
+ 'no-fallthrough': OFF,
+ 'no-irregular-whitespace': [ERROR],
+ eqeqeq: [ERROR, 'smart'],
+
+ 'no-console': OFF,
+
+ 'no-unused-vars': [
+ ERROR,
+ {
+ args: 'none',
+ vars: 'all',
+ varsIgnorePattern: '[rR]eact'
+ }
+ ],
+ 'no-unused-private-class-members': OFF,
+
+ 'spaced-comment': [
+ ERROR,
+ 'always',
+ {
+ exceptions: ['*', '#__PURE__'],
+ markers: ['/']
+ }
+ ],
+
+ 'max-depth': [WARN, 4],
+ radix: [ERROR, 'always'],
+ 'react/jsx-uses-react': WARN,
+ 'eol-last': ERROR,
+ 'arrow-spacing': ERROR,
+ 'space-before-blocks': [ERROR, 'always'],
+ 'space-infix-ops': ERROR,
+ 'no-new-wrappers': ERROR,
+ 'no-self-compare': ERROR,
+ 'no-nested-ternary': ERROR,
+ 'no-multiple-empty-lines': ERROR,
+ 'no-unneeded-ternary': ERROR,
+ // "no-duplicate-imports": ERROR,
+ 'react/display-name': OFF,
+ 'react/jsx-curly-spacing': [ERROR, 'never'],
+ 'react/jsx-indent-props': [ERROR, ERROR],
+ 'react/jsx-no-duplicate-props': ERROR,
+ 'react/jsx-no-literals': OFF,
+ 'react/jsx-no-undef': ERROR,
+ 'react/jsx-quotes': OFF,
+ 'react/jsx-sort-prop-types': OFF,
+ 'react/jsx-sort-props': OFF,
+ 'react/jsx-uses-vars': ERROR,
+ 'react/no-danger': OFF,
+ 'react/no-did-mount-set-state': OFF,
+ 'react/no-did-update-set-state': ERROR,
+ 'react/no-multi-comp': OFF,
+ 'react/no-set-state': OFF,
+
+ 'react/no-unknown-property': [
+ ERROR,
+ {
+ ignore: ['prefix']
+ }
+ ],
+
+ 'react/react-in-jsx-scope': ERROR,
+ 'react/require-extension': OFF,
+
+ 'react/jsx-max-props-per-line': [
+ ERROR,
+ {
+ when: 'multiline'
+ }
+ ],
+
+ 'react/jsx-boolean-value': ERROR,
+ 'react/self-closing-comp': ERROR,
+
+ // Core hooks rules
+ 'react-hooks/rules-of-hooks': ERROR, // https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/CHANGELOG.md
+ 'react-hooks/exhaustive-deps': WARN,
+
+ // React Compiler rules
+ 'react-hooks/config': ERROR,
+ 'react-hooks/error-boundaries': ERROR,
+ 'react-hooks/component-hook-factories': ERROR,
+ 'react-hooks/gating': ERROR,
+ 'react-hooks/globals': ERROR,
+ // 'react-hooks/immutability': ERROR,
+ // 'react-hooks/preserve-manual-memoization': ERROR, // No idea how to turn this one on yet
+ 'react-hooks/purity': ERROR,
+ // 'react-hooks/refs': ERROR, // can't turn on until https://github.com/facebook/react/issues/34775 is fixed
+ 'react-hooks/set-state-in-effect': ERROR,
+ 'react-hooks/set-state-in-render': ERROR,
+ 'react-hooks/static-components': ERROR,
+ 'react-hooks/unsupported-syntax': WARN,
+ 'react-hooks/use-memo': ERROR,
+ 'react-hooks/incompatible-library': WARN,
+
+ 'rsp-rules/no-react-key': [ERROR],
+ 'rsp-rules/sort-imports': [ERROR],
+ 'rsp-rules/no-non-shadow-contains': [ERROR],
+ 'rsp-rules/safe-event-target': [ERROR],
+ 'rsp-rules/shadow-safe-active-element': [ERROR],
+ 'rsp-rules/faster-node-contains': [ERROR],
+ 'rulesdir/imports': [ERROR],
+ 'rulesdir/useLayoutEffectRule': [ERROR],
+ 'rulesdir/pure-render': [ERROR],
+ 'jsx-a11y/accessible-emoji': ERROR,
+ 'jsx-a11y/alt-text': ERROR,
+ 'jsx-a11y/anchor-has-content': ERROR,
+ 'jsx-a11y/anchor-is-valid': ERROR,
+ 'jsx-a11y/aria-activedescendant-has-tabindex': ERROR,
+ 'jsx-a11y/aria-props': ERROR,
+ 'jsx-a11y/aria-proptypes': ERROR,
+ 'jsx-a11y/aria-role': ERROR,
+ 'jsx-a11y/aria-unsupported-elements': ERROR,
+ 'jsx-a11y/click-events-have-key-events': ERROR,
+ 'jsx-a11y/heading-has-content': ERROR,
+ 'jsx-a11y/html-has-lang': ERROR,
+ 'jsx-a11y/iframe-has-title': ERROR,
+ 'jsx-a11y/img-redundant-alt': ERROR,
+
+ 'jsx-a11y/interactive-supports-focus': [
+ ERROR,
+ {
+ tabbable: ['button', 'checkbox', 'link', 'searchbox', 'spinbutton', 'switch', 'textbox']
+ }
+ ],
+
+ 'jsx-a11y/label-has-associated-control': [
+ ERROR,
+ {
+ assert: 'either',
+ depth: 3
+ }
+ ],
+
+ 'jsx-a11y/media-has-caption': ERROR,
+ 'jsx-a11y/mouse-events-have-key-events': ERROR,
+ 'jsx-a11y/no-access-key': ERROR,
+ 'jsx-a11y/no-distracting-elements': ERROR,
+ 'jsx-a11y/no-interactive-element-to-noninteractive-role': ERROR,
+
+ 'jsx-a11y/no-noninteractive-element-interactions': [
+ WARN,
+ {
+ handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp']
+ }
+ ],
+
+ 'jsx-a11y/no-noninteractive-element-to-interactive-role': [
+ ERROR,
+ {
+ ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
+ ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
+ li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
+ table: ['grid'],
+ td: ['gridcell', 'columnheader', 'rowheader'],
+ th: ['columnheader', 'rowheader']
+ }
+ ],
+
+ 'jsx-a11y/no-noninteractive-tabindex': [
+ ERROR,
+ {
+ tags: [],
+ roles: ['alertdialog', 'dialog', 'tabpanel']
+ }
+ ],
+
+ 'jsx-a11y/no-redundant-roles': ERROR,
+
+ 'jsx-a11y/no-static-element-interactions': [
+ ERROR,
+ {
+ handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp']
+ }
+ ],
+
+ 'jsx-a11y/role-has-required-aria-props': ERROR,
+ 'jsx-a11y/role-supports-aria-props': ERROR,
+ 'jsx-a11y/scope': ERROR,
+ 'jsx-a11y/tabindex-no-positive': ERROR,
+
+ 'monorepo/no-relative-import': ERROR
+ }
+ },
+ {
+ files: ['packages/**/*.ts', 'packages/**/*.tsx'],
plugins: {
- react,
- rulesdir,
- "jsx-a11y": jsxA11Y,
- "react-hooks": reactHooks,
- jest,
- "@typescript-eslint": typescriptEslint,
- monorepo,
- jsdoc,
- "@stylistic": stylistic,
+ react,
+ rulesdir,
+ 'jsx-a11y': jsxA11Y,
+ 'react-hooks': reactHooks,
+ jest,
+ '@typescript-eslint': typescriptEslint,
+ monorepo,
+ jsdoc
},
languageOptions: {
- globals: {
- globalThis: "readonly",
+ globals: {
+ globalThis: 'readonly'
+ },
+
+ parser: tseslint.parser,
+ ecmaVersion: 6,
+ sourceType: 'module',
+
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ legacyDecorators: true
},
- parser: tseslint.parser,
- ecmaVersion: 6,
- sourceType: "module",
-
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- legacyDecorators: true,
- },
-
- useJSXTextNode: true,
- project: "./tsconfig.json",
- },
+ useJSXTextNode: true,
+ project: './tsconfig.json'
+ }
},
rules: {
- "jsdoc/require-description-complete-sentence": [ERROR, {
- abbreviations: ["e.g", "i.e"],
- }],
-
- "jsdoc/check-alignment": ERROR,
- "jsdoc/check-indentation": ERROR,
-
- "jsdoc/check-tag-names": [ERROR, {
- definedTags: ["selector", "note"],
- }],
-
- "jsdoc/require-description": [ERROR, {
- exemptedBy: ["deprecated"],
- checkConstructors: false,
- }],
-
- "no-redeclare": OFF,
- "@typescript-eslint/no-redeclare": ERROR,
- "no-unused-vars": OFF,
- "@typescript-eslint/no-unused-vars": ERROR,
-
- "@stylistic/member-delimiter-style": [ERROR, {
- multiline: {
- delimiter: "comma",
- requireLast: false,
- },
-
- singleline: {
- delimiter: "comma",
- requireLast: false,
- },
- }],
- },
-}, {
- files: ["packages/**/src/**/*.ts", "packages/**/src/**/*.tsx"],
- ignores: ["packages/dev/**"],
+ 'jsdoc/require-description-complete-sentence': [
+ ERROR,
+ {
+ abbreviations: ['e.g', 'i.e']
+ }
+ ],
+
+ 'jsdoc/check-alignment': ERROR,
+ 'jsdoc/check-indentation': ERROR,
+
+ 'jsdoc/check-tag-names': [
+ ERROR,
+ {
+ definedTags: ['selector', 'note']
+ }
+ ],
+
+ 'jsdoc/require-description': [
+ ERROR,
+ {
+ exemptedBy: ['deprecated'],
+ checkConstructors: false
+ }
+ ],
+
+ 'no-redeclare': OFF,
+ '@typescript-eslint/no-redeclare': ERROR,
+ 'no-unused-vars': OFF,
+ '@typescript-eslint/no-unused-vars': ERROR
+ }
+ },
+ {
+ files: ['packages/**/src/**/*.ts', 'packages/**/src/**/*.tsx'],
+ ignores: ['packages/dev/**'],
rules: {
- "rsp-rules/no-package-root-imports": ERROR,
- },
-}, {
+ 'rsp-rules/no-package-root-imports': ERROR
+ }
+ },
+ {
files: [
- "**/test/**",
- "**/stories/**",
- "**/docs/**",
- "**/chromatic/**",
- "**/chromatic-fc/**",
- "**/__tests__/**",
+ '**/test/**',
+ '**/stories/**',
+ '**/docs/**',
+ '**/chromatic/**',
+ '**/chromatic-fc/**',
+ '**/__tests__/**'
],
rules: {
- "rsp-rules/no-react-key": [ERROR],
- "rsp-rules/act-events-test": ERROR,
- "rsp-rules/no-getByRole-toThrow": ERROR,
- "rsp-rules/no-non-shadow-contains": OFF,
- "rsp-rules/safe-event-target": OFF,
- "rsp-rules/shadow-safe-active-element": OFF,
- "rsp-rules/faster-node-contains": OFF,
- "rulesdir/imports": OFF,
- "monorepo/no-internal-import": OFF,
- "jsdoc/require-jsdoc": OFF
+ 'rsp-rules/no-react-key': [ERROR],
+ 'rsp-rules/act-events-test': ERROR,
+ 'rsp-rules/no-getByRole-toThrow': ERROR,
+ 'rsp-rules/no-non-shadow-contains': OFF,
+ 'rsp-rules/safe-event-target': OFF,
+ 'rsp-rules/shadow-safe-active-element': OFF,
+ 'rsp-rules/faster-node-contains': OFF,
+ 'rulesdir/imports': OFF,
+ 'monorepo/no-internal-import': OFF,
+ 'jsdoc/require-jsdoc': OFF
},
languageOptions: {
- globals: {
- ...globals.browser,
- ...globals.node,
- ...globals.mocha,
- ...globals.jest,
- importSpectrumCSS: "readonly",
- jest: true,
- expect: true,
- JSX: "readonly",
- NodeJS: "readonly",
- AsyncIterable: "readonly",
- FileSystemFileEntry: "readonly",
- FileSystemDirectoryEntry: "readonly",
- FileSystemEntry: "readonly",
- IS_REACT_ACT_ENVIRONMENT: "readonly",
- globalThis: "readonly",
- },
-
- parser: tseslint.parser,
- ecmaVersion: 6,
- sourceType: "module",
-
- parserOptions: {
- // eventually move to projectService for faster linting
- ecmaFeatures: {
- legacyDecorators: true,
- },
- },
- },
-}, {
- files: ["**/dev/**", "**/scripts/**"],
+ globals: {
+ ...globals.browser,
+ ...globals.node,
+ ...globals.mocha,
+ ...globals.jest,
+ importSpectrumCSS: 'readonly',
+ jest: true,
+ expect: true,
+ JSX: 'readonly',
+ NodeJS: 'readonly',
+ AsyncIterable: 'readonly',
+ FileSystemFileEntry: 'readonly',
+ FileSystemDirectoryEntry: 'readonly',
+ FileSystemEntry: 'readonly',
+ IS_REACT_ACT_ENVIRONMENT: 'readonly',
+ globalThis: 'readonly'
+ },
+
+ parser: tseslint.parser,
+ ecmaVersion: 6,
+ sourceType: 'module',
+
+ parserOptions: {
+ // eventually move to projectService for faster linting
+ ecmaFeatures: {
+ legacyDecorators: true
+ }
+ }
+ }
+ },
+ {
+ files: ['**/dev/**', '**/scripts/**'],
rules: {
- "jsdoc/require-jsdoc": OFF,
- "jsdoc/require-description": OFF,
- "rsp-rules/safe-event-target": OFF,
- },
-}, {
- files: [
- "packages/@react-aria/focus/src/**/*.ts",
- "packages/@react-aria/focus/src/**/*.tsx",
- ],
+ 'jsdoc/require-jsdoc': OFF,
+ 'jsdoc/require-description': OFF,
+ 'rsp-rules/safe-event-target': OFF
+ }
+ },
+ {
+ files: ['packages/@react-aria/focus/src/**/*.ts', 'packages/@react-aria/focus/src/**/*.tsx'],
rules: {
- "no-restricted-globals": [ERROR, {
- name: "window",
- message: "Use getOwnerWindow from @react-aria/utils instead.",
- }, {
- name: "document",
- message: "Use getOwnerDocument from @react-aria/utils instead.",
- }],
- },
-}, {
+ 'no-restricted-globals': [
+ ERROR,
+ {
+ name: 'window',
+ message: 'Use getOwnerWindow from @react-aria/utils instead.'
+ },
+ {
+ name: 'document',
+ message: 'Use getOwnerDocument from @react-aria/utils instead.'
+ }
+ ]
+ }
+ },
+ {
files: [
- "packages/react-aria/src/interactions/**/*.ts",
- "packages/react-aria/src/interactions/**/*.tsx",
+ 'packages/react-aria/src/interactions/**/*.ts',
+ 'packages/react-aria/src/interactions/**/*.tsx'
],
rules: {
- "no-restricted-globals": [WARN, {
- name: "window",
- message: "Use getOwnerWindow from @react-aria/utils instead.",
- }, {
- name: "document",
- message: "Use getOwnerDocument from @react-aria/utils instead.",
- }],
- },
-}, {
+ 'no-restricted-globals': [
+ WARN,
+ {
+ name: 'window',
+ message: 'Use getOwnerWindow from @react-aria/utils instead.'
+ },
+ {
+ name: 'document',
+ message: 'Use getOwnerDocument from @react-aria/utils instead.'
+ }
+ ]
+ }
+ },
+ {
files: [
- "packages/@react-aria/test-utils/src/**/*.ts",
- "packages/@react-aria/test-utils/src/**/*.tsx",
+ 'packages/@react-aria/test-utils/src/**/*.ts',
+ 'packages/@react-aria/test-utils/src/**/*.tsx'
],
rules: {
- "rsp-rules/faster-node-contains": OFF,
- "rsp-rules/no-non-shadow-contains": OFF,
- "rsp-rules/shadow-safe-active-element": OFF,
- },
-}, {
- files: ["packages/@react-spectrum/s2/**", "packages/dev/s2-docs/**"],
+ 'rsp-rules/faster-node-contains': OFF,
+ 'rsp-rules/no-non-shadow-contains': OFF,
+ 'rsp-rules/shadow-safe-active-element': OFF
+ }
+ },
+ {
+ files: ['packages/@react-spectrum/s2/**', 'packages/dev/s2-docs/**'],
rules: {
- "react/react-in-jsx-scope": OFF,
- },
-}, {
- files: ["packages/dev/style-macro-chrome-plugin/**"],
+ 'react/react-in-jsx-scope': OFF
+ }
+ },
+ {
+ files: ['packages/dev/style-macro-chrome-plugin/**'],
languageOptions: {
- globals: {
- ...globals.webextensions,
- ...globals.browser
- }
+ globals: {
+ ...globals.webextensions,
+ ...globals.browser
+ }
}
-}];
+ }
+];
diff --git a/examples/next-app-csp/app/layout.tsx b/examples/next-app-csp/app/layout.tsx
index a295e627cd9..5ee1ee11539 100644
--- a/examples/next-app-csp/app/layout.tsx
+++ b/examples/next-app-csp/app/layout.tsx
@@ -1,34 +1,21 @@
-import type { Metadata } from "next";
-import { headers } from "next/headers";
-import {
- LocalizedStringProvider,
- createLocalizedStringDictionary,
-} from "@adobe/react-spectrum/i18n";
+import type {Metadata} from 'next';
+import {headers} from 'next/headers';
+import {LocalizedStringProvider, createLocalizedStringDictionary} from '@adobe/react-spectrum/i18n';
-const dictionary = createLocalizedStringDictionary([
- "@react-spectrum/datepicker",
-]);
+const dictionary = createLocalizedStringDictionary(['@react-spectrum/datepicker']);
export const metadata: Metadata = {
- title: "Create Next App",
- description: "Generated by create next app",
+ title: 'Create Next App',
+ description: 'Generated by create next app'
};
-export default function RootLayout({
- children,
-}: {
- children: React.ReactNode;
-}) {
- const nonce = headers().get("x-nonce");
- console.log("nonce", nonce);
+export default function RootLayout({children}: {children: React.ReactNode}) {
+ const nonce = headers().get('x-nonce');
+ console.log('nonce', nonce);
return (
-
+
{children}
diff --git a/examples/next-app-csp/app/page.tsx b/examples/next-app-csp/app/page.tsx
index 368ec781f6b..13f1cab94e9 100644
--- a/examples/next-app-csp/app/page.tsx
+++ b/examples/next-app-csp/app/page.tsx
@@ -1,11 +1,11 @@
-"use client";
+'use client';
import {Provider, defaultTheme, DatePicker} from '@adobe/react-spectrum';
import {useRouter} from 'next/navigation';
declare module '@adobe/react-spectrum' {
interface RouterConfig {
- routerOptions: NonNullable
['push']>[1]>
+ routerOptions: NonNullable['push']>[1]>;
}
}
@@ -15,5 +15,5 @@ export default function Home() {
- )
+ );
}
diff --git a/examples/next-app-csp/middleware.tsx b/examples/next-app-csp/middleware.tsx
index 3661cf4943b..47c1b659bfc 100644
--- a/examples/next-app-csp/middleware.tsx
+++ b/examples/next-app-csp/middleware.tsx
@@ -1,12 +1,12 @@
-import { NextResponse } from "next/server";
+import {NextResponse} from 'next/server';
export function middleware(request: Request) {
- const nonce = Buffer.from(crypto.randomUUID()).toString("base64");
+ const nonce = Buffer.from(crypto.randomUUID()).toString('base64');
const cspHeader = `
default-src 'self';
script-src 'self' 'nonce-${nonce}' 'strict-dynamic' https: http: 'unsafe-inline' ${
- process.env.NODE_ENV === "production" ? "" : `'unsafe-eval'`
- };
+ process.env.NODE_ENV === 'production' ? '' : `'unsafe-eval'`
+ };
style-src 'self' 'unsafe-inline';
img-src 'self' blob: data:;
font-src 'self';
@@ -17,26 +17,18 @@ export function middleware(request: Request) {
upgrade-insecure-requests;
`;
// Replace newline characters and spaces
- const contentSecurityPolicyHeaderValue = cspHeader
- .replace(/\s{2,}/g, " ")
- .trim();
+ const contentSecurityPolicyHeaderValue = cspHeader.replace(/\s{2,}/g, ' ').trim();
const requestHeaders = new Headers(request.headers);
- requestHeaders.set("x-nonce", nonce);
- requestHeaders.set(
- "Content-Security-Policy",
- contentSecurityPolicyHeaderValue
- );
+ requestHeaders.set('x-nonce', nonce);
+ requestHeaders.set('Content-Security-Policy', contentSecurityPolicyHeaderValue);
const response = NextResponse.next({
request: {
- headers: requestHeaders,
- },
+ headers: requestHeaders
+ }
});
- response.headers.set(
- "Content-Security-Policy",
- contentSecurityPolicyHeaderValue
- );
+ response.headers.set('Content-Security-Policy', contentSecurityPolicyHeaderValue);
return response;
}
@@ -51,11 +43,11 @@ export const config = {
* - favicon.ico (favicon file)
*/
{
- source: "/((?!api|_next/static|_next/image|favicon.ico).*)",
+ source: '/((?!api|_next/static|_next/image|favicon.ico).*)',
missing: [
- { type: "header", key: "next-router-prefetch" },
- { type: "header", key: "purpose", value: "prefetch" },
- ],
- },
- ],
+ {type: 'header', key: 'next-router-prefetch'},
+ {type: 'header', key: 'purpose', value: 'prefetch'}
+ ]
+ }
+ ]
};
diff --git a/examples/next-app-csp/next.config.js b/examples/next-app-csp/next.config.js
index 98c0d8f2b42..098b0e0cf99 100644
--- a/examples/next-app-csp/next.config.js
+++ b/examples/next-app-csp/next.config.js
@@ -3,18 +3,16 @@ const glob = require('glob');
/** @type {import('next').NextConfig} */
const nextConfig = {
- webpack(config, { isServer }) {
+ webpack(config, {isServer}) {
if (!isServer) {
// Don't include any locale strings in the client JS bundle.
- config.plugins.push(localesPlugin.webpack({ locales: [] }));
+ config.plugins.push(localesPlugin.webpack({locales: []}));
}
return config;
},
- transpilePackages: [
- '@adobe/react-spectrum',
- '@react-spectrum/*',
- '@spectrum-icons/*',
- ].flatMap(spec => glob.sync(`${spec}`, { cwd: 'node_modules/' })),
-}
+ transpilePackages: ['@adobe/react-spectrum', '@react-spectrum/*', '@spectrum-icons/*'].flatMap(
+ spec => glob.sync(`${spec}`, {cwd: 'node_modules/'})
+ )
+};
-module.exports = nextConfig
+module.exports = nextConfig;
diff --git a/examples/next-app-csp/package.json b/examples/next-app-csp/package.json
index 7a0963de24f..a20ccb4d545 100644
--- a/examples/next-app-csp/package.json
+++ b/examples/next-app-csp/package.json
@@ -2,6 +2,12 @@
"name": "next-app",
"version": "0.1.0",
"private": true,
+ "workspaces": [
+ "../../packages/react-aria-components",
+ "../../packages/react-aria",
+ "../../packages/react-stately",
+ "../../packages/*/*"
+ ],
"scripts": {
"dev": "next dev",
"build": "next build",
@@ -20,12 +26,6 @@
"glob": "^11.0.3",
"typescript": "^5"
},
- "workspaces": [
- "../../packages/react-aria-components",
- "../../packages/react-aria",
- "../../packages/react-stately",
- "../../packages/*/*"
- ],
"resolutions": {
"react": "link:../../node_modules/react",
"react-dom": "link:../../node_modules/react-dom"
diff --git a/examples/next-app/app/layout.tsx b/examples/next-app/app/layout.tsx
index 1491fb5cc44..60ac6b58bdd 100644
--- a/examples/next-app/app/layout.tsx
+++ b/examples/next-app/app/layout.tsx
@@ -1,18 +1,14 @@
-import type { Metadata } from 'next'
+import type {Metadata} from 'next';
import {LocalizedStringProvider, createLocalizedStringDictionary} from '@adobe/react-spectrum/i18n';
const dictionary = createLocalizedStringDictionary(['@react-spectrum/datepicker']);
export const metadata: Metadata = {
title: 'Create Next App',
- description: 'Generated by create next app',
-}
+ description: 'Generated by create next app'
+};
-export default function RootLayout({
- children,
-}: {
- children: React.ReactNode
-}) {
+export default function RootLayout({children}: {children: React.ReactNode}) {
return (
@@ -20,5 +16,5 @@ export default function RootLayout({
{children}
- )
+ );
}
diff --git a/examples/next-app/app/page.tsx b/examples/next-app/app/page.tsx
index 368ec781f6b..13f1cab94e9 100644
--- a/examples/next-app/app/page.tsx
+++ b/examples/next-app/app/page.tsx
@@ -1,11 +1,11 @@
-"use client";
+'use client';
import {Provider, defaultTheme, DatePicker} from '@adobe/react-spectrum';
import {useRouter} from 'next/navigation';
declare module '@adobe/react-spectrum' {
interface RouterConfig {
- routerOptions: NonNullable['push']>[1]>
+ routerOptions: NonNullable['push']>[1]>;
}
}
@@ -15,5 +15,5 @@ export default function Home() {
- )
+ );
}
diff --git a/examples/next-app/next.config.js b/examples/next-app/next.config.js
index 98c0d8f2b42..098b0e0cf99 100644
--- a/examples/next-app/next.config.js
+++ b/examples/next-app/next.config.js
@@ -3,18 +3,16 @@ const glob = require('glob');
/** @type {import('next').NextConfig} */
const nextConfig = {
- webpack(config, { isServer }) {
+ webpack(config, {isServer}) {
if (!isServer) {
// Don't include any locale strings in the client JS bundle.
- config.plugins.push(localesPlugin.webpack({ locales: [] }));
+ config.plugins.push(localesPlugin.webpack({locales: []}));
}
return config;
},
- transpilePackages: [
- '@adobe/react-spectrum',
- '@react-spectrum/*',
- '@spectrum-icons/*',
- ].flatMap(spec => glob.sync(`${spec}`, { cwd: 'node_modules/' })),
-}
+ transpilePackages: ['@adobe/react-spectrum', '@react-spectrum/*', '@spectrum-icons/*'].flatMap(
+ spec => glob.sync(`${spec}`, {cwd: 'node_modules/'})
+ )
+};
-module.exports = nextConfig
+module.exports = nextConfig;
diff --git a/examples/next-app/package.json b/examples/next-app/package.json
index da7f165b083..adbc149e641 100644
--- a/examples/next-app/package.json
+++ b/examples/next-app/package.json
@@ -2,7 +2,12 @@
"name": "next-app",
"version": "0.1.0",
"private": true,
- "packageManager": "yarn@4.2.2",
+ "workspaces": [
+ "../../packages/react-aria-components",
+ "../../packages/react-aria",
+ "../../packages/react-stately",
+ "../../packages/*/*"
+ ],
"scripts": {
"dev": "next dev",
"build": "next build",
@@ -21,14 +26,9 @@
"glob": "^11.0.3",
"typescript": "^5"
},
- "workspaces": [
- "../../packages/react-aria-components",
- "../../packages/react-aria",
- "../../packages/react-stately",
- "../../packages/*/*"
- ],
"resolutions": {
"react": "link:../../node_modules/react",
"react-dom": "link:../../node_modules/react-dom"
- }
+ },
+ "packageManager": "yarn@4.2.2"
}
diff --git a/examples/rac-spectrum-tailwind/package.json b/examples/rac-spectrum-tailwind/package.json
index 66da2477513..47362214f2a 100644
--- a/examples/rac-spectrum-tailwind/package.json
+++ b/examples/rac-spectrum-tailwind/package.json
@@ -1,7 +1,6 @@
{
"name": "rac-spectrum-tailwind-example",
"private": true,
- "packageManager": "yarn@4.2.2",
"scripts": {
"start": "parcel src/index.html",
"build": "PARCEL_WORKER_BACKEND=process parcel build src/index.html",
@@ -24,5 +23,6 @@
},
"devDependencies": {
"process": "^0.11.10"
- }
+ },
+ "packageManager": "yarn@4.2.2"
}
diff --git a/examples/rac-spectrum-tailwind/src/App.js b/examples/rac-spectrum-tailwind/src/App.js
index ede6335c844..a4dadfde448 100644
--- a/examples/rac-spectrum-tailwind/src/App.js
+++ b/examples/rac-spectrum-tailwind/src/App.js
@@ -1,15 +1,15 @@
-import { useState } from "react";
-import { defaultTheme, Link, Provider } from "@adobe/react-spectrum";
-import User from "@spectrum-icons/workflow/User";
-import UserGroup from "@spectrum-icons/workflow/UserGroup";
-import Building from "@spectrum-icons/workflow/Building";
-import ThemeSwitcher from "./ThemeSwitcher";
-import { SelectBoxGroup, SelectBox } from "./components/SelectBoxGroup";
-import { SentimentRatingGroup } from "./components/SentimentRatingGroup";
-import { NavigationBox } from "./components/NavigationBox";
-import { StarRatingGroup } from "./components/StarRatingGroup";
-import { GenInputField } from "./components/GenInputField";
-import { PlanSwitcher } from "./components/PlanSwitcher";
+import {useState} from 'react';
+import {defaultTheme, Link, Provider} from '@adobe/react-spectrum';
+import User from '@spectrum-icons/workflow/User';
+import UserGroup from '@spectrum-icons/workflow/UserGroup';
+import Building from '@spectrum-icons/workflow/Building';
+import ThemeSwitcher from './ThemeSwitcher';
+import {SelectBoxGroup, SelectBox} from './components/SelectBoxGroup';
+import {SentimentRatingGroup} from './components/SentimentRatingGroup';
+import {NavigationBox} from './components/NavigationBox';
+import {StarRatingGroup} from './components/StarRatingGroup';
+import {GenInputField} from './components/GenInputField';
+import {PlanSwitcher} from './components/PlanSwitcher';
export function App() {
let [colorScheme, setColorScheme] = useState(undefined);
@@ -22,56 +22,49 @@ export function App() {
-
- Intro
-
+ Intro
📙 Overview
- This resource is meant to help you get started with creating custom
- components using{" "}
+ This resource is meant to help you get started with creating custom components using{' '}
React Aria Components
- {" "}
- and Tailwind CSS, with
- a theme that features{" "}
- Spectrum styles and
- values. The goal for this is to enable you to deliver accessible
- custom Spectrum components more quickly.
+ {' '}
+ and Tailwind CSS, with a theme that
+ features Spectrum styles and values. The
+ goal for this is to enable you to deliver accessible custom Spectrum components more
+ quickly.
✅ When to use this
- When you need to implement a component that follows Spectrum
- guidelines, but doesn't exist in React Spectrum.
+ When you need to implement a component that follows Spectrum guidelines, but doesn't
+ exist in React Spectrum.
❌ When not to use this
- When you want to avoid patterns specifically outlined by Spectrum,
- or when a React Spectrum component already exists for your use case.
+ When you want to avoid patterns specifically outlined by Spectrum, or when a React
+ Spectrum component already exists for your use case.
⚠️ Risks
- Since you're taking ownership of the components you build, you still
- need to ensure they follow Spectrum guidelines and accessibility
- guidelines.
+ Since you're taking ownership of the components you build, you still need to ensure they
+ follow Spectrum guidelines and accessibility guidelines.
-
- Setup
-
+ Setup
📦 Install dependencies
- We need to install{" "}
+ We need to install{' '}
React Spectrum
- ,{" "}
+ ,{' '}
React Aria Components
- , and the{" "}
+ , and the{' '}
RAC Tailwind plugin
@@ -82,27 +75,23 @@ export function App() {
tailwindcss-react-aria-components
- Note that the reason React Spectrum is needed, is because the
- Provider will provide CSS variables that our theme will
- reference.
+ Note that the reason React Spectrum is needed, is because the Provider will provide
+ CSS variables that our theme will reference.
⚡ Install Tailwind
- Follow the instructions in the{" "}
-
- Tailwind Docs
- {" "}
- based on your build setup.{" "}
+ Follow the instructions in the{' '}
+ Tailwind Docs based on
+ your build setup.{' '}
🛠️ Configure Tailwind
- In your tailwind.config.js, include the preset from this
- template:
+ In your tailwind.config.js, include the preset from this template:
{`/** @type {import('tailwindcss').Config} */
module.exports = {
@@ -117,70 +106,52 @@ module.exports = {
- Then, add a React Spectrum{" "}
+ Then, add a React Spectrum{' '}
Provider
- {" "}
- to your app if one doesn't already exist. This will ensure that
- your page has access to the proper CSS variables. If you include
- these variables using some other method, that will work too.
+ {' '}
+ to your app if one doesn't already exist. This will ensure that your page has access
+ to the proper CSS variables. If you include these variables using some other method,
+ that will work too.
-
- Usage
-
+ Usage
🎨 Add styles
-
- You can now use Tailwind classes to style your components.
-
+
You can now use Tailwind classes to style your components.
Here are some examples:
- Using ring{" "}
- will give you a focus ring with good default Spectrum styles for
- it's color, width, and offset.
+ Using ring will give you a focus
+ ring with good default Spectrum styles for it's color, width, and offset.
- Using{" "}
- bg-blue-600{" "}
- will give you a background that matches
- --spectrum-global-color-blue-600.
+ Using bg-blue-600 will give you a
+ background that matches --spectrum-global-color-blue-600.
- Using w-25{" "}
- will give you a width of
- var(--spectrum-global-dimension-size-25).
+ Using w-25 will give you a width
+ of var(--spectrum-global-dimension-size-25).
- Using{" "}
-
- ease-in duration-100
- {" "}
- will give you a transition that matches Spectrum's motion
- values.
+ Using ease-in duration-100 will
+ give you a transition that matches Spectrum's motion values.
- Using{" "}
- sm:text-left{" "}
- will give you left text alignment for small width devices based
- on Spectrum's break points.
+ Using sm:text-left will give you
+ left text alignment for small width devices based on Spectrum's break points.
- Using{" "}
- dark:bg-black{" "}
- will give you a black background if the user is in dark mode
- based on the React Spectrum provider.
+ Using dark:bg-black will give you
+ a black background if the user is in dark mode based on the React Spectrum provider.
-
- 🪄 Styling based on state
-
- To see how to add Tailwind styles based on state, see the{" "}
+
🪄 Styling based on state
+ To see how to add Tailwind styles based on state, see the{' '}
RAC Styling docs
@@ -195,11 +166,7 @@ module.exports = {
- }
- description="For 1 person"
- />
+ } description="For 1 person" />
}
@@ -215,20 +182,12 @@ module.exports = {
-
- Navigation Boxes
-
+
Navigation Boxes
-
+
Premium
-
+
Templates
@@ -242,9 +201,7 @@ module.exports = {
-
- GenAI Input
-
+
GenAI Input
diff --git a/examples/rac-spectrum-tailwind/src/ThemeSwitcher.js b/examples/rac-spectrum-tailwind/src/ThemeSwitcher.js
index 7b05e2f724c..71fa7aeb49a 100644
--- a/examples/rac-spectrum-tailwind/src/ThemeSwitcher.js
+++ b/examples/rac-spectrum-tailwind/src/ThemeSwitcher.js
@@ -1,20 +1,16 @@
-import { useProvider, ActionButton } from "@adobe/react-spectrum";
-import Moon from "@spectrum-icons/workflow/Moon";
-import Light from "@spectrum-icons/workflow/Light";
+import {useProvider, ActionButton} from '@adobe/react-spectrum';
+import Moon from '@spectrum-icons/workflow/Moon';
+import Light from '@spectrum-icons/workflow/Light';
-export default function ThemeSwitcher({ setColorScheme }) {
- let { colorScheme } = useProvider();
- let label =
- colorScheme === "dark" ? "Switch to light theme" : "Switch to dark theme";
- let otherScheme = colorScheme === "light" ? "dark" : "light";
+export default function ThemeSwitcher({setColorScheme}) {
+ let {colorScheme} = useProvider();
+ let label = colorScheme === 'dark' ? 'Switch to light theme' : 'Switch to dark theme';
+ let otherScheme = colorScheme === 'light' ? 'dark' : 'light';
return (
-
setColorScheme(otherScheme)}
- >
- {colorScheme === "dark" ? : }
+ setColorScheme(otherScheme)}>
+ {colorScheme === 'dark' ? : }
);
diff --git a/examples/rac-spectrum-tailwind/src/components/GenInputField.tsx b/examples/rac-spectrum-tailwind/src/components/GenInputField.tsx
index 717d00334c4..a9dc9746958 100644
--- a/examples/rac-spectrum-tailwind/src/components/GenInputField.tsx
+++ b/examples/rac-spectrum-tailwind/src/components/GenInputField.tsx
@@ -1,29 +1,26 @@
-import { useState } from "react";
-import { Input, Group, TextField, Button } from "react-aria-components";
+import {useState} from 'react';
+import {Input, Group, TextField, Button} from 'react-aria-components';
export function GenInputField() {
- let [value, setValue] = useState("");
+ let [value, setValue] = useState('');
let [isTextFieldFocused, setIsTextFieldFocused] = useState(false);
return (
+ isTextFieldFocused ? 'ring' : ''
+ }`}>
setIsTextFieldFocused(true)}
onBlur={() => setIsTextFieldFocused(false)}
value={value}
onChange={setValue}
aria-label="Prompt"
- className="grow h-full p-150"
- >
+ className="grow h-full p-150">
+ isDisabled={value === ''}
+ className="self-end my-auto font-semibold text-white rounded-full disabled:bg-gray-300 disabled:text-gray-500 mx-200 bg-accent-800 p-150 focus-visible:ring focus:outline-hidden">
Generate
diff --git a/examples/rac-spectrum-tailwind/src/components/NavigationBox.tsx b/examples/rac-spectrum-tailwind/src/components/NavigationBox.tsx
index 0d1482ebead..e9b296595cb 100644
--- a/examples/rac-spectrum-tailwind/src/components/NavigationBox.tsx
+++ b/examples/rac-spectrum-tailwind/src/components/NavigationBox.tsx
@@ -1,21 +1,17 @@
-import { Link, LinkProps } from "react-aria-components";
+import {Link, LinkProps} from 'react-aria-components';
-interface NavigationBoxProps extends Omit {
+interface NavigationBoxProps extends Omit {
children?: React.ReactNode;
src?: string;
}
-export function NavigationBox({ children, src, ...other }: NavigationBoxProps) {
+export function NavigationBox({children, src, ...other}: NavigationBoxProps) {
return (
-
+ {...other}>
+
{children}
diff --git a/examples/rac-spectrum-tailwind/src/components/PlanSwitcher.tsx b/examples/rac-spectrum-tailwind/src/components/PlanSwitcher.tsx
index 1b17d442f59..af33d7b7569 100644
--- a/examples/rac-spectrum-tailwind/src/components/PlanSwitcher.tsx
+++ b/examples/rac-spectrum-tailwind/src/components/PlanSwitcher.tsx
@@ -1,19 +1,18 @@
-import { Radio, RadioGroup, Label } from "react-aria-components";
+import {Radio, RadioGroup, Label} from 'react-aria-components';
interface OptionProps {
- side: "start" | "end";
+ side: 'start' | 'end';
value: string;
children: React.ReactNode;
}
-function Option({ side, value, children }: OptionProps) {
+function Option({side, value, children}: OptionProps) {
return (
+ side === 'start' ? 'rounded-s' : 'rounded-e'
+ } selected:border-accent-800 selected:bg-accent-100 selected:text-accent-900 focus-visible:ring-half ring-offset-0`}>
{children}
);
@@ -21,10 +20,7 @@ function Option({ side, value, children }: OptionProps) {
export function PlanSwitcher() {
return (
-
+
Plan Switcher
diff --git a/examples/rac-spectrum-tailwind/src/components/SelectBoxGroup.tsx b/examples/rac-spectrum-tailwind/src/components/SelectBoxGroup.tsx
index 31e2367f55a..98c57a065d6 100644
--- a/examples/rac-spectrum-tailwind/src/components/SelectBoxGroup.tsx
+++ b/examples/rac-spectrum-tailwind/src/components/SelectBoxGroup.tsx
@@ -1,16 +1,12 @@
-import type { RadioGroupProps } from "react-aria-components";
-import { Label, Radio, RadioGroup, Text } from "react-aria-components";
+import type {RadioGroupProps} from 'react-aria-components';
+import {Label, Radio, RadioGroup, Text} from 'react-aria-components';
-interface SelectBoxGroupProps extends Omit {
+interface SelectBoxGroupProps extends Omit {
children?: React.ReactNode;
label?: string;
}
-export function SelectBoxGroup({
- label,
- children,
- ...props
-}: SelectBoxGroupProps) {
+export function SelectBoxGroup({label, children, ...props}: SelectBoxGroupProps) {
return (
{label}
@@ -25,13 +21,12 @@ interface SelectBoxProps {
description?: string;
}
-export function SelectBox({ name, icon, description }: SelectBoxProps) {
+export function SelectBox({name, icon, description}: SelectBoxProps) {
return (
- {({ isSelected }) => (
+ className="flex justify-center bg-white border rounded dark:bg-black p-160 m-160 h-2000 w-2000 focus:outline-hidden focus-visible:ring-half focus-visible:ring-offset-0 selected:bg-accent-100 selected:border-accent-700">
+ {({isSelected}) => (
{isSelected && (
@@ -40,8 +35,7 @@ export function SelectBox({ name, icon, description }: SelectBoxProps) {
className="fill-gray-75 pt-[2px] pl-[2px]"
focusable="false"
aria-hidden="true"
- role="img"
- >
+ role="img">
diff --git a/examples/rac-spectrum-tailwind/src/components/SentimentRatingGroup.tsx b/examples/rac-spectrum-tailwind/src/components/SentimentRatingGroup.tsx
index 47da1fd8a54..a55b5a00ed8 100644
--- a/examples/rac-spectrum-tailwind/src/components/SentimentRatingGroup.tsx
+++ b/examples/rac-spectrum-tailwind/src/components/SentimentRatingGroup.tsx
@@ -1,11 +1,6 @@
-import {
- Label,
- Radio,
- RadioGroup,
- RadioGroupProps,
-} from "react-aria-components";
+import {Label, Radio, RadioGroup, RadioGroupProps} from 'react-aria-components';
-interface SentimentRatingGroupProps extends Omit
{
+interface SentimentRatingGroupProps extends Omit {
ratings?: string[];
value?: string;
defaultValue?: string;
@@ -13,22 +8,21 @@ interface SentimentRatingGroupProps extends Omit {
}
export function SentimentRatingGroup({
- ratings = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ratings = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
...other
}: SentimentRatingGroupProps) {
return (
+ {...other}>
Sentiment Rating
Least Likely
Most Likely
- {ratings.map((rating) => (
+ {ratings.map(rating => (
))}
@@ -36,12 +30,11 @@ export function SentimentRatingGroup({
);
}
-export function SentimentRating({ rating }: { rating: string }) {
+export function SentimentRating({rating}: {rating: string}) {
return (
+ className="flex items-center justify-center bg-white border rounded-full disabled:bg-gray-200 disabled:text-gray-400 p-160 m-75 h-200 w-200 focus:outline-hidden focus-visible:ring dark:bg-black selected:bg-accent-800 dark:selected:bg-accent-800 selected:border-accent-800 selected:text-white pressed:bg-gray-200 dark:pressed:bg-gray-200 hover:border-gray-300">
{rating}
);
diff --git a/examples/rac-spectrum-tailwind/src/components/StarRatingGroup.tsx b/examples/rac-spectrum-tailwind/src/components/StarRatingGroup.tsx
index c11baf10160..95c3e580c1b 100644
--- a/examples/rac-spectrum-tailwind/src/components/StarRatingGroup.tsx
+++ b/examples/rac-spectrum-tailwind/src/components/StarRatingGroup.tsx
@@ -1,13 +1,7 @@
-import React, { useState } from "react";
-import {
- Group,
- Label,
- Radio,
- RadioGroup,
- RadioGroupProps,
-} from "react-aria-components";
+import React, {useState} from 'react';
+import {Group, Label, Radio, RadioGroup, RadioGroupProps} from 'react-aria-components';
-interface StarRatingGroupProps extends Omit {
+interface StarRatingGroupProps extends Omit {
ratingCount?: number;
value?: string;
defaultValue?: string;
@@ -19,16 +13,13 @@ interface StarRatingGroupProps extends Omit {
export function StarRatingGroup({
ratingCount = 5,
isEmphasized = false,
- label = "Rating",
+ label = 'Rating',
...other
}: StarRatingGroupProps) {
- let allRatings = Array.from(Array(ratingCount).keys()).map((i) =>
- String(i + 1)
- );
+ let allRatings = Array.from(Array(ratingCount).keys()).map(i => String(i + 1));
// Track which rating is hovered at the group level.
- let [hoveredRating, setHoveredRating] =
- useState(undefined);
+ let [hoveredRating, setHoveredRating] = useState(undefined);
let onPointerOver = (e: React.PointerEvent) => {
if ((e.target as HTMLElement).dataset?.rating) {
@@ -44,22 +35,17 @@ export function StarRatingGroup({
- {({ state }) => (
+ {...other}>
+ {({state}) => (
<>
{label}
-
+
- {allRatings.map((rating) => (
+ onPointerLeave={onPointerOut}>
+ {allRatings.map(rating => (
- {({ isHovered, isSelected }) => (
+ {({isHovered, isSelected}) => (
<>
+ height={18}>
{isFilled ? (
) : (
@@ -114,10 +97,7 @@ export function StarRating({
)}
{isHovered && isSelected && (
-
+
)}
>
)}
diff --git a/examples/rac-spectrum-tailwind/src/index.html b/examples/rac-spectrum-tailwind/src/index.html
index bd9cbfce20f..ddfa87c7a43 100644
--- a/examples/rac-spectrum-tailwind/src/index.html
+++ b/examples/rac-spectrum-tailwind/src/index.html
@@ -1,13 +1,13 @@
-
-
- React Aria Components + Spectrum + Tailwind
-
-
-
-
-
-
-
+
+
+ React Aria Components + Spectrum + Tailwind
+
+
+
+
+
+
+
diff --git a/examples/rac-spectrum-tailwind/src/index.js b/examples/rac-spectrum-tailwind/src/index.js
index 39c39b6b611..d12f959a5b5 100644
--- a/examples/rac-spectrum-tailwind/src/index.js
+++ b/examples/rac-spectrum-tailwind/src/index.js
@@ -1,6 +1,5 @@
-import { createRoot } from "react-dom/client";
-import { App } from './App';
+import {createRoot} from 'react-dom/client';
+import {App} from './App';
let root = createRoot(document.getElementById('root'));
root.render( );
-
diff --git a/examples/rac-spectrum-tailwind/src/spectrum-preset.js b/examples/rac-spectrum-tailwind/src/spectrum-preset.js
index 33a023de5bc..127202d74d2 100644
--- a/examples/rac-spectrum-tailwind/src/spectrum-preset.js
+++ b/examples/rac-spectrum-tailwind/src/spectrum-preset.js
@@ -1,553 +1,551 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
future: {
- respectDefaultRingColorOpacity: true,
+ respectDefaultRingColorOpacity: true
},
- darkMode: ["class", '[style*="color-scheme: dark;"]'],
+ darkMode: ['class', '[style*="color-scheme: dark;"]'],
theme: {
extend: {
ringOffsetWidth: {
- DEFAULT: "var(--spectrum-alias-focus-ring-gap)",
+ DEFAULT: 'var(--spectrum-alias-focus-ring-gap)'
},
textColor: {
- DEFAULT: "var(--spectrum-alias-text-color)",
+ DEFAULT: 'var(--spectrum-alias-text-color)'
},
ringOffsetColor: {
- DEFAULT: "var(--spectrum-alias-background-color-default)",
- },
+ DEFAULT: 'var(--spectrum-alias-background-color-default)'
+ }
},
screens: {
- xs: "304px",
- sm: "768px",
- md: "1280px",
- lg: "1768px",
- xl: "2160px",
+ xs: '304px',
+ sm: '768px',
+ md: '1280px',
+ lg: '1768px',
+ xl: '2160px'
},
/** https://spectrum.adobe.com/page/color-system/ */
colors: {
- white: "var(--spectrum-global-color-static-white)",
- black: "var(--spectrum-global-color-static-black)",
- transparent: "var(--spectrum-alias-global-color-transparent)",
+ white: 'var(--spectrum-global-color-static-white)',
+ black: 'var(--spectrum-global-color-static-black)',
+ transparent: 'var(--spectrum-alias-global-color-transparent)',
gray: {
- 50: "var(--spectrum-gray-50)",
- 75: "var(--spectrum-gray-75)",
- 100: "var(--spectrum-gray-100)",
- 200: "var(--spectrum-gray-200)",
- 300: "var(--spectrum-gray-300)",
- 400: "var(--spectrum-gray-400)",
- 500: "var(--spectrum-gray-500)",
- 600: "var(--spectrum-gray-600)",
- 700: "var(--spectrum-gray-700)",
- 800: "var(--spectrum-gray-800)",
- 900: "var(--spectrum-gray-900)",
+ 50: 'var(--spectrum-gray-50)',
+ 75: 'var(--spectrum-gray-75)',
+ 100: 'var(--spectrum-gray-100)',
+ 200: 'var(--spectrum-gray-200)',
+ 300: 'var(--spectrum-gray-300)',
+ 400: 'var(--spectrum-gray-400)',
+ 500: 'var(--spectrum-gray-500)',
+ 600: 'var(--spectrum-gray-600)',
+ 700: 'var(--spectrum-gray-700)',
+ 800: 'var(--spectrum-gray-800)',
+ 900: 'var(--spectrum-gray-900)'
},
blue: {
- DEFAULT: "var(--spectrum-global-color-static-blue)",
- 100: "var(--spectrum-blue-100)",
- 200: "var(--spectrum-blue-200)",
- 300: "var(--spectrum-blue-300)",
- 400: "var(--spectrum-blue-400)",
- 500: "var(--spectrum-blue-500)",
- 600: "var(--spectrum-blue-600)",
- 700: "var(--spectrum-blue-700)",
- 800: "var(--spectrum-blue-800)",
- 900: "var(--spectrum-blue-900)",
- 1000: "var(--spectrum-blue-1000)",
- 1100: "var(--spectrum-blue-1100)",
- 1200: "var(--spectrum-blue-1200)",
- 1300: "var(--spectrum-blue-1300)",
- 1400: "var(--spectrum-blue-1400)",
+ DEFAULT: 'var(--spectrum-global-color-static-blue)',
+ 100: 'var(--spectrum-blue-100)',
+ 200: 'var(--spectrum-blue-200)',
+ 300: 'var(--spectrum-blue-300)',
+ 400: 'var(--spectrum-blue-400)',
+ 500: 'var(--spectrum-blue-500)',
+ 600: 'var(--spectrum-blue-600)',
+ 700: 'var(--spectrum-blue-700)',
+ 800: 'var(--spectrum-blue-800)',
+ 900: 'var(--spectrum-blue-900)',
+ 1000: 'var(--spectrum-blue-1000)',
+ 1100: 'var(--spectrum-blue-1100)',
+ 1200: 'var(--spectrum-blue-1200)',
+ 1300: 'var(--spectrum-blue-1300)',
+ 1400: 'var(--spectrum-blue-1400)'
},
green: {
- 100: "var(--spectrum-green-100)",
- 200: "var(--spectrum-green-200)",
- 300: "var(--spectrum-green-300)",
- 400: "var(--spectrum-green-400)",
- 500: "var(--spectrum-green-500)",
- 600: "var(--spectrum-green-600)",
- 700: "var(--spectrum-green-700)",
- 800: "var(--spectrum-green-800)",
- 900: "var(--spectrum-green-900)",
- 1000: "var(--spectrum-green-1000)",
- 1100: "var(--spectrum-green-1100)",
- 1200: "var(--spectrum-green-1200)",
- 1300: "var(--spectrum-green-1300)",
- 1400: "var(--spectrum-green-1400)",
+ 100: 'var(--spectrum-green-100)',
+ 200: 'var(--spectrum-green-200)',
+ 300: 'var(--spectrum-green-300)',
+ 400: 'var(--spectrum-green-400)',
+ 500: 'var(--spectrum-green-500)',
+ 600: 'var(--spectrum-green-600)',
+ 700: 'var(--spectrum-green-700)',
+ 800: 'var(--spectrum-green-800)',
+ 900: 'var(--spectrum-green-900)',
+ 1000: 'var(--spectrum-green-1000)',
+ 1100: 'var(--spectrum-green-1100)',
+ 1200: 'var(--spectrum-green-1200)',
+ 1300: 'var(--spectrum-green-1300)',
+ 1400: 'var(--spectrum-green-1400)'
},
orange: {
- 100: "var(--spectrum-orange-100)",
- 200: "var(--spectrum-orange-200)",
- 300: "var(--spectrum-orange-300)",
- 400: "var(--spectrum-orange-400)",
- 500: "var(--spectrum-orange-500)",
- 600: "var(--spectrum-orange-600)",
- 700: "var(--spectrum-orange-700)",
- 800: "var(--spectrum-orange-800)",
- 900: "var(--spectrum-orange-900)",
- 1000: "var(--spectrum-orange-1000)",
- 1100: "var(--spectrum-orange-1100)",
- 1200: "var(--spectrum-orange-1200)",
- 1300: "var(--spectrum-orange-1300)",
- 1400: "var(--spectrum-orange-1400)",
+ 100: 'var(--spectrum-orange-100)',
+ 200: 'var(--spectrum-orange-200)',
+ 300: 'var(--spectrum-orange-300)',
+ 400: 'var(--spectrum-orange-400)',
+ 500: 'var(--spectrum-orange-500)',
+ 600: 'var(--spectrum-orange-600)',
+ 700: 'var(--spectrum-orange-700)',
+ 800: 'var(--spectrum-orange-800)',
+ 900: 'var(--spectrum-orange-900)',
+ 1000: 'var(--spectrum-orange-1000)',
+ 1100: 'var(--spectrum-orange-1100)',
+ 1200: 'var(--spectrum-orange-1200)',
+ 1300: 'var(--spectrum-orange-1300)',
+ 1400: 'var(--spectrum-orange-1400)'
},
red: {
- 100: "var(--spectrum-red-100)",
- 200: "var(--spectrum-red-200)",
- 300: "var(--spectrum-red-300)",
- 400: "var(--spectrum-red-400)",
- 500: "var(--spectrum-red-500)",
- 600: "var(--spectrum-red-600)",
- 700: "var(--spectrum-red-700)",
- 800: "var(--spectrum-red-800)",
- 900: "var(--spectrum-red-900)",
- 1000: "var(--spectrum-red-1000)",
- 1100: "var(--spectrum-red-1100)",
- 1200: "var(--spectrum-red-1200)",
- 1300: "var(--spectrum-red-1300)",
- 1400: "var(--spectrum-red-1400)",
+ 100: 'var(--spectrum-red-100)',
+ 200: 'var(--spectrum-red-200)',
+ 300: 'var(--spectrum-red-300)',
+ 400: 'var(--spectrum-red-400)',
+ 500: 'var(--spectrum-red-500)',
+ 600: 'var(--spectrum-red-600)',
+ 700: 'var(--spectrum-red-700)',
+ 800: 'var(--spectrum-red-800)',
+ 900: 'var(--spectrum-red-900)',
+ 1000: 'var(--spectrum-red-1000)',
+ 1100: 'var(--spectrum-red-1100)',
+ 1200: 'var(--spectrum-red-1200)',
+ 1300: 'var(--spectrum-red-1300)',
+ 1400: 'var(--spectrum-red-1400)'
},
celery: {
- 100: "var(--spectrum-celery-100)",
- 200: "var(--spectrum-celery-200)",
- 300: "var(--spectrum-celery-300)",
- 400: "var(--spectrum-celery-400)",
- 500: "var(--spectrum-celery-500)",
- 600: "var(--spectrum-celery-600)",
- 700: "var(--spectrum-celery-700)",
- 800: "var(--spectrum-celery-800)",
- 900: "var(--spectrum-celery-900)",
- 1000: "var(--spectrum-celery-1000)",
- 1100: "var(--spectrum-celery-1100)",
- 1200: "var(--spectrum-celery-1200)",
- 1300: "var(--spectrum-celery-1300)",
- 1400: "var(--spectrum-celery-1400)",
+ 100: 'var(--spectrum-celery-100)',
+ 200: 'var(--spectrum-celery-200)',
+ 300: 'var(--spectrum-celery-300)',
+ 400: 'var(--spectrum-celery-400)',
+ 500: 'var(--spectrum-celery-500)',
+ 600: 'var(--spectrum-celery-600)',
+ 700: 'var(--spectrum-celery-700)',
+ 800: 'var(--spectrum-celery-800)',
+ 900: 'var(--spectrum-celery-900)',
+ 1000: 'var(--spectrum-celery-1000)',
+ 1100: 'var(--spectrum-celery-1100)',
+ 1200: 'var(--spectrum-celery-1200)',
+ 1300: 'var(--spectrum-celery-1300)',
+ 1400: 'var(--spectrum-celery-1400)'
},
chartreuse: {
- 100: "var(--spectrum-chartreuse-100)",
- 200: "var(--spectrum-chartreuse-200)",
- 300: "var(--spectrum-chartreuse-300)",
- 400: "var(--spectrum-chartreuse-400)",
- 500: "var(--spectrum-chartreuse-500)",
- 600: "var(--spectrum-chartreuse-600)",
- 700: "var(--spectrum-chartreuse-700)",
- 800: "var(--spectrum-chartreuse-800)",
- 900: "var(--spectrum-chartreuse-900)",
- 1000: "var(--spectrum-chartreuse-1000)",
- 1100: "var(--spectrum-chartreuse-1100)",
- 1200: "var(--spectrum-chartreuse-1200)",
- 1300: "var(--spectrum-chartreuse-1300)",
- 1400: "var(--spectrum-chartreuse-1400)",
+ 100: 'var(--spectrum-chartreuse-100)',
+ 200: 'var(--spectrum-chartreuse-200)',
+ 300: 'var(--spectrum-chartreuse-300)',
+ 400: 'var(--spectrum-chartreuse-400)',
+ 500: 'var(--spectrum-chartreuse-500)',
+ 600: 'var(--spectrum-chartreuse-600)',
+ 700: 'var(--spectrum-chartreuse-700)',
+ 800: 'var(--spectrum-chartreuse-800)',
+ 900: 'var(--spectrum-chartreuse-900)',
+ 1000: 'var(--spectrum-chartreuse-1000)',
+ 1100: 'var(--spectrum-chartreuse-1100)',
+ 1200: 'var(--spectrum-chartreuse-1200)',
+ 1300: 'var(--spectrum-chartreuse-1300)',
+ 1400: 'var(--spectrum-chartreuse-1400)'
},
cyan: {
- 100: "var(--spectrum-cyan-100)",
- 200: "var(--spectrum-cyan-200)",
- 300: "var(--spectrum-cyan-300)",
- 400: "var(--spectrum-cyan-400)",
- 500: "var(--spectrum-cyan-500)",
- 600: "var(--spectrum-cyan-600)",
- 700: "var(--spectrum-cyan-700)",
- 800: "var(--spectrum-cyan-800)",
- 900: "var(--spectrum-cyan-900)",
- 1000: "var(--spectrum-cyan-1000)",
- 1100: "var(--spectrum-cyan-1100)",
- 1200: "var(--spectrum-cyan-1200)",
- 1300: "var(--spectrum-cyan-1300)",
- 1400: "var(--spectrum-cyan-1400)",
+ 100: 'var(--spectrum-cyan-100)',
+ 200: 'var(--spectrum-cyan-200)',
+ 300: 'var(--spectrum-cyan-300)',
+ 400: 'var(--spectrum-cyan-400)',
+ 500: 'var(--spectrum-cyan-500)',
+ 600: 'var(--spectrum-cyan-600)',
+ 700: 'var(--spectrum-cyan-700)',
+ 800: 'var(--spectrum-cyan-800)',
+ 900: 'var(--spectrum-cyan-900)',
+ 1000: 'var(--spectrum-cyan-1000)',
+ 1100: 'var(--spectrum-cyan-1100)',
+ 1200: 'var(--spectrum-cyan-1200)',
+ 1300: 'var(--spectrum-cyan-1300)',
+ 1400: 'var(--spectrum-cyan-1400)'
},
fuchsia: {
- 100: "var(--spectrum-fuchsia-100)",
- 200: "var(--spectrum-fuchsia-200)",
- 300: "var(--spectrum-fuchsia-300)",
- 400: "var(--spectrum-fuchsia-400)",
- 500: "var(--spectrum-fuchsia-500)",
- 600: "var(--spectrum-fuchsia-600)",
- 700: "var(--spectrum-fuchsia-700)",
- 800: "var(--spectrum-fuchsia-800)",
- 900: "var(--spectrum-fuchsia-900)",
- 1000: "var(--spectrum-fuchsia-1000)",
- 1100: "var(--spectrum-fuchsia-1100)",
- 1200: "var(--spectrum-fuchsia-1200)",
- 1300: "var(--spectrum-fuchsia-1300)",
- 1400: "var(--spectrum-fuchsia-1400)",
+ 100: 'var(--spectrum-fuchsia-100)',
+ 200: 'var(--spectrum-fuchsia-200)',
+ 300: 'var(--spectrum-fuchsia-300)',
+ 400: 'var(--spectrum-fuchsia-400)',
+ 500: 'var(--spectrum-fuchsia-500)',
+ 600: 'var(--spectrum-fuchsia-600)',
+ 700: 'var(--spectrum-fuchsia-700)',
+ 800: 'var(--spectrum-fuchsia-800)',
+ 900: 'var(--spectrum-fuchsia-900)',
+ 1000: 'var(--spectrum-fuchsia-1000)',
+ 1100: 'var(--spectrum-fuchsia-1100)',
+ 1200: 'var(--spectrum-fuchsia-1200)',
+ 1300: 'var(--spectrum-fuchsia-1300)',
+ 1400: 'var(--spectrum-fuchsia-1400)'
},
indigo: {
- 100: "var(--spectrum-indigo-100)",
- 200: "var(--spectrum-indigo-200)",
- 300: "var(--spectrum-indigo-300)",
- 400: "var(--spectrum-indigo-400)",
- 500: "var(--spectrum-indigo-500)",
- 600: "var(--spectrum-indigo-600)",
- 700: "var(--spectrum-indigo-700)",
- 800: "var(--spectrum-indigo-800)",
- 900: "var(--spectrum-indigo-900)",
- 1000: "var(--spectrum-indigo-1000)",
- 1100: "var(--spectrum-indigo-1100)",
- 1200: "var(--spectrum-indigo-1200)",
- 1300: "var(--spectrum-indigo-1300)",
- 1400: "var(--spectrum-indigo-1400)",
+ 100: 'var(--spectrum-indigo-100)',
+ 200: 'var(--spectrum-indigo-200)',
+ 300: 'var(--spectrum-indigo-300)',
+ 400: 'var(--spectrum-indigo-400)',
+ 500: 'var(--spectrum-indigo-500)',
+ 600: 'var(--spectrum-indigo-600)',
+ 700: 'var(--spectrum-indigo-700)',
+ 800: 'var(--spectrum-indigo-800)',
+ 900: 'var(--spectrum-indigo-900)',
+ 1000: 'var(--spectrum-indigo-1000)',
+ 1100: 'var(--spectrum-indigo-1100)',
+ 1200: 'var(--spectrum-indigo-1200)',
+ 1300: 'var(--spectrum-indigo-1300)',
+ 1400: 'var(--spectrum-indigo-1400)'
},
magenta: {
- 100: "var(--spectrum-magenta-100)",
- 200: "var(--spectrum-magenta-200)",
- 300: "var(--spectrum-magenta-300)",
- 400: "var(--spectrum-magenta-400)",
- 500: "var(--spectrum-magenta-500)",
- 600: "var(--spectrum-magenta-600)",
- 700: "var(--spectrum-magenta-700)",
- 800: "var(--spectrum-magenta-800)",
- 900: "var(--spectrum-magenta-900)",
- 1000: "var(--spectrum-magenta-1000)",
- 1100: "var(--spectrum-magenta-1100)",
- 1200: "var(--spectrum-magenta-1200)",
- 1300: "var(--spectrum-magenta-1300)",
- 1400: "var(--spectrum-magenta-1400)",
+ 100: 'var(--spectrum-magenta-100)',
+ 200: 'var(--spectrum-magenta-200)',
+ 300: 'var(--spectrum-magenta-300)',
+ 400: 'var(--spectrum-magenta-400)',
+ 500: 'var(--spectrum-magenta-500)',
+ 600: 'var(--spectrum-magenta-600)',
+ 700: 'var(--spectrum-magenta-700)',
+ 800: 'var(--spectrum-magenta-800)',
+ 900: 'var(--spectrum-magenta-900)',
+ 1000: 'var(--spectrum-magenta-1000)',
+ 1100: 'var(--spectrum-magenta-1100)',
+ 1200: 'var(--spectrum-magenta-1200)',
+ 1300: 'var(--spectrum-magenta-1300)',
+ 1400: 'var(--spectrum-magenta-1400)'
},
purple: {
- 100: "var(--spectrum-purple-100)",
- 200: "var(--spectrum-purple-200)",
- 300: "var(--spectrum-purple-300)",
- 400: "var(--spectrum-purple-400)",
- 500: "var(--spectrum-purple-500)",
- 600: "var(--spectrum-purple-600)",
- 700: "var(--spectrum-purple-700)",
- 800: "var(--spectrum-purple-800)",
- 900: "var(--spectrum-purple-900)",
- 1000: "var(--spectrum-purple-1000)",
- 1100: "var(--spectrum-purple-1100)",
- 1200: "var(--spectrum-purple-1200)",
- 1300: "var(--spectrum-purple-1300)",
- 1400: "var(--spectrum-purple-1400)",
+ 100: 'var(--spectrum-purple-100)',
+ 200: 'var(--spectrum-purple-200)',
+ 300: 'var(--spectrum-purple-300)',
+ 400: 'var(--spectrum-purple-400)',
+ 500: 'var(--spectrum-purple-500)',
+ 600: 'var(--spectrum-purple-600)',
+ 700: 'var(--spectrum-purple-700)',
+ 800: 'var(--spectrum-purple-800)',
+ 900: 'var(--spectrum-purple-900)',
+ 1000: 'var(--spectrum-purple-1000)',
+ 1100: 'var(--spectrum-purple-1100)',
+ 1200: 'var(--spectrum-purple-1200)',
+ 1300: 'var(--spectrum-purple-1300)',
+ 1400: 'var(--spectrum-purple-1400)'
},
seafoam: {
- 100: "var(--spectrum-seafoam-100)",
- 200: "var(--spectrum-seafoam-200)",
- 300: "var(--spectrum-seafoam-300)",
- 400: "var(--spectrum-seafoam-400)",
- 500: "var(--spectrum-seafoam-500)",
- 600: "var(--spectrum-seafoam-600)",
- 700: "var(--spectrum-seafoam-700)",
- 800: "var(--spectrum-seafoam-800)",
- 900: "var(--spectrum-seafoam-900)",
- 1000: "var(--spectrum-seafoam-1000)",
- 1100: "var(--spectrum-seafoam-1100)",
- 1200: "var(--spectrum-seafoam-1200)",
- 1300: "var(--spectrum-seafoam-1300)",
- 1400: "var(--spectrum-seafoam-1400)",
+ 100: 'var(--spectrum-seafoam-100)',
+ 200: 'var(--spectrum-seafoam-200)',
+ 300: 'var(--spectrum-seafoam-300)',
+ 400: 'var(--spectrum-seafoam-400)',
+ 500: 'var(--spectrum-seafoam-500)',
+ 600: 'var(--spectrum-seafoam-600)',
+ 700: 'var(--spectrum-seafoam-700)',
+ 800: 'var(--spectrum-seafoam-800)',
+ 900: 'var(--spectrum-seafoam-900)',
+ 1000: 'var(--spectrum-seafoam-1000)',
+ 1100: 'var(--spectrum-seafoam-1100)',
+ 1200: 'var(--spectrum-seafoam-1200)',
+ 1300: 'var(--spectrum-seafoam-1300)',
+ 1400: 'var(--spectrum-seafoam-1400)'
},
yellow: {
- 100: "var(--spectrum-yellow-100)",
- 200: "var(--spectrum-yellow-200)",
- 300: "var(--spectrum-yellow-300)",
- 400: "var(--spectrum-yellow-400)",
- 500: "var(--spectrum-yellow-500)",
- 600: "var(--spectrum-yellow-600)",
- 700: "var(--spectrum-yellow-700)",
- 800: "var(--spectrum-yellow-800)",
- 900: "var(--spectrum-yellow-900)",
- 1000: "var(--spectrum-yellow-1000)",
- 1100: "var(--spectrum-yellow-1100)",
- 1200: "var(--spectrum-yellow-1200)",
- 1300: "var(--spectrum-yellow-1300)",
- 1400: "var(--spectrum-yellow-1400)",
+ 100: 'var(--spectrum-yellow-100)',
+ 200: 'var(--spectrum-yellow-200)',
+ 300: 'var(--spectrum-yellow-300)',
+ 400: 'var(--spectrum-yellow-400)',
+ 500: 'var(--spectrum-yellow-500)',
+ 600: 'var(--spectrum-yellow-600)',
+ 700: 'var(--spectrum-yellow-700)',
+ 800: 'var(--spectrum-yellow-800)',
+ 900: 'var(--spectrum-yellow-900)',
+ 1000: 'var(--spectrum-yellow-1000)',
+ 1100: 'var(--spectrum-yellow-1100)',
+ 1200: 'var(--spectrum-yellow-1200)',
+ 1300: 'var(--spectrum-yellow-1300)',
+ 1400: 'var(--spectrum-yellow-1400)'
},
negative: {
- DEFAULT: "var(--spectrum-red-900)",
- background: "var(--spectrum-negative-background-color-default)",
- hover: "var(--spectrum-red-1000)",
- dark: "var(--spectrum-red-1000)",
- border: "var(--spectrum-red-800)",
- icon: "var(--spectrum-negative-visual-color)",
- status: "var(--spectrum-negative-visual-color)",
- textLarge: "var(--spectrum-red-900)",
- textSmall: "var(--spectrum-red-900)",
- down: "var(--spectrum-red-1100)",
- focus: "var(--spectrum-red-1100)",
+ DEFAULT: 'var(--spectrum-red-900)',
+ background: 'var(--spectrum-negative-background-color-default)',
+ hover: 'var(--spectrum-red-1000)',
+ dark: 'var(--spectrum-red-1000)',
+ border: 'var(--spectrum-red-800)',
+ icon: 'var(--spectrum-negative-visual-color)',
+ status: 'var(--spectrum-negative-visual-color)',
+ textLarge: 'var(--spectrum-red-900)',
+ textSmall: 'var(--spectrum-red-900)',
+ down: 'var(--spectrum-red-1100)',
+ focus: 'var(--spectrum-red-1100)'
},
notice: {
- DEFAULT: "var(--spectrum-orange-700)",
- background: "var(--spectrum-orange-800)",
- hover: "var(--spectrum-orange-600)",
- dark: "var(--spectrum-orange-800)",
- border: "var(--spectrum-orange-600)",
- icon: "var(--spectrum-notice-visual-color)",
- status: "var(--spectrum-notice-visual-color)",
- textLarge: "var(--spectrum-orange-700)",
- textSmall: "var(--spectrum-orange-800)",
- down: "var(--spectrum-orange-900)",
- focus: "var(--spectrum-orange-600)",
+ DEFAULT: 'var(--spectrum-orange-700)',
+ background: 'var(--spectrum-orange-800)',
+ hover: 'var(--spectrum-orange-600)',
+ dark: 'var(--spectrum-orange-800)',
+ border: 'var(--spectrum-orange-600)',
+ icon: 'var(--spectrum-notice-visual-color)',
+ status: 'var(--spectrum-notice-visual-color)',
+ textLarge: 'var(--spectrum-orange-700)',
+ textSmall: 'var(--spectrum-orange-800)',
+ down: 'var(--spectrum-orange-900)',
+ focus: 'var(--spectrum-orange-600)'
},
positive: {
- DEFAULT: "var(--spectrum-green-900)",
- background: "var(--spectrum-positive-background-color-default)",
+ DEFAULT: 'var(--spectrum-green-900)',
+ background: 'var(--spectrum-positive-background-color-default)',
// hover: "var(--spectrum-green-1000)",
- dark: "var(--spectrum-green-1000)",
- border: "var(--spectrum-green-800)",
- icon: "var(--spectrum-positive-visual-color)",
- status: "var(--spectrum-positive-visual-color)",
- textLarge: "var(--spectrum-green-900)",
- textSmall: "var(--spectrum-green-1000)",
- down: "var(--spectrum-green-1100)",
- focus: "var(--spectrum-green-800)",
+ dark: 'var(--spectrum-green-1000)',
+ border: 'var(--spectrum-green-800)',
+ icon: 'var(--spectrum-positive-visual-color)',
+ status: 'var(--spectrum-positive-visual-color)',
+ textLarge: 'var(--spectrum-green-900)',
+ textSmall: 'var(--spectrum-green-1000)',
+ down: 'var(--spectrum-green-1100)',
+ focus: 'var(--spectrum-green-800)'
},
informative: {
- DEFAULT: "var(--spectrum-blue-900)",
- background: "var(--spectrum-informative-background-color-default)",
+ DEFAULT: 'var(--spectrum-blue-900)',
+ background: 'var(--spectrum-informative-background-color-default)',
// hover: "var(--spectrum-blue-1000)",
- dark: "var(--spectrum-blue-1000)",
- border: "var(--spectrum-blue-800)",
- icon: "var(--spectrum-informative-visual-color)",
- status: "var(--spectrum-informative-visual-color)",
- textLarge: "var(--spectrum-blue-900)",
- textSmall: "var(--spectrum-blue-1000)",
- down: "var(--spectrum-blue-1100)",
- focus: "var(--spectrum-blue-800)",
+ dark: 'var(--spectrum-blue-1000)',
+ border: 'var(--spectrum-blue-800)',
+ icon: 'var(--spectrum-informative-visual-color)',
+ status: 'var(--spectrum-informative-visual-color)',
+ textLarge: 'var(--spectrum-blue-900)',
+ textSmall: 'var(--spectrum-blue-1000)',
+ down: 'var(--spectrum-blue-1100)',
+ focus: 'var(--spectrum-blue-800)'
},
cta: {
background: {
- DEFAULT: "var(--spectrum-accent-background-color-default)",
- hover: "var(--spectrum-accent-background-color-hover)",
- down: "var(--spectrum-accent-background-color-down)",
- keyFocus: "var(--spectrum-accent-background-color-key-focus)",
- },
+ DEFAULT: 'var(--spectrum-accent-background-color-default)',
+ hover: 'var(--spectrum-accent-background-color-hover)',
+ down: 'var(--spectrum-accent-background-color-down)',
+ keyFocus: 'var(--spectrum-accent-background-color-key-focus)'
+ }
},
accent: {
- 100: "var(--spectrum-blue-100)",
- 200: "var(--spectrum-blue-200)",
- 300: "var(--spectrum-blue-300)",
- 400: "var(--spectrum-blue-400)",
- 500: "var(--spectrum-blue-500)",
- 600: "var(--spectrum-blue-600)",
- 700: "var(--spectrum-blue-700)",
- 800: "var(--spectrum-blue-800)",
- 900: "var(--spectrum-blue-900)",
- 1000: "var(--spectrum-blue-1000)",
- 1100: "var(--spectrum-blue-1100)",
- 1200: "var(--spectrum-blue-1200)",
- 1300: "var(--spectrum-blue-1300)",
- 1400: "var(--spectrum-blue-1400)",
+ 100: 'var(--spectrum-blue-100)',
+ 200: 'var(--spectrum-blue-200)',
+ 300: 'var(--spectrum-blue-300)',
+ 400: 'var(--spectrum-blue-400)',
+ 500: 'var(--spectrum-blue-500)',
+ 600: 'var(--spectrum-blue-600)',
+ 700: 'var(--spectrum-blue-700)',
+ 800: 'var(--spectrum-blue-800)',
+ 900: 'var(--spectrum-blue-900)',
+ 1000: 'var(--spectrum-blue-1000)',
+ 1100: 'var(--spectrum-blue-1100)',
+ 1200: 'var(--spectrum-blue-1200)',
+ 1300: 'var(--spectrum-blue-1300)',
+ 1400: 'var(--spectrum-blue-1400)'
},
background: {
- DEFAULT: "var(--spectrum-alias-background-color-default)",
- disabled: "var(--spectrum-alias-background-color-disabled)",
- transparent: "var(--spectrum-alias-background-color-transparent)",
+ DEFAULT: 'var(--spectrum-alias-background-color-default)',
+ disabled: 'var(--spectrum-alias-background-color-disabled)',
+ transparent: 'var(--spectrum-alias-background-color-transparent)'
},
text: {
- DEFAULT: "var(--spectrum-alias-text-color)",
- hover: "var(--spectrum-alias-text-color-hover)",
- down: "var(--spectrum-alias-text-color-down)",
- "key-focus": "var(--spectrum-alias-text-color-key-focus)",
- "mouse-focus": "var(--spectrum-alias-text-color-mouse-focus)",
- disabled: "var(--spectrum-alias-text-color-disabled)",
- invalid: "var(--spectrum-alias-text-color-invalid)",
- selected: "var(--spectrum-alias-text-color-selected)",
- "selected-neutral": "var(--spectrum-alias-text-color-selected-neutral)",
+ DEFAULT: 'var(--spectrum-alias-text-color)',
+ hover: 'var(--spectrum-alias-text-color-hover)',
+ down: 'var(--spectrum-alias-text-color-down)',
+ 'key-focus': 'var(--spectrum-alias-text-color-key-focus)',
+ 'mouse-focus': 'var(--spectrum-alias-text-color-mouse-focus)',
+ disabled: 'var(--spectrum-alias-text-color-disabled)',
+ invalid: 'var(--spectrum-alias-text-color-invalid)',
+ selected: 'var(--spectrum-alias-text-color-selected)',
+ 'selected-neutral': 'var(--spectrum-alias-text-color-selected-neutral)'
},
border: {
- DEFAULT: "var(--spectrum-alias-border-color)",
- hover: "var(--spectrum-alias-border-color-hover)",
- down: "var(--spectrum-alias-border-color-down)",
- focus: "var(--spectrum-alias-border-color-focus)",
- "mouse-focus": "var(--spectrum-alias-border-color-mouse-focus)",
- disabled: "var(--spectrum-alias-border-color-disabled)",
- extralight: "var(--spectrum-alias-border-color-extralight)",
- light: "var(--spectrum-alias-border-color-light)",
- mid: "var(--spectrum-alias-border-color-mid)",
- dark: "var(--spectrum-alias-border-color-dark)",
- transparent: "var(--spectrum-alias-border-color-transparent)",
- "translucent-dark":
- "var(--spectrum-alias-border-color-translucent-dark)",
- "translucent-darker":
- "var(--spectrum-alias-border-color-transparent-darker)",
+ DEFAULT: 'var(--spectrum-alias-border-color)',
+ hover: 'var(--spectrum-alias-border-color-hover)',
+ down: 'var(--spectrum-alias-border-color-down)',
+ focus: 'var(--spectrum-alias-border-color-focus)',
+ 'mouse-focus': 'var(--spectrum-alias-border-color-mouse-focus)',
+ disabled: 'var(--spectrum-alias-border-color-disabled)',
+ extralight: 'var(--spectrum-alias-border-color-extralight)',
+ light: 'var(--spectrum-alias-border-color-light)',
+ mid: 'var(--spectrum-alias-border-color-mid)',
+ dark: 'var(--spectrum-alias-border-color-dark)',
+ transparent: 'var(--spectrum-alias-border-color-transparent)',
+ 'translucent-dark': 'var(--spectrum-alias-border-color-translucent-dark)',
+ 'translucent-darker': 'var(--spectrum-alias-border-color-transparent-darker)'
},
focus: {
- DEFAULT: "var(--spectrum-alias-focus-color)",
+ DEFAULT: 'var(--spectrum-alias-focus-color)'
},
- "focus-ring": {
- DEFAULT: "var(--spectrum-alias-focus-ring-color)",
+ 'focus-ring': {
+ DEFAULT: 'var(--spectrum-alias-focus-ring-color)'
},
icon: {
- DEFAULT: "var(--spectrum-alias-icon-color)",
- "over-background": "var(--spectrum-alias-icon-color-over-background)",
- hover: "var(--spectrum-alias-icon-color-hover)",
- down: "var(--spectrum-alias-icon-color-down)",
- focus: "var(--spectrum-alias-icon-color-focus)",
- disabled: "var(--spectrum-alias-icon-color-disabled)",
- "selected-neutral": "var(--spectrum-alias-icon-color-selected-neutral)",
- selected: "var(--spectrum-alias-icon-color-selected)",
- "selected-hover": "var(--spectrum-alias-icon-color-selected-hover)",
- "selected-down": "var(--spectrum-alias-icon-color-selected-down)",
- "selected-focus": "var(--spectrum-alias-icon-color-selected-focus)",
- error: "var(--spectrum-alias-icon-color-error)",
- },
+ DEFAULT: 'var(--spectrum-alias-icon-color)',
+ 'over-background': 'var(--spectrum-alias-icon-color-over-background)',
+ hover: 'var(--spectrum-alias-icon-color-hover)',
+ down: 'var(--spectrum-alias-icon-color-down)',
+ focus: 'var(--spectrum-alias-icon-color-focus)',
+ disabled: 'var(--spectrum-alias-icon-color-disabled)',
+ 'selected-neutral': 'var(--spectrum-alias-icon-color-selected-neutral)',
+ selected: 'var(--spectrum-alias-icon-color-selected)',
+ 'selected-hover': 'var(--spectrum-alias-icon-color-selected-hover)',
+ 'selected-down': 'var(--spectrum-alias-icon-color-selected-down)',
+ 'selected-focus': 'var(--spectrum-alias-icon-color-selected-focus)',
+ error: 'var(--spectrum-alias-icon-color-error)'
+ }
},
/** https://spectrum.adobe.com/page/states/#Keyboard-focus */
ringColor: {
- DEFAULT: "var(--spectrum-alias-focus-ring-color)",
+ DEFAULT: 'var(--spectrum-alias-focus-ring-color)'
},
ringOpacity: {
- DEFAULT: "1",
+ DEFAULT: '1'
},
ringWidth: {
- DEFAULT: "var(--spectrum-alias-focus-ring-size)",
+ DEFAULT: 'var(--spectrum-alias-focus-ring-size)',
/** For use when next to existing blue border. */
- half: "calc(var(--spectrum-alias-focus-ring-size) / 2)",
+ half: 'calc(var(--spectrum-alias-focus-ring-size) / 2)'
},
/** https://spectrum.adobe.com/page/object-styles/#Drop-shadow */
dropShadow: {
DEFAULT:
- "0 var(--spectrum-alias-dropshadow-offset-y) var(--spectrum-alias-dropshadow-blur) var(--spectrum-alias-dropshadow-color)",
+ '0 var(--spectrum-alias-dropshadow-offset-y) var(--spectrum-alias-dropshadow-blur) var(--spectrum-alias-dropshadow-color)'
},
/** https://spectrum.adobe.com/page/object-styles/#Border-width */
borderWidth: {
- DEFAULT: "var(--spectrum-alias-border-size-thin)",
- none: "0",
- thin: "var(--spectrum-alias-border-size-thin)",
- thick: "var(--spectrum-alias-border-size-thick)",
- thicker: "var(--spectrum-alias-border-size-thicker)",
- thickest: "var(--spectrum-alias-border-size-thickest)",
+ DEFAULT: 'var(--spectrum-alias-border-size-thin)',
+ none: '0',
+ thin: 'var(--spectrum-alias-border-size-thin)',
+ thick: 'var(--spectrum-alias-border-size-thick)',
+ thicker: 'var(--spectrum-alias-border-size-thicker)',
+ thickest: 'var(--spectrum-alias-border-size-thickest)'
},
/** https://spectrum.adobe.com/page/object-styles/#Rounding */
borderRadius: {
- DEFAULT: "var(--spectrum-alias-border-radius-regular)",
- xsmall: "var(--spectrum-alias-border-radius-xsmall)",
- small: "var(--spectrum-alias-border-radius-small)",
- regular: "var(--spectrum-alias-border-radius-regular)",
- medium: "var(--spectrum-alias-border-radius-medium)",
- large: "var(--spectrum-alias-border-radius-large)",
- full: "9999px",
+ DEFAULT: 'var(--spectrum-alias-border-radius-regular)',
+ xsmall: 'var(--spectrum-alias-border-radius-xsmall)',
+ small: 'var(--spectrum-alias-border-radius-small)',
+ regular: 'var(--spectrum-alias-border-radius-regular)',
+ medium: 'var(--spectrum-alias-border-radius-medium)',
+ large: 'var(--spectrum-alias-border-radius-large)',
+ full: '9999px'
},
/** https://spectrum.adobe.com/page/typography/#Font-sizes */
fontSize: {
- DEFAULT: "var(--spectrum-alias-font-size-default)",
- xs: "var(--spectrum-global-dimension-font-size-50)",
- sm: "var(--spectrum-global-dimension-font-size-75)",
- base: "var(--spectrum-alias-font-size-default)",
- lg: "var(--spectrum-global-dimension-font-size-200)",
- xl: "var(--spectrum-global-dimension-font-size-300)",
- "2xl": "var(--spectrum-global-dimension-font-size-400)",
- "3xl": "var(--spectrum-global-dimension-font-size-500)",
- "4xl": "var(--spectrum-global-dimension-font-size-600)",
- "5xl": "var(--spectrum-global-dimension-font-size-700)",
- "6xl": "var(--spectrum-global-dimension-font-size-800)",
- "7xl": "var(--spectrum-global-dimension-font-size-900)",
- "8xl": "var(--spectrum-global-dimension-font-size-1000)",
- "9xl": "var(--spectrum-global-dimension-font-size-1100)",
- "10xl": "var(--spectrum-global-dimension-font-size-1200)",
- "11xl": "var(--spectrum-global-dimension-font-size-1300)",
+ DEFAULT: 'var(--spectrum-alias-font-size-default)',
+ xs: 'var(--spectrum-global-dimension-font-size-50)',
+ sm: 'var(--spectrum-global-dimension-font-size-75)',
+ base: 'var(--spectrum-alias-font-size-default)',
+ lg: 'var(--spectrum-global-dimension-font-size-200)',
+ xl: 'var(--spectrum-global-dimension-font-size-300)',
+ '2xl': 'var(--spectrum-global-dimension-font-size-400)',
+ '3xl': 'var(--spectrum-global-dimension-font-size-500)',
+ '4xl': 'var(--spectrum-global-dimension-font-size-600)',
+ '5xl': 'var(--spectrum-global-dimension-font-size-700)',
+ '6xl': 'var(--spectrum-global-dimension-font-size-800)',
+ '7xl': 'var(--spectrum-global-dimension-font-size-900)',
+ '8xl': 'var(--spectrum-global-dimension-font-size-1000)',
+ '9xl': 'var(--spectrum-global-dimension-font-size-1100)',
+ '10xl': 'var(--spectrum-global-dimension-font-size-1200)',
+ '11xl': 'var(--spectrum-global-dimension-font-size-1300)'
},
fontWeight: {
- DEFAULT: "var(--spectrum-global-font-weight-regular)",
- thin: "var(--spectrum-global-font-weight-thin)",
- "ultra-light": "var(--spectrum-global-font-weight-ultra-light)",
- light: "var(--spectrum-global-font-weight-light)",
- regular: "var(--spectrum-global-font-weight-regular)",
- medium: "var(--spectrum-global-font-weight-medium)",
- semibold: "var(--spectrum-global-font-weight-semi-bold)",
- bold: "var(--spectrum-global-font-weight-bold)",
- "extra-bold": "var(--spectrum-global-font-weight-extra-bold)",
- black: "var(--spectrum-global-font-weight-black)",
+ DEFAULT: 'var(--spectrum-global-font-weight-regular)',
+ thin: 'var(--spectrum-global-font-weight-thin)',
+ 'ultra-light': 'var(--spectrum-global-font-weight-ultra-light)',
+ light: 'var(--spectrum-global-font-weight-light)',
+ regular: 'var(--spectrum-global-font-weight-regular)',
+ medium: 'var(--spectrum-global-font-weight-medium)',
+ semibold: 'var(--spectrum-global-font-weight-semi-bold)',
+ bold: 'var(--spectrum-global-font-weight-bold)',
+ 'extra-bold': 'var(--spectrum-global-font-weight-extra-bold)',
+ black: 'var(--spectrum-global-font-weight-black)'
},
letterSpacing: {
- DEFAULT: "var(--spectrum-global-font-letter-spacing-medium)",
- none: "var(--spectrum-global-font-letter-spacing-none)",
- small: "var(--spectrum-global-font-letter-spacing-small)",
- hand: "var(--spectrum-global-font-letter-spacing-han)",
- medium: "var(--spectrum-global-font-letter-spacing-medium)",
+ DEFAULT: 'var(--spectrum-global-font-letter-spacing-medium)',
+ none: 'var(--spectrum-global-font-letter-spacing-none)',
+ small: 'var(--spectrum-global-font-letter-spacing-small)',
+ hand: 'var(--spectrum-global-font-letter-spacing-han)',
+ medium: 'var(--spectrum-global-font-letter-spacing-medium)'
},
lineHeight: {
- DEFAULT: "var(--spectrum-global-font-line-height-medium)",
- small: "var(--spectrum-global-font-line-height-small)",
- medium: "var(--spectrum-global-font-line-height-medium)",
- large: "var(--spectrum-global-font-line-height-large)",
+ DEFAULT: 'var(--spectrum-global-font-line-height-medium)',
+ small: 'var(--spectrum-global-font-line-height-small)',
+ medium: 'var(--spectrum-global-font-line-height-medium)',
+ large: 'var(--spectrum-global-font-line-height-large)'
},
/** https://spectrum.adobe.com/page/motion/ */
transitionTimingFunction: {
- "ease-in-out": "cubic-bezier(.45, 0, .40, 1)",
- "ease-in": "cubic-bezier(.50, 0, 1, 1)",
- "ease-out": "cubic-bezier(0, 0, 0.40, 1)",
- linear: "cubic-bezier(0, 0, 1, 1)",
+ 'ease-in-out': 'cubic-bezier(.45, 0, .40, 1)',
+ 'ease-in': 'cubic-bezier(.50, 0, 1, 1)',
+ 'ease-out': 'cubic-bezier(0, 0, 0.40, 1)',
+ linear: 'cubic-bezier(0, 0, 1, 1)'
},
transitionDuration: {
- none: "var(--spectrum-global-animation-duration-0)",
- 0: "var(--spectrum-global-animation-duration-0)",
- 100: "var(--spectrum-global-animation-duration-100)",
- 200: "var(--spectrum-global-animation-duration-200)",
- 300: "var(--spectrum-global-animation-duration-300)",
- 400: "var(--spectrum-global-animation-duration-400)",
- 500: "var(--spectrum-global-animation-duration-500)",
- 600: "var(--spectrum-global-animation-duration-600)",
- 700: "var(--spectrum-global-animation-duration-700)",
- 800: "var(--spectrum-global-animation-duration-800)",
- 900: "var(--spectrum-global-animation-duration-900)",
- 1000: "var(--spectrum-global-animation-duration-1000)",
- 2000: "var(--spectrum-global-animation-duration-2000)",
- 4000: "var(--spectrum-global-animation-duration-4000)",
+ none: 'var(--spectrum-global-animation-duration-0)',
+ 0: 'var(--spectrum-global-animation-duration-0)',
+ 100: 'var(--spectrum-global-animation-duration-100)',
+ 200: 'var(--spectrum-global-animation-duration-200)',
+ 300: 'var(--spectrum-global-animation-duration-300)',
+ 400: 'var(--spectrum-global-animation-duration-400)',
+ 500: 'var(--spectrum-global-animation-duration-500)',
+ 600: 'var(--spectrum-global-animation-duration-600)',
+ 700: 'var(--spectrum-global-animation-duration-700)',
+ 800: 'var(--spectrum-global-animation-duration-800)',
+ 900: 'var(--spectrum-global-animation-duration-900)',
+ 1000: 'var(--spectrum-global-animation-duration-1000)',
+ 2000: 'var(--spectrum-global-animation-duration-2000)',
+ 4000: 'var(--spectrum-global-animation-duration-4000)'
},
spacing: {
- 0: "var(--spectrum-global-dimension-size-0)",
- 10: "var(--spectrum-global-dimension-size-10)",
- 25: "var(--spectrum-global-dimension-size-25)",
- 40: "var(--spectrum-global-dimension-size-40)",
- 50: "var(--spectrum-global-dimension-size-50)",
- 65: "var(--spectrum-global-dimension-size-65)",
- 75: "var(--spectrum-global-dimension-size-75)",
- 85: "var(--spectrum-global-dimension-size-85)",
- 100: "var(--spectrum-global-dimension-size-100)",
- 115: "var(--spectrum-global-dimension-size-115)",
- 125: "var(--spectrum-global-dimension-size-125)",
- 130: "var(--spectrum-global-dimension-size-130)",
- 150: "var(--spectrum-global-dimension-size-150)",
- 160: "var(--spectrum-global-dimension-size-160)",
- 175: "var(--spectrum-global-dimension-size-175)",
- 200: "var(--spectrum-global-dimension-size-200)",
- 225: "var(--spectrum-global-dimension-size-225)",
- 250: "var(--spectrum-global-dimension-size-250)",
- 275: "var(--spectrum-global-dimension-size-275)",
- 300: "var(--spectrum-global-dimension-size-300)",
- 325: "var(--spectrum-global-dimension-size-325)",
- 350: "var(--spectrum-global-dimension-size-350)",
- 400: "var(--spectrum-global-dimension-size-400)",
- 450: "var(--spectrum-global-dimension-size-450)",
- 500: "var(--spectrum-global-dimension-size-500)",
- 550: "var(--spectrum-global-dimension-size-550)",
- 600: "var(--spectrum-global-dimension-size-600)",
- 675: "var(--spectrum-global-dimension-size-675)",
- 700: "var(--spectrum-global-dimension-size-700)",
- 800: "var(--spectrum-global-dimension-size-800)",
- 900: "var(--spectrum-global-dimension-size-900)",
- 1000: "var(--spectrum-global-dimension-size-1000)",
- 1200: "var(--spectrum-global-dimension-size-1200)",
- 1250: "var(--spectrum-global-dimension-size-1250)",
- 1600: "var(--spectrum-global-dimension-size-1600)",
- 1700: "var(--spectrum-global-dimension-size-1700)",
- 2000: "var(--spectrum-global-dimension-size-2000)",
- 2400: "var(--spectrum-global-dimension-size-2400)",
- 3000: "var(--spectrum-global-dimension-size-3000)",
- 3400: "var(--spectrum-global-dimension-size-3400)",
- 3600: "var( --spectrum-global-dimension-size-3600)",
- 4600: "var(--spectrum-global-dimension-size-4600)",
- 5000: "var(--spectrum-global-dimension-size-5000)",
- 6000: "var(--spectrum-global-dimension-size-6000)",
+ 0: 'var(--spectrum-global-dimension-size-0)',
+ 10: 'var(--spectrum-global-dimension-size-10)',
+ 25: 'var(--spectrum-global-dimension-size-25)',
+ 40: 'var(--spectrum-global-dimension-size-40)',
+ 50: 'var(--spectrum-global-dimension-size-50)',
+ 65: 'var(--spectrum-global-dimension-size-65)',
+ 75: 'var(--spectrum-global-dimension-size-75)',
+ 85: 'var(--spectrum-global-dimension-size-85)',
+ 100: 'var(--spectrum-global-dimension-size-100)',
+ 115: 'var(--spectrum-global-dimension-size-115)',
+ 125: 'var(--spectrum-global-dimension-size-125)',
+ 130: 'var(--spectrum-global-dimension-size-130)',
+ 150: 'var(--spectrum-global-dimension-size-150)',
+ 160: 'var(--spectrum-global-dimension-size-160)',
+ 175: 'var(--spectrum-global-dimension-size-175)',
+ 200: 'var(--spectrum-global-dimension-size-200)',
+ 225: 'var(--spectrum-global-dimension-size-225)',
+ 250: 'var(--spectrum-global-dimension-size-250)',
+ 275: 'var(--spectrum-global-dimension-size-275)',
+ 300: 'var(--spectrum-global-dimension-size-300)',
+ 325: 'var(--spectrum-global-dimension-size-325)',
+ 350: 'var(--spectrum-global-dimension-size-350)',
+ 400: 'var(--spectrum-global-dimension-size-400)',
+ 450: 'var(--spectrum-global-dimension-size-450)',
+ 500: 'var(--spectrum-global-dimension-size-500)',
+ 550: 'var(--spectrum-global-dimension-size-550)',
+ 600: 'var(--spectrum-global-dimension-size-600)',
+ 675: 'var(--spectrum-global-dimension-size-675)',
+ 700: 'var(--spectrum-global-dimension-size-700)',
+ 800: 'var(--spectrum-global-dimension-size-800)',
+ 900: 'var(--spectrum-global-dimension-size-900)',
+ 1000: 'var(--spectrum-global-dimension-size-1000)',
+ 1200: 'var(--spectrum-global-dimension-size-1200)',
+ 1250: 'var(--spectrum-global-dimension-size-1250)',
+ 1600: 'var(--spectrum-global-dimension-size-1600)',
+ 1700: 'var(--spectrum-global-dimension-size-1700)',
+ 2000: 'var(--spectrum-global-dimension-size-2000)',
+ 2400: 'var(--spectrum-global-dimension-size-2400)',
+ 3000: 'var(--spectrum-global-dimension-size-3000)',
+ 3400: 'var(--spectrum-global-dimension-size-3400)',
+ 3600: 'var( --spectrum-global-dimension-size-3600)',
+ 4600: 'var(--spectrum-global-dimension-size-4600)',
+ 5000: 'var(--spectrum-global-dimension-size-5000)',
+ 6000: 'var(--spectrum-global-dimension-size-6000)'
},
opacity: {
- 100: "var(--spectrum-global-color-opacity-100)",
- 90: "var(--spectrum-global-color-opacity-90)",
- 80: "var(--spectrum-global-color-opacity-80)",
- 60: "var(--spectrum-global-color-opacity-60)",
- 50: "var(--spectrum-global-color-opacity-50)",
- 42: "var(--spectrum-global-color-opacity-42)",
- 40: "var(--spectrum-global-color-opacity-40)",
- 30: "var(--spectrum-global-color-opacity-30)",
- 25: "var(--spectrum-global-color-opacity-25)",
- 20: "var(--spectrum-global-color-opacity-20)",
- 15: "var(--spectrum-global-color-opacity-15)",
- 10: "var(--spectrum-global-color-opacity-10)",
- 8: "var(--spectrum-global-color-opacity-8)",
- 7: "var(--spectrum-global-color-opacity-7)",
- 6: "var(--spectrum-global-color-opacity-6)",
- 5: "var(--spectrum-global-color-opacity-5)",
- 4: "var(--spectrum-global-color-opacity-4)",
- },
+ 100: 'var(--spectrum-global-color-opacity-100)',
+ 90: 'var(--spectrum-global-color-opacity-90)',
+ 80: 'var(--spectrum-global-color-opacity-80)',
+ 60: 'var(--spectrum-global-color-opacity-60)',
+ 50: 'var(--spectrum-global-color-opacity-50)',
+ 42: 'var(--spectrum-global-color-opacity-42)',
+ 40: 'var(--spectrum-global-color-opacity-40)',
+ 30: 'var(--spectrum-global-color-opacity-30)',
+ 25: 'var(--spectrum-global-color-opacity-25)',
+ 20: 'var(--spectrum-global-color-opacity-20)',
+ 15: 'var(--spectrum-global-color-opacity-15)',
+ 10: 'var(--spectrum-global-color-opacity-10)',
+ 8: 'var(--spectrum-global-color-opacity-8)',
+ 7: 'var(--spectrum-global-color-opacity-7)',
+ 6: 'var(--spectrum-global-color-opacity-6)',
+ 5: 'var(--spectrum-global-color-opacity-5)',
+ 4: 'var(--spectrum-global-color-opacity-4)'
+ }
},
- plugins: [require("tailwindcss-animate")],
+ plugins: [require('tailwindcss-animate')]
};
diff --git a/examples/rac-spectrum-tailwind/src/style.css b/examples/rac-spectrum-tailwind/src/style.css
index a6d617bf484..b79ee418652 100644
--- a/examples/rac-spectrum-tailwind/src/style.css
+++ b/examples/rac-spectrum-tailwind/src/style.css
@@ -1,4 +1,4 @@
-@import 'tailwindcss' source("./");
+@import 'tailwindcss' source('./');
@config '../tailwind.config.js';
diff --git a/examples/rac-spectrum-tailwind/tailwind.config.js b/examples/rac-spectrum-tailwind/tailwind.config.js
index ab992a8a66b..55b4bafd485 100644
--- a/examples/rac-spectrum-tailwind/tailwind.config.js
+++ b/examples/rac-spectrum-tailwind/tailwind.config.js
@@ -1,12 +1,6 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
- content: [
- "./src/**/*.{html,js,ts,jsx,tsx}",
- ],
- presets: [
- require('./src/spectrum-preset.js')
- ],
- plugins: [
- require('../../packages/tailwindcss-react-aria-components/src/index.js')
- ],
-}
+ content: ['./src/**/*.{html,js,ts,jsx,tsx}'],
+ presets: [require('./src/spectrum-preset.js')],
+ plugins: [require('../../packages/tailwindcss-react-aria-components/src/index.js')]
+};
diff --git a/examples/rac-spectrum-tailwind/tsconfig.json b/examples/rac-spectrum-tailwind/tsconfig.json
index 66c175a102c..c437c1fd98c 100644
--- a/examples/rac-spectrum-tailwind/tsconfig.json
+++ b/examples/rac-spectrum-tailwind/tsconfig.json
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es5",
- "lib": [
- "dom",
- "dom.iterable",
- "esnext"
- ],
+ "lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
@@ -19,7 +15,5 @@
"noEmit": true,
"jsx": "react-jsx"
},
- "include": [
- "src"
- ]
+ "include": ["src"]
}
diff --git a/examples/remix/app/entry.server.tsx b/examples/remix/app/entry.server.tsx
index 536fbd41885..39729a88b75 100644
--- a/examples/remix/app/entry.server.tsx
+++ b/examples/remix/app/entry.server.tsx
@@ -1,9 +1,9 @@
-import { PassThrough } from 'node:stream';
-import type { EntryContext } from '@remix-run/node';
-import { createReadableStreamFromReadable } from '@remix-run/node';
-import { RemixServer } from '@remix-run/react';
+import {PassThrough} from 'node:stream';
+import type {EntryContext} from '@remix-run/node';
+import {createReadableStreamFromReadable} from '@remix-run/node';
+import {RemixServer} from '@remix-run/react';
import isbot from 'isbot';
-import { renderToPipeableStream } from 'react-dom/server';
+import {renderToPipeableStream} from 'react-dom/server';
import {getLocalizationScript} from '@adobe/react-spectrum/i18n';
const ABORT_DELAY = 5000;
@@ -12,20 +12,14 @@ export default function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
- remixContext: EntryContext,
+ remixContext: EntryContext
) {
- let callbackName = isbot(request.headers.get('user-agent'))
- ? 'onAllReady'
- : 'onShellReady';
+ let callbackName = isbot(request.headers.get('user-agent')) ? 'onAllReady' : 'onShellReady';
return new Promise((resolve, reject) => {
let shellRendered = false;
- const { pipe, abort } = renderToPipeableStream(
- ,
+ const {pipe, abort} = renderToPipeableStream(
+ ,
{
bootstrapScriptContent: getLocalizationScript('en'),
[callbackName]() {
@@ -37,7 +31,7 @@ export default function handleRequest(
resolve(
new Response(stream, {
headers: responseHeaders,
- status: responseStatusCode,
+ status: responseStatusCode
})
);
@@ -49,7 +43,7 @@ export default function handleRequest(
onError(error: unknown) {
responseStatusCode = 500;
console.error(error);
- },
+ }
}
);
diff --git a/examples/remix/app/root.tsx b/examples/remix/app/root.tsx
index 860c52a5250..9b6bdbe0211 100644
--- a/examples/remix/app/root.tsx
+++ b/examples/remix/app/root.tsx
@@ -13,7 +13,7 @@ import {Provider, defaultTheme} from '@adobe/react-spectrum';
declare module '@adobe/react-spectrum' {
interface RouterConfig {
- routerOptions: NavigateOptions
+ routerOptions: NavigateOptions;
}
}
@@ -41,7 +41,7 @@ export default function App() {
{/* https://remix.run/docs/en/main/guides/envvars */}
diff --git a/examples/remix/app/routes/_index.tsx b/examples/remix/app/routes/_index.tsx
index 9e7812157f4..38b1e5175d9 100644
--- a/examples/remix/app/routes/_index.tsx
+++ b/examples/remix/app/routes/_index.tsx
@@ -1,20 +1,19 @@
-import type { MetaFunction } from "@remix-run/node";
+import type {MetaFunction} from '@remix-run/node';
import {ActionMenu, DatePicker, Item} from '@adobe/react-spectrum';
export const meta: MetaFunction = () => {
- return [
- { title: "New Remix App" },
- { name: "description", content: "Welcome to Remix!" },
- ];
+ return [{title: 'New Remix App'}, {name: 'description', content: 'Welcome to Remix!'}];
};
export default function Index() {
return (
-
+
Welcome to Remix
- - Link to foo
+ -
+ Link to foo
+
);
diff --git a/examples/remix/app/routes/foo.tsx b/examples/remix/app/routes/foo.tsx
index 278b227d594..09cd9689fca 100644
--- a/examples/remix/app/routes/foo.tsx
+++ b/examples/remix/app/routes/foo.tsx
@@ -1,3 +1,3 @@
export default function Foo() {
- return
Foo
+ return
Foo ;
}
diff --git a/examples/remix/package.json b/examples/remix/package.json
index 44323ad2810..70aff4dc1cd 100644
--- a/examples/remix/package.json
+++ b/examples/remix/package.json
@@ -1,9 +1,14 @@
{
"name": "remix",
"private": true,
- "sideEffects": false,
+ "workspaces": [
+ "../../packages/react-aria-components",
+ "../../packages/react-aria",
+ "../../packages/react-stately",
+ "../../packages/*/*"
+ ],
"type": "module",
- "packageManager": "yarn@4.2.2",
+ "sideEffects": false,
"scripts": {
"build": "vite build && vite build --ssr",
"dev": "vite dev",
@@ -29,17 +34,12 @@
"vite": "^5.0.0",
"vite-tsconfig-paths": "^4.2.1"
},
- "engines": {
- "node": ">=24.0.0"
- },
- "workspaces": [
- "../../packages/react-aria-components",
- "../../packages/react-aria",
- "../../packages/react-stately",
- "../../packages/*/*"
- ],
"resolutions": {
"react": "link:../../node_modules/react",
"react-dom": "link:../../node_modules/react-dom"
- }
+ },
+ "engines": {
+ "node": ">=24.0.0"
+ },
+ "packageManager": "yarn@4.2.2"
}
diff --git a/examples/remix/vite.config.ts b/examples/remix/vite.config.ts
index eac068341ec..4476df56986 100644
--- a/examples/remix/vite.config.ts
+++ b/examples/remix/vite.config.ts
@@ -1,12 +1,8 @@
-import { vitePlugin as remix } from "@remix-run/dev";
-import { defineConfig } from "vite";
-import tsconfigPaths from "vite-tsconfig-paths";
+import {vitePlugin as remix} from '@remix-run/dev';
+import {defineConfig} from 'vite';
+import tsconfigPaths from 'vite-tsconfig-paths';
import optimizeLocales from '@react-aria/optimize-locales-plugin';
export default defineConfig({
- plugins: [
- remix(),
- tsconfigPaths(),
- {...optimizeLocales.vite({locales: []}), enforce: 'pre'}
- ],
+ plugins: [remix(), tsconfigPaths(), {...optimizeLocales.vite({locales: []}), enforce: 'pre'}]
});
diff --git a/examples/rsp-cra-18/package.json b/examples/rsp-cra-18/package.json
index 489ce9d4749..7ee2ac0a7f1 100644
--- a/examples/rsp-cra-18/package.json
+++ b/examples/rsp-cra-18/package.json
@@ -3,7 +3,13 @@
"version": "0.1.0",
"private": true,
"homepage": ".",
- "packageManager": "yarn@4.2.2",
+ "scripts": {
+ "start": "react-scripts start",
+ "build": "react-scripts build",
+ "test": "react-scripts test",
+ "eject": "react-scripts eject",
+ "install-17": "yarn add -W react@^17 react-dom@^17"
+ },
"dependencies": {
"@adobe/react-spectrum": "latest",
"@babel/plugin-proposal-private-property-in-object": "^7.16.7",
@@ -26,19 +32,6 @@
"typescript": "5.8.2",
"web-vitals": "^2.1.4"
},
- "scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test",
- "eject": "react-scripts eject",
- "install-17": "yarn add -W react@^17 react-dom@^17"
- },
- "eslintConfig": {
- "extends": [
- "react-app",
- "react-app/jest"
- ]
- },
"browserslist": {
"production": [
">0.2%",
@@ -50,5 +43,12 @@
"last 1 firefox version",
"last 1 safari version"
]
- }
+ },
+ "eslintConfig": {
+ "extends": [
+ "react-app",
+ "react-app/jest"
+ ]
+ },
+ "packageManager": "yarn@4.2.2"
}
diff --git a/examples/rsp-cra-18/src/App.css b/examples/rsp-cra-18/src/App.css
index b6b369d5d05..2e747c9a723 100644
--- a/examples/rsp-cra-18/src/App.css
+++ b/examples/rsp-cra-18/src/App.css
@@ -1,13 +1,13 @@
-body{
+body {
height: 100%;
}
-.no-bullets{
+.no-bullets {
list-style-type: none;
padding: 0px;
}
-#root{
+#root {
padding: 0;
margin: 0;
height: 100%;
@@ -17,6 +17,6 @@ html {
height: 100%;
}
-.content-padding{
+.content-padding {
padding: 50px;
-}
\ No newline at end of file
+}
diff --git a/examples/rsp-cra-18/src/App.tsx b/examples/rsp-cra-18/src/App.tsx
index 1ca5cd4f2f3..4ee07f60bcc 100644
--- a/examples/rsp-cra-18/src/App.tsx
+++ b/examples/rsp-cra-18/src/App.tsx
@@ -1,7 +1,18 @@
import './App.css';
-import {Provider, defaultTheme, Item, TagGroup, Cell, Column, Row, TableBody, TableHeader, TableView} from '@adobe/react-spectrum';
+import {
+ Provider,
+ defaultTheme,
+ Item,
+ TagGroup,
+ Cell,
+ Column,
+ Row,
+ TableBody,
+ TableHeader,
+ TableView
+} from '@adobe/react-spectrum';
import Lighting from './Lighting';
-import {useState} from 'react'
+import {useState} from 'react';
import BodyContent from './BodyContent';
import {enableTableNestedRows} from 'react-stately/private/flags/flags';
import ButtonExamples from './sections/ButtonExamples';
@@ -24,12 +35,20 @@ let columns = [
];
let nestedItems = [
- {foo: 'Lvl 1 Foo 1', bar: 'Lvl 1 Bar 1', baz: 'Lvl 1 Baz 1', childRows: [
- {foo: 'Lvl 2 Foo 1', bar: 'Lvl 2 Bar 1', baz: 'Lvl 2 Baz 1', childRows: [
- {foo: 'Lvl 3 Foo 1', bar: 'Lvl 3 Bar 1', baz: 'Lvl 3 Baz 1'}
- ]},
- {foo: 'Lvl 2 Foo 2', bar: 'Lvl 2 Bar 2', baz: 'Lvl 2 Baz 2'}
- ]}
+ {
+ foo: 'Lvl 1 Foo 1',
+ bar: 'Lvl 1 Bar 1',
+ baz: 'Lvl 1 Baz 1',
+ childRows: [
+ {
+ foo: 'Lvl 2 Foo 1',
+ bar: 'Lvl 2 Bar 1',
+ baz: 'Lvl 2 Baz 1',
+ childRows: [{foo: 'Lvl 3 Foo 1', bar: 'Lvl 3 Bar 1', baz: 'Lvl 3 Baz 1'}]
+ },
+ {foo: 'Lvl 2 Foo 2', bar: 'Lvl 2 Bar 2', baz: 'Lvl 2 Baz 2'}
+ ]
+ }
];
function App() {
@@ -37,10 +56,9 @@ function App() {
enableTableNestedRows();
return (
-
+
-
+
- News
- Travel
@@ -48,18 +66,20 @@ function App() {
- Shopping
-
-
- {column => {column.name} }
-
+
+ {column => {column.name} }
- {(item: any) =>
- (
- {(key) => {
+ {(item: any) => (
+
+ {key => {
return | {item[key]} | ;
}}
-
)
- }
+
+ )}
diff --git a/examples/rsp-cra-18/src/AutocompleteExample.tsx b/examples/rsp-cra-18/src/AutocompleteExample.tsx
index 66d82987f64..80cc2887775 100644
--- a/examples/rsp-cra-18/src/AutocompleteExample.tsx
+++ b/examples/rsp-cra-18/src/AutocompleteExample.tsx
@@ -1,13 +1,26 @@
-import {Autocomplete, Input, Label, Menu, MenuItem, SearchField, Text, useFilter} from 'react-aria-components'
+import {
+ Autocomplete,
+ Input,
+ Label,
+ Menu,
+ MenuItem,
+ SearchField,
+ Text,
+ useFilter
+} from 'react-aria-components';
import {classNames} from '@adobe/react-spectrum/private/utils/classNames';
import styles from './autocomplete.css';
interface AutocompleteItem {
- id: string,
- name: string
+ id: string;
+ name: string;
}
-let items: AutocompleteItem[] = [{id: '1', name: 'Foo'}, {id: '2', name: 'Bar'}, {id: '3', name: 'Baz'}];
+let items: AutocompleteItem[] = [
+ {id: '1', name: 'Foo'},
+ {id: '2', name: 'Bar'},
+ {id: '3', name: 'Baz'}
+];
export function AutocompleteExample() {
let {contains} = useFilter({sensitivity: 'base'});
@@ -18,17 +31,21 @@ export function AutocompleteExample() {
Test
- Please select an option below.
+
+ Please select an option below.
+
{item => (
classNames(styles, 'item', {
- focused: isFocused,
- selected: isSelected,
- open: isOpen
- })}>
+ className={({isFocused, isSelected, isOpen}) =>
+ classNames(styles, 'item', {
+ focused: isFocused,
+ selected: isSelected,
+ open: isOpen
+ })
+ }>
{item.name}
)}
diff --git a/examples/rsp-cra-18/src/BodyContent.tsx b/examples/rsp-cra-18/src/BodyContent.tsx
index 96f771364b8..48eea42bf1c 100644
--- a/examples/rsp-cra-18/src/BodyContent.tsx
+++ b/examples/rsp-cra-18/src/BodyContent.tsx
@@ -1,12 +1,11 @@
-import {useState, FormEvent, useRef} from "react";
-import {Key, Item, TabList, TabPanels, Tabs} from '@adobe/react-spectrum'
+import {useState, FormEvent, useRef} from 'react';
+import {Key, Item, TabList, TabPanels, Tabs} from '@adobe/react-spectrum';
import TodoList from './TodoList';
import JournalList from './JournalList';
-import ToDo from './ToDo'
-import Journal from './Journal'
-
-function BodyContent(){
+import ToDo from './ToDo';
+import Journal from './Journal';
+function BodyContent() {
//states for the To-Do list
const [list, setList] = useState([]);
const [value, setValue] = useState('');
@@ -20,60 +19,55 @@ function BodyContent(){
const countJournals = useRef(0);
const options = [
- {id: "Bad", name: "Bad"},
- {id: "Okay", name: "Okay"},
- {id: "Good", name: "Good"},
- {id: "Great", name: "Great"}
- ]
+ {id: 'Bad', name: 'Bad'},
+ {id: 'Okay', name: 'Okay'},
+ {id: 'Good', name: 'Good'},
+ {id: 'Great', name: 'Great'}
+ ];
//functions for the To-Do list
- function handleSubmitToDo(e: FormEvent){
- e.preventDefault()
+ function handleSubmitToDo(e: FormEvent) {
+ e.preventDefault();
- if (value.length > 0){
- setList(prevListArray => {
- return [
- ...prevListArray,
- {id: count.current, task: value}]
- })
+ if (value.length > 0) {
+ setList(prevListArray => {
+ return [...prevListArray, {id: count.current, task: value}];
+ });
- count.current = count.current + 1;
+ count.current = count.current + 1;
}
- setValue(""); //clears text field on submit
+ setValue(''); //clears text field on submit
}
- function updateCompleted(complete : string){
+ function updateCompleted(complete: string) {
setCompleted(prevListArray => {
- return [
- ...prevListArray,
- {id: prevListArray.length, task: complete}]
+ return [...prevListArray, {id: prevListArray.length, task: complete}];
});
}
- function clearCompleted(){
- setCompleted(() => {
- return [];
- })
+ function clearCompleted() {
+ setCompleted(() => {
+ return [];
+ });
}
//functions for journal entries
- function handleSubmitJournals(e: FormEvent){
- e.preventDefault()
+ function handleSubmitJournals(e: FormEvent) {
+ e.preventDefault();
- countJournals.current = countJournals.current + 1; //used to determine key for each item in the entryList array
+ countJournals.current = countJournals.current + 1; //used to determine key for each item in the entryList array
- setEntryList(prevListArray => {
- return [
- ...prevListArray,
- {rate: rating, description: description, id: countJournals.current}
- ]
- })
+ setEntryList(prevListArray => {
+ return [
+ ...prevListArray,
+ {rate: rating, description: description, id: countJournals.current}
+ ];
+ });
- setValue('') //clears the text area when submitted
+ setValue(''); //clears the text area when submitted
}
- return(
-
+ return (
- To-do List
@@ -81,27 +75,31 @@ function BodyContent(){
-
-
+
-
-
+
- )
+ );
}
export default BodyContent;
diff --git a/examples/rsp-cra-18/src/Completed.tsx b/examples/rsp-cra-18/src/Completed.tsx
index 9376aa0fd0e..18b7cc0afa7 100644
--- a/examples/rsp-cra-18/src/Completed.tsx
+++ b/examples/rsp-cra-18/src/Completed.tsx
@@ -1,38 +1,38 @@
import Delete from '@spectrum-icons/workflow/Delete';
-import {AlertDialog, DialogTrigger, ActionButton} from '@adobe/react-spectrum'
-import {Checkbox} from '@adobe/react-spectrum'
-import {Flex} from '@adobe/react-spectrum'
-import ToDo from './ToDo'
+import {AlertDialog, DialogTrigger, ActionButton} from '@adobe/react-spectrum';
+import {Checkbox} from '@adobe/react-spectrum';
+import {Flex} from '@adobe/react-spectrum';
+import ToDo from './ToDo';
-function Completed(props: {completed: ToDo[]; onDelete: any}){
+function Completed(props: {completed: ToDo[]; onDelete: any}) {
+ const elements = props.completed.map(item => (
+
+ {item.task}
+
+ ));
- const elements = props.completed.map(item => (
- {item.task}
- ))
+ let alertCancel = () => alert('Cancel button pressed.');
- let alertCancel = () => alert('Cancel button pressed.');
-
- return (
-
- {elements}
-
-
-
-
-
- Are you sure you want to delete the completed tasks?
-
-
-
-
- )
+ return (
+
+ {elements}
+
+
+
+
+
+ Are you sure you want to delete the completed tasks?
+
+
+
+ );
}
export default Completed;
diff --git a/examples/rsp-cra-18/src/Journal.tsx b/examples/rsp-cra-18/src/Journal.tsx
index f00e30e63ee..71d0bb9bdf8 100644
--- a/examples/rsp-cra-18/src/Journal.tsx
+++ b/examples/rsp-cra-18/src/Journal.tsx
@@ -1,9 +1,9 @@
import {Key} from '@react-types/shared';
-interface Journal{
- rate: Key,
- description: string,
- id: number
+interface Journal {
+ rate: Key;
+ description: string;
+ id: number;
}
-export default Journal
+export default Journal;
diff --git a/examples/rsp-cra-18/src/JournalEntries.tsx b/examples/rsp-cra-18/src/JournalEntries.tsx
index eea6d20f619..53f9b946d75 100644
--- a/examples/rsp-cra-18/src/JournalEntries.tsx
+++ b/examples/rsp-cra-18/src/JournalEntries.tsx
@@ -1,24 +1,20 @@
-import {Flex, Divider} from '@adobe/react-spectrum'
-import Journal from './Journal'
+import {Flex, Divider} from '@adobe/react-spectrum';
+import Journal from './Journal';
-function JournalEntries(props : {list : Journal[]}){
+function JournalEntries(props: {list: Journal[]}) {
+ const element = props.list.map(item => (
+
+
+ Your day was: {item.rate}
+ {item.description}
+
+ ));
- const element = props.list.map(item => (
-
-
- Your day was: {item.rate}
- {item.description}
-
-
- ))
-
- return (
-
-
-
- )
+ return (
+
+
+
+ );
}
export default JournalEntries;
diff --git a/examples/rsp-cra-18/src/JournalList.tsx b/examples/rsp-cra-18/src/JournalList.tsx
index 0b609883a5f..e4bde312ff7 100644
--- a/examples/rsp-cra-18/src/JournalList.tsx
+++ b/examples/rsp-cra-18/src/JournalList.tsx
@@ -1,40 +1,45 @@
-import {Key} from 'react'
+import {Key} from 'react';
import AddCircle from '@spectrum-icons/workflow/AddCircle';
-import {Flex, Text, Button, Form, TextArea, Picker, Item, Divider} from '@adobe/react-spectrum'
-import JournalEntries from './JournalEntries'
-import Journal from './Journal'
+import {Flex, Text, Button, Form, TextArea, Picker, Item, Divider} from '@adobe/react-spectrum';
+import JournalEntries from './JournalEntries';
+import Journal from './Journal';
-function JournalList(props: {rating: Key;
- setRating: any;
- entryList: Journal[];
- options: {id: string, name: string}[];
- description: string;
- setDescription: any;
- handleSubmit: any}){
- return(
- <>
-
-
- Entries
-
- >
- )
+function JournalList(props: {
+ rating: Key;
+ setRating: any;
+ entryList: Journal[];
+ options: {id: string; name: string}[];
+ description: string;
+ setDescription: any;
+ handleSubmit: any;
+}) {
+ return (
+ <>
+
+
+ props.setRating(selected)}>
+ {item => - {item.name}
}
+
+
+
+
+ Add Entry
+
+
+
+
+ Entries
+
+ >
+ );
}
-export default JournalList;
\ No newline at end of file
+export default JournalList;
diff --git a/examples/rsp-cra-18/src/Lighting.tsx b/examples/rsp-cra-18/src/Lighting.tsx
index 20f138dca4d..3b1a3e62ad0 100644
--- a/examples/rsp-cra-18/src/Lighting.tsx
+++ b/examples/rsp-cra-18/src/Lighting.tsx
@@ -1,14 +1,8 @@
-import {Switch} from '@adobe/react-spectrum'
-
-function Lighting(props : {switch: any; selected: boolean}) {
-
- let mode = props.selected ? "Light Mode" : "Dark Mode";
- return (
-
- {mode}
-
- );
- }
+import {Switch} from '@adobe/react-spectrum';
+function Lighting(props: {switch: any; selected: boolean}) {
+ let mode = props.selected ? 'Light Mode' : 'Dark Mode';
+ return {mode} ;
+}
export default Lighting;
diff --git a/examples/rsp-cra-18/src/ToDo.tsx b/examples/rsp-cra-18/src/ToDo.tsx
index e9b739f4e27..8d34b828440 100644
--- a/examples/rsp-cra-18/src/ToDo.tsx
+++ b/examples/rsp-cra-18/src/ToDo.tsx
@@ -1,6 +1,6 @@
-interface ToDo{
- id: number,
- task: string
+interface ToDo {
+ id: number;
+ task: string;
}
-export default ToDo
\ No newline at end of file
+export default ToDo;
diff --git a/examples/rsp-cra-18/src/ToDoItems.tsx b/examples/rsp-cra-18/src/ToDoItems.tsx
index 055b678d16c..2efc4db4347 100644
--- a/examples/rsp-cra-18/src/ToDoItems.tsx
+++ b/examples/rsp-cra-18/src/ToDoItems.tsx
@@ -1,38 +1,29 @@
-import {CheckboxGroup, Checkbox, Flex} from '@adobe/react-spectrum'
-import ToDo from './ToDo'
+import {CheckboxGroup, Checkbox, Flex} from '@adobe/react-spectrum';
+import ToDo from './ToDo';
+function TodoItems(props: {list: ToDo[]; handleList: any; updateCompleted: any}) {
+ function removeItem(id: number) {
+ //add selected item to the completed list
+ const found = props.list.find(element => element.id === id);
+ if (found) {
+ props.updateCompleted(found.task);
+ }
-function TodoItems(props: { list : ToDo[];
- handleList: any;
- updateCompleted: any}) {
-
- function removeItem(id: number){
-
- //add selected item to the completed list
- const found = props.list.find(element => element.id === id)
- if (found){
- props.updateCompleted(found.task);
- }
+ //remove the item from the list
+ props.handleList(props.list.filter(item => item.id !== id));
+ }
- //remove the item from the list
- props.handleList(props.list.filter(item => item.id !== id));
- }
+ const elements = props.list.map(item => (
+ removeItem(item.id)} key={item.id} value={item.task}>
+ {item.task}
+
+ ));
- const elements = props.list.map(item => (
- removeItem(item.id)}
- key={item.id}
- value={item.task}>
- {item.task}
-
- ))
-
- return (
-
-
- {elements}
-
-
- );
+ return (
+
+ {elements}
+
+ );
}
-export default TodoItems;
\ No newline at end of file
+export default TodoItems;
diff --git a/examples/rsp-cra-18/src/TodoList.tsx b/examples/rsp-cra-18/src/TodoList.tsx
index ce909b9e40a..3f6ed16aced 100644
--- a/examples/rsp-cra-18/src/TodoList.tsx
+++ b/examples/rsp-cra-18/src/TodoList.tsx
@@ -1,41 +1,48 @@
import './App.css';
-import {Flex, TextField, Button, Form, Divider} from '@adobe/react-spectrum'
-import ToDoItems from "./ToDoItems"
-import Completed from "./Completed"
-import ToDo from './ToDo'
+import {Flex, TextField, Button, Form, Divider} from '@adobe/react-spectrum';
+import ToDoItems from './ToDoItems';
+import Completed from './Completed';
+import ToDo from './ToDo';
-
-function TodoList(props: {list: ToDo[];
- setList: any;
- handleSubmit: any;
- value: string;
- setValue: any;
- completed: ToDo[];
- updateCompleted: any;
- clearCompleted: any}){
-
- return (
+function TodoList(props: {
+ list: ToDo[];
+ setList: any;
+ handleSubmit: any;
+ value: string;
+ setValue: any;
+ completed: ToDo[];
+ updateCompleted: any;
+ clearCompleted: any;
+}) {
+ return (
<>
-
-
-
-
- Submit
-
- To-Do
-
-
-
-
- Completed
-
+
+
+
+
+
+ Submit
+
+
+ To-Do
+
+
+
+
+ Completed
+
>
- );
+ );
}
export default TodoList;
diff --git a/examples/rsp-cra-18/src/index.css b/examples/rsp-cra-18/src/index.css
index ec2585e8c0b..99dd0500d68 100644
--- a/examples/rsp-cra-18/src/index.css
+++ b/examples/rsp-cra-18/src/index.css
@@ -1,13 +1,12 @@
body {
margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
- sans-serif;
+ font-family:
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell',
+ 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
- monospace;
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
}
diff --git a/examples/rsp-cra-18/src/index.tsx b/examples/rsp-cra-18/src/index.tsx
index 81de6c25b48..9052605deaf 100644
--- a/examples/rsp-cra-18/src/index.tsx
+++ b/examples/rsp-cra-18/src/index.tsx
@@ -4,14 +4,8 @@ import App from './App';
if (ReactDOM.version.startsWith('18')) {
let ReactDOMClient = require('react-dom/client');
- const root = ReactDOMClient.createRoot(
- document.getElementById('root') as HTMLElement
- );
- root.render(
-
- );
+ const root = ReactDOMClient.createRoot(document.getElementById('root') as HTMLElement);
+ root.render( );
} else {
- ReactDOM.render(
- , document.getElementById("root")
- )
+ ReactDOM.render( , document.getElementById('root'));
}
diff --git a/examples/rsp-cra-18/src/sections/ButtonExamples.tsx b/examples/rsp-cra-18/src/sections/ButtonExamples.tsx
index ad32e8a464f..af79fd9dee3 100644
--- a/examples/rsp-cra-18/src/sections/ButtonExamples.tsx
+++ b/examples/rsp-cra-18/src/sections/ButtonExamples.tsx
@@ -1,5 +1,12 @@
/* eslint-disable react/style-prop-object */
-import { ActionButton, Button, Divider, Flex, LogicButton, ToggleButton} from '@adobe/react-spectrum';
+import {
+ ActionButton,
+ Button,
+ Divider,
+ Flex,
+ LogicButton,
+ ToggleButton
+} from '@adobe/react-spectrum';
export default function ButtonExamples() {
return (
@@ -11,8 +18,12 @@ export default function ButtonExamples() {
Edit
Primary
Secondary
- Negative fill
- Negative outline
+
+ Negative fill
+
+
+ Negative outline
+
Logic Button
ToggleButton
diff --git a/examples/rsp-cra-18/src/sections/CollectionExamples.tsx b/examples/rsp-cra-18/src/sections/CollectionExamples.tsx
index 7182618d435..62bc54b804a 100644
--- a/examples/rsp-cra-18/src/sections/CollectionExamples.tsx
+++ b/examples/rsp-cra-18/src/sections/CollectionExamples.tsx
@@ -25,139 +25,135 @@ import {
import FileTxt from '@spectrum-icons/workflow/FileTxt';
import Folder from '@spectrum-icons/workflow/Folder';
-export default function CollectionExamples(){
- return (
- <>
- Collections
-
-
-
- - Cut
- - Copy
- - Paste
-
-
- - Left
- - Middle
- - Right
-
-
- - Adobe Photoshop
- - Adobe InDesign
- - Adobe AfterEffects
- - Adobe Illustrator
- - Adobe Lightroom
-
-
-
- Menu
-
- alert(key)}>
- - Cut
- - Copy
- - Paste
- - Replace
-
- - Share
- alert(key)}>
- - Copy Link
-
- - Email
- alert(key)}>
- - Email as Attachment
- - Email as Link
-
-
- - SMS
-
-
- - Delete
-
-
-
-
- Name
- Type
- Date Modified
-
-
-
- | Games |
- File folder |
- 6/7/2020 |
-
-
- | Program Files |
- File folder |
- 4/7/2021 |
-
-
- | bootmgr |
- System file |
- 11/20/2010 |
-
-
- | log.txt |
- Text Document |
- 1/18/2016 |
-
-
-
-
- - News
- - Travel
- - Gaming
- - Shopping
-
-
-
-
+export default function CollectionExamples() {
+ return (
+ <>
+ Collections
+
+
+
+ - Cut
+ - Copy
+ - Paste
+
+
+ - Left
+ - Middle
+ - Right
+
+
+ - Adobe Photoshop
+ - Adobe InDesign
+ - Adobe AfterEffects
+ - Adobe Illustrator
+ - Adobe Lightroom
+
+
+ Menu
+ alert(key)}>
+ - Cut
+ - Copy
+ - Paste
+ - Replace
+
+ - Share
+ alert(key)}>
+ - Copy Link
+
+ - Email
+ alert(key)}>
+ - Email as Attachment
+ - Email as Link
+
+
+ - SMS
+
+
+ - Delete
+
+
+
+
+ Name
+ Type
+ Date Modified
+
+
+
+ | Games |
+ File folder |
+ 6/7/2020 |
+
+
+ | Program Files |
+ File folder |
+ 4/7/2021 |
+
+
+ | bootmgr |
+ System file |
+ 11/20/2010 |
+
+
+ | log.txt |
+ Text Document |
+ 1/18/2016 |
+
+
+
+
+ - News
+ - Travel
+ - Gaming
+ - Shopping
+
+
+
+
+
+ Photos
+
+
+
+
+
+ Projects
+
+
+
- Photos
+ Projects-1
-
-
-
- Projects
-
-
-
+
- Projects-1
-
-
-
-
- Projects-1A
-
-
-
-
-
-
- Projects-2
-
-
-
-
-
- Projects-3
+ Projects-1A
-
-
-
- >
- )
+
+
+ Projects-2
+
+
+
+
+
+ Projects-3
+
+
+
+
+
+
+
+ >
+ );
}
diff --git a/examples/rsp-cra-18/src/sections/ColorExamples.tsx b/examples/rsp-cra-18/src/sections/ColorExamples.tsx
index 63eda8d1cb5..a2ddb27cdec 100644
--- a/examples/rsp-cra-18/src/sections/ColorExamples.tsx
+++ b/examples/rsp-cra-18/src/sections/ColorExamples.tsx
@@ -12,5 +12,5 @@ export default function ColorExamples() {
>
- )
+ );
}
diff --git a/examples/rsp-cra-18/src/sections/ContentExamples.tsx b/examples/rsp-cra-18/src/sections/ContentExamples.tsx
index 565d88a9e2c..d98eede2710 100644
--- a/examples/rsp-cra-18/src/sections/ContentExamples.tsx
+++ b/examples/rsp-cra-18/src/sections/ContentExamples.tsx
@@ -1,4 +1,19 @@
-import {Flex, Divider, Avatar, Content, Footer, Header, Heading, IllustratedMessage, Image, Keyboard, Text, View, TextField, Well} from '@adobe/react-spectrum';
+import {
+ Flex,
+ Divider,
+ Avatar,
+ Content,
+ Footer,
+ Header,
+ Heading,
+ IllustratedMessage,
+ Image,
+ Keyboard,
+ Text,
+ View,
+ TextField,
+ Well
+} from '@adobe/react-spectrum';
import NotFound from '@spectrum-icons/illustrations/NotFound';
export default function ContentExamples() {
@@ -20,7 +35,12 @@ export default function ContentExamples() {
No results
Try another search
-
+
⌘V
Paste
>
- )
+ );
}
diff --git a/examples/rsp-cra-18/src/sections/DateTimeExamples.tsx b/examples/rsp-cra-18/src/sections/DateTimeExamples.tsx
index ae5b1915037..d7aaac549cd 100644
--- a/examples/rsp-cra-18/src/sections/DateTimeExamples.tsx
+++ b/examples/rsp-cra-18/src/sections/DateTimeExamples.tsx
@@ -1,4 +1,13 @@
-import {Calendar, Flex, Divider, DateField, DatePicker, DateRangePicker, RangeCalendar, TimeField} from '@adobe/react-spectrum';
+import {
+ Calendar,
+ Flex,
+ Divider,
+ DateField,
+ DatePicker,
+ DateRangePicker,
+ RangeCalendar,
+ TimeField
+} from '@adobe/react-spectrum';
export default function DateTimeExamples() {
return (
@@ -7,12 +16,12 @@ export default function DateTimeExamples() {
-
+
-
+
-
+
- >
+ >
);
}
diff --git a/examples/rsp-cra-18/src/sections/DragAndDropExamples.tsx b/examples/rsp-cra-18/src/sections/DragAndDropExamples.tsx
index 4379434fe6d..345d6c6cbdf 100644
--- a/examples/rsp-cra-18/src/sections/DragAndDropExamples.tsx
+++ b/examples/rsp-cra-18/src/sections/DragAndDropExamples.tsx
@@ -12,29 +12,26 @@ export default function DragAndDropExamples() {
- setIsFilled(true)}>
-
-
-
- {isFilled ? 'You dropped something!' : 'Drag and drop your file'}
-
-
-
+ setIsFilled(true)}>
+
+
+ {isFilled ? 'You dropped something!' : 'Drag and drop your file'}
+
+
>
- )
+ );
}
function Draggable() {
- let { dragProps, isDragging } = useDrag({
+ let {dragProps, isDragging} = useDrag({
getItems() {
- return [{
- 'text/plain': 'hello world',
- 'my-app-custom-type': JSON.stringify({ message: 'hello world' })
- }];
+ return [
+ {
+ 'text/plain': 'hello world',
+ 'my-app-custom-type': JSON.stringify({message: 'hello world'})
+ }
+ ];
}
});
@@ -43,8 +40,7 @@ function Draggable() {
{...dragProps}
role="button"
tabIndex={0}
- className={`draggable ${isDragging ? 'dragging' : ''}`}
- >
+ className={`draggable ${isDragging ? 'dragging' : ''}`}>
Drag me
);
diff --git a/examples/rsp-cra-18/src/sections/FormExamples.tsx b/examples/rsp-cra-18/src/sections/FormExamples.tsx
index 0e20a5693d2..72421f18ab4 100644
--- a/examples/rsp-cra-18/src/sections/FormExamples.tsx
+++ b/examples/rsp-cra-18/src/sections/FormExamples.tsx
@@ -1,4 +1,22 @@
-import {Flex, Divider, Form, ComboBox, Item, Button, TextField, RadioGroup, Radio, CheckboxGroup, Checkbox, NumberField, RangeSlider, SearchField, Slider, Switch, TextArea} from '@adobe/react-spectrum';
+import {
+ Flex,
+ Divider,
+ Form,
+ ComboBox,
+ Item,
+ Button,
+ TextField,
+ RadioGroup,
+ Radio,
+ CheckboxGroup,
+ Checkbox,
+ NumberField,
+ RangeSlider,
+ SearchField,
+ Slider,
+ Switch,
+ TextArea
+} from '@adobe/react-spectrum';
export default function FormExamples() {
return (
@@ -28,9 +46,8 @@ export default function FormExamples() {
Basketball
-
-
+
+
Low power mode
@@ -38,5 +55,5 @@ export default function FormExamples() {
>
- )
+ );
}
diff --git a/examples/rsp-cra-18/src/sections/NavigationExamples.tsx b/examples/rsp-cra-18/src/sections/NavigationExamples.tsx
index cc0fdd4c29b..d978c71cb46 100644
--- a/examples/rsp-cra-18/src/sections/NavigationExamples.tsx
+++ b/examples/rsp-cra-18/src/sections/NavigationExamples.tsx
@@ -1,4 +1,17 @@
-import {Accordion, Disclosure, DisclosureTitle, DisclosurePanel, Flex, Divider, Breadcrumbs, Item, Link, Tabs, TabList, TabPanels} from '@adobe/react-spectrum';
+import {
+ Accordion,
+ Disclosure,
+ DisclosureTitle,
+ DisclosurePanel,
+ Flex,
+ Divider,
+ Breadcrumbs,
+ Item,
+ Link,
+ Tabs,
+ TabList,
+ TabPanels
+} from '@adobe/react-spectrum';
export default function NavigationExamples() {
return (
@@ -21,31 +34,21 @@ export default function NavigationExamples() {
- Empire
- -
- Arma virumque cano, Troiae qui primus ab oris.
-
- -
- Senatus Populusque Romanus.
-
- -
- Alea jacta est.
-
+ - Arma virumque cano, Troiae qui primus ab oris.
+ - Senatus Populusque Romanus.
+ - Alea jacta est.
Accordion
-
- Files
-
+ Files
Files content
-
- People
-
+ People
People content
diff --git a/examples/rsp-cra-18/src/sections/OverlayExamples.tsx b/examples/rsp-cra-18/src/sections/OverlayExamples.tsx
index d8dc812bb32..145dcbf23db 100644
--- a/examples/rsp-cra-18/src/sections/OverlayExamples.tsx
+++ b/examples/rsp-cra-18/src/sections/OverlayExamples.tsx
@@ -1,4 +1,20 @@
-import {Flex, Divider, DialogTrigger, ActionButton, AlertDialog, ContextualHelp, Heading, Content, Text, Dialog, Header, ButtonGroup, Button, Tooltip, TooltipTrigger} from '@adobe/react-spectrum';
+import {
+ Flex,
+ Divider,
+ DialogTrigger,
+ ActionButton,
+ AlertDialog,
+ ContextualHelp,
+ Heading,
+ Content,
+ Text,
+ Dialog,
+ Header,
+ ButtonGroup,
+ Button,
+ Tooltip,
+ TooltipTrigger
+} from '@adobe/react-spectrum';
export default function OverlayExamples() {
return (
@@ -8,41 +24,39 @@ export default function OverlayExamples() {
Save
-
- You are running low on disk space.
- Delete unnecessary files to free up space.
+
+ You are running low on disk space. Delete unnecessary files to free up space.
Need help?
- If you're having issues accessing your account, contact our customer
- support team for help.
+ If you're having issues accessing your account, contact our customer support team for
+ help.
- Check connectivity
- {(close) => (
-
- Internet Speed Test
- Connection status: Connected
-
-
-
- Start speed test?
-
-
-
- Cancel
- Confirm
-
-
- )}
+ Check connectivity
+ {close => (
+
+ Internet Speed Test
+ Connection status: Connected
+
+
+ Start speed test?
+
+
+
+ Cancel
+
+
+ Confirm
+
+
+
+ )}
Disk Status
@@ -50,14 +64,14 @@ export default function OverlayExamples() {
C://
-
- 50% disk space remaining.
-
+ 50% disk space remaining.
- Edit
+
+ Edit
+
Change Name
diff --git a/examples/rsp-cra-18/src/sections/PickerExamples.tsx b/examples/rsp-cra-18/src/sections/PickerExamples.tsx
index c6f41af6099..3caaf3e39db 100644
--- a/examples/rsp-cra-18/src/sections/PickerExamples.tsx
+++ b/examples/rsp-cra-18/src/sections/PickerExamples.tsx
@@ -21,5 +21,5 @@ export default function PickerExamples() {
>
- )
+ );
}
diff --git a/examples/rsp-cra-18/src/sections/StatusExamples.tsx b/examples/rsp-cra-18/src/sections/StatusExamples.tsx
index d2a478ffc93..505531c8f9b 100644
--- a/examples/rsp-cra-18/src/sections/StatusExamples.tsx
+++ b/examples/rsp-cra-18/src/sections/StatusExamples.tsx
@@ -1,4 +1,19 @@
-import {Flex, Divider, Badge, InlineAlert, Heading, Content, LabeledValue, Meter, ProgressBar, ProgressCircle, StatusLight, Button, ToastContainer, ToastQueue} from '@adobe/react-spectrum';
+import {
+ Flex,
+ Divider,
+ Badge,
+ InlineAlert,
+ Heading,
+ Content,
+ LabeledValue,
+ Meter,
+ ProgressBar,
+ ProgressCircle,
+ StatusLight,
+ Button,
+ ToastContainer,
+ ToastQueue
+} from '@adobe/react-spectrum';
export default function StatusExamples() {
return (
@@ -9,7 +24,10 @@ export default function StatusExamples() {
Licensed
Payment Information
- Enter your billing address, shipping address, and payment method to complete your purchase.
+
+ Enter your billing address, shipping address, and payment method to complete your
+ purchase.
+
diff --git a/examples/rsp-cra-18/tsconfig.json b/examples/rsp-cra-18/tsconfig.json
index ff87c41a6b7..fbdccfb5b6b 100644
--- a/examples/rsp-cra-18/tsconfig.json
+++ b/examples/rsp-cra-18/tsconfig.json
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es5",
- "lib": [
- "dom",
- "dom.iterable",
- "esnext"
- ],
+ "lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
@@ -20,8 +16,5 @@
"noEmit": true,
"jsx": "react-jsx"
},
- "include": [
- "src",
- "typings.d.ts"
- ]
+ "include": ["src", "typings.d.ts"]
}
diff --git a/examples/rsp-cra-18/typings.d.ts b/examples/rsp-cra-18/typings.d.ts
index cbe652dbe00..35306c6fc9a 100644
--- a/examples/rsp-cra-18/typings.d.ts
+++ b/examples/rsp-cra-18/typings.d.ts
@@ -1 +1 @@
-declare module "*.css";
+declare module '*.css';
diff --git a/examples/rsp-next-ts-17/components/ReorderableListView.tsx b/examples/rsp-next-ts-17/components/ReorderableListView.tsx
index 43fd81cf40c..240e5928b1b 100644
--- a/examples/rsp-next-ts-17/components/ReorderableListView.tsx
+++ b/examples/rsp-next-ts-17/components/ReorderableListView.tsx
@@ -1,41 +1,41 @@
-import { Item, ListView, Text, useListData, useDragAndDrop } from "@adobe/react-spectrum";
-import Folder from "@spectrum-icons/illustrations/Folder";
+import {Item, ListView, Text, useListData, useDragAndDrop} from '@adobe/react-spectrum';
+import Folder from '@spectrum-icons/illustrations/Folder';
export default function ReorderableListView() {
let list = useListData({
initialItems: [
- { id: "1", type: "file", name: "Adobe Photoshop" },
- { id: "2", type: "file", name: "Adobe XD" },
- { id: "3", type: "folder", name: "Documents", childNodes: [] },
- { id: "4", type: "file", name: "Adobe InDesign" },
- { id: "5", type: "folder", name: "Utilities", childNodes: [] },
- { id: "6", type: "file", name: "Adobe AfterEffects" },
- ],
+ {id: '1', type: 'file', name: 'Adobe Photoshop'},
+ {id: '2', type: 'file', name: 'Adobe XD'},
+ {id: '3', type: 'folder', name: 'Documents', childNodes: []},
+ {id: '4', type: 'file', name: 'Adobe InDesign'},
+ {id: '5', type: 'folder', name: 'Utilities', childNodes: []},
+ {id: '6', type: 'file', name: 'Adobe AfterEffects'}
+ ]
});
// Append a generated key to the item type so they can only be reordered within this list and not dragged elsewhere.
- let { dragAndDropHooks } = useDragAndDrop({
+ let {dragAndDropHooks} = useDragAndDrop({
getItems(keys) {
- return [...keys].map((key) => {
+ return [...keys].map(key => {
let item = list.getItem(key);
// Setup the drag types and associated info for each dragged item.
return {
- "custom-app-type-reorder": JSON.stringify(item),
- "text/plain": item?.name ?? '',
+ 'custom-app-type-reorder': JSON.stringify(item),
+ 'text/plain': item?.name ?? ''
};
});
},
- acceptedDragTypes: ["custom-app-type-reorder"],
- onReorder: async (e) => {
- let { keys, target, dropOperation } = e;
+ acceptedDragTypes: ['custom-app-type-reorder'],
+ onReorder: async e => {
+ let {keys, target, dropOperation} = e;
- if (target.dropPosition === "before") {
+ if (target.dropPosition === 'before') {
list.moveBefore(target.key, [...keys]);
- } else if (target.dropPosition === "after") {
+ } else if (target.dropPosition === 'after') {
list.moveAfter(target.key, [...keys]);
}
},
- getAllowedDropOperations: () => ["move"],
+ getAllowedDropOperations: () => ['move']
});
return (
@@ -45,11 +45,10 @@ export default function ReorderableListView() {
width="size-3600"
height="size-3600"
items={list.items}
- dragAndDropHooks={dragAndDropHooks}
- >
- {(item) => (
+ dragAndDropHooks={dragAndDropHooks}>
+ {item => (
-
- {item.type === "folder" &&
}
+ {item.type === 'folder' && }
{item.name}
)}
diff --git a/examples/rsp-next-ts-17/components/Section.tsx b/examples/rsp-next-ts-17/components/Section.tsx
index 9e8a47a64bd..18e8a9bb7cb 100644
--- a/examples/rsp-next-ts-17/components/Section.tsx
+++ b/examples/rsp-next-ts-17/components/Section.tsx
@@ -1,5 +1,5 @@
-import { View, Heading, Divider } from "@adobe/react-spectrum";
-import React, {JSX} from "react";
+import {View, Heading, Divider} from '@adobe/react-spectrum';
+import React, {JSX} from 'react';
interface SectionProps {
title: string;
@@ -7,7 +7,7 @@ interface SectionProps {
}
export default function Section(props: SectionProps) {
- let { title, children } = props;
+ let {title, children} = props;
return (
diff --git a/examples/rsp-next-ts-17/next.config.js b/examples/rsp-next-ts-17/next.config.js
index 28eeca82e92..5b5cd234628 100644
--- a/examples/rsp-next-ts-17/next.config.js
+++ b/examples/rsp-next-ts-17/next.config.js
@@ -1,14 +1,14 @@
const glob = require('glob');
-const withTM = require("next-transpile-modules")([
- '@adobe/react-spectrum',
- '@react-spectrum/*',
- '@spectrum-icons/*',
-].flatMap(spec => glob.sync(`${spec}`, { cwd: 'node_modules/' })));
+const withTM = require('next-transpile-modules')(
+ ['@adobe/react-spectrum', '@react-spectrum/*', '@spectrum-icons/*'].flatMap(spec =>
+ glob.sync(`${spec}`, {cwd: 'node_modules/'})
+ )
+);
module.exports = withTM({
basePath:
process.env.VERDACCIO && process.env.CIRCLE_SHA1
? `/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/next17`
- : "",
+ : ''
});
diff --git a/examples/rsp-next-ts-17/package.json b/examples/rsp-next-ts-17/package.json
index 1610e015f93..bc5f0be9105 100644
--- a/examples/rsp-next-ts-17/package.json
+++ b/examples/rsp-next-ts-17/package.json
@@ -3,7 +3,6 @@
"version": "0.1.0",
"private": true,
"homepage": ".",
- "packageManager": "yarn@4.2.2",
"scripts": {
"dev": "next dev",
"build": "next build",
@@ -32,5 +31,6 @@
"resolutions": {
"next/@swc/helpers": "0.4.36"
},
- "browserslist": "defaults"
+ "browserslist": "defaults",
+ "packageManager": "yarn@4.2.2"
}
diff --git a/examples/rsp-next-ts-17/pages/_app.tsx b/examples/rsp-next-ts-17/pages/_app.tsx
index c3035577504..225fd3f2126 100644
--- a/examples/rsp-next-ts-17/pages/_app.tsx
+++ b/examples/rsp-next-ts-17/pages/_app.tsx
@@ -1,5 +1,5 @@
-import "../styles/globals.css";
-import type { AppProps } from "next/app";
+import '../styles/globals.css';
+import type {AppProps} from 'next/app';
import {
SSRProvider,
Provider,
@@ -9,39 +9,32 @@ import {
Grid,
View,
ToastContainer,
- ColorScheme,
-} from "@adobe/react-spectrum";
-import { useState } from "react";
-import Moon from "@spectrum-icons/workflow/Moon";
-import Light from "@spectrum-icons/workflow/Light";
+ ColorScheme
+} from '@adobe/react-spectrum';
+import {useState} from 'react';
+import Moon from '@spectrum-icons/workflow/Moon';
+import Light from '@spectrum-icons/workflow/Light';
import {enableTableNestedRows} from 'react-stately/private/flags/flags';
-function MyApp({ Component, pageProps }: AppProps) {
- const [theme, setTheme] = useState("light");
+function MyApp({Component, pageProps}: AppProps) {
+ const [theme, setTheme] = useState('light');
- let themeIcons = { dark: , light: };
- let otherTheme: ColorScheme = theme === "light" ? "dark" : "light";
+ let themeIcons = {dark: , light: };
+ let otherTheme: ColorScheme = theme === 'light' ? 'dark' : 'light';
enableTableNestedRows();
return (
-
+ areas={['header', 'content']}
+ columns={['1fr']}
+ rows={['size-200', 'auto']}
+ gap="size-100">
+
setTheme(otherTheme)}
- >
+ onPress={() => setTheme(otherTheme)}>
{themeIcons[otherTheme]}
diff --git a/examples/rsp-next-ts-17/pages/api/hello.ts b/examples/rsp-next-ts-17/pages/api/hello.ts
index f8bcc7e5cae..4c4b0a90507 100644
--- a/examples/rsp-next-ts-17/pages/api/hello.ts
+++ b/examples/rsp-next-ts-17/pages/api/hello.ts
@@ -1,13 +1,10 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
-import type { NextApiRequest, NextApiResponse } from 'next'
+import type {NextApiRequest, NextApiResponse} from 'next';
type Data = {
- name: string
-}
+ name: string;
+};
-export default function handler(
- req: NextApiRequest,
- res: NextApiResponse
-) {
- res.status(200).json({ name: 'John Doe' })
+export default function handler(req: NextApiRequest, res: NextApiResponse) {
+ res.status(200).json({name: 'John Doe'});
}
diff --git a/examples/rsp-next-ts-17/pages/index.tsx b/examples/rsp-next-ts-17/pages/index.tsx
index 55b5e295ed0..c1eed979b6e 100644
--- a/examples/rsp-next-ts-17/pages/index.tsx
+++ b/examples/rsp-next-ts-17/pages/index.tsx
@@ -1,6 +1,6 @@
-import Head from "next/head";
-import styles from "../styles/Home.module.css";
-import React, { useState } from "react";
+import Head from 'next/head';
+import styles from '../styles/Home.module.css';
+import React, {useState} from 'react';
import {
ActionMenu,
Item,
@@ -87,22 +87,30 @@ import {
TreeViewItemContent,
ToastQueue,
SubmenuTrigger
-} from "@adobe/react-spectrum";
-import Edit from "@spectrum-icons/workflow/Edit";
-import NotFound from "@spectrum-icons/illustrations/NotFound";
-import Section from "../components/Section";
-import ReorderableListView from "../components/ReorderableListView";
+} from '@adobe/react-spectrum';
+import Edit from '@spectrum-icons/workflow/Edit';
+import NotFound from '@spectrum-icons/illustrations/NotFound';
+import Section from '../components/Section';
+import ReorderableListView from '../components/ReorderableListView';
import FileTxt from '@spectrum-icons/workflow/FileTxt';
import Folder from '@spectrum-icons/workflow/Folder';
let nestedItems = [
- {foo: 'Lvl 1 Foo 1', bar: 'Lvl 1 Bar 1', baz: 'Lvl 1 Baz 1', childRows: [
- {foo: 'Lvl 2 Foo 1', bar: 'Lvl 2 Bar 1', baz: 'Lvl 2 Baz 1', childRows: [
- {foo: 'Lvl 3 Foo 1', bar: 'Lvl 3 Bar 1', baz: 'Lvl 3 Baz 1'}
- ]},
- {foo: 'Lvl 2 Foo 2', bar: 'Lvl 2 Bar 2', baz: 'Lvl 2 Baz 2'}
- ]}
+ {
+ foo: 'Lvl 1 Foo 1',
+ bar: 'Lvl 1 Bar 1',
+ baz: 'Lvl 1 Baz 1',
+ childRows: [
+ {
+ foo: 'Lvl 2 Foo 1',
+ bar: 'Lvl 2 Bar 1',
+ baz: 'Lvl 2 Baz 1',
+ childRows: [{foo: 'Lvl 3 Foo 1', bar: 'Lvl 3 Bar 1', baz: 'Lvl 3 Baz 1'}]
+ },
+ {foo: 'Lvl 2 Foo 2', bar: 'Lvl 2 Bar 2', baz: 'Lvl 2 Baz 2'}
+ ]
+ }
];
let columns = [
@@ -123,7 +131,7 @@ export default function Home() {
- React Spectrum +{" "}
+ React Spectrum +{' '}
Next.js
@@ -157,8 +165,7 @@ export default function Home() {
+ maxWidth="size-6000">
- Adobe Photoshop
- Adobe InDesign
- Adobe AfterEffects
@@ -168,18 +175,18 @@ export default function Home() {
Menu
- ToastQueue.positive(key.toString())}>
+ ToastQueue.positive(key.toString())}>
- Cut
- Copy
- Paste
- Replace
- Share
- ToastQueue.positive(key.toString())}>
+ ToastQueue.positive(key.toString())}>
- Copy Link
- Email
- ToastQueue.positive(key.toString())}>
+ ToastQueue.positive(key.toString())}>
- Email as Attachment
- Email as Link
@@ -198,10 +205,7 @@ export default function Home() {
- Paste
-
+
Name
Type
@@ -230,18 +234,22 @@ export default function Home() {
-
+
{column => {column.name} }
- {(item: any) =>
- (
- {(key) => {
+ {(item: any) => (
+
+ {key => {
return | {item[key.toString()]} | ;
}}
-
)
- }
+
+ )}
@@ -335,11 +343,7 @@ export default function Home() {
-
+
The missing link.
@@ -351,9 +355,7 @@ export default function Home() {
- Empire
- -
- Arma virumque cano, Troiae qui primus ab oris.
-
+ - Arma virumque cano, Troiae qui primus ab oris.
- Senatus Populusque Romanus.
- Alea jacta est.
@@ -362,17 +364,13 @@ export default function Home() {
Accordion
-
- Files
-
+ Files
Files content
-
- People
-
+ People
People content
@@ -391,13 +389,8 @@ export default function Home() {
Save
-
- You are running low on disk space. Delete unnecessary files to
- free up space.
+
+ You are running low on disk space. Delete unnecessary files to free up space.
@@ -405,22 +398,16 @@ export default function Home() {
Need help?
- If you are having issues accessing your account, contact our
- customer support team for help.
+ If you are having issues accessing your account, contact our customer support team
+ for help.
- setIsDialogOpen(true)}>
- Show Dialog
-
+ setIsDialogOpen(true)}>Show Dialog
setIsDialogOpen(false)}>
{isDialogOpen && (
-
+
Are you sure you want to delete this item?
)}
@@ -428,7 +415,7 @@ export default function Home() {
Check connectivity
- {(close) => (
+ {close => (
Internet Speed Test
Connection status: Connected
@@ -486,7 +473,7 @@ export default function Home() {
@@ -516,7 +503,10 @@ export default function Home() {
Payment Information
- Enter your billing address, shipping address, and payment method to complete your purchase.
+
+ Enter your billing address, shipping address, and payment method to complete your
+ purchase.
+
@@ -549,18 +539,11 @@ export default function Home() {
Paste
-
+
-
- Better a little which is well done, than a great deal imperfectly.
-
+ Better a little which is well done, than a great deal imperfectly.
diff --git a/examples/rsp-next-ts-17/styles/globals.css b/examples/rsp-next-ts-17/styles/globals.css
index e5e2dcc23ba..51a2a4eaacd 100644
--- a/examples/rsp-next-ts-17/styles/globals.css
+++ b/examples/rsp-next-ts-17/styles/globals.css
@@ -2,8 +2,18 @@ html,
body {
padding: 0;
margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
- Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
+ font-family:
+ -apple-system,
+ BlinkMacSystemFont,
+ Segoe UI,
+ Roboto,
+ Oxygen,
+ Ubuntu,
+ Cantarell,
+ Fira Sans,
+ Droid Sans,
+ Helvetica Neue,
+ sans-serif;
}
a {
diff --git a/examples/rsp-next-ts/components/AutocompleteExample.tsx b/examples/rsp-next-ts/components/AutocompleteExample.tsx
index 5c1c8d3dbe9..4bf3b1fed7a 100644
--- a/examples/rsp-next-ts/components/AutocompleteExample.tsx
+++ b/examples/rsp-next-ts/components/AutocompleteExample.tsx
@@ -1,14 +1,27 @@
-import {Autocomplete, Input, Label, Menu, MenuItem, SearchField, Text, useFilter} from 'react-aria-components'
+import {
+ Autocomplete,
+ Input,
+ Label,
+ Menu,
+ MenuItem,
+ SearchField,
+ Text,
+ useFilter
+} from 'react-aria-components';
import {classNames} from '@adobe/react-spectrum/private/utils/classNames';
import React from 'react';
import styles from './autocomplete.module.css';
interface AutocompleteItem {
- id: string,
- name: string
+ id: string;
+ name: string;
}
-let items: AutocompleteItem[] = [{id: '1', name: 'Foo'}, {id: '2', name: 'Bar'}, {id: '3', name: 'Baz'}];
+let items: AutocompleteItem[] = [
+ {id: '1', name: 'Foo'},
+ {id: '2', name: 'Bar'},
+ {id: '3', name: 'Baz'}
+];
export function AutocompleteExample() {
let {contains} = useFilter({sensitivity: 'base'});
@@ -19,17 +32,21 @@ export function AutocompleteExample() {
Test
- Please select an option below.
+
+ Please select an option below.
+
{item => (
classNames(styles, 'item', {
- focused: isFocused,
- selected: isSelected,
- open: isOpen
- })}>
+ className={({isFocused, isSelected, isOpen}) =>
+ classNames(styles, 'item', {
+ focused: isFocused,
+ selected: isSelected,
+ open: isOpen
+ })
+ }>
{item.name}
)}
diff --git a/examples/rsp-next-ts/components/ReorderableListView.tsx b/examples/rsp-next-ts/components/ReorderableListView.tsx
index 43fd81cf40c..240e5928b1b 100644
--- a/examples/rsp-next-ts/components/ReorderableListView.tsx
+++ b/examples/rsp-next-ts/components/ReorderableListView.tsx
@@ -1,41 +1,41 @@
-import { Item, ListView, Text, useListData, useDragAndDrop } from "@adobe/react-spectrum";
-import Folder from "@spectrum-icons/illustrations/Folder";
+import {Item, ListView, Text, useListData, useDragAndDrop} from '@adobe/react-spectrum';
+import Folder from '@spectrum-icons/illustrations/Folder';
export default function ReorderableListView() {
let list = useListData({
initialItems: [
- { id: "1", type: "file", name: "Adobe Photoshop" },
- { id: "2", type: "file", name: "Adobe XD" },
- { id: "3", type: "folder", name: "Documents", childNodes: [] },
- { id: "4", type: "file", name: "Adobe InDesign" },
- { id: "5", type: "folder", name: "Utilities", childNodes: [] },
- { id: "6", type: "file", name: "Adobe AfterEffects" },
- ],
+ {id: '1', type: 'file', name: 'Adobe Photoshop'},
+ {id: '2', type: 'file', name: 'Adobe XD'},
+ {id: '3', type: 'folder', name: 'Documents', childNodes: []},
+ {id: '4', type: 'file', name: 'Adobe InDesign'},
+ {id: '5', type: 'folder', name: 'Utilities', childNodes: []},
+ {id: '6', type: 'file', name: 'Adobe AfterEffects'}
+ ]
});
// Append a generated key to the item type so they can only be reordered within this list and not dragged elsewhere.
- let { dragAndDropHooks } = useDragAndDrop({
+ let {dragAndDropHooks} = useDragAndDrop({
getItems(keys) {
- return [...keys].map((key) => {
+ return [...keys].map(key => {
let item = list.getItem(key);
// Setup the drag types and associated info for each dragged item.
return {
- "custom-app-type-reorder": JSON.stringify(item),
- "text/plain": item?.name ?? '',
+ 'custom-app-type-reorder': JSON.stringify(item),
+ 'text/plain': item?.name ?? ''
};
});
},
- acceptedDragTypes: ["custom-app-type-reorder"],
- onReorder: async (e) => {
- let { keys, target, dropOperation } = e;
+ acceptedDragTypes: ['custom-app-type-reorder'],
+ onReorder: async e => {
+ let {keys, target, dropOperation} = e;
- if (target.dropPosition === "before") {
+ if (target.dropPosition === 'before') {
list.moveBefore(target.key, [...keys]);
- } else if (target.dropPosition === "after") {
+ } else if (target.dropPosition === 'after') {
list.moveAfter(target.key, [...keys]);
}
},
- getAllowedDropOperations: () => ["move"],
+ getAllowedDropOperations: () => ['move']
});
return (
@@ -45,11 +45,10 @@ export default function ReorderableListView() {
width="size-3600"
height="size-3600"
items={list.items}
- dragAndDropHooks={dragAndDropHooks}
- >
- {(item) => (
+ dragAndDropHooks={dragAndDropHooks}>
+ {item => (
-
- {item.type === "folder" &&
}
+ {item.type === 'folder' && }
{item.name}
)}
diff --git a/examples/rsp-next-ts/components/Section.tsx b/examples/rsp-next-ts/components/Section.tsx
index 9e8a47a64bd..18e8a9bb7cb 100644
--- a/examples/rsp-next-ts/components/Section.tsx
+++ b/examples/rsp-next-ts/components/Section.tsx
@@ -1,5 +1,5 @@
-import { View, Heading, Divider } from "@adobe/react-spectrum";
-import React, {JSX} from "react";
+import {View, Heading, Divider} from '@adobe/react-spectrum';
+import React, {JSX} from 'react';
interface SectionProps {
title: string;
@@ -7,7 +7,7 @@ interface SectionProps {
}
export default function Section(props: SectionProps) {
- let { title, children } = props;
+ let {title, children} = props;
return (
diff --git a/examples/rsp-next-ts/jest.config.js b/examples/rsp-next-ts/jest.config.js
index 3d2b048bed9..4bb592ea51a 100644
--- a/examples/rsp-next-ts/jest.config.js
+++ b/examples/rsp-next-ts/jest.config.js
@@ -22,5 +22,5 @@ module.exports = {
},
moduleNameMapper: {
'\\.(css|styl)$': 'identity-obj-proxy'
- },
+ }
};
diff --git a/examples/rsp-next-ts/next.config.mjs b/examples/rsp-next-ts/next.config.mjs
index 143f791d364..f158e90df3e 100644
--- a/examples/rsp-next-ts/next.config.mjs
+++ b/examples/rsp-next-ts/next.config.mjs
@@ -2,18 +2,16 @@ import localesPlugin from '@react-aria/optimize-locales-plugin';
import {glob} from 'glob';
export default {
- transpilePackages: [
- '@adobe/react-spectrum',
- '@react-spectrum/*',
- '@spectrum-icons/*'
- ].flatMap(spec => glob.sync(`${spec}`, { cwd: 'node_modules/' })),
+ transpilePackages: ['@adobe/react-spectrum', '@react-spectrum/*', '@spectrum-icons/*'].flatMap(
+ spec => glob.sync(`${spec}`, {cwd: 'node_modules/'})
+ ),
basePath:
process.env.VERDACCIO && process.env.CIRCLE_SHA1
? `/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/next`
- : "",
- webpack(config, { isServer }) {
+ : '',
+ webpack(config, {isServer}) {
if (!isServer) {
- config.plugins.push(localesPlugin.webpack({ locales: [] }));
+ config.plugins.push(localesPlugin.webpack({locales: []}));
}
return config;
}
diff --git a/examples/rsp-next-ts/package.json b/examples/rsp-next-ts/package.json
index 2dfb5ce9357..bdcdd9772b5 100644
--- a/examples/rsp-next-ts/package.json
+++ b/examples/rsp-next-ts/package.json
@@ -3,7 +3,6 @@
"version": "0.1.0",
"private": true,
"homepage": ".",
- "packageManager": "yarn@4.2.2",
"scripts": {
"dev": "next dev",
"build": "next build",
@@ -40,5 +39,6 @@
"strip-ansi": "6.0.1",
"wrap-ansi": "7.0.0"
},
- "browserslist": "defaults"
+ "browserslist": "defaults",
+ "packageManager": "yarn@4.2.2"
}
diff --git a/examples/rsp-next-ts/pages/_app.tsx b/examples/rsp-next-ts/pages/_app.tsx
index a06cf4d7be6..d94f67b08ad 100644
--- a/examples/rsp-next-ts/pages/_app.tsx
+++ b/examples/rsp-next-ts/pages/_app.tsx
@@ -1,5 +1,5 @@
-import "../styles/globals.css";
-import type { AppProps } from "next/app";
+import '../styles/globals.css';
+import type {AppProps} from 'next/app';
import {
Provider,
lightTheme,
@@ -8,42 +8,40 @@ import {
Grid,
View,
ToastContainer,
- ColorScheme,
-} from "@adobe/react-spectrum";
-import { useState } from "react";
-import Moon from "@spectrum-icons/workflow/Moon";
-import Light from "@spectrum-icons/workflow/Light";
+ ColorScheme
+} from '@adobe/react-spectrum';
+import {useState} from 'react';
+import Moon from '@spectrum-icons/workflow/Moon';
+import Light from '@spectrum-icons/workflow/Light';
import {enableTableNestedRows} from 'react-stately/private/flags/flags';
import {useRouter, type NextRouter} from 'next/router';
import Script from 'next/script';
declare module '@adobe/react-spectrum' {
interface RouterConfig {
- routerOptions: NonNullable[2]>
+ routerOptions: NonNullable[2]>;
}
}
-function MyApp({ Component, pageProps }: AppProps) {
- const [theme, setTheme] = useState("light");
+function MyApp({Component, pageProps}: AppProps) {
+ const [theme, setTheme] = useState('light');
let router = useRouter();
- let themeIcons = { dark: , light: };
- let otherTheme: ColorScheme = theme === "light" ? "dark" : "light";
+ let themeIcons = {dark: , light: };
+ let otherTheme: ColorScheme = theme === 'light' ? 'dark' : 'light';
enableTableNestedRows();
return (
<>
-
+ areas={['header', 'content']}
+ columns={['1fr']}
+ rows={['size-200', 'auto']}
+ gap="size-100">
+
setTheme(otherTheme)}
- >
+ onPress={() => setTheme(otherTheme)}>
{themeIcons[otherTheme]}
diff --git a/examples/rsp-next-ts/pages/_document.tsx b/examples/rsp-next-ts/pages/_document.tsx
index b96c963de6c..678cfa166c4 100644
--- a/examples/rsp-next-ts/pages/_document.tsx
+++ b/examples/rsp-next-ts/pages/_document.tsx
@@ -1,4 +1,4 @@
-import { Html, Head, Main, NextScript } from 'next/document'
+import {Html, Head, Main, NextScript} from 'next/document';
import {LocalizedStringProvider} from '@adobe/react-spectrum/i18n';
export default function Document(props: any) {
@@ -11,5 +11,5 @@ export default function Document(props: any) {
- )
+ );
}
diff --git a/examples/rsp-next-ts/pages/api/hello.ts b/examples/rsp-next-ts/pages/api/hello.ts
index f8bcc7e5cae..4c4b0a90507 100644
--- a/examples/rsp-next-ts/pages/api/hello.ts
+++ b/examples/rsp-next-ts/pages/api/hello.ts
@@ -1,13 +1,10 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
-import type { NextApiRequest, NextApiResponse } from 'next'
+import type {NextApiRequest, NextApiResponse} from 'next';
type Data = {
- name: string
-}
+ name: string;
+};
-export default function handler(
- req: NextApiRequest,
- res: NextApiResponse
-) {
- res.status(200).json({ name: 'John Doe' })
+export default function handler(req: NextApiRequest, res: NextApiResponse) {
+ res.status(200).json({name: 'John Doe'});
}
diff --git a/examples/rsp-next-ts/pages/index.tsx b/examples/rsp-next-ts/pages/index.tsx
index 51edad1361a..002ded9d77b 100644
--- a/examples/rsp-next-ts/pages/index.tsx
+++ b/examples/rsp-next-ts/pages/index.tsx
@@ -1,6 +1,6 @@
-import Head from "next/head";
-import styles from "../styles/Home.module.css";
-import React, { useState } from "react";
+import Head from 'next/head';
+import styles from '../styles/Home.module.css';
+import React, {useState} from 'react';
import {
ActionMenu,
Item,
@@ -87,23 +87,31 @@ import {
TreeViewItemContent,
ToastQueue,
SubmenuTrigger
-} from "@adobe/react-spectrum";
-import {AutocompleteExample} from "../components/AutocompleteExample";
-import Edit from "@spectrum-icons/workflow/Edit";
-import NotFound from "@spectrum-icons/illustrations/NotFound";
-import Section from "../components/Section";
-import ReorderableListView from "../components/ReorderableListView";
+} from '@adobe/react-spectrum';
+import {AutocompleteExample} from '../components/AutocompleteExample';
+import Edit from '@spectrum-icons/workflow/Edit';
+import NotFound from '@spectrum-icons/illustrations/NotFound';
+import Section from '../components/Section';
+import ReorderableListView from '../components/ReorderableListView';
import FileTxt from '@spectrum-icons/workflow/FileTxt';
import Folder from '@spectrum-icons/workflow/Folder';
let nestedItems = [
- {foo: 'Lvl 1 Foo 1', bar: 'Lvl 1 Bar 1', baz: 'Lvl 1 Baz 1', childRows: [
- {foo: 'Lvl 2 Foo 1', bar: 'Lvl 2 Bar 1', baz: 'Lvl 2 Baz 1', childRows: [
- {foo: 'Lvl 3 Foo 1', bar: 'Lvl 3 Bar 1', baz: 'Lvl 3 Baz 1'}
- ]},
- {foo: 'Lvl 2 Foo 2', bar: 'Lvl 2 Bar 2', baz: 'Lvl 2 Baz 2'}
- ]}
+ {
+ foo: 'Lvl 1 Foo 1',
+ bar: 'Lvl 1 Bar 1',
+ baz: 'Lvl 1 Baz 1',
+ childRows: [
+ {
+ foo: 'Lvl 2 Foo 1',
+ bar: 'Lvl 2 Bar 1',
+ baz: 'Lvl 2 Baz 1',
+ childRows: [{foo: 'Lvl 3 Foo 1', bar: 'Lvl 3 Bar 1', baz: 'Lvl 3 Baz 1'}]
+ },
+ {foo: 'Lvl 2 Foo 2', bar: 'Lvl 2 Bar 2', baz: 'Lvl 2 Baz 2'}
+ ]
+ }
];
let columns = [
@@ -125,7 +133,7 @@ export default function Home() {
- React Spectrum +{" "}
+ React Spectrum +{' '}
Next.js
@@ -159,8 +167,7 @@ export default function Home() {
+ maxWidth="size-6000">
- Adobe Photoshop
- Adobe InDesign
- Adobe AfterEffects
@@ -170,18 +177,18 @@ export default function Home() {
Menu
- ToastQueue.positive(key.toString())}>
+ ToastQueue.positive(key.toString())}>
- Cut
- Copy
- Paste
- Replace
- Share
- ToastQueue.positive(key.toString())}>
+ ToastQueue.positive(key.toString())}>
- Copy Link
- Email
- ToastQueue.positive(key.toString())}>
+ ToastQueue.positive(key.toString())}>
- Email as Attachment
- Email as Link
@@ -195,16 +202,15 @@ export default function Home() {
Menu Trigger
- - Link to /foo
+ -
+ Link to /foo
+
- Cut
- Copy
- Paste
-
+
Name
Type
@@ -233,18 +239,22 @@ export default function Home() {
-
+
{column => {column.name} }
- {(item: any) =>
- (
- {(key) => {
+ {(item: any) => (
+
+ {key => {
return | {item[key.toString()]} | ;
}}
-
)
- }
+
+ )}
@@ -347,10 +357,7 @@ export default function Home() {
- March 2020 Assets
-
+
The missing link.
Foo
@@ -362,9 +369,7 @@ export default function Home() {
- Empire
- -
- Arma virumque cano, Troiae qui primus ab oris.
-
+ - Arma virumque cano, Troiae qui primus ab oris.
- Senatus Populusque Romanus.
- Alea jacta est.
@@ -373,17 +378,13 @@ export default function Home() {
Accordion
-
- Files
-
+ Files
Files content
-
- People
-
+ People
People content
@@ -402,13 +403,8 @@ export default function Home() {
Save
-
- You are running low on disk space. Delete unnecessary files to
- free up space.
+
+ You are running low on disk space. Delete unnecessary files to free up space.
@@ -416,22 +412,16 @@ export default function Home() {
Need help?
- If you are having issues accessing your account, contact our
- customer support team for help.
+ If you are having issues accessing your account, contact our customer support team
+ for help.
- setIsDialogOpen(true)}>
- Show Dialog
-
+ setIsDialogOpen(true)}>Show Dialog
setIsDialogOpen(false)}>
{isDialogOpen && (
-
+
Are you sure you want to delete this item?
)}
@@ -439,7 +429,7 @@ export default function Home() {
Check connectivity
- {(close) => (
+ {close => (
Internet Speed Test
Connection status: Connected
@@ -497,7 +487,7 @@ export default function Home() {
@@ -527,7 +517,10 @@ export default function Home() {
Payment Information
- Enter your billing address, shipping address, and payment method to complete your purchase.
+
+ Enter your billing address, shipping address, and payment method to complete your
+ purchase.
+
@@ -560,18 +553,11 @@ export default function Home() {
Paste
-
+
-
- Better a little which is well done, than a great deal imperfectly.
-
+ Better a little which is well done, than a great deal imperfectly.
diff --git a/examples/rsp-next-ts/styles/globals.css b/examples/rsp-next-ts/styles/globals.css
index e5e2dcc23ba..51a2a4eaacd 100644
--- a/examples/rsp-next-ts/styles/globals.css
+++ b/examples/rsp-next-ts/styles/globals.css
@@ -2,8 +2,18 @@ html,
body {
padding: 0;
margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
- Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
+ font-family:
+ -apple-system,
+ BlinkMacSystemFont,
+ Segoe UI,
+ Roboto,
+ Oxygen,
+ Ubuntu,
+ Cantarell,
+ Fira Sans,
+ Droid Sans,
+ Helvetica Neue,
+ sans-serif;
}
a {
diff --git a/examples/rsp-next-ts/test/index.test.js b/examples/rsp-next-ts/test/index.test.js
index d78e7dbac5a..e27f057c422 100644
--- a/examples/rsp-next-ts/test/index.test.js
+++ b/examples/rsp-next-ts/test/index.test.js
@@ -4,6 +4,10 @@ import {render} from '@testing-library/react';
describe('smoke test', () => {
it('should render', () => {
- render( );
+ render(
+
+
+
+ );
});
});
diff --git a/examples/rsp-next-ts/typings.d.ts b/examples/rsp-next-ts/typings.d.ts
index 1ee54e47133..670529edeb8 100644
--- a/examples/rsp-next-ts/typings.d.ts
+++ b/examples/rsp-next-ts/typings.d.ts
@@ -1 +1 @@
-declare module "*.modules.css";
+declare module '*.modules.css';
diff --git a/examples/rsp-webpack-4/package.json b/examples/rsp-webpack-4/package.json
index f5314e2045d..e69da1f3e61 100644
--- a/examples/rsp-webpack-4/package.json
+++ b/examples/rsp-webpack-4/package.json
@@ -1,9 +1,12 @@
{
"name": "rsp-cra-18-webpack-4",
"version": "1.0.0",
+ "private": true,
"description": "test esm with webpack 4",
+ "workspaces": [
+ "../../packages/*/*"
+ ],
"main": "src/index.jsx",
- "packageManager": "yarn@4.2.2",
"scripts": {
"build": "webpack --mode production",
"start": "webpack-dev-server --mode development --open",
@@ -12,10 +15,6 @@
"postinstall": "patch-package",
"prepareForProd": "node ./scripts/prepareForProd.mjs"
},
- "private": true,
- "workspaces": [
- "../../packages/*/*"
- ],
"dependencies": {
"@adobe/react-spectrum": "latest",
"@react-spectrum/provider": "latest",
@@ -23,7 +22,6 @@
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
- "NOTE": "Do not update Jest. The old version is used for testing.",
"devDependencies": {
"@babel/cli": "^7.24.3",
"@babel/core": "^7.24.3",
@@ -40,5 +38,7 @@
},
"resolutions": {
"terser-webpack-plugin": "4.2.3"
- }
+ },
+ "packageManager": "yarn@4.2.2",
+ "NOTE": "Do not update Jest. The old version is used for testing."
}
diff --git a/examples/rsp-webpack-4/scripts/prepareForProd.mjs b/examples/rsp-webpack-4/scripts/prepareForProd.mjs
index 9c8cc445dcf..435142fb87b 100644
--- a/examples/rsp-webpack-4/scripts/prepareForProd.mjs
+++ b/examples/rsp-webpack-4/scripts/prepareForProd.mjs
@@ -1,4 +1,3 @@
-
import fs from 'node:fs';
let pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
diff --git a/examples/rsp-webpack-4/src/App.css b/examples/rsp-webpack-4/src/App.css
index b6b369d5d05..2e747c9a723 100644
--- a/examples/rsp-webpack-4/src/App.css
+++ b/examples/rsp-webpack-4/src/App.css
@@ -1,13 +1,13 @@
-body{
+body {
height: 100%;
}
-.no-bullets{
+.no-bullets {
list-style-type: none;
padding: 0px;
}
-#root{
+#root {
padding: 0;
margin: 0;
height: 100%;
@@ -17,6 +17,6 @@ html {
height: 100%;
}
-.content-padding{
+.content-padding {
padding: 50px;
-}
\ No newline at end of file
+}
diff --git a/examples/rsp-webpack-4/src/App.js b/examples/rsp-webpack-4/src/App.js
index ed65587e902..5b6093e93d9 100644
--- a/examples/rsp-webpack-4/src/App.js
+++ b/examples/rsp-webpack-4/src/App.js
@@ -1,7 +1,21 @@
import './App.css';
-import {Provider, defaultTheme, Item, TagGroup, Cell, Column, InlineAlert, Row, TableBody, TableHeader, TableView, Content, Heading} from '@adobe/react-spectrum';
+import {
+ Provider,
+ defaultTheme,
+ Item,
+ TagGroup,
+ Cell,
+ Column,
+ InlineAlert,
+ Row,
+ TableBody,
+ TableHeader,
+ TableView,
+ Content,
+ Heading
+} from '@adobe/react-spectrum';
import Lighting from './Lighting';
-import {useState} from 'react'
+import {useState} from 'react';
import BodyContent from './BodyContent';
import {enableTableNestedRows} from 'react-stately/private/flags/flags';
@@ -12,12 +26,20 @@ let columns = [
];
let nestedItems = [
- {foo: 'Lvl 1 Foo 1', bar: 'Lvl 1 Bar 1', baz: 'Lvl 1 Baz 1', childRows: [
- {foo: 'Lvl 2 Foo 1', bar: 'Lvl 2 Bar 1', baz: 'Lvl 2 Baz 1', childRows: [
- {foo: 'Lvl 3 Foo 1', bar: 'Lvl 3 Bar 1', baz: 'Lvl 3 Baz 1'}
- ]},
- {foo: 'Lvl 2 Foo 2', bar: 'Lvl 2 Bar 2', baz: 'Lvl 2 Baz 2'}
- ]}
+ {
+ foo: 'Lvl 1 Foo 1',
+ bar: 'Lvl 1 Bar 1',
+ baz: 'Lvl 1 Baz 1',
+ childRows: [
+ {
+ foo: 'Lvl 2 Foo 1',
+ bar: 'Lvl 2 Bar 1',
+ baz: 'Lvl 2 Baz 1',
+ childRows: [{foo: 'Lvl 3 Foo 1', bar: 'Lvl 3 Bar 1', baz: 'Lvl 3 Baz 1'}]
+ },
+ {foo: 'Lvl 2 Foo 2', bar: 'Lvl 2 Bar 2', baz: 'Lvl 2 Baz 2'}
+ ]
+ }
];
function App() {
@@ -25,9 +47,7 @@ function App() {
enableTableNestedRows();
return (
-
+
@@ -37,23 +57,28 @@ function App() {
- Shopping
-
-
- {column => {column.name} }
-
+
+ {column => {column.name} }
- {(item) =>
- (
- {(key) => {
+ {item => (
+
+ {key => {
return | {item[key]} | ;
}}
-
)
- }
+
+ )}
Payment Information
- Enter your billing address, shipping address, and payment method to complete your purchase.
+
+ Enter your billing address, shipping address, and payment method to complete your
+ purchase.
+
diff --git a/examples/rsp-webpack-4/src/BodyContent.js b/examples/rsp-webpack-4/src/BodyContent.js
index 8b7581a696d..4b110892e62 100644
--- a/examples/rsp-webpack-4/src/BodyContent.js
+++ b/examples/rsp-webpack-4/src/BodyContent.js
@@ -1,11 +1,9 @@
-import {useState, useRef} from "react";
-import {Item, TabList, TabPanels, Tabs} from '@adobe/react-spectrum'
+import {useState, useRef} from 'react';
+import {Item, TabList, TabPanels, Tabs} from '@adobe/react-spectrum';
import TodoList from './TodoList';
import JournalList from './JournalList';
-
-function BodyContent(){
-
+function BodyContent() {
//states for the To-Do list
const [list, setList] = useState([]);
const [value, setValue] = useState('');
@@ -19,60 +17,55 @@ function BodyContent(){
const countJournals = useRef(0);
const options = [
- {id: "Bad", name: "Bad"},
- {id: "Okay", name: "Okay"},
- {id: "Good", name: "Good"},
- {id: "Great", name: "Great"}
- ]
+ {id: 'Bad', name: 'Bad'},
+ {id: 'Okay', name: 'Okay'},
+ {id: 'Good', name: 'Good'},
+ {id: 'Great', name: 'Great'}
+ ];
//functions for the To-Do list
- function handleSubmitToDo(e){
- e.preventDefault()
+ function handleSubmitToDo(e) {
+ e.preventDefault();
- if (value.length > 0){
- setList(prevListArray => {
- return [
- ...prevListArray,
- {id: count.current, task: value}]
- })
+ if (value.length > 0) {
+ setList(prevListArray => {
+ return [...prevListArray, {id: count.current, task: value}];
+ });
- count.current = count.current + 1;
+ count.current = count.current + 1;
}
- setValue(""); //clears text field on submit
+ setValue(''); //clears text field on submit
}
- function updateCompleted(complete){
+ function updateCompleted(complete) {
setCompleted(prevListArray => {
- return [
- ...prevListArray,
- {id: prevListArray.length, task: complete}]
+ return [...prevListArray, {id: prevListArray.length, task: complete}];
});
}
- function clearCompleted(){
- setCompleted(() => {
- return [];
- })
+ function clearCompleted() {
+ setCompleted(() => {
+ return [];
+ });
}
//functions for journal entries
- function handleSubmitJournals(e){
- e.preventDefault()
+ function handleSubmitJournals(e) {
+ e.preventDefault();
- countJournals.current = countJournals.current + 1; //used to determine key for each item in the entryList array
+ countJournals.current = countJournals.current + 1; //used to determine key for each item in the entryList array
- setEntryList(prevListArray => {
- return [
- ...prevListArray,
- {rate: rating, description: description, id: countJournals.current}
- ]
- })
+ setEntryList(prevListArray => {
+ return [
+ ...prevListArray,
+ {rate: rating, description: description, id: countJournals.current}
+ ];
+ });
- setValue('') //clears the text area when submitted
+ setValue(''); //clears the text area when submitted
}
- return(
-
+ return (
- To-do List
@@ -80,27 +73,31 @@ function BodyContent(){
-
-
+
-
-
+
- )
+ );
}
export default BodyContent;
diff --git a/examples/rsp-webpack-4/src/Completed.js b/examples/rsp-webpack-4/src/Completed.js
index d36268fb0f5..d37371e9420 100644
--- a/examples/rsp-webpack-4/src/Completed.js
+++ b/examples/rsp-webpack-4/src/Completed.js
@@ -1,37 +1,37 @@
import Delete from '@spectrum-icons/workflow/Delete';
-import {AlertDialog, DialogTrigger, ActionButton} from '@adobe/react-spectrum'
-import {Checkbox} from '@adobe/react-spectrum'
-import {Flex} from '@adobe/react-spectrum'
+import {AlertDialog, DialogTrigger, ActionButton} from '@adobe/react-spectrum';
+import {Checkbox} from '@adobe/react-spectrum';
+import {Flex} from '@adobe/react-spectrum';
-function Completed(props){
+function Completed(props) {
+ const elements = props.completed.map(item => (
+
+ {item.task}
+
+ ));
- const elements = props.completed.map(item => (
- {item.task}
- ))
+ let alertCancel = () => alert('Cancel button pressed.');
- let alertCancel = () => alert('Cancel button pressed.');
-
- return (
-
- {elements}
-
-
-
-
-
- Are you sure you want to delete the completed tasks?
-
-
-
-
- )
+ return (
+
+ {elements}
+
+
+
+
+
+ Are you sure you want to delete the completed tasks?
+
+
+
+ );
}
export default Completed;
diff --git a/examples/rsp-webpack-4/src/JournalEntries.js b/examples/rsp-webpack-4/src/JournalEntries.js
index b76dea74452..38a9ea12718 100644
--- a/examples/rsp-webpack-4/src/JournalEntries.js
+++ b/examples/rsp-webpack-4/src/JournalEntries.js
@@ -1,23 +1,19 @@
-import {Flex, Divider} from '@adobe/react-spectrum'
+import {Flex, Divider} from '@adobe/react-spectrum';
-function JournalEntries(props){
+function JournalEntries(props) {
+ const element = props.list.map(item => (
+
+
+ Your day was: {item.rate}
+ {item.description}
+
+ ));
- const element = props.list.map(item => (
-
-
- Your day was: {item.rate}
- {item.description}
-
-
- ))
-
- return (
-
-
-
- )
+ return (
+
+
+
+ );
}
export default JournalEntries;
diff --git a/examples/rsp-webpack-4/src/JournalList.js b/examples/rsp-webpack-4/src/JournalList.js
index 9e5b2cf546d..9880382b8f8 100644
--- a/examples/rsp-webpack-4/src/JournalList.js
+++ b/examples/rsp-webpack-4/src/JournalList.js
@@ -1,32 +1,35 @@
import AddCircle from '@spectrum-icons/workflow/AddCircle';
-import {Flex, Text, Button, Form, TextArea, Picker, Item, Divider} from '@adobe/react-spectrum'
-import JournalEntries from './JournalEntries'
+import {Flex, Text, Button, Form, TextArea, Picker, Item, Divider} from '@adobe/react-spectrum';
+import JournalEntries from './JournalEntries';
-function JournalList(props){
- return(
- <>
-
-
- props.setRating(selected)}
- >
- {(item) => - {item.name}
}
-
-
-
-
- Add Entry
-
-
-
-
- Entries
-
- >
- )
+function JournalList(props) {
+ return (
+ <>
+
+
+ props.setRating(selected)}>
+ {item => - {item.name}
}
+
+
+
+
+ Add Entry
+
+
+
+
+ Entries
+
+ >
+ );
}
export default JournalList;
diff --git a/examples/rsp-webpack-4/src/Lighting.js b/examples/rsp-webpack-4/src/Lighting.js
index 129f3710ceb..aff551d03b7 100644
--- a/examples/rsp-webpack-4/src/Lighting.js
+++ b/examples/rsp-webpack-4/src/Lighting.js
@@ -1,14 +1,8 @@
-import {Switch} from '@adobe/react-spectrum'
+import {Switch} from '@adobe/react-spectrum';
function Lighting(props) {
-
- let mode = props.selected ? "Light Mode" : "Dark Mode";
- return (
-
- {mode}
-
- );
- }
-
+ let mode = props.selected ? 'Light Mode' : 'Dark Mode';
+ return {mode} ;
+}
export default Lighting;
diff --git a/examples/rsp-webpack-4/src/ToDoItems.js b/examples/rsp-webpack-4/src/ToDoItems.js
index 2b0e326c7d9..312bd8d4620 100644
--- a/examples/rsp-webpack-4/src/ToDoItems.js
+++ b/examples/rsp-webpack-4/src/ToDoItems.js
@@ -1,35 +1,28 @@
-import {CheckboxGroup, Checkbox, Flex} from '@adobe/react-spectrum'
-
+import {CheckboxGroup, Checkbox, Flex} from '@adobe/react-spectrum';
function TodoItems(props) {
-
- function removeItem(id){
-
- //add selected item to the completed list
- const found = props.list.find(element => element.id === id)
- if (found){
- props.updateCompleted(found.task);
- }
-
- //remove the item from the list
- props.handleList(props.list.filter(item => item.id !== id));
+ function removeItem(id) {
+ //add selected item to the completed list
+ const found = props.list.find(element => element.id === id);
+ if (found) {
+ props.updateCompleted(found.task);
}
- const elements = props.list.map(item => (
- removeItem(item.id)}
- key={item.id}
- value={item.task}>
- {item.task}
-
- ))
-
- return (
-
-
- {elements}
-
-
- );
+ //remove the item from the list
+ props.handleList(props.list.filter(item => item.id !== id));
+ }
+
+ const elements = props.list.map(item => (
+ removeItem(item.id)} key={item.id} value={item.task}>
+ {item.task}
+
+ ));
+
+ return (
+
+ {elements}
+
+ );
}
export default TodoItems;
diff --git a/examples/rsp-webpack-4/src/TodoList.js b/examples/rsp-webpack-4/src/TodoList.js
index 281e8727bae..b5287ec803f 100644
--- a/examples/rsp-webpack-4/src/TodoList.js
+++ b/examples/rsp-webpack-4/src/TodoList.js
@@ -1,33 +1,38 @@
import './App.css';
-import {Flex, TextField, Button, Form, Divider} from '@adobe/react-spectrum'
-import ToDoItems from "./ToDoItems"
-import Completed from "./Completed"
+import {Flex, TextField, Button, Form, Divider} from '@adobe/react-spectrum';
+import ToDoItems from './ToDoItems';
+import Completed from './Completed';
-
-function TodoList(props){
-
- return (
+function TodoList(props) {
+ return (
<>
-
-
-
-
- Submit
-
- To-Do
-
-
-
-
- Completed
-
+
+
+
+
+
+ Submit
+
+
+ To-Do
+
+
+
+
+ Completed
+
>
- );
+ );
}
export default TodoList;
diff --git a/examples/rsp-webpack-4/src/index.css b/examples/rsp-webpack-4/src/index.css
index ec2585e8c0b..99dd0500d68 100644
--- a/examples/rsp-webpack-4/src/index.css
+++ b/examples/rsp-webpack-4/src/index.css
@@ -1,13 +1,12 @@
body {
margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
- sans-serif;
+ font-family:
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell',
+ 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
- monospace;
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
}
diff --git a/examples/rsp-webpack-4/src/index.js b/examples/rsp-webpack-4/src/index.js
index e14fe6832af..3e15d21d9a8 100644
--- a/examples/rsp-webpack-4/src/index.js
+++ b/examples/rsp-webpack-4/src/index.js
@@ -4,14 +4,8 @@ import App from './App';
if (ReactDOM.version.startsWith('18')) {
let ReactDOMClient = require('react-dom/client');
- const root = ReactDOMClient.createRoot(
- document.getElementById('root')
- );
- root.render(
-
- );
+ const root = ReactDOMClient.createRoot(document.getElementById('root'));
+ root.render( );
} else {
- ReactDOM.render(
- , document.getElementById("root")
- )
+ ReactDOM.render( , document.getElementById('root'));
}
diff --git a/examples/rsp-webpack-4/webpack.config.js b/examples/rsp-webpack-4/webpack.config.js
index 3b55e512ba3..38fbd57ce6e 100644
--- a/examples/rsp-webpack-4/webpack.config.js
+++ b/examples/rsp-webpack-4/webpack.config.js
@@ -1,33 +1,32 @@
-
-const path = require("path");
-const webpack = require("webpack");
+const path = require('path');
+const webpack = require('webpack');
module.exports = {
- entry: "./src/index.js",
- mode: "development",
+ entry: './src/index.js',
+ mode: 'development',
module: {
rules: [
{
test: /\.(js|jsx|ts|tsx)$/,
exclude: /(node_modules|bower_components)/,
- loader: "babel-loader",
- options: { presets: ["@babel/env"] }
+ loader: 'babel-loader',
+ options: {presets: ['@babel/env']}
},
{
test: /\.css$/,
- use: ["style-loader", "css-loader"]
+ use: ['style-loader', 'css-loader']
}
]
},
output: {
- path: path.resolve(__dirname, "dist/"),
- publicPath: "/dist/",
- filename: "bundle.js"
+ path: path.resolve(__dirname, 'dist/'),
+ publicPath: '/dist/',
+ filename: 'bundle.js'
},
devServer: {
- contentBase: path.join(__dirname, "public/"),
+ contentBase: path.join(__dirname, 'public/'),
port: 3000,
- publicPath: "http://localhost:3000/dist/",
+ publicPath: 'http://localhost:3000/dist/',
hotOnly: true
},
plugins: [new webpack.HotModuleReplacementPlugin()]
diff --git a/examples/s2-esbuild-starter-app/build.mjs b/examples/s2-esbuild-starter-app/build.mjs
index f05b8659737..2fcbac39219 100644
--- a/examples/s2-esbuild-starter-app/build.mjs
+++ b/examples/s2-esbuild-starter-app/build.mjs
@@ -1,18 +1,18 @@
import * as esbuild from 'esbuild';
-import { createBuildSettings } from './settings.mjs';
+import {createBuildSettings} from './settings.mjs';
import fs from 'fs';
-const outdirectory = "dist";
+const outdirectory = 'dist';
//clear out any old JS or CSS
if (fs.existsSync(outdirectory)) {
- fs.rmSync(outdirectory, { recursive: true })
+ fs.rmSync(outdirectory, {recursive: true});
}
fs.mkdirSync(outdirectory);
fs.copyFileSync('index.html', outdirectory + '/index.html');
//defaults to build
-let config = "-build";
+let config = '-build';
if (process.argv.length > 2) {
config = process.argv[2];
}
@@ -25,10 +25,10 @@ if (config === '-watch') {
});
let ctx = await esbuild.context(settings);
- await ctx.watch()
+ await ctx.watch();
- let { host, port } = await ctx.serve({
- servedir: outdirectory,
+ let {host, port} = await ctx.serve({
+ servedir: outdirectory
});
console.log('serving on', host, port);
} else if (config === '-build') {
@@ -38,5 +38,3 @@ if (config === '-watch') {
});
await esbuild.build(settings);
}
-
-
diff --git a/examples/s2-esbuild-starter-app/index.html b/examples/s2-esbuild-starter-app/index.html
index f69bb12a280..c1892e2c6a0 100644
--- a/examples/s2-esbuild-starter-app/index.html
+++ b/examples/s2-esbuild-starter-app/index.html
@@ -1,13 +1,13 @@
+
+
+
+
+ ESBuild example
+
+
-
-
-
- ESBuild example
-
-
-
-
-
-
-
+
+
+
+
diff --git a/examples/s2-esbuild-starter-app/index.jsx b/examples/s2-esbuild-starter-app/index.jsx
index 2f70ac0a091..bf633213b08 100644
--- a/examples/s2-esbuild-starter-app/index.jsx
+++ b/examples/s2-esbuild-starter-app/index.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import ReactDOM from "react-dom";
+import ReactDOM from 'react-dom';
import App from './src/app';
-ReactDOM.render( , document.getElementById("root"));
\ No newline at end of file
+ReactDOM.render( , document.getElementById('root'));
diff --git a/examples/s2-esbuild-starter-app/package.json b/examples/s2-esbuild-starter-app/package.json
index af55672b74a..fb5e0867ca1 100644
--- a/examples/s2-esbuild-starter-app/package.json
+++ b/examples/s2-esbuild-starter-app/package.json
@@ -2,6 +2,8 @@
"name": "esbuild-rainbow",
"version": "1.0.0",
"description": "Test app using macros",
+ "license": "ISC",
+ "author": "",
"main": "index.js",
"scripts": {
"build": "node build.mjs -build",
@@ -9,8 +11,6 @@
"test": "test",
"postinstall": "patch-package"
},
- "author": "",
- "license": "ISC",
"dependencies": {
"@react-spectrum/s2": "latest",
"react": "^18.2.0",
diff --git a/examples/s2-esbuild-starter-app/settings.mjs b/examples/s2-esbuild-starter-app/settings.mjs
index 1c047e44fe1..3a90a1f6411 100644
--- a/examples/s2-esbuild-starter-app/settings.mjs
+++ b/examples/s2-esbuild-starter-app/settings.mjs
@@ -9,7 +9,7 @@ export function createBuildSettings(options) {
macros.esbuild(),
esbuildPluginTsc({
force: true
- }),
+ })
],
...options
};
diff --git a/examples/s2-esbuild-starter-app/src/app.tsx b/examples/s2-esbuild-starter-app/src/app.tsx
index 3601a66c91c..c7a2aa8ef37 100644
--- a/examples/s2-esbuild-starter-app/src/app.tsx
+++ b/examples/s2-esbuild-starter-app/src/app.tsx
@@ -10,19 +10,17 @@
* governing permissions and limitations under the License.
*/
-
-import "@react-spectrum/s2/page.css";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { Button, Provider } from "@react-spectrum/s2";
+import '@react-spectrum/s2/page.css';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {Button, Provider} from '@react-spectrum/s2';
function App() {
return (
+ marginStart: 16
+ })}>
Hello Spectrum 2!
diff --git a/examples/s2-esbuild-starter-app/tsconfig.json b/examples/s2-esbuild-starter-app/tsconfig.json
index b1cae0c6f72..0008c832259 100644
--- a/examples/s2-esbuild-starter-app/tsconfig.json
+++ b/examples/s2-esbuild-starter-app/tsconfig.json
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "ES2022",
- "lib": [
- "dom",
- "dom.iterable",
- "esnext"
- ],
+ "lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
@@ -18,10 +14,6 @@
"noEmit": true,
"jsx": "react-jsx"
},
- "include": [
- "src"
- ],
- "exclude": [
- "icon.d.ts"
- ]
-}
\ No newline at end of file
+ "include": ["src"],
+ "exclude": ["icon.d.ts"]
+}
diff --git a/examples/s2-next-macros/next.config.mjs b/examples/s2-next-macros/next.config.mjs
index 056a4123343..65774bb82c4 100644
--- a/examples/s2-next-macros/next.config.mjs
+++ b/examples/s2-next-macros/next.config.mjs
@@ -6,14 +6,17 @@ let macrosWebpack = macrosPlugin.webpack();
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
- basePath: process.env.VERDACCIO && process.env.CIRCLE_SHA1 ? `/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/s2-next-macros` : "",
+ basePath:
+ process.env.VERDACCIO && process.env.CIRCLE_SHA1
+ ? `/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/s2-next-macros`
+ : '',
webpack(config, {}) {
config.plugins.push(macrosWebpack);
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
- use: ['@svgr/webpack'],
+ use: ['@svgr/webpack']
});
return config;
diff --git a/examples/s2-next-macros/postcss.config.js b/examples/s2-next-macros/postcss.config.js
index b82655a829c..7e38ed9d102 100644
--- a/examples/s2-next-macros/postcss.config.js
+++ b/examples/s2-next-macros/postcss.config.js
@@ -1,3 +1,3 @@
module.exports = {
plugins: []
-}
\ No newline at end of file
+};
diff --git a/examples/s2-next-macros/src/app/Lazy.js b/examples/s2-next-macros/src/app/Lazy.js
index b4c10079ddb..03a6588e437 100644
--- a/examples/s2-next-macros/src/app/Lazy.js
+++ b/examples/s2-next-macros/src/app/Lazy.js
@@ -10,10 +10,10 @@
* governing permissions and limitations under the License.
*/
-'use client'
+'use client';
-import React, {useState} from "react";
-import "@react-spectrum/s2/page.css";
+import React, {useState} from 'react';
+import '@react-spectrum/s2/page.css';
import {
Accordion,
ActionButton,
@@ -91,18 +91,18 @@ import {
TextField,
TimeField,
Tooltip,
- TooltipTrigger,
-} from "@react-spectrum/s2";
+ TooltipTrigger
+} from '@react-spectrum/s2';
import Checkmark from '@react-spectrum/s2/illustrations/gradient/generic1/Checkmark';
-import Cloud from "@react-spectrum/s2/illustrations/linear/Cloud";
-import DropToUpload from "@react-spectrum/s2/illustrations/linear/DropToUpload";
-import Server from "@react-spectrum/s2/illustrations/linear/Server";
-import AlertNotice from "@react-spectrum/s2/illustrations/linear/AlertNotice";
-import PaperAirplane from "@react-spectrum/s2/illustrations/linear/Paperairplane";
-import StarFilled1 from "@react-spectrum/s2/illustrations/linear/Star";
-import Edit from "@react-spectrum/s2/icons/Edit";
-import Section from "./components/Section";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
+import Cloud from '@react-spectrum/s2/illustrations/linear/Cloud';
+import DropToUpload from '@react-spectrum/s2/illustrations/linear/DropToUpload';
+import Server from '@react-spectrum/s2/illustrations/linear/Server';
+import AlertNotice from '@react-spectrum/s2/illustrations/linear/AlertNotice';
+import PaperAirplane from '@react-spectrum/s2/illustrations/linear/Paperairplane';
+import StarFilled1 from '@react-spectrum/s2/illustrations/linear/Star';
+import Edit from '@react-spectrum/s2/icons/Edit';
+import Section from './components/Section';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
export default function Lazy() {
let [isDialogOpen, setIsDialogOpen] = useState(false);
@@ -145,9 +145,8 @@ export default function Lazy() {
+ maxWidth: 288
+ })}>
Soccer
Baseball
@@ -187,27 +186,23 @@ export default function Lazy() {
-
+
-
- Files
-
-
+ Files
+
+
+
-
- Files content
-
+ Files content
-
- People
-
+ People
-
+
@@ -217,11 +212,7 @@ export default function Lazy() {
Trendy
March 2020 Assets
-
+
The missing link.
Foo
@@ -237,9 +228,7 @@ export default function Lazy() {
Monarchy and Republic
Empire
-
- Arma virumque cano, Troiae qui primus ab oris.
-
+
Arma virumque cano, Troiae qui primus ab oris.
Senatus Populusque Romanus.
Alea jacta est.
@@ -248,13 +237,8 @@ export default function Lazy() {
Save
-
- You are running low on disk space. Delete unnecessary files to
- free up space.
+
+ You are running low on disk space. Delete unnecessary files to free up space.
@@ -262,22 +246,16 @@ export default function Lazy() {
Need help?
- If you are having issues accessing your account, contact our
- customer support team for help.
+ If you are having issues accessing your account, contact our customer support team for
+ help.
- setIsDialogOpen(true)}>
- Show Dialog
-
+ setIsDialogOpen(true)}>Show Dialog
setIsDialogOpen(false)}>
{isDialogOpen && (
-
+
Are you sure you want to delete this item?
)}
@@ -310,10 +288,23 @@ export default function Lazy() {
Illustration
-
+
-
Thank you!
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+
+ Thank you!
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua.
+
@@ -322,7 +313,9 @@ export default function Lazy() {
Disk Status
- C://
+
+ C://
+
50% disk space remaining.
@@ -333,20 +326,35 @@ export default function Lazy() {
Fullscreen
- {({close}) => <>
+ {({close}) => (
+ <>
Dialog title
- {[...Array(5)].map((_, i) => Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
)}
+ {[...Array(5)].map((_, i) => (
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
+ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+ Duis aute irure dolor in
+
+ ))}
- Cancel
- Save
+
+ Cancel
+
+
+ Save
+
- >}
+ >
+ )}
@@ -376,7 +384,7 @@ export default function Lazy() {
@@ -405,35 +413,20 @@ export default function Lazy() {
Payment Information
- Enter your billing address, shipping address, and payment method
- to complete your purchase.
+ Enter your billing address, shipping address, and payment method to complete your
+ purchase.
-
+
-
-
-
-
+
+
+
+
Content is king
diff --git a/examples/s2-next-macros/src/app/components/CardViewExample.jsx b/examples/s2-next-macros/src/app/components/CardViewExample.jsx
index 79bec879537..eb2df602767 100644
--- a/examples/s2-next-macros/src/app/components/CardViewExample.jsx
+++ b/examples/s2-next-macros/src/app/components/CardViewExample.jsx
@@ -10,11 +10,24 @@
* governing permissions and limitations under the License.
*/
-import { ActionMenu, Avatar, Card, CardPreview, CardView, Collection, CollectionCardPreview, Content, Image, MenuItem, SkeletonCollection, Text } from '@react-spectrum/s2';
+import {
+ ActionMenu,
+ Avatar,
+ Card,
+ CardPreview,
+ CardView,
+ Collection,
+ CollectionCardPreview,
+ Content,
+ Image,
+ MenuItem,
+ SkeletonCollection,
+ Text
+} from '@react-spectrum/s2';
import Folder from '@react-spectrum/s2/icons/Folder';
import ErrorIcon from '@react-spectrum/s2/illustrations/linear/AlertNotice';
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { useAsyncList } from 'react-stately';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {useAsyncList} from 'react-stately';
const cardViewStyles = style({
width: 'full',
@@ -34,42 +47,59 @@ const avatarSize = {
function PhotoCard({item, layout}) {
return (
- {({size}) => (<>
-
- (
-
-
-
- )} />
-
-
- {item.description || item.alt_description}
- {size !== 'XS' &&
- Test
- }
-
-
- >)}
+ {({size}) => (
+ <>
+
+ (
+
+
+
+ )}
+ />
+
+
+ {item.description || item.alt_description}
+ {size !== 'XS' && (
+
+ Test
+
+ )}
+
+
+ >
+ )}
);
}
-export const CardViewExample = (props) => {
+export const CardViewExample = props => {
let list = useAsyncList({
async load({signal, cursor, items}) {
let page = cursor || 1;
@@ -80,7 +110,9 @@ export const CardViewExample = (props) => {
let nextItems = await res.json();
// Filter duplicates which might be returned by the API.
let existingKeys = new Set(items.map(i => i.id));
- nextItems = nextItems.filter(i => !existingKeys.has(i.id) && (i.description || i.alt_description));
+ nextItems = nextItems.filter(
+ i => !existingKeys.has(i.id) && (i.description || i.alt_description)
+ );
return {items: nextItems, cursor: nextItems.length ? page + 1 : null};
}
});
@@ -111,7 +143,8 @@ export const CardViewExample = (props) => {
width: 400,
height: 200 + Math.max(0, Math.round(Math.random() * 400))
}}
- layout={props.layout || 'grid'} />
+ layout={props.layout || 'grid'}
+ />
)}
)}
@@ -138,7 +171,7 @@ function TopicCard({topic}) {
);
}
-export const CollectionCardsExample = (props) => {
+export const CollectionCardsExample = props => {
let list = useAsyncList({
async load({signal, cursor}) {
let page = cursor || 1;
@@ -146,7 +179,7 @@ export const CollectionCardsExample = (props) => {
`https://api.unsplash.com/topics?page=${page}&per_page=30&client_id=AJuU-FPh11hn7RuumUllp4ppT8kgiLS7LtOHp_sp4nc`,
{signal}
);
- let items = (await res.json()).filter((topic) => !!topic.preview_photos);
+ let items = (await res.json()).filter(topic => !!topic.preview_photos);
return {items, cursor: items.length ? page + 1 : null};
}
});
@@ -161,9 +194,7 @@ export const CollectionCardsExample = (props) => {
loadingState={loadingState}
onLoadMore={props.loadingState === 'idle' ? list.loadMore : undefined}
styles={cardViewStyles}>
-
- {topic => }
-
+ {topic => }
{(loadingState === 'loading' || loadingState === 'loadingMore') && (
{() => (
@@ -179,10 +210,11 @@ export const CollectionCardsExample = (props) => {
{id: 'c', urls: {small: ''}},
{id: 'd', urls: {small: ''}}
]
- }} />
+ }}
+ />
)}
)}
);
-};
\ No newline at end of file
+};
diff --git a/examples/s2-next-macros/src/app/components/CollectionCardsExample.jsx b/examples/s2-next-macros/src/app/components/CollectionCardsExample.jsx
index 07bd17e3976..f8a6757d1d0 100644
--- a/examples/s2-next-macros/src/app/components/CollectionCardsExample.jsx
+++ b/examples/s2-next-macros/src/app/components/CollectionCardsExample.jsx
@@ -1,4 +1,3 @@
-
/*
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -11,10 +10,19 @@
* governing permissions and limitations under the License.
*/
-import { Card, CardView, Collection, CollectionCardPreview, Content, Image, SkeletonCollection, Text } from '@react-spectrum/s2';
+import {
+ Card,
+ CardView,
+ Collection,
+ CollectionCardPreview,
+ Content,
+ Image,
+ SkeletonCollection,
+ Text
+} from '@react-spectrum/s2';
import Folder from '@react-spectrum/s2/icons/Folder';
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { useAsyncList } from 'react-stately';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {useAsyncList} from 'react-stately';
const cardViewStyles = style({
width: 'full',
@@ -42,7 +50,7 @@ function TopicCard({topic}) {
);
}
-export const CollectionCardsExample = (props) => {
+export const CollectionCardsExample = props => {
let list = useAsyncList({
async load({signal, cursor}) {
let page = cursor || 1;
@@ -50,7 +58,7 @@ export const CollectionCardsExample = (props) => {
`https://api.unsplash.com/topics?page=${page}&per_page=30&client_id=AJuU-FPh11hn7RuumUllp4ppT8kgiLS7LtOHp_sp4nc`,
{signal}
);
- let items = (await res.json()).filter((topic) => !!topic.preview_photos);
+ let items = (await res.json()).filter(topic => !!topic.preview_photos);
return {items, cursor: items.length ? page + 1 : null};
}
});
@@ -65,9 +73,7 @@ export const CollectionCardsExample = (props) => {
loadingState={loadingState}
onLoadMore={props.loadingState === 'idle' ? list.loadMore : undefined}
styles={cardViewStyles}>
-
- {topic => }
-
+ {topic => }
{(loadingState === 'loading' || loadingState === 'loadingMore') && (
{() => (
@@ -83,10 +89,11 @@ export const CollectionCardsExample = (props) => {
{id: 'c', urls: {small: ''}},
{id: 'd', urls: {small: ''}}
]
- }} />
+ }}
+ />
)}
)}
);
-};
\ No newline at end of file
+};
diff --git a/examples/s2-next-macros/src/app/components/Section.jsx b/examples/s2-next-macros/src/app/components/Section.jsx
index 33b8a6213f3..18b91ad7f57 100644
--- a/examples/s2-next-macros/src/app/components/Section.jsx
+++ b/examples/s2-next-macros/src/app/components/Section.jsx
@@ -1,29 +1,27 @@
-import React from "react";
-import { Heading } from "@react-spectrum/s2";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
+import React from 'react';
+import {Heading} from '@react-spectrum/s2';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
export default function Section(props) {
- let { title, children } = props;
+ let {title, children} = props;
return (
-
+
+ level={2}>
{title}
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ gap: 16
+ })}>
{children}
diff --git a/examples/s2-next-macros/src/app/layout.tsx b/examples/s2-next-macros/src/app/layout.tsx
index 95167c156c9..baee841faf5 100644
--- a/examples/s2-next-macros/src/app/layout.tsx
+++ b/examples/s2-next-macros/src/app/layout.tsx
@@ -11,21 +11,17 @@
*/
import {ClientProviders} from './provider';
-import type { Metadata } from "next";
+import type {Metadata} from 'next';
export const metadata: Metadata = {
- title: "Spectrum 2 + Next.js",
- description: "Generated by create next app",
+ title: 'Spectrum 2 + Next.js',
+ description: 'Generated by create next app'
};
export default function RootLayout({
- children,
+ children
}: Readonly<{
children: React.ReactNode;
}>) {
- return (
-
- {children}
-
- );
+ return
{children} ;
}
diff --git a/examples/s2-next-macros/src/app/page.tsx b/examples/s2-next-macros/src/app/page.tsx
index 536b5a2cb78..bf942665998 100644
--- a/examples/s2-next-macros/src/app/page.tsx
+++ b/examples/s2-next-macros/src/app/page.tsx
@@ -10,10 +10,10 @@
* governing permissions and limitations under the License.
*/
-'use client'
+'use client';
-import React, { useState } from "react";
-import "@react-spectrum/s2/page.css";
+import React, {useState} from 'react';
+import '@react-spectrum/s2/page.css';
import {
ActionBar,
ActionButton,
@@ -49,14 +49,14 @@ import {
TreeViewItem,
TreeViewItemContent,
UnavailableMenuItemTrigger
-} from "@react-spectrum/s2";
-import Edit from "@react-spectrum/s2/icons/Edit";
-import FileTxt from "@react-spectrum/s2/icons/FileText";
-import Folder from "@react-spectrum/s2/icons/Folder";
-import Section from "./components/Section";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { CardViewExample } from "./components/CardViewExample";
-import { CollectionCardsExample } from "./components/CollectionCardsExample";
+} from '@react-spectrum/s2';
+import Edit from '@react-spectrum/s2/icons/Edit';
+import FileTxt from '@react-spectrum/s2/icons/FileText';
+import Folder from '@react-spectrum/s2/icons/Folder';
+import Section from './components/Section';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {CardViewExample} from './components/CardViewExample';
+import {CollectionCardsExample} from './components/CollectionCardsExample';
const Lazy = React.lazy(() => import('./Lazy.js'));
@@ -64,14 +64,14 @@ function App() {
let [isLazyLoaded, setLazyLoaded] = useState(false);
let [cardViewState, setCardViewState] = useState({
layout: 'grid',
- loadingState: 'idle',
+ loadingState: 'idle'
});
let cardViewLoadingOptions = [
{id: 'idle', label: 'Idle'},
{id: 'loading', label: 'Loading'},
{id: 'sorting', label: 'Sorting'},
{id: 'loadingMore', label: 'Loading More'},
- {id: 'error', label: 'Error'},
+ {id: 'error', label: 'Error'}
];
let cardViewLayoutOptions = [
{id: 'grid', label: 'Grid'},
@@ -79,43 +79,36 @@ function App() {
];
return (
-
+
Spectrum 2 + Next.js
+ alignItems: 'center'
+ })}>
Primary
- Secondary
+
+ Secondary
+
Action Button
Toggle Button
-
+
Link Button
@@ -141,14 +134,18 @@ function App() {
label="CardView Loading State"
items={cardViewLoadingOptions}
selectedKey={cardViewState.loadingState}
- onSelectionChange={loadingState => setCardViewState({...cardViewState, loadingState: loadingState as string})}>
+ onSelectionChange={loadingState =>
+ setCardViewState({...cardViewState, loadingState: loadingState as string})
+ }>
{item => {item.label} }
setCardViewState({...cardViewState, layout: layout as string})}>
+ onSelectionChange={layout =>
+ setCardViewState({...cardViewState, layout: layout as string})
+ }>
{item => {item.label} }
@@ -156,18 +153,18 @@ function App() {
Menu
- alert(key.toString())}>
+ alert(key.toString())}>
Cut
Copy
Paste
Replace
Share
- alert(key.toString())}>
+ alert(key.toString())}>
Copy Link
Email
- alert(key.toString())}>
+ alert(key.toString())}>
Email as Attachment
Email as Link
@@ -187,9 +184,7 @@ function App() {
Menu Trigger
-
- Link to /foo
-
+ Link to /foo
Cut
Copy
Paste
@@ -220,7 +215,9 @@ function App() {
console.log('edit', selectedKeys)}>Edit
console.log('copy', selectedKeys)}>Copy
- console.log('delete', selectedKeys)}>Delete
+ console.log('delete', selectedKeys)}>
+ Delete
+
)}>
@@ -294,10 +291,14 @@ function App() {
- {!isLazyLoaded &&
setLazyLoaded(true)}>Load more }
- {isLazyLoaded &&
Loading>}>
-
- }
+ {!isLazyLoaded && (
+
setLazyLoaded(true)}>Load more
+ )}
+ {isLazyLoaded && (
+
Loading>}>
+
+
+ )}
);
diff --git a/examples/s2-next-macros/src/app/provider.tsx b/examples/s2-next-macros/src/app/provider.tsx
index 0075d1b4530..82616a98e34 100644
--- a/examples/s2-next-macros/src/app/provider.tsx
+++ b/examples/s2-next-macros/src/app/provider.tsx
@@ -2,26 +2,22 @@
import {useRouter} from 'next/navigation';
import {RouterProvider} from 'react-aria-components';
-import { ReactNode } from 'react';
-import { Provider } from '@react-spectrum/s2';
+import {ReactNode} from 'react';
+import {Provider} from '@react-spectrum/s2';
declare module 'react-aria-components' {
interface RouterConfig {
- routerOptions: NonNullable<
- Parameters
['push']>[1]
- >;
+ routerOptions: NonNullable['push']>[1]>;
}
}
-export function ClientProviders({ children }: { children: ReactNode }) {
+export function ClientProviders({children}: {children: ReactNode}) {
let router = useRouter();
return (
-
- {children}
-
+ {children}
);
-}
\ No newline at end of file
+}
diff --git a/examples/s2-next-macros/tsconfig.json b/examples/s2-next-macros/tsconfig.json
index f48e7ee6f92..51d0dbcee7f 100644
--- a/examples/s2-next-macros/tsconfig.json
+++ b/examples/s2-next-macros/tsconfig.json
@@ -1,10 +1,6 @@
{
"compilerOptions": {
- "lib": [
- "dom",
- "dom.iterable",
- "esnext"
- ],
+ "lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
@@ -22,19 +18,10 @@
}
],
"paths": {
- "@/*": [
- "./src/*"
- ]
+ "@/*": ["./src/*"]
},
"target": "ES2017"
},
- "include": [
- "next-env.d.ts",
- "**/*.ts",
- "**/*.tsx",
- ".next/types/**/*.ts"
- ],
- "exclude": [
- "node_modules"
- ]
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
+ "exclude": ["node_modules"]
}
diff --git a/examples/s2-parcel-example/package.json b/examples/s2-parcel-example/package.json
index c95584b5487..74ae06a0ded 100644
--- a/examples/s2-parcel-example/package.json
+++ b/examples/s2-parcel-example/package.json
@@ -1,18 +1,18 @@
{
- "packageManager": "yarn@4.2.2",
- "devDependencies": {
- "parcel": "^2.16.3",
- "process": "^0.11.10"
+ "scripts": {
+ "dev": "parcel src/index.html",
+ "build": "parcel build src/index.html"
},
"dependencies": {
"@react-spectrum/s2": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
- "scripts": {
- "dev": "parcel src/index.html",
- "build": "parcel build src/index.html"
+ "devDependencies": {
+ "parcel": "^2.16.3",
+ "process": "^0.11.10"
},
+ "packageManager": "yarn@4.2.2",
"@parcel/bundler-default": {
"manualSharedBundles": [
{
diff --git a/examples/s2-parcel-example/src/App.js b/examples/s2-parcel-example/src/App.js
index b3148bee566..0ece412ec1c 100644
--- a/examples/s2-parcel-example/src/App.js
+++ b/examples/s2-parcel-example/src/App.js
@@ -10,8 +10,8 @@
* governing permissions and limitations under the License.
*/
-import React, { useState } from "react";
-import "@react-spectrum/s2/page.css";
+import React, {useState} from 'react';
+import '@react-spectrum/s2/page.css';
import {
ActionBar,
ActionButton,
@@ -47,14 +47,14 @@ import {
TreeViewItem,
TreeViewItemContent,
UnavailableMenuItemTrigger
-} from "@react-spectrum/s2";
-import Edit from "@react-spectrum/s2/icons/Edit";
-import FileTxt from "@react-spectrum/s2/icons/FileText";
-import Folder from "@react-spectrum/s2/icons/Folder";
-import Section from "./components/Section";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { CardViewExample } from "./components/CardViewExample";
-import { CollectionCardsExample } from "./components/CollectionCardsExample";
+} from '@react-spectrum/s2';
+import Edit from '@react-spectrum/s2/icons/Edit';
+import FileTxt from '@react-spectrum/s2/icons/FileText';
+import Folder from '@react-spectrum/s2/icons/Folder';
+import Section from './components/Section';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {CardViewExample} from './components/CardViewExample';
+import {CollectionCardsExample} from './components/CollectionCardsExample';
const Lazy = React.lazy(() => import('./Lazy'));
@@ -62,14 +62,14 @@ function App() {
let [isLazyLoaded, setLazyLoaded] = useState(false);
let [cardViewState, setCardViewState] = useState({
layout: 'grid',
- loadingState: 'idle',
+ loadingState: 'idle'
});
let cardViewLoadingOptions = [
{id: 'idle', label: 'Idle'},
{id: 'loading', label: 'Loading'},
{id: 'sorting', label: 'Sorting'},
{id: 'loadingMore', label: 'Loading More'},
- {id: 'error', label: 'Error'},
+ {id: 'error', label: 'Error'}
];
let cardViewLayoutOptions = [
{id: 'grid', label: 'Grid'},
@@ -77,43 +77,36 @@ function App() {
];
return (
-
+
Spectrum 2 + Parcel
+ alignItems: 'center'
+ })}>
Primary
- Secondary
+
+ Secondary
+
Action Button
Toggle Button
-
+
Link Button
@@ -154,18 +147,18 @@ function App() {
Menu
- alert(key.toString())}>
+ alert(key.toString())}>
Cut
Copy
Paste
Replace
Share
- alert(key.toString())}>
+ alert(key.toString())}>
Copy Link
Email
- alert(key.toString())}>
+ alert(key.toString())}>
Email as Attachment
Email as Link
@@ -185,7 +178,7 @@ function App() {
Menu Trigger
-
+
Link to /foo
Cut
@@ -218,7 +211,9 @@ function App() {
console.log('edit', selectedKeys)}>Edit
console.log('copy', selectedKeys)}>Copy
- console.log('delete', selectedKeys)}>Delete
+ console.log('delete', selectedKeys)}>
+ Delete
+
)}>
@@ -292,10 +287,14 @@ function App() {
- {!isLazyLoaded &&
setLazyLoaded(true)}>Load more }
- {isLazyLoaded &&
Loading>}>
-
- }
+ {!isLazyLoaded && (
+
setLazyLoaded(true)}>Load more
+ )}
+ {isLazyLoaded && (
+
Loading>}>
+
+
+ )}
);
diff --git a/examples/s2-parcel-example/src/Lazy.js b/examples/s2-parcel-example/src/Lazy.js
index 68b3eb4bc7c..9a48bea9d3f 100644
--- a/examples/s2-parcel-example/src/Lazy.js
+++ b/examples/s2-parcel-example/src/Lazy.js
@@ -1,5 +1,5 @@
-import React, {useState} from "react";
-import "@react-spectrum/s2/page.css";
+import React, {useState} from 'react';
+import '@react-spectrum/s2/page.css';
import {
Accordion,
ActionButton,
@@ -77,18 +77,18 @@ import {
TextField,
TimeField,
Tooltip,
- TooltipTrigger,
-} from "@react-spectrum/s2";
+ TooltipTrigger
+} from '@react-spectrum/s2';
import Checkmark from '@react-spectrum/s2/illustrations/gradient/generic1/Checkmark';
-import Cloud from "@react-spectrum/s2/illustrations/linear/Cloud";
-import DropToUpload from "@react-spectrum/s2/illustrations/linear/DropToUpload";
-import Server from "@react-spectrum/s2/illustrations/linear/Server";
-import AlertNotice from "@react-spectrum/s2/illustrations/linear/AlertNotice";
-import PaperAirplane from "@react-spectrum/s2/illustrations/linear/Paperairplane";
-import StarFilled1 from "@react-spectrum/s2/illustrations/linear/Star";
-import Edit from "@react-spectrum/s2/icons/Edit";
-import Section from "./components/Section";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
+import Cloud from '@react-spectrum/s2/illustrations/linear/Cloud';
+import DropToUpload from '@react-spectrum/s2/illustrations/linear/DropToUpload';
+import Server from '@react-spectrum/s2/illustrations/linear/Server';
+import AlertNotice from '@react-spectrum/s2/illustrations/linear/AlertNotice';
+import PaperAirplane from '@react-spectrum/s2/illustrations/linear/Paperairplane';
+import StarFilled1 from '@react-spectrum/s2/illustrations/linear/Star';
+import Edit from '@react-spectrum/s2/icons/Edit';
+import Section from './components/Section';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
export default function Lazy() {
let [isDialogOpen, setIsDialogOpen] = useState(false);
@@ -131,9 +131,8 @@ export default function Lazy() {
+ maxWidth: 288
+ })}>
Soccer
Baseball
@@ -173,27 +172,23 @@ export default function Lazy() {
-
+
-
- Files
-
-
+ Files
+
+
+
-
- Files content
-
+ Files content
-
- People
-
+ People
-
+
@@ -203,11 +198,7 @@ export default function Lazy() {
Trendy
March 2020 Assets
-
+
The missing link.
Foo
@@ -223,9 +214,7 @@ export default function Lazy() {
Monarchy and Republic
Empire
-
- Arma virumque cano, Troiae qui primus ab oris.
-
+
Arma virumque cano, Troiae qui primus ab oris.
Senatus Populusque Romanus.
Alea jacta est.
@@ -234,13 +223,8 @@ export default function Lazy() {
Save
-
- You are running low on disk space. Delete unnecessary files to
- free up space.
+
+ You are running low on disk space. Delete unnecessary files to free up space.
@@ -248,22 +232,16 @@ export default function Lazy() {
Need help?
- If you are having issues accessing your account, contact our
- customer support team for help.
+ If you are having issues accessing your account, contact our customer support team for
+ help.
- setIsDialogOpen(true)}>
- Show Dialog
-
+ setIsDialogOpen(true)}>Show Dialog
setIsDialogOpen(false)}>
{isDialogOpen && (
-
+
Are you sure you want to delete this item?
)}
@@ -296,10 +274,23 @@ export default function Lazy() {
Illustration
-
+
-
Thank you!
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+
+ Thank you!
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua.
+
@@ -308,7 +299,9 @@ export default function Lazy() {
Disk Status
- C://
+
+ C://
+
50% disk space remaining.
@@ -319,20 +312,35 @@ export default function Lazy() {
Fullscreen
- {({close}) => <>
+ {({close}) => (
+ <>
Dialog title
- {[...Array(5)].map((_, i) => Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
)}
+ {[...Array(5)].map((_, i) => (
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
+ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+ Duis aute irure dolor in
+
+ ))}
- Cancel
- Save
+
+ Cancel
+
+
+ Save
+
- >}
+ >
+ )}
@@ -362,7 +370,7 @@ export default function Lazy() {
@@ -391,35 +399,20 @@ export default function Lazy() {
Payment Information
- Enter your billing address, shipping address, and payment method
- to complete your purchase.
+ Enter your billing address, shipping address, and payment method to complete your
+ purchase.
-
+
-
-
-
-
+
+
+
+
Content is king
diff --git a/examples/s2-parcel-example/src/components/CardViewExample.jsx b/examples/s2-parcel-example/src/components/CardViewExample.jsx
index a7844b223aa..23c771d017d 100644
--- a/examples/s2-parcel-example/src/components/CardViewExample.jsx
+++ b/examples/s2-parcel-example/src/components/CardViewExample.jsx
@@ -10,11 +10,24 @@
* governing permissions and limitations under the License.
*/
-import { ActionMenu, Avatar, Card, CardPreview, CardView, Collection, CollectionCardPreview, Content, Image, MenuItem, SkeletonCollection, Text } from '@react-spectrum/s2';
+import {
+ ActionMenu,
+ Avatar,
+ Card,
+ CardPreview,
+ CardView,
+ Collection,
+ CollectionCardPreview,
+ Content,
+ Image,
+ MenuItem,
+ SkeletonCollection,
+ Text
+} from '@react-spectrum/s2';
import Folder from '@react-spectrum/s2/icons/Folder';
import ErrorIcon from '@react-spectrum/s2/illustrations/linear/AlertNotice';
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { useAsyncList } from 'react-stately';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {useAsyncList} from 'react-stately';
const cardViewStyles = style({
width: 'full',
@@ -34,41 +47,58 @@ const avatarSize = {
function PhotoCard({item, layout}) {
return (
- {({size}) => (<>
-
- (
-
-
-
- )} />
-
-
- {item.description || item.alt_description}
- {size !== 'XS' &&
- Test
- }
-
-
- >)}
+ {({size}) => (
+ <>
+
+ (
+
+
+
+ )}
+ />
+
+
+ {item.description || item.alt_description}
+ {size !== 'XS' && (
+
+ Test
+
+ )}
+
+
+ >
+ )}
);
}
-export const CardViewExample = (props) => {
+export const CardViewExample = props => {
let list = useAsyncList({
async load({signal, cursor, items}) {
let page = cursor || 1;
@@ -79,7 +109,9 @@ export const CardViewExample = (props) => {
let nextItems = await res.json();
// Filter duplicates which might be returned by the API.
let existingKeys = new Set(items.map(i => i.id));
- nextItems = nextItems.filter(i => !existingKeys.has(i.id) && (i.description || i.alt_description));
+ nextItems = nextItems.filter(
+ i => !existingKeys.has(i.id) && (i.description || i.alt_description)
+ );
return {items: nextItems, cursor: nextItems.length ? page + 1 : null};
}
});
@@ -110,7 +142,8 @@ export const CardViewExample = (props) => {
width: 400,
height: 200 + Math.max(0, Math.round(Math.random() * 400))
}}
- layout={props.layout || 'grid'} />
+ layout={props.layout || 'grid'}
+ />
)}
)}
@@ -137,7 +170,7 @@ function TopicCard({topic}) {
);
}
-export const CollectionCardsExample = (props) => {
+export const CollectionCardsExample = props => {
let list = useAsyncList({
async load({signal, cursor}) {
let page = cursor || 1;
@@ -145,7 +178,7 @@ export const CollectionCardsExample = (props) => {
`https://api.unsplash.com/topics?page=${page}&per_page=30&client_id=AJuU-FPh11hn7RuumUllp4ppT8kgiLS7LtOHp_sp4nc`,
{signal}
);
- let items = (await res.json()).filter((topic) => !!topic.preview_photos);
+ let items = (await res.json()).filter(topic => !!topic.preview_photos);
return {items, cursor: items.length ? page + 1 : null};
}
});
@@ -160,9 +193,7 @@ export const CollectionCardsExample = (props) => {
loadingState={loadingState}
onLoadMore={props.loadingState === 'idle' ? list.loadMore : undefined}
styles={cardViewStyles}>
-
- {topic => }
-
+ {topic => }
{(loadingState === 'loading' || loadingState === 'loadingMore') && (
{() => (
@@ -178,10 +209,11 @@ export const CollectionCardsExample = (props) => {
{id: 'c', urls: {small: ''}},
{id: 'd', urls: {small: ''}}
]
- }} />
+ }}
+ />
)}
)}
);
-};
\ No newline at end of file
+};
diff --git a/examples/s2-parcel-example/src/components/CollectionCardsExample.jsx b/examples/s2-parcel-example/src/components/CollectionCardsExample.jsx
index 07bd17e3976..f8a6757d1d0 100644
--- a/examples/s2-parcel-example/src/components/CollectionCardsExample.jsx
+++ b/examples/s2-parcel-example/src/components/CollectionCardsExample.jsx
@@ -1,4 +1,3 @@
-
/*
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -11,10 +10,19 @@
* governing permissions and limitations under the License.
*/
-import { Card, CardView, Collection, CollectionCardPreview, Content, Image, SkeletonCollection, Text } from '@react-spectrum/s2';
+import {
+ Card,
+ CardView,
+ Collection,
+ CollectionCardPreview,
+ Content,
+ Image,
+ SkeletonCollection,
+ Text
+} from '@react-spectrum/s2';
import Folder from '@react-spectrum/s2/icons/Folder';
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { useAsyncList } from 'react-stately';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {useAsyncList} from 'react-stately';
const cardViewStyles = style({
width: 'full',
@@ -42,7 +50,7 @@ function TopicCard({topic}) {
);
}
-export const CollectionCardsExample = (props) => {
+export const CollectionCardsExample = props => {
let list = useAsyncList({
async load({signal, cursor}) {
let page = cursor || 1;
@@ -50,7 +58,7 @@ export const CollectionCardsExample = (props) => {
`https://api.unsplash.com/topics?page=${page}&per_page=30&client_id=AJuU-FPh11hn7RuumUllp4ppT8kgiLS7LtOHp_sp4nc`,
{signal}
);
- let items = (await res.json()).filter((topic) => !!topic.preview_photos);
+ let items = (await res.json()).filter(topic => !!topic.preview_photos);
return {items, cursor: items.length ? page + 1 : null};
}
});
@@ -65,9 +73,7 @@ export const CollectionCardsExample = (props) => {
loadingState={loadingState}
onLoadMore={props.loadingState === 'idle' ? list.loadMore : undefined}
styles={cardViewStyles}>
-
- {topic => }
-
+ {topic => }
{(loadingState === 'loading' || loadingState === 'loadingMore') && (
{() => (
@@ -83,10 +89,11 @@ export const CollectionCardsExample = (props) => {
{id: 'c', urls: {small: ''}},
{id: 'd', urls: {small: ''}}
]
- }} />
+ }}
+ />
)}
)}
);
-};
\ No newline at end of file
+};
diff --git a/examples/s2-parcel-example/src/components/Section.jsx b/examples/s2-parcel-example/src/components/Section.jsx
index 33b8a6213f3..18b91ad7f57 100644
--- a/examples/s2-parcel-example/src/components/Section.jsx
+++ b/examples/s2-parcel-example/src/components/Section.jsx
@@ -1,29 +1,27 @@
-import React from "react";
-import { Heading } from "@react-spectrum/s2";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
+import React from 'react';
+import {Heading} from '@react-spectrum/s2';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
export default function Section(props) {
- let { title, children } = props;
+ let {title, children} = props;
return (
-
+
+ level={2}>
{title}
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ gap: 16
+ })}>
{children}
diff --git a/examples/s2-parcel-example/src/index.html b/examples/s2-parcel-example/src/index.html
index aeff7d6897a..abc668d3237 100644
--- a/examples/s2-parcel-example/src/index.html
+++ b/examples/s2-parcel-example/src/index.html
@@ -1,12 +1,12 @@
-
-
-
-
Spectrum 2 + Parcel
-
-
-
-
-
+
+
+
+
Spectrum 2 + Parcel
+
+
+
+
+
diff --git a/examples/s2-parcel-example/src/index.js b/examples/s2-parcel-example/src/index.js
index 330202b3f73..dfed704bc7f 100644
--- a/examples/s2-parcel-example/src/index.js
+++ b/examples/s2-parcel-example/src/index.js
@@ -10,9 +10,9 @@
* governing permissions and limitations under the License.
*/
-import { createRoot } from "react-dom/client";
-import App from "./App";
+import {createRoot} from 'react-dom/client';
+import App from './App';
-const container = document.getElementById("app");
+const container = document.getElementById('app');
const root = createRoot(container);
root.render(
);
diff --git a/examples/s2-rollup-starter-app/package.json b/examples/s2-rollup-starter-app/package.json
index 292f6303c3c..72ca0db3741 100644
--- a/examples/s2-rollup-starter-app/package.json
+++ b/examples/s2-rollup-starter-app/package.json
@@ -1,5 +1,19 @@
{
"name": "rollup-starter-app",
+ "scripts": {
+ "build": "rollup -c",
+ "watch": "rollup -c -w",
+ "dev": "npm-run-all --parallel start watch",
+ "start": "serve public -p 5678"
+ },
+ "dependencies": {
+ "@react-spectrum/s2": "latest",
+ "@rollup/plugin-babel": "^6.0.4",
+ "@rollup/plugin-replace": "^5.0.5",
+ "date-fns": "^2.16.1",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0"
+ },
"devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.1.0",
@@ -10,19 +24,5 @@
"rollup-plugin-terser": "^7.0.2",
"serve": "^11.3.2",
"unplugin-parcel-macros": "^0.0.3"
- },
- "dependencies": {
- "@react-spectrum/s2": "latest",
- "@rollup/plugin-babel": "^6.0.4",
- "@rollup/plugin-replace": "^5.0.5",
- "date-fns": "^2.16.1",
- "react": "^18.2.0",
- "react-dom": "^18.2.0"
- },
- "scripts": {
- "build": "rollup -c",
- "watch": "rollup -c -w",
- "dev": "npm-run-all --parallel start watch",
- "start": "serve public -p 5678"
}
}
diff --git a/examples/s2-rollup-starter-app/rollup.config.js b/examples/s2-rollup-starter-app/rollup.config.js
index 9b05e987c02..577b5447dba 100644
--- a/examples/s2-rollup-starter-app/rollup.config.js
+++ b/examples/s2-rollup-starter-app/rollup.config.js
@@ -17,7 +17,7 @@ import babel from '@rollup/plugin-babel';
import replace from '@rollup/plugin-replace';
import css from 'rollup-plugin-import-css';
import macros from 'unplugin-parcel-macros';
-import reactSvg from "rollup-plugin-react-svg";
+import reactSvg from 'rollup-plugin-react-svg';
// `npm run build` -> `production` is true
// `npm run dev` -> `production` is false
diff --git a/examples/s2-rollup-starter-app/src/App.jsx b/examples/s2-rollup-starter-app/src/App.jsx
index 178de33f81e..994523e3d00 100644
--- a/examples/s2-rollup-starter-app/src/App.jsx
+++ b/examples/s2-rollup-starter-app/src/App.jsx
@@ -1,16 +1,15 @@
import React from 'react';
-import "@react-spectrum/s2/page.css";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { Button } from "@react-spectrum/s2";
+import '@react-spectrum/s2/page.css';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {Button} from '@react-spectrum/s2';
function App() {
return (
+ marginStart: 16
+ })}>
Hello Spectrum 2!
diff --git a/examples/s2-rollup-starter-app/src/main.js b/examples/s2-rollup-starter-app/src/main.js
index 54dfbd1d00c..55f573f8537 100644
--- a/examples/s2-rollup-starter-app/src/main.js
+++ b/examples/s2-rollup-starter-app/src/main.js
@@ -18,6 +18,4 @@ import App from './App';
// logs will still point to your original source modules
console.log('if you have sourcemaps enabled in your devtools, click on main.js:5 -->');
-ReactDOM.createRoot(document.querySelector('#root')).render(
-
-);
+ReactDOM.createRoot(document.querySelector('#root')).render(
);
diff --git a/examples/s2-vite-project/.eslintrc.cjs b/examples/s2-vite-project/.eslintrc.cjs
index d6c95379530..9cbc3794e4e 100644
--- a/examples/s2-vite-project/.eslintrc.cjs
+++ b/examples/s2-vite-project/.eslintrc.cjs
@@ -1,18 +1,15 @@
module.exports = {
root: true,
- env: { browser: true, es2020: true },
+ env: {browser: true, es2020: true},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
- 'plugin:react-hooks/recommended',
+ 'plugin:react-hooks/recommended'
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
- 'react-refresh/only-export-components': [
- 'warn',
- { allowConstantExport: true },
- ],
- },
-}
+ 'react-refresh/only-export-components': ['warn', {allowConstantExport: true}]
+ }
+};
diff --git a/examples/s2-vite-project/package.json b/examples/s2-vite-project/package.json
index c9b6eb2c259..0548b1b37cc 100644
--- a/examples/s2-vite-project/package.json
+++ b/examples/s2-vite-project/package.json
@@ -1,7 +1,7 @@
{
"name": "vite-project",
- "private": true,
"version": "0.0.0",
+ "private": true,
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/examples/s2-vite-project/src/App.tsx b/examples/s2-vite-project/src/App.tsx
index b4058c9937b..11ba072297b 100644
--- a/examples/s2-vite-project/src/App.tsx
+++ b/examples/s2-vite-project/src/App.tsx
@@ -10,8 +10,8 @@
* governing permissions and limitations under the License.
*/
-import React, { useState } from "react";
-import "@react-spectrum/s2/page.css";
+import React, {useState} from 'react';
+import '@react-spectrum/s2/page.css';
import {
ActionBar,
ActionButton,
@@ -42,14 +42,14 @@ import {
TreeView,
TreeViewItem,
TreeViewItemContent
-} from "@react-spectrum/s2";
-import Edit from "@react-spectrum/s2/icons/Edit";
-import FileTxt from "@react-spectrum/s2/icons/FileText";
-import Folder from "@react-spectrum/s2/icons/Folder";
-import Section from "./components/Section";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { CardViewExample } from "./components/CardViewExample";
-import { CollectionCardsExample } from "./components/CollectionCardsExample";
+} from '@react-spectrum/s2';
+import Edit from '@react-spectrum/s2/icons/Edit';
+import FileTxt from '@react-spectrum/s2/icons/FileText';
+import Folder from '@react-spectrum/s2/icons/Folder';
+import Section from './components/Section';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {CardViewExample} from './components/CardViewExample';
+import {CollectionCardsExample} from './components/CollectionCardsExample';
const Lazy = React.lazy(() => import('./Lazy'));
@@ -57,14 +57,14 @@ function App() {
let [isLazyLoaded, setLazyLoaded] = useState(false);
let [cardViewState, setCardViewState] = useState({
layout: 'grid',
- loadingState: 'idle',
+ loadingState: 'idle'
});
let cardViewLoadingOptions = [
{id: 'idle', label: 'Idle'},
{id: 'loading', label: 'Loading'},
{id: 'sorting', label: 'Sorting'},
{id: 'loadingMore', label: 'Loading More'},
- {id: 'error', label: 'Error'},
+ {id: 'error', label: 'Error'}
];
let cardViewLayoutOptions = [
{id: 'grid', label: 'Grid'},
@@ -72,43 +72,36 @@ function App() {
];
return (
-
+
Spectrum 2 + Vite
+ alignItems: 'center'
+ })}>
Primary
- Secondary
+
+ Secondary
+
Action Button
Toggle Button
-
+
Link Button
@@ -134,14 +127,18 @@ function App() {
label="CardView Loading State"
items={cardViewLoadingOptions}
selectedKey={cardViewState.loadingState}
- onSelectionChange={loadingState => setCardViewState({...cardViewState, loadingState: loadingState as string})}>
+ onSelectionChange={loadingState =>
+ setCardViewState({...cardViewState, loadingState: loadingState as string})
+ }>
{item => {item.label} }
setCardViewState({...cardViewState, layout: layout as string})}>
+ onSelectionChange={layout =>
+ setCardViewState({...cardViewState, layout: layout as string})
+ }>
{item => {item.label} }
@@ -149,18 +146,18 @@ function App() {
Menu
- alert(key.toString())}>
+ alert(key.toString())}>
Cut
Copy
Paste
Replace
Share
- alert(key.toString())}>
+ alert(key.toString())}>
Copy Link
Email
- alert(key.toString())}>
+ alert(key.toString())}>
Email as Attachment
Email as Link
@@ -174,9 +171,7 @@ function App() {
Menu Trigger
-
- Link to /foo
-
+ Link to /foo
Cut
Copy
Paste
@@ -190,7 +185,9 @@ function App() {
console.log('edit', selectedKeys)}>Edit
console.log('copy', selectedKeys)}>Copy
- console.log('delete', selectedKeys)}>Delete
+ console.log('delete', selectedKeys)}>
+ Delete
+
)}>
@@ -264,10 +261,14 @@ function App() {
- {!isLazyLoaded &&
setLazyLoaded(true)}>Load more }
- {isLazyLoaded &&
Loading>}>
-
- }
+ {!isLazyLoaded && (
+
setLazyLoaded(true)}>Load more
+ )}
+ {isLazyLoaded && (
+
Loading>}>
+
+
+ )}
);
diff --git a/examples/s2-vite-project/src/Lazy.tsx b/examples/s2-vite-project/src/Lazy.tsx
index 8f500a7111e..c89fb630588 100644
--- a/examples/s2-vite-project/src/Lazy.tsx
+++ b/examples/s2-vite-project/src/Lazy.tsx
@@ -1,5 +1,5 @@
-import {useState} from "react";
-import "@react-spectrum/s2/page.css";
+import {useState} from 'react';
+import '@react-spectrum/s2/page.css';
import {
Accordion,
ActionButton,
@@ -77,18 +77,18 @@ import {
TextField,
TimeField,
Tooltip,
- TooltipTrigger,
-} from "@react-spectrum/s2";
+ TooltipTrigger
+} from '@react-spectrum/s2';
import Checkmark from '@react-spectrum/s2/illustrations/gradient/generic1/Checkmark';
-import Cloud from "@react-spectrum/s2/illustrations/linear/Cloud";
-import DropToUpload from "@react-spectrum/s2/illustrations/linear/DropToUpload";
-import Server from "@react-spectrum/s2/illustrations/linear/Server";
-import AlertNotice from "@react-spectrum/s2/illustrations/linear/AlertNotice";
-import PaperAirplane from "@react-spectrum/s2/illustrations/linear/Paperairplane";
-import StarFilled1 from "@react-spectrum/s2/illustrations/linear/Star";
-import Edit from "@react-spectrum/s2/icons/Edit";
-import Section from "./components/Section";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
+import Cloud from '@react-spectrum/s2/illustrations/linear/Cloud';
+import DropToUpload from '@react-spectrum/s2/illustrations/linear/DropToUpload';
+import Server from '@react-spectrum/s2/illustrations/linear/Server';
+import AlertNotice from '@react-spectrum/s2/illustrations/linear/AlertNotice';
+import PaperAirplane from '@react-spectrum/s2/illustrations/linear/Paperairplane';
+import StarFilled1 from '@react-spectrum/s2/illustrations/linear/Star';
+import Edit from '@react-spectrum/s2/icons/Edit';
+import Section from './components/Section';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
export default function Lazy() {
let [isDialogOpen, setIsDialogOpen] = useState(false);
@@ -131,9 +131,8 @@ export default function Lazy() {
+ maxWidth: 288
+ })}>
Soccer
Baseball
@@ -173,27 +172,23 @@ export default function Lazy() {
-
+
-
- Files
-
-
+ Files
+
+
+
-
- Files content
-
+ Files content
-
- People
-
+ People
-
+
@@ -203,11 +198,7 @@ export default function Lazy() {
Trendy
March 2020 Assets
-
+
The missing link.
Foo
@@ -223,9 +214,7 @@ export default function Lazy() {
Monarchy and Republic
Empire
-
- Arma virumque cano, Troiae qui primus ab oris.
-
+
Arma virumque cano, Troiae qui primus ab oris.
Senatus Populusque Romanus.
Alea jacta est.
@@ -234,13 +223,8 @@ export default function Lazy() {
Save
-
- You are running low on disk space. Delete unnecessary files to
- free up space.
+
+ You are running low on disk space. Delete unnecessary files to free up space.
@@ -248,22 +232,16 @@ export default function Lazy() {
Need help?
- If you are having issues accessing your account, contact our
- customer support team for help.
+ If you are having issues accessing your account, contact our customer support team for
+ help.
- setIsDialogOpen(true)}>
- Show Dialog
-
+ setIsDialogOpen(true)}>Show Dialog
setIsDialogOpen(false)}>
{isDialogOpen && (
-
+
Are you sure you want to delete this item?
)}
@@ -296,10 +274,23 @@ export default function Lazy() {
Illustration
-
+
-
Thank you!
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+
+ Thank you!
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua.
+
@@ -308,7 +299,9 @@ export default function Lazy() {
Disk Status
- C://
+
+ C://
+
50% disk space remaining.
@@ -319,20 +312,35 @@ export default function Lazy() {
Fullscreen
- {({close}) => <>
+ {({close}) => (
+ <>
Dialog title
- {[...Array(5)].map((_, i) => Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
)}
+ {[...Array(5)].map((_, i) => (
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
+ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+ Duis aute irure dolor in
+
+ ))}
- Cancel
- Save
+
+ Cancel
+
+
+ Save
+
- >}
+ >
+ )}
@@ -362,7 +370,7 @@ export default function Lazy() {
@@ -391,35 +399,20 @@ export default function Lazy() {
Payment Information
- Enter your billing address, shipping address, and payment method
- to complete your purchase.
+ Enter your billing address, shipping address, and payment method to complete your
+ purchase.
-
+
-
-
-
-
+
+
+
+
Content is king
diff --git a/examples/s2-vite-project/src/components/CardViewExample.jsx b/examples/s2-vite-project/src/components/CardViewExample.jsx
index a7844b223aa..23c771d017d 100644
--- a/examples/s2-vite-project/src/components/CardViewExample.jsx
+++ b/examples/s2-vite-project/src/components/CardViewExample.jsx
@@ -10,11 +10,24 @@
* governing permissions and limitations under the License.
*/
-import { ActionMenu, Avatar, Card, CardPreview, CardView, Collection, CollectionCardPreview, Content, Image, MenuItem, SkeletonCollection, Text } from '@react-spectrum/s2';
+import {
+ ActionMenu,
+ Avatar,
+ Card,
+ CardPreview,
+ CardView,
+ Collection,
+ CollectionCardPreview,
+ Content,
+ Image,
+ MenuItem,
+ SkeletonCollection,
+ Text
+} from '@react-spectrum/s2';
import Folder from '@react-spectrum/s2/icons/Folder';
import ErrorIcon from '@react-spectrum/s2/illustrations/linear/AlertNotice';
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { useAsyncList } from 'react-stately';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {useAsyncList} from 'react-stately';
const cardViewStyles = style({
width: 'full',
@@ -34,41 +47,58 @@ const avatarSize = {
function PhotoCard({item, layout}) {
return (
- {({size}) => (<>
-
- (
-
-
-
- )} />
-
-
- {item.description || item.alt_description}
- {size !== 'XS' &&
- Test
- }
-
-
- >)}
+ {({size}) => (
+ <>
+
+ (
+
+
+
+ )}
+ />
+
+
+ {item.description || item.alt_description}
+ {size !== 'XS' && (
+
+ Test
+
+ )}
+
+
+ >
+ )}
);
}
-export const CardViewExample = (props) => {
+export const CardViewExample = props => {
let list = useAsyncList({
async load({signal, cursor, items}) {
let page = cursor || 1;
@@ -79,7 +109,9 @@ export const CardViewExample = (props) => {
let nextItems = await res.json();
// Filter duplicates which might be returned by the API.
let existingKeys = new Set(items.map(i => i.id));
- nextItems = nextItems.filter(i => !existingKeys.has(i.id) && (i.description || i.alt_description));
+ nextItems = nextItems.filter(
+ i => !existingKeys.has(i.id) && (i.description || i.alt_description)
+ );
return {items: nextItems, cursor: nextItems.length ? page + 1 : null};
}
});
@@ -110,7 +142,8 @@ export const CardViewExample = (props) => {
width: 400,
height: 200 + Math.max(0, Math.round(Math.random() * 400))
}}
- layout={props.layout || 'grid'} />
+ layout={props.layout || 'grid'}
+ />
)}
)}
@@ -137,7 +170,7 @@ function TopicCard({topic}) {
);
}
-export const CollectionCardsExample = (props) => {
+export const CollectionCardsExample = props => {
let list = useAsyncList({
async load({signal, cursor}) {
let page = cursor || 1;
@@ -145,7 +178,7 @@ export const CollectionCardsExample = (props) => {
`https://api.unsplash.com/topics?page=${page}&per_page=30&client_id=AJuU-FPh11hn7RuumUllp4ppT8kgiLS7LtOHp_sp4nc`,
{signal}
);
- let items = (await res.json()).filter((topic) => !!topic.preview_photos);
+ let items = (await res.json()).filter(topic => !!topic.preview_photos);
return {items, cursor: items.length ? page + 1 : null};
}
});
@@ -160,9 +193,7 @@ export const CollectionCardsExample = (props) => {
loadingState={loadingState}
onLoadMore={props.loadingState === 'idle' ? list.loadMore : undefined}
styles={cardViewStyles}>
-
- {topic => }
-
+ {topic => }
{(loadingState === 'loading' || loadingState === 'loadingMore') && (
{() => (
@@ -178,10 +209,11 @@ export const CollectionCardsExample = (props) => {
{id: 'c', urls: {small: ''}},
{id: 'd', urls: {small: ''}}
]
- }} />
+ }}
+ />
)}
)}
);
-};
\ No newline at end of file
+};
diff --git a/examples/s2-vite-project/src/components/CollectionCardsExample.jsx b/examples/s2-vite-project/src/components/CollectionCardsExample.jsx
index 07bd17e3976..f8a6757d1d0 100644
--- a/examples/s2-vite-project/src/components/CollectionCardsExample.jsx
+++ b/examples/s2-vite-project/src/components/CollectionCardsExample.jsx
@@ -1,4 +1,3 @@
-
/*
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -11,10 +10,19 @@
* governing permissions and limitations under the License.
*/
-import { Card, CardView, Collection, CollectionCardPreview, Content, Image, SkeletonCollection, Text } from '@react-spectrum/s2';
+import {
+ Card,
+ CardView,
+ Collection,
+ CollectionCardPreview,
+ Content,
+ Image,
+ SkeletonCollection,
+ Text
+} from '@react-spectrum/s2';
import Folder from '@react-spectrum/s2/icons/Folder';
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { useAsyncList } from 'react-stately';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {useAsyncList} from 'react-stately';
const cardViewStyles = style({
width: 'full',
@@ -42,7 +50,7 @@ function TopicCard({topic}) {
);
}
-export const CollectionCardsExample = (props) => {
+export const CollectionCardsExample = props => {
let list = useAsyncList({
async load({signal, cursor}) {
let page = cursor || 1;
@@ -50,7 +58,7 @@ export const CollectionCardsExample = (props) => {
`https://api.unsplash.com/topics?page=${page}&per_page=30&client_id=AJuU-FPh11hn7RuumUllp4ppT8kgiLS7LtOHp_sp4nc`,
{signal}
);
- let items = (await res.json()).filter((topic) => !!topic.preview_photos);
+ let items = (await res.json()).filter(topic => !!topic.preview_photos);
return {items, cursor: items.length ? page + 1 : null};
}
});
@@ -65,9 +73,7 @@ export const CollectionCardsExample = (props) => {
loadingState={loadingState}
onLoadMore={props.loadingState === 'idle' ? list.loadMore : undefined}
styles={cardViewStyles}>
-
- {topic => }
-
+ {topic => }
{(loadingState === 'loading' || loadingState === 'loadingMore') && (
{() => (
@@ -83,10 +89,11 @@ export const CollectionCardsExample = (props) => {
{id: 'c', urls: {small: ''}},
{id: 'd', urls: {small: ''}}
]
- }} />
+ }}
+ />
)}
)}
);
-};
\ No newline at end of file
+};
diff --git a/examples/s2-vite-project/src/components/Section.jsx b/examples/s2-vite-project/src/components/Section.jsx
index 33b8a6213f3..18b91ad7f57 100644
--- a/examples/s2-vite-project/src/components/Section.jsx
+++ b/examples/s2-vite-project/src/components/Section.jsx
@@ -1,29 +1,27 @@
-import React from "react";
-import { Heading } from "@react-spectrum/s2";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
+import React from 'react';
+import {Heading} from '@react-spectrum/s2';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
export default function Section(props) {
- let { title, children } = props;
+ let {title, children} = props;
return (
-
+
+ level={2}>
{title}
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ gap: 16
+ })}>
{children}
diff --git a/examples/s2-vite-project/src/main.tsx b/examples/s2-vite-project/src/main.tsx
index 9e250b2f573..4f3cb420349 100644
--- a/examples/s2-vite-project/src/main.tsx
+++ b/examples/s2-vite-project/src/main.tsx
@@ -10,12 +10,12 @@
* governing permissions and limitations under the License.
*/
-import React from 'react'
-import ReactDOM from 'react-dom/client'
-import App from './App.tsx'
+import React from 'react';
+import ReactDOM from 'react-dom/client';
+import App from './App.tsx';
ReactDOM.createRoot(document.getElementById('root')!).render(
- ,
-)
+
+);
diff --git a/examples/s2-vite-project/src/vite-env.d.ts b/examples/s2-vite-project/src/vite-env.d.ts
index f18f194a22e..3a23dbccb53 100644
--- a/examples/s2-vite-project/src/vite-env.d.ts
+++ b/examples/s2-vite-project/src/vite-env.d.ts
@@ -14,9 +14,9 @@
declare module '*.svg' {
import * as React from 'react';
- export const ReactComponent: React.FunctionComponent
& { title?: string }>;
+ export const ReactComponent: React.FunctionComponent<
+ React.SVGProps & {title?: string}
+ >;
const src: string;
export default src;
diff --git a/examples/s2-vite-project/tsconfig.json b/examples/s2-vite-project/tsconfig.json
index 1ae247aeb47..43d1532840d 100644
--- a/examples/s2-vite-project/tsconfig.json
+++ b/examples/s2-vite-project/tsconfig.json
@@ -22,5 +22,5 @@
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
- "references": [{ "path": "./tsconfig.node.json" }]
+ "references": [{"path": "./tsconfig.node.json"}]
}
diff --git a/examples/s2-vite-project/vite.config.ts b/examples/s2-vite-project/vite.config.ts
index efe5f0287be..eebf278753c 100644
--- a/examples/s2-vite-project/vite.config.ts
+++ b/examples/s2-vite-project/vite.config.ts
@@ -10,16 +10,13 @@
* governing permissions and limitations under the License.
*/
-import { defineConfig } from 'vite'
-import react from '@vitejs/plugin-react'
+import {defineConfig} from 'vite';
+import react from '@vitejs/plugin-react';
import macros from 'unplugin-parcel-macros';
// https://vitejs.dev/config/
export default defineConfig({
- plugins: [
- macros.vite(),
- react()
- ],
+ plugins: [macros.vite(), react()],
build: {
target: ['es2022'],
// Lightning CSS produces much a smaller CSS bundle than the default minifier.
@@ -37,4 +34,4 @@ export default defineConfig({
}
}
}
-})
+});
diff --git a/examples/s2-webpack-5-example/package.json b/examples/s2-webpack-5-example/package.json
index d8c0a02168c..3b0e19655be 100644
--- a/examples/s2-webpack-5-example/package.json
+++ b/examples/s2-webpack-5-example/package.json
@@ -3,7 +3,6 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
- "packageManager": "yarn@4.2.2",
"scripts": {
"dev": "webpack serve",
"build": "webpack --mode production"
@@ -26,5 +25,6 @@
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
- }
+ },
+ "packageManager": "yarn@4.2.2"
}
diff --git a/examples/s2-webpack-5-example/src/App.js b/examples/s2-webpack-5-example/src/App.js
index 63d4e7ff9c2..52f2fb8496e 100644
--- a/examples/s2-webpack-5-example/src/App.js
+++ b/examples/s2-webpack-5-example/src/App.js
@@ -10,8 +10,8 @@
* governing permissions and limitations under the License.
*/
-import React, { useState } from "react";
-import "@react-spectrum/s2/page.css";
+import React, {useState} from 'react';
+import '@react-spectrum/s2/page.css';
import {
ActionBar,
ActionButton,
@@ -47,14 +47,14 @@ import {
TreeViewItem,
TreeViewItemContent,
UnavailableMenuItemTrigger
-} from "@react-spectrum/s2";
-import Edit from "@react-spectrum/s2/icons/Edit";
-import FileTxt from "@react-spectrum/s2/icons/FileText";
-import Folder from "@react-spectrum/s2/icons/Folder";
-import Section from "./components/Section";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { CardViewExample } from "./components/CardViewExample";
-import { CollectionCardsExample } from "./components/CollectionCardsExample";
+} from '@react-spectrum/s2';
+import Edit from '@react-spectrum/s2/icons/Edit';
+import FileTxt from '@react-spectrum/s2/icons/FileText';
+import Folder from '@react-spectrum/s2/icons/Folder';
+import Section from './components/Section';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {CardViewExample} from './components/CardViewExample';
+import {CollectionCardsExample} from './components/CollectionCardsExample';
const Lazy = React.lazy(() => import('./Lazy'));
@@ -62,14 +62,14 @@ function App() {
let [isLazyLoaded, setLazyLoaded] = useState(false);
let [cardViewState, setCardViewState] = useState({
layout: 'grid',
- loadingState: 'idle',
+ loadingState: 'idle'
});
let cardViewLoadingOptions = [
{id: 'idle', label: 'Idle'},
{id: 'loading', label: 'Loading'},
{id: 'sorting', label: 'Sorting'},
{id: 'loadingMore', label: 'Loading More'},
- {id: 'error', label: 'Error'},
+ {id: 'error', label: 'Error'}
];
let cardViewLayoutOptions = [
{id: 'grid', label: 'Grid'},
@@ -77,43 +77,36 @@ function App() {
];
return (
-
+
Spectrum 2 + Webpack
+ alignItems: 'center'
+ })}>
Primary
- Secondary
+
+ Secondary
+
Action Button
Toggle Button
-
+
Link Button
@@ -154,18 +147,18 @@ function App() {
Menu
- alert(key.toString())}>
+ alert(key.toString())}>
Cut
Copy
Paste
Replace
Share
- alert(key.toString())}>
+ alert(key.toString())}>
Copy Link
Email
- alert(key.toString())}>
+ alert(key.toString())}>
Email as Attachment
Email as Link
@@ -185,7 +178,7 @@ function App() {
Menu Trigger
-
+
Link to /foo
Cut
@@ -218,7 +211,9 @@ function App() {
console.log('edit', selectedKeys)}>Edit
console.log('copy', selectedKeys)}>Copy
- console.log('delete', selectedKeys)}>Delete
+ console.log('delete', selectedKeys)}>
+ Delete
+
)}>
@@ -292,10 +287,14 @@ function App() {
- {!isLazyLoaded &&
setLazyLoaded(true)}>Load more }
- {isLazyLoaded &&
Loading>}>
-
- }
+ {!isLazyLoaded && (
+
setLazyLoaded(true)}>Load more
+ )}
+ {isLazyLoaded && (
+
Loading>}>
+
+
+ )}
);
diff --git a/examples/s2-webpack-5-example/src/Lazy.js b/examples/s2-webpack-5-example/src/Lazy.js
index 68b3eb4bc7c..9a48bea9d3f 100644
--- a/examples/s2-webpack-5-example/src/Lazy.js
+++ b/examples/s2-webpack-5-example/src/Lazy.js
@@ -1,5 +1,5 @@
-import React, {useState} from "react";
-import "@react-spectrum/s2/page.css";
+import React, {useState} from 'react';
+import '@react-spectrum/s2/page.css';
import {
Accordion,
ActionButton,
@@ -77,18 +77,18 @@ import {
TextField,
TimeField,
Tooltip,
- TooltipTrigger,
-} from "@react-spectrum/s2";
+ TooltipTrigger
+} from '@react-spectrum/s2';
import Checkmark from '@react-spectrum/s2/illustrations/gradient/generic1/Checkmark';
-import Cloud from "@react-spectrum/s2/illustrations/linear/Cloud";
-import DropToUpload from "@react-spectrum/s2/illustrations/linear/DropToUpload";
-import Server from "@react-spectrum/s2/illustrations/linear/Server";
-import AlertNotice from "@react-spectrum/s2/illustrations/linear/AlertNotice";
-import PaperAirplane from "@react-spectrum/s2/illustrations/linear/Paperairplane";
-import StarFilled1 from "@react-spectrum/s2/illustrations/linear/Star";
-import Edit from "@react-spectrum/s2/icons/Edit";
-import Section from "./components/Section";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
+import Cloud from '@react-spectrum/s2/illustrations/linear/Cloud';
+import DropToUpload from '@react-spectrum/s2/illustrations/linear/DropToUpload';
+import Server from '@react-spectrum/s2/illustrations/linear/Server';
+import AlertNotice from '@react-spectrum/s2/illustrations/linear/AlertNotice';
+import PaperAirplane from '@react-spectrum/s2/illustrations/linear/Paperairplane';
+import StarFilled1 from '@react-spectrum/s2/illustrations/linear/Star';
+import Edit from '@react-spectrum/s2/icons/Edit';
+import Section from './components/Section';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
export default function Lazy() {
let [isDialogOpen, setIsDialogOpen] = useState(false);
@@ -131,9 +131,8 @@ export default function Lazy() {
+ maxWidth: 288
+ })}>
Soccer
Baseball
@@ -173,27 +172,23 @@ export default function Lazy() {
-
+
-
- Files
-
-
+ Files
+
+
+
-
- Files content
-
+ Files content
-
- People
-
+ People
-
+
@@ -203,11 +198,7 @@ export default function Lazy() {
Trendy
March 2020 Assets
-
+
The missing link.
Foo
@@ -223,9 +214,7 @@ export default function Lazy() {
Monarchy and Republic
Empire
-
- Arma virumque cano, Troiae qui primus ab oris.
-
+
Arma virumque cano, Troiae qui primus ab oris.
Senatus Populusque Romanus.
Alea jacta est.
@@ -234,13 +223,8 @@ export default function Lazy() {
Save
-
- You are running low on disk space. Delete unnecessary files to
- free up space.
+
+ You are running low on disk space. Delete unnecessary files to free up space.
@@ -248,22 +232,16 @@ export default function Lazy() {
Need help?
- If you are having issues accessing your account, contact our
- customer support team for help.
+ If you are having issues accessing your account, contact our customer support team for
+ help.
- setIsDialogOpen(true)}>
- Show Dialog
-
+ setIsDialogOpen(true)}>Show Dialog
setIsDialogOpen(false)}>
{isDialogOpen && (
-
+
Are you sure you want to delete this item?
)}
@@ -296,10 +274,23 @@ export default function Lazy() {
Illustration
-
+
-
Thank you!
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+
+ Thank you!
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua.
+
@@ -308,7 +299,9 @@ export default function Lazy() {
Disk Status
- C://
+
+ C://
+
50% disk space remaining.
@@ -319,20 +312,35 @@ export default function Lazy() {
Fullscreen
- {({close}) => <>
+ {({close}) => (
+ <>
Dialog title
- {[...Array(5)].map((_, i) => Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
)}
+ {[...Array(5)].map((_, i) => (
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
+ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+ Duis aute irure dolor in
+
+ ))}
- Cancel
- Save
+
+ Cancel
+
+
+ Save
+
- >}
+ >
+ )}
@@ -362,7 +370,7 @@ export default function Lazy() {
@@ -391,35 +399,20 @@ export default function Lazy() {
Payment Information
- Enter your billing address, shipping address, and payment method
- to complete your purchase.
+ Enter your billing address, shipping address, and payment method to complete your
+ purchase.
-
+
-
-
-
-
+
+
+
+
Content is king
diff --git a/examples/s2-webpack-5-example/src/components/CardViewExample.js b/examples/s2-webpack-5-example/src/components/CardViewExample.js
index b5f5fa6c130..0394384841f 100644
--- a/examples/s2-webpack-5-example/src/components/CardViewExample.js
+++ b/examples/s2-webpack-5-example/src/components/CardViewExample.js
@@ -10,12 +10,25 @@
* governing permissions and limitations under the License.
*/
-import React from "react";
-import { ActionMenu, Avatar, Card, CardPreview, CardView, Collection, CollectionCardPreview, Content, Image, MenuItem, SkeletonCollection, Text } from '@react-spectrum/s2';
+import React from 'react';
+import {
+ ActionMenu,
+ Avatar,
+ Card,
+ CardPreview,
+ CardView,
+ Collection,
+ CollectionCardPreview,
+ Content,
+ Image,
+ MenuItem,
+ SkeletonCollection,
+ Text
+} from '@react-spectrum/s2';
import Folder from '@react-spectrum/s2/icons/Folder';
import ErrorIcon from '@react-spectrum/s2/illustrations/linear/AlertNotice';
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { useAsyncList } from 'react-stately';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {useAsyncList} from 'react-stately';
const cardViewStyles = style({
width: 'full',
@@ -35,41 +48,58 @@ const avatarSize = {
function PhotoCard({item, layout}) {
return (
- {({size}) => (<>
-
- (
-
-
-
- )} />
-
-
- {item.description || item.alt_description}
- {size !== 'XS' &&
- Test
- }
-
-
- >)}
+ {({size}) => (
+ <>
+
+ (
+
+
+
+ )}
+ />
+
+
+ {item.description || item.alt_description}
+ {size !== 'XS' && (
+
+ Test
+
+ )}
+
+
+ >
+ )}
);
}
-export const CardViewExample = (props) => {
+export const CardViewExample = props => {
let list = useAsyncList({
async load({signal, cursor, items}) {
let page = cursor || 1;
@@ -80,7 +110,9 @@ export const CardViewExample = (props) => {
let nextItems = await res.json();
// Filter duplicates which might be returned by the API.
let existingKeys = new Set(items.map(i => i.id));
- nextItems = nextItems.filter(i => !existingKeys.has(i.id) && (i.description || i.alt_description));
+ nextItems = nextItems.filter(
+ i => !existingKeys.has(i.id) && (i.description || i.alt_description)
+ );
return {items: nextItems, cursor: nextItems.length ? page + 1 : null};
}
});
@@ -111,7 +143,8 @@ export const CardViewExample = (props) => {
width: 400,
height: 200 + Math.max(0, Math.round(Math.random() * 400))
}}
- layout={props.layout || 'grid'} />
+ layout={props.layout || 'grid'}
+ />
)}
)}
@@ -138,7 +171,7 @@ function TopicCard({topic}) {
);
}
-export const CollectionCardsExample = (props) => {
+export const CollectionCardsExample = props => {
let list = useAsyncList({
async load({signal, cursor}) {
let page = cursor || 1;
@@ -146,7 +179,7 @@ export const CollectionCardsExample = (props) => {
`https://api.unsplash.com/topics?page=${page}&per_page=30&client_id=AJuU-FPh11hn7RuumUllp4ppT8kgiLS7LtOHp_sp4nc`,
{signal}
);
- let items = (await res.json()).filter((topic) => !!topic.preview_photos);
+ let items = (await res.json()).filter(topic => !!topic.preview_photos);
return {items, cursor: items.length ? page + 1 : null};
}
});
@@ -161,9 +194,7 @@ export const CollectionCardsExample = (props) => {
loadingState={loadingState}
onLoadMore={props.loadingState === 'idle' ? list.loadMore : undefined}
styles={cardViewStyles}>
-
- {topic => }
-
+ {topic => }
{(loadingState === 'loading' || loadingState === 'loadingMore') && (
{() => (
@@ -179,10 +210,11 @@ export const CollectionCardsExample = (props) => {
{id: 'c', urls: {small: ''}},
{id: 'd', urls: {small: ''}}
]
- }} />
+ }}
+ />
)}
)}
);
-};
\ No newline at end of file
+};
diff --git a/examples/s2-webpack-5-example/src/components/CollectionCardsExample.js b/examples/s2-webpack-5-example/src/components/CollectionCardsExample.js
index de26f38b1f3..b7a5f9b56b3 100644
--- a/examples/s2-webpack-5-example/src/components/CollectionCardsExample.js
+++ b/examples/s2-webpack-5-example/src/components/CollectionCardsExample.js
@@ -1,4 +1,3 @@
-
/*
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -11,11 +10,20 @@
* governing permissions and limitations under the License.
*/
-import React from "react";
-import { Card, CardView, Collection, CollectionCardPreview, Content, Image, SkeletonCollection, Text } from '@react-spectrum/s2';
+import React from 'react';
+import {
+ Card,
+ CardView,
+ Collection,
+ CollectionCardPreview,
+ Content,
+ Image,
+ SkeletonCollection,
+ Text
+} from '@react-spectrum/s2';
import Folder from '@react-spectrum/s2/icons/Folder';
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
-import { useAsyncList } from 'react-stately';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
+import {useAsyncList} from 'react-stately';
const cardViewStyles = style({
width: 'full',
@@ -43,7 +51,7 @@ function TopicCard({topic}) {
);
}
-export const CollectionCardsExample = (props) => {
+export const CollectionCardsExample = props => {
let list = useAsyncList({
async load({signal, cursor}) {
let page = cursor || 1;
@@ -51,7 +59,7 @@ export const CollectionCardsExample = (props) => {
`https://api.unsplash.com/topics?page=${page}&per_page=30&client_id=AJuU-FPh11hn7RuumUllp4ppT8kgiLS7LtOHp_sp4nc`,
{signal}
);
- let items = (await res.json()).filter((topic) => !!topic.preview_photos);
+ let items = (await res.json()).filter(topic => !!topic.preview_photos);
return {items, cursor: items.length ? page + 1 : null};
}
});
@@ -66,9 +74,7 @@ export const CollectionCardsExample = (props) => {
loadingState={loadingState}
onLoadMore={props.loadingState === 'idle' ? list.loadMore : undefined}
styles={cardViewStyles}>
-
- {topic => }
-
+ {topic => }
{(loadingState === 'loading' || loadingState === 'loadingMore') && (
{() => (
@@ -84,10 +90,11 @@ export const CollectionCardsExample = (props) => {
{id: 'c', urls: {small: ''}},
{id: 'd', urls: {small: ''}}
]
- }} />
+ }}
+ />
)}
)}
);
-};
\ No newline at end of file
+};
diff --git a/examples/s2-webpack-5-example/src/components/Section.js b/examples/s2-webpack-5-example/src/components/Section.js
index 33b8a6213f3..18b91ad7f57 100644
--- a/examples/s2-webpack-5-example/src/components/Section.js
+++ b/examples/s2-webpack-5-example/src/components/Section.js
@@ -1,29 +1,27 @@
-import React from "react";
-import { Heading } from "@react-spectrum/s2";
-import { style } from "@react-spectrum/s2/style" with { type: "macro" };
+import React from 'react';
+import {Heading} from '@react-spectrum/s2';
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
export default function Section(props) {
- let { title, children } = props;
+ let {title, children} = props;
return (
-
+
+ level={2}>
{title}
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ gap: 16
+ })}>
{children}
diff --git a/examples/s2-webpack-5-example/src/index.html b/examples/s2-webpack-5-example/src/index.html
index d1078b284bc..488376f1eeb 100644
--- a/examples/s2-webpack-5-example/src/index.html
+++ b/examples/s2-webpack-5-example/src/index.html
@@ -1,4 +1,4 @@
-
+
diff --git a/examples/s2-webpack-5-example/src/index.js b/examples/s2-webpack-5-example/src/index.js
index 855950f2d16..011bfb56340 100644
--- a/examples/s2-webpack-5-example/src/index.js
+++ b/examples/s2-webpack-5-example/src/index.js
@@ -11,8 +11,8 @@
*/
import React from 'react';
-import { createRoot } from "react-dom/client";
-import App from "./App";
+import {createRoot} from 'react-dom/client';
+import App from './App';
const root = document.getElementById('root');
createRoot(root).render(
);
diff --git a/examples/s2-webpack-5-example/webpack.config.js b/examples/s2-webpack-5-example/webpack.config.js
index 5186ffbde90..aff784a0464 100644
--- a/examples/s2-webpack-5-example/webpack.config.js
+++ b/examples/s2-webpack-5-example/webpack.config.js
@@ -10,25 +10,25 @@
* governing permissions and limitations under the License.
*/
-const path = require("path");
-const HtmlWebpackPlugin = require("html-webpack-plugin");
-const MiniCssExtractPlugin = require("mini-css-extract-plugin");
-const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
-const {SwcMinifyWebpackPlugin} = require("swc-minify-webpack-plugin");
+const path = require('path');
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const MiniCssExtractPlugin = require('mini-css-extract-plugin');
+const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
+const {SwcMinifyWebpackPlugin} = require('swc-minify-webpack-plugin');
const {browserslistToTargets} = require('lightningcss');
const browserslist = require('browserslist');
-const macros = require("unplugin-parcel-macros");
+const macros = require('unplugin-parcel-macros');
// Adjust this to target the browsers your product supports.
// https://browserslist.dev/
const BROWSERSLIST = 'last 2 Chrome versions, last 2 Safari versions, last 2 Firefox versions';
module.exports = (env, argv) => ({
- entry: path.join(__dirname, "src", "index.js"),
+ entry: path.join(__dirname, 'src', 'index.js'),
output: {
- path: path.resolve(__dirname, "dist"),
+ path: path.resolve(__dirname, 'dist')
},
- mode: argv.mode || "development",
+ mode: argv.mode || 'development',
module: {
rules: [
{
@@ -36,7 +36,7 @@ module.exports = (env, argv) => ({
test: /\.?js$/,
exclude: /node_modules/,
use: {
- loader: "swc-loader",
+ loader: 'swc-loader',
options: {
env: {
targets: BROWSERSLIST
@@ -46,30 +46,30 @@ module.exports = (env, argv) => ({
jsx: true
}
}
- },
- },
+ }
+ }
},
{
// Use mini-css-extract-plugin instead of style-loader to that CSS is extracted
// into a standalone .css bundle instead of inlined into JS via
-
+
diff --git a/packages/dev/docs/pages/react-aria/home/ListBoxExample.tsx b/packages/dev/docs/pages/react-aria/home/ListBoxExample.tsx
index 9a9784807f4..54441850d32 100644
--- a/packages/dev/docs/pages/react-aria/home/ListBoxExample.tsx
+++ b/packages/dev/docs/pages/react-aria/home/ListBoxExample.tsx
@@ -11,7 +11,13 @@
*/
'use client';
import {animate, useIntersectionObserver} from './utils';
-import {ListBoxItem as AriaListBoxItem, ListBoxItemProps as AriaListBoxItemProps, Key, ListBox, Selection} from 'react-aria-components';
+import {
+ ListBoxItem as AriaListBoxItem,
+ ListBoxItemProps as AriaListBoxItemProps,
+ Key,
+ ListBox,
+ Selection
+} from 'react-aria-components';
import {itemStyles} from 'tailwind-starter/ListBox';
import React, {ReactNode, useCallback, useRef, useState} from 'react';
@@ -27,101 +33,104 @@ export function ListBoxExample(): ReactNode {
let isAnimating = useRef(false);
let ref = useRef(null);
- useIntersectionObserver(ref, useCallback(() => {
- let spaceKey = document.getElementById('space-key')!;
- let downKey = document.getElementById('down-key')!;
- let upKey = document.getElementById('up-key')!;
- let shiftKey = document.getElementById('shift-key')!;
- isAnimating.current = true;
- let cancel = animate([
- {
- time: 500,
- perform() {}
- },
- {
- time: 800,
- perform() {
- setFocusedKey('chocolate');
- setSelectedKeys(new Set());
+ useIntersectionObserver(
+ ref,
+ useCallback(() => {
+ let spaceKey = document.getElementById('space-key')!;
+ let downKey = document.getElementById('down-key')!;
+ let upKey = document.getElementById('up-key')!;
+ let shiftKey = document.getElementById('shift-key')!;
+ isAnimating.current = true;
+ let cancel = animate([
+ {
+ time: 500,
+ perform() {}
+ },
+ {
+ time: 800,
+ perform() {
+ setFocusedKey('chocolate');
+ setSelectedKeys(new Set());
+ }
+ },
+ {
+ time: 800,
+ perform() {
+ downKey.animate(keyframes, {duration: 600});
+ setFocusedKey('mint');
+ }
+ },
+ {
+ time: 800,
+ perform() {
+ spaceKey.animate(keyframes, {duration: 600});
+ setSelectedKeys(new Set(['mint']));
+ }
+ },
+ {
+ time: 800,
+ perform() {
+ shiftKey.animate([{fill: 'transparent'}, {fill: 'var(--press-fill)', offset: 1}], {
+ duration: 300,
+ fill: 'forwards'
+ });
+ }
+ },
+ {
+ time: 800,
+ perform() {
+ downKey.animate(keyframes, {duration: 600});
+ setFocusedKey('strawberry');
+ setSelectedKeys(new Set(['mint', 'strawberry']));
+ }
+ },
+ {
+ time: 600,
+ perform() {
+ downKey.animate(keyframes, {duration: 600});
+ setFocusedKey('vanilla');
+ setSelectedKeys(new Set(['mint', 'strawberry', 'vanilla']));
+ }
+ },
+ {
+ time: 600,
+ perform() {
+ upKey.animate(keyframes, {duration: 600});
+ setFocusedKey('strawberry');
+ setSelectedKeys(new Set(['mint', 'strawberry']));
+ }
+ },
+ {
+ time: 1200,
+ perform() {
+ shiftKey.animate([{fill: 'var(--press-fill)'}, {fill: 'transparent', offset: 1}], {
+ duration: 300,
+ fill: 'forwards'
+ });
+ }
+ },
+ {
+ time: 0,
+ perform() {
+ setFocusedKey(null);
+ setSelectedKeys(new Set());
+ isAnimating.current = false;
+ }
}
- },
- {
- time: 800,
- perform() {
- downKey.animate(keyframes, {duration: 600});
- setFocusedKey('mint');
- }
- },
- {
- time: 800,
- perform() {
- spaceKey.animate(keyframes, {duration: 600});
- setSelectedKeys(new Set(['mint']));
- }
- },
- {
- time: 800,
- perform() {
- shiftKey.animate([
- {fill: 'transparent'},
- {fill: 'var(--press-fill)', offset: 1}
- ], {duration: 300, fill: 'forwards'});
- }
- },
- {
- time: 800,
- perform() {
- downKey.animate(keyframes, {duration: 600});
- setFocusedKey('strawberry');
- setSelectedKeys(new Set(['mint', 'strawberry']));
- }
- },
- {
- time: 600,
- perform() {
- downKey.animate(keyframes, {duration: 600});
- setFocusedKey('vanilla');
- setSelectedKeys(new Set(['mint', 'strawberry', 'vanilla']));
- }
- },
- {
- time: 600,
- perform() {
- upKey.animate(keyframes, {duration: 600});
- setFocusedKey('strawberry');
- setSelectedKeys(new Set(['mint', 'strawberry']));
- }
- },
- {
- time: 1200,
- perform() {
- shiftKey.animate([
- {fill: 'var(--press-fill)'},
- {fill: 'transparent', offset: 1}
- ], {duration: 300, fill: 'forwards'});
- }
- },
- {
- time: 0,
- perform() {
- setFocusedKey(null);
- setSelectedKeys(new Set());
- isAnimating.current = false;
- }
- }
- ]);
+ ]);
- return () => {
- cancel();
- setFocusedKey(null);
- setSelectedKeys(new Set());
- spaceKey.getAnimations().forEach(a => a.cancel());
- downKey.getAnimations().forEach(a => a.cancel());
- upKey.getAnimations().forEach(a => a.cancel());
- shiftKey.getAnimations().forEach(a => a.cancel());
- isAnimating.current = false;
- };
- }, []));
+ return () => {
+ cancel();
+ setFocusedKey(null);
+ setSelectedKeys(new Set());
+ spaceKey.getAnimations().forEach(a => a.cancel());
+ downKey.getAnimations().forEach(a => a.cancel());
+ upKey.getAnimations().forEach(a => a.cancel());
+ shiftKey.getAnimations().forEach(a => a.cancel());
+ isAnimating.current = false;
+ };
+ }, [])
+ );
let onSelectionChange = keys => {
if (!isAnimating.current) {
@@ -137,26 +146,45 @@ export function ListBoxExample(): ReactNode {
selectionMode="multiple"
selectedKeys={selectedKeys}
onSelectionChange={onSelectionChange}>
- Chocolate
- Mint
- Strawberry
- Vanilla
+
+ Chocolate
+
+
+ Mint
+
+
+ Strawberry
+
+
+ Vanilla
+
);
}
interface ListBoxItemProps extends AriaListBoxItemProps {
- focusedKey: Key | null
+ focusedKey: Key | null;
}
function ListBoxItem(props: ListBoxItemProps) {
- let textValue = props.textValue || (typeof props.children === 'string' ? props.children : undefined);
+ let textValue =
+ props.textValue || (typeof props.children === 'string' ? props.children : undefined);
return (
- itemStyles({isFocusVisible: isFocusVisible || props.id === props.focusedKey, ...renderProps})}>
- {renderProps => (<>
- {typeof props.children === 'function' ? props.children(renderProps) : props.children}
-
- >)}
+
+ itemStyles({
+ isFocusVisible: isFocusVisible || props.id === props.focusedKey,
+ ...renderProps
+ })
+ }>
+ {renderProps => (
+ <>
+ {typeof props.children === 'function' ? props.children(renderProps) : props.children}
+
+ >
+ )}
);
}
diff --git a/packages/dev/docs/pages/react-aria/home/MouseAnimation.tsx b/packages/dev/docs/pages/react-aria/home/MouseAnimation.tsx
index 67a377c28f4..4261a0009ab 100644
--- a/packages/dev/docs/pages/react-aria/home/MouseAnimation.tsx
+++ b/packages/dev/docs/pages/react-aria/home/MouseAnimation.tsx
@@ -24,108 +24,111 @@ export function MouseAnimation(): ReactNode {
let [isPressed, setPressed] = useState(false);
let isAnimating = useRef(false);
let mouseRef = useRef(null);
- useIntersectionObserver(ref, useCallback(() => {
- isAnimating.current = true;
- let cancel = animate([
- {
- time: 500,
- perform() {}
- },
- {
- time: 700,
- perform() {
- mouseRef.current!.animate({
- transform: [
- 'translate(-50px, 150px)',
- 'translate(10px, 10px)'
- ]
- }, {duration: 1000, fill: 'forwards', easing: 'ease-in-out'});
+ useIntersectionObserver(
+ ref,
+ useCallback(() => {
+ isAnimating.current = true;
+ let cancel = animate([
+ {
+ time: 500,
+ perform() {}
+ },
+ {
+ time: 700,
+ perform() {
+ mouseRef.current!.animate(
+ {
+ transform: ['translate(-50px, 150px)', 'translate(10px, 10px)']
+ },
+ {duration: 1000, fill: 'forwards', easing: 'ease-in-out'}
+ );
+ }
+ },
+ {
+ time: 1700,
+ perform() {
+ setHovered('edit');
+ }
+ },
+ {
+ time: 800,
+ perform() {
+ setTooltip('edit');
+ }
+ },
+ {
+ time: 700,
+ perform() {
+ mouseRef.current!.animate(
+ {
+ transform: ['translate(10px, 10px)', 'translate(105px, 14px)']
+ },
+ {duration: 2000, fill: 'forwards', easing: 'ease-in-out'}
+ );
+ }
+ },
+ {
+ time: 600,
+ perform() {
+ setHovered('share');
+ setTooltip('share');
+ }
+ },
+ {
+ time: 1500,
+ perform() {
+ setHovered('settings');
+ setTooltip('settings');
+ }
+ },
+ {
+ time: 300,
+ perform() {
+ setPressed(true);
+ setTooltip(null);
+ }
+ },
+ {
+ time: 1000,
+ perform() {
+ setPressed(false);
+ }
+ },
+ {
+ time: 400,
+ perform() {
+ mouseRef.current!.animate(
+ {
+ transform: ['translate(105px, 14px)', 'translate(170px, 150px)']
+ },
+ {duration: 1500, fill: 'forwards', easing: 'ease-in-out'}
+ );
+ }
+ },
+ {
+ time: 1100,
+ perform() {
+ setHovered(null);
+ }
+ },
+ {
+ time: 0,
+ perform() {
+ isAnimating.current = false;
+ }
}
- },
- {
- time: 1700,
- perform() {
- setHovered('edit');
- }
- },
- {
- time: 800,
- perform() {
- setTooltip('edit');
- }
- },
- {
- time: 700,
- perform() {
- mouseRef.current!.animate({
- transform: [
- 'translate(10px, 10px)',
- 'translate(105px, 14px)'
- ]
- }, {duration: 2000, fill: 'forwards', easing: 'ease-in-out'});
- }
- },
- {
- time: 600,
- perform() {
- setHovered('share');
- setTooltip('share');
- }
- },
- {
- time: 1500,
- perform() {
- setHovered('settings');
- setTooltip('settings');
- }
- },
- {
- time: 300,
- perform() {
- setPressed(true);
- setTooltip(null);
- }
- },
- {
- time: 1000,
- perform() {
- setPressed(false);
- }
- },
- {
- time: 400,
- perform() {
- mouseRef.current!.animate({
- transform: [
- 'translate(105px, 14px)',
- 'translate(170px, 150px)'
- ]
- }, {duration: 1500, fill: 'forwards', easing: 'ease-in-out'});
- }
- },
- {
- time: 1100,
- perform() {
- setHovered(null);
- }
- },
- {
- time: 0,
- perform() {
- isAnimating.current = false;
- }
- }
- ]);
+ ]);
- return () => {
- cancel();
- setTooltip(null);
- setHovered(null);
- setPressed(false);
- mouseRef.current!.getAnimations().forEach(a => a.cancel());
- isAnimating.current = false;
- };
- }, []));
+ return () => {
+ cancel();
+ setTooltip(null);
+ setHovered(null);
+ setPressed(false);
+ mouseRef.current!.getAnimations().forEach(a => a.cancel());
+ isAnimating.current = false;
+ };
+ }, [])
+ );
let onOpenChange = (tooltip: string, isOpen: boolean) => {
if (!isAnimating.current) {
@@ -144,27 +147,46 @@ export function MouseAnimation(): ReactNode {
className="absolute z-10"
style={{filter: 'drop-shadow(0 1px 1px #aaa)', transform: 'translate(-50px, 130px)'}}>
-
-
+
+
- onOpenChange('edit', o)}>
-
+ onOpenChange('edit', o)}>
+
Edit
- onOpenChange('share', o)}>
-
+ onOpenChange('share', o)}>
+
Share
- onOpenChange('settings', o)}>
+ onOpenChange('settings', o)}>
-
+
diff --git a/packages/dev/docs/pages/react-aria/home/PaginatedCarousel.tsx b/packages/dev/docs/pages/react-aria/home/PaginatedCarousel.tsx
index 5534bb183cd..a8f3fd28a29 100644
--- a/packages/dev/docs/pages/react-aria/home/PaginatedCarousel.tsx
+++ b/packages/dev/docs/pages/react-aria/home/PaginatedCarousel.tsx
@@ -26,4 +26,3 @@ export function PaginatedCarousel({children, className, paginationClassName}) {
>
);
}
-
diff --git a/packages/dev/docs/pages/react-aria/home/Pagination.tsx b/packages/dev/docs/pages/react-aria/home/Pagination.tsx
index 0cd64a811cd..1280fca2e19 100644
--- a/packages/dev/docs/pages/react-aria/home/Pagination.tsx
+++ b/packages/dev/docs/pages/react-aria/home/Pagination.tsx
@@ -14,12 +14,23 @@ import {Button} from 'tailwind-starter/Button';
import {ChevronLeft, ChevronRight} from 'lucide-react';
import React, {ReactNode, RefObject, useEffect, useState} from 'react';
-export function Pagination({carouselRef, className}: {carouselRef: RefObject, className?: string}): ReactNode {
+export function Pagination({
+ carouselRef,
+ className
+}: {
+ carouselRef: RefObject;
+ className?: string;
+}): ReactNode {
let scroll = (dir: number) => {
let carousel = carouselRef.current!;
let style = window.getComputedStyle(carousel);
carousel.scrollBy({
- left: dir * (carousel.clientWidth - parseInt(style.paddingLeft, 10) - parseInt(style.paddingRight, 10) + parseInt(style.columnGap, 10)),
+ left:
+ dir *
+ (carousel.clientWidth -
+ parseInt(style.paddingLeft, 10) -
+ parseInt(style.paddingRight, 10) +
+ parseInt(style.columnGap, 10)),
behavior: 'smooth'
});
};
diff --git a/packages/dev/docs/pages/react-aria/home/Styles.tsx b/packages/dev/docs/pages/react-aria/home/Styles.tsx
index a6b65c5768d..deb735846ef 100644
--- a/packages/dev/docs/pages/react-aria/home/Styles.tsx
+++ b/packages/dev/docs/pages/react-aria/home/Styles.tsx
@@ -11,16 +11,17 @@
*/
'use client';
import {AddressBar, FileTab, Scrollable, Window} from './components';
-import {animate, AnimationPlaybackControls, motion, useMotionValueEvent, useReducedMotion, useScroll, useTransform} from 'motion/react';
-import {Button} from 'vanilla-starter/Button';
import {
- Collection,
- Key,
- Tab,
- TabList,
- TabPanel,
- Tabs
-} from 'react-aria-components';
+ animate,
+ AnimationPlaybackControls,
+ motion,
+ useMotionValueEvent,
+ useReducedMotion,
+ useScroll,
+ useTransform
+} from 'motion/react';
+import {Button} from 'vanilla-starter/Button';
+import {Collection, Key, Tab, TabList, TabPanel, Tabs} from 'react-aria-components';
import {ComboBox, ComboBoxItem} from 'tailwind-starter/ComboBox';
import {DatePicker} from 'vanilla-starter/DatePicker';
import React, {ReactNode, useCallback, useEffect, useRef, useState} from 'react';
@@ -34,102 +35,114 @@ export function Styles({children}): ReactNode {
{
id: 'css',
label: 'Vanilla CSS',
- content:
-
- DatePicker.tsx
- DatePicker.css
+ content: (
+
+
+ DatePicker.tsx
+ DatePicker.css
+
+ }>
+
+
{styling}
+
+ DatePicker.css
+
+
+ {css}
+
- }>
-
-
- {styling}
-
-
-
DatePicker.css
+
+
https://your-app.com}>
+
+
-
- {css}
-
-
-
-
https://your-app.com}>
-
-
-
-
-
+
+
+ )
},
{
id: 'tailwind',
label: 'Tailwind',
- content:
-
ComboBox.tsx}>
-
- {tailwind}
-
-
-
https://your-app.com}>
-
-
- {item => (
-
-
- {item.name}
-
- )}
-
-
-
-
+ content: (
+
+
ComboBox.tsx}>
+ {tailwind}
+
+
https://your-app.com}>
+
+
+ {item => (
+
+
+ {item.name}
+
+ )}
+
+
+
+
+ )
},
{
id: 'styled-components',
label: 'Styled Components',
- content:
-
Slider.tsx} className="bg-gray-50 dark:bg-zinc-800/80 backdrop-saturate-200">
-
- {styledComponents}
-
-
-
https://your-app.com}>
-
-
-
-
-
+ content: (
+
+
Slider.tsx}
+ className="bg-gray-50 dark:bg-zinc-800/80 backdrop-saturate-200">
+ {styledComponents}
+
+
https://your-app.com}>
+
+
+
+
+
+ )
},
{
id: 'panda',
label: 'Panda',
- content:
-
Button.tsx} className="bg-gray-50 dark:bg-zinc-800/80 dark:backdrop-saturate-200">
-
- {panda}
-
-
-
https://your-app.com}>
-
-
- Initiate launch sequence…
-
-
-
-
+ content: (
+
+
Button.tsx}
+ className="bg-gray-50 dark:bg-zinc-800/80 dark:backdrop-saturate-200">
+ {panda}
+
+
https://your-app.com}>
+
+
+ Initiate launch sequence…
+
+
+
+
+ )
}
- ]} />
+ ]}
+ />
);
}
interface TabOptions {
- id: string,
- label: string,
- content: React.ReactNode
+ id: string;
+ label: string;
+ content: React.ReactNode;
}
function AnimatedTabs({tabs}: {tabs: TabOptions[]}) {
@@ -155,14 +168,16 @@ function AnimatedTabs({tabs}: {tabs: TabOptions[]}) {
// This function determines which tab should be selected
// based on the scroll position.
let getIndex = useCallback(
- (x) => Math.max(0, Math.floor((tabElements.length - 1) * x)),
+ x => Math.max(0, Math.floor((tabElements.length - 1) * x)),
[tabElements]
);
// This function transforms the scroll position into the X position
// or width of the selected tab indicator.
let transform = (x, property) => {
- if (!tabElements.length) {return 0;}
+ if (!tabElements.length) {
+ return 0;
+ }
// Find the tab index for the scroll X position.
let index = getIndex(x);
@@ -184,13 +199,15 @@ function AnimatedTabs({tabs}: {tabs: TabOptions[]}) {
return value || 0.1;
};
- let x = useTransform(scrollXProgress, (x) => transform(x, 'offsetLeft'));
- let width = useTransform(scrollXProgress, (x) => transform(x, 'offsetWidth'));
+ let x = useTransform(scrollXProgress, x => transform(x, 'offsetLeft'));
+ let width = useTransform(scrollXProgress, x => transform(x, 'offsetWidth'));
// When the user scrolls, update the selected key
// so that the correct tab panel becomes interactive.
- useMotionValueEvent(scrollXProgress, 'change', (x) => {
- if (animationRef.current || !tabElements.length) {return;}
+ useMotionValueEvent(scrollXProgress, 'change', x => {
+ if (animationRef.current || !tabElements.length) {
+ return;
+ }
setSelectedKey(tabs[getIndex(x)].id);
});
@@ -208,7 +225,7 @@ function AnimatedTabs({tabs}: {tabs: TabOptions[]}) {
}
let tabPanel = tabPanelsRef.current!;
- let index = tabs.findIndex((tab) => tab.id === selectedKey);
+ let index = tabs.findIndex(tab => tab.id === selectedKey);
let scrollLeft = tabPanel.scrollWidth * (index / tabs.length);
if (shouldReduceMotion) {
tabPanel.scrollLeft = scrollLeft;
@@ -216,26 +233,22 @@ function AnimatedTabs({tabs}: {tabs: TabOptions[]}) {
}
animationRef.current?.stop();
- animationRef.current = animate(
- tabPanel.scrollLeft,
- scrollLeft,
- {
- type: 'spring',
- bounce: 0.2,
- duration: 0.6,
- onUpdate: (v) => {
- tabPanel.scrollLeft = v;
- },
- onPlay: () => {
- // Disable scroll snap while the animation is going or weird things happen.
- tabPanel.style.scrollSnapType = 'none';
- },
- onComplete: () => {
- tabPanel.style.scrollSnapType = '';
- animationRef.current = null;
- }
+ animationRef.current = animate(tabPanel.scrollLeft, scrollLeft, {
+ type: 'spring',
+ bounce: 0.2,
+ duration: 0.6,
+ onUpdate: v => {
+ tabPanel.scrollLeft = v;
+ },
+ onPlay: () => {
+ // Disable scroll snap while the animation is going or weird things happen.
+ tabPanel.style.scrollSnapType = 'none';
+ },
+ onComplete: () => {
+ tabPanel.style.scrollSnapType = '';
+ animationRef.current = null;
}
- );
+ });
};
// Scroll selected tab into view.
@@ -245,7 +258,11 @@ function AnimatedTabs({tabs}: {tabs: TabOptions[]}) {
if (tab) {
let scroll = tabListScrollRef.current;
// Would use scrollIntoView but it's broken in Chrome: https://github.com/facebook/react/issues/23396
- if (scroll && (tab.offsetLeft < scroll.scrollLeft || (tab.offsetLeft + tab.offsetWidth) > (scroll.offsetWidth + scroll.scrollLeft))) {
+ if (
+ scroll &&
+ (tab.offsetLeft < scroll.scrollLeft ||
+ tab.offsetLeft + tab.offsetWidth > scroll.offsetWidth + scroll.scrollLeft)
+ ) {
scroll.scroll({
left: tab.offsetLeft,
behavior: 'smooth'
@@ -259,32 +276,38 @@ function AnimatedTabs({tabs}: {tabs: TabOptions[]}) {
className="-mx-8 md:-mx-2"
selectedKey={selectedKey}
onSelectionChange={onSelectionChange}>
-
+
- {(tab) =>
- (
- {({isSelected, isFocusVisible}) => (<>
- {tab.label}
- {isFocusVisible && isSelected && (
- // Focus ring.
-
- )}
- >)}
- )
- }
+ {tab => (
+
+ {({isSelected, isFocusVisible}) => (
+ <>
+ {tab.label}
+ {isFocusVisible && isSelected && (
+ // Focus ring.
+
+ )}
+ >
+ )}
+
+ )}
{/* Selection indicator. */}
+ style={{x, width}}
+ />
- {(tab) => (
+ {tab => (
diff --git a/packages/dev/docs/pages/react-aria/home/SwitchAnimation.tsx b/packages/dev/docs/pages/react-aria/home/SwitchAnimation.tsx
index ab7d9c49f18..4fa42eeeba8 100644
--- a/packages/dev/docs/pages/react-aria/home/SwitchAnimation.tsx
+++ b/packages/dev/docs/pages/react-aria/home/SwitchAnimation.tsx
@@ -21,44 +21,60 @@ export function SwitchAnimation(): ReactNode {
let [isAnimating, setAnimating] = useState(false);
let [isSelected, setSelected] = useState(true);
- useIntersectionObserver(ref, useCallback(() => {
- let job = {
- isCanceled: false,
- async run() {
- flushSync(() => {
- setAnimating(true);
- });
- let animation = document.getAnimations()
- .find(anim => anim instanceof CSSAnimation && anim.animationName === 'touch-animation');
- try {
- await animation?.finished;
- } catch {
- // ignore abort errors.
+ useIntersectionObserver(
+ ref,
+ useCallback(() => {
+ let job = {
+ isCanceled: false,
+ async run() {
+ flushSync(() => {
+ setAnimating(true);
+ });
+ let animation = document
+ .getAnimations()
+ .find(anim => anim instanceof CSSAnimation && anim.animationName === 'touch-animation');
+ try {
+ await animation?.finished;
+ } catch {
+ // ignore abort errors.
+ }
+ setAnimating(false);
}
- setAnimating(false);
- }
- };
+ };
- animationQueue.next(job);
+ animationQueue.next(job);
- return () => {
- job.isCanceled = true;
- setAnimating(false);
- setSelected(true);
- };
- }, []));
+ return () => {
+ job.isCanceled = true;
+ setAnimating(false);
+ setSelected(true);
+ };
+ }, [])
+ );
return (
<>
-
+
-
-
+
+
>
diff --git a/packages/dev/docs/pages/react-aria/home/components.tsx b/packages/dev/docs/pages/react-aria/home/components.tsx
index 6f26ba0d99a..a52348648f2 100644
--- a/packages/dev/docs/pages/react-aria/home/components.tsx
+++ b/packages/dev/docs/pages/react-aria/home/components.tsx
@@ -14,15 +14,32 @@ import {BaseLink} from '@react-spectrum/s2-docs/src/Link';
import React, {ForwardedRef, HTMLAttributes, ReactNode} from 'react';
import {twMerge} from 'tailwind-merge';
-export function Window({children, className = '', isBackground = false, toolbar}: {children: ReactNode, className?: string, isBackground?: boolean, toolbar: ReactNode}): ReactNode {
+export function Window({
+ children,
+ className = '',
+ isBackground = false,
+ toolbar
+}: {
+ children: ReactNode;
+ className?: string;
+ isBackground?: boolean;
+ toolbar: ReactNode;
+}): ReactNode {
return (
-
+
{children}
@@ -30,72 +47,178 @@ export function Window({children, className = '', isBackground = false, toolbar}
);
}
-export function FileTab({children, className = ''}: {children: ReactNode, className?: string}): ReactNode {
- return
{children}
;
+export function FileTab({
+ children,
+ className = ''
+}: {
+ children: ReactNode;
+ className?: string;
+}): ReactNode {
+ return (
+
+ {children}
+
+ );
}
export function AddressBar({children}: {children: ReactNode}): ReactNode {
- return
{children}
;
+ return (
+
+ {children}
+
+ );
}
export function GradientText({children}: {children: ReactNode}): ReactNode {
- return
{children} ;
+ return (
+
+ {children}
+
+ );
}
-export function Card({className, ...otherProps}: {
- [x: string]: any,
- className: any
-}): ReactNode {
- return
;
+export function Card({className, ...otherProps}: {[x: string]: any; className: any}): ReactNode {
+ return (
+
+ );
}
export function CardTitle({children}: {children: ReactNode}): ReactNode {
- return
{children} ;
+ return (
+
{children}
+ );
}
export function CardDescription({children}: {children: ReactNode}): ReactNode {
- return
{children}
;
+ return (
+
+ {children}
+
+ );
}
interface ArrowProps {
- href: string,
- children: ReactNode,
- textX: number,
- x1?: number,
- x2?: number,
- points?: string,
- y: number,
- marker?: 'markerStart' | 'markerEnd' | 'none'
+ href: string;
+ children: ReactNode;
+ textX: number;
+ x1?: number;
+ x2?: number;
+ points?: string;
+ y: number;
+ marker?: 'markerStart' | 'markerEnd' | 'none';
}
-export function Arrow({href, children, textX, x1, x2, points, y, marker = 'markerEnd'}: ArrowProps): ReactNode {
+export function Arrow({
+ href,
+ children,
+ textX,
+ x1,
+ x2,
+ points,
+ y,
+ marker = 'markerEnd'
+}: ArrowProps): ReactNode {
let markerProps = marker === 'none' ? {} : {...{[marker]: 'url(#arrow)'}};
return (
<>
- {points
- ?
- :
- }
-
{children}
+ {points ? (
+
+ ) : (
+
+ )}
+
+
+ {children}
+
+
>
);
}
-export const Finger:
- React.ForwardRefExoticComponent
& React.RefAttributes> =
-React.forwardRef((props: HTMLAttributes, ref: ForwardedRef) => {
- return
;
-});
+export const Finger: React.ForwardRefExoticComponent<
+ React.HTMLAttributes & React.RefAttributes
+> = React.forwardRef(
+ (props: HTMLAttributes, ref: ForwardedRef) => {
+ return (
+
+ );
+ }
+);
-export function LearnMoreLink({children, href, className}: {children?: string, href: string, className: string}): ReactNode {
- return {children || 'Learn more'} ;
+export function LearnMoreLink({
+ children,
+ href,
+ className
+}: {
+ children?: string;
+ href: string;
+ className: string;
+}): ReactNode {
+ return (
+
+ {children || 'Learn more'}
+
+
+ );
}
-export function Scrollable({children, className = ''}: {children: ReactNode, className?: string}): ReactNode {
- // eslint-disable-next-line
- return {children}
;
+export function Scrollable({
+ children,
+ className = ''
+}: {
+ children: ReactNode;
+ className?: string;
+}): ReactNode {
+ return (
+
+ {children}
+
+ );
}
-export function Section({children, className = ''}: {children: ReactNode, className?: string}): ReactNode {
- return ;
+export function Section({
+ children,
+ className = ''
+}: {
+ children: ReactNode;
+ className?: string;
+}): ReactNode {
+ return (
+
+ );
}
diff --git a/packages/dev/docs/pages/react-aria/home/home.css b/packages/dev/docs/pages/react-aria/home/home.css
index eff70a47920..65529bf5bb4 100644
--- a/packages/dev/docs/pages/react-aria/home/home.css
+++ b/packages/dev/docs/pages/react-aria/home/home.css
@@ -21,16 +21,16 @@
}
.home .header-background {
- --pink: light-dark(oklch(from #DA8DE9 calc(l * 1.25) c h), oklch(from #BF67D0 calc(l * 0.9) c h));
- --orange: light-dark(#FACA85, oklch(from #EDB35F calc(l * 0.82) c h));
- --purple: light-dark(#EDE8FF, #6D33F7);
+ --pink: light-dark(oklch(from #da8de9 calc(l * 1.25) c h), oklch(from #bf67d0 calc(l * 0.9) c h));
+ --orange: light-dark(#faca85, oklch(from #edb35f calc(l * 0.82) c h));
+ --purple: light-dark(#ede8ff, #6d33f7);
background:
linear-gradient(to bottom, transparent 0% 80%, var(--page-bg)),
radial-gradient(50% 22% at 25% 72%, var(--pink), transparent),
radial-gradient(50% 22% at 62% 75%, var(--orange), transparent),
radial-gradient(150% 30% at 50% 70%, var(--purple), transparent),
- linear-gradient(to bottom, transparent, light-dark(#EDE8FF, transparent) 60%, transparent);
+ linear-gradient(to bottom, transparent, light-dark(#ede8ff, transparent) 60%, transparent);
@media (width < 768px) {
background:
@@ -38,7 +38,7 @@
radial-gradient(100% 10% at 45% 71%, var(--pink), transparent),
radial-gradient(100% 10% at 55% 84%, var(--orange), transparent),
radial-gradient(150% 30% at 50% 70%, var(--purple), transparent),
- linear-gradient(to bottom, transparent, light-dark(#EDE8FF, transparent) 60%, transparent);
+ linear-gradient(to bottom, transparent, light-dark(#ede8ff, transparent) 60%, transparent);
}
}
@@ -75,7 +75,7 @@
--hljs-function-color: theme(colors.blue.600);
--hljs-variable-color: theme(colors.purple.700);
--hljs-title-color: theme(colors.indigo.700);
- --hljs-comment-color: theme(colors.gray.700);
+ --hljs-comment-color: theme(colors.gray.700);
--mark-background: theme(colors.blue.400/10%);
--mark-border: theme(colors.blue.500);
}
@@ -92,7 +92,7 @@
--hljs-function-color: theme(colors.blue.400);
--hljs-variable-color: theme(colors.purple.400);
--hljs-title-color: theme(colors.indigo.400);
- --hljs-comment-color: theme(colors.gray.400);
+ --hljs-comment-color: theme(colors.gray.400);
--mark-border: theme(colors.blue.400);
}
}
@@ -114,17 +114,23 @@
}
.home pre.small {
- @apply sm:hidden
+ @apply sm:hidden;
}
.home .card-shadow {
- box-shadow: 0 0 2px rgb(0 0 0 / 12%), 0 3px 6px rgb(0 0 0 / 4%), 0 4px 8px 0 rgba(0 0 0 / 8%);
+ box-shadow:
+ 0 0 2px rgb(0 0 0 / 12%),
+ 0 3px 6px rgb(0 0 0 / 4%),
+ 0 4px 8px 0 rgba(0 0 0 / 8%);
outline: 1px solid transparent; /* WHCM */
@apply dark:border dark:border-zinc-200/10 dark:bg-clip-padding;
}
.home .card-shadow-hover:hover {
- box-shadow: 0 0 2px rgb(0 0 0 / 18%), 0 3px 8px rgb(0 0 0 / 6%), 0 4px 16px 0 rgba(0 0 0 / 10%);
+ box-shadow:
+ 0 0 2px rgb(0 0 0 / 18%),
+ 0 3px 8px rgb(0 0 0 / 6%),
+ 0 4px 16px 0 rgba(0 0 0 / 10%);
}
.home .card-shadow-hover:focus-visible {
@@ -141,22 +147,26 @@
transform: translate(10px, 135px);
}
- 15%, 16% {
+ 15%,
+ 16% {
opacity: var(--hover-opacity);
transform: translate(7px, 0);
}
- 17.2%, 19% {
+ 17.2%,
+ 19% {
opacity: var(--pressed-opacity);
transform: translate(7px, 0);
}
- 25%, 27% {
+ 25%,
+ 27% {
opacity: var(--pressed-opacity);
transform: translate(7px, 48px);
}
- 35%, 36% {
+ 35%,
+ 36% {
opacity: var(--pressed-opacity);
transform: translate(7px, 7px);
}
@@ -166,27 +176,32 @@
transform: translate(7px, 7px);
}
- 50%, 55% {
+ 50%,
+ 55% {
opacity: var(--hover-opacity);
transform: translate(4px, 52px);
}
- 65%, 66% {
+ 65%,
+ 66% {
opacity: var(--hover-opacity);
transform: translate(7px, 0);
}
- 67.2%, 69% {
+ 67.2%,
+ 69% {
opacity: var(--pressed-opacity);
transform: translate(7px, 0);
}
- 75%, 77% {
+ 75%,
+ 77% {
opacity: var(--pressed-opacity);
transform: translate(7px, 48px);
}
- 85%, 86% {
+ 85%,
+ 86% {
opacity: var(--pressed-opacity);
transform: translate(7px, 7px);
}
@@ -203,62 +218,74 @@
}
@keyframes switch-animation {
- 0%, 16% {
+ 0%,
+ 16% {
margin-left: --spacing(6);
width: --spacing(8);
}
- 18.5%, 22% {
+ 18.5%,
+ 22% {
margin-left: --spacing(4);
width: --spacing(10);
}
- 25%, 30% {
+ 25%,
+ 30% {
margin-left: --spacing(6);
width: --spacing(8);
}
- 33%, 36.5% {
+ 33%,
+ 36.5% {
margin-left: --spacing(4);
width: --spacing(10);
}
- 38.5%, 66% {
+ 38.5%,
+ 66% {
margin-left: 0;
width: --spacing(8);
}
- 68.5%, 72% {
+ 68.5%,
+ 72% {
margin-left: 0;
width: --spacing(10);
}
- 75%, 80% {
+ 75%,
+ 80% {
margin-left: 0;
width: --spacing(8);
}
- 83%, 86.5% {
+ 83%,
+ 86.5% {
margin-left: 0;
width: --spacing(10);
}
- 88.5%, 100% {
+ 88.5%,
+ 100% {
margin-left: --spacing(6);
width: --spacing(8);
}
}
@keyframes switch-background-animation {
- 0%, 36.5% {
+ 0%,
+ 36.5% {
background: var(--bg-selected);
}
- 38.5%, 86.5% {
+ 38.5%,
+ 86.5% {
background: var(--bg);
}
- 88.5%, 100% {
+ 88.5%,
+ 100% {
background: var(--bg-selected);
}
}
@@ -275,11 +302,13 @@
}
@keyframes cross-fade {
- 0%, 40% {
+ 0%,
+ 40% {
opacity: var(--fade-from, 0);
}
- 50%, 90% {
+ 50%,
+ 90% {
opacity: var(--fade-to, 1);
}
@@ -289,7 +318,8 @@
}
@keyframes highlight {
- 0%, 30% {
+ 0%,
+ 30% {
opacity: 0;
}
@@ -297,7 +327,8 @@
opacity: 1;
}
- 70%, 100% {
+ 70%,
+ 100% {
opacity: 0;
}
}
@@ -309,7 +340,7 @@
.home .highlight-tags {
.tag:nth-child(1 of .tag),
- .tag:nth-child(n+4 of .tag):nth-child(-n+8 of .tag),
+ .tag:nth-child(n + 4 of .tag):nth-child(-n + 8 of .tag),
.tag:nth-last-child(1 of .tag) {
position: relative;
&::after {
@@ -336,7 +367,8 @@
--b-shape: ellipse 30% 30% at 71% 42%;
--c: oklch(96% 0.06 218);
--c-shape: ellipse 40% 25% at 50% 72%;
- background: radial-gradient(var(--a-shape), var(--a), transparent),
+ background:
+ radial-gradient(var(--a-shape), var(--a), transparent),
radial-gradient(var(--b-shape), var(--b), transparent),
radial-gradient(var(--c-shape), var(--c), transparent);
}
@@ -361,7 +393,8 @@
--a: oklch(94% 0.08 250);
--b: oklch(94% 0.12 275);
--c: oklch(91% 0.15 290);
- background: radial-gradient(circle farthest-side at 28% 54%, var(--a), transparent 36%),
+ background:
+ radial-gradient(circle farthest-side at 28% 54%, var(--a), transparent 36%),
radial-gradient(circle farthest-side at 65% 45%, var(--b), transparent 50%),
radial-gradient(circle farthest-side at 60% 65%, var(--c), transparent 50%);
}
@@ -399,7 +432,8 @@
--b-shape: ellipse 35% 30% at 66% 50%;
--c: oklch(96% 0.15 20);
--c-shape: ellipse 40% 25% at 50% 70%;
- background: radial-gradient(var(--a-shape), var(--a), transparent),
+ background:
+ radial-gradient(var(--a-shape), var(--a), transparent),
radial-gradient(var(--b-shape), var(--b), transparent),
radial-gradient(var(--c-shape), var(--c), transparent);
}
@@ -427,7 +461,8 @@
--b-shape: ellipse 35% 30% at 66% 47%;
--c: oklch(96% 0.14 340);
--c-shape: ellipse 40% 25% at 50% 70%;
- background: radial-gradient(var(--a-shape), var(--a), transparent),
+ background:
+ radial-gradient(var(--a-shape), var(--a), transparent),
radial-gradient(var(--b-shape), var(--b), transparent),
radial-gradient(var(--c-shape), var(--c), transparent);
}
@@ -448,7 +483,6 @@
}
}
-
.home .green-gradient-background {
--a: oklch(96% 0.1 120);
--a-shape: ellipse 30% 30% at 29% 54%;
@@ -456,7 +490,8 @@
--b-shape: ellipse 35% 30% at 66% 41%;
--c: oklch(94% 0.06 150);
--c-shape: ellipse 40% 25% at 50% 74%;
- background: radial-gradient(var(--a-shape), var(--a), transparent),
+ background:
+ radial-gradient(var(--a-shape), var(--a), transparent),
radial-gradient(var(--b-shape), var(--b), transparent),
radial-gradient(var(--c-shape), var(--c), transparent);
}
diff --git a/packages/dev/docs/pages/react-aria/home/plants.ts b/packages/dev/docs/pages/react-aria/home/plants.ts
index 36d1c7217d4..a9fc484c970 100644
--- a/packages/dev/docs/pages/react-aria/home/plants.ts
+++ b/packages/dev/docs/pages/react-aria/home/plants.ts
@@ -31,16 +31,16 @@ import xmas from 'url:./plants/xmas.jpg?as=webp';
import zz from 'url:./plants/zz.jpg?as=webp';
export interface Plant {
- id: number,
- common_name: string,
- scientific_name: string[],
- watering: string,
- sunlight: string[],
- cycle: string,
+ id: number;
+ common_name: string;
+ scientific_name: string[];
+ watering: string;
+ sunlight: string[];
+ cycle: string;
default_image: {
- thumbnail: string
- },
- isFavorite?: boolean
+ thumbnail: string;
+ };
+ isFavorite?: boolean;
}
export default [
diff --git a/packages/dev/docs/pages/react-aria/home/utils.ts b/packages/dev/docs/pages/react-aria/home/utils.ts
index b1aba4a390c..9c7e8bf05d5 100644
--- a/packages/dev/docs/pages/react-aria/home/utils.ts
+++ b/packages/dev/docs/pages/react-aria/home/utils.ts
@@ -13,7 +13,7 @@
import {RefObject} from '@react-types/shared';
import {useEffect} from 'react';
-async function *createAnimationQueue() {
+async function* createAnimationQueue() {
while (true) {
let {isCanceled, run} = yield;
if (!isCanceled) {
@@ -22,13 +22,17 @@ async function *createAnimationQueue() {
}
}
-export let animationQueue: AsyncGenerator Promise
-}> = createAnimationQueue();
+export let animationQueue: AsyncGenerator<
+ undefined,
+ void,
+ {
+ isCanceled: boolean;
+ run: () => Promise;
+ }
+> = createAnimationQueue();
animationQueue.next(); // advance to first yield
-export function animate(steps: {time: number, perform: () => void}[]): () => void {
+export function animate(steps: {time: number; perform: () => void}[]): () => void {
let cancelCurrentStep;
async function run() {
for (let step of steps) {
@@ -71,7 +75,10 @@ function sleep(ms: number) {
};
}
-export function useIntersectionObserver(ref: RefObject, onIntersect: () => Function | void): void {
+export function useIntersectionObserver(
+ ref: RefObject,
+ onIntersect: () => Function | void
+): void {
useEffect(() => {
let element = ref.current;
if (!element) {
@@ -79,14 +86,17 @@ export function useIntersectionObserver(ref: RefObject, onIn
}
let cancel: Function | void = undefined;
- let observer = new IntersectionObserver((entries) => {
- if (entries[0].isIntersecting) {
- cancel = onIntersect();
- } else if (typeof cancel === 'function') {
- cancel();
- cancel = undefined;
- }
- }, {threshold: 1});
+ let observer = new IntersectionObserver(
+ entries => {
+ if (entries[0].isIntersecting) {
+ cancel = onIntersect();
+ } else if (typeof cancel === 'function') {
+ cancel();
+ cancel = undefined;
+ }
+ },
+ {threshold: 1}
+ );
observer.observe(element);
return () => {
diff --git a/packages/dev/docs/src/BasePage.js b/packages/dev/docs/src/BasePage.js
index d6080f22b92..065420ede28 100644
--- a/packages/dev/docs/src/BasePage.js
+++ b/packages/dev/docs/src/BasePage.js
@@ -1,9 +1,10 @@
import path from 'path';
import React from 'react';
-const TLD = process.env.DOCS_ENV === 'production'
- ? 'react-spectrum.adobe.com'
- : 'reactspectrum.blob.core.windows.net';
+const TLD =
+ process.env.DOCS_ENV === 'production'
+ ? 'react-spectrum.adobe.com'
+ : 'reactspectrum.blob.core.windows.net';
function stripMarkdown(description) {
return (description || '').replace(/\[(.*?)\]\(.*?\)/g, '$1');
@@ -11,10 +12,31 @@ function stripMarkdown(description) {
export const ImageContext = React.createContext();
-export function BasePage({children, currentPage, styles, scripts, publicUrl, pageSection, appendSectionToTitle, hero, className}) {
- let pathToPage = currentPage.filePath.substring(currentPage.filePath.indexOf('packages/'), currentPage.filePath.length);
- let keywords = [...new Set(currentPage.keywords.concat([currentPage.category, currentPage.title, pageSection]).filter(k => !!k))];
- let description = stripMarkdown(currentPage.description) || `Documentation for ${currentPage.title} in the ${pageSection} package.`;
+export function BasePage({
+ children,
+ currentPage,
+ styles,
+ scripts,
+ publicUrl,
+ pageSection,
+ appendSectionToTitle,
+ hero,
+ className
+}) {
+ let pathToPage = currentPage.filePath.substring(
+ currentPage.filePath.indexOf('packages/'),
+ currentPage.filePath.length
+ );
+ let keywords = [
+ ...new Set(
+ currentPage.keywords
+ .concat([currentPage.category, currentPage.title, pageSection])
+ .filter(k => !!k)
+ )
+ ];
+ let description =
+ stripMarkdown(currentPage.description) ||
+ `Documentation for ${currentPage.title} in the ${pageSection} package.`;
let title = currentPage.title + (appendSectionToTitle ? ` – ${pageSection}` : '');
let heroUrl = `https://${TLD}${currentPage.image || (hero ? publicUrl + path.basename(hero) : '')}`;
let githubLink = pathToPage;
@@ -25,21 +47,41 @@ export function BasePage({children, currentPage, styles, scripts, publicUrl, pag
}
return (
-
+
{title}
-
-
-
-
- {styles.map(s => )}
- {scripts.map(s => )}
+
+
+
+
+ {styles.map(s => (
+
+ ))}
+ {scripts.map(s => (
+
+ ))}
@@ -54,8 +96,8 @@ export function BasePage({children, currentPage, styles, scripts, publicUrl, pag
+ })
+ }}
+ />
-
- {children}
-
+ {children}
\' occurrences.');
+ console.log("✅ All HTML validated for duplicate '' occurrences.");
} else {
- console.log(`❌ Found ${duplicates.length} file(s) with duplicate '' occurrences:\n`);
-
+ console.log(
+ `❌ Found ${duplicates.length} file(s) with duplicate '' occurrences:\n`
+ );
+
for (const {filePath, count} of duplicates) {
const relativePath = filePath.replace(targetDir, '').replace(/^\//, '');
console.log(` 📄 ${relativePath}`);
console.log(` Pattern appears ${count} times (expected: 1)\n`);
}
-
+
process.exit(1);
}
}
diff --git a/packages/dev/s2-docs/src/BundlerSwitcher.tsx b/packages/dev/s2-docs/src/BundlerSwitcher.tsx
index 331a2859dc4..f1f316d809a 100644
--- a/packages/dev/s2-docs/src/BundlerSwitcher.tsx
+++ b/packages/dev/s2-docs/src/BundlerSwitcher.tsx
@@ -28,13 +28,13 @@ const switcher = style({
});
export interface BundlerSwitcherProps {
- children: ReactNode
+ children: ReactNode;
}
export interface BundlerSwitcherItemProps {
- id: SwitcherKey,
- label: string,
- children: ReactNode
+ id: SwitcherKey;
+ label: string;
+ children: ReactNode;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -65,9 +65,14 @@ export function BundlerSwitcher({children}: BundlerSwitcherProps) {
return (
-
+
{items.map(it => (
- {it.label}
+
+ {it.label}
+
))}
diff --git a/packages/dev/s2-docs/src/ClassAPI.tsx b/packages/dev/s2-docs/src/ClassAPI.tsx
index 8d837a3e283..a685c18fdf7 100644
--- a/packages/dev/s2-docs/src/ClassAPI.tsx
+++ b/packages/dev/s2-docs/src/ClassAPI.tsx
@@ -2,13 +2,11 @@ import {InterfaceType, setLinks, TInterface} from './types';
import React from 'react';
interface ClassAPIProps {
- class: TInterface,
- links: any
+ class: TInterface;
+ links: any;
}
export function ClassAPI({class: c, links}: ClassAPIProps) {
setLinks(links);
- return (
-
- );
+ return
;
}
diff --git a/packages/dev/s2-docs/src/Code.tsx b/packages/dev/s2-docs/src/Code.tsx
index c74ef358153..14bef234d7d 100644
--- a/packages/dev/s2-docs/src/Code.tsx
+++ b/packages/dev/s2-docs/src/Code.tsx
@@ -39,11 +39,19 @@ const mark = style({
});
function Highlight({tokens}) {
- return
;
+ return (
+
+
+
+ );
}
function Focus({tokens}) {
- return
;
+ return (
+
+
+
+ );
}
const groupings = {
@@ -54,12 +62,12 @@ const groupings = {
type Links = {[name: string]: string};
export interface ICodeProps {
- children: string,
- lang?: string,
- isFencedBlock?: boolean,
- hideImports?: boolean,
- links?: Links,
- styles?: StyleString
+ children: string;
+ lang?: string;
+ isFencedBlock?: boolean;
+ hideImports?: boolean;
+ links?: Links;
+ styles?: StyleString;
}
// Check if a language is supported by tree-sitter for syntax highlighting
@@ -68,7 +76,14 @@ function isSupportedLanguage(lang: string): boolean {
return supported.includes(lang.toLowerCase());
}
-export function Code({children, lang, isFencedBlock, hideImports = true, links, styles}: ICodeProps) {
+export function Code({
+ children,
+ lang,
+ isFencedBlock,
+ hideImports = true,
+ links,
+ styles
+}: ICodeProps) {
// If language is provided and is a supported syntax highlighting language
if (lang && isSupportedLanguage(lang)) {
return (
@@ -114,61 +129,64 @@ export function Code({children, lang, isFencedBlock, hideImports = true, links,
);
}
-const highlightCode = cache((children: string, lang: string, hideImports = true, links?: Links): Token[] => {
- // @ts-ignore
- let highlighted = highlightHast(children, Language[lang === 'json' ? 'JS' : lang.toUpperCase()]);
- let lineNodes = lines(highlighted);
- let idx = lineNodes.findIndex(line => !/^(["']use client["']|(\s*$))/.test(text(line)));
- if (idx > 0) {
- lineNodes = lineNodes.slice(idx);
- }
+const highlightCode = cache(
+ (children: string, lang: string, hideImports = true, links?: Links): Token[] => {
+ let highlighted = highlightHast(
+ children,
+ // @ts-ignore
+ Language[lang === 'json' ? 'JS' : lang.toUpperCase()]
+ );
+ let lineNodes = lines(highlighted);
+ let idx = lineNodes.findIndex(line => !/^(["']use client["']|(\s*$))/.test(text(line)));
+ if (idx > 0) {
+ lineNodes = lineNodes.slice(idx);
+ }
- if (hideImports) {
- // Group into hidden and visible nodes.
- // Hidden nodes will include all import statements. If a highlighted block is seen,
- // then we'll hide all the lines up until 2 lines before this.
- let hidden: HastNode[] = [];
- let visible: HastNode[] = [];
- let seenNonImportLine = false;
- let hasHighlight = false;
- for (let line of lineNodes) {
- if (!seenNonImportLine && /^(["']use client["']|@?import|(\s*$))/.test(text(line))) {
- hidden.push(line);
- } else {
- seenNonImportLine = true;
- visible.push(line);
+ if (hideImports) {
+ // Group into hidden and visible nodes.
+ // Hidden nodes will include all import statements. If a highlighted block is seen,
+ // then we'll hide all the lines up until 2 lines before this.
+ let hidden: HastNode[] = [];
+ let visible: HastNode[] = [];
+ let seenNonImportLine = false;
+ let hasHighlight = false;
+ for (let line of lineNodes) {
+ if (!seenNonImportLine && /^(["']use client["']|@?import|(\s*$))/.test(text(line))) {
+ hidden.push(line);
+ } else {
+ seenNonImportLine = true;
+ visible.push(line);
+ }
+
+ if ((line.tagName === 'highlight' || line.tagName === 'focus') && !hasHighlight) {
+ hasHighlight = true;
+ // Center highlighted lines within collapsed window (~8 lines).
+ let highlightedLines = line.children.length;
+ let contextLines = highlightedLines < 6 ? Math.floor((8 - highlightedLines) / 2) : 2;
+ contextLines++;
+ hidden.push(...visible.slice(0, -contextLines));
+ visible = visible.slice(-contextLines);
+ }
}
- if ((line.tagName === 'highlight' || line.tagName === 'focus') && !hasHighlight) {
- hasHighlight = true;
- // Center highlighted lines within collapsed window (~8 lines).
- let highlightedLines = line.children.length;
- let contextLines = highlightedLines < 6
- ? Math.floor((8 - highlightedLines) / 2)
- : 2;
- contextLines++;
- hidden.push(...visible.slice(0, -contextLines));
- visible = visible.slice(-contextLines);
+ if (hidden.length && visible.length) {
+ lineNodes = [
+ {
+ type: 'element',
+ tagName: 'span',
+ children: hidden,
+ properties: {
+ className: 'import'
+ }
+ },
+ ...visible
+ ];
}
}
- if (hidden.length && visible.length) {
- lineNodes = [
- {
- type: 'element',
- tagName: 'span',
- children: hidden,
- properties: {
- className: 'import'
- }
- },
- ...visible
- ];
- }
+ return renderChildren(lineNodes, '0', links);
}
-
- return renderChildren(lineNodes, '0', links);
-});
+);
function lines(node: HastNode) {
let resultLines: HastNode[] = [];
@@ -253,7 +271,12 @@ function lines(node: HastNode) {
// Renders a Hast Node to a list of tokens. A token is either a string, a React element, or a token type (number) + string.
// These are flattened into an array that gets sent to the client. This format significantly reduces the payload size vs JSX.
-function renderHast(node: HastNode | HastTextNode, key: string, links?: Links, indent = ''): Token | Token[] {
+function renderHast(
+ node: HastNode | HastTextNode,
+ key: string,
+ links?: Links,
+ indent = ''
+): Token | Token[] {
if (node.type === 'element' && 'children' in node) {
let childArray: Token[] = renderChildren(node.children, key, links);
if (node.tagName === 'div') {
@@ -264,18 +287,29 @@ function renderHast(node: HastNode | HastTextNode, key: string, links?: Links, i
}
}
- let tokenType = node.properties?.className.split(' ').map(c => TokenType[c]).filter(v => v != null) || [];
+ let tokenType =
+ node.properties?.className
+ .split(' ')
+ .map(c => TokenType[c])
+ .filter(v => v != null) || [];
if (node.properties?.className === 'comment' && text(node) === '/* PROPS */') {
return
;
}
// CodeProps includes the indent and newlines in case there are no props to show.
- if (node.tagName === 'div' && typeof childArray[0] === 'string' && /^\s+$/.test(childArray[0]) && React.isValidElement(childArray[1]) && childArray[1].type === CodeProps) {
+ if (
+ node.tagName === 'div' &&
+ typeof childArray[0] === 'string' &&
+ /^\s+$/.test(childArray[0]) &&
+ React.isValidElement(childArray[1]) &&
+ childArray[1].type === CodeProps
+ ) {
// If the only thing after CodeProps is the newline from div processing, exclude it (CodeProps handles its own newlines).
// Otherwise, include all trailing content.
- childArray = childArray.length === 3 && childArray[2] === '\n'
- ? childArray.slice(1, 2)
- : childArray.slice(1);
+ childArray =
+ childArray.length === 3 && childArray[2] === '\n'
+ ? childArray.slice(1, 2)
+ : childArray.slice(1);
}
let children = childArray.length === 1 ? childArray[0] : childArray;
@@ -284,22 +318,20 @@ function renderHast(node: HastNode | HastTextNode, key: string, links?: Links, i
if (links && typeof children === 'string' && links[children]) {
let link = links[children];
return (
-
+
{children}
);
}
// Link to imported files.
- if (properties?.className === 'string' && typeof children === 'string' && /^['"]\.\//.test(children)) {
+ if (
+ properties?.className === 'string' &&
+ typeof children === 'string' &&
+ /^['"]\.\//.test(children)
+ ) {
return (
-
+
);
@@ -319,7 +351,12 @@ function renderHast(node: HastNode | HastTextNode, key: string, links?: Links, i
return [tokenType[0], children];
}
- let className = node.properties?.className.split(' ').map(c => styles[c]).filter(Boolean).join(' ') || undefined;
+ let className =
+ node.properties?.className
+ .split(' ')
+ .map(c => styles[c])
+ .filter(Boolean)
+ .join(' ') || undefined;
return React.createElement(type, {...properties, className, key, tokens: childArray});
} else {
// @ts-ignore
@@ -327,12 +364,19 @@ function renderHast(node: HastNode | HastTextNode, key: string, links?: Links, i
}
}
-function renderChildren(children: (HastNode | HastTextNode)[], key: string, links?: Links): Token[] {
+function renderChildren(
+ children: (HastNode | HastTextNode)[],
+ key: string,
+ links?: Links
+): Token[] {
let childArray: Token[] = [];
let type = -1;
let stringIndex = -1;
for (let [i, child] of children.entries()) {
- let indent = i === 1 && stringIndex >= 0 && /^\s+$/.test(childArray[stringIndex] as string) ? childArray[stringIndex] as string : '';
+ let indent =
+ i === 1 && stringIndex >= 0 && /^\s+$/.test(childArray[stringIndex] as string)
+ ? (childArray[stringIndex] as string)
+ : '';
let childNode = renderHast(child, `${key}.${i}`, links, indent);
let childNodes = Array.isArray(childNode) ? childNode : [childNode];
let childIndex = 0;
@@ -385,9 +429,17 @@ function highlightDiff(code: string) {
let result: ReactNode[] = [];
for (let line of lines) {
if (line[0] === '-') {
- result.push({line} );
+ result.push(
+
+ {line}
+
+ );
} else if (line[0] === '+') {
- result.push({line} );
+ result.push(
+
+ {line}
+
+ );
} else {
result.push(line);
}
diff --git a/packages/dev/s2-docs/src/CodeBlock.tsx b/packages/dev/s2-docs/src/CodeBlock.tsx
index e4354578cdf..b51b32ebf6f 100644
--- a/packages/dev/s2-docs/src/CodeBlock.tsx
+++ b/packages/dev/s2-docs/src/CodeBlock.tsx
@@ -61,16 +61,24 @@ export const standaloneCode = style({
});
interface CodeBlockProps extends VisualExampleProps {
- render?: ReactNode,
- children: string,
- dir?: string,
- files?: string[],
- expanded?: boolean,
- hidden?: boolean,
- showCoachMark?: boolean
+ render?: ReactNode;
+ children: string;
+ dir?: string;
+ files?: string[];
+ expanded?: boolean;
+ hidden?: boolean;
+ showCoachMark?: boolean;
}
-export function CodeBlock({render, children, dir, files, expanded, hidden, ...props}: CodeBlockProps) {
+export function CodeBlock({
+ render,
+ children,
+ dir,
+ files,
+ expanded,
+ hidden,
+ ...props
+}: CodeBlockProps) {
if (hidden) {
return null;
}
@@ -80,12 +88,18 @@ export function CodeBlock({render, children, dir, files, expanded, hidden, ...pr
if (!render) {
return (
- {displayCode}
+
+ {displayCode}
+
);
}
- let resolveFrom = path.resolve('pages', dir || (props.type === 's2' ? 's2' : 'react-aria'), 'index.tsx');
+ let resolveFrom = path.resolve(
+ 'pages',
+ dir || (props.type === 's2' ? 's2' : 'react-aria'),
+ 'index.tsx'
+ );
let downloadFiles = getExampleFiles(resolveFrom, children, props.type);
let code = (
@@ -101,15 +115,14 @@ export function CodeBlock({render, children, dir, files, expanded, hidden, ...pr
component={render}
files={files}
downloadFiles={downloadFiles}
- code={code} />
+ code={code}
+ />
);
}
let content = (
-
+
{code}
@@ -117,11 +130,9 @@ export function CodeBlock({render, children, dir, files, expanded, hidden, ...pr
return (
-
+
- {files ?
+ {files ? (
{content}
- : content}
+ ) : (
+ content
+ )}
);
}
-export function CodeBlockBase({children, lang}: {children: string, lang: string}) {
+export function CodeBlockBase({children, lang}: {children: string; lang: string}) {
// @ts-ignore
let highlighted = highlight(children, Language[lang.toUpperCase()]);
return (
-
+
);
}
interface TruncatedCodeProps extends ICodeProps {
- children: string,
- maxLines?: number
+ children: string;
+ maxLines?: number;
}
function TruncatedCode({children, maxLines = 6, ...props}: TruncatedCodeProps) {
let lines = children.split('\n');
- return lines.length > maxLines
- ? (
+ return lines.length > maxLines ? (
{children}
- )
- : (
+ ) : (
;
@@ -197,7 +219,12 @@ export function Files({children, files, downloadFiles, type, defaultSelected, ma
if (!files[name]) {
extraFiles[name] = (
- {downloadFiles[name].contents}
+
+ {downloadFiles[name].contents}
+
);
}
@@ -219,11 +246,23 @@ export function Files({children, files, downloadFiles, type, defaultSelected, ma
const readFile = cache((file: string) => fs.readFileSync(file, 'utf8'));
-export function File({filename, maxLines, type}: {filename: string, maxLines?: number, type?: 'vanilla' | 'tailwind' | 's2'}) {
- let contents = readFile(path.isAbsolute(filename) ? filename : path.resolve('../../../', filename)).replace(/(vanilla-starter|tailwind-starter)\//g, './');
+export function File({
+ filename,
+ maxLines,
+ type
+}: {
+ filename: string;
+ maxLines?: number;
+ type?: 'vanilla' | 'tailwind' | 's2';
+}) {
+ let contents = readFile(
+ path.isAbsolute(filename) ? filename : path.resolve('../../../', filename)
+ ).replace(/(vanilla-starter|tailwind-starter)\//g, './');
return (
- {contents}
+
+ {contents}
+
);
}
@@ -246,14 +285,16 @@ export function getFiles(files: string[], type: string | undefined, npmDeps = {}
}
if (type === 'tailwind' && !fileContents['index.css']) {
- fileContents['index.css'] = readFileReplace(path.resolve('../../../starters/tailwind/src/index.css'));
+ fileContents['index.css'] = readFileReplace(
+ path.resolve('../../../starters/tailwind/src/index.css')
+ );
}
return {files: fileContents, deps: npmDeps};
}
function findAllFiles(files: string[], npmDeps = {}) {
- files = files.map(file => path.isAbsolute(file) ? file : path.resolve('../../../', file));
+ files = files.map(file => (path.isAbsolute(file) ? file : path.resolve('../../../', file)));
let queue: string[] = [...files];
let allFiles = new Set();
@@ -277,7 +318,10 @@ function findAllFiles(files: string[], npmDeps = {}) {
function parseFile(file: string, contents: string, npmDeps = {}, urls = {}) {
let deps = new Set();
for (let [, specifier] of contents.matchAll(/import (?:.|\n)*?['"](.+?)['"]/g)) {
- specifier = specifier.replace(/(vanilla-starter|tailwind-starter)\//g, (m, s) => 'starters/' + (s === 'vanilla-starter' ? 'docs' : 'tailwind') + '/src/');
+ specifier = specifier.replace(
+ /(vanilla-starter|tailwind-starter)\//g,
+ (m, s) => 'starters/' + (s === 'vanilla-starter' ? 'docs' : 'tailwind') + '/src/'
+ );
if (specifier.startsWith('url:')) {
urls[specifier] = resolveUrl(specifier.slice(4), file);
@@ -285,12 +329,16 @@ function parseFile(file: string, contents: string, npmDeps = {}, urls = {}) {
}
if (!/^(\.|starters)/.test(specifier)) {
- let dep = specifier.startsWith('@') ? specifier.split('/').slice(0, 2).join('/') : specifier.split('/')[0];
+ let dep = specifier.startsWith('@')
+ ? specifier.split('/').slice(0, 2).join('/')
+ : specifier.split('/')[0];
npmDeps[dep] ??= '^' + getPackageVersion(dep);
continue;
}
- let resolved = specifier.startsWith('.') ? path.resolve(path.dirname(file), specifier) : path.resolve('../../../' + specifier);
+ let resolved = specifier.startsWith('.')
+ ? path.resolve(path.dirname(file), specifier)
+ : path.resolve('../../../' + specifier);
if (path.extname(resolved) === '') {
if (fs.existsSync(resolved + '.tsx')) {
resolved += '.tsx';
@@ -307,14 +355,14 @@ function parseFile(file: string, contents: string, npmDeps = {}, urls = {}) {
export interface DownloadFiles {
files: {
- [name: string]: {contents: string}
- },
+ [name: string]: {contents: string};
+ };
deps: {
- [name: string]: string
- },
+ [name: string]: string;
+ };
urls?: {
- [url: string]: string
- }
+ [url: string]: string;
+ };
}
function getExampleFiles(file: string, contents: string, type: string | undefined): DownloadFiles {
diff --git a/packages/dev/s2-docs/src/CodeClient.tsx b/packages/dev/s2-docs/src/CodeClient.tsx
index 918ab700911..f82a69eb30c 100644
--- a/packages/dev/s2-docs/src/CodeClient.tsx
+++ b/packages/dev/s2-docs/src/CodeClient.tsx
@@ -15,7 +15,7 @@ const styles = [
];
interface CodeClientProps {
- tokens: Token[]
+ tokens: Token[];
}
export function CodeClient({tokens}: CodeClientProps) {
@@ -28,7 +28,11 @@ export function CodeClient({tokens}: CodeClientProps) {
let type = value;
value = tokens[i++];
let child = Array.isArray(value) ? : value;
- children.push({child} );
+ children.push(
+
+ {child}
+
+ );
} else if (Array.isArray(value)) {
// A nested array of tokens.
children.push( );
diff --git a/packages/dev/s2-docs/src/CodeFold.tsx b/packages/dev/s2-docs/src/CodeFold.tsx
index 0077b76aeab..fedf205b5ca 100644
--- a/packages/dev/s2-docs/src/CodeFold.tsx
+++ b/packages/dev/s2-docs/src/CodeFold.tsx
@@ -117,22 +117,38 @@ export function CodeFold({tokens}) {
return (
- {({isExpanded}) => (<>
-
- {({isHovered, isPressed, isFocusVisible}) => (<>
-
-
- {!isExpanded
- ? <> >
- : null}
- >)}
-
-
-
-
- >)}
+ {({isExpanded}) => (
+ <>
+
+ {({isHovered, isPressed, isFocusVisible}) => (
+ <>
+
+
+ {!isExpanded ? (
+ <>
+
+
+
+
+
+
+ >
+ ) : null}
+ >
+ )}
+
+
+
+
+ >
+ )}
);
}
diff --git a/packages/dev/s2-docs/src/CodePlatter.tsx b/packages/dev/s2-docs/src/CodePlatter.tsx
index cead892fbd1..f695fc96ebf 100644
--- a/packages/dev/s2-docs/src/CodePlatter.tsx
+++ b/packages/dev/s2-docs/src/CodePlatter.tsx
@@ -1,6 +1,24 @@
'use client';
-import {ActionButton, ActionButtonGroup, Button, ButtonGroup, Content, createIcon, Dialog, DialogContainer, Heading, Link, Menu, MenuItem, MenuTrigger, Text, ToastQueue, Tooltip, TooltipTrigger} from '@react-spectrum/s2';
+import {
+ ActionButton,
+ ActionButtonGroup,
+ Button,
+ ButtonGroup,
+ Content,
+ createIcon,
+ Dialog,
+ DialogContainer,
+ Heading,
+ Link,
+ Menu,
+ MenuItem,
+ MenuTrigger,
+ Text,
+ ToastQueue,
+ Tooltip,
+ TooltipTrigger
+} from '@react-spectrum/s2';
import {CopyButton} from './CopyButton';
import {createStackBlitz} from './StackBlitz';
import Download from '@react-spectrum/s2/icons/Download';
@@ -12,7 +30,15 @@ import LinkIcon from '@react-spectrum/s2/icons/Link';
import OpenIn from '@react-spectrum/s2/icons/OpenIn';
// import Polygon4 from '@react-spectrum/s2/icons/Polygon4';
import Prompt from '@react-spectrum/s2/icons/Prompt';
-import React, {createContext, ProviderProps, ReactNode, RefObject, useContext, useRef, useState} from 'react';
+import React, {
+ createContext,
+ ProviderProps,
+ ReactNode,
+ RefObject,
+ useContext,
+ useRef,
+ useState
+} from 'react';
import {ShadcnCommand} from './ShadcnCommand';
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
import {zip} from './zip';
@@ -36,13 +62,13 @@ const platterStyle = style({
});
interface CodePlatterProps {
- children: ReactNode,
- type?: 'vanilla' | 'tailwind' | 's2',
- showCoachMark?: boolean
+ children: ReactNode;
+ type?: 'vanilla' | 'tailwind' | 's2';
+ showCoachMark?: boolean;
}
interface CodePlatterContextValue {
- library: Library
+ library: Library;
}
const CodePlatterContext = createContext({library: 'react-spectrum'});
@@ -51,7 +77,7 @@ export function CodePlatterProvider(props: CodePlatterContextValue & {children:
}
interface FileProviderContextValue extends DownloadFiles {
- entry?: string
+ entry?: string;
}
const FileProviderContext = createContext(null);
@@ -59,8 +85,10 @@ export function FileProvider(props: ProviderProps ;
}
-const ShadcnContext = createContext<{type: 'vanilla' | 'tailwind', component: string} | null>(null);
-export function ShadcnProvider(props: ProviderProps<{type: 'vanilla' | 'tailwind', component: string} | null>) {
+const ShadcnContext = createContext<{type: 'vanilla' | 'tailwind'; component: string} | null>(null);
+export function ShadcnProvider(
+ props: ProviderProps<{type: 'vanilla' | 'tailwind'; component: string} | null>
+) {
return ;
}
@@ -90,96 +118,102 @@ export function CodePlatter({children, type, showCoachMark}: CodePlatterProps) {
return (
-
+
- {(shareUrl || files || shadcn) &&
-
-
-
-
- Open in…
-
-
- {shareUrl &&
- {
- // Find previous heading element to get hash.
- let url = new URL(shareUrl, location.href);
- let node: Element | null = codeRef.current;
-
- // Search for the nearest heading by walking up the tree and checking previous siblings
- while (node && node.tagName !== 'ARTICLE') {
- // Check previous siblings
- let sibling = node.previousElementSibling;
- while (sibling) {
- if (sibling instanceof HTMLHeadingElement) {
- node = sibling;
- break;
+ {(shareUrl || files || shadcn) && (
+
+
+
+
+
+ Open in…
+
+
+ {shareUrl && (
+ {
+ // Find previous heading element to get hash.
+ let url = new URL(shareUrl, location.href);
+ let node: Element | null = codeRef.current;
+
+ // Search for the nearest heading by walking up the tree and checking previous siblings
+ while (node && node.tagName !== 'ARTICLE') {
+ // Check previous siblings
+ let sibling = node.previousElementSibling;
+ while (sibling) {
+ if (sibling instanceof HTMLHeadingElement) {
+ node = sibling;
+ break;
+ }
+ // Also check inside the sibling for headings
+ let headingInSibling = sibling.querySelector('h1, h2, h3, h4, h5, h6');
+ if (headingInSibling instanceof HTMLHeadingElement) {
+ node = headingInSibling;
+ break;
+ }
+ sibling = sibling.previousElementSibling;
}
- // Also check inside the sibling for headings
- let headingInSibling = sibling.querySelector('h1, h2, h3, h4, h5, h6');
- if (headingInSibling instanceof HTMLHeadingElement) {
- node = headingInSibling;
+
+ if (node instanceof HTMLHeadingElement) {
break;
}
- sibling = sibling.previousElementSibling;
+
+ // Move up to parent
+ node = node.parentElement;
}
-
- if (node instanceof HTMLHeadingElement) {
- break;
+
+ if (node instanceof HTMLHeadingElement && node.id) {
+ url.hash = '#' + node.id;
}
-
- // Move up to parent
- node = node.parentElement;
- }
-
- if (node instanceof HTMLHeadingElement && node.id) {
- url.hash = '#' + node.id;
- }
- navigator.clipboard.writeText(url.toString()).catch(() => {
- ToastQueue.negative('Failed to copy link.');
- });
- }}>
-
- Copy link
-
- }
- {files &&
- {
- let filesToDownload = getCodeSandboxFiles(getExampleFiles(codeRef, files, urls, entry), deps, type, entry);
- let filesToZip = {};
- for (let key in filesToDownload) {
- if (filesToDownload[key] && !key.startsWith('.codesandbox') && !key.startsWith('.devcontainer')) {
- filesToZip[key] = filesToDownload[key].content;
+ navigator.clipboard.writeText(url.toString()).catch(() => {
+ ToastQueue.negative('Failed to copy link.');
+ });
+ }}>
+
+ Copy link
+
+ )}
+ {files && (
+ {
+ let filesToDownload = getCodeSandboxFiles(
+ getExampleFiles(codeRef, files, urls, entry),
+ deps,
+ type,
+ entry
+ );
+ let filesToZip = {};
+ for (let key in filesToDownload) {
+ if (
+ filesToDownload[key] &&
+ !key.startsWith('.codesandbox') &&
+ !key.startsWith('.devcontainer')
+ ) {
+ filesToZip[key] = filesToDownload[key].content;
+ }
}
- }
- let blob = zip(filesToZip);
-
- let a = document.createElement('a');
- a.href = URL.createObjectURL(blob);
- a.download = 'example.zip';
- a.hidden = true;
- document.body.appendChild(a);
-
- a.click();
- a.remove();
- }}>
-
- Download ZIP
-
- }
- {shadcn &&
- setShowShadcn(true)}>
-
- Install with shadcn
-
- }
- {/* {files &&
+ let blob = zip(filesToZip);
+
+ let a = document.createElement('a');
+ a.href = URL.createObjectURL(blob);
+ a.download = 'example.zip';
+ a.hidden = true;
+ document.body.appendChild(a);
+
+ a.click();
+ a.remove();
+ }}>
+
+ Download ZIP
+
+ )}
+ {shadcn && (
+ setShowShadcn(true)}>
+
+ Install with shadcn
+
+ )}
+ {/* {files &&
{
setShowCodeSandbox(true);
@@ -188,16 +222,21 @@ export function CodePlatter({children, type, showCoachMark}: CodePlatterProps) {
Open in CodeSandbox
} */}
- {files &&
- {
- createStackBlitz(getExampleFiles(codeRef, files, urls, entry), deps, type, entry);
- }}>
-
- Open in StackBlitz
-
- }
- {/* registryUrl &&
+ {files && (
+ {
+ createStackBlitz(
+ getExampleFiles(codeRef, files, urls, entry),
+ deps,
+ type,
+ entry
+ );
+ }}>
+
+ Open in StackBlitz
+
+ )}
+ {/* registryUrl &&
Open in v0
*/}
-
- }
+
+
+ )}
-
- {children}
-
+
{children}
{/*
setShowCodeSandbox(false)}>
{showCodeSandbox &&
}
*/}
setShowShadcn(false)}>
- {showShadcn &&
-
- }
+ {showShadcn && }
);
@@ -243,14 +279,15 @@ const pre = style({
});
export function Pre({children}) {
- return (
-
- {children}
-
- );
+ return {children} ;
}
-function getExampleFiles(codeRef: RefObject, files: DownloadFiles['files'], urls: {[name: string]: string}, entry: string | undefined): DownloadFiles['files'] {
+function getExampleFiles(
+ codeRef: RefObject,
+ files: DownloadFiles['files'],
+ urls: {[name: string]: string},
+ entry: string | undefined
+): DownloadFiles['files'] {
if (!entry) {
return {
...files,
@@ -265,13 +302,17 @@ function getTextContent(element: Element) {
// Manually walk over text nodes inside the element and concatenate them.
// This is like element.textContent except we skip anything inside an element with data-no-copy.
let result = '';
- let walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT, node => {
- if (node.nodeType === Node.ELEMENT_NODE && (node as Element).hasAttribute('data-no-copy')) {
- result += '\n';
- return NodeFilter.FILTER_REJECT;
+ let walker = document.createTreeWalker(
+ element,
+ NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT,
+ node => {
+ if (node.nodeType === Node.ELEMENT_NODE && (node as Element).hasAttribute('data-no-copy')) {
+ result += '\n';
+ return NodeFilter.FILTER_REJECT;
+ }
+ return node.nodeType === Node.TEXT_NODE ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
}
- return node.nodeType === Node.TEXT_NODE ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
- });
+ );
let node = walker.nextNode();
while (node) {
@@ -293,27 +334,32 @@ function getExampleCode(codeRef: RefObject, urls: {[name:
if (!code.includes('export default function')) {
// Export the last function
- code = code.replace(/\nfunction ([^(]+)((.|\n)+\n\}\n?)$/, '\nexport default function Example$2');
+ code = code.replace(
+ /\nfunction ([^(]+)((.|\n)+\n\}\n?)$/,
+ '\nexport default function Example$2'
+ );
}
- return code
- // Add function wrapper around raw JSX in examples.
- .replace(/\n<((?:.|\n)+)/, (_, code) => {
- let res = '\nexport default function Example() {\n return (\n <';
- let lines = code.split('\n');
- res += lines.shift();
-
- for (let line of lines) {
- res += '\n ' + line;
- }
+ return (
+ code
+ // Add function wrapper around raw JSX in examples.
+ .replace(/\n<((?:.|\n)+)/, (_, code) => {
+ let res = '\nexport default function Example() {\n return (\n <';
+ let lines = code.split('\n');
+ res += lines.shift();
+
+ for (let line of lines) {
+ res += '\n ' + line;
+ }
- res += '\n );\n}\n';
- return res;
- })
- // Resolve urls
- .replace(/import (.*?) from ['"](url:.*?)['"]/g, (_, name, specifier) => {
- return `const ${name} = '${urls[specifier]}'`;
- });
+ res += '\n );\n}\n';
+ return res;
+ })
+ // Resolve urls
+ .replace(/import (.*?) from ['"](url:.*?)['"]/g, (_, name, specifier) => {
+ return `const ${name} = '${urls[specifier]}'`;
+ })
+ );
}
// const V0 = createIcon(props => (
@@ -329,7 +375,11 @@ function getExampleCode(codeRef: RefObject, urls: {[name:
const Flash = createIcon(props => (
-
+
));
@@ -339,26 +389,36 @@ function ShadcnDialog() {
return (
- {({close}) => (<>
- Install with shadcn
-
- Use the shadcn CLI to install {component} and its dependencies into your project.
-
-
-
- Cancel
- {
- navigator.clipboard.writeText(preRef.current!.textContent!).catch(() => {
- ToastQueue.negative('Failed to copy command. Please try again.');
- });
- close();
- }}>
- Copy and close
-
-
- >)}
+ {({close}) => (
+ <>
+ Install with shadcn
+
+
+ Use the{' '}
+
+ shadcn CLI
+ {' '}
+ to install {component} and its dependencies into your project.
+
+
+
+
+
+ Cancel
+
+ {
+ navigator.clipboard.writeText(preRef.current!.textContent!).catch(() => {
+ ToastQueue.negative('Failed to copy command. Please try again.');
+ });
+ close();
+ }}>
+ Copy and close
+
+
+ >
+ )}
);
}
@@ -404,7 +464,6 @@ const pulseAnimation = keyframes(`
}
`);
-
const indicator = style({
animation: pulseAnimation,
animationDuration: 2500,
@@ -445,9 +504,5 @@ function Toolbar({children, showCoachMark}) {
);
}
- return (
-
- {children}
-
- );
+ return {children}
;
}
diff --git a/packages/dev/s2-docs/src/CodeSandbox.tsx b/packages/dev/s2-docs/src/CodeSandbox.tsx
index 1f7b32ce9cb..0325b748dd0 100644
--- a/packages/dev/s2-docs/src/CodeSandbox.tsx
+++ b/packages/dev/s2-docs/src/CodeSandbox.tsx
@@ -29,9 +29,11 @@ export function createCodeSandbox(
input.type = 'hidden';
input.name = 'parameters';
- input.value = LZString.compressToBase64(JSON.stringify({
- files: getCodeSandboxFiles(files, deps, type, entry)
- }));
+ input.value = LZString.compressToBase64(
+ JSON.stringify({
+ files: getCodeSandboxFiles(files, deps, type, entry)
+ })
+ );
form.appendChild(input);
document.body.appendChild(form);
@@ -51,7 +53,7 @@ const devDependencies = {
'@types/react-dom': '^19',
parcel: '^2',
typescript: '^5',
- 'tailwindcss': '^4',
+ tailwindcss: '^4',
'@tailwindcss/postcss': '^4',
postcss: '^8',
'tailwindcss-react-aria-components': '^2',
@@ -74,61 +76,84 @@ export function getCodeSandboxFiles(
let entryName = entry.split('/').pop()!.split('.')[0];
return {
'.codesandbox/tasks.json': {
- content: JSON.stringify({
- setupTasks: [
+ content:
+ JSON.stringify(
{
- name: 'Installing Dependencies',
- command: 'pnpm install'
- }
- ],
- tasks: {
- start: {
- name: 'start',
- command: 'pnpm start',
- runAtStart: true,
- preview: {
- port: 5173
+ setupTasks: [
+ {
+ name: 'Installing Dependencies',
+ command: 'pnpm install'
+ }
+ ],
+ tasks: {
+ start: {
+ name: 'start',
+ command: 'pnpm start',
+ runAtStart: true,
+ preview: {
+ port: 5173
+ }
+ },
+ build: {
+ name: 'build',
+ command: 'pnpm build',
+ runAtStart: false
+ }
}
},
- build: {
- name: 'build',
- command: 'pnpm build',
- runAtStart: false
- }
- }
- }, null, 2) + '\n'
+ null,
+ 2
+ ) + '\n'
},
'.devcontainer/devcontainer.json': {
- content: JSON.stringify({
- 'name': 'Devcontainer',
- 'image': 'ghcr.io/codesandbox/devcontainers/typescript-node:latest'
- }, null, 2) + '\n'
+ content:
+ JSON.stringify(
+ {
+ name: 'Devcontainer',
+ image: 'ghcr.io/codesandbox/devcontainers/typescript-node:latest'
+ },
+ null,
+ 2
+ ) + '\n'
},
'package.json': {
- content: JSON.stringify({
- name: type === 's2' ? 's2-starter' : 'react-aria-starter',
- private: true,
- version: '0.0.0',
- source: 'src/index.html',
- scripts: {
- start: 'parcel',
- build: 'parcel build'
- },
- dependencies: {
- react: '^19',
- 'react-dom': '^19',
- ...deps
- },
- devDependencies: devDependencies[type]
- }, null, 2) + '\n'
+ content:
+ JSON.stringify(
+ {
+ name: type === 's2' ? 's2-starter' : 'react-aria-starter',
+ private: true,
+ version: '0.0.0',
+ source: 'src/index.html',
+ scripts: {
+ start: 'parcel',
+ build: 'parcel build'
+ },
+ dependencies: {
+ react: '^19',
+ 'react-dom': '^19',
+ ...deps
+ },
+ devDependencies: devDependencies[type]
+ },
+ null,
+ 2
+ ) + '\n'
},
- '.postcssrc': type === 'tailwind' ? {
- content: JSON.stringify({
- plugins: {
- '@tailwindcss/postcss': {}
- }
- }, null, 2) + '\n'
- } : undefined,
+ '.postcssrc':
+ type === 'tailwind'
+ ? {
+ content:
+ JSON.stringify(
+ {
+ plugins: {
+ '@tailwindcss/postcss': {}
+ }
+ },
+ null,
+ 2
+ ) + '\n'
+ }
+ : undefined,
'src/index.html': {
content: `
@@ -152,19 +177,26 @@ createRoot(document.getElementById('root')!).render(<${entryName} />);
`
},
'tsconfig.json': {
- content: JSON.stringify({
- compilerOptions: {
- 'target': 'ES2022',
- 'lib': ['ES2022', 'DOM', 'DOM.Iterable'],
- 'module': 'ESNext',
- strict: true,
- 'moduleResolution': 'bundler',
- 'noEmit': true,
- 'jsx': 'react-jsx'
- },
- 'include': ['src']
- }, null, 2) + '\n'
+ content:
+ JSON.stringify(
+ {
+ compilerOptions: {
+ target: 'ES2022',
+ lib: ['ES2022', 'DOM', 'DOM.Iterable'],
+ module: 'ESNext',
+ strict: true,
+ moduleResolution: 'bundler',
+ noEmit: true,
+ jsx: 'react-jsx'
+ },
+ include: ['src']
+ },
+ null,
+ 2
+ ) + '\n'
},
- ...Object.fromEntries(Object.entries(files).map(([name, file]) => ['src/' + name, {content: file.contents}]))
+ ...Object.fromEntries(
+ Object.entries(files).map(([name, file]) => ['src/' + name, {content: file.contents}])
+ )
};
}
diff --git a/packages/dev/s2-docs/src/ColorSearchView.tsx b/packages/dev/s2-docs/src/ColorSearchView.tsx
index 2032ddb1d2a..357de59a318 100644
--- a/packages/dev/s2-docs/src/ColorSearchView.tsx
+++ b/packages/dev/s2-docs/src/ColorSearchView.tsx
@@ -1,13 +1,21 @@
'use client';
-import {Badge, Content, Heading, IllustratedMessage, Link, pressScale, Text} from '@react-spectrum/s2';
+import {
+ Badge,
+ Content,
+ Heading,
+ IllustratedMessage,
+ Link,
+ pressScale,
+ Text
+} from '@react-spectrum/s2';
import Checkmark from '@react-spectrum/s2/icons/Checkmark';
import CheckmarkCircle from '@react-spectrum/s2/icons/CheckmarkCircle';
import {colorSwatch, getColorScale} from './color.macro' with {type: 'macro'};
import {focusRing, iconStyle, style} from '@react-spectrum/s2/style' with {type: 'macro'};
import {Header, ListBox, ListBoxItem, ListBoxSection} from 'react-aria-components';
import {InfoMessage} from './colorSearchData';
-
+
import NoSearchResults from '@react-spectrum/s2/illustrations/linear/NoSearchResults';
import React, {useCallback, useEffect, useRef, useState} from 'react';
import Similar from '@react-spectrum/s2/icons/Similar';
@@ -63,80 +71,80 @@ const headerStyle = style({
});
const backgroundSwatches: Record = {
- 'black': colorSwatch('black'),
- 'white': colorSwatch('white'),
- 'base': colorSwatch('base'),
+ black: colorSwatch('black'),
+ white: colorSwatch('white'),
+ base: colorSwatch('base'),
'layer-1': colorSwatch('layer-1'),
'layer-2': colorSwatch('layer-2'),
- 'pasteboard': colorSwatch('pasteboard'),
- 'elevated': colorSwatch('elevated'),
- 'accent': colorSwatch('accent'),
+ pasteboard: colorSwatch('pasteboard'),
+ elevated: colorSwatch('elevated'),
+ accent: colorSwatch('accent'),
'accent-subtle': colorSwatch('accent-subtle'),
- 'neutral': colorSwatch('neutral'),
+ neutral: colorSwatch('neutral'),
'neutral-subdued': colorSwatch('neutral-subdued'),
'neutral-subtle': colorSwatch('neutral-subtle'),
- 'negative': colorSwatch('negative'),
+ negative: colorSwatch('negative'),
'negative-subtle': colorSwatch('negative-subtle'),
- 'informative': colorSwatch('informative'),
+ informative: colorSwatch('informative'),
'informative-subtle': colorSwatch('informative-subtle'),
- 'positive': colorSwatch('positive'),
+ positive: colorSwatch('positive'),
'positive-subtle': colorSwatch('positive-subtle'),
- 'notice': colorSwatch('notice'),
+ notice: colorSwatch('notice'),
'notice-subtle': colorSwatch('notice-subtle'),
- 'gray': colorSwatch('gray'),
+ gray: colorSwatch('gray'),
'gray-subtle': colorSwatch('gray-subtle'),
- 'red': colorSwatch('red'),
+ red: colorSwatch('red'),
'red-subtle': colorSwatch('red-subtle'),
- 'orange': colorSwatch('orange'),
+ orange: colorSwatch('orange'),
'orange-subtle': colorSwatch('orange-subtle'),
- 'yellow': colorSwatch('yellow'),
+ yellow: colorSwatch('yellow'),
'yellow-subtle': colorSwatch('yellow-subtle'),
- 'chartreuse': colorSwatch('chartreuse'),
+ chartreuse: colorSwatch('chartreuse'),
'chartreuse-subtle': colorSwatch('chartreuse-subtle'),
- 'celery': colorSwatch('celery'),
+ celery: colorSwatch('celery'),
'celery-subtle': colorSwatch('celery-subtle'),
- 'green': colorSwatch('green'),
+ green: colorSwatch('green'),
'green-subtle': colorSwatch('green-subtle'),
- 'seafoam': colorSwatch('seafoam'),
+ seafoam: colorSwatch('seafoam'),
'seafoam-subtle': colorSwatch('seafoam-subtle'),
- 'cyan': colorSwatch('cyan'),
+ cyan: colorSwatch('cyan'),
'cyan-subtle': colorSwatch('cyan-subtle'),
- 'blue': colorSwatch('blue'),
+ blue: colorSwatch('blue'),
'blue-subtle': colorSwatch('blue-subtle'),
- 'indigo': colorSwatch('indigo'),
+ indigo: colorSwatch('indigo'),
'indigo-subtle': colorSwatch('indigo-subtle'),
- 'purple': colorSwatch('purple'),
+ purple: colorSwatch('purple'),
'purple-subtle': colorSwatch('purple-subtle'),
- 'fuchsia': colorSwatch('fuchsia'),
+ fuchsia: colorSwatch('fuchsia'),
'fuchsia-subtle': colorSwatch('fuchsia-subtle'),
- 'magenta': colorSwatch('magenta'),
+ magenta: colorSwatch('magenta'),
'magenta-subtle': colorSwatch('magenta-subtle'),
- 'pink': colorSwatch('pink'),
+ pink: colorSwatch('pink'),
'pink-subtle': colorSwatch('pink-subtle'),
- 'turquoise': colorSwatch('turquoise'),
+ turquoise: colorSwatch('turquoise'),
'turquoise-subtle': colorSwatch('turquoise-subtle'),
- 'cinnamon': colorSwatch('cinnamon'),
+ cinnamon: colorSwatch('cinnamon'),
'cinnamon-subtle': colorSwatch('cinnamon-subtle'),
- 'brown': colorSwatch('brown'),
+ brown: colorSwatch('brown'),
'brown-subtle': colorSwatch('brown-subtle'),
- 'silver': colorSwatch('silver'),
+ silver: colorSwatch('silver'),
'silver-subtle': colorSwatch('silver-subtle'),
- 'disabled': colorSwatch('disabled')
+ disabled: colorSwatch('disabled')
};
const textSwatches: Record = {
- 'black': colorSwatch('black', 'color'),
- 'white': colorSwatch('white', 'color'),
- 'accent': colorSwatch('accent', 'color'),
- 'neutral': colorSwatch('neutral', 'color'),
+ black: colorSwatch('black', 'color'),
+ white: colorSwatch('white', 'color'),
+ accent: colorSwatch('accent', 'color'),
+ neutral: colorSwatch('neutral', 'color'),
'neutral-subdued': colorSwatch('neutral-subdued', 'color'),
- 'negative': colorSwatch('negative', 'color'),
- 'disabled': colorSwatch('disabled', 'color'),
- 'heading': colorSwatch('heading', 'color'),
- 'title': colorSwatch('title', 'color'),
- 'body': colorSwatch('body', 'color'),
- 'detail': colorSwatch('detail', 'color'),
- 'code': colorSwatch('code', 'color')
+ negative: colorSwatch('negative', 'color'),
+ disabled: colorSwatch('disabled', 'color'),
+ heading: colorSwatch('heading', 'color'),
+ title: colorSwatch('title', 'color'),
+ body: colorSwatch('body', 'color'),
+ detail: colorSwatch('detail', 'color'),
+ code: colorSwatch('code', 'color')
};
const accentScale = getColorScale('accent-color');
@@ -191,21 +199,25 @@ const scaleSwatches: Record = {
...Object.fromEntries(cinnamonScale)
};
-
interface ColorSearchViewProps {
filteredItems: Array<{
- id: string,
- name: string,
- items: Array<{name: string, section: string, type: string}>
- }>,
+ id: string;
+ name: string;
+ items: Array<{name: string; section: string; type: string}>;
+ }>;
/** Names of colors that exactly match the searched hex value. */
- exactMatches?: Set,
+ exactMatches?: Set;
/** Names of the closest matching colors when no exact matches exist. */
- closestMatches?: Set,
- listBoxClassName?: string
+ closestMatches?: Set;
+ listBoxClassName?: string;
}
-export function ColorSearchView({filteredItems, exactMatches = new Set(), closestMatches = new Set(), listBoxClassName}: ColorSearchViewProps) {
+export function ColorSearchView({
+ filteredItems,
+ exactMatches = new Set(),
+ closestMatches = new Set(),
+ listBoxClassName
+}: ColorSearchViewProps) {
const [copiedId, setCopiedId] = useState(null);
const timeout = useRef | null>(null);
@@ -221,21 +233,26 @@ export function ColorSearchView({filteredItems, exactMatches = new Set(), closes
if (timeout.current) {
clearTimeout(timeout.current);
}
- navigator.clipboard.writeText(colorName).then(() => {
- setCopiedId(itemId);
- timeout.current = setTimeout(() => setCopiedId(null), 2000);
- }).catch(() => {
- // noop
- });
+ navigator.clipboard
+ .writeText(colorName)
+ .then(() => {
+ setCopiedId(itemId);
+ timeout.current = setTimeout(() => setCopiedId(null), 2000);
+ })
+ .catch(() => {
+ // noop
+ });
}, []);
- const sections = filteredItems.map(section => ({
- ...section,
- items: section.items.map(item => ({
- ...item,
- id: `${section.id}-${item.name}`
+ const sections = filteredItems
+ .map(section => ({
+ ...section,
+ items: section.items.map(item => ({
+ ...item,
+ id: `${section.id}-${item.name}`
+ }))
}))
- })).filter(section => section.items.length > 0);
+ .filter(section => section.items.length > 0);
if (sections.length === 0) {
return (
@@ -249,10 +266,13 @@ export function ColorSearchView({filteredItems, exactMatches = new Set(), closes
return (
<>
- Press a color to copy its name. See styling for more information.
+
+ Press a color to copy its name. See styling for more
+ information.
+
{
+ onAction={key => {
for (const section of sections) {
const item = section.items.find(item => item.id === key.toString());
if (item) {
@@ -262,28 +282,32 @@ export function ColorSearchView({filteredItems, exactMatches = new Set(), closes
}
}}
layout="grid"
- className={listBoxClassName || style({
- width: 'full',
- display: 'flex',
- flexDirection: 'column',
- gap: 24,
- flexGrow: 1,
- overflow: 'auto',
- scrollPaddingY: 4
- })}
+ className={
+ listBoxClassName ||
+ style({
+ width: 'full',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 24,
+ flexGrow: 1,
+ overflow: 'auto',
+ scrollPaddingY: 4
+ })
+ }
dependencies={[copiedId, exactMatches, closestMatches]}
items={sections}>
{section => (
{section.items.map(item => (
-
+ isExactMatch={exactMatches.has(item.name)}
+ />
))}
)}
@@ -293,35 +317,44 @@ export function ColorSearchView({filteredItems, exactMatches = new Set(), closes
}
interface ColorItemProps {
- item: {id: string, name: string, type?: string, scale?: string},
- sectionId: string,
- isCopied?: boolean,
- isBestMatch?: boolean,
- isExactMatch?: boolean
+ item: {id: string; name: string; type?: string; scale?: string};
+ sectionId: string;
+ isCopied?: boolean;
+ isBestMatch?: boolean;
+ isExactMatch?: boolean;
}
-function ColorItem({item, sectionId, isCopied = false, isBestMatch = false, isExactMatch = false}: ColorItemProps) {
+function ColorItem({
+ item,
+ sectionId,
+ isCopied = false,
+ isBestMatch = false,
+ isExactMatch = false
+}: ColorItemProps) {
let ref = useRef(null);
-
+
// Look up the pre-generated swatch class for this color
- const swatchClass = sectionId === 'text'
- ? textSwatches[item.name]
- : backgroundSwatches[item.name] || scaleSwatches[item.name] || '';
-
+ const swatchClass =
+ sectionId === 'text'
+ ? textSwatches[item.name]
+ : backgroundSwatches[item.name] || scaleSwatches[item.name] || '';
+
return (
-
+ style={
+ {
+ width: '48px',
+ height: '48px',
+ '--s2-container-bg': 'var(--v)'
+ } as React.CSSProperties
+ }>
{isBestMatch && !isCopied ? (
-
{isExactMatch ? : }
@@ -372,7 +405,13 @@ function ColorItem({item, sectionId, isCopied = false, isBestMatch = false, isEx
style={{
opacity: isCopied ? 0 : 1
}}>
-
+
{item.name}
diff --git a/packages/dev/s2-docs/src/Command.tsx b/packages/dev/s2-docs/src/Command.tsx
index 22284c767f3..45ef28b8904 100644
--- a/packages/dev/s2-docs/src/Command.tsx
+++ b/packages/dev/s2-docs/src/Command.tsx
@@ -38,16 +38,18 @@ const preStyle = style({
export interface CommandProps {
/** The command to display. */
- command: string,
+ command: string;
/** Optional label preceding the code block. */
- label?: string
+ label?: string;
}
export function Command({command, label}: CommandProps) {
return (
- {label &&
{label}
}
+ {label && (
+
{label}
+ )}
{command}
diff --git a/packages/dev/s2-docs/src/ComponentCard.tsx b/packages/dev/s2-docs/src/ComponentCard.tsx
index 06a682e3ea5..b4606f1b969 100644
--- a/packages/dev/s2-docs/src/ComponentCard.tsx
+++ b/packages/dev/s2-docs/src/ComponentCard.tsx
@@ -160,7 +160,7 @@ import SliderDark from 'url:../assets/component-illustrations/dark/Slider.avif';
import SliderLight from 'url:../assets/component-illustrations/light/Slider.avif';
import StatusLightDark from 'url:../assets/component-illustrations/dark/StatusLight.avif';
import StatusLightLight from 'url:../assets/component-illustrations/light/StatusLight.avif';
-import {style} from '@react-spectrum/s2/style' with { type: 'macro' };
+import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
import StyleDark from 'url:../assets/component-illustrations/dark/Style.avif';
import StyleLight from 'url:../assets/component-illustrations/light/Style.avif';
import StyleMacroDark from 'url:../assets/component-illustrations/dark/StyleMacro.avif';
@@ -197,144 +197,144 @@ import WorkingWithAIDark from 'url:../assets/component-illustrations/dark/Workin
import WorkingWithAILight from 'url:../assets/component-illustrations/light/WorkingWithAI.avif';
export interface ComponentCardItem {
- id: string,
- name: string,
- href: string
+ id: string;
+ name: string;
+ href: string;
}
// Mapping from component names to their illustration [light, dark] tuple
const componentIllustrations: Record
= {
// Components
- 'Accordion': [AccordionLight, AccordionDark],
- 'ActionBar': [ActionBarLight, ActionBarDark],
- 'ActionButton': [ActionButtonLight, ActionButtonDark],
- 'ActionButtonGroup': [ActionGroupLight, ActionGroupDark],
- 'ActionMenu': [ActionMenuLight, ActionMenuDark],
- 'Autocomplete': [AutocompleteLight, AutocompleteDark],
- 'Avatar': [AvatarLight, AvatarDark],
- 'AvatarGroup': [AvatarGroupLight, AvatarGroupDark],
- 'Badge': [BadgeLight, BadgeDark],
- 'Breadcrumbs': [BreadcrumbsLight, BreadcrumbsDark],
- 'Button': [ButtonLight, ButtonDark],
- 'ButtonGroup': [ButtonGroupLight, ButtonGroupDark],
- 'Calendar': [CalendarLight, CalendarDark],
- 'Card': [CardLight, CardDark],
- 'CardView': [CardViewLight, CardViewDark],
- 'Checkbox': [CheckboxLight, CheckboxDark],
- 'CheckboxGroup': [CheckboxGroupLight, CheckboxGroupDark],
- 'ColorArea': [ColorAreaLight, ColorAreaDark],
- 'ColorField': [ColorFieldLight, ColorFieldDark],
- 'ColorPicker': [ColorPickerLight, ColorPickerDark],
- 'ColorSlider': [ColorSliderLight, ColorSliderDark],
- 'ColorSwatch': [ColorSwatchLight, ColorSwatchDark],
- 'ColorSwatchPicker': [ColorSwatchPickerLight, ColorSwatchPickerDark],
- 'ColorWheel': [ColorWheelLight, ColorWheelDark],
- 'ComboBox': [ComboBoxLight, ComboBoxDark],
- 'ContextualHelp': [ContextualHelpLight, ContextualHelpDark],
- 'DateField': [DateFieldLight, DateFieldDark],
- 'DatePicker': [DatePickerLight, DatePickerDark],
- 'DateRangePicker': [DateRangePickerLight, DateRangePickerDark],
- 'Dialog': [DialogLight, DialogDark],
- 'Disclosure': [DisclosureLight, DisclosureDark],
- 'DisclosureGroup': [AccordionLight, AccordionDark],
- 'Divider': [DividerLight, DividerDark],
- 'DropZone': [DropZoneLight, DropZoneDark],
- 'FileTrigger': [FileTriggerLight, FileTriggerDark],
- 'FocusRing': [FocusRingLight, FocusRingDark],
- 'FocusScope': [FocusScopeLight, FocusScopeDark],
- 'Form': [FormsLight, FormsDark],
- 'GridList': [CardViewLight, CardViewDark],
- 'Group': [GroupLight, GroupDark],
- 'Icons': [IconsLight, IconsDark],
- 'IllustratedMessage': [IllustratedMessageLight, IllustratedMessageDark],
- 'Illustrations': [IllustrationsLight, IllustrationsDark],
- 'Image': [ImageLight, ImageDark],
- 'InlineAlert': [InlineAlertLight, InlineAlertDark],
- 'Link': [LinkLight, LinkDark],
- 'LinkButton': [LinkButtonLight, LinkButtonDark],
- 'ListBox': [SelectionLight, SelectionDark],
- 'ListView': [ListViewLight, ListViewDark],
- 'Menu': [MenuLight, MenuDark],
- 'Meter': [MeterLight, MeterDark],
+ Accordion: [AccordionLight, AccordionDark],
+ ActionBar: [ActionBarLight, ActionBarDark],
+ ActionButton: [ActionButtonLight, ActionButtonDark],
+ ActionButtonGroup: [ActionGroupLight, ActionGroupDark],
+ ActionMenu: [ActionMenuLight, ActionMenuDark],
+ Autocomplete: [AutocompleteLight, AutocompleteDark],
+ Avatar: [AvatarLight, AvatarDark],
+ AvatarGroup: [AvatarGroupLight, AvatarGroupDark],
+ Badge: [BadgeLight, BadgeDark],
+ Breadcrumbs: [BreadcrumbsLight, BreadcrumbsDark],
+ Button: [ButtonLight, ButtonDark],
+ ButtonGroup: [ButtonGroupLight, ButtonGroupDark],
+ Calendar: [CalendarLight, CalendarDark],
+ Card: [CardLight, CardDark],
+ CardView: [CardViewLight, CardViewDark],
+ Checkbox: [CheckboxLight, CheckboxDark],
+ CheckboxGroup: [CheckboxGroupLight, CheckboxGroupDark],
+ ColorArea: [ColorAreaLight, ColorAreaDark],
+ ColorField: [ColorFieldLight, ColorFieldDark],
+ ColorPicker: [ColorPickerLight, ColorPickerDark],
+ ColorSlider: [ColorSliderLight, ColorSliderDark],
+ ColorSwatch: [ColorSwatchLight, ColorSwatchDark],
+ ColorSwatchPicker: [ColorSwatchPickerLight, ColorSwatchPickerDark],
+ ColorWheel: [ColorWheelLight, ColorWheelDark],
+ ComboBox: [ComboBoxLight, ComboBoxDark],
+ ContextualHelp: [ContextualHelpLight, ContextualHelpDark],
+ DateField: [DateFieldLight, DateFieldDark],
+ DatePicker: [DatePickerLight, DatePickerDark],
+ DateRangePicker: [DateRangePickerLight, DateRangePickerDark],
+ Dialog: [DialogLight, DialogDark],
+ Disclosure: [DisclosureLight, DisclosureDark],
+ DisclosureGroup: [AccordionLight, AccordionDark],
+ Divider: [DividerLight, DividerDark],
+ DropZone: [DropZoneLight, DropZoneDark],
+ FileTrigger: [FileTriggerLight, FileTriggerDark],
+ FocusRing: [FocusRingLight, FocusRingDark],
+ FocusScope: [FocusScopeLight, FocusScopeDark],
+ Form: [FormsLight, FormsDark],
+ GridList: [CardViewLight, CardViewDark],
+ Group: [GroupLight, GroupDark],
+ Icons: [IconsLight, IconsDark],
+ IllustratedMessage: [IllustratedMessageLight, IllustratedMessageDark],
+ Illustrations: [IllustrationsLight, IllustrationsDark],
+ Image: [ImageLight, ImageDark],
+ InlineAlert: [InlineAlertLight, InlineAlertDark],
+ Link: [LinkLight, LinkDark],
+ LinkButton: [LinkButtonLight, LinkButtonDark],
+ ListBox: [SelectionLight, SelectionDark],
+ ListView: [ListViewLight, ListViewDark],
+ Menu: [MenuLight, MenuDark],
+ Meter: [MeterLight, MeterDark],
'Migrating to Spectrum 2': [MigratingLight, MigratingDark],
- 'Modal': [DialogLight, DialogDark],
- 'NumberField': [NumberFieldLight, NumberFieldDark],
- 'Picker': [PickerLight, PickerDark],
- 'Popover': [PopoverLight, PopoverDark],
- 'ProgressBar': [ProgressBarLight, ProgressBarDark],
- 'ProgressCircle': [ProgressCircleLight, ProgressCircleDark],
- 'Provider': [ProviderLight, ProviderDark],
- 'RadioGroup': [RadioGroupLight, RadioGroupDark],
- 'RangeCalendar': [RangeCalendarLight, RangeCalendarDark],
- 'RangeSlider': [RangeSliderLight, RangeSliderDark],
- 'SearchField': [SearchFieldLight, SearchFieldDark],
- 'SegmentedControl': [SegmentedControlLight, SegmentedControlDark],
- 'Select': [PickerLight, PickerDark],
- 'SelectBoxGroup': [SelectBoxGroupLight, SelectBoxGroupDark],
- 'Separator': [DividerLight, DividerDark],
- 'Skeleton': [SkeletonLight, SkeletonDark],
- 'Slider': [SliderLight, SliderDark],
- 'StatusLight': [StatusLightLight, StatusLightDark],
- 'Switch': [SwitchLight, SwitchDark],
- 'Table': [TableLight, TableDark],
- 'TableView': [TableLight, TableDark],
- 'Tabs': [TabsLight, TabsDark],
- 'TagGroup': [TagGroupLight, TagGroupDark],
- 'TextArea': [TextAreaLight, TextAreaDark],
- 'TextField': [TextFieldLight, TextFieldDark],
- 'TimeField': [TimeFieldLight, TimeFieldDark],
- 'Toast': [ToastLight, ToastDark],
- 'ToggleButton': [ToggleButtonLight, ToggleButtonDark],
- 'ToggleButtonGroup': [ToggleButtonGroupLight, ToggleButtonGroupDark],
- 'Toolbar': [ActionGroupLight, ActionGroupDark],
- 'Tooltip': [TooltipLight, TooltipDark],
- 'Tree': [TreeLight, TreeDark],
- 'TreeView': [TreeLight, TreeDark],
- 'Virtualizer': [CollectionLight, CollectionDark],
- 'VisuallyHidden': [AccessibilityLight, AccessibilityDark],
+ Modal: [DialogLight, DialogDark],
+ NumberField: [NumberFieldLight, NumberFieldDark],
+ Picker: [PickerLight, PickerDark],
+ Popover: [PopoverLight, PopoverDark],
+ ProgressBar: [ProgressBarLight, ProgressBarDark],
+ ProgressCircle: [ProgressCircleLight, ProgressCircleDark],
+ Provider: [ProviderLight, ProviderDark],
+ RadioGroup: [RadioGroupLight, RadioGroupDark],
+ RangeCalendar: [RangeCalendarLight, RangeCalendarDark],
+ RangeSlider: [RangeSliderLight, RangeSliderDark],
+ SearchField: [SearchFieldLight, SearchFieldDark],
+ SegmentedControl: [SegmentedControlLight, SegmentedControlDark],
+ Select: [PickerLight, PickerDark],
+ SelectBoxGroup: [SelectBoxGroupLight, SelectBoxGroupDark],
+ Separator: [DividerLight, DividerDark],
+ Skeleton: [SkeletonLight, SkeletonDark],
+ Slider: [SliderLight, SliderDark],
+ StatusLight: [StatusLightLight, StatusLightDark],
+ Switch: [SwitchLight, SwitchDark],
+ Table: [TableLight, TableDark],
+ TableView: [TableLight, TableDark],
+ Tabs: [TabsLight, TabsDark],
+ TagGroup: [TagGroupLight, TagGroupDark],
+ TextArea: [TextAreaLight, TextAreaDark],
+ TextField: [TextFieldLight, TextFieldDark],
+ TimeField: [TimeFieldLight, TimeFieldDark],
+ Toast: [ToastLight, ToastDark],
+ ToggleButton: [ToggleButtonLight, ToggleButtonDark],
+ ToggleButtonGroup: [ToggleButtonGroupLight, ToggleButtonGroupDark],
+ Toolbar: [ActionGroupLight, ActionGroupDark],
+ Tooltip: [TooltipLight, TooltipDark],
+ Tree: [TreeLight, TreeDark],
+ TreeView: [TreeLight, TreeDark],
+ Virtualizer: [CollectionLight, CollectionDark],
+ VisuallyHidden: [AccessibilityLight, AccessibilityDark],
// Guides
- 'Collections': [CollectionLight, CollectionDark],
- 'Customization': [StyleLight, StyleDark],
+ Collections: [CollectionLight, CollectionDark],
+ Customization: [StyleLight, StyleDark],
'Drag and Drop': [DragAndDropLight, DragAndDropDark],
- 'Forms': [FormsLight, FormsDark],
+ Forms: [FormsLight, FormsDark],
'Framework setup': [FrameworksLight, FrameworksDark],
'Getting started': [GettingStartedLight, GettingStartedDark],
'MCP Server': [McpServerLight, McpServerDark],
- 'Quality': [AccessibilityLight, AccessibilityDark],
+ Quality: [AccessibilityLight, AccessibilityDark],
'Working with AI': [WorkingWithAILight, WorkingWithAIDark],
- 'Selection': [SelectionLight, SelectionDark],
+ Selection: [SelectionLight, SelectionDark],
'Style Macro': [StyleMacroLight, StyleMacroDark],
- 'Styling': [StyleLight, StyleDark],
- 'Testing': [TestingLight, TestingDark],
+ Styling: [StyleLight, StyleDark],
+ Testing: [TestingLight, TestingDark],
// Hooks - interaction hooks
- 'useClipboard': [ClipboardLight, ClipboardDark],
- 'useDrag': [DragAndDropLight, DragAndDropDark],
- 'useDrop': [DragAndDropLight, DragAndDropDark],
- 'useFocus': [FocusRingLight, FocusRingDark],
- 'useFocusRing': [FocusRingLight, FocusRingDark],
- 'useFocusVisible': [FocusRingLight, FocusRingDark],
- 'useFocusWithin': [FocusRingLight, FocusRingDark],
- 'useHover': [HoverLight, HoverDark],
- 'useKeyboard': [KeyboardLight, KeyboardDark],
- 'useLongPress': [PressLight, PressDark],
- 'useMove': [MoveLight, MoveDark],
- 'usePress': [PressLight, PressDark],
+ useClipboard: [ClipboardLight, ClipboardDark],
+ useDrag: [DragAndDropLight, DragAndDropDark],
+ useDrop: [DragAndDropLight, DragAndDropDark],
+ useFocus: [FocusRingLight, FocusRingDark],
+ useFocusRing: [FocusRingLight, FocusRingDark],
+ useFocusVisible: [FocusRingLight, FocusRingDark],
+ useFocusWithin: [FocusRingLight, FocusRingDark],
+ useHover: [HoverLight, HoverDark],
+ useKeyboard: [KeyboardLight, KeyboardDark],
+ useLongPress: [PressLight, PressDark],
+ useMove: [MoveLight, MoveDark],
+ usePress: [PressLight, PressDark],
// Hooks - utility hooks
- 'I18nProvider': [UtilityLight, UtilityDark],
- 'mergeProps': [UtilityLight, UtilityDark],
- 'PortalProvider': [UtilityLight, UtilityDark],
- 'SSRProvider': [UtilityLight, UtilityDark],
- 'useCollator': [UtilityLight, UtilityDark],
- 'useDateFormatter': [DatePickerLight, DatePickerDark],
- 'useField': [FormsLight, FormsDark],
- 'useFilter': [UtilityLight, UtilityDark],
- 'useId': [UtilityLight, UtilityDark],
- 'useIsSSR': [UtilityLight, UtilityDark],
- 'useLabel': [FormsLight, FormsDark],
- 'useLandmark': [AccessibilityLight, AccessibilityDark],
- 'useLocale': [UtilityLight, UtilityDark],
- 'useNumberFormatter': [NumberFieldLight, NumberFieldDark],
- 'useObjectRef': [UtilityLight, UtilityDark],
+ I18nProvider: [UtilityLight, UtilityDark],
+ mergeProps: [UtilityLight, UtilityDark],
+ PortalProvider: [UtilityLight, UtilityDark],
+ SSRProvider: [UtilityLight, UtilityDark],
+ useCollator: [UtilityLight, UtilityDark],
+ useDateFormatter: [DatePickerLight, DatePickerDark],
+ useField: [FormsLight, FormsDark],
+ useFilter: [UtilityLight, UtilityDark],
+ useId: [UtilityLight, UtilityDark],
+ useIsSSR: [UtilityLight, UtilityDark],
+ useLabel: [FormsLight, FormsDark],
+ useLandmark: [AccessibilityLight, AccessibilityDark],
+ useLocale: [UtilityLight, UtilityDark],
+ useNumberFormatter: [NumberFieldLight, NumberFieldDark],
+ useObjectRef: [UtilityLight, UtilityDark],
// Blog posts - map to existing component illustrations
'Building a Button Part 1: Press Events': [PressLight, PressDark],
'Building a Button Part 2: Hover Interactions': [HoverLight, HoverDark],
@@ -343,21 +343,24 @@ const componentIllustrations: Record = {
'Taming the dragon: Accessible drag and drop': [DragAndDropLight, DragAndDropDark],
'Date and Time Pickers for All': [DatePickerLight, DatePickerDark],
'How we internationalized our number field': [NumberFieldLight, NumberFieldDark],
- 'Improving Internationalization Support in Our Date and Time Components': [DateFieldLight, DateFieldDark],
+ 'Improving Internationalization Support in Our Date and Time Components': [
+ DateFieldLight,
+ DateFieldDark
+ ],
'Accessible Color Descriptions for Improved Color Pickers': [ColorPickerLight, ColorPickerDark],
'Creating a pointer-friendly submenu experience': [MenuLight, MenuDark],
'Introducing React Spectrum': [AdobeLight, AdobeDark],
// Internationalized
'Internationalized Date': [DateRangePickerLight, DateRangePickerDark],
'Calendar Interface': [CalendarLight, CalendarDark],
- 'CalendarDate': [CalendarLight, CalendarDark],
- 'CalendarDateTime': [DateFieldLight, DateFieldDark],
- 'Time': [TimeFieldLight, TimeFieldDark],
- 'ZonedDateTime': [DatePickerLight, DatePickerDark],
- 'DateFormatter': [DatePickerLight, DatePickerDark],
+ CalendarDate: [CalendarLight, CalendarDark],
+ CalendarDateTime: [DateFieldLight, DateFieldDark],
+ Time: [TimeFieldLight, TimeFieldDark],
+ ZonedDateTime: [DatePickerLight, DatePickerDark],
+ DateFormatter: [DatePickerLight, DatePickerDark],
'Internationalized Number': [NumberFieldLight, NumberFieldDark],
- 'NumberFormatter': [NumberFieldLight, NumberFieldDark],
- 'NumberParser': [NumberFieldLight, NumberFieldDark],
+ NumberFormatter: [NumberFieldLight, NumberFieldDark],
+ NumberParser: [NumberFieldLight, NumberFieldDark],
// Examples
'Emoji Picker': exampleImages['emoji-picker'],
'Filterable CRUD Table': exampleImages['crud'],
@@ -439,8 +442,8 @@ const releaseText = style({
});
interface IllustrationProps {
- name: string,
- href: string
+ name: string;
+ href: string;
}
function ComponentIllustration({name, href}: IllustrationProps) {
@@ -457,7 +460,8 @@ function ComponentIllustration({name, href}: IllustrationProps) {
aria-hidden="true"
width={960}
height={600}
- styles={illustrationStyles} />
+ styles={illustrationStyles}
+ />
);
}
@@ -471,12 +475,19 @@ function getReleaseVersionLabel(href: string) {
}
interface ComponentCardProps extends Omit {
- name: string,
- href: string,
- description?: string
+ name: string;
+ href: string;
+ description?: string;
}
-export function ComponentCard({id, name, href, description, size, ...otherProps}: ComponentCardProps) {
+export function ComponentCard({
+ id,
+ name,
+ href,
+ description,
+ size,
+ ...otherProps
+}: ComponentCardProps) {
let preview;
let releaseVersion = getReleaseVersionLabel(href);
@@ -490,7 +501,8 @@ export function ComponentCard({id, name, href, description, size, ...otherProps}
src={[
{srcSet: BackgroundLight, colorScheme: 'light'},
{srcSet: BackgroundDark, colorScheme: 'dark'}
- ]} />
+ ]}
+ />
{releaseVersion}
);
@@ -508,13 +520,14 @@ export function ComponentCard({id, name, href, description, size, ...otherProps}
size={size}
name={name}
description={description}
- preview={preview} />
+ preview={preview}
+ />
);
}
interface ComponentListProps {
- pages: Page[],
- components: string[]
+ pages: Page[];
+ components: string[];
}
export function ComponentList(props: ComponentListProps) {
@@ -544,11 +557,17 @@ export function ComponentList(props: ComponentListProps) {
scrollPaddingX: '--paddingX'
})}
style={{
- maskImage: 'linear-gradient(to right, transparent, white var(--paddingX) calc(100% - var(--paddingX)), transparent)'
+ maskImage:
+ 'linear-gradient(to right, transparent, white var(--paddingX) calc(100% - var(--paddingX)), transparent)'
}}>
{pages.map(page => (
-
+
))}
diff --git a/packages/dev/s2-docs/src/ComponentCardClient.tsx b/packages/dev/s2-docs/src/ComponentCardClient.tsx
index ba08de3f9fc..4ab7e003748 100644
--- a/packages/dev/s2-docs/src/ComponentCardClient.tsx
+++ b/packages/dev/s2-docs/src/ComponentCardClient.tsx
@@ -5,9 +5,9 @@ import {registerSpectrumLink} from './prefetch';
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
interface ComponentCardProps extends Omit
{
- preview: ReactNode,
- name: string,
- description?: string
+ preview: ReactNode;
+ name: string;
+ description?: string;
}
export function ComponentCardClient(props: ComponentCardProps) {
@@ -28,9 +28,7 @@ export function ComponentCardClient(props: ComponentCardProps) {
return (
-
- {preview}
-
+ {preview}
{name}
{description && {description} }
diff --git a/packages/dev/s2-docs/src/ComponentCardView.tsx b/packages/dev/s2-docs/src/ComponentCardView.tsx
index 164530d5a55..a8503810ec1 100644
--- a/packages/dev/s2-docs/src/ComponentCardView.tsx
+++ b/packages/dev/s2-docs/src/ComponentCardView.tsx
@@ -8,22 +8,29 @@ import React from 'react';
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
export interface ComponentCardItem {
- id: string,
- name: string,
- href: string,
- description?: string
+ id: string;
+ name: string;
+ href: string;
+ description?: string;
}
interface ComponentCardGridProps {
- items: ComponentCardItem[],
- ariaLabel?: string,
- size?: 'S' | 'M' | 'L',
- currentUrl?: string,
- onAction?: (key: Key) => void,
- renderEmptyState?: () => React.ReactNode
+ items: ComponentCardItem[];
+ ariaLabel?: string;
+ size?: 'S' | 'M' | 'L';
+ currentUrl?: string;
+ onAction?: (key: Key) => void;
+ renderEmptyState?: () => React.ReactNode;
}
-export function ComponentCardView({items, ariaLabel = 'Items', size = 'S', currentUrl, onAction, renderEmptyState}: ComponentCardGridProps) {
+export function ComponentCardView({
+ items,
+ ariaLabel = 'Items',
+ size = 'S',
+ currentUrl,
+ onAction,
+ renderEmptyState
+}: ComponentCardGridProps) {
return (
@@ -71,7 +78,15 @@ export function ComponentCardView({items, ariaLabel = 'Items', size = 'S', curre
})}
renderEmptyState={renderEmptyState}
items={items}>
- {(item) => }
+ {item => (
+
+ )}
diff --git a/packages/dev/s2-docs/src/CopyButton.tsx b/packages/dev/s2-docs/src/CopyButton.tsx
index b026849fecb..824df6e15c4 100644
--- a/packages/dev/s2-docs/src/CopyButton.tsx
+++ b/packages/dev/s2-docs/src/CopyButton.tsx
@@ -7,20 +7,27 @@ import React, {useEffect, useRef, useState} from 'react';
export interface CopyButtonProps {
/** Text to copy. If not provided, getText will be used. */
- text?: string,
+ text?: string;
/** Function returning the text to copy. */
- getText?: () => string,
+ getText?: () => string;
/** Accessible label for the button. */
- ariaLabel?: string,
+ ariaLabel?: string;
/** Tooltip label shown on hover/focus. */
- tooltip?: string,
+ tooltip?: string;
/** Quiet variant. */
- isQuiet?: boolean,
+ isQuiet?: boolean;
/** Size of the button. */
- size?: 'S' | 'M' | 'L'
+ size?: 'S' | 'M' | 'L';
}
-export function CopyButton({text, getText, ariaLabel = 'Copy', tooltip = 'Copy', isQuiet = false, size = 'S'}: CopyButtonProps) {
+export function CopyButton({
+ text,
+ getText,
+ ariaLabel = 'Copy',
+ tooltip = 'Copy',
+ isQuiet = false,
+ size = 'S'
+}: CopyButtonProps) {
let [isCopied, setIsCopied] = useState(false);
let timeout = useRef | null>(null);
@@ -40,12 +47,15 @@ export function CopyButton({text, getText, ariaLabel = 'Copy', tooltip = 'Copy',
if (!value) {
return;
}
- navigator.clipboard.writeText(value).then(() => {
- setIsCopied(true);
- timeout.current = setTimeout(() => setIsCopied(false), 2000);
- }).catch(() => {
- ToastQueue.negative('Failed to copy.');
- });
+ navigator.clipboard
+ .writeText(value)
+ .then(() => {
+ setIsCopied(true);
+ timeout.current = setTimeout(() => setIsCopied(false), 2000);
+ })
+ .catch(() => {
+ ToastQueue.negative('Failed to copy.');
+ });
};
return (
diff --git a/packages/dev/s2-docs/src/DisclosureRow.tsx b/packages/dev/s2-docs/src/DisclosureRow.tsx
index 2df1a6c8dcc..eed98dc4642 100644
--- a/packages/dev/s2-docs/src/DisclosureRow.tsx
+++ b/packages/dev/s2-docs/src/DisclosureRow.tsx
@@ -75,7 +75,9 @@ export function DisclosureRow({title, children, defaultExpanded}) {
- buttonStyles({...p, isExpanded: state.isExpanded})}>
+ buttonStyles({...p, isExpanded: state.isExpanded})}>
{/* @ts-ignore */}
{title}
diff --git a/packages/dev/s2-docs/src/Error.tsx b/packages/dev/s2-docs/src/Error.tsx
index e75f0a55471..7feb646818c 100644
--- a/packages/dev/s2-docs/src/Error.tsx
+++ b/packages/dev/s2-docs/src/Error.tsx
@@ -1,16 +1,24 @@
'use client';
-
import BrowserError from '@react-spectrum/s2/illustrations/linear/BrowserError';
import {Content, Heading, IllustratedMessage} from '@react-spectrum/s2';
export default function Error() {
return (
-
+
Error 404: Page not found
- This page isn't available. Try checking the URL or visit a different page.
+
+ This page isn't available. Try checking the URL or visit a different page.
+
);
diff --git a/packages/dev/s2-docs/src/ExampleApp.tsx b/packages/dev/s2-docs/src/ExampleApp.tsx
index c0a15ceca5f..fd437538753 100644
--- a/packages/dev/s2-docs/src/ExampleApp.tsx
+++ b/packages/dev/s2-docs/src/ExampleApp.tsx
@@ -4,19 +4,36 @@ import fs from 'fs/promises';
import path from 'path';
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
-export async function ExampleApp({dir, defaultSelected, type}: {dir: string, defaultSelected?: string, type?: 'tailwind' | 'vanilla' | 's2'}) {
- let files = (await fs.readdir('../../../' + dir, {withFileTypes: true})).filter(d => d.isFile()).map(d => path.join(dir, d.name));
+export async function ExampleApp({
+ dir,
+ defaultSelected,
+ type
+}: {
+ dir: string;
+ defaultSelected?: string;
+ type?: 'tailwind' | 'vanilla' | 's2';
+}) {
+ let files = (await fs.readdir('../../../' + dir, {withFileTypes: true}))
+ .filter(d => d.isFile())
+ .map(d => path.join(dir, d.name));
let {files: downloadFiles, deps} = getFiles(files, type);
return (
-
+
+ type={type}
+ />
);
diff --git a/packages/dev/s2-docs/src/ExampleList.tsx b/packages/dev/s2-docs/src/ExampleList.tsx
index 49369fb931e..b6713972496 100644
--- a/packages/dev/s2-docs/src/ExampleList.tsx
+++ b/packages/dev/s2-docs/src/ExampleList.tsx
@@ -22,17 +22,22 @@ import swipeableTabsDark from 'url:../pages/react-aria/examples//swipeable-tabs-
export const images: Record
= {
'ios-list': [iosList, iosListDark],
'emoji-picker': [emojiPicker, emojiPickerDark],
- 'kanban': [kanban, kanbanDark],
- 'photos': [photos, photosDark],
- 'crud': [crud, crudDark],
+ kanban: [kanban, kanbanDark],
+ photos: [photos, photosDark],
+ crud: [crud, crudDark],
'ripple-button': [rippleButton, rippleButton],
- 'sheet': [sheet, sheetDark],
+ sheet: [sheet, sheetDark],
'swipeable-tabs': [swipeableTabs, swipeableTabsDark]
};
export function ExampleList({tag, pages}) {
let examples = pages
- .filter(page => page.name.startsWith('react-aria/examples/') && !page.name.endsWith('index') && (!tag || page.exports?.keywords.includes(tag)))
+ .filter(
+ page =>
+ page.name.startsWith('react-aria/examples/') &&
+ !page.name.endsWith('index') &&
+ (!tag || page.exports?.keywords.includes(tag))
+ )
.sort((a, b) => getTitle(a).localeCompare(getTitle(b)));
return (
@@ -70,8 +75,14 @@ export function ExampleList({tag, pages}) {
- {getTitle(example)}
- {example.exports?.description ? {example.exports?.description} : null}
+
+ {getTitle(example)}
+
+ {example.exports?.description ? (
+
+ {example.exports?.description}
+
+ ) : null}
@@ -82,7 +93,7 @@ export function ExampleList({tag, pages}) {
);
}
-const getTitle = (example) => example.tableOfContents?.[0]?.title;
+const getTitle = example => example.tableOfContents?.[0]?.title;
const image = style({
width: 'full',
@@ -92,7 +103,7 @@ const image = style({
pointerEvents: 'none'
});
-export function ExampleImage({name, itemProp}: {name: string, itemProp?: string}) {
+export function ExampleImage({name, itemProp}: {name: string; itemProp?: string}) {
let img = images[path.basename(name)];
if (!Array.isArray(img)) {
return
;
@@ -107,6 +118,7 @@ export function ExampleImage({name, itemProp}: {name: string, itemProp?: string}
]}
alt=""
itemProp={itemProp}
- styles={image} />
+ styles={image}
+ />
);
}
diff --git a/packages/dev/s2-docs/src/ExampleOutput.tsx b/packages/dev/s2-docs/src/ExampleOutput.tsx
index 6ed335ed0cc..7b313f39941 100644
--- a/packages/dev/s2-docs/src/ExampleOutput.tsx
+++ b/packages/dev/s2-docs/src/ExampleOutput.tsx
@@ -5,13 +5,18 @@ import {Content, Heading, InlineAlert} from '@react-spectrum/s2';
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
interface ExampleOutputProps {
- component?: any,
- props?: Record
,
- align?: 'start' | 'center' | 'end',
- orientation?: 'horizontal' | 'vertical'
+ component?: any;
+ props?: Record;
+ align?: 'start' | 'center' | 'end';
+ orientation?: 'horizontal' | 'vertical';
}
-export function ExampleOutput({component, props = {}, align = 'center', orientation = 'horizontal'}: ExampleOutputProps) {
+export function ExampleOutput({
+ component,
+ props = {},
+ align = 'center',
+ orientation = 'horizontal'
+}: ExampleOutputProps) {
return (
+ style={{
+ background: getBackgroundColor(
+ props.staticColor || (props.isOverBackground ? 'white' : undefined)
+ )
+ }}>
- {isValidElement(component) ? cloneElement(component, props) : createElement(component, props)}
+ {isValidElement(component)
+ ? cloneElement(component, props)
+ : createElement(component, props)}
);
diff --git a/packages/dev/s2-docs/src/ExampleSwitcher.tsx b/packages/dev/s2-docs/src/ExampleSwitcher.tsx
index 6e68e531c03..f690a3b7a8c 100644
--- a/packages/dev/s2-docs/src/ExampleSwitcher.tsx
+++ b/packages/dev/s2-docs/src/ExampleSwitcher.tsx
@@ -1,6 +1,14 @@
'use client';
-import {Content, ContextualHelp, Heading, Picker, PickerItem, SegmentedControl, SegmentedControlItem} from '@react-spectrum/s2';
+import {
+ Content,
+ ContextualHelp,
+ Heading,
+ Picker,
+ PickerItem,
+ SegmentedControl,
+ SegmentedControlItem
+} from '@react-spectrum/s2';
import {createContext, useState} from 'react';
import {Key} from 'react-aria-components';
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
@@ -17,15 +25,8 @@ const exampleStyle = style({
lg: [24, '1fr', 'auto', 24]
},
gridTemplateAreas: {
- default: [
- '. switcher .',
- '. theme .',
- 'example example example'
- ],
- lg: [
- '. switcher theme .',
- 'example example example example'
- ]
+ default: ['. switcher .', '. theme .', 'example example example'],
+ lg: ['. switcher theme .', 'example example example example']
},
paddingTop: {
default: 12,
@@ -94,11 +95,18 @@ export function ExampleSwitcher({type = 'style', examples = DEFAULT_EXAMPLES, ch
return (
-
- {examples.map(example => {example} )}
+
+ {examples.map(example => (
+
+ {example}
+
+ ))}
- {selected === 'Vanilla CSS' &&
+ {selected === 'Vanilla CSS' && (
Vanilla CSS theme
- This sets the --tint CSS variable used by the Vanilla CSS examples.
+
+ This sets the --tint CSS variable
+ used by the Vanilla CSS examples.
+
}>
Indigo
@@ -122,7 +133,7 @@ export function ExampleSwitcher({type = 'style', examples = DEFAULT_EXAMPLES, ch
Pink
Purple
- }
+ )}
{children[examples.indexOf(selected)]}
diff --git a/packages/dev/s2-docs/src/ExpandableCode.tsx b/packages/dev/s2-docs/src/ExpandableCode.tsx
index 2773eddf501..ab94ea5db4c 100644
--- a/packages/dev/s2-docs/src/ExpandableCode.tsx
+++ b/packages/dev/s2-docs/src/ExpandableCode.tsx
@@ -52,13 +52,17 @@ const ExpandableCodeContext = createContext(null);
export function ExpandableCodeProvider({children}) {
let [isExpanded, setExpanded] = useState(false);
return (
-
- {children}
-
+ {children}
);
}
-export function ExpandableCode({children, hasHighlightedLine}: {children: ReactNode, hasHighlightedLine?: boolean}) {
+export function ExpandableCode({
+ children,
+ hasHighlightedLine
+}: {
+ children: ReactNode;
+ hasHighlightedLine?: boolean;
+}) {
let state = useState(false);
let ctx = useContext(ExpandableCodeContext);
let [isExpanded, setExpanded] = ctx || state;
@@ -68,17 +72,27 @@ export function ExpandableCode({children, hasHighlightedLine}: {children: ReactN
if (!isExpanded) {
if (hasHighlightedLine) {
// mask the top, bottom, and right sides
- mask = 'linear-gradient(transparent, white 25% 50%, transparent), linear-gradient(to right, white 0% 85%, transparent)';
+ mask =
+ 'linear-gradient(transparent, white 25% 50%, transparent), linear-gradient(to right, white 0% 85%, transparent)';
padding = '0px';
} else {
// only mask the bottom and right
- mask = 'linear-gradient(white 0% 50%, transparent), linear-gradient(to right, white 0% 85%, transparent)';
+ mask =
+ 'linear-gradient(white 0% 50%, transparent), linear-gradient(to right, white 0% 85%, transparent)';
}
}
return (
-
+
{children}
diff --git a/packages/dev/s2-docs/src/FileTabs.tsx b/packages/dev/s2-docs/src/FileTabs.tsx
index d64d101aecb..7cb3fca3e5f 100644
--- a/packages/dev/s2-docs/src/FileTabs.tsx
+++ b/packages/dev/s2-docs/src/FileTabs.tsx
@@ -6,10 +6,10 @@ import {Key, Tab, TabList, TabPanel, Tabs} from '@react-spectrum/s2';
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
interface FileTabsProps {
- children?: ReactNode,
- files: {[name: string]: ReactElement},
- extraFiles?: {[name: string]: ReactElement},
- defaultSelectedKey?: Key
+ children?: ReactNode;
+ files: {[name: string]: ReactElement};
+ extraFiles?: {[name: string]: ReactElement};
+ defaultSelectedKey?: Key;
}
const FileTabsContext = createContext<((tab: Key) => void) | null>(null);
@@ -44,10 +44,22 @@ export function FileTabs({children, files, extraFiles, defaultSelectedKey}: File
data-files>
{children && Example }
- {Object.keys(tabs).map(file => {file} )}
+ {Object.keys(tabs).map(file => (
+
+ {file}
+
+ ))}
- {children &&
{children} }
- {Object.entries(tabs).map(([name, file]) =>
{file} )}
+ {children && (
+
+ {children}
+
+ )}
+ {Object.entries(tabs).map(([name, file]) => (
+
+ {file}
+
+ ))}
);
@@ -64,6 +76,7 @@ export function TabLink({name, ...props}) {
{...props}
onPress={() => {
onFileClick(name);
- }} />
+ }}
+ />
);
}
diff --git a/packages/dev/s2-docs/src/FunctionJSDoc.tsx b/packages/dev/s2-docs/src/FunctionJSDoc.tsx
index 771b0cd56cc..372f1bfbda6 100644
--- a/packages/dev/s2-docs/src/FunctionJSDoc.tsx
+++ b/packages/dev/s2-docs/src/FunctionJSDoc.tsx
@@ -18,12 +18,12 @@ import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
interface FunctionJSDocProps {
function: {
- description?: string | null,
- examples?: string[]
- }
+ description?: string | null;
+ examples?: string[];
+ };
}
-function parseFencedCodeBlock(example: string): {lang?: string, code: string} | null {
+function parseFencedCodeBlock(example: string): {lang?: string; code: string} | null {
let trimmed = example.trim();
let match = trimmed.match(/^```([^\n`]*)\n([\s\S]*?)\n```$/);
if (!match) {
@@ -38,29 +38,27 @@ function parseFencedCodeBlock(example: string): {lang?: string, code: string} |
}
export function FunctionJSDoc({function: func}: FunctionJSDocProps) {
- let examples = Array.isArray(func.examples)
- ? func.examples.filter(Boolean)
- : [];
+ let examples = Array.isArray(func.examples) ? func.examples.filter(Boolean) : [];
return (
-
{renderHTMLfromMarkdown(func.description, {forceInline: false, forceBlock: true})}
+
+ {renderHTMLfromMarkdown(func.description, {forceInline: false, forceBlock: true})}
+
{examples.map((example, index) => {
let parsedExample = parseFencedCodeBlock(example);
return (
- {examples.length > 1 &&
-
- Example {index + 1}:
-
- }
- {parsedExample
- ? (
-
- {parsedExample.code}
-
- )
- : renderHTMLfromMarkdown(example, {forceInline: false, forceBlock: true})}
+ {examples.length > 1 && (
+
Example {index + 1}:
+ )}
+ {parsedExample ? (
+
+ {parsedExample.code}
+
+ ) : (
+ renderHTMLfromMarkdown(example, {forceInline: false, forceBlock: true})
+ )}
);
})}
diff --git a/packages/dev/s2-docs/src/Header.tsx b/packages/dev/s2-docs/src/Header.tsx
index 3f963d9b987..7aba746f568 100644
--- a/packages/dev/s2-docs/src/Header.tsx
+++ b/packages/dev/s2-docs/src/Header.tsx
@@ -1,6 +1,6 @@
'use client';
-import {baseColor, focusRing, space, style} from '@react-spectrum/s2/style' with { type: 'macro' };
+import {baseColor, focusRing, space, style} from '@react-spectrum/s2/style' with {type: 'macro'};
import {Button, Link} from 'react-aria-components';
import Contrast from '@react-spectrum/s2/icons/Contrast';
import {Divider, pressScale} from '@react-spectrum/s2';
@@ -26,7 +26,7 @@ function getButtonIcon(currentPage) {
const libraryStyles = style({
...focusRing(),
- paddingX: 12,
+ paddingX: 12,
display: 'flex',
alignItems: 'center',
columnGap: {
@@ -95,7 +95,8 @@ function ColorSchemeToggle() {
opacity: isDark ? 0 : 1,
transform: isDark ? 'rotate(-90deg) scale(0.5)' : 'rotate(0deg) scale(1)',
transition: 'opacity 200ms ease-out, transform 200ms ease-out'
- }} />
+ }}
+ />
+ }}
+ />
);
@@ -121,7 +123,7 @@ export default function Header() {
let openSearchMenu = async () => {
if (!document.startViewTransition) {
- setSearchOpen((prev) => !prev);
+ setSearchOpen(prev => !prev);
return;
}
@@ -140,7 +142,7 @@ export default function Header() {
labelRef.current!.style.viewTransitionName = '';
searchRef.current!.style.viewTransitionName = '';
renderCallback.current = resolve;
- setSearchOpen((prev) => !prev);
+ setSearchOpen(prev => !prev);
});
});
@@ -195,10 +197,15 @@ export default function Header() {
return (
<>
-