@australiangreens/ag-internal-components 0.0.95 → 0.0.96
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/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 De extends Yt {
|
|
136
136
|
}
|
|
137
|
-
Fe(
|
|
137
|
+
Fe(De, "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 De("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: y = 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: y,
|
|
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
|
+
}), Dn = 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), [y, b] = B(Ce), [D, 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: ye,
|
|
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 ? y : ce, Ie = (z) => {
|
|
551
|
+
p === void 0 && (g(z), r && S && (z ? (b(!1), F(y)) : 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(D))), $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 && ye === "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
|
+
} : {}), ye === "push" ? {
|
|
623
623
|
rightPanel: {
|
|
624
624
|
open: pe,
|
|
625
625
|
width: de
|
|
626
626
|
}
|
|
627
627
|
} : {}), {
|
|
628
|
-
children: /* @__PURE__ */ o(
|
|
628
|
+
children: /* @__PURE__ */ o(Dn, 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
|
+
}, yn = 64, $n = 72, In = 256, K = _(!0), xt = _(In), vt = _($n), ve = _(""), On = _(void 0), wt = _(yn), At = _(void 0);
|
|
637
637
|
function Tn({ links: e }) {
|
|
638
638
|
return /* @__PURE__ */ o("div", { children: "LinksMenu not implemented yet" });
|
|
639
639
|
}
|
|
@@ -719,8 +719,7 @@ 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
|
-
|
|
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(
|
|
722
|
+
return /* @__PURE__ */ h(
|
|
724
723
|
$,
|
|
725
724
|
{
|
|
726
725
|
sx: {
|
|
@@ -739,22 +738,22 @@ function Ln({ user: e, domainCode: t, open: n }) {
|
|
|
739
738
|
transition: n ? ae(i, ["width", "height"], "entering") : ae(i, ["width", "height"], "leaving"),
|
|
740
739
|
aspectRatio: 1
|
|
741
740
|
},
|
|
742
|
-
children:
|
|
741
|
+
children: e != null && e.name ? /* @__PURE__ */ o(
|
|
743
742
|
Pe,
|
|
744
743
|
{
|
|
745
744
|
src: e == null ? void 0 : e.picture,
|
|
746
745
|
sx: {
|
|
747
746
|
width: "100%",
|
|
748
747
|
height: "100%",
|
|
749
|
-
bgcolor: Ue[Math.abs(Pn(
|
|
748
|
+
bgcolor: Ue[Math.abs(Pn(e == null ? void 0 : e.name)) % Ue.length]
|
|
750
749
|
},
|
|
751
|
-
children: Nn(
|
|
750
|
+
children: Nn(e == null ? void 0 : e.name)
|
|
752
751
|
}
|
|
753
752
|
) : /* @__PURE__ */ o(Pe, { sx: { width: "100%", height: "100%" } })
|
|
754
753
|
}
|
|
755
754
|
),
|
|
756
755
|
/* @__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: [
|
|
757
|
-
|
|
756
|
+
e != null && e.name ? /* @__PURE__ */ o(E, { children: e == null ? void 0 : e.name }) : /* @__PURE__ */ o(Ne, { animation: !1, width: "50%" }),
|
|
758
757
|
t ? /* @__PURE__ */ o(E, { children: t.toUpperCase() }) : /* @__PURE__ */ o(Ne, { animation: !1, width: "25%" })
|
|
759
758
|
] }) }) })
|
|
760
759
|
]
|
|
@@ -892,16 +891,16 @@ function Po({
|
|
|
892
891
|
[K, n != null ? n : !0],
|
|
893
892
|
[ve, t != null ? t : ""]
|
|
894
893
|
]);
|
|
895
|
-
const x = _e(K), [A] = V(xt), [g] = V(vt),
|
|
894
|
+
const x = _e(K), [A] = V(xt), [g] = V(vt), y = _e(ve), [b] = V(wt), [D] = V(On), [I] = V(At);
|
|
896
895
|
return /* @__PURE__ */ h($, { children: [
|
|
897
896
|
/* @__PURE__ */ o(Wt, {}),
|
|
898
897
|
/* @__PURE__ */ o(
|
|
899
898
|
Wn,
|
|
900
899
|
{
|
|
901
|
-
titleText:
|
|
900
|
+
titleText: y,
|
|
902
901
|
"data-testid": s,
|
|
903
902
|
height: b,
|
|
904
|
-
middle:
|
|
903
|
+
middle: D
|
|
905
904
|
}
|
|
906
905
|
),
|
|
907
906
|
/* @__PURE__ */ h($, { sx: { display: "flex" }, children: [
|
|
@@ -945,14 +944,14 @@ const St = ({
|
|
|
945
944
|
disableCloseOnBackdropOrEscape: u = !1,
|
|
946
945
|
isLoading: w = !1
|
|
947
946
|
}) => {
|
|
948
|
-
var g,
|
|
947
|
+
var g, y;
|
|
949
948
|
const [x, A] = B(!1);
|
|
950
949
|
return /* @__PURE__ */ h(
|
|
951
950
|
je,
|
|
952
951
|
{
|
|
953
952
|
open: e,
|
|
954
|
-
onClose: (b,
|
|
955
|
-
u && (
|
|
953
|
+
onClose: (b, D) => N(void 0, null, function* () {
|
|
954
|
+
u && (D === "backdropClick" || D === "escapeKeyDown") || x || (s != null && s.onClick ? yield s.onClick() : c());
|
|
956
955
|
}),
|
|
957
956
|
fullWidth: !0,
|
|
958
957
|
maxWidth: i != null ? i : "xs",
|
|
@@ -970,7 +969,7 @@ const St = ({
|
|
|
970
969
|
"data-testid": s == null ? void 0 : s.testId,
|
|
971
970
|
disabled: (s == null ? void 0 : s.disabled) || x,
|
|
972
971
|
color: s == null ? void 0 : s.buttonColor,
|
|
973
|
-
children: (
|
|
972
|
+
children: (y = s == null ? void 0 : s.text) != null ? y : "Cancel"
|
|
974
973
|
}
|
|
975
974
|
),
|
|
976
975
|
r && /* @__PURE__ */ o(
|
|
@@ -1018,9 +1017,9 @@ function No({
|
|
|
1018
1017
|
loadingText: x = "Loading...",
|
|
1019
1018
|
noOptionsText: A = "No options",
|
|
1020
1019
|
popupIcon: g = /* @__PURE__ */ o(jt, {}),
|
|
1021
|
-
error:
|
|
1020
|
+
error: y = !1,
|
|
1022
1021
|
helperText: b = "",
|
|
1023
|
-
preLoadedOptions:
|
|
1022
|
+
preLoadedOptions: D = void 0,
|
|
1024
1023
|
disablePortal: I = !1,
|
|
1025
1024
|
disableIconFlip: O = !1
|
|
1026
1025
|
}) {
|
|
@@ -1032,7 +1031,7 @@ function No({
|
|
|
1032
1031
|
label: r,
|
|
1033
1032
|
lookup: e,
|
|
1034
1033
|
minLength: i,
|
|
1035
|
-
preLoadedOptions:
|
|
1034
|
+
preLoadedOptions: D
|
|
1036
1035
|
}), W = F.length >= i;
|
|
1037
1036
|
return /* @__PURE__ */ h("div", { "data-testid": c, children: [
|
|
1038
1037
|
/* @__PURE__ */ o(
|
|
@@ -1061,7 +1060,7 @@ function No({
|
|
|
1061
1060
|
label: r,
|
|
1062
1061
|
fullWidth: !0,
|
|
1063
1062
|
variant: w,
|
|
1064
|
-
error:
|
|
1063
|
+
error: y,
|
|
1065
1064
|
helperText: b,
|
|
1066
1065
|
InputProps: k(a({}, p.InputProps), {
|
|
1067
1066
|
endAdornment: /* @__PURE__ */ h(L, { children: [
|
|
@@ -1168,16 +1167,16 @@ const Lo = ({
|
|
|
1168
1167
|
preLoadedOptions: x,
|
|
1169
1168
|
helperText: A = "",
|
|
1170
1169
|
disabled: g,
|
|
1171
|
-
popupIcon:
|
|
1170
|
+
popupIcon: y,
|
|
1172
1171
|
disableIconFlip: b
|
|
1173
1172
|
}) => {
|
|
1174
|
-
const [
|
|
1175
|
-
inputValue:
|
|
1173
|
+
const [D, I] = B(""), { data: O, isLoading: F } = kt({
|
|
1174
|
+
inputValue: D,
|
|
1176
1175
|
label: n,
|
|
1177
1176
|
lookup: e,
|
|
1178
1177
|
minLength: u != null ? u : 0,
|
|
1179
1178
|
preLoadedOptions: x
|
|
1180
|
-
}), P =
|
|
1179
|
+
}), P = D.length >= u;
|
|
1181
1180
|
return /* @__PURE__ */ o("div", { "data-testid": d, children: /* @__PURE__ */ o(Gt, { direction: "row", spacing: 1, children: /* @__PURE__ */ o(
|
|
1182
1181
|
be,
|
|
1183
1182
|
{
|
|
@@ -1193,7 +1192,7 @@ const Lo = ({
|
|
|
1193
1192
|
value: i,
|
|
1194
1193
|
noOptionsText: P ? l : "Start typing to search",
|
|
1195
1194
|
getOptionLabel: (S) => S.label,
|
|
1196
|
-
popupIcon:
|
|
1195
|
+
popupIcon: y,
|
|
1197
1196
|
renderInput: (S) => /* @__PURE__ */ o(
|
|
1198
1197
|
Se,
|
|
1199
1198
|
k(a({
|
|
@@ -1335,7 +1334,7 @@ const Xn = {
|
|
|
1335
1334
|
})(), Jn = {
|
|
1336
1335
|
borderBottomLeftRadius: "0px",
|
|
1337
1336
|
borderBottomRightRadius: "0px"
|
|
1338
|
-
}, Zn = {}, jn = {},
|
|
1337
|
+
}, Zn = {}, jn = {}, Dt = Ye(null);
|
|
1339
1338
|
function eo(s) {
|
|
1340
1339
|
var c = s, {
|
|
1341
1340
|
overrideState: e = Zn,
|
|
@@ -1359,7 +1358,7 @@ function eo(s) {
|
|
|
1359
1358
|
key: Kn()
|
|
1360
1359
|
}), m);
|
|
1361
1360
|
return u.current.push(C), u.current.length === 1 && l({ open: !0 }), C.key;
|
|
1362
|
-
}, []),
|
|
1361
|
+
}, []), y = (m = "", C = {}) => g(a({ message: m, severity: "success" }, C)), b = (m = "", C = {}) => g(a({ message: m, severity: "info" }, C)), D = (m = "", C = {}) => g(a({ message: m, severity: "warning" }, C)), I = (m = "", C = {}) => g(a({ message: m, severity: "error" }, C)), O = (m) => {
|
|
1363
1362
|
const C = u.current.findIndex((M) => M.key === m);
|
|
1364
1363
|
if (C !== -1)
|
|
1365
1364
|
return C === 0 ? (l({ open: !1 }), u.current[0]) : u.current.splice(C, 1);
|
|
@@ -1374,13 +1373,13 @@ function eo(s) {
|
|
|
1374
1373
|
open: d,
|
|
1375
1374
|
setOpen: A,
|
|
1376
1375
|
enqueueNotification: g,
|
|
1377
|
-
enqueueSuccessNotification:
|
|
1376
|
+
enqueueSuccessNotification: y,
|
|
1378
1377
|
enqueueInfoNotification: b,
|
|
1379
|
-
enqueueWarningNotification:
|
|
1378
|
+
enqueueWarningNotification: D,
|
|
1380
1379
|
enqueueErrorNotification: I,
|
|
1381
1380
|
removeNotification: O
|
|
1382
1381
|
}, e), t);
|
|
1383
|
-
return /* @__PURE__ */ h(
|
|
1382
|
+
return /* @__PURE__ */ h(Dt.Provider, { value: p, children: [
|
|
1384
1383
|
i,
|
|
1385
1384
|
/* @__PURE__ */ o(
|
|
1386
1385
|
Vt,
|
|
@@ -1411,9 +1410,9 @@ function eo(s) {
|
|
|
1411
1410
|
] });
|
|
1412
1411
|
}
|
|
1413
1412
|
function to() {
|
|
1414
|
-
const e = Ke(
|
|
1413
|
+
const e = Ke(Dt);
|
|
1415
1414
|
if (e === null)
|
|
1416
|
-
throw new
|
|
1415
|
+
throw new De("Error: Tried to useSaladBar outside of a <SaladBarProvider>");
|
|
1417
1416
|
return e;
|
|
1418
1417
|
}
|
|
1419
1418
|
const Ro = X(
|
|
@@ -1421,14 +1420,14 @@ const Ro = X(
|
|
|
1421
1420
|
), no = en(), Ho = ({
|
|
1422
1421
|
children: e,
|
|
1423
1422
|
store: t
|
|
1424
|
-
}) => /* @__PURE__ */ o(ct, { store: t != null ? t : no, children: e }),
|
|
1423
|
+
}) => /* @__PURE__ */ o(ct, { store: t != null ? t : no, children: e }), yt = "domainCode";
|
|
1425
1424
|
var Qe;
|
|
1426
1425
|
const Xe = _(
|
|
1427
|
-
JSON.parse((Qe = localStorage.getItem(
|
|
1426
|
+
JSON.parse((Qe = localStorage.getItem(yt)) != null ? Qe : '{"domainCode": ""}').domainCode
|
|
1428
1427
|
), $t = _(
|
|
1429
1428
|
(e) => e(Xe),
|
|
1430
1429
|
(e, t, n) => {
|
|
1431
|
-
t(Xe, n), localStorage.setItem(
|
|
1430
|
+
t(Xe, n), localStorage.setItem(yt, JSON.stringify({ domainCode: n }));
|
|
1432
1431
|
}
|
|
1433
1432
|
), oo = {
|
|
1434
1433
|
act: "ACT",
|
|
@@ -1453,20 +1452,20 @@ const Xe = _(
|
|
|
1453
1452
|
applicationName: r,
|
|
1454
1453
|
handleLogout: s
|
|
1455
1454
|
}) => {
|
|
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,
|
|
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, y = () => N(void 0, null, function* () {
|
|
1457
1456
|
l ? (d(l), w(`Set domain to ${l}`), n()) : d("");
|
|
1458
1457
|
}), b = () => N(void 0, null, function* () {
|
|
1459
1458
|
c && !x && !A ? (u(c), n()) : g && s();
|
|
1460
1459
|
});
|
|
1461
|
-
let
|
|
1462
|
-
return x ?
|
|
1460
|
+
let D;
|
|
1461
|
+
return x ? D = "Unable to retrieve your active organisations. Try logging in again." : A && (D = "You no longer have any roles in your chosen organisation. Please choose another."), /* @__PURE__ */ h(
|
|
1463
1462
|
St,
|
|
1464
1463
|
{
|
|
1465
1464
|
isOpen: t,
|
|
1466
1465
|
dialogTitle: "Select an organisation",
|
|
1467
1466
|
primaryButton: {
|
|
1468
1467
|
text: "Confirm",
|
|
1469
|
-
onClick:
|
|
1468
|
+
onClick: y,
|
|
1470
1469
|
disabled: !l || x || A,
|
|
1471
1470
|
buttonColor: "primary"
|
|
1472
1471
|
},
|
|
@@ -1507,7 +1506,7 @@ const Xe = _(
|
|
|
1507
1506
|
)
|
|
1508
1507
|
}
|
|
1509
1508
|
),
|
|
1510
|
-
|
|
1509
|
+
D && /* @__PURE__ */ o(Xt, { error: !0, children: D })
|
|
1511
1510
|
]
|
|
1512
1511
|
}
|
|
1513
1512
|
);
|
|
@@ -1689,8 +1688,8 @@ export {
|
|
|
1689
1688
|
Po as AppLayout,
|
|
1690
1689
|
Ho as AtomProvider,
|
|
1691
1690
|
Mo as AuthGuard,
|
|
1692
|
-
|
|
1693
|
-
|
|
1691
|
+
Dt as Context,
|
|
1692
|
+
De as ContextError,
|
|
1694
1693
|
Wo as DomainCodeDialog,
|
|
1695
1694
|
$o as ExampleComponent,
|
|
1696
1695
|
No as FetchAutocomplete,
|