stone-kit
Version:
uikit for redesign
81 lines (80 loc) • 2.45 kB
JavaScript
import { jsxs as h, jsx as s } from "react/jsx-runtime";
import { c as m } from "./index-rKuIKazb.js";
const j = "_sortSelectWrapper_gj2vk_1", b = "_selectedOptions_gj2vk_11", x = "_selectModal_gj2vk_34", B = "_selectionOptionMini_gj2vk_38", S = "_selectedOptionsOpened_gj2vk_42", C = "_selectOptionsDisabled_gj2vk_46", L = "_optionsList_gj2vk_53", W = "_mobileOptionList_gj2vk_68", f = "_mobileSortHeader_gj2vk_76", M = "_modalAddBody_gj2vk_90", T = "_inputWrapper_gj2vk_96", D = "_option_gj2vk_53", N = "_icon_gj2vk_124", y = "_checkBox_gj2vk_131", A = "_checkBoxChecked_gj2vk_138", H = "_innerCheck_gj2vk_145", E = "_sortSelectWrapperTop_gj2vk_176", I = "_optionListOnTop_gj2vk_179", t = {
sortSelectWrapper: j,
selectedOptions: b,
selectModal: x,
selectionOptionMini: B,
selectedOptionsOpened: S,
selectOptionsDisabled: C,
optionsList: L,
mobileOptionList: W,
mobileSortHeader: f,
modalAddBody: M,
inputWrapper: T,
option: D,
icon: N,
checkBox: y,
checkBoxChecked: A,
innerCheck: H,
sortSelectWrapperTop: E,
optionListOnTop: I
}, k = m.bind(t), F = ({
selectedOption: e,
setSelectedOption: r,
setIsOpen: p,
containerRef: a,
onBlur: i,
onChange: _,
onClickOption: l,
isMobile: u,
placeholder: v
}) => {
const d = (o) => (c) => {
c.stopPropagation(), l && l(o);
const n = (e == null ? void 0 : e.value) === o.value ? null : o;
if (n && (r && r(n), _)) {
const g = {
...c,
target: { value: n }
};
_(g);
}
};
return { handleDocumentClick: (o) => {
a.current && !a.current.contains(o.target) && p(!1);
}, handleBlur: (o) => {
if (i) {
const c = {
...o,
target: { value: e }
};
i(c);
}
}, getInputValue: () => u ? "" : e ? e.label : v, getOption: (o) => /* @__PURE__ */ h(
"div",
{
className: k(t.option, {
[t.selected]: (e == null ? void 0 : e.value) === o.value
}),
onClick: d(o),
children: [
/* @__PURE__ */ s("div", { children: o.label }),
/* @__PURE__ */ s(
"div",
{
className: k(t.checkBox, {
[t.checkBoxChecked]: (e == null ? void 0 : e.value) === o.value
}),
children: (e == null ? void 0 : e.value) === o.value && /* @__PURE__ */ s("div", { className: t.innerCheck })
}
)
]
},
o.value
) };
};
export {
t as s,
F as u
};