-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
Add dialog-hide-warning example #2892
Conversation
🦋 Changeset detectedLatest commit: 504352f The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 504352f:
|
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @ariakit/test@0.3.0 ### Minor Changes - [`#2894`](#2894) All `@ariakit/test` functions now disable `global.IS_REACT_ACT_ENVIRONMENT` before running and restore its value at the end. - [`#2894`](#2894) Replaced the synchronous `fireEvent` functions by asynchronous `dispatch` functions. - [`#2894`](#2894) The `act` export has been removed. - [`#2894`](#2894) Exported user event functions that were previously synchronous are now asyncrhonous. - [`#2899`](#2899) The `screen` module and its queries (`getBy*`, `queryBy*`, etc.) have been removed in favor of the `query` module. - [`#2899`](#2899) The `within` module has been removed. - [`#2900`](#2900) The `render` function has been moved to the `@ariakit/test/react` path. It's now asynchronous. The root `@ariakit/test` package does not depend on React or React Testing Library anymore. ### Patch Changes - [`#2892`](#2892) Updated function argument types to support `null` instead of `Element`, but added a runtime error in case `null` is passed. - [`#2892`](#2892) Added a new `query` module that exports a `query`/`q` object with functions to query the DOM. - Updated dependencies: `@ariakit/core@0.3.3`. ## @ariakit/core@0.3.3 ### Patch Changes - [`#2909`](#2909) Fixed [Disclosure](https://ariakit.org/components/disclosure) and related components not waiting for the exit animation to complete before hiding the content element. - Improved JSDocs. ## @ariakit/react@0.3.4 ### Patch Changes - [`#2894`](#2894) Fixed [Command](https://ariakit.org/components/command) and related components not preventing the default behavior on <kbd>Space</kbd> keyup on non-native button elements. - [`#2896`](#2896) Controlled store updates are no longer flushed synchronously. Previously, we were wrapping _all_ controlled store updates with [`ReactDOM.flushSync`](https://react.dev/reference/react-dom/flushSync). This approach proved to be quite fragile and led to a few problems. Now, we only apply this to specific updates that require synchronous flushing. This change shouldn't impact your application, unless you're already facing problems, which could be fixed by this. If you find any issues stemming from this change, please let us know. Regardless, you can always opt into the previous behavior by wrapping your own updates in `flushSync` when needed: ```js const [open, setOpen] = useState(false); useDialogStore({ open, setOpen(open) { ReactDOM.flushSync(() => setOpen(open)); }, }); ``` - [`#2909`](#2909) Fixed [Disclosure](https://ariakit.org/components/disclosure) and related components not waiting for the exit animation to complete before hiding the content element. - [`#2909`](#2909) The [Dialog](https://ariakit.org/components/dialog) and related components can now receive controlled [`open`](https://ariakit.org/reference/dialog#open) and [`onClose`](https://ariakit.org/reference/dialog#onclose) props, allowing them to be used without a store: ```jsx const [open, setOpen] = useState(false); <Dialog open={open} onClose={() => setOpen(false)} > ``` - [`#2922`](#2922) Added [`unmountOnHide`](https://ariakit.org/reference/disclosure-content#unmountonhide) prop to [`DisclosureContent`](https://ariakit.org/reference/disclosure-content), [`Dialog`](https://ariakit.org/reference/dialog) and related components. Conditionally rendering the [`Dialog`](https://ariakit.org/reference/dialog) and related components will continue to work as before: ```jsx open && <Dialog> ``` Now, you can do the same thing using the [`unmountOnHide`](https://ariakit.org/reference/dialog#unmountonhide) prop: ```jsx <Dialog unmountOnHide> ``` - Improved JSDocs. - Updated dependencies: `@ariakit/react-core@0.3.4`. ## @ariakit/react-core@0.3.4 ### Patch Changes - [`#2894`](#2894) Fixed [Command](https://ariakit.org/components/command) and related components not preventing the default behavior on <kbd>Space</kbd> keyup on non-native button elements. - [`#2896`](#2896) Controlled store updates are no longer flushed synchronously. Previously, we were wrapping _all_ controlled store updates with [`ReactDOM.flushSync`](https://react.dev/reference/react-dom/flushSync). This approach proved to be quite fragile and led to a few problems. Now, we only apply this to specific updates that require synchronous flushing. This change shouldn't impact your application, unless you're already facing problems, which could be fixed by this. If you find any issues stemming from this change, please let us know. Regardless, you can always opt into the previous behavior by wrapping your own updates in `flushSync` when needed: ```js const [open, setOpen] = useState(false); useDialogStore({ open, setOpen(open) { ReactDOM.flushSync(() => setOpen(open)); }, }); ``` - [`#2897`](#2897) Fixed `CompositeRenderer` missing its `items` state when used in a component with a `mounted` state. - [`#2909`](#2909) Fixed [Disclosure](https://ariakit.org/components/disclosure) and related components not waiting for the exit animation to complete before hiding the content element. - [`#2909`](#2909) The [Dialog](https://ariakit.org/components/dialog) and related components can now receive controlled [`open`](https://ariakit.org/reference/dialog#open) and [`onClose`](https://ariakit.org/reference/dialog#onclose) props, allowing them to be used without a store: ```jsx const [open, setOpen] = useState(false); <Dialog open={open} onClose={() => setOpen(false)} > ``` - [`#2922`](#2922) Added [`unmountOnHide`](https://ariakit.org/reference/disclosure-content#unmountonhide) prop to [`DisclosureContent`](https://ariakit.org/reference/disclosure-content), [`Dialog`](https://ariakit.org/reference/dialog) and related components. Conditionally rendering the [`Dialog`](https://ariakit.org/reference/dialog) and related components will continue to work as before: ```jsx open && <Dialog> ``` Now, you can do the same thing using the [`unmountOnHide`](https://ariakit.org/reference/dialog#unmountonhide) prop: ```jsx <Dialog unmountOnHide> ``` - Improved JSDocs. - Updated dependencies: `@ariakit/core@0.3.3`. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Closes #2867
This PR adds an example inspired by the use case reproduced in #2867 with a more idiomatic implementation.
I've also added new query functions to the test package that were used to test this example.