UNPKG

@payfit/unity-components

Version:

54 lines (53 loc) • 2.11 kB
import { DropzoneContextProvider as e } from "./Dropzone.context.js"; import { DropzoneContent as t } from "./parts/DropzoneContent.js"; import { forwardRef as n } from "react"; import { uyTv as r } from "@payfit/unity-themes"; import { useId as i } from "react-aria"; import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime"; import { DropZone as c } from "react-aria-components/DropZone"; //#region src/core/components/dropzone/DropzoneOverlay.tsx var l = r({ slots: { base: "uy:relative", target: "uy:relative uy:block uy:rounded-none uy:border-0 uy:bg-transparent uy:p-0 uy:text-left", content: [ "uy:pointer-events-none uy:absolute uy:inset-0 uy:flex uy:flex-col uy:items-center uy:justify-center", "uy:rounded-300 uy:border uy:border-dashed uy:border-border-primary uy:bg-surface-primary-lowest-enabled uy:p-400", "uy:text-center uy:transition-opacity uy:duration-150" ] }, variants: { isDropTarget: { true: { content: "uy:opacity-100" }, false: { content: "uy:pointer-events-none uy:opacity-0" } } }, defaultVariants: { isDropTarget: !1 } }), u = n(({ children: n, overlay: r, "aria-describedby": u, "aria-labelledby": d, className: f, ...p }, m) => { let h = i(), { base: g, target: _, content: v } = l(), y = `unity-dropzone-overlay-${h}__label`, b = `unity-dropzone-overlay-${h}__description`; return /* @__PURE__ */ o("div", { className: g(), "data-unity-component": "DropzoneOverlay", children: /* @__PURE__ */ o(e, { value: { descriptionId: b, labelId: y }, children: /* @__PURE__ */ o(c, { ...p, ref: m, "aria-describedby": [u, b].filter(Boolean).join(" ") || void 0, "aria-labelledby": [d, y].filter(Boolean).join(" ") || void 0, className: _(), children: ({ isDropTarget: e }) => /* @__PURE__ */ s(a, { children: [n, /* @__PURE__ */ o("div", { className: v({ isDropTarget: e, className: f }), children: /* @__PURE__ */ o(t, { children: r }) })] }) }) }) }); }); u.displayName = "DropzoneOverlay"; //#endregion export { u as DropzoneOverlay, l as dropzoneOverlay };