@australiangreens/ag-internal-components 0.0.93 → 0.0.94

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 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";
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";
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, Sn = Ae(we, {
360
+ const mt = 400, bn = 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, Sn = Ae(we, {
387
387
  marginLeft: `${r}px`
388
388
  }))
389
389
  })
390
- ), bn = Ae($, {
390
+ ), Sn = 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
- Sn,
429
+ bn,
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(bn, k(a({ anchor: t }, l), { children: t === "left" ? /* @__PURE__ */ h(L, { children: [
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 }),
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, S] = B(Ce), [D, I] = B(me), [O, F] = B(Ce), P = n !== void 0, b = i !== void 0, {
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,
@@ -545,12 +545,12 @@ function Fo({
545
545
  ie(() => {
546
546
  M !== me && (g(M), I(M));
547
547
  }, [M]), ie(() => {
548
- j !== Ce && (S(j), F(j));
548
+ j !== Ce && (b(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 && b && (z ? (S(!1), F(y)) : S(O))), f && f(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 && (S(z), r && P && (z ? (g(!1), I(A)) : g(D))), $e && $e(z);
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(
@@ -572,7 +572,7 @@ function Fo({
572
572
  children: H
573
573
  }
574
574
  ),
575
- b && /* @__PURE__ */ o(
575
+ S && /* @__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
- } : {}), b && ye === "push" ? {
606
+ } : {}), S && 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
- }, St = (e) => {
682
+ }, bt = (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
- }, St(e)), ze = (e, t) => a({
693
+ }, bt(e)), ze = (e, t) => a({
694
694
  width: t,
695
695
  transition: ae(e, "width", "leaving")
696
- }, St(e)), Fn = R(we, {
696
+ }, bt(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,
@@ -868,7 +868,7 @@ function Wn({
868
868
  children: /* @__PURE__ */ o(Jt, { fontSize: "medium" })
869
869
  }
870
870
  ),
871
- /* @__PURE__ */ o(E, { className: Hn.titleText, variant: "h1", children: e }),
871
+ /* @__PURE__ */ o(E, { className: Hn.titleText, variant: "h6", component: "h1", children: e }),
872
872
  i
873
873
  ]
874
874
  }
@@ -891,7 +891,7 @@ function Po({
891
891
  [K, n != null ? n : !0],
892
892
  [ve, t != null ? t : ""]
893
893
  ]);
894
- const x = _e(K), [A] = V(xt), [g] = V(vt), y = _e(ve), [S] = V(wt), [D] = V(On), [I] = V(At);
894
+ const x = _e(K), [A] = V(xt), [g] = V(vt), y = _e(ve), [b] = V(wt), [D] = V(On), [I] = V(At);
895
895
  return /* @__PURE__ */ h($, { children: [
896
896
  /* @__PURE__ */ o(Wt, {}),
897
897
  /* @__PURE__ */ o(
@@ -899,7 +899,7 @@ function Po({
899
899
  {
900
900
  titleText: y,
901
901
  "data-testid": s,
902
- height: S,
902
+ height: b,
903
903
  middle: D
904
904
  }
905
905
  ),
@@ -915,7 +915,7 @@ function Po({
915
915
  domainCode: w,
916
916
  widthOpen: A,
917
917
  widthClosed: g,
918
- offsetTop: S,
918
+ offsetTop: b,
919
919
  "data-testid": c
920
920
  }
921
921
  ),
@@ -923,7 +923,7 @@ function Po({
923
923
  Mn,
924
924
  k(a({
925
925
  "data-testid": r,
926
- topBarHeight: S
926
+ topBarHeight: b
927
927
  }, i), {
928
928
  children: e
929
929
  })
@@ -931,7 +931,7 @@ function Po({
931
931
  ] })
932
932
  ] });
933
933
  }
934
- const bt = ({
934
+ const St = ({
935
935
  isOpen: e,
936
936
  dialogTitle: t,
937
937
  children: n,
@@ -950,7 +950,7 @@ const bt = ({
950
950
  je,
951
951
  {
952
952
  open: e,
953
- onClose: (S, D) => N(void 0, null, function* () {
953
+ onClose: (b, D) => N(void 0, null, function* () {
954
954
  u && (D === "backdropClick" || D === "escapeKeyDown") || x || (s != null && s.onClick ? yield s.onClick() : c());
955
955
  }),
956
956
  fullWidth: !0,
@@ -976,8 +976,8 @@ const bt = ({
976
976
  re,
977
977
  {
978
978
  onClick: () => N(void 0, null, function* () {
979
- var S;
980
- A(!0), yield (S = r.onClick) == null ? void 0 : S.call(r), A(!1);
979
+ var b;
980
+ A(!0), yield (b = r.onClick) == null ? void 0 : b.call(r), A(!1);
981
981
  }),
982
982
  "data-testid": r.testId,
983
983
  disabled: r.disabled || x,
@@ -1018,12 +1018,12 @@ function No({
1018
1018
  noOptionsText: A = "No options",
1019
1019
  popupIcon: g = /* @__PURE__ */ o(jt, {}),
1020
1020
  error: y = !1,
1021
- helperText: S = "",
1021
+ helperText: b = "",
1022
1022
  preLoadedOptions: D = void 0,
1023
1023
  disablePortal: I = !1,
1024
1024
  disableIconFlip: O = !1
1025
1025
  }) {
1026
- const [F, P] = B(""), b = (p, f) => {
1026
+ const [F, P] = B(""), S = (p, f) => {
1027
1027
  const m = s.filter((C) => C.id !== f);
1028
1028
  n(m, "delete", p);
1029
1029
  }, { data: v, isLoading: H } = kt({
@@ -1035,7 +1035,7 @@ function No({
1035
1035
  }), W = F.length >= i;
1036
1036
  return /* @__PURE__ */ h("div", { "data-testid": c, children: [
1037
1037
  /* @__PURE__ */ o(
1038
- Se,
1038
+ be,
1039
1039
  {
1040
1040
  sx: a(a({}, d), O ? { ".MuiAutocomplete-popupIndicatorOpen": { transform: "rotate(0deg)" } } : {}),
1041
1041
  "data-testid": c ? `${c}:Autocomplete` : void 0,
@@ -1055,13 +1055,13 @@ function No({
1055
1055
  loadingText: x,
1056
1056
  popupIcon: g,
1057
1057
  renderInput: (p) => /* @__PURE__ */ o(
1058
- be,
1058
+ Se,
1059
1059
  k(a({}, p), {
1060
1060
  label: r,
1061
1061
  fullWidth: !0,
1062
1062
  variant: w,
1063
1063
  error: y,
1064
- helperText: S,
1064
+ helperText: b,
1065
1065
  InputProps: k(a({}, p.InputProps), {
1066
1066
  endAdornment: /* @__PURE__ */ h(L, { children: [
1067
1067
  H ? /* @__PURE__ */ o(ke, { color: "inherit", size: 20 }) : null,
@@ -1139,7 +1139,7 @@ function No({
1139
1139
  }
1140
1140
  ),
1141
1141
  "data-testid": c ? `${c}:Chip(${p.id.toString()})` : void 0,
1142
- onDelete: (f) => b(f, p.id),
1142
+ onDelete: (f) => S(f, p.id),
1143
1143
  deleteIcon: /* @__PURE__ */ o(
1144
1144
  Zt,
1145
1145
  {
@@ -1168,7 +1168,7 @@ const Lo = ({
1168
1168
  helperText: A = "",
1169
1169
  disabled: g,
1170
1170
  popupIcon: y,
1171
- disableIconFlip: S
1171
+ disableIconFlip: b
1172
1172
  }) => {
1173
1173
  const [D, I] = B(""), { data: O, isLoading: F } = kt({
1174
1174
  inputValue: D,
@@ -1178,39 +1178,39 @@ const Lo = ({
1178
1178
  preLoadedOptions: x
1179
1179
  }), P = D.length >= u;
1180
1180
  return /* @__PURE__ */ o("div", { "data-testid": d, children: /* @__PURE__ */ o(Gt, { direction: "row", spacing: 1, children: /* @__PURE__ */ o(
1181
- Se,
1181
+ be,
1182
1182
  {
1183
- sx: a(a({}, r), S ? { ".MuiAutocomplete-popupIndicatorOpen": { transform: "rotate(0deg)" } } : {}),
1183
+ sx: a(a({}, r), b ? { ".MuiAutocomplete-popupIndicatorOpen": { transform: "rotate(0deg)" } } : {}),
1184
1184
  "data-testid": d ? `${d}:Autocomplete` : void 0,
1185
1185
  loading: P ? F : !1,
1186
1186
  options: O != null ? O : [],
1187
- onChange: (b, v) => {
1188
- t(b, v);
1187
+ onChange: (S, v) => {
1188
+ t(S, v);
1189
1189
  },
1190
1190
  disablePortal: w,
1191
- filterOptions: (b) => b,
1191
+ filterOptions: (S) => S,
1192
1192
  value: i,
1193
1193
  noOptionsText: P ? l : "Start typing to search",
1194
- getOptionLabel: (b) => b.label,
1194
+ getOptionLabel: (S) => S.label,
1195
1195
  popupIcon: y,
1196
- renderInput: (b) => /* @__PURE__ */ o(
1197
- be,
1196
+ renderInput: (S) => /* @__PURE__ */ o(
1197
+ Se,
1198
1198
  k(a({
1199
1199
  "data-testid": d ? `${d}:Autocomplete:TextField` : void 0
1200
- }, b), {
1200
+ }, S), {
1201
1201
  variant: c,
1202
1202
  label: n,
1203
1203
  color: s,
1204
1204
  helperText: A
1205
1205
  })
1206
1206
  ),
1207
- isOptionEqualToValue: (b, v) => b.id === v.id,
1208
- onInputChange: (b, v) => {
1207
+ isOptionEqualToValue: (S, v) => S.id === v.id,
1208
+ onInputChange: (S, v) => {
1209
1209
  I(v);
1210
1210
  },
1211
- renderOption: (b, v) => /* @__PURE__ */ xe(
1211
+ renderOption: (S, v) => /* @__PURE__ */ xe(
1212
1212
  "li",
1213
- k(a({}, b), {
1213
+ k(a({}, S), {
1214
1214
  key: v.id,
1215
1215
  "data-testid": d ? `${d}:Autocomplete:option(${v.id.toString()})` : void 0
1216
1216
  }),
@@ -1250,7 +1250,7 @@ const Lo = ({
1250
1250
  }
1251
1251
  }))();
1252
1252
  }, [s, r, n]), /* @__PURE__ */ o(
1253
- bt,
1253
+ St,
1254
1254
  {
1255
1255
  isOpen: e,
1256
1256
  primaryButton: {
@@ -1358,14 +1358,14 @@ function eo(s) {
1358
1358
  key: Kn()
1359
1359
  }), m);
1360
1360
  return u.current.push(C), u.current.length === 1 && l({ open: !0 }), C.key;
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) => {
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) => {
1362
1362
  const C = u.current.findIndex((M) => M.key === m);
1363
1363
  if (C !== -1)
1364
1364
  return C === 0 ? (l({ open: !1 }), u.current[0]) : u.current.splice(C, 1);
1365
1365
  }, F = (m, C) => {
1366
1366
  n(m, C) && l({ open: !1 });
1367
1367
  }, P = () => {
1368
- }, b = () => {
1368
+ }, S = () => {
1369
1369
  u.current.shift(), u.current.length > 0 && l({ open: !0 });
1370
1370
  }, v = (f = u.current[0]) != null ? f : a({}, Ge), H = {};
1371
1371
  "autoHideDuration" in v && (H.autoHideDuration = v.autoHideDuration);
@@ -1374,7 +1374,7 @@ function eo(s) {
1374
1374
  setOpen: A,
1375
1375
  enqueueNotification: g,
1376
1376
  enqueueSuccessNotification: y,
1377
- enqueueInfoNotification: S,
1377
+ enqueueInfoNotification: b,
1378
1378
  enqueueWarningNotification: D,
1379
1379
  enqueueErrorNotification: I,
1380
1380
  removeNotification: O
@@ -1387,7 +1387,7 @@ function eo(s) {
1387
1387
  open: d,
1388
1388
  onClose: F,
1389
1389
  TransitionProps: {
1390
- onExited: b,
1390
+ onExited: S,
1391
1391
  onExit: P
1392
1392
  },
1393
1393
  sx: { zIndex: Yn },
@@ -1454,12 +1454,12 @@ const Xe = _(
1454
1454
  }) => {
1455
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* () {
1456
1456
  l ? (d(l), w(`Set domain to ${l}`), n()) : d("");
1457
- }), S = () => N(void 0, null, function* () {
1457
+ }), b = () => N(void 0, null, function* () {
1458
1458
  c && !x && !A ? (u(c), n()) : g && s();
1459
1459
  });
1460
1460
  let D;
1461
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(
1462
- bt,
1462
+ St,
1463
1463
  {
1464
1464
  isOpen: t,
1465
1465
  dialogTitle: "Select an organisation",
@@ -1471,7 +1471,7 @@ const Xe = _(
1471
1471
  },
1472
1472
  secondaryButton: {
1473
1473
  text: g ? "Logout" : "Cancel",
1474
- onClick: S
1474
+ onClick: b
1475
1475
  },
1476
1476
  onClose: g ? () => {
1477
1477
  } : n,
@@ -1482,7 +1482,7 @@ const Xe = _(
1482
1482
  "."
1483
1483
  ] }),
1484
1484
  /* @__PURE__ */ o(
1485
- Se,
1485
+ be,
1486
1486
  {
1487
1487
  loading: e,
1488
1488
  multiple: !1,
@@ -1492,7 +1492,7 @@ const Xe = _(
1492
1492
  getOptionLabel: io,
1493
1493
  options: [...i],
1494
1494
  renderInput: (I) => /* @__PURE__ */ o(
1495
- be,
1495
+ Se,
1496
1496
  k(a({}, I), {
1497
1497
  variant: "filled",
1498
1498
  label: "Select organisation",
@@ -1637,11 +1637,12 @@ const Xe = _(
1637
1637
  }
1638
1638
  },
1639
1639
  typography: {
1640
- h1: {
1641
- fontSize: "1.5rem",
1642
- fontWeight: 400,
1643
- lineHeight: "1.334",
1644
- letterSpacing: "0em"
1640
+ h4: {
1641
+ fontSize: "1.88rem",
1642
+ fontWeight: 500
1643
+ },
1644
+ h5: {
1645
+ fontWeight: 500
1645
1646
  },
1646
1647
  // I couldn't think of what to call this. It is an attempt to match
1647
1648
  // https://www.figma.com/file/atonRPl2YD9A1NCntbDtKR/List-Filter-and-Product-Concept?node-id=1187%3A43730
@@ -1649,10 +1650,6 @@ const Xe = _(
1649
1650
  explainer: {
1650
1651
  fontSize: "14px",
1651
1652
  marginBlockStart: "1em"
1652
- },
1653
- h3: {
1654
- fontSize: "1rem",
1655
- fontWeight: 700
1656
1653
  }
1657
1654
  },
1658
1655
  navBar: {
@@ -1687,7 +1684,7 @@ const Xe = _(
1687
1684
  return /* @__PURE__ */ o(an, { client: t, children: e });
1688
1685
  });
1689
1686
  export {
1690
- bt as AgDialog,
1687
+ St as AgDialog,
1691
1688
  Po as AppLayout,
1692
1689
  Ho as AtomProvider,
1693
1690
  Mo as AuthGuard,