highsoft-ui 1.0.24 → 1.0.27

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,8 +7,8 @@ import { c as f } from "../../clsx-OuTLNxxd.js";
7
7
  import { Button as h } from "../Button/index.js";
8
8
  import { Container as j } from "../Container/index.js";
9
9
  import { ThemedLogo as z } from "../Logo/index.js";
10
- import { PrefPanel as L } from "../PrefPanel/index.js";
11
- import { useMediaQuery as M, useLocation as G } from "../../utils.js";
10
+ import { PrefPanel as S } from "../PrefPanel/index.js";
11
+ import { useMediaQuery as M, usePathname as G } 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
- }, S = function(t) {
124
+ }, L = function(t) {
125
125
  return /* @__PURE__ */ e("svg", d({
126
126
  xmlns: "http://www.w3.org/2000/svg",
127
127
  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
- }, H = function(t) {
172
+ }, W = function(t) {
173
173
  return /* @__PURE__ */ e("svg", d({
174
174
  xmlns: "http://www.w3.org/2000/svg",
175
175
  width: 24,
@@ -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
- }, W = [
210
+ }, H = [
211
211
  {
212
212
  title: "Products",
213
213
  url: "https://highcharts.com/products/",
@@ -245,22 +245,21 @@ function l(n, t) {
245
245
  function w1({
246
246
  items: n,
247
247
  link: t = "a",
248
- host: g = "https://www.highcharts.com"
248
+ host: p = "https://www.highcharts.com"
249
249
  }) {
250
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: k, tag: x, tagVariant: m = "success" }, C) => {
252
- w = l(w, g);
253
- let p = !1;
254
- if (typeof window < "u" && i) {
255
- const v = window.location.origin, _ = new URL(w, v);
256
- p = _.origin === v && _.pathname === i.pathname;
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: g, icon: k, tag: x, tagVariant: m = "success" }, C) => {
252
+ let w = !1;
253
+ if (typeof window < "u") {
254
+ const v = window.location.origin, _ = new URL(g, v);
255
+ w = (g.startsWith("/") || _.origin === v) && _.pathname === i;
257
256
  }
258
257
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
259
258
  t,
260
259
  {
261
- href: w,
260
+ href: l(g, p),
262
261
  className: f({
263
- [r.selected]: p
262
+ [r.selected]: w
264
263
  }),
265
264
  children: [
266
265
  k,
@@ -285,30 +284,30 @@ function w1({
285
284
  function z1({
286
285
  subItems: n,
287
286
  children: t,
288
- notifications: g = [],
287
+ notifications: p = [],
289
288
  // TODO: Fetch these from the internets
290
289
  link: i = "a",
291
290
  host: a = "https://www.highcharts.com"
292
291
  }) {
293
- const w = M("(max-width: 374px)"), k = M("(max-width: 849px)"), x = M("(min-width: 850px) and (max-width: 999px)"), [m, C] = N(!1), [p, v] = N([]);
292
+ const g = M("(max-width: 374px)"), k = M("(max-width: 849px)"), x = M("(min-width: 850px) and (max-width: 999px)"), [m, C] = N(!1), [w, v] = N([]);
294
293
  V(() => {
295
- if (g.length) {
294
+ if (p.length) {
296
295
  const c = localStorage.getItem("notifications");
297
296
  if (c) {
298
297
  const u = JSON.parse(c);
299
298
  v(
300
- g.filter(
299
+ p.filter(
301
300
  (o) => !o.id || !u.closed.includes(o.id)
302
301
  )
303
302
  );
304
303
  } else
305
- v(g);
304
+ v(p);
306
305
  }
307
- }, [g]);
306
+ }, [p]);
308
307
  const _ = () => {
309
308
  C(!m);
310
309
  }, y = (c) => {
311
- v(p.filter((o) => !o.id || o.id !== c));
310
+ v(w.filter((o) => !o.id || o.id !== c));
312
311
  const u = localStorage.getItem("notifications");
313
312
  if (u) {
314
313
  const o = JSON.parse(u);
@@ -322,7 +321,7 @@ function z1({
322
321
  );
323
322
  };
324
323
  return /* @__PURE__ */ e(q, { children: /* @__PURE__ */ s("header", { className: r.header, children: [
325
- p == null ? void 0 : p.map(
324
+ w == null ? void 0 : w.map(
326
325
  ({ id: c, title: u, description: o, variant: b, closable: O }, P) => /* @__PURE__ */ e(
327
326
  J,
328
327
  {
@@ -341,10 +340,10 @@ function z1({
341
340
  {
342
341
  className: r.logo,
343
342
  href: l("https://www.highcharts.com/", a),
344
- children: /* @__PURE__ */ e(z, { showText: !x && !w })
343
+ children: /* @__PURE__ */ e(z, { showText: !x && !g })
345
344
  }
346
345
  ),
347
- /* @__PURE__ */ e("ul", { className: r.links, children: W.map(({ title: c, url: u }, o) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
346
+ /* @__PURE__ */ e("ul", { className: r.links, children: H.map(({ title: c, url: u }, o) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
348
347
  h,
349
348
  {
350
349
  variant: "plain",
@@ -370,8 +369,8 @@ function z1({
370
369
  ]
371
370
  }
372
371
  ),
373
- /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(S, {}) }),
374
- /* @__PURE__ */ e(L, {}),
372
+ /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(L, {}) }),
373
+ /* @__PURE__ */ e(S, {}),
375
374
  /* @__PURE__ */ e(
376
375
  h,
377
376
  {
@@ -379,7 +378,7 @@ function z1({
379
378
  as: i,
380
379
  href: l("https://shop.highcharts.com/account", a),
381
380
  "aria-label": "Login",
382
- children: /* @__PURE__ */ e(H, {})
381
+ children: /* @__PURE__ */ e(W, {})
383
382
  }
384
383
  ),
385
384
  /* @__PURE__ */ s(
@@ -434,7 +433,7 @@ function z1({
434
433
  {
435
434
  className: r.logo,
436
435
  href: l("https://www.highcharts.com/", a),
437
- children: /* @__PURE__ */ e(z, { showText: !w })
436
+ children: /* @__PURE__ */ e(z, { showText: !g })
438
437
  }
439
438
  ),
440
439
  /* @__PURE__ */ s("div", { className: r.buttons, children: [
@@ -453,8 +452,8 @@ function z1({
453
452
  ]
454
453
  }
455
454
  ),
456
- /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(S, {}) }),
457
- /* @__PURE__ */ e(L, {})
455
+ /* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(L, {}) }),
456
+ /* @__PURE__ */ e(S, {})
458
457
  ] })
459
458
  ] }),
460
459
  /* @__PURE__ */ s("div", { className: r.buttons, children: [
@@ -469,7 +468,7 @@ function z1({
469
468
  a
470
469
  ),
471
470
  children: [
472
- /* @__PURE__ */ e(H, {}),
471
+ /* @__PURE__ */ e(W, {}),
473
472
  "Login"
474
473
  ]
475
474
  }
@@ -491,7 +490,7 @@ function z1({
491
490
  }
492
491
  )
493
492
  ] }),
494
- /* @__PURE__ */ e("ul", { className: r.links, children: W.map(({ title: c, url: u, icon: o }, b) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
493
+ /* @__PURE__ */ e("ul", { className: r.links, children: H.map(({ title: c, url: u, icon: o }, b) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
495
494
  h,
496
495
  {
497
496
  variant: "plain",
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { Location } from 'history';
2
1
  export declare function useMediaQuery(query: string): boolean;
3
2
  export declare function useMounted(): boolean;
4
- export declare function useLocation(): Location | undefined;
3
+ export declare function usePathname(): string;
package/dist/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _ as $ } from "./extends-hS2Bh-Yp.js";
2
- import { useState as P, useEffect as k } from "react";
2
+ import { useState as E, useEffect as k } from "react";
3
3
  var p;
4
4
  (function(n) {
5
5
  n.Pop = "POP", n.Push = "PUSH", n.Replace = "REPLACE";
@@ -23,9 +23,9 @@ function z(n) {
23
23
  n === void 0 && (n = {});
24
24
  var o = n, a = o.window, r = a === void 0 ? document.defaultView : a, i = r.history;
25
25
  function f() {
26
- var t = r.location, e = t.pathname, c = t.search, l = t.hash, u = i.state || {};
26
+ var e = r.location, t = e.pathname, c = e.search, l = e.hash, u = i.state || {};
27
27
  return [u.idx, A({
28
- pathname: e,
28
+ pathname: t,
29
29
  search: c,
30
30
  hash: l,
31
31
  state: u.usr || null,
@@ -37,12 +37,12 @@ function z(n) {
37
37
  if (s)
38
38
  d.call(s), s = null;
39
39
  else {
40
- var t = p.Pop, e = f(), c = e[0], l = e[1];
40
+ var e = p.Pop, t = f(), c = t[0], l = t[1];
41
41
  if (d.length)
42
42
  if (c != null) {
43
43
  var u = h - c;
44
44
  u && (s = {
45
- action: t,
45
+ action: e,
46
46
  location: l,
47
47
  retry: function() {
48
48
  y(u * -1);
@@ -57,83 +57,83 @@ function z(n) {
57
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
58
  );
59
59
  else
60
- b(t);
60
+ b(e);
61
61
  }
62
62
  }
63
63
  r.addEventListener(j, D);
64
- var m = p.Pop, L = f(), h = L[0], g = L[1], x = B(), d = B();
64
+ var w = p.Pop, x = f(), h = x[0], m = x[1], L = B(), d = B();
65
65
  h == null && (h = 0, i.replaceState($({}, i.state, {
66
66
  idx: h
67
67
  }), ""));
68
- function O(t) {
69
- return typeof t == "string" ? t : K(t);
68
+ function O(e) {
69
+ return typeof e == "string" ? e : K(e);
70
70
  }
71
- function S(t, e) {
72
- return e === void 0 && (e = null), A($({
73
- pathname: g.pathname,
71
+ function S(e, t) {
72
+ return t === void 0 && (t = null), A($({
73
+ pathname: m.pathname,
74
74
  hash: "",
75
75
  search: ""
76
- }, typeof t == "string" ? Q(t) : t, {
77
- state: e,
76
+ }, typeof e == "string" ? Q(e) : e, {
77
+ state: t,
78
78
  key: C()
79
79
  }));
80
80
  }
81
- function _(t, e) {
81
+ function _(e, t) {
82
82
  return [{
83
- usr: t.state,
84
- key: t.key,
85
- idx: e
86
- }, O(t)];
83
+ usr: e.state,
84
+ key: e.key,
85
+ idx: t
86
+ }, O(e)];
87
87
  }
88
- function M(t, e, c) {
88
+ function M(e, t, c) {
89
89
  return !d.length || (d.call({
90
- action: t,
91
- location: e,
90
+ action: e,
91
+ location: t,
92
92
  retry: c
93
93
  }), !1);
94
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
95
+ function b(e) {
96
+ w = e;
97
+ var t = f();
98
+ h = t[0], m = t[1], L.call({
99
+ action: w,
100
+ location: m
101
101
  });
102
102
  }
103
- function T(t, e) {
104
- var c = p.Push, l = S(t, e);
103
+ function T(e, t) {
104
+ var c = p.Push, l = S(e, t);
105
105
  function u() {
106
- T(t, e);
106
+ T(e, t);
107
107
  }
108
108
  if (M(c, l, u)) {
109
- var v = _(l, h + 1), E = v[0], w = v[1];
109
+ var v = _(l, h + 1), P = v[0], g = v[1];
110
110
  try {
111
- i.pushState(E, "", w);
111
+ i.pushState(P, "", g);
112
112
  } catch {
113
- r.location.assign(w);
113
+ r.location.assign(g);
114
114
  }
115
115
  b(c);
116
116
  }
117
117
  }
118
- function N(t, e) {
119
- var c = p.Replace, l = S(t, e);
118
+ function N(e, t) {
119
+ var c = p.Replace, l = S(e, t);
120
120
  function u() {
121
- N(t, e);
121
+ N(e, t);
122
122
  }
123
123
  if (M(c, l, u)) {
124
- var v = _(l, h), E = v[0], w = v[1];
125
- i.replaceState(E, "", w), b(c);
124
+ var v = _(l, h), P = v[0], g = v[1];
125
+ i.replaceState(P, "", g), b(c);
126
126
  }
127
127
  }
128
- function y(t) {
129
- i.go(t);
128
+ function y(e) {
129
+ i.go(e);
130
130
  }
131
131
  var R = {
132
132
  get action() {
133
- return m;
133
+ return w;
134
134
  },
135
135
  get location() {
136
- return g;
136
+ return m;
137
137
  },
138
138
  createHref: O,
139
139
  push: T,
@@ -145,11 +145,11 @@ function z(n) {
145
145
  forward: function() {
146
146
  y(1);
147
147
  },
148
- listen: function(e) {
149
- return x.push(e);
148
+ listen: function(t) {
149
+ return L.push(t);
150
150
  },
151
- block: function(e) {
152
- var c = d.push(e);
151
+ block: function(t) {
152
+ var c = d.push(t);
153
153
  return d.length === 1 && r.addEventListener(H, V), function() {
154
154
  c(), d.length || r.removeEventListener(H, V);
155
155
  };
@@ -198,7 +198,7 @@ function Q(n) {
198
198
  return o;
199
199
  }
200
200
  function J(n) {
201
- const [o, a] = P(!1);
201
+ const [o, a] = E(!1);
202
202
  return k(() => {
203
203
  const r = window.matchMedia(n);
204
204
  a(r.matches);
@@ -209,19 +209,22 @@ function J(n) {
209
209
  }, [n]), o;
210
210
  }
211
211
  function W() {
212
- const [n, o] = P(!1);
212
+ const [n, o] = E(!1);
213
213
  return k(() => {
214
214
  o(!0);
215
215
  }, []), n;
216
216
  }
217
217
  function X() {
218
- const [n, o] = P();
219
- return k(() => z().listen(({ location: r }) => {
220
- o(r);
221
- }), []), n;
218
+ const [n, o] = E("");
219
+ return k(() => {
220
+ const a = z();
221
+ return o(a.location.pathname), a.listen(({ location: r }) => {
222
+ o(r.pathname);
223
+ });
224
+ }, []), n;
222
225
  }
223
226
  export {
224
- X as useLocation,
225
227
  J as useMediaQuery,
226
- W as useMounted
228
+ W as useMounted,
229
+ X as usePathname
227
230
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "highsoft-ui",
3
- "version": "1.0.24",
3
+ "version": "1.0.27",
4
4
  "description": "Highsoft UI",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",