@anoki/fse-ui
Version:
FSE UI components library
88 lines (87 loc) • 2.78 kB
JavaScript
import { j as e } from "./index.es244.js";
import { Root as i, Trigger as c, Portal as m, Content as d, Group as x, Item as u } from "./index.es293.js";
import { clsx as o } from "./index.es246.js";
import { createColorClasses as h } from "./index.es274.js";
import './components/ui/Dropdown/Dropdown.css';/* empty css */
import { ArrowDown as w } from "./index.es158.js";
import { Row as p } from "./index.es9.js";
const R = ({
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(p, { as: "span", gap: "x4", children: [
s,
/* @__PURE__ */ e.jsx(w, { color: a, className: "ui-arrow" })
] })
]
}
) }),
/* @__PURE__ */ e.jsx(f, { options: n, asLinkItem: r })
] });
}, f = ({
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(x, { className: "ui-dropdown-menu-group", children: s.map((r, a) => /* @__PURE__ */ e.jsx(
u,
{
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,
className: o(
"fs-6 text-decoration-none bg-white outline-none border-none text-left",
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" })
]
}
)
},
a
)) })
}
) });
};
export {
R as Dropdown
};
//# sourceMappingURL=index.es24.js.map