import { n as e, t } from "./utils-CHlhTiFC.js";
import { t as n } from "./createLucideIcon-CC8mnBIB.js";
import { Badge as r } from "./Badge.js";
import { Button as i } from "./Button.js";
import { P as a } from "./Typography.js";
import { t as o } from "./label-BSFReMzI.js";
import { useState as s } from "react";
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
var d = n("trash-2", [
	["path", {
		d: "M10 11v6",
		key: "nco0om"
	}],
	["path", {
		d: "M14 11v6",
		key: "outv1u"
	}],
	["path", {
		d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",
		key: "miytrc"
	}],
	["path", {
		d: "M3 6h18",
		key: "d0wm0j"
	}],
	["path", {
		d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",
		key: "e791ji"
	}]
]), f = n("upload", [
	["path", {
		d: "M12 3v12",
		key: "1x0j5s"
	}],
	["path", {
		d: "m17 8-5-5-5 5",
		key: "7q97r8"
	}],
	["path", {
		d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",
		key: "ih7n3h"
	}]
]);
//#endregion
//#region src/components/ui/fileUpload.tsx
function p({ onFileChange: n, children: p, ...m }) {
	let h = m.id || e(), [g, _] = s([]), v = (e) => {
		if (e.target.files) {
			let t = [...Array.from(e.target.files)];
			m.multiple && (t = [...g, ...Array.from(e.target.files)]), _(t), n?.(t);
		}
	}, y = (e) => {
		let t = g.filter((t, n) => n !== e);
		_(t), n?.(t);
	};
	return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ u("div", {
		className: t("flex flex-col items-center gap-4 mb-2.5 w-full", m.className),
		children: [/* @__PURE__ */ l("input", {
			...m,
			id: h,
			type: "file",
			className: "hidden",
			onChange: v
		}), /* @__PURE__ */ l("label", {
			htmlFor: h,
			className: "flex w-full",
			children: p || /* @__PURE__ */ u("div", {
				className: "flex flex-col w-full bg-primary-gray-200 dark:bg-primary-gray-600 px-4 py-6 items-center gap-2 border border-primary-gray-300 dark:border-primary-gray-550",
				children: [/* @__PURE__ */ l(f, { className: "w-7 h-7 stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-400" }), /* @__PURE__ */ l(a, {
					className: "text-primary-gray-550 dark:text-primary-gray-300 text-sm md:text-sm",
					children: "Click on this area to upload"
				})]
			})
		})]
	}), g.length > 0 ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(o, { children: "File(s) uploaded" }), /* @__PURE__ */ l("div", {
		className: "w-full flex flex-wrap gap-2.5 justify-left mt-1",
		children: g?.map((e, t) => /* @__PURE__ */ u(r, {
			variant: "gray",
			className: "flex gap-4 bg-primary-gray-200 dark:bg-primary-gray-600 border border-primary-gray-300 dark:border-primary-gray-600 pr-4 pl-4",
			children: [/* @__PURE__ */ l("span", {
				className: "truncate text-primary-gray-500 dark:text-primary-gray-400 text-base",
				children: e.name
			}), /* @__PURE__ */ l(i, {
				variant: "icon",
				padding: "none",
				onClick: () => y(t),
				children: /* @__PURE__ */ l(d, { className: "w-4 h-4 stroke-accent-red" })
			})]
		}, e.name))
	})] }) : null] });
}
//#endregion
export { p as t };

//# sourceMappingURL=fileUpload-STEOuFiG.js.map