1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2025-06-15 13:36:35 +02:00

Compare commits

..

18 Commits

Author SHA1 Message Date
7e0752fc17 Merge branch 'dev' into 'master'
Dev

See merge request turris/reforis/foris-js!228
2024-07-26 16:12:26 +02:00
4c5aeed26e Merge branch 'bump-603' into 'dev'
Bump v6.0.3

See merge request turris/reforis/foris-js!227
2024-07-26 16:08:09 +02:00
d90e39a570 Bump v6.0.3
* Update WiFiQRCode component
2024-07-26 17:06:38 +03:00
2e2f326ade Merge branch 'wifi-qr-icon' into 'dev'
Update WiFiQRCode component

See merge request turris/reforis/foris-js!226
2024-07-26 14:26:00 +02:00
541ca7a784 Update WiFiQRCode component
Remove custom QR icon image with a standard fontawesome icon
2024-07-25 17:31:30 +03:00
8e0c60a576 Merge branch 'dev' into 'master'
Dev

See merge request turris/reforis/foris-js!225
2024-06-28 14:22:41 +02:00
928cf716d6 Merge branch 'bump-602' into 'dev'
Bump v6.0.2

See merge request turris/reforis/foris-js!224
2024-06-28 13:08:32 +02:00
bd8d5bc8cb Bump v6.0.2
* Add className prop to CheckBox and Radio components
2024-06-28 14:03:19 +03:00
804e0022eb Update Snapshots 2024-06-28 10:30:25 +03:00
d69398ac06 Add className prop to CheckBox and Radio components 2024-06-28 10:29:41 +03:00
e297410f16 Merge branch 'dev' into 'master'
Dev

See merge request turris/reforis/foris-js!223
2024-06-26 15:05:29 +02:00
17e5a959f7 Merge branch 'bump-601' into 'dev'
Bump v6.0.1

See merge request turris/reforis/foris-js!222
2024-06-26 15:00:58 +02:00
3b48510246 Bump v6.0.1
* Add className prop to Switch component
* Update dependencies in package.json
* NPM audit fix
2024-06-26 15:59:26 +03:00
8bac4f18f4 NPM audit fix 2024-06-26 15:57:31 +03:00
6cb2a5388e Update dependencies in package.json
Update Webpack and Prettier to latest versions
2024-06-26 15:52:57 +03:00
0b02bead71 Merge branch 'add-classname-prop-to-switch' into 'dev'
Add className prop to Switch

See merge request turris/reforis/foris-js!221
2024-06-26 14:24:49 +02:00
12c6d05ca6 Update Snapshots 2024-06-26 14:11:54 +03:00
923bbab6d5 Add className prop to Switch component 2024-06-26 14:11:16 +03:00
10 changed files with 114 additions and 86 deletions

View File

@ -8,6 +8,29 @@ and this project adheres to
## [Unreleased]
## [6.0.3] - 2024-07-26
### Changed
- Updated WiFiQRCode component
## [6.0.2] - 2024-06-28
### Added
- Added className prop to CheckBox and Radio components
## [6.0.1] - 2024-06-26
### Added
- Added className prop to Switch component
### Changed
- Updated dependencies in package.json
- NPM audit fix
## [6.0.0] - 2024-06-11
### Added
@ -314,7 +337,10 @@ and this project adheres to
## [0.0.7] - 2019-09-02
[unreleased]:
https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.0.0...master
https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.0.3...master
[6.0.3]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.0.2...v6.0.3
[6.0.2]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.0.1...v6.0.2
[6.0.1]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.0.0...v6.0.1
[6.0.0]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v5.6.1...v6.0.0
[5.6.1]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v5.6.0...v5.6.1
[5.6.0]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v5.5.0...v5.6.0

88
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "foris",
"version": "6.0.0",
"version": "6.0.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "foris",
"version": "6.0.0",
"version": "6.0.3",
"license": "GPL-3.0",
"dependencies": {
"axios": "^1.7.2",
@ -35,7 +35,7 @@
"jest-environment-jsdom": "^29.7.0",
"jest-mock-axios": "^4.7.3",
"moment-timezone": "^0.5.45",
"prettier": "^3.3.1",
"prettier": "^3.3.2",
"prop-types": "15.8.1",
"react": "16.9.0",
"react-dom": "16.9.0",
@ -43,7 +43,7 @@
"react-styleguidist": "^12.0.1",
"snapshot-diff": "^0.10.0",
"style-loader": "^1.2.1",
"webpack": "^5.91.0"
"webpack": "^5.92.1"
},
"peerDependencies": {
"bootstrap": "^5.3.3",
@ -4314,6 +4314,16 @@
"acorn-walk": "^8.0.2"
}
},
"node_modules/acorn-import-attributes": {
"version": "1.9.5",
"resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz",
"integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"acorn": "^8"
}
},
"node_modules/acorn-jsx": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
@ -15071,10 +15081,11 @@
}
},
"node_modules/prettier": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.1.tgz",
"integrity": "sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==",
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz",
"integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==",
"dev": true,
"license": "MIT",
"bin": {
"prettier": "bin/prettier.cjs"
},
@ -18145,10 +18156,11 @@
}
},
"node_modules/webpack": {
"version": "5.91.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.91.0.tgz",
"integrity": "sha512-rzVwlLeBWHJbmgTC/8TvAcu5vpJNII+MelQpylD4jNERPwpBJOE2lEcko1zJX3QJeLjTTAnQxn/OJ8bjDzVQaw==",
"version": "5.92.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.92.1.tgz",
"integrity": "sha512-JECQ7IwJb+7fgUFBlrJzbyu3GEuNBcdqr1LD7IbSzwkSmIevTm8PF+wej3Oxuz/JFBUZ6O1o43zsPkwm1C4TmA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/eslint-scope": "^3.7.3",
"@types/estree": "^1.0.5",
@ -18156,10 +18168,10 @@
"@webassemblyjs/wasm-edit": "^1.12.1",
"@webassemblyjs/wasm-parser": "^1.12.1",
"acorn": "^8.7.1",
"acorn-import-assertions": "^1.9.0",
"acorn-import-attributes": "^1.9.5",
"browserslist": "^4.21.10",
"chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.16.0",
"enhanced-resolve": "^5.17.0",
"es-module-lexer": "^1.2.1",
"eslint-scope": "5.1.1",
"events": "^3.2.0",
@ -18404,15 +18416,6 @@
"lodash": "^4.17.15"
}
},
"node_modules/webpack/node_modules/acorn-import-assertions": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz",
"integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==",
"dev": true,
"peerDependencies": {
"acorn": "^8"
}
},
"node_modules/webpack/node_modules/schema-utils": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz",
@ -18694,10 +18697,11 @@
}
},
"node_modules/ws": {
"version": "8.17.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz",
"integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==",
"version": "8.17.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10.0.0"
},
@ -22083,6 +22087,13 @@
"acorn-walk": "^8.0.2"
}
},
"acorn-import-attributes": {
"version": "1.9.5",
"resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz",
"integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==",
"dev": true,
"requires": {}
},
"acorn-jsx": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
@ -30150,9 +30161,9 @@
"dev": true
},
"prettier": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.1.tgz",
"integrity": "sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==",
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz",
"integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==",
"dev": true
},
"prettier-linter-helpers": {
@ -32451,9 +32462,9 @@
"dev": true
},
"webpack": {
"version": "5.91.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.91.0.tgz",
"integrity": "sha512-rzVwlLeBWHJbmgTC/8TvAcu5vpJNII+MelQpylD4jNERPwpBJOE2lEcko1zJX3QJeLjTTAnQxn/OJ8bjDzVQaw==",
"version": "5.92.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.92.1.tgz",
"integrity": "sha512-JECQ7IwJb+7fgUFBlrJzbyu3GEuNBcdqr1LD7IbSzwkSmIevTm8PF+wej3Oxuz/JFBUZ6O1o43zsPkwm1C4TmA==",
"dev": true,
"requires": {
"@types/eslint-scope": "^3.7.3",
@ -32462,10 +32473,10 @@
"@webassemblyjs/wasm-edit": "^1.12.1",
"@webassemblyjs/wasm-parser": "^1.12.1",
"acorn": "^8.7.1",
"acorn-import-assertions": "^1.9.0",
"acorn-import-attributes": "^1.9.5",
"browserslist": "^4.21.10",
"chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.16.0",
"enhanced-resolve": "^5.17.0",
"es-module-lexer": "^1.2.1",
"eslint-scope": "5.1.1",
"events": "^3.2.0",
@ -32482,13 +32493,6 @@
"webpack-sources": "^3.2.3"
},
"dependencies": {
"acorn-import-assertions": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz",
"integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==",
"dev": true,
"requires": {}
},
"schema-utils": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz",
@ -32853,9 +32857,9 @@
}
},
"ws": {
"version": "8.17.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz",
"integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==",
"version": "8.17.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"dev": true,
"requires": {}
},

View File

@ -1,6 +1,6 @@
{
"name": "foris",
"version": "6.0.0",
"version": "6.0.3",
"description": "Foris JS library is a set of components and utils for reForis application and plugins.",
"author": "CZ.NIC, z.s.p.o.",
"repository": {
@ -47,7 +47,7 @@
"jest-environment-jsdom": "^29.7.0",
"jest-mock-axios": "^4.7.3",
"moment-timezone": "^0.5.45",
"prettier": "^3.3.1",
"prettier": "^3.3.2",
"prop-types": "15.8.1",
"react": "16.9.0",
"react-dom": "16.9.0",
@ -55,7 +55,7 @@
"react-styleguidist": "^12.0.1",
"snapshot-diff": "^0.10.0",
"style-loader": "^1.2.1",
"webpack": "^5.91.0"
"webpack": "^5.92.1"
},
"scripts": {
"lint": "eslint src",

View File

@ -17,17 +17,19 @@ CheckBox.propTypes = {
helpText: PropTypes.string,
/** Control if checkbox is clickable */
disabled: PropTypes.bool,
/** Additional class name */
className: PropTypes.string,
};
CheckBox.defaultProps = {
disabled: false,
};
function CheckBox({ label, helpText, disabled, ...props }) {
function CheckBox({ label, helpText, disabled, className, ...props }) {
const uid = useUID();
return (
<div className="mb-3 form-check">
<div className={`${className || "mb-3"} form-check`.trim()}>
<input
className="form-check-input"
type="checkbox"

View File

@ -83,12 +83,13 @@ Radio.propTypes = {
id: PropTypes.string.isRequired,
inline: PropTypes.bool,
helpText: PropTypes.string,
className: PropTypes.string,
};
export function Radio({ label, id, helpText, inline, ...props }) {
export function Radio({ label, id, helpText, inline, className, ...props }) {
return (
<div
className={`mb-2 ${inline ? "form-check form-check-inline" : ""}`.trim()}
className={`${className || "mb-3"} ${inline ? "form-check form-check-inline" : ""}`.trim()}
>
<input
id={id}

View File

@ -19,15 +19,16 @@ Switch.propTypes = {
]).isRequired,
helpText: PropTypes.string,
switchHeading: PropTypes.bool,
className: PropTypes.string,
};
function Switch({ label, helpText, switchHeading, ...props }) {
function Switch({ label, helpText, switchHeading, className, ...props }) {
const uid = useUID();
return (
<div
className={`form-check form-switch mb-3 ${
switchHeading ? "d-flex align-items-center" : null
className={`form-check form-switch ${className || "mb-3"} ${
switchHeading ? "d-flex align-items-center" : ""
}`.trim()}
>
<input

View File

@ -11,7 +11,7 @@ exports[`<RadioSet/> Render radio set 1`] = `
Radios set label
</label>
<div
class="mb-2"
class="mb-3"
>
<input
checked=""
@ -29,7 +29,7 @@ exports[`<RadioSet/> Render radio set 1`] = `
</label>
</div>
<div
class="mb-2"
class="mb-3"
>
<input
class="form-check-input me-2"
@ -46,7 +46,7 @@ exports[`<RadioSet/> Render radio set 1`] = `
</label>
</div>
<div
class="mb-2"
class="mb-3"
>
<input
class="form-check-input me-2"

View File

@ -2,7 +2,7 @@
exports[`<Switch/> Render switch 1`] = `
<div
class="form-check form-switch mb-3 null"
class="form-check form-switch mb-3"
>
<input
checked=""
@ -29,7 +29,7 @@ exports[`<Switch/> Render switch 1`] = `
exports[`<Switch/> Render uncheked switch 1`] = `
<div
class="form-check form-switch mb-3 null"
class="form-check form-switch mb-3"
>
<input
class="form-check-input"

View File

@ -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.
@ -18,15 +18,12 @@ import {
ModalFooter,
ModalHeader,
} from "../../bootstrap/Modal";
import { ForisURLs } from "../../utils/forisUrls";
WiFiQRCode.propTypes = {
SSID: PropTypes.string.isRequired,
password: PropTypes.string.isRequired,
};
const QR_ICON_PATH = `${ForisURLs.static}/imgs/QR_icon.svg`;
export default function WiFiQRCode({ SSID, password }) {
const [modal, setModal] = useState(false);
@ -40,11 +37,10 @@ export default function WiFiQRCode({ SSID, password }) {
setModal(true);
}}
>
<img
width="20"
src={QR_ICON_PATH}
alt="QR"
style={{ opacity: 0.67 }}
<i
className="fa-solid fa-qrcode"
title={_("Show QR code")}
aria-label={_("Show QR code")}
/>
</button>
{modal ? (

View File

@ -5,7 +5,7 @@ exports[`<WiFiSettings/> Snapshot 2.4 GHz 1`] = `
- First value
+ Second value
@@ -243,207 +243,95 @@
@@ -242,207 +242,95 @@
value="0"
>
auto
@ -339,7 +339,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
- First value
+ Second value
@@ -527,10 +527,94 @@
@@ -526,10 +526,93 @@
<small>
Enables Wi-Fi for guests, which is separated from LAN network. Devices connected to this network are allowed to access the internet, but aren't allowed to access other devices and the configuration interface of the router. Parameters of the guest network can be set in the Guest network tab.
</small>
@ -370,11 +370,10 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
+ class="input-group-text"
+ type="button"
+ >
+ <img
+ alt="QR"
+ src="/reforis/static/reforis/imgs/QR_icon.svg"
+ style="opacity: 0.67;"
+ width="20"
+ <i
+ aria-label="Show QR code"
+ class="fa-solid fa-qrcode"
+ title="Show QR code"
+ />
+ </button>
+ </div>
@ -434,7 +433,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
class="form-check form-switch mb-3 d-flex align-items-center"
>
<input
@@ -553,10 +637,11 @@
@@ -552,10 +635,11 @@
<div
class="text-end"
>
@ -453,7 +452,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
- First value
+ Second value
@@ -21,10 +21,516 @@
@@ -21,10 +21,515 @@
>
Wi-Fi 1
</h2>
@ -482,11 +481,10 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ class="input-group-text"
+ type="button"
+ >
+ <img
+ alt="QR"
+ src="/reforis/static/reforis/imgs/QR_icon.svg"
+ style="opacity: 0.67;"
+ width="20"
+ <i
+ aria-label="Show QR code"
+ class="fa-solid fa-qrcode"
+ title="Show QR code"
+ />
+ </button>
+ </div>
@ -536,7 +534,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ </div>
+ </div>
+ <div
+ class="form-check form-switch mb-3 null"
+ class="form-check form-switch mb-3"
+ >
+ <input
+ class="form-check-input"
@ -568,7 +566,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ GHz
+ </label>
+ <div
+ class="mb-2 form-check form-check-inline"
+ class="mb-3 form-check form-check-inline"
+ >
+ <input
+ class="form-check-input me-2"
@ -585,7 +583,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ </label>
+ </div>
+ <div
+ class="mb-2 form-check form-check-inline"
+ class="mb-3 form-check form-check-inline"
+ >
+ <input
+ checked=""
@ -920,7 +918,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ </div>
+ </div>
+ <div
+ class="form-check form-switch mb-3 null"
+ class="form-check form-switch mb-3"
+ >
+ <input
+ class="form-check-input"
@ -943,7 +941,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ </div>
+ </div>
+ <div
+ class="form-check form-switch mb-3 null"
+ class="form-check form-switch mb-3"
+ >
+ <input
+ class="form-check-input"