@australiangreens/ag-internal-components 0.0.85 → 0.0.87
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 P = (e, t, n) => new Promise((i, r) => {
|
|
|
38
38
|
});
|
|
39
39
|
import { jsxs as p, Fragment as _, jsx as o } from "react/jsx-runtime";
|
|
40
40
|
import { useState as E, createContext as Qe, useCallback as ne, useContext as Ye, createElement as Ce, useEffect as oe, useRef as he } from "react";
|
|
41
|
-
import { Typography as F, Button as ie, Paper as Ke, Box as
|
|
41
|
+
import { Typography as F, Button as ie, Paper as Ke, Box as $, Drawer as ve, Dialog as Je, LinearProgress as Ze, DialogTitle as je, DialogContent as et, DialogActions as tt, Autocomplete as we, TextField as Ae, CircularProgress as be, Chip as _t, Tooltip as Mt, Stack as Rt, styled as Se, IconButton as Q, Container as nt, useTheme as ae, useMediaQuery as Ht, Collapse as Wt, Avatar as Fe, Fade as zt, Skeleton as Pe, Toolbar as Ut, Divider as Ne, CssBaseline as Gt, Snackbar as Vt, Alert as qt, FormHelperText as Xt } from "@mui/material";
|
|
42
42
|
import Qt from "@mui/material/CssBaseline";
|
|
43
43
|
import { styled as R, createTheme as ot, alpha as ge } from "@mui/material/styles";
|
|
44
44
|
import { AgError as Yt } from "@australiangreens/ag-error";
|
|
@@ -85,7 +85,7 @@ const ut = 330, pt = 73, U = "Navbar", q = {
|
|
|
85
85
|
userInfoHolder: `${U}-userInfoHolder`,
|
|
86
86
|
settings: `${U}-settings`,
|
|
87
87
|
pieChartIcon: `${U}-pieChartIcon`
|
|
88
|
-
}, ln = R(
|
|
88
|
+
}, ln = R($, {
|
|
89
89
|
name: "NavBar"
|
|
90
90
|
})(({ theme: e }) => ({
|
|
91
91
|
[`&.${q.root}`]: {
|
|
@@ -343,7 +343,7 @@ function Oo({
|
|
|
343
343
|
error: k = !1,
|
|
344
344
|
helperText: b = "",
|
|
345
345
|
preLoadedOptions: D = void 0,
|
|
346
|
-
disablePortal:
|
|
346
|
+
disablePortal: I = !1
|
|
347
347
|
}) {
|
|
348
348
|
const [x, y] = E(""), H = (h, f) => {
|
|
349
349
|
const B = a.filter((m) => m.id !== f);
|
|
@@ -361,7 +361,7 @@ function Oo({
|
|
|
361
361
|
{
|
|
362
362
|
sx: d,
|
|
363
363
|
"data-testid": c ? `${c}:Autocomplete` : void 0,
|
|
364
|
-
disablePortal:
|
|
364
|
+
disablePortal: I,
|
|
365
365
|
multiple: !0,
|
|
366
366
|
getOptionLabel: (h) => typeof h == "string" ? h : h.label,
|
|
367
367
|
loading: W ? T : !1,
|
|
@@ -434,7 +434,7 @@ function Oo({
|
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
),
|
|
437
|
-
a.length > 0 && /* @__PURE__ */ o(
|
|
437
|
+
a.length > 0 && /* @__PURE__ */ o($, { sx: l, children: a.map((h) => /* @__PURE__ */ o(
|
|
438
438
|
_t,
|
|
439
439
|
{
|
|
440
440
|
sx: {
|
|
@@ -495,13 +495,13 @@ const Eo = ({
|
|
|
495
495
|
lookup: e,
|
|
496
496
|
minLength: u != null ? u : 0,
|
|
497
497
|
preLoadedOptions: C
|
|
498
|
-
}),
|
|
498
|
+
}), I = g.length >= u;
|
|
499
499
|
return /* @__PURE__ */ o("div", { "data-testid": d, children: /* @__PURE__ */ o(Rt, { direction: "row", spacing: 1, children: /* @__PURE__ */ o(
|
|
500
500
|
we,
|
|
501
501
|
{
|
|
502
502
|
sx: r,
|
|
503
503
|
"data-testid": d ? `${d}:Autocomplete` : void 0,
|
|
504
|
-
loading:
|
|
504
|
+
loading: I ? D : !1,
|
|
505
505
|
options: b != null ? b : [],
|
|
506
506
|
onChange: (x, y) => {
|
|
507
507
|
t(x, y);
|
|
@@ -509,7 +509,7 @@ const Eo = ({
|
|
|
509
509
|
disablePortal: w,
|
|
510
510
|
filterOptions: (x) => x,
|
|
511
511
|
value: i,
|
|
512
|
-
noOptionsText:
|
|
512
|
+
noOptionsText: I ? l : "Start typing to search",
|
|
513
513
|
getOptionLabel: (x) => x.label,
|
|
514
514
|
renderInput: (x) => /* @__PURE__ */ o(
|
|
515
515
|
Ae,
|
|
@@ -698,7 +698,7 @@ function Dn({
|
|
|
698
698
|
}) {
|
|
699
699
|
return /* @__PURE__ */ p(kn, { leftPanel: t, rightPanel: n, "data-testid": i, children: [
|
|
700
700
|
/* @__PURE__ */ o("div", { className: O.topStripe }),
|
|
701
|
-
/* @__PURE__ */ o("div", { className: O.titleBar, children: /* @__PURE__ */ p(
|
|
701
|
+
/* @__PURE__ */ o("div", { className: O.titleBar, children: /* @__PURE__ */ p($, { className: O.titleSlider, children: [
|
|
702
702
|
t !== void 0 && !t.open && t.showOpenArrow && /* @__PURE__ */ p(
|
|
703
703
|
Q,
|
|
704
704
|
{
|
|
@@ -763,7 +763,7 @@ const Ct = 400, yn = Se(ve, {
|
|
|
763
763
|
marginLeft: `${r}px`
|
|
764
764
|
}))
|
|
765
765
|
})
|
|
766
|
-
), $n = Se(
|
|
766
|
+
), $n = Se($, {
|
|
767
767
|
shouldForwardProp: (e) => !["anchor"].includes(e)
|
|
768
768
|
})(({ theme: e, anchor: t }) => S(s({
|
|
769
769
|
display: "flex",
|
|
@@ -836,7 +836,7 @@ function Re({
|
|
|
836
836
|
}
|
|
837
837
|
);
|
|
838
838
|
}
|
|
839
|
-
const In = R(
|
|
839
|
+
const In = R($, {
|
|
840
840
|
shouldForwardProp: (e) => !["leftPanel", "rightPanel"].includes(e),
|
|
841
841
|
name: "PanelAwareMargins"
|
|
842
842
|
})(({ theme: e, leftPanel: t, rightPanel: n }) => {
|
|
@@ -893,7 +893,7 @@ function Po({
|
|
|
893
893
|
navBarWidthOpen: w,
|
|
894
894
|
navBarWidthClosed: C
|
|
895
895
|
}) {
|
|
896
|
-
const [A, g] = E(fe), [k, b] = E(me), [D,
|
|
896
|
+
const [A, g] = E(fe), [k, b] = E(me), [D, I] = E(fe), [x, y] = E(me), H = n !== void 0, N = i !== void 0, {
|
|
897
897
|
titleText: T,
|
|
898
898
|
content: W,
|
|
899
899
|
flavour: h,
|
|
@@ -919,16 +919,16 @@ function Po({
|
|
|
919
919
|
dataTestId: Ft
|
|
920
920
|
} = i ? s(s({}, ee), i) : s({}, ee);
|
|
921
921
|
oe(() => {
|
|
922
|
-
L !== fe && (g(L),
|
|
922
|
+
L !== fe && (g(L), I(L));
|
|
923
923
|
}, [L]), oe(() => {
|
|
924
924
|
Z !== me && (b(Z), y(Z));
|
|
925
925
|
}, [Z]);
|
|
926
926
|
const de = f === void 0 ? A : f, ue = le === void 0 ? k : le, $e = (z) => {
|
|
927
927
|
f === void 0 && (g(z), r && N && (z ? (b(!1), y(k)) : b(x))), B && B(z);
|
|
928
928
|
}, Ie = (z) => {
|
|
929
|
-
le === void 0 && (b(z), r && H && (z ? (g(!1),
|
|
929
|
+
le === void 0 && (b(z), r && H && (z ? (g(!1), I(A)) : g(D))), ye && ye(z);
|
|
930
930
|
};
|
|
931
|
-
return /* @__PURE__ */ p(
|
|
931
|
+
return /* @__PURE__ */ p($, { children: [
|
|
932
932
|
H && /* @__PURE__ */ o(
|
|
933
933
|
Re,
|
|
934
934
|
{
|
|
@@ -1021,7 +1021,7 @@ const te = "Navbar", X = {
|
|
|
1021
1021
|
// userInfoHolder: `${PREFIX}-userInfoHolder`,
|
|
1022
1022
|
// settings: `${PREFIX}-settings`,
|
|
1023
1023
|
// pieChartIcon: `${PREFIX}-pieChartIcon`,
|
|
1024
|
-
}, Nn = R(
|
|
1024
|
+
}, Nn = R($, { name: "NavBar" })(({ theme: e }) => ({
|
|
1025
1025
|
[`&.${X.root}`]: {
|
|
1026
1026
|
display: "flex"
|
|
1027
1027
|
},
|
|
@@ -1096,7 +1096,7 @@ const ze = ["#A62A21", "#7e3794", "#0B51C1", "#3A6024", "#A81563", "#B3003C"], R
|
|
|
1096
1096
|
function Hn({ user: e, domainCode: t, open: n }) {
|
|
1097
1097
|
const i = ae();
|
|
1098
1098
|
return /* @__PURE__ */ p(
|
|
1099
|
-
|
|
1099
|
+
$,
|
|
1100
1100
|
{
|
|
1101
1101
|
sx: {
|
|
1102
1102
|
paddingTop: 3,
|
|
@@ -1107,7 +1107,7 @@ function Hn({ user: e, domainCode: t, open: n }) {
|
|
|
1107
1107
|
},
|
|
1108
1108
|
children: [
|
|
1109
1109
|
/* @__PURE__ */ o(
|
|
1110
|
-
|
|
1110
|
+
$,
|
|
1111
1111
|
{
|
|
1112
1112
|
sx: {
|
|
1113
1113
|
width: n ? "5rem" : "2rem",
|
|
@@ -1128,7 +1128,7 @@ function Hn({ user: e, domainCode: t, open: n }) {
|
|
|
1128
1128
|
) : /* @__PURE__ */ o(Fe, { sx: { width: "100%", height: "100%" } })
|
|
1129
1129
|
}
|
|
1130
1130
|
),
|
|
1131
|
-
/* @__PURE__ */ o(Ln, { sx: { width: "100%" }, in: n, children: /* @__PURE__ */ o(zt, { in: n, children: /* @__PURE__ */ p(
|
|
1131
|
+
/* @__PURE__ */ o(Ln, { sx: { width: "100%" }, in: n, children: /* @__PURE__ */ o(zt, { in: n, children: /* @__PURE__ */ p($, { width: "100%", display: "flex", flexDirection: "column", alignItems: "center", children: [
|
|
1132
1132
|
e != null && e.name ? /* @__PURE__ */ o(F, { children: e.name }) : /* @__PURE__ */ o(Pe, { animation: !1, width: "50%" }),
|
|
1133
1133
|
t ? /* @__PURE__ */ o(F, { children: t.toUpperCase() }) : /* @__PURE__ */ o(Pe, { animation: !1, width: "25%" })
|
|
1134
1134
|
] }) }) })
|
|
@@ -1165,12 +1165,12 @@ function Wn({
|
|
|
1165
1165
|
isSmallScreen: u,
|
|
1166
1166
|
children: [
|
|
1167
1167
|
!u && /* @__PURE__ */ o(Ut, {}),
|
|
1168
|
-
r && /* @__PURE__ */ p(
|
|
1168
|
+
r && /* @__PURE__ */ p($, { flexGrow: "0", children: [
|
|
1169
1169
|
r,
|
|
1170
1170
|
/* @__PURE__ */ o(Ne, { variant: "middle", sx: { marginY: "0.5rem" } })
|
|
1171
1171
|
] }),
|
|
1172
|
-
/* @__PURE__ */ o(
|
|
1173
|
-
/* @__PURE__ */ p(
|
|
1172
|
+
/* @__PURE__ */ o($, { flexGrow: "1", children: Array.isArray(a) ? /* @__PURE__ */ o(Pn, { links: a }) : a }),
|
|
1173
|
+
/* @__PURE__ */ p($, { flexGrow: "0", children: [
|
|
1174
1174
|
/* @__PURE__ */ o(Ne, { variant: "middle", sx: { marginY: "0.5rem" } }),
|
|
1175
1175
|
/* @__PURE__ */ o(Hn, { user: d, domainCode: l, open: e }),
|
|
1176
1176
|
c && /* @__PURE__ */ o(_, { children: c })
|
|
@@ -1182,10 +1182,11 @@ function Wn({
|
|
|
1182
1182
|
function zn({
|
|
1183
1183
|
children: e,
|
|
1184
1184
|
topBarHeight: t,
|
|
1185
|
-
maxWidth: n = !1
|
|
1185
|
+
maxWidth: n = !1,
|
|
1186
|
+
noPadding: i
|
|
1186
1187
|
}) {
|
|
1187
1188
|
return /* @__PURE__ */ o(
|
|
1188
|
-
|
|
1189
|
+
$,
|
|
1189
1190
|
{
|
|
1190
1191
|
sx: {
|
|
1191
1192
|
overflow: "auto",
|
|
@@ -1194,7 +1195,7 @@ function zn({
|
|
|
1194
1195
|
// scrollbarGutter: 'stable both-edges',
|
|
1195
1196
|
flexGrow: 1
|
|
1196
1197
|
},
|
|
1197
|
-
children: /* @__PURE__ */ o(
|
|
1198
|
+
children: i ? /* @__PURE__ */ o($, { component: "main", id: "main-content", height: "inherit", children: e }) : /* @__PURE__ */ o(
|
|
1198
1199
|
nt,
|
|
1199
1200
|
{
|
|
1200
1201
|
component: "main",
|
|
@@ -1268,8 +1269,8 @@ function No({
|
|
|
1268
1269
|
[Y, n != null ? n : !0],
|
|
1269
1270
|
[xe, t != null ? t : ""]
|
|
1270
1271
|
]);
|
|
1271
|
-
const C = Le(Y), [A] = V(vt), [g] = V(wt), k = Le(xe), [b] = V(At), [D] = V(Fn), [
|
|
1272
|
-
return /* @__PURE__ */ p(
|
|
1272
|
+
const C = Le(Y), [A] = V(vt), [g] = V(wt), k = Le(xe), [b] = V(At), [D] = V(Fn), [I] = V(bt);
|
|
1273
|
+
return /* @__PURE__ */ p($, { children: [
|
|
1273
1274
|
/* @__PURE__ */ o(Gt, {}),
|
|
1274
1275
|
/* @__PURE__ */ o(
|
|
1275
1276
|
Vn,
|
|
@@ -1280,12 +1281,12 @@ function No({
|
|
|
1280
1281
|
middle: D
|
|
1281
1282
|
}
|
|
1282
1283
|
),
|
|
1283
|
-
/* @__PURE__ */ p(
|
|
1284
|
+
/* @__PURE__ */ p($, { sx: { display: "flex" }, children: [
|
|
1284
1285
|
/* @__PURE__ */ o(
|
|
1285
1286
|
Wn,
|
|
1286
1287
|
{
|
|
1287
1288
|
open: C,
|
|
1288
|
-
top:
|
|
1289
|
+
top: I,
|
|
1289
1290
|
middle: d,
|
|
1290
1291
|
bottom: l,
|
|
1291
1292
|
user: u,
|
|
@@ -1352,7 +1353,7 @@ function jn(a) {
|
|
|
1352
1353
|
key: Yn()
|
|
1353
1354
|
}), m);
|
|
1354
1355
|
return u.current.push(v), u.current.length === 1 && l({ open: !0 }), v.key;
|
|
1355
|
-
}, []), k = (m = "", v = {}) => g(s({ message: m, severity: "success" }, v)), b = (m = "", v = {}) => g(s({ message: m, severity: "info" }, v)), D = (m = "", v = {}) => g(s({ message: m, severity: "warning" }, v)),
|
|
1356
|
+
}, []), k = (m = "", v = {}) => g(s({ message: m, severity: "success" }, v)), b = (m = "", v = {}) => g(s({ message: m, severity: "info" }, v)), D = (m = "", v = {}) => g(s({ message: m, severity: "warning" }, v)), I = (m = "", v = {}) => g(s({ message: m, severity: "error" }, v)), x = (m) => {
|
|
1356
1357
|
const v = u.current.findIndex((L) => L.key === m);
|
|
1357
1358
|
if (v !== -1)
|
|
1358
1359
|
return v === 0 ? (l({ open: !1 }), u.current[0]) : u.current.splice(v, 1);
|
|
@@ -1370,7 +1371,7 @@ function jn(a) {
|
|
|
1370
1371
|
enqueueSuccessNotification: k,
|
|
1371
1372
|
enqueueInfoNotification: b,
|
|
1372
1373
|
enqueueWarningNotification: D,
|
|
1373
|
-
enqueueErrorNotification:
|
|
1374
|
+
enqueueErrorNotification: I,
|
|
1374
1375
|
removeNotification: x
|
|
1375
1376
|
}, e), t);
|
|
1376
1377
|
return /* @__PURE__ */ p(kt.Provider, { value: f, children: [
|
|
@@ -1482,18 +1483,18 @@ const qe = M(
|
|
|
1482
1483
|
multiple: !1,
|
|
1483
1484
|
disableClearable: !1,
|
|
1484
1485
|
value: l !== "" ? l : null,
|
|
1485
|
-
onChange: (
|
|
1486
|
+
onChange: (I, x) => u(x != null ? x : ""),
|
|
1486
1487
|
getOptionLabel: oo,
|
|
1487
1488
|
options: [...i],
|
|
1488
|
-
renderInput: (
|
|
1489
|
+
renderInput: (I) => /* @__PURE__ */ o(
|
|
1489
1490
|
Ae,
|
|
1490
|
-
S(s({},
|
|
1491
|
+
S(s({}, I), {
|
|
1491
1492
|
variant: "filled",
|
|
1492
1493
|
label: "Select organisation",
|
|
1493
|
-
InputProps: S(s({},
|
|
1494
|
+
InputProps: S(s({}, I.InputProps), {
|
|
1494
1495
|
endAdornment: /* @__PURE__ */ p(_, { children: [
|
|
1495
1496
|
e ? /* @__PURE__ */ o(be, { color: "inherit", size: 20, sx: { marginTop: "-20px" } }) : null,
|
|
1496
|
-
|
|
1497
|
+
I.InputProps.endAdornment
|
|
1497
1498
|
] })
|
|
1498
1499
|
})
|
|
1499
1500
|
})
|