@memobit/libs 3.11.2 → 3.11.3

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 (34) 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/Sidebar/Sidebar2.js +1 -1
  18. package/dist/components/Sidebar/SidebarContext.js +18 -23
  19. package/dist/components/Sidebar/useSidebar.js +11 -0
  20. package/dist/components/SuggestionsList/SuggestionsList2.js +27 -27
  21. package/dist/components/TimelineMarkers/TimelineMarkers2.js +31 -49
  22. package/dist/components/TimelineMarkers/calculateTimelineMarkers.js +28 -0
  23. package/dist/components/Toolbar/Toolbar2.js +6 -6
  24. package/dist/components/Tooltip/Tooltip2.js +35 -35
  25. package/dist/contexts/AuthContext/AuthContext.context.js +5 -0
  26. package/dist/contexts/AuthContext/AuthContext.js +5 -6
  27. package/dist/helpers/VersionInfo.js +1 -1
  28. package/dist/hooks/useAppPersistence.js +20 -20
  29. package/dist/hooks/useAuth/useAuth.js +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +269 -262
  32. package/dist/version.js +1 -1
  33. package/dist/version.json +4 -4
  34. package/package.json +1 -1
@@ -1,80 +1,58 @@
1
- import { Icon as v } from "../Icon/Icon2.js";
2
- import { Tooltip as O } from "../Tooltip/Tooltip2.js";
3
- import { Checkbox as z } from "../Checkbox/Checkbox2.js";
4
- import { EmptyState as L } from "../EmptyState/EmptyState2.js";
5
- import { TimelineMobileSeparator as Q, calculateTimelineMarkers as X } from "../TimelineMarkers/TimelineMarkers2.js";
6
- import Y, { useMemo as M } from "react";
7
- import { Fragment as R, jsx as a, jsxs as c } from "react/jsx-runtime";
8
- var la = [
9
- 15,
10
- 30,
11
- 50,
12
- 100,
13
- 250,
14
- 500
15
- ], oa = (t) => typeof t.header == "string" ? t.header : t.key, W = (t) => typeof t == "number" ? `${t}px` : t, aa = (t) => /* @__PURE__ */ c("span", {
16
- className: "data-view__column-label",
17
- children: [t.icon && /* @__PURE__ */ a(v, {
18
- className: "data-view__column-icon",
19
- name: t.icon,
20
- size: "sm",
21
- variant: "muted"
22
- }), /* @__PURE__ */ a("span", { children: t.header })]
23
- }), ea = (t, l) => {
24
- const h = t.cellIcon?.(l), n = t.accessor ? t.accessor(l) : l[t.key];
25
- return h ? /* @__PURE__ */ c("span", {
26
- className: "data-view__cell-with-icon",
27
- children: [/* @__PURE__ */ a(v, {
28
- className: "data-view__cell-icon",
29
- name: h
30
- }), /* @__PURE__ */ a("span", { children: n })]
31
- }) : n;
32
- };
33
- function _a({ data: t, columns: l, rowKey: h, card: n, actions: g, timeline: o, onRowClick: _, rowHref: j, rowClassName: D, empty: r, selectable: w, selectedIds: V = [], pinnedIds: $, onToggleSelect: p, cardMaxWidth: C, isMobile: G = !1, groups: I, showGroupCount: T = !0, collapsible: N = !1, collapsedGroups: U, onToggleGroup: Z }) {
34
- const P = l.filter((e) => !e.hideInCard && !(G && e.hideInMobile)), q = M(() => new Set($ ?? []), [$]), S = `data-view__cards${C !== void 0 ? " data-view__cards--grid" : ""}`, A = C !== void 0 ? { "--data-view-card-max-width": W(C) } : void 0, B = M(() => {
35
- if (!o) return /* @__PURE__ */ new Map();
36
- const e = t.map((s) => ({
37
- id: o.idAccessor(s),
38
- date: o.dateAccessor(s)
1
+ import { Icon as y } from "../Icon/Icon2.js";
2
+ import { Tooltip as U } from "../Tooltip/Tooltip2.js";
3
+ import { Checkbox as F } from "../Checkbox/Checkbox2.js";
4
+ import { EmptyState as M } from "../EmptyState/EmptyState2.js";
5
+ import { calculateTimelineMarkers as X } from "../TimelineMarkers/calculateTimelineMarkers.js";
6
+ import { TimelineMobileSeparator as Y } from "../TimelineMarkers/TimelineMarkers2.js";
7
+ import { renderCellContent as Z, renderColumnLabel as R } from "./DataView.helpers.js";
8
+ import W, { useMemo as j } from "react";
9
+ import { Fragment as aa, jsx as a, jsxs as c } from "react/jsx-runtime";
10
+ var ea = (n) => typeof n == "number" ? `${n}px` : n;
11
+ function ma({ data: n, columns: z, rowKey: V, card: s, actions: b, timeline: l, onRowClick: o, rowHref: D, rowClassName: E, empty: r, selectable: u, selectedIds: L = [], pinnedIds: k, onToggleSelect: _, cardMaxWidth: N, isMobile: q = !1, groups: g, showGroupCount: B = !0, collapsible: v = !1, collapsedGroups: G, onToggleGroup: H }) {
12
+ const $ = z.filter((e) => !e.hideInCard && !(q && e.hideInMobile)), J = j(() => new Set(k ?? []), [k]), I = `data-view__cards${N !== void 0 ? " data-view__cards--grid" : ""}`, P = N !== void 0 ? { "--data-view-card-max-width": ea(N) } : void 0, O = j(() => {
13
+ if (!l) return /* @__PURE__ */ new Map();
14
+ const e = n.map((i) => ({
15
+ id: l.idAccessor(i),
16
+ date: l.dateAccessor(i)
39
17
  }));
40
- return X(e, o.granularity);
41
- }, [t, o]);
42
- if (t.length === 0)
43
- return r ? /* @__PURE__ */ a(L, {
18
+ return X(e, l.granularity);
19
+ }, [n, l]);
20
+ if (n.length === 0)
21
+ return r ? /* @__PURE__ */ a(M, {
44
22
  title: r.title,
45
23
  description: r.description,
46
24
  icon: r.icon,
47
25
  primary: r.primary,
48
26
  secondary: r.secondary
49
- }) : /* @__PURE__ */ a(L, { title: "No data available" });
50
- const x = (e, s) => {
51
- const u = B.get(s), d = h(e, s), m = w && V.includes(d), f = q.has(d), y = j?.(e), H = !!_ || !!y, b = n?.accentColor?.(e), E = `data-view__card ${H ? "data-view__card--clickable" : ""} ${m ? "data-view__card--selected" : ""} ${f ? "data-view__card--pinned" : ""} ${b ? "data-view__card--accent" : ""} ${D?.(e) || ""}`, F = b ? { "--data-view-card-accent-color": b } : void 0, J = (i) => {
52
- i.metaKey || i.ctrlKey || i.shiftKey || i.altKey || i.button !== 0 || _ && (i.preventDefault(), _(e, i));
53
- }, K = /* @__PURE__ */ c(R, { children: [
54
- f && /* @__PURE__ */ a(O, {
27
+ }) : /* @__PURE__ */ a(M, { title: "No data available" });
28
+ const x = (e, i) => {
29
+ const h = O.get(i), d = V(e, i), m = u && L.includes(d), p = J.has(d), f = D?.(e), Q = !!o || !!f, w = s?.accentColor?.(e), K = `data-view__card ${Q ? "data-view__card--clickable" : ""} ${m ? "data-view__card--selected" : ""} ${p ? "data-view__card--pinned" : ""} ${w ? "data-view__card--accent" : ""} ${E?.(e) || ""}`, S = w ? { "--data-view-card-accent-color": w } : void 0, T = (t) => {
30
+ t.metaKey || t.ctrlKey || t.shiftKey || t.altKey || t.button !== 0 || o && (t.preventDefault(), o(e, t));
31
+ }, A = /* @__PURE__ */ c(aa, { children: [
32
+ p && /* @__PURE__ */ a(U, {
55
33
  title: "Pinned",
56
34
  children: /* @__PURE__ */ a("span", {
57
35
  className: "data-view__card-pin",
58
- children: /* @__PURE__ */ a(v, {
36
+ children: /* @__PURE__ */ a(y, {
59
37
  name: "pin",
60
38
  size: "sm"
61
39
  })
62
40
  })
63
41
  }),
64
- w && p && !n && /* @__PURE__ */ a("div", {
42
+ u && _ && !s && /* @__PURE__ */ a("div", {
65
43
  className: "data-view__card-select",
66
- onClick: (i) => i.stopPropagation(),
67
- children: /* @__PURE__ */ a(z, {
44
+ onClick: (t) => t.stopPropagation(),
45
+ children: /* @__PURE__ */ a(F, {
68
46
  checked: m || !1,
69
- onChange: (i) => p(d, i)
47
+ onChange: (t) => _(d, t)
70
48
  })
71
49
  }),
72
- n?.media && /* @__PURE__ */ a("div", {
50
+ s?.media && /* @__PURE__ */ a("div", {
73
51
  className: "data-view__card-media",
74
- children: n.media(e)
52
+ children: s.media(e)
75
53
  }),
76
- n && (() => {
77
- const i = n.icon?.(e);
54
+ s && (() => {
55
+ const t = s.icon?.(e);
78
56
  return /* @__PURE__ */ c("div", {
79
57
  className: "data-view__card-header",
80
58
  children: [/* @__PURE__ */ c("div", {
@@ -82,112 +60,108 @@ function _a({ data: t, columns: l, rowKey: h, card: n, actions: g, timeline: o,
82
60
  children: [/* @__PURE__ */ c("div", {
83
61
  className: "data-view__card-title-line",
84
62
  children: [
85
- w && p && /* @__PURE__ */ a("div", {
63
+ u && _ && /* @__PURE__ */ a("div", {
86
64
  className: "data-view__card-select",
87
- onClick: (k) => k.stopPropagation(),
88
- children: /* @__PURE__ */ a(z, {
65
+ onClick: (C) => C.stopPropagation(),
66
+ children: /* @__PURE__ */ a(F, {
89
67
  checked: m || !1,
90
- onChange: (k) => p(d, k)
68
+ onChange: (C) => _(d, C)
91
69
  })
92
70
  }),
93
- i && /* @__PURE__ */ a(v, {
71
+ t && /* @__PURE__ */ a(y, {
94
72
  className: "data-view__card-icon",
95
- name: i
73
+ name: t
96
74
  }),
97
75
  /* @__PURE__ */ a("span", {
98
76
  className: "data-view__card-title",
99
- children: n.title(e)
77
+ children: s.title(e)
100
78
  })
101
79
  ]
102
- }), n.subtitle && /* @__PURE__ */ a("span", {
80
+ }), s.subtitle && /* @__PURE__ */ a("span", {
103
81
  className: "data-view__card-subtitle",
104
- children: n.subtitle(e)
82
+ children: s.subtitle(e)
105
83
  })]
106
- }), n.badges && /* @__PURE__ */ a("div", {
84
+ }), s.badges && /* @__PURE__ */ a("div", {
107
85
  className: "data-view__card-badges",
108
- children: n.badges(e)
86
+ children: s.badges(e)
109
87
  })]
110
88
  });
111
89
  })(),
112
- P.length > 0 && /* @__PURE__ */ a("div", {
90
+ $.length > 0 && /* @__PURE__ */ a("div", {
113
91
  className: "data-view__card-body",
114
- children: P.map((i) => /* @__PURE__ */ c("div", {
92
+ children: $.map((t) => /* @__PURE__ */ c("div", {
115
93
  className: "data-view__card-field",
116
94
  children: [/* @__PURE__ */ a("span", {
117
95
  className: "data-view__card-label",
118
- children: aa(i)
96
+ children: R(t)
119
97
  }), /* @__PURE__ */ a("span", {
120
98
  className: "data-view__card-value",
121
- children: ea(i, e)
99
+ children: Z(t, e)
122
100
  })]
123
- }, i.key))
101
+ }, t.key))
124
102
  }),
125
- g && /* @__PURE__ */ a("div", {
103
+ b && /* @__PURE__ */ a("div", {
126
104
  className: "data-view__card-actions",
127
- onClick: (i) => i.stopPropagation(),
128
- children: g(e)
105
+ onClick: (t) => t.stopPropagation(),
106
+ children: b(e)
129
107
  })
130
108
  ] });
131
- return /* @__PURE__ */ c(Y.Fragment, { children: [u && /* @__PURE__ */ a(Q, { marker: u }), y ? /* @__PURE__ */ a("a", {
132
- className: E,
133
- href: y,
134
- style: F,
135
- onClick: J,
136
- children: K
109
+ return /* @__PURE__ */ c(W.Fragment, { children: [h && /* @__PURE__ */ a(Y, { marker: h }), f ? /* @__PURE__ */ a("a", {
110
+ className: K,
111
+ href: f,
112
+ style: S,
113
+ onClick: T,
114
+ children: A
137
115
  }) : /* @__PURE__ */ a("div", {
138
- className: E,
139
- style: F,
140
- onClick: _ ? (i) => _(e, i) : void 0,
141
- children: K
116
+ className: K,
117
+ style: S,
118
+ onClick: o ? (t) => o(e, t) : void 0,
119
+ children: A
142
120
  })] }, d);
143
121
  };
144
- if (I) {
122
+ if (g) {
145
123
  let e = 0;
146
124
  return /* @__PURE__ */ a("div", {
147
125
  className: "data-view__groups",
148
- children: I.map((s) => {
149
- const u = e;
150
- e += s.items.length;
151
- const d = N && U?.has(s.key);
126
+ children: g.map((i) => {
127
+ const h = e;
128
+ e += i.items.length;
129
+ const d = v && G?.has(i.key);
152
130
  return /* @__PURE__ */ c("section", {
153
131
  className: "data-view__group",
154
132
  children: [/* @__PURE__ */ c("header", {
155
- className: `data-view__group-header${N ? " data-view__group-header--collapsible" : ""}`,
156
- onClick: N ? () => Z?.(s.key) : void 0,
133
+ className: `data-view__group-header${v ? " data-view__group-header--collapsible" : ""}`,
134
+ onClick: v ? () => H?.(i.key) : void 0,
157
135
  children: [
158
136
  /* @__PURE__ */ a("span", {
159
137
  className: "data-view__group-label",
160
- children: s.label
138
+ children: i.label
161
139
  }),
162
- T && /* @__PURE__ */ a("span", {
140
+ B && /* @__PURE__ */ a("span", {
163
141
  className: "data-view__group-count",
164
- children: s.items.length === s.totalCount ? s.totalCount : `${s.items.length} of ${s.totalCount}`
142
+ children: i.items.length === i.totalCount ? i.totalCount : `${i.items.length} of ${i.totalCount}`
165
143
  }),
166
- N && /* @__PURE__ */ a(v, {
144
+ v && /* @__PURE__ */ a(y, {
167
145
  className: "data-view__group-chevron",
168
146
  name: d ? "caret-down" : "caret-up",
169
147
  size: "sm"
170
148
  })
171
149
  ]
172
150
  }), !d && /* @__PURE__ */ a("div", {
173
- className: S,
174
- style: A,
175
- children: s.items.map((m, f) => x(m, u + f))
151
+ className: I,
152
+ style: P,
153
+ children: i.items.map((m, p) => x(m, h + p))
176
154
  })]
177
- }, s.key ?? "__null__");
155
+ }, i.key ?? "__null__");
178
156
  })
179
157
  });
180
158
  }
181
159
  return /* @__PURE__ */ a("div", {
182
- className: S,
183
- style: A,
184
- children: t.map((e, s) => x(e, s))
160
+ className: I,
161
+ style: P,
162
+ children: n.map((e, i) => x(e, i))
185
163
  });
186
164
  }
187
165
  export {
188
- _a as CardView,
189
- la as DEFAULT_PAGE_SIZES,
190
- oa as getColumnLabel,
191
- ea as renderCellContent,
192
- aa as renderColumnLabel
166
+ ma as CardView
193
167
  };
@@ -1,4 +1,4 @@
1
- import { getColumnLabel as a } from "./DataView.CardView.js";
1
+ import { getColumnLabel as a } from "./DataView.helpers.js";
2
2
  import { MiniSort as s } from "../MiniSort/MiniSort2.js";
3
3
  import { jsx as d } from "react/jsx-runtime";
4
4
  function g({ columns: t, config: l, sortDirection: i, sortKey: c, onSort: e }) {
@@ -0,0 +1,34 @@
1
+ import { Icon as c } from "../Icon/Icon2.js";
2
+ import "react";
3
+ import { jsx as a, jsxs as i } from "react/jsx-runtime";
4
+ var m = [
5
+ 15,
6
+ 30,
7
+ 50,
8
+ 100,
9
+ 250,
10
+ 500
11
+ ], v = (e) => typeof e.header == "string" ? e.header : e.key, _ = (e) => /* @__PURE__ */ i("span", {
12
+ className: "data-view__column-label",
13
+ children: [e.icon && /* @__PURE__ */ a(c, {
14
+ className: "data-view__column-icon",
15
+ name: e.icon,
16
+ size: "sm",
17
+ variant: "muted"
18
+ }), /* @__PURE__ */ a("span", { children: e.header })]
19
+ }), p = (e, r) => {
20
+ const n = e.cellIcon?.(r), s = e.accessor ? e.accessor(r) : r[e.key];
21
+ return n ? /* @__PURE__ */ i("span", {
22
+ className: "data-view__cell-with-icon",
23
+ children: [/* @__PURE__ */ a(c, {
24
+ className: "data-view__cell-icon",
25
+ name: n
26
+ }), /* @__PURE__ */ a("span", { children: s })]
27
+ }) : s;
28
+ };
29
+ export {
30
+ m as DEFAULT_PAGE_SIZES,
31
+ v as getColumnLabel,
32
+ p as renderCellContent,
33
+ _ as renderColumnLabel
34
+ };