@australiangreens/ag-internal-components 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var L = (e, t, n) => new Promise((i, r) => {
|
|
|
38
38
|
});
|
|
39
39
|
import { jsxs as u, Fragment as F, jsx as o } from "react/jsx-runtime";
|
|
40
40
|
import { useState as E, createContext as Je, useCallback as re, useContext as Ze, useEffect as K, createElement as xe, useRef as ge } from "react";
|
|
41
|
-
import { Typography as B, Button as ae, Paper as je, Box as $, Drawer as we, styled as Ae, IconButton as J, Container as et, useTheme as se, useMediaQuery as Rt, Collapse as Ht, Avatar as Pe, Fade as Wt, Skeleton as Ne, Toolbar as zt, Divider as Le, CssBaseline as Ut, Dialog as tt, LinearProgress as nt, DialogTitle as ot, DialogContent as it, DialogActions as rt, Autocomplete as Se, TextField as be, CircularProgress as
|
|
41
|
+
import { Typography as B, Button as ae, Paper as je, Box as $, Drawer as we, styled as Ae, IconButton as J, Container as et, useTheme as se, useMediaQuery as Rt, Collapse as Ht, Avatar as Pe, Fade as Wt, Skeleton as Ne, Toolbar as zt, Divider as Le, CssBaseline as Ut, Dialog as tt, LinearProgress as nt, DialogTitle as ot, DialogContent as it, DialogActions as rt, Autocomplete as Se, TextField as be, CircularProgress as ke, Chip as Gt, Tooltip as Vt, Stack as qt, Snackbar as Xt, Alert as Qt, FormHelperText as Yt } from "@mui/material";
|
|
42
42
|
import Kt from "@mui/material/CssBaseline";
|
|
43
43
|
import { styled as R, createTheme as at, alpha as fe } from "@mui/material/styles";
|
|
44
44
|
import { AgError as Jt } from "@australiangreens/ag-error";
|
|
@@ -133,9 +133,9 @@ const gt = 330, ft = 73, U = "Navbar", q = {
|
|
|
133
133
|
}), !t && {
|
|
134
134
|
"& .MuiDrawer-paper": hn()
|
|
135
135
|
}));
|
|
136
|
-
class
|
|
136
|
+
class De extends Jt {
|
|
137
137
|
}
|
|
138
|
-
Fe(
|
|
138
|
+
Fe(De, "errorName", "ContextError");
|
|
139
139
|
const Ct = Je(null), fn = {}, mn = {}, Cn = ({
|
|
140
140
|
overrideState: e = fn,
|
|
141
141
|
overrideActions: t = mn,
|
|
@@ -154,7 +154,7 @@ const Ct = Je(null), fn = {}, mn = {}, Cn = ({
|
|
|
154
154
|
}, xn = () => {
|
|
155
155
|
const e = Ze(Ct);
|
|
156
156
|
if (e === null)
|
|
157
|
-
throw new
|
|
157
|
+
throw new De("Error: Tried to useNavBar outside of a <NavBarProvider>");
|
|
158
158
|
return e;
|
|
159
159
|
}, vn = (e = {}) => s({
|
|
160
160
|
open: !0
|
|
@@ -358,7 +358,7 @@ function bn({
|
|
|
358
358
|
] }) })
|
|
359
359
|
] });
|
|
360
360
|
}
|
|
361
|
-
const xt = 400,
|
|
361
|
+
const xt = 400, kn = Ae(we, {
|
|
362
362
|
shouldForwardProp: (e) => (
|
|
363
363
|
// Note we do want anchor to be forwarded to the Drawer component
|
|
364
364
|
![
|
|
@@ -388,7 +388,7 @@ const xt = 400, Dn = Ae(we, {
|
|
|
388
388
|
marginLeft: `${r}px`
|
|
389
389
|
}))
|
|
390
390
|
})
|
|
391
|
-
),
|
|
391
|
+
), Dn = Ae($, {
|
|
392
392
|
shouldForwardProp: (e) => !["anchor"].includes(e)
|
|
393
393
|
})(({ theme: e, anchor: t }) => y(s({
|
|
394
394
|
display: "flex",
|
|
@@ -422,12 +422,12 @@ function We({
|
|
|
422
422
|
onOpened: d,
|
|
423
423
|
onClosed: m,
|
|
424
424
|
"data-testid": f,
|
|
425
|
-
navBarOpen:
|
|
425
|
+
navBarOpen: w = !1,
|
|
426
426
|
navBarWidthOpen: g = 0,
|
|
427
|
-
navBarWidthClosed:
|
|
427
|
+
navBarWidthClosed: S = 0
|
|
428
428
|
}) {
|
|
429
429
|
return /* @__PURE__ */ u(
|
|
430
|
-
|
|
430
|
+
kn,
|
|
431
431
|
{
|
|
432
432
|
SlideProps: {
|
|
433
433
|
onEntered: () => d == null ? void 0 : d(),
|
|
@@ -439,11 +439,11 @@ function We({
|
|
|
439
439
|
width: l,
|
|
440
440
|
debugOpacity: p,
|
|
441
441
|
"data-testid": f,
|
|
442
|
-
navBarOpen:
|
|
442
|
+
navBarOpen: w,
|
|
443
443
|
navBarWidthOpen: g,
|
|
444
|
-
navBarWidthClosed:
|
|
444
|
+
navBarWidthClosed: S,
|
|
445
445
|
children: [
|
|
446
|
-
/* @__PURE__ */ o(
|
|
446
|
+
/* @__PURE__ */ o(Dn, y(s({ anchor: t }, a), { children: t === "left" ? /* @__PURE__ */ u(F, { children: [
|
|
447
447
|
/* @__PURE__ */ o(B, { variant: "h6", color: "inherit", component: "div", children: r }),
|
|
448
448
|
c && /* @__PURE__ */ u(J, { onClick: i, size: "large", "aria-label": "Close left side panel", children: [
|
|
449
449
|
/* @__PURE__ */ o(ct, { "data-testid": "arrowbackicon" }),
|
|
@@ -518,14 +518,14 @@ function No({
|
|
|
518
518
|
navBarWidthOpen: m,
|
|
519
519
|
navBarWidthClosed: f
|
|
520
520
|
}) {
|
|
521
|
-
const [
|
|
521
|
+
const [w, g] = E(me), [S, C] = E(Ce), [k, I] = E(me), [T, P] = E(Ce), N = n !== void 0, D = i !== void 0, {
|
|
522
522
|
titleText: b,
|
|
523
523
|
content: H,
|
|
524
524
|
flavour: W,
|
|
525
525
|
open: h,
|
|
526
|
-
onChangeOpen:
|
|
527
|
-
width:
|
|
528
|
-
arrowButtons:
|
|
526
|
+
onChangeOpen: x,
|
|
527
|
+
width: v,
|
|
528
|
+
arrowButtons: A,
|
|
529
529
|
startOpen: M,
|
|
530
530
|
onOpened: j,
|
|
531
531
|
onClosed: le,
|
|
@@ -546,12 +546,12 @@ function No({
|
|
|
546
546
|
K(() => {
|
|
547
547
|
M !== me && (g(M), I(M));
|
|
548
548
|
}, [M]), K(() => {
|
|
549
|
-
te !== Ce && (
|
|
549
|
+
te !== Ce && (C(te), P(te));
|
|
550
550
|
}, [te]);
|
|
551
|
-
const pe = h === void 0 ?
|
|
552
|
-
h === void 0 && (g(z), r &&
|
|
551
|
+
const pe = h === void 0 ? w : h, ue = ce === void 0 ? S : ce, Ie = (z) => {
|
|
552
|
+
h === void 0 && (g(z), r && D && (z ? (C(!1), P(S)) : C(T))), x && x(z);
|
|
553
553
|
}, Te = (z) => {
|
|
554
|
-
ce === void 0 && (
|
|
554
|
+
ce === void 0 && (C(z), r && N && (z ? (g(!1), I(w)) : g(k))), $e && $e(z);
|
|
555
555
|
};
|
|
556
556
|
return /* @__PURE__ */ u($, { children: [
|
|
557
557
|
N && /* @__PURE__ */ o(
|
|
@@ -561,10 +561,10 @@ function No({
|
|
|
561
561
|
anchor: "left",
|
|
562
562
|
open: pe,
|
|
563
563
|
onClose: () => Ie(!1),
|
|
564
|
-
width:
|
|
564
|
+
width: v,
|
|
565
565
|
titleText: b,
|
|
566
566
|
debugOpacity: l,
|
|
567
|
-
showCloseArrow:
|
|
567
|
+
showCloseArrow: A === "both" || A === "close",
|
|
568
568
|
onOpened: j,
|
|
569
569
|
onClosed: le,
|
|
570
570
|
navBarOpen: d,
|
|
@@ -573,7 +573,7 @@ function No({
|
|
|
573
573
|
children: H
|
|
574
574
|
}
|
|
575
575
|
),
|
|
576
|
-
|
|
576
|
+
D && /* @__PURE__ */ o(
|
|
577
577
|
We,
|
|
578
578
|
{
|
|
579
579
|
"data-testid": Nt,
|
|
@@ -600,11 +600,11 @@ function No({
|
|
|
600
600
|
}, N && W === "push" ? {
|
|
601
601
|
leftPanel: {
|
|
602
602
|
open: pe,
|
|
603
|
-
width:
|
|
603
|
+
width: v,
|
|
604
604
|
onOpen: () => Ie(!0),
|
|
605
|
-
showOpenArrow:
|
|
605
|
+
showOpenArrow: A === "both" || A === "open"
|
|
606
606
|
}
|
|
607
|
-
} : {}),
|
|
607
|
+
} : {}), D && ye === "push" ? {
|
|
608
608
|
rightPanel: {
|
|
609
609
|
open: ue,
|
|
610
610
|
width: de,
|
|
@@ -618,7 +618,7 @@ function No({
|
|
|
618
618
|
y(s(s({}, W === "push" ? {
|
|
619
619
|
leftPanel: {
|
|
620
620
|
open: pe,
|
|
621
|
-
width:
|
|
621
|
+
width: v
|
|
622
622
|
}
|
|
623
623
|
} : {}), ye === "push" ? {
|
|
624
624
|
rightPanel: {
|
|
@@ -680,7 +680,7 @@ const ie = "Navbar", Y = {
|
|
|
680
680
|
}
|
|
681
681
|
}, e)
|
|
682
682
|
);
|
|
683
|
-
},
|
|
683
|
+
}, kt = (e) => {
|
|
684
684
|
var t, n;
|
|
685
685
|
return {
|
|
686
686
|
overflowX: "hidden",
|
|
@@ -691,10 +691,10 @@ const ie = "Navbar", Y = {
|
|
|
691
691
|
}, ze = (e, t) => s({
|
|
692
692
|
width: t,
|
|
693
693
|
transition: X(e, "width", "entering")
|
|
694
|
-
},
|
|
694
|
+
}, kt(e)), Ue = (e, t) => s({
|
|
695
695
|
width: t,
|
|
696
696
|
transition: X(e, "width", "leaving")
|
|
697
|
-
},
|
|
697
|
+
}, kt(e)), Nn = R(we, {
|
|
698
698
|
shouldForwardProp: (e) => !["widthOpen", "widthClosed", "isSmallScreen"].includes(e)
|
|
699
699
|
})(({ theme: e, open: t, widthOpen: n, widthClosed: i, isSmallScreen: r }) => s(s({
|
|
700
700
|
flexShrink: 0,
|
|
@@ -910,15 +910,15 @@ function Lo({
|
|
|
910
910
|
[Z, n != null ? n : !0],
|
|
911
911
|
[ve, t != null ? t : ""]
|
|
912
912
|
]);
|
|
913
|
-
const
|
|
913
|
+
const w = _e(Z), [g] = V(wt), [S] = V(At), C = _e(ve), [k] = V(St), [I] = V(On), [T] = V(bt);
|
|
914
914
|
return /* @__PURE__ */ u($, { children: [
|
|
915
915
|
/* @__PURE__ */ o(Ut, {}),
|
|
916
916
|
/* @__PURE__ */ o(
|
|
917
917
|
zn,
|
|
918
918
|
{
|
|
919
|
-
titleText:
|
|
919
|
+
titleText: C,
|
|
920
920
|
"data-testid": l,
|
|
921
|
-
height:
|
|
921
|
+
height: k,
|
|
922
922
|
middle: I
|
|
923
923
|
}
|
|
924
924
|
),
|
|
@@ -926,15 +926,15 @@ function Lo({
|
|
|
926
926
|
/* @__PURE__ */ o(
|
|
927
927
|
Mn,
|
|
928
928
|
{
|
|
929
|
-
open:
|
|
929
|
+
open: w,
|
|
930
930
|
top: T,
|
|
931
931
|
middle: p,
|
|
932
932
|
bottom: a,
|
|
933
933
|
user: d,
|
|
934
934
|
domainCode: m,
|
|
935
935
|
widthOpen: g,
|
|
936
|
-
widthClosed:
|
|
937
|
-
offsetTop:
|
|
936
|
+
widthClosed: S,
|
|
937
|
+
offsetTop: k,
|
|
938
938
|
"data-testid": c,
|
|
939
939
|
useNewAvatar: f
|
|
940
940
|
}
|
|
@@ -943,7 +943,7 @@ function Lo({
|
|
|
943
943
|
Rn,
|
|
944
944
|
y(s({
|
|
945
945
|
"data-testid": r,
|
|
946
|
-
topBarHeight:
|
|
946
|
+
topBarHeight: k
|
|
947
947
|
}, i), {
|
|
948
948
|
children: e
|
|
949
949
|
})
|
|
@@ -951,7 +951,7 @@ function Lo({
|
|
|
951
951
|
] })
|
|
952
952
|
] });
|
|
953
953
|
}
|
|
954
|
-
const
|
|
954
|
+
const Dt = ({
|
|
955
955
|
isOpen: e,
|
|
956
956
|
dialogTitle: t,
|
|
957
957
|
children: n,
|
|
@@ -964,14 +964,14 @@ const kt = ({
|
|
|
964
964
|
disableCloseOnBackdropOrEscape: d = !1,
|
|
965
965
|
isLoading: m = !1
|
|
966
966
|
}) => {
|
|
967
|
-
var g,
|
|
968
|
-
const [f,
|
|
967
|
+
var g, S;
|
|
968
|
+
const [f, w] = E(!1);
|
|
969
969
|
return /* @__PURE__ */ u(
|
|
970
970
|
tt,
|
|
971
971
|
{
|
|
972
972
|
open: e,
|
|
973
|
-
onClose: (
|
|
974
|
-
d && (
|
|
973
|
+
onClose: (C, k) => L(void 0, null, function* () {
|
|
974
|
+
d && (k === "backdropClick" || k === "escapeKeyDown") || f || (l != null && l.onClick ? yield l.onClick() : c());
|
|
975
975
|
}),
|
|
976
976
|
fullWidth: !0,
|
|
977
977
|
maxWidth: i != null ? i : "xs",
|
|
@@ -989,15 +989,15 @@ const kt = ({
|
|
|
989
989
|
"data-testid": l == null ? void 0 : l.testId,
|
|
990
990
|
disabled: (l == null ? void 0 : l.disabled) || f,
|
|
991
991
|
color: l == null ? void 0 : l.buttonColor,
|
|
992
|
-
children: (
|
|
992
|
+
children: (S = l == null ? void 0 : l.text) != null ? S : "Cancel"
|
|
993
993
|
}
|
|
994
994
|
),
|
|
995
995
|
r && /* @__PURE__ */ o(
|
|
996
996
|
ae,
|
|
997
997
|
{
|
|
998
998
|
onClick: () => L(void 0, null, function* () {
|
|
999
|
-
var
|
|
1000
|
-
|
|
999
|
+
var C;
|
|
1000
|
+
w(!0), yield (C = r.onClick) == null ? void 0 : C.call(r), w(!1);
|
|
1001
1001
|
}),
|
|
1002
1002
|
"data-testid": r.testId,
|
|
1003
1003
|
disabled: r.disabled || f,
|
|
@@ -1035,23 +1035,23 @@ function _o({
|
|
|
1035
1035
|
textFieldColor: d,
|
|
1036
1036
|
textFieldVariant: m = "filled",
|
|
1037
1037
|
loadingText: f = "Loading...",
|
|
1038
|
-
noOptionsText:
|
|
1038
|
+
noOptionsText: w = "No options",
|
|
1039
1039
|
popupIcon: g = /* @__PURE__ */ o(tn, {}),
|
|
1040
|
-
error:
|
|
1041
|
-
helperText:
|
|
1042
|
-
preLoadedOptions:
|
|
1040
|
+
error: S = !1,
|
|
1041
|
+
helperText: C = "",
|
|
1042
|
+
preLoadedOptions: k = void 0,
|
|
1043
1043
|
disablePortal: I = !1,
|
|
1044
1044
|
disableIconFlip: T = !1
|
|
1045
1045
|
}) {
|
|
1046
|
-
const [P, N] = E(""),
|
|
1047
|
-
const
|
|
1048
|
-
n(
|
|
1046
|
+
const [P, N] = E(""), D = (h, x) => {
|
|
1047
|
+
const v = l.filter((A) => A.id !== x);
|
|
1048
|
+
n(v, "delete", h);
|
|
1049
1049
|
}, { data: b, isLoading: H } = yt({
|
|
1050
1050
|
inputValue: P,
|
|
1051
1051
|
label: r,
|
|
1052
1052
|
lookup: e,
|
|
1053
1053
|
minLength: i,
|
|
1054
|
-
preLoadedOptions:
|
|
1054
|
+
preLoadedOptions: k
|
|
1055
1055
|
}), W = P.length >= i;
|
|
1056
1056
|
return /* @__PURE__ */ u("div", { "data-testid": c, children: [
|
|
1057
1057
|
/* @__PURE__ */ o(
|
|
@@ -1067,11 +1067,11 @@ function _o({
|
|
|
1067
1067
|
filterSelectedOptions: !0,
|
|
1068
1068
|
includeInputInList: !0,
|
|
1069
1069
|
value: l,
|
|
1070
|
-
onChange: (h,
|
|
1071
|
-
n(
|
|
1070
|
+
onChange: (h, x, v) => {
|
|
1071
|
+
n(x, v, h);
|
|
1072
1072
|
},
|
|
1073
|
-
onInputChange: (h,
|
|
1074
|
-
noOptionsText: W ?
|
|
1073
|
+
onInputChange: (h, x) => N(x),
|
|
1074
|
+
noOptionsText: W ? w : "Start typing to search",
|
|
1075
1075
|
loadingText: f,
|
|
1076
1076
|
popupIcon: g,
|
|
1077
1077
|
renderInput: (h) => /* @__PURE__ */ o(
|
|
@@ -1080,34 +1080,34 @@ function _o({
|
|
|
1080
1080
|
label: r,
|
|
1081
1081
|
fullWidth: !0,
|
|
1082
1082
|
variant: m,
|
|
1083
|
-
error:
|
|
1084
|
-
helperText:
|
|
1083
|
+
error: S,
|
|
1084
|
+
helperText: C,
|
|
1085
1085
|
InputProps: y(s({}, h.InputProps), {
|
|
1086
1086
|
endAdornment: /* @__PURE__ */ u(F, { children: [
|
|
1087
|
-
H ? /* @__PURE__ */ o(
|
|
1087
|
+
H ? /* @__PURE__ */ o(ke, { color: "inherit", size: 20 }) : null,
|
|
1088
1088
|
h.InputProps.endAdornment
|
|
1089
1089
|
] })
|
|
1090
1090
|
}),
|
|
1091
1091
|
"data-testid": c ? `${c}:Autocomplete:TextField` : void 0,
|
|
1092
|
-
onKeyDown: (
|
|
1093
|
-
(
|
|
1092
|
+
onKeyDown: (x) => {
|
|
1093
|
+
(x.key === "Backspace" || x.key === "Delete") && x.stopPropagation();
|
|
1094
1094
|
},
|
|
1095
1095
|
color: d
|
|
1096
1096
|
})
|
|
1097
1097
|
),
|
|
1098
1098
|
renderTags: () => null,
|
|
1099
|
-
isOptionEqualToValue: (h,
|
|
1100
|
-
renderOption: (h,
|
|
1099
|
+
isOptionEqualToValue: (h, x) => h.id === x.id,
|
|
1100
|
+
renderOption: (h, x, v) => {
|
|
1101
1101
|
if (t) {
|
|
1102
|
-
const
|
|
1102
|
+
const A = on(x.label, v.inputValue, {
|
|
1103
1103
|
insideWords: !0,
|
|
1104
1104
|
findAllOccurrences: !0
|
|
1105
|
-
}), M = rn(
|
|
1105
|
+
}), M = rn(x.label, A);
|
|
1106
1106
|
return /* @__PURE__ */ xe(
|
|
1107
1107
|
"li",
|
|
1108
1108
|
y(s({}, h), {
|
|
1109
|
-
key:
|
|
1110
|
-
"data-testid": c ? `${c}:Autocomplete:option(${
|
|
1109
|
+
key: x.id,
|
|
1110
|
+
"data-testid": c ? `${c}:Autocomplete:option(${x.id.toString()})` : void 0
|
|
1111
1111
|
}),
|
|
1112
1112
|
/* @__PURE__ */ o("div", { children: M.map((j, le) => /* @__PURE__ */ o(
|
|
1113
1113
|
"span",
|
|
@@ -1124,10 +1124,10 @@ function _o({
|
|
|
1124
1124
|
return /* @__PURE__ */ xe(
|
|
1125
1125
|
"li",
|
|
1126
1126
|
y(s({}, h), {
|
|
1127
|
-
key:
|
|
1128
|
-
"data-testid": c ? `${c}:option(${
|
|
1127
|
+
key: x.id,
|
|
1128
|
+
"data-testid": c ? `${c}:option(${x.id.toString()})` : void 0
|
|
1129
1129
|
}),
|
|
1130
|
-
|
|
1130
|
+
x.label
|
|
1131
1131
|
);
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
@@ -1159,7 +1159,7 @@ function _o({
|
|
|
1159
1159
|
}
|
|
1160
1160
|
),
|
|
1161
1161
|
"data-testid": c ? `${c}:Chip(${h.id.toString()})` : void 0,
|
|
1162
|
-
onDelete: (
|
|
1162
|
+
onDelete: (x) => D(x, h.id),
|
|
1163
1163
|
deleteIcon: /* @__PURE__ */ o(
|
|
1164
1164
|
en,
|
|
1165
1165
|
{
|
|
@@ -1185,52 +1185,52 @@ const Mo = ({
|
|
|
1185
1185
|
minLength: d = 3,
|
|
1186
1186
|
disablePortal: m = !1,
|
|
1187
1187
|
preLoadedOptions: f,
|
|
1188
|
-
helperText:
|
|
1188
|
+
helperText: w = "",
|
|
1189
1189
|
disabled: g,
|
|
1190
|
-
popupIcon:
|
|
1191
|
-
disableIconFlip:
|
|
1190
|
+
popupIcon: S,
|
|
1191
|
+
disableIconFlip: C
|
|
1192
1192
|
}) => {
|
|
1193
|
-
const [
|
|
1194
|
-
inputValue:
|
|
1193
|
+
const [k, I] = E(""), { data: T, isLoading: P } = yt({
|
|
1194
|
+
inputValue: k,
|
|
1195
1195
|
label: n,
|
|
1196
1196
|
lookup: e,
|
|
1197
1197
|
minLength: d != null ? d : 0,
|
|
1198
1198
|
preLoadedOptions: f
|
|
1199
|
-
}), N =
|
|
1199
|
+
}), N = k.length >= d;
|
|
1200
1200
|
return /* @__PURE__ */ o("div", { "data-testid": p, children: /* @__PURE__ */ o(qt, { direction: "row", spacing: 1, children: /* @__PURE__ */ o(
|
|
1201
1201
|
Se,
|
|
1202
1202
|
{
|
|
1203
|
-
sx: s(s({}, r),
|
|
1203
|
+
sx: s(s({}, r), C ? { ".MuiAutocomplete-popupIndicatorOpen": { transform: "rotate(0deg)" } } : {}),
|
|
1204
1204
|
"data-testid": p ? `${p}:Autocomplete` : void 0,
|
|
1205
1205
|
loading: N ? P : !1,
|
|
1206
1206
|
options: T != null ? T : [],
|
|
1207
|
-
onChange: (
|
|
1208
|
-
t(
|
|
1207
|
+
onChange: (D, b) => {
|
|
1208
|
+
t(D, b);
|
|
1209
1209
|
},
|
|
1210
1210
|
disablePortal: m,
|
|
1211
|
-
filterOptions: (
|
|
1211
|
+
filterOptions: (D) => D,
|
|
1212
1212
|
value: i,
|
|
1213
1213
|
noOptionsText: N ? a : "Start typing to search",
|
|
1214
|
-
getOptionLabel: (
|
|
1215
|
-
popupIcon:
|
|
1216
|
-
renderInput: (
|
|
1214
|
+
getOptionLabel: (D) => D.label,
|
|
1215
|
+
popupIcon: S,
|
|
1216
|
+
renderInput: (D) => /* @__PURE__ */ o(
|
|
1217
1217
|
be,
|
|
1218
1218
|
y(s({
|
|
1219
1219
|
"data-testid": p ? `${p}:Autocomplete:TextField` : void 0
|
|
1220
|
-
},
|
|
1220
|
+
}, D), {
|
|
1221
1221
|
variant: c,
|
|
1222
1222
|
label: n,
|
|
1223
1223
|
color: l,
|
|
1224
|
-
helperText:
|
|
1224
|
+
helperText: w
|
|
1225
1225
|
})
|
|
1226
1226
|
),
|
|
1227
|
-
isOptionEqualToValue: (
|
|
1228
|
-
onInputChange: (
|
|
1227
|
+
isOptionEqualToValue: (D, b) => D.id === b.id,
|
|
1228
|
+
onInputChange: (D, b) => {
|
|
1229
1229
|
I(b);
|
|
1230
1230
|
},
|
|
1231
|
-
renderOption: (
|
|
1231
|
+
renderOption: (D, b) => /* @__PURE__ */ xe(
|
|
1232
1232
|
"li",
|
|
1233
|
-
y(s({},
|
|
1233
|
+
y(s({}, D), {
|
|
1234
1234
|
key: b.id,
|
|
1235
1235
|
"data-testid": p ? `${p}:Autocomplete:option(${b.id.toString()})` : void 0
|
|
1236
1236
|
}),
|
|
@@ -1265,12 +1265,12 @@ const Mo = ({
|
|
|
1265
1265
|
return K(() => {
|
|
1266
1266
|
(() => L(void 0, null, function* () {
|
|
1267
1267
|
if (l > 0) {
|
|
1268
|
-
const
|
|
1268
|
+
const w = yield r({ cacheMode: "off" }), g = Un(w) * 1e3;
|
|
1269
1269
|
n(g);
|
|
1270
1270
|
}
|
|
1271
1271
|
}))();
|
|
1272
1272
|
}, [l, r, n]), /* @__PURE__ */ o(
|
|
1273
|
-
|
|
1273
|
+
Dt,
|
|
1274
1274
|
{
|
|
1275
1275
|
isOpen: e,
|
|
1276
1276
|
primaryButton: {
|
|
@@ -1321,19 +1321,23 @@ function Ho({
|
|
|
1321
1321
|
},
|
|
1322
1322
|
withPopup: l = !1
|
|
1323
1323
|
}) {
|
|
1324
|
-
var
|
|
1324
|
+
var w, g;
|
|
1325
1325
|
const { isAuthenticated: c, isLoading: p, error: a, loginWithRedirect: d, loginWithPopup: m, logout: f } = ht();
|
|
1326
1326
|
if (K(() => {
|
|
1327
1327
|
a && r(a);
|
|
1328
1328
|
}, [a, r]), K(() => {
|
|
1329
1329
|
if (p || c || a)
|
|
1330
1330
|
return;
|
|
1331
|
-
const
|
|
1331
|
+
const S = {
|
|
1332
1332
|
appState: {
|
|
1333
1333
|
returnTo: `${window.location.pathname}${window.location.search}`
|
|
1334
1334
|
}
|
|
1335
1335
|
};
|
|
1336
|
-
|
|
1336
|
+
if (l) {
|
|
1337
|
+
const C = document.createElement("button");
|
|
1338
|
+
C.onclick = () => m(), C.click(), C.remove();
|
|
1339
|
+
} else
|
|
1340
|
+
d(S);
|
|
1337
1341
|
}, [p, c, a, d, r, l, m]), a) {
|
|
1338
1342
|
if (i || console.error(
|
|
1339
1343
|
`Error detected in AuthGuard [isAuthenticated=${c},isLoading=${p}]`,
|
|
@@ -1341,24 +1345,24 @@ function Ho({
|
|
|
1341
1345
|
), n === "all")
|
|
1342
1346
|
throw a;
|
|
1343
1347
|
if (Gn(a)) {
|
|
1344
|
-
let
|
|
1348
|
+
let S = "Auth error", C = "An unknown Auth0 error occurred.";
|
|
1345
1349
|
if (Vn(a))
|
|
1346
|
-
|
|
1350
|
+
S = "Unauthorised", C = `You are not authorised to access ${t}.`;
|
|
1347
1351
|
else if (qn(a))
|
|
1348
|
-
|
|
1352
|
+
S = "App not authorised", C = `You have not authorised ${t} to access your user profile. This is necessary to use ${t}.`;
|
|
1349
1353
|
else if (Xn(a))
|
|
1350
|
-
|
|
1354
|
+
S = "Auth0 script execution time exceeded", C = "The Auth0 login flow exceeded the time limit (20s). Try again in a minute.";
|
|
1351
1355
|
else if (n === "unknown")
|
|
1352
1356
|
throw a;
|
|
1353
1357
|
return /* @__PURE__ */ u(tt, { open: !0, children: [
|
|
1354
|
-
/* @__PURE__ */ o(ot, { children:
|
|
1358
|
+
/* @__PURE__ */ o(ot, { children: S }),
|
|
1355
1359
|
/* @__PURE__ */ u(it, { children: [
|
|
1356
|
-
/* @__PURE__ */ o(B, { children:
|
|
1360
|
+
/* @__PURE__ */ o(B, { children: C }),
|
|
1357
1361
|
/* @__PURE__ */ o("br", {}),
|
|
1358
1362
|
/* @__PURE__ */ o(B, { variant: "subtitle2", children: "Details from Auth0" }),
|
|
1359
1363
|
/* @__PURE__ */ u(B, { variant: "body2", children: [
|
|
1360
1364
|
"error: ",
|
|
1361
|
-
(
|
|
1365
|
+
(w = a == null ? void 0 : a.error) != null ? w : "N/A"
|
|
1362
1366
|
] }),
|
|
1363
1367
|
/* @__PURE__ */ u(B, { variant: "body2", children: [
|
|
1364
1368
|
"description: ",
|
|
@@ -1405,35 +1409,35 @@ function to(l) {
|
|
|
1405
1409
|
"shouldClose",
|
|
1406
1410
|
"children"
|
|
1407
1411
|
]);
|
|
1408
|
-
var
|
|
1409
|
-
const [{ open: p }, a] = E({ open: !1 }), d = ge([]), m = ge(Date.now()), f = ge(0),
|
|
1410
|
-
a({ open:
|
|
1411
|
-
}, []), g = re((
|
|
1412
|
+
var x;
|
|
1413
|
+
const [{ open: p }, a] = E({ open: !1 }), d = ge([]), m = ge(Date.now()), f = ge(0), w = re((v) => {
|
|
1414
|
+
a({ open: v });
|
|
1415
|
+
}, []), g = re((v = {}) => {
|
|
1412
1416
|
f.current += 1, d.current.length >= Xe && Date.now() - m.current >= Qe && (m.current = Date.now(), console.error(
|
|
1413
1417
|
`SaladBarProvider: MAX_QUEUE_LENGTH (${Xe}) hit ${f.current} times in last ${Qe}ms)`
|
|
1414
1418
|
), f.current = 0);
|
|
1415
|
-
const
|
|
1419
|
+
const A = s(y(s({}, qe), {
|
|
1416
1420
|
key: Jn()
|
|
1417
|
-
}),
|
|
1418
|
-
return d.current.push(
|
|
1419
|
-
}, []),
|
|
1420
|
-
const
|
|
1421
|
-
if (
|
|
1422
|
-
return
|
|
1423
|
-
}, P = (
|
|
1424
|
-
n(
|
|
1421
|
+
}), v);
|
|
1422
|
+
return d.current.push(A), d.current.length === 1 && a({ open: !0 }), A.key;
|
|
1423
|
+
}, []), S = (v = "", A = {}) => g(s({ message: v, severity: "success" }, A)), C = (v = "", A = {}) => g(s({ message: v, severity: "info" }, A)), k = (v = "", A = {}) => g(s({ message: v, severity: "warning" }, A)), I = (v = "", A = {}) => g(s({ message: v, severity: "error" }, A)), T = (v) => {
|
|
1424
|
+
const A = d.current.findIndex((M) => M.key === v);
|
|
1425
|
+
if (A !== -1)
|
|
1426
|
+
return A === 0 ? (a({ open: !1 }), d.current[0]) : d.current.splice(A, 1);
|
|
1427
|
+
}, P = (v, A) => {
|
|
1428
|
+
n(v, A) && a({ open: !1 });
|
|
1425
1429
|
}, N = () => {
|
|
1426
|
-
},
|
|
1430
|
+
}, D = () => {
|
|
1427
1431
|
d.current.shift(), d.current.length > 0 && a({ open: !0 });
|
|
1428
|
-
}, b = (
|
|
1432
|
+
}, b = (x = d.current[0]) != null ? x : s({}, qe), H = {};
|
|
1429
1433
|
"autoHideDuration" in b && (H.autoHideDuration = b.autoHideDuration);
|
|
1430
1434
|
const W = s(s({}, Qn), r), h = s(s({
|
|
1431
1435
|
open: p,
|
|
1432
|
-
setOpen:
|
|
1436
|
+
setOpen: w,
|
|
1433
1437
|
enqueueNotification: g,
|
|
1434
|
-
enqueueSuccessNotification:
|
|
1435
|
-
enqueueInfoNotification:
|
|
1436
|
-
enqueueWarningNotification:
|
|
1438
|
+
enqueueSuccessNotification: S,
|
|
1439
|
+
enqueueInfoNotification: C,
|
|
1440
|
+
enqueueWarningNotification: k,
|
|
1437
1441
|
enqueueErrorNotification: I,
|
|
1438
1442
|
removeNotification: T
|
|
1439
1443
|
}, e), t);
|
|
@@ -1445,7 +1449,7 @@ function to(l) {
|
|
|
1445
1449
|
open: p,
|
|
1446
1450
|
onClose: P,
|
|
1447
1451
|
TransitionProps: {
|
|
1448
|
-
onExited:
|
|
1452
|
+
onExited: D,
|
|
1449
1453
|
onExit: N
|
|
1450
1454
|
},
|
|
1451
1455
|
sx: { zIndex: Kn },
|
|
@@ -1453,10 +1457,10 @@ function to(l) {
|
|
|
1453
1457
|
/* @__PURE__ */ o(
|
|
1454
1458
|
Qt,
|
|
1455
1459
|
{
|
|
1456
|
-
onClose: (
|
|
1460
|
+
onClose: (v) => P(v, "closeAlert"),
|
|
1457
1461
|
severity: b.severity,
|
|
1458
1462
|
variant: "filled",
|
|
1459
|
-
icon: b.progressIndicator === "circular" ? /* @__PURE__ */ o(
|
|
1463
|
+
icon: b.progressIndicator === "circular" ? /* @__PURE__ */ o(ke, { size: "1em" }) : void 0,
|
|
1460
1464
|
style: b.progressIndicator === "linear" ? Zn : void 0,
|
|
1461
1465
|
children: b.message
|
|
1462
1466
|
}
|
|
@@ -1470,7 +1474,7 @@ function to(l) {
|
|
|
1470
1474
|
function no() {
|
|
1471
1475
|
const e = Ze($t);
|
|
1472
1476
|
if (e === null)
|
|
1473
|
-
throw new
|
|
1477
|
+
throw new De("Error: Tried to useSaladBar outside of a <SaladBarProvider>");
|
|
1474
1478
|
return e;
|
|
1475
1479
|
}
|
|
1476
1480
|
const Wo = Q(
|
|
@@ -1510,26 +1514,26 @@ const Ye = _(
|
|
|
1510
1514
|
applicationName: r,
|
|
1511
1515
|
handleLogout: l
|
|
1512
1516
|
}) => {
|
|
1513
|
-
const [c, p] = V(Tt), [a, d] = E(c), { enqueueSuccessNotification: m } = no(), f = i.length === 0,
|
|
1517
|
+
const [c, p] = V(Tt), [a, d] = E(c), { enqueueSuccessNotification: m } = no(), f = i.length === 0, w = !!c && !i.includes(c) && !i.includes(a), g = !c || f || w, S = () => L(void 0, null, function* () {
|
|
1514
1518
|
a ? (p(a), m(`Set organisation to ${a}`), n()) : p("");
|
|
1515
|
-
}),
|
|
1516
|
-
c && !f && !
|
|
1519
|
+
}), C = () => L(void 0, null, function* () {
|
|
1520
|
+
c && !f && !w ? (d(c), n()) : g && l();
|
|
1517
1521
|
});
|
|
1518
|
-
let
|
|
1519
|
-
return f ?
|
|
1520
|
-
|
|
1522
|
+
let k;
|
|
1523
|
+
return f ? k = "Unable to retrieve your active organisations. Try logging in again." : w && (k = "You no longer have any roles in your chosen organisation. Please choose another."), /* @__PURE__ */ u(
|
|
1524
|
+
Dt,
|
|
1521
1525
|
{
|
|
1522
1526
|
isOpen: t,
|
|
1523
1527
|
dialogTitle: "Select an organisation",
|
|
1524
1528
|
primaryButton: {
|
|
1525
1529
|
text: "Confirm",
|
|
1526
|
-
onClick:
|
|
1527
|
-
disabled: !a || f ||
|
|
1530
|
+
onClick: S,
|
|
1531
|
+
disabled: !a || f || w,
|
|
1528
1532
|
buttonColor: "primary"
|
|
1529
1533
|
},
|
|
1530
1534
|
secondaryButton: {
|
|
1531
1535
|
text: g ? "Logout" : "Cancel",
|
|
1532
|
-
onClick:
|
|
1536
|
+
onClick: C
|
|
1533
1537
|
},
|
|
1534
1538
|
onClose: g ? () => {
|
|
1535
1539
|
} : n,
|
|
@@ -1556,7 +1560,7 @@ const Ye = _(
|
|
|
1556
1560
|
label: "Select organisation",
|
|
1557
1561
|
InputProps: y(s({}, I.InputProps), {
|
|
1558
1562
|
endAdornment: /* @__PURE__ */ u(F, { children: [
|
|
1559
|
-
e ? /* @__PURE__ */ o(
|
|
1563
|
+
e ? /* @__PURE__ */ o(ke, { color: "inherit", size: 20, sx: { marginTop: "-20px" } }) : null,
|
|
1560
1564
|
I.InputProps.endAdornment
|
|
1561
1565
|
] })
|
|
1562
1566
|
})
|
|
@@ -1564,7 +1568,7 @@ const Ye = _(
|
|
|
1564
1568
|
)
|
|
1565
1569
|
}
|
|
1566
1570
|
),
|
|
1567
|
-
|
|
1571
|
+
k && /* @__PURE__ */ o(Yt, { error: !0, children: k })
|
|
1568
1572
|
]
|
|
1569
1573
|
}
|
|
1570
1574
|
);
|
|
@@ -1742,12 +1746,12 @@ const Ye = _(
|
|
|
1742
1746
|
return /* @__PURE__ */ o(ln, { client: t, children: e });
|
|
1743
1747
|
});
|
|
1744
1748
|
export {
|
|
1745
|
-
|
|
1749
|
+
Dt as AgDialog,
|
|
1746
1750
|
Lo as AppLayout,
|
|
1747
1751
|
zo as AtomProvider,
|
|
1748
1752
|
Ho as AuthGuard,
|
|
1749
1753
|
$t as Context,
|
|
1750
|
-
|
|
1754
|
+
De as ContextError,
|
|
1751
1755
|
Uo as DomainCodeDialog,
|
|
1752
1756
|
To as ExampleComponent,
|
|
1753
1757
|
_o as FetchAutocomplete,
|