foris 6.1.0 → 6.1.1-beta.b7a4613c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bootstrap/Alert.js +7 -1
- package/bootstrap/Modal.js +8 -5
- package/bootstrap/PasswordInput.js +1 -1
- package/common/WiFiSettings/WiFiGuestForm.js +4 -7
- package/common/WiFiSettings/WiFiQRCode.js +12 -3
- package/foris-6.1.1.tgz +0 -0
- package/package.json +1 -1
- package/translations/es/LC_MESSAGES/forisjs.po +11 -10
- package/utils/hooks.js +37 -0
- package/foris-6.1.0.tgz +0 -0
package/bootstrap/Alert.js
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
* See /LICENSE for more information.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React from "react";
|
|
8
|
+
import React, { useRef } from "react";
|
|
9
9
|
|
|
10
10
|
import PropTypes from "prop-types";
|
|
11
11
|
|
|
12
|
+
import { useFocusTrap } from "../utils/hooks";
|
|
13
|
+
|
|
12
14
|
export const ALERT_TYPES = Object.freeze({
|
|
13
15
|
PRIMARY: "primary",
|
|
14
16
|
SECONDARY: "secondary",
|
|
@@ -37,11 +39,15 @@ Alert.defaultProps = {
|
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
function Alert({ type, onDismiss, children }) {
|
|
42
|
+
const alertRef = useRef();
|
|
43
|
+
useFocusTrap(alertRef, !!onDismiss);
|
|
40
44
|
return (
|
|
41
45
|
<div
|
|
46
|
+
ref={alertRef}
|
|
42
47
|
className={`alert alert-${type} ${
|
|
43
48
|
onDismiss ? "alert-dismissible" : ""
|
|
44
49
|
}`.trim()}
|
|
50
|
+
role="alert"
|
|
45
51
|
>
|
|
46
52
|
{onDismiss && (
|
|
47
53
|
<button
|
package/bootstrap/Modal.js
CHANGED
|
@@ -9,7 +9,7 @@ import React, { useRef, useEffect } from "react";
|
|
|
9
9
|
|
|
10
10
|
import PropTypes from "prop-types";
|
|
11
11
|
|
|
12
|
-
import { useClickOutside } from "../utils/hooks";
|
|
12
|
+
import { useClickOutside, useFocusTrap } from "../utils/hooks";
|
|
13
13
|
import Portal from "../utils/Portal";
|
|
14
14
|
import "./Modal.css";
|
|
15
15
|
|
|
@@ -29,10 +29,11 @@ Modal.propTypes = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export function Modal({ shown, setShown, scrollable, size, children }) {
|
|
32
|
-
const
|
|
32
|
+
const modalRef = useRef();
|
|
33
33
|
let modalSize = "modal-";
|
|
34
34
|
|
|
35
|
-
useClickOutside(
|
|
35
|
+
useClickOutside(modalRef, () => setShown(false));
|
|
36
|
+
useFocusTrap(modalRef, shown);
|
|
36
37
|
|
|
37
38
|
useEffect(() => {
|
|
38
39
|
const handleEsc = (event) => {
|
|
@@ -65,11 +66,13 @@ export function Modal({ shown, setShown, scrollable, size, children }) {
|
|
|
65
66
|
return (
|
|
66
67
|
<Portal containerId="modal-container">
|
|
67
68
|
<div
|
|
69
|
+
ref={modalRef}
|
|
68
70
|
className={`modal fade ${shown ? "show" : ""}`.trim()}
|
|
69
71
|
role="dialog"
|
|
72
|
+
aria-modal="true"
|
|
73
|
+
aria-labelledby="modal-title"
|
|
70
74
|
>
|
|
71
75
|
<div
|
|
72
|
-
ref={dialogRef}
|
|
73
76
|
className={`${modalSize.trim()} modal-dialog modal-dialog-centered ${
|
|
74
77
|
scrollable ? "modal-dialog-scrollable" : ""
|
|
75
78
|
}`.trim()}
|
|
@@ -90,7 +93,7 @@ ModalHeader.propTypes = {
|
|
|
90
93
|
export function ModalHeader({ setShown, title }) {
|
|
91
94
|
return (
|
|
92
95
|
<div className="modal-header">
|
|
93
|
-
<
|
|
96
|
+
<h1 className="modal-title fs-5">{title}</h1>
|
|
94
97
|
<button
|
|
95
98
|
type="button"
|
|
96
99
|
className="btn-close"
|
|
@@ -68,14 +68,11 @@ export default function WifiGuestForm({
|
|
|
68
68
|
}))}
|
|
69
69
|
{...props}
|
|
70
70
|
>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
/>
|
|
76
|
-
</div>
|
|
71
|
+
<WiFiQRCode
|
|
72
|
+
SSID={formData.SSID}
|
|
73
|
+
password={formData.password}
|
|
74
|
+
/>
|
|
77
75
|
</TextInput>
|
|
78
|
-
|
|
79
76
|
<PasswordInput
|
|
80
77
|
withEye
|
|
81
78
|
label={_("Password")}
|
|
@@ -42,7 +42,7 @@ export default function WiFiQRCode({ SSID, password }) {
|
|
|
42
42
|
icon="fa-solid fa-qrcode"
|
|
43
43
|
title={_("Show QR code")}
|
|
44
44
|
aria-label={_("Show QR code")}
|
|
45
|
-
className="text-
|
|
45
|
+
className="text-secondary"
|
|
46
46
|
/>
|
|
47
47
|
</button>
|
|
48
48
|
{modal ? (
|
|
@@ -70,17 +70,26 @@ function QRCodeModal({ shown, setShown, SSID, password }) {
|
|
|
70
70
|
<ModalHeader setShown={setShown} title={_("Wi-Fi QR Code")} />
|
|
71
71
|
<ModalBody>
|
|
72
72
|
<QRCode
|
|
73
|
+
className="d-block mx-auto img-logo-black"
|
|
73
74
|
renderAs="svg"
|
|
74
75
|
value={toQRCodeContent(SSID, password)}
|
|
75
76
|
level="M"
|
|
76
77
|
size={350}
|
|
77
78
|
includeMargin
|
|
78
|
-
style={{ display: "block", margin: "auto" }}
|
|
79
79
|
/>
|
|
80
80
|
</ModalBody>
|
|
81
81
|
<ModalFooter>
|
|
82
82
|
<Button
|
|
83
|
-
className="btn-
|
|
83
|
+
className="btn-secondary"
|
|
84
|
+
onClick={(e) => {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
setShown(false);
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
{_("Close")}
|
|
90
|
+
</Button>
|
|
91
|
+
<Button
|
|
92
|
+
className="btn-primary"
|
|
84
93
|
onClick={(e) => {
|
|
85
94
|
e.preventDefault();
|
|
86
95
|
createAndDownloadPdf(SSID, password);
|
package/foris-6.1.1.tgz
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -8,15 +8,16 @@ msgstr ""
|
|
|
8
8
|
"Project-Id-Version: PROJECT VERSION\n"
|
|
9
9
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
|
10
10
|
"POT-Creation-Date: 2024-08-23 14:02+0200\n"
|
|
11
|
-
"PO-Revision-Date:
|
|
12
|
-
"Last-Translator:
|
|
11
|
+
"PO-Revision-Date: 2024-08-24 13:09+0000\n"
|
|
12
|
+
"Last-Translator: gallegonovato <fran-carro@hotmail.es>\n"
|
|
13
|
+
"Language-Team: Spanish <https://hosted.weblate.org/projects/turris/foris-js/"
|
|
14
|
+
"es/>\n"
|
|
13
15
|
"Language: es\n"
|
|
14
|
-
"Language-Team: Spanish <https://hosted.weblate.org/projects/turris/foris-"
|
|
15
|
-
"js/es/>\n"
|
|
16
|
-
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
|
17
16
|
"MIME-Version: 1.0\n"
|
|
18
17
|
"Content-Type: text/plain; charset=utf-8\n"
|
|
19
18
|
"Content-Transfer-Encoding: 8bit\n"
|
|
19
|
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
|
20
|
+
"X-Generator: Weblate 5.7.1-dev\n"
|
|
20
21
|
"Generated-By: Babel 2.16.0\n"
|
|
21
22
|
|
|
22
23
|
#: src/api/utils.js:61
|
|
@@ -39,7 +40,7 @@ msgstr ""
|
|
|
39
40
|
|
|
40
41
|
#: src/bootstrap/Alert.js:51 src/bootstrap/Modal.js:98
|
|
41
42
|
msgid "Close"
|
|
42
|
-
msgstr ""
|
|
43
|
+
msgstr "Cerrar"
|
|
43
44
|
|
|
44
45
|
#: src/bootstrap/CopyInput.js:57
|
|
45
46
|
msgid "Copied!"
|
|
@@ -123,13 +124,15 @@ msgstr "Cifrado"
|
|
|
123
124
|
|
|
124
125
|
#: src/common/WiFiSettings/WiFiForm.js:226
|
|
125
126
|
msgid "Disable Management Frame Protection"
|
|
126
|
-
msgstr ""
|
|
127
|
+
msgstr "Desactivar Protected Management Frames"
|
|
127
128
|
|
|
128
129
|
#: src/common/WiFiSettings/WiFiForm.js:227
|
|
129
130
|
msgid ""
|
|
130
131
|
"In case you have trouble connecting to WiFi Access Point, try disabling "
|
|
131
132
|
"Management Frame Protection."
|
|
132
133
|
msgstr ""
|
|
134
|
+
"Si tienes problemas para conectarte a un punto de acceso Wi-Fi, intenta "
|
|
135
|
+
"desactivar Management Frame Protection."
|
|
133
136
|
|
|
134
137
|
#: src/common/WiFiSettings/WiFiForm.js:262
|
|
135
138
|
msgid "auto"
|
|
@@ -145,9 +148,8 @@ msgstr "Activar el modo Wi-Fi de invitados"
|
|
|
145
148
|
|
|
146
149
|
#: src/common/WiFiSettings/WiFiQRCode.js:43
|
|
147
150
|
#: src/common/WiFiSettings/WiFiQRCode.js:44
|
|
148
|
-
#, fuzzy
|
|
149
151
|
msgid "Show QR code"
|
|
150
|
-
msgstr "
|
|
152
|
+
msgstr "Mostrar el código QR"
|
|
151
153
|
|
|
152
154
|
#: src/common/WiFiSettings/WiFiQRCode.js:70
|
|
153
155
|
msgid "Wi-Fi QR Code"
|
|
@@ -444,4 +446,3 @@ msgstr "No contiene una lista de correos electrónicos separados por comas."
|
|
|
444
446
|
#~ " default option with 20 MHz wide "
|
|
445
447
|
#~ "channel."
|
|
446
448
|
#~ msgstr ""
|
|
447
|
-
|
package/utils/hooks.js
CHANGED
|
@@ -40,3 +40,40 @@ export function useClickOutside(element, callback) {
|
|
|
40
40
|
};
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
/* Trap focus inside element. */
|
|
45
|
+
export function useFocusTrap(elementRef, condition = true) {
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!condition) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const currentElement = elementRef.current;
|
|
51
|
+
const focusableElements = currentElement.querySelectorAll(
|
|
52
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
53
|
+
);
|
|
54
|
+
const firstElement = focusableElements[0];
|
|
55
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
56
|
+
|
|
57
|
+
const handleTab = (event) => {
|
|
58
|
+
if (event.key === "Tab") {
|
|
59
|
+
if (event.shiftKey) {
|
|
60
|
+
if (document.activeElement === firstElement) {
|
|
61
|
+
lastElement.focus();
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
}
|
|
64
|
+
} else if (document.activeElement === lastElement) {
|
|
65
|
+
firstElement.focus();
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
currentElement.addEventListener("keydown", handleTab);
|
|
72
|
+
|
|
73
|
+
firstElement.focus();
|
|
74
|
+
|
|
75
|
+
return () => {
|
|
76
|
+
currentElement.removeEventListener("keydown", handleTab);
|
|
77
|
+
};
|
|
78
|
+
}, [elementRef, condition]);
|
|
79
|
+
}
|
package/foris-6.1.0.tgz
DELETED
|
Binary file
|