@memobit/libs 3.4.2 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/components/AngleSlider/AngleSlider2.js +27 -27
  2. package/dist/components/AppHeader/AppHeader2.js +39 -36
  3. package/dist/components/Blockquote/Blockquote2.js +14 -14
  4. package/dist/components/BulkActionBar/BulkActionBar2.js +34 -30
  5. package/dist/components/Calendar/Calendar2.js +10 -8
  6. package/dist/components/Card/Card.css +1 -1
  7. package/dist/components/Confetti/Confetti2.js +2 -3
  8. package/dist/components/ControlPanel/ControlPanelFilter.js +26 -26
  9. package/dist/components/DataView/DataView.CardView.js +8 -4
  10. package/dist/components/DataView/DataView.ColumnSelector.js +24 -21
  11. package/dist/components/DataView/DataView.MiniSort.js +18 -16
  12. package/dist/components/DataView/DataView2.js +90 -86
  13. package/dist/components/DiffViewer/DiffViewer2.js +124 -118
  14. package/dist/components/Dropdown/Dropdown.css +1 -1
  15. package/dist/components/Dropdown/Dropdown2.js +69 -72
  16. package/dist/components/EventCalendar/EventCalendar.Chip.js +21 -21
  17. package/dist/components/EventCalendar/EventCalendar.Month.js +19 -19
  18. package/dist/components/FloatingWindow/FloatingWindow2.js +60 -60
  19. package/dist/components/Grid/Grid2.js +18 -18
  20. package/dist/components/InputPIN/InputPIN2.js +42 -42
  21. package/dist/components/MiniSort/MiniSort2.js +47 -43
  22. package/dist/components/MiniStatsCard/MiniStatsCard2.js +20 -20
  23. package/dist/components/Pagination/Pagination2.js +18 -18
  24. package/dist/components/Popover/Popover2.js +23 -21
  25. package/dist/components/RangeSlider/RangeSlider2.js +25 -25
  26. package/dist/components/Rating/RatingIcon.js +9 -9
  27. package/dist/components/RichTextEditor/hooks/useLinkPrompt.js +7 -6
  28. package/dist/components/RollingNumber/RollingNumber2.js +33 -31
  29. package/dist/components/Separator/Separator2.js +27 -23
  30. package/dist/components/Skeleton/Skeleton2.js +6 -8
  31. package/dist/components/Slider/Slider2.js +32 -32
  32. package/dist/components/Splitter/Splitter2.js +34 -34
  33. package/dist/components/StackedBar/StackedBar2.js +36 -34
  34. package/dist/components/Stats/Stats2.js +20 -16
  35. package/dist/components/StickyBar/StickyBar2.js +26 -22
  36. package/dist/components/Timeline/Timeline2.js +53 -47
  37. package/dist/components/Tooltip/Tooltip2.js +7 -8
  38. package/dist/components/TourHud/TourHud2.js +20 -20
  39. package/dist/components/Transition/Transition2.js +20 -20
  40. package/dist/components/Tree/Tree2.js +23 -23
  41. package/dist/helpers/VersionInfo.js +1 -1
  42. package/dist/index.d.ts +5 -5
  43. package/dist/node_modules/qrcode.react/lib/esm/index.js +2 -2
  44. package/dist/version.js +2 -2
  45. package/dist/version.json +4 -4
  46. package/package.json +24 -23
@@ -1,22 +1,22 @@
1
1
  import './Dropdown.css';
2
2
  import { Icon as I } from "../Icon/Icon2.js";
3
- import { Button as de } from "../Button/Button2.js";
4
- import { Tooltip as Te } from "../Tooltip/Tooltip2.js";
5
- import { InputText as Ae } from "../InputText/InputText2.js";
6
- import { foldDiacritics as le } from "../../helpers/Search.js";
3
+ import { Button as le } from "../Button/Button2.js";
4
+ import { Tooltip as Ae } from "../Tooltip/Tooltip2.js";
5
+ import { InputText as Ce } from "../InputText/InputText2.js";
6
+ import { foldDiacritics as ae } from "../../helpers/Search.js";
7
7
  /* empty css */
8
8
  import { useEffect as E, useId as He, useRef as D, useState as k } from "react";
9
9
  import { jsx as c, jsxs as g } from "react/jsx-runtime";
10
10
  import { createPortal as je } from "react-dom";
11
- import { caretDown as Ce, clear as fe } from "@memobit/icons";
12
- var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", disabled: x = !1, error: A, highlighted: ue = !1, id: we, label: J, maxVisibleSelectedLabels: he = 1, multilineChips: me = !1, multiple: o = !1, name: N, onChange: u, onSearchChange: ge, options: m, placeholder: H = "Select an option", searchable: a = !0, searchValue: B, selectedCountDisplay: j = "inline", showChips: C = !1, sortSelectedFirst: Q = !1, success: _, usePortal: $ = !0, value: d, valueAsChip: ve = !0 }) => {
13
- const [p, v] = k(!1), [s, l] = k(B || ""), [f, X] = k(m), [L, S] = k(-1), [i, w] = k([]), [R, be] = k({
11
+ import { caretDown as _e, clear as fe } from "@memobit/icons";
12
+ var Ye = ({ allowCustomValue: h = !1, autofocus: pe = !1, className: ue = "", disabled: x = !1, error: A, highlighted: we = !1, id: he, label: J, maxVisibleSelectedLabels: me = 1, multilineChips: ge = !1, multiple: o = !1, name: N, onChange: u, onSearchChange: ve, options: m, placeholder: C = "Select an option", searchable: f = !0, searchValue: M, selectedCountDisplay: H = "inline", showChips: j = !1, sortSelectedFirst: Q = !1, success: _, usePortal: $ = !0, value: d, valueAsChip: be = !0 }) => {
13
+ const [p, v] = k(!1), [s, l] = k(M || ""), [a, X] = k(m), [L, S] = k(-1), [i, w] = k([]), [R, xe] = k({
14
14
  top: 0,
15
15
  bottom: 0,
16
16
  left: 0,
17
17
  width: 0,
18
18
  maxHeight: 300
19
- }), [z, xe] = k(!1), O = D(null), y = D([]), F = D(null), Ne = D(null), Y = He(), Z = we ?? `dropdown-${Y}`, U = D(null);
19
+ }), [z, Ne] = k(!1), O = D(null), y = D([]), F = D(null), $e = D(null), Y = He(), Z = he ?? `dropdown-${Y}`, U = D(null);
20
20
  E(() => {
21
21
  if (p && Q && o) {
22
22
  const n = new Set(i.map((r) => r.value)), e = [], t = [];
@@ -29,16 +29,16 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
29
29
  m
30
30
  ]), E(() => {
31
31
  const n = U.current ?? m;
32
- if (!a || !s) X(n);
32
+ if (!f || !s) X(n);
33
33
  else {
34
- const e = le(s), t = n.filter((r) => le(r.label).includes(e));
34
+ const e = ae(s), t = n.filter((r) => ae(r.label).includes(e));
35
35
  X(t);
36
36
  }
37
37
  S(-1);
38
38
  }, [
39
39
  s,
40
40
  m,
41
- a,
41
+ f,
42
42
  p
43
43
  ]);
44
44
  const V = D(d);
@@ -87,23 +87,23 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
87
87
  d,
88
88
  m,
89
89
  o,
90
- a,
90
+ f,
91
91
  h
92
92
  ]), E(() => {
93
- a && B !== void 0 && l(B);
94
- }, [B, a]), E(() => {
93
+ f && M !== void 0 && l(M);
94
+ }, [M, f]), E(() => {
95
95
  if (!p || !O.current) return;
96
96
  const n = () => {
97
97
  if (!O.current) return;
98
- const t = O.current.getBoundingClientRect(), r = window.visualViewport, T = r?.offsetTop ?? 0, Re = T + (r?.height ?? window.innerHeight), ie = 300, Me = 8, G = Re - t.bottom, se = t.top - T, ce = G < ie && se > G;
99
- if (xe(ce), $) {
100
- const Be = Math.max(0, (ce ? se : G) - Me);
101
- be({
98
+ const t = O.current.getBoundingClientRect(), r = window.visualViewport, T = r?.offsetTop ?? 0, Be = T + (r?.height ?? window.innerHeight), se = 300, Me = 8, G = Be - t.bottom, ce = t.top - T, de = G < se && ce > G;
99
+ if (Ne(de), $) {
100
+ const Te = Math.max(0, (de ? ce : G) - Me);
101
+ xe({
102
102
  top: t.bottom,
103
103
  bottom: window.innerHeight - t.top,
104
104
  left: t.left,
105
105
  width: t.width,
106
- maxHeight: Math.min(ie, Be)
106
+ maxHeight: Math.min(se, Te)
107
107
  });
108
108
  }
109
109
  };
@@ -128,7 +128,7 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
128
128
  w([t]), l(t.label), v(!1), u && u(t, N);
129
129
  return;
130
130
  }
131
- v(!1), !o && i.length > 0 ? l(i[0].label) : o && a && l("");
131
+ v(!1), !o && i.length > 0 ? l(i[0].label) : o && f && l("");
132
132
  }
133
133
  };
134
134
  return document.addEventListener("mousedown", n), () => {
@@ -142,7 +142,7 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
142
142
  N,
143
143
  u,
144
144
  m,
145
- a,
145
+ f,
146
146
  i,
147
147
  $
148
148
  ]);
@@ -151,7 +151,7 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
151
151
  if (o) {
152
152
  const e = i.some((r) => r.value === n.value);
153
153
  let t;
154
- e ? t = i.filter((r) => r.value !== n.value) : t = [...i, n], w(t), a && l(""), u && u(t, N);
154
+ e ? t = i.filter((r) => r.value !== n.value) : t = [...i, n], w(t), f && l(""), u && u(t, N);
155
155
  } else
156
156
  l(n.label), w([n]), v(!1), u && u(n, N);
157
157
  }, P = () => {
@@ -173,16 +173,16 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
173
173
  w([e]), l(e.label), v(!1), u && u(e, N);
174
174
  }, ee = (n) => {
175
175
  const e = i.filter((t) => t.value !== n.value);
176
- w(e), u && (o ? u(e, N) : (u(null, N), a || l("")));
177
- }, $e = () => {
178
- w([]), (!a || !o) && l(""), v(!1), u && u(o ? [] : null, N);
179
- }, ke = (n) => {
180
- l(n), p || v(!0), ge?.(n);
176
+ w(e), u && (o ? u(e, N) : (u(null, N), f || l("")));
177
+ }, ke = () => {
178
+ w([]), (!f || !o) && l(""), v(!1), u && u(o ? [] : null, N);
179
+ }, Le = (n) => {
180
+ l(n), p || v(!0), ve?.(n);
181
181
  }, ne = () => {
182
- x || (v(!0), !o && a && i.length > 0 && l(""), (o || a) && F.current?.focus());
183
- }, Le = () => {
184
- x || (v(!p), p || (S(-1), !o && a && i.length > 0 && l(""), (o || a) && F.current?.focus()));
185
- }, Se = (n) => {
182
+ x || (v(!0), !o && f && i.length > 0 && l(""), (o || f) && F.current?.focus());
183
+ }, Se = () => {
184
+ x || (v(!p), p || (S(-1), !o && f && i.length > 0 && l(""), (o || f) && F.current?.focus()));
185
+ }, Oe = (n) => {
186
186
  if (!x) {
187
187
  if (!p) {
188
188
  (n.key === "ArrowDown" || n.key === "Enter") && (v(!0), n.preventDefault());
@@ -190,45 +190,42 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
190
190
  }
191
191
  switch (n.key) {
192
192
  case "ArrowDown":
193
- if (n.preventDefault(), h && s && f.length === 0) return;
193
+ if (n.preventDefault(), h && s && a.length === 0) return;
194
194
  S((e) => {
195
- const t = e < (h && s && !f.some((r) => r.label.toLowerCase() === s.toLowerCase()) ? f.length : f.length - 1) ? e + 1 : 0;
196
- return t < f.length && y.current[t] && y.current[t]?.scrollIntoView({ block: "nearest" }), t;
195
+ const t = e < (h && s && !a.some((r) => r.label.toLowerCase() === s.toLowerCase()) ? a.length : a.length - 1) ? e + 1 : 0;
196
+ return t < a.length && y.current[t] && y.current[t]?.scrollIntoView({ block: "nearest" }), t;
197
197
  });
198
198
  break;
199
199
  case "ArrowUp":
200
- if (n.preventDefault(), h && s && f.length === 0) return;
200
+ if (n.preventDefault(), h && s && a.length === 0) return;
201
201
  S((e) => {
202
- const t = h && s && !f.some((T) => T.label.toLowerCase() === s.toLowerCase()) ? f.length : f.length - 1, r = e > 0 ? e - 1 : t;
203
- return r < f.length && y.current[r] && y.current[r]?.scrollIntoView({ block: "nearest" }), r;
202
+ const t = h && s && !a.some((T) => T.label.toLowerCase() === s.toLowerCase()) ? a.length : a.length - 1, r = e > 0 ? e - 1 : t;
203
+ return r < a.length && y.current[r] && y.current[r]?.scrollIntoView({ block: "nearest" }), r;
204
204
  });
205
205
  break;
206
206
  case "Enter":
207
- n.preventDefault(), L >= 0 && L < f.length ? K(f[L]) : (h && s && L === f.length || h && s && f.length === 0) && P();
207
+ n.preventDefault(), L >= 0 && L < a.length ? K(a[L]) : (h && s && L === a.length || h && s && a.length === 0) && P();
208
208
  break;
209
209
  case "Escape":
210
- n.preventDefault(), v(!1), !o && i.length > 0 ? l(i[0].label) : o && a && l("");
210
+ n.preventDefault(), v(!1), !o && i.length > 0 ? l(i[0].label) : o && f && l("");
211
211
  break;
212
212
  case "Backspace":
213
213
  o && s === "" && i.length > 0 && (n.preventDefault(), ee(i[i.length - 1]));
214
- break;
215
- default:
216
- break;
217
214
  }
218
215
  }
219
- }, q = (n) => i.some((e) => e.value === n.value), Oe = () => {
216
+ }, q = (n) => i.some((e) => e.value === n.value), ye = () => {
220
217
  if (i.length === 0) return "";
221
- const n = Math.max(1, he);
218
+ const n = Math.max(1, me);
222
219
  if (i.length <= n) return i.map((r) => r.label).join(", ");
223
220
  const e = i.slice(0, n).map((r) => r.label).join(", "), t = i.length - n;
224
221
  return `${e} (+${t} ${t === 1 ? "other" : "others"})`;
225
- }, ye = () => o && C || a && p ? s : i.length > 0 ? o ? Oe() : i[0].label : "", Ie = () => o && C ? i.length > 0 ? "" : H : p && a ? H : i.length > 0 ? "" : H, Ee = () => !o || i.length === 0 || j === "none" ? null : j === "floating" ? /* @__PURE__ */ g("div", {
222
+ }, Ie = () => o && j || f && p ? s : i.length > 0 ? o ? ye() : i[0].label : "", Ee = () => o && j ? i.length > 0 ? "" : C : p && f ? C : i.length > 0 ? "" : C, De = () => !o || i.length === 0 || H === "none" ? null : H === "floating" ? /* @__PURE__ */ g("div", {
226
223
  className: "dropdown-selected-count",
227
224
  children: [i.length, " selected"]
228
- }) : null, te = () => !!(h && s && s.trim() && !f.some((n) => n.label.toLowerCase() === s.toLowerCase() || n.value.toString() === s)), De = () => {
225
+ }) : null, te = () => !!(h && s && s.trim() && !a.some((n) => n.label.toLowerCase() === s.toLowerCase() || n.value.toString() === s)), Re = () => {
229
226
  if (!p || x) return null;
230
227
  const n = /* @__PURE__ */ c("div", {
231
- ref: Ne,
228
+ ref: $e,
232
229
  className: `dropdown-menu ${$ ? "dropdown-menu--portal" : ""} ${z ? "dropdown-menu--upward" : ""}`,
233
230
  style: $ ? {
234
231
  position: "fixed",
@@ -239,9 +236,9 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
239
236
  maxHeight: `${R.maxHeight}px`,
240
237
  zIndex: 9999
241
238
  } : void 0,
242
- children: f.length > 0 || te() ? /* @__PURE__ */ g("ul", {
239
+ children: a.length > 0 || te() ? /* @__PURE__ */ g("ul", {
243
240
  className: "dropdown-options-list",
244
- children: [f.map((e, t) => /* @__PURE__ */ g("li", {
241
+ children: [a.map((e, t) => /* @__PURE__ */ g("li", {
245
242
  ref: (r) => {
246
243
  y.current[t] = r;
247
244
  },
@@ -287,11 +284,11 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
287
284
  })]
288
285
  }, `dd-option-${Y}-${t}`)), te() && /* @__PURE__ */ c("li", {
289
286
  ref: (e) => {
290
- y.current[f.length] = e;
287
+ y.current[a.length] = e;
291
288
  },
292
- className: `dropdown-option dropdown-option--create ${L === f.length ? "focused" : ""}`,
289
+ className: `dropdown-option dropdown-option--create ${L === a.length ? "focused" : ""}`,
293
290
  onClick: P,
294
- onMouseEnter: () => S(f.length),
291
+ onMouseEnter: () => S(a.length),
295
292
  children: /* @__PURE__ */ c("div", {
296
293
  className: "dropdown-option-content",
297
294
  children: /* @__PURE__ */ g("span", {
@@ -310,9 +307,9 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
310
307
  })
311
308
  });
312
309
  return $ ? je(n, document.body) : n;
313
- }, b = !o && i.length === 1 ? i[0] : null, M = ve && !p && !o && i.length > 0, re = !!(b?.icon && !s && !M), oe = !!(b?.suffixIcon && !M), W = o && C;
310
+ }, b = !o && i.length === 1 ? i[0] : null, B = be && !p && !o && i.length > 0, re = !!(b?.icon && !s && !B), oe = !!(b?.suffixIcon && !B), W = o && j, ie = i.length > 0;
314
311
  return /* @__PURE__ */ g("div", {
315
- className: `dropdown-container ${A ? "dropdown-error" : ""} ${_ ? "dropdown-success" : ""} ${ue ? "dropdown-highlighted" : ""} ${o ? "multiple" : ""} ${x ? "disabled" : ""} ${o ? `count-display-${j}` : ""} ${pe}`,
312
+ className: `dropdown-container ${A ? "dropdown-error" : ""} ${_ ? "dropdown-success" : ""} ${we ? "dropdown-highlighted" : ""} ${o ? "multiple" : ""} ${x ? "disabled" : ""} ${o ? `count-display-${H}` : ""} ${ue}`,
316
313
  ref: O,
317
314
  children: [
318
315
  J && /* @__PURE__ */ c("label", {
@@ -321,13 +318,13 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
321
318
  children: J
322
319
  }),
323
320
  /* @__PURE__ */ g("div", {
324
- className: `dropdown-input-container ${re ? "dropdown-input-container--has-prefix-icon" : ""} ${oe ? "dropdown-input-container--has-suffix-icon" : ""} ${W ? "dropdown-input-container--chips" : ""} ${W && me ? "dropdown-input-container--chips-multiline" : ""}`,
321
+ className: `dropdown-input-container ${re ? "dropdown-input-container--has-prefix-icon" : ""} ${oe ? "dropdown-input-container--has-suffix-icon" : ""} ${W ? "dropdown-input-container--chips" : ""} ${W && ge ? "dropdown-input-container--chips-multiline" : ""} ${ie ? "dropdown-input-container--clearable" : ""}`,
325
322
  children: [
326
323
  re && b?.icon && /* @__PURE__ */ c("span", {
327
324
  className: "dropdown-selected-icon dropdown-selected-icon--prefix",
328
325
  children: /* @__PURE__ */ c(I, { name: b.icon })
329
326
  }),
330
- M && b && /* @__PURE__ */ g("span", {
327
+ B && b && /* @__PURE__ */ g("span", {
331
328
  className: "dropdown-value-chip",
332
329
  onClick: ne,
333
330
  children: [b.icon && /* @__PURE__ */ c(I, { name: b.icon }), /* @__PURE__ */ c("span", {
@@ -340,7 +337,7 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
340
337
  children: [/* @__PURE__ */ c("span", {
341
338
  className: "dropdown-chip__label",
342
339
  children: n.label
343
- }), /* @__PURE__ */ c(Te, {
340
+ }), /* @__PURE__ */ c(Ae, {
344
341
  title: "Remove",
345
342
  children: /* @__PURE__ */ c("button", {
346
343
  type: "button",
@@ -353,17 +350,17 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
353
350
  })
354
351
  })]
355
352
  }, `dd-chip-${n.value}`)),
356
- /* @__PURE__ */ c(Ae, {
353
+ /* @__PURE__ */ c(Ce, {
357
354
  ref: F,
358
355
  id: Z,
359
- placeholder: M ? "" : Ie(),
360
- value: M ? "" : ye(),
361
- onChange: a || o ? ke : () => {
356
+ placeholder: B ? "" : Ee(),
357
+ value: B ? "" : Ie(),
358
+ onChange: f || o ? Le : () => {
362
359
  },
363
360
  onClick: ne,
364
- onKeyDown: Se,
361
+ onKeyDown: Oe,
365
362
  autoComplete: "off",
366
- autoFocus: ae,
363
+ autoFocus: pe,
367
364
  disabled: x
368
365
  }),
369
366
  /* @__PURE__ */ g("div", {
@@ -373,30 +370,30 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
373
370
  className: "dropdown-selected-icon dropdown-selected-icon--suffix",
374
371
  children: /* @__PURE__ */ c(I, { name: b.suffixIcon })
375
372
  }),
376
- (!o && i.length > 0 || o && i.length > 0) && /* @__PURE__ */ c("span", {
373
+ ie && /* @__PURE__ */ c("span", {
377
374
  className: "dropdown-action-button dropdown-clear-button",
378
- children: /* @__PURE__ */ c(de, {
375
+ children: /* @__PURE__ */ c(le, {
379
376
  variant: "plain",
380
- onClick: $e,
377
+ onClick: ke,
381
378
  disabled: x,
382
379
  children: fe
383
380
  })
384
381
  }),
385
382
  /* @__PURE__ */ c("span", {
386
383
  className: `dropdown-action-button dropdown-toggle-button ${p ? "open" : ""}`,
387
- children: /* @__PURE__ */ c(de, {
384
+ children: /* @__PURE__ */ c(le, {
388
385
  variant: "plain",
389
- onClick: Le,
386
+ onClick: Se,
390
387
  disabled: x,
391
- children: Ce
388
+ children: _e
392
389
  })
393
390
  })
394
391
  ]
395
392
  }),
396
- Ee()
393
+ De()
397
394
  ]
398
395
  }),
399
- De(),
396
+ Re(),
400
397
  A && /* @__PURE__ */ c("span", {
401
398
  className: "dropdown-error-message",
402
399
  children: A
@@ -409,5 +406,5 @@ var Xe = ({ allowCustomValue: h = !1, autofocus: ae = !1, className: pe = "", di
409
406
  });
410
407
  };
411
408
  export {
412
- Xe as Dropdown
409
+ Ye as Dropdown
413
410
  };
@@ -1,39 +1,39 @@
1
- import { formatEventTime as m } from "./EventCalendar.helpers.js";
2
- import { Fragment as f, jsx as r, jsxs as b } from "react/jsx-runtime";
3
- function N({ className: t, dragEnabled: d, event: a, isDragging: o, onClick: e, onDragEnd: s, onDragStart: p, renderEvent: c, showTime: h = !1, style: i }) {
1
+ import { formatEventTime as f } from "./EventCalendar.helpers.js";
2
+ import { Fragment as b, jsx as e, jsxs as x } from "react/jsx-runtime";
3
+ function j({ className: t, dragEnabled: d, event: a, isDragging: s, onClick: r, onDragEnd: o, onDragStart: p, renderEvent: c, showTime: h = !1, style: i }) {
4
4
  const n = d && a.draggable !== !1, g = (l) => {
5
- l.stopPropagation(), e?.(a);
5
+ l.stopPropagation(), r?.(a);
6
6
  }, _ = (l) => {
7
7
  l.dataTransfer.effectAllowed = "move", l.dataTransfer.setData("text/plain", String(a.id)), p(a);
8
- };
9
- return /* @__PURE__ */ r("div", {
10
- className: [
11
- "event-calendar__chip",
12
- `event-calendar__chip--${a.variant ?? "default"}`,
13
- o ? "event-calendar__chip--dragging" : "",
14
- n ? "event-calendar__chip--draggable" : "",
15
- e ? "event-calendar__chip--clickable" : "",
16
- t ?? ""
17
- ].filter(Boolean).join(" "),
8
+ }, m = [
9
+ "event-calendar__chip",
10
+ `event-calendar__chip--${a.variant ?? "default"}`,
11
+ s ? "event-calendar__chip--dragging" : "",
12
+ n ? "event-calendar__chip--draggable" : "",
13
+ r ? "event-calendar__chip--clickable" : "",
14
+ t ?? ""
15
+ ].filter(Boolean).join(" ");
16
+ return /* @__PURE__ */ e("div", {
17
+ className: m,
18
18
  draggable: n,
19
19
  onClick: g,
20
- onDragEnd: s,
20
+ onDragEnd: o,
21
21
  onDragStart: _,
22
22
  style: a.color ? {
23
23
  ...i,
24
24
  "--event-calendar-chip-color": a.color
25
25
  } : i,
26
26
  title: a.title,
27
- children: c ? c(a) : /* @__PURE__ */ b(f, { children: [
28
- a.leading && /* @__PURE__ */ r("span", {
27
+ children: c ? c(a) : /* @__PURE__ */ x(b, { children: [
28
+ a.leading && /* @__PURE__ */ e("span", {
29
29
  className: "event-calendar__chip-leading",
30
30
  children: a.leading
31
31
  }),
32
- h && !a.allDay && /* @__PURE__ */ r("span", {
32
+ h && !a.allDay && /* @__PURE__ */ e("span", {
33
33
  className: "event-calendar__chip-time",
34
- children: m(a.start)
34
+ children: f(a.start)
35
35
  }),
36
- /* @__PURE__ */ r("span", {
36
+ /* @__PURE__ */ e("span", {
37
37
  className: "event-calendar__chip-title",
38
38
  children: a.title
39
39
  })
@@ -41,5 +41,5 @@ function N({ className: t, dragEnabled: d, event: a, isDragging: o, onClick: e,
41
41
  });
42
42
  }
43
43
  export {
44
- N as EventCalendarChip
44
+ j as EventCalendarChip
45
45
  };
@@ -1,7 +1,7 @@
1
- import { getIsoWeek as ae, getMonthMatrix as re, isSameDay as oe, isToday as ce, isWeekend as le } from "../../helpers/Datetime.js";
2
- import { bucketEventsByDay as se, isMultiDayEvent as ie, layoutWeekSpans as de, startOfDay as g } from "./EventCalendar.helpers.js";
1
+ import { getIsoWeek as re, getMonthMatrix as oe, isSameDay as ce, isToday as le, isWeekend as se } from "../../helpers/Datetime.js";
2
+ import { bucketEventsByDay as ie, isMultiDayEvent as de, layoutWeekSpans as ue, startOfDay as g } from "./EventCalendar.helpers.js";
3
3
  import { EventCalendarChip as z } from "./EventCalendar.Chip.js";
4
- import { useCallback as M, useEffect as ue, useMemo as d, useState as T } from "react";
4
+ import { useCallback as M, useEffect as me, useMemo as d, useState as T } from "react";
5
5
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
6
  var C = [
7
7
  "Sun",
@@ -12,9 +12,9 @@ var C = [
12
12
  "Fri",
13
13
  "Sat"
14
14
  ];
15
- function ge({ date: u, dragEnabled: f, draggingId: w, emptyLabel: x, events: m, firstDayOfWeek: v, maxEventsPerDay: E, onDayClick: S, onDragEnd: $, onDragStart: L, onDrop: G, onEventClick: P, onOpenDay: _, onRangeSelect: h, renderEvent: j, showWeekNumbers: B }) {
15
+ function fe({ date: u, dragEnabled: f, draggingId: w, emptyLabel: x, events: m, firstDayOfWeek: v, maxEventsPerDay: E, onDayClick: S, onDragEnd: $, onDragStart: L, onDrop: G, onEventClick: P, onOpenDay: _, onRangeSelect: h, renderEvent: j, showWeekNumbers: B }) {
16
16
  const [H, A] = T(null), [J, D] = T(null), [r, b] = T(null);
17
- ue(() => {
17
+ me(() => {
18
18
  if (!r) return;
19
19
  const e = () => {
20
20
  if (r.anchor.getTime() !== r.focus.getTime()) {
@@ -44,7 +44,7 @@ function ge({ date: u, dragEnabled: f, draggingId: w, emptyLabel: x, events: m,
44
44
  if (!r) return !1;
45
45
  const a = g(e).getTime(), i = Math.min(r.anchor.getTime(), r.focus.getTime()), l = Math.max(r.anchor.getTime(), r.focus.getTime());
46
46
  return a >= i && a <= l;
47
- }, [r]), y = d(() => re(u.getFullYear(), u.getMonth(), v), [u, v]), F = d(() => y.flat(), [y]), I = d(() => se(m, F), [m, F]), X = d(() => new Map(I.map((e) => [e.date.toDateString(), e])), [I]), Z = d(() => v === 1 ? [...C.slice(1), C[0]] : C, [v]), O = u.getMonth(), R = m.length > 0, ee = /* @__PURE__ */ new Date(), ne = (e, a) => {
47
+ }, [r]), y = d(() => oe(u.getFullYear(), u.getMonth(), v), [u, v]), F = d(() => y.flat(), [y]), I = d(() => ie(m, F), [m, F]), X = d(() => new Map(I.map((e) => [e.date.toDateString(), e])), [I]), Z = d(() => v === 1 ? [...C.slice(1), C[0]] : C, [v]), O = u.getMonth(), R = m.length > 0, ee = /* @__PURE__ */ new Date(), ne = (e, a) => {
48
48
  e.preventDefault(), D(null), G(a, !0);
49
49
  }, te = (e, a) => {
50
50
  !f || w === null || (e.preventDefault(), e.dataTransfer.dropEffect = "move", D(a));
@@ -65,12 +65,12 @@ function ge({ date: u, dragEnabled: f, draggingId: w, emptyLabel: x, events: m,
65
65
  /* @__PURE__ */ o("div", {
66
66
  className: "event-calendar__weeks",
67
67
  children: y.map((e, a) => {
68
- const i = e.some((n) => oe(n, ee)), l = de(m, e), N = l.reduce((n, c) => Math.max(n, c.lane + 1), 0);
68
+ const i = e.some((n) => ce(n, ee)), l = ue(m, e), N = l.reduce((n, c) => Math.max(n, c.lane + 1), 0);
69
69
  return /* @__PURE__ */ s("div", {
70
70
  className: ["event-calendar__week", i ? "event-calendar__week--current" : ""].filter(Boolean).join(" "),
71
71
  children: [B && /* @__PURE__ */ o("div", {
72
72
  className: "event-calendar__week-number",
73
- children: ae(e[0])
73
+ children: re(e[0])
74
74
  }), /* @__PURE__ */ s("div", {
75
75
  className: "event-calendar__week-days",
76
76
  style: { "--event-calendar-span-lanes": N },
@@ -96,17 +96,17 @@ function ge({ date: u, dragEnabled: f, draggingId: w, emptyLabel: x, events: m,
96
96
  }
97
97
  }, `${n.event.id}-span-${a}`))
98
98
  }), e.map((n) => {
99
- const c = n.toDateString(), k = X.get(c), p = k ? [...k.allDay.filter((t) => !ie(t)), ...k.timed] : [], W = H === c, Y = n.getDate() === 1 ? `${n.toLocaleDateString(void 0, { month: "short" })} ${n.getDate()}` : String(n.getDate()), K = W ? p : p.slice(0, E), q = p.length - K.length;
99
+ const c = n.toDateString(), k = X.get(c), p = k ? [...k.allDay.filter((t) => !de(t)), ...k.timed] : [], W = H === c, Y = n.getDate() === 1 ? `${n.toLocaleDateString(void 0, { month: "short" })} ${n.getDate()}` : String(n.getDate()), K = W ? p : p.slice(0, E), q = p.length - K.length, ae = [
100
+ "event-calendar__day",
101
+ n.getMonth() === O ? "" : "event-calendar__day--outside",
102
+ le(n) ? "event-calendar__day--today" : "",
103
+ se(n) ? "event-calendar__day--weekend" : "",
104
+ J === c ? "event-calendar__day--drop-target" : "",
105
+ V(n) ? "event-calendar__day--selecting" : "",
106
+ S ? "event-calendar__day--clickable" : ""
107
+ ].filter(Boolean).join(" ");
100
108
  return /* @__PURE__ */ s("div", {
101
- className: [
102
- "event-calendar__day",
103
- n.getMonth() === O ? "" : "event-calendar__day--outside",
104
- ce(n) ? "event-calendar__day--today" : "",
105
- le(n) ? "event-calendar__day--weekend" : "",
106
- J === c ? "event-calendar__day--drop-target" : "",
107
- V(n) ? "event-calendar__day--selecting" : "",
108
- S ? "event-calendar__day--clickable" : ""
109
- ].filter(Boolean).join(" "),
109
+ className: ae,
110
110
  onClick: () => S?.(n),
111
111
  onDragLeave: () => D((t) => t === c ? null : t),
112
112
  onDragOver: (t) => te(t, c),
@@ -176,5 +176,5 @@ function ge({ date: u, dragEnabled: f, draggingId: w, emptyLabel: x, events: m,
176
176
  });
177
177
  }
178
178
  export {
179
- ge as EventCalendarMonth
179
+ fe as EventCalendarMonth
180
180
  };