@canonical/maas-react-components 2.7.0 → 2.7.1

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,20 +1,30 @@
1
- import { C as Re, D as Ae, F as Me, G as Le, I as Fe, L as De, a as Be, M as Oe, N as Ue, b as je, e as Ve, f as Te, P as qe, S as Ge, c as Ke, T as Qe, d as $e, m as He, t as ze, u as Ze } from "../QueryInput-D7uXzKgr.mjs";
2
- import { jsx as a, jsxs as w, Fragment as te } from "react/jsx-runtime";
3
- import { Link as ne, Spinner as H, Label as le, Button as V, Icon as K, CheckboxInput as se, useClickOutside as oe, useOnEscapePressed as ae, SearchBox as z } from "@canonical/react-components";
1
+ import { C as te, S as ne } from "../QueryInput-D7uXzKgr.mjs";
2
+ import { D as Be, F as Oe, G as Ue, I as je, L as Ve, a as Te, M as qe, N as Ge, b as Ke, e as ze, f as Qe, P as $e, c as He, T as Ze, d as Xe, m as Ye, t as Je, u as We } from "../QueryInput-D7uXzKgr.mjs";
3
+ import { jsx as s, jsxs as N, Fragment as le } from "react/jsx-runtime";
4
+ import { Link as se, Spinner as $, Label as oe, Button as V, Icon as K, CheckboxInput as ae, useClickOutside as ie, useOnEscapePressed as re, SearchBox as H } from "@canonical/react-components";
5
+ import { lazy as ce, Suspense as de, useReducer as ue, useCallback as w, useId as q, useMemo as O, useState as U, useEffect as G, useRef as T } from "react";
4
6
  import L from "classnames";
5
- import { useReducer as ie, useCallback as S, useId as q, useMemo as O, useState as U, useEffect as G, useRef as T } from "react";
6
- import { useDropzone as re } from "react-dropzone";
7
- const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href: l, rel: "noreferrer noopener", target: "_blank", children: t }), ce = ({
7
+ import { useDropzone as pe } from "react-dropzone";
8
+ const Ee = ({ children: t, to: l, ...e }) => /* @__PURE__ */ s(se, { ...e, href: l, rel: "noreferrer noopener", target: "_blank", children: t }), he = ({
8
9
  percentComplete: t
9
- }) => /* @__PURE__ */ w("small", { className: "progress-indicator", children: [
10
+ }) => /* @__PURE__ */ N("small", { className: "progress-indicator", children: [
10
11
  t,
11
12
  "% ",
12
- /* @__PURE__ */ a(H, { className: "progress-indicator__spinner" })
13
- ] }), Z = ({
13
+ /* @__PURE__ */ s($, { className: "progress-indicator__spinner" })
14
+ ] }), xe = (t, l) => {
15
+ const e = ce(t);
16
+ return (r) => /* @__PURE__ */ s(
17
+ de,
18
+ {
19
+ fallback: /* @__PURE__ */ s(te, { children: /* @__PURE__ */ s(ne.Skeleton, { hasTitle: l }) }),
20
+ children: /* @__PURE__ */ s(e, { ...r })
21
+ }
22
+ );
23
+ }, Z = ({
14
24
  children: t,
15
25
  className: l,
16
26
  isVisible: e
17
- }) => /* @__PURE__ */ a(
27
+ }) => /* @__PURE__ */ s(
18
28
  "div",
19
29
  {
20
30
  className: L("fade-in--down", l),
@@ -22,12 +32,12 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
22
32
  style: { visibility: e ? "visible" : "hidden" },
23
33
  children: t
24
34
  }
25
- ), we = ({
35
+ ), Pe = ({
26
36
  children: t,
27
37
  ...l
28
- }) => /* @__PURE__ */ a(Z, { isVisible: !l["aria-hidden"], children: /* @__PURE__ */ a("div", { className: "p-form__nested-group", ...l, children: t }) }), Se = ({ activeStep: t, items: l }) => /* @__PURE__ */ a("ol", { className: "stepper", children: l.map((e, n) => {
38
+ }) => /* @__PURE__ */ s(Z, { isVisible: !l["aria-hidden"], children: /* @__PURE__ */ s("div", { className: "p-form__nested-group", ...l, children: t }) }), ke = ({ activeStep: t, items: l }) => /* @__PURE__ */ s("ol", { className: "stepper", children: l.map((e, n) => {
29
39
  const r = n === t, p = n < t;
30
- return /* @__PURE__ */ a("li", { "aria-label": e, className: "stepper__item", children: /* @__PURE__ */ a(
40
+ return /* @__PURE__ */ s("li", { "aria-label": e, className: "stepper__item", children: /* @__PURE__ */ s(
31
41
  "p",
32
42
  {
33
43
  "aria-label": p ? `${e} (completed)` : e,
@@ -38,7 +48,7 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
38
48
  children: e
39
49
  }
40
50
  ) }, n);
41
- }) }), de = () => {
51
+ }) }), me = () => {
42
52
  const t = (u, g) => {
43
53
  switch (g.type) {
44
54
  case "add-files":
@@ -67,13 +77,13 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
67
77
  )
68
78
  };
69
79
  }
70
- }, [{ acceptedFiles: l, fileRejections: e }, n] = ie(
80
+ }, [{ acceptedFiles: l, fileRejections: e }, n] = ue(
71
81
  t,
72
82
  {
73
83
  acceptedFiles: [],
74
84
  fileRejections: []
75
85
  }
76
- ), r = S(
86
+ ), r = w(
77
87
  (u, g) => n({
78
88
  type: "add-files",
79
89
  payload: { acceptedFiles: u, fileRejections: g }
@@ -81,7 +91,7 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
81
91
  [n]
82
92
  );
83
93
  return { acceptedFiles: l, fileRejections: e, onFileUpload: r, removeFile: (u) => n({ type: "remove-accepted", payload: u }), removeRejectedFile: (u) => n({ type: "remove-rejected", payload: u }) };
84
- }, Ie = ({
94
+ }, Re = ({
85
95
  accept: t,
86
96
  error: l,
87
97
  files: e,
@@ -94,26 +104,26 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
94
104
  onRemoveFile: v,
95
105
  rejectedFiles: C
96
106
  }) => {
97
- const d = de(), b = e ?? d.acceptedFiles, f = C ?? d.fileRejections, E = g ?? d.onFileUpload, h = (c) => {
107
+ const d = me(), b = e ?? d.acceptedFiles, f = C ?? d.fileRejections, E = g ?? d.onFileUpload, h = (c) => {
98
108
  v ? v(c) : "file" in c && "errors" in c ? d.removeRejectedFile(c) : d.removeFile(c);
99
- }, { getRootProps: x, getInputProps: i } = re({
109
+ }, { getRootProps: x, getInputProps: i } = pe({
100
110
  accept: t,
101
111
  maxFiles: p,
102
112
  maxSize: m,
103
113
  minSize: u,
104
114
  onDrop: E
105
115
  }), y = q();
106
- return /* @__PURE__ */ w(
116
+ return /* @__PURE__ */ N(
107
117
  "div",
108
118
  {
109
119
  className: L("p-form__group p-form-validation", {
110
120
  "is-error": !!l
111
121
  }),
112
122
  children: [
113
- r && /* @__PURE__ */ a(le, { id: y, children: r }),
114
- n && /* @__PURE__ */ a("p", { className: "p-form-help-text", children: n }),
115
- /* @__PURE__ */ w("div", { className: "p-form__control", children: [
116
- !p || b.length + f.length < p ? /* @__PURE__ */ a("div", { className: "file-upload__wrapper", children: /* @__PURE__ */ w(
123
+ r && /* @__PURE__ */ s(oe, { id: y, children: r }),
124
+ n && /* @__PURE__ */ s("p", { className: "p-form-help-text", children: n }),
125
+ /* @__PURE__ */ N("div", { className: "p-form__control", children: [
126
+ !p || b.length + f.length < p ? /* @__PURE__ */ s("div", { className: "file-upload__wrapper", children: /* @__PURE__ */ N(
117
127
  "div",
118
128
  {
119
129
  ...x(),
@@ -121,61 +131,61 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
121
131
  className: "file-upload",
122
132
  "data-testid": "file-upload",
123
133
  children: [
124
- /* @__PURE__ */ a("input", { ...i() }),
125
- /* @__PURE__ */ a("button", { className: "file-upload__button", type: "button", children: "Drag and drop files here or click to upload" })
134
+ /* @__PURE__ */ s("input", { ...i() }),
135
+ /* @__PURE__ */ s("button", { className: "file-upload__button", type: "button", children: "Drag and drop files here or click to upload" })
126
136
  ]
127
137
  }
128
138
  ) }) : null,
129
- /* @__PURE__ */ w("div", { className: "file-upload__files-list", children: [
130
- f && f.map((c) => /* @__PURE__ */ a("span", { className: "is-error", children: /* @__PURE__ */ w("div", { className: "file-upload__file is-rejected", children: [
139
+ /* @__PURE__ */ N("div", { className: "file-upload__files-list", children: [
140
+ f && f.map((c) => /* @__PURE__ */ s("span", { className: "is-error", children: /* @__PURE__ */ N("div", { className: "file-upload__file is-rejected", children: [
131
141
  c.file.name,
132
- /* @__PURE__ */ a(
142
+ /* @__PURE__ */ s(
133
143
  V,
134
144
  {
135
145
  appearance: "base",
136
146
  className: "file-upload__file-remove-button",
137
147
  onClick: () => h(c),
138
148
  type: "button",
139
- children: /* @__PURE__ */ a(K, { name: "close", children: "Remove file" })
149
+ children: /* @__PURE__ */ s(K, { name: "close", children: "Remove file" })
140
150
  }
141
151
  )
142
152
  ] }) }, c.file.name)),
143
- b && b.map((c) => /* @__PURE__ */ w("div", { className: "file-upload__file", children: [
153
+ b && b.map((c) => /* @__PURE__ */ N("div", { className: "file-upload__file", children: [
144
154
  c.name,
145
- c.percentUploaded !== void 0 ? /* @__PURE__ */ a(ce, { percentComplete: c.percentUploaded }) : /* @__PURE__ */ a(
155
+ c.percentUploaded !== void 0 ? /* @__PURE__ */ s(he, { percentComplete: c.percentUploaded }) : /* @__PURE__ */ s(
146
156
  V,
147
157
  {
148
158
  appearance: "base",
149
159
  className: "file-upload__file-remove-button",
150
160
  onClick: () => h(c),
151
161
  type: "button",
152
- children: /* @__PURE__ */ a(K, { name: "close", children: "Remove file" })
162
+ children: /* @__PURE__ */ s(K, { name: "close", children: "Remove file" })
153
163
  }
154
164
  )
155
165
  ] }, c.name))
156
166
  ] }),
157
- l ? /* @__PURE__ */ w("p", { className: "p-form-validation__message", children: [
158
- /* @__PURE__ */ a("strong", { children: "Error: " }),
167
+ l ? /* @__PURE__ */ N("p", { className: "p-form-validation__message", children: [
168
+ /* @__PURE__ */ s("strong", { children: "Error: " }),
159
169
  l
160
170
  ] }) : null
161
171
  ] })
162
172
  ]
163
173
  }
164
174
  );
165
- }, X = (t, l) => t.label.localeCompare(l.label, "en", { numeric: !0 }), ue = (t) => (l, e) => {
175
+ }, X = (t, l) => t.label.localeCompare(l.label, "en", { numeric: !0 }), fe = (t) => (l, e) => {
166
176
  if (t) {
167
177
  const n = t.has(l.value), r = t.has(e.value);
168
178
  if (n && !r) return -1;
169
179
  if (!n && r) return 1;
170
180
  }
171
181
  return 0;
172
- }, pe = (t) => {
182
+ }, ge = (t) => {
173
183
  const l = /* @__PURE__ */ new Map();
174
184
  return t.forEach((e) => {
175
185
  const n = e.group || "Ungrouped", r = l.get(n) || [];
176
186
  r.push(e), l.set(n, r);
177
187
  }), Array.from(l, ([e, n]) => ({ group: e, items: n }));
178
- }, he = ({
188
+ }, ve = ({
179
189
  items: t,
180
190
  selectedItems: l,
181
191
  disabledItems: e,
@@ -184,7 +194,7 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
184
194
  isOpen: p,
185
195
  footer: m,
186
196
  sortFn: u = X,
187
- groupFn: g = pe,
197
+ groupFn: g = ge,
188
198
  ...v
189
199
  }) => {
190
200
  const C = O(
@@ -207,12 +217,12 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
207
217
  r(I);
208
218
  }
209
219
  };
210
- return /* @__PURE__ */ a(Z, { isVisible: p, className: "put-above", children: /* @__PURE__ */ w("div", { className: "multi-select__dropdown", role: "listbox", ...v, children: [
220
+ return /* @__PURE__ */ s(Z, { isVisible: p, className: "put-above", children: /* @__PURE__ */ N("div", { className: "multi-select__dropdown", role: "listbox", ...v, children: [
211
221
  n || null,
212
- h.map(({ group: i, items: y }) => /* @__PURE__ */ w("div", { className: "multi-select__group", children: [
213
- E ? /* @__PURE__ */ a("h5", { className: "multi-select__dropdown-header", children: i }) : null,
214
- /* @__PURE__ */ a("ul", { className: "multi-select__dropdown-list", "aria-label": i, children: y.sort(u).sort(ue(b)).map((c) => /* @__PURE__ */ a("li", { className: "multi-select__dropdown-item", children: /* @__PURE__ */ a(
215
- se,
222
+ h.map(({ group: i, items: y }) => /* @__PURE__ */ N("div", { className: "multi-select__group", children: [
223
+ E ? /* @__PURE__ */ s("h5", { className: "multi-select__dropdown-header", children: i }) : null,
224
+ /* @__PURE__ */ s("ul", { className: "multi-select__dropdown-list", "aria-label": i, children: y.sort(u).sort(fe(b)).map((c) => /* @__PURE__ */ s("li", { className: "multi-select__dropdown-item", children: /* @__PURE__ */ s(
225
+ ae,
216
226
  {
217
227
  disabled: d.has(c.value),
218
228
  label: c.label,
@@ -223,9 +233,9 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
223
233
  c.value
224
234
  ) }, c.value)) })
225
235
  ] }, i)),
226
- m ? /* @__PURE__ */ a("div", { className: "multi-select__footer", children: m }) : null
236
+ m ? /* @__PURE__ */ s("div", { className: "multi-select__footer", children: m }) : null
227
237
  ] }) });
228
- }, Ce = ({
238
+ }, Ae = ({
229
239
  disabled: t,
230
240
  selectedItems: l = [],
231
241
  label: e,
@@ -238,10 +248,10 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
238
248
  dropdownFooter: v,
239
249
  variant: C = "search"
240
250
  }) => {
241
- const d = oe(() => {
251
+ const d = ie(() => {
242
252
  f(!1), h("");
243
253
  });
244
- ae(() => {
254
+ re(() => {
245
255
  f(!1), h("");
246
256
  });
247
257
  const [b, f] = U(!1), [E, h] = U("");
@@ -254,9 +264,9 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
254
264
  }, P = q(), I = q(), F = y.filter(
255
265
  (_) => m.some((R) => R.value === _.value)
256
266
  ).sort(X).map((_) => _.label).join(", ");
257
- return /* @__PURE__ */ a("div", { ref: d, children: /* @__PURE__ */ w("div", { className: "multi-select", children: [
258
- C === "search" ? /* @__PURE__ */ a(
259
- z,
267
+ return /* @__PURE__ */ s("div", { ref: d, children: /* @__PURE__ */ N("div", { className: "multi-select", children: [
268
+ C === "search" ? /* @__PURE__ */ s(
269
+ H,
260
270
  {
261
271
  externallyControlled: !0,
262
272
  "aria-controls": P,
@@ -276,7 +286,7 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
276
286
  value: E,
277
287
  className: "multi-select__input"
278
288
  }
279
- ) : /* @__PURE__ */ a(
289
+ ) : /* @__PURE__ */ s(
280
290
  "button",
281
291
  {
282
292
  role: "combobox",
@@ -288,11 +298,11 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
288
298
  onClick: () => {
289
299
  f((_) => !_);
290
300
  },
291
- children: /* @__PURE__ */ a("span", { className: "multi-select__condensed-text", children: y.length > 0 ? F : r ?? "Select items" })
301
+ children: /* @__PURE__ */ s("span", { className: "multi-select__condensed-text", children: y.length > 0 ? F : r ?? "Select items" })
292
302
  }
293
303
  ),
294
- /* @__PURE__ */ a(
295
- he,
304
+ /* @__PURE__ */ s(
305
+ ve,
296
306
  {
297
307
  id: P,
298
308
  isOpen: b,
@@ -303,8 +313,8 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
303
313
  disabledItems: u,
304
314
  header: g,
305
315
  updateItems: c,
306
- footer: v || /* @__PURE__ */ w(te, { children: [
307
- /* @__PURE__ */ a(
316
+ footer: v || /* @__PURE__ */ N(le, { children: [
317
+ /* @__PURE__ */ s(
308
318
  V,
309
319
  {
310
320
  appearance: "link",
@@ -320,7 +330,7 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
320
330
  children: "Select all"
321
331
  }
322
332
  ),
323
- /* @__PURE__ */ a(
333
+ /* @__PURE__ */ s(
324
334
  V,
325
335
  {
326
336
  appearance: "link",
@@ -340,7 +350,7 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
340
350
  }
341
351
  )
342
352
  ] }) });
343
- }, Q = {
353
+ }, z = {
344
354
  DEFAULT: 4,
345
355
  EXPANDED: 15
346
356
  }, k = {
@@ -350,9 +360,9 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
350
360
  COLON: ":",
351
361
  COMMA: ","
352
362
  }, j = (t, l = t.length) => {
353
- const e = me(t, l), { token: n, tokenStart: r, tokenEnd: p } = fe(t, l);
363
+ const e = be(t, l), { token: n, tokenStart: r, tokenEnd: p } = _e(t, l);
354
364
  return { context: e, token: n, tokenStart: r, tokenEnd: p };
355
- }, me = (t, l) => {
365
+ }, be = (t, l) => {
356
366
  let e = 0;
357
367
  for (let n = l - 1; n >= 0; n--) {
358
368
  const r = t[n];
@@ -367,17 +377,17 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
367
377
  }
368
378
  }
369
379
  return "";
370
- }, fe = (t, l) => {
380
+ }, _e = (t, l) => {
371
381
  let e = l, n = l;
372
382
  for (; n < t.length && /[^\s=(),]/.test(t[n]); )
373
383
  n++;
374
384
  for (; e > 0 && /[^\s=(),]/.test(t[e - 1]); )
375
385
  e--;
376
386
  return { token: t.slice(e, n), tokenStart: e, tokenEnd: n };
377
- }, $ = (t, l) => {
387
+ }, Q = (t, l) => {
378
388
  const e = t.charAt(l - 1);
379
389
  return l > 0 && (e === k.CLOSE_PAREN || e === k.COMMA);
380
- }, Ee = ({
390
+ }, Me = ({
381
391
  className: t,
382
392
  disabled: l = !1,
383
393
  search: e,
@@ -396,48 +406,48 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
396
406
  showingMore: !1,
397
407
  cursorPosition: 0
398
408
  }), f = T(null), E = T(null), h = T(null), x = O(() => {
399
- const s = d.showingMore ? Q.EXPANDED : Q.DEFAULT, o = u.slice(0, s);
400
- return !d.showingMore && u.length > s ? [...o, { value: "Show more...", type: "more" }] : o;
401
- }, [u, d.showingMore]), i = S(
402
- (s) => {
403
- b(typeof s == "function" ? (o) => ({ ...o, ...s(o) }) : (o) => ({ ...o, ...s }));
409
+ const o = d.showingMore ? z.EXPANDED : z.DEFAULT, a = u.slice(0, o);
410
+ return !d.showingMore && u.length > o ? [...a, { value: "Show more...", type: "more" }] : a;
411
+ }, [u, d.showingMore]), i = w(
412
+ (o) => {
413
+ b(typeof o == "function" ? (a) => ({ ...a, ...o(a) }) : (a) => ({ ...a, ...o }));
404
414
  },
405
415
  []
406
- ), y = S(
407
- (s) => {
408
- f.current && !f.current.contains(s.target) && i({
416
+ ), y = w(
417
+ (o) => {
418
+ f.current && !f.current.contains(o.target) && i({
409
419
  isVisible: !1,
410
420
  highlightedIndex: -1
411
421
  });
412
422
  },
413
423
  [i]
414
- ), c = S(
415
- (s, o) => {
416
- const { tokenStart: N, tokenEnd: A } = o;
417
- if (s.type === "filter") {
418
- const B = s.value + k.COLON + k.OPEN_PAREN;
419
- return e.slice(0, N) + B + e.slice(A);
424
+ ), c = w(
425
+ (o, a) => {
426
+ const { tokenStart: S, tokenEnd: A } = a;
427
+ if (o.type === "filter") {
428
+ const B = o.value + k.COLON + k.OPEN_PAREN;
429
+ return e.slice(0, S) + B + e.slice(A);
420
430
  }
421
431
  if (r.length === 0) {
422
- const B = s.type + k.COLON + k.OPEN_PAREN + k.EQUALS + s.value;
423
- return e.slice(0, N) + B + e.slice(A);
432
+ const B = o.type + k.COLON + k.OPEN_PAREN + k.EQUALS + o.value;
433
+ return e.slice(0, S) + B + e.slice(A);
424
434
  }
425
- const M = e.charAt(N - 1) === k.EQUALS ? s.value : k.EQUALS + s.value;
426
- return e.slice(0, N) + M + e.slice(A);
435
+ const M = e.charAt(S - 1) === k.EQUALS ? o.value : k.EQUALS + o.value;
436
+ return e.slice(0, S) + M + e.slice(A);
427
437
  },
428
438
  [e, r]
429
- ), P = S(
430
- (s) => {
431
- const o = x[s];
432
- if (!o) return;
433
- if (o.type === "more") {
439
+ ), P = w(
440
+ (o) => {
441
+ const a = x[o];
442
+ if (!a) return;
443
+ if (a.type === "more") {
434
444
  i({ showingMore: !0 });
435
445
  return;
436
446
  }
437
- const N = j(
447
+ const S = j(
438
448
  e,
439
449
  d.cursorPosition
440
- ), A = c(o, N), M = N.tokenStart + (o.type === "filter" ? o.value.length + 2 : r.length === 0 ? o.type.length + o.value.length + 3 : o.value.length + 1), { context: B, token: ee } = j(
450
+ ), A = c(a, S), M = S.tokenStart + (a.type === "filter" ? a.value.length + 2 : r.length === 0 ? a.type.length + a.value.length + 3 : a.value.length + 1), { context: B, token: ee } = j(
441
451
  A,
442
452
  M
443
453
  );
@@ -449,7 +459,7 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
449
459
  }, 0), i({
450
460
  highlightedIndex: 0,
451
461
  showingMore: !1,
452
- isVisible: o.type === "filter",
462
+ isVisible: a.type === "filter",
453
463
  cursorPosition: M
454
464
  });
455
465
  },
@@ -464,46 +474,46 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
464
474
  n,
465
475
  i
466
476
  ]
467
- ), I = S(() => {
477
+ ), I = w(() => {
468
478
  if (!h.current) return;
469
- const s = h.current.selectionStart || 0, { context: o, token: N } = j(
479
+ const o = h.current.selectionStart || 0, { context: a, token: S } = j(
470
480
  e,
471
- s
481
+ o
472
482
  );
473
- p(o), m(N), i((A) => ({
483
+ p(a), m(S), i((A) => ({
474
484
  ...A,
475
- isVisible: !$(e, s),
476
- cursorPosition: s
485
+ isVisible: !Q(e, o),
486
+ cursorPosition: o
477
487
  }));
478
- }, [e, p, m, i]), F = S(
479
- (s) => {
480
- const { key: o } = s;
488
+ }, [e, p, m, i]), F = w(
489
+ (o) => {
490
+ const { key: a } = o;
481
491
  if (d.isVisible) {
482
- const N = x.length;
483
- switch (o) {
492
+ const S = x.length;
493
+ switch (a) {
484
494
  case "Tab":
485
495
  case "ArrowDown":
486
- s.preventDefault(), i({
487
- highlightedIndex: (d.highlightedIndex + 1) % N
496
+ o.preventDefault(), i({
497
+ highlightedIndex: (d.highlightedIndex + 1) % S
488
498
  });
489
499
  return;
490
500
  case "ArrowUp":
491
- s.preventDefault(), i({
492
- highlightedIndex: d.highlightedIndex <= 0 ? N - 1 : d.highlightedIndex - 1
501
+ o.preventDefault(), i({
502
+ highlightedIndex: d.highlightedIndex <= 0 ? S - 1 : d.highlightedIndex - 1
493
503
  });
494
504
  return;
495
505
  case "Enter":
496
- s.preventDefault(), d.highlightedIndex >= 0 ? P(d.highlightedIndex) : i({ isVisible: !1 });
506
+ o.preventDefault(), d.highlightedIndex >= 0 ? P(d.highlightedIndex) : i({ isVisible: !1 });
497
507
  return;
498
508
  case "Escape":
499
- s.preventDefault(), i({
509
+ o.preventDefault(), i({
500
510
  isVisible: !1,
501
511
  highlightedIndex: -1
502
512
  });
503
513
  return;
504
514
  }
505
515
  }
506
- (o === "ArrowLeft" || o === "ArrowRight" || o === "Home" || o === "End") && setTimeout(I, 0);
516
+ (a === "ArrowLeft" || a === "ArrowRight" || a === "Home" || a === "End") && setTimeout(I, 0);
507
517
  },
508
518
  [
509
519
  d,
@@ -512,46 +522,46 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
512
522
  P,
513
523
  I
514
524
  ]
515
- ), _ = S(
516
- (s) => {
517
- const { key: o } = s;
518
- (o === "ArrowLeft" || o === "ArrowRight" || o === "Home" || o === "End") && I();
525
+ ), _ = w(
526
+ (o) => {
527
+ const { key: a } = o;
528
+ (a === "ArrowLeft" || a === "ArrowRight" || a === "Home" || a === "End") && I();
519
529
  },
520
530
  [I]
521
- ), R = S(() => {
531
+ ), R = w(() => {
522
532
  i({
523
533
  isVisible: !0,
524
534
  highlightedIndex: 0
525
535
  });
526
- }, [i]), D = S(
527
- (s) => {
536
+ }, [i]), D = w(
537
+ (o) => {
528
538
  var M;
529
- const o = ((M = h.current) == null ? void 0 : M.selectionStart) || s.length, { context: N, token: A } = j(
530
- s,
531
- o
539
+ const a = ((M = h.current) == null ? void 0 : M.selectionStart) || o.length, { context: S, token: A } = j(
540
+ o,
541
+ a
532
542
  );
533
- p(N), m(A), n(s), i({
543
+ p(S), m(A), n(o), i({
534
544
  highlightedIndex: 0,
535
- isVisible: !$(s, o),
545
+ isVisible: !Q(o, a),
536
546
  showingMore: !1,
537
- cursorPosition: o
547
+ cursorPosition: a
538
548
  });
539
549
  },
540
550
  [p, m, n, i]
541
- ), Y = S(() => {
551
+ ), Y = w(() => {
542
552
  setTimeout(I, 0);
543
- }, [I]), J = S(() => {
553
+ }, [I]), J = w(() => {
544
554
  i({
545
555
  isVisible: !1,
546
556
  highlightedIndex: -1
547
557
  });
548
- }, [i]), W = S(
549
- (s) => {
550
- i({ highlightedIndex: s });
558
+ }, [i]), W = w(
559
+ (o) => {
560
+ i({ highlightedIndex: o });
551
561
  },
552
562
  [i]
553
563
  );
554
- return G(() => (document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y)), [y]), /* @__PURE__ */ w(
564
+ return G(() => (document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y)), [y]), /* @__PURE__ */ N(
555
565
  "div",
556
566
  {
557
567
  className: L("p-query-input", t),
@@ -559,8 +569,8 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
559
569
  ref: f,
560
570
  ...C,
561
571
  children: [
562
- /* @__PURE__ */ a(
563
- z,
572
+ /* @__PURE__ */ s(
573
+ H,
564
574
  {
565
575
  disabled: l,
566
576
  placeholder: v,
@@ -582,7 +592,7 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
582
592
  "aria-owns": "query-suggestions"
583
593
  }
584
594
  ),
585
- d.isVisible && u.length > 0 && /* @__PURE__ */ a(
595
+ d.isVisible && u.length > 0 && /* @__PURE__ */ s(
586
596
  "ul",
587
597
  {
588
598
  className: "p-query-input__list",
@@ -590,42 +600,42 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
590
600
  id: "query-suggestions",
591
601
  role: "listbox",
592
602
  "aria-label": "Search suggestions",
593
- children: g ? /* @__PURE__ */ a("div", { className: "p-query-input__loading", children: /* @__PURE__ */ a(H, { text: "Loading..." }) }) : x.map((s, o) => /* @__PURE__ */ w(
603
+ children: g ? /* @__PURE__ */ s("div", { className: "p-query-input__loading", children: /* @__PURE__ */ s($, { text: "Loading..." }) }) : x.map((o, a) => /* @__PURE__ */ N(
594
604
  "li",
595
605
  {
596
606
  className: L("p-query-input__item", {
597
- highlight: o === d.highlightedIndex
607
+ highlight: a === d.highlightedIndex
598
608
  }),
599
- onClick: () => P(o),
600
- onKeyDown: () => P(o),
601
- onMouseEnter: () => W(o),
609
+ onClick: () => P(a),
610
+ onKeyDown: () => P(a),
611
+ onMouseEnter: () => W(a),
602
612
  role: "option",
603
- "aria-selected": o === d.highlightedIndex,
613
+ "aria-selected": a === d.highlightedIndex,
604
614
  tabIndex: -1,
605
615
  children: [
606
- /* @__PURE__ */ w("span", { className: "p-query-input__item-label", children: [
607
- /* @__PURE__ */ a(
616
+ /* @__PURE__ */ N("span", { className: "p-query-input__item-label", children: [
617
+ /* @__PURE__ */ s(
608
618
  "span",
609
619
  {
610
620
  className: L({
611
- "u-text--muted": s.type === "more"
621
+ "u-text--muted": o.type === "more"
612
622
  }),
613
- children: s.value
623
+ children: o.value
614
624
  }
615
625
  ),
616
- s.type === "filter" && /* @__PURE__ */ a("span", { className: "u-text--muted", children: ":()" })
626
+ o.type === "filter" && /* @__PURE__ */ s("span", { className: "u-text--muted", children: ":()" })
617
627
  ] }),
618
- s.type !== "more" && /* @__PURE__ */ a("span", { className: "u-text--muted u-align-text--right", children: s.type })
628
+ o.type !== "more" && /* @__PURE__ */ s("span", { className: "u-text--muted u-align-text--right", children: o.type })
619
629
  ]
620
630
  },
621
- `${s.value}-${o}`
631
+ `${o.value}-${a}`
622
632
  ))
623
633
  }
624
634
  )
625
635
  ]
626
636
  }
627
637
  );
628
- }, xe = ({ value: t, unit: l }, {
638
+ }, Le = ({ value: t, unit: l }, {
629
639
  binary: e = !1,
630
640
  convertTo: n,
631
641
  decimals: r = 2,
@@ -646,33 +656,34 @@ const Ne = ({ children: t, to: l, ...e }) => /* @__PURE__ */ a(ne, { ...e, href:
646
656
  };
647
657
  };
648
658
  export {
649
- Re as ContentSection,
650
- Ae as DynamicTable,
651
- Ne as ExternalLink,
652
- Ie as FileUpload,
653
- Me as FormSection,
654
- Le as GenericTable,
655
- Fe as InputGroup,
656
- De as Layout,
657
- Be as MainToolbar,
658
- Oe as Meter,
659
- Ce as MultiSelect,
660
- he as MultiSelectDropdown,
661
- Ue as Navigation,
662
- je as NavigationBar,
663
- we as NestedFormGroup,
664
- Ve as Pagination,
665
- Te as PaginationContainer,
666
- qe as Placeholder,
667
- ce as ProgressIndicator,
668
- Ee as QueryInput,
669
- Ge as SidePanel,
670
- Ke as SidePanelContextProvider,
671
- Se as Stepper,
672
- Qe as TableCaption,
673
- $e as defaultFilledColors,
674
- xe as formatBytes,
675
- He as meterColor,
676
- ze as testIds,
677
- Ze as useSidePanel
659
+ te as ContentSection,
660
+ Be as DynamicTable,
661
+ Ee as ExternalLink,
662
+ Re as FileUpload,
663
+ Oe as FormSection,
664
+ Ue as GenericTable,
665
+ je as InputGroup,
666
+ Ve as Layout,
667
+ Te as MainToolbar,
668
+ qe as Meter,
669
+ Ae as MultiSelect,
670
+ ve as MultiSelectDropdown,
671
+ Ge as Navigation,
672
+ Ke as NavigationBar,
673
+ Pe as NestedFormGroup,
674
+ ze as Pagination,
675
+ Qe as PaginationContainer,
676
+ $e as Placeholder,
677
+ he as ProgressIndicator,
678
+ Me as QueryInput,
679
+ ne as SidePanel,
680
+ He as SidePanelContextProvider,
681
+ ke as Stepper,
682
+ Ze as TableCaption,
683
+ Xe as defaultFilledColors,
684
+ Le as formatBytes,
685
+ xe as lazyLoadSidePanel,
686
+ Ye as meterColor,
687
+ Je as testIds,
688
+ We as useSidePanel
678
689
  };
@@ -1,2 +1,3 @@
1
1
  export { SidePanel } from './SidePanel';
2
2
  export { SidePanelContextProvider, useSidePanel } from './SidePanelContextProvider/SidePanelContextProvider';
3
+ export { lazyLoadSidePanel } from './utils';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@canonical/maas-react-components",
3
3
  "description": "React components for use in MAAS UI projects.",
4
- "version": "2.7.0",
4
+ "version": "2.7.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/canonical/maas-react-components.git"