Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: S2 release notes #7406

Merged
merged 10 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions .storybook-s2/docs/Migrating.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ export function Migrating() {
<li className={style({font: 'body', marginY: 8})}>Update <Code>Item</Code> to be a <Code>MenuItem</Code></li>
</ul>

<H3>ActionGroup</H3>
<ul className="sb-unstyled">
<li className={style({font: 'body', marginY: 8})}>Use <Code>ActionButtonGroup</Code> if you are migrating from an <Code>ActionGroup</Code> that didn't allow for selection. <Code>ActionButtonGroup</Code> takes <Code>ActionButtons</Code> as children. </li>
<li className={style({font: 'body', marginY: 8})}>Use <Code>ToggleButtonGroup</Code> if you are migrating from an <Code>ActionGroup</Code> that used single or multiple selection. <Code>ToggleButtonGroup</Code> takes <Code>ToggleButtons</Code> as children. </li>
<li className={style({font: 'body', marginY: 8})}>[PENDING] Comment out <Code>overflowMode</Code> (it has not been implemented yet)</li>
<li className={style({font: 'body', marginY: 8})}>[PENDING] Comment out <Code>buttonLabelBehavior</Code> (it has not been implemented yet)</li>
<li className={style({font: 'body', marginY: 8})}>[PENDING] Comment out <Code>summaryIcon</Code> (it has not been implemented yet)</li>
<li className={style({font: 'body', marginY: 8})}>Update root level <Code>onAction</Code> to called via <Code>onPress</Code> on each <Code>ActionButton</Code></li>
<li className={style({font: 'body', marginY: 8})}>Apply <Code>isDisabled</Code> directly on each <Code>ActionButton</Code> or <Code>ToggleButton</Code> instead of root level <Code>disabledKeys</Code></li>
<li className={style({font: 'body', marginY: 8})}>Update <Code>key</Code> to be <Code>id</Code> (and keep <Code>key</Code> if rendered inside <Code>array.map</Code>)</li>
<li className={style({font: 'body', marginY: 8})}>Convert dynamic collections render function to <Code>items.map</Code></li>
</ul>

<H3>AlertDialog</H3>
<P>No updates needed.</P>

Expand Down Expand Up @@ -141,14 +154,37 @@ export function Migrating() {
<ul className="sb-unstyled">
<li className={style({font: 'body', marginY: 8})}>Update children to move render props from being the second child of <Code>DialogTrigger</Code> to being a child of <Code>Dialog</Code></li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>onDismiss</Code> and use <Code>onOpenChange</Code> on the <Code>DialogTrigger</Code>, or <Code>onDismiss</Code> on the <Code>DialogContainer</Code> instead</li>
<li className={style({font: 'body', marginY: 8})}><Code>Dialog</Code> is now meant specifically for rendering modal dialogs only and follows the same preset layout as before</li>
<li className={style({font: 'body', marginY: 8})}>If you are trying to create a dialog with a custom layout use <Code>CustomDialog</Code></li>
<li className={style({font: 'body', marginY: 8})}>If you are trying to create a fullscreen dialog use <Code>FullscreenDialog</Code></li>
<li className={style({font: 'body', marginY: 8})}>If you are trying to create a popover dialog use <Code>Popover</Code></li>
<li className={style({font: 'body', marginY: 8})}>Supports <Code>isKeyboardDismissDisabled</Code> in place of <Code>DialogTrigger</Code></li>
<li className={style({font: 'body', marginY: 8})}>Supports <Code>isDismissible</Code> in place of <Code>DialogTrigger</Code>. Note the fixed spelling from previous <Code>isDismissible</Code> prop.</li>
<li className={style({font: 'body', marginY: 8})}>Supports <Code>role: "dialog" | "alertdialog"</Code></li>
</ul>

<H3>DialogContainer</H3>
<ul className="sb-unstyled">
<li className={style({font: 'body', marginY: 8})}>Remove <Code>type</Code>, this is dependent on the dialog level child that you use (e.g. <Code>Dialog</Code>, <Code>FullscreenDialog</Code>, <Code>Popover</Code>)</li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>isDismissable</Code>, prop now exists on the dialog level component as <Code>isDismissible</Code></li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>isKeyboardDismissDisabled</Code>, prop now exists on the dialog level component</li>
</ul>

<H3>DialogTrigger</H3>
<ul className="sb-unstyled">
<li className={style({font: 'body', marginY: 8})}>[PENDING] Comment out <Code>type="tray"</Code> (<Code>Tray</Code> has not been implemented yet)</li>
<li className={style({font: 'body', marginY: 8})}>[PENDING] Comment out <Code>mobileType="tray"</Code> (<Code>Tray</Code> has not been implemented yet)</li>
<li className={style({font: 'body', marginY: 8})}>[PENDING] Comment out <Code>mobileType</Code> (<Code>Tray</Code> and other types have not been implemented yet for <Code>Popover</Code>)</li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>targetRef</Code> (it is no longer supported in Spectrum 2)</li>
<li className={style({font: 'body', marginY: 8})}>Update <Code>children</Code> to remove render props usage, and note that the <Code>close</Code> function was moved from <Code>DialogTrigger</Code> to <Code>Dialog</Code></li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>containerPadding</Code>, prop now exists on the <Code>Popover</Code> component</li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>crossOffset</Code>, prop now exists on the <Code>Popover</Code> component</li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>hideArrow</Code>, prop now exists on the <Code>Popover</Code> component</li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>isDismissable</Code>, prop now exists on the dialog level component as <Code>isDismissible</Code></li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>isKeyboardDismissDisabled</Code>, prop now exists on the dialog level component</li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>offset</Code>, prop now exists on the <Code>Popover</Code> component</li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>placement</Code>, prop now exists on the <Code>Popover</Code> component</li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>shouldFlip</Code>, prop now exists on the <Code>Popover</Code> component</li>
<li className={style({font: 'body', marginY: 8})}>Remove <Code>type</Code>, this is dependent on the dialog level child that you use (e.g. <Code>Dialog</Code>, <Code>FullscreenDialog</Code>, <Code>Popover</Code>)</li>
</ul>

<H3>Divider</H3>
Expand Down Expand Up @@ -468,7 +504,7 @@ export function Migrating() {
<td><Code>'large'</Code></td>
<td><Code>'xl'</Code></td>
</tr>
</tbody>
</tbody>
</table>

<H3>Dimension values</H3>
Expand Down
50 changes: 50 additions & 0 deletions .storybook-s2/docs/Release Notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,56 @@ export default MDXLayout;

# Release Notes

## v0.5.0

In this release we have updated our Dialog and DialogTrigger APIs to improve layout flexibility for custom dialogs and popovers. Dialog has been split into four components:

* [Dialog](?path=/docs/dialog--docs) – a modal dialog with a standard layout with slots for the heading, content, hero image, button group, etc. This corresponds to the previous `type="modal"` API.
* [FullscreenDialog](?path=/docs/fullscreendialog--docs) – a fullscreen or takeover modal, similar to a Dialog but with different slots and layout. This corresponds to the previous `type="fullscreen"` and `type="fullscreenTakeover"` APIs.
* [CustomDialog](?path=/docs/customdialog--docs) – a modal dialog with a completely custom layout. It can have default padding or go edge-to-edge. No built-in slots are provided, the layout is entirely up to you.
Copy link
Member Author

Choose a reason for hiding this comment

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

I noticed that padding is removed from the props table in the storybook intentionally (probably because it makes the story look strange when applied), but are we worried about discoverablity?

* [Popover](?path=/docs/popover--docs) Popovers no longer support the previous dialog-style layout, which was rarely needed in recent apps. In addition, popover now has a reduced amount of padding by default, which was a common request.

In addition, several DialogTrigger props have moved to the above children:

* `type` is removed. Use one of the above components instead.
* `isKeyboardDismissDisabled` moved to Dialog, FullscreenDialog, and CustomDialog
* `isDismissable` was renamed to `isDismissible` (fixed spelling), and moved to Dialog and CustomDialog
* `hideArrow`, `offset`, `crossOffset`, `containerPadding`, `placement`, and `shouldFlip` moved to Popover

We've also continued to iterate on developer experience based on your feedback. Documentation on style macro usage with regards to
[colors](?path=/docs/style-macro--docs#colors) and [typography](?path=/docs/style-macro--docs#typography) have been added to help clarify
these common use cases. Style macro properties like `width` and `height` now allow for arbitrary pixel size values, please see the [docs](?path=/docs/style-macro--docs#sizing)
for more information. Finally, documentation on [optimizing CSS bundling](?path=/docs/style-macro--docs#css-optimization) have also been
added to help you generate a properly optimized output when using the bundler of your choice.

### New components

* [ActionButtonGroup](?path=/docs/actionbuttongroup--docs)
* [CloseButton](?path=/docs/customdialog--docs)
* [CustomDialog](?path=/docs/customdialog--docs)
* [FullscreenDialog](?path=/docs/fullscreendialog--docs)
* [Popover](?path=/docs/popover--docs)
* [ToggleButtonGroup](?path=/docs/togglebuttongroup--docs)

### Updates
Copy link
Member

Choose a reason for hiding this comment

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

Not exactly sure where, but we should link to the new docs for style macro (color and typography) #7292 and optimizing CSS bundling #7278

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm, I think those are pretty important so I'll put it right after the dialog summary blurb

Copy link
Member

Choose a reason for hiding this comment

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

also supporting arbitrary pixel sizes #7385


* [Accordion](?path=/docs/accordion--docs): Add support for adjacent sibling elements in header
* [ActionButton](?path=/docs/actionbutton--docs): Add support for Avatars in ActionButtons
* [Dialog](?path=/docs/dialog--docs): See above for a summary of the changes to Dialog and Dialog adjacent components.
* [Disclosure](?path=/docs/disclosure--docs): Add support for adjacent sibling elements in header
* [DropZone](?path=/docs/dropzone--docs): Add t-shirt sizing
* [Menu](?path=/docs/menu--docs): Add support for separate user defined selection modes per MenuSection
* [Meter](?path=/docs/meter--docs): Add label positioning support
* Update Spectrum Tokens to v53
* Allow arbitrary pixel sizes for style macro sizing properties (e.g. width, height)

### Codemods

* Support Dialog updates
* Support ActionGroup -> ActionButtonGroup/ToggleButtonGroup
* Support arbitrary pixel sizing for style macro sizing properties
* Update S1 to S2 icon mapping

## v0.4.0

### New components
Expand Down
12 changes: 7 additions & 5 deletions packages/@react-spectrum/s2/stories/CustomDialog.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ const meta: Meta<typeof CustomDialog> = {
layout: 'centered'
},
tags: ['autodocs'],
title: 'CustomDialog',
argTypes: {
padding: {table: {disable: true}}
}
title: 'CustomDialog'
};

export default meta;
Expand Down Expand Up @@ -59,7 +56,12 @@ export const EdgeToEdge = (args: any) => (
</DialogTrigger>
);

EdgeToEdge.args = {
padding: 'none'
};

export const Illustration = (args: any) => (

<DialogTrigger>
<ActionButton>Open dialog</ActionButton>
<CustomDialog {...args}>
Expand All @@ -82,7 +84,7 @@ export const SideImage = (args: any) => (
<ActionButton>Open dialog</ActionButton>
<CustomDialog padding="none" {...args}>
<div className={style({display: 'flex', size: 'full', flexDirection: {default: 'column', sm: 'row'}})}>
<Image
<Image
alt=""
src={new URL('./assets/preview.png', import.meta.url).toString()}
styles={style({
Expand Down