prometeo-design-system 3.1.7 → 4.0.0
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/dist/Icons/ReassignmentFill.es.js +1 -1
- package/dist/Icons/StarFill.d.ts +6 -0
- package/dist/Icons/StarFill.es.js +19 -0
- package/dist/Icons/components/StarFill.d.ts +4 -0
- package/dist/Icons/index.d.ts +1 -0
- package/dist/Icons/types.d.ts +4 -2
- package/dist/Icons.es.js +18 -16
- package/dist/Input.es.js +56 -52
- package/dist/PyrionLayout.d.ts +6 -0
- package/dist/PyrionLayout.es.js +1308 -0
- package/dist/RecurrentDatePicker.es.js +1 -1
- package/dist/Scrollable.es.js +118 -86
- package/dist/components/Input/Input.d.ts +1 -0
- package/dist/components/NavigationDrawer/NavigationDrawer.d.ts +18 -11
- package/dist/components/NavigationDrawer/NavigationDrawerActionItem.d.ts +1 -0
- package/dist/components/NavigationDrawer/NavigationDrawerActions.d.ts +3 -2
- package/dist/components/NavigationDrawer/NavigationDrawerSidebar.d.ts +11 -0
- package/dist/components/NotificationCard/NotificationCard.d.ts +3 -2
- package/dist/components/PyrionNavigationDrawer/PLContent.d.ts +10 -0
- package/dist/components/PyrionNavigationDrawer/PLFooter.d.ts +20 -0
- package/dist/components/PyrionNavigationDrawer/PLHeader.d.ts +10 -0
- package/dist/components/PyrionNavigationDrawer/PLHelpSection.d.ts +8 -0
- package/dist/components/PyrionNavigationDrawer/{PyrionNavigationDrawerMobileAppSwitcher.d.ts → PLMobileAppSwitcher.d.ts} +3 -3
- package/dist/components/PyrionNavigationDrawer/PLNotificationsList.d.ts +15 -0
- package/dist/components/PyrionNavigationDrawer/PLSidebar.d.ts +12 -0
- package/dist/components/PyrionNavigationDrawer/PLSidebarContent.d.ts +17 -0
- package/dist/components/PyrionNavigationDrawer/{PyrionNavigationDrawerSystemLogo.d.ts → PLSystemLogo.d.ts} +1 -1
- package/dist/components/PyrionNavigationDrawer/PLSystemSessions.d.ts +14 -0
- package/dist/components/PyrionNavigationDrawer/PLayoutBase.d.ts +41 -0
- package/dist/components/PyrionNavigationDrawer/PyrionLayout.d.ts +143 -0
- package/dist/components/PyrionNavigationDrawer/index.d.ts +3 -2
- package/dist/components/Scrollable/Scrollable.d.ts +1 -0
- package/dist/exports/PyrionLayout.d.ts +2 -0
- package/dist/exports/usePyrionNavigation.d.ts +1 -1
- package/dist/prometeo-design-system.es.js +2423 -402
- package/dist/styles.css +1 -1
- package/dist/usePyrionNavigation.es.js +1 -1
- package/package.json +5 -13
- package/dist/LayoutGeneric-CfWhV1ov.js +0 -26
- package/dist/LayoutGeneric.d.ts +0 -6
- package/dist/LayoutGeneric.es.js +0 -4
- package/dist/PyrionNavigationDrawer.d.ts +0 -6
- package/dist/PyrionNavigationDrawer.es.js +0 -962
- package/dist/components/PyrionNavigationDrawer/PyrionHelpSection.d.ts +0 -8
- package/dist/components/PyrionNavigationDrawer/PyrionNavigationDrawer.d.ts +0 -130
- package/dist/components/PyrionNavigationDrawer/PyrionNotificationsList.d.ts +0 -8
- package/dist/components/PyrionNavigationDrawer/SidebarContent.d.ts +0 -13
- package/dist/components/PyrionNavigationDrawer/SystemSessions.d.ts +0 -12
- package/dist/exports/LayoutGeneric.d.ts +0 -2
- package/dist/exports/PyrionNavigationDrawer.d.ts +0 -2
|
@@ -0,0 +1,1308 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
|
+
import { useIsMobile as Fe } from "./useDevice.es.js";
|
|
3
|
+
import { g as de } from "./utils-X4-h3cum.js";
|
|
4
|
+
import Te, { memo as L, forwardRef as he, useState as te, useEffect as V, useContext as Se, createContext as ke, useRef as O, useCallback as g, Children as ot, isValidElement as ue, useMemo as ne, useImperativeHandle as De } from "react";
|
|
5
|
+
import { useNavigate as lt } from "react-router";
|
|
6
|
+
import { B as it, T as ct } from "./badge-B1IK_-i5.js";
|
|
7
|
+
import { c as A } from "./cn-B6yFEsav.js";
|
|
8
|
+
import { CloseNavBarDesktop as dt } from "./Icons/CloseNavBarDesktop.es.js";
|
|
9
|
+
import { c as Ae } from "./index-BOQuZ0gG.js";
|
|
10
|
+
import { CrevronLeft as ut } from "./Icons/CrevronLeft.es.js";
|
|
11
|
+
import { Scrollable as be } from "./Scrollable.es.js";
|
|
12
|
+
import $ from "./TicketCard.es.js";
|
|
13
|
+
import ft from "./Avatar.es.js";
|
|
14
|
+
import fe from "./Button.es.js";
|
|
15
|
+
import { Logout as mt } from "./Icons/Logout.es.js";
|
|
16
|
+
import pt from "./NotificationCard.es.js";
|
|
17
|
+
import { Notifications as Me } from "./Icons/Notifications.es.js";
|
|
18
|
+
import { Close as Be } from "./Icons/Close.es.js";
|
|
19
|
+
import { Help as Ue } from "./Icons/Help.es.js";
|
|
20
|
+
import { createPortal as Ee } from "react-dom";
|
|
21
|
+
import { Settings as ht } from "./Icons/Settings.es.js";
|
|
22
|
+
const ze = L(he(({ children: t, className: r, context: s, modal: l = !1, closeOnOverlayClick: d = !1, unmountChildrenOnClose: o = !0 }, i) => {
|
|
23
|
+
const p = ae(t, s), c = typeof window < "u" && window.matchMedia("(min-width: 768px)").matches, { isSidebarOpen: x } = bt(), { closeSidebar: b } = re(), [C, u] = te(() => o ? x : !0), [h, N] = te(!1);
|
|
24
|
+
return V(() => {
|
|
25
|
+
o && s?.subscribeToSidebarOpen((m) => {
|
|
26
|
+
m ? (N(!1), u(!0)) : N(!0);
|
|
27
|
+
});
|
|
28
|
+
}, [o, s]), V(() => {
|
|
29
|
+
const m = i && typeof i == "object" && "current" in i ? i.current : null;
|
|
30
|
+
if (!m) return;
|
|
31
|
+
const P = () => {
|
|
32
|
+
h && (u(!1), N(!1));
|
|
33
|
+
};
|
|
34
|
+
return m.addEventListener("transitionend", P), () => m.removeEventListener("transitionend", P);
|
|
35
|
+
}, [h]), /* @__PURE__ */ e.jsxs("div", { ref: i, className: A("sidebar", c ? "collapsed" : "expanded", "h-full overflow-auto", r), "aria-modal": l || void 0, children: [
|
|
36
|
+
l && c && /* @__PURE__ */ e.jsx(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: A("navigation-drawer-sidebar-overlay"),
|
|
40
|
+
onClick: (m) => {
|
|
41
|
+
m.preventDefault(), m.stopPropagation(), d && b?.();
|
|
42
|
+
},
|
|
43
|
+
"aria-hidden": "true"
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ e.jsxs("div", { className: A("navigation-drawer-sidebar-inner"), children: [
|
|
47
|
+
/* @__PURE__ */ e.jsx("div", { className: "secure-click-margin" }),
|
|
48
|
+
C && p
|
|
49
|
+
] })
|
|
50
|
+
] });
|
|
51
|
+
})), Ve = ke(null), He = ke(null), bt = () => {
|
|
52
|
+
const t = Se(Ve);
|
|
53
|
+
if (!t) throw new Error("useDrawerState must be used within NavigationDrawer");
|
|
54
|
+
return t;
|
|
55
|
+
}, re = () => {
|
|
56
|
+
const t = Se(He);
|
|
57
|
+
if (!t) throw new Error("useDrawerActions must be used within NavigationDrawer");
|
|
58
|
+
return t;
|
|
59
|
+
}, ae = (t, r) => typeof t == "function" ? r ? t(r) : null : t, We = "navigation-drawer-collapsed", Pe = () => {
|
|
60
|
+
if (typeof window > "u") return !1;
|
|
61
|
+
try {
|
|
62
|
+
const t = sessionStorage.getItem(We);
|
|
63
|
+
return t ? JSON.parse(t) : !1;
|
|
64
|
+
} catch {
|
|
65
|
+
return !1;
|
|
66
|
+
}
|
|
67
|
+
}, xt = (t) => {
|
|
68
|
+
if (!(typeof window > "u"))
|
|
69
|
+
try {
|
|
70
|
+
sessionStorage.setItem(We, JSON.stringify(t));
|
|
71
|
+
} catch {
|
|
72
|
+
}
|
|
73
|
+
}, gt = (t) => {
|
|
74
|
+
const { children: r, classNameDrawer: s, classNameSidebar: l, disableDragOpen: d } = t, o = O(null), i = O(null), p = O(null), c = O(null), x = O(Pe()), b = O(!1), C = O("drawer"), u = O(/* @__PURE__ */ new Set()), h = O(/* @__PURE__ */ new Set()), N = O(!1), m = O(null), P = g((n) => {
|
|
75
|
+
const f = i.current;
|
|
76
|
+
f && (f.classList.toggle("collapsed", n), f.classList.toggle("expanded", !n));
|
|
77
|
+
}, []), k = g((n) => {
|
|
78
|
+
const f = c.current;
|
|
79
|
+
if (!f) return;
|
|
80
|
+
f.classList.toggle("collapsed", n), f.classList.toggle("expanded", !n);
|
|
81
|
+
const w = o.current;
|
|
82
|
+
w && (w.classList.toggle("sidebar-collapsed", n), w.classList.toggle("sidebar-expanded", !n));
|
|
83
|
+
}, []), j = g(
|
|
84
|
+
(n, { notify: f = !0 } = {}) => {
|
|
85
|
+
const w = x.current !== n;
|
|
86
|
+
x.current = n, xt(n), P(n), f && w && u.current.forEach((D) => D(n));
|
|
87
|
+
},
|
|
88
|
+
[P]
|
|
89
|
+
), R = g(
|
|
90
|
+
(n, { notify: f = !0 } = {}) => {
|
|
91
|
+
const w = b.current !== n;
|
|
92
|
+
if (b.current = n, k(n), f && w) {
|
|
93
|
+
const D = !n;
|
|
94
|
+
h.current.forEach((E) => E(D));
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
[k]
|
|
98
|
+
), T = g(
|
|
99
|
+
(n, { notify: f = !0 } = {}) => {
|
|
100
|
+
const w = C.current, D = w !== n;
|
|
101
|
+
C.current = n, window.matchMedia("(min-width: 768px)").matches || j(n !== "drawer", { notify: f });
|
|
102
|
+
const E = w === "sidebar", a = n === "sidebar";
|
|
103
|
+
f && D && E !== a && h.current.forEach((v) => v(a)), R(n !== "sidebar", { notify: f }), j(n !== "drawer", { notify: f });
|
|
104
|
+
},
|
|
105
|
+
[j, R]
|
|
106
|
+
), F = g((n) => {
|
|
107
|
+
const f = o.current;
|
|
108
|
+
if (!f || window.matchMedia("(min-width: 768px)").matches) return;
|
|
109
|
+
N.current = !0;
|
|
110
|
+
const w = p.current?.offsetLeft ?? 0, D = c.current?.offsetLeft ?? w, E = n === "drawer" ? 0 : n === "sidebar" ? D : w;
|
|
111
|
+
m.current = E, f.scrollTo({ left: E, behavior: "smooth" });
|
|
112
|
+
const a = () => {
|
|
113
|
+
N.current = !1, m.current = null, f.removeEventListener("scrollend", a);
|
|
114
|
+
};
|
|
115
|
+
f.addEventListener("scrollend", a, { once: !0 }), setTimeout(() => {
|
|
116
|
+
N.current && a();
|
|
117
|
+
}, 1e3);
|
|
118
|
+
}, []), H = g(() => {
|
|
119
|
+
const n = o.current, f = p.current;
|
|
120
|
+
if (!n || !f || window.matchMedia("(min-width: 768px)").matches) return;
|
|
121
|
+
const w = [
|
|
122
|
+
{ panel: "drawer", offset: 0 },
|
|
123
|
+
{ panel: "outlet", offset: f.offsetLeft }
|
|
124
|
+
], D = c.current;
|
|
125
|
+
D && w.push({ panel: "sidebar", offset: D.offsetLeft });
|
|
126
|
+
const E = n.scrollLeft;
|
|
127
|
+
let a = w[0], v = Math.abs(E - a.offset);
|
|
128
|
+
for (let S = 1; S < w.length; S++) {
|
|
129
|
+
const y = Math.abs(E - w[S].offset);
|
|
130
|
+
y < v && (a = w[S], v = y);
|
|
131
|
+
}
|
|
132
|
+
T(a.panel);
|
|
133
|
+
}, [T]);
|
|
134
|
+
V(() => {
|
|
135
|
+
const n = o.current;
|
|
136
|
+
n && (d?.drawer && n.classList.add("disabled-dragopen"), d?.sidebar && n.classList.add("disabled-dragopen-sidebar"));
|
|
137
|
+
}, [d]), V(() => {
|
|
138
|
+
const n = o.current, f = p.current;
|
|
139
|
+
if (!n || !f) return;
|
|
140
|
+
if (window.matchMedia("(min-width: 768px)").matches) {
|
|
141
|
+
const D = Pe();
|
|
142
|
+
j(D, { notify: !1 }), R(!0, { notify: !1 });
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
requestAnimationFrame(() => {
|
|
146
|
+
n.scrollLeft = f.offsetLeft, T("outlet");
|
|
147
|
+
});
|
|
148
|
+
}, [T, j, R]), V(() => {
|
|
149
|
+
const n = o.current;
|
|
150
|
+
if (!n) return;
|
|
151
|
+
const f = p.current;
|
|
152
|
+
if (!f) return;
|
|
153
|
+
const w = f.offsetLeft;
|
|
154
|
+
let D = w, E = !1;
|
|
155
|
+
const a = () => {
|
|
156
|
+
if (window.matchMedia("(min-width: 768px)").matches) return;
|
|
157
|
+
if (N.current) {
|
|
158
|
+
if (D = n.scrollLeft, E) return;
|
|
159
|
+
E = !0, requestAnimationFrame(() => {
|
|
160
|
+
H(), E = !1;
|
|
161
|
+
});
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const v = n.classList.contains("disabled-dragopen"), S = n.classList.contains("disabled-dragopen-sidebar");
|
|
165
|
+
if (v || S) {
|
|
166
|
+
const y = n.scrollLeft, z = y - D;
|
|
167
|
+
if (z !== 0) {
|
|
168
|
+
const ce = i.current?.offsetLeft ?? 0, at = c.current?.offsetLeft ?? w;
|
|
169
|
+
if (v) {
|
|
170
|
+
const ve = z < 0 && y < w, Ne = y >= ce && y < w;
|
|
171
|
+
if (ve || Ne) {
|
|
172
|
+
n.scrollLeft = D;
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (S) {
|
|
177
|
+
const ve = z > 0 && y > w, Ne = y > w && y <= at;
|
|
178
|
+
if (ve || Ne) {
|
|
179
|
+
n.scrollLeft = D;
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
D = n.scrollLeft, !E && (E = !0, requestAnimationFrame(() => {
|
|
186
|
+
H(), E = !1;
|
|
187
|
+
}));
|
|
188
|
+
};
|
|
189
|
+
return n.addEventListener("scroll", a), () => n.removeEventListener("scroll", a);
|
|
190
|
+
}, [H]);
|
|
191
|
+
const M = g(() => {
|
|
192
|
+
const n = window.matchMedia("(min-width: 768px)").matches, f = !x.current;
|
|
193
|
+
if (n) {
|
|
194
|
+
j(f);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const w = f ? "outlet" : "drawer";
|
|
198
|
+
T(w), F(w);
|
|
199
|
+
}, [F, T, j]), W = O(null);
|
|
200
|
+
W.current || (W.current = {
|
|
201
|
+
toggleCollapse: () => M(),
|
|
202
|
+
getIsCollapsed: () => x.current,
|
|
203
|
+
subscribeToCollapse: (n) => (u.current.add(n), () => {
|
|
204
|
+
u.current.delete(n);
|
|
205
|
+
}),
|
|
206
|
+
openSidebar: () => {
|
|
207
|
+
if (c.current) {
|
|
208
|
+
if (window.matchMedia("(min-width: 768px)").matches) {
|
|
209
|
+
R(!1);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
T("sidebar"), F("sidebar");
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
closeSidebar: () => {
|
|
216
|
+
if (window.matchMedia("(min-width: 768px)").matches) {
|
|
217
|
+
R(!0);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
T("outlet"), F("outlet");
|
|
221
|
+
},
|
|
222
|
+
toggleSidebar: () => {
|
|
223
|
+
if (!c.current) return;
|
|
224
|
+
if (window.matchMedia("(min-width: 768px)").matches) {
|
|
225
|
+
R(!b.current);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const n = C.current === "sidebar" ? "outlet" : "sidebar";
|
|
229
|
+
T(n), F(n);
|
|
230
|
+
},
|
|
231
|
+
getIsSidebarOpen: () => c.current ? window.matchMedia("(min-width: 768px)").matches ? !b.current : C.current === "sidebar" : !1,
|
|
232
|
+
subscribeToSidebarOpen: (n) => (h.current.add(n), () => {
|
|
233
|
+
h.current.delete(n);
|
|
234
|
+
}),
|
|
235
|
+
setDrawerDragEnabled: (n) => {
|
|
236
|
+
const f = o.current;
|
|
237
|
+
if (f)
|
|
238
|
+
if (n) {
|
|
239
|
+
const w = f.scrollLeft, D = f.style.scrollBehavior;
|
|
240
|
+
f.style.scrollBehavior = "auto", f.classList.remove("disabled-dragopen"), requestAnimationFrame(() => {
|
|
241
|
+
f.scrollLeft = w, requestAnimationFrame(() => {
|
|
242
|
+
f.style.scrollBehavior = D;
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
} else
|
|
246
|
+
f.classList.add("disabled-dragopen");
|
|
247
|
+
},
|
|
248
|
+
setSidebarDragEnabled: (n) => {
|
|
249
|
+
const f = o.current;
|
|
250
|
+
if (f)
|
|
251
|
+
if (n) {
|
|
252
|
+
const w = f.scrollLeft, D = f.style.scrollBehavior;
|
|
253
|
+
f.style.scrollBehavior = "auto", f.classList.remove("disabled-dragopen-sidebar"), requestAnimationFrame(() => {
|
|
254
|
+
f.scrollLeft = w, requestAnimationFrame(() => {
|
|
255
|
+
f.style.scrollBehavior = D;
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
} else
|
|
259
|
+
f.classList.add("disabled-dragopen-sidebar");
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
const Q = W.current, _ = typeof r == "function" ? r(Q) : r, I = ot.toArray(_);
|
|
263
|
+
let q = null, J = null, K = null;
|
|
264
|
+
const G = [];
|
|
265
|
+
let X = null, Z = null;
|
|
266
|
+
I.forEach((n) => {
|
|
267
|
+
if (!ue(n)) {
|
|
268
|
+
G.push(n);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (n.type === Le && !q) {
|
|
272
|
+
q = n;
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (n.type === me && !J) {
|
|
276
|
+
J = n;
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (n.type === pe && !K) {
|
|
280
|
+
K = n;
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
if (n.type === ye && !X) {
|
|
284
|
+
X = n;
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (n.type === ze && !Z) {
|
|
288
|
+
Z = n;
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
G.push(n);
|
|
292
|
+
});
|
|
293
|
+
const xe = !!J, oe = J ?? (G.length ? /* @__PURE__ */ e.jsx(me, { children: G }) : null), ee = xe ? G : [], Y = X ?? (!!X ? /* @__PURE__ */ e.jsx(ye, { children: _ }) : null), le = K ?? (!!K ? /* @__PURE__ */ e.jsx(pe, { children: K }) : null), ie = !!Z, B = Z, we = ne(() => ({
|
|
294
|
+
isCollapsed: x.current,
|
|
295
|
+
isSidebarOpen: !b.current
|
|
296
|
+
}), [x.current, b.current]);
|
|
297
|
+
return /* @__PURE__ */ e.jsx(Ve.Provider, { value: we, children: /* @__PURE__ */ e.jsx(He.Provider, { value: Q, children: /* @__PURE__ */ e.jsxs("div", { ref: o, className: A(
|
|
298
|
+
"w-full h-full overflow-y-hidden",
|
|
299
|
+
ie ? "navigation-drawer-with-sidebar" : "navigation-drawer",
|
|
300
|
+
d?.drawer ? "disabled-dragopen" : "",
|
|
301
|
+
d?.sidebar ? "disabled-dragopen-sidebar" : ""
|
|
302
|
+
), children: [
|
|
303
|
+
/* @__PURE__ */ e.jsxs(
|
|
304
|
+
"div",
|
|
305
|
+
{
|
|
306
|
+
ref: i,
|
|
307
|
+
className: A(
|
|
308
|
+
"bg-neutral-default-default border-r border-neutral-strong-default h-dvh md:h-screen p-4 overflow-hidden drawer flex flex-col gap-4",
|
|
309
|
+
x.current ? "collapsed" : "expanded w-min",
|
|
310
|
+
s
|
|
311
|
+
),
|
|
312
|
+
children: [
|
|
313
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col flex-1 gap-4 overflow-hidden", children: [
|
|
314
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
315
|
+
/* @__PURE__ */ e.jsx(qe, { onToggleCollapse: M }),
|
|
316
|
+
q
|
|
317
|
+
] }),
|
|
318
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-1 overflow-hidden relative flex-col", children: [
|
|
319
|
+
ee,
|
|
320
|
+
oe
|
|
321
|
+
] })
|
|
322
|
+
] }),
|
|
323
|
+
le
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
Y && ue(Y) ? Te.cloneElement(Y, { ref: p }) : Y,
|
|
328
|
+
B && ue(B) ? Te.cloneElement(B, {
|
|
329
|
+
ref: c,
|
|
330
|
+
className: A("sidebar", B.props?.className, l)
|
|
331
|
+
}) : B
|
|
332
|
+
] }) }) });
|
|
333
|
+
}, _e = L(gt), qe = L(({ onToggleCollapse: t }) => /* @__PURE__ */ e.jsx(
|
|
334
|
+
"button",
|
|
335
|
+
{
|
|
336
|
+
type: "button",
|
|
337
|
+
onClick: t,
|
|
338
|
+
className: "collapse-button cursor-pointer text-neutral-default-default hover:text-primary-default transition-colors duration-300 w-max",
|
|
339
|
+
children: /* @__PURE__ */ e.jsx(dt, { size: 32, className: "transition-transform duration-300 p-1" })
|
|
340
|
+
}
|
|
341
|
+
), (t, r) => t.onToggleCollapse === r.onToggleCollapse);
|
|
342
|
+
qe.displayName = "NavigationDrawerCollapseButton";
|
|
343
|
+
const Le = L(({ children: t, className: r, context: s }) => {
|
|
344
|
+
const l = ae(t, s);
|
|
345
|
+
return /* @__PURE__ */ e.jsx("div", { className: A("flex items-center justify-between", r), children: l });
|
|
346
|
+
});
|
|
347
|
+
Le.displayName = "NavigationDrawerHeader";
|
|
348
|
+
const me = L(({ children: t, className: r, context: s, ...l }) => {
|
|
349
|
+
const d = ae(t, s);
|
|
350
|
+
return /* @__PURE__ */ e.jsx("div", { ...l, className: A("w-full flex-1 drawer-content", r), children: d });
|
|
351
|
+
});
|
|
352
|
+
me.displayName = "NavigationDrawerContent";
|
|
353
|
+
const pe = L(({ children: t, className: r, context: s }) => {
|
|
354
|
+
const l = ae(t, s);
|
|
355
|
+
return /* @__PURE__ */ e.jsx("div", { className: A("flex items-center justify-between", r), children: l });
|
|
356
|
+
});
|
|
357
|
+
pe.displayName = "NavigationDrawerFooter";
|
|
358
|
+
const $e = L(({ className: t }) => /* @__PURE__ */ e.jsx("div", { className: A("w-full border-t border-neutral-strong-default ", t) }));
|
|
359
|
+
$e.displayName = "NavigationDrawerSpacer";
|
|
360
|
+
const ye = L(he(({ children: t, className: r, context: s }, l) => {
|
|
361
|
+
const d = ae(t, s);
|
|
362
|
+
return /* @__PURE__ */ e.jsx("div", { ref: l, className: A("flex-1 overflow-auto ", r), children: d });
|
|
363
|
+
}), (t, r) => t.children === r.children && t.className === r.className), U = Object.assign(_e, {
|
|
364
|
+
Root: _e,
|
|
365
|
+
Header: Le,
|
|
366
|
+
Content: me,
|
|
367
|
+
Footer: pe,
|
|
368
|
+
Spacer: $e,
|
|
369
|
+
Outlet: ye,
|
|
370
|
+
Sidebar: ze
|
|
371
|
+
});
|
|
372
|
+
U.displayName = "NavigationDrawer";
|
|
373
|
+
const wt = "hover:bg-neutral-medium-hover", vt = Ae("", {
|
|
374
|
+
variants: {
|
|
375
|
+
isSelected: {
|
|
376
|
+
true: "bg-neutral-medium-selected ",
|
|
377
|
+
false: ""
|
|
378
|
+
},
|
|
379
|
+
disabled: {
|
|
380
|
+
true: "bg-transparent hover:bg-transparent active:bg-transparent focus:bg-transparent",
|
|
381
|
+
false: "cursor-pointer"
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}), Nt = Ae(
|
|
385
|
+
A(
|
|
386
|
+
"select-none line-clamp-1 min-w-max",
|
|
387
|
+
"prometeo-fonts-label-large transition-colors duration-300 ease-out"
|
|
388
|
+
),
|
|
389
|
+
{
|
|
390
|
+
variants: {
|
|
391
|
+
isSelected: {
|
|
392
|
+
true: "text-primary-default-default",
|
|
393
|
+
false: "text-neutral-default-default"
|
|
394
|
+
},
|
|
395
|
+
disabled: {
|
|
396
|
+
true: "text-primary-default-disabled",
|
|
397
|
+
false: "cursor-pointer"
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
compoundVariants: [
|
|
401
|
+
{ isSelected: !0, disabled: !0, className: "text-neutral-strong-disabled hover:text-neutral-strong-disabled focus:text-neutral-strong-disabled active:text-neutral-strong-disabled" },
|
|
402
|
+
{ isSelected: !1, disabled: !0, className: "text-neutral-strong-disabled hover:text-neutral-strong-disabled focus:text-neutral-strong-disabled active:text-neutral-strong-disabled" },
|
|
403
|
+
{ isSelected: !0, disabled: !1, className: " text-primary-default-default group-active:text-neutral-default-pressed group-focus:text-neutral-default-pressed" },
|
|
404
|
+
{ isSelected: !1, disabled: !1, className: " text-neutral-default-default group-active:text-neutral-default-pressed group-focus:text-neutral-default-pressed" }
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
), Re = Ae(
|
|
408
|
+
A(
|
|
409
|
+
"transition-colors duration-300 ease-out min-w-max"
|
|
410
|
+
),
|
|
411
|
+
{
|
|
412
|
+
variants: {
|
|
413
|
+
isSelected: {
|
|
414
|
+
true: "",
|
|
415
|
+
false: ""
|
|
416
|
+
},
|
|
417
|
+
disabled: {
|
|
418
|
+
true: "",
|
|
419
|
+
false: "cursor-pointer"
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
compoundVariants: [
|
|
423
|
+
{ isSelected: !0, disabled: !0, className: "text-neutral-strong-disabled hover:text-neutral-strong-disabled focus:text-neutral-strong-disabled active:text-neutral-strong-disabled" },
|
|
424
|
+
{ isSelected: !1, disabled: !0, className: "text-neutral-strong-disabled hover:text-neutral-strong-disabled focus:text-neutral-strong-disabled active:text-neutral-strong-disabled" },
|
|
425
|
+
{ isSelected: !0, disabled: !1, className: "text-primary-default-default group-active:text-neutral-default-pressed group-focus:text-neutral-default-pressed" },
|
|
426
|
+
{ isSelected: !1, disabled: !1, className: "text-neutral-default-default group-active:text-neutral-default-pressed group-focus:text-neutral-default-pressed" }
|
|
427
|
+
]
|
|
428
|
+
}
|
|
429
|
+
), yt = (t) => {
|
|
430
|
+
const {
|
|
431
|
+
title: r,
|
|
432
|
+
icon: s,
|
|
433
|
+
count: l,
|
|
434
|
+
className: d,
|
|
435
|
+
isSelected: o = !1,
|
|
436
|
+
hasSublinks: i,
|
|
437
|
+
subLinksCollapsed: p,
|
|
438
|
+
onToggleSublinks: c,
|
|
439
|
+
as: x = "div",
|
|
440
|
+
onClick: b,
|
|
441
|
+
onAuxClick: C,
|
|
442
|
+
disabled: u = !1
|
|
443
|
+
} = t, h = (k) => {
|
|
444
|
+
u || b?.(k);
|
|
445
|
+
}, N = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
446
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-center flex-nowrap", children: [
|
|
447
|
+
s && /* @__PURE__ */ e.jsx(s, { size: 24, className: Re({ disabled: u, isSelected: o }) }),
|
|
448
|
+
/* @__PURE__ */ e.jsx("label", { className: Nt({ disabled: u, isSelected: o }), children: r })
|
|
449
|
+
] }),
|
|
450
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 items-center", children: [
|
|
451
|
+
l && l ? /* @__PURE__ */ e.jsx(it, { count: l, maxCount: 9, className: "badge", disabled: u }) : "",
|
|
452
|
+
i && /* @__PURE__ */ e.jsx(
|
|
453
|
+
"div",
|
|
454
|
+
{
|
|
455
|
+
className: A(
|
|
456
|
+
"sublinks-toggle",
|
|
457
|
+
"transition-all duration-200",
|
|
458
|
+
"rounded-full relative grid place-items-center size-6",
|
|
459
|
+
o && "text-primary-default-default",
|
|
460
|
+
`${p ? "-rotate-90" : "rotate-90"}`
|
|
461
|
+
),
|
|
462
|
+
children: /* @__PURE__ */ e.jsx(
|
|
463
|
+
"button",
|
|
464
|
+
{
|
|
465
|
+
disabled: u,
|
|
466
|
+
type: "button",
|
|
467
|
+
onClick: c,
|
|
468
|
+
className: A("absolute cursor-pointer hover:text-primary-default-hover top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 p-2 z-100 select-none", Re({ disabled: u, isSelected: o }), u && "pointer-events-none"),
|
|
469
|
+
children: /* @__PURE__ */ e.jsx(ut, {})
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
}
|
|
473
|
+
)
|
|
474
|
+
] })
|
|
475
|
+
] }), m = A(
|
|
476
|
+
"group navitem",
|
|
477
|
+
"h-12 flex-1 flex items-center p-3 rounded-lg justify-between w-full",
|
|
478
|
+
"transition-all duration-300",
|
|
479
|
+
wt,
|
|
480
|
+
vt({ isSelected: o, disabled: u }),
|
|
481
|
+
d
|
|
482
|
+
);
|
|
483
|
+
if (x === "a") {
|
|
484
|
+
const k = {
|
|
485
|
+
onClick: h,
|
|
486
|
+
onAuxClick: C,
|
|
487
|
+
className: m
|
|
488
|
+
};
|
|
489
|
+
return /* @__PURE__ */ e.jsx("a", { ...k, children: N });
|
|
490
|
+
}
|
|
491
|
+
if (x === "button") {
|
|
492
|
+
const k = {
|
|
493
|
+
onClick: h,
|
|
494
|
+
type: "button",
|
|
495
|
+
className: m
|
|
496
|
+
};
|
|
497
|
+
return /* @__PURE__ */ e.jsx("button", { ...k, children: N });
|
|
498
|
+
}
|
|
499
|
+
const P = {
|
|
500
|
+
onClick: h,
|
|
501
|
+
className: m
|
|
502
|
+
};
|
|
503
|
+
return /* @__PURE__ */ e.jsx("div", { ...P, children: N });
|
|
504
|
+
}, Oe = L(yt);
|
|
505
|
+
Oe.displayName = "NavigationDrawerItemBase";
|
|
506
|
+
const Ct = (t) => {
|
|
507
|
+
const { title: r, icon: s, count: l, className: d, isActive: o, onClick: i, isView: p = !0, disabled: c } = t;
|
|
508
|
+
return p ? /* @__PURE__ */ e.jsx(
|
|
509
|
+
Oe,
|
|
510
|
+
{
|
|
511
|
+
as: "button",
|
|
512
|
+
title: r,
|
|
513
|
+
icon: s,
|
|
514
|
+
count: l,
|
|
515
|
+
className: d,
|
|
516
|
+
isSelected: o,
|
|
517
|
+
onClick: i,
|
|
518
|
+
disabled: c
|
|
519
|
+
}
|
|
520
|
+
) : null;
|
|
521
|
+
}, Je = L(Ct);
|
|
522
|
+
Je.displayName = "NavigationDrawerActionItem";
|
|
523
|
+
const jt = ({ actions: t, activeActionId: r, onActionClick: s, className: l, payload: d }) => /* @__PURE__ */ e.jsx(be, { className: A("flex flex-col gap-2 w-full ", l), scrollbarProps: { hide: !0 }, persistScroll: "navigation-actions", indicators: {
|
|
524
|
+
top: { type: "shadow", behavior: "scroll-on-hover", show: !0 },
|
|
525
|
+
bottom: { type: "shadow", behavior: "scroll-on-hover", show: !0 }
|
|
526
|
+
}, children: t?.map((o) => {
|
|
527
|
+
const { id: i, onClick: p, isView: c = !0, ...x } = o, b = i === r, C = () => {
|
|
528
|
+
s?.(i, d), p?.();
|
|
529
|
+
};
|
|
530
|
+
return c ? /* @__PURE__ */ e.jsx(
|
|
531
|
+
Je,
|
|
532
|
+
{
|
|
533
|
+
...x,
|
|
534
|
+
id: i,
|
|
535
|
+
isActive: b,
|
|
536
|
+
onClick: C
|
|
537
|
+
},
|
|
538
|
+
i
|
|
539
|
+
) : null;
|
|
540
|
+
}) }), Ke = L(jt);
|
|
541
|
+
Ke.displayName = "NavigationDrawerActions";
|
|
542
|
+
const St = (t) => {
|
|
543
|
+
const { className: r, title: s, path: l, onClick: d, isSelected: o, parentPath: i } = t, p = g(() => {
|
|
544
|
+
d?.(l);
|
|
545
|
+
}, [l]), c = g(() => {
|
|
546
|
+
if (l.startsWith("./")) {
|
|
547
|
+
if (!i) return;
|
|
548
|
+
const x = i + l.slice(2);
|
|
549
|
+
window.open(x, "_blank");
|
|
550
|
+
} else
|
|
551
|
+
window.open(l, "_blank");
|
|
552
|
+
}, [l]);
|
|
553
|
+
return /* @__PURE__ */ e.jsx(
|
|
554
|
+
"a",
|
|
555
|
+
{
|
|
556
|
+
onClick: p,
|
|
557
|
+
onAuxClick: c,
|
|
558
|
+
className: A(
|
|
559
|
+
"group",
|
|
560
|
+
"transition-all duration-300 ease-in-out cursor-pointer",
|
|
561
|
+
"h-10 w-full rounded-lg py-[11px] px-3",
|
|
562
|
+
"hover:bg-neutral-medium-hover",
|
|
563
|
+
o && "bg-neutral-medium-selected hover:bg-neutral-medium-hover active:bg-transparent focus:bg-transparent",
|
|
564
|
+
r
|
|
565
|
+
),
|
|
566
|
+
children: /* @__PURE__ */ e.jsx("p", { className: A(
|
|
567
|
+
"prometeo-fonts-label-large text-neutral-medium-default",
|
|
568
|
+
"group-active:text-neutral-default-focused group-focus:text-neutral-default-focused",
|
|
569
|
+
o && "text-primary-default-default group-hover:text-primary-default-hover group-focus:text-primary-default-focused group-active:text-primary-default-focused"
|
|
570
|
+
), children: s })
|
|
571
|
+
}
|
|
572
|
+
);
|
|
573
|
+
}, Ge = L(St);
|
|
574
|
+
Ge.displayName = "NavItemSecondary";
|
|
575
|
+
const kt = he((t, r) => {
|
|
576
|
+
const [s, l] = te(!0), d = O(null), { path: o, title: i, icon: p, count: c, className: x, isSelected: b = !1, onClick: C, sublinks: u, toggleCollapse: h, getIsCollapsed: N, subscribeToCollapse: m, isView: P = !0, disabled: k } = t;
|
|
577
|
+
V(() => m ? m((I) => {
|
|
578
|
+
I && l(!0);
|
|
579
|
+
}) : void 0, [m]);
|
|
580
|
+
const j = g(() => {
|
|
581
|
+
l((_) => !_);
|
|
582
|
+
}, []), R = g((_) => {
|
|
583
|
+
l(_);
|
|
584
|
+
}, []), T = {
|
|
585
|
+
toggle: j,
|
|
586
|
+
setIsCollapsed: R,
|
|
587
|
+
get isCollapsed() {
|
|
588
|
+
return s;
|
|
589
|
+
},
|
|
590
|
+
get isDrawerCollapsed() {
|
|
591
|
+
return N?.() ?? !1;
|
|
592
|
+
},
|
|
593
|
+
toggleDrawerCollapse: h,
|
|
594
|
+
subscribeToCollapse: m
|
|
595
|
+
};
|
|
596
|
+
De(r, () => T, [T, s, N, h]);
|
|
597
|
+
const F = p, H = g(() => {
|
|
598
|
+
const _ = N?.() ?? !1;
|
|
599
|
+
if (u && u.length > 0 && _) {
|
|
600
|
+
R(!1), h?.();
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
C?.(o);
|
|
604
|
+
}, [o, C, u, h, R, N]), M = g(() => {
|
|
605
|
+
window.open(o, "_blank");
|
|
606
|
+
}, [o]), W = () => {
|
|
607
|
+
if (!u || k) return null;
|
|
608
|
+
if (t.subLinksRender && u)
|
|
609
|
+
return t.subLinksRender(u, T);
|
|
610
|
+
const _ = g((I) => {
|
|
611
|
+
if (I.startsWith("./")) {
|
|
612
|
+
const q = o + I.slice(2);
|
|
613
|
+
C?.(q);
|
|
614
|
+
} else
|
|
615
|
+
C?.(I);
|
|
616
|
+
}, [o]);
|
|
617
|
+
return V(() => {
|
|
618
|
+
const I = d.current;
|
|
619
|
+
if (!I) return;
|
|
620
|
+
const q = I.scrollHeight;
|
|
621
|
+
I.style.setProperty("--sublinks-max-height", `${q}px`);
|
|
622
|
+
}, []), /* @__PURE__ */ e.jsx("div", { ref: d, className: `sublinks flex flex-col gap-1 ml-8 ${s ? "collapsed" : "expanded"}`, children: u.map((I) => /* @__PURE__ */ e.jsx(Ge, { ...I, onClick: _, parentPath: o }, `${I.title}-${I.path}`)) });
|
|
623
|
+
}, Q = (_) => {
|
|
624
|
+
_.stopPropagation(), _.preventDefault(), j();
|
|
625
|
+
};
|
|
626
|
+
return P ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
627
|
+
/* @__PURE__ */ e.jsx(
|
|
628
|
+
Oe,
|
|
629
|
+
{
|
|
630
|
+
as: "a",
|
|
631
|
+
title: i,
|
|
632
|
+
icon: F,
|
|
633
|
+
count: c,
|
|
634
|
+
className: x,
|
|
635
|
+
isSelected: b,
|
|
636
|
+
hasSublinks: !!u,
|
|
637
|
+
subLinksCollapsed: s,
|
|
638
|
+
onToggleSublinks: Q,
|
|
639
|
+
onClick: H,
|
|
640
|
+
onAuxClick: M,
|
|
641
|
+
disabled: k
|
|
642
|
+
}
|
|
643
|
+
),
|
|
644
|
+
W()
|
|
645
|
+
] }) : null;
|
|
646
|
+
}), Ye = L(kt);
|
|
647
|
+
Ye.displayName = "NavigationDrawerLinkItem";
|
|
648
|
+
const Dt = ({ navlinks: t, handleNavigation: r, className: s, getIsCollapsed: l, toggleCollapse: d, subscribeToCollapse: o }) => (
|
|
649
|
+
// <div className={cn("flex flex-col gap-2 h-full",className)}>
|
|
650
|
+
/* @__PURE__ */ e.jsx(be, { className: A("flex flex-col gap-2 w-full ", s), scrollbarProps: { hide: !0 }, persistScroll: "navigation-links", indicators: {
|
|
651
|
+
top: { type: "shadow", behavior: "scroll-on-hover", show: !0 },
|
|
652
|
+
bottom: { type: "shadow", behavior: "scroll-on-hover", show: !0 }
|
|
653
|
+
}, children: t?.map((i, p) => {
|
|
654
|
+
const c = i.isSelected || i.path === window.location.pathname || (i.relatedPaths?.some((x) => window.location.pathname.startsWith(x)) ?? !1);
|
|
655
|
+
return /* @__PURE__ */ e.jsx(
|
|
656
|
+
Ye,
|
|
657
|
+
{
|
|
658
|
+
className: "",
|
|
659
|
+
...i,
|
|
660
|
+
isSelected: c,
|
|
661
|
+
onClick: r,
|
|
662
|
+
toggleCollapse: d,
|
|
663
|
+
getIsCollapsed: l,
|
|
664
|
+
subscribeToCollapse: o,
|
|
665
|
+
disabled: i.disabled,
|
|
666
|
+
isView: i.isView
|
|
667
|
+
},
|
|
668
|
+
p
|
|
669
|
+
);
|
|
670
|
+
}) })
|
|
671
|
+
), Qe = L(Dt);
|
|
672
|
+
Qe.displayName = "NavigationDrawerNavlinks";
|
|
673
|
+
const Xe = L(({ navlinks: t, handleNavigation: r, allActions: s, activeActionId: l, onActionClick: d }) => {
|
|
674
|
+
const { getIsCollapsed: o, toggleCollapse: i, subscribeToCollapse: p } = re();
|
|
675
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
676
|
+
/* @__PURE__ */ e.jsx(U.Spacer, { className: "pb-3" }),
|
|
677
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col overflow-hidden h-full gap-4", children: [
|
|
678
|
+
/* @__PURE__ */ e.jsx(
|
|
679
|
+
Qe,
|
|
680
|
+
{
|
|
681
|
+
getIsCollapsed: o,
|
|
682
|
+
toggleCollapse: i,
|
|
683
|
+
subscribeToCollapse: p,
|
|
684
|
+
navlinks: t,
|
|
685
|
+
handleNavigation: r,
|
|
686
|
+
className: "flex flex-1 min-h-[30vh]"
|
|
687
|
+
}
|
|
688
|
+
),
|
|
689
|
+
/* @__PURE__ */ e.jsx(
|
|
690
|
+
Ke,
|
|
691
|
+
{
|
|
692
|
+
actions: s,
|
|
693
|
+
activeActionId: l,
|
|
694
|
+
onActionClick: d,
|
|
695
|
+
className: "max-h-[35vh]"
|
|
696
|
+
}
|
|
697
|
+
)
|
|
698
|
+
] })
|
|
699
|
+
] });
|
|
700
|
+
}, (t, r) => t.navlinks === r.navlinks && t.handleNavigation === r.handleNavigation && t.allActions === r.allActions && t.activeActionId === r.activeActionId && t.onActionClick === r.onActionClick);
|
|
701
|
+
Xe.displayName = "PyrionNavigationDrawer.Content";
|
|
702
|
+
const At = ({ name: t, imageUrl: r, avatarSize: s = "xxs", subImageUrl: l, className: d, mainSlot: o = t, secondarySlot: i }) => {
|
|
703
|
+
const p = g(() => o ? typeof o == "string" ? /* @__PURE__ */ e.jsx("p", { className: "prometeo-fonts-label-large text-neutral-default-default line-clamp-1 select-text", children: o }) : typeof o == "function" ? o() : o : null, [o]), c = g(() => i ? typeof i == "string" ? /* @__PURE__ */ e.jsx("p", { className: "prometeo-fonts-body-small text-neutral-default-default line-clamp-1 whitespace-pre text-ellipsis select-text", children: i }) : typeof i == "function" ? i() : i : null, [i]);
|
|
704
|
+
return /* @__PURE__ */ e.jsxs("div", { className: A("flex items-center gap-2 p-3 rounded-lg max-w-full max-h-full select-none ", d), children: [
|
|
705
|
+
/* @__PURE__ */ e.jsx(
|
|
706
|
+
ft,
|
|
707
|
+
{
|
|
708
|
+
fallbackText: t,
|
|
709
|
+
sizeImage: s,
|
|
710
|
+
sizeFallback: s,
|
|
711
|
+
imageUrl: r,
|
|
712
|
+
subImageUrl: l
|
|
713
|
+
}
|
|
714
|
+
),
|
|
715
|
+
/* @__PURE__ */ e.jsxs("div", { className: A("usercard-content flex flex-col gap-0 flex-1 overflow-hidden w-full transition-all duration-300 ease-in-out ", i && "gap-1"), children: [
|
|
716
|
+
/* @__PURE__ */ e.jsx("div", { className: "w-full", children: p() }),
|
|
717
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex gap-1 justify-between overflow-hidden relative w-full", children: c() })
|
|
718
|
+
] })
|
|
719
|
+
] });
|
|
720
|
+
}, Ie = L(At);
|
|
721
|
+
Ie.displayName = "UserCard";
|
|
722
|
+
const Lt = (t) => {
|
|
723
|
+
const { sessions: r, onSessionClick: s, secondarySlot: l, subImageUrlAccessor: d } = t;
|
|
724
|
+
if (!r || r.length === 0)
|
|
725
|
+
return null;
|
|
726
|
+
const o = (c) => {
|
|
727
|
+
s && s(c);
|
|
728
|
+
}, i = (c) => {
|
|
729
|
+
if (!d)
|
|
730
|
+
return;
|
|
731
|
+
const x = c.metadata;
|
|
732
|
+
if (!x)
|
|
733
|
+
return;
|
|
734
|
+
const b = de({ metadata: x }, d);
|
|
735
|
+
if (b != null)
|
|
736
|
+
return typeof b == "string" ? b : String(b);
|
|
737
|
+
}, p = g((c) => typeof l == "function" ? l(c) : l, [l]);
|
|
738
|
+
return /* @__PURE__ */ e.jsx("div", { className: "w-full h-full flex flex-col gap-2", children: r?.map((c) => {
|
|
739
|
+
const { auth_id: x } = c;
|
|
740
|
+
return /* @__PURE__ */ e.jsx($, { className: " shrink-0 h-max", children: /* @__PURE__ */ e.jsx($.Content, { onClick: () => o(c), className: "p-0 group-data-[expanded=true]/ticketcard:border-none", children: /* @__PURE__ */ e.jsx(
|
|
741
|
+
Ie,
|
|
742
|
+
{
|
|
743
|
+
name: x.name,
|
|
744
|
+
avatarSize: "xxs",
|
|
745
|
+
secondarySlot: p(c),
|
|
746
|
+
subImageUrl: i(c),
|
|
747
|
+
imageUrl: x.profile_picture,
|
|
748
|
+
className: "pyrion-navigation-drawer-user-card"
|
|
749
|
+
},
|
|
750
|
+
c.token
|
|
751
|
+
) }) }, c.token);
|
|
752
|
+
}) });
|
|
753
|
+
}, Ot = ({
|
|
754
|
+
state: t,
|
|
755
|
+
currentAppSessions: r,
|
|
756
|
+
resolveUserSecondarySlot: s,
|
|
757
|
+
resolveSessionSecondarySlot: l,
|
|
758
|
+
onSessionClick: d,
|
|
759
|
+
onLogoutClick: o,
|
|
760
|
+
options: i,
|
|
761
|
+
currentSystemId: p,
|
|
762
|
+
userOptionsControls: c,
|
|
763
|
+
mobileAppSwitcherControls: x
|
|
764
|
+
}) => {
|
|
765
|
+
const { getIsCollapsed: b, toggleCollapse: C, subscribeToCollapse: u } = re(), h = g(() => {
|
|
766
|
+
b() && (C(), c.current?.open());
|
|
767
|
+
}, [b, C, c]);
|
|
768
|
+
return V(() => u((N) => {
|
|
769
|
+
N && (c.current?.close(), x.current?.close());
|
|
770
|
+
}), [u, c, x]), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
771
|
+
/* @__PURE__ */ e.jsx(U.Spacer, { className: "mb-3" }),
|
|
772
|
+
/* @__PURE__ */ e.jsxs($, { className: "", controls: c, children: [
|
|
773
|
+
/* @__PURE__ */ e.jsx($.Content, { onClick: h, children: /* @__PURE__ */ e.jsx(
|
|
774
|
+
Ie,
|
|
775
|
+
{
|
|
776
|
+
className: "pyrion-navigation-drawer-user-card p-0",
|
|
777
|
+
name: t.user.name,
|
|
778
|
+
secondarySlot: s(t.metadata),
|
|
779
|
+
imageUrl: t.user.profile_picture,
|
|
780
|
+
subImageUrl: t.company.icon,
|
|
781
|
+
avatarSize: "xxs"
|
|
782
|
+
}
|
|
783
|
+
) }),
|
|
784
|
+
/* @__PURE__ */ e.jsxs($.Options, { className: "min-h-max flex flex-col gap-3 pl-3 mt-3 pt-2", children: [
|
|
785
|
+
r && r.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
786
|
+
/* @__PURE__ */ e.jsx("p", { className: "prometeo-fonts-label-medium text-neutral-medium-default select-none", children: "Cambiar cuenta" }),
|
|
787
|
+
/* @__PURE__ */ e.jsx(be, { className: "flex flex-col gap-2 max-h-[165px] flex-1", scrollbarProps: { hide: !0 }, children: /* @__PURE__ */ e.jsx(
|
|
788
|
+
Lt,
|
|
789
|
+
{
|
|
790
|
+
sessions: r,
|
|
791
|
+
onSessionClick: d,
|
|
792
|
+
secondarySlot: l,
|
|
793
|
+
subImageUrlAccessor: i?.sessionCardOptions?.subImageUrlAccessor,
|
|
794
|
+
currentSystemId: p
|
|
795
|
+
}
|
|
796
|
+
) })
|
|
797
|
+
] }),
|
|
798
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2", children: o && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
799
|
+
/* @__PURE__ */ e.jsx("span", { className: "border-t border-neutral-strong-default w-full bg-neutral-strong-default" }),
|
|
800
|
+
/* @__PURE__ */ e.jsx(
|
|
801
|
+
fe,
|
|
802
|
+
{
|
|
803
|
+
onClick: o,
|
|
804
|
+
animate: !1,
|
|
805
|
+
animateIcon: !1,
|
|
806
|
+
variant: "text",
|
|
807
|
+
label: "Cerrar sesión",
|
|
808
|
+
icon: /* @__PURE__ */ e.jsx(mt, {}),
|
|
809
|
+
size: "small",
|
|
810
|
+
color: "secondary"
|
|
811
|
+
}
|
|
812
|
+
)
|
|
813
|
+
] }) })
|
|
814
|
+
] })
|
|
815
|
+
] })
|
|
816
|
+
] });
|
|
817
|
+
}, Ze = L(Ot, (t, r) => t.state !== r.state || t.currentAppSessions !== r.currentAppSessions || t.options !== r.options || t.currentSystemId !== r.currentSystemId || t.userOptionsControls !== r.userOptionsControls || t.mobileAppSwitcherControls !== r.mobileAppSwitcherControls);
|
|
818
|
+
Ze.displayName = "PyrionNavigationDrawer.Footer";
|
|
819
|
+
const It = ({ tabs: t, content: r, controls: s }) => /* @__PURE__ */ e.jsxs($, { controls: s, children: [
|
|
820
|
+
/* @__PURE__ */ e.jsx($.Content, { children: typeof r == "function" ? r() : r }),
|
|
821
|
+
/* @__PURE__ */ e.jsxs($.Options, { children: [
|
|
822
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col p-2 pl-4 gap-2", children: [
|
|
823
|
+
/* @__PURE__ */ e.jsx("p", { className: " prometeo-fonts-label-medium text-neutral-medium-default", children: "Cambiar módulo" }),
|
|
824
|
+
/* @__PURE__ */ e.jsx(be, { className: "max-h-52", scrollbarProps: { hide: !0 }, children: t?.map((l) => {
|
|
825
|
+
const d = typeof l.thumbnail == "string" ? /* @__PURE__ */ e.jsx(
|
|
826
|
+
"img",
|
|
827
|
+
{
|
|
828
|
+
src: l.thumbnail,
|
|
829
|
+
alt: l.description,
|
|
830
|
+
className: "size-8 aspect-square rounded",
|
|
831
|
+
draggable: !1
|
|
832
|
+
}
|
|
833
|
+
) : l.thumbnail, o = () => {
|
|
834
|
+
l.disabled || l.onClick && l.onClick(l.name);
|
|
835
|
+
};
|
|
836
|
+
return /* @__PURE__ */ e.jsxs("div", { onClick: o, className: "flex gap-2 p-2 rounded-lg h-12", children: [
|
|
837
|
+
d,
|
|
838
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center h-full justify-center ", children: [
|
|
839
|
+
/* @__PURE__ */ e.jsx("p", { className: "prometeo-fonts-label-large text-neutral-default-default line-clamp-1", children: l.name }),
|
|
840
|
+
l.description && /* @__PURE__ */ e.jsx("p", { className: "prometeo-fonts-body-small text-neutral-medium-default line-clamp-1", children: l.description })
|
|
841
|
+
] })
|
|
842
|
+
] });
|
|
843
|
+
}) })
|
|
844
|
+
] }),
|
|
845
|
+
/* @__PURE__ */ e.jsx("div", {})
|
|
846
|
+
] })
|
|
847
|
+
] }), Ce = L(({ enabled_systems: t, onClick: r, currentSystemId: s }) => {
|
|
848
|
+
const l = g(() => {
|
|
849
|
+
if (t) {
|
|
850
|
+
if (s) {
|
|
851
|
+
const p = t.find((c) => c._id === s);
|
|
852
|
+
if (p) return { coverImage: p.coverImage, thumbnail: p.thumbnail };
|
|
853
|
+
}
|
|
854
|
+
const o = window.location.origin, i = t.find((p) => p.url === o);
|
|
855
|
+
if (i) return { coverImage: i.coverImage, thumbnail: i.thumbnail };
|
|
856
|
+
}
|
|
857
|
+
return { coverImage: "", thumbnail: "" };
|
|
858
|
+
}, [t]), d = !!r;
|
|
859
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
860
|
+
/* @__PURE__ */ e.jsx(
|
|
861
|
+
"img",
|
|
862
|
+
{
|
|
863
|
+
src: l().coverImage,
|
|
864
|
+
alt: "System Logo",
|
|
865
|
+
className: A("w-full h-12 rounded object-contain system-cover-image ", d && "cursor-pointer"),
|
|
866
|
+
draggable: !1,
|
|
867
|
+
onClick: r
|
|
868
|
+
}
|
|
869
|
+
),
|
|
870
|
+
/* @__PURE__ */ e.jsx(
|
|
871
|
+
"img",
|
|
872
|
+
{
|
|
873
|
+
src: l().thumbnail,
|
|
874
|
+
alt: "System Logo",
|
|
875
|
+
className: A("w-12 h-12 rounded object-cover system-thumbnail ", d && "cursor-pointer"),
|
|
876
|
+
draggable: !1,
|
|
877
|
+
onClick: r
|
|
878
|
+
}
|
|
879
|
+
)
|
|
880
|
+
] });
|
|
881
|
+
}, (t, r) => t.enabled_systems === r.enabled_systems && t.onClick === r.onClick && t.currentSystemId === r.currentSystemId);
|
|
882
|
+
Ce.displayName = "PyrionNavigationDrawer.SystemLogo";
|
|
883
|
+
const et = L(({ onSystemLogoClick: t, state: r, currentSystemId: s, tabs: l, mobileAppSwitcherControls: d }) => {
|
|
884
|
+
const { getIsCollapsed: o } = re(), i = Fe(), p = g(() => {
|
|
885
|
+
if (t) {
|
|
886
|
+
const c = o();
|
|
887
|
+
t(c);
|
|
888
|
+
}
|
|
889
|
+
}, [t, o]);
|
|
890
|
+
return i ? /* @__PURE__ */ e.jsx(
|
|
891
|
+
It,
|
|
892
|
+
{
|
|
893
|
+
controls: d,
|
|
894
|
+
tabs: l,
|
|
895
|
+
content: /* @__PURE__ */ e.jsx(
|
|
896
|
+
Ce,
|
|
897
|
+
{
|
|
898
|
+
enabled_systems: r.enabled_systems,
|
|
899
|
+
onClick: p,
|
|
900
|
+
currentSystemId: s
|
|
901
|
+
}
|
|
902
|
+
)
|
|
903
|
+
}
|
|
904
|
+
) : /* @__PURE__ */ e.jsx(
|
|
905
|
+
Ce,
|
|
906
|
+
{
|
|
907
|
+
enabled_systems: r.enabled_systems,
|
|
908
|
+
onClick: p,
|
|
909
|
+
currentSystemId: s
|
|
910
|
+
}
|
|
911
|
+
);
|
|
912
|
+
});
|
|
913
|
+
et.displayName = "PyrionNavigationDrawer.Header";
|
|
914
|
+
const Tt = ({ onCloseClick: t, onMarkAllAsRead: r, notificationsListControls: s }) => {
|
|
915
|
+
const [l, d] = te([]), o = O(/* @__PURE__ */ new Set()), i = g((u, h = "top") => {
|
|
916
|
+
d((N) => {
|
|
917
|
+
const m = Array.isArray(u) ? h === "bottom" ? [...N, ...u] : [...u, ...N] : h === "bottom" ? [...N, u] : [u, ...N];
|
|
918
|
+
return o.current.forEach((P) => P(m, m.length)), m;
|
|
919
|
+
});
|
|
920
|
+
}, []), p = g((u) => (o.current.add(u), () => {
|
|
921
|
+
o.current.delete(u);
|
|
922
|
+
}), []), c = g((u) => {
|
|
923
|
+
d((h) => {
|
|
924
|
+
const N = Array.isArray(u) ? h.filter((m) => !u.includes(m._id)) : h.filter((m) => m._id !== u);
|
|
925
|
+
return o.current.forEach((m) => m(N, N.length)), N;
|
|
926
|
+
});
|
|
927
|
+
}, []), x = g(() => {
|
|
928
|
+
d([]), o.current.forEach((u) => u([], 0));
|
|
929
|
+
}, []), b = g((u) => {
|
|
930
|
+
d(u), o.current.forEach((h) => h(u, u.length));
|
|
931
|
+
}, []);
|
|
932
|
+
De(s, () => ({
|
|
933
|
+
addNewNotification: i,
|
|
934
|
+
subscribeToUpdates: p,
|
|
935
|
+
setNotifications: b,
|
|
936
|
+
removeNotification: c,
|
|
937
|
+
removeAllNotifications: x
|
|
938
|
+
}), [i, p, b, c, x]);
|
|
939
|
+
const C = l.length > 0;
|
|
940
|
+
return /* @__PURE__ */ e.jsxs(
|
|
941
|
+
"section",
|
|
942
|
+
{
|
|
943
|
+
className: "w-full md:w-[479px] bg-neutral-default-default border-l-0 md:border-l border-neutral-strong-default min-h-full",
|
|
944
|
+
children: [
|
|
945
|
+
/* @__PURE__ */ e.jsxs("div", { className: "w-full h-max flex gap-2 items-center justify-between pt-8 pb-2 pr-2 pl-4 border-b border-neutral-strong-default sticky top-0 z-50 bg-neutral-default-default", children: [
|
|
946
|
+
/* @__PURE__ */ e.jsxs("span", { className: "flex gap-2 items-center", children: [
|
|
947
|
+
/* @__PURE__ */ e.jsx(Me, { className: "text-neutral-strong-default", size: 24 }),
|
|
948
|
+
/* @__PURE__ */ e.jsx("p", { className: "prometeo-fonts-headline-small text-neutral-strong-default", children: "Notificaciones" })
|
|
949
|
+
] }),
|
|
950
|
+
/* @__PURE__ */ e.jsx(fe, { onClick: () => t?.(), icon: /* @__PURE__ */ e.jsx(Be, {}), variant: "text", animate: !1, animateIcon: !1, color: "secondary", className: "size-12" })
|
|
951
|
+
] }),
|
|
952
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-3 pb-8 pt-4 px-4", children: [
|
|
953
|
+
r && C && /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ e.jsx(fe, { onClick: r, label: "Marcar todas como leidas", variant: "text", animate: !1, animateIcon: !1, size: "small" }) }),
|
|
954
|
+
C ? l?.map((u, h) => /* @__PURE__ */ e.jsx(pt, { ...u, className: " border-b border-neutral-strong-default rounded-b-none last:border-b-0" }, h)) : /* @__PURE__ */ e.jsx("p", { className: " prometeo-fonts-body-medium text-neutral-default-hover text-center py-8", children: "No hay notificaciones" })
|
|
955
|
+
] })
|
|
956
|
+
]
|
|
957
|
+
}
|
|
958
|
+
);
|
|
959
|
+
}, Et = ({ onCloseClick: t, children: r, title: s = "Ayuda" }) => /* @__PURE__ */ e.jsxs(
|
|
960
|
+
"section",
|
|
961
|
+
{
|
|
962
|
+
className: "w-full md:w-[479px] bg-neutral-default-default border-l-0 md:border-l border-neutral-strong-default h-full",
|
|
963
|
+
children: [
|
|
964
|
+
/* @__PURE__ */ e.jsxs("div", { className: "w-full h-max flex gap-2 items-center justify-between pt-8 pb-2 pr-2 pl-4 border-b border-neutral-strong-default sticky top-0 z-50 bg-neutral-default-default", children: [
|
|
965
|
+
/* @__PURE__ */ e.jsxs("span", { className: "flex gap-2 items-center", children: [
|
|
966
|
+
/* @__PURE__ */ e.jsx(Ue, { className: "text-neutral-strong-default", size: 24 }),
|
|
967
|
+
/* @__PURE__ */ e.jsx("p", { className: "prometeo-fonts-headline-small text-neutral-strong-default", children: s })
|
|
968
|
+
] }),
|
|
969
|
+
/* @__PURE__ */ e.jsx(fe, { onClick: () => t?.(), icon: /* @__PURE__ */ e.jsx(Be, {}), variant: "text", animate: !1, animateIcon: !1, color: "secondary", className: "size-12" })
|
|
970
|
+
] }),
|
|
971
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-3 pb-8 pt-4 px-4", children: r })
|
|
972
|
+
]
|
|
973
|
+
}
|
|
974
|
+
), Pt = ({ closeSidebar: t, options: r, helpSection: s, initialSection: l, notificationsListControls: d }, o) => {
|
|
975
|
+
const [i, p] = te(l ?? "notifications");
|
|
976
|
+
De(o, () => ({
|
|
977
|
+
setActiveSection: p
|
|
978
|
+
}));
|
|
979
|
+
const c = () => {
|
|
980
|
+
t();
|
|
981
|
+
};
|
|
982
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
983
|
+
i === "notifications" && !r?.notificationsDrawerOptions?.hide && /* @__PURE__ */ e.jsx(
|
|
984
|
+
Tt,
|
|
985
|
+
{
|
|
986
|
+
onCloseClick: c,
|
|
987
|
+
onMarkAllAsRead: r?.notificationsDrawerOptions?.onMarkAllAsRead,
|
|
988
|
+
notificationsListControls: d
|
|
989
|
+
}
|
|
990
|
+
),
|
|
991
|
+
i === "help" && s && !r?.helpSectionDrawerOptions?.hide && /* @__PURE__ */ e.jsx(Et, { onCloseClick: c, children: typeof s == "function" ? s() : s })
|
|
992
|
+
] });
|
|
993
|
+
}, tt = he(Pt);
|
|
994
|
+
tt.displayName = "SidebarContent";
|
|
995
|
+
const _t = ({
|
|
996
|
+
options: t,
|
|
997
|
+
helpSection: r,
|
|
998
|
+
sidebarContentRef: s,
|
|
999
|
+
initialSectionRef: l,
|
|
1000
|
+
notificationsListControls: d
|
|
1001
|
+
}) => {
|
|
1002
|
+
const { closeSidebar: o } = re();
|
|
1003
|
+
return /* @__PURE__ */ e.jsx(
|
|
1004
|
+
tt,
|
|
1005
|
+
{
|
|
1006
|
+
ref: s,
|
|
1007
|
+
closeSidebar: o,
|
|
1008
|
+
options: t,
|
|
1009
|
+
helpSection: r,
|
|
1010
|
+
initialSection: l.current,
|
|
1011
|
+
notificationsListControls: d
|
|
1012
|
+
}
|
|
1013
|
+
);
|
|
1014
|
+
}, rt = L(_t);
|
|
1015
|
+
rt.displayName = "PyrionNavigationDrawer.Sidebar";
|
|
1016
|
+
const Rt = ({ navigationControlsRef: t }) => {
|
|
1017
|
+
const r = re();
|
|
1018
|
+
return t.current.toggleCollapse = r.toggleCollapse, t.current.getIsCollapsed = r.getIsCollapsed, t.current.subscribeToCollapse = r.subscribeToCollapse, t.current.openSidebar = r.openSidebar, t.current.closeSidebar = r.closeSidebar, t.current.toggleSidebar = r.toggleSidebar, t.current.getIsSidebarOpen = r.getIsSidebarOpen, t.current.subscribeToSidebarOpen = r.subscribeToSidebarOpen, t.current.setDrawerDragEnabled = r.setDrawerDragEnabled, t.current.setSidebarDragEnabled = r.setSidebarDragEnabled, null;
|
|
1019
|
+
}, Ft = (t) => {
|
|
1020
|
+
const { children: r, currentAppSessions: s, resolveUserSecondarySlot: l, resolveSessionSecondarySlot: d, handleNavigation: o, allActions: i, tabs: p, navigationControlsRef: c, sidebarContentRef: x, initialSectionRef: b, userOptionsControls: C, mobileAppSwitcherControls: u, notificationsListControls: h, outletRef: N, ...m } = t;
|
|
1021
|
+
return /* @__PURE__ */ e.jsxs(U, { disableDragOpen: m.options?.disableDragOpen, children: [
|
|
1022
|
+
/* @__PURE__ */ e.jsx(Rt, { navigationControlsRef: c }),
|
|
1023
|
+
/* @__PURE__ */ e.jsx(U.Header, { className: "flex flex-col relative w-full select-none", children: /* @__PURE__ */ e.jsx(
|
|
1024
|
+
et,
|
|
1025
|
+
{
|
|
1026
|
+
onSystemLogoClick: m.onSystemLogoClick,
|
|
1027
|
+
state: m.state,
|
|
1028
|
+
currentSystemId: m.currentSystemId,
|
|
1029
|
+
tabs: p,
|
|
1030
|
+
mobileAppSwitcherControls: u
|
|
1031
|
+
}
|
|
1032
|
+
) }, "PL-Header"),
|
|
1033
|
+
/* @__PURE__ */ e.jsx(U.Content, { className: "overflow-hidden flex flex-col relative flex-1 w-[285px] md:w-auto", children: /* @__PURE__ */ e.jsx(
|
|
1034
|
+
Xe,
|
|
1035
|
+
{
|
|
1036
|
+
navlinks: m.links,
|
|
1037
|
+
handleNavigation: o,
|
|
1038
|
+
allActions: i,
|
|
1039
|
+
activeActionId: m.activeActionId,
|
|
1040
|
+
onActionClick: m.onActionClick
|
|
1041
|
+
}
|
|
1042
|
+
) }, "PL-Content"),
|
|
1043
|
+
/* @__PURE__ */ e.jsx(U.Footer, { className: "md:min-h-max flex flex-col w-full overflow-hidden max-w-full", children: /* @__PURE__ */ e.jsx(
|
|
1044
|
+
Ze,
|
|
1045
|
+
{
|
|
1046
|
+
state: m.state,
|
|
1047
|
+
currentAppSessions: s,
|
|
1048
|
+
resolveUserSecondarySlot: l,
|
|
1049
|
+
resolveSessionSecondarySlot: d,
|
|
1050
|
+
onSessionClick: m.onSessionClick,
|
|
1051
|
+
onLogoutClick: m.onLogoutClick,
|
|
1052
|
+
options: m.options,
|
|
1053
|
+
currentSystemId: m.currentSystemId,
|
|
1054
|
+
userOptionsControls: C,
|
|
1055
|
+
mobileAppSwitcherControls: u
|
|
1056
|
+
}
|
|
1057
|
+
) }, "PL-Footer"),
|
|
1058
|
+
/* @__PURE__ */ e.jsx(U.Outlet, { ref: N, children: /* @__PURE__ */ e.jsx(st, { children: r }) }),
|
|
1059
|
+
/* @__PURE__ */ e.jsx(
|
|
1060
|
+
U.Sidebar,
|
|
1061
|
+
{
|
|
1062
|
+
className: "bg-neutral-default-default",
|
|
1063
|
+
modal: m.options?.sidebarOptions?.modal,
|
|
1064
|
+
closeOnOverlayClick: m.options?.sidebarOptions?.closeOnOverlayClick,
|
|
1065
|
+
children: /* @__PURE__ */ e.jsx(
|
|
1066
|
+
rt,
|
|
1067
|
+
{
|
|
1068
|
+
options: m.options,
|
|
1069
|
+
helpSection: m.helpSection,
|
|
1070
|
+
sidebarContentRef: x,
|
|
1071
|
+
initialSectionRef: b,
|
|
1072
|
+
notificationsListControls: h
|
|
1073
|
+
}
|
|
1074
|
+
)
|
|
1075
|
+
}
|
|
1076
|
+
)
|
|
1077
|
+
] });
|
|
1078
|
+
}, je = L(Ft, (t, r) => {
|
|
1079
|
+
const { children: s, ...l } = t, { children: d, ...o } = r, i = Object.keys(l), p = Object.keys(o);
|
|
1080
|
+
if (i.length !== p.length)
|
|
1081
|
+
return !1;
|
|
1082
|
+
for (const c of i) {
|
|
1083
|
+
if (!Object.prototype.hasOwnProperty.call(o, c))
|
|
1084
|
+
return !1;
|
|
1085
|
+
const x = l[c], b = o[c];
|
|
1086
|
+
if (x !== b)
|
|
1087
|
+
return !1;
|
|
1088
|
+
}
|
|
1089
|
+
return !0;
|
|
1090
|
+
});
|
|
1091
|
+
je.displayName = "PyrionNavigationDrawer.LayoutBase";
|
|
1092
|
+
const st = L(({ children: t }) => /* @__PURE__ */ e.jsx(U.Outlet, { children: t }));
|
|
1093
|
+
st.displayName = "PyrionNavigationDrawer.IsolatedOutlet";
|
|
1094
|
+
const nt = ke(null), ar = () => {
|
|
1095
|
+
const t = Se(nt);
|
|
1096
|
+
if (!t)
|
|
1097
|
+
throw new Error("usePyrionNavigation debe usarse dentro de PyrionNavigationDrawer");
|
|
1098
|
+
return t;
|
|
1099
|
+
}, or = ({ children: t, helpSection: r, state: s, links: l, onLinkClick: d, onNavigate: o, onLogoutClick: i, actions: p, activeActionId: c, onActionClick: x, tabsProps: b, currentSystemId: C, onSessionClick: u, options: h, onSystemLogoClick: N }) => {
|
|
1100
|
+
const m = lt(), P = Fe(), k = O(null), j = O({}), R = O(null), T = O("notifications"), F = O(null), H = O(null), M = O(null), [W, Q] = te(0), _ = g((a) => {
|
|
1101
|
+
if (d) {
|
|
1102
|
+
d(a);
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
const v = window.location.pathname;
|
|
1106
|
+
m(a), o && o(v, a);
|
|
1107
|
+
}, [d, o, m]), I = (a) => {
|
|
1108
|
+
a && window.open(a, "_blank");
|
|
1109
|
+
}, J = {
|
|
1110
|
+
system: {
|
|
1111
|
+
mobile: I,
|
|
1112
|
+
desktop: (a) => {
|
|
1113
|
+
typeof window < "u" && a && (window.location.href = a);
|
|
1114
|
+
}
|
|
1115
|
+
},
|
|
1116
|
+
product: {
|
|
1117
|
+
mobile: I,
|
|
1118
|
+
desktop: I
|
|
1119
|
+
}
|
|
1120
|
+
}, K = g((a) => {
|
|
1121
|
+
const v = P ? "mobile" : "desktop", S = s.enabled_systems.find((y) => y.name === a)?.url;
|
|
1122
|
+
J.system[v](S), b?.onTabClick?.(a);
|
|
1123
|
+
}, [P, s.enabled_systems, b?.onTabClick]), G = g((a) => {
|
|
1124
|
+
const v = P ? "mobile" : "desktop", S = s.company.products?.find((y) => y.name === a)?.domain;
|
|
1125
|
+
J.product[v](S), b?.onTabClick?.(a);
|
|
1126
|
+
}, [P, s.company.products, b?.onTabClick]), X = g((a, v) => {
|
|
1127
|
+
if (v) {
|
|
1128
|
+
v(a), b?.onTabClick?.(a);
|
|
1129
|
+
return;
|
|
1130
|
+
} else
|
|
1131
|
+
b?.onTabClick?.(a);
|
|
1132
|
+
}, [b?.onTabClick]), Z = g(() => {
|
|
1133
|
+
const a = {};
|
|
1134
|
+
s.enabled_systems.forEach((S) => {
|
|
1135
|
+
a[S.url] = S.name;
|
|
1136
|
+
});
|
|
1137
|
+
const v = window.location.origin;
|
|
1138
|
+
for (const [S, y] of Object.entries(a))
|
|
1139
|
+
if (v === S)
|
|
1140
|
+
return y;
|
|
1141
|
+
return "";
|
|
1142
|
+
}, [s.enabled_systems]), xe = b?.currentTabName || Z(), oe = ne(
|
|
1143
|
+
() => s.sessions || [],
|
|
1144
|
+
[s.sessions]
|
|
1145
|
+
), ee = (a) => a == null ? null : typeof a == "string" || typeof a == "number" || typeof a == "boolean" ? String(a) : ue(a) ? a : typeof a == "object" ? JSON.stringify(a) : null, se = g((a, v) => {
|
|
1146
|
+
if (!a) return null;
|
|
1147
|
+
if (Array.isArray(a)) {
|
|
1148
|
+
const S = a?.[0] ? de(v, a[0]) : null, y = a?.[1] ? de(v, a[1]) : null, z = ee(S), ce = ee(y);
|
|
1149
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1150
|
+
/* @__PURE__ */ e.jsx("p", { className: "prometeo-fonts-body-small text-neutral-default-default line-clamp-1 whitespace-break-spaces min-w-1/2", children: z }),
|
|
1151
|
+
ce && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 flex-1 grow shrink-0 min-w-[40%] overflow-hidden", children: [
|
|
1152
|
+
/* @__PURE__ */ e.jsx("span", { className: "size-0.5 bg-[--neutral-300] rounded-full" }),
|
|
1153
|
+
/* @__PURE__ */ e.jsx("p", { className: "prometeo-fonts-body-small text-neutral-default-default line-clamp-1 whitespace-pre text-ellipsis", children: ce })
|
|
1154
|
+
] })
|
|
1155
|
+
] });
|
|
1156
|
+
}
|
|
1157
|
+
if (typeof a == "string") {
|
|
1158
|
+
const S = de(v, a);
|
|
1159
|
+
return ee(S);
|
|
1160
|
+
}
|
|
1161
|
+
return typeof a == "function" ? ee(a(v)) : null;
|
|
1162
|
+
}, []), Y = g(
|
|
1163
|
+
(a) => {
|
|
1164
|
+
const v = h?.userCardOptions?.secondarySlot;
|
|
1165
|
+
if (!v) return null;
|
|
1166
|
+
const S = s.enabled_systems?.find((z) => z._id === C), y = { company: s.company, user: s.user, system: S, metadata: a };
|
|
1167
|
+
return se(v, y);
|
|
1168
|
+
},
|
|
1169
|
+
[C, h?.userCardOptions?.secondarySlot, se, s.company, s.enabled_systems, s.user]
|
|
1170
|
+
), ge = g(
|
|
1171
|
+
(a) => {
|
|
1172
|
+
const v = h?.sessionCardOptions?.secondarySlot || h?.userCardOptions?.secondarySlot;
|
|
1173
|
+
if (!v) return null;
|
|
1174
|
+
const S = s.enabled_systems?.find((z) => z._id === C), y = { company: s.company, user: a.auth_id, metadata: a?.metadata, system: S };
|
|
1175
|
+
return se(v, y);
|
|
1176
|
+
},
|
|
1177
|
+
[C, h?.sessionCardOptions?.secondarySlot, h?.userCardOptions?.secondarySlot, se, s.company]
|
|
1178
|
+
), le = ne(() => {
|
|
1179
|
+
const a = [];
|
|
1180
|
+
return j.current.openNotifications = () => {
|
|
1181
|
+
T.current = "notifications", j.current.openSidebar?.(), R.current?.setActiveSection("notifications");
|
|
1182
|
+
}, j.current.openHelp = () => {
|
|
1183
|
+
T.current = "help", j.current.openSidebar?.(), R.current?.setActiveSection("help");
|
|
1184
|
+
}, !h?.notificationsDrawerOptions?.hideActionButton && !h?.notificationsDrawerOptions?.hide && a.push({
|
|
1185
|
+
id: "notifications",
|
|
1186
|
+
title: "Notificaciones",
|
|
1187
|
+
icon: Me,
|
|
1188
|
+
onClick: j.current.openNotifications,
|
|
1189
|
+
count: W
|
|
1190
|
+
}), !h?.helpSectionDrawerOptions?.hideActionButton && r && !h?.helpSectionDrawerOptions?.hide && a.push({
|
|
1191
|
+
id: "help",
|
|
1192
|
+
title: "Ayuda",
|
|
1193
|
+
icon: Ue,
|
|
1194
|
+
onClick: j.current.openHelp
|
|
1195
|
+
}), h?.configurationActionOptions?.onClick && !h?.configurationActionOptions?.hideActionButton && a.push({
|
|
1196
|
+
id: "configuration",
|
|
1197
|
+
title: "Configuracion",
|
|
1198
|
+
icon: ht,
|
|
1199
|
+
onClick: h.configurationActionOptions?.onClick
|
|
1200
|
+
}), a;
|
|
1201
|
+
}, [h, r, x, W]), ie = ne(
|
|
1202
|
+
() => [...le, ...p || []],
|
|
1203
|
+
[le, p]
|
|
1204
|
+
), B = ne(() => {
|
|
1205
|
+
const a = s.enabled_systems.map((y) => ({
|
|
1206
|
+
name: y.name,
|
|
1207
|
+
thumbnail: y.thumbnail,
|
|
1208
|
+
onClick: K
|
|
1209
|
+
})) || [], v = b?.customTabs?.map((y) => ({
|
|
1210
|
+
...y,
|
|
1211
|
+
onClick: () => X(y.name, y?.onClick)
|
|
1212
|
+
})) || [], S = s.company.products?.map((y) => ({
|
|
1213
|
+
name: y.name,
|
|
1214
|
+
thumbnail: y.thumbnail,
|
|
1215
|
+
onClick: G
|
|
1216
|
+
})) || [];
|
|
1217
|
+
return [...a, ...v, ...S];
|
|
1218
|
+
}, [s.enabled_systems, s.company.products, b?.customTabs]), we = g((a) => {
|
|
1219
|
+
k.current?.addNewNotification ? k.current.addNewNotification(a) : console.warn("Notifications controls not ready yet");
|
|
1220
|
+
}, []), n = g((a) => k.current?.subscribeToUpdates ? k.current.subscribeToUpdates(a) : (console.warn("Notifications controls not ready yet"), () => {
|
|
1221
|
+
}), []), f = g((a) => {
|
|
1222
|
+
k.current?.removeNotification ? k.current.removeNotification(a) : console.warn("Notifications controls not ready yet");
|
|
1223
|
+
}, []), w = g(() => {
|
|
1224
|
+
k.current?.removeAllNotifications ? k.current.removeAllNotifications() : console.warn("Notifications controls not ready yet");
|
|
1225
|
+
}, []), D = g((a) => {
|
|
1226
|
+
k.current?.setNotifications ? k.current.setNotifications(a) : console.warn("Notifications controls not ready yet");
|
|
1227
|
+
}, []), E = g((a) => {
|
|
1228
|
+
console.log("Show error modal", { disableDrawer: a });
|
|
1229
|
+
const v = /* @__PURE__ */ e.jsx("div", { className: "bg-red-800 rounded fixed z-200 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 h-[40vh] w-[40vw]", children: /* @__PURE__ */ e.jsx("p", { className: "text-red-700", children: "Error occurred" }) });
|
|
1230
|
+
return a ? (console.log(document.body), Ee(v, document.body)) : (console.log(M.current, "outlet ref"), Ee(v, M.current));
|
|
1231
|
+
}, [M]);
|
|
1232
|
+
return j.current.addNewNotification = we, j.current.subscribeToNotificationsUpdates = n, j.current.removeNotification = f, j.current.removeAllNotifications = w, j.current.setNotifications = D, j.current.showErrorModal = E, V(() => {
|
|
1233
|
+
n((a, v) => {
|
|
1234
|
+
Q(v);
|
|
1235
|
+
});
|
|
1236
|
+
}, [n]), /* @__PURE__ */ e.jsx(nt.Provider, { value: j.current, children: P ? /* @__PURE__ */ e.jsx("div", { className: "flex h-screen", children: /* @__PURE__ */ e.jsx(
|
|
1237
|
+
je,
|
|
1238
|
+
{
|
|
1239
|
+
links: l,
|
|
1240
|
+
handleNavigation: _,
|
|
1241
|
+
allActions: ie,
|
|
1242
|
+
activeActionId: c,
|
|
1243
|
+
onActionClick: x,
|
|
1244
|
+
state: s,
|
|
1245
|
+
currentAppSessions: oe,
|
|
1246
|
+
resolveUserSecondarySlot: Y,
|
|
1247
|
+
resolveSessionSecondarySlot: ge,
|
|
1248
|
+
onSessionClick: u,
|
|
1249
|
+
onLogoutClick: i,
|
|
1250
|
+
options: h,
|
|
1251
|
+
currentSystemId: C,
|
|
1252
|
+
userOptionsControls: F,
|
|
1253
|
+
mobileAppSwitcherControls: H,
|
|
1254
|
+
onSystemLogoClick: N,
|
|
1255
|
+
tabs: B,
|
|
1256
|
+
helpSection: r,
|
|
1257
|
+
sidebarContentRef: R,
|
|
1258
|
+
initialSectionRef: T,
|
|
1259
|
+
navigationControlsRef: j,
|
|
1260
|
+
notificationsListControls: k,
|
|
1261
|
+
outletRef: M,
|
|
1262
|
+
children: t
|
|
1263
|
+
}
|
|
1264
|
+
) }) : /* @__PURE__ */ e.jsxs("div", { className: "flex h-screen", children: [
|
|
1265
|
+
B.length > 0 && /* @__PURE__ */ e.jsx(
|
|
1266
|
+
ct,
|
|
1267
|
+
{
|
|
1268
|
+
className: "hidden md:flex",
|
|
1269
|
+
tabs: B,
|
|
1270
|
+
activeColor: "var(--neutral-900)",
|
|
1271
|
+
currentTabName: xe
|
|
1272
|
+
}
|
|
1273
|
+
),
|
|
1274
|
+
/* @__PURE__ */ e.jsx(
|
|
1275
|
+
je,
|
|
1276
|
+
{
|
|
1277
|
+
links: l,
|
|
1278
|
+
handleNavigation: _,
|
|
1279
|
+
allActions: ie,
|
|
1280
|
+
activeActionId: c,
|
|
1281
|
+
onActionClick: x,
|
|
1282
|
+
state: s,
|
|
1283
|
+
currentAppSessions: oe,
|
|
1284
|
+
resolveUserSecondarySlot: Y,
|
|
1285
|
+
resolveSessionSecondarySlot: ge,
|
|
1286
|
+
onSessionClick: u,
|
|
1287
|
+
onLogoutClick: i,
|
|
1288
|
+
options: h,
|
|
1289
|
+
currentSystemId: C,
|
|
1290
|
+
userOptionsControls: F,
|
|
1291
|
+
mobileAppSwitcherControls: H,
|
|
1292
|
+
onSystemLogoClick: N,
|
|
1293
|
+
tabs: B,
|
|
1294
|
+
helpSection: r,
|
|
1295
|
+
sidebarContentRef: R,
|
|
1296
|
+
initialSectionRef: T,
|
|
1297
|
+
navigationControlsRef: j,
|
|
1298
|
+
notificationsListControls: k,
|
|
1299
|
+
outletRef: M,
|
|
1300
|
+
children: t
|
|
1301
|
+
}
|
|
1302
|
+
)
|
|
1303
|
+
] }) });
|
|
1304
|
+
};
|
|
1305
|
+
export {
|
|
1306
|
+
or as default,
|
|
1307
|
+
ar as u
|
|
1308
|
+
};
|