UNPKG

@dndbuilder.com/react

Version:

Drag and drop builder for React

53 lines (52 loc) 2.96 kB
"use client"; import { jsx as r, jsxs as I } from "react/jsx-runtime"; import "../../../config/theme.config.js"; import "../../../config/builder.config.js"; import "../../../../../../utils.js"; import "../../../components/base/render-block.js"; import "../../../components/base/asset-manager.js"; import { RenderChildren as G } from "../../../components/base/render-children.js"; import { Popover as d } from "../../../components/shared/popover.js"; import { RenderIcon as H } from "../../../components/shared/render-icon.js"; import { useBreakpoint as J } from "../../../hooks/use-breakpoint.js"; const $ = ({ settings: o, children: P, meta: a }) => { var m, n, p, f, e, u, b, N, w, h, x, O, v, C, i, k, j, R, S, T, z, B, D; const c = J(), U = (a == null ? void 0 : a.locale) || "en", q = (p = (n = (m = o == null ? void 0 : o.button) == null ? void 0 : m.text) == null ? void 0 : n.content) == null ? void 0 : p[U], l = (u = (e = (f = o == null ? void 0 : o.button) == null ? void 0 : f.image) == null ? void 0 : e.media) == null ? void 0 : u.url, y = ((N = (b = o == null ? void 0 : o.content) == null ? void 0 : b.side) == null ? void 0 : N[c]) ?? "bottom", A = ((h = (w = o == null ? void 0 : o.content) == null ? void 0 : w.sideOffset) == null ? void 0 : h[c]) ?? 0, E = ((O = (x = o == null ? void 0 : o.content) == null ? void 0 : x.align) == null ? void 0 : O[c]) ?? "start", F = ((C = (v = o == null ? void 0 : o.content) == null ? void 0 : v.alignOffset) == null ? void 0 : C[c]) ?? 0; return /* @__PURE__ */ r("div", { className: "dropdown", children: /* @__PURE__ */ I(d, { children: [ /* @__PURE__ */ I(d.Trigger, { className: "reset dropdown-button flex items-center gap-1", children: [ l && /* @__PURE__ */ r( "img", { className: "dropdown-button-image h-6 w-6", src: l, alt: ((j = (k = (i = o == null ? void 0 : o.button) == null ? void 0 : i.image) == null ? void 0 : k.media) == null ? void 0 : j.name) ?? "dropdown-image" } ), /* @__PURE__ */ r("span", { className: "dropdown-button-text", children: q }), /* @__PURE__ */ r( H, { className: "dropdown-button-icon", iconName: (S = (R = o == null ? void 0 : o.button) == null ? void 0 : R.icon) == null ? void 0 : S.iconName, iconSet: (z = (T = o == null ? void 0 : o.button) == null ? void 0 : T.icon) == null ? void 0 : z.iconSet } ) ] }), /* @__PURE__ */ r( d.Content, { className: "dropdown-content z-[1000]", side: y, sideOffset: Number(A), align: E, alignOffset: Number(F), avoidCollisions: ((D = (B = o == null ? void 0 : o.content) == null ? void 0 : B.avoidCollisions) == null ? void 0 : D[c]) ?? !1, children: /* @__PURE__ */ r(G, { blocks: P, meta: a }) } ) ] }) }); }; export { $ as default }; //# sourceMappingURL=dropdown.preview.js.map