@variamosple/variamos-components 0.0.22 → 0.0.24
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/Components/AuthWrapper/index.js +18 -38
- package/dist/Components/ConfirmationModal/index.d.ts +1 -1
- package/dist/Components/ConfirmationModal/index.js +19 -280
- package/dist/Components/Footer/index.js +6 -6
- package/dist/Components/Header/HeaderOptions.js +16 -16
- package/dist/Components/Header/MenuItem.js +19 -20
- package/dist/Components/Header/SubHeader.js +35 -9
- package/dist/Components/Header/index.js +24 -25
- package/dist/Components/NotAuthorized/index.js +10 -11
- package/dist/Components/Paginator/index.js +56 -128
- package/dist/Components/ProtectedRoute/index.js +10 -10
- package/dist/Context/AnalyticsContext.js +7 -7
- package/dist/Context/MenuContext.js +16 -16
- package/dist/Context/SessionContext.js +44 -44
- package/dist/HOC/WithPageVisit.d.ts +1 -1
- package/dist/HOC/WithPageVisit.js +6 -6
- package/dist/assets/index.css +1 -1
- package/package.json +10 -7
- package/dist/AbstractModalHeader-UzCRSxIO.js +0 -1690
- package/dist/Anchor-DJG5WYYF.js +0 -40
- package/dist/Button-DWo2Fl71.js +0 -78
- package/dist/Button-GQJKgb76.js +0 -33
- package/dist/Container-BLjzOisH.js +0 -22
- package/dist/Nav-CdxSljzW.js +0 -144
- package/dist/NavDropdown-AuV3RgfC.js +0 -1764
- package/dist/NavLink-ebvp1HCw.js +0 -173
- package/dist/SubHeader-gTVD9DIX.js +0 -481
- package/dist/ThemeProvider-Q3gZ4GF2.js +0 -72
- package/dist/jsx-runtime-Drh4NO5G.js +0 -633
- package/dist/useEventCallback-Bfo0-hwZ.js +0 -16
- package/dist/useMergedRefs-BpAaCckn.js +0 -16
- package/dist/useWindow-rGE2GXIv.js +0 -118
|
@@ -1,55 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { jsx as o, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import d, { useEffect as c } from "react";
|
|
3
|
+
import { Spinner as f } from "react-bootstrap";
|
|
4
4
|
import "../../Context/AnalyticsContext.js";
|
|
5
5
|
import "../../Context/MenuContext.js";
|
|
6
|
-
import { useRouter as
|
|
6
|
+
import { useRouter as p } from "../../Context/RouterContext.js";
|
|
7
7
|
import { useSession as l } from "../../Context/SessionContext.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
variant: n,
|
|
12
|
-
animation: i = "border",
|
|
13
|
-
size: c,
|
|
14
|
-
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
|
|
15
|
-
as: r = "div",
|
|
16
|
-
className: s,
|
|
17
|
-
...m
|
|
18
|
-
}, e) => {
|
|
19
|
-
t = g(t, "spinner");
|
|
20
|
-
const o = `${t}-${i}`;
|
|
21
|
-
return /* @__PURE__ */ a.jsx(r, {
|
|
22
|
-
ref: e,
|
|
23
|
-
...m,
|
|
24
|
-
className: w(s, o, c && `${o}-${c}`, n && `text-${n}`)
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
d.displayName = "Spinner";
|
|
28
|
-
const k = ({
|
|
29
|
-
redirectPath: t,
|
|
30
|
-
children: n
|
|
8
|
+
const P = ({
|
|
9
|
+
redirectPath: i,
|
|
10
|
+
children: m
|
|
31
11
|
}) => {
|
|
32
|
-
const [
|
|
33
|
-
return
|
|
34
|
-
if (!
|
|
35
|
-
const e = window.location.href,
|
|
36
|
-
|
|
37
|
-
() =>
|
|
12
|
+
const [a, h] = d.useState(!1), { isAuthenticated: t, isLoading: r } = l(), { navigate: n } = p();
|
|
13
|
+
return c(() => {
|
|
14
|
+
if (!r && !t && !a) {
|
|
15
|
+
const e = window.location.href, s = new URLSearchParams();
|
|
16
|
+
s.set("redirectTo", encodeURIComponent(e)), h(!0), setTimeout(
|
|
17
|
+
() => n(`${i}?${s.toString()}`),
|
|
38
18
|
300
|
|
39
19
|
);
|
|
40
20
|
}
|
|
41
|
-
}, [
|
|
21
|
+
}, [t, r, i, n, a]), c(() => {
|
|
42
22
|
const e = new URL(window.location.href);
|
|
43
23
|
e.searchParams.has("authToken") && (localStorage.setItem("authToken", e.searchParams.get("authToken")), e.searchParams.delete("authToken"), window.history.replaceState({}, "", e));
|
|
44
|
-
}, []),
|
|
45
|
-
|
|
24
|
+
}, []), r || !t ? /* @__PURE__ */ o("div", { className: "d-flex justify-content-center align-items-center w-100 h-100", children: /* @__PURE__ */ o(
|
|
25
|
+
f,
|
|
46
26
|
{
|
|
47
27
|
animation: "border",
|
|
48
28
|
variant: "primary",
|
|
49
29
|
style: { width: "3rem", height: "3rem", borderWidth: "0.5rem" }
|
|
50
30
|
}
|
|
51
|
-
) }) : /* @__PURE__ */
|
|
31
|
+
) }) : /* @__PURE__ */ o(u, { children: m });
|
|
52
32
|
};
|
|
53
33
|
export {
|
|
54
|
-
|
|
34
|
+
P as AuthWrapper
|
|
55
35
|
};
|
|
@@ -9,4 +9,4 @@ export interface ConfirmationModalProps {
|
|
|
9
9
|
cancelButtonVariant?: string;
|
|
10
10
|
}
|
|
11
11
|
export declare const confirmationModalDefaultProps: ConfirmationModalProps;
|
|
12
|
-
export default function ConfirmationModal({ show, onCancel, onConfirm, message, confirmLabel, confirmButtonVariant, cancelButtonVariant, cancelLabel, }: ConfirmationModalProps): import("react
|
|
12
|
+
export default function ConfirmationModal({ show, onCancel, onConfirm, message, confirmLabel, confirmButtonVariant, cancelButtonVariant, cancelLabel, }: ConfirmationModalProps): import("react").JSX.Element;
|
|
@@ -1,267 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import * as u from "react";
|
|
5
|
-
import { useRef as N, useEffect as Oe, useState as E, useMemo as be, useCallback as Ie } from "react";
|
|
6
|
-
import { A as Ue, d as He, M as ze, B as Le, F as X, g as We, t as _e } from "../../AbstractModalHeader-UzCRSxIO.js";
|
|
7
|
-
import { B as J } from "../../Button-GQJKgb76.js";
|
|
8
|
-
function Ke(e) {
|
|
9
|
-
const t = N(e);
|
|
10
|
-
return t.current = e, t;
|
|
11
|
-
}
|
|
12
|
-
function qe(e) {
|
|
13
|
-
const t = Ke(e);
|
|
14
|
-
Oe(() => () => t.current(), []);
|
|
15
|
-
}
|
|
16
|
-
var R;
|
|
17
|
-
function Q(e) {
|
|
18
|
-
if ((!R && R !== 0 || e) && V) {
|
|
19
|
-
var t = document.createElement("div");
|
|
20
|
-
t.style.position = "absolute", t.style.top = "-9999px", t.style.width = "50px", t.style.height = "50px", t.style.overflow = "scroll", document.body.appendChild(t), R = t.offsetWidth - t.clientWidth, document.body.removeChild(t);
|
|
21
|
-
}
|
|
22
|
-
return R;
|
|
23
|
-
}
|
|
24
|
-
function Ge() {
|
|
25
|
-
return E(null);
|
|
26
|
-
}
|
|
27
|
-
const Y = /* @__PURE__ */ u.forwardRef(({
|
|
28
|
-
className: e,
|
|
29
|
-
bsPrefix: t,
|
|
30
|
-
as: r = "div",
|
|
31
|
-
...s
|
|
32
|
-
}, o) => (t = c(t, "modal-body"), /* @__PURE__ */ n.jsx(r, {
|
|
33
|
-
ref: o,
|
|
34
|
-
className: d(e, t),
|
|
35
|
-
...s
|
|
36
|
-
})));
|
|
37
|
-
Y.displayName = "ModalBody";
|
|
38
|
-
const A = /* @__PURE__ */ u.forwardRef(({
|
|
39
|
-
bsPrefix: e,
|
|
40
|
-
className: t,
|
|
41
|
-
contentClassName: r,
|
|
42
|
-
centered: s,
|
|
43
|
-
size: o,
|
|
44
|
-
fullscreen: l,
|
|
45
|
-
children: f,
|
|
46
|
-
scrollable: m,
|
|
47
|
-
...j
|
|
48
|
-
}, C) => {
|
|
49
|
-
e = c(e, "modal");
|
|
50
|
-
const g = `${e}-dialog`, S = typeof l == "string" ? `${e}-fullscreen-${l}` : `${e}-fullscreen`;
|
|
51
|
-
return /* @__PURE__ */ n.jsx("div", {
|
|
52
|
-
...j,
|
|
53
|
-
ref: C,
|
|
54
|
-
className: d(g, t, o && `${e}-${o}`, s && `${g}-centered`, m && `${g}-scrollable`, l && S),
|
|
55
|
-
children: /* @__PURE__ */ n.jsx("div", {
|
|
56
|
-
className: d(`${e}-content`, r),
|
|
57
|
-
children: f
|
|
58
|
-
})
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
A.displayName = "ModalDialog";
|
|
62
|
-
const Z = /* @__PURE__ */ u.forwardRef(({
|
|
63
|
-
className: e,
|
|
64
|
-
bsPrefix: t,
|
|
65
|
-
as: r = "div",
|
|
66
|
-
...s
|
|
67
|
-
}, o) => (t = c(t, "modal-footer"), /* @__PURE__ */ n.jsx(r, {
|
|
68
|
-
ref: o,
|
|
69
|
-
className: d(e, t),
|
|
70
|
-
...s
|
|
71
|
-
})));
|
|
72
|
-
Z.displayName = "ModalFooter";
|
|
73
|
-
const P = /* @__PURE__ */ u.forwardRef(({
|
|
74
|
-
bsPrefix: e,
|
|
75
|
-
className: t,
|
|
76
|
-
closeLabel: r = "Close",
|
|
77
|
-
closeButton: s = !1,
|
|
78
|
-
...o
|
|
79
|
-
}, l) => (e = c(e, "modal-header"), /* @__PURE__ */ n.jsx(Ue, {
|
|
80
|
-
ref: l,
|
|
81
|
-
...o,
|
|
82
|
-
className: d(t, e),
|
|
83
|
-
closeLabel: r,
|
|
84
|
-
closeButton: s
|
|
85
|
-
})));
|
|
86
|
-
P.displayName = "ModalHeader";
|
|
87
|
-
const Je = He("h4"), ee = /* @__PURE__ */ u.forwardRef(({
|
|
88
|
-
className: e,
|
|
89
|
-
bsPrefix: t,
|
|
90
|
-
as: r = Je,
|
|
91
|
-
...s
|
|
92
|
-
}, o) => (t = c(t, "modal-title"), /* @__PURE__ */ n.jsx(r, {
|
|
93
|
-
ref: o,
|
|
94
|
-
className: d(e, t),
|
|
95
|
-
...s
|
|
96
|
-
})));
|
|
97
|
-
ee.displayName = "ModalTitle";
|
|
98
|
-
function Qe(e) {
|
|
99
|
-
return /* @__PURE__ */ n.jsx(X, {
|
|
100
|
-
...e,
|
|
101
|
-
timeout: null
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
function Ve(e) {
|
|
105
|
-
return /* @__PURE__ */ n.jsx(X, {
|
|
106
|
-
...e,
|
|
107
|
-
timeout: null
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
const te = /* @__PURE__ */ u.forwardRef(({
|
|
111
|
-
bsPrefix: e,
|
|
112
|
-
className: t,
|
|
113
|
-
style: r,
|
|
114
|
-
dialogClassName: s,
|
|
115
|
-
contentClassName: o,
|
|
116
|
-
children: l,
|
|
117
|
-
dialogAs: f = A,
|
|
118
|
-
"data-bs-theme": m,
|
|
119
|
-
"aria-labelledby": j,
|
|
120
|
-
"aria-describedby": C,
|
|
121
|
-
"aria-label": g,
|
|
122
|
-
/* BaseModal props */
|
|
123
|
-
show: S = !1,
|
|
124
|
-
animation: h = !0,
|
|
125
|
-
backdrop: M = !0,
|
|
126
|
-
keyboard: ae = !0,
|
|
127
|
-
onEscapeKeyDown: $,
|
|
128
|
-
onShow: ne,
|
|
129
|
-
onHide: w,
|
|
130
|
-
container: oe,
|
|
131
|
-
autoFocus: re = !0,
|
|
132
|
-
enforceFocus: se = !0,
|
|
133
|
-
restoreFocus: le = !0,
|
|
134
|
-
restoreFocusOptions: de,
|
|
135
|
-
onEntered: ie,
|
|
136
|
-
onExit: x,
|
|
137
|
-
onExiting: ce,
|
|
138
|
-
onEnter: D,
|
|
139
|
-
onEntering: F,
|
|
140
|
-
onExited: O,
|
|
141
|
-
backdropClassName: b,
|
|
142
|
-
manager: I,
|
|
143
|
-
...ue
|
|
144
|
-
}, fe) => {
|
|
145
|
-
const [me, ge] = E({}), [he, U] = E(!1), v = N(!1), B = N(!1), p = N(null), [y, pe] = Ge(), ye = xe(fe, pe), H = q(w), Me = $e();
|
|
146
|
-
e = c(e, "modal");
|
|
147
|
-
const we = be(() => ({
|
|
148
|
-
onHide: H
|
|
149
|
-
}), [H]);
|
|
150
|
-
function z() {
|
|
151
|
-
return I || We({
|
|
152
|
-
isRTL: Me
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
function L(a) {
|
|
156
|
-
if (!V) return;
|
|
157
|
-
const i = z().getScrollbarWidth() > 0, K = a.scrollHeight > Fe(a).documentElement.clientHeight;
|
|
158
|
-
ge({
|
|
159
|
-
paddingRight: i && !K ? Q() : void 0,
|
|
160
|
-
paddingLeft: !i && K ? Q() : void 0
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
const T = q(() => {
|
|
164
|
-
y && L(y.dialog);
|
|
165
|
-
});
|
|
166
|
-
qe(() => {
|
|
167
|
-
G(window, "resize", T), p.current == null || p.current();
|
|
168
|
-
});
|
|
169
|
-
const Re = () => {
|
|
170
|
-
v.current = !0;
|
|
171
|
-
}, Ne = (a) => {
|
|
172
|
-
v.current && y && a.target === y.dialog && (B.current = !0), v.current = !1;
|
|
173
|
-
}, W = () => {
|
|
174
|
-
U(!0), p.current = _e(y.dialog, () => {
|
|
175
|
-
U(!1);
|
|
176
|
-
});
|
|
177
|
-
}, je = (a) => {
|
|
178
|
-
a.target === a.currentTarget && W();
|
|
179
|
-
}, Ce = (a) => {
|
|
180
|
-
if (M === "static") {
|
|
181
|
-
je(a);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
if (B.current || a.target !== a.currentTarget) {
|
|
185
|
-
B.current = !1;
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
w == null || w();
|
|
189
|
-
}, Se = (a) => {
|
|
190
|
-
ae ? $ == null || $(a) : (a.preventDefault(), M === "static" && W());
|
|
191
|
-
}, ve = (a, i) => {
|
|
192
|
-
a && L(a), D == null || D(a, i);
|
|
193
|
-
}, Be = (a) => {
|
|
194
|
-
p.current == null || p.current(), x == null || x(a);
|
|
195
|
-
}, Te = (a, i) => {
|
|
196
|
-
F == null || F(a, i), De(window, "resize", T);
|
|
197
|
-
}, ke = (a) => {
|
|
198
|
-
a && (a.style.display = ""), O == null || O(a), G(window, "resize", T);
|
|
199
|
-
}, Ee = Ie((a) => /* @__PURE__ */ n.jsx("div", {
|
|
200
|
-
...a,
|
|
201
|
-
className: d(`${e}-backdrop`, b, !h && "show")
|
|
202
|
-
}), [h, b, e]), _ = {
|
|
203
|
-
...r,
|
|
204
|
-
...me
|
|
205
|
-
};
|
|
206
|
-
_.display = "block";
|
|
207
|
-
const Ae = (a) => /* @__PURE__ */ n.jsx("div", {
|
|
208
|
-
role: "dialog",
|
|
209
|
-
...a,
|
|
210
|
-
style: _,
|
|
211
|
-
className: d(t, e, he && `${e}-static`, !h && "show"),
|
|
212
|
-
onClick: M ? Ce : void 0,
|
|
213
|
-
onMouseUp: Ne,
|
|
214
|
-
"data-bs-theme": m,
|
|
215
|
-
"aria-label": g,
|
|
216
|
-
"aria-labelledby": j,
|
|
217
|
-
"aria-describedby": C,
|
|
218
|
-
children: /* @__PURE__ */ n.jsx(f, {
|
|
219
|
-
...ue,
|
|
220
|
-
onMouseDown: Re,
|
|
221
|
-
className: s,
|
|
222
|
-
contentClassName: o,
|
|
223
|
-
children: l
|
|
224
|
-
})
|
|
225
|
-
});
|
|
226
|
-
return /* @__PURE__ */ n.jsx(ze.Provider, {
|
|
227
|
-
value: we,
|
|
228
|
-
children: /* @__PURE__ */ n.jsx(Le, {
|
|
229
|
-
show: S,
|
|
230
|
-
ref: ye,
|
|
231
|
-
backdrop: M,
|
|
232
|
-
container: oe,
|
|
233
|
-
keyboard: !0,
|
|
234
|
-
autoFocus: re,
|
|
235
|
-
enforceFocus: se,
|
|
236
|
-
restoreFocus: le,
|
|
237
|
-
restoreFocusOptions: de,
|
|
238
|
-
onEscapeKeyDown: Se,
|
|
239
|
-
onShow: ne,
|
|
240
|
-
onHide: w,
|
|
241
|
-
onEnter: ve,
|
|
242
|
-
onEntering: Te,
|
|
243
|
-
onEntered: ie,
|
|
244
|
-
onExit: Be,
|
|
245
|
-
onExiting: ce,
|
|
246
|
-
onExited: ke,
|
|
247
|
-
manager: z(),
|
|
248
|
-
transition: h ? Qe : void 0,
|
|
249
|
-
backdropTransition: h ? Ve : void 0,
|
|
250
|
-
renderBackdrop: Ee,
|
|
251
|
-
renderDialog: Ae
|
|
252
|
-
})
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
te.displayName = "Modal";
|
|
256
|
-
const k = Object.assign(te, {
|
|
257
|
-
Body: Y,
|
|
258
|
-
Header: P,
|
|
259
|
-
Title: ee,
|
|
260
|
-
Footer: Z,
|
|
261
|
-
Dialog: A,
|
|
262
|
-
TRANSITION_DURATION: 300,
|
|
263
|
-
BACKDROP_TRANSITION_DURATION: 150
|
|
264
|
-
}), at = Object.freeze({
|
|
1
|
+
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Modal as n, Button as i } from "react-bootstrap";
|
|
3
|
+
const p = Object.freeze({
|
|
265
4
|
message: "",
|
|
266
5
|
show: !1,
|
|
267
6
|
onCancel: () => {
|
|
@@ -269,25 +8,25 @@ const k = Object.assign(te, {
|
|
|
269
8
|
onConfirm: () => {
|
|
270
9
|
}
|
|
271
10
|
});
|
|
272
|
-
function
|
|
273
|
-
show:
|
|
274
|
-
onCancel:
|
|
275
|
-
onConfirm:
|
|
276
|
-
message:
|
|
277
|
-
confirmLabel:
|
|
278
|
-
confirmButtonVariant:
|
|
279
|
-
cancelButtonVariant:
|
|
280
|
-
cancelLabel:
|
|
11
|
+
function u({
|
|
12
|
+
show: a,
|
|
13
|
+
onCancel: r,
|
|
14
|
+
onConfirm: t,
|
|
15
|
+
message: c,
|
|
16
|
+
confirmLabel: l = "Accept",
|
|
17
|
+
confirmButtonVariant: d = "primary",
|
|
18
|
+
cancelButtonVariant: s = "secondary",
|
|
19
|
+
cancelLabel: f = "Cancel"
|
|
281
20
|
}) {
|
|
282
|
-
return /* @__PURE__ */ n
|
|
283
|
-
/* @__PURE__ */ n.
|
|
284
|
-
/* @__PURE__ */ n.
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
/* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ e(n, { show: a, onHide: r, children: [
|
|
22
|
+
/* @__PURE__ */ o(n.Body, { children: c }),
|
|
23
|
+
/* @__PURE__ */ e(n.Footer, { children: [
|
|
24
|
+
/* @__PURE__ */ o(i, { variant: s, onClick: r, children: f }),
|
|
25
|
+
/* @__PURE__ */ o(i, { variant: d, onClick: t, children: l })
|
|
287
26
|
] })
|
|
288
27
|
] });
|
|
289
28
|
}
|
|
290
29
|
export {
|
|
291
|
-
|
|
292
|
-
|
|
30
|
+
p as confirmationModalDefaultProps,
|
|
31
|
+
u as default
|
|
293
32
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../../assets/index.css';const
|
|
3
|
-
footer:
|
|
4
|
-
},
|
|
1
|
+
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/index.css';const e = "_footer_cvhpi_1", s = {
|
|
3
|
+
footer: e
|
|
4
|
+
}, i = ({ version: o = "" }) => /* @__PURE__ */ r("footer", { className: `container-fluid ${s.footer}`, children: /* @__PURE__ */ r("div", { className: "row copyright", children: /* @__PURE__ */ t("p", { className: "mb-0", children: [
|
|
5
5
|
"©",
|
|
6
6
|
" Copyright 2023 VariaMos.",
|
|
7
|
-
|
|
7
|
+
o && ` ${o}`
|
|
8
8
|
] }) }) });
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
i as Footer
|
|
11
11
|
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as w, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as p } from "react";
|
|
3
|
+
import { NavDropdown as a } from "react-bootstrap";
|
|
3
4
|
import "../../Context/AnalyticsContext.js";
|
|
4
|
-
import { useMenu as
|
|
5
|
-
import { useRouter as
|
|
6
|
-
import { useSession as
|
|
7
|
-
import { mapToWebTarget as
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const { user: o, isAuthenticated: d, logout: g } = j(), { options: t } = w(), { navigate: m } = x(), l = p(() => {
|
|
5
|
+
import { useMenu as v } from "../../Context/MenuContext.js";
|
|
6
|
+
import { useRouter as R } from "../../Context/RouterContext.js";
|
|
7
|
+
import { useSession as x } from "../../Context/SessionContext.js";
|
|
8
|
+
import { mapToWebTarget as P } from "../../Model/Router.js";
|
|
9
|
+
const N = () => {
|
|
10
|
+
const { user: o, isAuthenticated: d, logout: g } = x(), { options: t } = v(), { navigate: m } = R(), l = p(() => {
|
|
11
11
|
const i = (o == null ? void 0 : o.permissions) || [], h = (o == null ? void 0 : o.roles) || [];
|
|
12
12
|
return t != null && t.length ? t.filter((r) => {
|
|
13
13
|
var n, f;
|
|
14
14
|
if (!((n = r == null ? void 0 : r.allowedPermissions) != null && n.length) && !((f = r == null ? void 0 : r.allowedRoles) != null && f.length))
|
|
15
15
|
return !0;
|
|
16
16
|
let e = !0;
|
|
17
|
-
return r.allowedRoles && (e = e && r.allowedRoles.some((
|
|
18
|
-
(
|
|
17
|
+
return r.allowedRoles && (e = e && r.allowedRoles.some((s) => h.includes(s))), r.allowedPermissions && (e = e && r.allowedPermissions.some(
|
|
18
|
+
(s) => i.includes(s)
|
|
19
19
|
)), e;
|
|
20
20
|
}) : [];
|
|
21
21
|
}, [t, o]);
|
|
22
|
-
return !(l != null && l.length) && !d ? null : /* @__PURE__ */
|
|
23
|
-
l == null ? void 0 : l.map((i) => /* @__PURE__ */
|
|
22
|
+
return !(l != null && l.length) && !d ? null : /* @__PURE__ */ w(a, { title: (o == null ? void 0 : o.name) || "Options", id: "nav-dropdown", children: [
|
|
23
|
+
l == null ? void 0 : l.map((i) => /* @__PURE__ */ c(
|
|
24
24
|
a.Item,
|
|
25
25
|
{
|
|
26
26
|
onClick: () => m(i.location, {
|
|
27
|
-
target:
|
|
27
|
+
target: P(i.target)
|
|
28
28
|
}),
|
|
29
29
|
children: i.title
|
|
30
30
|
},
|
|
31
31
|
i.title
|
|
32
32
|
)),
|
|
33
|
-
d && !!(l != null && l.length) && /* @__PURE__ */
|
|
34
|
-
d && /* @__PURE__ */
|
|
33
|
+
d && !!(l != null && l.length) && /* @__PURE__ */ c(a.Divider, {}),
|
|
34
|
+
d && /* @__PURE__ */ c(a.Item, { onClick: g, children: "Logout" })
|
|
35
35
|
] });
|
|
36
36
|
};
|
|
37
37
|
export {
|
|
38
|
-
|
|
38
|
+
N as HeaderOptions
|
|
39
39
|
};
|
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useMemo as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as h } from "react";
|
|
3
|
+
import { Nav as v, NavDropdown as d } from "react-bootstrap";
|
|
3
4
|
import "../../Context/AnalyticsContext.js";
|
|
4
5
|
import "../../Context/MenuContext.js";
|
|
5
|
-
import { useRouter as
|
|
6
|
-
import { useSession as
|
|
6
|
+
import { useRouter as C } from "../../Context/RouterContext.js";
|
|
7
|
+
import { useSession as N } from "../../Context/SessionContext.js";
|
|
7
8
|
import { mapToWebTarget as m } from "../../Model/Router.js";
|
|
8
|
-
import { N as h } from "../../Nav-CdxSljzW.js";
|
|
9
|
-
import { N as d } from "../../NavDropdown-AuV3RgfC.js";
|
|
10
9
|
const y = ({
|
|
11
10
|
title: e,
|
|
12
11
|
type: w,
|
|
13
12
|
location: g,
|
|
14
|
-
target:
|
|
15
|
-
children:
|
|
13
|
+
target: k,
|
|
14
|
+
children: t
|
|
16
15
|
}) => {
|
|
17
|
-
const { user: r } =
|
|
18
|
-
const i = (r == null ? void 0 : r.permissions) || [],
|
|
19
|
-
return
|
|
16
|
+
const { user: r } = N(), { navigate: p } = C(), a = h(() => {
|
|
17
|
+
const i = (r == null ? void 0 : r.permissions) || [], R = (r == null ? void 0 : r.roles) || [];
|
|
18
|
+
return t ? t.filter((o) => {
|
|
20
19
|
var c, f;
|
|
21
20
|
if (!((c = o == null ? void 0 : o.allowedPermissions) != null && c.length) && !((f = o == null ? void 0 : o.allowedRoles) != null && f.length))
|
|
22
21
|
return !0;
|
|
23
|
-
let
|
|
24
|
-
return o.allowedRoles && (
|
|
25
|
-
(
|
|
26
|
-
)),
|
|
22
|
+
let l = !0;
|
|
23
|
+
return o.allowedRoles && (l = l && o.allowedRoles.some((n) => R.includes(n))), o.allowedPermissions && (l = l && o.allowedPermissions.some(
|
|
24
|
+
(n) => i.includes(n)
|
|
25
|
+
)), l;
|
|
27
26
|
}) : [];
|
|
28
|
-
}, [
|
|
29
|
-
return w === "location" ? /* @__PURE__ */
|
|
30
|
-
|
|
27
|
+
}, [t, r]);
|
|
28
|
+
return w === "location" ? /* @__PURE__ */ s(
|
|
29
|
+
v.Link,
|
|
31
30
|
{
|
|
32
31
|
as: "button",
|
|
33
32
|
className: "btn btn-link",
|
|
34
|
-
onClick: () => p(g, { target: m(
|
|
33
|
+
onClick: () => p(g, { target: m(k) }),
|
|
35
34
|
children: e
|
|
36
35
|
}
|
|
37
|
-
) : /* @__PURE__ */
|
|
36
|
+
) : /* @__PURE__ */ s(d, { title: e, children: a == null ? void 0 : a.map((i) => /* @__PURE__ */ s(
|
|
38
37
|
d.Item,
|
|
39
38
|
{
|
|
40
39
|
as: "button",
|
|
@@ -1,12 +1,38 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "react";
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as w } from "react";
|
|
3
|
+
import { Navbar as h, Container as g, Nav as d } from "react-bootstrap";
|
|
3
4
|
import "../../Context/AnalyticsContext.js";
|
|
4
|
-
import "../../Context/MenuContext.js";
|
|
5
|
-
import "../../Context/RouterContext.js";
|
|
6
|
-
import "../../Context/SessionContext.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { useMenu as N } from "../../Context/MenuContext.js";
|
|
6
|
+
import { useRouter as v } from "../../Context/RouterContext.js";
|
|
7
|
+
import { useSession as R } from "../../Context/SessionContext.js";
|
|
8
|
+
const H = () => {
|
|
9
|
+
const { navigate: f } = v(), { subMenu: n } = N(), { user: r } = R(), t = w(() => {
|
|
10
|
+
const l = (r == null ? void 0 : r.roles) || [], m = (r == null ? void 0 : r.permissions) || [];
|
|
11
|
+
return n ? n.filter((o) => {
|
|
12
|
+
var a, c;
|
|
13
|
+
if (!((a = o == null ? void 0 : o.allowedRoles) != null && a.length) && !((c = o == null ? void 0 : o.allowedPermissions) != null && c.length))
|
|
14
|
+
return !0;
|
|
15
|
+
let i = !0;
|
|
16
|
+
return o.allowedRoles && (i = i && o.allowedRoles.some(
|
|
17
|
+
(e) => l.includes(e)
|
|
18
|
+
)), o.allowedPermissions && (i = i && o.allowedPermissions.some(
|
|
19
|
+
(e) => m.includes(e)
|
|
20
|
+
)), i;
|
|
21
|
+
}) : [];
|
|
22
|
+
}, [n, r]), p = (l) => () => {
|
|
23
|
+
f(l);
|
|
24
|
+
};
|
|
25
|
+
return t.length ? /* @__PURE__ */ s(h, { className: "py-1 shadow-sm bg-white", children: /* @__PURE__ */ s(g, { children: /* @__PURE__ */ s(d, { className: "d-flex justify-content-center w-100 gap-3", children: t.map((l) => /* @__PURE__ */ s(
|
|
26
|
+
d.Link,
|
|
27
|
+
{
|
|
28
|
+
as: "button",
|
|
29
|
+
className: "btn btn-link p-0",
|
|
30
|
+
onClick: p(l.location),
|
|
31
|
+
children: l.title
|
|
32
|
+
},
|
|
33
|
+
l.location
|
|
34
|
+
)) }) }) }) : null;
|
|
35
|
+
};
|
|
10
36
|
export {
|
|
11
|
-
|
|
37
|
+
H as SubHeader
|
|
12
38
|
};
|
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Navbar as t, Container as u, Nav as i } from "react-bootstrap";
|
|
2
3
|
import "../../Context/AnalyticsContext.js";
|
|
3
|
-
import { useMenu as
|
|
4
|
-
import { useRouter as
|
|
5
|
-
import { useSession as
|
|
6
|
-
import { HeaderOptions as
|
|
7
|
-
import { MenuItemComponent as
|
|
8
|
-
import {
|
|
9
|
-
import { C as h } from "../../Container-BLjzOisH.js";
|
|
10
|
-
import { N as t } from "../../Nav-CdxSljzW.js";
|
|
4
|
+
import { useMenu as h } from "../../Context/MenuContext.js";
|
|
5
|
+
import { useRouter as f } from "../../Context/RouterContext.js";
|
|
6
|
+
import { useSession as g } from "../../Context/SessionContext.js";
|
|
7
|
+
import { HeaderOptions as N } from "./HeaderOptions.js";
|
|
8
|
+
import { MenuItemComponent as n } from "./MenuItem.js";
|
|
9
|
+
import { SubHeader as k } from "./SubHeader.js";
|
|
11
10
|
const I = ({
|
|
12
|
-
logoUrl:
|
|
13
|
-
logoAlt:
|
|
14
|
-
signInUrl:
|
|
11
|
+
logoUrl: a,
|
|
12
|
+
logoAlt: m = "App logo",
|
|
13
|
+
signInUrl: s
|
|
15
14
|
}) => {
|
|
16
|
-
const { items:
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
15
|
+
const { items: c } = h(), { navigate: l } = f(), { isAuthenticated: p, isLoading: d } = g();
|
|
16
|
+
return /* @__PURE__ */ o("header", { className: "sticky-top", children: [
|
|
17
|
+
/* @__PURE__ */ e(t, { bg: "dark", variant: "dark", children: /* @__PURE__ */ o(u, { fluid: !0, children: [
|
|
18
|
+
/* @__PURE__ */ e(t.Brand, { onClick: () => l("/"), children: /* @__PURE__ */ e(
|
|
20
19
|
"img",
|
|
21
20
|
{
|
|
22
|
-
src:
|
|
21
|
+
src: a,
|
|
23
22
|
height: "30",
|
|
24
23
|
className: "d-inline-block align-top",
|
|
25
|
-
alt:
|
|
24
|
+
alt: m
|
|
26
25
|
}
|
|
27
26
|
) }),
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
!
|
|
32
|
-
|
|
27
|
+
/* @__PURE__ */ e(i, { className: "me-auto", children: c.map((r) => /* @__PURE__ */ e(n, { ...r }, r.title)) }),
|
|
28
|
+
/* @__PURE__ */ o(i, { className: "me-5 pe-5", children: [
|
|
29
|
+
/* @__PURE__ */ e(N, {}),
|
|
30
|
+
!d && !p && /* @__PURE__ */ e(
|
|
31
|
+
n,
|
|
33
32
|
{
|
|
34
33
|
title: "Sign In",
|
|
35
34
|
type: "location",
|
|
36
|
-
location:
|
|
35
|
+
location: s
|
|
37
36
|
}
|
|
38
37
|
)
|
|
39
38
|
] })
|
|
40
39
|
] }) }),
|
|
41
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ e(k, {})
|
|
42
41
|
] });
|
|
43
42
|
};
|
|
44
43
|
export {
|