@companix/uikit 0.0.76 → 0.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__helpers/createScope.d.ts +13 -0
- package/dist/bundle.es.js +2 -0
- package/dist/bundle.es12.js +4 -4
- package/dist/bundle.es13.js +3 -3
- package/dist/bundle.es14.js +2 -2
- package/dist/bundle.es16.js +1 -1
- package/dist/bundle.es2.js +1 -1
- package/dist/bundle.es21.js +1 -1
- package/dist/bundle.es22.js +1 -1
- package/dist/bundle.es23.js +1 -1
- package/dist/bundle.es24.js +1 -1
- package/dist/bundle.es25.js +1 -1
- package/dist/bundle.es27.js +1 -1
- package/dist/bundle.es28.js +4 -4
- package/dist/bundle.es29.js +2 -2
- package/dist/bundle.es32.js +2 -2
- package/dist/bundle.es36.js +1 -1
- package/dist/bundle.es40.js +1 -1
- package/dist/bundle.es41.js +1 -1
- package/dist/bundle.es42.js +1 -1
- package/dist/bundle.es45.js +19 -24
- package/dist/bundle.es46.js +25 -23
- package/dist/bundle.es47.js +22 -23
- package/dist/bundle.es48.js +24 -88
- package/dist/bundle.es49.js +88 -18
- package/dist/bundle.es50.js +17 -92
- package/dist/bundle.es51.js +92 -73
- package/dist/bundle.es52.js +73 -23
- package/dist/bundle.es53.js +20 -35
- package/dist/bundle.es54.js +39 -5
- package/dist/bundle.es55.js +5 -14
- package/dist/bundle.es56.js +13 -13
- package/dist/bundle.es57.js +13 -69
- package/dist/bundle.es58.js +68 -66
- package/dist/bundle.es59.js +67 -10
- package/dist/bundle.es60.js +10 -42
- package/dist/bundle.es61.js +42 -14
- package/dist/bundle.es62.js +15 -32
- package/dist/bundle.es63.js +23 -61
- package/dist/bundle.es64.js +70 -75
- package/dist/bundle.es65.js +13 -48
- package/dist/bundle.es66.js +74 -13
- package/dist/bundle.es67.js +48 -13
- package/dist/bundle.es68.js +16 -0
- package/dist/bundle.es9.js +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/bundle.es58.js
CHANGED
|
@@ -1,70 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import { jsxs as D, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { dateToFormat as $, weeks as g, createVoids as p, getDayIndex as b, getFirstDay as u, getMonthMaxDay as k } from "./bundle.es52.js";
|
|
3
|
+
import { CalendarHeader as F } from "./bundle.es66.js";
|
|
4
|
+
import { useCalendar as j } from "./bundle.es67.js";
|
|
5
|
+
import { attr as m } from "@companix/utils-browser";
|
|
6
|
+
import { isSameDate as f } from "./bundle.es59.js";
|
|
7
|
+
import { useLayoutEffect as I } from "react";
|
|
8
|
+
const T = ({ disablePickers: c, value: e, onChange: i, ...l }) => {
|
|
9
|
+
const {
|
|
10
|
+
viewDate: n,
|
|
11
|
+
setViewDate: r,
|
|
12
|
+
setNextMonth: N,
|
|
13
|
+
setPrevMonth: x,
|
|
14
|
+
isMonthDisabled: M,
|
|
15
|
+
isYearDisabled: v,
|
|
16
|
+
isDayDisabled: w
|
|
17
|
+
} = j(l);
|
|
18
|
+
I(() => {
|
|
19
|
+
e && r(e);
|
|
20
|
+
}, [e]);
|
|
21
|
+
const o = $(n), h = n.getMonth(), y = n.getFullYear(), C = /* @__PURE__ */ new Date();
|
|
22
|
+
return /* @__PURE__ */ D("div", { className: "calendar", children: [
|
|
23
|
+
/* @__PURE__ */ t(
|
|
24
|
+
F,
|
|
25
|
+
{
|
|
26
|
+
viewDate: n,
|
|
27
|
+
onChange: r,
|
|
28
|
+
onNextMonth: N,
|
|
29
|
+
onPrevMonth: x,
|
|
30
|
+
disablePickers: c,
|
|
31
|
+
isMonthDisabled: M,
|
|
32
|
+
isYearDisabled: v
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ t("div", { className: "calendar-names", children: g.map((d, a) => /* @__PURE__ */ t("div", { className: "calendar-name", children: d }, `week-name-${a}`)) }),
|
|
36
|
+
/* @__PURE__ */ D("div", { className: "calendar-days", children: [
|
|
37
|
+
p(b(u(o.month, o.year))).map((d, a) => /* @__PURE__ */ t("div", { className: "calendar-day", "data-void": !0 }, `void-${d}-${a}`)),
|
|
38
|
+
p(k(o.month, o.year)).map((d, a) => {
|
|
39
|
+
const s = new Date(y, h, a + 1);
|
|
40
|
+
return /* @__PURE__ */ t(
|
|
41
|
+
P,
|
|
42
|
+
{
|
|
43
|
+
day: a + 1,
|
|
44
|
+
disabled: w(s),
|
|
45
|
+
selected: !!(e && f(e, s)),
|
|
46
|
+
today: f(s, C),
|
|
47
|
+
onSelect: () => i?.(s)
|
|
48
|
+
},
|
|
49
|
+
`date-${d}-${y}-${h}-${a}`
|
|
50
|
+
);
|
|
51
|
+
})
|
|
52
|
+
] })
|
|
53
|
+
] });
|
|
54
|
+
}, P = ({ day: c, disabled: e, selected: i, today: l, onSelect: n }) => {
|
|
55
|
+
const r = () => {
|
|
56
|
+
e || n?.();
|
|
48
57
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
return /* @__PURE__ */ t(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: "calendar-day",
|
|
62
|
+
"data-disabled": m(e),
|
|
63
|
+
"data-selected": m(i),
|
|
64
|
+
"data-today": m(l),
|
|
65
|
+
onClick: r,
|
|
66
|
+
children: /* @__PURE__ */ t("span", { className: "calendar-day-number", children: c })
|
|
67
|
+
}
|
|
68
|
+
);
|
|
58
69
|
};
|
|
59
70
|
export {
|
|
60
|
-
|
|
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
|
|
71
|
+
T as Calendar
|
|
70
72
|
};
|
package/dist/bundle.es59.js
CHANGED
|
@@ -1,13 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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]);
|
|
10
58
|
};
|
|
11
59
|
export {
|
|
12
|
-
|
|
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
|
|
13
70
|
};
|
package/dist/bundle.es60.js
CHANGED
|
@@ -1,45 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
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
|
+
] });
|
|
40
10
|
};
|
|
41
11
|
export {
|
|
42
|
-
|
|
43
|
-
u as defaultMin,
|
|
44
|
-
I as useCalendarOptions
|
|
12
|
+
f as SelectRightElements
|
|
45
13
|
};
|
package/dist/bundle.es61.js
CHANGED
|
@@ -1,17 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { DefaultMonths as f, getMonthMaxDay as i } from "./bundle.es52.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 };
|
|
12
40
|
};
|
|
13
41
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
42
|
+
p as defaultMax,
|
|
43
|
+
u as defaultMin,
|
|
44
|
+
I as useCalendarOptions
|
|
17
45
|
};
|
package/dist/bundle.es62.js
CHANGED
|
@@ -1,34 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
});
|
|
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
|
+
};
|
|
32
13
|
export {
|
|
33
|
-
|
|
14
|
+
r as getColorScheme,
|
|
15
|
+
m as getSystemColorScheme,
|
|
16
|
+
s as updateDOM
|
|
34
17
|
};
|
package/dist/bundle.es63.js
CHANGED
|
@@ -1,72 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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,
|
|
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.es23.js";
|
|
4
|
+
const g = f((a, l) => {
|
|
5
|
+
const [i, n] = u([]);
|
|
6
|
+
c(
|
|
7
|
+
l,
|
|
11
8
|
() => ({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const e = [...o], n = o.findIndex((s) => s.id === t.id);
|
|
15
|
-
return n === -1 ? e.push(t) : e[n] = t, e;
|
|
16
|
-
});
|
|
9
|
+
showAlert: (e) => {
|
|
10
|
+
n((t) => [...t, e]);
|
|
17
11
|
}
|
|
18
12
|
}),
|
|
19
13
|
[]
|
|
20
14
|
);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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;
|
|
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;
|
|
32
19
|
});
|
|
33
20
|
};
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
|
|
21
|
+
return /* @__PURE__ */ s(p, { children: i.map(({ id: e, ...t }) => /* @__PURE__ */ s(
|
|
22
|
+
x,
|
|
36
23
|
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
);
|
|
24
|
+
defaultOpen: !0,
|
|
25
|
+
onUnMounted: () => d(e),
|
|
26
|
+
...a,
|
|
27
|
+
...t
|
|
28
|
+
},
|
|
29
|
+
`alert-${e}`
|
|
30
|
+
)) });
|
|
69
31
|
});
|
|
70
32
|
export {
|
|
71
|
-
|
|
33
|
+
g as Viewport
|
|
72
34
|
};
|
package/dist/bundle.es64.js
CHANGED
|
@@ -1,77 +1,72 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
)
|
|
71
|
-
] }),
|
|
72
|
-
!l && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "right", onClick: N, children: /* @__PURE__ */ o(C, { icon: T }) })
|
|
73
|
-
] });
|
|
74
|
-
};
|
|
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
|
+
]
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
});
|
|
75
70
|
export {
|
|
76
|
-
|
|
71
|
+
M as Viewport
|
|
77
72
|
};
|