foris 6.2.1 → 6.3.0-beta.1ec0a261
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/EmailInput.md +2 -1
- package/bootstrap/Radio.js +48 -0
- package/bootstrap/RadioSet.js +2 -36
- package/bootstrap/ThreeDotsMenu.js +42 -0
- package/bootstrap/ThreeDotsMenu.md +40 -0
- package/foris-6.3.0.tgz +0 -0
- package/index.js +3 -1
- package/package.json +1 -1
- package/foris-6.2.1.tgz +0 -0
package/bootstrap/EmailInput.md
CHANGED
|
@@ -6,6 +6,7 @@ All additional `props` are passed to the `<input type="email">` HTML component.
|
|
|
6
6
|
|
|
7
7
|
```js
|
|
8
8
|
import { useState } from "react";
|
|
9
|
+
import Button from "./Button";
|
|
9
10
|
const [email, setEmail] = useState("Wrong email");
|
|
10
11
|
<form onSubmit={(e) => e.preventDefault()}>
|
|
11
12
|
<EmailInput
|
|
@@ -14,6 +15,6 @@ const [email, setEmail] = useState("Wrong email");
|
|
|
14
15
|
helpText="Read the small text!"
|
|
15
16
|
onChange={(event) => setEmail(event.target.value)}
|
|
16
17
|
/>
|
|
17
|
-
<
|
|
18
|
+
<Button type="submit">Try to submit</Button>
|
|
18
19
|
</form>;
|
|
19
20
|
```
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
|
3
|
+
*
|
|
4
|
+
* This is free software, licensed under the GNU General Public License v3.
|
|
5
|
+
* See /LICENSE for more information.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import PropTypes from "prop-types";
|
|
11
|
+
|
|
12
|
+
Radio.propTypes = {
|
|
13
|
+
label: PropTypes.oneOfType([
|
|
14
|
+
PropTypes.string,
|
|
15
|
+
PropTypes.element,
|
|
16
|
+
PropTypes.node,
|
|
17
|
+
PropTypes.arrayOf(PropTypes.node),
|
|
18
|
+
]).isRequired,
|
|
19
|
+
id: PropTypes.string.isRequired,
|
|
20
|
+
inline: PropTypes.bool,
|
|
21
|
+
helpText: PropTypes.string,
|
|
22
|
+
className: PropTypes.string,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function Radio({ label, id, helpText, inline, className, ...props }) {
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
className={`${className || "mb-3"} ${inline ? "form-check form-check-inline" : ""}`.trim()}
|
|
29
|
+
>
|
|
30
|
+
<input
|
|
31
|
+
id={id}
|
|
32
|
+
className="form-check-input me-2"
|
|
33
|
+
type="radio"
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
<label className="form-check-label" htmlFor={id}>
|
|
37
|
+
{label}
|
|
38
|
+
{helpText && (
|
|
39
|
+
<div className="form-text">
|
|
40
|
+
<small>{helpText}</small>
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
43
|
+
</label>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default Radio;
|
package/bootstrap/RadioSet.js
CHANGED
|
@@ -10,6 +10,8 @@ import React from "react";
|
|
|
10
10
|
import PropTypes from "prop-types";
|
|
11
11
|
import { useUID } from "react-uid";
|
|
12
12
|
|
|
13
|
+
import Radio from "./Radio";
|
|
14
|
+
|
|
13
15
|
RadioSet.propTypes = {
|
|
14
16
|
/** Name attribute of the input HTML tag. */
|
|
15
17
|
name: PropTypes.string.isRequired,
|
|
@@ -73,40 +75,4 @@ function RadioSet({ name, label, choices, value, helpText, inline, ...props }) {
|
|
|
73
75
|
);
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
Radio.propTypes = {
|
|
77
|
-
label: PropTypes.oneOfType([
|
|
78
|
-
PropTypes.string,
|
|
79
|
-
PropTypes.element,
|
|
80
|
-
PropTypes.node,
|
|
81
|
-
PropTypes.arrayOf(PropTypes.node),
|
|
82
|
-
]).isRequired,
|
|
83
|
-
id: PropTypes.string.isRequired,
|
|
84
|
-
inline: PropTypes.bool,
|
|
85
|
-
helpText: PropTypes.string,
|
|
86
|
-
className: PropTypes.string,
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export function Radio({ label, id, helpText, inline, className, ...props }) {
|
|
90
|
-
return (
|
|
91
|
-
<div
|
|
92
|
-
className={`${className || "mb-3"} ${inline ? "form-check form-check-inline" : ""}`.trim()}
|
|
93
|
-
>
|
|
94
|
-
<input
|
|
95
|
-
id={id}
|
|
96
|
-
className="form-check-input me-2"
|
|
97
|
-
type="radio"
|
|
98
|
-
{...props}
|
|
99
|
-
/>
|
|
100
|
-
<label className="form-check-label" htmlFor={id}>
|
|
101
|
-
{label}
|
|
102
|
-
{helpText && (
|
|
103
|
-
<div className="form-text">
|
|
104
|
-
<small>{helpText}</small>
|
|
105
|
-
</div>
|
|
106
|
-
)}
|
|
107
|
-
</label>
|
|
108
|
-
</div>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
78
|
export default RadioSet;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
|
3
|
+
*
|
|
4
|
+
* This is free software, licensed under the GNU General Public License v3.
|
|
5
|
+
* See /LICENSE for more information.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import { faEllipsisVertical } from "@fortawesome/free-solid-svg-icons";
|
|
11
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
12
|
+
import PropTypes from "prop-types";
|
|
13
|
+
|
|
14
|
+
import Button from "./Button";
|
|
15
|
+
|
|
16
|
+
ThreeDotsMenu.propTypes = {
|
|
17
|
+
/** Menu items. */
|
|
18
|
+
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function ThreeDotsMenu({ children }) {
|
|
22
|
+
return (
|
|
23
|
+
<div className="dropdown">
|
|
24
|
+
<Button
|
|
25
|
+
className="btn-sm btn-link text-body"
|
|
26
|
+
data-bs-toggle="dropdown"
|
|
27
|
+
aria-expanded="false"
|
|
28
|
+
>
|
|
29
|
+
<FontAwesomeIcon icon={faEllipsisVertical} />
|
|
30
|
+
</Button>
|
|
31
|
+
<ul className="dropdown-menu">
|
|
32
|
+
{children.map((child) => (
|
|
33
|
+
<li key={child.key || child.props.id || Math.random()}>
|
|
34
|
+
{child}
|
|
35
|
+
</li>
|
|
36
|
+
))}
|
|
37
|
+
</ul>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default ThreeDotsMenu;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
ThreeDotsMenu Bootstrap component is a dropdown menu that appears when the user
|
|
2
|
+
clicks on three dots. It is used to display a list of actions that can be
|
|
3
|
+
performed on a particular item.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
8
|
+
import { faEdit, faTrash } from "@fortawesome/free-solid-svg-icons";
|
|
9
|
+
|
|
10
|
+
const threeDotsMenuItems = [
|
|
11
|
+
{
|
|
12
|
+
text: "Edit",
|
|
13
|
+
icon: faEdit,
|
|
14
|
+
onClick: () => {
|
|
15
|
+
alert("Edit clicked");
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
text: "Delete",
|
|
20
|
+
icon: faTrash,
|
|
21
|
+
onClick: () => {
|
|
22
|
+
alert("Delete clicked");
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
<ThreeDotsMenu>
|
|
28
|
+
{threeDotsMenuItems.map((item, index) => (
|
|
29
|
+
<button key={index} onClick={item.onClick} className="dropdown-item">
|
|
30
|
+
<FontAwesomeIcon
|
|
31
|
+
icon={item.icon}
|
|
32
|
+
className="me-1"
|
|
33
|
+
width="1rem"
|
|
34
|
+
size="sm"
|
|
35
|
+
/>
|
|
36
|
+
{item.text}
|
|
37
|
+
</button>
|
|
38
|
+
))}
|
|
39
|
+
</ThreeDotsMenu>;
|
|
40
|
+
```
|
package/foris-6.3.0.tgz
ADDED
|
Binary file
|
package/index.js
CHANGED
|
@@ -28,11 +28,13 @@ export { default as FileInput } from "./bootstrap/FileInput";
|
|
|
28
28
|
export { default as Input } from "./bootstrap/Input";
|
|
29
29
|
export { default as NumberInput } from "./bootstrap/NumberInput";
|
|
30
30
|
export { default as PasswordInput } from "./bootstrap/PasswordInput";
|
|
31
|
-
export { default as
|
|
31
|
+
export { default as Radio } from "./bootstrap/Radio";
|
|
32
|
+
export { default as RadioSet } from "./bootstrap/RadioSet";
|
|
32
33
|
export { default as Select } from "./bootstrap/Select";
|
|
33
34
|
export { default as TextInput } from "./bootstrap/TextInput";
|
|
34
35
|
export { formFieldsSize, buttonFormFieldsSize } from "./bootstrap/constants";
|
|
35
36
|
export { default as Switch } from "./bootstrap/Switch";
|
|
37
|
+
export { default as ThreeDotsMenu } from "./bootstrap/ThreeDotsMenu";
|
|
36
38
|
|
|
37
39
|
export { Spinner, SpinnerElement } from "./bootstrap/Spinner";
|
|
38
40
|
export { Modal, ModalBody, ModalFooter, ModalHeader } from "./bootstrap/Modal";
|
package/package.json
CHANGED
package/foris-6.2.1.tgz
DELETED
|
Binary file
|