@memobit/libs 3.26.4 → 3.28.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 (47) hide show
  1. package/dist/components/Banner/Banner2.js +15 -13
  2. package/dist/components/BoldText/BoldText.js +5 -0
  3. package/dist/components/Calendar/Calendar2.js +108 -135
  4. package/dist/components/ColorPicker/ColorPicker.css +1 -1
  5. package/dist/components/ColorPicker/ColorPicker2.js +114 -114
  6. package/dist/components/ConfirmDialog/ConfirmDialog2.js +13 -11
  7. package/dist/components/ConfirmPopover/ConfirmPopover2.js +26 -24
  8. package/dist/components/ContextMenu/ContextMenu2.js +46 -33
  9. package/dist/components/ControlPanel/ControlPanel2.js +95 -93
  10. package/dist/components/ControlPanel/ControlPanelFilter.js +205 -193
  11. package/dist/components/ControlPanel/ControlPanelOptions.js +190 -185
  12. package/dist/components/DataView/DataView.CardView.js +83 -81
  13. package/dist/components/DataView/DataView.ColumnSelector.js +27 -25
  14. package/dist/components/DataView/DataView.TableView.js +74 -72
  15. package/dist/components/DataView/DataView2.js +169 -167
  16. package/dist/components/DatePicker/DatePicker2.js +71 -69
  17. package/dist/components/Drawer/Drawer2.js +58 -55
  18. package/dist/components/Dropdown/Dropdown2.js +187 -189
  19. package/dist/components/InputDate/InputDate2.js +43 -41
  20. package/dist/components/InputSearch/InputSearch2.js +27 -25
  21. package/dist/components/MenuBar/MenuBar.css +1 -0
  22. package/dist/components/MenuBar/MenuBar2.js +46 -0
  23. package/dist/components/Modal/Modal2.js +49 -47
  24. package/dist/components/Pagination/Pagination2.js +44 -47
  25. package/dist/components/ScrollToTop/ScrollToTop2.js +18 -16
  26. package/dist/components/ThemeSettings/ThemeSettings2.js +131 -123
  27. package/dist/components/TipsOfTheDay/TipsOfTheDay2.js +16 -12
  28. package/dist/components/Toast/Toast2.js +38 -33
  29. package/dist/components/ToolButton/ToolButton.css +1 -0
  30. package/dist/components/ToolButton/ToolButton2.js +36 -0
  31. package/dist/components/ToolPalette/ToolPalette.css +1 -0
  32. package/dist/components/ToolPalette/ToolPalette2.js +83 -0
  33. package/dist/components/Toolbar/Toolbar2.js +58 -56
  34. package/dist/contexts/LanguageContext/LanguageContext.context.js +9 -0
  35. package/dist/contexts/LanguageContext/LanguageContext.js +19 -0
  36. package/dist/contexts/LanguageContext/libMessages.js +240 -0
  37. package/dist/helpers/Datetime.js +84 -68
  38. package/dist/helpers/Language.js +8 -0
  39. package/dist/helpers/Pagination.js +5 -4
  40. package/dist/helpers/VersionInfo.js +1 -1
  41. package/dist/hooks/useLanguage.js +16 -0
  42. package/dist/index.d.ts +133 -6
  43. package/dist/index.js +417 -399
  44. package/dist/memobit-icons.json +4 -0
  45. package/dist/version.js +2 -2
  46. package/dist/version.json +4 -4
  47. package/package.json +1 -1
@@ -1,54 +1,56 @@
1
1
  import './Dropdown.css';
2
- import { Icon as M } from "../Icon/Icon2.js";
3
- import { Button as xe } from "../Button/Button2.js";
4
- import { Tooltip as Ke } from "../Tooltip/Tooltip2.js";
5
- import { InputText as Pe } from "../InputText/InputText2.js";
6
- import { foldDiacritics as be } from "../../helpers/Search.js";
2
+ import { Icon as R } from "../Icon/Icon2.js";
3
+ import { libMessages as Ge } from "../../contexts/LanguageContext/libMessages.js";
4
+ import { useMessages as Je } from "../../hooks/useLanguage.js";
5
+ import { Button as be } from "../Button/Button2.js";
6
+ import { Tooltip as Qe } from "../Tooltip/Tooltip2.js";
7
+ import { InputText as Xe } from "../InputText/InputText2.js";
8
+ import { foldDiacritics as Ne } from "../../helpers/Search.js";
7
9
  /* empty css */
8
- import { useEffect as O, useId as qe, useRef as k, useState as S } from "react";
9
- import { jsx as c, jsxs as v } from "react/jsx-runtime";
10
- import { createPortal as Ge } from "react-dom";
11
- import { caretDown as Je, clear as Ne } from "@memobit/icons";
12
- var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", disabled: N = !1, error: C, highlighted: Le = !1, id: Oe, label: V, maxVisibleSelectedLabels: Se = 1, multilineChips: ye = !1, multiple: i = !1, name: $, onChange: p, onSearchChange: Ie, options: m, placeholder: F = "Select an option", searchable: f = !0, searchValue: A, selectedCountDisplay: _ = "inline", showChips: H = !1, sortSelectedFirst: ee = !1, success: z, usePortal: L = !0, value: d, valueAsChip: Ee = !0 }) => {
13
- const [u, x] = S(!1), [s, l] = S(A || ""), [a, ne] = S(m), [y, I] = S(-1), [o, h] = S([]), [R, De] = S({
10
+ import { useEffect as L, useId as Ye, useRef as O, useState as y } from "react";
11
+ import { jsx as s, jsxs as b } from "react/jsx-runtime";
12
+ import { createPortal as Ze } from "react-dom";
13
+ import { caretDown as Ve, clear as $e } from "@memobit/icons";
14
+ var hn = ({ allowCustomValue: w = !1, autofocus: Oe = !1, className: ke = "", clearable: Le = !0, disabled: N = !1, error: F, highlighted: ye = !1, id: Se, label: ee, maxVisibleSelectedLabels: Ie = 1, multilineChips: Ee = !1, multiple: i = !1, name: $, onChange: p, onSearchChange: Me, options: m, placeholder: De, searchable: f = !0, searchValue: W, selectedCountDisplay: _ = "inline", showChips: H = !1, sortSelectedFirst: ne = !1, success: z, usePortal: k = !0, value: d, valueAsChip: Re = !0 }) => {
15
+ const S = Je(Ge), U = De ?? S.selectOption, [u, v] = y(!1), [c, l] = y(W || ""), [a, te] = y(m), [I, E] = y(-1), [o, h] = y([]), [B, Be] = y({
14
16
  top: 0,
15
17
  bottom: 0,
16
18
  left: 0,
17
19
  width: 0,
18
20
  maxHeight: 300
19
- }), [U, Me] = S(!1), E = k(null), D = k([]), K = k(null), te = k(null), re = qe(), oe = Oe ?? `dropdown-${re}`, P = k(null), ie = k(o);
20
- O(() => {
21
- ie.current = o;
22
- }), O(() => {
23
- if (u && ee && i) {
24
- const n = new Set(ie.current.map((r) => r.value)), e = [], t = [];
25
- m.forEach((r) => (n.has(r.value) ? e : t).push(r)), P.current = [...e, ...t];
26
- } else u || (P.current = null);
21
+ }), [K, Te] = y(!1), M = O(null), D = O([]), P = O(null), re = O(null), oe = Ye(), ie = Se ?? `dropdown-${oe}`, q = O(null), se = O(o);
22
+ L(() => {
23
+ se.current = o;
24
+ }), L(() => {
25
+ if (u && ne && i) {
26
+ const n = new Set(se.current.map((r) => r.value)), e = [], t = [];
27
+ m.forEach((r) => (n.has(r.value) ? e : t).push(r)), q.current = [...e, ...t];
28
+ } else u || (q.current = null);
27
29
  }, [
28
30
  u,
29
- ee,
31
+ ne,
30
32
  i,
31
33
  m
32
- ]), O(() => {
33
- const n = P.current ?? m;
34
- if (!f || !s) ne(n);
34
+ ]), L(() => {
35
+ const n = q.current ?? m;
36
+ if (!f || !c) te(n);
35
37
  else {
36
- const e = be(s), t = n.filter((r) => be(r.label).includes(e));
37
- ne(t);
38
+ const e = Ne(c), t = n.filter((r) => Ne(r.label).includes(e));
39
+ te(t);
38
40
  }
39
- I(-1);
41
+ E(-1);
40
42
  }, [
41
- s,
43
+ c,
42
44
  m,
43
45
  f,
44
46
  u
45
47
  ]);
46
- const se = k(d), W = k(!1), j = k(null);
47
- O(() => {
48
- const n = se.current;
49
- se.current = d;
50
- const e = !Object.is(n, d), t = e && !W.current;
51
- if (e && (W.current = !1), d == null) {
48
+ const ce = O(d), j = O(!1), C = O(null);
49
+ L(() => {
50
+ const n = ce.current;
51
+ ce.current = d;
52
+ const e = !Object.is(n, d), t = e && !j.current;
53
+ if (e && (j.current = !1), d == null) {
52
54
  e && (h([]), t && l(""));
53
55
  return;
54
56
  }
@@ -62,7 +64,7 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
62
64
  }
63
65
  if (m.length > 0) {
64
66
  if (i && Array.isArray(d)) {
65
- const r = new Set(d.map(String)), g = m.filter((X) => r.has(X.value.toString()));
67
+ const r = new Set(d.map(String)), g = m.filter((Y) => r.has(Y.value.toString()));
66
68
  h(g), t && l("");
67
69
  } else if (!i && (typeof d == "string" || typeof d == "number")) {
68
70
  const r = m.find((g) => typeof g.value == "number" && typeof d == "number" ? g.value === d : g.value.toString() === d.toString());
@@ -91,51 +93,51 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
91
93
  i,
92
94
  f,
93
95
  w
94
- ]), O(() => {
95
- f && A !== void 0 && l(A);
96
- }, [A, f]), O(() => {
97
- if (!u || !E.current) return;
96
+ ]), L(() => {
97
+ f && W !== void 0 && l(W);
98
+ }, [W, f]), L(() => {
99
+ if (!u || !M.current) return;
98
100
  const n = () => {
99
- if (!E.current) return;
100
- const t = E.current.getBoundingClientRect(), r = window.visualViewport, g = r?.offsetTop ?? 0, X = g + (r?.height ?? window.innerHeight), he = 300, Y = 8, Z = X - t.bottom, we = t.top - g, me = Z < he && we > Z;
101
- if (Me(me), L) {
102
- const _e = Math.max(0, (me ? we : Z) - Y), T = te.current;
103
- if (T && j.current === null) {
104
- const Ue = T.style.width;
105
- T.style.width = "max-content", j.current = T.offsetWidth, T.style.width = Ue;
101
+ if (!M.current) return;
102
+ const t = M.current.getBoundingClientRect(), r = window.visualViewport, g = r?.offsetTop ?? 0, Y = g + (r?.height ?? window.innerHeight), we = 300, Z = 8, V = Y - t.bottom, me = t.top - g, ge = V < we && me > V;
103
+ if (Te(ge), k) {
104
+ const Ke = Math.max(0, (ge ? me : V) - Z), A = re.current;
105
+ if (A && C.current === null) {
106
+ const qe = A.style.width;
107
+ A.style.width = "max-content", C.current = A.offsetWidth, A.style.width = qe;
106
108
  }
107
- const ze = 360, ge = document.documentElement.clientWidth, ve = Math.max(t.width, Math.min(j.current ?? t.width, ze, ge - 16));
108
- De({
109
+ const Pe = 360, ve = document.documentElement.clientWidth, xe = Math.max(t.width, Math.min(C.current ?? t.width, Pe, ve - 16));
110
+ Be({
109
111
  top: t.bottom,
110
112
  bottom: window.innerHeight - t.top,
111
- left: Math.max(Y, Math.min(t.left, ge - Y - ve)),
112
- width: ve,
113
- maxHeight: Math.min(he, _e)
113
+ left: Math.max(Z, Math.min(t.left, ve - Z - xe)),
114
+ width: xe,
115
+ maxHeight: Math.min(we, Ke)
114
116
  });
115
117
  }
116
118
  };
117
119
  n();
118
120
  const e = window.visualViewport;
119
121
  return window.addEventListener("scroll", n, !0), window.addEventListener("resize", n), e?.addEventListener("resize", n), e?.addEventListener("scroll", n), () => {
120
- j.current = null, window.removeEventListener("scroll", n, !0), window.removeEventListener("resize", n), e?.removeEventListener("resize", n), e?.removeEventListener("scroll", n);
122
+ C.current = null, window.removeEventListener("scroll", n, !0), window.removeEventListener("resize", n), e?.removeEventListener("resize", n), e?.removeEventListener("scroll", n);
121
123
  };
122
- }, [u, L]), O(() => {
124
+ }, [u, k]), L(() => {
123
125
  const n = (e) => {
124
- if (E.current && !E.current.contains(e.target)) {
125
- if (L && u) {
126
+ if (M.current && !M.current.contains(e.target)) {
127
+ if (k && u) {
126
128
  const t = document.querySelector(".dropdown-menu--portal");
127
129
  if (t && t.contains(e.target)) return;
128
130
  }
129
- if (w && !i && s.trim() && !(o.length > 0 && o[0].label.toLowerCase() === s.trim().toLowerCase())) {
130
- const t = m.find((r) => r.label.toLowerCase() === s.toLowerCase() || r.value.toString() === s) || {
131
- label: s.trim(),
132
- value: s.trim(),
131
+ if (w && !i && c.trim() && !(o.length > 0 && o[0].label.toLowerCase() === c.trim().toLowerCase())) {
132
+ const t = m.find((r) => r.label.toLowerCase() === c.toLowerCase() || r.value.toString() === c) || {
133
+ label: c.trim(),
134
+ value: c.trim(),
133
135
  className: "custom-option"
134
136
  };
135
- h([t]), l(t.label), x(!1), p && p(t, $);
137
+ h([t]), l(t.label), v(!1), p && p(t, $);
136
138
  return;
137
139
  }
138
- x(!1), !i && o.length > 0 ? l(o[0].label) : i && f && l("");
140
+ v(!1), !i && o.length > 0 ? l(o[0].label) : i && f && l("");
139
141
  }
140
142
  };
141
143
  return document.addEventListener("mousedown", n), () => {
@@ -143,7 +145,7 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
143
145
  };
144
146
  }, [
145
147
  w,
146
- s,
148
+ c,
147
149
  u,
148
150
  i,
149
151
  $,
@@ -151,119 +153,119 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
151
153
  m,
152
154
  f,
153
155
  o,
154
- L
156
+ k
155
157
  ]);
156
- const q = (n) => {
158
+ const G = (n) => {
157
159
  if (!n.disabled)
158
160
  if (i) {
159
161
  const e = o.some((r) => r.value === n.value);
160
162
  let t;
161
- e ? t = o.filter((r) => r.value !== n.value) : t = [...o, n], e || !H ? W.current = !0 : f && l(""), h(t), p && p(t, $);
163
+ e ? t = o.filter((r) => r.value !== n.value) : t = [...o, n], e || !H ? j.current = !0 : f && l(""), h(t), p && p(t, $);
162
164
  } else
163
- l(n.label), h([n]), x(!1), p && p(n, $);
164
- }, G = () => {
165
- if (!w || !s.trim()) return;
166
- const n = m.find((t) => t.label.toLowerCase() === s.toLowerCase() || t.value.toString() === s);
165
+ l(n.label), h([n]), v(!1), p && p(n, $);
166
+ }, J = () => {
167
+ if (!w || !c.trim()) return;
168
+ const n = m.find((t) => t.label.toLowerCase() === c.toLowerCase() || t.value.toString() === c);
167
169
  if (n) {
168
- q(n);
170
+ G(n);
169
171
  return;
170
172
  }
171
173
  const e = {
172
- label: s.trim(),
173
- value: s.trim(),
174
+ label: c.trim(),
175
+ value: c.trim(),
174
176
  className: "custom-option"
175
177
  };
176
178
  if (i) {
177
179
  const t = [...o, e];
178
180
  h(t), l(""), p && p(t, $);
179
181
  } else
180
- h([e]), l(e.label), x(!1), p && p(e, $);
181
- }, ce = (n) => {
182
+ h([e]), l(e.label), v(!1), p && p(e, $);
183
+ }, de = (n) => {
182
184
  const e = o.filter((t) => t.value !== n.value);
183
- h(e), p && (i ? (W.current = !0, p(e, $)) : (p(null, $), f || l("")));
184
- }, Re = () => {
185
- h([]), (!f || !i) && l(""), x(!1), p && p(i ? [] : null, $);
186
- }, Be = (n) => {
187
- l(n), u || x(!0), Ie?.(n);
188
- }, de = () => {
189
- N || (x(!0), !i && f && o.length > 0 && l(""), (i || f) && K.current?.focus());
190
- }, Te = () => {
191
- N || (x(!u), u || (I(-1), !i && f && o.length > 0 && l(""), (i || f) && K.current?.focus()));
192
- }, Ae = (n) => {
185
+ h(e), p && (i ? (j.current = !0, p(e, $)) : (p(null, $), f || l("")));
186
+ }, Ae = () => {
187
+ h([]), (!f || !i) && l(""), v(!1), p && p(i ? [] : null, $);
188
+ }, We = (n) => {
189
+ l(n), u || v(!0), Me?.(n);
190
+ }, le = () => {
191
+ N || (v(!0), !i && f && o.length > 0 && l(""), (i || f) && P.current?.focus());
192
+ }, He = () => {
193
+ N || (v(!u), u || (E(-1), !i && f && o.length > 0 && l(""), (i || f) && P.current?.focus()));
194
+ }, je = (n) => {
193
195
  if (!N) {
194
196
  if (!u) {
195
- (n.key === "ArrowDown" || n.key === "Enter") && (x(!0), n.preventDefault());
197
+ (n.key === "ArrowDown" || n.key === "Enter") && (v(!0), n.preventDefault());
196
198
  return;
197
199
  }
198
200
  switch (n.key) {
199
201
  case "ArrowDown":
200
- if (n.preventDefault(), w && s && a.length === 0) return;
201
- I((e) => {
202
- const t = e < (w && s && !a.some((r) => r.label.toLowerCase() === s.toLowerCase()) ? a.length : a.length - 1) ? e + 1 : 0;
202
+ if (n.preventDefault(), w && c && a.length === 0) return;
203
+ E((e) => {
204
+ const t = e < (w && c && !a.some((r) => r.label.toLowerCase() === c.toLowerCase()) ? a.length : a.length - 1) ? e + 1 : 0;
203
205
  return t < a.length && D.current[t] && D.current[t]?.scrollIntoView({ block: "nearest" }), t;
204
206
  });
205
207
  break;
206
208
  case "ArrowUp":
207
- if (n.preventDefault(), w && s && a.length === 0) return;
208
- I((e) => {
209
- const t = w && s && !a.some((g) => g.label.toLowerCase() === s.toLowerCase()) ? a.length : a.length - 1, r = e > 0 ? e - 1 : t;
209
+ if (n.preventDefault(), w && c && a.length === 0) return;
210
+ E((e) => {
211
+ const t = w && c && !a.some((g) => g.label.toLowerCase() === c.toLowerCase()) ? a.length : a.length - 1, r = e > 0 ? e - 1 : t;
210
212
  return r < a.length && D.current[r] && D.current[r]?.scrollIntoView({ block: "nearest" }), r;
211
213
  });
212
214
  break;
213
215
  case "Enter":
214
- n.preventDefault(), y >= 0 && y < a.length ? q(a[y]) : (w && s && y === a.length || w && s && a.length === 0) && G();
216
+ n.preventDefault(), I >= 0 && I < a.length ? G(a[I]) : (w && c && I === a.length || w && c && a.length === 0) && J();
215
217
  break;
216
218
  case "Escape":
217
- n.preventDefault(), x(!1), !i && o.length > 0 ? l(o[0].label) : i && f && l("");
219
+ n.preventDefault(), v(!1), !i && o.length > 0 ? l(o[0].label) : i && f && l("");
218
220
  break;
219
221
  case "Backspace":
220
- i && s === "" && o.length > 0 && (n.preventDefault(), ce(o[o.length - 1]));
222
+ i && c === "" && o.length > 0 && (n.preventDefault(), de(o[o.length - 1]));
221
223
  }
222
224
  }
223
- }, J = (n) => o.some((e) => e.value === n.value), He = () => {
225
+ }, Q = (n) => o.some((e) => e.value === n.value), Ce = () => {
224
226
  if (o.length === 0) return "";
225
- const n = Math.max(1, Se);
227
+ const n = Math.max(1, Ie);
226
228
  if (o.length <= n) return o.map((r) => r.label).join(", ");
227
229
  const e = o.slice(0, n).map((r) => r.label).join(", "), t = o.length - n;
228
- return `${e} (+${t} ${t === 1 ? "other" : "others"})`;
229
- }, We = () => i && H || f && u ? s : o.length > 0 ? i ? He() : o[0].label : "", je = () => i && H ? o.length > 0 ? "" : F : u && f ? F : o.length > 0 ? "" : F, Ce = () => !i || o.length === 0 || _ === "none" ? null : _ === "floating" ? /* @__PURE__ */ v("div", {
230
+ return S.selectedWithOthers(e, t);
231
+ }, Fe = () => i && H || f && u ? c : o.length > 0 ? i ? Ce() : o[0].label : "", _e = () => i && H ? o.length > 0 ? "" : U : u && f ? U : o.length > 0 ? "" : U, ze = () => !i || o.length === 0 || _ === "none" ? null : _ === "floating" ? /* @__PURE__ */ s("div", {
230
232
  className: "dropdown-selected-count",
231
- children: [o.length, " selected"]
232
- }) : null, le = () => !!(w && s && s.trim() && !a.some((n) => n.label.toLowerCase() === s.toLowerCase() || n.value.toString() === s)), Fe = () => {
233
+ children: S.selectedCount(o.length)
234
+ }) : null, ae = () => !!(w && c && c.trim() && !a.some((n) => n.label.toLowerCase() === c.toLowerCase() || n.value.toString() === c)), Ue = () => {
233
235
  if (!u || N) return null;
234
- const n = /* @__PURE__ */ c("div", {
235
- ref: te,
236
- className: `dropdown-menu ${L ? "dropdown-menu--portal" : ""} ${U ? "dropdown-menu--upward" : ""}`,
237
- style: L ? {
236
+ const n = /* @__PURE__ */ s("div", {
237
+ ref: re,
238
+ className: `dropdown-menu ${k ? "dropdown-menu--portal" : ""} ${K ? "dropdown-menu--upward" : ""}`,
239
+ style: k ? {
238
240
  position: "fixed",
239
- top: U ? "auto" : `${R.top}px`,
240
- bottom: U ? `${R.bottom}px` : "auto",
241
- left: `${R.left}px`,
242
- width: `${R.width}px`,
243
- maxHeight: `${R.maxHeight}px`,
241
+ top: K ? "auto" : `${B.top}px`,
242
+ bottom: K ? `${B.bottom}px` : "auto",
243
+ left: `${B.left}px`,
244
+ width: `${B.width}px`,
245
+ maxHeight: `${B.maxHeight}px`,
244
246
  zIndex: 9999
245
247
  } : void 0,
246
- children: a.length > 0 || le() ? /* @__PURE__ */ v("ul", {
248
+ children: a.length > 0 || ae() ? /* @__PURE__ */ b("ul", {
247
249
  className: "dropdown-options-list",
248
- children: [a.map((e, t) => /* @__PURE__ */ v("li", {
250
+ children: [a.map((e, t) => /* @__PURE__ */ b("li", {
249
251
  ref: (r) => {
250
252
  D.current[t] = r;
251
253
  },
252
- className: `dropdown-option ${e.className || ""} ${y === t ? "focused" : ""} ${J(e) ? "selected" : ""} ${e.disabled ? "dropdown-option--disabled" : ""}`,
253
- onClick: () => q(e),
254
- onMouseEnter: () => I(t),
254
+ className: `dropdown-option ${e.className || ""} ${I === t ? "focused" : ""} ${Q(e) ? "selected" : ""} ${e.disabled ? "dropdown-option--disabled" : ""}`,
255
+ onClick: () => G(e),
256
+ onMouseEnter: () => E(t),
255
257
  title: e.tooltip,
256
258
  children: [
257
- i && /* @__PURE__ */ c("div", {
259
+ i && /* @__PURE__ */ s("div", {
258
260
  className: "dropdown-option-checkbox",
259
- children: /* @__PURE__ */ c("div", {
260
- className: `checkbox ${J(e) ? "checked" : ""}`,
261
- children: J(e) && /* @__PURE__ */ c("svg", {
261
+ children: /* @__PURE__ */ s("div", {
262
+ className: `checkbox ${Q(e) ? "checked" : ""}`,
263
+ children: Q(e) && /* @__PURE__ */ s("svg", {
262
264
  width: "10",
263
265
  height: "8",
264
266
  viewBox: "0 0 10 8",
265
267
  fill: "none",
266
- children: /* @__PURE__ */ c("path", {
268
+ children: /* @__PURE__ */ s("path", {
267
269
  d: "M9 1L3.5 6.5L1 4",
268
270
  stroke: "currentColor",
269
271
  strokeWidth: "1.5",
@@ -273,146 +275,142 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
273
275
  })
274
276
  })
275
277
  }),
276
- /* @__PURE__ */ v("div", {
278
+ /* @__PURE__ */ b("div", {
277
279
  className: "dropdown-option-content",
278
- children: [/* @__PURE__ */ v("span", {
280
+ children: [/* @__PURE__ */ b("span", {
279
281
  className: "dropdown-option-label",
280
282
  children: [
281
- e.prefix && /* @__PURE__ */ c("span", {
283
+ e.prefix && /* @__PURE__ */ s("span", {
282
284
  className: "dropdown-option-prefix",
283
285
  children: e.prefix
284
286
  }),
285
- e.icon && /* @__PURE__ */ c(M, { name: e.icon }),
286
- /* @__PURE__ */ c("span", { children: e.label }),
287
- e.suffixIcon && /* @__PURE__ */ c(M, { name: e.suffixIcon })
287
+ e.icon && /* @__PURE__ */ s(R, { name: e.icon }),
288
+ /* @__PURE__ */ s("span", { children: e.label }),
289
+ e.suffixIcon && /* @__PURE__ */ s(R, { name: e.suffixIcon })
288
290
  ]
289
- }), e.details && /* @__PURE__ */ c("span", {
291
+ }), e.details && /* @__PURE__ */ s("span", {
290
292
  className: "dropdown-option-details",
291
293
  children: e.details
292
294
  })]
293
295
  }),
294
- e.count !== void 0 && /* @__PURE__ */ c("span", {
296
+ e.count !== void 0 && /* @__PURE__ */ s("span", {
295
297
  className: "dropdown-option-count",
296
298
  children: e.count
297
299
  })
298
300
  ]
299
- }, `dd-option-${re}-${t}`)), le() && /* @__PURE__ */ c("li", {
301
+ }, `dd-option-${oe}-${t}`)), ae() && /* @__PURE__ */ s("li", {
300
302
  ref: (e) => {
301
303
  D.current[a.length] = e;
302
304
  },
303
- className: `dropdown-option dropdown-option--create ${y === a.length ? "focused" : ""}`,
304
- onClick: G,
305
- onMouseEnter: () => I(a.length),
306
- children: /* @__PURE__ */ c("div", {
305
+ className: `dropdown-option dropdown-option--create ${I === a.length ? "focused" : ""}`,
306
+ onClick: J,
307
+ onMouseEnter: () => E(a.length),
308
+ children: /* @__PURE__ */ s("div", {
307
309
  className: "dropdown-option-content",
308
- children: /* @__PURE__ */ v("span", {
310
+ children: /* @__PURE__ */ b("span", {
309
311
  className: "dropdown-option-label",
310
- children: [/* @__PURE__ */ c(M, { name: "plus" }), /* @__PURE__ */ v("span", { children: [
311
- "Create “",
312
- s,
313
- "”"
314
- ] })]
312
+ children: [/* @__PURE__ */ s(R, { name: "plus" }), /* @__PURE__ */ s("span", { children: S.createOption(c) })]
315
313
  })
316
314
  })
317
315
  })]
318
- }) : /* @__PURE__ */ c("div", {
316
+ }) : /* @__PURE__ */ s("div", {
319
317
  className: "dropdown-no-options",
320
- children: "No options found"
318
+ children: S.noOptions
321
319
  })
322
320
  });
323
- return L ? Ge(n, document.body) : n;
324
- }, b = !i && o.length === 1 ? o[0] : null, B = Ee && !u && !i && o.length > 0, ae = !!(b?.icon && !s && !B), fe = !!(b?.suffixIcon && !B), Q = i && H, ue = o.length > 0, pe = f || w;
325
- return /* @__PURE__ */ v("div", {
326
- className: `dropdown-container ${C ? "dropdown-error" : ""} ${z ? "dropdown-success" : ""} ${Le ? "dropdown-highlighted" : ""} ${i ? "multiple" : ""} ${N ? "disabled" : ""} ${i ? `count-display-${_}` : ""} ${ke}`,
327
- ref: E,
321
+ return k ? Ze(n, document.body) : n;
322
+ }, x = !i && o.length === 1 ? o[0] : null, T = Re && !u && !i && o.length > 0, fe = !!(x?.icon && !c && !T), ue = !!(x?.suffixIcon && !T), X = i && H, pe = Le && o.length > 0, he = f || w;
323
+ return /* @__PURE__ */ b("div", {
324
+ className: `dropdown-container ${F ? "dropdown-error" : ""} ${z ? "dropdown-success" : ""} ${ye ? "dropdown-highlighted" : ""} ${i ? "multiple" : ""} ${N ? "disabled" : ""} ${i ? `count-display-${_}` : ""} ${ke}`,
325
+ ref: M,
328
326
  children: [
329
- V && /* @__PURE__ */ c("label", {
330
- htmlFor: oe,
327
+ ee && /* @__PURE__ */ s("label", {
328
+ htmlFor: ie,
331
329
  className: "dropdown-label",
332
- children: V
330
+ children: ee
333
331
  }),
334
- /* @__PURE__ */ v("div", {
335
- className: `dropdown-input-container ${ae ? "dropdown-input-container--has-prefix-icon" : ""} ${fe ? "dropdown-input-container--has-suffix-icon" : ""} ${Q ? "dropdown-input-container--chips" : ""} ${Q && ye ? "dropdown-input-container--chips-multiline" : ""} ${ue ? "dropdown-input-container--clearable" : ""}`,
332
+ /* @__PURE__ */ b("div", {
333
+ className: `dropdown-input-container ${fe ? "dropdown-input-container--has-prefix-icon" : ""} ${ue ? "dropdown-input-container--has-suffix-icon" : ""} ${X ? "dropdown-input-container--chips" : ""} ${X && Ee ? "dropdown-input-container--chips-multiline" : ""} ${pe ? "dropdown-input-container--clearable" : ""}`,
336
334
  children: [
337
- ae && b?.icon && /* @__PURE__ */ c("span", {
335
+ fe && x?.icon && /* @__PURE__ */ s("span", {
338
336
  className: "dropdown-selected-icon dropdown-selected-icon--prefix",
339
- children: /* @__PURE__ */ c(M, { name: b.icon })
337
+ children: /* @__PURE__ */ s(R, { name: x.icon })
340
338
  }),
341
- B && b && /* @__PURE__ */ v("span", {
339
+ T && x && /* @__PURE__ */ b("span", {
342
340
  className: "dropdown-value-chip",
343
- onClick: de,
344
- children: [b.icon && /* @__PURE__ */ c(M, { name: b.icon }), /* @__PURE__ */ c("span", {
341
+ onClick: le,
342
+ children: [x.icon && /* @__PURE__ */ s(R, { name: x.icon }), /* @__PURE__ */ s("span", {
345
343
  className: "dropdown-value-chip__label",
346
- children: b.label
344
+ children: x.label
347
345
  })]
348
346
  }),
349
- Q && o.map((n) => /* @__PURE__ */ v("span", {
347
+ X && o.map((n) => /* @__PURE__ */ b("span", {
350
348
  className: "dropdown-chip",
351
- children: [/* @__PURE__ */ c("span", {
349
+ children: [/* @__PURE__ */ s("span", {
352
350
  className: "dropdown-chip__label",
353
351
  children: n.label
354
- }), /* @__PURE__ */ c(Ke, {
355
- title: "Remove",
356
- children: /* @__PURE__ */ c("button", {
352
+ }), /* @__PURE__ */ s(Qe, {
353
+ title: S.remove,
354
+ children: /* @__PURE__ */ s("button", {
357
355
  type: "button",
358
356
  className: "dropdown-chip__remove",
359
357
  disabled: N,
360
358
  onClick: (e) => {
361
- e.stopPropagation(), ce(n);
359
+ e.stopPropagation(), de(n);
362
360
  },
363
- children: Ne
361
+ children: $e
364
362
  })
365
363
  })]
366
364
  }, `dd-chip-${n.value}`)),
367
- /* @__PURE__ */ c(Pe, {
368
- ref: K,
369
- id: oe,
370
- placeholder: B ? "" : je(),
371
- value: B ? "" : We(),
372
- onChange: pe ? Be : void 0,
373
- onClick: de,
374
- onKeyDown: Ae,
365
+ /* @__PURE__ */ s(Xe, {
366
+ ref: P,
367
+ id: ie,
368
+ placeholder: T ? "" : _e(),
369
+ value: T ? "" : Fe(),
370
+ onChange: he ? We : void 0,
371
+ onClick: le,
372
+ onKeyDown: je,
375
373
  autoComplete: "off",
376
- autoFocus: $e,
374
+ autoFocus: Oe,
377
375
  disabled: N,
378
- readOnly: !pe
376
+ readOnly: !he
379
377
  }),
380
- /* @__PURE__ */ v("div", {
378
+ /* @__PURE__ */ b("div", {
381
379
  className: "dropdown-actions-buttons",
382
380
  children: [
383
- fe && b?.suffixIcon && /* @__PURE__ */ c("span", {
381
+ ue && x?.suffixIcon && /* @__PURE__ */ s("span", {
384
382
  className: "dropdown-selected-icon dropdown-selected-icon--suffix",
385
- children: /* @__PURE__ */ c(M, { name: b.suffixIcon })
383
+ children: /* @__PURE__ */ s(R, { name: x.suffixIcon })
386
384
  }),
387
- ue && /* @__PURE__ */ c("span", {
385
+ pe && /* @__PURE__ */ s("span", {
388
386
  className: "dropdown-action-button dropdown-clear-button",
389
- children: /* @__PURE__ */ c(xe, {
387
+ children: /* @__PURE__ */ s(be, {
390
388
  variant: "plain",
391
- onClick: Re,
389
+ onClick: Ae,
392
390
  disabled: N,
393
- children: Ne
391
+ children: $e
394
392
  })
395
393
  }),
396
- /* @__PURE__ */ c("span", {
394
+ /* @__PURE__ */ s("span", {
397
395
  className: `dropdown-action-button dropdown-toggle-button ${u ? "open" : ""}`,
398
- children: /* @__PURE__ */ c(xe, {
396
+ children: /* @__PURE__ */ s(be, {
399
397
  variant: "plain",
400
- onClick: Te,
398
+ onClick: He,
401
399
  disabled: N,
402
- children: Je
400
+ children: Ve
403
401
  })
404
402
  })
405
403
  ]
406
404
  }),
407
- Ce()
405
+ ze()
408
406
  ]
409
407
  }),
410
- Fe(),
411
- C && /* @__PURE__ */ c("span", {
408
+ Ue(),
409
+ F && /* @__PURE__ */ s("span", {
412
410
  className: "dropdown-error-message",
413
- children: C
411
+ children: F
414
412
  }),
415
- z && /* @__PURE__ */ c("span", {
413
+ z && /* @__PURE__ */ s("span", {
416
414
  className: "dropdown-success-message",
417
415
  children: z
418
416
  })
@@ -420,5 +418,5 @@ var cn = ({ allowCustomValue: w = !1, autofocus: $e = !1, className: ke = "", di
420
418
  });
421
419
  };
422
420
  export {
423
- cn as Dropdown
421
+ hn as Dropdown
424
422
  };