@banzamel/mineralui 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{MDropdownMenu-C2lftqSx.cjs → MDropdownMenu-BvN5grK5.cjs} +2 -2
- package/dist/{MDropdownMenu-C2lftqSx.cjs.map → MDropdownMenu-BvN5grK5.cjs.map} +1 -1
- package/dist/{MDropdownMenu-BeD_DxPr.js → MDropdownMenu-CFoKJ7V6.js} +2 -2
- package/dist/{MDropdownMenu-BeD_DxPr.js.map → MDropdownMenu-CFoKJ7V6.js.map} +1 -1
- package/dist/{MInputCVC-DvUOzpYp.js → MInputCVC-B4V0QI5h.js} +2 -2
- package/dist/{MInputCVC-DvUOzpYp.js.map → MInputCVC-B4V0QI5h.js.map} +1 -1
- package/dist/{MInputCVC-_2ALihF1.cjs → MInputCVC-BlY5OrVn.cjs} +2 -2
- package/dist/{MInputCVC-_2ALihF1.cjs.map → MInputCVC-BlY5OrVn.cjs.map} +1 -1
- package/dist/MPopover-C5aaGhma.js +150 -0
- package/dist/MPopover-C5aaGhma.js.map +1 -0
- package/dist/MPopover-CV-9MArH.cjs +2 -0
- package/dist/MPopover-CV-9MArH.cjs.map +1 -0
- package/dist/{cards-fRWZkts9.cjs → cards-CQSYgH9U.cjs} +2 -2
- package/dist/{cards-fRWZkts9.cjs.map → cards-CQSYgH9U.cjs.map} +1 -1
- package/dist/{cards-DYmK8TpL.js → cards-Cpr9B8Mu.js} +4 -4
- package/dist/{cards-DYmK8TpL.js.map → cards-Cpr9B8Mu.js.map} +1 -1
- package/dist/cards.cjs +1 -1
- package/dist/cards.js +1 -1
- package/dist/components/primitives/MPopover/popoverStack.d.ts +32 -0
- package/dist/{data-CuynADWM.cjs → data-BZ92hzXx.cjs} +2 -2
- package/dist/{data-CuynADWM.cjs.map → data-BZ92hzXx.cjs.map} +1 -1
- package/dist/{data-D8WFA3Et.js → data-C-6DP7iY.js} +2 -2
- package/dist/{data-D8WFA3Et.js.map → data-C-6DP7iY.js.map} +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.js +1 -1
- package/dist/{dropdowns-5cJf-6UG.js → dropdowns-DiThUF7D.js} +2 -2
- package/dist/{dropdowns-5cJf-6UG.js.map → dropdowns-DiThUF7D.js.map} +1 -1
- package/dist/{dropdowns-C-ASvu7P.cjs → dropdowns-bQ0cEKNN.cjs} +2 -2
- package/dist/{dropdowns-C-ASvu7P.cjs.map → dropdowns-bQ0cEKNN.cjs.map} +1 -1
- package/dist/dropdowns.cjs +1 -1
- package/dist/dropdowns.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +8 -8
- package/dist/inputs.cjs +1 -1
- package/dist/inputs.js +1 -1
- package/dist/{layout-i8H5tIbO.js → layout-CdSpVJuK.js} +2 -2
- package/dist/{layout-i8H5tIbO.js.map → layout-CdSpVJuK.js.map} +1 -1
- package/dist/{layout-CfolwT8L.cjs → layout-Ddo7HUPu.cjs} +2 -2
- package/dist/{layout-CfolwT8L.cjs.map → layout-Ddo7HUPu.cjs.map} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.js +1 -1
- package/dist/{overlays-zPzbHW5P.cjs → overlays-BUZEaZaJ.cjs} +2 -2
- package/dist/{overlays-zPzbHW5P.cjs.map → overlays-BUZEaZaJ.cjs.map} +1 -1
- package/dist/{overlays-CAcGmqNv.js → overlays-C1vO_A2I.js} +2 -2
- package/dist/{overlays-CAcGmqNv.js.map → overlays-C1vO_A2I.js.map} +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.js +2 -2
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.js +1 -1
- package/package.json +1 -1
- package/dist/MPopover-Cweomcj2.cjs +0 -2
- package/dist/MPopover-Cweomcj2.cjs.map +0 -1
- package/dist/MPopover-DT3vclV1.js +0 -98
- package/dist/MPopover-DT3vclV1.js.map +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { t as e } from "./cn-YER3QsV1.js";
|
|
2
|
+
import { t } from "./MPortal-Ba2Sxset.js";
|
|
3
|
+
import { useCallback as n, useEffect as r, useRef as i, useState as a } from "react";
|
|
4
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/primitives/MPopover/popoverStack.ts
|
|
6
|
+
var s = [], c = 1;
|
|
7
|
+
function l() {
|
|
8
|
+
return c++;
|
|
9
|
+
}
|
|
10
|
+
function u(e) {
|
|
11
|
+
return s.push(e), () => {
|
|
12
|
+
let t = s.indexOf(e);
|
|
13
|
+
t !== -1 && s.splice(t, 1);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function d(e) {
|
|
17
|
+
let t = e.getAnchorEl();
|
|
18
|
+
if (!t) return null;
|
|
19
|
+
for (let n of s) {
|
|
20
|
+
if (n.id === e.id) continue;
|
|
21
|
+
let r = n.getPopoverEl();
|
|
22
|
+
if (r && r.contains(t)) return n.id;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
function f(e, t) {
|
|
27
|
+
if (!t) return !1;
|
|
28
|
+
for (let n of s) {
|
|
29
|
+
if (n.id === e) continue;
|
|
30
|
+
let r = n.getPopoverEl();
|
|
31
|
+
if (!r || !r.contains(t)) continue;
|
|
32
|
+
let i = /* @__PURE__ */ new Set(), a = d(n);
|
|
33
|
+
for (; a !== null && !i.has(a);) {
|
|
34
|
+
if (a === e) return !0;
|
|
35
|
+
i.add(a);
|
|
36
|
+
let t = s.find((e) => e.id === a);
|
|
37
|
+
a = t ? d(t) : null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return !1;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/components/primitives/MPopover/MPopover.tsx
|
|
44
|
+
function p({ open: s, anchorRef: c, onClose: d, placement: p = "bottom-start", matchWidth: m = !1, offset: h = 4, zIndex: g, children: _, className: v, style: y }) {
|
|
45
|
+
let b = i(null), x = i(null);
|
|
46
|
+
x.current === null && (x.current = l());
|
|
47
|
+
let S = x.current, [C, w] = a(null), [T, E] = a(!1), [D, O] = a(null), k = n(() => {
|
|
48
|
+
if (g !== void 0) {
|
|
49
|
+
O(g);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
let e = c.current;
|
|
53
|
+
if (!e || typeof window > "u") {
|
|
54
|
+
O(null);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
let t = e.closest(".drawer-backdrop, .modal-backdrop, .sheet-backdrop, .sidebar.mobile-open, .popover");
|
|
58
|
+
if (!t) {
|
|
59
|
+
O(null);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
let n = window.getComputedStyle(t).zIndex, r = Number.parseInt(n, 10);
|
|
63
|
+
O(Number.isFinite(r) ? r + 1 : null);
|
|
64
|
+
}, [c, g]), A = n(() => {
|
|
65
|
+
if (!c.current || !b.current) return;
|
|
66
|
+
let e = c.current.getBoundingClientRect(), t = b.current.getBoundingClientRect(), n = {
|
|
67
|
+
width: window.innerWidth,
|
|
68
|
+
height: window.innerHeight
|
|
69
|
+
}, r = p.startsWith("top"), i = p.startsWith("right"), a = p.startsWith("left"), o = i || a, s = p.endsWith("end"), l, u;
|
|
70
|
+
if (o) {
|
|
71
|
+
let r = n.width - e.right - h, a = e.left - h, o = i ? r < t.width && a > r : a < t.width && r > a;
|
|
72
|
+
E(o), u = (i ? !o : o) ? e.right + h + window.scrollX : e.left - t.width - h + window.scrollX, l = s ? e.bottom - t.height + window.scrollY : e.top + window.scrollY;
|
|
73
|
+
} else {
|
|
74
|
+
let i = n.height - e.bottom - h, a = e.top - h, o = r ? a < t.height && i > a : i < t.height && a > i;
|
|
75
|
+
E(o), l = (r ? !o : o) ? e.top - t.height - h + window.scrollY : e.bottom + h + window.scrollY, u = s ? e.right - t.width + window.scrollX : e.left + window.scrollX;
|
|
76
|
+
}
|
|
77
|
+
u = Math.max(8, Math.min(u, n.width - t.width - 8)), l = Math.max(8 + window.scrollY, l), w({
|
|
78
|
+
top: l,
|
|
79
|
+
left: u,
|
|
80
|
+
width: m ? e.width : void 0
|
|
81
|
+
});
|
|
82
|
+
}, [
|
|
83
|
+
c,
|
|
84
|
+
p,
|
|
85
|
+
h,
|
|
86
|
+
m
|
|
87
|
+
]);
|
|
88
|
+
return r(() => {
|
|
89
|
+
if (!s) {
|
|
90
|
+
w(null), O(null);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
return k(), requestAnimationFrame(A), document.addEventListener("scroll", A, {
|
|
94
|
+
capture: !0,
|
|
95
|
+
passive: !0
|
|
96
|
+
}), window.addEventListener("resize", A, { passive: !0 }), () => {
|
|
97
|
+
document.removeEventListener("scroll", A, { capture: !0 }), window.removeEventListener("resize", A);
|
|
98
|
+
};
|
|
99
|
+
}, [
|
|
100
|
+
s,
|
|
101
|
+
k,
|
|
102
|
+
A
|
|
103
|
+
]), r(() => {
|
|
104
|
+
if (!s) return;
|
|
105
|
+
let e = (e) => {
|
|
106
|
+
e.key === "Escape" && d();
|
|
107
|
+
};
|
|
108
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
109
|
+
}, [s, d]), r(() => {
|
|
110
|
+
if (s) return u({
|
|
111
|
+
id: S,
|
|
112
|
+
getPopoverEl: () => b.current,
|
|
113
|
+
getAnchorEl: () => c.current
|
|
114
|
+
});
|
|
115
|
+
}, [
|
|
116
|
+
s,
|
|
117
|
+
S,
|
|
118
|
+
c
|
|
119
|
+
]), r(() => {
|
|
120
|
+
if (!s) return;
|
|
121
|
+
let e = (e) => {
|
|
122
|
+
let t = e.target;
|
|
123
|
+
b.current?.contains(t) || c.current?.contains(t) || f(S, t) || d();
|
|
124
|
+
};
|
|
125
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
126
|
+
}, [
|
|
127
|
+
s,
|
|
128
|
+
d,
|
|
129
|
+
c,
|
|
130
|
+
S
|
|
131
|
+
]), s ? /* @__PURE__ */ o(t, { children: /* @__PURE__ */ o("div", {
|
|
132
|
+
ref: b,
|
|
133
|
+
className: e("popover", T ? "flipped" : "normal", v),
|
|
134
|
+
style: {
|
|
135
|
+
position: "absolute",
|
|
136
|
+
top: C?.top ?? 0,
|
|
137
|
+
left: C?.left ?? 0,
|
|
138
|
+
width: C?.width,
|
|
139
|
+
zIndex: D ?? void 0,
|
|
140
|
+
visibility: C ? "visible" : "hidden",
|
|
141
|
+
...y
|
|
142
|
+
},
|
|
143
|
+
role: "listbox",
|
|
144
|
+
children: _
|
|
145
|
+
}) }) : null;
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
export { p as t };
|
|
149
|
+
|
|
150
|
+
//# sourceMappingURL=MPopover-C5aaGhma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MPopover-C5aaGhma.js","names":[],"sources":["../src/components/primitives/MPopover/popoverStack.ts","../src/components/primitives/MPopover/MPopover.tsx"],"sourcesContent":["/**\n * Registry of currently-open MPopover instances.\n *\n * Every popover portals its content to `document.body`, so a popover opened\n * from inside another popover is NOT a DOM descendant of its parent. That\n * breaks the naive outside-click test (`parent.contains(target)`): pressing a\n * nested dropdown item looks like an outside click to the parent, the parent\n * closes, React unmounts the nested menu mid-gesture, and the browser never\n * gets to fire `click` because mousedown and mouseup landed on different\n * elements. The action silently does nothing.\n *\n * This registry restores the nesting relation the DOM lost. Nesting is derived\n * from where each popover's ANCHOR lives, not from open order: a popover whose\n * anchor sits inside another popover's element is that popover's child. Open\n * order would misclassify two independent popovers that happen to be open at\n * the same time — clicking the newer one must still close the older one.\n */\n\nexport interface PopoverRegistration {\n id: number\n getPopoverEl: () => HTMLElement | null\n getAnchorEl: () => HTMLElement | null\n}\n\nconst registrations: PopoverRegistration[] = []\nlet nextId = 1\n\nexport function nextPopoverId(): number {\n return nextId++\n}\n\nexport function registerPopover(registration: PopoverRegistration): () => void {\n registrations.push(registration)\n return () => {\n const index = registrations.indexOf(registration)\n if (index !== -1) registrations.splice(index, 1)\n }\n}\n\n/** The registered popover whose element contains `entry`'s anchor, if any. */\nfunction parentIdOf(entry: PopoverRegistration): number | null {\n const anchor = entry.getAnchorEl()\n if (!anchor) return null\n\n for (const other of registrations) {\n if (other.id === entry.id) continue\n const element = other.getPopoverEl()\n if (element && element.contains(anchor)) return other.id\n }\n\n return null\n}\n\n/**\n * True when `target` lies inside a popover that is nested (at any depth) within\n * the popover identified by `id`. Callers use it to keep a parent open while\n * the interaction belongs to one of its descendants.\n */\nexport function isInsideDescendantPopover(id: number, target: Node | null): boolean {\n if (!target) return false\n\n for (const entry of registrations) {\n if (entry.id === id) continue\n\n const element = entry.getPopoverEl()\n if (!element || !element.contains(target)) continue\n\n // Walk the ancestor chain of the popover that was actually hit.\n // `seen` guards against a cycle if a malformed tree ever produces one.\n const seen = new Set<number>()\n let cursor = parentIdOf(entry)\n\n while (cursor !== null && !seen.has(cursor)) {\n if (cursor === id) return true\n seen.add(cursor)\n const parent = registrations.find((candidate) => candidate.id === cursor)\n cursor = parent ? parentIdOf(parent) : null\n }\n }\n\n return false\n}\n\n/** Test-only helper — the registry is module state that outlives a render. */\nexport function __resetPopoverStack(): void {\n registrations.length = 0\n nextId = 1\n}\n","import {useState, useEffect, useRef, useCallback} from 'react'\nimport {MPortal} from '../MPortal'\nimport {cn} from '../../../utils/cn'\nimport {isInsideDescendantPopover, nextPopoverId, registerPopover} from './popoverStack'\nimport type {MPopoverProps} from './MPopover.types'\nimport './MPopover.css'\n\n// Position floating content relative to an anchor with viewport-aware flipping.\nexport function MPopover({\n open,\n anchorRef,\n onClose,\n placement = 'bottom-start',\n matchWidth = false,\n offset = 4,\n zIndex,\n children,\n className,\n style,\n}: MPopoverProps) {\n const popoverRef = useRef<HTMLDivElement>(null)\n const popoverIdRef = useRef<number>(null)\n if (popoverIdRef.current === null) popoverIdRef.current = nextPopoverId()\n const popoverId = popoverIdRef.current\n const [position, setPosition] = useState<{top: number; left: number; width?: number} | null>(null)\n const [flipped, setFlipped] = useState(false)\n const [layerZ, setLayerZ] = useState<number | string | null>(null)\n\n // Lift popovers above drawers, modals and mobile sidebars when the anchor sits inside them.\n const updateLayer = useCallback(() => {\n if (zIndex !== undefined) {\n setLayerZ(zIndex)\n return\n }\n\n const anchor = anchorRef.current\n if (!anchor || typeof window === 'undefined') {\n setLayerZ(null)\n return\n }\n\n const layerHost = anchor.closest(\n '.drawer-backdrop, .modal-backdrop, .sheet-backdrop, .sidebar.mobile-open, .popover'\n )\n if (!layerHost) {\n setLayerZ(null)\n return\n }\n\n const computedZ = window.getComputedStyle(layerHost).zIndex\n const parsedZ = Number.parseInt(computedZ, 10)\n setLayerZ(Number.isFinite(parsedZ) ? parsedZ + 1 : null)\n }, [anchorRef, zIndex])\n\n // Recalculate popover position whenever layout or viewport constraints change.\n const updatePosition = useCallback(() => {\n if (!anchorRef.current || !popoverRef.current) return\n\n const anchor = anchorRef.current.getBoundingClientRect()\n const popover = popoverRef.current.getBoundingClientRect()\n const viewport = {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n\n const isTop = placement.startsWith('top')\n const isRight = placement.startsWith('right')\n const isLeft = placement.startsWith('left')\n const isHorizontal = isRight || isLeft\n const isEnd = placement.endsWith('end')\n\n let top: number\n let left: number\n\n if (isHorizontal) {\n // Horizontal placement: position to the right or left of the anchor\n const spaceRight = viewport.width - anchor.right - offset\n const spaceLeft = anchor.left - offset\n const shouldFlip = isRight\n ? spaceRight < popover.width && spaceLeft > spaceRight\n : spaceLeft < popover.width && spaceRight > spaceLeft\n\n setFlipped(shouldFlip)\n\n const showOnRight = isRight ? !shouldFlip : shouldFlip\n\n if (showOnRight) {\n left = anchor.right + offset + window.scrollX\n } else {\n left = anchor.left - popover.width - offset + window.scrollX\n }\n\n if (isEnd) {\n top = anchor.bottom - popover.height + window.scrollY\n } else {\n top = anchor.top + window.scrollY\n }\n } else {\n // Vertical placement: position above or below the anchor\n const spaceBelow = viewport.height - anchor.bottom - offset\n const spaceAbove = anchor.top - offset\n const shouldFlip = isTop\n ? spaceAbove < popover.height && spaceBelow > spaceAbove\n : spaceBelow < popover.height && spaceAbove > spaceBelow\n\n setFlipped(shouldFlip)\n\n const showOnTop = isTop ? !shouldFlip : shouldFlip\n\n if (showOnTop) {\n top = anchor.top - popover.height - offset + window.scrollY\n } else {\n top = anchor.bottom + offset + window.scrollY\n }\n\n if (isEnd) {\n left = anchor.right - popover.width + window.scrollX\n } else {\n left = anchor.left + window.scrollX\n }\n }\n\n // Clamp to viewport\n left = Math.max(8, Math.min(left, viewport.width - popover.width - 8))\n top = Math.max(8 + window.scrollY, top)\n\n setPosition({\n top,\n left,\n width: matchWidth ? anchor.width : undefined,\n })\n }, [anchorRef, placement, offset, matchWidth])\n\n useEffect(() => {\n if (!open) {\n setPosition(null)\n setLayerZ(null)\n return\n }\n\n updateLayer()\n // Wait one frame so the rendered popover can be measured accurately.\n requestAnimationFrame(updatePosition)\n\n // `scroll` does not bubble, so a window listener only ever sees the\n // document scrolling. Anchors living inside a scrollable ancestor — an\n // app shell with a scrolling main region, MStickyPanel, an overflowing\n // card — would leave the popover stranded at its opening coordinates\n // while the anchor moved away underneath it. Scroll events do capture,\n // so a capture-phase listener on the document catches scrolling from\n // ANY container, including the document itself.\n document.addEventListener('scroll', updatePosition, {capture: true, passive: true})\n window.addEventListener('resize', updatePosition, {passive: true})\n return () => {\n document.removeEventListener('scroll', updatePosition, {capture: true})\n window.removeEventListener('resize', updatePosition)\n }\n }, [open, updateLayer, updatePosition])\n\n // Close the popover with the standard Escape key interaction.\n useEffect(() => {\n if (!open) return\n const handleKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') onClose()\n }\n document.addEventListener('keydown', handleKey)\n return () => document.removeEventListener('keydown', handleKey)\n }, [open, onClose])\n\n // Publish this instance while it is open so nested popovers can be related\n // back to it — see popoverStack.ts for why the DOM alone cannot answer this.\n useEffect(() => {\n if (!open) return\n return registerPopover({\n id: popoverId,\n getPopoverEl: () => popoverRef.current,\n getAnchorEl: () => anchorRef.current,\n })\n }, [open, popoverId, anchorRef])\n\n // Close when the user interacts outside both the popover and its anchor.\n useEffect(() => {\n if (!open) return\n const handleClick = (e: MouseEvent) => {\n const target = e.target as Node\n\n if (popoverRef.current?.contains(target) || anchorRef.current?.contains(target)) {\n return\n }\n\n // A popover nested inside this one is portaled to `document.body`,\n // so it fails the `contains` checks above even though the click\n // belongs to this popover's own subtree. Closing here would unmount\n // that child between mousedown and mouseup and swallow its click.\n if (isInsideDescendantPopover(popoverId, target)) {\n return\n }\n\n onClose()\n }\n document.addEventListener('mousedown', handleClick)\n return () => document.removeEventListener('mousedown', handleClick)\n }, [open, onClose, anchorRef, popoverId])\n\n if (!open) return null\n\n return (\n <MPortal>\n <div\n ref={popoverRef}\n className={cn('popover', flipped ? 'flipped' : 'normal', className)}\n style={{\n position: 'absolute',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n width: position?.width,\n zIndex: layerZ ?? undefined,\n visibility: position ? 'visible' : 'hidden',\n ...style,\n }}\n role=\"listbox\"\n >\n {children}\n </div>\n </MPortal>\n )\n}\n"],"mappings":";;;;;AAwBA,IAAM,IAAuC,EAAE,EAC3C,IAAS;AAEb,SAAgB,IAAwB;AACpC,QAAO;;AAGX,SAAgB,EAAgB,GAA+C;AAE3E,QADA,EAAc,KAAK,EAAa,QACnB;EACT,IAAM,IAAQ,EAAc,QAAQ,EAAa;AACjD,EAAI,MAAU,MAAI,EAAc,OAAO,GAAO,EAAE;;;AAKxD,SAAS,EAAW,GAA2C;CAC3D,IAAM,IAAS,EAAM,aAAa;AAClC,KAAI,CAAC,EAAQ,QAAO;AAEpB,MAAK,IAAM,KAAS,GAAe;AAC/B,MAAI,EAAM,OAAO,EAAM,GAAI;EAC3B,IAAM,IAAU,EAAM,cAAc;AACpC,MAAI,KAAW,EAAQ,SAAS,EAAO,CAAE,QAAO,EAAM;;AAG1D,QAAO;;AAQX,SAAgB,EAA0B,GAAY,GAA8B;AAChF,KAAI,CAAC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YAAY,UAAU,EAAU;EACnE,OAAO;GACH,UAAU;GACV,KAAK,GAAU,OAAO;GACtB,MAAM,GAAU,QAAQ;GACxB,OAAO,GAAU;GACjB,QAAQ,KAAU,KAAA;GAClB,YAAY,IAAW,YAAY;GACnC,GAAG;GACN;EACD,MAAK;EAEJ;EACC,CAAA,EACA,CAAA,GApBI"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require(`./cn-CU5TNITO.cjs`),t=require(`./MPortal-BciZHNDC.cjs`);require(`./core-DBpQf3uY.cjs`);let n=require(`react`),r=require(`react/jsx-runtime`);var i=[],a=1;function o(){return a++}function s(e){return i.push(e),()=>{let t=i.indexOf(e);t!==-1&&i.splice(t,1)}}function c(e){let t=e.getAnchorEl();if(!t)return null;for(let n of i){if(n.id===e.id)continue;let r=n.getPopoverEl();if(r&&r.contains(t))return n.id}return null}function l(e,t){if(!t)return!1;for(let n of i){if(n.id===e)continue;let r=n.getPopoverEl();if(!r||!r.contains(t))continue;let a=new Set,o=c(n);for(;o!==null&&!a.has(o);){if(o===e)return!0;a.add(o);let t=i.find(e=>e.id===o);o=t?c(t):null}}return!1}function u({open:i,anchorRef:a,onClose:c,placement:u=`bottom-start`,matchWidth:d=!1,offset:f=4,zIndex:p,children:m,className:h,style:g}){let _=(0,n.useRef)(null),v=(0,n.useRef)(null);v.current===null&&(v.current=o());let y=v.current,[b,x]=(0,n.useState)(null),[S,C]=(0,n.useState)(!1),[w,T]=(0,n.useState)(null),E=(0,n.useCallback)(()=>{if(p!==void 0){T(p);return}let e=a.current;if(!e||typeof window>`u`){T(null);return}let t=e.closest(`.drawer-backdrop, .modal-backdrop, .sheet-backdrop, .sidebar.mobile-open, .popover`);if(!t){T(null);return}let n=window.getComputedStyle(t).zIndex,r=Number.parseInt(n,10);T(Number.isFinite(r)?r+1:null)},[a,p]),D=(0,n.useCallback)(()=>{if(!a.current||!_.current)return;let e=a.current.getBoundingClientRect(),t=_.current.getBoundingClientRect(),n={width:window.innerWidth,height:window.innerHeight},r=u.startsWith(`top`),i=u.startsWith(`right`),o=u.startsWith(`left`),s=i||o,c=u.endsWith(`end`),l,p;if(s){let r=n.width-e.right-f,a=e.left-f,o=i?r<t.width&&a>r:a<t.width&&r>a;C(o),p=(i?!o:o)?e.right+f+window.scrollX:e.left-t.width-f+window.scrollX,l=c?e.bottom-t.height+window.scrollY:e.top+window.scrollY}else{let i=n.height-e.bottom-f,a=e.top-f,o=r?a<t.height&&i>a:i<t.height&&a>i;C(o),l=(r?!o:o)?e.top-t.height-f+window.scrollY:e.bottom+f+window.scrollY,p=c?e.right-t.width+window.scrollX:e.left+window.scrollX}p=Math.max(8,Math.min(p,n.width-t.width-8)),l=Math.max(8+window.scrollY,l),x({top:l,left:p,width:d?e.width:void 0})},[a,u,f,d]);return(0,n.useEffect)(()=>{if(!i){x(null),T(null);return}return E(),requestAnimationFrame(D),document.addEventListener(`scroll`,D,{capture:!0,passive:!0}),window.addEventListener(`resize`,D,{passive:!0}),()=>{document.removeEventListener(`scroll`,D,{capture:!0}),window.removeEventListener(`resize`,D)}},[i,E,D]),(0,n.useEffect)(()=>{if(!i)return;let e=e=>{e.key===`Escape`&&c()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i,c]),(0,n.useEffect)(()=>{if(i)return s({id:y,getPopoverEl:()=>_.current,getAnchorEl:()=>a.current})},[i,y,a]),(0,n.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;_.current?.contains(t)||a.current?.contains(t)||l(y,t)||c()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i,c,a,y]),i?(0,r.jsx)(t.t,{children:(0,r.jsx)(`div`,{ref:_,className:e.t(`popover`,S?`flipped`:`normal`,h),style:{position:`absolute`,top:b?.top??0,left:b?.left??0,width:b?.width,zIndex:w??void 0,visibility:b?`visible`:`hidden`,...g},role:`listbox`,children:m})}):null}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return u}});
|
|
2
|
+
//# sourceMappingURL=MPopover-CV-9MArH.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MPopover-CV-9MArH.cjs","names":[],"sources":["../src/components/primitives/MPopover/popoverStack.ts","../src/components/primitives/MPopover/MPopover.tsx"],"sourcesContent":["/**\n * Registry of currently-open MPopover instances.\n *\n * Every popover portals its content to `document.body`, so a popover opened\n * from inside another popover is NOT a DOM descendant of its parent. That\n * breaks the naive outside-click test (`parent.contains(target)`): pressing a\n * nested dropdown item looks like an outside click to the parent, the parent\n * closes, React unmounts the nested menu mid-gesture, and the browser never\n * gets to fire `click` because mousedown and mouseup landed on different\n * elements. The action silently does nothing.\n *\n * This registry restores the nesting relation the DOM lost. Nesting is derived\n * from where each popover's ANCHOR lives, not from open order: a popover whose\n * anchor sits inside another popover's element is that popover's child. Open\n * order would misclassify two independent popovers that happen to be open at\n * the same time — clicking the newer one must still close the older one.\n */\n\nexport interface PopoverRegistration {\n id: number\n getPopoverEl: () => HTMLElement | null\n getAnchorEl: () => HTMLElement | null\n}\n\nconst registrations: PopoverRegistration[] = []\nlet nextId = 1\n\nexport function nextPopoverId(): number {\n return nextId++\n}\n\nexport function registerPopover(registration: PopoverRegistration): () => void {\n registrations.push(registration)\n return () => {\n const index = registrations.indexOf(registration)\n if (index !== -1) registrations.splice(index, 1)\n }\n}\n\n/** The registered popover whose element contains `entry`'s anchor, if any. */\nfunction parentIdOf(entry: PopoverRegistration): number | null {\n const anchor = entry.getAnchorEl()\n if (!anchor) return null\n\n for (const other of registrations) {\n if (other.id === entry.id) continue\n const element = other.getPopoverEl()\n if (element && element.contains(anchor)) return other.id\n }\n\n return null\n}\n\n/**\n * True when `target` lies inside a popover that is nested (at any depth) within\n * the popover identified by `id`. Callers use it to keep a parent open while\n * the interaction belongs to one of its descendants.\n */\nexport function isInsideDescendantPopover(id: number, target: Node | null): boolean {\n if (!target) return false\n\n for (const entry of registrations) {\n if (entry.id === id) continue\n\n const element = entry.getPopoverEl()\n if (!element || !element.contains(target)) continue\n\n // Walk the ancestor chain of the popover that was actually hit.\n // `seen` guards against a cycle if a malformed tree ever produces one.\n const seen = new Set<number>()\n let cursor = parentIdOf(entry)\n\n while (cursor !== null && !seen.has(cursor)) {\n if (cursor === id) return true\n seen.add(cursor)\n const parent = registrations.find((candidate) => candidate.id === cursor)\n cursor = parent ? parentIdOf(parent) : null\n }\n }\n\n return false\n}\n\n/** Test-only helper — the registry is module state that outlives a render. */\nexport function __resetPopoverStack(): void {\n registrations.length = 0\n nextId = 1\n}\n","import {useState, useEffect, useRef, useCallback} from 'react'\nimport {MPortal} from '../MPortal'\nimport {cn} from '../../../utils/cn'\nimport {isInsideDescendantPopover, nextPopoverId, registerPopover} from './popoverStack'\nimport type {MPopoverProps} from './MPopover.types'\nimport './MPopover.css'\n\n// Position floating content relative to an anchor with viewport-aware flipping.\nexport function MPopover({\n open,\n anchorRef,\n onClose,\n placement = 'bottom-start',\n matchWidth = false,\n offset = 4,\n zIndex,\n children,\n className,\n style,\n}: MPopoverProps) {\n const popoverRef = useRef<HTMLDivElement>(null)\n const popoverIdRef = useRef<number>(null)\n if (popoverIdRef.current === null) popoverIdRef.current = nextPopoverId()\n const popoverId = popoverIdRef.current\n const [position, setPosition] = useState<{top: number; left: number; width?: number} | null>(null)\n const [flipped, setFlipped] = useState(false)\n const [layerZ, setLayerZ] = useState<number | string | null>(null)\n\n // Lift popovers above drawers, modals and mobile sidebars when the anchor sits inside them.\n const updateLayer = useCallback(() => {\n if (zIndex !== undefined) {\n setLayerZ(zIndex)\n return\n }\n\n const anchor = anchorRef.current\n if (!anchor || typeof window === 'undefined') {\n setLayerZ(null)\n return\n }\n\n const layerHost = anchor.closest(\n '.drawer-backdrop, .modal-backdrop, .sheet-backdrop, .sidebar.mobile-open, .popover'\n )\n if (!layerHost) {\n setLayerZ(null)\n return\n }\n\n const computedZ = window.getComputedStyle(layerHost).zIndex\n const parsedZ = Number.parseInt(computedZ, 10)\n setLayerZ(Number.isFinite(parsedZ) ? parsedZ + 1 : null)\n }, [anchorRef, zIndex])\n\n // Recalculate popover position whenever layout or viewport constraints change.\n const updatePosition = useCallback(() => {\n if (!anchorRef.current || !popoverRef.current) return\n\n const anchor = anchorRef.current.getBoundingClientRect()\n const popover = popoverRef.current.getBoundingClientRect()\n const viewport = {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n\n const isTop = placement.startsWith('top')\n const isRight = placement.startsWith('right')\n const isLeft = placement.startsWith('left')\n const isHorizontal = isRight || isLeft\n const isEnd = placement.endsWith('end')\n\n let top: number\n let left: number\n\n if (isHorizontal) {\n // Horizontal placement: position to the right or left of the anchor\n const spaceRight = viewport.width - anchor.right - offset\n const spaceLeft = anchor.left - offset\n const shouldFlip = isRight\n ? spaceRight < popover.width && spaceLeft > spaceRight\n : spaceLeft < popover.width && spaceRight > spaceLeft\n\n setFlipped(shouldFlip)\n\n const showOnRight = isRight ? !shouldFlip : shouldFlip\n\n if (showOnRight) {\n left = anchor.right + offset + window.scrollX\n } else {\n left = anchor.left - popover.width - offset + window.scrollX\n }\n\n if (isEnd) {\n top = anchor.bottom - popover.height + window.scrollY\n } else {\n top = anchor.top + window.scrollY\n }\n } else {\n // Vertical placement: position above or below the anchor\n const spaceBelow = viewport.height - anchor.bottom - offset\n const spaceAbove = anchor.top - offset\n const shouldFlip = isTop\n ? spaceAbove < popover.height && spaceBelow > spaceAbove\n : spaceBelow < popover.height && spaceAbove > spaceBelow\n\n setFlipped(shouldFlip)\n\n const showOnTop = isTop ? !shouldFlip : shouldFlip\n\n if (showOnTop) {\n top = anchor.top - popover.height - offset + window.scrollY\n } else {\n top = anchor.bottom + offset + window.scrollY\n }\n\n if (isEnd) {\n left = anchor.right - popover.width + window.scrollX\n } else {\n left = anchor.left + window.scrollX\n }\n }\n\n // Clamp to viewport\n left = Math.max(8, Math.min(left, viewport.width - popover.width - 8))\n top = Math.max(8 + window.scrollY, top)\n\n setPosition({\n top,\n left,\n width: matchWidth ? anchor.width : undefined,\n })\n }, [anchorRef, placement, offset, matchWidth])\n\n useEffect(() => {\n if (!open) {\n setPosition(null)\n setLayerZ(null)\n return\n }\n\n updateLayer()\n // Wait one frame so the rendered popover can be measured accurately.\n requestAnimationFrame(updatePosition)\n\n // `scroll` does not bubble, so a window listener only ever sees the\n // document scrolling. Anchors living inside a scrollable ancestor — an\n // app shell with a scrolling main region, MStickyPanel, an overflowing\n // card — would leave the popover stranded at its opening coordinates\n // while the anchor moved away underneath it. Scroll events do capture,\n // so a capture-phase listener on the document catches scrolling from\n // ANY container, including the document itself.\n document.addEventListener('scroll', updatePosition, {capture: true, passive: true})\n window.addEventListener('resize', updatePosition, {passive: true})\n return () => {\n document.removeEventListener('scroll', updatePosition, {capture: true})\n window.removeEventListener('resize', updatePosition)\n }\n }, [open, updateLayer, updatePosition])\n\n // Close the popover with the standard Escape key interaction.\n useEffect(() => {\n if (!open) return\n const handleKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') onClose()\n }\n document.addEventListener('keydown', handleKey)\n return () => document.removeEventListener('keydown', handleKey)\n }, [open, onClose])\n\n // Publish this instance while it is open so nested popovers can be related\n // back to it — see popoverStack.ts for why the DOM alone cannot answer this.\n useEffect(() => {\n if (!open) return\n return registerPopover({\n id: popoverId,\n getPopoverEl: () => popoverRef.current,\n getAnchorEl: () => anchorRef.current,\n })\n }, [open, popoverId, anchorRef])\n\n // Close when the user interacts outside both the popover and its anchor.\n useEffect(() => {\n if (!open) return\n const handleClick = (e: MouseEvent) => {\n const target = e.target as Node\n\n if (popoverRef.current?.contains(target) || anchorRef.current?.contains(target)) {\n return\n }\n\n // A popover nested inside this one is portaled to `document.body`,\n // so it fails the `contains` checks above even though the click\n // belongs to this popover's own subtree. Closing here would unmount\n // that child between mousedown and mouseup and swallow its click.\n if (isInsideDescendantPopover(popoverId, target)) {\n return\n }\n\n onClose()\n }\n document.addEventListener('mousedown', handleClick)\n return () => document.removeEventListener('mousedown', handleClick)\n }, [open, onClose, anchorRef, popoverId])\n\n if (!open) return null\n\n return (\n <MPortal>\n <div\n ref={popoverRef}\n className={cn('popover', flipped ? 'flipped' : 'normal', className)}\n style={{\n position: 'absolute',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n width: position?.width,\n zIndex: layerZ ?? undefined,\n visibility: position ? 'visible' : 'hidden',\n ...style,\n }}\n role=\"listbox\"\n >\n {children}\n </div>\n </MPortal>\n )\n}\n"],"mappings":"8JAwBA,IAAM,EAAuC,EAAE,CAC3C,EAAS,EAEb,SAAgB,GAAwB,CACpC,MAAO,KAGX,SAAgB,EAAgB,EAA+C,CAE3E,OADA,EAAc,KAAK,EAAa,KACnB,CACT,IAAM,EAAQ,EAAc,QAAQ,EAAa,CAC7C,IAAU,IAAI,EAAc,OAAO,EAAO,EAAE,EAKxD,SAAS,EAAW,EAA2C,CAC3D,IAAM,EAAS,EAAM,aAAa,CAClC,GAAI,CAAC,EAAQ,OAAO,KAEpB,IAAK,IAAM,KAAS,EAAe,CAC/B,GAAI,EAAM,KAAO,EAAM,GAAI,SAC3B,IAAM,EAAU,EAAM,cAAc,CACpC,GAAI,GAAW,EAAQ,SAAS,EAAO,CAAE,OAAO,EAAM,GAG1D,OAAO,KAQX,SAAgB,EAA0B,EAAY,EAA8B,CAChF,GAAI,CAAC,EAAQ,MAAO,GAEpB,IAAK,IAAM,KAAS,EAAe,CAC/B,GAAI,EAAM,KAAO,EAAI,SAErB,IAAM,EAAU,EAAM,cAAc,CACpC,GAAI,CAAC,GAAW,CAAC,EAAQ,SAAS,EAAO,CAAE,SAI3C,IAAM,EAAO,IAAI,IACb,EAAS,EAAW,EAAM,CAE9B,KAAO,IAAW,MAAQ,CAAC,EAAK,IAAI,EAAO,EAAE,CACzC,GAAI,IAAW,EAAI,MAAO,GAC1B,EAAK,IAAI,EAAO,CAChB,IAAM,EAAS,EAAc,KAAM,GAAc,EAAU,KAAO,EAAO,CACzE,EAAS,EAAS,EAAW,EAAO,CAAG,MAI/C,MAAO,GCxEX,SAAgB,EAA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=require(`./useInteractionEffect-DFTdcWHl.cjs`),i=require(`./MPopover-Cweomcj2.cjs`),a=require(`./MSurface-CYeVFOw_.cjs`),o=require(`./MText-j6Zbbj5Y.cjs`),s=require(`./MHeading-BLnb3dNv.cjs`),c=require(`./MLink-Biipj7xz.cjs`),l=require(`./MButton-R08y1HCT.cjs`),u=require(`./MCheckbox-CM5HJQWW.cjs`),d=require(`./MSkeleton-CLSU5pL6.cjs`),f=require(`./MLoader-XcpKlLrd.cjs`),p=require(`./MGrid-B_0kFUws.cjs`),m=require(`./MStack-BP_BUeCc.cjs`),h=require(`./MCard-1OVOl4Ql.cjs`),g=require(`./MInputCVC-_2ALihF1.cjs`),_=require(`./MAvatar-bUWENcq-.cjs`),v=require(`./MDetailList-DTLU7HQZ.cjs`),y=require(`./MInputSearch-9wcXlY8-.cjs`),b=require(`./MTreeView-DuQkm0ZV.cjs`),x=require(`./MDropdownMenu-C2lftqSx.cjs`),S=require(`./MPagination-C6QQdEj_.cjs`);require(`./core-DBpQf3uY.cjs`);let C=require(`react`),w=require(`react/jsx-runtime`);function T(e){if(typeof e==`string`)return e;if(typeof e==`function`){let t=e;return t.displayName??t.name??``}if(typeof e==`object`&&e){let t=e;return t.displayName??t.render?.displayName??t.render?.name??``}return``}function E(e){if(e.props.color!==void 0)return!1;if(e.type===l.t)return!0;let t=T(e.type);return t.startsWith(`M`)&&t.endsWith(`Icon`)}function D(e,t){return t?C.Children.map(e,e=>{if(!(0,C.isValidElement)(e))return e;let n=e,r=n.props,i=r.children?D(r.children,t):r.children,a={};return i!==r.children&&(a.children=i),E(n)&&(a.color=t),Object.keys(a).length?(0,C.cloneElement)(n,a):n}):e}function O({component:e,to:n,href:i,target:a,rel:o,color:s,interactive:c=!0,clickEffect:l,rippleColor:u,className:d,children:f,onPointerDown:p,type:m,...g}){let{component:_,href:v,to:y,isInteractive:b}=h.a({component:e,href:i,to:n,interactive:c,hasClickHandler:!!g.onClick,hasPointerHandler:!!p,fallbackComponent:`button`}),{effectClassName:x,effectLayer:S,handlePointerDown:C}=r.t({effect:l??(b?`ripple`:`none`),disabled:!b,color:u});return(0,w.jsxs)(_,{href:_===`a`||e?v:void 0,to:y,target:a,rel:o,type:_===`button`?m??`button`:void 0,className:t.t(`card-action-area`,s&&`color-${s}`,b&&`interactive`,x,d),onPointerDown:e=>{C(e),p?.(e)},...g,children:[S,(0,w.jsx)(`span`,{className:`card-action-area-content`,children:D(f,s)})]})}function k(e){let t=e.replace(/\D/g,``);return t.length<=4?t:`\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 ${t.slice(-4)}`}function A({component:e,to:i,href:a,target:o,rel:s,holder:c,number:l,expiry:u,brand:d,brandIcon:f,balance:p,balanceLabel:m=`Current balance`,color:g,interactive:_=!1,clickEffect:v,rippleColor:y,className:b,onPointerDown:x,...S}){let C=n.n(l),T=d??C.brand,E=n.t.find(e=>e.brand===T)??C,D=k(l),O=E.iconLabel,{component:A,href:j,to:M,isInteractive:N}=h.a({component:e,href:a,to:i,interactive:_,hasClickHandler:!!S.onClick,hasPointerHandler:!!x}),{effectClassName:P,effectLayer:F,handlePointerDown:I}=r.t({effect:v??(N?`ripple`:`none`),disabled:!N,color:y});return(0,w.jsxs)(A,{href:A===`a`||e?j:void 0,to:M,target:o,rel:s,className:t.t(`card-payment`,g||`primary`,N&&`interactive`,P,b),onPointerDown:e=>{I(e),x?.(e)},...S,children:[F,p!==void 0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`cp-balance-label`,children:m}),(0,w.jsx)(`p`,{className:`cp-balance`,children:p})]}),(0,w.jsxs)(`div`,{className:`cp-row`,children:[(0,w.jsx)(`span`,{className:t.t(`cp-brand`,!f&&T),children:f??O}),(0,w.jsx)(`span`,{className:`cp-number`,children:D})]}),(0,w.jsxs)(`div`,{className:`cp-details`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`cp-field-label`,children:`MCard holder`}),(0,w.jsx)(`p`,{className:`cp-field-value`,children:c})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`cp-field-label`,children:`Expiration date`}),(0,w.jsx)(`p`,{className:`cp-field-value`,children:u})]})]})]})}function j(e){return n.t.find(t=>t.brand===e)?.iconLabel??`CARD`}function M({title:n=`Your payment methods`,actionLabel:r=`Change`,actionHref:i=`#`,onAction:s,brand:l=`visa`,brandIcon:u,last4:f,badgeLabel:p,summary:m,helperText:h=`All fields are required, unless stated otherwise.`,expiryLabel:_=`Expiration date`,cvcLabel:v=`Security code`,expiryProps:y,cvcProps:b,color:x,className:S,...C}){let T=y?.value??y?.defaultValue,E=p===void 0?`Default`:p,D=T?`Credit card - Expiration date ${String(T).replace(`/`,`.`)}`:`Credit card`,O=m===void 0?D:m,k=j(l),A={clearable:!0,...y};return(0,w.jsxs)(`div`,{className:t.t(`card-payment-method`,x||`primary`,S),...C,children:[(0,w.jsxs)(`div`,{className:`cpm-header`,children:[(0,w.jsx)(`h3`,{className:`cpm-title`,children:n}),(0,w.jsxs)(c.t,{href:i,tone:`accent`,underline:`none`,className:`cpm-action`,onClick:e=>{s&&(e.preventDefault(),s())},children:[r,(0,w.jsx)(e.Ui,{})]})]}),(0,w.jsxs)(`div`,{className:`cpm-surface`,children:[(0,w.jsxs)(`div`,{className:`cpm-method`,children:[(0,w.jsxs)(a.n,{align:`center`,className:`cpm-method-row`,children:[(0,w.jsx)(`span`,{className:t.t(`cpm-brand`,!u&&l),children:u??k}),(0,w.jsx)(`span`,{className:`cpm-last4`,children:`\u2022\u2022\u2022\u2022 ${f}`}),E&&(0,w.jsx)(d.n,{color:`info`,children:E})]}),O&&(0,w.jsx)(o.t,{tone:`muted`,className:`cpm-summary`,children:O})]}),h&&(0,w.jsx)(o.t,{tone:`muted`,size:`sm`,className:`cpm-helper`,children:h}),(0,w.jsxs)(`div`,{className:`cpm-fields`,children:[(0,w.jsx)(g.n,{label:_,placeholder:`MM/YYYY`,fullWidth:!0,...A}),(0,w.jsx)(g.t,{label:v,placeholder:`123`,fullWidth:!0,...b})]})]})]})}function N({variant:n,title:r,description:i,price:a,currency:o=`PLN`,duration:s,available:c,image:u,gallery:f,galleryAutoPlay:p=!1,rating:m,reviewCount:h,favorite:g,onFavorite:y,menuItems:b,onAddToCart:S,actionLabel:T,icon:E,color:D=`primary`,leader:O,participants:k,maxParticipants:A,quantity:j,onQuantityChange:M,showQuantity:N=!0,date:P,location:F,status:I,className:L,...R}){let[z,B]=(0,C.useState)(0),[V,H]=(0,C.useState)(!1),[U,W]=(0,C.useState)(1),G=j??U,K=f&&f.length>0?f:u?[u]:[];(0,C.useEffect)(()=>{z>=K.length&&B(0)},[z,K.length]),(0,C.useEffect)(()=>{if(!V)return;let e=window.setTimeout(()=>{H(!1)},220);return()=>window.clearTimeout(e)},[z,V]);function q(e){e===z||e<0||e>=K.length||(K.length>1&&H(!0),B(e))}(0,C.useEffect)(()=>{if(!p||K.length<=1)return;let e=window.setInterval(()=>{H(!0),B(e=>(e+1)%K.length)},3500);return()=>window.clearInterval(e)},[p,K.length]);function ee(e){let t=Math.max(1,e);M?M(t):W(t)}let J=c===!0?`Available`:c===!1?`Unavailable`:typeof c==`number`?`${c} spots`:null,Y=P?P instanceof Date?P:new Date(P):null,te=Y?Y.getDate():null,ne=Y?Y.toLocaleString(`en`,{month:`short`}).toUpperCase():null;return(0,w.jsxs)(`div`,{className:t.t(`card-service`,n,`color-${D}`,L),...R,children:[K.length>0&&(0,w.jsxs)(`div`,{className:`cs-gallery`,children:[(0,w.jsx)(`img`,{src:K[z],alt:r,className:t.t(`cs-image`,V&&`is-transitioning`)}),K.length>1&&(0,w.jsx)(`div`,{className:`cs-gallery-dots`,children:K.map((e,n)=>(0,w.jsx)(`button`,{type:`button`,className:t.t(`cs-dot`,n===z&&`active`),onClick:()=>q(n),"aria-label":`Image ${n+1}`},n))}),(y||b&&b.length>0)&&(0,w.jsxs)(`div`,{className:`cs-gallery-actions`,children:[b&&b.length>0&&(0,w.jsx)(x.i,{className:`cs-menu-wrap`,trigger:(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,shape:`circle`,"aria-label":`More options`,className:`cs-overlay-btn`,children:(0,w.jsx)(e.Xn,{})}),placement:`bottom-end`,children:b.map((e,t)=>(0,w.jsx)(x.r,{icon:e.icon,color:e.danger?`error`:void 0,label:e.label,onClick:e.onClick},t))}),y&&(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,shape:`circle`,onClick:y,"aria-label":g?`Remove from favorites`:`Add to favorites`,className:t.t(`cs-overlay-btn`,g&&`cs-fav-active`),children:g?(0,w.jsx)(e.nr,{}):(0,w.jsx)(e.rr,{})})]})]}),(0,w.jsxs)(`div`,{className:`cs-body`,children:[n===`event`&&Y&&(0,w.jsxs)(`div`,{className:`cs-event-header`,children:[(0,w.jsxs)(`div`,{className:`cs-date-block`,children:[(0,w.jsx)(`span`,{className:`cs-date-day`,children:te}),(0,w.jsx)(`span`,{className:`cs-date-month`,children:ne})]}),(0,w.jsxs)(`div`,{className:`cs-event-info`,children:[(0,w.jsx)(`h3`,{className:`cs-title`,children:r}),i&&(0,w.jsx)(`p`,{className:`cs-desc`,children:i})]})]}),n!==`event`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`cs-top`,children:[E&&(0,w.jsx)(`span`,{className:`cs-icon`,children:E}),(0,w.jsx)(`h3`,{className:`cs-title`,children:r})]}),i&&(0,w.jsx)(`p`,{className:`cs-desc`,children:i})]}),n===`event`&&!Y&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`cs-top`,children:[E&&(0,w.jsx)(`span`,{className:`cs-icon`,children:E}),(0,w.jsx)(`h3`,{className:`cs-title`,children:r})]}),i&&(0,w.jsx)(`p`,{className:`cs-desc`,children:i})]}),m!==void 0&&(0,w.jsxs)(`div`,{className:`cs-rating`,children:[(0,w.jsx)(v.n,{value:Math.round(m),size:`sm`,color:`warning`,readOnly:!0,className:`cs-stars`}),(0,w.jsx)(`span`,{className:`cs-rating-value`,children:m.toFixed(1)}),h!==void 0&&(0,w.jsxs)(`span`,{className:`cs-review-count`,children:[`(`,h,`)`]})]}),O&&(0,w.jsxs)(`div`,{className:`cs-leader`,children:[(0,w.jsx)(_.t,{src:O.avatar,name:O.name,size:28,color:D}),(0,w.jsx)(`span`,{className:`cs-leader-name`,children:O.name})]}),n===`course`&&k&&(0,w.jsxs)(`div`,{className:`cs-participants`,children:[(0,w.jsx)(`div`,{className:`cs-participants-avatars`,children:k.slice(0,4).map((e,t)=>(0,w.jsx)(_.t,{src:e.avatar,name:e.name,size:28,color:D,className:`cs-participant-avatar`},`${e.name}-${t}`))}),A&&(0,w.jsxs)(`span`,{className:`cs-spots`,children:[k.length,`/`,A]})]}),(0,w.jsxs)(`div`,{className:`cs-meta`,children:[n===`event`&&F&&(0,w.jsx)(d.n,{size:`xs`,color:D,children:F}),s&&(0,w.jsx)(d.n,{size:`xs`,color:D,icon:(0,w.jsx)(e.Li,{}),children:s}),n===`event`&&I&&(0,w.jsx)(d.n,{size:`xs`,color:I.toLowerCase()===`sold out`?`error`:D,children:I}),J&&n!==`event`&&(0,w.jsx)(d.n,{size:`xs`,color:c===!1?`error`:D,children:J})]})]}),(0,w.jsxs)(`div`,{className:`cs-footer`,children:[a!==void 0&&(0,w.jsxs)(`span`,{className:`cs-price`,children:[typeof a==`number`?a.toFixed(2):a,` `,(0,w.jsx)(`span`,{className:`cs-currency`,children:o})]}),(0,w.jsxs)(`div`,{className:`cs-actions`,children:[n===`product`&&S&&N&&(0,w.jsxs)(`div`,{className:`cs-qty`,children:[(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,size:`sm`,onClick:()=>ee(G-1),"aria-label":`Decrease`,className:`cs-qty-btn`,children:(0,w.jsx)(e.Mr,{})}),(0,w.jsx)(`span`,{className:`cs-qty-value`,children:G}),(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,size:`sm`,onClick:()=>ee(G+1),"aria-label":`Increase`,className:`cs-qty-btn`,children:(0,w.jsx)(e.Nr,{})})]}),S&&(0,w.jsx)(l.t,{variant:`filled`,size:`sm`,color:D,onClick:()=>S(G),disabled:c===!1,className:`cs-cart-btn`,children:T??(n===`event`?`Register`:`Add to cart`)})]})]})]})}function P(e){let{onAction:t,actionLabel:n=`Book now`,...r}=e;return(0,w.jsx)(N,{variant:`service`,onAddToCart:t?()=>t():void 0,actionLabel:n,...r})}function F(e){let{onAction:t,actionLabel:n=`Join course`,...r}=e;return(0,w.jsx)(N,{variant:`course`,onAddToCart:t?()=>t():void 0,actionLabel:n,...r})}function I({component:n,title:i,description:a,icon:o,color:s=`primary`,to:c,href:u,target:d,rel:f,onClick:p,interactive:m=!1,clickEffect:g,rippleColor:_,image:v,video:y,illustration:b,camera:S,mediaFill:T=!1,overlayPosition:E=`bottom`,favorite:D,onFavorite:O,menuItems:k,className:A,...j}){let M=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!S)return;let e=M.current;if(!e||typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return;let t=null,n=!1,r=S===!0?{video:!0}:S;return navigator.mediaDevices.getUserMedia(r).then(r=>{if(n){r.getTracks().forEach(e=>e.stop());return}t=r,e.srcObject=r,e.play().catch(()=>void 0)}).catch(()=>void 0),()=>{n=!0,t&&t.getTracks().forEach(e=>e.stop()),e.srcObject=null}},[S]);let N=!!(v||y||b||S),{component:P,href:F,to:I,isInteractive:L,isLink:R}=h.a({component:n,href:u,to:c,interactive:m,hasClickHandler:!!p,fallbackComponent:`button`}),z=T&&N,{effectClassName:B,effectLayer:V,handlePointerDown:H}=r.t({effect:g??(L?`ripple`:`none`),disabled:!L,color:_});function U(e){e.stopPropagation()}function W(e){p&&(e.preventDefault(),p())}function G(){return N?(0,w.jsxs)(`div`,{className:t.t(`tile-media`,z&&`fill`),children:[v&&(0,w.jsx)(`img`,{src:v,alt:i,className:`tile-image`}),y&&(0,w.jsx)(`video`,{src:y,className:`tile-video`,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,"aria-label":i}),S&&(0,w.jsx)(`video`,{ref:M,className:`tile-video`,autoPlay:!0,muted:!0,playsInline:!0,"aria-label":i}),b&&(0,w.jsx)(`div`,{className:`tile-illustration`,children:b}),z&&(0,w.jsx)(`div`,{className:t.t(`tile-scrim`,`scrim-${E}`)})]}):null}function K(){return(0,w.jsxs)(`div`,{className:t.t(`tile-body`,z&&`overlay`,z&&`pos-${E}`),children:[(0,w.jsxs)(`div`,{className:`tile-top`,children:[o&&(0,w.jsx)(`span`,{className:`tile-icon`,children:o}),(0,w.jsx)(`h3`,{className:`tile-title`,children:i})]}),a&&(0,w.jsx)(`p`,{className:`tile-desc`,children:a})]})}let q=O||k&&k.length>0;return(0,w.jsxs)(`div`,{className:t.t(`card-tile`,`color-${s}`,z&&`media-fill`,L&&`interactive`,B,A),onPointerDown:H,...j,children:[V,R&&(0,w.jsx)(P,{href:P===`a`||n?F:void 0,to:I,target:d,rel:f,className:`tile-link`,"aria-label":i,onClick:p?W:void 0}),!R&&p&&(0,w.jsx)(P,{type:`button`,className:`tile-link`,"aria-label":i,onClick:p}),G(),K(),q&&(0,w.jsxs)(`div`,{className:`tile-actions`,onClick:U,onPointerDown:U,children:[k&&k.length>0&&(0,w.jsx)(x.i,{className:`tile-menu-wrap`,trigger:(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,shape:`circle`,"aria-label":`More options`,className:`tile-overlay-btn`,children:(0,w.jsx)(e.Xn,{})}),placement:`bottom-end`,children:k.map((e,t)=>(0,w.jsx)(x.r,{icon:e.icon,color:e.danger?`error`:void 0,label:e.label,onClick:e.onClick},t))}),O&&(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,shape:`circle`,onClick:O,"aria-label":D?`Remove from favorites`:`Add to favorites`,className:t.t(`tile-overlay-btn`,D&&`tile-fav-active`),children:D?(0,w.jsx)(e.nr,{}):(0,w.jsx)(e.rr,{})})]})]})}function L(e){let{addToCartLabel:t=`Add to cart`,...n}=e;return(0,w.jsx)(N,{variant:`product`,actionLabel:t,...n})}function R(e){let{onRegister:t,registerLabel:n=`Register`,...r}=e;return(0,w.jsx)(N,{variant:`event`,onAddToCart:t?()=>t():void 0,actionLabel:n,...r})}function z(e,t){return t||(typeof e!=`number`||e===0?`neutral`:e>0?`up`:`down`)}function B(e){return typeof e==`number`&&e>0?`+${e}`:e}function V({component:n,to:i,href:a,target:o,rel:s,title:c,value:l,trend:u,trendType:d,icon:f,color:p=`primary`,helperText:m,interactive:g=!1,clickEffect:_,rippleColor:v,className:y,onPointerDown:b,...x}){let S=u!=null,C=z(u,d),T=B(u),{component:E,href:D,to:O,isInteractive:k}=h.a({component:n,href:a,to:i,interactive:g,hasClickHandler:!!x.onClick,hasPointerHandler:!!b}),{effectClassName:A,effectLayer:j,handlePointerDown:M}=r.t({effect:_??(k?`ripple`:`none`),disabled:!k,color:v});return(0,w.jsxs)(E,{href:E===`a`||n?D:void 0,to:O,target:o,rel:s,className:t.t(`card-widget`,`color-${p}`,k&&`interactive`,A,y),onPointerDown:e=>{M(e),b?.(e)},...x,children:[j,(0,w.jsxs)(`div`,{className:`cw-top`,children:[(0,w.jsxs)(`div`,{className:`cw-meta`,children:[(0,w.jsx)(`span`,{className:`cw-title`,children:c}),(0,w.jsx)(`span`,{className:`cw-value`,children:l})]}),f&&(0,w.jsx)(`span`,{className:`cw-icon`,children:f})]}),S&&(0,w.jsx)(`div`,{className:`cw-bottom`,children:(0,w.jsxs)(`span`,{className:t.t(`cw-trend`,C),children:[C===`up`&&(0,w.jsx)(e.Hi,{size:14}),C===`down`&&(0,w.jsx)(e.Vi,{size:14}),(0,w.jsx)(`span`,{children:T})]})}),m&&(0,w.jsx)(`div`,{className:`cw-helper`,children:m})]})}function H(e,t){return t||(typeof e!=`number`||e===0?`neutral`:e>0?`up`:`down`)}function U(e){return typeof e==`number`&&e>0?`+${e}`:e}function W({label:n,value:r,icon:i,badge:s,helperText:c,trend:l,trendType:u,color:d=`primary`,className:f,...p}){let g=l!=null,_=H(l,u);return(0,w.jsx)(h.t,{className:t.t(`stat-card`,`color-${d}`,f),...p,children:(0,w.jsxs)(m.t,{spacing:`md`,children:[(0,w.jsxs)(a.n,{justify:`between`,align:`start`,children:[(0,w.jsxs)(m.t,{spacing:`xs`,children:[(0,w.jsx)(`span`,{className:`stat-card-label`,children:n}),(0,w.jsx)(`span`,{className:`stat-card-value`,children:r})]}),(0,w.jsxs)(a.n,{align:`center`,children:[s,i&&(0,w.jsx)(`span`,{className:`stat-card-icon`,children:i})]})]}),(g||c)&&(0,w.jsxs)(a.n,{justify:`between`,align:`center`,children:[g?(0,w.jsxs)(`span`,{className:t.t(`stat-card-trend`,_),children:[_===`up`&&(0,w.jsx)(e.Hi,{size:14}),_===`down`&&(0,w.jsx)(e.Vi,{size:14}),(0,w.jsx)(`span`,{children:U(l)})]}):(0,w.jsx)(`span`,{}),c&&(0,w.jsx)(o.t,{size:`sm`,tone:`muted`,children:c})]})]})})}function G(e){if(typeof e==`number`)return{gridTemplateColumns:`repeat(${e}, 1fr)`};let t={};return e.base!==void 0&&(t[`--cols-base`]=e.base),e.sm!==void 0&&(t[`--cols-sm`]=e.sm),e.md!==void 0&&(t[`--cols-md`]=e.md),e.lg!==void 0&&(t[`--cols-lg`]=e.lg),e.xl!==void 0&&(t[`--cols-xl`]=e.xl),e.xxl!==void 0&&(t[`--cols-xxl`]=e.xxl),t}function K(e,t){let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;r=r[e]}return r}function q({items:n,renderCard:r,color:a=`primary`,searchable:o=!1,searchKeys:s,searchPlaceholder:c=`Search...`,search:d,onSearchChange:p,filterable:m=!1,filterKeys:h=[],filters:g,onFiltersChange:_,sortable:v=!1,sortKeys:b=[],defaultSort:x,sort:T,onSortChange:E,pagination:D=!1,pageSize:O=12,page:k,onPageChange:A,total:j,manualSearch:M=!1,manualFilters:N=!1,manualSort:P=!1,manualPagination:F=!1,loading:I=!1,loadingLabel:L=`Loading`,scrollOffset:R,columns:z=3,emptyMessage:B=`No results found.`,className:V,style:H,...U}){let[W,q]=(0,C.useState)(``),[ee,J]=(0,C.useState)({}),[Y,te]=(0,C.useState)(x??null),[ne,X]=(0,C.useState)(1),[re,ie]=(0,C.useState)(!1),[ae,oe]=(0,C.useState)(!1),se=(0,C.useRef)(null),ce=(0,C.useRef)(null),le=d===void 0?W:d,Z=g===void 0?ee:g,Q=T===void 0?Y:T,ue=k===void 0?ne:k,de=(0,C.useCallback)(e=>{d===void 0&&q(e),!F&&k===void 0&&X(1),p?.(e)},[d,k,F,p]),fe=(0,C.useCallback)(e=>{g===void 0&&J(e),!F&&k===void 0&&X(1),_?.(e)},[g,k,F,_]),pe=(0,C.useCallback)(e=>{T===void 0&&te(e),!F&&k===void 0&&X(1),E?.(e)},[T,k,F,E]),me=(0,C.useRef)(null),he=(0,C.useCallback)(e=>{k===void 0&&X(e),A?.(e),me.current?.scrollIntoView({block:`start`,behavior:`smooth`})},[k,A]),ge=(0,C.useCallback)(()=>{ie(e=>!e),oe(!1)},[]),_e=(0,C.useCallback)(()=>{oe(e=>!e),ie(!1)},[]),$=(0,C.useMemo)(()=>{let e=n;if(!M&&le&&s&&s.length>0){let t=le.toLowerCase();e=e.filter(e=>s.some(n=>{let r=K(e,n);return r!=null&&String(r).toLowerCase().includes(t)}))}if(!N)for(let[t,n]of Object.entries(Z))!n||n.length===0||(e=e.filter(e=>{let r=K(e,t);return r!=null&&n.includes(String(r))}));return!P&&Q&&(e=[...e].sort((e,t)=>{let n=K(e,Q.key),r=K(t,Q.key);if(n==null&&r==null)return 0;if(n==null)return 1;if(r==null)return-1;let i=String(n).localeCompare(String(r),void 0,{numeric:!0});return Q.direction===`asc`?i:-i})),e===n?[...e]:e},[n,le,s,Z,Q,M,N,P]),ve=F?j??$.length:$.length,ye=(0,C.useMemo)(()=>{if(!D||F)return $;let e=(ue-1)*O;return $.slice(e,e+O)},[$,D,F,ue,O]);function be(e,t){let n=Z[e]??[],r=n.includes(t)?n.filter(e=>e!==t):[...n,t];fe({...Z,[e]:r})}let xe=(0,C.useMemo)(()=>{let e={};for(let t of h){if(t.options){e[t.key]=t.options;continue}let r=new Set;for(let e of n){let n=K(e,t.key);n!=null&&r.add(String(n))}e[t.key]=Array.from(r).sort()}return e},[n,h]),Se=b.find(e=>e.key===Q?.key);return(0,w.jsxs)(`div`,{ref:me,className:t.t(`card-grid`,`color-${a}`,V),style:R===void 0?H:{scrollMarginTop:R,...H},...U,children:[(o||m||v)&&(0,w.jsxs)(`div`,{className:`card-grid-toolbar`,children:[o&&(0,w.jsx)(y.t,{className:`card-grid-search`,size:`sm`,fullWidth:!0,placeholder:c,value:le,onChange:e=>de(e.target.value),onClear:()=>de(``)}),(0,w.jsxs)(`div`,{className:`card-grid-actions`,children:[m&&h.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.t,{ref:se,variant:`outlined`,color:a,size:`sm`,startIcon:(0,w.jsx)(e.Jn,{}),"aria-expanded":re,onClick:ge,children:`Filter`}),(0,w.jsx)(i.t,{open:re,anchorRef:se,onClose:()=>ie(!1),placement:`bottom-end`,className:`card-grid-dropdown`,children:h.map(e=>(0,w.jsxs)(`div`,{className:`card-grid-filter-group`,children:[(0,w.jsx)(`span`,{className:`card-grid-filter-label`,children:e.label}),(xe[e.key]??[]).map(t=>(0,w.jsx)(`div`,{className:`card-grid-filter-option`,children:(0,w.jsx)(u.t,{size:`sm`,clickEffect:`none`,checked:Z[e.key]?.includes(t)??!1,onChange:()=>be(e.key,t),label:t})},t))]},e.key))})]}),v&&b.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.t,{ref:ce,variant:`outlined`,color:a,size:`sm`,startIcon:Q?Q.direction===`asc`?(0,w.jsx)(e.Hi,{}):(0,w.jsx)(e.Vi,{}):(0,w.jsx)(e.qn,{}),"aria-expanded":ae,onClick:_e,children:Se?`Sort: ${Se.label}`:`Sort`}),(0,w.jsx)(i.t,{open:ae,anchorRef:ce,onClose:()=>oe(!1),placement:`bottom-end`,className:`card-grid-dropdown`,children:b.map(n=>(0,w.jsxs)(`button`,{type:`button`,className:t.t(`card-grid-sort-item`,Q?.key===n.key&&`active`),onClick:()=>{Q?.key===n.key?pe({key:n.key,direction:Q.direction===`asc`?`desc`:`asc`}):pe({key:n.key,direction:`asc`})},children:[n.label,Q?.key===n.key&&(0,w.jsx)(`span`,{className:`card-grid-sort-dir`,children:Q.direction===`asc`?(0,w.jsx)(e.Hi,{className:`card-grid-sort-icon`}):(0,w.jsx)(e.Vi,{className:`card-grid-sort-icon`})})]},n.key))})]})]})]}),(0,w.jsxs)(`div`,{className:t.t(`card-grid-body`,I&&`loading`),"aria-busy":I||void 0,children:[ye.length>0?(0,w.jsx)(`div`,{className:`card-grid-items`,style:G(z),children:ye.map((e,t)=>{let n=e?.id;return(0,w.jsx)(C.Fragment,{children:r(e,t)},n??t)})}):(0,w.jsx)(`div`,{className:`card-grid-empty`,children:B}),I&&(0,w.jsx)(`div`,{className:`card-grid-loading`,role:`status`,"aria-live":`polite`,children:(0,w.jsx)(f.t,{center:!1,minHeight:`auto`,color:a,label:L})})]}),D&&ve>O&&(0,w.jsx)(`div`,{className:`card-grid-pagination`,children:(0,w.jsx)(S.t,{total:ve,page:ue,pageSize:O,onChange:he})})]})}function ee({title:e=`Today`,description:t,color:n=`primary`,workdayStart:r,workdayEnd:i,timeline:c,summary:l,tabs:u=[],footer:d,emptyTimeline:f=(0,w.jsx)(o.t,{tone:`muted`,children:`No events scheduled for this day.`}),...g}){let _=r&&i?`${r}-${i}`:r??i??void 0,y=u.filter(e=>e.items.length>0);return(0,w.jsxs)(h.t,{color:n,...g,children:[(0,w.jsx)(h.i,{children:(0,w.jsxs)(m.t,{children:[(0,w.jsx)(s.t,{level:4,children:e}),(t||_)&&(0,w.jsxs)(o.t,{size:`sm`,tone:`muted`,children:[t,t&&_?` `:null,_]})]})}),(0,w.jsx)(h.n,{children:(0,w.jsxs)(p.t,{type:`row`,align:`start`,children:[(0,w.jsx)(p.t,{type:`col`,xl:7,sm:12,children:c.length?(0,w.jsx)(m.t,{className:`day-schedule-card-timeline`,children:c.map(e=>(0,w.jsxs)(a.n,{align:`start`,className:`day-schedule-card-entry`,children:[(0,w.jsx)(`span`,{className:`day-schedule-card-time`,children:e.time}),(0,w.jsx)(`div`,{className:`day-schedule-card-dot`,"data-color":e.color??n,children:D(e.icon,e.color??n)}),(0,w.jsxs)(`div`,{className:`day-schedule-card-copy`,children:[(0,w.jsx)(o.t,{as:`strong`,children:e.title}),e.description&&(0,w.jsx)(o.t,{size:`sm`,tone:`muted`,children:e.description})]})]},e.id))}):f}),(0,w.jsx)(p.t,{type:`col`,xl:5,sm:12,children:(0,w.jsxs)(m.t,{className:`day-schedule-card-side`,children:[l,y.length>0&&(0,w.jsx)(p.r,{variant:`underline`,size:`sm`,fullWidth:!0,defaultValue:y[0].type,items:y.map(e=>({value:e.type,label:(0,w.jsxs)(`span`,{className:`day-schedule-card-tab-label`,children:[(0,w.jsx)(`span`,{children:e.title}),(0,w.jsx)(`span`,{className:`day-schedule-card-tab-count`,children:e.items.length})]}),content:(0,w.jsx)(v.t,{items:e.items})}))})]})})]})}),d&&(0,w.jsx)(h.r,{children:D(d,n)})]})}function J({title:t=`Documents`,description:n,color:r=`primary`,items:i,selected:c,onSelect:u,defaultExpanded:d,expanded:f,onExpandChange:g,detailsTitle:_,detailsMeta:y,detailsItems:S=[],detailsActions:C=[],renderDetails:T,emptyDetails:E=(0,w.jsx)(o.t,{tone:`muted`,children:`Select a document to inspect its details.`}),primaryAction:O,...k}){let A=e=>({...e,icon:D(e.icon,r),children:e.children?.map(A)}),j=i.map(A);return(0,w.jsxs)(h.t,{stretch:!1,color:r,...k,children:[(0,w.jsx)(h.i,{children:(0,w.jsxs)(a.n,{justify:`between`,align:`center`,children:[(0,w.jsxs)(m.t,{children:[(0,w.jsx)(s.t,{level:4,children:t}),n&&(0,w.jsx)(o.t,{size:`sm`,tone:`muted`,children:n})]}),D(O,r)]})}),(0,w.jsx)(h.n,{children:(0,w.jsxs)(p.t,{type:`row`,align:`start`,children:[(0,w.jsx)(p.t,{type:`col`,xl:7,sm:12,children:(0,w.jsx)(b.t,{items:j,color:r,defaultExpanded:d,expanded:f,onExpandChange:g,selected:c,onSelect:u,expandable:!0,selectable:!0,showLines:!0,fileIcons:!0})}),(0,w.jsx)(p.t,{type:`col`,xl:5,sm:12,children:(0,w.jsxs)(m.t,{padding:`sm`,children:[(_||y||C.length>0)&&(0,w.jsxs)(a.n,{justify:`between`,align:`start`,children:[(0,w.jsxs)(m.t,{children:[_&&(0,w.jsx)(s.t,{level:5,children:_}),y&&(0,w.jsx)(o.t,{size:`sm`,tone:`muted`,children:y})]}),C.length>0&&(0,w.jsx)(x.i,{placement:`bottom-end`,trigger:(0,w.jsx)(l.t,{variant:`ghost`,color:r,iconOnly:!0,shape:`circle`,"aria-label":`Open document actions`,children:(0,w.jsx)(e.Xn,{})}),children:C.map(e=>(0,w.jsx)(x.r,{icon:D(e.icon,e.color??r),label:e.label,color:e.color??r,disabled:e.disabled,component:e.component,href:e.href,to:e.to,onClick:e.onClick},e.id))})]}),T||(S.length?(0,w.jsx)(v.t,{items:S}):E)]})})]})})]})}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return P}});
|
|
2
|
-
//# sourceMappingURL=cards-
|
|
1
|
+
const e=require(`./icons-D675Im0B.cjs`),t=require(`./cn-CU5TNITO.cjs`),n=require(`./creditCards-D_HwRUBz.cjs`),r=require(`./useInteractionEffect-DFTdcWHl.cjs`),i=require(`./MPopover-CV-9MArH.cjs`),a=require(`./MSurface-CYeVFOw_.cjs`),o=require(`./MText-j6Zbbj5Y.cjs`),s=require(`./MHeading-BLnb3dNv.cjs`),c=require(`./MLink-Biipj7xz.cjs`),l=require(`./MButton-R08y1HCT.cjs`),u=require(`./MCheckbox-CM5HJQWW.cjs`),d=require(`./MSkeleton-CLSU5pL6.cjs`),f=require(`./MLoader-XcpKlLrd.cjs`),p=require(`./MGrid-B_0kFUws.cjs`),m=require(`./MStack-BP_BUeCc.cjs`),h=require(`./MCard-1OVOl4Ql.cjs`),g=require(`./MInputCVC-BlY5OrVn.cjs`),_=require(`./MAvatar-bUWENcq-.cjs`),v=require(`./MDetailList-DTLU7HQZ.cjs`),y=require(`./MInputSearch-9wcXlY8-.cjs`),b=require(`./MTreeView-DuQkm0ZV.cjs`),x=require(`./MDropdownMenu-BvN5grK5.cjs`),S=require(`./MPagination-C6QQdEj_.cjs`);require(`./core-DBpQf3uY.cjs`);let C=require(`react`),w=require(`react/jsx-runtime`);function T(e){if(typeof e==`string`)return e;if(typeof e==`function`){let t=e;return t.displayName??t.name??``}if(typeof e==`object`&&e){let t=e;return t.displayName??t.render?.displayName??t.render?.name??``}return``}function E(e){if(e.props.color!==void 0)return!1;if(e.type===l.t)return!0;let t=T(e.type);return t.startsWith(`M`)&&t.endsWith(`Icon`)}function D(e,t){return t?C.Children.map(e,e=>{if(!(0,C.isValidElement)(e))return e;let n=e,r=n.props,i=r.children?D(r.children,t):r.children,a={};return i!==r.children&&(a.children=i),E(n)&&(a.color=t),Object.keys(a).length?(0,C.cloneElement)(n,a):n}):e}function O({component:e,to:n,href:i,target:a,rel:o,color:s,interactive:c=!0,clickEffect:l,rippleColor:u,className:d,children:f,onPointerDown:p,type:m,...g}){let{component:_,href:v,to:y,isInteractive:b}=h.a({component:e,href:i,to:n,interactive:c,hasClickHandler:!!g.onClick,hasPointerHandler:!!p,fallbackComponent:`button`}),{effectClassName:x,effectLayer:S,handlePointerDown:C}=r.t({effect:l??(b?`ripple`:`none`),disabled:!b,color:u});return(0,w.jsxs)(_,{href:_===`a`||e?v:void 0,to:y,target:a,rel:o,type:_===`button`?m??`button`:void 0,className:t.t(`card-action-area`,s&&`color-${s}`,b&&`interactive`,x,d),onPointerDown:e=>{C(e),p?.(e)},...g,children:[S,(0,w.jsx)(`span`,{className:`card-action-area-content`,children:D(f,s)})]})}function k(e){let t=e.replace(/\D/g,``);return t.length<=4?t:`\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 ${t.slice(-4)}`}function A({component:e,to:i,href:a,target:o,rel:s,holder:c,number:l,expiry:u,brand:d,brandIcon:f,balance:p,balanceLabel:m=`Current balance`,color:g,interactive:_=!1,clickEffect:v,rippleColor:y,className:b,onPointerDown:x,...S}){let C=n.n(l),T=d??C.brand,E=n.t.find(e=>e.brand===T)??C,D=k(l),O=E.iconLabel,{component:A,href:j,to:M,isInteractive:N}=h.a({component:e,href:a,to:i,interactive:_,hasClickHandler:!!S.onClick,hasPointerHandler:!!x}),{effectClassName:P,effectLayer:F,handlePointerDown:I}=r.t({effect:v??(N?`ripple`:`none`),disabled:!N,color:y});return(0,w.jsxs)(A,{href:A===`a`||e?j:void 0,to:M,target:o,rel:s,className:t.t(`card-payment`,g||`primary`,N&&`interactive`,P,b),onPointerDown:e=>{I(e),x?.(e)},...S,children:[F,p!==void 0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`cp-balance-label`,children:m}),(0,w.jsx)(`p`,{className:`cp-balance`,children:p})]}),(0,w.jsxs)(`div`,{className:`cp-row`,children:[(0,w.jsx)(`span`,{className:t.t(`cp-brand`,!f&&T),children:f??O}),(0,w.jsx)(`span`,{className:`cp-number`,children:D})]}),(0,w.jsxs)(`div`,{className:`cp-details`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`cp-field-label`,children:`MCard holder`}),(0,w.jsx)(`p`,{className:`cp-field-value`,children:c})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`cp-field-label`,children:`Expiration date`}),(0,w.jsx)(`p`,{className:`cp-field-value`,children:u})]})]})]})}function j(e){return n.t.find(t=>t.brand===e)?.iconLabel??`CARD`}function M({title:n=`Your payment methods`,actionLabel:r=`Change`,actionHref:i=`#`,onAction:s,brand:l=`visa`,brandIcon:u,last4:f,badgeLabel:p,summary:m,helperText:h=`All fields are required, unless stated otherwise.`,expiryLabel:_=`Expiration date`,cvcLabel:v=`Security code`,expiryProps:y,cvcProps:b,color:x,className:S,...C}){let T=y?.value??y?.defaultValue,E=p===void 0?`Default`:p,D=T?`Credit card - Expiration date ${String(T).replace(`/`,`.`)}`:`Credit card`,O=m===void 0?D:m,k=j(l),A={clearable:!0,...y};return(0,w.jsxs)(`div`,{className:t.t(`card-payment-method`,x||`primary`,S),...C,children:[(0,w.jsxs)(`div`,{className:`cpm-header`,children:[(0,w.jsx)(`h3`,{className:`cpm-title`,children:n}),(0,w.jsxs)(c.t,{href:i,tone:`accent`,underline:`none`,className:`cpm-action`,onClick:e=>{s&&(e.preventDefault(),s())},children:[r,(0,w.jsx)(e.Ui,{})]})]}),(0,w.jsxs)(`div`,{className:`cpm-surface`,children:[(0,w.jsxs)(`div`,{className:`cpm-method`,children:[(0,w.jsxs)(a.n,{align:`center`,className:`cpm-method-row`,children:[(0,w.jsx)(`span`,{className:t.t(`cpm-brand`,!u&&l),children:u??k}),(0,w.jsx)(`span`,{className:`cpm-last4`,children:`\u2022\u2022\u2022\u2022 ${f}`}),E&&(0,w.jsx)(d.n,{color:`info`,children:E})]}),O&&(0,w.jsx)(o.t,{tone:`muted`,className:`cpm-summary`,children:O})]}),h&&(0,w.jsx)(o.t,{tone:`muted`,size:`sm`,className:`cpm-helper`,children:h}),(0,w.jsxs)(`div`,{className:`cpm-fields`,children:[(0,w.jsx)(g.n,{label:_,placeholder:`MM/YYYY`,fullWidth:!0,...A}),(0,w.jsx)(g.t,{label:v,placeholder:`123`,fullWidth:!0,...b})]})]})]})}function N({variant:n,title:r,description:i,price:a,currency:o=`PLN`,duration:s,available:c,image:u,gallery:f,galleryAutoPlay:p=!1,rating:m,reviewCount:h,favorite:g,onFavorite:y,menuItems:b,onAddToCart:S,actionLabel:T,icon:E,color:D=`primary`,leader:O,participants:k,maxParticipants:A,quantity:j,onQuantityChange:M,showQuantity:N=!0,date:P,location:F,status:I,className:L,...R}){let[z,B]=(0,C.useState)(0),[V,H]=(0,C.useState)(!1),[U,W]=(0,C.useState)(1),G=j??U,K=f&&f.length>0?f:u?[u]:[];(0,C.useEffect)(()=>{z>=K.length&&B(0)},[z,K.length]),(0,C.useEffect)(()=>{if(!V)return;let e=window.setTimeout(()=>{H(!1)},220);return()=>window.clearTimeout(e)},[z,V]);function q(e){e===z||e<0||e>=K.length||(K.length>1&&H(!0),B(e))}(0,C.useEffect)(()=>{if(!p||K.length<=1)return;let e=window.setInterval(()=>{H(!0),B(e=>(e+1)%K.length)},3500);return()=>window.clearInterval(e)},[p,K.length]);function ee(e){let t=Math.max(1,e);M?M(t):W(t)}let J=c===!0?`Available`:c===!1?`Unavailable`:typeof c==`number`?`${c} spots`:null,Y=P?P instanceof Date?P:new Date(P):null,te=Y?Y.getDate():null,ne=Y?Y.toLocaleString(`en`,{month:`short`}).toUpperCase():null;return(0,w.jsxs)(`div`,{className:t.t(`card-service`,n,`color-${D}`,L),...R,children:[K.length>0&&(0,w.jsxs)(`div`,{className:`cs-gallery`,children:[(0,w.jsx)(`img`,{src:K[z],alt:r,className:t.t(`cs-image`,V&&`is-transitioning`)}),K.length>1&&(0,w.jsx)(`div`,{className:`cs-gallery-dots`,children:K.map((e,n)=>(0,w.jsx)(`button`,{type:`button`,className:t.t(`cs-dot`,n===z&&`active`),onClick:()=>q(n),"aria-label":`Image ${n+1}`},n))}),(y||b&&b.length>0)&&(0,w.jsxs)(`div`,{className:`cs-gallery-actions`,children:[b&&b.length>0&&(0,w.jsx)(x.i,{className:`cs-menu-wrap`,trigger:(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,shape:`circle`,"aria-label":`More options`,className:`cs-overlay-btn`,children:(0,w.jsx)(e.Xn,{})}),placement:`bottom-end`,children:b.map((e,t)=>(0,w.jsx)(x.r,{icon:e.icon,color:e.danger?`error`:void 0,label:e.label,onClick:e.onClick},t))}),y&&(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,shape:`circle`,onClick:y,"aria-label":g?`Remove from favorites`:`Add to favorites`,className:t.t(`cs-overlay-btn`,g&&`cs-fav-active`),children:g?(0,w.jsx)(e.nr,{}):(0,w.jsx)(e.rr,{})})]})]}),(0,w.jsxs)(`div`,{className:`cs-body`,children:[n===`event`&&Y&&(0,w.jsxs)(`div`,{className:`cs-event-header`,children:[(0,w.jsxs)(`div`,{className:`cs-date-block`,children:[(0,w.jsx)(`span`,{className:`cs-date-day`,children:te}),(0,w.jsx)(`span`,{className:`cs-date-month`,children:ne})]}),(0,w.jsxs)(`div`,{className:`cs-event-info`,children:[(0,w.jsx)(`h3`,{className:`cs-title`,children:r}),i&&(0,w.jsx)(`p`,{className:`cs-desc`,children:i})]})]}),n!==`event`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`cs-top`,children:[E&&(0,w.jsx)(`span`,{className:`cs-icon`,children:E}),(0,w.jsx)(`h3`,{className:`cs-title`,children:r})]}),i&&(0,w.jsx)(`p`,{className:`cs-desc`,children:i})]}),n===`event`&&!Y&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`cs-top`,children:[E&&(0,w.jsx)(`span`,{className:`cs-icon`,children:E}),(0,w.jsx)(`h3`,{className:`cs-title`,children:r})]}),i&&(0,w.jsx)(`p`,{className:`cs-desc`,children:i})]}),m!==void 0&&(0,w.jsxs)(`div`,{className:`cs-rating`,children:[(0,w.jsx)(v.n,{value:Math.round(m),size:`sm`,color:`warning`,readOnly:!0,className:`cs-stars`}),(0,w.jsx)(`span`,{className:`cs-rating-value`,children:m.toFixed(1)}),h!==void 0&&(0,w.jsxs)(`span`,{className:`cs-review-count`,children:[`(`,h,`)`]})]}),O&&(0,w.jsxs)(`div`,{className:`cs-leader`,children:[(0,w.jsx)(_.t,{src:O.avatar,name:O.name,size:28,color:D}),(0,w.jsx)(`span`,{className:`cs-leader-name`,children:O.name})]}),n===`course`&&k&&(0,w.jsxs)(`div`,{className:`cs-participants`,children:[(0,w.jsx)(`div`,{className:`cs-participants-avatars`,children:k.slice(0,4).map((e,t)=>(0,w.jsx)(_.t,{src:e.avatar,name:e.name,size:28,color:D,className:`cs-participant-avatar`},`${e.name}-${t}`))}),A&&(0,w.jsxs)(`span`,{className:`cs-spots`,children:[k.length,`/`,A]})]}),(0,w.jsxs)(`div`,{className:`cs-meta`,children:[n===`event`&&F&&(0,w.jsx)(d.n,{size:`xs`,color:D,children:F}),s&&(0,w.jsx)(d.n,{size:`xs`,color:D,icon:(0,w.jsx)(e.Li,{}),children:s}),n===`event`&&I&&(0,w.jsx)(d.n,{size:`xs`,color:I.toLowerCase()===`sold out`?`error`:D,children:I}),J&&n!==`event`&&(0,w.jsx)(d.n,{size:`xs`,color:c===!1?`error`:D,children:J})]})]}),(0,w.jsxs)(`div`,{className:`cs-footer`,children:[a!==void 0&&(0,w.jsxs)(`span`,{className:`cs-price`,children:[typeof a==`number`?a.toFixed(2):a,` `,(0,w.jsx)(`span`,{className:`cs-currency`,children:o})]}),(0,w.jsxs)(`div`,{className:`cs-actions`,children:[n===`product`&&S&&N&&(0,w.jsxs)(`div`,{className:`cs-qty`,children:[(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,size:`sm`,onClick:()=>ee(G-1),"aria-label":`Decrease`,className:`cs-qty-btn`,children:(0,w.jsx)(e.Mr,{})}),(0,w.jsx)(`span`,{className:`cs-qty-value`,children:G}),(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,size:`sm`,onClick:()=>ee(G+1),"aria-label":`Increase`,className:`cs-qty-btn`,children:(0,w.jsx)(e.Nr,{})})]}),S&&(0,w.jsx)(l.t,{variant:`filled`,size:`sm`,color:D,onClick:()=>S(G),disabled:c===!1,className:`cs-cart-btn`,children:T??(n===`event`?`Register`:`Add to cart`)})]})]})]})}function P(e){let{onAction:t,actionLabel:n=`Book now`,...r}=e;return(0,w.jsx)(N,{variant:`service`,onAddToCart:t?()=>t():void 0,actionLabel:n,...r})}function F(e){let{onAction:t,actionLabel:n=`Join course`,...r}=e;return(0,w.jsx)(N,{variant:`course`,onAddToCart:t?()=>t():void 0,actionLabel:n,...r})}function I({component:n,title:i,description:a,icon:o,color:s=`primary`,to:c,href:u,target:d,rel:f,onClick:p,interactive:m=!1,clickEffect:g,rippleColor:_,image:v,video:y,illustration:b,camera:S,mediaFill:T=!1,overlayPosition:E=`bottom`,favorite:D,onFavorite:O,menuItems:k,className:A,...j}){let M=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!S)return;let e=M.current;if(!e||typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return;let t=null,n=!1,r=S===!0?{video:!0}:S;return navigator.mediaDevices.getUserMedia(r).then(r=>{if(n){r.getTracks().forEach(e=>e.stop());return}t=r,e.srcObject=r,e.play().catch(()=>void 0)}).catch(()=>void 0),()=>{n=!0,t&&t.getTracks().forEach(e=>e.stop()),e.srcObject=null}},[S]);let N=!!(v||y||b||S),{component:P,href:F,to:I,isInteractive:L,isLink:R}=h.a({component:n,href:u,to:c,interactive:m,hasClickHandler:!!p,fallbackComponent:`button`}),z=T&&N,{effectClassName:B,effectLayer:V,handlePointerDown:H}=r.t({effect:g??(L?`ripple`:`none`),disabled:!L,color:_});function U(e){e.stopPropagation()}function W(e){p&&(e.preventDefault(),p())}function G(){return N?(0,w.jsxs)(`div`,{className:t.t(`tile-media`,z&&`fill`),children:[v&&(0,w.jsx)(`img`,{src:v,alt:i,className:`tile-image`}),y&&(0,w.jsx)(`video`,{src:y,className:`tile-video`,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,"aria-label":i}),S&&(0,w.jsx)(`video`,{ref:M,className:`tile-video`,autoPlay:!0,muted:!0,playsInline:!0,"aria-label":i}),b&&(0,w.jsx)(`div`,{className:`tile-illustration`,children:b}),z&&(0,w.jsx)(`div`,{className:t.t(`tile-scrim`,`scrim-${E}`)})]}):null}function K(){return(0,w.jsxs)(`div`,{className:t.t(`tile-body`,z&&`overlay`,z&&`pos-${E}`),children:[(0,w.jsxs)(`div`,{className:`tile-top`,children:[o&&(0,w.jsx)(`span`,{className:`tile-icon`,children:o}),(0,w.jsx)(`h3`,{className:`tile-title`,children:i})]}),a&&(0,w.jsx)(`p`,{className:`tile-desc`,children:a})]})}let q=O||k&&k.length>0;return(0,w.jsxs)(`div`,{className:t.t(`card-tile`,`color-${s}`,z&&`media-fill`,L&&`interactive`,B,A),onPointerDown:H,...j,children:[V,R&&(0,w.jsx)(P,{href:P===`a`||n?F:void 0,to:I,target:d,rel:f,className:`tile-link`,"aria-label":i,onClick:p?W:void 0}),!R&&p&&(0,w.jsx)(P,{type:`button`,className:`tile-link`,"aria-label":i,onClick:p}),G(),K(),q&&(0,w.jsxs)(`div`,{className:`tile-actions`,onClick:U,onPointerDown:U,children:[k&&k.length>0&&(0,w.jsx)(x.i,{className:`tile-menu-wrap`,trigger:(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,shape:`circle`,"aria-label":`More options`,className:`tile-overlay-btn`,children:(0,w.jsx)(e.Xn,{})}),placement:`bottom-end`,children:k.map((e,t)=>(0,w.jsx)(x.r,{icon:e.icon,color:e.danger?`error`:void 0,label:e.label,onClick:e.onClick},t))}),O&&(0,w.jsx)(l.t,{variant:`ghost`,iconOnly:!0,shape:`circle`,onClick:O,"aria-label":D?`Remove from favorites`:`Add to favorites`,className:t.t(`tile-overlay-btn`,D&&`tile-fav-active`),children:D?(0,w.jsx)(e.nr,{}):(0,w.jsx)(e.rr,{})})]})]})}function L(e){let{addToCartLabel:t=`Add to cart`,...n}=e;return(0,w.jsx)(N,{variant:`product`,actionLabel:t,...n})}function R(e){let{onRegister:t,registerLabel:n=`Register`,...r}=e;return(0,w.jsx)(N,{variant:`event`,onAddToCart:t?()=>t():void 0,actionLabel:n,...r})}function z(e,t){return t||(typeof e!=`number`||e===0?`neutral`:e>0?`up`:`down`)}function B(e){return typeof e==`number`&&e>0?`+${e}`:e}function V({component:n,to:i,href:a,target:o,rel:s,title:c,value:l,trend:u,trendType:d,icon:f,color:p=`primary`,helperText:m,interactive:g=!1,clickEffect:_,rippleColor:v,className:y,onPointerDown:b,...x}){let S=u!=null,C=z(u,d),T=B(u),{component:E,href:D,to:O,isInteractive:k}=h.a({component:n,href:a,to:i,interactive:g,hasClickHandler:!!x.onClick,hasPointerHandler:!!b}),{effectClassName:A,effectLayer:j,handlePointerDown:M}=r.t({effect:_??(k?`ripple`:`none`),disabled:!k,color:v});return(0,w.jsxs)(E,{href:E===`a`||n?D:void 0,to:O,target:o,rel:s,className:t.t(`card-widget`,`color-${p}`,k&&`interactive`,A,y),onPointerDown:e=>{M(e),b?.(e)},...x,children:[j,(0,w.jsxs)(`div`,{className:`cw-top`,children:[(0,w.jsxs)(`div`,{className:`cw-meta`,children:[(0,w.jsx)(`span`,{className:`cw-title`,children:c}),(0,w.jsx)(`span`,{className:`cw-value`,children:l})]}),f&&(0,w.jsx)(`span`,{className:`cw-icon`,children:f})]}),S&&(0,w.jsx)(`div`,{className:`cw-bottom`,children:(0,w.jsxs)(`span`,{className:t.t(`cw-trend`,C),children:[C===`up`&&(0,w.jsx)(e.Hi,{size:14}),C===`down`&&(0,w.jsx)(e.Vi,{size:14}),(0,w.jsx)(`span`,{children:T})]})}),m&&(0,w.jsx)(`div`,{className:`cw-helper`,children:m})]})}function H(e,t){return t||(typeof e!=`number`||e===0?`neutral`:e>0?`up`:`down`)}function U(e){return typeof e==`number`&&e>0?`+${e}`:e}function W({label:n,value:r,icon:i,badge:s,helperText:c,trend:l,trendType:u,color:d=`primary`,className:f,...p}){let g=l!=null,_=H(l,u);return(0,w.jsx)(h.t,{className:t.t(`stat-card`,`color-${d}`,f),...p,children:(0,w.jsxs)(m.t,{spacing:`md`,children:[(0,w.jsxs)(a.n,{justify:`between`,align:`start`,children:[(0,w.jsxs)(m.t,{spacing:`xs`,children:[(0,w.jsx)(`span`,{className:`stat-card-label`,children:n}),(0,w.jsx)(`span`,{className:`stat-card-value`,children:r})]}),(0,w.jsxs)(a.n,{align:`center`,children:[s,i&&(0,w.jsx)(`span`,{className:`stat-card-icon`,children:i})]})]}),(g||c)&&(0,w.jsxs)(a.n,{justify:`between`,align:`center`,children:[g?(0,w.jsxs)(`span`,{className:t.t(`stat-card-trend`,_),children:[_===`up`&&(0,w.jsx)(e.Hi,{size:14}),_===`down`&&(0,w.jsx)(e.Vi,{size:14}),(0,w.jsx)(`span`,{children:U(l)})]}):(0,w.jsx)(`span`,{}),c&&(0,w.jsx)(o.t,{size:`sm`,tone:`muted`,children:c})]})]})})}function G(e){if(typeof e==`number`)return{gridTemplateColumns:`repeat(${e}, 1fr)`};let t={};return e.base!==void 0&&(t[`--cols-base`]=e.base),e.sm!==void 0&&(t[`--cols-sm`]=e.sm),e.md!==void 0&&(t[`--cols-md`]=e.md),e.lg!==void 0&&(t[`--cols-lg`]=e.lg),e.xl!==void 0&&(t[`--cols-xl`]=e.xl),e.xxl!==void 0&&(t[`--cols-xxl`]=e.xxl),t}function K(e,t){let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;r=r[e]}return r}function q({items:n,renderCard:r,color:a=`primary`,searchable:o=!1,searchKeys:s,searchPlaceholder:c=`Search...`,search:d,onSearchChange:p,filterable:m=!1,filterKeys:h=[],filters:g,onFiltersChange:_,sortable:v=!1,sortKeys:b=[],defaultSort:x,sort:T,onSortChange:E,pagination:D=!1,pageSize:O=12,page:k,onPageChange:A,total:j,manualSearch:M=!1,manualFilters:N=!1,manualSort:P=!1,manualPagination:F=!1,loading:I=!1,loadingLabel:L=`Loading`,scrollOffset:R,columns:z=3,emptyMessage:B=`No results found.`,className:V,style:H,...U}){let[W,q]=(0,C.useState)(``),[ee,J]=(0,C.useState)({}),[Y,te]=(0,C.useState)(x??null),[ne,X]=(0,C.useState)(1),[re,ie]=(0,C.useState)(!1),[ae,oe]=(0,C.useState)(!1),se=(0,C.useRef)(null),ce=(0,C.useRef)(null),le=d===void 0?W:d,Z=g===void 0?ee:g,Q=T===void 0?Y:T,ue=k===void 0?ne:k,de=(0,C.useCallback)(e=>{d===void 0&&q(e),!F&&k===void 0&&X(1),p?.(e)},[d,k,F,p]),fe=(0,C.useCallback)(e=>{g===void 0&&J(e),!F&&k===void 0&&X(1),_?.(e)},[g,k,F,_]),pe=(0,C.useCallback)(e=>{T===void 0&&te(e),!F&&k===void 0&&X(1),E?.(e)},[T,k,F,E]),me=(0,C.useRef)(null),he=(0,C.useCallback)(e=>{k===void 0&&X(e),A?.(e),me.current?.scrollIntoView({block:`start`,behavior:`smooth`})},[k,A]),ge=(0,C.useCallback)(()=>{ie(e=>!e),oe(!1)},[]),_e=(0,C.useCallback)(()=>{oe(e=>!e),ie(!1)},[]),$=(0,C.useMemo)(()=>{let e=n;if(!M&&le&&s&&s.length>0){let t=le.toLowerCase();e=e.filter(e=>s.some(n=>{let r=K(e,n);return r!=null&&String(r).toLowerCase().includes(t)}))}if(!N)for(let[t,n]of Object.entries(Z))!n||n.length===0||(e=e.filter(e=>{let r=K(e,t);return r!=null&&n.includes(String(r))}));return!P&&Q&&(e=[...e].sort((e,t)=>{let n=K(e,Q.key),r=K(t,Q.key);if(n==null&&r==null)return 0;if(n==null)return 1;if(r==null)return-1;let i=String(n).localeCompare(String(r),void 0,{numeric:!0});return Q.direction===`asc`?i:-i})),e===n?[...e]:e},[n,le,s,Z,Q,M,N,P]),ve=F?j??$.length:$.length,ye=(0,C.useMemo)(()=>{if(!D||F)return $;let e=(ue-1)*O;return $.slice(e,e+O)},[$,D,F,ue,O]);function be(e,t){let n=Z[e]??[],r=n.includes(t)?n.filter(e=>e!==t):[...n,t];fe({...Z,[e]:r})}let xe=(0,C.useMemo)(()=>{let e={};for(let t of h){if(t.options){e[t.key]=t.options;continue}let r=new Set;for(let e of n){let n=K(e,t.key);n!=null&&r.add(String(n))}e[t.key]=Array.from(r).sort()}return e},[n,h]),Se=b.find(e=>e.key===Q?.key);return(0,w.jsxs)(`div`,{ref:me,className:t.t(`card-grid`,`color-${a}`,V),style:R===void 0?H:{scrollMarginTop:R,...H},...U,children:[(o||m||v)&&(0,w.jsxs)(`div`,{className:`card-grid-toolbar`,children:[o&&(0,w.jsx)(y.t,{className:`card-grid-search`,size:`sm`,fullWidth:!0,placeholder:c,value:le,onChange:e=>de(e.target.value),onClear:()=>de(``)}),(0,w.jsxs)(`div`,{className:`card-grid-actions`,children:[m&&h.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.t,{ref:se,variant:`outlined`,color:a,size:`sm`,startIcon:(0,w.jsx)(e.Jn,{}),"aria-expanded":re,onClick:ge,children:`Filter`}),(0,w.jsx)(i.t,{open:re,anchorRef:se,onClose:()=>ie(!1),placement:`bottom-end`,className:`card-grid-dropdown`,children:h.map(e=>(0,w.jsxs)(`div`,{className:`card-grid-filter-group`,children:[(0,w.jsx)(`span`,{className:`card-grid-filter-label`,children:e.label}),(xe[e.key]??[]).map(t=>(0,w.jsx)(`div`,{className:`card-grid-filter-option`,children:(0,w.jsx)(u.t,{size:`sm`,clickEffect:`none`,checked:Z[e.key]?.includes(t)??!1,onChange:()=>be(e.key,t),label:t})},t))]},e.key))})]}),v&&b.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.t,{ref:ce,variant:`outlined`,color:a,size:`sm`,startIcon:Q?Q.direction===`asc`?(0,w.jsx)(e.Hi,{}):(0,w.jsx)(e.Vi,{}):(0,w.jsx)(e.qn,{}),"aria-expanded":ae,onClick:_e,children:Se?`Sort: ${Se.label}`:`Sort`}),(0,w.jsx)(i.t,{open:ae,anchorRef:ce,onClose:()=>oe(!1),placement:`bottom-end`,className:`card-grid-dropdown`,children:b.map(n=>(0,w.jsxs)(`button`,{type:`button`,className:t.t(`card-grid-sort-item`,Q?.key===n.key&&`active`),onClick:()=>{Q?.key===n.key?pe({key:n.key,direction:Q.direction===`asc`?`desc`:`asc`}):pe({key:n.key,direction:`asc`})},children:[n.label,Q?.key===n.key&&(0,w.jsx)(`span`,{className:`card-grid-sort-dir`,children:Q.direction===`asc`?(0,w.jsx)(e.Hi,{className:`card-grid-sort-icon`}):(0,w.jsx)(e.Vi,{className:`card-grid-sort-icon`})})]},n.key))})]})]})]}),(0,w.jsxs)(`div`,{className:t.t(`card-grid-body`,I&&`loading`),"aria-busy":I||void 0,children:[ye.length>0?(0,w.jsx)(`div`,{className:`card-grid-items`,style:G(z),children:ye.map((e,t)=>{let n=e?.id;return(0,w.jsx)(C.Fragment,{children:r(e,t)},n??t)})}):(0,w.jsx)(`div`,{className:`card-grid-empty`,children:B}),I&&(0,w.jsx)(`div`,{className:`card-grid-loading`,role:`status`,"aria-live":`polite`,children:(0,w.jsx)(f.t,{center:!1,minHeight:`auto`,color:a,label:L})})]}),D&&ve>O&&(0,w.jsx)(`div`,{className:`card-grid-pagination`,children:(0,w.jsx)(S.t,{total:ve,page:ue,pageSize:O,onChange:he})})]})}function ee({title:e=`Today`,description:t,color:n=`primary`,workdayStart:r,workdayEnd:i,timeline:c,summary:l,tabs:u=[],footer:d,emptyTimeline:f=(0,w.jsx)(o.t,{tone:`muted`,children:`No events scheduled for this day.`}),...g}){let _=r&&i?`${r}-${i}`:r??i??void 0,y=u.filter(e=>e.items.length>0);return(0,w.jsxs)(h.t,{color:n,...g,children:[(0,w.jsx)(h.i,{children:(0,w.jsxs)(m.t,{children:[(0,w.jsx)(s.t,{level:4,children:e}),(t||_)&&(0,w.jsxs)(o.t,{size:`sm`,tone:`muted`,children:[t,t&&_?` `:null,_]})]})}),(0,w.jsx)(h.n,{children:(0,w.jsxs)(p.t,{type:`row`,align:`start`,children:[(0,w.jsx)(p.t,{type:`col`,xl:7,sm:12,children:c.length?(0,w.jsx)(m.t,{className:`day-schedule-card-timeline`,children:c.map(e=>(0,w.jsxs)(a.n,{align:`start`,className:`day-schedule-card-entry`,children:[(0,w.jsx)(`span`,{className:`day-schedule-card-time`,children:e.time}),(0,w.jsx)(`div`,{className:`day-schedule-card-dot`,"data-color":e.color??n,children:D(e.icon,e.color??n)}),(0,w.jsxs)(`div`,{className:`day-schedule-card-copy`,children:[(0,w.jsx)(o.t,{as:`strong`,children:e.title}),e.description&&(0,w.jsx)(o.t,{size:`sm`,tone:`muted`,children:e.description})]})]},e.id))}):f}),(0,w.jsx)(p.t,{type:`col`,xl:5,sm:12,children:(0,w.jsxs)(m.t,{className:`day-schedule-card-side`,children:[l,y.length>0&&(0,w.jsx)(p.r,{variant:`underline`,size:`sm`,fullWidth:!0,defaultValue:y[0].type,items:y.map(e=>({value:e.type,label:(0,w.jsxs)(`span`,{className:`day-schedule-card-tab-label`,children:[(0,w.jsx)(`span`,{children:e.title}),(0,w.jsx)(`span`,{className:`day-schedule-card-tab-count`,children:e.items.length})]}),content:(0,w.jsx)(v.t,{items:e.items})}))})]})})]})}),d&&(0,w.jsx)(h.r,{children:D(d,n)})]})}function J({title:t=`Documents`,description:n,color:r=`primary`,items:i,selected:c,onSelect:u,defaultExpanded:d,expanded:f,onExpandChange:g,detailsTitle:_,detailsMeta:y,detailsItems:S=[],detailsActions:C=[],renderDetails:T,emptyDetails:E=(0,w.jsx)(o.t,{tone:`muted`,children:`Select a document to inspect its details.`}),primaryAction:O,...k}){let A=e=>({...e,icon:D(e.icon,r),children:e.children?.map(A)}),j=i.map(A);return(0,w.jsxs)(h.t,{stretch:!1,color:r,...k,children:[(0,w.jsx)(h.i,{children:(0,w.jsxs)(a.n,{justify:`between`,align:`center`,children:[(0,w.jsxs)(m.t,{children:[(0,w.jsx)(s.t,{level:4,children:t}),n&&(0,w.jsx)(o.t,{size:`sm`,tone:`muted`,children:n})]}),D(O,r)]})}),(0,w.jsx)(h.n,{children:(0,w.jsxs)(p.t,{type:`row`,align:`start`,children:[(0,w.jsx)(p.t,{type:`col`,xl:7,sm:12,children:(0,w.jsx)(b.t,{items:j,color:r,defaultExpanded:d,expanded:f,onExpandChange:g,selected:c,onSelect:u,expandable:!0,selectable:!0,showLines:!0,fileIcons:!0})}),(0,w.jsx)(p.t,{type:`col`,xl:5,sm:12,children:(0,w.jsxs)(m.t,{padding:`sm`,children:[(_||y||C.length>0)&&(0,w.jsxs)(a.n,{justify:`between`,align:`start`,children:[(0,w.jsxs)(m.t,{children:[_&&(0,w.jsx)(s.t,{level:5,children:_}),y&&(0,w.jsx)(o.t,{size:`sm`,tone:`muted`,children:y})]}),C.length>0&&(0,w.jsx)(x.i,{placement:`bottom-end`,trigger:(0,w.jsx)(l.t,{variant:`ghost`,color:r,iconOnly:!0,shape:`circle`,"aria-label":`Open document actions`,children:(0,w.jsx)(e.Xn,{})}),children:C.map(e=>(0,w.jsx)(x.r,{icon:D(e.icon,e.color??r),label:e.label,color:e.color??r,disabled:e.disabled,component:e.component,href:e.href,to:e.to,onClick:e.onClick},e.id))})]}),T||(S.length?(0,w.jsx)(v.t,{items:S}):E)]})})]})})]})}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return P}});
|
|
2
|
+
//# sourceMappingURL=cards-CQSYgH9U.cjs.map
|