@australiangreens/ag-internal-components 0.1.7 → 0.1.9

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.
@@ -1,4 +1,4 @@
1
- import { SxProps, Theme } from '@mui/material';
1
+ import { AutocompleteChangeReason, SxProps, Theme } from '@mui/material';
2
2
  import { ReactNode, SyntheticEvent } from 'react';
3
3
  import { AutocompleteGenericEntity } from '../types';
4
4
  type Props<EntityType extends AutocompleteGenericEntity> = {
@@ -8,7 +8,7 @@ type Props<EntityType extends AutocompleteGenericEntity> = {
8
8
  * to the underlying Autocomplete, but it is triggered by the Autocomplete's
9
9
  * own onChange.
10
10
  */
11
- onChange: (event: SyntheticEvent<Element, Event>, newValue: EntityType | null) => unknown;
11
+ onChange: (event: SyntheticEvent<Element, Event>, newValue: EntityType | null, reason: AutocompleteChangeReason) => unknown;
12
12
  value: EntityType | null;
13
13
  /**
14
14
  * A minimum length of characters in the Autocomplete before the lookup is called. If not set,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SingleAutocomplete/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,OAAO,EAAa,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,cAAc,EAAY,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAErD,KAAK,KAAK,CAAC,UAAU,SAAS,yBAAyB,IAAI;IACzD;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI,KAAK,OAAO,CAAC;IAC1F,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IAEzB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IAEd,qFA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AE,UAAU,GAAG,IAAI,EAC3B,MAAM,EAAE,wBAAwB,KAC7B,OAAO,CAAC;IACb,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IAEzB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IAEd,qFAAqF;IACrF,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,EAAE,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IAElF,gBAAgB,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;IAE5C;6EACyE;IACzE,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,cAAc,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IACpF,gBAAgB,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;IACtD,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,QAAA,MAAM,kBAAkB,qSAoFvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -40,13 +40,13 @@ import { jsxs as p, Fragment as F, jsx as o } from "react/jsx-runtime";
40
40
  import { useState as E, createContext as Je, useCallback as ae, useContext as Ze, useEffect as K, createElement as xe, useMemo as Rt, useRef as ge } from "react";
41
41
  import { Typography as O, Button as J, Paper as je, Box as I, Drawer as we, styled as Ae, IconButton as Z, Container as et, useTheme as se, useMediaQuery as Ht, Collapse as Wt, Avatar as Pe, Fade as zt, Skeleton as Ne, Toolbar as Ut, Divider as Le, CssBaseline as Gt, Dialog as tt, LinearProgress as nt, DialogTitle as ot, DialogContent as it, DialogActions as rt, Autocomplete as Se, TextField as be, CircularProgress as De, Chip as Vt, Tooltip as qt, Stack as Xt, Snackbar as Qt, Alert as Yt, FormHelperText as Kt } from "@mui/material";
42
42
  import Jt from "@mui/material/CssBaseline";
43
- import { styled as R, createTheme as at, alpha as fe } from "@mui/material/styles";
43
+ import { styled as H, createTheme as at, alpha as fe } from "@mui/material/styles";
44
44
  import { AgError as Zt } from "@australiangreens/ag-error";
45
45
  import { createHelper as Q } from "souvlaki";
46
46
  import { BrowserRouter as jt } from "react-router-dom";
47
47
  import st from "@mui/material/List";
48
48
  import { ArrowForward as lt, ArrowBack as ct, ViewHeadline as en, Cancel as tn, ArrowDropDown as nn } from "@mui/icons-material";
49
- import { atom as _, useSetAtom as dt, useAtomValue as _e, useAtom as V, getDefaultStore as on, Provider as ut } from "jotai";
49
+ import { atom as M, useSetAtom as dt, useAtomValue as _e, useAtom as V, getDefaultStore as on, Provider as ut } from "jotai";
50
50
  import { useHydrateAtoms as pt } from "jotai/utils";
51
51
  import Me from "react-avatar";
52
52
  import rn from "autosuggest-highlight/match";
@@ -87,7 +87,7 @@ const gt = 330, ft = 73, U = "Navbar", q = {
87
87
  userInfoHolder: `${U}-userInfoHolder`,
88
88
  settings: `${U}-settings`,
89
89
  pieChartIcon: `${U}-pieChartIcon`
90
- }, pn = R(I, {
90
+ }, pn = H(I, {
91
91
  name: "NavBar"
92
92
  })(({ theme: e }) => ({
93
93
  [`&.${q.root}`]: {
@@ -120,7 +120,7 @@ const gt = 330, ft = 73, U = "Navbar", q = {
120
120
  width: gt
121
121
  }, mt()), gn = () => a({
122
122
  width: ft
123
- }, mt()), fn = R(we, {
123
+ }, mt()), fn = H(we, {
124
124
  shouldForwardProp: (e) => e !== "open"
125
125
  })(({ theme: e, open: t }) => a(a({
126
126
  width: t ? gt : ft,
@@ -160,7 +160,7 @@ const Ct = Je(null), mn = {}, Cn = {}, xn = ({
160
160
  open: !0
161
161
  }, e), Bo = Q(
162
162
  (e = wn(), t = {}) => ({ children: n }) => /* @__PURE__ */ o(xn, { overrideState: e, overrideActions: t, children: n })
163
- ), Eo = Q(() => ({ children: e }) => /* @__PURE__ */ o(jt, { children: e })), Re = 7, Fo = R(st)(({ theme: e }) => ({
163
+ ), Eo = Q(() => ({ children: e }) => /* @__PURE__ */ o(jt, { children: e })), Re = 7, Fo = H(st)(({ theme: e }) => ({
164
164
  backgroundColor: "black",
165
165
  color: "white",
166
166
  "& .MuiListItem-root": {
@@ -198,7 +198,7 @@ const Ct = Je(null), mn = {}, Cn = {}, xn = ({
198
198
  // '&.Mui-selected.Mui-focusVisible:hover': {
199
199
  // },
200
200
  }
201
- })), He = 7, Po = R(st)(({ theme: e }) => ({
201
+ })), He = 7, Po = H(st)(({ theme: e }) => ({
202
202
  backgroundColor: "#e8e8e8",
203
203
  color: "inherit",
204
204
  "& .MuiListItem-root": {
@@ -461,7 +461,7 @@ function We({
461
461
  }
462
462
  );
463
463
  }
464
- const In = R(I, {
464
+ const In = H(I, {
465
465
  shouldForwardProp: (e) => !["leftPanel", "rightPanel"].includes(e),
466
466
  name: "PanelAwareMargins"
467
467
  })(({ theme: e, leftPanel: t, rightPanel: n }) => {
@@ -484,7 +484,7 @@ const In = R(I, {
484
484
  }),
485
485
  marginRight: `${(r = n == null ? void 0 : n.width) != null ? r : 0}px`
486
486
  });
487
- }), $n = R(et, {
487
+ }), $n = H(et, {
488
488
  name: "PageContainer"
489
489
  })(({ theme: e }) => ({
490
490
  // Horizontal padding comes from the Container's gutter
@@ -520,13 +520,13 @@ function Lo({
520
520
  }) {
521
521
  const [v, h] = E(me), [b, A] = E(Ce), [D, $] = E(me), [T, P] = E(Ce), N = n !== void 0, k = i !== void 0, {
522
522
  titleText: S,
523
- content: H,
523
+ content: _,
524
524
  flavour: W,
525
525
  open: g,
526
526
  onChangeOpen: C,
527
527
  width: x,
528
528
  arrowButtons: w,
529
- startOpen: M,
529
+ startOpen: R,
530
530
  onOpened: ee,
531
531
  onClosed: le,
532
532
  dataTestId: Ot
@@ -544,8 +544,8 @@ function Lo({
544
544
  dataTestId: Nt
545
545
  } = i ? a(a({}, ie), i) : a({}, ie);
546
546
  K(() => {
547
- M !== me && (h(M), $(M));
548
- }, [M]), K(() => {
547
+ R !== me && (h(R), $(R));
548
+ }, [R]), K(() => {
549
549
  ne !== Ce && (A(ne), P(ne));
550
550
  }, [ne]);
551
551
  const ue = g === void 0 ? v : g, pe = ce === void 0 ? b : ce, $e = (z) => {
@@ -570,7 +570,7 @@ function Lo({
570
570
  navBarOpen: u,
571
571
  navBarWidthOpen: f,
572
572
  navBarWidthClosed: m,
573
- children: H
573
+ children: _
574
574
  }
575
575
  ),
576
576
  k && /* @__PURE__ */ o(
@@ -634,7 +634,7 @@ function Lo({
634
634
  const vt = () => {
635
635
  const e = se();
636
636
  return Ht(e.breakpoints.down("sm"));
637
- }, Tn = 64, On = 72, Bn = 256, j = _(!0), wt = _(Bn), At = _(On), ve = _(""), En = _(void 0), St = _(Tn), bt = _(void 0);
637
+ }, Tn = 64, On = 72, Bn = 256, j = M(!0), wt = M(Bn), At = M(On), ve = M(""), En = M(void 0), St = M(Tn), bt = M(void 0);
638
638
  function Fn({ links: e }) {
639
639
  return /* @__PURE__ */ o("div", { children: "LinksMenu not implemented yet" });
640
640
  }
@@ -646,7 +646,7 @@ const re = "Navbar", Y = {
646
646
  // userInfoHolder: `${PREFIX}-userInfoHolder`,
647
647
  // settings: `${PREFIX}-settings`,
648
648
  // pieChartIcon: `${PREFIX}-pieChartIcon`,
649
- }, Pn = R(I, { name: "NavBar" })(({ theme: e }) => ({
649
+ }, Pn = H(I, { name: "NavBar" })(({ theme: e }) => ({
650
650
  [`&.${Y.root}`]: {
651
651
  display: "flex"
652
652
  },
@@ -694,7 +694,7 @@ const re = "Navbar", Y = {
694
694
  }, Dt(e)), Ue = (e, t) => a({
695
695
  width: t,
696
696
  transition: X(e, "width", "leaving")
697
- }, Dt(e)), Ln = R(we, {
697
+ }, Dt(e)), Ln = H(we, {
698
698
  shouldForwardProp: (e) => !["widthOpen", "widthClosed", "isSmallScreen"].includes(e)
699
699
  })(({ theme: e, open: t, widthOpen: n, widthClosed: i, isSmallScreen: r }) => a(a({
700
700
  flexShrink: 0,
@@ -873,7 +873,7 @@ function Un({
873
873
  gap: 2,
874
874
  flexShrink: 0,
875
875
  height: t,
876
- zIndex: l ? 0 : c.zIndex.drawer + 1
876
+ zIndex: l ? 0 : c.zIndex.drawer + 101
877
877
  },
878
878
  children: [
879
879
  /* @__PURE__ */ o(
@@ -1046,7 +1046,7 @@ function Mo({
1046
1046
  const [P, N] = E(""), k = (g, C) => {
1047
1047
  const x = s.filter((w) => w.id !== C);
1048
1048
  n(x, "delete", g);
1049
- }, { data: S, isLoading: H } = yt({
1049
+ }, { data: S, isLoading: _ } = yt({
1050
1050
  inputValue: P,
1051
1051
  label: r,
1052
1052
  lookup: e,
@@ -1062,7 +1062,7 @@ function Mo({
1062
1062
  disablePortal: $,
1063
1063
  multiple: !0,
1064
1064
  getOptionLabel: (g) => typeof g == "string" ? g : g.label,
1065
- loading: W ? H : !1,
1065
+ loading: W ? _ : !1,
1066
1066
  options: [...s, ...S != null ? S : []],
1067
1067
  filterSelectedOptions: !0,
1068
1068
  includeInputInList: !0,
@@ -1084,7 +1084,7 @@ function Mo({
1084
1084
  helperText: A,
1085
1085
  InputProps: y(a({}, g.InputProps), {
1086
1086
  endAdornment: /* @__PURE__ */ p(F, { children: [
1087
- H ? /* @__PURE__ */ o(De, { color: "inherit", size: 20 }) : null,
1087
+ _ ? /* @__PURE__ */ o(De, { color: "inherit", size: 20 }) : null,
1088
1088
  g.InputProps.endAdornment
1089
1089
  ] })
1090
1090
  }),
@@ -1102,14 +1102,14 @@ function Mo({
1102
1102
  const w = rn(C.label, x.inputValue, {
1103
1103
  insideWords: !0,
1104
1104
  findAllOccurrences: !0
1105
- }), M = an(C.label, w);
1105
+ }), R = an(C.label, w);
1106
1106
  return /* @__PURE__ */ xe(
1107
1107
  "li",
1108
1108
  y(a({}, g), {
1109
1109
  key: C.id,
1110
1110
  "data-testid": c ? `${c}:Autocomplete:option(${C.id.toString()})` : void 0
1111
1111
  }),
1112
- /* @__PURE__ */ o("div", { children: M.map((ee, le) => /* @__PURE__ */ o(
1112
+ /* @__PURE__ */ o("div", { children: R.map((ee, le) => /* @__PURE__ */ o(
1113
1113
  "span",
1114
1114
  {
1115
1115
  style: {
@@ -1204,8 +1204,8 @@ const Ro = ({
1204
1204
  "data-testid": l ? `${l}:Autocomplete` : void 0,
1205
1205
  loading: N ? P : !1,
1206
1206
  options: T != null ? T : [],
1207
- onChange: (k, S) => {
1208
- t(k, S);
1207
+ onChange: (k, S, _) => {
1208
+ t(k, S, _);
1209
1209
  },
1210
1210
  disablePortal: f,
1211
1211
  filterOptions: (k) => k,
@@ -1424,7 +1424,7 @@ function no(s) {
1424
1424
  }), x);
1425
1425
  return u.current.push(w), u.current.length === 1 && d({ open: !0 }), w.key;
1426
1426
  }, []), b = (x = "", w = {}) => h(a({ message: x, severity: "success" }, w)), A = (x = "", w = {}) => h(a({ message: x, severity: "info" }, w)), D = (x = "", w = {}) => h(a({ message: x, severity: "warning" }, w)), $ = (x = "", w = {}) => h(a({ message: x, severity: "error" }, w)), T = (x) => {
1427
- const w = u.current.findIndex((M) => M.key === x);
1427
+ const w = u.current.findIndex((R) => R.key === x);
1428
1428
  if (w !== -1)
1429
1429
  return w === 0 ? (d({ open: !1 }), u.current[0]) : u.current.splice(w, 1);
1430
1430
  }, P = (x, w) => {
@@ -1432,8 +1432,8 @@ function no(s) {
1432
1432
  }, N = () => {
1433
1433
  }, k = () => {
1434
1434
  u.current.shift(), u.current.length > 0 && d({ open: !0 });
1435
- }, S = (C = u.current[0]) != null ? C : a({}, qe), H = {};
1436
- "autoHideDuration" in S && (H.autoHideDuration = S.autoHideDuration);
1435
+ }, S = (C = u.current[0]) != null ? C : a({}, qe), _ = {};
1436
+ "autoHideDuration" in S && (_.autoHideDuration = S.autoHideDuration);
1437
1437
  const W = a(a({}, Yn), r), g = a(a({
1438
1438
  open: l,
1439
1439
  setOpen: v,
@@ -1448,7 +1448,7 @@ function no(s) {
1448
1448
  i,
1449
1449
  /* @__PURE__ */ o(
1450
1450
  Qt,
1451
- y(a(a({}, W), H), {
1451
+ y(a(a({}, W), _), {
1452
1452
  open: l,
1453
1453
  onClose: P,
1454
1454
  TransitionProps: {
@@ -1487,9 +1487,9 @@ const zo = Q(
1487
1487
  store: t
1488
1488
  }) => /* @__PURE__ */ o(ut, { store: t != null ? t : io, children: e }), $t = "domainCode";
1489
1489
  var Ke;
1490
- const Ye = _(
1490
+ const Ye = M(
1491
1491
  JSON.parse((Ke = localStorage.getItem($t)) != null ? Ke : '{"domainCode": ""}').domainCode
1492
- ), Tt = _(
1492
+ ), Tt = M(
1493
1493
  (e) => e(Ye),
1494
1494
  (e, t, n) => {
1495
1495
  t(Ye, n), localStorage.setItem($t, JSON.stringify({ domainCode: n }));