diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e670df..cb70402 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,22 @@ and this project adheres to ## [Unreleased] +## [6.6.0] - 2025-02-07 + +### Added + +- Added & updated Weblate translations +- Added Wi-Fi and LAN settings URLs to ForisURLs +- Added Wi-Fi modes VHT/HE 80+80 +- Added encryption selection to WiFiGuestForm +- Added optional close button to ModalHeader component + +### Changed + +- Updated Wi-Fi API +- Enhanced NumberInput component with keyboard & touch accessibility +- Refactored pagination condition in RichTable component + ## [6.5.0] - 2024-11-13 ### Added @@ -419,7 +435,8 @@ and this project adheres to ## [0.0.7] - 2019-09-02 [unreleased]: - https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.5.0...dev + https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.6.0...dev +[6.6.0]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.5.0...v6.6.0 [6.5.0]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.4.0...v6.5.0 [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 diff --git a/package-lock.json b/package-lock.json index 882a7f5..646d42a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "foris", - "version": "6.5.0", + "version": "6.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "foris", - "version": "6.5.0", + "version": "6.6.0", "license": "GPL-3.0", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.6.0", diff --git a/package.json b/package.json index 994c90f..e4399a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foris", - "version": "6.5.0", + "version": "6.6.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/Modal.js b/src/bootstrap/Modal.js index a1e65c0..efdf6a8 100644 --- a/src/bootstrap/Modal.js +++ b/src/bootstrap/Modal.js @@ -88,18 +88,21 @@ export function Modal({ shown, setShown, scrollable, size, children }) { ModalHeader.propTypes = { setShown: PropTypes.func.isRequired, title: PropTypes.string.isRequired, + showCloseButton: PropTypes.bool, }; -export function ModalHeader({ setShown, title }) { +export function ModalHeader({ setShown, title, showCloseButton = true }) { return (

{title}

-
); } diff --git a/src/bootstrap/NumberInput.js b/src/bootstrap/NumberInput.js index 1a825a5..beaa22d 100644 --- a/src/bootstrap/NumberInput.js +++ b/src/bootstrap/NumberInput.js @@ -50,6 +50,20 @@ function NumberInput({ onChange, inlineText, value, ...props }) { -1 ); + function handleKeyDown(event, enableFunction) { + if (event.key === "Enter" || event.key === " ") { + event.preventDefault(); + enableFunction(true); + } + } + + function handleKeyUp(event, enableFunction) { + if (event.key === "Enter" || event.key === " ") { + event.preventDefault(); + enableFunction(false); + } + } + return ( {inlineText && ( @@ -60,7 +74,15 @@ function NumberInput({ onChange, inlineText, value, ...props }) { className="btn btn-outline-secondary" onMouseDown={() => enableIncrease(true)} onMouseUp={() => enableIncrease(false)} - aria-label="Increase" + onMouseLeave={() => enableIncrease(false)} + onTouchStart={() => enableIncrease(true)} + onTouchEnd={() => enableIncrease(false)} + onTouchCancel={() => enableIncrease(false)} + onKeyDown={(event) => handleKeyDown(event, enableIncrease)} + onKeyUp={(event) => handleKeyUp(event, enableIncrease)} + onBlur={() => enableIncrease(false)} + title={_("Increase value. Hint: Hold to increase faster.")} + aria-label={_("Increase value. Hint: Hold to increase faster.")} > @@ -69,7 +91,15 @@ function NumberInput({ onChange, inlineText, value, ...props }) { className="btn btn-outline-secondary" onMouseDown={() => enableDecrease(true)} onMouseUp={() => enableDecrease(false)} - aria-label="Decrease" + onMouseLeave={() => enableDecrease(false)} + onTouchStart={() => enableDecrease(true)} + onTouchEnd={() => enableDecrease(false)} + onTouchCancel={() => enableDecrease(false)} + onKeyDown={(event) => handleKeyDown(event, enableDecrease)} + onKeyUp={(event) => handleKeyUp(event, enableDecrease)} + onBlur={() => enableDecrease(false)} + title={_("Decrease value. Hint: Hold to decrease faster.")} + aria-label={_("Decrease value. Hint: Hold to decrease faster.")} > diff --git a/src/bootstrap/__tests__/NumberInput.test.js b/src/bootstrap/__tests__/NumberInput.test.js index 6df7200..c0d89df 100644 --- a/src/bootstrap/__tests__/NumberInput.test.js +++ b/src/bootstrap/__tests__/NumberInput.test.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/) + * Copyright (C) 2019-2024 CZ.NIC z.s.p.o. (https://www.nic.cz/) * * This is free software, licensed under the GNU General Public License v3. * See /LICENSE for more information. @@ -32,7 +32,7 @@ describe("", () => { }); it("Increase number with button", async () => { - const increaseButton = getByLabelText(componentContainer, "Increase"); + const increaseButton = getByLabelText(componentContainer, /Increase/); fireEvent.mouseDown(increaseButton); await wait(() => expect(onChangeMock).toHaveBeenCalledWith({ target: { value: 2 } }) @@ -40,7 +40,7 @@ describe("", () => { }); it("Decrease number with button", async () => { - const decreaseButton = getByLabelText(componentContainer, "Decrease"); + const decreaseButton = getByLabelText(componentContainer, /Decrease/); fireEvent.mouseDown(decreaseButton); await wait(() => expect(onChangeMock).toHaveBeenCalledWith({ target: { value: 0 } }) diff --git a/src/bootstrap/__tests__/__snapshots__/NumberInput.test.js.snap b/src/bootstrap/__tests__/__snapshots__/NumberInput.test.js.snap index 306ab26..874e03f 100644 --- a/src/bootstrap/__tests__/__snapshots__/NumberInput.test.js.snap +++ b/src/bootstrap/__tests__/__snapshots__/NumberInput.test.js.snap @@ -20,8 +20,9 @@ exports[` Render number input 1`] = ` value="1" />