@australiangreens/ag-internal-components 0.3.10 → 0.3.13

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 N = (e, t, o) => new Promise((i, s) => {
38
38
  });
39
39
  import { jsxs as m, Fragment as M, jsx as n } from "react/jsx-runtime";
40
40
  import { useState as G, createElement as ae, useEffect as ge, useMemo as rt, createContext as st, useRef as re, useCallback as xe, useContext as at } from "react";
41
- import { Typography as I, Button as q, Paper as $e, Dialog as Me, LinearProgress as Le, DialogTitle as Oe, DialogContent as Re, DialogActions as Ue, Autocomplete as le, TextField as ce, CircularProgress as te, Box as P, Chip as lt, Tooltip as ct, Stack as dt, Snackbar as ut, Alert as pt, FormHelperText as ht, useTheme as oe, useMediaQuery as ft, Drawer as mt, Collapse as gt, Avatar as Ae, Fade as xt, Skeleton as Ce, Toolbar as At, Divider as Se, Container as Ct, IconButton as St } from "@mui/material";
41
+ import { Typography as I, Button as z, Paper as $e, Dialog as Me, LinearProgress as Le, DialogTitle as Oe, DialogContent as Re, DialogActions as Ue, Autocomplete as le, TextField as ce, CircularProgress as te, Box as P, Chip as lt, Tooltip as ct, Stack as dt, Snackbar as ut, Alert as pt, FormHelperText as ht, useTheme as oe, useMediaQuery as ft, Drawer as mt, Collapse as gt, Avatar as Ae, Fade as xt, Skeleton as Ce, Toolbar as At, Divider as Se, Container as Ct, IconButton as St } from "@mui/material";
42
42
  import { Cancel as wt, ArrowDropDown as vt, ViewHeadline as Dt } from "@mui/icons-material";
43
43
  import { useQuery as Be } from "@tanstack/react-query";
44
44
  import kt from "autosuggest-highlight/match";
@@ -51,15 +51,15 @@ import { createHelper as Et } from "souvlaki";
51
51
  import _t from "@mui/material/CssBaseline";
52
52
  import ve from "@mui/material/Box";
53
53
  import { useHydrateAtoms as It } from "jotai/utils";
54
- import { styled as We, createTheme as ze, alpha as se } from "@mui/material/styles";
54
+ import { styled as We, createTheme as qe, alpha as se } from "@mui/material/styles";
55
55
  import De from "react-avatar";
56
- function To({ text: e }) {
56
+ function No({ text: e }) {
57
57
  const [t, o] = G(0);
58
58
  return /* @__PURE__ */ m(M, { children: [
59
59
  /* @__PURE__ */ n(I, { variant: "h6", color: "inherit", component: "div", sx: { fontSize: "22px" }, children: "Hello world" }),
60
60
  /* @__PURE__ */ n(I, { variant: "caption", display: "block", children: /* @__PURE__ */ n("span", { children: "Just ensuring MUI is working as planned as a peer dependency. v0.0.11" }) }),
61
61
  /* @__PURE__ */ n(
62
- q,
62
+ z,
63
63
  {
64
64
  variant: "outlined",
65
65
  onClick: () => o((i) => i + 1),
@@ -77,7 +77,7 @@ function To({ text: e }) {
77
77
  ] })
78
78
  ] });
79
79
  }
80
- const qe = ({
80
+ const ze = ({
81
81
  isOpen: e,
82
82
  dialogTitle: t,
83
83
  children: o,
@@ -110,7 +110,7 @@ const qe = ({
110
110
  /* @__PURE__ */ n(Re, { sx: { "& > :last-child": { marginBottom: 0 } }, children: o }),
111
111
  /* @__PURE__ */ m(Ue, { children: [
112
112
  /* @__PURE__ */ n(
113
- q,
113
+ z,
114
114
  {
115
115
  onClick: (S = a == null ? void 0 : a.onClick) != null ? S : r,
116
116
  "data-testid": a == null ? void 0 : a.testId,
@@ -122,7 +122,7 @@ const qe = ({
122
122
  u && u.map((h, k) => {
123
123
  var F;
124
124
  return /* @__PURE__ */ n(
125
- q,
125
+ z,
126
126
  {
127
127
  onClick: h == null ? void 0 : h.onClick,
128
128
  "data-testid": h == null ? void 0 : h.testId,
@@ -134,7 +134,7 @@ const qe = ({
134
134
  );
135
135
  }),
136
136
  s && /* @__PURE__ */ n(
137
- q,
137
+ z,
138
138
  {
139
139
  onClick: () => N(null, null, function* () {
140
140
  var h;
@@ -175,7 +175,7 @@ const qe = ({
175
175
  ) : o(s),
176
176
  queryKey: ["autocomplete", i, s]
177
177
  });
178
- function No({
178
+ function $o({
179
179
  lookup: e = () => N(null, null, function* () {
180
180
  }),
181
181
  enableHighlighting: t = !0,
@@ -343,7 +343,7 @@ function No({
343
343
  }) })
344
344
  ] });
345
345
  }
346
- const $o = /MUI: The value provided to.*is invalid/i, Mo = ({
346
+ const Mo = /MUI: The value provided to.*is invalid/i, Lo = ({
347
347
  lookup: e = () => N(null, null, function* () {
348
348
  }),
349
349
  onChange: t,
@@ -462,14 +462,14 @@ const $o = /MUI: The value provided to.*is invalid/i, Mo = ({
462
462
  } catch (t) {
463
463
  return -1;
464
464
  }
465
- }, Lo = ({
465
+ }, Oo = ({
466
466
  open: e = !1,
467
467
  closeHandler: t,
468
468
  setAuth0ExpiryTime: o
469
469
  }) => {
470
470
  const { logout: i, getAccessTokenSilently: s } = de();
471
471
  return /* @__PURE__ */ n(
472
- qe,
472
+ ze,
473
473
  {
474
474
  isOpen: e,
475
475
  primaryButton: {
@@ -516,7 +516,7 @@ function Lt(e) {
516
516
  const t = e.error, o = (i = e == null ? void 0 : e.error_description) != null ? i : "";
517
517
  return t === "access_denied" && o.match(/Script.*time.*exceeded/);
518
518
  }
519
- function Oo({
519
+ function Ro({
520
520
  children: e,
521
521
  appName: t = "the app",
522
522
  throwErrors: o = "none",
@@ -573,8 +573,8 @@ function Oo({
573
573
  ] })
574
574
  ] }),
575
575
  /* @__PURE__ */ m(Ue, { children: [
576
- g === "Auth0 script execution time exceeded" && /* @__PURE__ */ n(q, { href: window.location.origin + window.location.pathname, children: "Reload" }),
577
- /* @__PURE__ */ n(q, { onClick: () => c({ logoutParams: { returnTo: window.location.origin } }), children: "Logout" })
576
+ g === "Auth0 script execution time exceeded" && /* @__PURE__ */ n(z, { href: window.location.origin + window.location.pathname, children: "Reload" }),
577
+ /* @__PURE__ */ n(z, { onClick: () => c({ logoutParams: { returnTo: window.location.origin } }), children: "Logout" })
578
578
  ] })
579
579
  ] });
580
580
  } else if (o === "unknown") throw r;
@@ -601,11 +601,11 @@ const Ot = {
601
601
  })(), Ht = {
602
602
  borderBottomLeftRadius: "0px",
603
603
  borderBottomRightRadius: "0px"
604
- }, Wt = {}, zt = {}, Ke = st(null);
605
- function qt(a) {
604
+ }, Wt = {}, qt = {}, Ke = st(null);
605
+ function zt(a) {
606
606
  var u = a, {
607
607
  overrideState: e = Wt,
608
- overrideActions: t = zt,
608
+ overrideActions: t = qt,
609
609
  shouldClose: o = Rt.shouldClose,
610
610
  children: i
611
611
  } = u, s = fe(u, [
@@ -685,8 +685,8 @@ function Gt() {
685
685
  throw new Xe("Error: Tried to useSaladBar outside of a <SaladBarProvider>");
686
686
  return e;
687
687
  }
688
- const Ro = Et(
689
- (e = { autoHideDuration: 1 }, t = {}, o = {}) => ({ children: i }) => /* @__PURE__ */ n(qt, b(d({}, e), { overrideState: t, overrideActions: o, children: /* @__PURE__ */ n(M, { children: i }) }))
688
+ const Uo = Et(
689
+ (e = { autoHideDuration: 1 }, t = {}, o = {}) => ({ children: i }) => /* @__PURE__ */ n(zt, b(d({}, e), { overrideState: t, overrideActions: o, children: /* @__PURE__ */ n(M, { children: i }) }))
690
690
  ), Ye = "domainCode";
691
691
  var Ne;
692
692
  const Fe = L(
@@ -711,7 +711,7 @@ const Fe = L(
711
711
  }, Qe = (e) => {
712
712
  var t;
713
713
  return e === null ? "N/A" : (t = Kt[e]) != null ? t : "";
714
- }, Uo = ({
714
+ }, Bo = ({
715
715
  isLoading: e,
716
716
  isOpen: t,
717
717
  onClose: o,
@@ -727,7 +727,7 @@ const Fe = L(
727
727
  });
728
728
  let k;
729
729
  return D ? k = "Unable to retrieve your active organisations. Try logging in again." : g && (k = "You no longer have any roles in your chosen organisation. Please choose another."), /* @__PURE__ */ m(
730
- qe,
730
+ ze,
731
731
  {
732
732
  isOpen: t,
733
733
  dialogTitle: "Select an organisation",
@@ -812,7 +812,7 @@ const Z = "Navbar", Y = {
812
812
  // marginTop: '64px',
813
813
  // marginBottom: '16px',
814
814
  // },
815
- })), z = (e, t, o) => e.transitions.create(t, {
815
+ })), q = (e, t, o) => e.transitions.create(t, {
816
816
  easing: e.transitions.easing.sharp,
817
817
  duration: o === "leaving" ? e.transitions.duration.leavingScreen : e.transitions.duration.enteringScreen
818
818
  }), io = (e) => {
@@ -837,10 +837,10 @@ const Z = "Navbar", Y = {
837
837
  };
838
838
  }, _e = (e, t) => d({
839
839
  width: t,
840
- transition: z(e, "width", "entering")
840
+ transition: q(e, "width", "entering")
841
841
  }, Ze(e)), Ie = (e, t) => d({
842
842
  width: t,
843
- transition: z(e, "width", "leaving")
843
+ transition: q(e, "width", "leaving")
844
844
  }, Ze(e)), ro = We(mt, {
845
845
  shouldForwardProp: (e) => !["widthOpen", "widthClosed", "isSmallScreen"].includes(e)
846
846
  })(({ theme: e, open: t, widthOpen: o, widthClosed: i, isSmallScreen: s }) => d(d({
@@ -862,7 +862,7 @@ function je(e) {
862
862
  (t, o, i) => o === "-" ? " " + i.toUpperCase() : i.toUpperCase()
863
863
  );
864
864
  }
865
- function Bo(e, t, o, i) {
865
+ function Ho(e, t, o, i) {
866
866
  var u;
867
867
  if (!e) return "None";
868
868
  const a = Object.entries(e).filter(
@@ -877,7 +877,7 @@ function Bo(e, t, o, i) {
877
877
  (r) => o[r].some((l) => a.includes(l))
878
878
  )) != null ? u : "None";
879
879
  }
880
- const Ho = (e) => {
880
+ const Wo = (e) => {
881
881
  const { getIdTokenClaims: t, user: o } = de();
882
882
  return Be({
883
883
  queryKey: ["availableDomains", o == null ? void 0 : o.sub],
@@ -890,7 +890,7 @@ const Ho = (e) => {
890
890
  }, []) : [];
891
891
  })
892
892
  });
893
- }, Wo = (e) => Object.values(e).reduce(
893
+ }, qo = (e) => Object.values(e).reduce(
894
894
  (t, o) => [.../* @__PURE__ */ new Set([...t, ...o])],
895
895
  []
896
896
  ), j = {
@@ -913,14 +913,21 @@ function zo(e, t) {
913
913
  j[e](o);
914
914
  };
915
915
  }
916
- function qo(e) {
916
+ function Go(e) {
917
917
  if (e)
918
918
  console[e] = j[e];
919
919
  else
920
920
  for (const t of Object.keys(j))
921
921
  console[t] = j[t];
922
922
  }
923
- function so(e) {
923
+ function so(e, t) {
924
+ return e != null && typeof e == "object" && "error" in e && e.error === t;
925
+ }
926
+ function Vo(e, t) {
927
+ const o = t == null ? void 0 : t.originalException;
928
+ return so(o, "login_required") ? null : e;
929
+ }
930
+ function ao(e) {
924
931
  let t = 0;
925
932
  for (let o = 0, i = e.length; o < i; o++) {
926
933
  const s = e.charCodeAt(o);
@@ -929,7 +936,7 @@ function so(e) {
929
936
  return t;
930
937
  }
931
938
  const Pe = ["#A62A21", "#7e3794", "#0B51C1", "#3A6024", "#A81563", "#B3003C"], Te = (e) => e.split(/\s/).map((t) => t.substring(0, 1).toUpperCase()).filter((t) => !!t).slice(0, 2).join("").toUpperCase();
932
- function ao({ user: e, domainCode: t, open: o, useNewAvatar: i = !1 }) {
939
+ function lo({ user: e, domainCode: t, open: o, useNewAvatar: i = !1 }) {
933
940
  const s = oe();
934
941
  return /* @__PURE__ */ m(
935
942
  P,
@@ -947,7 +954,7 @@ function ao({ user: e, domainCode: t, open: o, useNewAvatar: i = !1 }) {
947
954
  {
948
955
  sx: {
949
956
  width: o ? "5rem" : "2rem",
950
- transition: o ? z(s, ["width", "height"], "entering") : z(s, ["width", "height"], "leaving"),
957
+ transition: o ? q(s, ["width", "height"], "entering") : q(s, ["width", "height"], "leaving"),
951
958
  aspectRatio: 1
952
959
  },
953
960
  children: e != null && e.name ? /* @__PURE__ */ n(M, { children: /* @__PURE__ */ n(
@@ -957,7 +964,7 @@ function ao({ user: e, domainCode: t, open: o, useNewAvatar: i = !1 }) {
957
964
  sx: {
958
965
  width: "100%",
959
966
  height: "100%",
960
- bgcolor: Pe[Math.abs(so(e == null ? void 0 : e.name)) % Pe.length]
967
+ bgcolor: Pe[Math.abs(ao(e == null ? void 0 : e.name)) % Pe.length]
961
968
  },
962
969
  children: Te(e == null ? void 0 : e.name)
963
970
  }
@@ -969,7 +976,7 @@ function ao({ user: e, domainCode: t, open: o, useNewAvatar: i = !1 }) {
969
976
  {
970
977
  sx: {
971
978
  width: o ? "5rem" : "2rem",
972
- transition: o ? z(s, ["width", "height"], "entering") : z(s, ["width", "height"], "leaving"),
979
+ transition: o ? q(s, ["width", "height"], "entering") : q(s, ["width", "height"], "leaving"),
973
980
  aspectRatio: 1
974
981
  },
975
982
  children: e != null && e.name ? /* @__PURE__ */ n(M, { children: /* @__PURE__ */ m(De, { src: e == null ? void 0 : e.picture, name: e == null ? void 0 : e.name, round: !0, size: o ? "80" : "32", children: [
@@ -988,7 +995,7 @@ function ao({ user: e, domainCode: t, open: o, useNewAvatar: i = !1 }) {
988
995
  }
989
996
  );
990
997
  }
991
- function lo({
998
+ function co({
992
999
  open: e,
993
1000
  widthClosed: t,
994
1001
  widthOpen: o,
@@ -1025,14 +1032,14 @@ function lo({
1025
1032
  /* @__PURE__ */ n(P, { flexGrow: "1", children: Array.isArray(a) ? /* @__PURE__ */ n(oo, { links: a }) : a }),
1026
1033
  /* @__PURE__ */ m(P, { flexGrow: "0", children: [
1027
1034
  /* @__PURE__ */ n(Se, { variant: "middle", sx: { marginY: "0.5rem" } }),
1028
- /* @__PURE__ */ n(ao, { user: r, domainCode: l, open: e, useNewAvatar: c }),
1035
+ /* @__PURE__ */ n(lo, { user: r, domainCode: l, open: e, useNewAvatar: c }),
1029
1036
  u && /* @__PURE__ */ n(M, { children: u })
1030
1037
  ] })
1031
1038
  ]
1032
1039
  }
1033
1040
  ) });
1034
1041
  }
1035
- function co({
1042
+ function uo({
1036
1043
  children: e,
1037
1044
  topBarHeight: t,
1038
1045
  maxWidth: o = !1,
@@ -1059,10 +1066,10 @@ function co({
1059
1066
  }
1060
1067
  );
1061
1068
  }
1062
- const uo = "TopBar", po = {
1063
- titleText: `${uo}-titleText`
1069
+ const po = "TopBar", ho = {
1070
+ titleText: `${po}-titleText`
1064
1071
  };
1065
- function ho({
1072
+ function fo({
1066
1073
  titleText: e = "",
1067
1074
  height: t,
1068
1075
  "data-testid": o,
@@ -1084,7 +1091,7 @@ function ho({
1084
1091
  gap: 2,
1085
1092
  flexShrink: 0,
1086
1093
  height: t,
1087
- zIndex: r ? 0 : u.zIndex.drawer + 101
1094
+ zIndex: r ? 0 : u.zIndex.drawer + 99
1088
1095
  },
1089
1096
  children: [
1090
1097
  /* @__PURE__ */ n(
@@ -1097,13 +1104,13 @@ function ho({
1097
1104
  children: /* @__PURE__ */ n(Dt, { fontSize: "medium" })
1098
1105
  }
1099
1106
  ),
1100
- /* @__PURE__ */ n(I, { className: po.titleText, variant: "h6", component: "h1", children: e }),
1107
+ /* @__PURE__ */ n(I, { className: ho.titleText, variant: "h6", component: "h1", children: e }),
1101
1108
  i
1102
1109
  ]
1103
1110
  }
1104
1111
  ) });
1105
1112
  }
1106
- function Go({
1113
+ function Ko({
1107
1114
  children: e,
1108
1115
  initialTitleText: t,
1109
1116
  initialNavBarOpen: o,
@@ -1125,7 +1132,7 @@ function Go({
1125
1132
  return /* @__PURE__ */ m(ve, { children: [
1126
1133
  /* @__PURE__ */ n(_t, {}),
1127
1134
  /* @__PURE__ */ n(
1128
- ho,
1135
+ fo,
1129
1136
  {
1130
1137
  titleText: y,
1131
1138
  "data-testid": a,
@@ -1135,7 +1142,7 @@ function Go({
1135
1142
  ),
1136
1143
  /* @__PURE__ */ m(ve, { sx: { display: "flex" }, children: [
1137
1144
  /* @__PURE__ */ n(
1138
- lo,
1145
+ co,
1139
1146
  {
1140
1147
  open: D,
1141
1148
  top: F,
@@ -1151,7 +1158,7 @@ function Go({
1151
1158
  }
1152
1159
  ),
1153
1160
  /* @__PURE__ */ n(
1154
- co,
1161
+ uo,
1155
1162
  b(d({
1156
1163
  "data-testid": s,
1157
1164
  topBarHeight: h
@@ -1162,7 +1169,7 @@ function Go({
1162
1169
  ] })
1163
1170
  ] });
1164
1171
  }
1165
- const Vo = ze({
1172
+ const Xo = qe({
1166
1173
  palette: {
1167
1174
  primary: {
1168
1175
  dark: "#00A651",
@@ -1213,7 +1220,7 @@ const Vo = ze({
1213
1220
  navBar: {
1214
1221
  backgroundColor: "#E8E8E8"
1215
1222
  }
1216
- }), Ko = ze({
1223
+ }), Yo = qe({
1217
1224
  palette: {
1218
1225
  primary: {
1219
1226
  main: "#007236",
@@ -1309,39 +1316,40 @@ const Vo = ze({
1309
1316
  }
1310
1317
  });
1311
1318
  export {
1312
- qe as AgDialog,
1313
- Go as AppLayout,
1314
- Oo as AuthGuard,
1319
+ ze as AgDialog,
1320
+ Ko as AppLayout,
1321
+ Ro as AuthGuard,
1315
1322
  Ke as Context,
1316
1323
  Xe as ContextError,
1317
1324
  Kt as DOMAIN_CODE_LABELS,
1318
- Uo as DomainCodeDialog,
1319
- To as ExampleComponent,
1320
- No as FetchAutocomplete,
1321
- $o as MUI_AUTOCOMPLETE_VALUE_WARNING_REGEX,
1322
- qt as SaladBarProvider,
1323
- Lo as SessionExpiryDialog,
1324
- Mo as SingleAutocomplete,
1325
- Bo as determineUserLevelFromClaims,
1325
+ Bo as DomainCodeDialog,
1326
+ No as ExampleComponent,
1327
+ $o as FetchAutocomplete,
1328
+ Mo as MUI_AUTOCOMPLETE_VALUE_WARNING_REGEX,
1329
+ zt as SaladBarProvider,
1330
+ Oo as SessionExpiryDialog,
1331
+ Lo as SingleAutocomplete,
1332
+ Ho as determineUserLevelFromClaims,
1326
1333
  Vt as domainCodeAtom,
1327
- Vo as fed21Theme,
1334
+ Xo as fed21Theme,
1328
1335
  Tt as getAuth0Expiry,
1329
1336
  Qe as getDomainOptionLabel,
1330
- Wo as getValidBusinessRoles,
1331
- Ko as internalAgSystemsTheme,
1337
+ qo as getValidBusinessRoles,
1338
+ Yo as internalAgSystemsTheme,
1332
1339
  ee as navBarOpenAtom,
1333
1340
  to as navBarTopAtom,
1334
1341
  Zt as navBarWidthClosedAtom,
1335
1342
  Jt as navBarWidthOpenAtom,
1336
- so as simpleHashCode,
1343
+ Vo as sentryBeforeSend,
1344
+ ao as simpleHashCode,
1337
1345
  zo as suppressConsole,
1338
1346
  Ee as titleTextAtom,
1339
1347
  eo as topBarHeightAtom,
1340
1348
  jt as topBarMiddleAtom,
1341
- qo as unsuppressConsole,
1349
+ Go as unsuppressConsole,
1342
1350
  Ve as useAutocompleteOptions,
1343
1351
  Gt as useSaladBar,
1344
- Ho as useValidDomains,
1345
- Ro as withSaladBarProvider
1352
+ Wo as useValidDomains,
1353
+ Uo as withSaladBarProvider
1346
1354
  };
1347
1355
  //# sourceMappingURL=index.js.map