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

449 lines
14 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: fb331b08bcf9fa6e.3b67e0d42a.js
* Module id: 529833
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
var t = e.i(462214),
r = e.i(358379),
o = e.i(192830),
n = e.i(983912),
i = e.i(909243),
a = e.i(855698),
l = e.i(938202),
s = e.i(7284),
u = e.i(759455),
d = e.i(450943),
c = e.i(978459),
f = e.i(479324),
p = e.i(46978),
m = e.i(981933),
h = e.i(433923),
v = e.i(754654),
g = e.i(764218),
x = e.i(657102),
w = e.i(615528),
b = e.i(205697),
y = e.i(600354),
P = e.i(141460),
R = e.i(142385),
C = e.i(593307);
let S = { refProp: "ref", popupType: "dialog" },
E = (0, C.factory)((e, t) => {
let {
children: o,
refProp: n,
popupType: i,
...a
} = (0, f.useProps)("PopoverTarget", S, e),
l = (0, R.getSingleElementChild)(o);
if (!l)
throw Error(
"Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported",
);
let u = (0, x.usePopoverContext)(),
d = (0, y.useMergedRef)(u.reference, (0, P.getRefProp)(l), t),
c = u.withRoles
? {
"aria-haspopup": i,
"aria-expanded": u.opened,
"aria-controls": u.opened ? u.getDropdownId() : void 0,
id: u.getTargetId(),
}
: {},
p = l.props;
return (0, r.cloneElement)(l, {
...a,
...c,
...u.targetProps,
className: (0, s.default)(
u.targetProps.className,
a.className,
p.className,
),
[n]: d,
...(!u.controlled
? {
onClick: () => {
u.onToggle(), p.onClick?.();
},
}
: null),
});
});
E.displayName = "@mantine/core/PopoverTarget";
var T = e.i(800109),
D = e.i(641712),
M = e.i(520466),
k = e.i(403557),
j = e.i(361752),
N = e.i(883787);
let O = {
position: "bottom",
offset: 8,
positionDependencies: [],
transitionProps: { transition: "fade", duration: 150 },
middlewares: { flip: !0, shift: !0, inline: !1 },
arrowSize: 7,
arrowOffset: 5,
arrowRadius: 0,
arrowPosition: "side",
closeOnClickOutside: !0,
withinPortal: !0,
closeOnEscape: !0,
trapFocus: !1,
withRoles: !0,
returnFocus: !1,
withOverlay: !1,
hideDetached: !0,
clickOutsideEvents: ["mousedown", "touchstart"],
zIndex: (0, i.getDefaultZIndex)("popover"),
__staticSelector: "Popover",
width: "max-content",
},
L = (0, l.createVarsResolver)((e, { radius: t, shadow: r }) => ({
dropdown: {
"--popover-radius": void 0 === t ? void 0 : (0, a.getRadius)(t),
"--popover-shadow": (0, a.getShadow)(r),
},
}));
function F(e) {
let i = (0, f.useProps)("Popover", O, e),
{
children: a,
position: l,
offset: s,
onPositionChange: b,
positionDependencies: y,
opened: P,
transitionProps: R,
onExitTransitionEnd: C,
onEnterTransitionEnd: S,
width: E,
middlewares: F,
withArrow: B,
arrowSize: I,
arrowOffset: _,
arrowRadius: A,
arrowPosition: z,
unstyled: $,
classNames: V,
styles: K,
closeOnClickOutside: U,
withinPortal: Y,
portalProps: H,
closeOnEscape: X,
clickOutsideEvents: G,
trapFocus: W,
onClose: Z,
onDismiss: J,
onOpen: q,
onChange: Q,
zIndex: ee,
radius: et,
shadow: er,
id: eo,
defaultOpened: en,
__staticSelector: ei,
withRoles: ea,
disabled: el,
returnFocus: es,
variant: eu,
keepMounted: ed,
vars: ec,
floatingStrategy: ef,
withOverlay: ep,
overlayProps: em,
hideDetached: eh,
attributes: ev,
preventPositionChangeWhenVisible: eg,
...ex
} = i,
ew = (0, d.useStyles)({
name: ei,
props: i,
classes: w.default,
classNames: V,
styles: K,
unstyled: $,
attributes: ev,
rootSelector: "dropdown",
vars: ec,
varsResolver: L,
}),
{ resolvedStyles: eb } = (0, u.useResolvedStylesApi)({
classNames: V,
styles: K,
props: i,
}),
[ey, eP] = (0, r.useState)(P ?? en ?? !1),
eR = (0, r.useRef)(l),
eC = (0, r.useRef)(null),
[eS, eE] = (0, r.useState)(null),
[eT, eD] = (0, r.useState)(null),
{ dir: eM } = (0, p.useDirection)(),
ek = (0, c.useMantineEnv)(),
ej = (0, o.useId)(eo),
eN = (function (e) {
var t;
let o,
n,
i = (0, c.useMantineEnv)(),
[a, l] = (0, k.useUncontrolled)({
value: e.opened,
defaultValue: e.defaultOpened,
finalValue: !1,
onChange: e.onChange,
}),
s = (0, r.useRef)(a),
u = (0, T.useFloating)({
strategy: e.strategy,
placement: e.preventPositionChangeWhenVisible
? e.positionRef.current
: e.position,
middleware:
((t = () => u),
(o = (function (e) {
if (void 0 === e) return { shift: !0, flip: !0 };
let t = { ...e };
return (
void 0 === e.shift && (t.shift = !0),
void 0 === e.flip && (t.flip = !0),
t
);
})(e.middlewares)),
(n = [(0, M.offset)(e.offset), (0, M.hide)()]),
e.dropdownVisible &&
"test" !== i &&
e.preventPositionChangeWhenVisible &&
(o.flip = !1),
o.flip &&
n.push(
"boolean" == typeof o.flip
? (0, M.flip)()
: (0, M.flip)(o.flip),
),
o.shift &&
n.push(
(0, M.shift)(
"boolean" == typeof o.shift
? { limiter: (0, M.limitShift)(), padding: 5 }
: {
limiter: (0, M.limitShift)(),
padding: 5,
...o.shift,
},
),
),
o.inline &&
n.push(
"boolean" == typeof o.inline
? (0, M.inline)()
: (0, M.inline)(o.inline),
),
n.push(
(0, M.arrow)({ element: e.arrowRef, padding: e.arrowOffset }),
),
(o.size || "target" === e.width) &&
n.push(
(0, M.size)({
...("boolean" == typeof o.size ? {} : o.size),
apply({
rects: r,
availableWidth: n,
availableHeight: i,
...a
}) {
let l = t(),
s = l.refs.floating.current?.style ?? {};
o.size &&
("object" == typeof o.size && o.size.apply
? o.size.apply({
rects: r,
availableWidth: n,
availableHeight: i,
...a,
})
: Object.assign(s, {
maxWidth: `${n}px`,
maxHeight: `${i}px`,
})),
"target" === e.width &&
Object.assign(s, {
width: `${r.reference.width}px`,
});
},
}),
),
n),
whileElementsMounted: e.keepMounted ? void 0 : D.autoUpdate,
});
return (
(0, r.useEffect)(() => {
if (u.refs.reference.current && u.refs.floating.current && a)
return (0, D.autoUpdate)(
u.refs.reference.current,
u.refs.floating.current,
u.update,
);
}, [a, u.update]),
(0, j.useDidUpdate)(() => {
e.onPositionChange?.(u.placement),
(e.positionRef.current = u.placement);
}, [u.placement, e.preventPositionChangeWhenVisible]),
(0, j.useDidUpdate)(() => {
a !== s.current && (a ? e.onOpen?.() : e.onClose?.()),
(s.current = a);
}, [a, e.onClose, e.onOpen]),
(0, N.useIsomorphicEffect)(() => {
let t = -1;
return (
a && (t = window.setTimeout(() => e.setDropdownVisible(!0), 4)),
() => {
window.clearTimeout(t);
}
);
}, [a, e.position]),
{
floating: u,
controlled: "boolean" == typeof e.opened,
opened: a,
onClose: () => {
a && !e.disabled && l(!1);
},
onToggle: () => {
e.disabled || l(!a);
},
}
);
})({
middlewares: F,
width: E,
position: (0, m.getFloatingPosition)(eM, l),
offset: "number" == typeof s ? s + (B ? I / 2 : 0) : s,
arrowRef: eC,
arrowOffset: _,
onPositionChange: b,
positionDependencies: y,
opened: P,
defaultOpened: en,
onChange: Q,
onOpen: q,
onClose: Z,
onDismiss: J,
strategy: ef,
dropdownVisible: ey,
setDropdownVisible: eP,
positionRef: eR,
disabled: el,
preventPositionChangeWhenVisible: eg,
keepMounted: ed,
});
(0, n.useClickOutside)(
() => {
U && (eN.onClose(), J?.());
},
G,
[eS, eT],
);
let eO = (0, r.useCallback)(
(e) => {
eE(e), eN.floating.refs.setReference(e);
},
[eN.floating.refs.setReference],
),
eL = (0, r.useCallback)(
(e) => {
eD(e), eN.floating.refs.setFloating(e);
},
[eN.floating.refs.setFloating],
),
eF = (0, r.useCallback)(() => {
R?.onExited?.(), C?.(), eP(!1), eg || (eR.current = l);
}, [R?.onExited, C, eg, l]),
eB = (0, r.useCallback)(() => {
R?.onEntered?.(), S?.();
}, [R?.onEntered, S]);
return (0, t.jsxs)(x.PopoverContextProvider, {
value: {
returnFocus: es,
disabled: el,
controlled: eN.controlled,
reference: eO,
floating: eL,
x: eN.floating.x,
y: eN.floating.y,
arrowX: eN.floating?.middlewareData?.arrow?.x,
arrowY: eN.floating?.middlewareData?.arrow?.y,
opened: eN.opened,
arrowRef: eC,
transitionProps: { ...R, onExited: eF, onEntered: eB },
width: E,
withArrow: B,
arrowSize: I,
arrowOffset: _,
arrowRadius: A,
arrowPosition: z,
placement: eN.floating.placement,
trapFocus: W,
withinPortal: Y,
portalProps: H,
zIndex: ee,
radius: et,
shadow: er,
closeOnEscape: X,
onDismiss: J,
onClose: eN.onClose,
onToggle: eN.onToggle,
getTargetId: () => `${ej}-target`,
getDropdownId: () => `${ej}-dropdown`,
withRoles: ea,
targetProps: ex,
__staticSelector: ei,
classNames: V,
styles: K,
unstyled: $,
variant: eu,
keepMounted: ed,
getStyles: ew,
resolvedStyles: eb,
floatingStrategy: ef,
referenceHidden:
!!eh &&
"test" !== ek &&
eN.floating.middlewareData.hide?.referenceHidden,
},
children: [
a,
ep &&
(0, t.jsx)(g.Transition, {
transition: "fade",
mounted: eN.opened,
duration: R?.duration || 250,
exitDuration: R?.exitDuration || 250,
children: (e) =>
(0, t.jsx)(v.OptionalPortal, {
withinPortal: Y,
children: (0, t.jsx)(h.Overlay, {
...em,
...ew("overlay", {
className: em?.className,
style: [e, em?.style],
}),
}),
}),
}),
],
});
}
(F.Target = E),
(F.Dropdown = b.PopoverDropdown),
(F.displayName = "@mantine/core/Popover"),
(F.extend = (e) => e),
e.s(["Popover", () => F], 529833);
};
export default moduleFactory;