UNPKG

@sikka/hawa

Version:

Modern UI Kit made with Tailwind

827 lines (815 loc) • 28.8 kB
"use client"; // elements/fileDropzone/FileDropzone.tsx import React7, { useEffect as useEffect2, useState as useState2 } from "react"; import { useDropzone } from "react-dropzone"; import clsx2 from "clsx"; // elements/alert/Alert.tsx import React6, { useRef, useState, useEffect } from "react"; // util/index.ts import { clsx } from "clsx"; import { twMerge } from "tailwind-merge"; function cn(...inputs) { return twMerge(clsx(inputs)); } // elements/button/Button.tsx import * as React5 from "react"; import { cva } from "class-variance-authority"; // elements/helperText/HelperText.tsx import React from "react"; var HelperText = ({ helperText }) => /* @__PURE__ */ React.createElement( "p", { className: cn( "hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all", helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0" ) }, helperText ); // elements/label/Label.tsx import * as React3 from "react"; // elements/tooltip/Tooltip.tsx import React2 from "react"; import * as TooltipPrimitive from "@radix-ui/react-tooltip"; var TooltipContent = React2.forwardRef(({ className, sideOffset = 4, size = "default", ...props }, ref) => /* @__PURE__ */ React2.createElement( TooltipPrimitive.Content, { ref, sideOffset, className: cn( "hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2", { "hawa-text-xs": size === "small", "hawa-text-xl": size === "large" }, className ), ...props } )); TooltipContent.displayName = TooltipPrimitive.Content.displayName; var TooltipArrow = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React2.createElement(TooltipPrimitive.Arrow, { ref, className: cn(className), ...props })); TooltipArrow.displayName = TooltipPrimitive.Arrow.displayName; var Tooltip = ({ side, size, open, content, children, disabled, defaultOpen, onOpenChange, triggerProps, contentProps, providerProps, delayDuration = 300, ...props }) => { return /* @__PURE__ */ React2.createElement( TooltipPrimitive.TooltipProvider, { delayDuration, ...providerProps }, /* @__PURE__ */ React2.createElement( TooltipPrimitive.Root, { open: !disabled && open, defaultOpen, onOpenChange, ...props }, /* @__PURE__ */ React2.createElement(TooltipPrimitive.Trigger, { ...triggerProps }, children), /* @__PURE__ */ React2.createElement( TooltipContent, { size, side, align: "center", ...contentProps, style: { ...contentProps == null ? void 0 : contentProps.style, maxWidth: "var(--radix-tooltip-content-available-width)", maxHeight: "var(--radix-tooltip-content-available-height)" } }, content ) ) ); }; // elements/label/Label.tsx var Label = React3.forwardRef(({ className, hint, hintSide, required, children, ...props }, ref) => /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-gap-1 hawa-transition-all" }, /* @__PURE__ */ React3.createElement( "label", { ref, className: cn( "hawa-text-sm hawa-font-medium hawa-leading-none peer-disabled:hawa-cursor-not-allowed peer-disabled:hawa-opacity-70", className ), ...props }, children, required && /* @__PURE__ */ React3.createElement("span", { className: "hawa-mx-0.5 hawa-text-red-500" }, "*") ), hint && /* @__PURE__ */ React3.createElement( Tooltip, { content: hint, side: hintSide, triggerProps: { tabIndex: -1, onClick: (event) => event.preventDefault() } }, /* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement( "svg", { xmlns: "http://www.w3.org/2000/svg", className: "hawa-h-[14px] hawa-w-[14px] hawa-cursor-help", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React3.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ React3.createElement("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }), /* @__PURE__ */ React3.createElement("path", { d: "M12 17h.01" }) )) ))); Label.displayName = "Label"; // elements/loading/Loading.tsx import React4 from "react"; var Loading = ({ design = "spinner", size = "normal", themeMode = "light", classNames, color, ...props }) => { let sizeStyles = { button: "hawa-h-4 hawa-w-4", xs: "hawa-h-1 hawa-w-1", sm: "hawa-h-6 hawa-w-6", normal: "hawa-h-8 hawa-w-8", lg: "hawa-h-14 hawa-w-14", xl: "hawa-h-24 hawa-w-24" }; let progressSizes = { button: "hawa-h-1", xs: "hawa-h-1 hawa-w-1", sm: "hawa-h-6 hawa-w-6", normal: "", lg: "hawa-h-6", xl: "hawa-h-10 hawa-w-64" }; let animationStyles = { pulse: "hawa-animate-in hawa-fade-in hawa-duration-1000", bounce: "hawa-animate-bounce" }; switch (design.split("-")[0]) { case "dots": return /* @__PURE__ */ React4.createElement( "div", { className: cn( "hawa-flex hawa-flex-row hawa-gap-2", classNames == null ? void 0 : classNames.container ) }, /* @__PURE__ */ React4.createElement( "div", { className: cn( "hawa-animate-bounce hawa-rounded-full hawa-delay-100 hawa-repeat-infinite", size === "button" ? "hawa-h-2 hawa-w-2" : sizeStyles[size], animationStyles[design.split("-")[1]], color ? color : "hawa-bg-primary" ) } ), /* @__PURE__ */ React4.createElement( "div", { className: cn( "hawa-animate-bounce hawa-rounded-full hawa-delay-200 hawa-repeat-infinite", size === "button" ? "hawa-h-2 hawa-w-2" : sizeStyles[size], animationStyles[design.split("-")[1]], color ? color : "hawa-bg-primary" ) } ), /* @__PURE__ */ React4.createElement( "div", { className: cn( "hawa-animate-bounce hawa-rounded-full hawa-delay-300 hawa-repeat-infinite", size === "button" ? "hawa-h-2 hawa-w-2" : sizeStyles[size], animationStyles[design.split("-")[1]], color ? color : "hawa-bg-primary" ) } ) ); case "square": return /* @__PURE__ */ React4.createElement( "svg", { className: cn( "squircle-container", sizeStyles[size], classNames == null ? void 0 : classNames.container ), viewBox: "0 0 35 35", height: "35", width: "35" }, /* @__PURE__ */ React4.createElement( "rect", { className: "squircle-track", x: "2.5", y: "2.5", fill: "none", strokeWidth: "5px", width: "32.5", height: "32.5" } ), /* @__PURE__ */ React4.createElement( "rect", { className: "square-car", x: "2.5", y: "2.5", fill: "none", strokeWidth: "5px", width: "32.5", height: "32.5", pathLength: "100" } ) ); case "squircle": return /* @__PURE__ */ React4.createElement( "svg", { x: "0px", y: "0px", viewBox: "0 0 37 37", height: "37", width: "37", preserveAspectRatio: "xMidYMid meet", className: cn( "squircle-container", sizeStyles[size], classNames == null ? void 0 : classNames.container ) }, /* @__PURE__ */ React4.createElement( "path", { className: cn("squircle-track", classNames == null ? void 0 : classNames.track), fill: "none", strokeWidth: "5", pathLength: "100", d: "M0.37 18.5 C0.37 5.772 5.772 0.37 18.5 0.37 S36.63 5.772 36.63 18.5 S31.228 36.63 18.5 36.63 S0.37 31.228 0.37 18.5" } ), /* @__PURE__ */ React4.createElement( "path", { className: cn("squircle-car", classNames == null ? void 0 : classNames.car), fill: "none", strokeWidth: "5", pathLength: "100", d: "M0.37 18.5 C0.37 5.772 5.772 0.37 18.5 0.37 S36.63 5.772 36.63 18.5 S31.228 36.63 18.5 36.63 S0.37 31.228 0.37 18.5" } ) ); case "progress": return /* @__PURE__ */ React4.createElement( "div", { className: cn( "progress-loading after:hawa-rounded hawa-rounded", progressSizes[size], classNames == null ? void 0 : classNames.container ) } ); case "orbit": return /* @__PURE__ */ React4.createElement("div", { className: cn("orbit-container", classNames == null ? void 0 : classNames.container) }); default: return /* @__PURE__ */ React4.createElement( "svg", { viewBox: "0 0 40 40", height: "40", width: "40", className: cn( "circle-container", sizeStyles[size], classNames == null ? void 0 : classNames.container ) }, /* @__PURE__ */ React4.createElement( "circle", { className: cn( "circle-track", { "hawa-stroke-primary-foreground": themeMode === "dark", "hawa-stroke-primary": themeMode === "light" }, classNames == null ? void 0 : classNames.track ), cx: "20", cy: "20", r: "17.5", fill: "none", strokeWidth: "5px", pathLength: "100" } ), /* @__PURE__ */ React4.createElement( "circle", { className: cn( "circle-car", { "hawa-stroke-primary-foreground": themeMode === "dark", "hawa-stroke-primary": themeMode === "light" }, classNames == null ? void 0 : classNames.car ), cx: "20", cy: "20", r: "17.5", fill: "none", pathLength: "100", strokeWidth: "5px" } ) ); } }; // elements/button/Button.tsx var buttonVariants = cva( "hawa-inline-flex hawa-items-center hawa-select-none hawa-rounded-md hawa-text-sm hawa-font-medium hawa-ring-offset-background hawa-transition-colors focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2 disabled:hawa-pointer-events-none disabled:hawa-opacity-50", { variants: { variant: { default: "hawa-bg-primary hawa-text-primary-foreground hover:hawa-bg-primary/90", light: "hawa-bg-primary/20 hawa-text-primary hover:hawa-bg-primary/40", destructive: "hawa-bg-destructive hawa-text-destructive-foreground hover:hawa-bg-destructive/90", outline: "hawa-border hawa-border-input hawa-bg-transparent hover:hawa-bg-accent hover:hawa-text-accent-foreground", secondary: "hawa-bg-secondary hawa-text-secondary-foreground hover:hawa-bg-secondary/80", ghost: "hover:hawa-bg-accent hover:hawa-text-accent-foreground", link: "hawa-text-primary hawa-underline-offset-4 hover:hawa-underline", combobox: "hawa-bg-background hawa-border", neoBrutalism: "neo-brutalism" // "hawa-cursor-pointer hawa-transition-all hawa-uppercase hawa-font-mono dark:hawa-bg-black hawa-font-bold hawa-py-2 hawa-px-4 hawa-rounded hawa-border-2 hawa-border-primary hawa-shadow-color-primary hawa-transition-[hawa-transform_50ms, hawa-box-shadow_50ms] active:hawa-translate-x-0.5 active:hawa-translate-y-0.5 active:hawa-shadow-color-primary-active shadow-color-primary active:shadow-color-primary-active", }, size: { default: "hawa-h-10 hawa-px-4 hawa-py-2", heightless: "hawa-px-4 hawa-py-4", xs: "hawa-h-fit hawa-min-h-[25px] hawa-py-1 hawa-text-[10px] hawa-px-2 ", sm: "hawa-h-9 hawa-text-[11px] hawa-rounded-md hawa-px-3", lg: "hawa-h-11 hawa-rounded-md hawa-px-8", xl: "hawa-h-14 hawa-rounded-md hawa-px-10", icon: "hawa-h-10 hawa-w-10", smallIcon: "hawa-h-7 hawa-w-7" } }, defaultVariants: { variant: "default", size: "default" } } ); var Button = React5.forwardRef( ({ className, label, variant, size, asChild = false, centered = true, isLoading, children, labelProps, showHelperText = false, asInput = false, ...props }, ref) => { const Comp = "button"; const loadingColor = variant === "outline" || variant === "ghost" || variant === "neoBrutalism" ? "hawa-bg-primary" : "hawa-bg-primary-foreground"; if (asInput) { return /* @__PURE__ */ React5.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, label && /* @__PURE__ */ React5.createElement(Label, { ...labelProps }, label), /* @__PURE__ */ React5.createElement( Comp, { className: cn( buttonVariants({ variant, size, className }), centered && "hawa-justify-center" ), ref, ...props }, isLoading ? /* @__PURE__ */ React5.createElement( Loading, { design: size === "icon" || size === "smallIcon" ? "spinner" : "dots-pulse", themeMode: variant === "outline" ? "light" : "dark", color: loadingColor, size: size === "sm" || size === "xs" ? "xs" : "button" } ) : children ), showHelperText && /* @__PURE__ */ React5.createElement(HelperText, { helperText: props.helperText })); } else { return /* @__PURE__ */ React5.createElement( Comp, { className: cn( buttonVariants({ variant, size, className }), centered && "hawa-justify-center" ), ref, ...props }, isLoading ? /* @__PURE__ */ React5.createElement( Loading, { design: size === "icon" || size === "smallIcon" ? "spinner" : "dots-pulse", themeMode: variant === "outline" ? "light" : "dark", color: loadingColor, size: size === "sm" || size === "xs" ? "xs" : "button" } ) : children ); } } ); Button.displayName = "Button"; // elements/alert/Alert.tsx var Alert = ({ direction = "ltr", severity = "none", duration, icon, className, ...props }) => { const alertRef = useRef(null); const [closed, setClosed] = useState(false); useEffect(() => { if (duration) { const timeoutHide = setTimeout(() => { setClosed(true); }, duration); const timeoutDestroy = setTimeout(() => { setClosed(true); if (alertRef == null ? void 0 : alertRef.current) { alertRef == null ? void 0 : alertRef.current.removeChild(alertRef == null ? void 0 : alertRef.current.children[0]); } }, duration + 1e3); return () => { clearTimeout(timeoutHide); clearTimeout(timeoutDestroy); }; } }, [duration]); let closeButtonStyle = { none: "", info: "", warning: "", error: "", success: "", hyper: "", oceanic: "" }; let styleVariant = { none: "hawa-bg-background hawa-border", info: "hawa-text-info-foreground hawa-bg-info/90", warning: "hawa-text-warning-foreground hawa-bg-warning/90", error: "hawa-text-destructive-foreground hawa-bg-destructive/90", success: "hawa-text-success-foreground hawa-bg-success/90", hyper: "hawa-text-white hawa-bg-gradient-to-tl hawa-from-pink-700 hawa-via-red-500 hawa-to-yellow-600 ", oceanic: "hawa-text-white hawa-bg-gradient-to-bl hawa-from-green-500 hawa-via-blue-700 hawa-to-purple-500" }; return /* @__PURE__ */ React6.createElement("div", { ref: alertRef }, /* @__PURE__ */ React6.createElement( "div", { "data-testid": "alert", "aria-label": "Alert", role: "alert", dir: direction, className: cn( "hawa-relative hawa-mb-4 hawa-flex hawa-flex-col hawa-rounded hawa-p-4 hawa-text-sm hawa-transition-all", styleVariant[severity], closed ? "hawa-opacity-0" : "hawa-opacity-100", className ) }, /* @__PURE__ */ React6.createElement("div", { className: "hawa-flex hawa-flex-row" }, icon && /* @__PURE__ */ React6.createElement( "div", { className: direction === "rtl" ? "hawa-pl-2 hawa-pt-1" : "hawa-pr-2 hawa-pt-1" }, icon ), /* @__PURE__ */ React6.createElement("div", { className: "hawa-flex hawa-flex-col" }, /* @__PURE__ */ React6.createElement( "span", { className: cn( "hawa-font-bold", direction === "rtl" ? "hawa-ml-8" : "hawa-mr-8" ) }, props.title ), /* @__PURE__ */ React6.createElement( "span", { className: cn( direction === "rtl" ? "hawa-ml-8" : "hawa-mr-8", props.persistent ? "hawa-w-full" : "hawa-w-[calc(100% - 40px)]" ) }, props.text ), props.actions && /* @__PURE__ */ React6.createElement("div", { className: "hawa-mt-2 hawa-flex hawa-flex-row hawa-gap-2" }, props.actions.map((act, index) => /* @__PURE__ */ React6.createElement( Button, { key: index, variant: act.variant, onClick: act.onClick() }, act.label ))))), !props.persistent && /* @__PURE__ */ React6.createElement( "button", { type: "button", "data-dismiss-target": "#alert-default", "aria-label": "Close", className: cn( "hawa-absolute hawa-top-2 hawa-inline-flex hawa-h-9 hawa-w-9 hawa-items-center hawa-justify-center hawa-rounded-inner hawa-p-1.5 hawa-transition-all hover:hawa-text-gray-900", closeButtonStyle[severity], direction === "rtl" ? "hawa-left-2" : "hawa-right-2" ), onClick: () => { if (props.onAlertClosed) { props.onAlertClosed(); } if (!props.noDestroy) { setClosed(true); setTimeout(() => { if (alertRef == null ? void 0 : alertRef.current) { alertRef == null ? void 0 : alertRef.current.removeChild( alertRef == null ? void 0 : alertRef.current.children[0] ); } }, 200); } } }, /* @__PURE__ */ React6.createElement("span", { className: "hawa-sr-only" }, "Close"), /* @__PURE__ */ React6.createElement( "svg", { "aria-label": "Close Icon", "aria-hidden": "true", className: "hawa-h-5 hawa-w-5", fill: "currentColor", viewBox: "0 0 20 20" }, /* @__PURE__ */ React6.createElement( "path", { fillRule: "evenodd", d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z", clipRule: "evenodd" } ) ) ) )); }; // elements/fileDropzone/FileDropzone.tsx var FileDropzone = ({ texts, files, setFiles, setDeletedFiles, onAcceptedFiles, errorMessages, maxFiles, accept, showPreview, onDeleteFile, onClearFiles, disclaimer, maxSize, label, termsLink, privacyLink }) => { var _a, _b, _c, _d, _e, _f; const [cmp, setCmp] = useState2(0); const [max, setMax] = useState2(0); const { getRootProps, getInputProps, fileRejections, acceptedFiles, isDragActive } = useDropzone({ multiple: true, accept, maxSize, maxFiles, onDrop: (acceptedFiles2) => { setFiles( acceptedFiles2.map( (file, index) => Object.assign(file, { preview: URL.createObjectURL(file) }) ) ); } }); useEffect2( () => () => { files == null ? void 0 : files.forEach((file) => { URL.revokeObjectURL(file.preview); }); }, [files] ); useEffect2(() => { setFiles(acceptedFiles); }, [acceptedFiles, cmp, setFiles]); onClearFiles = () => { acceptedFiles.length = 0; acceptedFiles.splice(0, acceptedFiles.length); setFiles([]); }; const clearAllFiles = () => { acceptedFiles.length = 0; setFiles([]); }; useEffect2(() => { if (maxSize > 0) { const k = 1024; const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; const i = Math.floor(Math.log(maxSize) / Math.log(1024)); setMax( parseFloat((maxSize / Math.pow(1024, i)).toFixed(2)) + " " + sizes[i] ); } }, [maxSize]); const errs = fileRejections.map((rej, i) => { switch (rej.errors[0].code) { case "file-too-large": return /* @__PURE__ */ React7.createElement( Alert, { key: i, text: rej.file.name, title: texts.fileTooLarge, severity: "error" } ); case "too-many-files": return /* @__PURE__ */ React7.createElement( Alert, { key: i, text: rej.file.name, title: texts.tooManyFiles, severity: "error" } ); case "file-invalid-type": return /* @__PURE__ */ React7.createElement( Alert, { key: i, text: rej.file.name, title: texts.invalidFileType, severity: "error" } ); default: return /* @__PURE__ */ React7.createElement( Alert, { key: i, text: rej.file.name, title: rej.errors[0].code, severity: "error" } ); } }); const thumbs = files == null ? void 0 : files.map((file, index) => /* @__PURE__ */ React7.createElement("div", { className: "hawa-relative hawa-rounded", key: index }, /* @__PURE__ */ React7.createElement( "button", { onClick: (e) => { e.stopPropagation(); acceptedFiles.splice(acceptedFiles.indexOf(file), 1); setCmp(Math.random); onDeleteFile(file); }, type: "button", className: "hawa-absolute hawa-left-0 hawa-ml-auto hawa-inline-flex hawa-items-center hawa-rounded-inner hawa-rounded-bl-none hawa-rounded-tr-none hawa-bg-gray-900 hawa-p-1.5 hawa-text-sm hawa-text-gray-400 hawa-transition-all hover:hawa-bg-gray-200 hover:hawa-text-gray-900 dark:hover:hawa-bg-gray-600 dark:hover:hawa-text-white", "data-modal-toggle": "defaultModal" }, /* @__PURE__ */ React7.createElement( "svg", { "aria-hidden": "true", className: "hawa-h-5 hawa-w-5", fill: "currentColor", viewBox: "0 0 20 20" }, /* @__PURE__ */ React7.createElement( "path", { fillRule: "evenodd", d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z", clipRule: "evenodd" } ) ), /* @__PURE__ */ React7.createElement("span", { className: "hawa-sr-only" }, "Close modal") ), /* @__PURE__ */ React7.createElement( "div", { style: { display: "flex", justifyContent: "center", alignItems: "center", overflow: "hidden", height: 100, width: 100, backgroundImage: `url(${file.preview})`, backgroundSize: "cover", backgroundPosition: "center", border: "1px solid black" }, className: "hawa-rounded", key: file.name } ))); return /* @__PURE__ */ React7.createElement("div", null, label && /* @__PURE__ */ React7.createElement("div", { className: "hawa-mb-2 hawa-block hawa-text-sm hawa-font-medium hawa-text-gray-900 dark:hawa-text-gray-300" }, label), /* @__PURE__ */ React7.createElement( "div", { className: clsx2( "hawa-flex hawa-flex-col hawa-justify-center hawa-rounded hawa-border hawa-border-dashed hawa-p-6 hawa-transition-all", isDragActive ? "hawa-bg-muted" : "hawa-bg-muted/20 hover:hawa-bg-muted/50" ) }, /* @__PURE__ */ React7.createElement("div", { ...getRootProps({}) }, /* @__PURE__ */ React7.createElement("p", { ...getInputProps() }), /* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center hawa-gap-2 hawa-pt-4 hawa-text-center" }, /* @__PURE__ */ React7.createElement( "svg", { stroke: "currentColor", fill: "none", strokeWidth: "2", viewBox: "0 0 24 24", strokeLinecap: "round", strokeLinejoin: "round", height: "1.5em", width: "1.5em" }, /* @__PURE__ */ React7.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), /* @__PURE__ */ React7.createElement("path", { d: "M19 11v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" }), /* @__PURE__ */ React7.createElement("path", { d: "M13 13l9 3l-4 2l-2 4l-3 -9" }), /* @__PURE__ */ React7.createElement("path", { d: "M3 3l0 .01" }), /* @__PURE__ */ React7.createElement("path", { d: "M7 3l0 .01" }), /* @__PURE__ */ React7.createElement("path", { d: "M11 3l0 .01" }), /* @__PURE__ */ React7.createElement("path", { d: "M15 3l0 .01" }), /* @__PURE__ */ React7.createElement("path", { d: "M3 7l0 .01" }), /* @__PURE__ */ React7.createElement("path", { d: "M3 11l0 .01" }), /* @__PURE__ */ React7.createElement("path", { d: "M3 15l0 .01" }) ), typeof texts.clickHereToUpload === "function" ? texts.clickHereToUpload() : texts.clickHereToUpload), /* @__PURE__ */ React7.createElement("div", { className: "hawa-select-none hawa-pt-2 hawa-text-center hawa-text-xs" }, texts.acceptedFileTypes, " ", accept.split(",")), /* @__PURE__ */ React7.createElement("div", { className: "hawa-select-none hawa-pb-2 hawa-pt-1 hawa-text-center hawa-text-xs" }, texts.maxFileSize, " ", max)), acceptedFiles.length > 0 && /* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-justify-center hawa-rounded-lg hawa-p-2" }, /* @__PURE__ */ React7.createElement(Button, { onClick: clearAllFiles }, "Clear All")), acceptedFiles.length > 0 && thumbs && showPreview ? /* @__PURE__ */ React7.createElement("aside", { className: "hawa-flex hawa-flex-row hawa-flex-wrap hawa-justify-center hawa-gap-2 hawa-rounded-lg hawa-p-2" }, thumbs) : null, /* @__PURE__ */ React7.createElement("div", { className: "px-4" }, ((_b = (_a = fileRejections[0]) == null ? void 0 : _a.errors[0]) == null ? void 0 : _b.code) && errs) ), disclaimer && /* @__PURE__ */ React7.createElement("div", { className: "hawa-mt-2 hawa-text-sm hawa-text-muted-foreground/50" }, (_c = texts.disclaimer) != null ? _c : "By uploading a file you agree to our", " ", /* @__PURE__ */ React7.createElement( "a", { href: termsLink, className: "clickable-link hawa-text-muted-foreground/50" }, (_d = texts.terms) != null ? _d : "Terms" ), " ", (_e = texts.and) != null ? _e : "and", " ", /* @__PURE__ */ React7.createElement( "a", { href: privacyLink, className: "clickable-link hawa-text-muted-foreground/50" }, (_f = texts.privacyPolicy) != null ? _f : "Privacy Policy" ))); }; export { FileDropzone }; //# sourceMappingURL=index.mjs.map