@companix/uikit 0.0.60 → 0.0.61

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 (42) hide show
  1. package/dist/Select/OptionsPopover.d.ts +41 -0
  2. package/dist/Select/SelectInput.d.ts +2 -1
  3. package/dist/Select/index.d.ts +5 -8
  4. package/dist/SelectTags/index.d.ts +7 -12
  5. package/dist/bundle.es12.js +74 -61
  6. package/dist/bundle.es13.js +2 -2
  7. package/dist/bundle.es15.js +1 -1
  8. package/dist/bundle.es21.js +1 -1
  9. package/dist/bundle.es22.js +1 -1
  10. package/dist/bundle.es23.js +1 -1
  11. package/dist/bundle.es26.js +1 -1
  12. package/dist/bundle.es27.js +81 -80
  13. package/dist/bundle.es28.js +4 -4
  14. package/dist/bundle.es29.js +2 -2
  15. package/dist/bundle.es32.js +2 -2
  16. package/dist/bundle.es36.js +1 -1
  17. package/dist/bundle.es40.js +1 -1
  18. package/dist/bundle.es41.js +1 -1
  19. package/dist/bundle.es42.js +1 -1
  20. package/dist/bundle.es48.js +39 -40
  21. package/dist/bundle.es50.js +66 -31
  22. package/dist/bundle.es51.js +24 -4
  23. package/dist/bundle.es52.js +35 -20
  24. package/dist/bundle.es53.js +5 -39
  25. package/dist/bundle.es54.js +14 -5
  26. package/dist/bundle.es55.js +13 -13
  27. package/dist/bundle.es56.js +69 -13
  28. package/dist/bundle.es57.js +66 -68
  29. package/dist/bundle.es58.js +69 -67
  30. package/dist/bundle.es59.js +10 -69
  31. package/dist/bundle.es60.js +42 -10
  32. package/dist/bundle.es61.js +14 -42
  33. package/dist/bundle.es62.js +32 -15
  34. package/dist/bundle.es63.js +61 -23
  35. package/dist/bundle.es64.js +13 -69
  36. package/dist/bundle.es65.js +74 -13
  37. package/dist/bundle.es66.js +45 -71
  38. package/dist/bundle.es67.js +13 -48
  39. package/package.json +1 -1
  40. package/dist/Select/SelectLoader.d.ts +0 -1
  41. package/dist/Select/SelectOptions.d.ts +0 -19
  42. package/dist/bundle.es68.js +0 -16
@@ -1,70 +1,72 @@
1
- import { useMemo as D, useCallback as c } from "react";
2
- function l(e, t) {
3
- return e.getDate() === t.getDate() && e.getMonth() === t.getMonth() && e.getFullYear() === t.getFullYear();
4
- }
5
- function f(e) {
6
- const t = new Date(e);
7
- return t.setHours(0, 0, 0, 0), t;
8
- }
9
- function h(e) {
10
- const t = new Date(e);
11
- return t.setHours(23, 59, 59, 999), t;
12
- }
13
- function M(e, t = {}) {
14
- const { min: n, max: r, withTime: s = !1 } = t;
15
- return !s && (n && l(e, n) || r && l(e, r)) ? !1 : !!(n && e < n || r && e > r);
16
- }
17
- function m(e, t) {
18
- const n = new Date(e);
19
- if (!t)
20
- return n;
21
- const r = n.getDate(), s = new Date(e);
22
- s.setMonth(n.getMonth() + t + 1, 0);
23
- const a = s.getDate();
24
- return r >= a ? s : (n.setFullYear(s.getFullYear(), s.getMonth(), r), n);
25
- }
26
- function F(e, t) {
27
- return m(e, -1);
28
- }
29
- function g(e) {
30
- const t = new Date(e), n = new Date(t);
31
- return n.setFullYear(t.getFullYear(), t.getMonth() + 1, 0), n.setHours(0, 0, 0, 0), n.getDate();
32
- }
33
- function Y(e, t) {
34
- const n = new Date(e);
35
- return n.setFullYear(t), n;
36
- }
37
- function y(e, t) {
38
- const n = new Date(e), r = n.getFullYear(), s = n.getDate(), a = new Date(e);
39
- a.setFullYear(r, t, 15), a.setHours(0, 0, 0, 0);
40
- const u = g(a);
41
- return n.setMonth(t, Math.min(s, u)), n;
42
- }
43
- const w = (e) => {
44
- const { disableFuture: t, disablePast: n, maxDateTime: r, minDateTime: s, shouldDisableDate: a } = e;
45
- return (u, i) => {
46
- const o = /* @__PURE__ */ new Date();
47
- return a ? a(u) : t ? f(u) > o : n ? h(u) < o : s || r ? M(u, { min: s, max: r, withTime: i }) : !1;
48
- };
49
- }, d = (e) => {
50
- const t = D(() => w(e), [
51
- e.disableFuture,
52
- e.disablePast,
53
- e.shouldDisableDate,
54
- e.minDateTime,
55
- e.maxDateTime
56
- ]);
57
- return c(t, [t]);
1
+ import { clamp as m } from "@companix/utils-browser";
2
+ import { formatTime as i } from "@companix/utils-js";
3
+ const g = (n, r) => new Date(r, n, 0).getDate(), u = (n, r) => new Date(r, n - 1, 1).getDay(), D = (n) => n === 0 ? 6 : n - 1, d = (n) => new Array(n).fill(0), T = (n) => ({
4
+ day: n.getDate(),
5
+ month: n.getMonth() + 1,
6
+ year: n.getFullYear()
7
+ }), p = ({ min: n, max: r }) => (t) => {
8
+ if (n.year === t.year) {
9
+ if (t.month !== 0 && t.month < n.month)
10
+ return t.month = 0, t.day = 0, t;
11
+ if (t.month === n.month && t.day < n.day && t.day !== 0)
12
+ return t.day = 0, t;
13
+ }
14
+ if (r.year === t.year) {
15
+ if (t.month !== 0 && t.month > r.month)
16
+ return t.month = 0, t.day = 0, t;
17
+ if (t.month === r.month && t.day > r.day && t.day !== 0)
18
+ return t.day = 0, t;
19
+ }
20
+ }, A = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"], M = [
21
+ "Январь",
22
+ "Февраль",
23
+ "Март",
24
+ "Апрель",
25
+ "Май",
26
+ "Июнь",
27
+ "Июль",
28
+ "Август",
29
+ "Сентябрь",
30
+ "Октябрь",
31
+ "Ноябрь",
32
+ "Декабрь"
33
+ ], c = 9999, a = 100, w = (n, r) => {
34
+ const t = [], o = m(n - r, a, c), e = m(n + r, a, c);
35
+ for (let s = o; s <= e; s++)
36
+ t.push({ title: String(s).padStart(4, "0"), value: s });
37
+ return t;
38
+ }, F = (n) => {
39
+ const r = [], t = new Intl.DateTimeFormat(n, {
40
+ month: "long"
41
+ });
42
+ for (let o = 0; o < 12; o++)
43
+ r.push({
44
+ title: t.format(new Date(2023, o, 15)),
45
+ value: o
46
+ });
47
+ return r;
48
+ }, Y = (n, r) => r.reduce((t, o) => t.replaceAll(o, ""), n.trim()), E = ({ hours: n, minutes: r }, t = ":") => [i(n), i(r)].join(t), h = (n, r = ":") => {
49
+ const [t, o] = [i(n.hours), i(n.minutes)], e = [t, o].join(r);
50
+ return { title: e, value: e, hours: t, minutes: o };
51
+ }, _ = (n, r = ":") => {
52
+ const t = { minutes: -n, hours: 0 };
53
+ return Array.from({ length: 1440 / n }).map(() => (t.minutes += n, t.minutes === 60 && (t.minutes = 0, t.hours++), h(t, r)));
58
54
  };
59
55
  export {
60
- m as addMonths,
61
- w as createDayDisableChecker,
62
- h as endOfDay,
63
- M as isDayMinMaxRestricted,
64
- l as isSameDate,
65
- y as setMonth,
66
- Y as setYear,
67
- f as startOfDay,
68
- F as subMonths,
69
- d as useDayDisableCheker
56
+ c as DEFAULT_MAX_YEAR,
57
+ a as DEFAULT_MIN_YEAR,
58
+ M as DefaultMonths,
59
+ E as convertTimeToOption,
60
+ p as createDateValidation,
61
+ d as createVoids,
62
+ T as dateToFormat,
63
+ D as getDayIndex,
64
+ u as getFirstDay,
65
+ g as getMonthMaxDay,
66
+ F as getMonths,
67
+ h as getTimeValue,
68
+ _ as getTimesOptions,
69
+ w as getYears,
70
+ Y as removeDigits,
71
+ A as weeks
70
72
  };
@@ -1,72 +1,13 @@
1
- import { clamp as m } from "@companix/utils-browser";
2
- import { formatTime as i } from "@companix/utils-js";
3
- const g = (n, r) => new Date(r, n, 0).getDate(), u = (n, r) => new Date(r, n - 1, 1).getDay(), D = (n) => n === 0 ? 6 : n - 1, d = (n) => new Array(n).fill(0), T = (n) => ({
4
- day: n.getDate(),
5
- month: n.getMonth() + 1,
6
- year: n.getFullYear()
7
- }), p = ({ min: n, max: r }) => (t) => {
8
- if (n.year === t.year) {
9
- if (t.month !== 0 && t.month < n.month)
10
- return t.month = 0, t.day = 0, t;
11
- if (t.month === n.month && t.day < n.day && t.day !== 0)
12
- return t.day = 0, t;
13
- }
14
- if (r.year === t.year) {
15
- if (t.month !== 0 && t.month > r.month)
16
- return t.month = 0, t.day = 0, t;
17
- if (t.month === r.month && t.day > r.day && t.day !== 0)
18
- return t.day = 0, t;
19
- }
20
- }, A = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"], M = [
21
- "Январь",
22
- "Февраль",
23
- "Март",
24
- "Апрель",
25
- "Май",
26
- "Июнь",
27
- "Июль",
28
- "Август",
29
- "Сентябрь",
30
- "Октябрь",
31
- "Ноябрь",
32
- "Декабрь"
33
- ], c = 9999, a = 100, w = (n, r) => {
34
- const t = [], o = m(n - r, a, c), e = m(n + r, a, c);
35
- for (let s = o; s <= e; s++)
36
- t.push({ title: String(s).padStart(4, "0"), value: s });
37
- return t;
38
- }, F = (n) => {
39
- const r = [], t = new Intl.DateTimeFormat(n, {
40
- month: "long"
41
- });
42
- for (let o = 0; o < 12; o++)
43
- r.push({
44
- title: t.format(new Date(2023, o, 15)),
45
- value: o
46
- });
47
- return r;
48
- }, Y = (n, r) => r.reduce((t, o) => t.replaceAll(o, ""), n.trim()), E = ({ hours: n, minutes: r }, t = ":") => [i(n), i(r)].join(t), h = (n, r = ":") => {
49
- const [t, o] = [i(n.hours), i(n.minutes)], e = [t, o].join(r);
50
- return { title: e, value: e, hours: t, minutes: o };
51
- }, _ = (n, r = ":") => {
52
- const t = { minutes: -n, hours: 0 };
53
- return Array.from({ length: 1440 / n }).map(() => (t.minutes += n, t.minutes === 60 && (t.minutes = 0, t.hours++), h(t, r)));
1
+ import { jsxs as r, Fragment as a, jsx as e } from "react/jsx-runtime";
2
+ import { faXmark as i, faChevronDown as m } from "@companix/icons-solid";
3
+ import { Icon as o } from "./bundle.es33.js";
4
+ const f = (n) => {
5
+ const { clearButton: c, clearButtonIcon: t, value: s, onClear: l } = n;
6
+ return /* @__PURE__ */ r(a, { children: [
7
+ c && s && /* @__PURE__ */ e("button", { className: "select-close-button", onClick: l, children: t ?? /* @__PURE__ */ e(o, { className: "select-close-icon", icon: i, size: "xxxs" }) }),
8
+ /* @__PURE__ */ e(o, { className: "expand-icon select-expand", icon: m, size: "xxxs" })
9
+ ] });
54
10
  };
55
11
  export {
56
- c as DEFAULT_MAX_YEAR,
57
- a as DEFAULT_MIN_YEAR,
58
- M as DefaultMonths,
59
- E as convertTimeToOption,
60
- p as createDateValidation,
61
- d as createVoids,
62
- T as dateToFormat,
63
- D as getDayIndex,
64
- u as getFirstDay,
65
- g as getMonthMaxDay,
66
- F as getMonths,
67
- h as getTimeValue,
68
- _ as getTimesOptions,
69
- w as getYears,
70
- Y as removeDigits,
71
- A as weeks
12
+ f as SelectRightElements
72
13
  };
@@ -1,13 +1,45 @@
1
- import { jsxs as r, Fragment as a, jsx as e } from "react/jsx-runtime";
2
- import { faXmark as i, faChevronDown as m } from "@companix/icons-solid";
3
- import { Icon as o } from "./bundle.es33.js";
4
- const f = (n) => {
5
- const { clearButton: c, clearButtonIcon: t, value: s, onClear: l } = n;
6
- return /* @__PURE__ */ r(a, { children: [
7
- c && s && /* @__PURE__ */ e("button", { className: "select-close-button", onClick: l, children: t ?? /* @__PURE__ */ e(o, { className: "select-close-icon", icon: i, size: "xxxs" }) }),
8
- /* @__PURE__ */ e(o, { className: "expand-icon select-expand", icon: m, size: "xxxs" })
9
- ] });
1
+ import { DefaultMonths as f, getMonthMaxDay as i } from "./bundle.es58.js";
2
+ import { useMemo as s } from "react";
3
+ import { range as l } from "@companix/utils-js";
4
+ const p = { day: 31, month: 12, year: 2050 }, u = { day: 1, month: 1, year: 1900 }, I = ({ min: t = u, max: e = p, now: r }) => {
5
+ const h = s(() => l(e.year, t.year).map((n) => ({
6
+ title: n.toString(),
7
+ value: n
8
+ })), [e.year, t.year]), d = s(() => {
9
+ const n = f.map((o, a) => ({
10
+ title: o,
11
+ value: a + 1
12
+ }));
13
+ if (t.month && r.year === t.year) {
14
+ const o = n.findIndex(({ value: a }) => a === t.month);
15
+ n.splice(0, o);
16
+ }
17
+ if (e.month && r.year === e.year) {
18
+ const o = n.findIndex(({ value: a }) => a === e.month);
19
+ n.splice(o + 1, n.length);
20
+ }
21
+ return n;
22
+ }, [r.year, t.year, t.month, e.year, e.month]), c = s(() => {
23
+ if (r.month === 0)
24
+ return [];
25
+ const n = i(r.month, r.year), o = Array.from({ length: n }, (a, y) => ({
26
+ title: `${y + 1}`,
27
+ value: y + 1
28
+ }));
29
+ if (t.day && r.month === t.month && r.year === t.year) {
30
+ const a = o.findIndex(({ value: y }) => y === t.day);
31
+ o.splice(0, a);
32
+ }
33
+ if (e.day && r.month === e.month && r.year === e.year) {
34
+ const a = o.findIndex(({ value: y }) => y === e.day);
35
+ o.splice(a + 1, o.length);
36
+ }
37
+ return o;
38
+ }, [r.month, r.year, t, e]);
39
+ return { years: h, months: d, days: c };
10
40
  };
11
41
  export {
12
- f as SelectRightElements
42
+ p as defaultMax,
43
+ u as defaultMin,
44
+ I as useCalendarOptions
13
45
  };
@@ -1,45 +1,17 @@
1
- import { DefaultMonths as f, getMonthMaxDay as i } from "./bundle.es59.js";
2
- import { useMemo as s } from "react";
3
- import { range as l } from "@companix/utils-js";
4
- const p = { day: 31, month: 12, year: 2050 }, u = { day: 1, month: 1, year: 1900 }, I = ({ min: t = u, max: e = p, now: r }) => {
5
- const h = s(() => l(e.year, t.year).map((n) => ({
6
- title: n.toString(),
7
- value: n
8
- })), [e.year, t.year]), d = s(() => {
9
- const n = f.map((o, a) => ({
10
- title: o,
11
- value: a + 1
12
- }));
13
- if (t.month && r.year === t.year) {
14
- const o = n.findIndex(({ value: a }) => a === t.month);
15
- n.splice(0, o);
16
- }
17
- if (e.month && r.year === e.year) {
18
- const o = n.findIndex(({ value: a }) => a === e.month);
19
- n.splice(o + 1, n.length);
20
- }
21
- return n;
22
- }, [r.year, t.year, t.month, e.year, e.month]), c = s(() => {
23
- if (r.month === 0)
24
- return [];
25
- const n = i(r.month, r.year), o = Array.from({ length: n }, (a, y) => ({
26
- title: `${y + 1}`,
27
- value: y + 1
28
- }));
29
- if (t.day && r.month === t.month && r.year === t.year) {
30
- const a = o.findIndex(({ value: y }) => y === t.day);
31
- o.splice(0, a);
32
- }
33
- if (e.day && r.month === e.month && r.year === e.year) {
34
- const a = o.findIndex(({ value: y }) => y === e.day);
35
- o.splice(a + 1, o.length);
36
- }
37
- return o;
38
- }, [r.month, r.year, t, e]);
39
- return { years: h, months: d, days: c };
1
+ const r = (e, o) => {
2
+ let t;
3
+ try {
4
+ t = localStorage.getItem(e) || void 0;
5
+ } catch {
6
+ }
7
+ return t ?? o;
8
+ }, m = (e) => (e || (e = window.matchMedia("(prefers-color-scheme: dark)")), e.matches ? "dark" : "light"), s = (e) => {
9
+ const [o, t] = ["theme-light", "theme-dark"];
10
+ let c = e;
11
+ e === "system" && (c = m()), document.documentElement.classList.remove(o, t), document.documentElement.classList.add(c === "dark" ? t : o), document.documentElement.style.colorScheme = c;
40
12
  };
41
13
  export {
42
- p as defaultMax,
43
- u as defaultMin,
44
- I as useCalendarOptions
14
+ r as getColorScheme,
15
+ m as getSystemColorScheme,
16
+ s as updateDOM
45
17
  };
@@ -1,17 +1,34 @@
1
- const r = (e, o) => {
2
- let t;
3
- try {
4
- t = localStorage.getItem(e) || void 0;
5
- } catch {
6
- }
7
- return t ?? o;
8
- }, m = (e) => (e || (e = window.matchMedia("(prefers-color-scheme: dark)")), e.matches ? "dark" : "light"), s = (e) => {
9
- const [o, t] = ["theme-light", "theme-dark"];
10
- let c = e;
11
- e === "system" && (c = m()), document.documentElement.classList.remove(o, t), document.documentElement.classList.add(c === "dark" ? t : o), document.documentElement.style.colorScheme = c;
12
- };
1
+ import { jsx as s, Fragment as p } from "react/jsx-runtime";
2
+ import { forwardRef as f, useState as u, useImperativeHandle as c } from "react";
3
+ import { AlertDialog as x } from "./bundle.es22.js";
4
+ const g = f((a, l) => {
5
+ const [i, n] = u([]);
6
+ c(
7
+ l,
8
+ () => ({
9
+ showAlert: (e) => {
10
+ n((t) => [...t, e]);
11
+ }
12
+ }),
13
+ []
14
+ );
15
+ const d = (e) => {
16
+ n((t) => {
17
+ const r = [...t], o = r.findIndex((m) => m.id === e);
18
+ return o !== -1 && r.splice(o, 1), r;
19
+ });
20
+ };
21
+ return /* @__PURE__ */ s(p, { children: i.map(({ id: e, ...t }) => /* @__PURE__ */ s(
22
+ x,
23
+ {
24
+ defaultOpen: !0,
25
+ onUnMounted: () => d(e),
26
+ ...a,
27
+ ...t
28
+ },
29
+ `alert-${e}`
30
+ )) });
31
+ });
13
32
  export {
14
- r as getColorScheme,
15
- m as getSystemColorScheme,
16
- s as updateDOM
33
+ g as Viewport
17
34
  };
@@ -1,34 +1,72 @@
1
- import { jsx as s, Fragment as p } from "react/jsx-runtime";
2
- import { forwardRef as f, useState as u, useImperativeHandle as c } from "react";
3
- import { AlertDialog as x } from "./bundle.es22.js";
4
- const g = f((a, l) => {
5
- const [i, n] = u([]);
6
- c(
7
- l,
1
+ import { jsxs as y, jsx as I } from "react/jsx-runtime";
2
+ import { forwardRef as $, useState as b, useMemo as C, useImperativeHandle as w, useCallback as P, createElement as j } from "react";
3
+ import * as c from "@radix-ui/react-toast";
4
+ import { customCSS as k } from "@companix/utils-browser";
5
+ import { Toast as E } from "./bundle.es42.js";
6
+ var u = /* @__PURE__ */ ((r) => (r["top-center"] = "up", r["top-left"] = "left", r["top-right"] = "right", r["bottom-center"] = "down", r["bottom-left"] = "left", r["bottom-right"] = "right", r))(u || {});
7
+ const M = $((r, h) => {
8
+ const { side: l = "top", align: f = "center", gap: d = 14, duration: g, swipeThreshold: x, closeIcon: T } = r, [i, p] = b([]), a = C(() => ({}), []);
9
+ w(
10
+ h,
8
11
  () => ({
9
- showAlert: (e) => {
10
- n((t) => [...t, e]);
12
+ showToast: (t) => {
13
+ p((o) => {
14
+ const e = [...o], n = o.findIndex((s) => s.id === t.id);
15
+ return n === -1 ? e.push(t) : e[n] = t, e;
16
+ });
11
17
  }
12
18
  }),
13
19
  []
14
20
  );
15
- const d = (e) => {
16
- n((t) => {
17
- const r = [...t], o = r.findIndex((m) => m.id === e);
18
- return o !== -1 && r.splice(o, 1), r;
21
+ const m = P((t) => {
22
+ t.forEach(({ id: o }, e) => {
23
+ let n = 0;
24
+ for (let s = e + 1; s < t.length; s++)
25
+ a[t[s].id] && (n += a[t[s].id].clientHeight + d);
26
+ a[o] && a[o].style.setProperty("--offset", `${n}px`);
27
+ });
28
+ }, []), v = (t) => {
29
+ p((o) => {
30
+ const e = [...o], n = e.findIndex((s) => s.id === t);
31
+ return n !== -1 && e.splice(n, 1), e;
19
32
  });
20
33
  };
21
- return /* @__PURE__ */ s(p, { children: i.map(({ id: e, ...t }) => /* @__PURE__ */ s(
22
- x,
34
+ return /* @__PURE__ */ y(
35
+ c.Provider,
23
36
  {
24
- defaultOpen: !0,
25
- onUnMounted: () => d(e),
26
- ...a,
27
- ...t
28
- },
29
- `alert-${e}`
30
- )) });
37
+ swipeThreshold: x,
38
+ swipeDirection: u[`${l}-${f}`],
39
+ children: [
40
+ i.map(({ id: t, ...o }) => /* @__PURE__ */ j(
41
+ E,
42
+ {
43
+ ...o,
44
+ id: t,
45
+ key: `toaster-${t}`,
46
+ duration: o.duration ?? g,
47
+ closeIcon: T,
48
+ onInitialized: (e) => {
49
+ a[t] = e, m(i);
50
+ },
51
+ onClosing: () => {
52
+ delete a[t], m(i);
53
+ },
54
+ onClosed: () => v(t)
55
+ }
56
+ )),
57
+ /* @__PURE__ */ I(
58
+ c.Viewport,
59
+ {
60
+ "data-side": l,
61
+ "data-align": f,
62
+ className: "toaster-viewport",
63
+ style: k({ "--toasters-gap": `${d}px` })
64
+ }
65
+ )
66
+ ]
67
+ }
68
+ );
31
69
  });
32
70
  export {
33
- g as Viewport
71
+ M as Viewport
34
72
  };
@@ -1,72 +1,16 @@
1
- import { jsxs as y, jsx as I } from "react/jsx-runtime";
2
- import { forwardRef as $, useState as b, useMemo as C, useImperativeHandle as w, useCallback as P, createElement as j } from "react";
3
- import * as c from "@radix-ui/react-toast";
4
- import { customCSS as k } from "@companix/utils-browser";
5
- import { Toast as E } from "./bundle.es42.js";
6
- var u = /* @__PURE__ */ ((r) => (r["top-center"] = "up", r["top-left"] = "left", r["top-right"] = "right", r["bottom-center"] = "down", r["bottom-left"] = "left", r["bottom-right"] = "right", r))(u || {});
7
- const M = $((r, h) => {
8
- const { side: l = "top", align: f = "center", gap: d = 14, duration: g, swipeThreshold: x, closeIcon: T } = r, [i, p] = b([]), a = C(() => ({}), []);
9
- w(
10
- h,
11
- () => ({
12
- showToast: (t) => {
13
- p((o) => {
14
- const e = [...o], n = o.findIndex((s) => s.id === t.id);
15
- return n === -1 ? e.push(t) : e[n] = t, e;
16
- });
17
- }
18
- }),
19
- []
20
- );
21
- const m = P((t) => {
22
- t.forEach(({ id: o }, e) => {
23
- let n = 0;
24
- for (let s = e + 1; s < t.length; s++)
25
- a[t[s].id] && (n += a[t[s].id].clientHeight + d);
26
- a[o] && a[o].style.setProperty("--offset", `${n}px`);
27
- });
28
- }, []), v = (t) => {
29
- p((o) => {
30
- const e = [...o], n = e.findIndex((s) => s.id === t);
31
- return n !== -1 && e.splice(n, 1), e;
32
- });
33
- };
34
- return /* @__PURE__ */ y(
35
- c.Provider,
36
- {
37
- swipeThreshold: x,
38
- swipeDirection: u[`${l}-${f}`],
39
- children: [
40
- i.map(({ id: t, ...o }) => /* @__PURE__ */ j(
41
- E,
42
- {
43
- ...o,
44
- id: t,
45
- key: `toaster-${t}`,
46
- duration: o.duration ?? g,
47
- closeIcon: T,
48
- onInitialized: (e) => {
49
- a[t] = e, m(i);
50
- },
51
- onClosing: () => {
52
- delete a[t], m(i);
53
- },
54
- onClosed: () => v(t)
55
- }
56
- )),
57
- /* @__PURE__ */ I(
58
- c.Viewport,
59
- {
60
- "data-side": l,
61
- "data-align": f,
62
- className: "toaster-viewport",
63
- style: k({ "--toasters-gap": `${d}px` })
64
- }
65
- )
66
- ]
1
+ import { useRef as l, useCallback as p } from "react";
2
+ import { useEffectWithLayout as d } from "./bundle.es67.js";
3
+ const g = (r, f) => {
4
+ const c = l(null), i = l(null), o = { Right: c, Left: i }, u = p((t) => {
5
+ if (r.current) {
6
+ const n = r.current.style, e = o[t];
7
+ e.current && e.current.clientWidth ? n[`padding${t}`] !== `${e.current.clientWidth}px` && (n[`padding${t}`] = `${e.current.clientWidth}px`) : n[`padding${t}`] && (n[`padding${t}`] = "");
67
8
  }
68
- );
69
- });
9
+ }, []);
10
+ return d(() => {
11
+ u("Left"), u("Right");
12
+ }, f), { rightRef: c, leftRef: i };
13
+ };
70
14
  export {
71
- M as Viewport
15
+ g as useInputPadding
72
16
  };