UNPKG

@anoki/fse-marche-ui

Version:

FSE UI components library

78 lines (77 loc) 2.47 kB
import { j as e } from "./index.es137.js"; import { Root as i, Trigger as c, Portal as m, Content as d, Group as u, Item as x } from "./index.es159.js"; import { clsx as o } from "./index.es139.js"; import { createColorClasses as h } from "./index.es145.js"; import './components/ui/Dropdown/Dropdown.css';/* empty css */ import { ArrowDown as p } from "./index.es76.js"; import { Row as w } from "./index.es9.js"; const k = ({ text: s, leftIcon: t, options: n, asLinkItem: r, textColor: a = "white" }) => { const l = h({ text: a }); return /* @__PURE__ */ e.jsxs(i, { children: [ /* @__PURE__ */ e.jsx(c, { asChild: !0, children: /* @__PURE__ */ e.jsxs( "button", { className: o( "border-none bg-transparent base-row gap-x8 fw-regular fs-6 align-items-center", l, "ui-dropdown-trigger" ), children: [ t && t, /* @__PURE__ */ e.jsxs(w, { as: "span", gap: "x4", children: [ s, /* @__PURE__ */ e.jsx(p, { color: a, className: "ui-arrow" }) ] }) ] } ) }), /* @__PURE__ */ e.jsx(j, { options: n, asLinkItem: r }) ] }); }, j = ({ options: s, asLinkItem: t }) => { if (s.length === 0) return null; const n = t ?? "a"; return /* @__PURE__ */ e.jsx(m, { children: /* @__PURE__ */ e.jsx( d, { className: "bg-white shadow ui-dropdown-menu-content", children: /* @__PURE__ */ e.jsx(u, { className: "ui-dropdown-menu-group", children: s.map((r, a) => /* @__PURE__ */ e.jsx( x, { asChild: !0, className: "ui-dropdown-menu-item", children: r.href ? /* @__PURE__ */ e.jsxs( n, { href: r.href, className: o( "fs-6 text-decoration-none", r.active ? "text-primary fw-semibold" : "text-slate-28 fw-regular" ), children: [ r.label, r.active && /* @__PURE__ */ e.jsx("span", { className: "visually-hidden", children: "Attivo" }) ] } ) : /* @__PURE__ */ e.jsxs("button", { onClick: r.onClick, children: [ r.label, r.active && /* @__PURE__ */ e.jsx("span", { className: "visually-hidden", children: "Attivo" }) ] }) }, a )) }) } ) }); }; export { k as Dropdown }; //# sourceMappingURL=index.es22.js.map