1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-24 00:01:36 +01:00

Merge branch 'dev' into 'master'

Dev

See merge request turris/reforis/foris-js!100
This commit is contained in:
Bogdan Bodnar 2020-02-26 17:02:47 +01:00
commit 00b861531e
4 changed files with 23 additions and 6 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "foris",
"version": "4.2.0",
"version": "4.3.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "foris",
"version": "4.2.0",
"version": "4.3.0",
"description": "Set of components and utils for Foris and its plugins.",
"author": "CZ.NIC, z.s.p.o.",
"repository": {

View File

@ -17,6 +17,7 @@ Modal.propTypes = {
shown: PropTypes.bool.isRequired,
/** Callback to manage modal visibility */
setShown: PropTypes.func.isRequired,
scrollable: PropTypes.bool,
/** Modal content use following: `ModalHeader`, `ModalBody`, `ModalFooter` */
children: PropTypes.oneOfType([
@ -25,7 +26,9 @@ Modal.propTypes = {
]).isRequired,
};
export function Modal({ shown, setShown, children }) {
export function Modal({
shown, setShown, scrollable, children,
}) {
const dialogRef = useRef();
useClickOutside(dialogRef, () => setShown(false));
@ -33,7 +36,11 @@ export function Modal({ shown, setShown, children }) {
return (
<Portal containerId="modal-container">
<div className={`modal fade ${shown ? "show" : ""}`} role="dialog">
<div ref={dialogRef} className="modal-dialog modal-dialog-centered" role="document">
<div
ref={dialogRef}
className={`modal-dialog modal-dialog-centered${scrollable ? " modal-dialog-scrollable" : ""}`}
role="document"
>
<div className="modal-content">
{children}
</div>

View File

@ -17,7 +17,12 @@ RadioSet.propTypes = {
/** Choices . */
choices: PropTypes.arrayOf(PropTypes.shape({
/** Choice lable . */
label: PropTypes.string.isRequired,
label: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element,
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
]).isRequired,
/** Choice value . */
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
})).isRequired,
@ -58,7 +63,12 @@ export function RadioSet({
}
Radio.propTypes = {
label: PropTypes.string.isRequired,
label: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element,
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
]).isRequired,
id: PropTypes.string.isRequired,
helpText: PropTypes.string,
};