highsoft-ui 1.0.19 → 1.0.20

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,15 +1,15 @@
1
- import { jsx as e, jsxs as s, Fragment as V } from "react/jsx-runtime";
2
- import { useState as M, useEffect as q } from "react";
3
- import { J as U } from "../../index-CMegByeX.js";
1
+ import { jsx as e, jsxs as s, Fragment as U } from "react/jsx-runtime";
2
+ import { useState as N, useEffect as V } from "react";
3
+ import { J as q } from "../../index-CMegByeX.js";
4
4
  import { _ as d } from "../../extends-hS2Bh-Yp.js";
5
5
  import { N as J, X as A } from "../../index-ChurKizy.js";
6
- import { c as p } from "../../clsx-OuTLNxxd.js";
6
+ import { c as f } from "../../clsx-OuTLNxxd.js";
7
7
  import { Button as h } from "../Button/index.js";
8
- import { Container as W } from "../Container/index.js";
9
- import { ThemedLogo as N } from "../Logo/index.js";
10
- import { PrefPanel as z } from "../PrefPanel/index.js";
11
- import { useMediaQuery as C } from "../../utils.js";
12
- var G = function(t) {
8
+ import { Container as j } from "../Container/index.js";
9
+ import { ThemedLogo as z } from "../Logo/index.js";
10
+ import { PrefPanel as L } from "../PrefPanel/index.js";
11
+ import { useMediaQuery as b, useLocation as G } from "../../utils.js";
12
+ var F = function(t) {
13
13
  return /* @__PURE__ */ e("svg", d({
14
14
  xmlns: "http://www.w3.org/2000/svg",
15
15
  width: 24,
@@ -25,7 +25,7 @@ var G = function(t) {
25
25
  d: "M18.5 16c1.933 0 3.5-2.9101 3.5-6.5C22 5.9102 20.433 3 18.5 3m0 13c-1.933 0-3.5-2.9101-3.5-6.5C15 5.9102 16.567 3 18.5 3m0 13L5.4435 13.6261c-.9275-.1686-1.3912-.253-1.7662-.4371a3 3 0 0 1-1.5632-1.8731C2 10.914 2 10.4427 2 9.5s0-1.414.1141-1.816a3 3 0 0 1 1.5632-1.873c.375-.1841.8388-.2685 1.7662-.4371L18.5 3M5 14l.3939 5.514c.0374.5236.056.7855.17.9839a1 1 0 0 0 .4324.4026c.206.0995.4685.0995.9935.0995h1.7824c.6001 0 .9002 0 1.1223-.1197a1 1 0 0 0 .4397-.4748c.1023-.2306.0793-.5298.0333-1.1282L10 14.5"
26
26
  })
27
27
  }));
28
- }, F = function(t) {
28
+ }, Q = function(t) {
29
29
  return /* @__PURE__ */ e("svg", d({
30
30
  xmlns: "http://www.w3.org/2000/svg",
31
31
  width: 24,
@@ -41,7 +41,7 @@ var G = function(t) {
41
41
  d: "M6 11v4m12-6v4m-1-9c2.4487 0 3.7731.3748 4.4321.6654.0878.0388.1317.0581.2583.179.0759.0724.2145.285.2501.3837.0595.1646.0595.2546.0595.4346v10.7484c0 .9088 0 1.3632-.1363 1.5968-.1386.2375-.2723.348-.5318.4393-.255.0897-.7699-.0092-1.7997-.2071A13.45 13.45 0 0 0 17 18c-3 0-6 2-10 2-2.4487 0-3.7731-.3748-4.4321-.6654-.0878-.0388-.1317-.0581-.2583-.179-.076-.0724-.2145-.285-.2501-.3837C2 18.6073 2 18.5173 2 18.3373V7.5889c0-.9088 0-1.3632.1363-1.5968.1386-.2375.2723-.348.5318-.4393.255-.0898.77.0092 1.7997.207A13.44 13.44 0 0 0 7 6c3 0 6-2 10-2m-2.5 8c0 1.3807-1.1193 2.5-2.5 2.5S9.5 13.3807 9.5 12s1.1193-2.5 2.5-2.5 2.5 1.1193 2.5 2.5"
42
42
  })
43
43
  }));
44
- }, Q = function(t) {
44
+ }, R = function(t) {
45
45
  return /* @__PURE__ */ e("svg", d({
46
46
  xmlns: "http://www.w3.org/2000/svg",
47
47
  width: 24,
@@ -137,7 +137,7 @@ var G = function(t) {
137
137
  d: "m21 21-4.35-4.35M19 11c0 4.4183-3.5817 8-8 8s-8-3.5817-8-8 3.5817-8 8-8 8 3.5817 8 8"
138
138
  })
139
139
  }));
140
- }, L = function(t) {
140
+ }, T = function(t) {
141
141
  return /* @__PURE__ */ e("svg", d({
142
142
  xmlns: "http://www.w3.org/2000/svg",
143
143
  width: 24,
@@ -153,7 +153,7 @@ var G = function(t) {
153
153
  d: "M4.5 22v-5m0-10V2M2 4.5h5m-5 15h5M13 3l-1.7342 4.5089c-.282.7332-.423 1.0998-.6423 1.4082a3 3 0 0 1-.7064.7064c-.3084.2193-.675.3603-1.4082.6423L4 12l4.5089 1.7342c.7332.282 1.0998.423 1.4082.6423.2733.1943.5121.4331.7064.7064.2193.3084.3603.675.6423 1.4082L13 21l1.7342-4.5089c.282-.7332.423-1.0998.6423-1.4082a3 3 0 0 1 .7064-.7064c.3084-.2193.675-.3603 1.4082-.6423L22 12l-4.5089-1.7342c-.7332-.282-1.0998-.423-1.4082-.6423a3 3 0 0 1-.7064-.7064c-.2193-.3084-.3603-.675-.6423-1.4082z"
154
154
  })
155
155
  }));
156
- }, T = function(t) {
156
+ }, B = function(t) {
157
157
  return /* @__PURE__ */ e("svg", d({
158
158
  xmlns: "http://www.w3.org/2000/svg",
159
159
  width: 24,
@@ -169,7 +169,7 @@ var G = function(t) {
169
169
  d: "m7 15 3-3-3-3m6 6h4m-9.2 6h8.4c1.6802 0 2.5202 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 18.7202 21 17.8802 21 16.2V7.8c0-1.6802 0-2.5202-.327-3.162a3 3 0 0 0-1.311-1.311C18.7202 3 17.8802 3 16.2 3H7.8c-1.6802 0-2.5202 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.2798 3 6.1198 3 7.8v8.4c0 1.6802 0 2.5202.327 3.162a3 3 0 0 0 1.311 1.311C5.2798 21 6.1198 21 7.8 21"
170
170
  })
171
171
  }));
172
- }, B = function(t) {
172
+ }, H = function(t) {
173
173
  return /* @__PURE__ */ e("svg", d({
174
174
  xmlns: "http://www.w3.org/2000/svg",
175
175
  width: 24,
@@ -186,32 +186,32 @@ var G = function(t) {
186
186
  })
187
187
  }));
188
188
  };
189
- const R = "_header_1vxsz_270", I = "_outer_1vxsz_281", K = "_main_1vxsz_290", Y = "_container_1vxsz_294", Z = "_links_1vxsz_300", e1 = "_buttons_1vxsz_301", t1 = "_menu_1vxsz_309", r1 = "_logo_1vxsz_314", n1 = "_subContainer_1vxsz_326", s1 = "_selected_1vxsz_354", o1 = "_subTag_1vxsz_366", i1 = "_mobileOverlay_1vxsz_384", a1 = "_show_1vxsz_1", c1 = "_open_1vxsz_396", h1 = "_mobile_1vxsz_384", l1 = "_slideUp_1vxsz_1", d1 = "_sub_1vxsz_326", u1 = "_gpt_1vxsz_462", r = {
190
- header: R,
191
- outer: I,
192
- main: K,
193
- container: Y,
194
- links: Z,
195
- buttons: e1,
196
- menu: t1,
197
- logo: r1,
198
- subContainer: n1,
199
- selected: s1,
200
- subTag: o1,
189
+ const I = "_header_1vxsz_270", K = "_outer_1vxsz_281", Y = "_main_1vxsz_290", Z = "_container_1vxsz_294", e1 = "_links_1vxsz_300", t1 = "_buttons_1vxsz_301", r1 = "_menu_1vxsz_309", n1 = "_logo_1vxsz_314", s1 = "_subContainer_1vxsz_326", o1 = "_selected_1vxsz_354", i1 = "_subTag_1vxsz_366", a1 = "_mobileOverlay_1vxsz_384", c1 = "_show_1vxsz_1", h1 = "_open_1vxsz_396", l1 = "_mobile_1vxsz_384", d1 = "_slideUp_1vxsz_1", u1 = "_sub_1vxsz_326", m1 = "_gpt_1vxsz_462", r = {
190
+ header: I,
191
+ outer: K,
192
+ main: Y,
193
+ container: Z,
194
+ links: e1,
195
+ buttons: t1,
196
+ menu: r1,
197
+ logo: n1,
198
+ subContainer: s1,
199
+ selected: o1,
200
+ subTag: i1,
201
201
  "subTag-success": "_subTag-success_1vxsz_371",
202
202
  "subTag-brand": "_subTag-brand_1vxsz_375",
203
- mobileOverlay: i1,
204
- show: a1,
205
- open: c1,
206
- mobile: h1,
207
- slideUp: l1,
208
- sub: d1,
209
- gpt: u1
210
- }, H = [
203
+ mobileOverlay: a1,
204
+ show: c1,
205
+ open: h1,
206
+ mobile: l1,
207
+ slideUp: d1,
208
+ sub: u1,
209
+ gpt: m1
210
+ }, W = [
211
211
  {
212
212
  title: "Products",
213
213
  url: "https://highcharts.com/products/",
214
- icon: /* @__PURE__ */ e(Q, {})
214
+ icon: /* @__PURE__ */ e(R, {})
215
215
  },
216
216
  {
217
217
  title: "Demos",
@@ -231,66 +231,80 @@ const R = "_header_1vxsz_270", I = "_outer_1vxsz_281", K = "_main_1vxsz_290", Y
231
231
  {
232
232
  title: "Pricing",
233
233
  url: "https://shop.highcharts.com/",
234
- icon: /* @__PURE__ */ e(F, {})
234
+ icon: /* @__PURE__ */ e(Q, {})
235
235
  },
236
236
  {
237
237
  title: "Blog",
238
238
  url: "https://www.highcharts.com/blog/",
239
- icon: /* @__PURE__ */ e(G, {})
239
+ icon: /* @__PURE__ */ e(F, {})
240
240
  }
241
241
  ];
242
242
  function l(n, t) {
243
243
  return t ? n.replace(t, "") : n;
244
244
  }
245
- function m1({
245
+ function w1({
246
246
  items: n,
247
247
  link: t = "a",
248
- host: w = "https://www.highcharts.com"
248
+ host: g = "https://www.highcharts.com"
249
249
  }) {
250
- return /* @__PURE__ */ e("div", { className: p(r.sub, r.outer), children: /* @__PURE__ */ e(W, { className: r.subContainer, as: "ul", children: n.map(({ title: i, url: a, icon: g, tag: v, tagVariant: _ = "success" }, m) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(t, { href: l(a, w), children: [
251
- g,
252
- /* @__PURE__ */ s("span", { children: [
253
- i,
254
- v && /* @__PURE__ */ e(
255
- "span",
256
- {
257
- className: p(
258
- r.subTag,
259
- r[`subTag-${_}`]
260
- ),
261
- children: v
262
- }
263
- )
264
- ] })
265
- ] }) }, m)) }) });
250
+ const i = G();
251
+ return /* @__PURE__ */ e("div", { className: f(r.sub, r.outer), children: /* @__PURE__ */ e(j, { className: r.subContainer, as: "ul", children: n.map(({ title: a, url: w, icon: x, tag: _, tagVariant: m = "success" }, k) => {
252
+ w = l(w, g);
253
+ const p = window.location.origin, v = new URL(w, p);
254
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
255
+ t,
256
+ {
257
+ href: w,
258
+ className: f({
259
+ [r.selected]: v.origin === p && v.pathname === i.pathname
260
+ }),
261
+ children: [
262
+ x,
263
+ /* @__PURE__ */ s("span", { children: [
264
+ a,
265
+ _ && /* @__PURE__ */ e(
266
+ "span",
267
+ {
268
+ className: f(
269
+ r.subTag,
270
+ r[`subTag-${m}`]
271
+ ),
272
+ children: _
273
+ }
274
+ )
275
+ ] })
276
+ ]
277
+ }
278
+ ) }, k);
279
+ }) }) });
266
280
  }
267
- function N1({
281
+ function z1({
268
282
  subItems: n,
269
283
  children: t,
270
- notifications: w = [],
284
+ notifications: g = [],
271
285
  // TODO: Fetch these from the internets
272
286
  link: i = "a",
273
287
  host: a = "https://www.highcharts.com"
274
288
  }) {
275
- const g = C("(max-width: 374px)"), v = C("(max-width: 849px)"), _ = C("(min-width: 850px) and (max-width: 999px)"), [m, j] = M(!1), [f, x] = M([]);
276
- q(() => {
277
- if (w.length) {
289
+ const w = b("(max-width: 374px)"), x = b("(max-width: 849px)"), _ = b("(min-width: 850px) and (max-width: 999px)"), [m, k] = N(!1), [p, v] = N([]);
290
+ V(() => {
291
+ if (g.length) {
278
292
  const c = localStorage.getItem("notifications");
279
293
  if (c) {
280
294
  const u = JSON.parse(c);
281
- x(
282
- w.filter(
295
+ v(
296
+ g.filter(
283
297
  (o) => !o.id || !u.closed.includes(o.id)
284
298
  )
285
299
  );
286
300
  } else
287
- x(w);
301
+ v(g);
288
302
  }
289
- }, [w]);
290
- const b = () => {
291
- j(!m);
303
+ }, [g]);
304
+ const M = () => {
305
+ k(!m);
292
306
  }, O = (c) => {
293
- x(f.filter((o) => !o.id || o.id !== c));
307
+ v(p.filter((o) => !o.id || o.id !== c));
294
308
  const u = localStorage.getItem("notifications");
295
309
  if (u) {
296
310
  const o = JSON.parse(u);
@@ -303,13 +317,13 @@ function N1({
303
317
  })
304
318
  );
305
319
  };
306
- return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ s("header", { className: r.header, children: [
307
- f == null ? void 0 : f.map(
308
- ({ id: c, title: u, description: o, variant: k, closable: y }, P) => /* @__PURE__ */ e(
320
+ return /* @__PURE__ */ e(q, { children: /* @__PURE__ */ s("header", { className: r.header, children: [
321
+ p == null ? void 0 : p.map(
322
+ ({ id: c, title: u, description: o, variant: C, closable: y }, P) => /* @__PURE__ */ e(
309
323
  J,
310
324
  {
311
325
  description: o,
312
- variant: k,
326
+ variant: C,
313
327
  closable: y,
314
328
  onClose: () => O(c),
315
329
  children: u
@@ -317,16 +331,16 @@ function N1({
317
331
  P
318
332
  )
319
333
  ),
320
- /* @__PURE__ */ e("div", { className: p(r.main, r.outer), children: /* @__PURE__ */ s(W, { as: "nav", className: r.container, children: [
334
+ /* @__PURE__ */ e("div", { className: f(r.main, r.outer), children: /* @__PURE__ */ s(j, { as: "nav", className: r.container, children: [
321
335
  /* @__PURE__ */ e(
322
336
  i,
323
337
  {
324
338
  className: r.logo,
325
339
  href: l("https://www.highcharts.com/", a),
326
- children: /* @__PURE__ */ e(N, { showText: !_ && !g })
340
+ children: /* @__PURE__ */ e(z, { showText: !_ && !w })
327
341
  }
328
342
  ),
329
- /* @__PURE__ */ e("ul", { className: r.links, children: H.map(({ title: c, url: u }, o) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
343
+ /* @__PURE__ */ e("ul", { className: r.links, children: W.map(({ title: c, url: u }, o) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
330
344
  h,
331
345
  {
332
346
  variant: "plain",
@@ -348,12 +362,12 @@ function N1({
348
362
  ),
349
363
  children: [
350
364
  /* @__PURE__ */ e("span", { className: r.gpt, children: "Highcharts GPT" }),
351
- /* @__PURE__ */ e(L, {})
365
+ /* @__PURE__ */ e(T, {})
352
366
  ]
353
367
  }
354
368
  ),
355
369
  /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(S, {}) }),
356
- /* @__PURE__ */ e(z, {}),
370
+ /* @__PURE__ */ e(L, {}),
357
371
  /* @__PURE__ */ e(
358
372
  h,
359
373
  {
@@ -361,7 +375,7 @@ function N1({
361
375
  as: i,
362
376
  href: l("https://shop.highcharts.com/account", a),
363
377
  "aria-label": "Login",
364
- children: /* @__PURE__ */ e(B, {})
378
+ children: /* @__PURE__ */ e(H, {})
365
379
  }
366
380
  ),
367
381
  /* @__PURE__ */ s(
@@ -374,7 +388,7 @@ function N1({
374
388
  a
375
389
  ),
376
390
  children: [
377
- /* @__PURE__ */ e(T, {}),
391
+ /* @__PURE__ */ e(B, {}),
378
392
  "Get started"
379
393
  ]
380
394
  }
@@ -384,7 +398,7 @@ function N1({
384
398
  {
385
399
  variant: m ? "white" : "transparent",
386
400
  className: r.menu,
387
- onClick: b,
401
+ onClick: M,
388
402
  children: [
389
403
  m ? "Close" : "Menu",
390
404
  m ? /* @__PURE__ */ e(A, {}) : /* @__PURE__ */ e($, {})
@@ -393,20 +407,20 @@ function N1({
393
407
  )
394
408
  ] })
395
409
  ] }) }),
396
- !!(n != null && n.length) && /* @__PURE__ */ e(m1, { items: n, link: i, host: a }),
410
+ !!(n != null && n.length) && /* @__PURE__ */ e(w1, { items: n, link: i, host: a }),
397
411
  t,
398
- v && /* @__PURE__ */ s(V, { children: [
412
+ x && /* @__PURE__ */ s(U, { children: [
399
413
  /* @__PURE__ */ e(
400
414
  "div",
401
415
  {
402
- className: p(r.mobileOverlay, { [r.open]: m }),
403
- onClick: b
416
+ className: f(r.mobileOverlay, { [r.open]: m }),
417
+ onClick: M
404
418
  }
405
419
  ),
406
420
  /* @__PURE__ */ s(
407
421
  "nav",
408
422
  {
409
- className: p(r.mobile, {
423
+ className: f(r.mobile, {
410
424
  [r.open]: m
411
425
  }),
412
426
  children: [
@@ -416,7 +430,7 @@ function N1({
416
430
  {
417
431
  className: r.logo,
418
432
  href: l("https://www.highcharts.com/", a),
419
- children: /* @__PURE__ */ e(N, { showText: !g })
433
+ children: /* @__PURE__ */ e(z, { showText: !w })
420
434
  }
421
435
  ),
422
436
  /* @__PURE__ */ s("div", { className: r.buttons, children: [
@@ -431,12 +445,12 @@ function N1({
431
445
  ),
432
446
  children: [
433
447
  /* @__PURE__ */ e("span", { className: r.gpt, children: "Highcharts GPT" }),
434
- /* @__PURE__ */ e(L, {})
448
+ /* @__PURE__ */ e(T, {})
435
449
  ]
436
450
  }
437
451
  ),
438
452
  /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(S, {}) }),
439
- /* @__PURE__ */ e(z, {})
453
+ /* @__PURE__ */ e(L, {})
440
454
  ] })
441
455
  ] }),
442
456
  /* @__PURE__ */ s("div", { className: r.buttons, children: [
@@ -451,7 +465,7 @@ function N1({
451
465
  a
452
466
  ),
453
467
  children: [
454
- /* @__PURE__ */ e(B, {}),
468
+ /* @__PURE__ */ e(H, {}),
455
469
  "Login"
456
470
  ]
457
471
  }
@@ -467,13 +481,13 @@ function N1({
467
481
  a
468
482
  ),
469
483
  children: [
470
- /* @__PURE__ */ e(T, {}),
484
+ /* @__PURE__ */ e(B, {}),
471
485
  "Get started"
472
486
  ]
473
487
  }
474
488
  )
475
489
  ] }),
476
- /* @__PURE__ */ e("ul", { className: r.links, children: H.map(({ title: c, url: u, icon: o }, k) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
490
+ /* @__PURE__ */ e("ul", { className: r.links, children: W.map(({ title: c, url: u, icon: o }, C) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
477
491
  h,
478
492
  {
479
493
  variant: "plain",
@@ -486,7 +500,7 @@ function N1({
486
500
  c
487
501
  ]
488
502
  }
489
- ) }, k)) })
503
+ ) }, C)) })
490
504
  ]
491
505
  }
492
506
  )
@@ -494,6 +508,6 @@ function N1({
494
508
  ] }) });
495
509
  }
496
510
  export {
497
- N1 as Header,
498
- m1 as SubHeader
511
+ z1 as Header,
512
+ w1 as SubHeader
499
513
  };
package/dist/utils.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export declare function useMediaQuery(query: string): boolean;
2
2
  export declare function useMounted(): boolean;
3
+ export declare function useLocation(): import('history').Location;
package/dist/utils.js CHANGED
@@ -1,22 +1,227 @@
1
- import { useState as c, useEffect as o } from "react";
2
- function d(e) {
3
- const [t, s] = c(!1);
4
- return o(() => {
5
- const n = window.matchMedia(e);
6
- s(n.matches);
7
- const a = (r) => {
8
- s(r.matches);
1
+ import { _ as $ } from "./extends-hS2Bh-Yp.js";
2
+ import { useState as P, useEffect as k } from "react";
3
+ var p;
4
+ (function(n) {
5
+ n.Pop = "POP", n.Push = "PUSH", n.Replace = "REPLACE";
6
+ })(p || (p = {}));
7
+ var A = process.env.NODE_ENV !== "production" ? function(n) {
8
+ return Object.freeze(n);
9
+ } : function(n) {
10
+ return n;
11
+ };
12
+ function U(n, a) {
13
+ {
14
+ typeof console < "u" && console.warn(a);
15
+ try {
16
+ throw new Error(a);
17
+ } catch {
18
+ }
19
+ }
20
+ }
21
+ var H = "beforeunload", j = "popstate";
22
+ function z(n) {
23
+ n === void 0 && (n = {});
24
+ var a = n, o = a.window, r = o === void 0 ? document.defaultView : o, i = r.history;
25
+ function f() {
26
+ var t = r.location, e = t.pathname, c = t.search, l = t.hash, u = i.state || {};
27
+ return [u.idx, A({
28
+ pathname: e,
29
+ search: c,
30
+ hash: l,
31
+ state: u.usr || null,
32
+ key: u.key || "default"
33
+ })];
34
+ }
35
+ var s = null;
36
+ function D() {
37
+ if (s)
38
+ d.call(s), s = null;
39
+ else {
40
+ var t = p.Pop, e = f(), c = e[0], l = e[1];
41
+ if (d.length)
42
+ if (c != null) {
43
+ var u = h - c;
44
+ u && (s = {
45
+ action: t,
46
+ location: l,
47
+ retry: function() {
48
+ y(u * -1);
49
+ }
50
+ }, y(u));
51
+ } else
52
+ process.env.NODE_ENV !== "production" && U(
53
+ !1,
54
+ // TODO: Write up a doc that explains our blocking strategy in
55
+ // detail and link to it here so people can understand better what
56
+ // is going on and how to avoid it.
57
+ "You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
58
+ );
59
+ else
60
+ b(t);
61
+ }
62
+ }
63
+ r.addEventListener(j, D);
64
+ var m = p.Pop, L = f(), h = L[0], g = L[1], x = B(), d = B();
65
+ h == null && (h = 0, i.replaceState($({}, i.state, {
66
+ idx: h
67
+ }), ""));
68
+ function O(t) {
69
+ return typeof t == "string" ? t : K(t);
70
+ }
71
+ function S(t, e) {
72
+ return e === void 0 && (e = null), A($({
73
+ pathname: g.pathname,
74
+ hash: "",
75
+ search: ""
76
+ }, typeof t == "string" ? Q(t) : t, {
77
+ state: e,
78
+ key: C()
79
+ }));
80
+ }
81
+ function _(t, e) {
82
+ return [{
83
+ usr: t.state,
84
+ key: t.key,
85
+ idx: e
86
+ }, O(t)];
87
+ }
88
+ function M(t, e, c) {
89
+ return !d.length || (d.call({
90
+ action: t,
91
+ location: e,
92
+ retry: c
93
+ }), !1);
94
+ }
95
+ function b(t) {
96
+ m = t;
97
+ var e = f();
98
+ h = e[0], g = e[1], x.call({
99
+ action: m,
100
+ location: g
101
+ });
102
+ }
103
+ function T(t, e) {
104
+ var c = p.Push, l = S(t, e);
105
+ function u() {
106
+ T(t, e);
107
+ }
108
+ if (M(c, l, u)) {
109
+ var v = _(l, h + 1), E = v[0], w = v[1];
110
+ try {
111
+ i.pushState(E, "", w);
112
+ } catch {
113
+ r.location.assign(w);
114
+ }
115
+ b(c);
116
+ }
117
+ }
118
+ function N(t, e) {
119
+ var c = p.Replace, l = S(t, e);
120
+ function u() {
121
+ N(t, e);
122
+ }
123
+ if (M(c, l, u)) {
124
+ var v = _(l, h), E = v[0], w = v[1];
125
+ i.replaceState(E, "", w), b(c);
126
+ }
127
+ }
128
+ function y(t) {
129
+ i.go(t);
130
+ }
131
+ var R = {
132
+ get action() {
133
+ return m;
134
+ },
135
+ get location() {
136
+ return g;
137
+ },
138
+ createHref: O,
139
+ push: T,
140
+ replace: N,
141
+ go: y,
142
+ back: function() {
143
+ y(-1);
144
+ },
145
+ forward: function() {
146
+ y(1);
147
+ },
148
+ listen: function(e) {
149
+ return x.push(e);
150
+ },
151
+ block: function(e) {
152
+ var c = d.push(e);
153
+ return d.length === 1 && r.addEventListener(H, V), function() {
154
+ c(), d.length || r.removeEventListener(H, V);
155
+ };
156
+ }
157
+ };
158
+ return R;
159
+ }
160
+ function V(n) {
161
+ n.preventDefault(), n.returnValue = "";
162
+ }
163
+ function B() {
164
+ var n = [];
165
+ return {
166
+ get length() {
167
+ return n.length;
168
+ },
169
+ push: function(o) {
170
+ return n.push(o), function() {
171
+ n = n.filter(function(r) {
172
+ return r !== o;
173
+ });
174
+ };
175
+ },
176
+ call: function(o) {
177
+ n.forEach(function(r) {
178
+ return r && r(o);
179
+ });
180
+ }
181
+ };
182
+ }
183
+ function C() {
184
+ return Math.random().toString(36).substr(2, 8);
185
+ }
186
+ function K(n) {
187
+ var a = n.pathname, o = a === void 0 ? "/" : a, r = n.search, i = r === void 0 ? "" : r, f = n.hash, s = f === void 0 ? "" : f;
188
+ return i && i !== "?" && (o += i.charAt(0) === "?" ? i : "?" + i), s && s !== "#" && (o += s.charAt(0) === "#" ? s : "#" + s), o;
189
+ }
190
+ function Q(n) {
191
+ var a = {};
192
+ if (n) {
193
+ var o = n.indexOf("#");
194
+ o >= 0 && (a.hash = n.substr(o), n = n.substr(0, o));
195
+ var r = n.indexOf("?");
196
+ r >= 0 && (a.search = n.substr(r), n = n.substr(0, r)), n && (a.pathname = n);
197
+ }
198
+ return a;
199
+ }
200
+ function J(n) {
201
+ const [a, o] = P(!1);
202
+ return k(() => {
203
+ const r = window.matchMedia(n);
204
+ o(r.matches);
205
+ const i = (f) => {
206
+ o(f.matches);
9
207
  };
10
- return n.addEventListener("change", a), () => n.removeEventListener("change", a);
11
- }, [e]), t;
208
+ return r.addEventListener("change", i), () => r.removeEventListener("change", i);
209
+ }, [n]), a;
210
+ }
211
+ function W() {
212
+ const [n, a] = P(!1);
213
+ return k(() => {
214
+ a(!0);
215
+ }, []), n;
12
216
  }
13
- function i() {
14
- const [e, t] = c(!1);
15
- return o(() => {
16
- t(!0);
17
- }, []), e;
217
+ function X() {
218
+ const n = z(), [a, o] = P(n.location);
219
+ return k(() => n.listen(({ location: r }) => {
220
+ o(r);
221
+ }), []), a;
18
222
  }
19
223
  export {
20
- d as useMediaQuery,
21
- i as useMounted
224
+ X as useLocation,
225
+ J as useMediaQuery,
226
+ W as useMounted
22
227
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "highsoft-ui",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "Highsoft UI",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
@@ -50,6 +50,7 @@
50
50
  "@untitled-ui/icons-react": "^0.1.4",
51
51
  "clsx": "^2.1.0",
52
52
  "highsoft-design-tokens": "^2.2.1",
53
+ "history": "^5.3.0",
53
54
  "modern-normalize": "^3.0.1",
54
55
  "next-themes": "^0.4.6",
55
56
  "radix-ui": "^1.4.1"