Skip to content

Commit

Permalink
docs: March release notes (#7845)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuiliao authored Mar 6, 2025
1 parent 4d3c72c commit b4695c8
Show file tree
Hide file tree
Showing 8 changed files with 388 additions and 5 deletions.
10 changes: 8 additions & 2 deletions .storybook-s2/docs/Intro.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ function App() {
<Provider background="base">
{/* your app */}
</Provider>`)}</Pre>
<H3>Usage with older React Spectrum versions</H3>
<P>See Adobe internal documentation.</P>
<H2>Styling</H2>
<P>React Spectrum v3 supported a limited set of <Link href="https://react-spectrum.adobe.com/react-spectrum/styling.html" target="_blank">style props</Link> for layout and positioning using Spectrum-defined values. In Spectrum 2, we’re improving on this by offering a much more flexible style macro. This offers additional Spectrum tokens, improves performance by generating CSS at build time rather than runtime, and works with any DOM element for use in custom components.</P>
<P><Link href="https://parceljs.org/features/macros/" target="_blank">Macros</Link> are a new bundler feature that enable functions to run at build time. The React Spectrum <Code>style</Code> macro uses this to generate CSS that can be applied to any DOM element or component. Import the <Code>style</Code> macro using the with <Code>{`{type: 'macro'}`}</Code> <Link href="https://github.com/tc39/proposal-import-attributes" target="_blank">import attribute</Link>, and pass the result to the <Code>styles</Code> prop of any React Spectrum component to provide it with styles.</P>
Expand Down Expand Up @@ -238,8 +240,12 @@ function YourComponent() {
<Pre>{highlight(`/* YourComponent.css */
.your-unsafe-class {
background: red;
}
`, 'CSS')}</Pre>
}`, 'CSS')}</Pre>
<H3>CSS Resets</H3>
<P>CSS resets are strongly discouraged. Global CSS selectors can unintentionally affect elements that were not intended, leading to style clashes. Since Spectrum 2 uses <Link href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_layers" target="_blank">CSS cascade layers</Link>, global CSS outside a <Code>@layer</Code> will override S2's CSS. Therefore, if you cannot remove your CSS reset, it must be placed in a lower layer. This can be done by declaring your reset layer before the <Code>_</Code> layer used by S2.</P>
<Pre>{highlight(`/* App.css */
@layer reset, _;
@import "reset.css" layer(reset);`)}</Pre>
</main>
</div>
)
Expand Down
6 changes: 6 additions & 0 deletions .storybook-s2/docs/Migrating.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,12 @@ export function Migrating() {
<li className={style({font: 'body', marginY: 8})}>Update placement prop to be have one value (i.e. Update <Code>placement="bottom left"</Code> to be <Code>placement="bottom"</Code>)</li>
</ul>

<H3>TreeView</H3>
<P>If migrating from TreeView version 3.0.0-beta.3 or before, please do the following. Otherwise, no updates needed.</P>
<ul className="sb-unstyled">
<li className={style({font: 'body', marginY: 8})}> Update content within <Code>TreeViewItem</Code> to be wrapped in <Code>TreeViewContentItem</Code></li>
</ul>

<H3>View</H3>
<ul className="sb-unstyled">
<li className={style({font: 'body', marginY: 8})}>Update <Code>View</Code> to be a <Code>div</Code> and apply styles using the style macro</li>
Expand Down
29 changes: 29 additions & 0 deletions .storybook-s2/docs/Release Notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,35 @@ export default MDXLayout;

# Release Notes

## v0.7.0

### New Components

* [TreeView](?path=/docs/treeview--docs)

### Updates

* [Badge](?path=/docs/badge--docs): Add `overflowMode` prop, fix icon alignment, update typo from `variant="charteuse"` to `variant="chartreuse"`
* [CardView](?path=/docs/cardview--docs): Fix styling when using `renderActionBar`
* Image: Add `fetchPriority` prop
* [Menu](?path=/docs/menu--docs): Fix menu item's focus rings from exceeding popover boundaries
* [Tabs](?path=/docs/tabs--docs): Add collapse behavior
* Remove `all: revert-layer` from style macro generated CSS to fix Safari issues
* Remove references to CSS `flex` shorthand. Please use `flexGrow`, `flexBasis`, and `flexShrink` instead.

### Codemods

* Update S2 icon migration map
* Handle margin/padding shorthands in style props codemod

### Important CSS update

In this release, we have made significant changes to the way our Style Macro generates CSS in order to fix issues with Safari. The Style Macro uses [CSS Cascade Layers](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Styling_basics/Cascade_layers) to avoid CSS specificity and ordering issues. However, this means global CSS declared outside a `@layer`, such as CSS resets, will take precedence over S2's CSS. To avoid this, we previously used [all: revert-layer](https://developer.mozilla.org/en-US/docs/Web/CSS/revert-layer). Unfortunately, due to numerous bugs in Safari 18, this caused rendering issues in our components.

To fix these Safari issues, we have removed `all: revert-layer` in this release. This means that global CSS will now take precedence over S2's styles. **If you are using a CSS reset on the same page as S2 components, you will need to remove it** or put it in a `@layer` of its own. See [the docs](?path=/docs/intro--docs#css-resets) for more information.

**If you are using a version older than React Spectrum v3 on the same page, you must update to the latest version.** See the Adobe internal documentation for more details.

## v0.6.0

### New Components
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/autocomplete/docs/useAutocomplete.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {InlineAlert, Content, Heading} from '@adobe/react-spectrum';
---
category: Pickers
keywords: [autocomplete, autosuggest, typeahead, search, aria]
after_version: 3.0.0
preRelease: beta
---

# useAutocomplete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ export default Layout;
import docs from 'docs:@react-stately/autocomplete';
import {ClassAPI, HeaderInfo, FunctionAPI, PageDescription} from '@react-spectrum/docs';
import packageData from '@react-stately/autocomplete/package.json';
import {InlineAlert, Content, Heading} from '@adobe/react-spectrum';

---
category: Pickers
keywords: [autocomplete, state]
after_version: 3.0.0-alpha.0
preRelease: beta
---

# useAutocompleteState
Expand All @@ -28,6 +29,11 @@ after_version: 3.0.0-alpha.0
packageData={packageData}
componentNames={['useAutocompleteState']} />

<InlineAlert variant="notice" marginTop={60}>
<Heading>Under construction</Heading>
<Content>This hook is in <strong>beta</strong>. More documentation is coming soon!</Content>
</InlineAlert>

## API

<FunctionAPI function={docs.exports.useAutocompleteState} links={docs.links} />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

2 comments on commit b4695c8

@rspbot
Copy link

@rspbot rspbot commented on b4695c8 Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rspbot
Copy link

@rspbot rspbot commented on b4695c8 Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.