@anoki/fse-ui
Version:
FSE UI components library
71 lines (70 loc) • 2.29 kB
JavaScript
import { j as e } from "./index.es244.js";
import { clsx as l } from "./index.es246.js";
import './components/ui/FilterDropDownV2/FilterDropDownV2.css';/* empty css */
import { ArrowDown as u } from "./index.es158.js";
import { useState as f, useRef as p, useEffect as x } from "react";
import { ArrowList as v } from "./index.es296.js";
import { Col as w } from "./index.es10.js";
const C = ({
items: a = [],
className: c,
label: d,
value: n,
setValue: m
}) => {
const [s, o] = f(!1), t = p(null);
return x(() => {
const r = (i) => {
t.current && !t.current.contains(i.target) && o(!1);
};
return s ? document.addEventListener("mousedown", r) : document.removeEventListener("mousedown", r), () => {
document.removeEventListener("mousedown", r);
};
}, [s]), /* @__PURE__ */ e.jsxs("div", { ref: t, className: l(c, "ui-filter-dropdown-v2"), children: [
/* @__PURE__ */ e.jsxs(
"button",
{
className: "ui-button-accordion-v2",
type: "button",
onClick: () => o(!s),
children: [
/* @__PURE__ */ e.jsx("h3", { className: "fw-semibold fs-custom text-primary", children: n || d }),
/* @__PURE__ */ e.jsx(
u,
{
color: "primary",
className: l("ui-arrow-v2", { "ui-expanded-v2": s })
}
)
]
}
),
s && /* @__PURE__ */ e.jsxs("div", { className: "ui-wrap-list-item-filter-v2 position-relative pt-x12", children: [
/* @__PURE__ */ e.jsx(v, { className: "ui-arrow-list-v2 position-absolute" }),
/* @__PURE__ */ e.jsx("div", { className: "p-x24 h-full shadow", children: /* @__PURE__ */ e.jsx(
w,
{
gap: "x24",
text: "primary",
fs: "custom",
fw: "regular",
className: "ui-list-item-filter-v2 h-full overflow fw-regular",
children: a.map((r, i) => /* @__PURE__ */ e.jsx(
"div",
{
onClick: () => {
m(r.value), o(!1);
},
children: r == null ? void 0 : r.label
},
i
))
}
) })
] })
] });
};
export {
C as FilterDropDownV2
};
//# sourceMappingURL=index.es26.js.map