highsoft-ui 1.0.28 → 1.0.30

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.
@@ -7,10 +7,11 @@ export interface SubHeaderItem {
7
7
  tag?: ReactNode;
8
8
  tagVariant?: 'success' | 'brand';
9
9
  }
10
- export declare function SubHeader({ items, link: Link, host }: {
10
+ export declare function SubHeader({ items, link: Link, host, pathname }: {
11
11
  items: Array<SubHeaderItem>;
12
12
  link?: ElementType;
13
13
  host?: string;
14
+ pathname?: string;
14
15
  }): import("react/jsx-runtime").JSX.Element;
15
16
  export interface Notification {
16
17
  id?: string;
@@ -20,10 +21,11 @@ export interface Notification {
20
21
  closable?: boolean;
21
22
  }
22
23
  export declare function Header({ subItems, children, notifications: initialNotifications, // TODO: Fetch these from the internets
23
- link: Link, host }: {
24
+ link: Link, host, pathname }: {
24
25
  subItems?: Array<SubHeaderItem>;
25
26
  children?: ReactNode;
26
27
  notifications?: Array<Notification>;
27
28
  link?: ElementType;
28
29
  host?: string;
30
+ pathname?: string;
29
31
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,14 @@
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";
1
+ import { jsx as e, jsxs as o, Fragment as V } from "react/jsx-runtime";
2
+ import { useState as z, useEffect as q } from "react";
3
+ import { J } from "../../index-CMegByeX.js";
4
4
  import { _ as d } from "../../extends-hS2Bh-Yp.js";
5
- import { N as J, X as A } from "../../index-ChurKizy.js";
6
- import { c as _ } from "../../clsx-OuTLNxxd.js";
5
+ import { N as A, X as G } from "../../index-ChurKizy.js";
6
+ import { c as g } from "../../clsx-OuTLNxxd.js";
7
7
  import { Button as h } from "../Button/index.js";
8
- import { Container as j } from "../Container/index.js";
9
- import { ThemedLogo as z } from "../Logo/index.js";
10
- import { PrefPanel as S } from "../PrefPanel/index.js";
11
- import { useMediaQuery as M, usePathname as G } from "../../utils.js";
8
+ import { Container as y } from "../Container/index.js";
9
+ import { ThemedLogo as S } from "../Logo/index.js";
10
+ import { PrefPanel as L } from "../PrefPanel/index.js";
11
+ import { useMediaQuery as M } from "../../utils.js";
12
12
  var F = function(t) {
13
13
  return /* @__PURE__ */ e("svg", d({
14
14
  xmlns: "http://www.w3.org/2000/svg",
@@ -121,7 +121,7 @@ var F = function(t) {
121
121
  d: "M12 16v5m6 0-3.9514-3.2928c-.7288-.6074-1.0932-.911-1.4999-1.0271a2 2 0 0 0-1.0974 0c-.4067.1161-.7711.4197-1.4999 1.0271L6 21m2-10v1m4-3v3m4-5v5m6-9H2m1 0h18v8.2c0 1.6802 0 2.5202-.327 3.162a3 3 0 0 1-1.311 1.311C18.7202 16 17.8802 16 16.2 16H7.8c-1.6802 0-2.5202 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 13.7202 3 12.8802 3 11.2z"
122
122
  })
123
123
  }));
124
- }, L = function(t) {
124
+ }, T = function(t) {
125
125
  return /* @__PURE__ */ e("svg", d({
126
126
  xmlns: "http://www.w3.org/2000/svg",
127
127
  width: 24,
@@ -137,7 +137,7 @@ var F = 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
- }, T = function(t) {
140
+ }, B = 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 F = 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
- }, B = function(t) {
156
+ }, H = function(t) {
157
157
  return /* @__PURE__ */ e("svg", d({
158
158
  xmlns: "http://www.w3.org/2000/svg",
159
159
  width: 24,
@@ -186,17 +186,17 @@ var F = function(t) {
186
186
  })
187
187
  }));
188
188
  };
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 = {
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", n1 = "_menu_1vxsz_309", r1 = "_logo_1vxsz_314", o1 = "_subContainer_1vxsz_326", s1 = "_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", n = {
190
190
  header: I,
191
191
  outer: K,
192
192
  main: Y,
193
193
  container: Z,
194
194
  links: e1,
195
195
  buttons: t1,
196
- menu: r1,
197
- logo: n1,
198
- subContainer: s1,
199
- selected: o1,
196
+ menu: n1,
197
+ logo: r1,
198
+ subContainer: o1,
199
+ selected: s1,
200
200
  subTag: i1,
201
201
  "subTag-success": "_subTag-success_1vxsz_371",
202
202
  "subTag-brand": "_subTag-brand_1vxsz_375",
@@ -207,7 +207,7 @@ const I = "_header_1vxsz_270", K = "_outer_1vxsz_281", Y = "_main_1vxsz_290", Z
207
207
  slideUp: d1,
208
208
  sub: u1,
209
209
  gpt: m1
210
- }, H = [
210
+ }, j = [
211
211
  {
212
212
  title: "Products",
213
213
  url: "https://highcharts.com/products/",
@@ -239,38 +239,34 @@ const I = "_header_1vxsz_270", K = "_outer_1vxsz_281", Y = "_main_1vxsz_290", Z
239
239
  icon: /* @__PURE__ */ e(F, {})
240
240
  }
241
241
  ];
242
- function l(n, t) {
243
- return t ? n.replace(t, "") : n;
242
+ function l(r, t) {
243
+ return t ? r.replace(t, "") : r;
244
244
  }
245
245
  function w1({
246
- items: n,
246
+ items: r,
247
247
  link: t = "a",
248
- host: g = "https://www.highcharts.com"
248
+ host: p = "https://www.highcharts.com",
249
+ pathname: i = typeof window < "u" ? window.location.pathname : ""
249
250
  }) {
250
- const o = G();
251
- return console.log("header", o), /* @__PURE__ */ e("div", { className: _(r.sub, r.outer), children: /* @__PURE__ */ e(j, { className: r.subContainer, as: "ul", children: n.map(({ title: a, url: v, icon: k, tag: x, tagVariant: m = "success" }, C) => {
252
- let w = !1;
253
- if (typeof window < "u") {
254
- const p = window.location.origin, f = new URL(v, p);
255
- console.log(f, o, p), w = (v.startsWith("/") || f.origin === p) && f.pathname === o;
256
- }
257
- return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
251
+ return /* @__PURE__ */ e("div", { className: g(n.sub, n.outer), children: /* @__PURE__ */ e(y, { className: n.subContainer, as: "ul", children: r.map(({ title: a, url: f, icon: _, tag: x, tagVariant: C = "success" }, m) => {
252
+ const k = typeof window < "u" && window.location.origin || "http://example.com", w = new URL(f, k), v = w.origin === k && w.pathname === i;
253
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
258
254
  t,
259
255
  {
260
- href: l(v, g),
261
- className: _({
262
- [r.selected]: w
256
+ href: l(f, p),
257
+ className: g({
258
+ [n.selected]: v
263
259
  }),
264
260
  children: [
265
- k,
266
- /* @__PURE__ */ s("span", { children: [
261
+ _,
262
+ /* @__PURE__ */ o("span", { children: [
267
263
  a,
268
264
  x && /* @__PURE__ */ e(
269
265
  "span",
270
266
  {
271
- className: _(
272
- r.subTag,
273
- r[`subTag-${m}`]
267
+ className: g(
268
+ n.subTag,
269
+ n[`subTag-${C}`]
274
270
  ),
275
271
  children: x
276
272
  }
@@ -278,40 +274,41 @@ function w1({
278
274
  ] })
279
275
  ]
280
276
  }
281
- ) }, C);
277
+ ) }, m);
282
278
  }) }) });
283
279
  }
284
280
  function z1({
285
- subItems: n,
281
+ subItems: r,
286
282
  children: t,
287
- notifications: g = [],
283
+ notifications: p = [],
288
284
  // TODO: Fetch these from the internets
289
- link: o = "a",
290
- host: a = "https://www.highcharts.com"
285
+ link: i = "a",
286
+ host: a = "https://www.highcharts.com",
287
+ pathname: f = typeof window < "u" ? window.location.pathname : ""
291
288
  }) {
292
- const v = M("(max-width: 374px)"), k = M("(max-width: 849px)"), x = M("(min-width: 850px) and (max-width: 999px)"), [m, C] = N(!1), [w, p] = N([]);
293
- V(() => {
294
- if (g.length) {
289
+ const _ = M("(max-width: 374px)"), x = M("(max-width: 849px)"), C = M("(min-width: 850px) and (max-width: 999px)"), [m, k] = z(!1), [w, v] = z([]);
290
+ q(() => {
291
+ if (p.length) {
295
292
  const c = localStorage.getItem("notifications");
296
293
  if (c) {
297
294
  const u = JSON.parse(c);
298
- p(
299
- g.filter(
300
- (i) => !i.id || !u.closed.includes(i.id)
295
+ v(
296
+ p.filter(
297
+ (s) => !s.id || !u.closed.includes(s.id)
301
298
  )
302
299
  );
303
300
  } else
304
- p(g);
301
+ v(p);
305
302
  }
306
- }, [g]);
307
- const f = () => {
308
- C(!m);
309
- }, y = (c) => {
310
- p(w.filter((i) => !i.id || i.id !== c));
303
+ }, [p]);
304
+ const N = () => {
305
+ k(!m);
306
+ }, O = (c) => {
307
+ v(w.filter((s) => !s.id || s.id !== c));
311
308
  const u = localStorage.getItem("notifications");
312
309
  if (u) {
313
- const i = JSON.parse(u);
314
- i.closed.includes(c) || (i.closed.push(c), localStorage.setItem("notifications", JSON.stringify(i)));
310
+ const s = JSON.parse(u);
311
+ s.closed.includes(c) || (s.closed.push(c), localStorage.setItem("notifications", JSON.stringify(s)));
315
312
  } else
316
313
  localStorage.setItem(
317
314
  "notifications",
@@ -320,149 +317,157 @@ function z1({
320
317
  })
321
318
  );
322
319
  };
323
- return /* @__PURE__ */ e(q, { children: /* @__PURE__ */ s("header", { className: r.header, children: [
320
+ return /* @__PURE__ */ e(J, { children: /* @__PURE__ */ o("header", { className: n.header, children: [
324
321
  w == null ? void 0 : w.map(
325
- ({ id: c, title: u, description: i, variant: b, closable: O }, P) => /* @__PURE__ */ e(
326
- J,
322
+ ({ id: c, title: u, description: s, variant: b, closable: P }, U) => /* @__PURE__ */ e(
323
+ A,
327
324
  {
328
- description: i,
325
+ description: s,
329
326
  variant: b,
330
- closable: O,
331
- onClose: () => y(c),
327
+ closable: P,
328
+ onClose: () => O(c),
332
329
  children: u
333
330
  },
334
- P
331
+ U
335
332
  )
336
333
  ),
337
- /* @__PURE__ */ e("div", { className: _(r.main, r.outer), children: /* @__PURE__ */ s(j, { as: "nav", className: r.container, children: [
334
+ /* @__PURE__ */ e("div", { className: g(n.main, n.outer), children: /* @__PURE__ */ o(y, { as: "nav", className: n.container, children: [
338
335
  /* @__PURE__ */ e(
339
- o,
336
+ i,
340
337
  {
341
- className: r.logo,
338
+ className: n.logo,
342
339
  href: l("https://www.highcharts.com/", a),
343
- children: /* @__PURE__ */ e(z, { showText: !x && !v })
340
+ children: /* @__PURE__ */ e(S, { showText: !C && !_ })
344
341
  }
345
342
  ),
346
- /* @__PURE__ */ e("ul", { className: r.links, children: H.map(({ title: c, url: u }, i) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
343
+ /* @__PURE__ */ e("ul", { className: n.links, children: j.map(({ title: c, url: u }, s) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
347
344
  h,
348
345
  {
349
346
  variant: "plain",
350
347
  size: 300,
351
- as: o,
348
+ as: i,
352
349
  href: l(u, a),
353
350
  children: c
354
351
  }
355
- ) }, i)) }),
356
- /* @__PURE__ */ s("div", { className: r.buttons, children: [
357
- /* @__PURE__ */ s(
352
+ ) }, s)) }),
353
+ /* @__PURE__ */ o("div", { className: n.buttons, children: [
354
+ /* @__PURE__ */ o(
358
355
  h,
359
356
  {
360
357
  variant: "transparent",
361
- as: o,
358
+ as: i,
362
359
  href: l(
363
360
  "https://www.highcharts.com/chat/gpt/",
364
361
  a
365
362
  ),
366
363
  children: [
367
- /* @__PURE__ */ e("span", { className: r.gpt, children: "Highcharts GPT" }),
368
- /* @__PURE__ */ e(T, {})
364
+ /* @__PURE__ */ e("span", { className: n.gpt, children: "Highcharts GPT" }),
365
+ /* @__PURE__ */ e(B, {})
369
366
  ]
370
367
  }
371
368
  ),
372
- /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(L, {}) }),
373
- /* @__PURE__ */ e(S, {}),
369
+ /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(T, {}) }),
370
+ /* @__PURE__ */ e(L, {}),
374
371
  /* @__PURE__ */ e(
375
372
  h,
376
373
  {
377
374
  variant: "brand",
378
- as: o,
375
+ as: i,
379
376
  href: l("https://shop.highcharts.com/account", a),
380
377
  "aria-label": "Login",
381
378
  children: /* @__PURE__ */ e(W, {})
382
379
  }
383
380
  ),
384
- /* @__PURE__ */ s(
381
+ /* @__PURE__ */ o(
385
382
  h,
386
383
  {
387
384
  variant: "success",
388
- as: o,
385
+ as: i,
389
386
  href: l(
390
387
  "https://www.highcharts.com/download/",
391
388
  a
392
389
  ),
393
390
  children: [
394
- /* @__PURE__ */ e(B, {}),
391
+ /* @__PURE__ */ e(H, {}),
395
392
  "Get started"
396
393
  ]
397
394
  }
398
395
  ),
399
- /* @__PURE__ */ s(
396
+ /* @__PURE__ */ o(
400
397
  h,
401
398
  {
402
399
  variant: m ? "white" : "transparent",
403
- className: r.menu,
404
- onClick: f,
400
+ className: n.menu,
401
+ onClick: N,
405
402
  children: [
406
403
  m ? "Close" : "Menu",
407
- m ? /* @__PURE__ */ e(A, {}) : /* @__PURE__ */ e($, {})
404
+ m ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ e($, {})
408
405
  ]
409
406
  }
410
407
  )
411
408
  ] })
412
409
  ] }) }),
413
- !!(n != null && n.length) && /* @__PURE__ */ e(w1, { items: n, link: o, host: a }),
410
+ !!(r != null && r.length) && /* @__PURE__ */ e(
411
+ w1,
412
+ {
413
+ items: r,
414
+ link: i,
415
+ host: a,
416
+ pathname: f
417
+ }
418
+ ),
414
419
  t,
415
- k && /* @__PURE__ */ s(U, { children: [
420
+ x && /* @__PURE__ */ o(V, { children: [
416
421
  /* @__PURE__ */ e(
417
422
  "div",
418
423
  {
419
- className: _(r.mobileOverlay, { [r.open]: m }),
420
- onClick: f
424
+ className: g(n.mobileOverlay, { [n.open]: m }),
425
+ onClick: N
421
426
  }
422
427
  ),
423
- /* @__PURE__ */ s(
428
+ /* @__PURE__ */ o(
424
429
  "nav",
425
430
  {
426
- className: _(r.mobile, {
427
- [r.open]: m
431
+ className: g(n.mobile, {
432
+ [n.open]: m
428
433
  }),
429
434
  children: [
430
- /* @__PURE__ */ s("div", { className: r.container, children: [
435
+ /* @__PURE__ */ o("div", { className: n.container, children: [
431
436
  /* @__PURE__ */ e(
432
- o,
437
+ i,
433
438
  {
434
- className: r.logo,
439
+ className: n.logo,
435
440
  href: l("https://www.highcharts.com/", a),
436
- children: /* @__PURE__ */ e(z, { showText: !v })
441
+ children: /* @__PURE__ */ e(S, { showText: !_ })
437
442
  }
438
443
  ),
439
- /* @__PURE__ */ s("div", { className: r.buttons, children: [
440
- /* @__PURE__ */ s(
444
+ /* @__PURE__ */ o("div", { className: n.buttons, children: [
445
+ /* @__PURE__ */ o(
441
446
  h,
442
447
  {
443
448
  variant: "transparent",
444
- as: o,
449
+ as: i,
445
450
  href: l(
446
451
  "https://www.highcharts.com/chat/gpt/",
447
452
  a
448
453
  ),
449
454
  children: [
450
- /* @__PURE__ */ e("span", { className: r.gpt, children: "Highcharts GPT" }),
451
- /* @__PURE__ */ e(T, {})
455
+ /* @__PURE__ */ e("span", { className: n.gpt, children: "Highcharts GPT" }),
456
+ /* @__PURE__ */ e(B, {})
452
457
  ]
453
458
  }
454
459
  ),
455
- /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(L, {}) }),
456
- /* @__PURE__ */ e(S, {})
460
+ /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(T, {}) }),
461
+ /* @__PURE__ */ e(L, {})
457
462
  ] })
458
463
  ] }),
459
- /* @__PURE__ */ s("div", { className: r.buttons, children: [
460
- /* @__PURE__ */ s(
464
+ /* @__PURE__ */ o("div", { className: n.buttons, children: [
465
+ /* @__PURE__ */ o(
461
466
  h,
462
467
  {
463
468
  variant: "brand",
464
469
  fullWidth: !0,
465
- as: o,
470
+ as: i,
466
471
  href: l(
467
472
  "https://shop.highcharts.com/account",
468
473
  a
@@ -473,33 +478,33 @@ function z1({
473
478
  ]
474
479
  }
475
480
  ),
476
- /* @__PURE__ */ s(
481
+ /* @__PURE__ */ o(
477
482
  h,
478
483
  {
479
484
  variant: "success",
480
485
  fullWidth: !0,
481
- as: o,
486
+ as: i,
482
487
  href: l(
483
488
  "https://www.highcharts.com/download/",
484
489
  a
485
490
  ),
486
491
  children: [
487
- /* @__PURE__ */ e(B, {}),
492
+ /* @__PURE__ */ e(H, {}),
488
493
  "Get started"
489
494
  ]
490
495
  }
491
496
  )
492
497
  ] }),
493
- /* @__PURE__ */ e("ul", { className: r.links, children: H.map(({ title: c, url: u, icon: i }, b) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
498
+ /* @__PURE__ */ e("ul", { className: n.links, children: j.map(({ title: c, url: u, icon: s }, b) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
494
499
  h,
495
500
  {
496
501
  variant: "plain",
497
502
  size: 500,
498
503
  fullWidth: !0,
499
- as: o,
504
+ as: i,
500
505
  href: l(u, a),
501
506
  children: [
502
- i,
507
+ s,
503
508
  c
504
509
  ]
505
510
  }
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export declare function useMediaQuery(query: string): boolean;
2
2
  export declare function useMounted(): boolean;
3
- export declare function usePathname(): string;
package/dist/utils.js CHANGED
@@ -1,230 +1,22 @@
1
- import { _ as $ } from "./extends-hS2Bh-Yp.js";
2
- import { useState as E, useEffect as k } from "react";
3
- var p;
4
- (function(e) {
5
- e.Pop = "POP", e.Push = "PUSH", e.Replace = "REPLACE";
6
- })(p || (p = {}));
7
- var A = process.env.NODE_ENV !== "production" ? function(e) {
8
- return Object.freeze(e);
9
- } : function(e) {
10
- return e;
11
- };
12
- function U(e, o) {
13
- {
14
- typeof console < "u" && console.warn(o);
15
- try {
16
- throw new Error(o);
17
- } catch {
18
- }
19
- }
20
- }
21
- var H = "beforeunload", j = "popstate";
22
- function z(e) {
23
- e === void 0 && (e = {});
24
- var o = e, a = o.window, t = a === void 0 ? document.defaultView : a, i = t.history;
25
- function f() {
26
- var n = t.location, r = n.pathname, c = n.search, l = n.hash, u = i.state || {};
27
- return [u.idx, A({
28
- pathname: r,
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 n = p.Pop, r = f(), c = r[0], l = r[1];
41
- if (d.length)
42
- if (c != null) {
43
- var u = h - c;
44
- u && (s = {
45
- action: n,
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(n);
61
- }
62
- }
63
- t.addEventListener(j, D);
64
- var w = p.Pop, x = f(), h = x[0], m = x[1], L = B(), d = B();
65
- h == null && (h = 0, i.replaceState($({}, i.state, {
66
- idx: h
67
- }), ""));
68
- function O(n) {
69
- return typeof n == "string" ? n : K(n);
70
- }
71
- function S(n, r) {
72
- return r === void 0 && (r = null), A($({
73
- pathname: m.pathname,
74
- hash: "",
75
- search: ""
76
- }, typeof n == "string" ? Q(n) : n, {
77
- state: r,
78
- key: C()
79
- }));
80
- }
81
- function _(n, r) {
82
- return [{
83
- usr: n.state,
84
- key: n.key,
85
- idx: r
86
- }, O(n)];
87
- }
88
- function M(n, r, c) {
89
- return !d.length || (d.call({
90
- action: n,
91
- location: r,
92
- retry: c
93
- }), !1);
94
- }
95
- function b(n) {
96
- w = n;
97
- var r = f();
98
- h = r[0], m = r[1], L.call({
99
- action: w,
100
- location: m
101
- });
102
- }
103
- function T(n, r) {
104
- var c = p.Push, l = S(n, r);
105
- function u() {
106
- T(n, r);
107
- }
108
- if (M(c, l, u)) {
109
- var v = _(l, h + 1), P = v[0], g = v[1];
110
- try {
111
- i.pushState(P, "", g);
112
- } catch {
113
- t.location.assign(g);
114
- }
115
- b(c);
116
- }
117
- }
118
- function N(n, r) {
119
- var c = p.Replace, l = S(n, r);
120
- function u() {
121
- N(n, r);
122
- }
123
- if (M(c, l, u)) {
124
- var v = _(l, h), P = v[0], g = v[1];
125
- i.replaceState(P, "", g), b(c);
126
- }
127
- }
128
- function y(n) {
129
- i.go(n);
130
- }
131
- var R = {
132
- get action() {
133
- return w;
134
- },
135
- get location() {
136
- return m;
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(r) {
149
- return L.push(r);
150
- },
151
- block: function(r) {
152
- var c = d.push(r);
153
- return d.length === 1 && t.addEventListener(H, V), function() {
154
- c(), d.length || t.removeEventListener(H, V);
155
- };
156
- }
157
- };
158
- return R;
159
- }
160
- function V(e) {
161
- e.preventDefault(), e.returnValue = "";
162
- }
163
- function B() {
164
- var e = [];
165
- return {
166
- get length() {
167
- return e.length;
168
- },
169
- push: function(a) {
170
- return e.push(a), function() {
171
- e = e.filter(function(t) {
172
- return t !== a;
173
- });
174
- };
175
- },
176
- call: function(a) {
177
- e.forEach(function(t) {
178
- return t && t(a);
179
- });
180
- }
181
- };
182
- }
183
- function C() {
184
- return Math.random().toString(36).substr(2, 8);
185
- }
186
- function K(e) {
187
- var o = e.pathname, a = o === void 0 ? "/" : o, t = e.search, i = t === void 0 ? "" : t, f = e.hash, s = f === void 0 ? "" : f;
188
- return i && i !== "?" && (a += i.charAt(0) === "?" ? i : "?" + i), s && s !== "#" && (a += s.charAt(0) === "#" ? s : "#" + s), a;
189
- }
190
- function Q(e) {
191
- var o = {};
192
- if (e) {
193
- var a = e.indexOf("#");
194
- a >= 0 && (o.hash = e.substr(a), e = e.substr(0, a));
195
- var t = e.indexOf("?");
196
- t >= 0 && (o.search = e.substr(t), e = e.substr(0, t)), e && (o.pathname = e);
197
- }
198
- return o;
199
- }
200
- function J(e) {
201
- const [o, a] = E(!1);
202
- return k(() => {
203
- const t = window.matchMedia(e);
204
- a(t.matches);
205
- const i = (f) => {
206
- a(f.matches);
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);
207
9
  };
208
- return t.addEventListener("change", i), () => t.removeEventListener("change", i);
209
- }, [e]), o;
210
- }
211
- function W() {
212
- const [e, o] = E(!1);
213
- return k(() => {
214
- o(!0);
215
- }, []), e;
10
+ return n.addEventListener("change", a), () => n.removeEventListener("change", a);
11
+ }, [e]), t;
216
12
  }
217
- function X() {
218
- const [e, o] = E("");
219
- return k(() => {
220
- const a = z();
221
- return o(a.location.pathname), a.listen(({ location: t }) => {
222
- console.log("listener", t.pathname), o(t.pathname);
223
- });
13
+ function i() {
14
+ const [e, t] = c(!1);
15
+ return o(() => {
16
+ t(!0);
224
17
  }, []), e;
225
18
  }
226
19
  export {
227
- J as useMediaQuery,
228
- W as useMounted,
229
- X as usePathname
20
+ d as useMediaQuery,
21
+ i as useMounted
230
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "highsoft-ui",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "Highsoft UI",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
@@ -50,7 +50,6 @@
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",
54
53
  "modern-normalize": "^3.0.1",
55
54
  "next-themes": "^0.4.6",
56
55
  "radix-ui": "^1.4.1"