diff --git a/CHANGELOG.md b/CHANGELOG.md index 49b3e92..bff7b5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ and this project adheres to ## [Unreleased] +## [6.4.0] - 2024-10-02 + +### Changed + +- Refactored Alert component to include dismiss animation and timeout +- Refactored ThreeDotsMenu component to include additional props + ## [6.3.0] - 2024-09-27 ### Added @@ -398,7 +405,8 @@ and this project adheres to ## [0.0.7] - 2019-09-02 [unreleased]: - https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.3.0...dev + https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.4.0...dev +[6.4.0]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.3.0...v6.4.0 [6.3.0]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.2.1...v6.3.0 [6.2.1]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.2.0...v6.2.1 [6.2.0]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.1.1...v6.2.0 diff --git a/package-lock.json b/package-lock.json index f01849e..3cb34d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "foris", - "version": "6.3.0", + "version": "6.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "foris", - "version": "6.3.0", + "version": "6.4.0", "license": "GPL-3.0", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.6.0", diff --git a/package.json b/package.json index fe77a00..7fa058e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foris", - "version": "6.3.0", + "version": "6.4.0", "description": "Foris JS library is a set of components and utils for reForis application and plugins.", "author": "CZ.NIC, z.s.p.o.", "repository": { diff --git a/src/bootstrap/Alert.js b/src/bootstrap/Alert.js index 577a753..3697a14 100644 --- a/src/bootstrap/Alert.js +++ b/src/bootstrap/Alert.js @@ -5,7 +5,7 @@ * See /LICENSE for more information. */ -import React, { useRef } from "react"; +import React, { useRef, useEffect, useState } from "react"; import PropTypes from "prop-types"; @@ -40,20 +40,36 @@ Alert.defaultProps = { function Alert({ type, onDismiss, children }) { const alertRef = useRef(); + const [isVisible, setIsVisible] = useState(true); useFocusTrap(alertRef, !!onDismiss); + + useEffect(() => { + if (onDismiss) { + const timeout = setTimeout(() => setIsVisible(false), 7000); + return () => clearTimeout(timeout); + } + }, [onDismiss]); + + const handleAnimationEnd = () => { + if (!isVisible && onDismiss) { + onDismiss(); + } + }; + return (
{onDismiss && (