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