foris 6.5.0-beta.5a53eca1 → 6.5.0-beta.dff5f87e

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.
@@ -88,18 +88,21 @@ export function Modal({ shown, setShown, scrollable, size, children }) {
88
88
  ModalHeader.propTypes = {
89
89
  setShown: PropTypes.func.isRequired,
90
90
  title: PropTypes.string.isRequired,
91
+ showCloseButton: PropTypes.bool,
91
92
  };
92
93
 
93
- export function ModalHeader({ setShown, title }) {
94
+ export function ModalHeader({ setShown, title, showCloseButton = true }) {
94
95
  return (
95
96
  <div className="modal-header">
96
97
  <h1 className="modal-title fs-5">{title}</h1>
97
- <button
98
- type="button"
99
- className="btn-close"
100
- onClick={() => setShown(false)}
101
- aria-label={_("Close")}
102
- />
98
+ {showCloseButton && (
99
+ <button
100
+ type="button"
101
+ className="btn-close"
102
+ onClick={() => setShown(false)}
103
+ aria-label={_("Close")}
104
+ />
105
+ )}
103
106
  </div>
104
107
  );
105
108
  }
@@ -50,6 +50,20 @@ function NumberInput({ onChange, inlineText, value, ...props }) {
50
50
  -1
51
51
  );
52
52
 
53
+ function handleKeyDown(event, enableFunction) {
54
+ if (event.key === "Enter" || event.key === " ") {
55
+ event.preventDefault();
56
+ enableFunction(true);
57
+ }
58
+ }
59
+
60
+ function handleKeyUp(event, enableFunction) {
61
+ if (event.key === "Enter" || event.key === " ") {
62
+ event.preventDefault();
63
+ enableFunction(false);
64
+ }
65
+ }
66
+
53
67
  return (
54
68
  <Input type="number" onChange={onChange} value={value} {...props}>
55
69
  {inlineText && (
@@ -60,7 +74,15 @@ function NumberInput({ onChange, inlineText, value, ...props }) {
60
74
  className="btn btn-outline-secondary"
61
75
  onMouseDown={() => enableIncrease(true)}
62
76
  onMouseUp={() => enableIncrease(false)}
63
- aria-label="Increase"
77
+ onMouseLeave={() => enableIncrease(false)}
78
+ onTouchStart={() => enableIncrease(true)}
79
+ onTouchEnd={() => enableIncrease(false)}
80
+ onTouchCancel={() => enableIncrease(false)}
81
+ onKeyDown={(event) => handleKeyDown(event, enableIncrease)}
82
+ onKeyUp={(event) => handleKeyUp(event, enableIncrease)}
83
+ onBlur={() => enableIncrease(false)}
84
+ title={_("Increase value. Hint: Hold to increase faster.")}
85
+ aria-label={_("Increase value. Hint: Hold to increase faster.")}
64
86
  >
65
87
  <FontAwesomeIcon icon={faPlus} />
66
88
  </button>
@@ -69,7 +91,15 @@ function NumberInput({ onChange, inlineText, value, ...props }) {
69
91
  className="btn btn-outline-secondary"
70
92
  onMouseDown={() => enableDecrease(true)}
71
93
  onMouseUp={() => enableDecrease(false)}
72
- aria-label="Decrease"
94
+ onMouseLeave={() => enableDecrease(false)}
95
+ onTouchStart={() => enableDecrease(true)}
96
+ onTouchEnd={() => enableDecrease(false)}
97
+ onTouchCancel={() => enableDecrease(false)}
98
+ onKeyDown={(event) => handleKeyDown(event, enableDecrease)}
99
+ onKeyUp={(event) => handleKeyUp(event, enableDecrease)}
100
+ onBlur={() => enableDecrease(false)}
101
+ title={_("Decrease value. Hint: Hold to decrease faster.")}
102
+ aria-label={_("Decrease value. Hint: Hold to decrease faster.")}
73
103
  >
74
104
  <FontAwesomeIcon icon={faMinus} />
75
105
  </button>
@@ -64,13 +64,15 @@ function RichTable({
64
64
  },
65
65
  });
66
66
 
67
+ const paginationIsNeeded = tableData.length > pageSize && withPagination;
68
+
67
69
  return (
68
70
  <div className="table-responsive">
69
71
  <table className="table table-hover text-nowrap">
70
72
  <RichTableHeader table={table} flexRender={flexRender} />
71
73
  <RichTableBody table={table} flexRender={flexRender} />
72
74
  </table>
73
- {withPagination && (
75
+ {paginationIsNeeded && (
74
76
  <RichTablePagination
75
77
  table={table}
76
78
  tablePageSize={pageSize}
@@ -9,9 +9,10 @@ import React from "react";
9
9
 
10
10
  import PropTypes from "prop-types";
11
11
 
12
- import { HELP_TEXTS } from "./constants";
12
+ import { HELP_TEXTS, ENCRYPTIONMODES } from "./constants";
13
13
  import WiFiQRCode from "./WiFiQRCode";
14
14
  import PasswordInput from "../../bootstrap/PasswordInput";
15
+ import Select from "../../bootstrap/Select";
15
16
  import Switch from "../../bootstrap/Switch";
16
17
  import TextInput from "../../bootstrap/TextInput";
17
18
 
@@ -21,6 +22,7 @@ WifiGuestForm.propTypes = {
21
22
  SSID: PropTypes.string.isRequired,
22
23
  password: PropTypes.string.isRequired,
23
24
  enabled: PropTypes.bool.isRequired,
25
+ encryption: PropTypes.string.isRequired,
24
26
  }),
25
27
  formErrors: PropTypes.shape({
26
28
  SSID: PropTypes.string,
@@ -89,6 +91,20 @@ export default function WifiGuestForm({
89
91
  }))}
90
92
  {...props}
91
93
  />
94
+ <Select
95
+ label={_("Encryption")}
96
+ choices={ENCRYPTIONMODES}
97
+ helpText={HELP_TEXTS.wpa3}
98
+ value={formData.encryption}
99
+ onChange={setFormValue((value) => ({
100
+ devices: {
101
+ [formData.id]: {
102
+ guest_wifi: { encryption: { $set: value } },
103
+ },
104
+ },
105
+ }))}
106
+ {...props}
107
+ />
92
108
  </>
93
109
  ) : null}
94
110
  </>
package/foris-6.5.0.tgz CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foris",
3
- "version": "6.5.0-beta.5a53eca1",
3
+ "version": "6.5.0-beta.dff5f87e",
4
4
  "description": "Foris JS library is a set of components and utils for reForis application and plugins.",
5
5
  "author": "CZ.NIC, z.s.p.o.",
6
6
  "repository": {