@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,25 +1,27 @@
1
1
  import './Dropdown.css';
2
- import { Icon as I } from "../Icon/Icon2.js";
2
+ import { Icon as D } from "../Icon/Icon2.js";
3
3
  import { Button as ae } from "../Button/Button2.js";
4
- import { Tooltip as He } from "../Tooltip/Tooltip2.js";
5
- import { InputText as je } from "../InputText/InputText2.js";
6
- import { foldDiacritics as fe } from "../../helpers/Search.js";
4
+ import { Tooltip as je } from "../Tooltip/Tooltip2.js";
5
+ import { InputText as Ce } from "../InputText/InputText2.js";
6
+ import { foldDiacritics as pe } from "../../helpers/Search.js";
7
7
  /* empty css */
8
- import { useEffect as E, useId as Ce, useRef as D, useState as k } from "react";
8
+ import { useEffect as k, useId as _e, useRef as L, useState as O } from "react";
9
9
  import { jsx as c, jsxs as g } from "react/jsx-runtime";
10
- import { createPortal as _e } from "react-dom";
11
- import { caretDown as ze, clear as pe } from "@memobit/icons";
12
- var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", disabled: x = !1, error: A, highlighted: he = !1, id: me, label: J, maxVisibleSelectedLabels: ge = 1, multilineChips: ve = !1, multiple: i = !1, name: N, onChange: u, onSearchChange: be, options: m, placeholder: H = "Select an option", searchable: f = !0, searchValue: M, selectedCountDisplay: j = "inline", showChips: C = !1, sortSelectedFirst: Q = !1, success: _, usePortal: $ = !0, value: d, valueAsChip: xe = !0 }) => {
13
- const [p, v] = k(!1), [s, l] = k(M || ""), [a, X] = k(m), [L, O] = k(-1), [o, w] = k([]), [R, Ne] = k({
10
+ import { createPortal as ze } from "react-dom";
11
+ import { caretDown as Fe, clear as ue } from "@memobit/icons";
12
+ var Ve = ({ allowCustomValue: h = !1, autofocus: we = !1, className: he = "", disabled: x = !1, error: A, highlighted: me = !1, id: ge, label: J, maxVisibleSelectedLabels: ve = 1, multilineChips: be = !1, multiple: i = !1, name: N, onChange: u, onSearchChange: xe, options: m, placeholder: H = "Select an option", searchable: a = !0, searchValue: M, selectedCountDisplay: j = "inline", showChips: C = !1, sortSelectedFirst: Q = !1, success: _, usePortal: $ = !0, value: d, valueAsChip: Ne = !0 }) => {
13
+ const [p, v] = O(!1), [s, l] = O(M || ""), [f, X] = O(m), [S, y] = O(-1), [o, w] = O([]), [R, $e] = O({
14
14
  top: 0,
15
15
  bottom: 0,
16
16
  left: 0,
17
17
  width: 0,
18
18
  maxHeight: 300
19
- }), [z, $e] = k(!1), S = D(null), y = D([]), F = D(null), ke = D(null), Y = Ce(), Z = me ?? `dropdown-${Y}`, U = D(null);
20
- E(() => {
19
+ }), [z, ke] = O(!1), I = L(null), E = L([]), F = L(null), Le = L(null), Y = _e(), Z = ge ?? `dropdown-${Y}`, U = L(null), V = L(o);
20
+ k(() => {
21
+ V.current = o;
22
+ }), k(() => {
21
23
  if (p && Q && i) {
22
- const n = new Set(o.map((r) => r.value)), e = [], t = [];
24
+ const n = new Set(V.current.map((r) => r.value)), e = [], t = [];
23
25
  m.forEach((r) => (n.has(r.value) ? e : t).push(r)), U.current = [...e, ...t];
24
26
  } else p || (U.current = null);
25
27
  }, [
@@ -27,24 +29,24 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
27
29
  Q,
28
30
  i,
29
31
  m
30
- ]), E(() => {
32
+ ]), k(() => {
31
33
  const n = U.current ?? m;
32
- if (!f || !s) X(n);
34
+ if (!a || !s) X(n);
33
35
  else {
34
- const e = fe(s), t = n.filter((r) => fe(r.label).includes(e));
36
+ const e = pe(s), t = n.filter((r) => pe(r.label).includes(e));
35
37
  X(t);
36
38
  }
37
- O(-1);
39
+ y(-1);
38
40
  }, [
39
41
  s,
40
42
  m,
41
- f,
43
+ a,
42
44
  p
43
45
  ]);
44
- const V = D(d);
45
- E(() => {
46
- const n = V.current;
47
- V.current = d;
46
+ const ee = L(d);
47
+ k(() => {
48
+ const n = ee.current;
49
+ ee.current = d;
48
50
  const e = !Object.is(n, d);
49
51
  if (d == null) {
50
52
  e && (w([]), l(""));
@@ -87,23 +89,23 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
87
89
  d,
88
90
  m,
89
91
  i,
90
- f,
92
+ a,
91
93
  h
92
- ]), E(() => {
93
- f && M !== void 0 && l(M);
94
- }, [M, f]), E(() => {
95
- if (!p || !S.current) return;
94
+ ]), k(() => {
95
+ a && M !== void 0 && l(M);
96
+ }, [M, a]), k(() => {
97
+ if (!p || !I.current) return;
96
98
  const n = () => {
97
- if (!S.current) return;
98
- const t = S.current.getBoundingClientRect(), r = window.visualViewport, T = r?.offsetTop ?? 0, Me = T + (r?.height ?? window.innerHeight), ce = 300, Te = 8, G = Me - t.bottom, de = t.top - T, le = G < ce && de > G;
99
- if ($e(le), $) {
100
- const Ae = Math.max(0, (le ? de : G) - Te);
101
- Ne({
99
+ if (!I.current) return;
100
+ const t = I.current.getBoundingClientRect(), r = window.visualViewport, T = r?.offsetTop ?? 0, Te = T + (r?.height ?? window.innerHeight), de = 300, Ae = 8, G = Te - t.bottom, le = t.top - T, fe = G < de && le > G;
101
+ if (ke(fe), $) {
102
+ const He = Math.max(0, (fe ? le : G) - Ae);
103
+ $e({
102
104
  top: t.bottom,
103
105
  bottom: window.innerHeight - t.top,
104
106
  left: t.left,
105
107
  width: t.width,
106
- maxHeight: Math.min(ce, Ae)
108
+ maxHeight: Math.min(de, He)
107
109
  });
108
110
  }
109
111
  };
@@ -112,9 +114,9 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
112
114
  return window.addEventListener("scroll", n, !0), window.addEventListener("resize", n), e?.addEventListener("resize", n), e?.addEventListener("scroll", n), () => {
113
115
  window.removeEventListener("scroll", n, !0), window.removeEventListener("resize", n), e?.removeEventListener("resize", n), e?.removeEventListener("scroll", n);
114
116
  };
115
- }, [p, $]), E(() => {
117
+ }, [p, $]), k(() => {
116
118
  const n = (e) => {
117
- if (S.current && !S.current.contains(e.target)) {
119
+ if (I.current && !I.current.contains(e.target)) {
118
120
  if ($ && p) {
119
121
  const t = document.querySelector(".dropdown-menu--portal");
120
122
  if (t && t.contains(e.target)) return;
@@ -128,7 +130,7 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
128
130
  w([t]), l(t.label), v(!1), u && u(t, N);
129
131
  return;
130
132
  }
131
- v(!1), !i && o.length > 0 ? l(o[0].label) : i && f && l("");
133
+ v(!1), !i && o.length > 0 ? l(o[0].label) : i && a && l("");
132
134
  }
133
135
  };
134
136
  return document.addEventListener("mousedown", n), () => {
@@ -142,7 +144,7 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
142
144
  N,
143
145
  u,
144
146
  m,
145
- f,
147
+ a,
146
148
  o,
147
149
  $
148
150
  ]);
@@ -151,7 +153,7 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
151
153
  if (i) {
152
154
  const e = o.some((r) => r.value === n.value);
153
155
  let t;
154
- e ? t = o.filter((r) => r.value !== n.value) : t = [...o, n], w(t), f && l(""), u && u(t, N);
156
+ e ? t = o.filter((r) => r.value !== n.value) : t = [...o, n], w(t), a && l(""), u && u(t, N);
155
157
  } else
156
158
  l(n.label), w([n]), v(!1), u && u(n, N);
157
159
  }, P = () => {
@@ -171,18 +173,18 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
171
173
  w(t), l(""), u && u(t, N);
172
174
  } else
173
175
  w([e]), l(e.label), v(!1), u && u(e, N);
174
- }, ee = (n) => {
176
+ }, ne = (n) => {
175
177
  const e = o.filter((t) => t.value !== n.value);
176
- w(e), u && (i ? u(e, N) : (u(null, N), f || l("")));
177
- }, Le = () => {
178
- w([]), (!f || !i) && l(""), v(!1), u && u(i ? [] : null, N);
179
- }, Oe = (n) => {
180
- l(n), p || v(!0), be?.(n);
181
- }, ne = () => {
182
- x || (v(!0), !i && f && o.length > 0 && l(""), (i || f) && F.current?.focus());
183
- }, Se = () => {
184
- x || (v(!p), p || (O(-1), !i && f && o.length > 0 && l(""), (i || f) && F.current?.focus()));
185
- }, ye = (n) => {
178
+ w(e), u && (i ? u(e, N) : (u(null, N), a || l("")));
179
+ }, Oe = () => {
180
+ w([]), (!a || !i) && l(""), v(!1), u && u(i ? [] : null, N);
181
+ }, Se = (n) => {
182
+ l(n), p || v(!0), xe?.(n);
183
+ }, te = () => {
184
+ x || (v(!0), !i && a && o.length > 0 && l(""), (i || a) && F.current?.focus());
185
+ }, ye = () => {
186
+ x || (v(!p), p || (y(-1), !i && a && o.length > 0 && l(""), (i || a) && F.current?.focus()));
187
+ }, Ie = (n) => {
186
188
  if (!x) {
187
189
  if (!p) {
188
190
  (n.key === "ArrowDown" || n.key === "Enter") && (v(!0), n.preventDefault());
@@ -190,42 +192,42 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
190
192
  }
191
193
  switch (n.key) {
192
194
  case "ArrowDown":
193
- if (n.preventDefault(), h && s && a.length === 0) return;
194
- O((e) => {
195
- const t = e < (h && s && !a.some((r) => r.label.toLowerCase() === s.toLowerCase()) ? a.length : a.length - 1) ? e + 1 : 0;
196
- return t < a.length && y.current[t] && y.current[t]?.scrollIntoView({ block: "nearest" }), t;
195
+ if (n.preventDefault(), h && s && f.length === 0) return;
196
+ y((e) => {
197
+ const t = e < (h && s && !f.some((r) => r.label.toLowerCase() === s.toLowerCase()) ? f.length : f.length - 1) ? e + 1 : 0;
198
+ return t < f.length && E.current[t] && E.current[t]?.scrollIntoView({ block: "nearest" }), t;
197
199
  });
198
200
  break;
199
201
  case "ArrowUp":
200
- if (n.preventDefault(), h && s && a.length === 0) return;
201
- O((e) => {
202
- const t = h && s && !a.some((T) => T.label.toLowerCase() === s.toLowerCase()) ? a.length : a.length - 1, r = e > 0 ? e - 1 : t;
203
- return r < a.length && y.current[r] && y.current[r]?.scrollIntoView({ block: "nearest" }), r;
202
+ if (n.preventDefault(), h && s && f.length === 0) return;
203
+ y((e) => {
204
+ const t = h && s && !f.some((T) => T.label.toLowerCase() === s.toLowerCase()) ? f.length : f.length - 1, r = e > 0 ? e - 1 : t;
205
+ return r < f.length && E.current[r] && E.current[r]?.scrollIntoView({ block: "nearest" }), r;
204
206
  });
205
207
  break;
206
208
  case "Enter":
207
- n.preventDefault(), L >= 0 && L < a.length ? K(a[L]) : (h && s && L === a.length || h && s && a.length === 0) && P();
209
+ n.preventDefault(), S >= 0 && S < f.length ? K(f[S]) : (h && s && S === f.length || h && s && f.length === 0) && P();
208
210
  break;
209
211
  case "Escape":
210
- n.preventDefault(), v(!1), !i && o.length > 0 ? l(o[0].label) : i && f && l("");
212
+ n.preventDefault(), v(!1), !i && o.length > 0 ? l(o[0].label) : i && a && l("");
211
213
  break;
212
214
  case "Backspace":
213
- i && s === "" && o.length > 0 && (n.preventDefault(), ee(o[o.length - 1]));
215
+ i && s === "" && o.length > 0 && (n.preventDefault(), ne(o[o.length - 1]));
214
216
  }
215
217
  }
216
- }, q = (n) => o.some((e) => e.value === n.value), Ie = () => {
218
+ }, q = (n) => o.some((e) => e.value === n.value), Ee = () => {
217
219
  if (o.length === 0) return "";
218
- const n = Math.max(1, ge);
220
+ const n = Math.max(1, ve);
219
221
  if (o.length <= n) return o.map((r) => r.label).join(", ");
220
222
  const e = o.slice(0, n).map((r) => r.label).join(", "), t = o.length - n;
221
223
  return `${e} (+${t} ${t === 1 ? "other" : "others"})`;
222
- }, Ee = () => i && C || f && p ? s : o.length > 0 ? i ? Ie() : o[0].label : "", De = () => i && C ? o.length > 0 ? "" : H : p && f ? H : o.length > 0 ? "" : H, Re = () => !i || o.length === 0 || j === "none" ? null : j === "floating" ? /* @__PURE__ */ g("div", {
224
+ }, De = () => i && C || a && p ? s : o.length > 0 ? i ? Ee() : o[0].label : "", Re = () => i && C ? o.length > 0 ? "" : H : p && a ? H : o.length > 0 ? "" : H, Be = () => !i || o.length === 0 || j === "none" ? null : j === "floating" ? /* @__PURE__ */ g("div", {
223
225
  className: "dropdown-selected-count",
224
226
  children: [o.length, " selected"]
225
- }) : null, te = () => !!(h && s && s.trim() && !a.some((n) => n.label.toLowerCase() === s.toLowerCase() || n.value.toString() === s)), Be = () => {
227
+ }) : null, re = () => !!(h && s && s.trim() && !f.some((n) => n.label.toLowerCase() === s.toLowerCase() || n.value.toString() === s)), Me = () => {
226
228
  if (!p || x) return null;
227
229
  const n = /* @__PURE__ */ c("div", {
228
- ref: ke,
230
+ ref: Le,
229
231
  className: `dropdown-menu ${$ ? "dropdown-menu--portal" : ""} ${z ? "dropdown-menu--upward" : ""}`,
230
232
  style: $ ? {
231
233
  position: "fixed",
@@ -236,15 +238,15 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
236
238
  maxHeight: `${R.maxHeight}px`,
237
239
  zIndex: 9999
238
240
  } : void 0,
239
- children: a.length > 0 || te() ? /* @__PURE__ */ g("ul", {
241
+ children: f.length > 0 || re() ? /* @__PURE__ */ g("ul", {
240
242
  className: "dropdown-options-list",
241
- children: [a.map((e, t) => /* @__PURE__ */ g("li", {
243
+ children: [f.map((e, t) => /* @__PURE__ */ g("li", {
242
244
  ref: (r) => {
243
- y.current[t] = r;
245
+ E.current[t] = r;
244
246
  },
245
- className: `dropdown-option ${e.className || ""} ${L === t ? "focused" : ""} ${q(e) ? "selected" : ""} ${e.disabled ? "dropdown-option--disabled" : ""}`,
247
+ className: `dropdown-option ${e.className || ""} ${S === t ? "focused" : ""} ${q(e) ? "selected" : ""} ${e.disabled ? "dropdown-option--disabled" : ""}`,
246
248
  onClick: () => K(e),
247
- onMouseEnter: () => O(t),
249
+ onMouseEnter: () => y(t),
248
250
  title: e.tooltip,
249
251
  children: [i && /* @__PURE__ */ c("div", {
250
252
  className: "dropdown-option-checkbox",
@@ -273,27 +275,27 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
273
275
  className: "dropdown-option-prefix",
274
276
  children: e.prefix
275
277
  }),
276
- e.icon && /* @__PURE__ */ c(I, { name: e.icon }),
278
+ e.icon && /* @__PURE__ */ c(D, { name: e.icon }),
277
279
  /* @__PURE__ */ c("span", { children: e.label }),
278
- e.suffixIcon && /* @__PURE__ */ c(I, { name: e.suffixIcon })
280
+ e.suffixIcon && /* @__PURE__ */ c(D, { name: e.suffixIcon })
279
281
  ]
280
282
  }), e.details && /* @__PURE__ */ c("span", {
281
283
  className: "dropdown-option-details",
282
284
  children: e.details
283
285
  })]
284
286
  })]
285
- }, `dd-option-${Y}-${t}`)), te() && /* @__PURE__ */ c("li", {
287
+ }, `dd-option-${Y}-${t}`)), re() && /* @__PURE__ */ c("li", {
286
288
  ref: (e) => {
287
- y.current[a.length] = e;
289
+ E.current[f.length] = e;
288
290
  },
289
- className: `dropdown-option dropdown-option--create ${L === a.length ? "focused" : ""}`,
291
+ className: `dropdown-option dropdown-option--create ${S === f.length ? "focused" : ""}`,
290
292
  onClick: P,
291
- onMouseEnter: () => O(a.length),
293
+ onMouseEnter: () => y(f.length),
292
294
  children: /* @__PURE__ */ c("div", {
293
295
  className: "dropdown-option-content",
294
296
  children: /* @__PURE__ */ g("span", {
295
297
  className: "dropdown-option-label",
296
- children: [/* @__PURE__ */ c(I, { name: "plus" }), /* @__PURE__ */ g("span", { children: [
298
+ children: [/* @__PURE__ */ c(D, { name: "plus" }), /* @__PURE__ */ g("span", { children: [
297
299
  "Create “",
298
300
  s,
299
301
  "”"
@@ -306,11 +308,11 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
306
308
  children: "No options found"
307
309
  })
308
310
  });
309
- return $ ? _e(n, document.body) : n;
310
- }, b = !i && o.length === 1 ? o[0] : null, B = xe && !p && !i && o.length > 0, re = !!(b?.icon && !s && !B), oe = !!(b?.suffixIcon && !B), W = i && C, ie = o.length > 0, se = f || h;
311
+ return $ ? ze(n, document.body) : n;
312
+ }, b = !i && o.length === 1 ? o[0] : null, B = Ne && !p && !i && o.length > 0, oe = !!(b?.icon && !s && !B), ie = !!(b?.suffixIcon && !B), W = i && C, se = o.length > 0, ce = a || h;
311
313
  return /* @__PURE__ */ g("div", {
312
- className: `dropdown-container ${A ? "dropdown-error" : ""} ${_ ? "dropdown-success" : ""} ${he ? "dropdown-highlighted" : ""} ${i ? "multiple" : ""} ${x ? "disabled" : ""} ${i ? `count-display-${j}` : ""} ${we}`,
313
- ref: S,
314
+ className: `dropdown-container ${A ? "dropdown-error" : ""} ${_ ? "dropdown-success" : ""} ${me ? "dropdown-highlighted" : ""} ${i ? "multiple" : ""} ${x ? "disabled" : ""} ${i ? `count-display-${j}` : ""} ${he}`,
315
+ ref: I,
314
316
  children: [
315
317
  J && /* @__PURE__ */ c("label", {
316
318
  htmlFor: Z,
@@ -318,16 +320,16 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
318
320
  children: J
319
321
  }),
320
322
  /* @__PURE__ */ g("div", {
321
- className: `dropdown-input-container ${re ? "dropdown-input-container--has-prefix-icon" : ""} ${oe ? "dropdown-input-container--has-suffix-icon" : ""} ${W ? "dropdown-input-container--chips" : ""} ${W && ve ? "dropdown-input-container--chips-multiline" : ""} ${ie ? "dropdown-input-container--clearable" : ""}`,
323
+ className: `dropdown-input-container ${oe ? "dropdown-input-container--has-prefix-icon" : ""} ${ie ? "dropdown-input-container--has-suffix-icon" : ""} ${W ? "dropdown-input-container--chips" : ""} ${W && be ? "dropdown-input-container--chips-multiline" : ""} ${se ? "dropdown-input-container--clearable" : ""}`,
322
324
  children: [
323
- re && b?.icon && /* @__PURE__ */ c("span", {
325
+ oe && b?.icon && /* @__PURE__ */ c("span", {
324
326
  className: "dropdown-selected-icon dropdown-selected-icon--prefix",
325
- children: /* @__PURE__ */ c(I, { name: b.icon })
327
+ children: /* @__PURE__ */ c(D, { name: b.icon })
326
328
  }),
327
329
  B && b && /* @__PURE__ */ g("span", {
328
330
  className: "dropdown-value-chip",
329
- onClick: ne,
330
- children: [b.icon && /* @__PURE__ */ c(I, { name: b.icon }), /* @__PURE__ */ c("span", {
331
+ onClick: te,
332
+ children: [b.icon && /* @__PURE__ */ c(D, { name: b.icon }), /* @__PURE__ */ c("span", {
331
333
  className: "dropdown-value-chip__label",
332
334
  children: b.label
333
335
  })]
@@ -337,63 +339,63 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
337
339
  children: [/* @__PURE__ */ c("span", {
338
340
  className: "dropdown-chip__label",
339
341
  children: n.label
340
- }), /* @__PURE__ */ c(He, {
342
+ }), /* @__PURE__ */ c(je, {
341
343
  title: "Remove",
342
344
  children: /* @__PURE__ */ c("button", {
343
345
  type: "button",
344
346
  className: "dropdown-chip__remove",
345
347
  disabled: x,
346
348
  onClick: (e) => {
347
- e.stopPropagation(), ee(n);
349
+ e.stopPropagation(), ne(n);
348
350
  },
349
- children: pe
351
+ children: ue
350
352
  })
351
353
  })]
352
354
  }, `dd-chip-${n.value}`)),
353
- /* @__PURE__ */ c(je, {
355
+ /* @__PURE__ */ c(Ce, {
354
356
  ref: F,
355
357
  id: Z,
356
- placeholder: B ? "" : De(),
357
- value: B ? "" : Ee(),
358
- onChange: se ? Oe : void 0,
359
- onClick: ne,
360
- onKeyDown: ye,
358
+ placeholder: B ? "" : Re(),
359
+ value: B ? "" : De(),
360
+ onChange: ce ? Se : void 0,
361
+ onClick: te,
362
+ onKeyDown: Ie,
361
363
  autoComplete: "off",
362
- autoFocus: ue,
364
+ autoFocus: we,
363
365
  disabled: x,
364
- readOnly: !se
366
+ readOnly: !ce
365
367
  }),
366
368
  /* @__PURE__ */ g("div", {
367
369
  className: "dropdown-actions-buttons",
368
370
  children: [
369
- oe && b?.suffixIcon && /* @__PURE__ */ c("span", {
371
+ ie && b?.suffixIcon && /* @__PURE__ */ c("span", {
370
372
  className: "dropdown-selected-icon dropdown-selected-icon--suffix",
371
- children: /* @__PURE__ */ c(I, { name: b.suffixIcon })
373
+ children: /* @__PURE__ */ c(D, { name: b.suffixIcon })
372
374
  }),
373
- ie && /* @__PURE__ */ c("span", {
375
+ se && /* @__PURE__ */ c("span", {
374
376
  className: "dropdown-action-button dropdown-clear-button",
375
377
  children: /* @__PURE__ */ c(ae, {
376
378
  variant: "plain",
377
- onClick: Le,
379
+ onClick: Oe,
378
380
  disabled: x,
379
- children: pe
381
+ children: ue
380
382
  })
381
383
  }),
382
384
  /* @__PURE__ */ c("span", {
383
385
  className: `dropdown-action-button dropdown-toggle-button ${p ? "open" : ""}`,
384
386
  children: /* @__PURE__ */ c(ae, {
385
387
  variant: "plain",
386
- onClick: Se,
388
+ onClick: ye,
387
389
  disabled: x,
388
- children: ze
390
+ children: Fe
389
391
  })
390
392
  })
391
393
  ]
392
394
  }),
393
- Re()
395
+ Be()
394
396
  ]
395
397
  }),
396
- Be(),
398
+ Me(),
397
399
  A && /* @__PURE__ */ c("span", {
398
400
  className: "dropdown-error-message",
399
401
  children: A
@@ -406,5 +408,5 @@ var Ze = ({ allowCustomValue: h = !1, autofocus: ue = !1, className: we = "", di
406
408
  });
407
409
  };
408
410
  export {
409
- Ze as Dropdown
411
+ Ve as Dropdown
410
412
  };
@@ -1,74 +1,74 @@
1
1
  import './InputEmail.css';
2
2
  /* empty css */
3
- import { forwardRef as F, useEffect as G, useState as N } from "react";
4
- import { jsx as n, jsxs as b } from "react/jsx-runtime";
5
- var L = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, M = (r) => !r || r.trim() === "" ? !0 : L.test(r.trim()), P = F(({ autoComplete: r = "on", autoFocus: I, disabled: A, error: $ = "Please enter a valid email address", highlighted: v, id: o, label: p, maxLength: x, onBlur: z, onChange: Z, onClick: j, onKeyDown: y, onKeyUp: B, onValidate: a, placeholder: C, readOnly: R = !1, required: s = !1, showValidation: h = !1, success: m, validateOn: i = "blur", value: l }, T) => {
6
- const [f, u] = N(!0), [d, g] = N(!1), c = (e) => s && (!e || e.trim() === "") ? !1 : !e || e.trim() === "" ? !0 : M(e);
3
+ import { validateEmail as z } from "./validateEmail.js";
4
+ import { forwardRef as A, useCallback as D, useEffect as G, useState as N } from "react";
5
+ import { jsx as m, jsxs as b } from "react/jsx-runtime";
6
+ var H = A(({ autoComplete: E = "on", autoFocus: I, disabled: x, error: C = "Please enter a valid email address", highlighted: $, id: o, label: c, maxLength: j, onBlur: y, onChange: B, onClick: T, onKeyDown: k, onKeyUp: v, onValidate: a, placeholder: w, readOnly: F = !1, required: i = !1, showValidation: p = !1, success: n, validateOn: r = "blur", value: t }, P) => {
7
+ const [h, u] = N(!0), [f, d] = N(!1), l = D((e) => i && (!e || e.trim() === "") ? !1 : !e || e.trim() === "" ? !0 : z(e), [i]);
7
8
  G(() => {
8
- if (l !== void 0) {
9
- const e = c(l);
9
+ if (t !== void 0) {
10
+ const e = l(t);
10
11
  u(e), a?.(e);
11
12
  }
12
13
  }, [
13
- l,
14
+ t,
14
15
  a,
15
- s
16
+ l
16
17
  ]);
17
- const _ = (e) => {
18
- if (Z?.(e), i === "change" || i === "both") {
19
- const t = c(e);
20
- u(t), g(!0), a?.(t);
18
+ const R = (e) => {
19
+ if (B?.(e), r === "change" || r === "both") {
20
+ const s = l(e);
21
+ u(s), d(!0), a?.(s);
21
22
  }
22
- }, w = (e) => {
23
- if (g(!0), i === "blur" || i === "both") {
24
- const t = c(e.target.value);
25
- u(t), a?.(t);
23
+ }, S = (e) => {
24
+ if (d(!0), r === "blur" || r === "both") {
25
+ const s = l(e.target.value);
26
+ u(s), a?.(s);
26
27
  }
27
- z?.(e);
28
- }, E = h && d && !f;
28
+ y?.(e);
29
+ }, g = p && f && !h;
29
30
  return /* @__PURE__ */ b("div", {
30
- className: `input-email-wrapper${v ? " input-email-highlighted" : ""}`,
31
+ className: `input-email-wrapper${$ ? " input-email-highlighted" : ""}`,
31
32
  children: [
32
- p && /* @__PURE__ */ b("label", {
33
+ c && /* @__PURE__ */ b("label", {
33
34
  htmlFor: o,
34
35
  className: "input-email-label",
35
- children: [p, s && /* @__PURE__ */ n("span", {
36
+ children: [c, i && /* @__PURE__ */ m("span", {
36
37
  className: "input-email-required",
37
38
  children: "*"
38
39
  })]
39
40
  }),
40
- /* @__PURE__ */ n("input", {
41
- autoComplete: r,
41
+ /* @__PURE__ */ m("input", {
42
+ autoComplete: E,
42
43
  autoFocus: I,
43
- disabled: A,
44
+ disabled: x,
44
45
  type: "email",
45
- className: `input-email${E ? " input-email--error" : ""}${m ? " input-email-success" : f && d && h ? " input-email--valid" : ""}`,
46
+ className: `input-email${g ? " input-email--error" : ""}${n ? " input-email-success" : h && f && p ? " input-email--valid" : ""}`,
46
47
  id: o,
47
- maxLength: x,
48
- placeholder: C,
49
- ref: T,
50
- value: l,
51
- onBlur: w,
52
- onChange: (e) => _(e.target.value),
53
- onClick: j,
54
- onKeyDown: y,
55
- onKeyUp: B,
56
- readOnly: R,
57
- required: s
48
+ maxLength: j,
49
+ placeholder: w,
50
+ ref: P,
51
+ value: t,
52
+ onBlur: S,
53
+ onChange: (e) => R(e.target.value),
54
+ onClick: T,
55
+ onKeyDown: k,
56
+ onKeyUp: v,
57
+ readOnly: F,
58
+ required: i
58
59
  }),
59
- E && /* @__PURE__ */ n("span", {
60
+ g && /* @__PURE__ */ m("span", {
60
61
  className: "input-email-error-message",
61
- children: $
62
+ children: C
62
63
  }),
63
- m && /* @__PURE__ */ n("span", {
64
+ n && /* @__PURE__ */ m("span", {
64
65
  className: "input-email-success-message",
65
- children: m
66
+ children: n
66
67
  })
67
68
  ]
68
69
  });
69
70
  });
70
- P.displayName = "InputEmail";
71
+ H.displayName = "InputEmail";
71
72
  export {
72
- P as InputEmail,
73
- M as validateEmail
73
+ H as InputEmail
74
74
  };
@@ -0,0 +1,7 @@
1
+ import './InputEmail.css';
2
+ /* empty css */
3
+ var t = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, e = (r) => !r || r.trim() === "" ? !0 : t.test(r.trim());
4
+ export {
5
+ t as EMAIL_REGEX,
6
+ e as validateEmail
7
+ };