Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

444 lines
14 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 7e519410fdb8d8cd.424e721e83.js
* Module id: 247232
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
var t = e.i(462214),
i = e.i(358379),
a = e.i(192830),
r = e.i(403557),
n = e.i(162511),
o = e.i(7284),
s = e.i(759455),
l = e.i(479324),
d = e.i(593307),
u = e.i(718242),
c = e.i(4329),
h = e.i(195099),
m = e.i(315383),
p = e.i(734520),
v = e.i(27797);
function b(e) {
return "group" in e;
}
function g({
data: e,
withCheckIcon: i,
withAlignedLabels: a,
value: r,
checkIconPosition: n,
unstyled: s,
renderOption: l,
}) {
if (!b(e)) {
var d;
let u = ((d = e.value), Array.isArray(r) ? r.includes(d) : r === d),
c =
i &&
(u
? (0, t.jsx)(m.CheckIcon, {
className: v.default.optionsDropdownCheckIcon,
})
: a
? (0, t.jsx)("div", {
className: v.default.optionsDropdownCheckPlaceholder,
})
: null),
p = (0, t.jsxs)(t.Fragment, {
children: [
"left" === n && c,
(0, t.jsx)("span", { children: e.label }),
"right" === n && c,
],
});
return (0, t.jsx)(h.Combobox.Option, {
value: e.value,
disabled: e.disabled,
className: (0, o.default)({ [v.default.optionsDropdownOption]: !s }),
"data-reverse": "right" === n || void 0,
"data-checked": u || void 0,
"aria-selected": u,
active: u,
children: "function" == typeof l ? l({ option: e, checked: u }) : p,
});
}
let u = e.items.map((e) =>
(0, t.jsx)(
g,
{
data: e,
value: r,
unstyled: s,
withCheckIcon: i,
withAlignedLabels: a,
checkIconPosition: n,
renderOption: l,
},
e.value,
),
);
return (0, t.jsx)(h.Combobox.Group, { label: e.group, children: u });
}
function f({
data: e,
hidden: i,
hiddenWhenEmpty: a,
filter: r,
search: n,
limit: o,
maxDropdownHeight: s,
withScrollArea: l = !0,
filterOptions: d = !0,
withCheckIcon: u = !1,
withAlignedLabels: c = !1,
value: m,
checkIconPosition: v,
nothingFoundMessage: f,
unstyled: E,
labelId: w,
renderOption: y,
scrollAreaProps: x,
"aria-label": A,
}) {
!(function e(t, i = new Set()) {
if (Array.isArray(t))
for (let a of t)
if (b(a)) e(a.items, i);
else {
if (void 0 === a.value)
throw Error(
"[@mantine/core] Each option must have value property",
);
if ("string" != typeof a.value)
throw Error(
`[@mantine/core] Option value must be a string, other data formats are not supported, got ${typeof a.value}`,
);
if (i.has(a.value))
throw Error(
`[@mantine/core] Duplicate options are not supported. Option with value "${a.value}" was provided more than once`,
);
i.add(a.value);
}
})(e);
let k =
"string" == typeof n
? (
r ||
function e({ options: t, search: i, limit: a }) {
let r = i.trim().toLowerCase(),
n = [];
for (let o = 0; o < t.length; o += 1) {
let s = t[o];
if (n.length === a) break;
b(s) &&
n.push({
group: s.group,
items: e({
options: s.items,
search: i,
limit: a - n.length,
}),
}),
!b(s) && s.label.toLowerCase().includes(r) && n.push(s);
}
return n;
}
)({ options: e, search: d ? n : "", limit: o ?? 1 / 0 })
: e,
I = (function (e) {
if (0 === e.length) return !0;
for (let t of e) if (!("group" in t) || t.items.length > 0) return !1;
return !0;
})(k),
C = k.map((e) =>
(0, t.jsx)(
g,
{
data: e,
withCheckIcon: u,
withAlignedLabels: c,
value: m,
checkIconPosition: v,
unstyled: E,
renderOption: y,
},
b(e) ? e.group : e.value,
),
);
return (0, t.jsx)(h.Combobox.Dropdown, {
hidden: i || (a && I),
"data-composed": !0,
children: (0, t.jsxs)(h.Combobox.Options, {
labelledBy: w,
"aria-label": A,
children: [
l
? (0, t.jsx)(p.ScrollArea.Autosize, {
mah: s ?? 220,
type: "scroll",
scrollbarSize: "var(--combobox-padding)",
offsetScrollbars: "y",
...x,
children: C,
})
: C,
I && f && (0, t.jsx)(h.Combobox.Empty, { children: f }),
],
}),
});
}
var E = e.i(464588),
w = e.i(518366);
let y = {
withCheckIcon: !0,
allowDeselect: !0,
checkIconPosition: "left",
openOnFocus: !0,
},
x = (0, d.factory)((e, o) => {
let d = (0, l.useProps)("Select", y, e),
{
classNames: m,
styles: p,
unstyled: v,
vars: b,
dropdownOpened: g,
defaultDropdownOpened: x,
onDropdownClose: A,
onDropdownOpen: k,
onFocus: I,
onBlur: C,
onClick: T,
onChange: M,
data: _,
value: S,
defaultValue: L,
selectFirstOptionOnChange: R,
selectFirstOptionOnDropdownOpen: D,
onOptionSubmit: N,
comboboxProps: P,
readOnly: j,
disabled: O,
filter: U,
limit: H,
withScrollArea: V,
maxDropdownHeight: W,
size: $,
searchable: B,
rightSection: F,
checkIconPosition: z,
withCheckIcon: G,
withAlignedLabels: q,
nothingFoundMessage: Q,
name: K,
form: Y,
searchValue: X,
defaultSearchValue: Z,
onSearchChange: J,
allowDeselect: ee,
error: et,
rightSectionPointerEvents: ei,
id: ea,
clearable: er,
clearButtonProps: en,
hiddenInputProps: eo,
renderOption: es,
onClear: el,
autoComplete: ed,
scrollAreaProps: eu,
__defaultRightSection: ec,
__clearSection: eh,
__clearable: em,
chevronColor: ep,
autoSelectOnBlur: ev,
openOnFocus: eb,
attributes: eg,
...ef
} = d,
eE = (0, i.useMemo)(() => (0, u.getParsedComboboxData)(_), [_]),
ew = (0, i.useRef)({}),
ey = (0, i.useMemo)(() => (0, c.getOptionsLockup)(eE), [eE]),
ex = (0, a.useId)(ea),
[eA, ek, eI] = (0, r.useUncontrolled)({
value: S,
defaultValue: L,
finalValue: null,
onChange: M,
}),
eC =
"string" == typeof eA
? eA in ey
? ey[eA]
: ew.current[eA]
: void 0,
eT = (0, n.usePrevious)(eC),
[eM, e_, eS] = (0, r.useUncontrolled)({
value: X,
defaultValue: Z,
finalValue: eC ? eC.label : "",
onChange: J,
}),
eL = (0, E.useCombobox)({
opened: g,
defaultOpened: x,
onDropdownOpen: () => {
k?.(),
D
? eL.selectFirstOption()
: eL.updateSelectedOptionIndex("active", {
scrollIntoView: !0,
});
},
onDropdownClose: () => {
A?.(), setTimeout(eL.resetSelectedOption, 0);
},
}),
eR = (e) => {
e_(e), eL.resetSelectedOption();
},
{ resolvedClassNames: eD, resolvedStyles: eN } = (0,
s.useResolvedStylesApi)({ props: d, styles: p, classNames: m });
(0, i.useEffect)(() => {
R && eL.selectFirstOption();
}, [R, eM]),
(0, i.useEffect)(() => {
null === S && eR(""),
"string" == typeof S &&
eC &&
(eT?.value !== eC.value || eT?.label !== eC.label) &&
eR(eC.label);
}, [S, eC]),
(0, i.useEffect)(() => {
eI ||
eS ||
eR(
"string" == typeof eA
? eA in ey
? ey[eA]?.label
: ew.current[eA]?.label || ""
: "",
);
}, [ey, eA]),
(0, i.useEffect)(() => {
eA && eA in ey && (ew.current[eA] = ey[eA]);
}, [ey, eA]);
let eP = (0, t.jsx)(h.Combobox.ClearButton, {
...en,
onClear: () => {
ek(null, null), eR(""), el?.();
},
}),
ej = er && !!eA && !O && !j;
return (0, t.jsxs)(t.Fragment, {
children: [
(0, t.jsxs)(h.Combobox, {
store: eL,
__staticSelector: "Select",
classNames: eD,
styles: eN,
unstyled: v,
readOnly: j,
size: $,
attributes: eg,
keepMounted: ev,
onOptionSubmit: (e) => {
N?.(e);
let t = ee && ey[e].value === eA ? null : ey[e],
i = t ? t.value : null;
i !== eA && ek(i, t),
eI || eR(("string" == typeof i && t?.label) || ""),
eL.closeDropdown();
},
...P,
children: [
(0, t.jsx)(h.Combobox.Target, {
targetType: B ? "input" : "button",
autoComplete: ed,
children: (0, t.jsx)(w.InputBase, {
id: ex,
ref: o,
__defaultRightSection: (0, t.jsx)(h.Combobox.Chevron, {
size: $,
error: et,
unstyled: v,
color: ep,
}),
__clearSection: eP,
__clearable: ej,
rightSection: F,
rightSectionPointerEvents: ei || "none",
...ef,
size: $,
__staticSelector: "Select",
disabled: O,
readOnly: j || !B,
value: eM,
onChange: (e) => {
eR(e.currentTarget.value),
eL.openDropdown(),
R && eL.selectFirstOption();
},
onFocus: (e) => {
eb && B && eL.openDropdown(), I?.(e);
},
onBlur: (e) => {
ev && eL.clickSelectedOption(), B && eL.closeDropdown();
let t =
"string" == typeof eA &&
(eA in ey ? ey[eA] : ew.current[eA]);
eR((t && t.label) || ""), C?.(e);
},
onClick: (e) => {
B ? eL.openDropdown() : eL.toggleDropdown(), T?.(e);
},
classNames: eD,
styles: eN,
unstyled: v,
pointer: !B,
error: et,
attributes: eg,
}),
}),
(0, t.jsx)(f, {
data: eE,
hidden: j || O,
filter: U,
search: eM,
limit: H,
hiddenWhenEmpty: !Q,
withScrollArea: V,
maxDropdownHeight: W,
filterOptions: !!B && eC?.label !== eM,
value: eA,
checkIconPosition: z,
withCheckIcon: G,
withAlignedLabels: q,
nothingFoundMessage: Q,
unstyled: v,
labelId: ef.label ? `${ex}-label` : void 0,
"aria-label": ef.label ? void 0 : ef["aria-label"],
renderOption: es,
scrollAreaProps: eu,
}),
],
}),
(0, t.jsx)(h.Combobox.HiddenInput, {
value: eA,
name: K,
form: Y,
disabled: O,
...eo,
}),
],
});
});
(x.classes = { ...w.InputBase.classes, ...h.Combobox.classes }),
(x.displayName = "@mantine/core/Select"),
e.s(["Select", () => x], 247232);
};
export default moduleFactory;