@australiangreens/ag-internal-components 0.0.24 → 0.0.25

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
@@ -1,61 +1,442 @@
1
- var V = Object.defineProperty, $ = Object.defineProperties;
2
- var j = Object.getOwnPropertyDescriptors;
3
- var m = Object.getOwnPropertySymbols;
4
- var T = Object.prototype.hasOwnProperty, N = Object.prototype.propertyIsEnumerable;
5
- var F = (e, t, r) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, a = (e, t) => {
6
- for (var r in t || (t = {}))
7
- T.call(t, r) && F(e, r, t[r]);
8
- if (m)
9
- for (var r of m(t))
10
- N.call(t, r) && F(e, r, t[r]);
11
- return e;
12
- }, g = (e, t) => $(e, j(t));
13
- var P = (e, t) => {
14
- var r = {};
15
- for (var i in e)
16
- T.call(e, i) && t.indexOf(i) < 0 && (r[i] = e[i]);
17
- if (e != null && m)
18
- for (var i of m(e))
19
- t.indexOf(i) < 0 && N.call(e, i) && (r[i] = e[i]);
20
- return r;
1
+ var Et = Object.defineProperty, kt = Object.defineProperties;
2
+ var Nt = Object.getOwnPropertyDescriptors;
3
+ var M = Object.getOwnPropertySymbols;
4
+ var at = Object.prototype.hasOwnProperty, st = Object.prototype.propertyIsEnumerable;
5
+ var V = (t, e, n) => e in t ? Et(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, r = (t, e) => {
6
+ for (var n in e || (e = {}))
7
+ at.call(e, n) && V(t, n, e[n]);
8
+ if (M)
9
+ for (var n of M(e))
10
+ st.call(e, n) && V(t, n, e[n]);
11
+ return t;
12
+ }, v = (t, e) => kt(t, Nt(e));
13
+ var ct = (t, e) => {
14
+ var n = {};
15
+ for (var o in t)
16
+ at.call(t, o) && e.indexOf(o) < 0 && (n[o] = t[o]);
17
+ if (t != null && M)
18
+ for (var o of M(t))
19
+ e.indexOf(o) < 0 && st.call(t, o) && (n[o] = t[o]);
20
+ return n;
21
21
  };
22
- var b = (e, t, r) => (F(e, typeof t != "symbol" ? t + "" : t, r), r);
23
- import { jsxs as p, Fragment as K, jsx as s } from "react/jsx-runtime";
24
- import { useState as M, createContext as J, useRef as y, useContext as Y } from "react";
25
- import Z from "@mui/material/Button";
26
- import ee from "@mui/material/Paper";
27
- import D from "@mui/material/Typography";
28
- import { createTheme as q, alpha as x, ThemeProvider as te } from "@mui/material/styles";
29
- import re from "@mui/material/Snackbar";
30
- import oe from "@mui/material/Alert";
31
- import ne from "@mui/material/LinearProgress";
32
- import ie from "@mui/material/CircularProgress";
33
- import { AgError as ae } from "@australiangreens/ag-error";
34
- function Pe({ text: e }) {
35
- const [t, r] = M(0);
36
- return /* @__PURE__ */ p(K, { children: [
37
- /* @__PURE__ */ s(D, { variant: "h6", color: "inherit", component: "div", sx: { fontSize: "22px" }, children: "Hello world" }),
38
- /* @__PURE__ */ s(D, { variant: "caption", display: "block", children: /* @__PURE__ */ s("span", { children: "Just ensuring MUI is working as planned as a peer dependency. v0.0.11" }) }),
39
- /* @__PURE__ */ s(
40
- Z,
22
+ var lt = (t, e, n) => (V(t, typeof e != "symbol" ? e + "" : e, n), n);
23
+ import { jsxs as l, Fragment as q, jsx as i } from "react/jsx-runtime";
24
+ import { useState as b, useEffect as dt, createContext as Dt, useRef as K, useContext as Lt } from "react";
25
+ import $t from "@mui/material/Button";
26
+ import Rt from "@mui/material/Paper";
27
+ import E from "@mui/material/Typography";
28
+ import { styled as k, Box as xt, IconButton as pt } from "@mui/material";
29
+ import wt from "@mui/icons-material/ArrowForward";
30
+ import vt from "@mui/icons-material/ArrowBack";
31
+ import _t from "@mui/material/Drawer";
32
+ import Ht from "@mui/material/Box";
33
+ import ut from "@mui/material/IconButton";
34
+ import Mt from "@mui/material/Container";
35
+ import { createTheme as Ct, alpha as J, ThemeProvider as zt } from "@mui/material/styles";
36
+ import qt from "@mui/material/Snackbar";
37
+ import Gt from "@mui/material/Alert";
38
+ import Ut from "@mui/material/LinearProgress";
39
+ import Wt from "@mui/material/CircularProgress";
40
+ import { AgError as Xt } from "@australiangreens/ag-error";
41
+ function Pe({ text: t }) {
42
+ const [e, n] = b(0);
43
+ return /* @__PURE__ */ l(q, { children: [
44
+ /* @__PURE__ */ i(E, { variant: "h6", color: "inherit", component: "div", sx: { fontSize: "22px" }, children: "Hello world" }),
45
+ /* @__PURE__ */ i(E, { variant: "caption", display: "block", children: /* @__PURE__ */ i("span", { children: "Just ensuring MUI is working as planned as a peer dependency. v0.0.11" }) }),
46
+ /* @__PURE__ */ i(
47
+ $t,
41
48
  {
42
49
  variant: "outlined",
43
- onClick: () => r((i) => i + 1),
50
+ onClick: () => n((o) => o + 1),
44
51
  "aria-label": "Increment",
45
52
  children: "Hello I am a button"
46
53
  }
47
54
  ),
48
- /* @__PURE__ */ p("p", { children: [
55
+ /* @__PURE__ */ l("p", { children: [
49
56
  "This is some text: ",
50
- /* @__PURE__ */ s("span", { children: e })
57
+ /* @__PURE__ */ i("span", { children: t })
51
58
  ] }),
52
- /* @__PURE__ */ p(ee, { children: [
59
+ /* @__PURE__ */ l(Rt, { children: [
53
60
  "This number will incremember when button pressed: ",
54
- t
61
+ e
55
62
  ] })
56
63
  ] });
57
64
  }
58
- const se = q({
65
+ const jt = 24, Qt = 64, C = "TopBar", u = {
66
+ topStripe: `${C}-topStripe`,
67
+ titleBar: `${C}-titleBar`,
68
+ titleSlider: `${C}-titleSlider`,
69
+ titleText: `${C}-titleText`,
70
+ leftPanelButton: `${C}-leftPanelButton`,
71
+ rightPanelButton: `${C}-leftPanelButton`
72
+ }, Vt = k("div", {
73
+ shouldForwardProp: (t) => !["leftPanel", "rightPanel"].includes(t),
74
+ name: C
75
+ })(({ theme: t, leftPanel: e, rightPanel: n }) => {
76
+ var o, c;
77
+ return {
78
+ width: "100%",
79
+ [`& .${u.topStripe}`]: {
80
+ width: "100%",
81
+ height: `${jt}px`,
82
+ backgroundColor: t.palette.primary.main
83
+ },
84
+ [`& .${u.titleBar}`]: {
85
+ backgroundColor: t.palette.primary.light,
86
+ height: `${Qt}px`,
87
+ padding: t.spacing(0, 3),
88
+ width: "100%"
89
+ },
90
+ [`& .${u.titleSlider}`]: r(r({
91
+ height: "100%",
92
+ display: "flex",
93
+ alignItems: "center",
94
+ color: "white",
95
+ transition: t.transitions.create("margin", {
96
+ easing: t.transitions.easing.sharp,
97
+ duration: t.transitions.duration.leavingScreen
98
+ }),
99
+ [`& .${u.leftPanelButton}`]: {
100
+ marginRight: t.spacing(2),
101
+ flexGrow: 0
102
+ },
103
+ [`& .${u.titleText}`]: {
104
+ flexGrow: 1
105
+ },
106
+ [`& .${u.rightPanelButton}`]: {
107
+ flexGrow: 0
108
+ }
109
+ }, (e == null ? void 0 : e.open) && {
110
+ transition: t.transitions.create("margin", {
111
+ easing: t.transitions.easing.easeOut,
112
+ duration: t.transitions.duration.enteringScreen
113
+ }),
114
+ marginLeft: `${(o = e == null ? void 0 : e.width) != null ? o : 0}px`
115
+ }), (n == null ? void 0 : n.open) && {
116
+ transition: t.transitions.create("margin", {
117
+ easing: t.transitions.easing.easeOut,
118
+ duration: t.transitions.duration.enteringScreen
119
+ }),
120
+ marginRight: `${(c = n == null ? void 0 : n.width) != null ? c : 0}px`
121
+ })
122
+ };
123
+ });
124
+ function Kt({
125
+ titleText: t = "",
126
+ leftPanel: e,
127
+ rightPanel: n,
128
+ "data-testid": o
129
+ }) {
130
+ return /* @__PURE__ */ l(Vt, { leftPanel: e, rightPanel: n, "data-testid": o, children: [
131
+ /* @__PURE__ */ i("div", { className: u.topStripe }),
132
+ /* @__PURE__ */ i("div", { className: u.titleBar, children: /* @__PURE__ */ l(xt, { className: u.titleSlider, children: [
133
+ e !== void 0 && !e.open && e.showOpenArrow && /* @__PURE__ */ l(
134
+ pt,
135
+ {
136
+ className: u.leftPanelButton,
137
+ color: "inherit",
138
+ "aria-label": "Open left side panel",
139
+ onClick: e == null ? void 0 : e.onOpen,
140
+ edge: "start",
141
+ size: "large",
142
+ children: [
143
+ " ",
144
+ /* @__PURE__ */ i(wt, {})
145
+ ]
146
+ }
147
+ ),
148
+ /* @__PURE__ */ i(E, { className: u.titleText, variant: "h6", noWrap: !0, children: t }),
149
+ n !== void 0 && !n.open && n.showOpenArrow && /* @__PURE__ */ l(
150
+ pt,
151
+ {
152
+ className: u.rightPanelButton,
153
+ color: "inherit",
154
+ "aria-label": "Open right side panel",
155
+ onClick: n == null ? void 0 : n.onOpen,
156
+ edge: "end",
157
+ size: "large",
158
+ children: [
159
+ " ",
160
+ /* @__PURE__ */ i(vt, {})
161
+ ]
162
+ }
163
+ )
164
+ ] }) })
165
+ ] });
166
+ }
167
+ const Ft = 400, Jt = k(_t, {
168
+ shouldForwardProp: (t) => (
169
+ // Note we do want anchor to be forwarded to the Drawer component
170
+ ![
171
+ "width",
172
+ "debug",
173
+ "debugOpacity",
174
+ "navBarOpen",
175
+ "navBarWidthOpen",
176
+ "navBarWidthClosed"
177
+ ].includes(t)
178
+ ),
179
+ name: "SidePanelDrawer"
180
+ })(
181
+ ({ width: t, debugOpacity: e = !1, anchor: n, navBarOpen: o, navBarWidthOpen: c, navBarWidthClosed: m }) => ({
182
+ width: t,
183
+ "& .MuiDrawer-paper": r(r({
184
+ position: "absolute",
185
+ width: t,
186
+ boxSizing: "border-box",
187
+ border: "unset",
188
+ boxShadow: "0px 4px 5px rgba(0, 0, 0, 0.14), 0px 1px 10px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.2)"
189
+ }, e && {
190
+ opacity: "50%"
191
+ }), n === "left" && r({
192
+ marginLeft: `${m}px`
193
+ }, o && {
194
+ marginLeft: `${c}px`
195
+ }))
196
+ })
197
+ ), Yt = k(Ht, {
198
+ shouldForwardProp: (t) => !["anchor"].includes(t)
199
+ })(({ theme: t, anchor: e }) => v(r({
200
+ display: "flex",
201
+ alignItems: "center",
202
+ padding: t.spacing(2)
203
+ }, t.mixins.toolbar), {
204
+ justifyContent: e === "left" ? "space-between" : "flex-start",
205
+ backgroundColor: t.palette.primary.light,
206
+ height: "88px",
207
+ "&,*": {
208
+ color: "white"
209
+ },
210
+ " .MuiTypography-root": {
211
+ fontSize: "22px"
212
+ },
213
+ " .MuiButtonBase-root": {
214
+ marginRight: e === "right" ? t.spacing(2) : 0
215
+ }
216
+ }));
217
+ function ft({
218
+ children: t,
219
+ anchor: e = "left",
220
+ open: n,
221
+ onClose: o = () => {
222
+ },
223
+ titleText: c = "",
224
+ width: m = Ft,
225
+ showCloseArrow: h = !0,
226
+ debugOpacity: d = !1,
227
+ headerBoxProps: F = {},
228
+ onOpened: f,
229
+ onClosed: p,
230
+ "data-testid": O,
231
+ navBarOpen: T = !1,
232
+ navBarWidthOpen: x = 0,
233
+ navBarWidthClosed: y = 0
234
+ }) {
235
+ return /* @__PURE__ */ l(
236
+ Jt,
237
+ {
238
+ SlideProps: {
239
+ onEntered: () => f == null ? void 0 : f(),
240
+ onExited: () => p == null ? void 0 : p()
241
+ },
242
+ variant: "persistent",
243
+ anchor: e,
244
+ open: n,
245
+ width: m,
246
+ debugOpacity: d,
247
+ "data-testid": O,
248
+ navBarOpen: T,
249
+ navBarWidthOpen: x,
250
+ navBarWidthClosed: y,
251
+ children: [
252
+ /* @__PURE__ */ i(Yt, v(r({ anchor: e }, F), { children: e === "left" ? /* @__PURE__ */ l(q, { children: [
253
+ /* @__PURE__ */ i(E, { variant: "h6", color: "inherit", component: "div", children: c }),
254
+ h && /* @__PURE__ */ l(ut, { onClick: o, size: "large", "aria-label": "Close left side panel", children: [
255
+ /* @__PURE__ */ i(vt, { "data-testid": "arrowbackicon" }),
256
+ " "
257
+ ] })
258
+ ] }) : /* @__PURE__ */ l(q, { children: [
259
+ h && /* @__PURE__ */ l(ut, { onClick: o, size: "large", "aria-label": "Close right side panel", children: [
260
+ /* @__PURE__ */ i(wt, {}),
261
+ " "
262
+ ] }),
263
+ /* @__PURE__ */ i(E, { variant: "h6", color: "inherit", component: "div", children: c })
264
+ ] }) })),
265
+ t
266
+ ]
267
+ }
268
+ );
269
+ }
270
+ const Zt = k("div", {
271
+ shouldForwardProp: (t) => !["leftPanel", "rightPanel"].includes(t),
272
+ name: "PanelAwareMargins"
273
+ })(({ theme: t, leftPanel: e, rightPanel: n }) => {
274
+ var o, c;
275
+ return r(r({
276
+ transition: t.transitions.create("margin", {
277
+ easing: t.transitions.easing.sharp,
278
+ duration: t.transitions.duration.leavingScreen
279
+ })
280
+ }, (e == null ? void 0 : e.open) && {
281
+ transition: t.transitions.create("margin", {
282
+ easing: t.transitions.easing.easeOut,
283
+ duration: t.transitions.duration.enteringScreen
284
+ }),
285
+ marginLeft: `${(o = e == null ? void 0 : e.width) != null ? o : 0}px`
286
+ }), (n == null ? void 0 : n.open) && {
287
+ transition: t.transitions.create("margin", {
288
+ easing: t.transitions.easing.easeOut,
289
+ duration: t.transitions.duration.enteringScreen
290
+ }),
291
+ marginRight: `${(c = n == null ? void 0 : n.width) != null ? c : 0}px`
292
+ });
293
+ }), te = k(Mt, {
294
+ name: "PageContainer"
295
+ })(({ theme: t }) => ({
296
+ // Horizontal padding comes from the Container's gutter
297
+ paddingTop: t.spacing(3),
298
+ paddingBottom: t.spacing(3)
299
+ })), Y = !1, Z = !1, z = {
300
+ titleText: "",
301
+ flavour: "push",
302
+ width: Ft,
303
+ arrowButtons: "both",
304
+ startOpen: !1,
305
+ open: void 0,
306
+ onChangeOpen: void 0,
307
+ content: /* @__PURE__ */ i(q, {}),
308
+ onOpened: void 0,
309
+ onClosed: void 0,
310
+ dataTestId: void 0
311
+ };
312
+ function Ae({
313
+ children: t,
314
+ titleText: e = "",
315
+ leftPanel: n,
316
+ rightPanel: o,
317
+ sidePanelsAreMutuallyExclusive: c = !0,
318
+ debugOpacity: m = !1,
319
+ pageContainerProps: h,
320
+ pageContentDataTestId: d,
321
+ topBarDataTestId: F,
322
+ navBarOpen: f,
323
+ navBarWidthOpen: p,
324
+ navBarWidthClosed: O
325
+ }) {
326
+ const [T, x] = b(Y), [y, S] = b(Z), [N, D] = b(Y), [G, g] = b(Z), B = n !== void 0, I = o !== void 0, {
327
+ titleText: L,
328
+ content: s,
329
+ flavour: a,
330
+ open: P,
331
+ onChangeOpen: et,
332
+ width: U,
333
+ arrowButtons: $,
334
+ startOpen: R,
335
+ onOpened: Tt,
336
+ onClosed: yt,
337
+ dataTestId: St
338
+ } = n ? r(r({}, z), n) : r({}, z), {
339
+ titleText: Bt,
340
+ content: bt,
341
+ flavour: nt,
342
+ open: W,
343
+ onChangeOpen: rt,
344
+ width: X,
345
+ arrowButtons: _,
346
+ startOpen: H,
347
+ onOpened: It,
348
+ onClosed: Pt,
349
+ dataTestId: At
350
+ } = o ? r(r({}, z), o) : r({}, z);
351
+ dt(() => {
352
+ R !== Y && (x(R), D(R));
353
+ }, [R]), dt(() => {
354
+ H !== Z && (S(H), g(H));
355
+ }, [H]);
356
+ const j = P === void 0 ? T : P, Q = W === void 0 ? y : W, ot = (w) => {
357
+ P === void 0 && (x(w), c && I && (w ? (S(!1), g(y)) : S(G))), et && et(w);
358
+ }, it = (w) => {
359
+ W === void 0 && (S(w), c && B && (w ? (x(!1), D(T)) : x(N))), rt && rt(w);
360
+ };
361
+ return /* @__PURE__ */ l(xt, { children: [
362
+ B && /* @__PURE__ */ i(
363
+ ft,
364
+ {
365
+ "data-testid": St,
366
+ anchor: "left",
367
+ open: j,
368
+ onClose: () => ot(!1),
369
+ width: U,
370
+ titleText: L,
371
+ debugOpacity: m,
372
+ showCloseArrow: $ === "both" || $ === "close",
373
+ onOpened: Tt,
374
+ onClosed: yt,
375
+ navBarOpen: f,
376
+ navBarWidthOpen: p,
377
+ navBarWidthClosed: O,
378
+ children: s
379
+ }
380
+ ),
381
+ I && /* @__PURE__ */ i(
382
+ ft,
383
+ {
384
+ "data-testid": At,
385
+ anchor: "right",
386
+ open: Q,
387
+ onClose: () => it(!1),
388
+ width: X,
389
+ titleText: Bt,
390
+ debugOpacity: m,
391
+ showCloseArrow: _ === "both" || _ === "close",
392
+ onOpened: It,
393
+ onClosed: Pt,
394
+ navBarOpen: f,
395
+ navBarWidthOpen: p,
396
+ navBarWidthClosed: O,
397
+ children: bt
398
+ }
399
+ ),
400
+ /* @__PURE__ */ i(
401
+ Kt,
402
+ r(r({
403
+ titleText: e,
404
+ "data-testid": F
405
+ }, B && a === "push" ? {
406
+ leftPanel: {
407
+ open: j,
408
+ width: U,
409
+ onOpen: () => ot(!0),
410
+ showOpenArrow: $ === "both" || $ === "open"
411
+ }
412
+ } : {}), I && nt === "push" ? {
413
+ rightPanel: {
414
+ open: Q,
415
+ width: X,
416
+ onOpen: () => it(!0),
417
+ showOpenArrow: _ === "both" || _ === "open"
418
+ }
419
+ } : {})
420
+ ),
421
+ /* @__PURE__ */ i(
422
+ Zt,
423
+ v(r(r({}, a === "push" ? {
424
+ leftPanel: {
425
+ open: j,
426
+ width: U
427
+ }
428
+ } : {}), nt === "push" ? {
429
+ rightPanel: {
430
+ open: Q,
431
+ width: X
432
+ }
433
+ } : {}), {
434
+ children: /* @__PURE__ */ i(te, v(r({ "data-testid": d }, h), { children: t }))
435
+ })
436
+ )
437
+ ] });
438
+ }
439
+ const ee = Ct({
59
440
  palette: {
60
441
  primary: {
61
442
  main: "#007236",
@@ -107,22 +488,22 @@ const se = q({
107
488
  MuiMenuItem: {
108
489
  // Setting defaultProps for color on MenuItem does not work, so update manually
109
490
  styleOverrides: {
110
- root: ({ theme: e }) => ({
491
+ root: ({ theme: t }) => ({
111
492
  "&.Mui-selected": {
112
- backgroundColor: x(
113
- e.palette.secondary.main,
114
- e.palette.action.selectedOpacity
493
+ backgroundColor: J(
494
+ t.palette.secondary.main,
495
+ t.palette.action.selectedOpacity
115
496
  ),
116
497
  "&:hover": {
117
- backgroundColor: x(
118
- e.palette.secondary.main,
119
- e.palette.action.selectedOpacity
498
+ backgroundColor: J(
499
+ t.palette.secondary.main,
500
+ t.palette.action.selectedOpacity
120
501
  )
121
502
  },
122
503
  "&.Mui-focusVisible": {
123
- backgroundColor: x(
124
- e.palette.secondary.main,
125
- e.palette.action.focusOpacity
504
+ backgroundColor: J(
505
+ t.palette.secondary.main,
506
+ t.palette.action.focusOpacity
126
507
  )
127
508
  }
128
509
  }
@@ -143,7 +524,7 @@ const se = q({
143
524
  fontWeight: 700
144
525
  }
145
526
  }
146
- }), ce = q({
527
+ }), ne = Ct({
147
528
  palette: {
148
529
  primary: {
149
530
  dark: "#00A651",
@@ -192,116 +573,116 @@ const se = q({
192
573
  }
193
574
  }
194
575
  });
195
- function be({
196
- name: e = "internal",
197
- children: t
576
+ function Ee({
577
+ name: t = "internal",
578
+ children: e
198
579
  }) {
199
- return /* @__PURE__ */ s(te, { theme: e === "internal" ? se : e === "fed21" ? ce : void 0, children: t });
580
+ return /* @__PURE__ */ i(zt, { theme: t === "internal" ? ee : t === "fed21" ? ne : void 0, children: e });
200
581
  }
201
- class v extends ae {
582
+ class tt extends Xt {
202
583
  }
203
- b(v, "errorName", "ContextError");
204
- const d = () => {
205
- throw new v("SaladBarContext can only be used in a child of a <SaladBarProvider>");
206
- }, le = (e) => {
207
- throw new v("SaladBarContext can only be used in a child of a <SaladBarProvider>");
208
- }, ue = {
209
- enqueueNotification: d,
210
- enqueueSuccessNotification: d,
211
- enqueueInfoNotification: d,
212
- enqueueWarningNotification: d,
213
- enqueueErrorNotification: d,
214
- removeNotification: le
215
- }, H = J(ue), de = {
584
+ lt(tt, "errorName", "ContextError");
585
+ const A = () => {
586
+ throw new tt("SaladBarContext can only be used in a child of a <SaladBarProvider>");
587
+ }, re = (t) => {
588
+ throw new tt("SaladBarContext can only be used in a child of a <SaladBarProvider>");
589
+ }, oe = {
590
+ enqueueNotification: A,
591
+ enqueueSuccessNotification: A,
592
+ enqueueInfoNotification: A,
593
+ enqueueWarningNotification: A,
594
+ enqueueErrorNotification: A,
595
+ removeNotification: re
596
+ }, Ot = Dt(oe), ie = {
216
597
  autoHideDuration: 6e3,
217
598
  anchorOrigin: { vertical: "top", horizontal: "center" },
218
599
  // The default is false. If we prefer timer to continue when window loses
219
600
  // focus, change to true
220
601
  disableWindowBlurListener: !1
221
- }, pe = {
222
- shouldClose: (e, t) => t !== "clickaway"
223
- }, B = {
602
+ }, ae = {
603
+ shouldClose: (t, e) => e !== "clickaway"
604
+ }, gt = {
224
605
  message: "",
225
606
  severity: "info",
226
607
  variant: "standard",
227
608
  progressIndicator: void 0
228
609
  // Can use 'circular' or 'linear'
229
- }, w = 100, I = 2e3, fe = 2e3, me = (() => {
230
- let e = 0;
231
- return () => (e += 1, e);
232
- })(), he = {
610
+ }, ht = 100, mt = 2e3, se = 2e3, ce = (() => {
611
+ let t = 0;
612
+ return () => (t += 1, t);
613
+ })(), le = {
233
614
  borderBottomLeftRadius: "0px",
234
615
  borderBottomRightRadius: "0px"
235
616
  };
236
- function De(i) {
237
- var C = i, {
238
- children: e,
239
- shouldClose: t = pe.shouldClose
240
- } = C, r = P(C, [
617
+ function ke(o) {
618
+ var c = o, {
619
+ children: t,
620
+ shouldClose: e = ae.shouldClose
621
+ } = c, n = ct(c, [
241
622
  "children",
242
623
  "shouldClose"
243
624
  ]);
244
- var A;
245
- const [L, f] = M(!1), c = y([]), k = y(Date.now()), h = y(0), u = (n = {}) => {
246
- h.current += 1, c.current.length >= w && Date.now() - k.current >= I && (k.current = Date.now(), console.error(
247
- `SaladBarProvider: MAX_QUEUE_LENGTH (${w}) hit ${h.current} times in last ${I}ms)`
248
- ), h.current = 0);
249
- const o = a(g(a({}, B), {
250
- key: me()
251
- }), n);
252
- return c.current.push(o), c.current.length === 1 && f(!0), o.key;
253
- }, R = (n = "", o = {}) => u(a({ message: n, severity: "success" }, o)), _ = (n = "", o = {}) => u(a({ message: n, severity: "info" }, o)), O = (n = "", o = {}) => u(a({ message: n, severity: "warning" }, o)), z = (n = "", o = {}) => u(a({ message: n, severity: "error" }, o)), U = (n) => {
254
- const o = c.current.findIndex((Q) => Q.key === n);
255
- if (o !== -1)
256
- return o === 0 ? (f(!1), c.current[0]) : c.current.splice(o, 1);
257
- }, S = (n, o) => {
258
- t(n, o) && f(!1);
259
- }, W = () => {
625
+ var L;
626
+ const [m, h] = b(!1), d = K([]), F = K(Date.now()), f = K(0), p = (s = {}) => {
627
+ f.current += 1, d.current.length >= ht && Date.now() - F.current >= mt && (F.current = Date.now(), console.error(
628
+ `SaladBarProvider: MAX_QUEUE_LENGTH (${ht}) hit ${f.current} times in last ${mt}ms)`
629
+ ), f.current = 0);
630
+ const a = r(v(r({}, gt), {
631
+ key: ce()
632
+ }), s);
633
+ return d.current.push(a), d.current.length === 1 && h(!0), a.key;
634
+ }, O = (s = "", a = {}) => p(r({ message: s, severity: "success" }, a)), T = (s = "", a = {}) => p(r({ message: s, severity: "info" }, a)), x = (s = "", a = {}) => p(r({ message: s, severity: "warning" }, a)), y = (s = "", a = {}) => p(r({ message: s, severity: "error" }, a)), S = (s) => {
635
+ const a = d.current.findIndex((P) => P.key === s);
636
+ if (a !== -1)
637
+ return a === 0 ? (h(!1), d.current[0]) : d.current.splice(a, 1);
638
+ }, N = (s, a) => {
639
+ e(s, a) && h(!1);
640
+ }, D = () => {
260
641
  }, G = () => {
261
- c.current.shift(), c.current.length > 0 && f(!0);
262
- }, l = (A = c.current[0]) != null ? A : a({}, B), E = {};
263
- "autoHideDuration" in l && (E.autoHideDuration = l.autoHideDuration);
264
- const X = a(a({}, de), r);
642
+ d.current.shift(), d.current.length > 0 && h(!0);
643
+ }, g = (L = d.current[0]) != null ? L : r({}, gt), B = {};
644
+ "autoHideDuration" in g && (B.autoHideDuration = g.autoHideDuration);
645
+ const I = r(r({}, ie), n);
265
646
  return (
266
647
  // Should be resolved when we move to React >= 18
267
648
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
268
649
  // @ts-ignore
269
- /* @__PURE__ */ p(
270
- H.Provider,
650
+ /* @__PURE__ */ l(
651
+ Ot.Provider,
271
652
  {
272
653
  value: {
273
- enqueueNotification: u,
274
- enqueueSuccessNotification: R,
275
- enqueueInfoNotification: _,
276
- enqueueWarningNotification: O,
277
- enqueueErrorNotification: z,
278
- removeNotification: U
654
+ enqueueNotification: p,
655
+ enqueueSuccessNotification: O,
656
+ enqueueInfoNotification: T,
657
+ enqueueWarningNotification: x,
658
+ enqueueErrorNotification: y,
659
+ removeNotification: S
279
660
  },
280
661
  children: [
281
- e,
282
- /* @__PURE__ */ s(
283
- re,
284
- g(a(a({}, X), E), {
285
- open: L,
286
- onClose: S,
662
+ t,
663
+ /* @__PURE__ */ i(
664
+ qt,
665
+ v(r(r({}, I), B), {
666
+ open: m,
667
+ onClose: N,
287
668
  TransitionProps: {
288
669
  onExited: G,
289
- onExit: W
670
+ onExit: D
290
671
  },
291
- sx: { zIndex: fe },
292
- children: /* @__PURE__ */ p("div", { children: [
293
- /* @__PURE__ */ s(
294
- oe,
672
+ sx: { zIndex: se },
673
+ children: /* @__PURE__ */ l("div", { children: [
674
+ /* @__PURE__ */ i(
675
+ Gt,
295
676
  {
296
- onClose: (n) => S(n, "closeAlert"),
297
- severity: l.severity,
677
+ onClose: (s) => N(s, "closeAlert"),
678
+ severity: g.severity,
298
679
  variant: "filled",
299
- icon: l.progressIndicator === "circular" ? /* @__PURE__ */ s(ie, { size: "1em" }) : void 0,
300
- style: l.progressIndicator === "linear" ? he : void 0,
301
- children: l.message
680
+ icon: g.progressIndicator === "circular" ? /* @__PURE__ */ i(Wt, { size: "1em" }) : void 0,
681
+ style: g.progressIndicator === "linear" ? le : void 0,
682
+ children: g.message
302
683
  }
303
684
  ),
304
- l.progressIndicator === "linear" && /* @__PURE__ */ s(ne, { color: "primary" })
685
+ g.progressIndicator === "linear" && /* @__PURE__ */ i(Ut, { color: "primary" })
305
686
  ] })
306
687
  })
307
688
  )
@@ -310,14 +691,15 @@ function De(i) {
310
691
  )
311
692
  );
312
693
  }
313
- function Be() {
314
- return Y(H);
694
+ function Ne() {
695
+ return Lt(Ot);
315
696
  }
316
697
  export {
317
- be as AgThemeProvider,
318
- v as ContextError,
698
+ Ee as AgThemeProvider,
699
+ tt as ContextError,
319
700
  Pe as ExampleComponent,
320
- De as SaladBarProvider,
321
- Be as useSaladBar
701
+ Ae as PageLayout,
702
+ ke as SaladBarProvider,
703
+ Ne as useSaladBar
322
704
  };
323
705
  //# sourceMappingURL=index.js.map