@australiangreens/ag-internal-components 0.0.24 → 0.0.26

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