@memobit/libs 3.1.3 → 3.1.5
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/ColorPicker/ColorPicker.css +1 -1
- package/dist/components/ColorPicker/ColorPicker2.js +178 -148
- package/dist/components/ControlPanel/ControlPanelFilter.js +60 -57
- package/dist/components/Drawer/Drawer2.js +65 -54
- package/dist/components/EmojiPicker/EmojiPicker2.js +21 -18
- package/dist/components/EventCalendar/EventCalendar2.js +30 -32
- package/dist/components/IconPicker/IconPicker2.js +28 -25
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/hooks/useBodyScrollLock.js +17 -21
- package/dist/index.d.ts +10 -0
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- package/package.json +1 -1
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { Icon as
|
|
1
|
+
import { Icon as b } from "../Icon/Icon2.js";
|
|
2
2
|
import { Button as C } from "../Button/Button2.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
3
|
+
import { Tooltip as k } from "../Tooltip/Tooltip2.js";
|
|
4
|
+
import { Chip as S } from "../Chip/Chip2.js";
|
|
5
|
+
import { InputNumber as x } from "../InputNumber/InputNumber2.js";
|
|
6
|
+
import { InputText as w } from "../InputText/InputText2.js";
|
|
7
|
+
import { DatePicker as R } from "../DatePicker/DatePicker2.js";
|
|
8
|
+
import { Dropdown as E } from "../Dropdown/Dropdown2.js";
|
|
9
|
+
import { InputDate as L } from "../InputDate/InputDate2.js";
|
|
10
|
+
import { InputSearch as D } from "../InputSearch/InputSearch2.js";
|
|
11
|
+
import { Rating as M } from "../Rating/Rating2.js";
|
|
12
|
+
import { DEFAULT_DATE_RANGE_PRESETS as T } from "./ControlPanel.types.js";
|
|
13
|
+
import { Fragment as P, useEffect as V, useRef as j, useState as A } from "react";
|
|
13
14
|
import { jsx as n, jsxs as _ } from "react/jsx-runtime";
|
|
14
|
-
var
|
|
15
|
+
var H = 3, f = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean" ? [] : [e], I = (e) => e.every((r) => typeof r == "number") ? e : e.map(String), N = 2, U = (e) => {
|
|
15
16
|
const r = e.options ?? [];
|
|
16
|
-
return
|
|
17
|
-
},
|
|
17
|
+
return f(e.value).map((o) => r.find((t) => t.value === o)?.label ?? String(o));
|
|
18
|
+
}, B = (e) => {
|
|
18
19
|
const { type: r, value: o } = e;
|
|
19
20
|
if (o == null || o === "") return;
|
|
20
21
|
if (r === "checkbox") return o === !0 ? "On" : void 0;
|
|
@@ -28,15 +29,15 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
28
29
|
}
|
|
29
30
|
if (r === "rating") return typeof o == "number" && o > 0 ? String(o) : void 0;
|
|
30
31
|
if (r === "text" || r === "search" || r === "date" || r === "number") return String(o);
|
|
31
|
-
const t =
|
|
32
|
+
const t = U(e);
|
|
32
33
|
if (t.length !== 0)
|
|
33
|
-
return t.length <=
|
|
34
|
-
},
|
|
35
|
-
const t = r && e.type !== "checkbox", [s, d] =
|
|
34
|
+
return t.length <= N ? t.join(", ") : `${t.slice(0, N).join(", ")} +${t.length - N}`;
|
|
35
|
+
}, te = ({ filter: e, collapsible: r = !1, onChange: o }) => {
|
|
36
|
+
const t = r && e.type !== "checkbox", [s, d] = A(e.defaultExpanded ?? !1), a = e.summary ?? B(e), i = /* @__PURE__ */ _("span", {
|
|
36
37
|
className: `control-panel__filter-title${e.isActive ? " control-panel__filter-title--active" : ""}`,
|
|
37
38
|
children: [
|
|
38
39
|
e.isActive && /* @__PURE__ */ n("span", { className: "control-panel__filter-active-dot" }),
|
|
39
|
-
e.icon && /* @__PURE__ */ n(
|
|
40
|
+
e.icon && /* @__PURE__ */ n(b, { name: e.icon }),
|
|
40
41
|
e.label
|
|
41
42
|
]
|
|
42
43
|
});
|
|
@@ -59,19 +60,19 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
59
60
|
}),
|
|
60
61
|
/* @__PURE__ */ n("span", {
|
|
61
62
|
className: "control-panel__filter-caret",
|
|
62
|
-
children: /* @__PURE__ */ n(
|
|
63
|
+
children: /* @__PURE__ */ n(b, { name: s ? "caret-up" : "caret-down" })
|
|
63
64
|
})
|
|
64
65
|
]
|
|
65
|
-
}) : e.type !== "checkbox" && i, (!t || s) && /* @__PURE__ */ n(
|
|
66
|
+
}) : e.type !== "checkbox" && i, (!t || s) && /* @__PURE__ */ n(z, {
|
|
66
67
|
filter: e,
|
|
67
68
|
onChange: o
|
|
68
69
|
})]
|
|
69
70
|
});
|
|
70
|
-
},
|
|
71
|
-
const [t, s] =
|
|
72
|
-
return
|
|
71
|
+
}, Y = ({ placeholder: e, value: r, onChange: o }) => {
|
|
72
|
+
const [t, s] = A(r), d = j(r);
|
|
73
|
+
return V(() => {
|
|
73
74
|
r !== d.current && (d.current = r, s(r));
|
|
74
|
-
}, [r]), /* @__PURE__ */ n(
|
|
75
|
+
}, [r]), /* @__PURE__ */ n(D, {
|
|
75
76
|
className: "control-panel__filter-search",
|
|
76
77
|
onChange: (a) => {
|
|
77
78
|
d.current = a, s(a), o(a);
|
|
@@ -79,9 +80,9 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
79
80
|
placeholder: e,
|
|
80
81
|
value: t
|
|
81
82
|
});
|
|
82
|
-
},
|
|
83
|
-
const o =
|
|
84
|
-
if (e.type === "checkbox") return /* @__PURE__ */ n(
|
|
83
|
+
}, z = ({ filter: e, onChange: r }) => {
|
|
84
|
+
const o = f(e.value), t = e.options ?? [], [s, d] = A("");
|
|
85
|
+
if (e.type === "checkbox") return /* @__PURE__ */ n(S, {
|
|
85
86
|
count: e.count,
|
|
86
87
|
selected: e.value === !0,
|
|
87
88
|
onClick: () => r({
|
|
@@ -91,7 +92,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
91
92
|
}),
|
|
92
93
|
children: e.label
|
|
93
94
|
});
|
|
94
|
-
if (e.type === "date") return /* @__PURE__ */ n(
|
|
95
|
+
if (e.type === "date") return /* @__PURE__ */ n(L, {
|
|
95
96
|
min: e.minDate,
|
|
96
97
|
max: e.maxDate,
|
|
97
98
|
value: typeof e.value == "string" ? e.value : "",
|
|
@@ -103,7 +104,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
103
104
|
});
|
|
104
105
|
if (e.type === "text") return /* @__PURE__ */ n("div", {
|
|
105
106
|
className: "control-panel__filter-text",
|
|
106
|
-
children: /* @__PURE__ */ n(
|
|
107
|
+
children: /* @__PURE__ */ n(w, {
|
|
107
108
|
onChange: (a) => r({
|
|
108
109
|
filterId: e.id,
|
|
109
110
|
type: e.type,
|
|
@@ -113,7 +114,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
113
114
|
value: typeof e.value == "string" ? e.value : ""
|
|
114
115
|
})
|
|
115
116
|
});
|
|
116
|
-
if (e.type === "search") return /* @__PURE__ */ n(
|
|
117
|
+
if (e.type === "search") return /* @__PURE__ */ n(Y, {
|
|
117
118
|
placeholder: e.placeholder,
|
|
118
119
|
value: typeof e.value == "string" ? e.value : "",
|
|
119
120
|
onChange: (a) => r({
|
|
@@ -124,7 +125,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
124
125
|
});
|
|
125
126
|
if (e.type === "number") return /* @__PURE__ */ n("div", {
|
|
126
127
|
className: "control-panel__filter-number",
|
|
127
|
-
children: /* @__PURE__ */ n(
|
|
128
|
+
children: /* @__PURE__ */ n(x, {
|
|
128
129
|
min: e.min,
|
|
129
130
|
max: e.max,
|
|
130
131
|
step: e.step,
|
|
@@ -137,7 +138,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
137
138
|
})
|
|
138
139
|
})
|
|
139
140
|
});
|
|
140
|
-
if (e.type === "rating") return /* @__PURE__ */ n(
|
|
141
|
+
if (e.type === "rating") return /* @__PURE__ */ n(M, {
|
|
141
142
|
selectable: !0,
|
|
142
143
|
icon: e.ratingIcon ?? "star",
|
|
143
144
|
maxRate: e.maxRate ?? 10,
|
|
@@ -158,7 +159,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
158
159
|
return /* @__PURE__ */ _("div", {
|
|
159
160
|
className: "control-panel__filter-range",
|
|
160
161
|
children: [
|
|
161
|
-
/* @__PURE__ */ n(
|
|
162
|
+
/* @__PURE__ */ n(x, {
|
|
162
163
|
min: e.min,
|
|
163
164
|
max: e.max,
|
|
164
165
|
step: e.step,
|
|
@@ -171,7 +172,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
171
172
|
className: "control-panel__filter-range-sep",
|
|
172
173
|
children: "—"
|
|
173
174
|
}),
|
|
174
|
-
/* @__PURE__ */ n(
|
|
175
|
+
/* @__PURE__ */ n(x, {
|
|
175
176
|
min: e.min,
|
|
176
177
|
max: e.max,
|
|
177
178
|
step: e.step,
|
|
@@ -184,19 +185,19 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
184
185
|
});
|
|
185
186
|
}
|
|
186
187
|
if (e.type === "date-range") {
|
|
187
|
-
const a = Array.isArray(e.value) ? e.value : [], i = a[0] || void 0, l = a[1] || void 0, m = e.presets ??
|
|
188
|
+
const a = Array.isArray(e.value) ? e.value : [], i = a[0] || void 0, l = a[1] || void 0, m = e.presets ?? T, p = (c) => {
|
|
188
189
|
if (!c) return;
|
|
189
|
-
const [h,
|
|
190
|
-
return new Date(h,
|
|
190
|
+
const [h, g, $] = c.split("-").map(Number);
|
|
191
|
+
return new Date(h, g - 1, $);
|
|
191
192
|
}, u = (c) => `${c.getFullYear()}-${String(c.getMonth() + 1).padStart(2, "0")}-${String(c.getDate()).padStart(2, "0")}`, v = (c, h) => r({
|
|
192
193
|
filterId: e.id,
|
|
193
194
|
type: e.type,
|
|
194
195
|
value: [c ?? "", h ?? ""]
|
|
195
|
-
}),
|
|
196
|
+
}), y = (c) => {
|
|
196
197
|
const h = e.maxDate ? p(e.maxDate) : /* @__PURE__ */ new Date();
|
|
197
198
|
if (!h) return;
|
|
198
|
-
const
|
|
199
|
-
|
|
199
|
+
const g = new Date(h);
|
|
200
|
+
g.setDate(g.getDate() - c), v(u(g), u(h));
|
|
200
201
|
};
|
|
201
202
|
return /* @__PURE__ */ _("div", {
|
|
202
203
|
className: "control-panel__filter-date-range",
|
|
@@ -205,10 +206,10 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
205
206
|
children: m.map((c) => /* @__PURE__ */ n(C, {
|
|
206
207
|
size: "small",
|
|
207
208
|
variant: "default",
|
|
208
|
-
onClick: () =>
|
|
209
|
+
onClick: () => y(c.days),
|
|
209
210
|
children: c.label
|
|
210
211
|
}, c.days))
|
|
211
|
-
}), /* @__PURE__ */ n(
|
|
212
|
+
}), /* @__PURE__ */ n(R, {
|
|
212
213
|
mode: "range",
|
|
213
214
|
minDate: p(e.minDate),
|
|
214
215
|
maxDate: p(e.maxDate),
|
|
@@ -228,7 +229,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
228
229
|
});
|
|
229
230
|
}
|
|
230
231
|
if (e.type === "dropdown")
|
|
231
|
-
return !e.multiple && t.length > 0 && t.length <=
|
|
232
|
+
return !e.multiple && t.length > 0 && t.length <= H ? /* @__PURE__ */ n("div", {
|
|
232
233
|
className: `control-panel__filter-list ${e.inline ? "control-panel__filter-list--inline" : ""}`,
|
|
233
234
|
children: t.map((a) => {
|
|
234
235
|
const i = e.value === a.value;
|
|
@@ -255,7 +256,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
255
256
|
className: "control-panel__filter-swatch",
|
|
256
257
|
style: { backgroundColor: a.color }
|
|
257
258
|
}),
|
|
258
|
-
a.icon && /* @__PURE__ */ n(
|
|
259
|
+
a.icon && /* @__PURE__ */ n(b, { name: a.icon }),
|
|
259
260
|
/* @__PURE__ */ n("span", {
|
|
260
261
|
className: "control-panel__filter-label",
|
|
261
262
|
children: a.label
|
|
@@ -268,7 +269,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
268
269
|
})
|
|
269
270
|
}, a.value);
|
|
270
271
|
})
|
|
271
|
-
}) : /* @__PURE__ */ n(
|
|
272
|
+
}) : /* @__PURE__ */ n(E, {
|
|
272
273
|
className: "control-panel__filter-dropdown",
|
|
273
274
|
multiple: e.multiple,
|
|
274
275
|
name: e.id,
|
|
@@ -277,7 +278,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
277
278
|
r({
|
|
278
279
|
filterId: e.id,
|
|
279
280
|
type: e.type,
|
|
280
|
-
value: Array.isArray(a) ?
|
|
281
|
+
value: Array.isArray(a) ? I(a.map((l) => l.value)) : a?.value ?? null,
|
|
281
282
|
option: Array.isArray(a) ? null : a,
|
|
282
283
|
options: i
|
|
283
284
|
});
|
|
@@ -293,7 +294,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
293
294
|
const a = s.trim().toLowerCase(), i = e.searchable && a ? t.filter((l) => l.label.toLowerCase().includes(a)) : t;
|
|
294
295
|
return /* @__PURE__ */ _("div", {
|
|
295
296
|
className: "control-panel__filter-chips-wrap",
|
|
296
|
-
children: [e.searchable && t.length > 0 && /* @__PURE__ */ n(
|
|
297
|
+
children: [e.searchable && t.length > 0 && /* @__PURE__ */ n(D, {
|
|
297
298
|
className: "control-panel__filter-chip-search",
|
|
298
299
|
value: s,
|
|
299
300
|
onChange: d,
|
|
@@ -305,23 +306,21 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
305
306
|
overflowY: "auto"
|
|
306
307
|
} : void 0,
|
|
307
308
|
children: i.map((l) => {
|
|
308
|
-
const m = o.includes(l.value)
|
|
309
|
-
return /* @__PURE__ */ _(A, {
|
|
309
|
+
const m = o.includes(l.value), p = /* @__PURE__ */ _(S, {
|
|
310
310
|
color: l.color,
|
|
311
311
|
count: l.count,
|
|
312
312
|
disabled: l.disabled,
|
|
313
313
|
icon: l.icon,
|
|
314
|
-
title: l.tooltip,
|
|
315
314
|
selected: m,
|
|
316
315
|
onClick: () => {
|
|
317
316
|
if (l.disabled) return;
|
|
318
|
-
const
|
|
317
|
+
const u = e.multiple === !1, v = u ? m ? [] : [l.value] : m ? o.filter((y) => y !== l.value) : [...o, l.value];
|
|
319
318
|
r({
|
|
320
319
|
filterId: e.id,
|
|
321
320
|
type: e.type,
|
|
322
|
-
value:
|
|
321
|
+
value: u ? v[0] ?? null : I(v),
|
|
323
322
|
option: l,
|
|
324
|
-
options: t.filter((
|
|
323
|
+
options: t.filter((y) => v.includes(y.value))
|
|
325
324
|
});
|
|
326
325
|
},
|
|
327
326
|
children: [l.imageUrl && /* @__PURE__ */ n("img", {
|
|
@@ -329,7 +328,11 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
329
328
|
src: l.imageUrl,
|
|
330
329
|
alt: ""
|
|
331
330
|
}), l.label]
|
|
332
|
-
}
|
|
331
|
+
});
|
|
332
|
+
return l.tooltip ? /* @__PURE__ */ n(k, {
|
|
333
|
+
title: l.tooltip,
|
|
334
|
+
children: p
|
|
335
|
+
}, l.value) : /* @__PURE__ */ n(P, { children: p }, l.value);
|
|
333
336
|
})
|
|
334
337
|
})]
|
|
335
338
|
});
|
|
@@ -363,7 +366,7 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
363
366
|
className: "control-panel__filter-swatch",
|
|
364
367
|
style: { backgroundColor: a.color }
|
|
365
368
|
}),
|
|
366
|
-
a.icon && /* @__PURE__ */ n(
|
|
369
|
+
a.icon && /* @__PURE__ */ n(b, {
|
|
367
370
|
className: "control-panel__filter-icon",
|
|
368
371
|
name: a.icon
|
|
369
372
|
}),
|
|
@@ -382,5 +385,5 @@ var V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
382
385
|
});
|
|
383
386
|
};
|
|
384
387
|
export {
|
|
385
|
-
|
|
388
|
+
te as ControlPanelFilterItem
|
|
386
389
|
};
|
|
@@ -1,63 +1,74 @@
|
|
|
1
1
|
import './Drawer.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { useBodyScrollLock as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Tooltip as
|
|
2
|
+
import { Icon as T } from "../Icon/Icon2.js";
|
|
3
|
+
import { useBodyScrollLock as Z } from "../../hooks/useBodyScrollLock.js";
|
|
4
|
+
import { Button as l } from "../Button/Button2.js";
|
|
5
|
+
import { Tooltip as v } from "../Tooltip/Tooltip2.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import
|
|
8
|
-
import { Fragment as
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
const [
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const e =
|
|
16
|
-
|
|
7
|
+
import V, { useEffect as b, useState as W } from "react";
|
|
8
|
+
import { Fragment as X, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
9
|
+
var q = 1e3, N = 0, o = [], U = ({ isOpen: n, onClose: s, position: p = "left", width: g = "320px", maxWidth: C = "none", margin: I = 0, borderRadius: E = 0, shadow: z = "none", children: S, title: c, icon: m, className: j = "", showOverlay: D = !0, lockScroll: F = !0, hideClose: $ = !1, actions: _ = [], onBack: f, backLabel: B = "Back", primary: t, secondary: a, footer: h }) => {
|
|
10
|
+
Z(n && F);
|
|
11
|
+
const [w, L] = W(0);
|
|
12
|
+
if (b(() => {
|
|
13
|
+
if (!n) return;
|
|
14
|
+
N += 1;
|
|
15
|
+
const e = N;
|
|
16
|
+
return L(e), o.push(e), () => {
|
|
17
|
+
const d = o.indexOf(e);
|
|
18
|
+
d !== -1 && o.splice(d, 1);
|
|
19
|
+
};
|
|
20
|
+
}, [n]), b(() => {
|
|
21
|
+
if (!n) return;
|
|
22
|
+
const e = (d) => {
|
|
23
|
+
d.key !== "Escape" || o[o.length - 1] !== w || s();
|
|
17
24
|
};
|
|
18
25
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
19
|
-
}, [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"--drawer-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
}, [
|
|
27
|
+
n,
|
|
28
|
+
s,
|
|
29
|
+
w
|
|
30
|
+
]), !n) return null;
|
|
31
|
+
const u = (e) => typeof e == "number" ? `${e}px` : e, k = q + w * 2, R = {
|
|
32
|
+
"--drawer-width": g,
|
|
33
|
+
"--drawer-max-width": u(C),
|
|
34
|
+
"--drawer-margin": u(I),
|
|
35
|
+
"--drawer-border-radius": u(E),
|
|
36
|
+
"--drawer-shadow": z,
|
|
37
|
+
zIndex: k + 1
|
|
38
|
+
}, A = h || t || a;
|
|
39
|
+
return /* @__PURE__ */ i(X, { children: [D && /* @__PURE__ */ r("div", {
|
|
29
40
|
className: "drawer-overlay",
|
|
30
|
-
onClick:
|
|
31
|
-
style: { zIndex:
|
|
32
|
-
}), /* @__PURE__ */
|
|
33
|
-
className: `drawer drawer--${
|
|
34
|
-
style:
|
|
41
|
+
onClick: s,
|
|
42
|
+
style: { zIndex: k }
|
|
43
|
+
}), /* @__PURE__ */ i("div", {
|
|
44
|
+
className: `drawer drawer--${p} ${j}`,
|
|
45
|
+
style: R,
|
|
35
46
|
children: [
|
|
36
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ i("div", {
|
|
37
48
|
className: "drawer__header",
|
|
38
49
|
children: [
|
|
39
|
-
|
|
40
|
-
title:
|
|
50
|
+
f && /* @__PURE__ */ r(v, {
|
|
51
|
+
title: B,
|
|
41
52
|
position: "bottom",
|
|
42
|
-
children: /* @__PURE__ */ r(
|
|
53
|
+
children: /* @__PURE__ */ r(l, {
|
|
43
54
|
className: "drawer__back",
|
|
44
|
-
onClick:
|
|
55
|
+
onClick: f,
|
|
45
56
|
size: "small",
|
|
46
57
|
variant: "ghost",
|
|
47
58
|
icon: "arrow-left"
|
|
48
59
|
})
|
|
49
60
|
}),
|
|
50
|
-
(
|
|
61
|
+
(c || m) && /* @__PURE__ */ i("h2", {
|
|
51
62
|
className: "drawer__title",
|
|
52
|
-
children: [
|
|
63
|
+
children: [m && /* @__PURE__ */ r(T, { name: m }), c && /* @__PURE__ */ r("span", {
|
|
53
64
|
className: "drawer__title-text",
|
|
54
|
-
children:
|
|
65
|
+
children: c
|
|
55
66
|
})]
|
|
56
67
|
}),
|
|
57
68
|
_.length > 0 && /* @__PURE__ */ r("div", {
|
|
58
69
|
className: "drawer__header-actions",
|
|
59
70
|
children: _.map((e) => {
|
|
60
|
-
const
|
|
71
|
+
const d = /* @__PURE__ */ r(l, {
|
|
61
72
|
disabled: e.disabled,
|
|
62
73
|
onClick: e.onClick,
|
|
63
74
|
icon: e.icon,
|
|
@@ -65,20 +76,20 @@ var X = 1e3, x = 0, Q = ({ isOpen: d, onClose: n, position: b = "left", width: N
|
|
|
65
76
|
size: e.size ?? "small",
|
|
66
77
|
variant: e.variant ?? "ghost",
|
|
67
78
|
children: e.label
|
|
68
|
-
}),
|
|
69
|
-
return
|
|
70
|
-
title:
|
|
79
|
+
}), x = e.title ?? e.label;
|
|
80
|
+
return x ? /* @__PURE__ */ r(v, {
|
|
81
|
+
title: x,
|
|
71
82
|
position: "bottom",
|
|
72
|
-
children:
|
|
73
|
-
}, e.id) : /* @__PURE__ */ r(
|
|
83
|
+
children: d
|
|
84
|
+
}, e.id) : /* @__PURE__ */ r(V.Fragment, { children: d }, e.id);
|
|
74
85
|
})
|
|
75
86
|
}),
|
|
76
|
-
|
|
87
|
+
!$ && /* @__PURE__ */ r(v, {
|
|
77
88
|
title: "Close drawer",
|
|
78
|
-
children: /* @__PURE__ */ r(
|
|
89
|
+
children: /* @__PURE__ */ r(l, {
|
|
79
90
|
className: "drawer__close",
|
|
80
91
|
icon: "clear",
|
|
81
|
-
onClick:
|
|
92
|
+
onClick: s,
|
|
82
93
|
size: "medium",
|
|
83
94
|
variant: "ghost"
|
|
84
95
|
})
|
|
@@ -87,22 +98,22 @@ var X = 1e3, x = 0, Q = ({ isOpen: d, onClose: n, position: b = "left", width: N
|
|
|
87
98
|
}),
|
|
88
99
|
/* @__PURE__ */ r("div", {
|
|
89
100
|
className: "drawer__content",
|
|
90
|
-
children:
|
|
101
|
+
children: S
|
|
91
102
|
}),
|
|
92
|
-
|
|
103
|
+
A && /* @__PURE__ */ i("div", {
|
|
93
104
|
className: "drawer__footer",
|
|
94
|
-
children: [
|
|
105
|
+
children: [h && /* @__PURE__ */ r("div", {
|
|
95
106
|
className: "drawer__footer-content",
|
|
96
|
-
children:
|
|
97
|
-
}), (t || a) && /* @__PURE__ */
|
|
107
|
+
children: h
|
|
108
|
+
}), (t || a) && /* @__PURE__ */ i("div", {
|
|
98
109
|
className: "drawer__footer-actions",
|
|
99
|
-
children: [a && /* @__PURE__ */ r(
|
|
110
|
+
children: [a && /* @__PURE__ */ r(l, {
|
|
100
111
|
variant: a.variant || "default",
|
|
101
112
|
icon: a.icon,
|
|
102
113
|
disabled: a.disabled,
|
|
103
114
|
onClick: a.onClick,
|
|
104
115
|
children: a.text
|
|
105
|
-
}), t && /* @__PURE__ */ r(
|
|
116
|
+
}), t && /* @__PURE__ */ r(l, {
|
|
106
117
|
variant: t.variant || "info",
|
|
107
118
|
icon: t.icon,
|
|
108
119
|
disabled: t.disabled,
|
|
@@ -115,5 +126,5 @@ var X = 1e3, x = 0, Q = ({ isOpen: d, onClose: n, position: b = "left", width: N
|
|
|
115
126
|
})] });
|
|
116
127
|
};
|
|
117
128
|
export {
|
|
118
|
-
|
|
129
|
+
U as Drawer
|
|
119
130
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import './EmojiPicker.css';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Tooltip as h } from "../Tooltip/Tooltip2.js";
|
|
3
|
+
import { InputSearch as v } from "../InputSearch/InputSearch2.js";
|
|
4
|
+
import { EMOJI_KEYWORDS as _ } from "./emojiKeywords/index.js";
|
|
4
5
|
/* empty css */
|
|
5
|
-
import { useMemo as
|
|
6
|
-
import { jsx as i, jsxs as
|
|
6
|
+
import { useMemo as f, useState as a } from "react";
|
|
7
|
+
import { jsx as i, jsxs as k } from "react/jsx-runtime";
|
|
7
8
|
var m = [
|
|
8
9
|
{
|
|
9
10
|
id: "smileys",
|
|
@@ -743,18 +744,18 @@ var m = [
|
|
|
743
744
|
"🈲"
|
|
744
745
|
]
|
|
745
746
|
}
|
|
746
|
-
],
|
|
747
|
-
const [o, d] =
|
|
747
|
+
], A = ({ value: n, onChange: l }) => {
|
|
748
|
+
const [o, d] = a(""), [r, p] = a(m[0].id), c = f(() => {
|
|
748
749
|
if (!o.trim()) return null;
|
|
749
750
|
const e = o.toLowerCase();
|
|
750
|
-
return m.flatMap((s) => s.emojis.filter((
|
|
751
|
-
}, [o]),
|
|
752
|
-
return /* @__PURE__ */
|
|
751
|
+
return m.flatMap((s) => s.emojis.filter((j) => _[j]?.some((u) => u.includes(e)) || s.name.toLowerCase().includes(e)));
|
|
752
|
+
}, [o]), t = c ?? m.find((e) => e.id === r)?.emojis ?? [];
|
|
753
|
+
return /* @__PURE__ */ k("div", {
|
|
753
754
|
className: "emoji-picker",
|
|
754
755
|
children: [
|
|
755
756
|
/* @__PURE__ */ i("div", {
|
|
756
757
|
className: "emoji-picker__search",
|
|
757
|
-
children: /* @__PURE__ */ i(
|
|
758
|
+
children: /* @__PURE__ */ i(v, {
|
|
758
759
|
placeholder: "Search emoji...",
|
|
759
760
|
value: o,
|
|
760
761
|
onChange: d,
|
|
@@ -763,20 +764,22 @@ var m = [
|
|
|
763
764
|
}),
|
|
764
765
|
!c && /* @__PURE__ */ i("div", {
|
|
765
766
|
className: "emoji-picker__categories",
|
|
766
|
-
children: m.map((e) => /* @__PURE__ */ i(
|
|
767
|
-
className: `emoji-picker__cat-btn${r === e.id ? " is-active" : ""}`,
|
|
767
|
+
children: m.map((e) => /* @__PURE__ */ i(h, {
|
|
768
768
|
title: e.name,
|
|
769
|
-
|
|
770
|
-
|
|
769
|
+
children: /* @__PURE__ */ i("button", {
|
|
770
|
+
className: `emoji-picker__cat-btn${r === e.id ? " is-active" : ""}`,
|
|
771
|
+
onClick: () => p(e.id),
|
|
772
|
+
children: e.icon
|
|
773
|
+
})
|
|
771
774
|
}, e.id))
|
|
772
775
|
}),
|
|
773
776
|
/* @__PURE__ */ i("div", {
|
|
774
777
|
className: "emoji-picker__grid",
|
|
775
|
-
children:
|
|
778
|
+
children: t.length === 0 ? /* @__PURE__ */ i("p", {
|
|
776
779
|
className: "emoji-picker__empty",
|
|
777
780
|
children: "No results"
|
|
778
|
-
}) :
|
|
779
|
-
className: `emoji-picker__emoji${
|
|
781
|
+
}) : t.map((e, s) => /* @__PURE__ */ i("button", {
|
|
782
|
+
className: `emoji-picker__emoji${n === e ? " is-selected" : ""}`,
|
|
780
783
|
onClick: () => l?.(e),
|
|
781
784
|
children: e
|
|
782
785
|
}, s))
|
|
@@ -785,5 +788,5 @@ var m = [
|
|
|
785
788
|
});
|
|
786
789
|
};
|
|
787
790
|
export {
|
|
788
|
-
|
|
791
|
+
A as EmojiPicker
|
|
789
792
|
};
|