UNPKG

@brizy/ui

Version:
19 lines (18 loc) 792 B
import React from "react"; import { isEmpty } from "ramda"; import LoadingOutlined from "@ant-design/icons/lib/icons/LoadingOutlined"; import { BRZ_PREFIX } from "../../constants"; export const isValid = ({ value }) => { if (value) { return !isEmpty(value === null || value === void 0 ? void 0 : value.name) && !isEmpty(value === null || value === void 0 ? void 0 : value.source); } return false; }; export const isMultiple = ({ value }) => { if (value) { return value.filter(value => isValid({ value })).length > 0; } return false; }; export const getLoading = () => React.createElement(LoadingOutlined, null); export const getChoose = (t) => (React.createElement("span", { className: `${BRZ_PREFIX}-upload-file__placeholder` }, t("Choose a file")));