diff --git a/CHANGELOG.md b/CHANGELOG.md index ce2015bb38..ed76e0c0af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix `Popup` - do not stop event propagation when pressing Esc on trigger element @sophieH29 ([#750](https://github.com/stardust-ui/react/pull/750)) - Fix alignment of `Layout`'s `main` area @kuzhelov ([#752](https://github.com/stardust-ui/react/pull/752)) - Forwarding props for `createShorthand` calls if the value is a React element @mnajdova ([#759](https://github.com/stardust-ui/react/pull/759)) +- Call `Popup` `onOpenChange` on all user initiated events @levithomason ([#619](https://github.com/stardust-ui/react/pull/619)) ### Features - Rename `Slot` component to `Box` and export it @Bugaa92 ([#713](https://github.com/stardust-ui/react/pull/713)) diff --git a/docs/src/examples/components/Popup/Types/PopupControlledExample.shorthand.tsx b/docs/src/examples/components/Popup/Types/PopupControlledExample.shorthand.tsx index 198daebfac..9f00929dd1 100644 --- a/docs/src/examples/components/Popup/Types/PopupControlledExample.shorthand.tsx +++ b/docs/src/examples/components/Popup/Types/PopupControlledExample.shorthand.tsx @@ -1,22 +1,20 @@ import * as React from 'react' import { Button, Input, Popup } from '@stardust-ui/react' -class PopupControlledExample extends React.Component { - state = { popupOpen: false } +class PopupControlledExample extends React.Component { + state = { open: false } - togglePopup() { - this.setState(prev => ({ popupOpen: !prev.popupOpen })) + handleOpenChange = (e, { open }) => { + alert(`Popup requested to change its open state to "${open}".`) + this.setState({ open }) } render() { return ( { - alert(`Popup is requested to change its open state to "${newProps.open}".`) - this.setState({ popupOpen: newProps.open }) - }} - trigger={