@companix/uikit 0.0.68 → 0.0.69
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/Select/OptionsPopover.d.ts +1 -0
- package/dist/bundle.es12.js +6 -5
- package/dist/bundle.es13.js +1 -0
- package/dist/bundle.es48.js +24 -22
- package/dist/bundle.es50.js +56 -50
- package/dist/bundle.es53.js +1 -1
- package/dist/bundle.es57.js +2 -2
- package/dist/bundle.es64.js +74 -13
- package/dist/bundle.es65.js +45 -71
- package/dist/bundle.es66.js +13 -48
- package/package.json +1 -1
|
@@ -31,6 +31,7 @@ interface InternalListProps<T> extends SelectOptionsPopoverParams {
|
|
|
31
31
|
options: Option<T>[];
|
|
32
32
|
scrollboxRef?: React.RefObject<HTMLDivElement>;
|
|
33
33
|
optionsWrapperRef?: React.RefObject<HTMLDivElement>;
|
|
34
|
+
close: () => void;
|
|
34
35
|
isActive: (value: T) => boolean;
|
|
35
36
|
onSelect?: (value: T) => void;
|
|
36
37
|
onOpened?: (activeIndex: number) => void;
|
package/dist/bundle.es12.js
CHANGED
|
@@ -35,9 +35,9 @@ const Z = (t) => {
|
|
|
35
35
|
r.current[e.value] = e;
|
|
36
36
|
});
|
|
37
37
|
}, [t.options, t.defaultOptions]);
|
|
38
|
-
const x = n === null ? null : r.current[n] ?? null, { popoverRef: z, froozePopoverPosition: B, handleAnimationEnd: F } = w(), { scrollToElement:
|
|
38
|
+
const x = n === null ? null : r.current[n] ?? null, { popoverRef: z, froozePopoverPosition: B, handleAnimationEnd: F } = w(), { scrollToElement: p, optionsWrapperRef: I, scrollBoxRef: T } = M();
|
|
39
39
|
k(m, () => ({
|
|
40
|
-
scrollTo: (o) =>
|
|
40
|
+
scrollTo: (o) => p(o, "top")
|
|
41
41
|
}));
|
|
42
42
|
const b = (o, e) => {
|
|
43
43
|
B(), i(o), e();
|
|
@@ -59,14 +59,15 @@ const Z = (t) => {
|
|
|
59
59
|
N,
|
|
60
60
|
{
|
|
61
61
|
...S,
|
|
62
|
+
close: o,
|
|
62
63
|
isActive: (e) => e === n,
|
|
63
64
|
onSelect: (e) => b(e, o),
|
|
64
65
|
scrollboxRef: T,
|
|
65
66
|
optionsWrapperRef: I,
|
|
66
|
-
onOpened: (e) =>
|
|
67
|
+
onOpened: (e) => p(e, "center"),
|
|
67
68
|
onOptionsLoaded: (e) => {
|
|
68
|
-
e.forEach((
|
|
69
|
-
r.current[
|
|
69
|
+
e.forEach((c) => {
|
|
70
|
+
r.current[c.value] = c;
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
}
|
package/dist/bundle.es13.js
CHANGED
package/dist/bundle.es48.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as o, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import w from "classnames";
|
|
3
3
|
import { attr as s } from "@companix/utils-browser";
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { VisuallyHidden as
|
|
6
|
-
import { mergeRefs as
|
|
7
|
-
import { SelectRightElements as
|
|
8
|
-
const
|
|
4
|
+
import { forwardRef as y, useRef as D, useCallback as S } from "react";
|
|
5
|
+
import { VisuallyHidden as T } from "@radix-ui/react-visually-hidden";
|
|
6
|
+
import { mergeRefs as j } from "react-merge-refs";
|
|
7
|
+
import { SelectRightElements as z } from "./bundle.es59.js";
|
|
8
|
+
const W = y(
|
|
9
9
|
({
|
|
10
10
|
required: a,
|
|
11
11
|
size: i,
|
|
@@ -19,35 +19,37 @@ const V = w(
|
|
|
19
19
|
disabled: r,
|
|
20
20
|
onClear: h,
|
|
21
21
|
inputRef: C,
|
|
22
|
-
onClick: I
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
onClick: I,
|
|
23
|
+
...N
|
|
24
|
+
}, k) => {
|
|
25
|
+
const e = D(null), v = S(
|
|
25
26
|
(t) => {
|
|
26
27
|
if (!e.current || !document)
|
|
27
28
|
return;
|
|
28
29
|
t.target !== e.current && (e.current.click(), document.activeElement !== e.current && e.current.focus());
|
|
29
30
|
},
|
|
30
31
|
[e]
|
|
31
|
-
),
|
|
32
|
+
), F = (t) => {
|
|
32
33
|
document && document.activeElement === e.current && t.preventDefault();
|
|
33
|
-
}, F = (t) => {
|
|
34
|
-
r || k(t);
|
|
35
34
|
}, g = (t) => {
|
|
36
|
-
v(t);
|
|
35
|
+
r || v(t);
|
|
37
36
|
}, R = (t) => {
|
|
37
|
+
F(t);
|
|
38
|
+
}, x = (t) => {
|
|
38
39
|
e.current && e.current.focus(), h?.(t);
|
|
39
40
|
};
|
|
40
41
|
return /* @__PURE__ */ o(
|
|
41
42
|
"div",
|
|
42
43
|
{
|
|
43
|
-
ref:
|
|
44
|
-
className:
|
|
44
|
+
ref: k,
|
|
45
|
+
className: w("form select", d),
|
|
45
46
|
"data-size": i ?? "md",
|
|
46
47
|
"data-fill": s(u),
|
|
47
48
|
"data-required": s(a),
|
|
48
49
|
"data-disabled": s(r),
|
|
49
|
-
onMouseDown:
|
|
50
|
-
onClick:
|
|
50
|
+
onMouseDown: R,
|
|
51
|
+
onClick: g,
|
|
52
|
+
...N,
|
|
51
53
|
children: [
|
|
52
54
|
/* @__PURE__ */ o("div", { className: "select-layout form-input", children: [
|
|
53
55
|
l && /* @__PURE__ */ n("div", { className: "select-element", children: l }),
|
|
@@ -56,19 +58,19 @@ const V = w(
|
|
|
56
58
|
c
|
|
57
59
|
] }) }),
|
|
58
60
|
/* @__PURE__ */ n("div", { className: "select-element", children: /* @__PURE__ */ n(
|
|
59
|
-
|
|
61
|
+
z,
|
|
60
62
|
{
|
|
61
63
|
clearButton: m,
|
|
62
64
|
value: !!c,
|
|
63
65
|
clearButtonIcon: f,
|
|
64
|
-
onClear:
|
|
66
|
+
onClear: x
|
|
65
67
|
}
|
|
66
68
|
) })
|
|
67
69
|
] }),
|
|
68
|
-
/* @__PURE__ */ n(
|
|
70
|
+
/* @__PURE__ */ n(T, { asChild: !0, children: /* @__PURE__ */ n(
|
|
69
71
|
"input",
|
|
70
72
|
{
|
|
71
|
-
ref:
|
|
73
|
+
ref: j([C, e]),
|
|
72
74
|
autoComplete: "off",
|
|
73
75
|
autoCapitalize: "none",
|
|
74
76
|
autoCorrect: "off",
|
|
@@ -84,5 +86,5 @@ const V = w(
|
|
|
84
86
|
}
|
|
85
87
|
);
|
|
86
88
|
export {
|
|
87
|
-
|
|
89
|
+
W as SelectInput
|
|
88
90
|
};
|
package/dist/bundle.es50.js
CHANGED
|
@@ -1,85 +1,91 @@
|
|
|
1
1
|
import { jsx as i, jsxs as L } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
2
|
+
import { useMemo as k, useEffect as v } from "react";
|
|
3
3
|
import { Spinner as R } from "./bundle.es6.js";
|
|
4
|
-
import { OptionItem as
|
|
4
|
+
import { OptionItem as g } from "./bundle.es15.js";
|
|
5
5
|
import { OptionsList as S } from "./bundle.es17.js";
|
|
6
6
|
import { Icon as b } from "./bundle.es33.js";
|
|
7
|
-
import { faPlus as
|
|
8
|
-
const
|
|
9
|
-
const { onOptionsLoaded: n, useOptions:
|
|
10
|
-
return
|
|
7
|
+
import { faPlus as y } from "@companix/icons-solid";
|
|
8
|
+
const I = () => ({ isLoading: !1, options: [] }), N = (e) => {
|
|
9
|
+
const { onOptionsLoaded: n, useOptions: s = I, options: o } = e, t = s();
|
|
10
|
+
return v(() => {
|
|
11
11
|
t.options.length > 0 && n?.(t.options);
|
|
12
12
|
}, [t.options]), o ? { options: o, isLoading: void 0 } : t;
|
|
13
|
-
},
|
|
13
|
+
}, F = (e) => {
|
|
14
14
|
const {
|
|
15
15
|
isActive: n,
|
|
16
|
-
emptyText:
|
|
16
|
+
emptyText: s,
|
|
17
17
|
scrollboxRef: o,
|
|
18
18
|
optionsWrapperRef: t,
|
|
19
|
-
addOption:
|
|
20
|
-
onOpened:
|
|
21
|
-
onSelect:
|
|
22
|
-
minimalOptions:
|
|
23
|
-
filterOptions:
|
|
24
|
-
disableFiltering:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
addOption: d,
|
|
20
|
+
onOpened: r,
|
|
21
|
+
onSelect: f,
|
|
22
|
+
minimalOptions: O,
|
|
23
|
+
filterOptions: p,
|
|
24
|
+
disableFiltering: m,
|
|
25
|
+
close: c,
|
|
26
|
+
...a
|
|
27
|
+
} = e, { options: l, isLoading: u } = N(a), x = k(() => p && !m ? l.filter(p) : l, [l, p, m]);
|
|
28
|
+
return u ? /* @__PURE__ */ i("div", { className: "select-popover-loading", children: /* @__PURE__ */ i(R, { size: 24 }) }) : /* @__PURE__ */ i(
|
|
29
|
+
P,
|
|
29
30
|
{
|
|
30
|
-
options:
|
|
31
|
+
options: x,
|
|
31
32
|
isActive: n,
|
|
32
|
-
emptyText:
|
|
33
|
+
emptyText: s,
|
|
33
34
|
scrollboxRef: o,
|
|
34
35
|
optionsWrapperRef: t,
|
|
35
|
-
minimalOptions:
|
|
36
|
-
addOption:
|
|
37
|
-
onOpened:
|
|
38
|
-
onSelect:
|
|
36
|
+
minimalOptions: O,
|
|
37
|
+
addOption: d,
|
|
38
|
+
onOpened: r,
|
|
39
|
+
onSelect: f,
|
|
40
|
+
close: c
|
|
39
41
|
}
|
|
40
42
|
);
|
|
41
|
-
},
|
|
43
|
+
}, P = (e) => {
|
|
42
44
|
const {
|
|
43
45
|
isActive: n,
|
|
44
|
-
onOpened:
|
|
46
|
+
onOpened: s,
|
|
45
47
|
addOption: o,
|
|
46
48
|
scrollboxRef: t,
|
|
47
|
-
optionsWrapperRef:
|
|
48
|
-
options:
|
|
49
|
-
onSelect:
|
|
50
|
-
minimalOptions:
|
|
51
|
-
emptyText:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
optionsWrapperRef: d,
|
|
50
|
+
options: r,
|
|
51
|
+
onSelect: f,
|
|
52
|
+
minimalOptions: O,
|
|
53
|
+
emptyText: p = "Ничего не найдено",
|
|
54
|
+
close: m
|
|
55
|
+
} = e;
|
|
56
|
+
return v(() => {
|
|
57
|
+
s?.(r.findIndex(({ value: c }) => n(c)));
|
|
58
|
+
}, []), /* @__PURE__ */ L(S, { scrollboxRef: t, optionsWrapperRef: d, maxHeight: 300, children: [
|
|
56
59
|
o && /* @__PURE__ */ i(
|
|
57
|
-
|
|
60
|
+
g,
|
|
58
61
|
{
|
|
59
62
|
className: "select-add-option",
|
|
60
|
-
icon: /* @__PURE__ */ i(b, { icon:
|
|
63
|
+
icon: /* @__PURE__ */ i(b, { icon: y }),
|
|
61
64
|
title: o.text,
|
|
62
|
-
onClick: o.onClick
|
|
65
|
+
onClick: o.onClick,
|
|
66
|
+
onClickCapture: () => {
|
|
67
|
+
o.closeOnClick && m();
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
r.length === 0 && !o && /* @__PURE__ */ i("div", { className: "select-tags-empty", children: p }),
|
|
72
|
+
r.map(({ title: c, value: a, className: l, icon: u, disabled: x, label: C }, h) => /* @__PURE__ */ i(
|
|
73
|
+
g,
|
|
68
74
|
{
|
|
69
|
-
active: n(
|
|
70
|
-
onClick: () =>
|
|
71
|
-
minimal:
|
|
72
|
-
disabled:
|
|
75
|
+
active: n(a),
|
|
76
|
+
onClick: () => f?.(a),
|
|
77
|
+
minimal: O,
|
|
78
|
+
disabled: x,
|
|
73
79
|
className: l,
|
|
74
|
-
title:
|
|
75
|
-
label:
|
|
76
|
-
icon:
|
|
80
|
+
title: c,
|
|
81
|
+
label: C,
|
|
82
|
+
icon: u
|
|
77
83
|
},
|
|
78
84
|
`select-option-${h}`
|
|
79
85
|
))
|
|
80
86
|
] });
|
|
81
87
|
};
|
|
82
88
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
F as OptionsPopover,
|
|
90
|
+
P as SelectOptionsList
|
|
85
91
|
};
|
package/dist/bundle.es53.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs as b, jsx as o } from "react/jsx-runtime";
|
|
|
2
2
|
import h from "classnames";
|
|
3
3
|
import { attr as e } from "@companix/utils-browser";
|
|
4
4
|
import { forwardRef as x } from "react";
|
|
5
|
-
import { useInputPadding as N } from "./bundle.
|
|
5
|
+
import { useInputPadding as N } from "./bundle.es66.js";
|
|
6
6
|
const v = x(
|
|
7
7
|
({
|
|
8
8
|
required: s,
|
package/dist/bundle.es57.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as D, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { dateToFormat as $, weeks as g, createVoids as p, getDayIndex as b, getFirstDay as u, getMonthMaxDay as k } from "./bundle.es51.js";
|
|
3
|
-
import { CalendarHeader as F } from "./bundle.
|
|
4
|
-
import { useCalendar as j } from "./bundle.
|
|
3
|
+
import { CalendarHeader as F } from "./bundle.es64.js";
|
|
4
|
+
import { useCalendar as j } from "./bundle.es65.js";
|
|
5
5
|
import { attr as m } from "@companix/utils-browser";
|
|
6
6
|
import { isSameDate as f } from "./bundle.es58.js";
|
|
7
7
|
import { useLayoutEffect as I } from "react";
|
package/dist/bundle.es64.js
CHANGED
|
@@ -1,16 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsxs as d, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as u, useMemo as h } from "react";
|
|
3
|
+
import { Select as p } from "./bundle.es12.js";
|
|
4
|
+
import { getMonths as k, getYears as z, DEFAULT_MAX_YEAR as f, DEFAULT_MIN_YEAR as g } from "./bundle.es51.js";
|
|
5
|
+
import { Icon as C } from "./bundle.es33.js";
|
|
6
|
+
import { faChevronLeft as E, faChevronRight as T } from "@companix/icons-solid";
|
|
7
|
+
import { setMonth as _, setYear as F } from "./bundle.es58.js";
|
|
8
|
+
const y = ({
|
|
9
|
+
viewDate: n,
|
|
10
|
+
onChange: c,
|
|
11
|
+
isMonthDisabled: a,
|
|
12
|
+
isYearDisabled: m,
|
|
13
|
+
onNextMonth: N,
|
|
14
|
+
onPrevMonth: v
|
|
15
|
+
}) => {
|
|
16
|
+
const e = n.getFullYear(), r = n.getMonth(), s = "ru", M = u(
|
|
17
|
+
(t) => {
|
|
18
|
+
c(_(n, t));
|
|
19
|
+
},
|
|
20
|
+
[c, n]
|
|
21
|
+
), x = u(
|
|
22
|
+
(t) => {
|
|
23
|
+
c(F(n, t));
|
|
24
|
+
},
|
|
25
|
+
[c, n]
|
|
26
|
+
), A = h(() => k(s).map((t) => ({
|
|
27
|
+
...t,
|
|
28
|
+
className: "capitalize",
|
|
29
|
+
disabled: a && a(t.value)
|
|
30
|
+
})), [s, a]), Y = h(() => z(e, 100).map((t) => ({
|
|
31
|
+
...t,
|
|
32
|
+
disabled: m && m(t.value)
|
|
33
|
+
})), [e, m]);
|
|
34
|
+
let l = r === 11 && e === f;
|
|
35
|
+
a && !l && (l = a(
|
|
36
|
+
r === 11 ? 0 : r + 1,
|
|
37
|
+
r === 11 ? Math.min(e + 1, f) : e
|
|
38
|
+
));
|
|
39
|
+
let i = r === 0 && e === g;
|
|
40
|
+
return a && !i && (i = a(
|
|
41
|
+
r === 0 ? 11 : r - 1,
|
|
42
|
+
r === 0 ? Math.max(e - 1, g) : e
|
|
43
|
+
)), /* @__PURE__ */ d("div", { className: "calendar-header", children: [
|
|
44
|
+
!i && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "left", onClick: v, children: /* @__PURE__ */ o(C, { icon: E }) }),
|
|
45
|
+
/* @__PURE__ */ d("div", { className: "calendar-pickers", children: [
|
|
46
|
+
/* @__PURE__ */ o(
|
|
47
|
+
p,
|
|
48
|
+
{
|
|
49
|
+
fill: !0,
|
|
50
|
+
options: Y,
|
|
51
|
+
size: "sm",
|
|
52
|
+
value: e,
|
|
53
|
+
minimalOptions: !0,
|
|
54
|
+
matchTarget: "min-width",
|
|
55
|
+
onChange: (t) => x(t)
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ o(
|
|
59
|
+
p,
|
|
60
|
+
{
|
|
61
|
+
fill: !0,
|
|
62
|
+
options: A,
|
|
63
|
+
size: "sm",
|
|
64
|
+
className: "capitalize",
|
|
65
|
+
value: r,
|
|
66
|
+
minimalOptions: !0,
|
|
67
|
+
matchTarget: "min-width",
|
|
68
|
+
onChange: (t) => M(t)
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] }),
|
|
72
|
+
!l && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "right", onClick: N, children: /* @__PURE__ */ o(C, { icon: T }) })
|
|
73
|
+
] });
|
|
13
74
|
};
|
|
14
75
|
export {
|
|
15
|
-
|
|
76
|
+
y as CalendarHeader
|
|
16
77
|
};
|
package/dist/bundle.es65.js
CHANGED
|
@@ -1,77 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
isMonthDisabled: a,
|
|
12
|
-
isYearDisabled: m,
|
|
13
|
-
onNextMonth: N,
|
|
14
|
-
onPrevMonth: v
|
|
1
|
+
import { subMonths as L, addMonths as N, useDayDisableCheker as R } from "./bundle.es58.js";
|
|
2
|
+
import { DEFAULT_MIN_YEAR as w, DEFAULT_MAX_YEAR as A } from "./bundle.es51.js";
|
|
3
|
+
import { useState as U, useCallback as M } from "react";
|
|
4
|
+
const X = ({
|
|
5
|
+
value: p,
|
|
6
|
+
disablePast: r,
|
|
7
|
+
disableFuture: c,
|
|
8
|
+
shouldDisableDate: E,
|
|
9
|
+
minDateTime: l,
|
|
10
|
+
maxDateTime: s
|
|
15
11
|
}) => {
|
|
16
|
-
const e =
|
|
17
|
-
(
|
|
18
|
-
|
|
12
|
+
const [e, u] = U(p || /* @__PURE__ */ new Date()), _ = M(() => {
|
|
13
|
+
u(L(e));
|
|
14
|
+
}, [e]), C = M(() => {
|
|
15
|
+
u(N(e, 1));
|
|
16
|
+
}, [e]), D = R({
|
|
17
|
+
disableFuture: c,
|
|
18
|
+
disablePast: r,
|
|
19
|
+
shouldDisableDate: E,
|
|
20
|
+
minDateTime: l,
|
|
21
|
+
maxDateTime: s
|
|
22
|
+
}), k = M(
|
|
23
|
+
(o, t) => {
|
|
24
|
+
const n = /* @__PURE__ */ new Date();
|
|
25
|
+
t = t || e.getFullYear();
|
|
26
|
+
const h = l ? l.getMonth() : 0, Y = s ? s.getMonth() : 11, F = l?.getFullYear() || w, f = s?.getFullYear() || A;
|
|
27
|
+
let g = t >= F && t <= f ? t === F && h > o || t === f && o > Y : !0;
|
|
28
|
+
return c && (g = g || (t === n.getFullYear() ? o > n.getMonth() : t > n.getFullYear())), r && (g = g || (t === n.getFullYear() ? o < n.getMonth() : t < n.getFullYear())), g;
|
|
19
29
|
},
|
|
20
|
-
[c,
|
|
21
|
-
),
|
|
22
|
-
(
|
|
23
|
-
|
|
30
|
+
[c, r, e, l, s]
|
|
31
|
+
), v = M(
|
|
32
|
+
(o) => {
|
|
33
|
+
const t = /* @__PURE__ */ new Date(), n = l?.getFullYear() || w, h = s?.getFullYear() || A;
|
|
34
|
+
let Y = n > o || o > h;
|
|
35
|
+
return c && (Y = Y || o > t.getFullYear()), r && (Y = Y || o < t.getFullYear()), Y;
|
|
24
36
|
},
|
|
25
|
-
[c,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
r === 11 ? 0 : r + 1,
|
|
37
|
-
r === 11 ? Math.min(e + 1, f) : e
|
|
38
|
-
));
|
|
39
|
-
let i = r === 0 && e === g;
|
|
40
|
-
return a && !i && (i = a(
|
|
41
|
-
r === 0 ? 11 : r - 1,
|
|
42
|
-
r === 0 ? Math.max(e - 1, g) : e
|
|
43
|
-
)), /* @__PURE__ */ d("div", { className: "calendar-header", children: [
|
|
44
|
-
!i && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "left", onClick: v, children: /* @__PURE__ */ o(C, { icon: E }) }),
|
|
45
|
-
/* @__PURE__ */ d("div", { className: "calendar-pickers", children: [
|
|
46
|
-
/* @__PURE__ */ o(
|
|
47
|
-
p,
|
|
48
|
-
{
|
|
49
|
-
fill: !0,
|
|
50
|
-
options: Y,
|
|
51
|
-
size: "sm",
|
|
52
|
-
value: e,
|
|
53
|
-
minimalOptions: !0,
|
|
54
|
-
matchTarget: "min-width",
|
|
55
|
-
onChange: (t) => x(t)
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
/* @__PURE__ */ o(
|
|
59
|
-
p,
|
|
60
|
-
{
|
|
61
|
-
fill: !0,
|
|
62
|
-
options: A,
|
|
63
|
-
size: "sm",
|
|
64
|
-
className: "capitalize",
|
|
65
|
-
value: r,
|
|
66
|
-
minimalOptions: !0,
|
|
67
|
-
matchTarget: "min-width",
|
|
68
|
-
onChange: (t) => M(t)
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
] }),
|
|
72
|
-
!l && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "right", onClick: N, children: /* @__PURE__ */ o(C, { icon: T }) })
|
|
73
|
-
] });
|
|
37
|
+
[c, r, l, s]
|
|
38
|
+
);
|
|
39
|
+
return {
|
|
40
|
+
viewDate: e,
|
|
41
|
+
setViewDate: u,
|
|
42
|
+
setPrevMonth: _,
|
|
43
|
+
setNextMonth: C,
|
|
44
|
+
isDayDisabled: D,
|
|
45
|
+
isMonthDisabled: k,
|
|
46
|
+
isYearDisabled: v
|
|
47
|
+
};
|
|
74
48
|
};
|
|
75
49
|
export {
|
|
76
|
-
|
|
50
|
+
X as useCalendar
|
|
77
51
|
};
|
package/dist/bundle.es66.js
CHANGED
|
@@ -1,51 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
u(L(e));
|
|
14
|
-
}, [e]), C = M(() => {
|
|
15
|
-
u(N(e, 1));
|
|
16
|
-
}, [e]), D = R({
|
|
17
|
-
disableFuture: c,
|
|
18
|
-
disablePast: r,
|
|
19
|
-
shouldDisableDate: E,
|
|
20
|
-
minDateTime: l,
|
|
21
|
-
maxDateTime: s
|
|
22
|
-
}), k = M(
|
|
23
|
-
(o, t) => {
|
|
24
|
-
const n = /* @__PURE__ */ new Date();
|
|
25
|
-
t = t || e.getFullYear();
|
|
26
|
-
const h = l ? l.getMonth() : 0, Y = s ? s.getMonth() : 11, F = l?.getFullYear() || w, f = s?.getFullYear() || A;
|
|
27
|
-
let g = t >= F && t <= f ? t === F && h > o || t === f && o > Y : !0;
|
|
28
|
-
return c && (g = g || (t === n.getFullYear() ? o > n.getMonth() : t > n.getFullYear())), r && (g = g || (t === n.getFullYear() ? o < n.getMonth() : t < n.getFullYear())), g;
|
|
29
|
-
},
|
|
30
|
-
[c, r, e, l, s]
|
|
31
|
-
), v = M(
|
|
32
|
-
(o) => {
|
|
33
|
-
const t = /* @__PURE__ */ new Date(), n = l?.getFullYear() || w, h = s?.getFullYear() || A;
|
|
34
|
-
let Y = n > o || o > h;
|
|
35
|
-
return c && (Y = Y || o > t.getFullYear()), r && (Y = Y || o < t.getFullYear()), Y;
|
|
36
|
-
},
|
|
37
|
-
[c, r, l, s]
|
|
38
|
-
);
|
|
39
|
-
return {
|
|
40
|
-
viewDate: e,
|
|
41
|
-
setViewDate: u,
|
|
42
|
-
setPrevMonth: _,
|
|
43
|
-
setNextMonth: C,
|
|
44
|
-
isDayDisabled: D,
|
|
45
|
-
isMonthDisabled: k,
|
|
46
|
-
isYearDisabled: v
|
|
47
|
-
};
|
|
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}`] = "");
|
|
8
|
+
}
|
|
9
|
+
}, []);
|
|
10
|
+
return d(() => {
|
|
11
|
+
u("Left"), u("Right");
|
|
12
|
+
}, f), { rightRef: c, leftRef: i };
|
|
48
13
|
};
|
|
49
14
|
export {
|
|
50
|
-
|
|
15
|
+
g as useInputPadding
|
|
51
16
|
};
|