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", "name": "foris",
"version": "4.2.0", "version": "4.3.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

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

View File

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

View File

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