@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.
- package/dist/components/Banner/Banner2.js +15 -13
- package/dist/components/BoldText/BoldText.js +5 -0
- package/dist/components/Calendar/Calendar2.js +108 -135
- package/dist/components/ColorPicker/ColorPicker.css +1 -1
- package/dist/components/ColorPicker/ColorPicker2.js +114 -114
- package/dist/components/ConfirmDialog/ConfirmDialog2.js +13 -11
- package/dist/components/ConfirmPopover/ConfirmPopover2.js +26 -24
- package/dist/components/ContextMenu/ContextMenu2.js +46 -33
- package/dist/components/ControlPanel/ControlPanel2.js +95 -93
- package/dist/components/ControlPanel/ControlPanelFilter.js +205 -193
- package/dist/components/ControlPanel/ControlPanelOptions.js +190 -185
- package/dist/components/DataView/DataView.CardView.js +83 -81
- package/dist/components/DataView/DataView.ColumnSelector.js +27 -25
- package/dist/components/DataView/DataView.TableView.js +74 -72
- package/dist/components/DataView/DataView2.js +169 -167
- package/dist/components/DatePicker/DatePicker2.js +71 -69
- package/dist/components/Drawer/Drawer2.js +58 -55
- package/dist/components/Dropdown/Dropdown2.js +187 -189
- package/dist/components/InputDate/InputDate2.js +43 -41
- package/dist/components/InputSearch/InputSearch2.js +27 -25
- package/dist/components/MenuBar/MenuBar.css +1 -0
- package/dist/components/MenuBar/MenuBar2.js +46 -0
- package/dist/components/Modal/Modal2.js +49 -47
- package/dist/components/Pagination/Pagination2.js +44 -47
- package/dist/components/ScrollToTop/ScrollToTop2.js +18 -16
- package/dist/components/ThemeSettings/ThemeSettings2.js +131 -123
- package/dist/components/TipsOfTheDay/TipsOfTheDay2.js +16 -12
- package/dist/components/Toast/Toast2.js +38 -33
- package/dist/components/ToolButton/ToolButton.css +1 -0
- package/dist/components/ToolButton/ToolButton2.js +36 -0
- package/dist/components/ToolPalette/ToolPalette.css +1 -0
- package/dist/components/ToolPalette/ToolPalette2.js +83 -0
- package/dist/components/Toolbar/Toolbar2.js +58 -56
- package/dist/contexts/LanguageContext/LanguageContext.context.js +9 -0
- package/dist/contexts/LanguageContext/LanguageContext.js +19 -0
- package/dist/contexts/LanguageContext/libMessages.js +240 -0
- package/dist/helpers/Datetime.js +84 -68
- package/dist/helpers/Language.js +8 -0
- package/dist/helpers/Pagination.js +5 -4
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/hooks/useLanguage.js +16 -0
- package/dist/index.d.ts +133 -6
- package/dist/index.js +417 -399
- package/dist/memobit-icons.json +4 -0
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- package/package.json +1 -1
|
@@ -1,54 +1,56 @@
|
|
|
1
1
|
import './Dropdown.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { createPortal as
|
|
11
|
-
import { caretDown as
|
|
12
|
-
var
|
|
13
|
-
const [u,
|
|
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
|
-
}), [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}),
|
|
23
|
-
if (u &&
|
|
24
|
-
const n = new Set(
|
|
25
|
-
m.forEach((r) => (n.has(r.value) ? e : t).push(r)),
|
|
26
|
-
} else u || (
|
|
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
|
-
|
|
31
|
+
ne,
|
|
30
32
|
i,
|
|
31
33
|
m
|
|
32
|
-
]),
|
|
33
|
-
const n =
|
|
34
|
-
if (!f || !
|
|
34
|
+
]), L(() => {
|
|
35
|
+
const n = q.current ?? m;
|
|
36
|
+
if (!f || !c) te(n);
|
|
35
37
|
else {
|
|
36
|
-
const e =
|
|
37
|
-
|
|
38
|
+
const e = Ne(c), t = n.filter((r) => Ne(r.label).includes(e));
|
|
39
|
+
te(t);
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
E(-1);
|
|
40
42
|
}, [
|
|
41
|
-
|
|
43
|
+
c,
|
|
42
44
|
m,
|
|
43
45
|
f,
|
|
44
46
|
u
|
|
45
47
|
]);
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const n =
|
|
49
|
-
|
|
50
|
-
const e = !Object.is(n, d), t = e && !
|
|
51
|
-
if (e && (
|
|
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((
|
|
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
|
-
]),
|
|
95
|
-
f &&
|
|
96
|
-
}, [
|
|
97
|
-
if (!u || !
|
|
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 (!
|
|
100
|
-
const t =
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
const
|
|
105
|
-
|
|
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
|
|
108
|
-
|
|
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(
|
|
112
|
-
width:
|
|
113
|
-
maxHeight: Math.min(
|
|
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
|
-
|
|
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,
|
|
124
|
+
}, [u, k]), L(() => {
|
|
123
125
|
const n = (e) => {
|
|
124
|
-
if (
|
|
125
|
-
if (
|
|
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 &&
|
|
130
|
-
const t = m.find((r) => r.label.toLowerCase() ===
|
|
131
|
-
label:
|
|
132
|
-
value:
|
|
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),
|
|
137
|
+
h([t]), l(t.label), v(!1), p && p(t, $);
|
|
136
138
|
return;
|
|
137
139
|
}
|
|
138
|
-
|
|
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
|
-
|
|
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
|
-
|
|
156
|
+
k
|
|
155
157
|
]);
|
|
156
|
-
const
|
|
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 ?
|
|
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]),
|
|
164
|
-
},
|
|
165
|
-
if (!w || !
|
|
166
|
-
const n = m.find((t) => t.label.toLowerCase() ===
|
|
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
|
-
|
|
170
|
+
G(n);
|
|
169
171
|
return;
|
|
170
172
|
}
|
|
171
173
|
const e = {
|
|
172
|
-
label:
|
|
173
|
-
value:
|
|
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),
|
|
181
|
-
},
|
|
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 ? (
|
|
184
|
-
},
|
|
185
|
-
h([]), (!f || !i) && l(""),
|
|
186
|
-
},
|
|
187
|
-
l(n), u ||
|
|
188
|
-
},
|
|
189
|
-
N || (
|
|
190
|
-
},
|
|
191
|
-
N || (
|
|
192
|
-
},
|
|
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") && (
|
|
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 &&
|
|
201
|
-
|
|
202
|
-
const t = e < (w &&
|
|
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 &&
|
|
208
|
-
|
|
209
|
-
const t = w &&
|
|
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(),
|
|
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(),
|
|
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 &&
|
|
222
|
+
i && c === "" && o.length > 0 && (n.preventDefault(), de(o[o.length - 1]));
|
|
221
223
|
}
|
|
222
224
|
}
|
|
223
|
-
},
|
|
225
|
+
}, Q = (n) => o.some((e) => e.value === n.value), Ce = () => {
|
|
224
226
|
if (o.length === 0) return "";
|
|
225
|
-
const n = Math.max(1,
|
|
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
|
|
229
|
-
},
|
|
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:
|
|
232
|
-
}) : null,
|
|
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__ */
|
|
235
|
-
ref:
|
|
236
|
-
className: `dropdown-menu ${
|
|
237
|
-
style:
|
|
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:
|
|
240
|
-
bottom:
|
|
241
|
-
left: `${
|
|
242
|
-
width: `${
|
|
243
|
-
maxHeight: `${
|
|
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 ||
|
|
248
|
+
children: a.length > 0 || ae() ? /* @__PURE__ */ b("ul", {
|
|
247
249
|
className: "dropdown-options-list",
|
|
248
|
-
children: [a.map((e, t) => /* @__PURE__ */
|
|
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 || ""} ${
|
|
253
|
-
onClick: () =>
|
|
254
|
-
onMouseEnter: () =>
|
|
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__ */
|
|
259
|
+
i && /* @__PURE__ */ s("div", {
|
|
258
260
|
className: "dropdown-option-checkbox",
|
|
259
|
-
children: /* @__PURE__ */
|
|
260
|
-
className: `checkbox ${
|
|
261
|
-
children:
|
|
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__ */
|
|
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__ */
|
|
278
|
+
/* @__PURE__ */ b("div", {
|
|
277
279
|
className: "dropdown-option-content",
|
|
278
|
-
children: [/* @__PURE__ */
|
|
280
|
+
children: [/* @__PURE__ */ b("span", {
|
|
279
281
|
className: "dropdown-option-label",
|
|
280
282
|
children: [
|
|
281
|
-
e.prefix && /* @__PURE__ */
|
|
283
|
+
e.prefix && /* @__PURE__ */ s("span", {
|
|
282
284
|
className: "dropdown-option-prefix",
|
|
283
285
|
children: e.prefix
|
|
284
286
|
}),
|
|
285
|
-
e.icon && /* @__PURE__ */
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
e.suffixIcon && /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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-${
|
|
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 ${
|
|
304
|
-
onClick:
|
|
305
|
-
onMouseEnter: () =>
|
|
306
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
310
|
+
children: /* @__PURE__ */ b("span", {
|
|
309
311
|
className: "dropdown-option-label",
|
|
310
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
316
|
+
}) : /* @__PURE__ */ s("div", {
|
|
319
317
|
className: "dropdown-no-options",
|
|
320
|
-
children:
|
|
318
|
+
children: S.noOptions
|
|
321
319
|
})
|
|
322
320
|
});
|
|
323
|
-
return
|
|
324
|
-
},
|
|
325
|
-
return /* @__PURE__ */
|
|
326
|
-
className: `dropdown-container ${
|
|
327
|
-
ref:
|
|
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
|
-
|
|
330
|
-
htmlFor:
|
|
327
|
+
ee && /* @__PURE__ */ s("label", {
|
|
328
|
+
htmlFor: ie,
|
|
331
329
|
className: "dropdown-label",
|
|
332
|
-
children:
|
|
330
|
+
children: ee
|
|
333
331
|
}),
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
className: `dropdown-input-container ${
|
|
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
|
-
|
|
335
|
+
fe && x?.icon && /* @__PURE__ */ s("span", {
|
|
338
336
|
className: "dropdown-selected-icon dropdown-selected-icon--prefix",
|
|
339
|
-
children: /* @__PURE__ */
|
|
337
|
+
children: /* @__PURE__ */ s(R, { name: x.icon })
|
|
340
338
|
}),
|
|
341
|
-
|
|
339
|
+
T && x && /* @__PURE__ */ b("span", {
|
|
342
340
|
className: "dropdown-value-chip",
|
|
343
|
-
onClick:
|
|
344
|
-
children: [
|
|
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:
|
|
344
|
+
children: x.label
|
|
347
345
|
})]
|
|
348
346
|
}),
|
|
349
|
-
|
|
347
|
+
X && o.map((n) => /* @__PURE__ */ b("span", {
|
|
350
348
|
className: "dropdown-chip",
|
|
351
|
-
children: [/* @__PURE__ */
|
|
349
|
+
children: [/* @__PURE__ */ s("span", {
|
|
352
350
|
className: "dropdown-chip__label",
|
|
353
351
|
children: n.label
|
|
354
|
-
}), /* @__PURE__ */
|
|
355
|
-
title:
|
|
356
|
-
children: /* @__PURE__ */
|
|
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(),
|
|
359
|
+
e.stopPropagation(), de(n);
|
|
362
360
|
},
|
|
363
|
-
children:
|
|
361
|
+
children: $e
|
|
364
362
|
})
|
|
365
363
|
})]
|
|
366
364
|
}, `dd-chip-${n.value}`)),
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
ref:
|
|
369
|
-
id:
|
|
370
|
-
placeholder:
|
|
371
|
-
value:
|
|
372
|
-
onChange:
|
|
373
|
-
onClick:
|
|
374
|
-
onKeyDown:
|
|
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:
|
|
374
|
+
autoFocus: Oe,
|
|
377
375
|
disabled: N,
|
|
378
|
-
readOnly: !
|
|
376
|
+
readOnly: !he
|
|
379
377
|
}),
|
|
380
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ b("div", {
|
|
381
379
|
className: "dropdown-actions-buttons",
|
|
382
380
|
children: [
|
|
383
|
-
|
|
381
|
+
ue && x?.suffixIcon && /* @__PURE__ */ s("span", {
|
|
384
382
|
className: "dropdown-selected-icon dropdown-selected-icon--suffix",
|
|
385
|
-
children: /* @__PURE__ */
|
|
383
|
+
children: /* @__PURE__ */ s(R, { name: x.suffixIcon })
|
|
386
384
|
}),
|
|
387
|
-
|
|
385
|
+
pe && /* @__PURE__ */ s("span", {
|
|
388
386
|
className: "dropdown-action-button dropdown-clear-button",
|
|
389
|
-
children: /* @__PURE__ */
|
|
387
|
+
children: /* @__PURE__ */ s(be, {
|
|
390
388
|
variant: "plain",
|
|
391
|
-
onClick:
|
|
389
|
+
onClick: Ae,
|
|
392
390
|
disabled: N,
|
|
393
|
-
children:
|
|
391
|
+
children: $e
|
|
394
392
|
})
|
|
395
393
|
}),
|
|
396
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ s("span", {
|
|
397
395
|
className: `dropdown-action-button dropdown-toggle-button ${u ? "open" : ""}`,
|
|
398
|
-
children: /* @__PURE__ */
|
|
396
|
+
children: /* @__PURE__ */ s(be, {
|
|
399
397
|
variant: "plain",
|
|
400
|
-
onClick:
|
|
398
|
+
onClick: He,
|
|
401
399
|
disabled: N,
|
|
402
|
-
children:
|
|
400
|
+
children: Ve
|
|
403
401
|
})
|
|
404
402
|
})
|
|
405
403
|
]
|
|
406
404
|
}),
|
|
407
|
-
|
|
405
|
+
ze()
|
|
408
406
|
]
|
|
409
407
|
}),
|
|
410
|
-
|
|
411
|
-
|
|
408
|
+
Ue(),
|
|
409
|
+
F && /* @__PURE__ */ s("span", {
|
|
412
410
|
className: "dropdown-error-message",
|
|
413
|
-
children:
|
|
411
|
+
children: F
|
|
414
412
|
}),
|
|
415
|
-
z && /* @__PURE__ */
|
|
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
|
-
|
|
421
|
+
hn as Dropdown
|
|
424
422
|
};
|