highsoft-ui 1.0.28 → 1.0.29

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 v } 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
+ }, W = 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 F = 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
- }, W = 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,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,38 @@ 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;
251
+ return /* @__PURE__ */ e("div", { className: v(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
+ let k = !1;
253
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;
254
+ const w = window.location.origin, g = new URL(f, w);
255
+ k = (f.startsWith("/") || g.origin === w) && g.pathname === i;
256
256
  }
257
- return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
257
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
258
258
  t,
259
259
  {
260
- href: l(v, g),
261
- className: _({
262
- [r.selected]: w
260
+ href: l(f, p),
261
+ className: v({
262
+ [n.selected]: k
263
263
  }),
264
264
  children: [
265
- k,
266
- /* @__PURE__ */ s("span", { children: [
265
+ _,
266
+ /* @__PURE__ */ o("span", { children: [
267
267
  a,
268
268
  x && /* @__PURE__ */ e(
269
269
  "span",
270
270
  {
271
- className: _(
272
- r.subTag,
273
- r[`subTag-${m}`]
271
+ className: v(
272
+ n.subTag,
273
+ n[`subTag-${C}`]
274
274
  ),
275
275
  children: x
276
276
  }
@@ -278,40 +278,41 @@ function w1({
278
278
  ] })
279
279
  ]
280
280
  }
281
- ) }, C);
281
+ ) }, m);
282
282
  }) }) });
283
283
  }
284
284
  function z1({
285
- subItems: n,
285
+ subItems: r,
286
286
  children: t,
287
- notifications: g = [],
287
+ notifications: p = [],
288
288
  // TODO: Fetch these from the internets
289
- link: o = "a",
290
- host: a = "https://www.highcharts.com"
289
+ link: i = "a",
290
+ host: a = "https://www.highcharts.com",
291
+ pathname: f = typeof window < "u" ? window.location.pathname : ""
291
292
  }) {
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) {
293
+ const _ = M("(max-width: 374px)"), x = M("(max-width: 849px)"), C = M("(min-width: 850px) and (max-width: 999px)"), [m, k] = z(!1), [w, g] = z([]);
294
+ q(() => {
295
+ if (p.length) {
295
296
  const c = localStorage.getItem("notifications");
296
297
  if (c) {
297
298
  const u = JSON.parse(c);
298
- p(
299
- g.filter(
300
- (i) => !i.id || !u.closed.includes(i.id)
299
+ g(
300
+ p.filter(
301
+ (s) => !s.id || !u.closed.includes(s.id)
301
302
  )
302
303
  );
303
304
  } else
304
- p(g);
305
+ g(p);
305
306
  }
306
- }, [g]);
307
- const f = () => {
308
- C(!m);
309
- }, y = (c) => {
310
- p(w.filter((i) => !i.id || i.id !== c));
307
+ }, [p]);
308
+ const N = () => {
309
+ k(!m);
310
+ }, O = (c) => {
311
+ g(w.filter((s) => !s.id || s.id !== c));
311
312
  const u = localStorage.getItem("notifications");
312
313
  if (u) {
313
- const i = JSON.parse(u);
314
- i.closed.includes(c) || (i.closed.push(c), localStorage.setItem("notifications", JSON.stringify(i)));
314
+ const s = JSON.parse(u);
315
+ s.closed.includes(c) || (s.closed.push(c), localStorage.setItem("notifications", JSON.stringify(s)));
315
316
  } else
316
317
  localStorage.setItem(
317
318
  "notifications",
@@ -320,186 +321,194 @@ function z1({
320
321
  })
321
322
  );
322
323
  };
323
- return /* @__PURE__ */ e(q, { children: /* @__PURE__ */ s("header", { className: r.header, children: [
324
+ return /* @__PURE__ */ e(J, { children: /* @__PURE__ */ o("header", { className: n.header, children: [
324
325
  w == null ? void 0 : w.map(
325
- ({ id: c, title: u, description: i, variant: b, closable: O }, P) => /* @__PURE__ */ e(
326
- J,
326
+ ({ id: c, title: u, description: s, variant: b, closable: P }, U) => /* @__PURE__ */ e(
327
+ A,
327
328
  {
328
- description: i,
329
+ description: s,
329
330
  variant: b,
330
- closable: O,
331
- onClose: () => y(c),
331
+ closable: P,
332
+ onClose: () => O(c),
332
333
  children: u
333
334
  },
334
- P
335
+ U
335
336
  )
336
337
  ),
337
- /* @__PURE__ */ e("div", { className: _(r.main, r.outer), children: /* @__PURE__ */ s(j, { as: "nav", className: r.container, children: [
338
+ /* @__PURE__ */ e("div", { className: v(n.main, n.outer), children: /* @__PURE__ */ o(y, { as: "nav", className: n.container, children: [
338
339
  /* @__PURE__ */ e(
339
- o,
340
+ i,
340
341
  {
341
- className: r.logo,
342
+ className: n.logo,
342
343
  href: l("https://www.highcharts.com/", a),
343
- children: /* @__PURE__ */ e(z, { showText: !x && !v })
344
+ children: /* @__PURE__ */ e(S, { showText: !C && !_ })
344
345
  }
345
346
  ),
346
- /* @__PURE__ */ e("ul", { className: r.links, children: H.map(({ title: c, url: u }, i) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
347
+ /* @__PURE__ */ e("ul", { className: n.links, children: j.map(({ title: c, url: u }, s) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
347
348
  h,
348
349
  {
349
350
  variant: "plain",
350
351
  size: 300,
351
- as: o,
352
+ as: i,
352
353
  href: l(u, a),
353
354
  children: c
354
355
  }
355
- ) }, i)) }),
356
- /* @__PURE__ */ s("div", { className: r.buttons, children: [
357
- /* @__PURE__ */ s(
356
+ ) }, s)) }),
357
+ /* @__PURE__ */ o("div", { className: n.buttons, children: [
358
+ /* @__PURE__ */ o(
358
359
  h,
359
360
  {
360
361
  variant: "transparent",
361
- as: o,
362
+ as: i,
362
363
  href: l(
363
364
  "https://www.highcharts.com/chat/gpt/",
364
365
  a
365
366
  ),
366
367
  children: [
367
- /* @__PURE__ */ e("span", { className: r.gpt, children: "Highcharts GPT" }),
368
- /* @__PURE__ */ e(T, {})
368
+ /* @__PURE__ */ e("span", { className: n.gpt, children: "Highcharts GPT" }),
369
+ /* @__PURE__ */ e(B, {})
369
370
  ]
370
371
  }
371
372
  ),
372
- /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(L, {}) }),
373
- /* @__PURE__ */ e(S, {}),
373
+ /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(T, {}) }),
374
+ /* @__PURE__ */ e(L, {}),
374
375
  /* @__PURE__ */ e(
375
376
  h,
376
377
  {
377
378
  variant: "brand",
378
- as: o,
379
+ as: i,
379
380
  href: l("https://shop.highcharts.com/account", a),
380
381
  "aria-label": "Login",
381
- children: /* @__PURE__ */ e(W, {})
382
+ children: /* @__PURE__ */ e(H, {})
382
383
  }
383
384
  ),
384
- /* @__PURE__ */ s(
385
+ /* @__PURE__ */ o(
385
386
  h,
386
387
  {
387
388
  variant: "success",
388
- as: o,
389
+ as: i,
389
390
  href: l(
390
391
  "https://www.highcharts.com/download/",
391
392
  a
392
393
  ),
393
394
  children: [
394
- /* @__PURE__ */ e(B, {}),
395
+ /* @__PURE__ */ e(W, {}),
395
396
  "Get started"
396
397
  ]
397
398
  }
398
399
  ),
399
- /* @__PURE__ */ s(
400
+ /* @__PURE__ */ o(
400
401
  h,
401
402
  {
402
403
  variant: m ? "white" : "transparent",
403
- className: r.menu,
404
- onClick: f,
404
+ className: n.menu,
405
+ onClick: N,
405
406
  children: [
406
407
  m ? "Close" : "Menu",
407
- m ? /* @__PURE__ */ e(A, {}) : /* @__PURE__ */ e($, {})
408
+ m ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ e($, {})
408
409
  ]
409
410
  }
410
411
  )
411
412
  ] })
412
413
  ] }) }),
413
- !!(n != null && n.length) && /* @__PURE__ */ e(w1, { items: n, link: o, host: a }),
414
+ !!(r != null && r.length) && /* @__PURE__ */ e(
415
+ w1,
416
+ {
417
+ items: r,
418
+ link: i,
419
+ host: a,
420
+ pathname: f
421
+ }
422
+ ),
414
423
  t,
415
- k && /* @__PURE__ */ s(U, { children: [
424
+ x && /* @__PURE__ */ o(V, { children: [
416
425
  /* @__PURE__ */ e(
417
426
  "div",
418
427
  {
419
- className: _(r.mobileOverlay, { [r.open]: m }),
420
- onClick: f
428
+ className: v(n.mobileOverlay, { [n.open]: m }),
429
+ onClick: N
421
430
  }
422
431
  ),
423
- /* @__PURE__ */ s(
432
+ /* @__PURE__ */ o(
424
433
  "nav",
425
434
  {
426
- className: _(r.mobile, {
427
- [r.open]: m
435
+ className: v(n.mobile, {
436
+ [n.open]: m
428
437
  }),
429
438
  children: [
430
- /* @__PURE__ */ s("div", { className: r.container, children: [
439
+ /* @__PURE__ */ o("div", { className: n.container, children: [
431
440
  /* @__PURE__ */ e(
432
- o,
441
+ i,
433
442
  {
434
- className: r.logo,
443
+ className: n.logo,
435
444
  href: l("https://www.highcharts.com/", a),
436
- children: /* @__PURE__ */ e(z, { showText: !v })
445
+ children: /* @__PURE__ */ e(S, { showText: !_ })
437
446
  }
438
447
  ),
439
- /* @__PURE__ */ s("div", { className: r.buttons, children: [
440
- /* @__PURE__ */ s(
448
+ /* @__PURE__ */ o("div", { className: n.buttons, children: [
449
+ /* @__PURE__ */ o(
441
450
  h,
442
451
  {
443
452
  variant: "transparent",
444
- as: o,
453
+ as: i,
445
454
  href: l(
446
455
  "https://www.highcharts.com/chat/gpt/",
447
456
  a
448
457
  ),
449
458
  children: [
450
- /* @__PURE__ */ e("span", { className: r.gpt, children: "Highcharts GPT" }),
451
- /* @__PURE__ */ e(T, {})
459
+ /* @__PURE__ */ e("span", { className: n.gpt, children: "Highcharts GPT" }),
460
+ /* @__PURE__ */ e(B, {})
452
461
  ]
453
462
  }
454
463
  ),
455
- /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(L, {}) }),
456
- /* @__PURE__ */ e(S, {})
464
+ /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(T, {}) }),
465
+ /* @__PURE__ */ e(L, {})
457
466
  ] })
458
467
  ] }),
459
- /* @__PURE__ */ s("div", { className: r.buttons, children: [
460
- /* @__PURE__ */ s(
468
+ /* @__PURE__ */ o("div", { className: n.buttons, children: [
469
+ /* @__PURE__ */ o(
461
470
  h,
462
471
  {
463
472
  variant: "brand",
464
473
  fullWidth: !0,
465
- as: o,
474
+ as: i,
466
475
  href: l(
467
476
  "https://shop.highcharts.com/account",
468
477
  a
469
478
  ),
470
479
  children: [
471
- /* @__PURE__ */ e(W, {}),
480
+ /* @__PURE__ */ e(H, {}),
472
481
  "Login"
473
482
  ]
474
483
  }
475
484
  ),
476
- /* @__PURE__ */ s(
485
+ /* @__PURE__ */ o(
477
486
  h,
478
487
  {
479
488
  variant: "success",
480
489
  fullWidth: !0,
481
- as: o,
490
+ as: i,
482
491
  href: l(
483
492
  "https://www.highcharts.com/download/",
484
493
  a
485
494
  ),
486
495
  children: [
487
- /* @__PURE__ */ e(B, {}),
496
+ /* @__PURE__ */ e(W, {}),
488
497
  "Get started"
489
498
  ]
490
499
  }
491
500
  )
492
501
  ] }),
493
- /* @__PURE__ */ e("ul", { className: r.links, children: H.map(({ title: c, url: u, icon: i }, b) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
502
+ /* @__PURE__ */ e("ul", { className: n.links, children: j.map(({ title: c, url: u, icon: s }, b) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
494
503
  h,
495
504
  {
496
505
  variant: "plain",
497
506
  size: 500,
498
507
  fullWidth: !0,
499
- as: o,
508
+ as: i,
500
509
  href: l(u, a),
501
510
  children: [
502
- i,
511
+ s,
503
512
  c
504
513
  ]
505
514
  }
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.29",
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"