@australiangreens/ag-internal-components 0.0.91 → 0.0.93

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, n) => new Promise((i, r) => {
38
38
  });
39
39
  import { jsxs as h, Fragment as L, jsx as o } from "react/jsx-runtime";
40
40
  import { useState as B, createContext as Ye, useCallback as oe, useContext as Ke, useEffect as ie, createElement as xe, useRef as ge } from "react";
41
- import { Typography as E, Button as re, Paper as Je, Box as $, Drawer as we, styled as Ae, IconButton as Y, Container as Ze, useTheme as se, useMediaQuery as _t, Collapse as Mt, Avatar as Pe, Fade as Rt, Skeleton as Ne, Toolbar as Ht, Divider as Le, CssBaseline as Wt, Dialog as je, LinearProgress as et, DialogTitle as tt, DialogContent as nt, DialogActions as ot, Autocomplete as be, TextField as Se, CircularProgress as ke, Chip as zt, Tooltip as Ut, Stack as Gt, Snackbar as Vt, Alert as qt, FormHelperText as Xt } from "@mui/material";
41
+ import { Typography as E, Button as re, Paper as Je, Box as $, Drawer as we, styled as Ae, IconButton as Y, Container as Ze, useTheme as se, useMediaQuery as _t, Collapse as Mt, Avatar as Pe, Fade as Rt, Skeleton as Ne, Toolbar as Ht, Divider as Le, CssBaseline as Wt, Dialog as je, LinearProgress as et, DialogTitle as tt, DialogContent as nt, DialogActions as ot, Autocomplete as Se, TextField as be, CircularProgress as ke, Chip as zt, Tooltip as Ut, Stack 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 it, alpha as fe } from "@mui/material/styles";
44
44
  import { AgError as Yt } from "@australiangreens/ag-error";
@@ -357,7 +357,7 @@ function An({
357
357
  ] }) })
358
358
  ] });
359
359
  }
360
- const mt = 400, bn = Ae(we, {
360
+ const mt = 400, Sn = Ae(we, {
361
361
  shouldForwardProp: (e) => (
362
362
  // Note we do want anchor to be forwarded to the Drawer component
363
363
  ![
@@ -387,7 +387,7 @@ const mt = 400, bn = Ae(we, {
387
387
  marginLeft: `${r}px`
388
388
  }))
389
389
  })
390
- ), Sn = Ae($, {
390
+ ), bn = Ae($, {
391
391
  shouldForwardProp: (e) => !["anchor"].includes(e)
392
392
  })(({ theme: e, anchor: t }) => k(a({
393
393
  display: "flex",
@@ -426,7 +426,7 @@ function He({
426
426
  navBarWidthClosed: y = 0
427
427
  }) {
428
428
  return /* @__PURE__ */ h(
429
- bn,
429
+ Sn,
430
430
  {
431
431
  SlideProps: {
432
432
  onEntered: () => u == null ? void 0 : u(),
@@ -442,7 +442,7 @@ function He({
442
442
  navBarWidthOpen: g,
443
443
  navBarWidthClosed: y,
444
444
  children: [
445
- /* @__PURE__ */ o(Sn, k(a({ anchor: t }, l), { children: t === "left" ? /* @__PURE__ */ h(L, { children: [
445
+ /* @__PURE__ */ o(bn, 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 }),
447
447
  c && /* @__PURE__ */ h(Y, { onClick: i, size: "large", "aria-label": "Close left side panel", children: [
448
448
  /* @__PURE__ */ o(st, { "data-testid": "arrowbackicon" }),
@@ -517,7 +517,7 @@ function Fo({
517
517
  navBarWidthOpen: w,
518
518
  navBarWidthClosed: x
519
519
  }) {
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, {
520
+ const [A, g] = B(me), [y, S] = B(Ce), [D, I] = B(me), [O, F] = B(Ce), P = n !== void 0, b = i !== void 0, {
521
521
  titleText: v,
522
522
  content: H,
523
523
  flavour: W,
@@ -545,12 +545,12 @@ function Fo({
545
545
  ie(() => {
546
546
  M !== me && (g(M), I(M));
547
547
  }, [M]), ie(() => {
548
- j !== Ce && (b(j), F(j));
548
+ j !== Ce && (S(j), F(j));
549
549
  }, [j]);
550
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);
551
+ p === void 0 && (g(z), r && b && (z ? (S(!1), F(y)) : S(O))), f && f(z);
552
552
  }, Oe = (z) => {
553
- ce === void 0 && (b(z), r && P && (z ? (g(!1), I(A)) : g(D))), $e && $e(z);
553
+ ce === void 0 && (S(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(
@@ -572,7 +572,7 @@ function Fo({
572
572
  children: H
573
573
  }
574
574
  ),
575
- S && /* @__PURE__ */ o(
575
+ b && /* @__PURE__ */ o(
576
576
  He,
577
577
  {
578
578
  "data-testid": Ft,
@@ -603,7 +603,7 @@ function Fo({
603
603
  onOpen: () => Ie(!0),
604
604
  showOpenArrow: C === "both" || C === "open"
605
605
  }
606
- } : {}), S && ye === "push" ? {
606
+ } : {}), b && ye === "push" ? {
607
607
  rightPanel: {
608
608
  open: pe,
609
609
  width: de,
@@ -679,7 +679,7 @@ const ne = "Navbar", Q = {
679
679
  }
680
680
  }, e)
681
681
  );
682
- }, bt = (e) => {
682
+ }, St = (e) => {
683
683
  var t, n;
684
684
  return {
685
685
  overflowX: "hidden",
@@ -690,10 +690,10 @@ const ne = "Navbar", Q = {
690
690
  }, We = (e, t) => a({
691
691
  width: t,
692
692
  transition: ae(e, "width", "entering")
693
- }, bt(e)), ze = (e, t) => a({
693
+ }, St(e)), ze = (e, t) => a({
694
694
  width: t,
695
695
  transition: ae(e, "width", "leaving")
696
- }, bt(e)), Fn = R(we, {
696
+ }, St(e)), Fn = R(we, {
697
697
  shouldForwardProp: (e) => !["widthOpen", "widthClosed", "isSmallScreen"].includes(e)
698
698
  })(({ theme: e, open: t, widthOpen: n, widthClosed: i, isSmallScreen: r }) => a(a({
699
699
  flexShrink: 0,
@@ -815,8 +815,6 @@ function Mn({
815
815
  sx: {
816
816
  overflow: "auto",
817
817
  height: `calc(100vh - ${t}px)`,
818
- scrollbarGutter: "stable",
819
- // scrollbarGutter: 'stable both-edges',
820
818
  flexGrow: 1
821
819
  },
822
820
  children: i ? /* @__PURE__ */ o($, { component: "main", id: "main-content", height: "inherit", children: e }) : /* @__PURE__ */ o(
@@ -870,7 +868,7 @@ function Wn({
870
868
  children: /* @__PURE__ */ o(Jt, { fontSize: "medium" })
871
869
  }
872
870
  ),
873
- /* @__PURE__ */ o(E, { className: Hn.titleText, variant: "h6", children: e }),
871
+ /* @__PURE__ */ o(E, { className: Hn.titleText, variant: "h1", children: e }),
874
872
  i
875
873
  ]
876
874
  }
@@ -893,7 +891,7 @@ function Po({
893
891
  [K, n != null ? n : !0],
894
892
  [ve, t != null ? t : ""]
895
893
  ]);
896
- const x = _e(K), [A] = V(xt), [g] = V(vt), y = _e(ve), [b] = V(wt), [D] = V(On), [I] = V(At);
894
+ const x = _e(K), [A] = V(xt), [g] = V(vt), y = _e(ve), [S] = V(wt), [D] = V(On), [I] = V(At);
897
895
  return /* @__PURE__ */ h($, { children: [
898
896
  /* @__PURE__ */ o(Wt, {}),
899
897
  /* @__PURE__ */ o(
@@ -901,7 +899,7 @@ function Po({
901
899
  {
902
900
  titleText: y,
903
901
  "data-testid": s,
904
- height: b,
902
+ height: S,
905
903
  middle: D
906
904
  }
907
905
  ),
@@ -917,7 +915,7 @@ function Po({
917
915
  domainCode: w,
918
916
  widthOpen: A,
919
917
  widthClosed: g,
920
- offsetTop: b,
918
+ offsetTop: S,
921
919
  "data-testid": c
922
920
  }
923
921
  ),
@@ -925,7 +923,7 @@ function Po({
925
923
  Mn,
926
924
  k(a({
927
925
  "data-testid": r,
928
- topBarHeight: b
926
+ topBarHeight: S
929
927
  }, i), {
930
928
  children: e
931
929
  })
@@ -933,7 +931,7 @@ function Po({
933
931
  ] })
934
932
  ] });
935
933
  }
936
- const St = ({
934
+ const bt = ({
937
935
  isOpen: e,
938
936
  dialogTitle: t,
939
937
  children: n,
@@ -952,7 +950,7 @@ const St = ({
952
950
  je,
953
951
  {
954
952
  open: e,
955
- onClose: (b, D) => N(void 0, null, function* () {
953
+ onClose: (S, D) => N(void 0, null, function* () {
956
954
  u && (D === "backdropClick" || D === "escapeKeyDown") || x || (s != null && s.onClick ? yield s.onClick() : c());
957
955
  }),
958
956
  fullWidth: !0,
@@ -978,8 +976,8 @@ const St = ({
978
976
  re,
979
977
  {
980
978
  onClick: () => N(void 0, null, function* () {
981
- var b;
982
- A(!0), yield (b = r.onClick) == null ? void 0 : b.call(r), A(!1);
979
+ var S;
980
+ A(!0), yield (S = r.onClick) == null ? void 0 : S.call(r), A(!1);
983
981
  }),
984
982
  "data-testid": r.testId,
985
983
  disabled: r.disabled || x,
@@ -1020,12 +1018,12 @@ function No({
1020
1018
  noOptionsText: A = "No options",
1021
1019
  popupIcon: g = /* @__PURE__ */ o(jt, {}),
1022
1020
  error: y = !1,
1023
- helperText: b = "",
1021
+ helperText: S = "",
1024
1022
  preLoadedOptions: D = void 0,
1025
1023
  disablePortal: I = !1,
1026
1024
  disableIconFlip: O = !1
1027
1025
  }) {
1028
- const [F, P] = B(""), S = (p, f) => {
1026
+ const [F, P] = B(""), b = (p, f) => {
1029
1027
  const m = s.filter((C) => C.id !== f);
1030
1028
  n(m, "delete", p);
1031
1029
  }, { data: v, isLoading: H } = kt({
@@ -1037,7 +1035,7 @@ function No({
1037
1035
  }), W = F.length >= i;
1038
1036
  return /* @__PURE__ */ h("div", { "data-testid": c, children: [
1039
1037
  /* @__PURE__ */ o(
1040
- be,
1038
+ Se,
1041
1039
  {
1042
1040
  sx: a(a({}, d), O ? { ".MuiAutocomplete-popupIndicatorOpen": { transform: "rotate(0deg)" } } : {}),
1043
1041
  "data-testid": c ? `${c}:Autocomplete` : void 0,
@@ -1057,13 +1055,13 @@ function No({
1057
1055
  loadingText: x,
1058
1056
  popupIcon: g,
1059
1057
  renderInput: (p) => /* @__PURE__ */ o(
1060
- Se,
1058
+ be,
1061
1059
  k(a({}, p), {
1062
1060
  label: r,
1063
1061
  fullWidth: !0,
1064
1062
  variant: w,
1065
1063
  error: y,
1066
- helperText: b,
1064
+ helperText: S,
1067
1065
  InputProps: k(a({}, p.InputProps), {
1068
1066
  endAdornment: /* @__PURE__ */ h(L, { children: [
1069
1067
  H ? /* @__PURE__ */ o(ke, { color: "inherit", size: 20 }) : null,
@@ -1141,7 +1139,7 @@ function No({
1141
1139
  }
1142
1140
  ),
1143
1141
  "data-testid": c ? `${c}:Chip(${p.id.toString()})` : void 0,
1144
- onDelete: (f) => S(f, p.id),
1142
+ onDelete: (f) => b(f, p.id),
1145
1143
  deleteIcon: /* @__PURE__ */ o(
1146
1144
  Zt,
1147
1145
  {
@@ -1170,7 +1168,7 @@ const Lo = ({
1170
1168
  helperText: A = "",
1171
1169
  disabled: g,
1172
1170
  popupIcon: y,
1173
- disableIconFlip: b
1171
+ disableIconFlip: S
1174
1172
  }) => {
1175
1173
  const [D, I] = B(""), { data: O, isLoading: F } = kt({
1176
1174
  inputValue: D,
@@ -1180,39 +1178,39 @@ const Lo = ({
1180
1178
  preLoadedOptions: x
1181
1179
  }), P = D.length >= u;
1182
1180
  return /* @__PURE__ */ o("div", { "data-testid": d, children: /* @__PURE__ */ o(Gt, { direction: "row", spacing: 1, children: /* @__PURE__ */ o(
1183
- be,
1181
+ Se,
1184
1182
  {
1185
- sx: a(a({}, r), b ? { ".MuiAutocomplete-popupIndicatorOpen": { transform: "rotate(0deg)" } } : {}),
1183
+ sx: a(a({}, r), S ? { ".MuiAutocomplete-popupIndicatorOpen": { transform: "rotate(0deg)" } } : {}),
1186
1184
  "data-testid": d ? `${d}:Autocomplete` : void 0,
1187
1185
  loading: P ? F : !1,
1188
1186
  options: O != null ? O : [],
1189
- onChange: (S, v) => {
1190
- t(S, v);
1187
+ onChange: (b, v) => {
1188
+ t(b, v);
1191
1189
  },
1192
1190
  disablePortal: w,
1193
- filterOptions: (S) => S,
1191
+ filterOptions: (b) => b,
1194
1192
  value: i,
1195
1193
  noOptionsText: P ? l : "Start typing to search",
1196
- getOptionLabel: (S) => S.label,
1194
+ getOptionLabel: (b) => b.label,
1197
1195
  popupIcon: y,
1198
- renderInput: (S) => /* @__PURE__ */ o(
1199
- Se,
1196
+ renderInput: (b) => /* @__PURE__ */ o(
1197
+ be,
1200
1198
  k(a({
1201
1199
  "data-testid": d ? `${d}:Autocomplete:TextField` : void 0
1202
- }, S), {
1200
+ }, b), {
1203
1201
  variant: c,
1204
1202
  label: n,
1205
1203
  color: s,
1206
1204
  helperText: A
1207
1205
  })
1208
1206
  ),
1209
- isOptionEqualToValue: (S, v) => S.id === v.id,
1210
- onInputChange: (S, v) => {
1207
+ isOptionEqualToValue: (b, v) => b.id === v.id,
1208
+ onInputChange: (b, v) => {
1211
1209
  I(v);
1212
1210
  },
1213
- renderOption: (S, v) => /* @__PURE__ */ xe(
1211
+ renderOption: (b, v) => /* @__PURE__ */ xe(
1214
1212
  "li",
1215
- k(a({}, S), {
1213
+ k(a({}, b), {
1216
1214
  key: v.id,
1217
1215
  "data-testid": d ? `${d}:Autocomplete:option(${v.id.toString()})` : void 0
1218
1216
  }),
@@ -1252,7 +1250,7 @@ const Lo = ({
1252
1250
  }
1253
1251
  }))();
1254
1252
  }, [s, r, n]), /* @__PURE__ */ o(
1255
- St,
1253
+ bt,
1256
1254
  {
1257
1255
  isOpen: e,
1258
1256
  primaryButton: {
@@ -1360,14 +1358,14 @@ function eo(s) {
1360
1358
  key: Kn()
1361
1359
  }), m);
1362
1360
  return u.current.push(C), u.current.length === 1 && l({ open: !0 }), C.key;
1363
- }, []), 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) => {
1361
+ }, []), y = (m = "", C = {}) => g(a({ message: m, severity: "success" }, C)), S = (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) => {
1364
1362
  const C = u.current.findIndex((M) => M.key === m);
1365
1363
  if (C !== -1)
1366
1364
  return C === 0 ? (l({ open: !1 }), u.current[0]) : u.current.splice(C, 1);
1367
1365
  }, F = (m, C) => {
1368
1366
  n(m, C) && l({ open: !1 });
1369
1367
  }, P = () => {
1370
- }, S = () => {
1368
+ }, b = () => {
1371
1369
  u.current.shift(), u.current.length > 0 && l({ open: !0 });
1372
1370
  }, v = (f = u.current[0]) != null ? f : a({}, Ge), H = {};
1373
1371
  "autoHideDuration" in v && (H.autoHideDuration = v.autoHideDuration);
@@ -1376,7 +1374,7 @@ function eo(s) {
1376
1374
  setOpen: A,
1377
1375
  enqueueNotification: g,
1378
1376
  enqueueSuccessNotification: y,
1379
- enqueueInfoNotification: b,
1377
+ enqueueInfoNotification: S,
1380
1378
  enqueueWarningNotification: D,
1381
1379
  enqueueErrorNotification: I,
1382
1380
  removeNotification: O
@@ -1389,7 +1387,7 @@ function eo(s) {
1389
1387
  open: d,
1390
1388
  onClose: F,
1391
1389
  TransitionProps: {
1392
- onExited: S,
1390
+ onExited: b,
1393
1391
  onExit: P
1394
1392
  },
1395
1393
  sx: { zIndex: Yn },
@@ -1456,12 +1454,12 @@ const Xe = _(
1456
1454
  }) => {
1457
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* () {
1458
1456
  l ? (d(l), w(`Set domain to ${l}`), n()) : d("");
1459
- }), b = () => N(void 0, null, function* () {
1457
+ }), S = () => N(void 0, null, function* () {
1460
1458
  c && !x && !A ? (u(c), n()) : g && s();
1461
1459
  });
1462
1460
  let D;
1463
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(
1464
- St,
1462
+ bt,
1465
1463
  {
1466
1464
  isOpen: t,
1467
1465
  dialogTitle: "Select an organisation",
@@ -1473,7 +1471,7 @@ const Xe = _(
1473
1471
  },
1474
1472
  secondaryButton: {
1475
1473
  text: g ? "Logout" : "Cancel",
1476
- onClick: b
1474
+ onClick: S
1477
1475
  },
1478
1476
  onClose: g ? () => {
1479
1477
  } : n,
@@ -1484,7 +1482,7 @@ const Xe = _(
1484
1482
  "."
1485
1483
  ] }),
1486
1484
  /* @__PURE__ */ o(
1487
- be,
1485
+ Se,
1488
1486
  {
1489
1487
  loading: e,
1490
1488
  multiple: !1,
@@ -1494,7 +1492,7 @@ const Xe = _(
1494
1492
  getOptionLabel: io,
1495
1493
  options: [...i],
1496
1494
  renderInput: (I) => /* @__PURE__ */ o(
1497
- Se,
1495
+ be,
1498
1496
  k(a({}, I), {
1499
1497
  variant: "filled",
1500
1498
  label: "Select organisation",
@@ -1639,6 +1637,12 @@ const Xe = _(
1639
1637
  }
1640
1638
  },
1641
1639
  typography: {
1640
+ h1: {
1641
+ fontSize: "1.5rem",
1642
+ fontWeight: 400,
1643
+ lineHeight: "1.334",
1644
+ letterSpacing: "0em"
1645
+ },
1642
1646
  // I couldn't think of what to call this. It is an attempt to match
1643
1647
  // https://www.figma.com/file/atonRPl2YD9A1NCntbDtKR/List-Filter-and-Product-Concept?node-id=1187%3A43730
1644
1648
  // but not sure if line height should be changed
@@ -1683,7 +1687,7 @@ const Xe = _(
1683
1687
  return /* @__PURE__ */ o(an, { client: t, children: e });
1684
1688
  });
1685
1689
  export {
1686
- St as AgDialog,
1690
+ bt as AgDialog,
1687
1691
  Po as AppLayout,
1688
1692
  Ho as AtomProvider,
1689
1693
  Mo as AuthGuard,