@memobit/libs 3.11.2 → 3.12.0

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.
Files changed (38) hide show
  1. package/dist/components/Confetti/Confetti2.js +33 -33
  2. package/dist/components/ContextToast/ContextToast2.js +53 -57
  3. package/dist/components/ContextToast/useToast.js +12 -0
  4. package/dist/components/ControlPanel/ControlPanel2.js +41 -43
  5. package/dist/components/ControlPanel/ControlPanelContext.js +16 -21
  6. package/dist/components/ControlPanel/useControlPanel.js +11 -0
  7. package/dist/components/DataView/DataView.CardView.js +83 -109
  8. package/dist/components/DataView/DataView.MiniSort.js +1 -1
  9. package/dist/components/DataView/DataView.helpers.js +34 -0
  10. package/dist/components/DataView/DataView2.js +111 -108
  11. package/dist/components/Dropdown/Dropdown2.js +108 -106
  12. package/dist/components/InputEmail/InputEmail2.js +43 -43
  13. package/dist/components/InputEmail/validateEmail.js +7 -0
  14. package/dist/components/InputMask/InputMask2.js +40 -54
  15. package/dist/components/InputMask/InputMaskPresets.js +18 -0
  16. package/dist/components/Pagination/Pagination2.js +4 -4
  17. package/dist/components/QuickOptionUpdate/QuickOptionUpdate2.js +29 -28
  18. package/dist/components/Sidebar/Sidebar2.js +1 -1
  19. package/dist/components/Sidebar/SidebarContext.js +18 -23
  20. package/dist/components/Sidebar/useSidebar.js +11 -0
  21. package/dist/components/SuggestionsList/SuggestionsList2.js +27 -27
  22. package/dist/components/TimelineMarkers/TimelineMarkers2.js +31 -49
  23. package/dist/components/TimelineMarkers/calculateTimelineMarkers.js +28 -0
  24. package/dist/components/Toolbar/Toolbar2.js +6 -6
  25. package/dist/components/Tooltip/Tooltip2.js +35 -35
  26. package/dist/contexts/AuthContext/AuthContext.context.js +5 -0
  27. package/dist/contexts/AuthContext/AuthContext.js +59 -63
  28. package/dist/helpers/AppPersistenceStorage.js +25 -15
  29. package/dist/helpers/Http.js +76 -48
  30. package/dist/helpers/VersionInfo.js +1 -1
  31. package/dist/hooks/useAppPersistence.js +20 -20
  32. package/dist/hooks/useAuth/useAuth.js +1 -1
  33. package/dist/http.d.ts +4 -0
  34. package/dist/index.d.ts +13 -1
  35. package/dist/index.js +270 -262
  36. package/dist/version.js +2 -2
  37. package/dist/version.json +4 -4
  38. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import './InputMask.css';
2
2
  /* empty css */
3
3
  import A, { forwardRef as U, useCallback as W, useId as X, useImperativeHandle as Y, useRef as O, useState as C } from "react";
4
- import { jsx as m, jsxs as M } from "react/jsx-runtime";
4
+ import { jsx as m, jsxs as N } from "react/jsx-runtime";
5
5
  var D = {
6
6
  9: /\d/,
7
7
  a: /[a-zA-Z]/,
@@ -25,80 +25,80 @@ function te(e) {
25
25
  }), t++);
26
26
  return n;
27
27
  }
28
- function N(e, n, t) {
29
- let u = 0, c = "", p = "";
30
- for (const d of n) if (d.type === "literal") c += d.char;
31
- else if (u < e.length) {
32
- const r = e[u];
33
- c += r, p += r, u++;
34
- } else c += t;
28
+ function v(e, n, t) {
29
+ let r = 0, u = "", p = "";
30
+ for (const f of n) if (f.type === "literal") u += f.char;
31
+ else if (r < e.length) {
32
+ const c = e[r];
33
+ u += c, p += c, r++;
34
+ } else u += t;
35
35
  return {
36
- masked: c,
36
+ masked: u,
37
37
  rawAccepted: p
38
38
  };
39
39
  }
40
40
  function ne(e) {
41
41
  return e.filter((n) => n.type === "token").length;
42
42
  }
43
- var se = U(({ mask: e, value: n, onChange: t, onComplete: u, placeholder: c, label: p, hint: d, error: r, highlighted: S, size: $ = "md", variant: b = "default", disabled: h = !1, readOnly: k = !1, maskChar: l = "_", mono: B = !0, icon: y, suffix: g, className: V = "", id: z, name: E, autoComplete: F }, P) => {
44
- const i = A.useMemo(() => te(e), [e]), f = A.useMemo(() => ne(i), [i]), T = X(), x = z ?? T, [a, w] = C(() => n !== void 0 ? n : ""), I = O(null);
45
- Y(P, () => ({
43
+ var se = U(({ mask: e, value: n, onChange: t, onComplete: r, placeholder: u, label: p, hint: f, error: c, highlighted: S, size: $ = "md", variant: B = "default", disabled: h = !1, readOnly: k = !1, maskChar: a = "_", mono: V = !0, icon: y, suffix: g, className: z = "", id: E, name: F, autoComplete: T }, Z) => {
44
+ const i = A.useMemo(() => te(e), [e]), d = A.useMemo(() => ne(i), [i]), b = X(), x = E ?? b, [l, w] = C(() => n !== void 0 ? n : ""), I = O(null);
45
+ Y(Z, () => ({
46
46
  focus: () => I.current?.focus(),
47
47
  clear: () => {
48
48
  w(""), t?.("", "");
49
49
  },
50
- getRawValue: () => a
50
+ getRawValue: () => l
51
51
  }));
52
- const { masked: v } = N(a, i, l), Z = v.includes(l) ? v.replace(new RegExp(l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), l) : v, H = r ? "danger" : b, L = [
52
+ const { masked: M } = v(l, i, a), H = M.includes(a) ? M.replace(new RegExp(a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), a) : M, L = c ? "danger" : B, P = [
53
53
  "input-mask",
54
54
  `input-mask--${$}`,
55
- `input-mask--${H}`,
55
+ `input-mask--${L}`,
56
56
  S ? "input-mask--highlighted" : "",
57
57
  h ? "input-mask--disabled" : "",
58
58
  k ? "input-mask--readonly" : "",
59
- B ? "input-mask--mono" : "",
59
+ V ? "input-mask--mono" : "",
60
60
  y ? "input-mask--has-icon" : "",
61
61
  g ? "input-mask--has-suffix" : "",
62
- V
62
+ z
63
63
  ].filter(Boolean).join(" "), q = W((s) => {
64
64
  if (h || k) return;
65
65
  if (s.key === "Backspace") {
66
66
  s.preventDefault();
67
- const o = a.slice(0, -1), { masked: Q } = N(o, i, l);
67
+ const o = l.slice(0, -1), { masked: Q } = v(o, i, a);
68
68
  w(o), t?.(o, Q);
69
69
  return;
70
70
  }
71
- if (s.key.length !== 1 || s.ctrlKey || s.metaKey || (s.preventDefault(), a.length >= f)) return;
71
+ if (s.key.length !== 1 || s.ctrlKey || s.metaKey || (s.preventDefault(), l.length >= d)) return;
72
72
  const R = s.key;
73
73
  let K = 0;
74
74
  for (const o of i) if (o.type === "token") {
75
- if (K === a.length) {
75
+ if (K === l.length) {
76
76
  if (!D[o.key].test(R)) return;
77
77
  break;
78
78
  }
79
79
  K++;
80
80
  }
81
- const { masked: j, rawAccepted: _ } = N(a + R, i, l);
82
- w(_), t?.(_, j), _.length === f && u?.(_, j);
81
+ const { masked: j, rawAccepted: _ } = v(l + R, i, a);
82
+ w(_), t?.(_, j), _.length === d && r?.(_, j);
83
83
  }, [
84
84
  h,
85
85
  k,
86
- a,
87
- i,
88
86
  l,
89
- f,
87
+ i,
88
+ a,
89
+ d,
90
90
  t,
91
- u
92
- ]), G = c ?? i.map((s) => s.type === "literal" ? s.char : l).join(""), J = a.length === f;
93
- return /* @__PURE__ */ M("div", {
94
- className: L,
91
+ r
92
+ ]), G = u ?? i.map((s) => s.type === "literal" ? s.char : a).join(""), J = l.length === d;
93
+ return /* @__PURE__ */ N("div", {
94
+ className: P,
95
95
  children: [
96
96
  p && /* @__PURE__ */ m("label", {
97
97
  className: "input-mask__label",
98
98
  htmlFor: x,
99
99
  children: p
100
100
  }),
101
- /* @__PURE__ */ M("div", {
101
+ /* @__PURE__ */ N("div", {
102
102
  className: "input-mask__field",
103
103
  children: [
104
104
  y && /* @__PURE__ */ m("span", {
@@ -108,12 +108,12 @@ var se = U(({ mask: e, value: n, onChange: t, onComplete: u, placeholder: c, lab
108
108
  /* @__PURE__ */ m("input", {
109
109
  ref: I,
110
110
  id: x,
111
- name: E,
111
+ name: F,
112
112
  type: "text",
113
113
  inputMode: "text",
114
- autoComplete: F,
114
+ autoComplete: T,
115
115
  className: ["input-mask__input", J ? "input-mask__input--filled" : ""].filter(Boolean).join(" "),
116
- value: Z,
116
+ value: H,
117
117
  placeholder: G,
118
118
  disabled: h,
119
119
  readOnly: k,
@@ -122,12 +122,12 @@ var se = U(({ mask: e, value: n, onChange: t, onComplete: u, placeholder: c, lab
122
122
  },
123
123
  onKeyDown: q
124
124
  }),
125
- /* @__PURE__ */ M("span", {
125
+ /* @__PURE__ */ N("span", {
126
126
  className: "input-mask__counter",
127
127
  children: [
128
- a.length,
128
+ l.length,
129
129
  "/",
130
- f
130
+ d
131
131
  ]
132
132
  }),
133
133
  g && /* @__PURE__ */ m("span", {
@@ -136,28 +136,14 @@ var se = U(({ mask: e, value: n, onChange: t, onComplete: u, placeholder: c, lab
136
136
  })
137
137
  ]
138
138
  }),
139
- (d || r) && /* @__PURE__ */ m("p", {
140
- className: r ? "input-mask__error" : "input-mask__hint",
141
- children: r ?? d
139
+ (f || c) && /* @__PURE__ */ m("p", {
140
+ className: c ? "input-mask__error" : "input-mask__hint",
141
+ children: c ?? f
142
142
  })
143
143
  ]
144
144
  });
145
145
  });
146
146
  se.displayName = "InputMask";
147
- var re = {
148
- creditCard: "9999 9999 9999 9999",
149
- iban: "aa99 9999 9999 9999 9999 99",
150
- cvv: "999",
151
- expiry: "99/99",
152
- phone: "+99 (999) 999-9999",
153
- ssn: "999-99-9999",
154
- ipv4: "999.999.999.999",
155
- serialNumber: "***-***-***-***",
156
- date: "99/99/9999",
157
- time: "99:99",
158
- uuid: "********-****-****-****-************"
159
- };
160
147
  export {
161
- se as InputMask,
162
- re as InputMaskPresets
148
+ se as InputMask
163
149
  };
@@ -0,0 +1,18 @@
1
+ import './InputMask.css';
2
+ /* empty css */
3
+ var r = {
4
+ creditCard: "9999 9999 9999 9999",
5
+ iban: "aa99 9999 9999 9999 9999 99",
6
+ cvv: "999",
7
+ expiry: "99/99",
8
+ phone: "+99 (999) 999-9999",
9
+ ssn: "999-99-9999",
10
+ ipv4: "999.999.999.999",
11
+ serialNumber: "***-***-***-***",
12
+ date: "99/99/9999",
13
+ time: "99:99",
14
+ uuid: "********-****-****-****-************"
15
+ };
16
+ export {
17
+ r as InputMaskPresets
18
+ };
@@ -1,12 +1,12 @@
1
1
  import './Pagination.css';
2
2
  import { Button as u } from "../Button/Button2.js";
3
- import { useBreakpoint as E } from "../../hooks/useBreakpoint.js";
4
- import { Dropdown as y } from "../Dropdown/Dropdown2.js";
3
+ import { Dropdown as E } from "../Dropdown/Dropdown2.js";
4
+ import { useBreakpoint as y } from "../../hooks/useBreakpoint.js";
5
5
  /* empty css */
6
6
  import { useCallback as L, useEffect as R, useRef as I, useState as O } from "react";
7
7
  import { jsx as t, jsxs as c } from "react/jsx-runtime";
8
8
  var V = 120, j = 45, C = 8, H = 4, z = ({ currentPage: i, totalPages: r, totalItems: p, onPageChange: d, showPagesNumbers: N = !1, pageSizeOptions: o, pageSize: m, onPageSizeChange: v, pageSizeLabel: x = "Rows", horizontalAlign: D = "left" }) => {
9
- const { isAtLeast: a, isMobile: k } = E(), f = I(null), [l, w] = O(k ? 0 : 2), h = L(() => {
9
+ const { isAtLeast: a, isMobile: k } = y(), f = I(null), [l, w] = O(k ? 0 : 2), h = L(() => {
10
10
  const s = f.current, e = s?.parentElement;
11
11
  if (!s || !e) return;
12
12
  let n = 0;
@@ -64,7 +64,7 @@ var V = 120, j = 45, C = 8, H = 4, z = ({ currentPage: i, totalPages: r, totalIt
64
64
  }),
65
65
  b && M && /* @__PURE__ */ c("div", {
66
66
  className: "pagination__page-size",
67
- children: [/* @__PURE__ */ t("span", { children: x }), /* @__PURE__ */ t(y, {
67
+ children: [/* @__PURE__ */ t("span", { children: x }), /* @__PURE__ */ t(E, {
68
68
  name: "pageSize",
69
69
  options: M,
70
70
  value: m,
@@ -2,34 +2,35 @@ import './QuickOptionUpdate.css';
2
2
  import { Modal as x } from "../Modal/Modal2.js";
3
3
  import { Radio as C } from "../Radio/Radio2.js";
4
4
  /* empty css */
5
- import { useEffect as S, useState as o } from "react";
6
- import { jsx as r, jsxs as b } from "react/jsx-runtime";
7
- var O = ({ isOpen: p = !1, list: c, title: f, onClose: t, onSave: u, icon: h, value: s }) => {
8
- const [a, l] = o(s), [i, d] = o(!1), [m, n] = o("");
5
+ import { useEffect as S, useState as n } from "react";
6
+ import { jsx as a, jsxs as b } from "react/jsx-runtime";
7
+ import { logger as q } from "@memobit/core";
8
+ var U = ({ isOpen: m = !1, list: c, title: f, onClose: t, onSave: u, icon: v, value: i }) => {
9
+ const [r, l] = n(i), [s, d] = n(!1), [p, o] = n("");
9
10
  S(() => {
10
- l(s);
11
- }, [s]);
12
- const v = async () => {
13
- if (!a) {
14
- n("Please select a value");
11
+ l(i);
12
+ }, [i]);
13
+ const g = async () => {
14
+ if (!r) {
15
+ o("Please select a value");
15
16
  return;
16
17
  }
17
- d(!0), n("");
18
+ d(!0), o("");
18
19
  try {
19
- await u(a);
20
+ await u(r);
20
21
  } catch (e) {
21
- n(e instanceof Error ? e.message : "Failed to save");
22
+ o(e instanceof Error ? e.message : "Failed to save");
22
23
  } finally {
23
24
  d(!1);
24
25
  }
25
- }, g = (e) => {
26
- typeof e == "string" || typeof e == "number" ? l(e) : console.error("Unsupported type used.");
26
+ }, h = (e) => {
27
+ typeof e == "string" || typeof e == "number" ? l(e) : q.error("QuickOptionUpdate received an unsupported value type", void 0, { type: typeof e });
27
28
  };
28
- return /* @__PURE__ */ r("div", {
29
+ return /* @__PURE__ */ a("div", {
29
30
  className: "quick-set",
30
31
  children: /* @__PURE__ */ b(x, {
31
- isOpen: p,
32
- titleIcon: h,
32
+ isOpen: m,
33
+ titleIcon: v,
33
34
  title: f,
34
35
  size: "small",
35
36
  onClose: t,
@@ -37,31 +38,31 @@ var O = ({ isOpen: p = !1, list: c, title: f, onClose: t, onSave: u, icon: h, va
37
38
  secondary: {
38
39
  text: "Cancel",
39
40
  variant: "default",
40
- disabled: i,
41
+ disabled: s,
41
42
  onClick: t
42
43
  },
43
44
  primary: {
44
- text: i ? "Saving..." : "Save",
45
+ text: s ? "Saving..." : "Save",
45
46
  variant: "success",
46
- disabled: i || !a,
47
- onClick: v
47
+ disabled: s || !r,
48
+ onClick: g
48
49
  },
49
- children: [/* @__PURE__ */ r("div", {
50
+ children: [/* @__PURE__ */ a("div", {
50
51
  className: "quick-set-list",
51
- children: c && c.map(({ key: e, label: k }) => /* @__PURE__ */ r(C, {
52
+ children: c && c.map(({ key: e, label: k }) => /* @__PURE__ */ a(C, {
52
53
  name: "ownership",
53
54
  label: k,
54
- checked: a === e,
55
+ checked: r === e,
55
56
  value: e,
56
- onChange: (y) => g(y)
57
+ onChange: (y) => h(y)
57
58
  }, `quick-update-ownership-${e}`))
58
- }), m && /* @__PURE__ */ r("div", {
59
+ }), p && /* @__PURE__ */ a("div", {
59
60
  className: "error-message",
60
- children: m
61
+ children: p
61
62
  })]
62
63
  })
63
64
  });
64
65
  };
65
66
  export {
66
- O as QuickOptionUpdate
67
+ U as QuickOptionUpdate
67
68
  };
@@ -3,7 +3,7 @@ import { Icon as N } from "../Icon/Icon2.js";
3
3
  import { Tooltip as M } from "../Tooltip/Tooltip2.js";
4
4
  import { AppHeader as O } from "../AppHeader/AppHeader2.js";
5
5
  import { InputSearch as A } from "../InputSearch/InputSearch2.js";
6
- import { useSidebarContext as F } from "./SidebarContext.js";
6
+ import { useSidebarContext as F } from "./useSidebar.js";
7
7
  /* empty css */
8
8
  import { useState as I } from "react";
9
9
  import { Fragment as Q, jsx as a, jsxs as i } from "react/jsx-runtime";
@@ -1,31 +1,26 @@
1
- import { useBreakpoint as l } from "../../hooks/useBreakpoint.js";
2
- import { createContext as b, useCallback as t, useContext as m, useMemo as p, useState as v } from "react";
3
- import { jsx as x } from "react/jsx-runtime";
4
- var u = b(null), S = () => m(u), g = () => {
5
- const e = S();
6
- if (!e) throw new Error("useSidebar must be used within a SidebarProvider");
7
- return e;
8
- }, h = ({ children: e }) => {
9
- const { isMobile: o } = l(), [s, r] = v(!1), n = t(() => r((d) => !d), []), a = t(() => r(!0), []), i = t(() => r(!1), []), c = p(() => ({
10
- isMobile: o,
11
- isOpen: s,
12
- toggle: n,
13
- open: a,
14
- close: i
1
+ import { useBreakpoint as p } from "../../hooks/useBreakpoint.js";
2
+ import { SidebarContext as l } from "./useSidebar.js";
3
+ import { useCallback as o, useMemo as u, useState as f } from "react";
4
+ import { jsx as b } from "react/jsx-runtime";
5
+ var k = ({ children: a }) => {
6
+ const { isMobile: t } = p(), [r, e] = f(!1), s = o(() => e((m) => !m), []), i = o(() => e(!0), []), n = o(() => e(!1), []), c = u(() => ({
7
+ isMobile: t,
8
+ isOpen: r,
9
+ toggle: s,
10
+ open: i,
11
+ close: n
15
12
  }), [
16
- o,
13
+ t,
14
+ r,
17
15
  s,
18
- n,
19
- a,
20
- i
16
+ i,
17
+ n
21
18
  ]);
22
- return /* @__PURE__ */ x(u.Provider, {
19
+ return /* @__PURE__ */ b(l.Provider, {
23
20
  value: c,
24
- children: e
21
+ children: a
25
22
  });
26
23
  };
27
24
  export {
28
- h as SidebarProvider,
29
- g as useSidebar,
30
- S as useSidebarContext
25
+ k as SidebarProvider
31
26
  };
@@ -0,0 +1,11 @@
1
+ import { createContext as r, useContext as t } from "react";
2
+ var o = r(null), a = () => t(o), n = () => {
3
+ const e = a();
4
+ if (!e) throw new Error("useSidebar must be used within a SidebarProvider");
5
+ return e;
6
+ };
7
+ export {
8
+ o as SidebarContext,
9
+ n as useSidebar,
10
+ a as useSidebarContext
11
+ };
@@ -1,20 +1,20 @@
1
1
  import './SuggestionsList.css';
2
- import { Icon as j } from "../Icon/Icon2.js";
3
- import { Button as T } from "../Button/Button2.js";
4
- import { Tooltip as B } from "../Tooltip/Tooltip2.js";
5
- import { InputSearch as H } from "../InputSearch/InputSearch2.js";
6
- import { format2Digits as q } from "../../helpers/Numbers.js";
2
+ import { Icon as T } from "../Icon/Icon2.js";
3
+ import { Button as B } from "../Button/Button2.js";
4
+ import { Tooltip as H } from "../Tooltip/Tooltip2.js";
5
+ import { InputSearch as q } from "../InputSearch/InputSearch2.js";
6
+ import { format2Digits as z } from "../../helpers/Numbers.js";
7
7
  /* empty css */
8
- import { useCallback as z, useMemo as h, useState as g } from "react";
8
+ import { useCallback as V, useMemo as h, useState as g } from "react";
9
9
  import { jsx as e, jsxs as t } from "react/jsx-runtime";
10
- function V({ state: n }) {
10
+ function k({ state: n }) {
11
11
  return /* @__PURE__ */ e("span", {
12
12
  className: `suggestions-list__sort-icon suggestions-list__sort-icon--${n}`,
13
- children: /* @__PURE__ */ e(j, { name: n === "asc" ? "arrow-up" : n === "desc" ? "arrow-down" : "arrow-bidirectional-vertical" })
13
+ children: /* @__PURE__ */ e(T, { name: n === "asc" ? "arrow-up" : n === "desc" ? "arrow-down" : "arrow-bidirectional-vertical" })
14
14
  });
15
15
  }
16
- var k = 10, W = ({ data: n, label: I, title: N, tooltip: w, enableSearch: y = !1, onRowClick: o }) => {
17
- const [d, x] = g(!1), [r, M] = g(!1), [c, _] = g(""), [i, E] = g(null), [u, D] = g("asc"), p = h(() => c.trim() ? n.filter((s) => s.name.toLowerCase().includes(c.toLowerCase())) : n, [n, c]), m = h(() => {
16
+ var I = 10, W = ({ data: n, label: x, title: N, tooltip: w, enableSearch: y = !1, onRowClick: o }) => {
17
+ const [d, M] = g(!1), [r, _] = g(!1), [c, E] = g(""), [i, K] = g(null), [u, D] = g("asc"), p = h(() => c.trim() ? n.filter((s) => s.name.toLowerCase().includes(c.toLowerCase())) : n, [n, c]), m = h(() => {
18
18
  if (!i) return p;
19
19
  const s = [...p].sort((l, a) => {
20
20
  const S = i === "name" ? l.name : l.value, b = i === "name" ? a.name : a.value;
@@ -25,24 +25,24 @@ var k = 10, W = ({ data: n, label: I, title: N, tooltip: w, enableSearch: y = !1
25
25
  p,
26
26
  i,
27
27
  u
28
- ]), v = h(() => r ? [...m] : m.slice(0, k), [m, r]), C = m.length > k, K = () => {
29
- x(!d);
30
- }, L = z(() => {
31
- M(!r);
32
- }, [r]), f = (s) => {
33
- i === s ? D((l) => l === "asc" ? "desc" : "asc") : (E(s), D("asc"));
34
- }, $ = h(() => /* @__PURE__ */ t("div", {
28
+ ]), v = h(() => r ? [...m] : m.slice(0, I), [m, r]), C = m.length > I, $ = () => {
29
+ M(!d);
30
+ }, L = V(() => {
31
+ _(!r);
32
+ }, [r]), f = V((s) => {
33
+ i === s ? D((l) => l === "asc" ? "desc" : "asc") : (K(s), D("asc"));
34
+ }, [i]), j = h(() => /* @__PURE__ */ t("div", {
35
35
  className: "list-suggestions-list",
36
36
  children: [
37
- /* @__PURE__ */ e(B, {
37
+ /* @__PURE__ */ e(H, {
38
38
  title: w,
39
39
  children: /* @__PURE__ */ e("legend", { children: N || "Suggestions" })
40
40
  }),
41
41
  y && /* @__PURE__ */ e("div", {
42
42
  className: "list-suggestions-list-search",
43
- children: /* @__PURE__ */ e(H, {
43
+ children: /* @__PURE__ */ e(q, {
44
44
  value: c,
45
- onChange: _,
45
+ onChange: E,
46
46
  placeholder: "Search suggestions..."
47
47
  })
48
48
  }),
@@ -55,12 +55,12 @@ var k = 10, W = ({ data: n, label: I, title: N, tooltip: w, enableSearch: y = !1
55
55
  type: "button",
56
56
  className: "list-suggestions-list-header-cell list-suggestions-list-header-cell--name",
57
57
  onClick: () => f("name"),
58
- children: ["Name", /* @__PURE__ */ e(V, { state: i === "name" ? u : "unsorted" })]
58
+ children: ["Name", /* @__PURE__ */ e(k, { state: i === "name" ? u : "unsorted" })]
59
59
  }), /* @__PURE__ */ t("button", {
60
60
  type: "button",
61
61
  className: "list-suggestions-list-header-cell list-suggestions-list-header-cell--value",
62
62
  onClick: () => f("value"),
63
- children: ["Value", /* @__PURE__ */ e(V, { state: i === "value" ? u : "unsorted" })]
63
+ children: ["Value", /* @__PURE__ */ e(k, { state: i === "value" ? u : "unsorted" })]
64
64
  })]
65
65
  }),
66
66
  v.map((s, l) => /* @__PURE__ */ t("div", {
@@ -71,7 +71,7 @@ var k = 10, W = ({ data: n, label: I, title: N, tooltip: w, enableSearch: y = !1
71
71
  o && (a.key === "Enter" || a.key === " ") && (a.preventDefault(), o(s));
72
72
  },
73
73
  children: [/* @__PURE__ */ e("div", { children: s.name }), /* @__PURE__ */ t("div", { children: [
74
- typeof s.value == "number" && q(s.value),
74
+ typeof s.value == "number" && z(s.value),
75
75
  typeof s.value == "string" && s.value,
76
76
  s.unit
77
77
  ] })]
@@ -104,16 +104,16 @@ var k = 10, W = ({ data: n, label: I, title: N, tooltip: w, enableSearch: y = !1
104
104
  ]);
105
105
  return /* @__PURE__ */ t("div", {
106
106
  className: "suggestions-list",
107
- children: [/* @__PURE__ */ e("div", { children: /* @__PURE__ */ t(T, {
107
+ children: [/* @__PURE__ */ e("div", { children: /* @__PURE__ */ t(B, {
108
108
  icon: d ? "caret-up" : "caret-down",
109
- onClick: K,
109
+ onClick: $,
110
110
  children: [
111
111
  d ? "Hide" : "Show",
112
112
  " ",
113
- I,
113
+ x,
114
114
  " suggestions"
115
115
  ]
116
- }) }), d && $]
116
+ }) }), d && j]
117
117
  });
118
118
  };
119
119
  export {
@@ -1,73 +1,55 @@
1
1
  import './TimelineMarkers.css';
2
2
  /* empty css */
3
- import { useMemo as h } from "react";
4
- import { jsx as t, jsxs as m } from "react/jsx-runtime";
5
- var u = (e) => {
6
- const [a, r, l] = e.split("-").map(Number);
7
- return new Date(a, r - 1, l);
8
- }, p = (e, a) => a === "month" ? e.toLocaleDateString("en-US", { month: "long" }) : e.toLocaleDateString("en-US", {
9
- day: "2-digit",
10
- month: "short"
11
- }), v = (e, a) => a === "month" ? `${e.getFullYear()}-${e.getMonth()}` : `${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`, b = (e) => e.getFullYear().toString(), g = (e, a = "day") => {
12
- const r = /* @__PURE__ */ new Map();
13
- let l = null, i = null;
14
- return e.forEach((o, n) => {
15
- const s = u(o.date), c = b(s), _ = v(s, a), d = c !== l, k = _ !== i;
16
- r.set(n, {
17
- showYear: d,
18
- showDate: k,
19
- yearLabel: d ? s.getFullYear().toString() : "",
20
- dateLabel: k ? p(s, a) : ""
21
- }), l = c, i = _;
22
- }), r;
23
- }, f = ({ marker: e, onClick: a }) => {
24
- const r = (l) => {
25
- l.stopPropagation(), a?.(l);
3
+ import { calculateTimelineMarkers as _ } from "./calculateTimelineMarkers.js";
4
+ import { useMemo as d } from "react";
5
+ import { jsx as r, jsxs as l } from "react/jsx-runtime";
6
+ var p = ({ marker: e, onClick: m }) => {
7
+ const a = (i) => {
8
+ i.stopPropagation(), m?.(i);
26
9
  };
27
- return e.showYear ? /* @__PURE__ */ m("div", {
10
+ return e.showYear ? /* @__PURE__ */ l("div", {
28
11
  className: "timeline-markers__marker timeline-markers__marker--year",
29
- onClick: r,
30
- children: [/* @__PURE__ */ m("div", {
12
+ onClick: a,
13
+ children: [/* @__PURE__ */ l("div", {
31
14
  className: "timeline-markers__labels",
32
- children: [/* @__PURE__ */ t("span", {
15
+ children: [/* @__PURE__ */ r("span", {
33
16
  className: "timeline-markers__label timeline-markers__label--year",
34
17
  children: e.yearLabel
35
- }), /* @__PURE__ */ t("span", {
18
+ }), /* @__PURE__ */ r("span", {
36
19
  className: "timeline-markers__label timeline-markers__label--date",
37
20
  children: e.dateLabel
38
21
  })]
39
- }), /* @__PURE__ */ t("div", { className: "timeline-markers__dot timeline-markers__dot--year" })]
40
- }) : e.showDate ? /* @__PURE__ */ m("div", {
22
+ }), /* @__PURE__ */ r("div", { className: "timeline-markers__dot timeline-markers__dot--year" })]
23
+ }) : e.showDate ? /* @__PURE__ */ l("div", {
41
24
  className: "timeline-markers__marker timeline-markers__marker--date",
42
- onClick: r,
43
- children: [/* @__PURE__ */ t("span", {
25
+ onClick: a,
26
+ children: [/* @__PURE__ */ r("span", {
44
27
  className: "timeline-markers__label timeline-markers__label--date",
45
28
  children: e.dateLabel
46
- }), /* @__PURE__ */ t("div", { className: "timeline-markers__dot timeline-markers__dot--date" })]
47
- }) : /* @__PURE__ */ t("div", {
29
+ }), /* @__PURE__ */ r("div", { className: "timeline-markers__dot timeline-markers__dot--date" })]
30
+ }) : /* @__PURE__ */ r("div", {
48
31
  className: "timeline-markers__marker timeline-markers__marker--empty",
49
- onClick: r,
50
- children: /* @__PURE__ */ t("div", { className: "timeline-markers__dot timeline-markers__dot--small" })
32
+ onClick: a,
33
+ children: /* @__PURE__ */ r("div", { className: "timeline-markers__dot timeline-markers__dot--small" })
51
34
  });
52
- }, L = ({ marker: e }) => !e.showYear && !e.showDate ? null : /* @__PURE__ */ t("div", {
35
+ }, b = ({ marker: e }) => !e.showYear && !e.showDate ? null : /* @__PURE__ */ r("div", {
53
36
  className: "timeline-markers__separator",
54
- children: /* @__PURE__ */ t("span", {
37
+ children: /* @__PURE__ */ r("span", {
55
38
  className: "timeline-markers__separator-label",
56
39
  children: e.showYear ? e.yearLabel : e.dateLabel
57
40
  })
58
- }), Y = ({ items: e, renderItem: a, className: r }) => {
59
- const l = h(() => g(e), [e]);
60
- return /* @__PURE__ */ m("div", {
61
- className: `timeline-markers${r ? ` ${r}` : ""}`,
62
- children: [/* @__PURE__ */ t("div", { className: "timeline-markers__track" }), e.map((i, o) => {
63
- const n = l.get(o);
64
- return n ? a(i, n) : null;
41
+ }), v = ({ items: e, renderItem: m, className: a }) => {
42
+ const i = d(() => _(e), [e]);
43
+ return /* @__PURE__ */ l("div", {
44
+ className: `timeline-markers${a ? ` ${a}` : ""}`,
45
+ children: [/* @__PURE__ */ r("div", { className: "timeline-markers__track" }), e.map((t, n) => {
46
+ const s = i.get(n);
47
+ return s ? m(t, s) : null;
65
48
  })]
66
49
  });
67
50
  };
68
51
  export {
69
- f as TimelineMarkerDot,
70
- Y as TimelineMarkers,
71
- L as TimelineMobileSeparator,
72
- g as calculateTimelineMarkers
52
+ p as TimelineMarkerDot,
53
+ v as TimelineMarkers,
54
+ b as TimelineMobileSeparator
73
55
  };
@@ -0,0 +1,28 @@
1
+ import './TimelineMarkers.css';
2
+ /* empty css */
3
+ var m = (e) => {
4
+ const [t, a, r] = e.split("-").map(Number);
5
+ return new Date(t, a - 1, r);
6
+ }, h = (e, t) => t === "month" ? e.toLocaleDateString("en-US", { month: "long" }) : e.toLocaleDateString("en-US", {
7
+ day: "2-digit",
8
+ month: "short"
9
+ }), y = (e, t) => t === "month" ? `${e.getFullYear()}-${e.getMonth()}` : `${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`, D = (e) => e.getFullYear().toString(), p = (e, t = "day") => {
10
+ const a = /* @__PURE__ */ new Map();
11
+ let r = null, o = null;
12
+ return e.forEach((i, u) => {
13
+ const n = m(i.date), l = D(n), s = y(n, t), g = l !== r, c = s !== o;
14
+ a.set(u, {
15
+ showYear: g,
16
+ showDate: c,
17
+ yearLabel: g ? n.getFullYear().toString() : "",
18
+ dateLabel: c ? h(n, t) : ""
19
+ }), r = l, o = s;
20
+ }), a;
21
+ };
22
+ export {
23
+ p as calculateTimelineMarkers,
24
+ h as formatTimelineDate,
25
+ y as getDateKey,
26
+ D as getYearKey,
27
+ m as parseLocalDate
28
+ };