@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.
@@ -4,8 +4,8 @@ import { addDays as Z, addMonths as H } from "../../helpers/Datetime.js";
4
4
  import { useSwipe as ee } from "../../hooks/useSwipe.js";
5
5
  import { buildDroppedStart as te, getWeekDays as ae, startOfDay as T } from "./EventCalendar.helpers.js";
6
6
  import { DayAgenda as ne } from "../DayAgenda/DayAgenda2.js";
7
- import { ToggleButtons as le } from "../ToggleButtons/ToggleButtons2.js";
8
- import { EventCalendarMonth as re } from "./EventCalendar.Month.js";
7
+ import { ToggleButtons as re } from "../ToggleButtons/ToggleButtons2.js";
8
+ import { EventCalendarMonth as le } from "./EventCalendar.Month.js";
9
9
  import { EventCalendarWeek as oe } from "./EventCalendar.Week.js";
10
10
  /* empty css */
11
11
  import { useCallback as s, useMemo as ie, useState as f } from "react";
@@ -18,61 +18,61 @@ var se = [{
18
18
  key: "week",
19
19
  label: "Week",
20
20
  icon: "calendar-week"
21
- }], ce = (l) => l.toLocaleDateString(void 0, {
21
+ }], ce = (r) => r.toLocaleDateString(void 0, {
22
22
  month: "long",
23
23
  year: "numeric"
24
- }), g = (l) => l.toLocaleDateString(void 0, { month: "short" }), de = (l, v) => {
25
- const r = ae(l, v), t = r[0], a = r[r.length - 1];
26
- return t.getFullYear() !== a.getFullYear() ? `${t.getDate()} ${g(t)} ${t.getFullYear()} – ${a.getDate()} ${g(a)} ${a.getFullYear()}` : t.getMonth() !== a.getMonth() ? `${t.getDate()} ${g(t)} – ${a.getDate()} ${g(a)} ${a.getFullYear()}` : `${t.getDate()} – ${a.getDate()} ${g(a)} ${a.getFullYear()}`;
24
+ }), d = (r) => r.toLocaleDateString(void 0, { month: "short" }), de = (r, D) => {
25
+ const l = ae(r, D), t = l[0], a = l[l.length - 1];
26
+ return t.getFullYear() !== a.getFullYear() ? `${t.getDate()} ${d(t)} ${t.getFullYear()} – ${a.getDate()} ${d(a)} ${a.getFullYear()}` : t.getMonth() !== a.getMonth() ? `${t.getDate()} ${d(t)} – ${a.getDate()} ${d(a)} ${a.getFullYear()}` : `${t.getDate()} – ${a.getDate()} ${d(a)} ${a.getFullYear()}`;
27
27
  };
28
- function Se({ activeHours: l, className: v, date: r, dayAgenda: t = !1, dayEndHour: a = 24, dayStartHour: y = 0, defaultDurationMinutes: C = 30, emptyLabel: Y, events: b, firstDayOfWeek: D = 0, headerExtra: z, hourHeight: V = 44, maxEventsPerDay: W = 3, onDateChange: $, onDayClick: _, onEventClick: c, onEventDrop: h, onViewChange: w, renderEvent: B, showHeader: x = !0, showWeekNumbers: L = !1, swipeNavigation: P = !0, view: u }) {
29
- const [A, E] = f(() => T(r ?? /* @__PURE__ */ new Date())), [O, R] = f(u ?? "month"), [d, S] = f(null), [I, m] = f(null), o = r ?? A, i = u ?? O, q = !!h, M = s((e) => {
30
- $ && $(e), r || E(e);
31
- }, [r, $]), G = s((e) => {
32
- w && w(e), u || R(e);
33
- }, [w, u]), p = s((e) => {
28
+ function Se({ activeHours: r, className: D, date: l, dayAgenda: t = !1, dayEndHour: a = 24, dayStartHour: y = 0, defaultDurationMinutes: C = 30, emptyLabel: Y, events: b, firstDayOfWeek: v = 0, headerExtra: z, hourHeight: V = 44, maxEventsPerDay: W = 3, onDateChange: $, onDayClick: _, onEventClick: m, onEventDrop: g, onViewChange: w, renderEvent: B, showHeader: x = !0, showWeekNumbers: L = !1, swipeNavigation: P = !0, view: h }) {
29
+ const [A, E] = f(() => T(l ?? /* @__PURE__ */ new Date())), [O, R] = f(h ?? "month"), [c, S] = f(null), [I, u] = f(null), o = l ?? A, i = h ?? O, q = !!g, M = s((e) => {
30
+ $ && $(e), l || E(e);
31
+ }, [l, $]), G = s((e) => {
32
+ w && w(e), h || R(e);
33
+ }, [w, h]), p = s((e) => {
34
34
  M(i === "month" ? H(o, e) : Z(o, e * 7));
35
35
  }, [
36
36
  o,
37
37
  i,
38
38
  M
39
39
  ]), J = s((e, X) => {
40
- !d || !h || (h(d, te(d, e, X)), S(null));
41
- }, [d, h]), k = s((e) => m(T(e)), []), K = s((e) => {
40
+ !c || !g || (g(c, te(c, e, X)), S(null));
41
+ }, [c, g]), k = s((e) => u(T(e)), []), K = s((e) => {
42
42
  if (t) {
43
43
  k(e.start);
44
44
  return;
45
45
  }
46
- c?.(e);
46
+ m?.(e);
47
47
  }, [
48
48
  t,
49
- c,
49
+ m,
50
50
  k
51
51
  ]), Q = ee({
52
52
  enabled: P,
53
53
  onSwipeLeft: () => p(1),
54
54
  onSwipeRight: () => p(-1)
55
- }), U = ie(() => i === "month" ? ce(o) : de(o, D), [
55
+ }), U = ie(() => i === "month" ? ce(o) : de(o, v), [
56
56
  o,
57
57
  i,
58
- D
58
+ v
59
59
  ]), j = {
60
- activeHours: l,
60
+ activeHours: r,
61
61
  date: o,
62
62
  dragEnabled: q,
63
- draggingId: d?.id ?? null,
63
+ draggingId: c?.id ?? null,
64
64
  events: b,
65
- firstDayOfWeek: D,
65
+ firstDayOfWeek: v,
66
66
  onDayClick: _,
67
67
  onDragEnd: () => S(null),
68
68
  onDragStart: (e) => S(e),
69
69
  onDrop: J,
70
- onEventClick: t || c ? K : void 0,
70
+ onEventClick: t || m ? K : void 0,
71
71
  renderEvent: B,
72
72
  showWeekNumbers: L
73
73
  };
74
74
  return /* @__PURE__ */ F("div", {
75
- className: ["event-calendar", v ?? ""].filter(Boolean).join(" "),
75
+ className: ["event-calendar", D ?? ""].filter(Boolean).join(" "),
76
76
  children: [
77
77
  x && /* @__PURE__ */ F("div", {
78
78
  className: "event-calendar__header",
@@ -109,7 +109,7 @@ function Se({ activeHours: l, className: v, date: r, dayAgenda: t = !1, dayEndHo
109
109
  className: "event-calendar__header-extra",
110
110
  children: z
111
111
  }),
112
- /* @__PURE__ */ n(le, {
112
+ /* @__PURE__ */ n(re, {
113
113
  onToggleChange: (e) => G(e),
114
114
  size: "small",
115
115
  state: i,
@@ -120,7 +120,7 @@ function Se({ activeHours: l, className: v, date: r, dayAgenda: t = !1, dayEndHo
120
120
  /* @__PURE__ */ n("div", {
121
121
  className: "event-calendar__viewport",
122
122
  ...Q,
123
- children: i === "month" ? /* @__PURE__ */ n(re, {
123
+ children: i === "month" ? /* @__PURE__ */ n(le, {
124
124
  ...j,
125
125
  emptyLabel: Y,
126
126
  maxEventsPerDay: W,
@@ -134,19 +134,17 @@ function Se({ activeHours: l, className: v, date: r, dayAgenda: t = !1, dayEndHo
134
134
  })
135
135
  }),
136
136
  I && /* @__PURE__ */ n(ne, {
137
- activeHours: l,
137
+ activeHours: r,
138
138
  date: I,
139
- onDateChange: m,
139
+ onDateChange: u,
140
140
  emptyLabel: Y,
141
141
  events: b,
142
142
  isOpen: !0,
143
143
  onAdd: _ ? (e) => {
144
- m(null), _(e);
145
- } : void 0,
146
- onClose: () => m(null),
147
- onEventClick: c ? (e) => {
148
- m(null), c(e);
144
+ u(null), _(e);
149
145
  } : void 0,
146
+ onClose: () => u(null),
147
+ onEventClick: m,
150
148
  renderEvent: B
151
149
  })
152
150
  ]
@@ -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: 442,
26
+ libBuildNumber: 452,
27
27
  libCommit: n,
28
28
  libBuildDate: t
29
29
  };
@@ -1,31 +1,27 @@
1
- import { useEffect as u, useRef as i } from "react";
2
- var b = (e) => {
3
- const o = i(null);
4
- u(() => {
5
- const d = () => {
6
- if (!o.current) return;
7
- const { overflow: t, position: l, top: n, left: y, right: r, width: s, scrollY: c } = o.current;
8
- document.body.style.overflow = t, document.body.style.position = l, document.body.style.top = n, document.body.style.left = y, document.body.style.right = r, document.body.style.width = s, window.scrollTo(0, c), o.current = null;
9
- };
10
- if (e) {
11
- if (!o.current) {
12
- const t = window.scrollY;
13
- o.current = {
1
+ import { useEffect as c } from "react";
2
+ var t = 0, e = null, m = (d) => {
3
+ c(() => {
4
+ if (d) {
5
+ if (t += 1, t === 1) {
6
+ const o = window.scrollY;
7
+ e = {
14
8
  overflow: document.body.style.overflow,
15
9
  position: document.body.style.position,
16
10
  top: document.body.style.top,
17
11
  left: document.body.style.left,
18
12
  right: document.body.style.right,
19
13
  width: document.body.style.width,
20
- scrollY: t
21
- }, document.body.style.overflow = "hidden", document.body.style.position = "fixed", document.body.style.top = `-${t}px`, document.body.style.left = "0", document.body.style.right = "0", document.body.style.width = "100%";
14
+ scrollY: o
15
+ }, document.body.style.overflow = "hidden", document.body.style.position = "fixed", document.body.style.top = `-${o}px`, document.body.style.left = "0", document.body.style.right = "0", document.body.style.width = "100%";
22
16
  }
23
- } else d();
24
- return () => {
25
- d();
26
- };
27
- }, [e]);
17
+ return () => {
18
+ if (t -= 1, t > 0 || !e) return;
19
+ const { left: o, overflow: l, position: y, right: n, scrollY: s, top: i, width: r } = e;
20
+ document.body.style.overflow = l, document.body.style.position = y, document.body.style.top = i, document.body.style.left = o, document.body.style.right = n, document.body.style.width = r, window.scrollTo(0, s), e = null;
21
+ };
22
+ }
23
+ }, [d]);
28
24
  };
29
25
  export {
30
- b as useBodyScrollLock
26
+ m as useBodyScrollLock
31
27
  };
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.3", B = 442, L = "26c4a4b", _ = "2026-10-02T08:54:18.262Z", a = "442";
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.3",
3
- "buildNumber": 442,
4
- "commit": "26c4a4b",
5
- "buildDate": "2026-10-02T08:54:18.262Z"
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.3",
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",