@australiangreens/ag-internal-components 0.0.94 → 0.0.95
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/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +54 -53
- package/dist/esm/index.js.map +1 -1
- package/dist/layouts/AppLayout/NavBar/UserInfo.d.ts +3 -0
- package/dist/layouts/AppLayout/NavBar/UserInfo.d.ts.map +1 -1
- package/dist/layouts/AppLayout/NavBar/types.d.ts +2 -0
- package/dist/layouts/AppLayout/NavBar/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -132,9 +132,9 @@ const pt = 330, ht = 73, U = "Navbar", q = {
|
|
|
132
132
|
}), !t && {
|
|
133
133
|
"& .MuiDrawer-paper": un()
|
|
134
134
|
}));
|
|
135
|
-
class
|
|
135
|
+
class ye extends Yt {
|
|
136
136
|
}
|
|
137
|
-
Fe(
|
|
137
|
+
Fe(ye, "errorName", "ContextError");
|
|
138
138
|
const ft = Ye(null), hn = {}, gn = {}, fn = ({
|
|
139
139
|
overrideState: e = hn,
|
|
140
140
|
overrideActions: t = gn,
|
|
@@ -153,7 +153,7 @@ const ft = Ye(null), hn = {}, gn = {}, fn = ({
|
|
|
153
153
|
}, mn = () => {
|
|
154
154
|
const e = Ke(ft);
|
|
155
155
|
if (e === null)
|
|
156
|
-
throw new
|
|
156
|
+
throw new ye("Error: Tried to useNavBar outside of a <NavBarProvider>");
|
|
157
157
|
return e;
|
|
158
158
|
}, Cn = (e = {}) => a({
|
|
159
159
|
open: !0
|
|
@@ -423,7 +423,7 @@ function He({
|
|
|
423
423
|
"data-testid": x,
|
|
424
424
|
navBarOpen: A = !1,
|
|
425
425
|
navBarWidthOpen: g = 0,
|
|
426
|
-
navBarWidthClosed:
|
|
426
|
+
navBarWidthClosed: D = 0
|
|
427
427
|
}) {
|
|
428
428
|
return /* @__PURE__ */ h(
|
|
429
429
|
bn,
|
|
@@ -440,7 +440,7 @@ function He({
|
|
|
440
440
|
"data-testid": x,
|
|
441
441
|
navBarOpen: A,
|
|
442
442
|
navBarWidthOpen: g,
|
|
443
|
-
navBarWidthClosed:
|
|
443
|
+
navBarWidthClosed: D,
|
|
444
444
|
children: [
|
|
445
445
|
/* @__PURE__ */ o(Sn, k(a({ anchor: t }, l), { children: t === "left" ? /* @__PURE__ */ h(L, { children: [
|
|
446
446
|
/* @__PURE__ */ o(E, { variant: "h6", color: "inherit", component: "div", children: r }),
|
|
@@ -483,7 +483,7 @@ const kn = R($, {
|
|
|
483
483
|
}),
|
|
484
484
|
marginRight: `${(r = n == null ? void 0 : n.width) != null ? r : 0}px`
|
|
485
485
|
});
|
|
486
|
-
}),
|
|
486
|
+
}), yn = R(Ze, {
|
|
487
487
|
name: "PageContainer"
|
|
488
488
|
})(({ theme: e }) => ({
|
|
489
489
|
// Horizontal padding comes from the Container's gutter
|
|
@@ -517,7 +517,7 @@ function Fo({
|
|
|
517
517
|
navBarWidthOpen: w,
|
|
518
518
|
navBarWidthClosed: x
|
|
519
519
|
}) {
|
|
520
|
-
const [A, g] = B(me), [
|
|
520
|
+
const [A, g] = B(me), [D, b] = B(Ce), [y, I] = B(me), [O, F] = B(Ce), P = n !== void 0, S = i !== void 0, {
|
|
521
521
|
titleText: v,
|
|
522
522
|
content: H,
|
|
523
523
|
flavour: W,
|
|
@@ -532,7 +532,7 @@ function Fo({
|
|
|
532
532
|
} = n ? a(a({}, te), n) : a({}, te), {
|
|
533
533
|
titleText: Ot,
|
|
534
534
|
content: Tt,
|
|
535
|
-
flavour:
|
|
535
|
+
flavour: De,
|
|
536
536
|
open: ce,
|
|
537
537
|
onChangeOpen: $e,
|
|
538
538
|
width: de,
|
|
@@ -547,10 +547,10 @@ function Fo({
|
|
|
547
547
|
}, [M]), ie(() => {
|
|
548
548
|
j !== Ce && (b(j), F(j));
|
|
549
549
|
}, [j]);
|
|
550
|
-
const ue = p === void 0 ? A : p, pe = ce === void 0 ?
|
|
551
|
-
p === void 0 && (g(z), r && S && (z ? (b(!1), F(
|
|
550
|
+
const ue = p === void 0 ? A : p, pe = ce === void 0 ? D : ce, Ie = (z) => {
|
|
551
|
+
p === void 0 && (g(z), r && S && (z ? (b(!1), F(D)) : b(O))), f && f(z);
|
|
552
552
|
}, Oe = (z) => {
|
|
553
|
-
ce === void 0 && (b(z), r && P && (z ? (g(!1), I(A)) : g(
|
|
553
|
+
ce === void 0 && (b(z), r && P && (z ? (g(!1), I(A)) : g(y))), $e && $e(z);
|
|
554
554
|
};
|
|
555
555
|
return /* @__PURE__ */ h($, { children: [
|
|
556
556
|
P && /* @__PURE__ */ o(
|
|
@@ -603,7 +603,7 @@ function Fo({
|
|
|
603
603
|
onOpen: () => Ie(!0),
|
|
604
604
|
showOpenArrow: C === "both" || C === "open"
|
|
605
605
|
}
|
|
606
|
-
} : {}), S &&
|
|
606
|
+
} : {}), S && De === "push" ? {
|
|
607
607
|
rightPanel: {
|
|
608
608
|
open: pe,
|
|
609
609
|
width: de,
|
|
@@ -619,13 +619,13 @@ function Fo({
|
|
|
619
619
|
open: ue,
|
|
620
620
|
width: m
|
|
621
621
|
}
|
|
622
|
-
} : {}),
|
|
622
|
+
} : {}), De === "push" ? {
|
|
623
623
|
rightPanel: {
|
|
624
624
|
open: pe,
|
|
625
625
|
width: de
|
|
626
626
|
}
|
|
627
627
|
} : {}), {
|
|
628
|
-
children: /* @__PURE__ */ o(
|
|
628
|
+
children: /* @__PURE__ */ o(yn, k(a({ "data-testid": d }, c), { children: e }))
|
|
629
629
|
})
|
|
630
630
|
)
|
|
631
631
|
] });
|
|
@@ -633,7 +633,7 @@ function Fo({
|
|
|
633
633
|
const Ct = () => {
|
|
634
634
|
const e = se();
|
|
635
635
|
return _t(e.breakpoints.down("sm"));
|
|
636
|
-
},
|
|
636
|
+
}, Dn = 64, $n = 72, In = 256, K = _(!0), xt = _(In), vt = _($n), ve = _(""), On = _(void 0), wt = _(Dn), At = _(void 0);
|
|
637
637
|
function Tn({ links: e }) {
|
|
638
638
|
return /* @__PURE__ */ o("div", { children: "LinksMenu not implemented yet" });
|
|
639
639
|
}
|
|
@@ -719,7 +719,8 @@ function Pn(e) {
|
|
|
719
719
|
const Ue = ["#A62A21", "#7e3794", "#0B51C1", "#3A6024", "#A81563", "#B3003C"], Nn = (e) => e.split(/\s/).map((t) => t.substring(0, 1).toUpperCase()).filter((t) => !!t).slice(0, 2).join("").toUpperCase();
|
|
720
720
|
function Ln({ user: e, domainCode: t, open: n }) {
|
|
721
721
|
const i = se();
|
|
722
|
-
|
|
722
|
+
let r;
|
|
723
|
+
return e ? e.given_name && e.family_name ? r = `${e.given_name} ${e.family_name}` : e.name ? r = e.name : r = "" : r = "", /* @__PURE__ */ h(
|
|
723
724
|
$,
|
|
724
725
|
{
|
|
725
726
|
sx: {
|
|
@@ -738,22 +739,22 @@ function Ln({ user: e, domainCode: t, open: n }) {
|
|
|
738
739
|
transition: n ? ae(i, ["width", "height"], "entering") : ae(i, ["width", "height"], "leaving"),
|
|
739
740
|
aspectRatio: 1
|
|
740
741
|
},
|
|
741
|
-
children:
|
|
742
|
+
children: r ? /* @__PURE__ */ o(
|
|
742
743
|
Pe,
|
|
743
744
|
{
|
|
744
745
|
src: e == null ? void 0 : e.picture,
|
|
745
746
|
sx: {
|
|
746
747
|
width: "100%",
|
|
747
748
|
height: "100%",
|
|
748
|
-
bgcolor: Ue[Math.abs(Pn(
|
|
749
|
+
bgcolor: Ue[Math.abs(Pn(r)) % Ue.length]
|
|
749
750
|
},
|
|
750
|
-
children: Nn(
|
|
751
|
+
children: Nn(r)
|
|
751
752
|
}
|
|
752
753
|
) : /* @__PURE__ */ o(Pe, { sx: { width: "100%", height: "100%" } })
|
|
753
754
|
}
|
|
754
755
|
),
|
|
755
756
|
/* @__PURE__ */ o(En, { sx: { width: "100%" }, in: n, children: /* @__PURE__ */ o(Rt, { in: n, children: /* @__PURE__ */ h($, { width: "100%", display: "flex", flexDirection: "column", alignItems: "center", children: [
|
|
756
|
-
|
|
757
|
+
r ? /* @__PURE__ */ o(E, { children: r }) : /* @__PURE__ */ o(Ne, { animation: !1, width: "50%" }),
|
|
757
758
|
t ? /* @__PURE__ */ o(E, { children: t.toUpperCase() }) : /* @__PURE__ */ o(Ne, { animation: !1, width: "25%" })
|
|
758
759
|
] }) }) })
|
|
759
760
|
]
|
|
@@ -891,16 +892,16 @@ function Po({
|
|
|
891
892
|
[K, n != null ? n : !0],
|
|
892
893
|
[ve, t != null ? t : ""]
|
|
893
894
|
]);
|
|
894
|
-
const x = _e(K), [A] = V(xt), [g] = V(vt),
|
|
895
|
+
const x = _e(K), [A] = V(xt), [g] = V(vt), D = _e(ve), [b] = V(wt), [y] = V(On), [I] = V(At);
|
|
895
896
|
return /* @__PURE__ */ h($, { children: [
|
|
896
897
|
/* @__PURE__ */ o(Wt, {}),
|
|
897
898
|
/* @__PURE__ */ o(
|
|
898
899
|
Wn,
|
|
899
900
|
{
|
|
900
|
-
titleText:
|
|
901
|
+
titleText: D,
|
|
901
902
|
"data-testid": s,
|
|
902
903
|
height: b,
|
|
903
|
-
middle:
|
|
904
|
+
middle: y
|
|
904
905
|
}
|
|
905
906
|
),
|
|
906
907
|
/* @__PURE__ */ h($, { sx: { display: "flex" }, children: [
|
|
@@ -944,14 +945,14 @@ const St = ({
|
|
|
944
945
|
disableCloseOnBackdropOrEscape: u = !1,
|
|
945
946
|
isLoading: w = !1
|
|
946
947
|
}) => {
|
|
947
|
-
var g,
|
|
948
|
+
var g, D;
|
|
948
949
|
const [x, A] = B(!1);
|
|
949
950
|
return /* @__PURE__ */ h(
|
|
950
951
|
je,
|
|
951
952
|
{
|
|
952
953
|
open: e,
|
|
953
|
-
onClose: (b,
|
|
954
|
-
u && (
|
|
954
|
+
onClose: (b, y) => N(void 0, null, function* () {
|
|
955
|
+
u && (y === "backdropClick" || y === "escapeKeyDown") || x || (s != null && s.onClick ? yield s.onClick() : c());
|
|
955
956
|
}),
|
|
956
957
|
fullWidth: !0,
|
|
957
958
|
maxWidth: i != null ? i : "xs",
|
|
@@ -969,7 +970,7 @@ const St = ({
|
|
|
969
970
|
"data-testid": s == null ? void 0 : s.testId,
|
|
970
971
|
disabled: (s == null ? void 0 : s.disabled) || x,
|
|
971
972
|
color: s == null ? void 0 : s.buttonColor,
|
|
972
|
-
children: (
|
|
973
|
+
children: (D = s == null ? void 0 : s.text) != null ? D : "Cancel"
|
|
973
974
|
}
|
|
974
975
|
),
|
|
975
976
|
r && /* @__PURE__ */ o(
|
|
@@ -1017,9 +1018,9 @@ function No({
|
|
|
1017
1018
|
loadingText: x = "Loading...",
|
|
1018
1019
|
noOptionsText: A = "No options",
|
|
1019
1020
|
popupIcon: g = /* @__PURE__ */ o(jt, {}),
|
|
1020
|
-
error:
|
|
1021
|
+
error: D = !1,
|
|
1021
1022
|
helperText: b = "",
|
|
1022
|
-
preLoadedOptions:
|
|
1023
|
+
preLoadedOptions: y = void 0,
|
|
1023
1024
|
disablePortal: I = !1,
|
|
1024
1025
|
disableIconFlip: O = !1
|
|
1025
1026
|
}) {
|
|
@@ -1031,7 +1032,7 @@ function No({
|
|
|
1031
1032
|
label: r,
|
|
1032
1033
|
lookup: e,
|
|
1033
1034
|
minLength: i,
|
|
1034
|
-
preLoadedOptions:
|
|
1035
|
+
preLoadedOptions: y
|
|
1035
1036
|
}), W = F.length >= i;
|
|
1036
1037
|
return /* @__PURE__ */ h("div", { "data-testid": c, children: [
|
|
1037
1038
|
/* @__PURE__ */ o(
|
|
@@ -1060,7 +1061,7 @@ function No({
|
|
|
1060
1061
|
label: r,
|
|
1061
1062
|
fullWidth: !0,
|
|
1062
1063
|
variant: w,
|
|
1063
|
-
error:
|
|
1064
|
+
error: D,
|
|
1064
1065
|
helperText: b,
|
|
1065
1066
|
InputProps: k(a({}, p.InputProps), {
|
|
1066
1067
|
endAdornment: /* @__PURE__ */ h(L, { children: [
|
|
@@ -1167,16 +1168,16 @@ const Lo = ({
|
|
|
1167
1168
|
preLoadedOptions: x,
|
|
1168
1169
|
helperText: A = "",
|
|
1169
1170
|
disabled: g,
|
|
1170
|
-
popupIcon:
|
|
1171
|
+
popupIcon: D,
|
|
1171
1172
|
disableIconFlip: b
|
|
1172
1173
|
}) => {
|
|
1173
|
-
const [
|
|
1174
|
-
inputValue:
|
|
1174
|
+
const [y, I] = B(""), { data: O, isLoading: F } = kt({
|
|
1175
|
+
inputValue: y,
|
|
1175
1176
|
label: n,
|
|
1176
1177
|
lookup: e,
|
|
1177
1178
|
minLength: u != null ? u : 0,
|
|
1178
1179
|
preLoadedOptions: x
|
|
1179
|
-
}), P =
|
|
1180
|
+
}), P = y.length >= u;
|
|
1180
1181
|
return /* @__PURE__ */ o("div", { "data-testid": d, children: /* @__PURE__ */ o(Gt, { direction: "row", spacing: 1, children: /* @__PURE__ */ o(
|
|
1181
1182
|
be,
|
|
1182
1183
|
{
|
|
@@ -1192,7 +1193,7 @@ const Lo = ({
|
|
|
1192
1193
|
value: i,
|
|
1193
1194
|
noOptionsText: P ? l : "Start typing to search",
|
|
1194
1195
|
getOptionLabel: (S) => S.label,
|
|
1195
|
-
popupIcon:
|
|
1196
|
+
popupIcon: D,
|
|
1196
1197
|
renderInput: (S) => /* @__PURE__ */ o(
|
|
1197
1198
|
Se,
|
|
1198
1199
|
k(a({
|
|
@@ -1334,7 +1335,7 @@ const Xn = {
|
|
|
1334
1335
|
})(), Jn = {
|
|
1335
1336
|
borderBottomLeftRadius: "0px",
|
|
1336
1337
|
borderBottomRightRadius: "0px"
|
|
1337
|
-
}, Zn = {}, jn = {},
|
|
1338
|
+
}, Zn = {}, jn = {}, yt = Ye(null);
|
|
1338
1339
|
function eo(s) {
|
|
1339
1340
|
var c = s, {
|
|
1340
1341
|
overrideState: e = Zn,
|
|
@@ -1358,7 +1359,7 @@ function eo(s) {
|
|
|
1358
1359
|
key: Kn()
|
|
1359
1360
|
}), m);
|
|
1360
1361
|
return u.current.push(C), u.current.length === 1 && l({ open: !0 }), C.key;
|
|
1361
|
-
}, []),
|
|
1362
|
+
}, []), D = (m = "", C = {}) => g(a({ message: m, severity: "success" }, C)), b = (m = "", C = {}) => g(a({ message: m, severity: "info" }, C)), y = (m = "", C = {}) => g(a({ message: m, severity: "warning" }, C)), I = (m = "", C = {}) => g(a({ message: m, severity: "error" }, C)), O = (m) => {
|
|
1362
1363
|
const C = u.current.findIndex((M) => M.key === m);
|
|
1363
1364
|
if (C !== -1)
|
|
1364
1365
|
return C === 0 ? (l({ open: !1 }), u.current[0]) : u.current.splice(C, 1);
|
|
@@ -1373,13 +1374,13 @@ function eo(s) {
|
|
|
1373
1374
|
open: d,
|
|
1374
1375
|
setOpen: A,
|
|
1375
1376
|
enqueueNotification: g,
|
|
1376
|
-
enqueueSuccessNotification:
|
|
1377
|
+
enqueueSuccessNotification: D,
|
|
1377
1378
|
enqueueInfoNotification: b,
|
|
1378
|
-
enqueueWarningNotification:
|
|
1379
|
+
enqueueWarningNotification: y,
|
|
1379
1380
|
enqueueErrorNotification: I,
|
|
1380
1381
|
removeNotification: O
|
|
1381
1382
|
}, e), t);
|
|
1382
|
-
return /* @__PURE__ */ h(
|
|
1383
|
+
return /* @__PURE__ */ h(yt.Provider, { value: p, children: [
|
|
1383
1384
|
i,
|
|
1384
1385
|
/* @__PURE__ */ o(
|
|
1385
1386
|
Vt,
|
|
@@ -1410,9 +1411,9 @@ function eo(s) {
|
|
|
1410
1411
|
] });
|
|
1411
1412
|
}
|
|
1412
1413
|
function to() {
|
|
1413
|
-
const e = Ke(
|
|
1414
|
+
const e = Ke(yt);
|
|
1414
1415
|
if (e === null)
|
|
1415
|
-
throw new
|
|
1416
|
+
throw new ye("Error: Tried to useSaladBar outside of a <SaladBarProvider>");
|
|
1416
1417
|
return e;
|
|
1417
1418
|
}
|
|
1418
1419
|
const Ro = X(
|
|
@@ -1420,14 +1421,14 @@ const Ro = X(
|
|
|
1420
1421
|
), no = en(), Ho = ({
|
|
1421
1422
|
children: e,
|
|
1422
1423
|
store: t
|
|
1423
|
-
}) => /* @__PURE__ */ o(ct, { store: t != null ? t : no, children: e }),
|
|
1424
|
+
}) => /* @__PURE__ */ o(ct, { store: t != null ? t : no, children: e }), Dt = "domainCode";
|
|
1424
1425
|
var Qe;
|
|
1425
1426
|
const Xe = _(
|
|
1426
|
-
JSON.parse((Qe = localStorage.getItem(
|
|
1427
|
+
JSON.parse((Qe = localStorage.getItem(Dt)) != null ? Qe : '{"domainCode": ""}').domainCode
|
|
1427
1428
|
), $t = _(
|
|
1428
1429
|
(e) => e(Xe),
|
|
1429
1430
|
(e, t, n) => {
|
|
1430
|
-
t(Xe, n), localStorage.setItem(
|
|
1431
|
+
t(Xe, n), localStorage.setItem(Dt, JSON.stringify({ domainCode: n }));
|
|
1431
1432
|
}
|
|
1432
1433
|
), oo = {
|
|
1433
1434
|
act: "ACT",
|
|
@@ -1452,20 +1453,20 @@ const Xe = _(
|
|
|
1452
1453
|
applicationName: r,
|
|
1453
1454
|
handleLogout: s
|
|
1454
1455
|
}) => {
|
|
1455
|
-
const [c, d] = V($t), [l, u] = B(c), { enqueueSuccessNotification: w } = to(), x = i.length === 0, A = !!c && !i.includes(c) && !i.includes(l), g = !c || x || A,
|
|
1456
|
+
const [c, d] = V($t), [l, u] = B(c), { enqueueSuccessNotification: w } = to(), x = i.length === 0, A = !!c && !i.includes(c) && !i.includes(l), g = !c || x || A, D = () => N(void 0, null, function* () {
|
|
1456
1457
|
l ? (d(l), w(`Set domain to ${l}`), n()) : d("");
|
|
1457
1458
|
}), b = () => N(void 0, null, function* () {
|
|
1458
1459
|
c && !x && !A ? (u(c), n()) : g && s();
|
|
1459
1460
|
});
|
|
1460
|
-
let
|
|
1461
|
-
return x ?
|
|
1461
|
+
let y;
|
|
1462
|
+
return x ? y = "Unable to retrieve your active organisations. Try logging in again." : A && (y = "You no longer have any roles in your chosen organisation. Please choose another."), /* @__PURE__ */ h(
|
|
1462
1463
|
St,
|
|
1463
1464
|
{
|
|
1464
1465
|
isOpen: t,
|
|
1465
1466
|
dialogTitle: "Select an organisation",
|
|
1466
1467
|
primaryButton: {
|
|
1467
1468
|
text: "Confirm",
|
|
1468
|
-
onClick:
|
|
1469
|
+
onClick: D,
|
|
1469
1470
|
disabled: !l || x || A,
|
|
1470
1471
|
buttonColor: "primary"
|
|
1471
1472
|
},
|
|
@@ -1506,7 +1507,7 @@ const Xe = _(
|
|
|
1506
1507
|
)
|
|
1507
1508
|
}
|
|
1508
1509
|
),
|
|
1509
|
-
|
|
1510
|
+
y && /* @__PURE__ */ o(Xt, { error: !0, children: y })
|
|
1510
1511
|
]
|
|
1511
1512
|
}
|
|
1512
1513
|
);
|
|
@@ -1688,8 +1689,8 @@ export {
|
|
|
1688
1689
|
Po as AppLayout,
|
|
1689
1690
|
Ho as AtomProvider,
|
|
1690
1691
|
Mo as AuthGuard,
|
|
1691
|
-
|
|
1692
|
-
|
|
1692
|
+
yt as Context,
|
|
1693
|
+
ye as ContextError,
|
|
1693
1694
|
Wo as DomainCodeDialog,
|
|
1694
1695
|
$o as ExampleComponent,
|
|
1695
1696
|
No as FetchAutocomplete,
|