@alphakits/ui 2.3.0 → 2.3.1
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.
|
@@ -1,65 +1,71 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as n, jsxs as j } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as x, useMemo as z, useCallback as C } from "react";
|
|
3
3
|
import { TransitionGroup as P, CSSTransition as W } from "react-transition-group";
|
|
4
|
-
import
|
|
5
|
-
import { weekDaysShort as q, isSameDay as
|
|
4
|
+
import R from "classnames";
|
|
5
|
+
import { weekDaysShort as q, isSameDay as d, isWithinInterval as G, isLastDayOfMonth as H, isBefore as I, endOfDay as M, isEqual as J, isToday as K, startOfMonth as Q } from "../../../utils/date/index.js";
|
|
6
6
|
import { capitalize as U } from "../../../utils/string.js";
|
|
7
7
|
import { Button as V } from "../../../button/component.js";
|
|
8
8
|
import { Flex as b } from "../../../flex/component.js";
|
|
9
9
|
import { usePrevious as X } from "../../../hooks/usePrevious/index.js";
|
|
10
10
|
import { getSelectionRange as Y } from "../../utils.js";
|
|
11
11
|
import t from "./index.module.css.js";
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const Z = ({
|
|
13
|
+
children: l,
|
|
14
|
+
...a
|
|
15
|
+
}) => {
|
|
16
|
+
const i = x(null);
|
|
17
|
+
return /* @__PURE__ */ n(W, { ...a, nodeRef: i, children: /* @__PURE__ */ n("div", { ref: i, children: l }) });
|
|
18
|
+
}, ce = ({
|
|
19
|
+
weeks: l = [],
|
|
14
20
|
activeMonth: a = /* @__PURE__ */ new Date(),
|
|
15
|
-
highlighted:
|
|
21
|
+
highlighted: i,
|
|
16
22
|
selectedFrom: m,
|
|
17
|
-
selectedTo:
|
|
18
|
-
getDayProps:
|
|
19
|
-
locale:
|
|
23
|
+
selectedTo: f,
|
|
24
|
+
getDayProps: N,
|
|
25
|
+
locale: p
|
|
20
26
|
}) => {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
() =>
|
|
25
|
-
[
|
|
26
|
-
),
|
|
27
|
-
const
|
|
27
|
+
const u = x(a);
|
|
28
|
+
u.current = a;
|
|
29
|
+
const D = X(a), g = D && (a < D ? "right" : "left"), s = Y(m, f, i), v = z(() => q(p), [p]), S = C(
|
|
30
|
+
() => v.map((e) => /* @__PURE__ */ n("div", { className: t.dayName, children: U(e) }, e)),
|
|
31
|
+
[v]
|
|
32
|
+
), T = (e) => {
|
|
33
|
+
const o = e.selected || m != null && d(e.date, new Date(m)) || f != null && d(e.date, new Date(f)), r = !o && s && G(e.date, s), c = e.date.getDate() === 1, h = H(e.date), y = c && r && s && e.date > s.start, k = h && r && s && e.date < s.end, A = s && d(e.date, s.start), B = s && d(e.date, s.end), w = N(e), L = I(M(new Date(e.date)), /* @__PURE__ */ new Date());
|
|
28
34
|
return /* @__PURE__ */ n(
|
|
29
35
|
V,
|
|
30
36
|
{
|
|
31
|
-
...
|
|
32
|
-
ref: (
|
|
33
|
-
Q(e.date).getTime() ===
|
|
37
|
+
...w,
|
|
38
|
+
ref: (O) => {
|
|
39
|
+
Q(e.date).getTime() === u.current.getTime() && w.ref(O);
|
|
34
40
|
},
|
|
35
41
|
type: "button",
|
|
36
42
|
view: "ghost",
|
|
37
43
|
size: "xs",
|
|
38
44
|
disabled: e.disabled,
|
|
39
|
-
className:
|
|
40
|
-
[t.selected]:
|
|
45
|
+
className: R(t.day, {
|
|
46
|
+
[t.selected]: o,
|
|
41
47
|
[t.range]: r,
|
|
42
|
-
[t.rangeStart]:
|
|
43
|
-
[t.rangeEnd]:
|
|
44
|
-
[t.transitLeft]:
|
|
48
|
+
[t.rangeStart]: A,
|
|
49
|
+
[t.rangeEnd]: B,
|
|
50
|
+
[t.transitLeft]: y,
|
|
45
51
|
[t.transitRight]: k,
|
|
46
52
|
[t.today]: K(e.date),
|
|
47
|
-
[t.firstDay]:
|
|
48
|
-
[t.lastDay]:
|
|
53
|
+
[t.firstDay]: c,
|
|
54
|
+
[t.lastDay]: h,
|
|
49
55
|
[t.event]: e.event,
|
|
50
|
-
[t.prev]:
|
|
56
|
+
[t.prev]: L,
|
|
51
57
|
[t.disabled]: e.disabled,
|
|
52
58
|
[t.muted]: e.muted || e.disabled,
|
|
53
|
-
[t.highlighted]:
|
|
59
|
+
[t.highlighted]: i && J(e.date, i)
|
|
54
60
|
}),
|
|
55
61
|
children: e.date.getDate()
|
|
56
62
|
}
|
|
57
63
|
);
|
|
58
|
-
}, E = (e,
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */ n("div", { className: t.daysRow, children: /* @__PURE__ */ n(b, { children:
|
|
64
|
+
}, E = (e, o) => /* @__PURE__ */ n(b, { className: t.weekRow, children: e.map((r, c) => /* @__PURE__ */ n("div", { className: t.daysRowDay, children: r && T(r) }, r ? r.date.getTime() : c)) }, o);
|
|
65
|
+
return /* @__PURE__ */ j("div", { className: R(t.daysTable, g && t[g]), children: [
|
|
66
|
+
/* @__PURE__ */ n("div", { className: t.daysRow, children: /* @__PURE__ */ n(b, { children: S() }) }),
|
|
61
67
|
/* @__PURE__ */ n(P, { component: null, children: /* @__PURE__ */ n(
|
|
62
|
-
|
|
68
|
+
Z,
|
|
63
69
|
{
|
|
64
70
|
timeout: 300,
|
|
65
71
|
classNames: {
|
|
@@ -68,12 +74,12 @@ const oe = ({
|
|
|
68
74
|
exit: t.daysExit,
|
|
69
75
|
exitActive: t.daysExitActive
|
|
70
76
|
},
|
|
71
|
-
children: /* @__PURE__ */ n("div", { className: t.daysBody, children:
|
|
77
|
+
children: /* @__PURE__ */ n("div", { className: t.daysBody, children: l.map(E) })
|
|
72
78
|
},
|
|
73
79
|
a.getTime()
|
|
74
80
|
) })
|
|
75
81
|
] });
|
|
76
82
|
};
|
|
77
83
|
export {
|
|
78
|
-
|
|
84
|
+
ce as DaysTable
|
|
79
85
|
};
|
|
@@ -1,107 +1,112 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useFloating as
|
|
4
|
-
import { CSSTransition as
|
|
5
|
-
import
|
|
6
|
-
import { Portal as
|
|
7
|
-
import { stackingOrder as
|
|
8
|
-
import { Stack as
|
|
1
|
+
import { jsx as r, jsxs as $ } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as N, useLayoutEffect as j, useEffect as R, useMemo as D, useCallback as P } from "react";
|
|
3
|
+
import { useFloating as U, autoUpdate as z, offset as V, flip as q, shift as B, arrow as G } from "@floating-ui/react-dom";
|
|
4
|
+
import { CSSTransition as H } from "react-transition-group";
|
|
5
|
+
import m from "classnames";
|
|
6
|
+
import { Portal as J } from "../portal/component.js";
|
|
7
|
+
import { stackingOrder as K } from "../stack/context.js";
|
|
8
|
+
import { Stack as Q } from "../stack/component.js";
|
|
9
9
|
import e from "./index.module.css.js";
|
|
10
|
-
const
|
|
10
|
+
const W = {
|
|
11
11
|
timeout: 150
|
|
12
|
-
},
|
|
12
|
+
}, X = {
|
|
13
13
|
enter: e.enter,
|
|
14
14
|
enterActive: e.enterActive,
|
|
15
15
|
exit: e.exit,
|
|
16
16
|
exitActive: e.exitActive
|
|
17
|
-
},
|
|
17
|
+
}, Y = {
|
|
18
18
|
top: "bottom",
|
|
19
19
|
right: "left",
|
|
20
20
|
bottom: "top",
|
|
21
21
|
left: "right"
|
|
22
|
-
},
|
|
22
|
+
}, lt = ({
|
|
23
23
|
children: f,
|
|
24
|
-
getPortalContainer:
|
|
25
|
-
transition:
|
|
26
|
-
anchorElement:
|
|
27
|
-
offset:
|
|
28
|
-
withArrow:
|
|
29
|
-
withTransition:
|
|
24
|
+
getPortalContainer: A,
|
|
25
|
+
transition: u = W,
|
|
26
|
+
anchorElement: d,
|
|
27
|
+
offset: a = [0, 0],
|
|
28
|
+
withArrow: s = !1,
|
|
29
|
+
withTransition: b = !0,
|
|
30
30
|
position: y = "left",
|
|
31
|
-
preventFlip:
|
|
32
|
-
popperClassName:
|
|
33
|
-
arrowClassName:
|
|
34
|
-
className:
|
|
35
|
-
open:
|
|
36
|
-
dataTestId:
|
|
37
|
-
update:
|
|
38
|
-
transitionDuration:
|
|
39
|
-
zIndex: w =
|
|
31
|
+
preventFlip: E,
|
|
32
|
+
popperClassName: O,
|
|
33
|
+
arrowClassName: T,
|
|
34
|
+
className: h,
|
|
35
|
+
open: p,
|
|
36
|
+
dataTestId: C,
|
|
37
|
+
update: l,
|
|
38
|
+
transitionDuration: F = `${u.timeout}ms`,
|
|
39
|
+
zIndex: w = K.POPOVER
|
|
40
40
|
}) => {
|
|
41
|
-
const x =
|
|
42
|
-
refs:
|
|
43
|
-
floatingStyles:
|
|
44
|
-
middlewareData:
|
|
45
|
-
placement:
|
|
41
|
+
const x = N(null), S = N(null), {
|
|
42
|
+
refs: i,
|
|
43
|
+
floatingStyles: I,
|
|
44
|
+
middlewareData: c,
|
|
45
|
+
placement: v,
|
|
46
46
|
update: o
|
|
47
|
-
} =
|
|
47
|
+
} = U({
|
|
48
48
|
placement: y,
|
|
49
|
-
whileElementsMounted:
|
|
49
|
+
whileElementsMounted: z,
|
|
50
50
|
middleware: [
|
|
51
|
-
|
|
51
|
+
V(
|
|
52
52
|
{
|
|
53
|
-
crossAxis:
|
|
54
|
-
mainAxis:
|
|
53
|
+
crossAxis: a[0],
|
|
54
|
+
mainAxis: a[1]
|
|
55
55
|
},
|
|
56
|
-
[
|
|
56
|
+
[a]
|
|
57
57
|
),
|
|
58
|
-
...
|
|
59
|
-
|
|
60
|
-
...
|
|
58
|
+
...E ? [] : [q()],
|
|
59
|
+
B({ padding: 4 }),
|
|
60
|
+
...s ? [G({ element: x })] : []
|
|
61
61
|
]
|
|
62
62
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}, [
|
|
66
|
-
|
|
67
|
-
}, [o,
|
|
63
|
+
j(() => {
|
|
64
|
+
i.setReference(d);
|
|
65
|
+
}, [d, i]), R(() => {
|
|
66
|
+
l && o && (l.current = o);
|
|
67
|
+
}, [o, l]), R(() => {
|
|
68
68
|
o();
|
|
69
69
|
}, [o, f]);
|
|
70
|
-
const
|
|
71
|
-
if (!
|
|
70
|
+
const M = D(() => {
|
|
71
|
+
if (!s || !c.arrow)
|
|
72
72
|
return {};
|
|
73
|
-
const { x: t, y:
|
|
73
|
+
const { x: t, y: n } = c.arrow, k = v.split("-")[0], L = Y[k] ?? "bottom";
|
|
74
74
|
return {
|
|
75
75
|
position: "absolute",
|
|
76
76
|
left: t != null ? `${t}px` : void 0,
|
|
77
|
-
top:
|
|
77
|
+
top: n != null ? `${n}px` : void 0,
|
|
78
78
|
right: "",
|
|
79
79
|
bottom: "",
|
|
80
|
-
[
|
|
80
|
+
[L]: "-4px"
|
|
81
81
|
};
|
|
82
|
-
}, [
|
|
82
|
+
}, [s, c.arrow, v]), _ = P(
|
|
83
|
+
(t) => {
|
|
84
|
+
S.current = t, i.setFloating(t);
|
|
85
|
+
},
|
|
86
|
+
[i]
|
|
87
|
+
), g = (t, n) => /* @__PURE__ */ r(
|
|
83
88
|
"div",
|
|
84
89
|
{
|
|
85
|
-
ref:
|
|
90
|
+
ref: _,
|
|
86
91
|
style: {
|
|
87
92
|
zIndex: t,
|
|
88
|
-
...
|
|
93
|
+
...I
|
|
89
94
|
},
|
|
90
|
-
className:
|
|
91
|
-
children: /* @__PURE__ */
|
|
95
|
+
className: m(e.component, h),
|
|
96
|
+
children: /* @__PURE__ */ $(
|
|
92
97
|
"div",
|
|
93
98
|
{
|
|
94
|
-
"data-test-id":
|
|
95
|
-
className:
|
|
96
|
-
style:
|
|
99
|
+
"data-test-id": C,
|
|
100
|
+
className: m(e.inner, O),
|
|
101
|
+
style: n,
|
|
97
102
|
children: [
|
|
98
103
|
f,
|
|
99
|
-
|
|
104
|
+
s && /* @__PURE__ */ r(
|
|
100
105
|
"div",
|
|
101
106
|
{
|
|
102
107
|
ref: x,
|
|
103
|
-
style:
|
|
104
|
-
className:
|
|
108
|
+
style: M,
|
|
109
|
+
className: m(e.arrow, T)
|
|
105
110
|
}
|
|
106
111
|
)
|
|
107
112
|
]
|
|
@@ -109,17 +114,18 @@ const J = {
|
|
|
109
114
|
)
|
|
110
115
|
}
|
|
111
116
|
);
|
|
112
|
-
return /* @__PURE__ */ r(
|
|
113
|
-
|
|
117
|
+
return /* @__PURE__ */ r(Q, { value: w, children: (t) => /* @__PURE__ */ r(J, { getPortalContainer: A, children: b ? /* @__PURE__ */ r(
|
|
118
|
+
H,
|
|
114
119
|
{
|
|
115
120
|
unmountOnExit: !0,
|
|
116
|
-
classNames:
|
|
117
|
-
...
|
|
118
|
-
in:
|
|
119
|
-
|
|
121
|
+
classNames: X,
|
|
122
|
+
...u,
|
|
123
|
+
in: p,
|
|
124
|
+
nodeRef: S,
|
|
125
|
+
children: g(t, { transitionDuration: F })
|
|
120
126
|
}
|
|
121
|
-
) :
|
|
127
|
+
) : p && g(t) }) });
|
|
122
128
|
};
|
|
123
129
|
export {
|
|
124
|
-
|
|
130
|
+
lt as Popover
|
|
125
131
|
};
|
package/dist/toast/component.js
CHANGED
|
@@ -1,99 +1,101 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import { CSSTransition as
|
|
5
|
-
import
|
|
6
|
-
import { useClickOutside as
|
|
7
|
-
import { usePrevious as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Portal as
|
|
10
|
-
import { ToastPlate as
|
|
11
|
-
import
|
|
12
|
-
const
|
|
13
|
-
enter:
|
|
14
|
-
enterActive:
|
|
15
|
-
exit:
|
|
16
|
-
exitActive:
|
|
17
|
-
},
|
|
2
|
+
import { forwardRef as $, useRef as l, useCallback as i, useEffect as g } from "react";
|
|
3
|
+
import I from "react-merge-refs";
|
|
4
|
+
import { CSSTransition as q } from "react-transition-group";
|
|
5
|
+
import P from "classnames";
|
|
6
|
+
import { useClickOutside as y } from "../hooks/useClickOutside/index.js";
|
|
7
|
+
import { usePrevious as z } from "../hooks/usePrevious/index.js";
|
|
8
|
+
import { Popover as B } from "../popover/component.js";
|
|
9
|
+
import { Portal as F } from "../portal/component.js";
|
|
10
|
+
import { ToastPlate as _ } from "../toast-plate/component.js";
|
|
11
|
+
import e from "./index.module.css.js";
|
|
12
|
+
const G = {
|
|
13
|
+
enter: e.enter,
|
|
14
|
+
enterActive: e.enterActive,
|
|
15
|
+
exit: e.exit,
|
|
16
|
+
exitActive: e.exitActive
|
|
17
|
+
}, tt = $(
|
|
18
18
|
({
|
|
19
|
-
anchorElement:
|
|
20
|
-
position:
|
|
21
|
-
offset:
|
|
22
|
-
open:
|
|
23
|
-
autoCloseDelay:
|
|
24
|
-
className:
|
|
25
|
-
bottomOffset:
|
|
26
|
-
style:
|
|
27
|
-
block:
|
|
19
|
+
anchorElement: d,
|
|
20
|
+
position: E,
|
|
21
|
+
offset: b,
|
|
22
|
+
open: r,
|
|
23
|
+
autoCloseDelay: T = 3e3,
|
|
24
|
+
className: x,
|
|
25
|
+
bottomOffset: v,
|
|
26
|
+
style: S = {},
|
|
27
|
+
block: A,
|
|
28
28
|
onMouseEnter: n,
|
|
29
29
|
onMouseLeave: f,
|
|
30
30
|
onTouchStart: u,
|
|
31
31
|
onClose: o,
|
|
32
|
-
getPortalContainer:
|
|
33
|
-
...
|
|
34
|
-
},
|
|
35
|
-
const
|
|
36
|
-
clearTimeout(p.current), p.current = window.setTimeout(o,
|
|
37
|
-
}, [
|
|
32
|
+
getPortalContainer: R,
|
|
33
|
+
...h
|
|
34
|
+
}, N) => {
|
|
35
|
+
const a = l(null), O = l(null), p = l(0), k = z(r), c = i(() => {
|
|
36
|
+
clearTimeout(p.current), p.current = window.setTimeout(o, T);
|
|
37
|
+
}, [T, o]), t = i(() => {
|
|
38
38
|
clearTimeout(p.current);
|
|
39
|
-
}, []),
|
|
39
|
+
}, []), j = i(
|
|
40
40
|
(m) => {
|
|
41
41
|
t(), n && n(m);
|
|
42
42
|
},
|
|
43
43
|
[n, t]
|
|
44
|
-
),
|
|
44
|
+
), C = i(
|
|
45
45
|
(m) => {
|
|
46
46
|
c(), f && f(m);
|
|
47
47
|
},
|
|
48
48
|
[f, c]
|
|
49
|
-
),
|
|
49
|
+
), L = i(
|
|
50
50
|
(m) => {
|
|
51
51
|
t(), u && u(m);
|
|
52
52
|
},
|
|
53
53
|
[u, t]
|
|
54
|
-
),
|
|
54
|
+
), M = i(() => {
|
|
55
55
|
o(), t();
|
|
56
56
|
}, [o, t]);
|
|
57
|
-
|
|
57
|
+
y(a, M), g(() => (r !== k && r && c(), () => {
|
|
58
58
|
t();
|
|
59
|
-
}), [
|
|
60
|
-
const
|
|
61
|
-
block:
|
|
59
|
+
}), [r, k, c, t]);
|
|
60
|
+
const w = {
|
|
61
|
+
block: A,
|
|
62
62
|
onClose: o,
|
|
63
|
-
onMouseEnter:
|
|
64
|
-
onMouseLeave:
|
|
65
|
-
onTouchStart:
|
|
66
|
-
ref:
|
|
63
|
+
onMouseEnter: j,
|
|
64
|
+
onMouseLeave: C,
|
|
65
|
+
onTouchStart: L,
|
|
66
|
+
ref: I([N, a])
|
|
67
67
|
};
|
|
68
|
-
return
|
|
69
|
-
|
|
68
|
+
return d ? /* @__PURE__ */ s(
|
|
69
|
+
B,
|
|
70
70
|
{
|
|
71
|
-
open:
|
|
72
|
-
anchorElement:
|
|
73
|
-
position:
|
|
74
|
-
offset:
|
|
75
|
-
popperClassName:
|
|
71
|
+
open: r,
|
|
72
|
+
anchorElement: d,
|
|
73
|
+
position: E,
|
|
74
|
+
offset: b,
|
|
75
|
+
popperClassName: P(e.popover, { [e.block]: A }),
|
|
76
76
|
transition: { timeout: 150 },
|
|
77
|
-
getPortalContainer:
|
|
78
|
-
children: /* @__PURE__ */ s(
|
|
77
|
+
getPortalContainer: R,
|
|
78
|
+
children: /* @__PURE__ */ s(_, { ...h, style: S, className: x, ...w })
|
|
79
79
|
}
|
|
80
|
-
) : /* @__PURE__ */ s(
|
|
81
|
-
|
|
80
|
+
) : /* @__PURE__ */ s(F, { getPortalContainer: R, children: /* @__PURE__ */ s(
|
|
81
|
+
q,
|
|
82
82
|
{
|
|
83
83
|
unmountOnExit: !0,
|
|
84
|
-
in:
|
|
84
|
+
in: r,
|
|
85
85
|
timeout: 150,
|
|
86
|
-
classNames:
|
|
86
|
+
classNames: G,
|
|
87
|
+
nodeRef: O,
|
|
87
88
|
children: /* @__PURE__ */ s(
|
|
88
|
-
|
|
89
|
+
_,
|
|
89
90
|
{
|
|
90
|
-
...
|
|
91
|
-
className:
|
|
91
|
+
...h,
|
|
92
|
+
className: P(e.fixed, e.toastPlate, x),
|
|
92
93
|
style: {
|
|
93
|
-
...
|
|
94
|
-
bottom:
|
|
94
|
+
...S,
|
|
95
|
+
bottom: v && `${v}px`
|
|
95
96
|
},
|
|
96
|
-
...
|
|
97
|
+
...w,
|
|
98
|
+
ref: I([N, a, O])
|
|
97
99
|
}
|
|
98
100
|
)
|
|
99
101
|
}
|
|
@@ -101,5 +103,5 @@ const F = {
|
|
|
101
103
|
}
|
|
102
104
|
);
|
|
103
105
|
export {
|
|
104
|
-
|
|
106
|
+
tt as Toast
|
|
105
107
|
};
|