@companix/uikit 0.1.25 → 0.1.26
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/__hooks/use-rerender.d.ts +1 -0
- package/dist/__hooks/use-sync-submit.d.ts +1 -0
- package/dist/bundle.es.js +45 -43
- package/dist/bundle.es10.js +1 -1
- package/dist/bundle.es13.js +4 -4
- package/dist/bundle.es14.js +3 -3
- package/dist/bundle.es15.js +2 -2
- package/dist/bundle.es17.js +1 -1
- package/dist/bundle.es23.js +5 -5
- package/dist/bundle.es25.js +1 -1
- package/dist/bundle.es26.js +1 -1
- package/dist/bundle.es28.js +1 -1
- package/dist/bundle.es29.js +12 -11
- package/dist/bundle.es31.js +4 -4
- package/dist/bundle.es32.js +2 -2
- package/dist/bundle.es35.js +2 -2
- package/dist/bundle.es41.js +1 -1
- package/dist/bundle.es42.js +2 -2
- package/dist/bundle.es45.js +1 -1
- package/dist/bundle.es52.js +10 -25
- package/dist/bundle.es53.js +17 -29
- package/dist/bundle.es54.js +36 -48
- package/dist/bundle.es55.js +49 -55
- package/dist/bundle.es56.js +56 -8
- package/dist/bundle.es57.js +8 -26
- package/dist/bundle.es58.js +27 -5
- package/dist/bundle.es59.js +5 -66
- package/dist/bundle.es60.js +66 -23
- package/dist/bundle.es61.js +22 -23
- package/dist/bundle.es62.js +24 -90
- package/dist/bundle.es63.js +90 -18
- package/dist/bundle.es64.js +17 -93
- package/dist/bundle.es65.js +93 -73
- package/dist/bundle.es66.js +73 -23
- package/dist/bundle.es67.js +20 -35
- package/dist/bundle.es68.js +39 -24
- package/dist/bundle.es69.js +24 -79
- package/dist/bundle.es70.js +71 -85
- package/dist/bundle.es71.js +93 -10
- package/dist/bundle.es72.js +10 -70
- package/dist/bundle.es73.js +5 -11
- package/dist/bundle.es74.js +68 -41
- package/dist/bundle.es75.js +10 -31
- package/dist/bundle.es76.js +41 -64
- package/dist/bundle.es77.js +33 -41
- package/dist/bundle.es78.js +62 -11
- package/dist/bundle.es79.js +40 -31
- package/dist/bundle.es80.js +15 -70
- package/dist/bundle.es81.js +32 -14
- package/dist/bundle.es82.js +70 -75
- package/dist/bundle.es83.js +71 -45
- package/dist/bundle.es84.js +48 -13
- package/dist/bundle.es85.js +16 -0
- package/dist/bundle.es86.js +16 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/bundle.es76.js
CHANGED
|
@@ -1,68 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"Tab",
|
|
17
|
-
"Shift+Tab",
|
|
18
|
-
"Space",
|
|
19
|
-
"Mod+B",
|
|
20
|
-
"Mod+U",
|
|
21
|
-
"Mod+I",
|
|
22
|
-
"Mod+S",
|
|
23
|
-
"Mod+K",
|
|
24
|
-
"Mod+Equal",
|
|
25
|
-
"Mod+Shift+Equal",
|
|
26
|
-
"Mod+Minus",
|
|
27
|
-
"Mod+Shift+Minus",
|
|
28
|
-
"PageUp",
|
|
29
|
-
"PageDown",
|
|
30
|
-
"Home",
|
|
31
|
-
"End"
|
|
32
|
-
], c = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform), d = (o) => o.key === "Meta" || o.metaKey, s = (o) => o.key === "Control" || o.ctrlKey, M = {
|
|
33
|
-
Mod: (o) => c ? d(o) : s(o),
|
|
34
|
-
Alt: (o) => o.key === "Alt" || o.altKey,
|
|
35
|
-
Shift: (o) => o.key === "Shift" || o.shiftKey,
|
|
36
|
-
Meta: (o) => c ? s(o) : d(o)
|
|
37
|
-
}, f = (o) => {
|
|
38
|
-
try {
|
|
39
|
-
const t = [];
|
|
40
|
-
for (const e of Object.values(a))
|
|
41
|
-
M[e](o) && t.push(e);
|
|
42
|
-
if (["Meta", "Control", "Alt", "Shift"].includes(o.key)) {
|
|
43
|
-
const e = t.join("+");
|
|
44
|
-
return { key: e, code: e };
|
|
1
|
+
import { DefaultMonths as f, getMonthMaxDay as i } from "./bundle.es66.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);
|
|
45
16
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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 };
|
|
62
40
|
};
|
|
63
41
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
u as onElementKeyDownFactory
|
|
42
|
+
p as defaultMax,
|
|
43
|
+
u as defaultMin,
|
|
44
|
+
I as useCalendarOptions
|
|
68
45
|
};
|
package/dist/bundle.es77.js
CHANGED
|
@@ -1,43 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
o > 0 && n.scrollBy({ top: o });
|
|
34
|
-
}, d = (t) => t.replace(/ /gi, " ").replace(/<br\s*\/?>/gi, `
|
|
35
|
-
`);
|
|
1
|
+
import { jsxs as E, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as p, useState as v, useLayoutEffect as N, useEffect as y } from "react";
|
|
3
|
+
import { Editor as R } from "./bundle.es42.js";
|
|
4
|
+
const k = (d) => {
|
|
5
|
+
const {
|
|
6
|
+
id: e,
|
|
7
|
+
className: f,
|
|
8
|
+
inputClassName: i,
|
|
9
|
+
placeholderClassName: m,
|
|
10
|
+
placeholder: r,
|
|
11
|
+
value: s,
|
|
12
|
+
inputMode: n,
|
|
13
|
+
onCreate: b,
|
|
14
|
+
onClick: A
|
|
15
|
+
} = d, u = p(null), o = p(null), [h, a] = v(!0);
|
|
16
|
+
return N(() => {
|
|
17
|
+
const t = document.createElement("span");
|
|
18
|
+
t.setAttribute("contenteditable", "true"), t.setAttribute("class", i), t.dataset.placeholder = r, e && t.setAttribute("id", e), n && t.setAttribute("inputmode", n), u.current && u.current.appendChild(t);
|
|
19
|
+
const l = new R(t), C = l.onContentChange((x) => {
|
|
20
|
+
a(x.length === 0);
|
|
21
|
+
});
|
|
22
|
+
return b(l), o.current = t, () => {
|
|
23
|
+
C(), o.current = null, t.remove();
|
|
24
|
+
};
|
|
25
|
+
}, []), y(() => {
|
|
26
|
+
const t = o.current;
|
|
27
|
+
t && (e && t.setAttribute("id", e), n && t.setAttribute("inputmode", n), s && (t.textContent = s, a(!1)), t.setAttribute("class", i), t.setAttribute("role", "textbox"), t.setAttribute("aria-multiline", "true"), r && t.setAttribute("aria-label", r));
|
|
28
|
+
}, [e, i, n, r, s]), /* @__PURE__ */ E("div", { role: "presentation", className: f, children: [
|
|
29
|
+
h && /* @__PURE__ */ c("span", { "aria-hidden": "true", className: m, children: r }),
|
|
30
|
+
/* @__PURE__ */ c("div", { role: "presentation", ref: u, onClick: A })
|
|
31
|
+
] });
|
|
32
|
+
};
|
|
36
33
|
export {
|
|
37
|
-
|
|
38
|
-
a as getNodeTextContent,
|
|
39
|
-
l as getPlainTextOffset,
|
|
40
|
-
f as getTextSelectionOffsets,
|
|
41
|
-
d as normalizeEditorText,
|
|
42
|
-
g as scrollSelectionIntoView
|
|
34
|
+
k as WriteBarInput
|
|
43
35
|
};
|
package/dist/bundle.es78.js
CHANGED
|
@@ -1,17 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var a = /* @__PURE__ */ ((o) => (o.Mod = "Mod", o.Alt = "Alt", o.Shift = "Shift", o.Meta = "Meta", o))(a || {});
|
|
2
|
+
const l = [
|
|
3
|
+
"Shift",
|
|
4
|
+
"Mod",
|
|
5
|
+
"ArrowDown",
|
|
6
|
+
"ArrowUp",
|
|
7
|
+
"Mod+ArrowDown",
|
|
8
|
+
"Mod+ArrowUp",
|
|
9
|
+
"Enter",
|
|
10
|
+
"Escape",
|
|
11
|
+
"Backspace",
|
|
12
|
+
"Shift+Enter",
|
|
13
|
+
"Mod+Enter",
|
|
14
|
+
"ArrowLeft",
|
|
15
|
+
"ArrowRight",
|
|
16
|
+
"Tab",
|
|
17
|
+
"Shift+Tab",
|
|
18
|
+
"Space",
|
|
19
|
+
"Mod+B",
|
|
20
|
+
"Mod+U",
|
|
21
|
+
"Mod+I",
|
|
22
|
+
"Mod+S",
|
|
23
|
+
"Mod+K",
|
|
24
|
+
"Mod+Equal",
|
|
25
|
+
"Mod+Shift+Equal",
|
|
26
|
+
"Mod+Minus",
|
|
27
|
+
"Mod+Shift+Minus",
|
|
28
|
+
"PageUp",
|
|
29
|
+
"PageDown",
|
|
30
|
+
"Home",
|
|
31
|
+
"End"
|
|
32
|
+
], c = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform), d = (o) => o.key === "Meta" || o.metaKey, s = (o) => o.key === "Control" || o.ctrlKey, M = {
|
|
33
|
+
Mod: (o) => c ? d(o) : s(o),
|
|
34
|
+
Alt: (o) => o.key === "Alt" || o.altKey,
|
|
35
|
+
Shift: (o) => o.key === "Shift" || o.shiftKey,
|
|
36
|
+
Meta: (o) => c ? s(o) : d(o)
|
|
37
|
+
}, f = (o) => {
|
|
3
38
|
try {
|
|
4
|
-
t =
|
|
39
|
+
const t = [];
|
|
40
|
+
for (const e of Object.values(a))
|
|
41
|
+
M[e](o) && t.push(e);
|
|
42
|
+
if (["Meta", "Control", "Alt", "Shift"].includes(o.key)) {
|
|
43
|
+
const e = t.join("+");
|
|
44
|
+
return { key: e, code: e };
|
|
45
|
+
}
|
|
46
|
+
const r = ["Key", "Digit", "Numpad"].find((e) => o.code.startsWith(e)), n = r ? o.code.slice(r.length) : o.code, i = o.key.length === 1 ? o.key.toUpperCase() : o.key;
|
|
47
|
+
return {
|
|
48
|
+
key: [...t, i].join("+"),
|
|
49
|
+
code: [...t, n].join("+")
|
|
50
|
+
};
|
|
5
51
|
} catch {
|
|
52
|
+
return;
|
|
6
53
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
54
|
+
}, y = (o) => {
|
|
55
|
+
const t = f(o);
|
|
56
|
+
if (!t)
|
|
57
|
+
return null;
|
|
58
|
+
const { key: r, code: n } = t;
|
|
59
|
+
return [r, n].find((i) => l.includes(i)) ?? null;
|
|
60
|
+
}, u = (o) => (t) => {
|
|
61
|
+
o(y(t), t);
|
|
12
62
|
};
|
|
13
63
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
64
|
+
a as Modifier,
|
|
65
|
+
f as getKeyCombo,
|
|
66
|
+
y as getModuleKeyCombo,
|
|
67
|
+
u as onElementKeyDownFactory
|
|
17
68
|
};
|
package/dist/bundle.es79.js
CHANGED
|
@@ -1,34 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { isTextNode as s, isElementNode as i } from "@companix/utils-browser";
|
|
2
|
+
const a = (t) => s(t) ? t.nodeValue || "" : i(t) && t.nodeName === "IMG" ? t.getAttribute("alt") || "" : i(t) && t.nodeName === "DIV" || i(t) && t.nodeName === "BR" && !(t.parentElement && i(t.parentElement) && t.parentElement.nodeName === "DIV" && t.parentElement.getAttribute("contenteditable") !== "true") ? `
|
|
3
|
+
` : "", m = (t) => {
|
|
4
|
+
const e = document.getSelection();
|
|
5
|
+
if (!e || e.rangeCount === 0)
|
|
6
|
+
return {};
|
|
7
|
+
const n = e.getRangeAt(0);
|
|
8
|
+
return n && t.contains(n.commonAncestorContainer) ? { range: n, selection: e } : {};
|
|
9
|
+
}, l = (t, e, n) => {
|
|
10
|
+
let r = n, o = e;
|
|
11
|
+
t === e && (r = 0, o = t.childNodes[n]);
|
|
12
|
+
const c = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT);
|
|
13
|
+
for (; c.nextNode(); ) {
|
|
14
|
+
if (c.currentNode === o)
|
|
15
|
+
return r;
|
|
16
|
+
r += a(c.currentNode).length;
|
|
17
|
+
}
|
|
18
|
+
return r;
|
|
19
|
+
}, f = (t, e) => {
|
|
20
|
+
const n = l(t, e.startContainer, e.startOffset);
|
|
21
|
+
return {
|
|
22
|
+
from: n,
|
|
23
|
+
to: e.collapsed ? n : l(t, e.endContainer, e.endOffset)
|
|
20
24
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
}, g = () => {
|
|
26
|
+
const t = window.getSelection();
|
|
27
|
+
if (!t || !t.rangeCount) return;
|
|
28
|
+
const e = t.getRangeAt(0);
|
|
29
|
+
if (e.commonAncestorContainer === document) return;
|
|
30
|
+
const n = e.commonAncestorContainer.parentElement;
|
|
31
|
+
if (!n) return;
|
|
32
|
+
const r = n.getBoundingClientRect(), o = e.getBoundingClientRect().bottom - r.bottom;
|
|
33
|
+
o > 0 && n.scrollBy({ top: o });
|
|
34
|
+
}, d = (t) => t.replace(/ /gi, " ").replace(/<br\s*\/?>/gi, `
|
|
35
|
+
`);
|
|
32
36
|
export {
|
|
33
|
-
|
|
37
|
+
m as getEditorSelection,
|
|
38
|
+
a as getNodeTextContent,
|
|
39
|
+
l as getPlainTextOffset,
|
|
40
|
+
f as getTextSelectionOffsets,
|
|
41
|
+
d as normalizeEditorText,
|
|
42
|
+
g as scrollSelectionIntoView
|
|
34
43
|
};
|
package/dist/bundle.es80.js
CHANGED
|
@@ -1,72 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
});
|
|
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
|
+
};
|
|
70
13
|
export {
|
|
71
|
-
|
|
14
|
+
r as getColorScheme,
|
|
15
|
+
m as getSystemColorScheme,
|
|
16
|
+
s as updateDOM
|
|
72
17
|
};
|
package/dist/bundle.es81.js
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as s, Fragment as p } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f, useState as c, useImperativeHandle as u } from "react";
|
|
3
|
+
import { AlertDialog as x } from "./bundle.es26.js";
|
|
4
|
+
const g = f((l, a) => {
|
|
5
|
+
const [i, o] = c([]);
|
|
6
|
+
u(
|
|
7
|
+
a,
|
|
8
|
+
() => ({
|
|
9
|
+
showAlert: (e) => {
|
|
10
|
+
o((t) => [...t, e]);
|
|
11
|
+
}
|
|
12
|
+
}),
|
|
13
|
+
[]
|
|
14
|
+
);
|
|
15
|
+
const d = (e) => {
|
|
16
|
+
o((t) => {
|
|
17
|
+
const r = [...t], n = r.findIndex((m) => m.id === e);
|
|
18
|
+
return n !== -1 && r.splice(n, 1), r;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ s(p, { children: i.map(({ id: e, ...t }) => /* @__PURE__ */ s(
|
|
22
|
+
x,
|
|
23
|
+
{
|
|
24
|
+
defaultOpen: !0,
|
|
25
|
+
onClosed: () => d(e),
|
|
26
|
+
...l,
|
|
27
|
+
...t
|
|
28
|
+
},
|
|
29
|
+
`alert-${e}`
|
|
30
|
+
)) });
|
|
31
|
+
});
|
|
14
32
|
export {
|
|
15
|
-
g as
|
|
33
|
+
g as Viewport
|
|
16
34
|
};
|
package/dist/bundle.es82.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.es55.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
|
};
|