@memobit/libs 3.1.4 → 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.
@@ -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 var(--delimiter-color);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 N } from "../Button/Button2.js";
3
- import { InputNumber as b } from "../InputNumber/InputNumber2.js";
4
- import { InputText as j } from "../InputText/InputText2.js";
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 B, useRef as R, useState as H } from "react";
7
- import { jsx as m, jsxs as x } from "react/jsx-runtime";
8
- var _ = (s, h, i) => Math.min(i, Math.max(h, s)), k = (s) => {
9
- const h = s.replace("#", "").trim();
10
- if (![3, 6].includes(h.length)) return null;
11
- const i = h.length === 3 ? h.split("").map((o) => o + o).join("") : h, l = parseInt(i, 16);
12
- return Number.isNaN(l) ? null : {
13
- r: l >> 16 & 255,
14
- g: l >> 8 & 255,
15
- b: l & 255
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 = ({ r: s, g: h, b: i }) => `#${[
18
- s,
19
- h,
20
- i
21
- ].map((l) => _(Math.round(l), 0, 255).toString(16).padStart(2, "0")).join("")}`, g = ({ r: s, g: h, b: i }) => {
22
- const l = s / 255, o = h / 255, t = i / 255, r = Math.max(l, o, t), c = r - Math.min(l, o, t);
23
- let e = 0;
24
- c !== 0 && (r === l ? e = (o - t) / c % 6 : r === o ? e = (t - l) / c + 2 : e = (l - o) / c + 4, e = Math.round(e * 60), e < 0 && (e += 360));
25
- const a = r === 0 ? 0 : c / r, d = r;
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: e,
31
+ h: n,
28
32
  s: Math.round(a * 100),
29
- v: Math.round(d * 100)
33
+ v: Math.round(m * 100)
30
34
  };
31
- }, T = ({ h: s, s: h, v: i }) => {
32
- const l = h / 100, o = i / 100, t = o * l, r = t * (1 - Math.abs(s / 60 % 2 - 1)), c = o - t;
33
- let e = 0, a = 0, d = 0;
34
- return s < 60 ? (e = t, a = r) : s < 120 ? (e = r, a = t) : s < 180 ? (a = t, d = r) : s < 240 ? (a = r, d = t) : s < 300 ? (e = r, d = t) : (e = t, d = r), {
35
- r: Math.round((e + c) * 255),
36
- g: Math.round((a + c) * 255),
37
- b: Math.round((d + c) * 255)
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
- }, I = ({ r: s, g: h, b: i }) => {
40
- const l = s / 255, o = h / 255, t = i / 255, r = Math.max(l, o, t), c = Math.min(l, o, t), e = r - c;
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
- e !== 0 && (r === l ? a = (o - t) / e % 6 : r === o ? a = (t - l) / e + 2 : a = (l - o) / e + 4, a = Math.round(a * 60), a < 0 && (a += 360));
43
- const d = (r + c) / 2, p = e === 0 ? 0 : e / (1 - Math.abs(2 * d - 1));
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(p * 100),
47
- l: Math.round(d * 100)
50
+ s: Math.round(M * 100),
51
+ l: Math.round(m * 100)
48
52
  };
49
- }, w = ({ h: s, s: h, l: i }) => {
50
- const l = h / 100, o = i / 100, t = (1 - Math.abs(2 * o - 1)) * l, r = t * (1 - Math.abs(s / 60 % 2 - 1)), c = o - t / 2;
51
- let e = 0, a = 0, d = 0;
52
- return s < 60 ? (e = t, a = r) : s < 120 ? (e = r, a = t) : s < 180 ? (a = t, d = r) : s < 240 ? (a = r, d = t) : s < 300 ? (e = r, d = t) : (e = t, d = r), {
53
- r: Math.round((e + c) * 255),
54
- g: Math.round((a + c) * 255),
55
- b: Math.round((d + c) * 255)
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
- }, F = ({ value: s = "#4e79a7", onChange: h }) => {
58
- const [i, l] = H("hex"), [o, t] = H(() => {
59
- const n = k(s) || {
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 g(n);
65
- }), r = R(null), c = R(o);
66
- c.current = o, B(() => {
67
- const n = k(s);
68
- n && t(g(n));
69
- }, [s]);
70
- const e = (n) => {
71
- const v = {
72
- h: _(n.h, 0, 360),
73
- s: _(n.s, 0, 100),
74
- v: _(n.v, 0, 100)
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
- t(v);
77
- const u = L(T(v));
78
- h?.(u);
79
- }, a = (n, v) => {
80
- const u = r.current?.getBoundingClientRect();
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 M = _(n - u.left, 0, u.width), y = _(v - u.top, 0, u.height), S = Math.round(M / u.width * 100), E = Math.round(100 - y / u.height * 100);
83
- e({
84
- h: c.current.h,
85
- s: S,
86
- v: E
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
- }, d = (n) => {
89
- n.preventDefault();
101
+ }, I = (e) => {
102
+ e.preventDefault();
90
103
  try {
91
- n.currentTarget.setPointerCapture(n.pointerId);
104
+ e.currentTarget.setPointerCapture(e.pointerId);
92
105
  } catch {
93
106
  }
94
- a(n.clientX, n.clientY);
95
- const v = (M) => a(M.clientX, M.clientY), u = () => {
96
- window.removeEventListener("pointermove", v), window.removeEventListener("pointerup", u), window.removeEventListener("pointercancel", u);
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", v), window.addEventListener("pointerup", u), window.addEventListener("pointercancel", u);
99
- }, p = T(o), C = L(p), f = I(p);
100
- return /* @__PURE__ */ x("div", {
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__ */ m("div", {
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__ */ x("div", {
138
+ /* @__PURE__ */ b("div", {
108
139
  className: "color-picker__controls",
109
- children: [/* @__PURE__ */ x("div", {
140
+ children: [/* @__PURE__ */ b("div", {
110
141
  className: "color-picker__sv",
111
- ref: r,
112
- style: { backgroundColor: `hsl(${o.h}, 100%, 50%)` },
113
- onPointerDown: d,
142
+ ref: M,
143
+ style: { backgroundColor: `hsl(${l.h}, 100%, 50%)` },
144
+ onPointerDown: I,
114
145
  children: [
115
- /* @__PURE__ */ m("div", { className: "color-picker__sv-white" }),
116
- /* @__PURE__ */ m("div", { className: "color-picker__sv-black" }),
117
- /* @__PURE__ */ m("div", {
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: `${o.s}%`,
121
- top: `${100 - o.v}%`
151
+ left: `${l.s}%`,
152
+ top: `${100 - l.v}%`
122
153
  }
123
154
  })
124
155
  ]
125
- }), /* @__PURE__ */ m("div", {
156
+ }), /* @__PURE__ */ d("div", {
126
157
  className: "color-picker__slider",
127
- children: /* @__PURE__ */ m("input", {
158
+ children: /* @__PURE__ */ d("input", {
128
159
  type: "range",
129
160
  min: 0,
130
161
  max: 360,
131
- value: o.h,
132
- onChange: (n) => e({
133
- ...o,
134
- h: Number(n.target.value)
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__ */ x("div", {
170
+ /* @__PURE__ */ b("div", {
140
171
  className: "color-picker__mode-toggle",
141
172
  children: [
142
- /* @__PURE__ */ m(N, {
173
+ /* @__PURE__ */ d(H, {
143
174
  variant: "plain",
144
- className: i === "hex" ? "is-active" : "",
145
- onClick: () => l("hex"),
175
+ className: s === "hex" ? "is-active" : "",
176
+ onClick: () => r("hex"),
146
177
  children: "Hex"
147
178
  }),
148
- /* @__PURE__ */ m(N, {
179
+ /* @__PURE__ */ d(H, {
149
180
  variant: "plain",
150
- className: i === "rgb" ? "is-active" : "",
151
- onClick: () => l("rgb"),
181
+ className: s === "rgb" ? "is-active" : "",
182
+ onClick: () => r("rgb"),
152
183
  children: "RGB"
153
184
  }),
154
- /* @__PURE__ */ m(N, {
185
+ /* @__PURE__ */ d(H, {
155
186
  variant: "plain",
156
- className: i === "hsl" ? "is-active" : "",
157
- onClick: () => l("hsl"),
187
+ className: s === "hsl" ? "is-active" : "",
188
+ onClick: () => r("hsl"),
158
189
  children: "HSL"
159
190
  })
160
191
  ]
161
192
  }),
162
- i === "hex" && /* @__PURE__ */ m("div", {
193
+ s === "hex" && /* @__PURE__ */ d("div", {
163
194
  className: "color-picker__fields color-picker__fields--hex",
164
- children: /* @__PURE__ */ m(j, {
195
+ children: /* @__PURE__ */ d(X, {
165
196
  label: "Hex",
166
197
  value: C,
167
- onChange: (n) => {
168
- const v = k(n);
169
- v && e(g(v));
198
+ onChange: (e) => {
199
+ x(e) && $(e.startsWith("#") ? e : `#${e}`);
170
200
  }
171
201
  })
172
202
  }),
173
- i === "rgb" && /* @__PURE__ */ x("div", {
203
+ s === "rgb" && /* @__PURE__ */ b("div", {
174
204
  className: "color-picker__fields color-picker__fields--rgb",
175
205
  children: [
176
- /* @__PURE__ */ m(b, {
206
+ /* @__PURE__ */ d(N, {
177
207
  label: "R",
178
208
  min: 0,
179
209
  max: 255,
180
- value: p.r,
181
- onChange: (n) => e(g({
182
- ...p,
183
- r: n ?? 0
210
+ value: f.r,
211
+ onChange: (e) => g(v({
212
+ ...f,
213
+ r: e ?? 0
184
214
  }))
185
215
  }),
186
- /* @__PURE__ */ m(b, {
216
+ /* @__PURE__ */ d(N, {
187
217
  label: "G",
188
218
  min: 0,
189
219
  max: 255,
190
- value: p.g,
191
- onChange: (n) => e(g({
192
- ...p,
193
- g: n ?? 0
220
+ value: f.g,
221
+ onChange: (e) => g(v({
222
+ ...f,
223
+ g: e ?? 0
194
224
  }))
195
225
  }),
196
- /* @__PURE__ */ m(b, {
226
+ /* @__PURE__ */ d(N, {
197
227
  label: "B",
198
228
  min: 0,
199
229
  max: 255,
200
- value: p.b,
201
- onChange: (n) => e(g({
202
- ...p,
203
- b: n ?? 0
230
+ value: f.b,
231
+ onChange: (e) => g(v({
232
+ ...f,
233
+ b: e ?? 0
204
234
  }))
205
235
  })
206
236
  ]
207
237
  }),
208
- i === "hsl" && /* @__PURE__ */ x("div", {
238
+ s === "hsl" && /* @__PURE__ */ b("div", {
209
239
  className: "color-picker__fields color-picker__fields--hsl",
210
240
  children: [
211
- /* @__PURE__ */ m(b, {
241
+ /* @__PURE__ */ d(N, {
212
242
  label: "H",
213
243
  min: 0,
214
244
  max: 360,
215
- value: f.h,
216
- onChange: (n) => {
217
- const v = w({
218
- ...f,
219
- h: n ?? 0
245
+ value: _.h,
246
+ onChange: (e) => {
247
+ const p = T({
248
+ ..._,
249
+ h: e ?? 0
220
250
  });
221
- e(g(v));
251
+ g(v(p));
222
252
  }
223
253
  }),
224
- /* @__PURE__ */ m(b, {
254
+ /* @__PURE__ */ d(N, {
225
255
  label: "S",
226
256
  min: 0,
227
257
  max: 100,
228
- value: f.s,
229
- onChange: (n) => {
230
- const v = w({
231
- ...f,
232
- s: n ?? 0
258
+ value: _.s,
259
+ onChange: (e) => {
260
+ const p = T({
261
+ ..._,
262
+ s: e ?? 0
233
263
  });
234
- e(g(v));
264
+ g(v(p));
235
265
  }
236
266
  }),
237
- /* @__PURE__ */ m(b, {
267
+ /* @__PURE__ */ d(N, {
238
268
  label: "L",
239
269
  min: 0,
240
270
  max: 100,
241
- value: f.l,
242
- onChange: (n) => {
243
- const v = w({
244
- ...f,
245
- l: n ?? 0
271
+ value: _.l,
272
+ onChange: (e) => {
273
+ const p = T({
274
+ ..._,
275
+ l: e ?? 0
246
276
  });
247
- e(g(v));
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
- F as ColorPicker
286
+ Z as ColorPicker
257
287
  };
@@ -1,20 +1,21 @@
1
- import { Icon as g } from "../Icon/Icon2.js";
1
+ import { Icon as b } from "../Icon/Icon2.js";
2
2
  import { Button as C } from "../Button/Button2.js";
3
- import { Chip as A } from "../Chip/Chip2.js";
4
- import { InputNumber as b } from "../InputNumber/InputNumber2.js";
5
- import { InputText as k } from "../InputText/InputText2.js";
6
- import { DatePicker as w } from "../DatePicker/DatePicker2.js";
7
- import { Dropdown as R } from "../Dropdown/Dropdown2.js";
8
- import { InputDate as E } from "../InputDate/InputDate2.js";
9
- import { InputSearch as I } from "../InputSearch/InputSearch2.js";
10
- import { Rating as L } from "../Rating/Rating2.js";
11
- import { DEFAULT_DATE_RANGE_PRESETS as M } from "./ControlPanel.types.js";
12
- import { useEffect as P, useRef as T, useState as N } from "react";
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 V = 3, D = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean" ? [] : [e], S = (e) => e.every((r) => typeof r == "number") ? e : e.map(String), x = 2, j = (e) => {
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 D(e.value).map((o) => r.find((t) => t.value === o)?.label ?? String(o));
17
- }, H = (e) => {
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 = j(e);
32
+ const t = U(e);
32
33
  if (t.length !== 0)
33
- return t.length <= x ? t.join(", ") : `${t.slice(0, x).join(", ")} +${t.length - x}`;
34
- }, ne = ({ filter: e, collapsible: r = !1, onChange: o }) => {
35
- const t = r && e.type !== "checkbox", [s, d] = N(e.defaultExpanded ?? !1), a = e.summary ?? H(e), i = /* @__PURE__ */ _("span", {
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(g, { name: e.icon }),
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(g, { name: s ? "caret-up" : "caret-down" })
63
+ children: /* @__PURE__ */ n(b, { name: s ? "caret-up" : "caret-down" })
63
64
  })
64
65
  ]
65
- }) : e.type !== "checkbox" && i, (!t || s) && /* @__PURE__ */ n(B, {
66
+ }) : e.type !== "checkbox" && i, (!t || s) && /* @__PURE__ */ n(z, {
66
67
  filter: e,
67
68
  onChange: o
68
69
  })]
69
70
  });
70
- }, U = ({ placeholder: e, value: r, onChange: o }) => {
71
- const [t, s] = N(r), d = T(r);
72
- return P(() => {
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(I, {
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
- }, B = ({ filter: e, onChange: r }) => {
83
- const o = D(e.value), t = e.options ?? [], [s, d] = N("");
84
- if (e.type === "checkbox") return /* @__PURE__ */ n(A, {
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(E, {
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(k, {
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(U, {
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(b, {
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(L, {
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(b, {
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(b, {
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 ?? M, p = (c) => {
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, y, $] = c.split("-").map(Number);
190
- return new Date(h, y - 1, $);
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
- }), f = (c) => {
196
+ }), y = (c) => {
196
197
  const h = e.maxDate ? p(e.maxDate) : /* @__PURE__ */ new Date();
197
198
  if (!h) return;
198
- const y = new Date(h);
199
- y.setDate(y.getDate() - c), v(u(y), u(h));
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: () => f(c.days),
209
+ onClick: () => y(c.days),
209
210
  children: c.label
210
211
  }, c.days))
211
- }), /* @__PURE__ */ n(w, {
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 <= V ? /* @__PURE__ */ n("div", {
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(g, { name: a.icon }),
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(R, {
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) ? S(a.map((l) => l.value)) : a?.value ?? null,
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(I, {
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 p = e.multiple === !1, u = p ? m ? [] : [l.value] : m ? o.filter((v) => v !== l.value) : [...o, l.value];
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: p ? u[0] ?? null : S(u),
321
+ value: u ? v[0] ?? null : I(v),
323
322
  option: l,
324
- options: t.filter((v) => u.includes(v.value))
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
- }, l.value);
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(g, {
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
- ne as ControlPanelFilterItem
388
+ te as ControlPanelFilterItem
386
389
  };
@@ -1,9 +1,10 @@
1
1
  import './EmojiPicker.css';
2
- import { InputSearch as h } from "../InputSearch/InputSearch2.js";
3
- import { EMOJI_KEYWORDS as v } from "./emojiKeywords/index.js";
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 _, useState as n } from "react";
6
- import { jsx as i, jsxs as f } from "react/jsx-runtime";
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
- ], E = ({ value: t, onChange: l }) => {
747
- const [o, d] = n(""), [r, j] = n(m[0].id), c = _(() => {
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((p) => v[p]?.some((u) => u.includes(e)) || s.name.toLowerCase().includes(e)));
751
- }, [o]), a = c ?? m.find((e) => e.id === r)?.emojis ?? [];
752
- return /* @__PURE__ */ f("div", {
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(h, {
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("button", {
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
- onClick: () => j(e.id),
770
- children: e.icon
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: a.length === 0 ? /* @__PURE__ */ i("p", {
778
+ children: t.length === 0 ? /* @__PURE__ */ i("p", {
776
779
  className: "emoji-picker__empty",
777
780
  children: "No results"
778
- }) : a.map((e, s) => /* @__PURE__ */ i("button", {
779
- className: `emoji-picker__emoji${t === e ? " is-selected" : ""}`,
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
- E as EmojiPicker
791
+ A as EmojiPicker
789
792
  };
@@ -1,51 +1,54 @@
1
1
  import './IconPicker.css';
2
- import { Icon as f } from "../Icon/Icon2.js";
3
- import { InputSearch as g } from "../InputSearch/InputSearch2.js";
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 k } from "react";
6
- import { iconMap as v } from "@memobit/icons/map";
7
- import { jsx as c, jsxs as N } from "react/jsx-runtime";
8
- import { iconAliases as S } from "@memobit/icons";
9
- var b = Object.keys(v), w = ({ color: s, emptyLabel: p = "No icons match", icons: n, onChange: m, placeholder: h = "Search icons...", value: d }) => {
10
- const [o, u] = k(""), t = a(() => n ?? b, [n]), i = a(() => {
11
- const e = o.trim().toLowerCase();
12
- if (!e) return t;
13
- const _ = e.replace(/[\s-]+/g, ""), l = (r) => r.includes(e) || r.replace(/-/g, "").includes(_);
14
- return t.filter((r) => l(r) || (S[r] ?? []).some(l));
15
- }, [t, o]);
16
- return /* @__PURE__ */ N("div", {
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(g, {
22
+ children: /* @__PURE__ */ c(k, {
22
23
  autoFocus: !0,
23
24
  onChange: u,
24
25
  placeholder: h,
25
- value: o
26
+ value: i
26
27
  })
27
28
  }),
28
29
  /* @__PURE__ */ c("div", {
29
30
  className: "icon-picker__grid",
30
- children: i.length === 0 ? /* @__PURE__ */ c("p", {
31
+ children: t.length === 0 ? /* @__PURE__ */ c("p", {
31
32
  className: "icon-picker__empty",
32
33
  children: p
33
- }) : i.map((e) => /* @__PURE__ */ c("button", {
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
- type: "button",
39
- children: /* @__PURE__ */ c(f, { name: e })
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: i.length === t.length ? `${t.length} icons` : `${i.length} of ${t.length}`
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
- w as IconPicker
53
+ M as IconPicker
51
54
  };
@@ -23,7 +23,7 @@ var r = (i) => {
23
23
  const o = {
24
24
  ...i,
25
25
  lib: d,
26
- libBuildNumber: 445,
26
+ libBuildNumber: 452,
27
27
  libCommit: n,
28
28
  libBuildDate: t
29
29
  };
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.4", B = 445, L = "64ab8ec", _ = "2026-10-02T09:11:25.286Z", a = "445";
1
+ var I = "3.1.5", B = 452, L = "7f7e753", _ = "2026-10-02T12:17:26.091Z", r = "452";
2
2
  export {
3
3
  _ as LIB_BUILD_DATE,
4
- a as LIB_BUILD_ID,
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
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "3.1.4",
3
- "buildNumber": 445,
4
- "commit": "64ab8ec",
5
- "buildDate": "2026-10-02T09:11:25.286Z"
2
+ "version": "3.1.5",
3
+ "buildNumber": 452,
4
+ "commit": "7f7e753",
5
+ "buildDate": "2026-10-02T12:17:26.091Z"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memobit/libs",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
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",