@alphakits/ui 2.3.1 → 2.4.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.
- package/dist/__internal/utils/index.d.ts +1 -1
- package/dist/__internal/utils/index.js +4 -4
- package/dist/amount-input/component.js +41 -41
- package/dist/avatar/component.js +2 -18
- package/dist/badge/component.d.ts +1 -1
- package/dist/base-card/component.js +1 -7
- package/dist/bottom-sheet/component.d.ts +1 -1
- package/dist/bottom-sheet/component.js +9 -13
- package/dist/box/component.d.ts +2 -2
- package/dist/box/component.js +4 -4
- package/dist/button/component.js +9 -9
- package/dist/button-arrow/component.js +6 -1
- package/dist/calendar/component.d.ts +1 -2
- package/dist/calendar/component.js +77 -74
- package/dist/calendar/components/days-table/component.js +31 -34
- package/dist/calendar/components/header/{/321/201omponent.js → component.js} +3 -12
- package/dist/calendar/components/header/index.d.ts +1 -1
- package/dist/calendar/components/header/index.js +1 -1
- package/dist/calendar/components/months-table/{/321/201omponent.js → component.js} +7 -7
- package/dist/calendar/components/months-table/index.d.ts +1 -1
- package/dist/calendar/components/months-table/index.js +1 -1
- package/dist/calendar/components/select-button/{/321/201omponent.d.ts → component.d.ts} +3 -3
- package/dist/calendar/components/select-button/{/321/201omponent.js → component.js} +5 -11
- package/dist/calendar/components/select-button/index.d.ts +1 -1
- package/dist/calendar/components/select-button/index.js +1 -1
- package/dist/calendar/components/years-table/{/321/201omponent.js → component.js} +14 -14
- package/dist/calendar/components/years-table/index.d.ts +1 -1
- package/dist/calendar/components/years-table/index.js +1 -1
- package/dist/calendar/index.d.ts +2 -2
- package/dist/calendar/index.js +4 -4
- package/dist/calendar/use-calendar.js +51 -47
- package/dist/calendar/utils.js +7 -9
- package/dist/calendar-input/component.js +22 -22
- package/dist/card/component.js +2 -18
- package/dist/cell/base/component.js +31 -31
- package/dist/cell/pure/component.js +2 -2
- package/dist/checkbox/component.js +11 -11
- package/dist/checkbox-group/component.js +23 -24
- package/dist/checkbox-lists/component.d.ts +1 -2
- package/dist/checkbox-lists/component.js +59 -61
- package/dist/collapsable-row/addons.d.ts +3 -4
- package/dist/collapsable-row/addons.js +6 -9
- package/dist/collapsable-row/component.d.ts +1 -1
- package/dist/collapsable-row/component.js +7 -7
- package/dist/collapse/component.js +45 -54
- package/dist/copy-button/component.d.ts +1 -2
- package/dist/copy-button/component.js +1 -5
- package/dist/date/component.js +1 -1
- package/dist/date-switcher/component.d.ts +1 -2
- package/dist/date-switcher/component.js +8 -8
- package/dist/decorated-item/component.js +10 -20
- package/dist/dot/component.js +1 -4
- package/dist/empty-page/component.js +1 -9
- package/dist/filter-tag/component.d.ts +1 -1
- package/dist/flex/component.d.ts +2 -2
- package/dist/footer/component.js +57 -53
- package/dist/form/component.d.ts +1 -2
- package/dist/form/component.js +2 -12
- package/dist/form/templates/base-form/index.d.ts +3 -3
- package/dist/form/templates/base-form/index.js +26 -26
- package/dist/form/templates/filters-form/index.d.ts +1 -1
- package/dist/form/templates/filters-form/index.js +20 -23
- package/dist/form/templates/rest-form/form.d.ts +1 -2
- package/dist/form/templates/rest-form/form.js +77 -80
- package/dist/form/templates/rest-form/index.d.ts +3 -3
- package/dist/form/templates/rest-form/index.js +16 -27
- package/dist/form/utils/get-default-values.js +3 -6
- package/dist/form/utils/remove-undefined-from-object.js +1 -3
- package/dist/form-control/component.js +1 -1
- package/dist/formik/index.d.ts +2 -2
- package/dist/header-search/component.js +1 -6
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +10 -10
- package/dist/hooks/use-get-one/index.js +16 -16
- package/dist/icon-button/component.d.ts +3 -3
- package/dist/icon-button/component.js +2 -8
- package/dist/image/component.js +52 -30
- package/dist/image/image-base.js +1 -7
- package/dist/image/use-image-render-component.d.ts +1 -1
- package/dist/image/use-image-render-component.js +11 -14
- package/dist/image-gallery/component.js +40 -45
- package/dist/image-uploader/component.js +56 -53
- package/dist/index.js +41 -41
- package/dist/info-block-wrapper/component.d.ts +1 -1
- package/dist/input/component.js +1 -1
- package/dist/input-autocomplete/autocomplete-field/index.d.ts +1 -2
- package/dist/input-autocomplete/autocomplete-field/index.js +6 -6
- package/dist/input-autocomplete/component.d.ts +26 -26
- package/dist/input-ghost/component.d.ts +1 -1
- package/dist/link/component.d.ts +2 -2
- package/dist/link/component.js +1 -1
- package/dist/loader/component.js +6 -5
- package/dist/masked-input/component.js +7 -16
- package/dist/menu/component.js +12 -17
- package/dist/menu/components/content-header/index.js +1 -9
- package/dist/menu/components/menu-avatar/index.js +1 -6
- package/dist/menu/components/menu-button/index.js +1 -10
- package/dist/menu/components/menu-buttons-list/index.d.ts +1 -1
- package/dist/menu/components/menu-buttons-list/index.js +1 -7
- package/dist/menu/hooks/use-menu.js +12 -12
- package/dist/message/component.js +33 -14
- package/dist/modal/components/modals/modal.d.ts +1 -2
- package/dist/modal/components/modals/modal.js +30 -33
- package/dist/modal/context.js +12 -9
- package/dist/modal/hooks/use-modal.d.ts +1 -1
- package/dist/modal/hooks/use-modal.js +22 -22
- package/dist/mq/component.js +1 -6
- package/dist/notification/component.js +14 -12
- package/dist/page-container/component.js +1 -6
- package/dist/page-loading/component.d.ts +1 -2
- package/dist/page-with-controls/component.js +4 -7
- package/dist/picker-button/common/labeled-button/index.js +18 -12
- package/dist/picker-button/component.js +5 -5
- package/dist/picker-button/field/{Component.d.ts → component.d.ts} +1 -2
- package/dist/picker-button/field/index.d.ts +1 -1
- package/dist/picker-button/field/index.js +1 -1
- package/dist/picker-button/index.d.ts +1 -1
- package/dist/picker-button/index.js +4 -4
- package/dist/popover/component.d.ts +2 -2
- package/dist/popover/component.js +77 -79
- package/dist/radio/component.js +7 -7
- package/dist/radio-groups/component.d.ts +1 -2
- package/dist/radio-groups/component.js +9 -7
- package/dist/select/component.d.ts +8 -9
- package/dist/select/component.js +1 -9
- package/dist/select/components/arrow/component.d.ts +1 -2
- package/dist/select/components/base-select/component.js +97 -90
- package/dist/select/components/checkmark/component.d.ts +1 -2
- package/dist/select/components/field/component.d.ts +1 -2
- package/dist/select/components/field/component.js +8 -5
- package/dist/select/components/native-select/component.js +4 -11
- package/dist/select/components/optgroup/component.d.ts +1 -2
- package/dist/select/components/optgroup/component.js +4 -4
- package/dist/select/components/option/component.js +1 -1
- package/dist/select/components/options-list/component.d.ts +1 -2
- package/dist/select/components/options-list/component.js +25 -23
- package/dist/select/components/select-search/index.d.ts +1 -1
- package/dist/select/components/select-search/index.js +28 -26
- package/dist/select/components/virtual-options-list/component.d.ts +1 -2
- package/dist/select/components/virtual-options-list/component.js +52 -45
- package/dist/select/index.js +4 -4
- package/dist/select/presets/index.d.ts +1 -1
- package/dist/select/presets/index.js +4 -4
- package/dist/select/presets/use-lazy-loading/index.d.ts +3 -4
- package/dist/select/presets/use-lazy-loading/index.js +45 -43
- package/dist/select/presets/use-select-with-loading/hook.d.ts +1 -2
- package/dist/select/presets/use-select-with-loading/hook.js +8 -1
- package/dist/select/utils.js +32 -32
- package/dist/sidepanel/component.js +21 -15
- package/dist/sidepanel-header/component.js +17 -16
- package/dist/skeleton/component.js +4 -4
- package/dist/space/component.d.ts +2 -2
- package/dist/space/component.js +42 -45
- package/dist/space/{Item.d.ts → item.d.ts} +2 -2
- package/dist/spinner/component.js +6 -5
- package/dist/stack/index.d.ts +1 -1
- package/dist/stack/index.js +5 -5
- package/dist/stepped-progress-bar/components/step-bar.js +3 -3
- package/dist/stepped-progress-bar/index.d.ts +2 -2
- package/dist/stepped-progress-bar/index.js +37 -22
- package/dist/sticker/component.js +1 -17
- package/dist/suffix-input/component.js +13 -13
- package/dist/switch/component.js +7 -7
- package/dist/table/components/cells/index.d.ts +1 -2
- package/dist/table/components/empty-list/index.d.ts +3 -3
- package/dist/table/components/empty-list/index.js +6 -3
- package/dist/table/components/error/index.d.ts +3 -3
- package/dist/table/components/error/index.js +8 -5
- package/dist/table/components/loading/index.d.ts +1 -1
- package/dist/table/components/loading/index.js +18 -12
- package/dist/table/components/pagination/index.js +56 -53
- package/dist/table/components/table-header/index.js +59 -56
- package/dist/table/hooks/use-table-data.js +64 -59
- package/dist/table/table.d.ts +1 -1
- package/dist/table/table.js +80 -80
- package/dist/table/types.d.ts +3 -3
- package/dist/table/utils/get-query-from-url.js +1 -8
- package/dist/table/utils/get-tags.d.ts +1 -1
- package/dist/table/utils/get-tags.js +9 -12
- package/dist/table/utils/index.d.ts +1 -1
- package/dist/table/utils/index.js +4 -4
- package/dist/table/utils/parse-query-params.js +5 -1
- package/dist/table/utils/prepare-rows.d.ts +1 -2
- package/dist/table/utils/prepare-rows.js +4 -3
- package/dist/table/utils/query-adapter.d.ts +1 -1
- package/dist/table/utils/query-adapter.js +5 -5
- package/dist/table/utils/remove-query-param.js +3 -1
- package/dist/table/utils/reset-query-param.js +16 -9
- package/dist/table-status/component.js +5 -1
- package/dist/textarea/component.js +36 -28
- package/dist/theme-provider/component.js +33 -29
- package/dist/toast/component.d.ts +7 -8
- package/dist/toast/component.js +6 -6
- package/dist/toast-notifier/component.js +13 -13
- package/dist/toast-notifier/use-timer.d.ts +1 -1
- package/dist/toast-notifier/use-timer.js +5 -5
- package/dist/toast-plate/component.d.ts +3 -3
- package/dist/toast-plate/component.js +7 -7
- package/dist/tooltip/component.js +35 -35
- package/dist/tooltip/node-resolver.js +7 -7
- package/dist/typings/api.d.ts +3 -5
- package/dist/typography/colors.d.ts +1 -1
- package/dist/typography/title/component.d.ts +3 -3
- package/dist/typography/title/index.d.ts +1 -1
- package/dist/typography/title/index.js +3 -3
- package/dist/utils/date/index.js +12 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +14 -14
- package/dist/utils/split-amount/util.js +4 -4
- package/dist/with-suffix/component.d.ts +13 -13
- package/dist/with-suffix/component.js +8 -8
- package/package.json +9 -34
- /package/dist/__internal/utils/{getDataTestId.d.ts → get-data-test-id.d.ts} +0 -0
- /package/dist/__internal/utils/{getDataTestId.js → get-data-test-id.js} +0 -0
- /package/dist/calendar/components/header/{/321/201omponent.d.ts" → component.d.ts} +0 -0
- /package/dist/calendar/components/months-table/{/321/201omponent.d.ts" → component.d.ts} +0 -0
- /package/dist/calendar/components/years-table/{/321/201omponent.d.ts" → component.d.ts} +0 -0
- /package/dist/picker-button/field/{Component.js → component.js} +0 -0
- /package/dist/space/{Item.js → item.js} +0 -0
|
@@ -1,69 +1,66 @@
|
|
|
1
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
|
-
import { TransitionGroup as P, CSSTransition as W } from "react-transition-group";
|
|
4
2
|
import R from "classnames";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { Button as
|
|
8
|
-
import { Flex as
|
|
9
|
-
import { usePrevious as
|
|
3
|
+
import { useRef as b, useMemo as z, useCallback as C } from "react";
|
|
4
|
+
import { TransitionGroup as P, CSSTransition as W } from "react-transition-group";
|
|
5
|
+
import { Button as q } from "../../../button/component.js";
|
|
6
|
+
import { Flex as T } from "../../../flex/component.js";
|
|
7
|
+
import { usePrevious as G } from "../../../hooks/usePrevious/index.js";
|
|
8
|
+
import { weekDaysShort as H, isSameDay as l, isWithinInterval as I, isLastDayOfMonth as M, isBefore as J, endOfDay as K, isEqual as Q, isToday as U, startOfMonth as V } from "../../../utils/date/index.js";
|
|
9
|
+
import { capitalize as X } from "../../../utils/string.js";
|
|
10
10
|
import { getSelectionRange as Y } from "../../utils.js";
|
|
11
11
|
import t from "./index.module.css.js";
|
|
12
|
-
const Z = ({
|
|
13
|
-
|
|
14
|
-
...a
|
|
15
|
-
}) => {
|
|
16
|
-
const i = x(null);
|
|
17
|
-
return /* @__PURE__ */ n(W, { ...a, nodeRef: i, children: /* @__PURE__ */ n("div", { ref: i, children: l }) });
|
|
12
|
+
const Z = ({ children: m, ...i }) => {
|
|
13
|
+
const a = b(null);
|
|
14
|
+
return /* @__PURE__ */ n(W, { ...i, nodeRef: a, children: /* @__PURE__ */ n("div", { ref: a, children: m }) });
|
|
18
15
|
}, ce = ({
|
|
19
|
-
weeks:
|
|
20
|
-
activeMonth:
|
|
21
|
-
highlighted:
|
|
22
|
-
selectedFrom:
|
|
16
|
+
weeks: m = [],
|
|
17
|
+
activeMonth: i = /* @__PURE__ */ new Date(),
|
|
18
|
+
highlighted: a,
|
|
19
|
+
selectedFrom: o,
|
|
23
20
|
selectedTo: f,
|
|
24
|
-
getDayProps:
|
|
21
|
+
getDayProps: x,
|
|
25
22
|
locale: p
|
|
26
23
|
}) => {
|
|
27
|
-
const u =
|
|
28
|
-
u.current =
|
|
29
|
-
const D =
|
|
30
|
-
() => v.map((e) => /* @__PURE__ */ n("div", { className: t.dayName, children:
|
|
24
|
+
const u = b(i);
|
|
25
|
+
u.current = i;
|
|
26
|
+
const D = G(i), g = D && (i < D ? "right" : "left"), s = Y(o, f, a), v = z(() => H(p), [p]), N = C(
|
|
27
|
+
() => v.map((e) => /* @__PURE__ */ n("div", { className: t.dayName, children: X(e) }, e)),
|
|
31
28
|
[v]
|
|
32
|
-
),
|
|
33
|
-
const
|
|
29
|
+
), S = (e) => {
|
|
30
|
+
const c = e.selected || o != null && l(e.date, new Date(o)) || f != null && l(e.date, new Date(f)), r = !c && s && I(e.date, s), d = e.date.getDate() === 1, h = M(e.date), y = d && r && s && e.date > s.start, k = h && r && s && e.date < s.end, A = s && l(e.date, s.start), B = s && l(e.date, s.end), w = x(e), L = J(K(new Date(e.date)), /* @__PURE__ */ new Date());
|
|
34
31
|
return /* @__PURE__ */ n(
|
|
35
|
-
|
|
32
|
+
q,
|
|
36
33
|
{
|
|
37
34
|
...w,
|
|
38
35
|
ref: (O) => {
|
|
39
|
-
|
|
36
|
+
V(e.date).getTime() === u.current.getTime() && w.ref(O);
|
|
40
37
|
},
|
|
41
38
|
type: "button",
|
|
42
39
|
view: "ghost",
|
|
43
40
|
size: "xs",
|
|
44
41
|
disabled: e.disabled,
|
|
45
42
|
className: R(t.day, {
|
|
46
|
-
[t.selected]:
|
|
43
|
+
[t.selected]: c,
|
|
47
44
|
[t.range]: r,
|
|
48
45
|
[t.rangeStart]: A,
|
|
49
46
|
[t.rangeEnd]: B,
|
|
50
47
|
[t.transitLeft]: y,
|
|
51
48
|
[t.transitRight]: k,
|
|
52
|
-
[t.today]:
|
|
53
|
-
[t.firstDay]:
|
|
49
|
+
[t.today]: U(e.date),
|
|
50
|
+
[t.firstDay]: d,
|
|
54
51
|
[t.lastDay]: h,
|
|
55
52
|
[t.event]: e.event,
|
|
56
53
|
[t.prev]: L,
|
|
57
54
|
[t.disabled]: e.disabled,
|
|
58
55
|
[t.muted]: e.muted || e.disabled,
|
|
59
|
-
[t.highlighted]:
|
|
56
|
+
[t.highlighted]: a && Q(e.date, a)
|
|
60
57
|
}),
|
|
61
58
|
children: e.date.getDate()
|
|
62
59
|
}
|
|
63
60
|
);
|
|
64
|
-
}, E = (e,
|
|
61
|
+
}, E = (e, c) => /* @__PURE__ */ n(T, { className: t.weekRow, children: e.map((r, d) => /* @__PURE__ */ n("div", { className: t.daysRowDay, children: r && S(r) }, r ? r.date.getTime() : d)) }, c);
|
|
65
62
|
return /* @__PURE__ */ j("div", { className: R(t.daysTable, g && t[g]), children: [
|
|
66
|
-
/* @__PURE__ */ n("div", { className: t.daysRow, children: /* @__PURE__ */ n(
|
|
63
|
+
/* @__PURE__ */ n("div", { className: t.daysRow, children: /* @__PURE__ */ n(T, { children: N() }) }),
|
|
67
64
|
/* @__PURE__ */ n(P, { component: null, children: /* @__PURE__ */ n(
|
|
68
65
|
Z,
|
|
69
66
|
{
|
|
@@ -74,9 +71,9 @@ const Z = ({
|
|
|
74
71
|
exit: t.daysExit,
|
|
75
72
|
exitActive: t.daysExitActive
|
|
76
73
|
},
|
|
77
|
-
children: /* @__PURE__ */ n("div", { className: t.daysBody, children:
|
|
74
|
+
children: /* @__PURE__ */ n("div", { className: t.daysBody, children: m.map(E) })
|
|
78
75
|
},
|
|
79
|
-
|
|
76
|
+
i.getTime()
|
|
80
77
|
) })
|
|
81
78
|
] });
|
|
82
79
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import t from "@alphakits/icons/dist/ChevronBackS";
|
|
3
3
|
import s from "classnames";
|
|
4
|
-
import { capitalize as b } from "../../../utils/string.js";
|
|
5
4
|
import { Button as i } from "../../../button/component.js";
|
|
6
|
-
import {
|
|
5
|
+
import { capitalize as b } from "../../../utils/string.js";
|
|
6
|
+
import { SelectButton as u } from "../select-button/component.js";
|
|
7
7
|
import e from "./index.module.css.js";
|
|
8
8
|
const $ = ({
|
|
9
9
|
month: d,
|
|
@@ -37,16 +37,7 @@ const $ = ({
|
|
|
37
37
|
}
|
|
38
38
|
),
|
|
39
39
|
/* @__PURE__ */ l("div", { className: e.selectors, children: [
|
|
40
|
-
m && /* @__PURE__ */ o(
|
|
41
|
-
i,
|
|
42
|
-
{
|
|
43
|
-
view: "outlined",
|
|
44
|
-
className: e.today,
|
|
45
|
-
onClick: n,
|
|
46
|
-
size: "xs",
|
|
47
|
-
children: "today"
|
|
48
|
-
}
|
|
49
|
-
),
|
|
40
|
+
m && /* @__PURE__ */ o(i, { view: "outlined", className: e.today, onClick: n, size: "xs", children: "today" }),
|
|
50
41
|
/* @__PURE__ */ o(
|
|
51
42
|
i,
|
|
52
43
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from './component';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback as n, createElement as f } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { FlexColumns as p } from "../../../flex-columns/component.js";
|
|
4
|
+
import { isSameMonth as u, isThisMonth as c } from "../../../utils/date/index.js";
|
|
5
|
+
import { capitalize as d } from "../../../utils/string.js";
|
|
6
6
|
import { monthName as b } from "../../utils.js";
|
|
7
|
-
import { SelectButton as g } from "../select-button
|
|
7
|
+
import { SelectButton as g } from "../select-button/component.js";
|
|
8
8
|
import r from "./index.module.css.js";
|
|
9
9
|
const C = ({
|
|
10
10
|
selectedMonth: e,
|
|
@@ -14,10 +14,10 @@ const C = ({
|
|
|
14
14
|
shortNames: i
|
|
15
15
|
}) => {
|
|
16
16
|
const s = n(
|
|
17
|
-
(t) => e &&
|
|
17
|
+
(t) => e && u(e, t.date) ? "selected" : c(t.date) ? "outlined" : "default",
|
|
18
18
|
[e]
|
|
19
19
|
);
|
|
20
|
-
return /* @__PURE__ */ l(
|
|
20
|
+
return /* @__PURE__ */ l(p, { columns: 3, gc: 0, gr: 8, className: r.monthsTable, children: o.map((t) => /* @__PURE__ */ f(
|
|
21
21
|
g,
|
|
22
22
|
{
|
|
23
23
|
...m(t),
|
|
@@ -25,7 +25,7 @@ const C = ({
|
|
|
25
25
|
className: r.button,
|
|
26
26
|
view: s(t)
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
d(b(t.date, a, i))
|
|
29
29
|
)) });
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from './component';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
2
2
|
export type SelectButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
3
3
|
className?: string;
|
|
4
4
|
view?: 'default' | 'filled' | 'outlined' | 'selected';
|
|
5
5
|
};
|
|
6
|
-
export declare const SelectButton:
|
|
6
|
+
export declare const SelectButton: import('react').ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
7
7
|
className?: string | undefined;
|
|
8
8
|
view?: "default" | "outlined" | "filled" | "selected" | undefined;
|
|
9
|
-
} &
|
|
9
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import n from "
|
|
2
|
+
import p from "classnames";
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
4
|
import { Button as a } from "../../../button/component.js";
|
|
5
5
|
import o from "./index.module.css.js";
|
|
6
|
-
const w =
|
|
7
|
-
({
|
|
8
|
-
className: r,
|
|
9
|
-
children: m,
|
|
10
|
-
disabled: t,
|
|
11
|
-
view: e = "default",
|
|
12
|
-
...s
|
|
13
|
-
}, f) => /* @__PURE__ */ i(
|
|
6
|
+
const w = n(
|
|
7
|
+
({ className: r, children: m, disabled: t, view: e = "default", ...s }, f) => /* @__PURE__ */ i(
|
|
14
8
|
a,
|
|
15
9
|
{
|
|
16
10
|
...s,
|
|
@@ -18,7 +12,7 @@ const w = p(
|
|
|
18
12
|
view: "ghost",
|
|
19
13
|
size: "xs",
|
|
20
14
|
disabled: t,
|
|
21
|
-
className:
|
|
15
|
+
className: p(o.button, o[e], r, {
|
|
22
16
|
[o.disabled]: t
|
|
23
17
|
}),
|
|
24
18
|
children: m
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from './component';
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as d, useCallback as c, useLayoutEffect as T, createElement as b } from "react";
|
|
3
3
|
import { isSameYear as h, isThisYear as g } from "../../../utils/date/index.js";
|
|
4
|
-
import { SelectButton as N } from "../select-button
|
|
4
|
+
import { SelectButton as N } from "../select-button/component.js";
|
|
5
5
|
import r from "./index.module.css.js";
|
|
6
6
|
const E = ({
|
|
7
|
-
selectedYear:
|
|
7
|
+
selectedYear: o,
|
|
8
8
|
years: i = [],
|
|
9
|
-
getYearProps:
|
|
10
|
-
onScroll:
|
|
9
|
+
getYearProps: a,
|
|
10
|
+
onScroll: t
|
|
11
11
|
}) => {
|
|
12
|
-
const l = d(null),
|
|
13
|
-
(e) =>
|
|
14
|
-
[
|
|
12
|
+
const l = d(null), u = c(
|
|
13
|
+
(e) => o && h(o, e) ? "selected" : g(e) ? "outlined" : "default",
|
|
14
|
+
[o]
|
|
15
15
|
), m = c(
|
|
16
16
|
(e) => {
|
|
17
|
-
|
|
17
|
+
t(e.currentTarget.scrollTop);
|
|
18
18
|
},
|
|
19
|
-
[
|
|
19
|
+
[t]
|
|
20
20
|
);
|
|
21
21
|
return T(() => {
|
|
22
|
-
const e = l.current, f = `.${r.button}[tabIndex="0"]`, s = e
|
|
22
|
+
const e = l.current, f = `.${r.button}[tabIndex="0"]`, s = e?.querySelector(f);
|
|
23
23
|
if (e && s) {
|
|
24
24
|
const p = e.clientHeight / 2 - s.clientHeight / 2;
|
|
25
|
-
e.scrollTop = s.offsetTop - p,
|
|
25
|
+
e.scrollTop = s.offsetTop - p, t(e.scrollTop);
|
|
26
26
|
}
|
|
27
|
-
}, [
|
|
27
|
+
}, [t]), /* @__PURE__ */ n("div", { className: r.yearsTable, onScroll: m, ref: l, children: /* @__PURE__ */ n("div", { className: r.inner, children: i.map((e) => /* @__PURE__ */ b(
|
|
28
28
|
N,
|
|
29
29
|
{
|
|
30
|
-
...
|
|
30
|
+
...a(e),
|
|
31
31
|
key: e.getFullYear(),
|
|
32
|
-
view:
|
|
32
|
+
view: u(e),
|
|
33
33
|
className: r.button
|
|
34
34
|
},
|
|
35
35
|
e.getFullYear()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from './component';
|
package/dist/calendar/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './component';
|
|
2
|
-
export { usePeriod } from './use-period';
|
|
3
2
|
export { useCalendar } from './use-calendar';
|
|
4
|
-
export {
|
|
3
|
+
export { usePeriod } from './use-period';
|
|
4
|
+
export { DAYS_IN_WEEK, dateInLimits, limitDate, MONTHS_IN_YEAR, monthName, russianWeekDay, SUNDAY_INDEX, } from './utils';
|
package/dist/calendar/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Calendar as o } from "./component.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useCalendar as t } from "./use-calendar.js";
|
|
3
|
+
import { usePeriod as i } from "./use-period.js";
|
|
4
4
|
import { DAYS_IN_WEEK as n, MONTHS_IN_YEAR as s, SUNDAY_INDEX as D, dateInLimits as _, limitDate as d, monthName as f, russianWeekDay as p } from "./utils.js";
|
|
5
5
|
export {
|
|
6
6
|
o as Calendar,
|
|
@@ -11,6 +11,6 @@ export {
|
|
|
11
11
|
d as limitDate,
|
|
12
12
|
f as monthName,
|
|
13
13
|
p as russianWeekDay,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
t as useCalendar,
|
|
15
|
+
i as usePeriod
|
|
16
16
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useState as O, useRef as
|
|
1
|
+
import { useState as O, useRef as ct, useMemo as r, useCallback as o } from "react";
|
|
2
2
|
import Tt from "react-merge-refs";
|
|
3
|
-
import { startOfMonth as
|
|
4
|
-
import { dateArrayToHashTable as
|
|
3
|
+
import { startOfMonth as dt, startOfYear as ft, subYears as Dt, addMonths as Rt, addYears as mt, isSameDay as Ft, isSameMonth as ut } from "../utils/date/index.js";
|
|
4
|
+
import { dateArrayToHashTable as it, generateWeeks as Nt, generateMonths as Pt, generateYears as It, limitDate as W, simulateTab as Bt, modifyDateByShift as Et, MONTHS_IN_YEAR as Lt } from "./utils.js";
|
|
5
5
|
function Ut({
|
|
6
6
|
defaultMonth: C,
|
|
7
7
|
month: R,
|
|
8
|
-
minDate:
|
|
8
|
+
minDate: a,
|
|
9
9
|
view: H = "days",
|
|
10
|
-
maxDate:
|
|
10
|
+
maxDate: c,
|
|
11
11
|
selected: h,
|
|
12
12
|
events: U,
|
|
13
13
|
offDays: x,
|
|
@@ -16,24 +16,24 @@ function Ut({
|
|
|
16
16
|
onChange: N,
|
|
17
17
|
setView: K
|
|
18
18
|
}) {
|
|
19
|
-
const [
|
|
19
|
+
const [lt, ht] = O(C), [gt, _] = O(C), [Mt, j] = O(), g = R === void 0, d = g ? lt : R, Y = g ? gt : R, M = ct([]), P = ct(null), u = r(() => a && dt(a), [a]), i = r(() => c && dt(c), [c]), q = r(() => a && ft(a), [a]), z = r(() => c && ft(c), [c]), wt = u ? d > u : !0, yt = i ? d < i : !0, G = r(() => it(U || []), [U]), b = r(() => it(x || []), [x]), pt = r(
|
|
20
20
|
() => Nt(d, {
|
|
21
|
-
minDate:
|
|
22
|
-
maxDate:
|
|
21
|
+
minDate: a,
|
|
22
|
+
maxDate: c,
|
|
23
23
|
selected: h,
|
|
24
24
|
eventsMap: G,
|
|
25
25
|
offDaysMap: b
|
|
26
26
|
}),
|
|
27
|
-
[
|
|
28
|
-
),
|
|
27
|
+
[c, a, h, d, G, b]
|
|
28
|
+
), Yt = r(
|
|
29
29
|
() => Pt(Y, { minMonth: u, maxMonth: i }),
|
|
30
30
|
[u, i, Y]
|
|
31
|
-
), J =
|
|
32
|
-
() => It(
|
|
33
|
-
[
|
|
31
|
+
), J = r(
|
|
32
|
+
() => It(a || Dt(/* @__PURE__ */ new Date(), 5), c || /* @__PURE__ */ new Date()),
|
|
33
|
+
[a, c]
|
|
34
34
|
), k = o(
|
|
35
35
|
(t) => {
|
|
36
|
-
g && (
|
|
36
|
+
g && (ht(t), _(t)), m && m(t.getTime());
|
|
37
37
|
},
|
|
38
38
|
[m, g]
|
|
39
39
|
), Q = o(
|
|
@@ -60,9 +60,9 @@ function Ut({
|
|
|
60
60
|
v(1);
|
|
61
61
|
}, [v]), E = o(() => {
|
|
62
62
|
v(-1);
|
|
63
|
-
}, [v]),
|
|
63
|
+
}, [v]), St = o(() => {
|
|
64
64
|
T(1);
|
|
65
|
-
}, [T]),
|
|
65
|
+
}, [T]), At = o(() => {
|
|
66
66
|
T(-1);
|
|
67
67
|
}, [T]), w = o(
|
|
68
68
|
() => M.current.find((t) => document.activeElement === t),
|
|
@@ -78,12 +78,12 @@ function Ut({
|
|
|
78
78
|
), f = o(
|
|
79
79
|
(t) => {
|
|
80
80
|
const e = w();
|
|
81
|
-
if (e
|
|
82
|
-
const n = /* @__PURE__ */ new Date(+e.dataset.date), s = Et(t, n,
|
|
81
|
+
if (e?.dataset.date) {
|
|
82
|
+
const n = /* @__PURE__ */ new Date(+e.dataset.date), s = Et(t, n, a, c, b);
|
|
83
83
|
let p = !1;
|
|
84
84
|
s < n && s.getMonth() !== n.getMonth() && (E(), p = !0), s > n && s.getMonth() !== n.getMonth() && (B(), p = !0);
|
|
85
|
-
const
|
|
86
|
-
p ? setTimeout(
|
|
85
|
+
const at = () => l(M.current[s.getDate() - 1]);
|
|
86
|
+
p ? setTimeout(at, 0) : at();
|
|
87
87
|
} else
|
|
88
88
|
y();
|
|
89
89
|
},
|
|
@@ -91,8 +91,8 @@ function Ut({
|
|
|
91
91
|
l,
|
|
92
92
|
y,
|
|
93
93
|
w,
|
|
94
|
+
c,
|
|
94
95
|
a,
|
|
95
|
-
r,
|
|
96
96
|
b,
|
|
97
97
|
B,
|
|
98
98
|
E
|
|
@@ -100,7 +100,7 @@ function Ut({
|
|
|
100
100
|
), S = o(
|
|
101
101
|
(t) => {
|
|
102
102
|
const e = w();
|
|
103
|
-
if (e
|
|
103
|
+
if (e?.dataset.date) {
|
|
104
104
|
const s = (/* @__PURE__ */ new Date(+e.dataset.date)).getMonth() + t;
|
|
105
105
|
s >= 0 && s < Lt && l(M.current[s]);
|
|
106
106
|
} else
|
|
@@ -110,7 +110,7 @@ function Ut({
|
|
|
110
110
|
), A = o(
|
|
111
111
|
(t) => {
|
|
112
112
|
const e = w();
|
|
113
|
-
if (e
|
|
113
|
+
if (e?.dataset.date) {
|
|
114
114
|
const s = (/* @__PURE__ */ new Date(+e.dataset.date)).getFullYear() + t, p = (/* @__PURE__ */ new Date()).getFullYear();
|
|
115
115
|
s <= p && s > p - J.length && l(M.current[s]);
|
|
116
116
|
} else
|
|
@@ -136,7 +136,7 @@ function Ut({
|
|
|
136
136
|
e && N && N(+e);
|
|
137
137
|
},
|
|
138
138
|
[N]
|
|
139
|
-
),
|
|
139
|
+
), et = r(
|
|
140
140
|
() => ({
|
|
141
141
|
ArrowLeft: () => f("prev"),
|
|
142
142
|
ArrowRight: () => f("next"),
|
|
@@ -148,7 +148,7 @@ function Ut({
|
|
|
148
148
|
PageDown: () => f("nextMonth")
|
|
149
149
|
}),
|
|
150
150
|
[f]
|
|
151
|
-
),
|
|
151
|
+
), ot = r(
|
|
152
152
|
() => ({
|
|
153
153
|
ArrowLeft: () => S(-1),
|
|
154
154
|
ArrowRight: () => S(1),
|
|
@@ -156,7 +156,7 @@ function Ut({
|
|
|
156
156
|
ArrowDown: () => S(3)
|
|
157
157
|
}),
|
|
158
158
|
[S]
|
|
159
|
-
),
|
|
159
|
+
), st = r(
|
|
160
160
|
() => ({
|
|
161
161
|
ArrowLeft: () => A(1),
|
|
162
162
|
ArrowRight: () => A(-1),
|
|
@@ -164,23 +164,26 @@ function Ut({
|
|
|
164
164
|
ArrowDown: () => A(-3)
|
|
165
165
|
}),
|
|
166
166
|
[A]
|
|
167
|
-
),
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
), nt = r(
|
|
168
|
+
() => ({
|
|
169
|
+
days: et,
|
|
170
|
+
months: ot,
|
|
171
|
+
years: st
|
|
172
|
+
}),
|
|
173
|
+
[et, ot, st]
|
|
174
|
+
), rt = o(
|
|
172
175
|
(t) => {
|
|
173
|
-
const e =
|
|
176
|
+
const e = nt[H];
|
|
174
177
|
t.key in e && (e[t.key](), t.preventDefault());
|
|
175
178
|
},
|
|
176
|
-
[
|
|
179
|
+
[nt, H]
|
|
177
180
|
);
|
|
178
|
-
let
|
|
181
|
+
let L = !1;
|
|
179
182
|
const bt = o(
|
|
180
183
|
(t) => {
|
|
181
184
|
const e = h && Ft(h, t.date);
|
|
182
185
|
let n = e;
|
|
183
|
-
return (!h || !
|
|
186
|
+
return (!h || !ut(h, d)) && !L && !t.disabled && (L = !0, n = !0), {
|
|
184
187
|
"data-date": t.date.getTime(),
|
|
185
188
|
"aria-selected": e,
|
|
186
189
|
ref: (s) => {
|
|
@@ -195,14 +198,15 @@ function Ut({
|
|
|
195
198
|
[
|
|
196
199
|
tt,
|
|
197
200
|
D,
|
|
198
|
-
L,
|
|
199
201
|
Z,
|
|
200
202
|
$,
|
|
201
|
-
h
|
|
203
|
+
h,
|
|
204
|
+
L,
|
|
205
|
+
d
|
|
202
206
|
]
|
|
203
207
|
), kt = o(
|
|
204
208
|
(t) => {
|
|
205
|
-
const e =
|
|
209
|
+
const e = ut(d, t.date);
|
|
206
210
|
return {
|
|
207
211
|
"data-date": t.date.getTime(),
|
|
208
212
|
"aria-selected": e,
|
|
@@ -219,24 +223,24 @@ function Ut({
|
|
|
219
223
|
[d, D, X, K]
|
|
220
224
|
), vt = o(
|
|
221
225
|
({ ref: t = null } = {}) => ({
|
|
222
|
-
onKeyDown:
|
|
226
|
+
onKeyDown: rt,
|
|
223
227
|
ref: Tt([t, P]),
|
|
224
228
|
tabIndex: -1
|
|
225
229
|
}),
|
|
226
|
-
[
|
|
230
|
+
[rt]
|
|
227
231
|
);
|
|
228
232
|
return {
|
|
229
233
|
activeMonth: d,
|
|
230
234
|
activeYear: Y,
|
|
231
|
-
weeks:
|
|
232
|
-
months:
|
|
233
|
-
canSetPrevMonth:
|
|
234
|
-
canSetNextMonth:
|
|
235
|
-
highlighted:
|
|
235
|
+
weeks: pt,
|
|
236
|
+
months: Yt,
|
|
237
|
+
canSetPrevMonth: wt,
|
|
238
|
+
canSetNextMonth: yt,
|
|
239
|
+
highlighted: Mt,
|
|
236
240
|
setPrevMonth: E,
|
|
237
241
|
setNextMonth: B,
|
|
238
|
-
setNextYear:
|
|
239
|
-
setPrevYear:
|
|
242
|
+
setNextYear: St,
|
|
243
|
+
setPrevYear: At,
|
|
240
244
|
setMonthByDate: I,
|
|
241
245
|
getDayProps: bt,
|
|
242
246
|
getMonthProps: kt,
|
package/dist/calendar/utils.js
CHANGED
|
@@ -14,7 +14,9 @@ function j(e, t) {
|
|
|
14
14
|
}, []);
|
|
15
15
|
}
|
|
16
16
|
function q(e, t) {
|
|
17
|
-
return S({ start: u(e), end: E(e) }).map(
|
|
17
|
+
return S({ start: u(e), end: E(e) }).map(
|
|
18
|
+
(n) => U(n, t)
|
|
19
|
+
);
|
|
18
20
|
}
|
|
19
21
|
function z(e, t) {
|
|
20
22
|
return x({
|
|
@@ -23,13 +25,7 @@ function z(e, t) {
|
|
|
23
25
|
}).reverse();
|
|
24
26
|
}
|
|
25
27
|
function H(e, t, n) {
|
|
26
|
-
const {
|
|
27
|
-
minDate: r,
|
|
28
|
-
maxDate: i,
|
|
29
|
-
selected: a,
|
|
30
|
-
eventsMap: s = {},
|
|
31
|
-
offDaysMap: o = {}
|
|
32
|
-
} = n, f = o[e.getTime()], c = r && M(e, r) || i && b(e, i);
|
|
28
|
+
const { minDate: r, maxDate: i, selected: a, eventsMap: s = {}, offDaysMap: o = {} } = n, f = o[e.getTime()], c = r && M(e, r) || i && b(e, i);
|
|
33
29
|
return {
|
|
34
30
|
date: e,
|
|
35
31
|
disabled: c || f,
|
|
@@ -53,7 +49,9 @@ function C(e, t, n) {
|
|
|
53
49
|
return e && W(e, t, n).getTime() === new Date(e).getTime();
|
|
54
50
|
}
|
|
55
51
|
function G(e, t, n) {
|
|
56
|
-
return new Intl.DateTimeFormat(t, { month: n ? "short" : "long" }).format(
|
|
52
|
+
return new Intl.DateTimeFormat(t, { month: n ? "short" : "long" }).format(
|
|
53
|
+
e
|
|
54
|
+
);
|
|
57
55
|
}
|
|
58
56
|
function J(e) {
|
|
59
57
|
return e.reduce((t, n) => (t[k(n).getTime()] = !0, t), {});
|