UNPKG

@anoki/fse-ui

Version:

FSE UI components library

79 lines (78 loc) 2.51 kB
import { j as e } from "./index.es244.js"; import { clsx as l } from "./index.es246.js"; import './components/ui/FilterDropDown/FilterDropDown.css';/* empty css */ import { ArrowDown as u } from "./index.es158.js"; import { useState as p, useRef as f, useEffect as x } from "react"; import { ArrowList as w } from "./index.es296.js"; import { Col as h } from "./index.es10.js"; const C = ({ size: n, items: a = [], className: m, filter: d, setFilter: c }) => { const [s, t] = p(!1), o = f(null); return x(() => { const r = (i) => { o.current && !o.current.contains(i.target) && t(!1); }; return s ? document.addEventListener("mousedown", r) : document.removeEventListener("mousedown", r), () => { document.removeEventListener("mousedown", r); }; }, [s]), /* @__PURE__ */ e.jsxs( "div", { ref: o, style: n === "large" ? { width: "668px" } : { width: "322px" }, className: l(m, "ui-filter-dropdown"), children: [ /* @__PURE__ */ e.jsxs( "button", { className: "ui-button-accordion", type: "button", onClick: () => t(!s), children: [ /* @__PURE__ */ e.jsx("h3", { className: "fw-semibold fs-custom text-primary", children: d }), /* @__PURE__ */ e.jsx( u, { color: "primary", className: l("ui-arrow", { "ui-expanded": s }) } ) ] } ), s && /* @__PURE__ */ e.jsxs("div", { className: "ui-wrap-list-item-filter position-relative pt-x12", children: [ /* @__PURE__ */ e.jsx(w, { className: "ui-arrow-list position-absolute" }), /* @__PURE__ */ e.jsx("div", { className: "p-x24 h-full shadow", children: /* @__PURE__ */ e.jsx( h, { gap: "x24", text: "primary", fs: "custom", fw: "regular", className: "ui-list-item-filter h-full overflow fw-regular", children: a.map((r, i) => /* @__PURE__ */ e.jsx( "div", { onClick: () => { c(r.value), t(!1); }, children: r.label }, i )) } ) }) ] }) ] } ); }; export { C as FilterDropDown }; //# sourceMappingURL=index.es25.js.map