- {requirements ?? (
+ {hasRequirements ? (
+ requirements
+ ) : (
Check that the image is in PNG or JPG format
{maxSize ? ` and does not exceed ${maxSize}MB` : ""}
@@ -101,11 +112,13 @@ export const ImageUpload = ({
ImageUpload.propTypes = {
src: PropTypes.string,
size: PropTypes.oneOf(["small", "medium", "large"]),
- onChange: PropTypes.func.isRequired,
- onDelete: PropTypes.func.isRequired,
- onError: PropTypes.func.isRequired,
isLoading: PropTypes.bool,
maxSize: PropTypes.number,
hasDelete: PropTypes.bool,
- requirements: PropTypes.oneOf([PropTypes.string, PropTypes.node]),
+ caption: PropTypes.string,
+ requirements: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
+ csvAcceptFormats: PropTypes.string,
+ onChange: PropTypes.func.isRequired,
+ onDelete: PropTypes.func.isRequired,
+ onError: PropTypes.func.isRequired,
};
diff --git a/src/components/Modal.jsx b/src/components/Modal.jsx
index 4f8a3c88c..4e06c2f6b 100644
--- a/src/components/Modal.jsx
+++ b/src/components/Modal.jsx
@@ -5,14 +5,56 @@ import React, { Fragment } from "react";
import { CloseIcon } from "../icons/CloseIcon";
const sizes = {
- small: "max-w-100",
- medium: "max-w-125",
- large: "max-w-150",
- huge: "max-w-200",
+ small: "max-w-100", // 400px
+ medium: "max-w-125", // 500px
+ large: "max-w-150", // 600px
+ huge: "max-w-200", // 800px
+};
+
+const positions = {
+ center: "inline-block",
+ topLeft: "absolute m-4 top-0 left-0",
+ topRight: "absolute m-4 top-0 right-0",
+ bottomLeft: "absolute m-4 bottom-0 left-0",
+ bottomRight: "absolute m-4 bottom-0 right-0",
+};
+
+const animations = {
+ center: {
+ enterFrom: "translate-y-4 sm:translate-y-0 sm:scale-95",
+ enterTo: "translate-y-0 sm:scale-100",
+ leaveFrom: "translate-y-0 sm:scale-100",
+ leaveTo: "translate-y-4 sm:translate-y-0 sm:scale-95",
+ },
+ topLeft: {
+ enterFrom: "scale-0 origin-top-left",
+ enterTo: "scale-100 origin-top-left",
+ leaveFrom: "scale-100 origin-top-left",
+ leaveTo: "scale-0 origin-top-left",
+ },
+ topRight: {
+ enterFrom: "scale-0 origin-top-right",
+ enterTo: "scale-100 origin-top-right",
+ leaveFrom: "scale-100 origin-top-right",
+ leaveTo: "scale-0 origin-top-right",
+ },
+ bottomLeft: {
+ enterFrom: "scale-0 origin-bottom-left",
+ enterTo: "scale-100 origin-bottom-left",
+ leaveFrom: "scale-100 origin-bottom-left",
+ leaveTo: "scale-0 origin-bottom-left",
+ },
+ bottomRight: {
+ enterFrom: "scale-0 origin-bottom-right",
+ enterTo: "scale-100 origin-bottom-right",
+ leaveFrom: "scale-100 origin-bottom-right",
+ leaveTo: "scale-0 origin-bottom-right",
+ },
};
export const Modal = ({
size = "medium",
+ position = "center",
isOpen = false,
shouldCloseOnOutsideClick = false,
onClose,
@@ -42,24 +84,27 @@ export const Modal = ({
{/* This element is to trick the browser into centering the modal contents. */}
-
-
-
+ {position === "center" && (
+
+
+
+ )}
{onClose ? (
@@ -81,6 +126,16 @@ export const Modal = ({
);
};
+Modal.propTypes = {
+ size: PropTypes.oneOf(Object.keys(sizes)),
+ position: PropTypes.oneOf(Object.keys(positions)),
+ isOpen: PropTypes.bool.isRequired,
+ shouldCloseOnOutsideClick: PropTypes.bool,
+ onClose: PropTypes.func.isRequired,
+ children: PropTypes.node.isRequired,
+ className: PropTypes.string,
+};
+
const Header = ({ children, description, className, ...rest }) => {
return (
diff --git a/src/components/Popover/PopoverList.jsx b/src/components/Popover/PopoverList.jsx
index a6fc1e284..97f636204 100644
--- a/src/components/Popover/PopoverList.jsx
+++ b/src/components/Popover/PopoverList.jsx
@@ -38,8 +38,8 @@ PopoverList.propTypes = {
children: PropTypes.node.isRequired,
};
-const Item = ({ name, isActive = false, position, total, children, className, onClickItem, ...rest }) => {
- const onClick = (event) => onClickItem(event, name);
+const Item = ({ name, isActive = false, id = null, position, total, children, className, onClickItem, ...rest }) => {
+ const onClick = (event) => onClickItem(event, name, id);
return (
-
+
{label &&
{label}
}
@@ -128,7 +128,7 @@ export const Login = ({