@memobit/libs 3.1.4 → 3.1.6
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/Chip/Chip.css +1 -1
- 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/EmojiPicker/EmojiPicker2.js +21 -18
- package/dist/components/IconPicker/IconPicker2.js +28 -25
- package/dist/helpers/VersionInfo.js +1 -1
- 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 +1 @@
|
|
|
1
|
-
.chip{--chip-color:var(--body-accent-color);justify-content:center;align-items:center;gap:var(--spacing-8);border:var(--spacing-1) solid var(--delimiter-color);max-width:100%;color:var(--body-color);cursor:pointer;font-family:inherit;font-size:var(--font-size-sm);background:0 0;border-radius:999px;transition:background .2s,border-color .2s,color .2s;display:inline-flex}.chip:hover:not(:disabled){border-color:var(--chip-hover-border-color,var(--chip-color));background:var(--chip-hover-background-color,var(--card-background-accent-color));color:var(--chip-hover-color,var(--body-color-accent))}.chip:disabled{cursor:not-allowed;opacity:.6}.chip--selected,.chip--selected:hover:not(:disabled){border-color:var(--chip-selected-border-color,var(--body-accent-color));background:var(--chip-selected-background-color,var(--card-background-accent-color));color:var(--chip-selected-color,var(--body-accent-color))}.chip--plain{background:0 0;border-color:#0000}.chip--default{--chip-color:var(--body-accent-color)}.chip--info{--chip-color:var(--button-info-background-color)}.chip--success{--chip-color:var(--button-success-background-color)}.chip--warning{--chip-color:var(--button-warning-background-color)}.chip--danger{--chip-color:var(--button-danger-background-color)}.chip--custom.chip--selected,.chip--info.chip--selected,.chip--success.chip--selected,.chip--warning.chip--selected,.chip--danger.chip--selected,.chip--custom.chip--selected:hover:not(:disabled),.chip--info.chip--selected:hover:not(:disabled),.chip--success.chip--selected:hover:not(:disabled),.chip--warning.chip--selected:hover:not(:disabled),.chip--danger.chip--selected:hover:not(:disabled){border-color:var(--chip-color);background:color-mix(in srgb, var(--chip-color) 18%, transparent);color:var(--chip-color)}.chip--custom{background:color-mix(in srgb, var(--chip-color) 22%, transparent);color:var(--body-color)}.chip--custom:hover:not(:disabled){background:color-mix(in srgb, var(--chip-color) 32%, transparent)}.chip--custom.chip--selected,.chip--custom.chip--selected:hover:not(:disabled){background:var(--chip-color);border-color:var(--chip-color);color:var(--button-default-color,white)}.chip--xsmall{min-height:var(--spacing-20);gap:var(--spacing-4);padding:var(--spacing-2) var(--spacing-8);font-size:var(--font-size-xxs)}.chip--small{min-height:var(--spacing-24);gap:var(--spacing-4);padding:var(--spacing-4) var(--spacing-12);font-size:var(--font-size-xs)}.chip--medium{min-height:var(--spacing-32);gap:var(--spacing-8);padding:var(--spacing-8) 14px;font-size:var(--font-size-sm)}.chip--large{min-height:var(--spacing-40);gap:var(--spacing-12);padding:var(--spacing-12) var(--spacing-20);font-size:var(--font-size-md)}.chip__swatch{background-color:var(--chip-color);border-radius:999px;flex-shrink:0
|
|
1
|
+
.chip{--chip-color:var(--body-accent-color);justify-content:center;align-items:center;gap:var(--spacing-8);border:var(--spacing-1) solid var(--delimiter-color);max-width:100%;color:var(--body-color);cursor:pointer;font-family:inherit;font-size:var(--font-size-sm);background:0 0;border-radius:999px;transition:background .2s,border-color .2s,color .2s;display:inline-flex}.chip:hover:not(:disabled){border-color:var(--chip-hover-border-color,var(--chip-color));background:var(--chip-hover-background-color,var(--card-background-accent-color));color:var(--chip-hover-color,var(--body-color-accent))}.chip:disabled{cursor:not-allowed;opacity:.6}.chip--selected,.chip--selected:hover:not(:disabled){border-color:var(--chip-selected-border-color,var(--body-accent-color));background:var(--chip-selected-background-color,var(--card-background-accent-color));color:var(--chip-selected-color,var(--body-accent-color))}.chip--plain{background:0 0;border-color:#0000}.chip--default{--chip-color:var(--body-accent-color)}.chip--info{--chip-color:var(--button-info-background-color)}.chip--success{--chip-color:var(--button-success-background-color)}.chip--warning{--chip-color:var(--button-warning-background-color)}.chip--danger{--chip-color:var(--button-danger-background-color)}.chip--custom.chip--selected,.chip--info.chip--selected,.chip--success.chip--selected,.chip--warning.chip--selected,.chip--danger.chip--selected,.chip--custom.chip--selected:hover:not(:disabled),.chip--info.chip--selected:hover:not(:disabled),.chip--success.chip--selected:hover:not(:disabled),.chip--warning.chip--selected:hover:not(:disabled),.chip--danger.chip--selected:hover:not(:disabled){border-color:var(--chip-color);background:color-mix(in srgb, var(--chip-color) 18%, transparent);color:var(--chip-color)}.chip--custom{background:color-mix(in srgb, var(--chip-color) 22%, transparent);color:var(--body-color)}.chip--custom:hover:not(:disabled){background:color-mix(in srgb, var(--chip-color) 32%, transparent)}.chip--custom.chip--selected,.chip--custom.chip--selected:hover:not(:disabled){background:var(--chip-color);border-color:var(--chip-color);color:var(--button-default-color,white)}.chip--xsmall{min-height:var(--spacing-20);gap:var(--spacing-4);padding:var(--spacing-2) var(--spacing-8);font-size:var(--font-size-xxs)}.chip--small{min-height:var(--spacing-24);gap:var(--spacing-4);padding:var(--spacing-4) var(--spacing-12);font-size:var(--font-size-xs)}.chip--medium{min-height:var(--spacing-32);gap:var(--spacing-8);padding:var(--spacing-8) 14px;font-size:var(--font-size-sm)}.chip--large{min-height:var(--spacing-40);gap:var(--spacing-12);padding:var(--spacing-12) var(--spacing-20);font-size:var(--font-size-md)}.chip__swatch{background-color:var(--chip-color);width:10px;height:10px;box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--body-color) 30%, transparent);border-radius:999px;flex-shrink:0}.chip__label{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.chip__count{color:var(--body-color-muted);font-size:var(--font-size-xs);flex-shrink:0}.chip>.icon{flex-shrink:0}.chip--selected .chip__count{color:var(--chip-selected-count-color,var(--body-color-muted))}.chip--xsmall .chip__swatch{width:var(--spacing-4);height:var(--spacing-4)}.chip--small .chip__swatch{width:var(--spacing-8);height:var(--spacing-8)}.chip--large .chip__swatch{width:var(--spacing-12);height:var(--spacing-12)}.chip--xsmall .chip__count{font-size:var(--font-size-xxs)}.chip--large .chip__count{font-size:var(--font-size-sm)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.color-picker{gap:var(--spacing-12);border:1px solid var(--delimiter-color);border-radius:var(--radius);padding:var(--spacing-16);background:var(--card-background-color);flex-direction:column;width:320px;display:flex}.color-picker__preview{border-radius:var(--radius);border:1px solid var(--delimiter-color);width:100%;height:40px}.color-picker__controls{gap:var(--spacing-12);flex-direction:column;display:flex}.color-picker__sv{border-radius:var(--radius);cursor:crosshair;touch-action:none;-webkit-user-select:none;user-select:none;width:100%;height:180px;position:relative;overflow:hidden}.color-picker__sv-white,.color-picker__sv-black{position:absolute;inset:0}.color-picker__sv-white{background:linear-gradient(90deg,#fff,#fff0)}.color-picker__sv-black{background:linear-gradient(#0000,#000)}.color-picker__sv-handle{border:2px solid #fff;border-radius:50%;width:12px;height:12px;position:absolute;transform:translate(-6px,-6px);box-shadow:0 0 0 1px #0000004d}.color-picker__slider input[type=range]{width:100%}.color-picker__mode-toggle{gap:var(--spacing-8);display:flex}.color-picker__mode-toggle .button{padding:6px 10px}.color-picker__mode-toggle .button.is-active{border:1px solid var(--body-accent-color);color:var(--body-accent-color)}.color-picker__fields{gap:var(--spacing-8);grid-template-columns:1fr;display:grid}.color-picker__fields .input-text-wrapper,.color-picker__fields .input-number-wrapper{width:100%}.color-picker__fields--rgb,.color-picker__fields--hsl,.color-picker__fields--hex{grid-template-columns:repeat(3,1fr)}.color-picker__fields--hex .input-text-wrapper{grid-column:span 3}
|
|
1
|
+
.color-picker{gap:var(--spacing-12);border:1px solid var(--delimiter-color);border-radius:var(--radius);padding:var(--spacing-16);background:var(--card-background-color);flex-direction:column;width:320px;display:flex}.color-picker__swatches{gap:var(--spacing-6);flex-direction:column;display:flex}.color-picker__swatches-label{font-size:var(--font-size-xxs);color:var(--body-sub-title-color)}.color-picker__swatches-row{gap:var(--spacing-6);flex-wrap:wrap;display:flex}.color-picker__swatch{width:var(--spacing-20);height:var(--spacing-20);border:1px solid color-mix(in srgb, var(--body-color) 30%, transparent);cursor:pointer;transition:transform var(--transition-fast);border-radius:50%;padding:0}.color-picker__swatch:hover{transform:scale(1.15)}.color-picker__swatch.is-selected{outline:2px solid var(--body-accent-color);outline-offset:2px}.color-picker__preview{border-radius:var(--radius);border:1px solid var(--delimiter-color);width:100%;height:40px}.color-picker__controls{gap:var(--spacing-12);flex-direction:column;display:flex}.color-picker__sv{border-radius:var(--radius);cursor:crosshair;touch-action:none;-webkit-user-select:none;user-select:none;width:100%;height:180px;position:relative;overflow:hidden}.color-picker__sv-white,.color-picker__sv-black{position:absolute;inset:0}.color-picker__sv-white{background:linear-gradient(90deg,#fff,#fff0)}.color-picker__sv-black{background:linear-gradient(#0000,#000)}.color-picker__sv-handle{border:2px solid #fff;border-radius:50%;width:12px;height:12px;position:absolute;transform:translate(-6px,-6px);box-shadow:0 0 0 1px #0000004d}.color-picker__slider input[type=range]{width:100%}.color-picker__mode-toggle{gap:var(--spacing-8);display:flex}.color-picker__mode-toggle .button{padding:6px 10px}.color-picker__mode-toggle .button.is-active{border:1px solid var(--body-accent-color);color:var(--body-accent-color)}.color-picker__fields{gap:var(--spacing-8);grid-template-columns:1fr;display:grid}.color-picker__fields .input-text-wrapper,.color-picker__fields .input-number-wrapper{width:100%}.color-picker__fields--rgb,.color-picker__fields--hsl,.color-picker__fields--hex{grid-template-columns:repeat(3,1fr)}.color-picker__fields--hex .input-text-wrapper{grid-column:span 3}
|
|
@@ -1,250 +1,280 @@
|
|
|
1
1
|
import './ColorPicker.css';
|
|
2
|
-
import { Button as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { Button as H } from "../Button/Button2.js";
|
|
3
|
+
import { Tooltip as G } from "../Tooltip/Tooltip2.js";
|
|
4
|
+
import { InputNumber as N } from "../InputNumber/InputNumber2.js";
|
|
5
|
+
import { InputText as X } from "../InputText/InputText2.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
import { useEffect as
|
|
7
|
-
import { jsx as
|
|
8
|
-
var
|
|
9
|
-
const
|
|
10
|
-
if (![3, 6].includes(
|
|
11
|
-
const
|
|
12
|
-
return Number.isNaN(
|
|
13
|
-
r:
|
|
14
|
-
g:
|
|
15
|
-
b:
|
|
7
|
+
import { useEffect as Y, useMemo as A, useRef as B, useState as y } from "react";
|
|
8
|
+
import { jsx as d, jsxs as b } from "react/jsx-runtime";
|
|
9
|
+
var k = (t, i, h) => Math.min(h, Math.max(i, t)), x = (t) => {
|
|
10
|
+
const i = t.replace("#", "").trim();
|
|
11
|
+
if (![3, 6].includes(i.length)) return null;
|
|
12
|
+
const h = i.length === 3 ? i.split("").map((s) => s + s).join("") : i, c = parseInt(h, 16);
|
|
13
|
+
return Number.isNaN(c) ? null : {
|
|
14
|
+
r: c >> 16 & 255,
|
|
15
|
+
g: c >> 8 & 255,
|
|
16
|
+
b: c & 255
|
|
16
17
|
};
|
|
17
|
-
}, L = (
|
|
18
|
-
|
|
19
|
-
h
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
18
|
+
}, L = (t) => {
|
|
19
|
+
const i = t.trim().replace("#", "").toLowerCase();
|
|
20
|
+
return `#${i.length === 3 ? i.split("").map((h) => h + h).join("") : i}`;
|
|
21
|
+
}, R = ({ r: t, g: i, b: h }) => `#${[
|
|
22
|
+
t,
|
|
23
|
+
i,
|
|
24
|
+
h
|
|
25
|
+
].map((c) => k(Math.round(c), 0, 255).toString(16).padStart(2, "0")).join("")}`, v = ({ r: t, g: i, b: h }) => {
|
|
26
|
+
const c = t / 255, s = i / 255, r = h / 255, o = Math.max(c, s, r), l = o - Math.min(c, s, r);
|
|
27
|
+
let n = 0;
|
|
28
|
+
l !== 0 && (o === c ? n = (s - r) / l % 6 : o === s ? n = (r - c) / l + 2 : n = (c - s) / l + 4, n = Math.round(n * 60), n < 0 && (n += 360));
|
|
29
|
+
const a = o === 0 ? 0 : l / o, m = o;
|
|
26
30
|
return {
|
|
27
|
-
h:
|
|
31
|
+
h: n,
|
|
28
32
|
s: Math.round(a * 100),
|
|
29
|
-
v: Math.round(
|
|
33
|
+
v: Math.round(m * 100)
|
|
30
34
|
};
|
|
31
|
-
},
|
|
32
|
-
const
|
|
33
|
-
let
|
|
34
|
-
return
|
|
35
|
-
r: Math.round((
|
|
36
|
-
g: Math.round((a +
|
|
37
|
-
b: Math.round((
|
|
35
|
+
}, E = ({ h: t, s: i, v: h }) => {
|
|
36
|
+
const c = i / 100, s = h / 100, r = s * c, o = r * (1 - Math.abs(t / 60 % 2 - 1)), l = s - r;
|
|
37
|
+
let n = 0, a = 0, m = 0;
|
|
38
|
+
return t < 60 ? (n = r, a = o) : t < 120 ? (n = o, a = r) : t < 180 ? (a = r, m = o) : t < 240 ? (a = o, m = r) : t < 300 ? (n = o, m = r) : (n = r, m = o), {
|
|
39
|
+
r: Math.round((n + l) * 255),
|
|
40
|
+
g: Math.round((a + l) * 255),
|
|
41
|
+
b: Math.round((m + l) * 255)
|
|
38
42
|
};
|
|
39
|
-
},
|
|
40
|
-
const
|
|
43
|
+
}, F = ({ r: t, g: i, b: h }) => {
|
|
44
|
+
const c = t / 255, s = i / 255, r = h / 255, o = Math.max(c, s, r), l = Math.min(c, s, r), n = o - l;
|
|
41
45
|
let a = 0;
|
|
42
|
-
|
|
43
|
-
const
|
|
46
|
+
n !== 0 && (o === c ? a = (s - r) / n % 6 : o === s ? a = (r - c) / n + 2 : a = (c - s) / n + 4, a = Math.round(a * 60), a < 0 && (a += 360));
|
|
47
|
+
const m = (o + l) / 2, M = n === 0 ? 0 : n / (1 - Math.abs(2 * m - 1));
|
|
44
48
|
return {
|
|
45
49
|
h: a,
|
|
46
|
-
s: Math.round(
|
|
47
|
-
l: Math.round(
|
|
50
|
+
s: Math.round(M * 100),
|
|
51
|
+
l: Math.round(m * 100)
|
|
48
52
|
};
|
|
49
|
-
},
|
|
50
|
-
const
|
|
51
|
-
let
|
|
52
|
-
return
|
|
53
|
-
r: Math.round((
|
|
54
|
-
g: Math.round((a +
|
|
55
|
-
b: Math.round((
|
|
53
|
+
}, T = ({ h: t, s: i, l: h }) => {
|
|
54
|
+
const c = i / 100, s = h / 100, r = (1 - Math.abs(2 * s - 1)) * c, o = r * (1 - Math.abs(t / 60 % 2 - 1)), l = s - r / 2;
|
|
55
|
+
let n = 0, a = 0, m = 0;
|
|
56
|
+
return t < 60 ? (n = r, a = o) : t < 120 ? (n = o, a = r) : t < 180 ? (a = r, m = o) : t < 240 ? (a = o, m = r) : t < 300 ? (n = o, m = r) : (n = r, m = o), {
|
|
57
|
+
r: Math.round((n + l) * 255),
|
|
58
|
+
g: Math.round((a + l) * 255),
|
|
59
|
+
b: Math.round((m + l) * 255)
|
|
56
60
|
};
|
|
57
|
-
},
|
|
58
|
-
const [
|
|
59
|
-
const
|
|
61
|
+
}, Z = ({ value: t = "#4e79a7", onChange: i, swatches: h, swatchesLabel: c = "Already in use" }) => {
|
|
62
|
+
const [s, r] = y("hex"), o = A(() => {
|
|
63
|
+
const e = /* @__PURE__ */ new Set();
|
|
64
|
+
return (h ?? []).forEach((p) => {
|
|
65
|
+
const u = x(p);
|
|
66
|
+
u && e.add(R(u));
|
|
67
|
+
}), [...e];
|
|
68
|
+
}, [h]), [l, n] = y(() => {
|
|
69
|
+
const e = x(t) || {
|
|
60
70
|
r: 78,
|
|
61
71
|
g: 121,
|
|
62
72
|
b: 167
|
|
63
73
|
};
|
|
64
|
-
return
|
|
65
|
-
}),
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
h:
|
|
73
|
-
s:
|
|
74
|
-
v:
|
|
74
|
+
return v(e);
|
|
75
|
+
}), [a, m] = y(() => x(t) ? L(t) : null), M = B(null), S = B(l);
|
|
76
|
+
S.current = l, Y(() => {
|
|
77
|
+
const e = x(t);
|
|
78
|
+
e && (n(v(e)), m(L(t)));
|
|
79
|
+
}, [t]);
|
|
80
|
+
const g = (e) => {
|
|
81
|
+
const p = {
|
|
82
|
+
h: k(e.h, 0, 360),
|
|
83
|
+
s: k(e.s, 0, 100),
|
|
84
|
+
v: k(e.v, 0, 100)
|
|
75
85
|
};
|
|
76
|
-
|
|
77
|
-
const u =
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
const
|
|
86
|
+
n(p), m(null);
|
|
87
|
+
const u = R(E(p));
|
|
88
|
+
i?.(u);
|
|
89
|
+
}, $ = (e) => {
|
|
90
|
+
const p = x(e);
|
|
91
|
+
p && (n(v(p)), m(L(e)), i?.(e));
|
|
92
|
+
}, j = (e, p) => {
|
|
93
|
+
const u = M.current?.getBoundingClientRect();
|
|
81
94
|
if (!u) return;
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
h:
|
|
85
|
-
s:
|
|
86
|
-
v:
|
|
95
|
+
const w = k(e - u.left, 0, u.width), P = k(p - u.top, 0, u.height), z = Math.round(w / u.width * 100), D = Math.round(100 - P / u.height * 100);
|
|
96
|
+
g({
|
|
97
|
+
h: S.current.h,
|
|
98
|
+
s: z,
|
|
99
|
+
v: D
|
|
87
100
|
});
|
|
88
|
-
},
|
|
89
|
-
|
|
101
|
+
}, I = (e) => {
|
|
102
|
+
e.preventDefault();
|
|
90
103
|
try {
|
|
91
|
-
|
|
104
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
92
105
|
} catch {
|
|
93
106
|
}
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
window.removeEventListener("pointermove",
|
|
107
|
+
j(e.clientX, e.clientY);
|
|
108
|
+
const p = (w) => j(w.clientX, w.clientY), u = () => {
|
|
109
|
+
window.removeEventListener("pointermove", p), window.removeEventListener("pointerup", u), window.removeEventListener("pointercancel", u);
|
|
97
110
|
};
|
|
98
|
-
window.addEventListener("pointermove",
|
|
99
|
-
},
|
|
100
|
-
return /* @__PURE__ */
|
|
111
|
+
window.addEventListener("pointermove", p), window.addEventListener("pointerup", u), window.addEventListener("pointercancel", u);
|
|
112
|
+
}, f = a ? x(a) ?? E(l) : E(l), C = a ?? R(f), _ = F(f);
|
|
113
|
+
return /* @__PURE__ */ b("div", {
|
|
101
114
|
className: "color-picker",
|
|
102
115
|
children: [
|
|
103
|
-
/* @__PURE__ */
|
|
116
|
+
o.length > 0 && /* @__PURE__ */ b("div", {
|
|
117
|
+
className: "color-picker__swatches",
|
|
118
|
+
children: [/* @__PURE__ */ d("span", {
|
|
119
|
+
className: "color-picker__swatches-label",
|
|
120
|
+
children: c
|
|
121
|
+
}), /* @__PURE__ */ d("div", {
|
|
122
|
+
className: "color-picker__swatches-row",
|
|
123
|
+
children: o.map((e) => /* @__PURE__ */ d(G, {
|
|
124
|
+
title: e,
|
|
125
|
+
children: /* @__PURE__ */ d("button", {
|
|
126
|
+
className: `color-picker__swatch${e === C.toLowerCase() ? " is-selected" : ""}`,
|
|
127
|
+
onClick: () => $(e),
|
|
128
|
+
style: { backgroundColor: e },
|
|
129
|
+
type: "button"
|
|
130
|
+
})
|
|
131
|
+
}, e))
|
|
132
|
+
})]
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ d("div", {
|
|
104
135
|
className: "color-picker__preview",
|
|
105
136
|
style: { backgroundColor: C }
|
|
106
137
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ b("div", {
|
|
108
139
|
className: "color-picker__controls",
|
|
109
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ b("div", {
|
|
110
141
|
className: "color-picker__sv",
|
|
111
|
-
ref:
|
|
112
|
-
style: { backgroundColor: `hsl(${
|
|
113
|
-
onPointerDown:
|
|
142
|
+
ref: M,
|
|
143
|
+
style: { backgroundColor: `hsl(${l.h}, 100%, 50%)` },
|
|
144
|
+
onPointerDown: I,
|
|
114
145
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ d("div", { className: "color-picker__sv-white" }),
|
|
147
|
+
/* @__PURE__ */ d("div", { className: "color-picker__sv-black" }),
|
|
148
|
+
/* @__PURE__ */ d("div", {
|
|
118
149
|
className: "color-picker__sv-handle",
|
|
119
150
|
style: {
|
|
120
|
-
left: `${
|
|
121
|
-
top: `${100 -
|
|
151
|
+
left: `${l.s}%`,
|
|
152
|
+
top: `${100 - l.v}%`
|
|
122
153
|
}
|
|
123
154
|
})
|
|
124
155
|
]
|
|
125
|
-
}), /* @__PURE__ */
|
|
156
|
+
}), /* @__PURE__ */ d("div", {
|
|
126
157
|
className: "color-picker__slider",
|
|
127
|
-
children: /* @__PURE__ */
|
|
158
|
+
children: /* @__PURE__ */ d("input", {
|
|
128
159
|
type: "range",
|
|
129
160
|
min: 0,
|
|
130
161
|
max: 360,
|
|
131
|
-
value:
|
|
132
|
-
onChange: (
|
|
133
|
-
...
|
|
134
|
-
h: Number(
|
|
162
|
+
value: l.h,
|
|
163
|
+
onChange: (e) => g({
|
|
164
|
+
...l,
|
|
165
|
+
h: Number(e.target.value)
|
|
135
166
|
})
|
|
136
167
|
})
|
|
137
168
|
})]
|
|
138
169
|
}),
|
|
139
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ b("div", {
|
|
140
171
|
className: "color-picker__mode-toggle",
|
|
141
172
|
children: [
|
|
142
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ d(H, {
|
|
143
174
|
variant: "plain",
|
|
144
|
-
className:
|
|
145
|
-
onClick: () =>
|
|
175
|
+
className: s === "hex" ? "is-active" : "",
|
|
176
|
+
onClick: () => r("hex"),
|
|
146
177
|
children: "Hex"
|
|
147
178
|
}),
|
|
148
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ d(H, {
|
|
149
180
|
variant: "plain",
|
|
150
|
-
className:
|
|
151
|
-
onClick: () =>
|
|
181
|
+
className: s === "rgb" ? "is-active" : "",
|
|
182
|
+
onClick: () => r("rgb"),
|
|
152
183
|
children: "RGB"
|
|
153
184
|
}),
|
|
154
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ d(H, {
|
|
155
186
|
variant: "plain",
|
|
156
|
-
className:
|
|
157
|
-
onClick: () =>
|
|
187
|
+
className: s === "hsl" ? "is-active" : "",
|
|
188
|
+
onClick: () => r("hsl"),
|
|
158
189
|
children: "HSL"
|
|
159
190
|
})
|
|
160
191
|
]
|
|
161
192
|
}),
|
|
162
|
-
|
|
193
|
+
s === "hex" && /* @__PURE__ */ d("div", {
|
|
163
194
|
className: "color-picker__fields color-picker__fields--hex",
|
|
164
|
-
children: /* @__PURE__ */
|
|
195
|
+
children: /* @__PURE__ */ d(X, {
|
|
165
196
|
label: "Hex",
|
|
166
197
|
value: C,
|
|
167
|
-
onChange: (
|
|
168
|
-
|
|
169
|
-
v && e(g(v));
|
|
198
|
+
onChange: (e) => {
|
|
199
|
+
x(e) && $(e.startsWith("#") ? e : `#${e}`);
|
|
170
200
|
}
|
|
171
201
|
})
|
|
172
202
|
}),
|
|
173
|
-
|
|
203
|
+
s === "rgb" && /* @__PURE__ */ b("div", {
|
|
174
204
|
className: "color-picker__fields color-picker__fields--rgb",
|
|
175
205
|
children: [
|
|
176
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ d(N, {
|
|
177
207
|
label: "R",
|
|
178
208
|
min: 0,
|
|
179
209
|
max: 255,
|
|
180
|
-
value:
|
|
181
|
-
onChange: (
|
|
182
|
-
...
|
|
183
|
-
r:
|
|
210
|
+
value: f.r,
|
|
211
|
+
onChange: (e) => g(v({
|
|
212
|
+
...f,
|
|
213
|
+
r: e ?? 0
|
|
184
214
|
}))
|
|
185
215
|
}),
|
|
186
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ d(N, {
|
|
187
217
|
label: "G",
|
|
188
218
|
min: 0,
|
|
189
219
|
max: 255,
|
|
190
|
-
value:
|
|
191
|
-
onChange: (
|
|
192
|
-
...
|
|
193
|
-
g:
|
|
220
|
+
value: f.g,
|
|
221
|
+
onChange: (e) => g(v({
|
|
222
|
+
...f,
|
|
223
|
+
g: e ?? 0
|
|
194
224
|
}))
|
|
195
225
|
}),
|
|
196
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ d(N, {
|
|
197
227
|
label: "B",
|
|
198
228
|
min: 0,
|
|
199
229
|
max: 255,
|
|
200
|
-
value:
|
|
201
|
-
onChange: (
|
|
202
|
-
...
|
|
203
|
-
b:
|
|
230
|
+
value: f.b,
|
|
231
|
+
onChange: (e) => g(v({
|
|
232
|
+
...f,
|
|
233
|
+
b: e ?? 0
|
|
204
234
|
}))
|
|
205
235
|
})
|
|
206
236
|
]
|
|
207
237
|
}),
|
|
208
|
-
|
|
238
|
+
s === "hsl" && /* @__PURE__ */ b("div", {
|
|
209
239
|
className: "color-picker__fields color-picker__fields--hsl",
|
|
210
240
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
241
|
+
/* @__PURE__ */ d(N, {
|
|
212
242
|
label: "H",
|
|
213
243
|
min: 0,
|
|
214
244
|
max: 360,
|
|
215
|
-
value:
|
|
216
|
-
onChange: (
|
|
217
|
-
const
|
|
218
|
-
...
|
|
219
|
-
h:
|
|
245
|
+
value: _.h,
|
|
246
|
+
onChange: (e) => {
|
|
247
|
+
const p = T({
|
|
248
|
+
..._,
|
|
249
|
+
h: e ?? 0
|
|
220
250
|
});
|
|
221
|
-
|
|
251
|
+
g(v(p));
|
|
222
252
|
}
|
|
223
253
|
}),
|
|
224
|
-
/* @__PURE__ */
|
|
254
|
+
/* @__PURE__ */ d(N, {
|
|
225
255
|
label: "S",
|
|
226
256
|
min: 0,
|
|
227
257
|
max: 100,
|
|
228
|
-
value:
|
|
229
|
-
onChange: (
|
|
230
|
-
const
|
|
231
|
-
...
|
|
232
|
-
s:
|
|
258
|
+
value: _.s,
|
|
259
|
+
onChange: (e) => {
|
|
260
|
+
const p = T({
|
|
261
|
+
..._,
|
|
262
|
+
s: e ?? 0
|
|
233
263
|
});
|
|
234
|
-
|
|
264
|
+
g(v(p));
|
|
235
265
|
}
|
|
236
266
|
}),
|
|
237
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ d(N, {
|
|
238
268
|
label: "L",
|
|
239
269
|
min: 0,
|
|
240
270
|
max: 100,
|
|
241
|
-
value:
|
|
242
|
-
onChange: (
|
|
243
|
-
const
|
|
244
|
-
...
|
|
245
|
-
l:
|
|
271
|
+
value: _.l,
|
|
272
|
+
onChange: (e) => {
|
|
273
|
+
const p = T({
|
|
274
|
+
..._,
|
|
275
|
+
l: e ?? 0
|
|
246
276
|
});
|
|
247
|
-
|
|
277
|
+
g(v(p));
|
|
248
278
|
}
|
|
249
279
|
})
|
|
250
280
|
]
|
|
@@ -253,5 +283,5 @@ var _ = (s, h, i) => Math.min(i, Math.max(h, s)), k = (s) => {
|
|
|
253
283
|
});
|
|
254
284
|
};
|
|
255
285
|
export {
|
|
256
|
-
|
|
286
|
+
Z as ColorPicker
|
|
257
287
|
};
|
|
@@ -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,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
|
};
|
|
@@ -1,51 +1,54 @@
|
|
|
1
1
|
import './IconPicker.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import {
|
|
2
|
+
import { Icon as _ } from "../Icon/Icon2.js";
|
|
3
|
+
import { Tooltip as g } from "../Tooltip/Tooltip2.js";
|
|
4
|
+
import { InputSearch as k } from "../InputSearch/InputSearch2.js";
|
|
4
5
|
/* empty css */
|
|
5
|
-
import { useMemo as a, useState as
|
|
6
|
-
import { iconMap as
|
|
7
|
-
import { jsx as c, jsxs as
|
|
8
|
-
import { iconAliases as
|
|
9
|
-
var
|
|
10
|
-
const [
|
|
11
|
-
const e =
|
|
12
|
-
if (!e) return
|
|
13
|
-
const
|
|
14
|
-
return
|
|
15
|
-
}, [
|
|
16
|
-
return /* @__PURE__ */
|
|
6
|
+
import { useMemo as a, useState as v } from "react";
|
|
7
|
+
import { iconMap as N } from "@memobit/icons/map";
|
|
8
|
+
import { jsx as c, jsxs as S } from "react/jsx-runtime";
|
|
9
|
+
import { iconAliases as b } from "@memobit/icons";
|
|
10
|
+
var y = Object.keys(N), M = ({ color: s, emptyLabel: p = "No icons match", icons: n, onChange: m, placeholder: h = "Search icons...", value: d }) => {
|
|
11
|
+
const [i, u] = v(""), o = a(() => n ?? y, [n]), t = a(() => {
|
|
12
|
+
const e = i.trim().toLowerCase();
|
|
13
|
+
if (!e) return o;
|
|
14
|
+
const f = e.replace(/[\s-]+/g, ""), l = (r) => r.includes(e) || r.replace(/-/g, "").includes(f);
|
|
15
|
+
return o.filter((r) => l(r) || (b[r] ?? []).some(l));
|
|
16
|
+
}, [o, i]);
|
|
17
|
+
return /* @__PURE__ */ S("div", {
|
|
17
18
|
className: "icon-picker",
|
|
18
19
|
children: [
|
|
19
20
|
/* @__PURE__ */ c("div", {
|
|
20
21
|
className: "icon-picker__search",
|
|
21
|
-
children: /* @__PURE__ */ c(
|
|
22
|
+
children: /* @__PURE__ */ c(k, {
|
|
22
23
|
autoFocus: !0,
|
|
23
24
|
onChange: u,
|
|
24
25
|
placeholder: h,
|
|
25
|
-
value:
|
|
26
|
+
value: i
|
|
26
27
|
})
|
|
27
28
|
}),
|
|
28
29
|
/* @__PURE__ */ c("div", {
|
|
29
30
|
className: "icon-picker__grid",
|
|
30
|
-
children:
|
|
31
|
+
children: t.length === 0 ? /* @__PURE__ */ c("p", {
|
|
31
32
|
className: "icon-picker__empty",
|
|
32
33
|
children: p
|
|
33
|
-
}) :
|
|
34
|
-
className: `icon-picker__icon${d === e ? " is-selected" : ""}`,
|
|
35
|
-
onClick: () => m?.(e),
|
|
36
|
-
style: s ? { color: s } : void 0,
|
|
34
|
+
}) : t.map((e) => /* @__PURE__ */ c(g, {
|
|
37
35
|
title: e,
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
children: /* @__PURE__ */ c("button", {
|
|
37
|
+
className: `icon-picker__icon${d === e ? " is-selected" : ""}`,
|
|
38
|
+
onClick: () => m?.(e),
|
|
39
|
+
style: s ? { color: s } : void 0,
|
|
40
|
+
type: "button",
|
|
41
|
+
children: /* @__PURE__ */ c(_, { name: e })
|
|
42
|
+
})
|
|
40
43
|
}, e))
|
|
41
44
|
}),
|
|
42
45
|
/* @__PURE__ */ c("p", {
|
|
43
46
|
className: "icon-picker__count",
|
|
44
|
-
children:
|
|
47
|
+
children: t.length === o.length ? `${o.length} icons` : `${t.length} of ${o.length}`
|
|
45
48
|
})
|
|
46
49
|
]
|
|
47
50
|
});
|
|
48
51
|
};
|
|
49
52
|
export {
|
|
50
|
-
|
|
53
|
+
M as IconPicker
|
|
51
54
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -541,6 +541,16 @@ export declare const ColorPicker: default_2.FC<ColorPickerProps>;
|
|
|
541
541
|
export declare interface ColorPickerProps {
|
|
542
542
|
value?: string;
|
|
543
543
|
onChange?: (hex: string) => void;
|
|
544
|
+
/**
|
|
545
|
+
* Colours to offer for reuse, above the gradient. Pass the ones already in play —
|
|
546
|
+
* the palette a record set is actually using — so picking the same shade again is one
|
|
547
|
+
* click rather than a fresh trip through the gradient. Without it every visit to the
|
|
548
|
+
* picker mints a new near-miss: nine greys that differ by a digit, each its own entry
|
|
549
|
+
* in anything that later groups or filters by colour. Duplicates and anything that
|
|
550
|
+
* isn't a hex are dropped, and the list renders only when something survives.
|
|
551
|
+
*/
|
|
552
|
+
swatches?: string[];
|
|
553
|
+
swatchesLabel?: string;
|
|
544
554
|
}
|
|
545
555
|
|
|
546
556
|
export declare interface ColProps {
|
package/dist/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var I = "3.1.
|
|
1
|
+
var I = "3.1.6", B = 455, L = "01ff130", _ = "2026-10-02T13:07:29.369Z", r = "455";
|
|
2
2
|
export {
|
|
3
3
|
_ as LIB_BUILD_DATE,
|
|
4
|
-
|
|
4
|
+
r as LIB_BUILD_ID,
|
|
5
5
|
B as LIB_BUILD_NUMBER,
|
|
6
6
|
L as LIB_COMMIT,
|
|
7
7
|
I as LIB_VERSION
|
package/dist/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memobit/libs",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.6",
|
|
4
4
|
"description": "React component library powering the Memobit apps — 100+ components, helpers and hooks. Icons ship as @memobit/icons and themes as @memobit/themes. TypeScript-first, ESM-only, React 19.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|