mimir-ui-kit 1.21.0 → 1.21.2
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/DatePickerModal-BM0BgzTb.js +204 -0
- package/dist/assets/Button.css +1 -1
- package/dist/assets/DatePickerModal.css +1 -0
- package/dist/assets/Drawer.css +1 -1
- package/dist/assets/TextArea.css +1 -1
- package/dist/components/Button/Button.d.ts +52 -0
- package/dist/components/Button/Button.js +33 -28
- package/dist/components/Button/constants.d.ts +8 -1
- package/dist/components/Button/constants.js +9 -0
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.js +2 -1
- package/dist/components/Button/types.d.ts +7 -2
- package/dist/components/DatePicker/DatePicker.d.ts +0 -12
- package/dist/components/DatePicker/DatePicker.js +18 -87
- package/dist/components/DatePicker/DatePickerModal.d.ts +1 -2
- package/dist/components/DatePicker/DatePickerModal.js +7 -182
- package/dist/components/DatePicker/constants.d.ts +0 -1
- package/dist/components/DatePicker/constants.js +0 -15
- package/dist/components/Drawer/Drawer.d.ts +13 -5
- package/dist/components/Drawer/Drawer.js +75 -51
- package/dist/components/TextArea/TextArea.js +9 -9
- package/dist/components/Uploader/Uploader.js +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +2 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useResizeObserver/getElement.d.ts +4 -0
- package/dist/hooks/useResizeObserver/getElement.js +18 -0
- package/dist/hooks/useResizeObserver/index.d.ts +1 -0
- package/dist/hooks/useResizeObserver/index.js +4 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +17 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.js +49 -0
- package/dist/index.js +4 -1
- package/package.json +1 -1
- package/dist/assets/styles.css +0 -1
- package/dist/components/DatePicker/MonthPickerModal.d.ts +0 -9
- package/dist/components/DatePicker/MonthPickerModal.js +0 -123
- package/dist/components/DatePicker/YearPickerModal.d.ts +0 -9
- package/dist/components/DatePicker/YearPickerModal.js +0 -120
- package/dist/styles.module-BZXDqssF.js +0 -36
package/dist/hooks/index.js
CHANGED
@@ -5,6 +5,7 @@ import { useInterval } from "./useInterval/useInterval.js";
|
|
5
5
|
import { useTimer } from "./useTimer/index.js";
|
6
6
|
import { useCopyToClipboard } from "./useCopyToClipboard/useCopyToClipboard.js";
|
7
7
|
import { useMergeRefs } from "./useMergeRefs/useMergeRefs.js";
|
8
|
+
import { useResizeObserver } from "./useResizeObserver/useResizeObserver.js";
|
8
9
|
export {
|
9
10
|
EMediaQuery,
|
10
11
|
EMinMediaQuery,
|
@@ -13,5 +14,6 @@ export {
|
|
13
14
|
useLockBodyScroll,
|
14
15
|
useMediaQuery,
|
15
16
|
useMergeRefs,
|
17
|
+
useResizeObserver,
|
16
18
|
useTimer
|
17
19
|
};
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { RefObject } from 'react';
|
2
|
+
|
3
|
+
export type GetElementTarget = RefObject<Element | null | undefined> | (() => Element) | Element | Window | Document;
|
4
|
+
export declare const getElement: <Target extends GetElementTarget>(target: Target) => Element | (Target & Document) | (Target & Window) | null | undefined;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
const getElement = (target) => {
|
2
|
+
if (typeof target === "function") {
|
3
|
+
return target();
|
4
|
+
}
|
5
|
+
if (target instanceof Document) {
|
6
|
+
return target;
|
7
|
+
}
|
8
|
+
if (target instanceof Window) {
|
9
|
+
return target;
|
10
|
+
}
|
11
|
+
if (target instanceof Element) {
|
12
|
+
return target;
|
13
|
+
}
|
14
|
+
return target.current;
|
15
|
+
};
|
16
|
+
export {
|
17
|
+
getElement
|
18
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { useResizeObserver } from './useResizeObserver';
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { RefObject } from 'react';
|
2
|
+
|
3
|
+
export type UseResizeObserverTarget = RefObject<Element | null | undefined> | (() => Element) | Element;
|
4
|
+
export interface UseResizeObserverOptions extends ResizeObserverOptions {
|
5
|
+
enabled?: boolean;
|
6
|
+
onChange?: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void;
|
7
|
+
}
|
8
|
+
export interface UseResizeObserverReturn {
|
9
|
+
entries: ResizeObserverEntry[];
|
10
|
+
}
|
11
|
+
export interface UseResizeObserver {
|
12
|
+
<Target extends UseResizeObserverTarget | UseResizeObserverTarget[]>(target: Target, options?: UseResizeObserverOptions): UseResizeObserverReturn;
|
13
|
+
<Target extends UseResizeObserverTarget | UseResizeObserverTarget[]>(options?: UseResizeObserverOptions, target?: never): UseResizeObserverReturn & {
|
14
|
+
ref: (node: Target) => void;
|
15
|
+
};
|
16
|
+
}
|
17
|
+
export declare const useResizeObserver: UseResizeObserver;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { useState, useRef, useEffect } from "react";
|
2
|
+
import { getElement } from "./getElement.js";
|
3
|
+
const useResizeObserver = (...params) => {
|
4
|
+
const target = typeof params[0] === "object" && !("current" in params[0]) ? void 0 : params[0];
|
5
|
+
const options = target ? params[1] : params[0];
|
6
|
+
const enabled = (options == null ? void 0 : options.enabled) ?? true;
|
7
|
+
const [entries, setEntries] = useState([]);
|
8
|
+
const [internalRef, setInternalRef] = useState();
|
9
|
+
const internalOnChangeRef = useRef();
|
10
|
+
internalOnChangeRef.current = options == null ? void 0 : options.onChange;
|
11
|
+
useEffect(() => {
|
12
|
+
if (!enabled && !target && !internalRef) return;
|
13
|
+
if (Array.isArray(target)) {
|
14
|
+
if (!target.length) return;
|
15
|
+
const observer2 = new ResizeObserver((entries2) => {
|
16
|
+
var _a;
|
17
|
+
setEntries(entries2);
|
18
|
+
(_a = internalOnChangeRef.current) == null ? void 0 : _a.call(internalOnChangeRef, entries2, observer2);
|
19
|
+
});
|
20
|
+
target.forEach((target2) => {
|
21
|
+
const element2 = getElement(target2);
|
22
|
+
if (!element2) return;
|
23
|
+
observer2.observe(element2, options);
|
24
|
+
});
|
25
|
+
return () => {
|
26
|
+
observer2.disconnect();
|
27
|
+
};
|
28
|
+
}
|
29
|
+
const element = target ? getElement(target) : internalRef;
|
30
|
+
if (!element) return;
|
31
|
+
const observer = new ResizeObserver((entries2) => {
|
32
|
+
var _a;
|
33
|
+
setEntries(entries2);
|
34
|
+
(_a = internalOnChangeRef.current) == null ? void 0 : _a.call(internalOnChangeRef, entries2, observer);
|
35
|
+
});
|
36
|
+
observer.observe(element, options);
|
37
|
+
return () => {
|
38
|
+
observer.disconnect();
|
39
|
+
};
|
40
|
+
}, [internalRef, target, options == null ? void 0 : options.box, enabled]);
|
41
|
+
if (target) return { entries };
|
42
|
+
return {
|
43
|
+
ref: setInternalRef,
|
44
|
+
entries
|
45
|
+
};
|
46
|
+
};
|
47
|
+
export {
|
48
|
+
useResizeObserver
|
49
|
+
};
|
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Button } from "./components/Button/Button.js";
|
2
|
-
import { EButtonForm, EButtonSize, EButtonVariantDefault, EButtonVariantOutline, EButtonVariantRound } from "./components/Button/constants.js";
|
2
|
+
import { EButtonForm, EButtonSize, EButtonVariantBorderless, EButtonVariantDefault, EButtonVariantOutline, EButtonVariantRound } from "./components/Button/constants.js";
|
3
3
|
import { I } from "./Input-6mudFqTb.js";
|
4
4
|
import { EInputSize, EInputVariant } from "./components/Input/constants.js";
|
5
5
|
import { TextArea } from "./components/TextArea/TextArea.js";
|
@@ -50,6 +50,7 @@ import { useInterval } from "./hooks/useInterval/useInterval.js";
|
|
50
50
|
import { useTimer } from "./hooks/useTimer/index.js";
|
51
51
|
import { useCopyToClipboard } from "./hooks/useCopyToClipboard/useCopyToClipboard.js";
|
52
52
|
import { useMergeRefs } from "./hooks/useMergeRefs/useMergeRefs.js";
|
53
|
+
import { useResizeObserver } from "./hooks/useResizeObserver/useResizeObserver.js";
|
53
54
|
import { Icon } from "./icons/Icon.js";
|
54
55
|
import { formating } from "./utils/index.js";
|
55
56
|
import './assets/index.css';export {
|
@@ -62,6 +63,7 @@ import './assets/index.css';export {
|
|
62
63
|
EAccordionSize,
|
63
64
|
EButtonForm,
|
64
65
|
EButtonSize,
|
66
|
+
EButtonVariantBorderless,
|
65
67
|
EButtonVariantDefault,
|
66
68
|
EButtonVariantOutline,
|
67
69
|
EButtonVariantRound,
|
@@ -117,6 +119,7 @@ import './assets/index.css';export {
|
|
117
119
|
useLockBodyScroll,
|
118
120
|
useMediaQuery,
|
119
121
|
useMergeRefs,
|
122
|
+
useResizeObserver,
|
120
123
|
useTimer,
|
121
124
|
useToast
|
122
125
|
};
|
package/package.json
CHANGED
package/dist/assets/styles.css
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
._input_3fxwe_2{padding-right:var(--space-3xl)}._input-wrapper_3fxwe_6{flex:1}._date-wrapper_3fxwe_10{position:relative;width:100%}._date-wrapper_3fxwe_10:hover ._input-wrapper_3fxwe_6{background-color:var(--input-bg-color-hover)}._date-wrapper_3fxwe_10:before{position:absolute;top:0;right:60px;bottom:0;left:0;z-index:3;cursor:pointer;content:""}[data-disabled=true] ._date-wrapper_3fxwe_10:before{cursor:auto}[data-disabled=true] ._date-wrapper_3fxwe_10 ._input-wrapper_3fxwe_6{background:var(--black-20)}[data-disabled=true] ._date-wrapper_3fxwe_10 ._input-wrapper_3fxwe_6 label,[data-disabled=true] ._date-wrapper_3fxwe_10 ._input-wrapper_3fxwe_6 input{color:var(--white)}[data-disabled=true] ._button-wrapper_3fxwe_35 svg{color:var(--white);fill:var(--white);cursor:default}._wrapper_3fxwe_41{position:relative;display:flex;align-items:center;border-radius:var(--control-radius-s)}._wrapper_3fxwe_41._active_3fxwe_47{border-bottom:1px solid var(--citrine-100)}._button-wrapper_3fxwe_35{position:absolute;top:0;right:0;z-index:2;display:flex;width:44px;height:100%;max-height:var(--button-height-xxl)}._button_3fxwe_35{align-self:center;background-color:transparent;border-radius:var(--control-radius-s)}._field-overlow_3fxwe_68{position:fixed;top:0;right:0;bottom:0;left:0;z-index:3}._calendar-block_3fxwe_74{position:absolute;z-index:3;display:flex;flex-direction:column;width:368px;max-height:none;padding:16px;font-weight:var(--font-weight-text-regular);font-size:var(--size-text-l);font-family:var(--font-inter);font-style:normal;line-height:var(--line-height-text-2xs);text-align:center;text-overflow:ellipsis;background:var(--white);border-radius:var(--control-radius-s);box-shadow:0 0 #16172705,0 2px 4px #16172705,0 6px 6px #16172705,0 15px 9px #16172703;opacity:0;transition:height .5s ease-in;font-feature-settings:"zero";font-variant-numeric:slashed-zero}._calendar-block_3fxwe_74 ._h_3fxwe_97{display:flex;width:100%;color:var(--black-100)}._calendar-block_3fxwe_74 ._b_3fxwe_35{display:grid;grid-template-columns:repeat(7,1fr)}._calendar-block_3fxwe_74 ._d_3fxwe_10{display:flex;flex:1;align-items:center;justify-content:center;color:var(--black-100);cursor:pointer;gap:4px}._calendar-block_3fxwe_74 ._m_3fxwe_118,._calendar-block_3fxwe_74 ._a_3fxwe_47,._calendar-block_3fxwe_74 ._prev_3fxwe_120{width:auto;height:48px;overflow:hidden}._calendar-block_3fxwe_74 ._m_3fxwe_118{display:flex;align-items:center;justify-content:center;color:var(--disabled)}._calendar-block_3fxwe_74 ._m_3fxwe_118 b{font-weight:var(--font-weight-text-regular)}._calendar-block_3fxwe_74 ._orange_3fxwe_136{color:var(--citrine-100)}._calendar-block_3fxwe_74 ._a_3fxwe_47{color:var(--black-100);border-radius:var(--control-radius-s)}._calendar-block_3fxwe_74 ._a_3fxwe_47 b{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-weight:var(--font-weight-text-regular);cursor:pointer}._calendar-block_3fxwe_74 ._a_3fxwe_47 b:hover{background:var(--black-10)}._calendar-block_3fxwe_74 ._a_3fxwe_47 b:active{color:var(--white);background:var(--sapphire-100)}._calendar-block_3fxwe_74 ._current_3fxwe_161{background:var(--sapphire-10);border-radius:var(--control-radius-s)}._calendar-block_3fxwe_74 ._monthGrid_3fxwe_166{display:grid;grid-template-columns:repeat(3,1fr)}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
type MonthPickerModal = {
|
2
|
-
date: Date;
|
3
|
-
onChangeValue: (d: Date) => void;
|
4
|
-
setActive: (s: boolean) => void;
|
5
|
-
before?: Date;
|
6
|
-
onType?: (s: 'years') => void;
|
7
|
-
};
|
8
|
-
export declare function MonthPickerModal({ date, onChangeValue, before, onType }: MonthPickerModal): import("react/jsx-runtime").JSX.Element;
|
9
|
-
export {};
|
@@ -1,123 +0,0 @@
|
|
1
|
-
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
2
|
-
import { useRef, useState, useEffect } from "react";
|
3
|
-
import { months } from "./constants.js";
|
4
|
-
import { c as cls } from "../../styles.module-BZXDqssF.js";
|
5
|
-
import { Icon } from "../../icons/Icon.js";
|
6
|
-
import { formating } from "../../utils/index.js";
|
7
|
-
import { Button } from "../Button/Button.js";
|
8
|
-
function MonthPickerModal({
|
9
|
-
date,
|
10
|
-
onChangeValue,
|
11
|
-
before,
|
12
|
-
onType
|
13
|
-
}) {
|
14
|
-
const field = useRef(null);
|
15
|
-
const _current = new Date(date);
|
16
|
-
const _selecte = new Date(date);
|
17
|
-
const current = {
|
18
|
-
y: _current.getFullYear(),
|
19
|
-
d: _current.getDate(),
|
20
|
-
m: _current.getMonth() + 1
|
21
|
-
};
|
22
|
-
const selecte = {
|
23
|
-
y: _selecte.getFullYear(),
|
24
|
-
d: _selecte.getDate(),
|
25
|
-
m: _selecte.getMonth() + 1
|
26
|
-
};
|
27
|
-
const [year, setYear] = useState(selecte.y);
|
28
|
-
const blockWidth = 368;
|
29
|
-
useEffect(() => {
|
30
|
-
var _a, _b, _c, _d;
|
31
|
-
const windowHeight = window.innerHeight;
|
32
|
-
const windowWidth = window.innerWidth;
|
33
|
-
if (field.current !== null) {
|
34
|
-
const inputWidth = ((_b = (_a = field == null ? void 0 : field.current) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.offsetWidth) || 0;
|
35
|
-
const inputHeight = (_d = (_c = field == null ? void 0 : field.current) == null ? void 0 : _c.parentElement) == null ? void 0 : _d.offsetHeight;
|
36
|
-
const inputPosition = field.current.getBoundingClientRect();
|
37
|
-
const calendarSize = field.current.offsetHeight;
|
38
|
-
if (windowHeight < inputPosition.y + calendarSize) {
|
39
|
-
field.current.style.top = -calendarSize + "px";
|
40
|
-
} else {
|
41
|
-
field.current.style.top = inputHeight + "px";
|
42
|
-
}
|
43
|
-
if (windowWidth < inputPosition.x + blockWidth) {
|
44
|
-
field.current.style.left = inputWidth - blockWidth + "px";
|
45
|
-
}
|
46
|
-
field.current.style.opacity = "1";
|
47
|
-
}
|
48
|
-
}, []);
|
49
|
-
const next = () => {
|
50
|
-
setYear(year + 1);
|
51
|
-
};
|
52
|
-
const prev = () => {
|
53
|
-
setYear(year - 1);
|
54
|
-
};
|
55
|
-
const isBefore = (activeDate) => {
|
56
|
-
if (before) {
|
57
|
-
const beforeDate = before.getTime();
|
58
|
-
if (beforeDate > activeDate) return true;
|
59
|
-
}
|
60
|
-
return false;
|
61
|
-
};
|
62
|
-
const send = (searchDate) => {
|
63
|
-
if (isBefore(
|
64
|
-
(/* @__PURE__ */ new Date(
|
65
|
-
`${year}-${formating.Number(2, searchDate)}-${formating.Number(2, selecte.d)}`
|
66
|
-
)).getTime()
|
67
|
-
))
|
68
|
-
return;
|
69
|
-
onChangeValue(
|
70
|
-
/* @__PURE__ */ new Date(
|
71
|
-
`${year}-${formating.Number(2, searchDate)}-${formating.Number(2, selecte.d)}`
|
72
|
-
)
|
73
|
-
);
|
74
|
-
};
|
75
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: [cls["calendar-block"]].join(" "), ref: field, children: [
|
76
|
-
/* @__PURE__ */ jsxs("div", { className: cls["h"], children: [
|
77
|
-
/* @__PURE__ */ jsx(
|
78
|
-
Button,
|
79
|
-
{
|
80
|
-
isIconButton: true,
|
81
|
-
iconName: "DropdownArrowLeft16px",
|
82
|
-
onClick: prev,
|
83
|
-
variant: "secondary-gray",
|
84
|
-
size: "l"
|
85
|
-
}
|
86
|
-
),
|
87
|
-
/* @__PURE__ */ jsxs("div", { onClick: () => onType == null ? void 0 : onType("years"), className: cls["d"], children: [
|
88
|
-
year.toString(),
|
89
|
-
/* @__PURE__ */ jsx(Icon, { iconName: "DropdownArrowBottom16px" })
|
90
|
-
] }),
|
91
|
-
/* @__PURE__ */ jsx(
|
92
|
-
Button,
|
93
|
-
{
|
94
|
-
isIconButton: true,
|
95
|
-
iconName: "DropdownArrowRight16px",
|
96
|
-
onClick: next,
|
97
|
-
variant: "secondary-gray",
|
98
|
-
size: "l"
|
99
|
-
}
|
100
|
-
)
|
101
|
-
] }),
|
102
|
-
/* @__PURE__ */ jsx("div", { className: cls["monthGrid"], children: months.map((i, s) => /* @__PURE__ */ jsx(
|
103
|
-
"div",
|
104
|
-
{
|
105
|
-
className: isBefore(
|
106
|
-
(/* @__PURE__ */ new Date(`${year}-${formating.Number(2, s + 1)}`)).getTime()
|
107
|
-
) ? cls["m"] : cls["a"],
|
108
|
-
children: /* @__PURE__ */ jsx(
|
109
|
-
"b",
|
110
|
-
{
|
111
|
-
className: current.y === year && current.m === s + 1 ? cls["current"] : "",
|
112
|
-
onClick: () => send(s + 1),
|
113
|
-
children: i
|
114
|
-
}
|
115
|
-
)
|
116
|
-
},
|
117
|
-
s
|
118
|
-
)) })
|
119
|
-
] }) });
|
120
|
-
}
|
121
|
-
export {
|
122
|
-
MonthPickerModal
|
123
|
-
};
|
@@ -1,9 +0,0 @@
|
|
1
|
-
type YearPickerModal = {
|
2
|
-
date: Date;
|
3
|
-
onChangeValue: (d: Date) => void;
|
4
|
-
setActive: (s: boolean) => void;
|
5
|
-
before?: Date;
|
6
|
-
onType?: (s: 'years') => void;
|
7
|
-
};
|
8
|
-
export declare function YearPickerModal({ date, onChangeValue, before, onType }: YearPickerModal): import("react/jsx-runtime").JSX.Element;
|
9
|
-
export {};
|
@@ -1,120 +0,0 @@
|
|
1
|
-
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
2
|
-
import { useRef, useState, useEffect } from "react";
|
3
|
-
import { c as cls } from "../../styles.module-BZXDqssF.js";
|
4
|
-
import { formating } from "../../utils/index.js";
|
5
|
-
import { Button } from "../Button/Button.js";
|
6
|
-
function YearPickerModal({
|
7
|
-
date,
|
8
|
-
onChangeValue,
|
9
|
-
before,
|
10
|
-
onType
|
11
|
-
}) {
|
12
|
-
const field = useRef(null);
|
13
|
-
const _current = new Date(date);
|
14
|
-
const _selecte = new Date(date);
|
15
|
-
const current = {
|
16
|
-
y: _current.getFullYear(),
|
17
|
-
d: _current.getDate(),
|
18
|
-
m: _current.getMonth() + 1
|
19
|
-
};
|
20
|
-
const selecte = {
|
21
|
-
y: _selecte.getFullYear(),
|
22
|
-
d: _selecte.getDate(),
|
23
|
-
m: _selecte.getMonth() + 1
|
24
|
-
};
|
25
|
-
const [year, setYear] = useState(selecte.y);
|
26
|
-
const blockWidth = 368;
|
27
|
-
const firstYears = year - 7;
|
28
|
-
const years = Array.from(Array(15).keys()).map((i) => i + firstYears);
|
29
|
-
useEffect(() => {
|
30
|
-
var _a, _b, _c, _d;
|
31
|
-
const windowHeight = window.innerHeight;
|
32
|
-
const windowWidth = window.innerWidth;
|
33
|
-
if (field.current !== null) {
|
34
|
-
const inputWidth = ((_b = (_a = field == null ? void 0 : field.current) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.offsetWidth) || 0;
|
35
|
-
const inputHeight = (_d = (_c = field == null ? void 0 : field.current) == null ? void 0 : _c.parentElement) == null ? void 0 : _d.offsetHeight;
|
36
|
-
const inputPosition = field.current.getBoundingClientRect();
|
37
|
-
const calendarSize = field.current.offsetHeight;
|
38
|
-
if (windowHeight < inputPosition.y + calendarSize) {
|
39
|
-
field.current.style.top = -calendarSize + "px";
|
40
|
-
} else {
|
41
|
-
field.current.style.top = inputHeight + "px";
|
42
|
-
}
|
43
|
-
if (windowWidth < inputPosition.x + blockWidth) {
|
44
|
-
field.current.style.left = inputWidth - blockWidth + "px";
|
45
|
-
}
|
46
|
-
field.current.style.opacity = "1";
|
47
|
-
}
|
48
|
-
}, []);
|
49
|
-
const next = () => {
|
50
|
-
setYear(year + 15);
|
51
|
-
};
|
52
|
-
const prev = () => {
|
53
|
-
setYear(year - 15);
|
54
|
-
};
|
55
|
-
const isBefore = (activeDate) => {
|
56
|
-
if (before) {
|
57
|
-
const beforeDate = before.getTime();
|
58
|
-
if (beforeDate > activeDate) return true;
|
59
|
-
}
|
60
|
-
return false;
|
61
|
-
};
|
62
|
-
const send = (searchDate) => {
|
63
|
-
if (isBefore(
|
64
|
-
(/* @__PURE__ */ new Date(
|
65
|
-
`${searchDate}-${formating.Number(2, selecte.m)}-${formating.Number(2, selecte.d)}`
|
66
|
-
)).getTime()
|
67
|
-
))
|
68
|
-
return;
|
69
|
-
onChangeValue(
|
70
|
-
/* @__PURE__ */ new Date(
|
71
|
-
`${searchDate}-${formating.Number(2, selecte.m)}-${formating.Number(2, selecte.d)}`
|
72
|
-
)
|
73
|
-
);
|
74
|
-
};
|
75
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: [cls["calendar-block"]].join(" "), ref: field, children: [
|
76
|
-
/* @__PURE__ */ jsxs("div", { className: cls["h"], children: [
|
77
|
-
/* @__PURE__ */ jsx(
|
78
|
-
Button,
|
79
|
-
{
|
80
|
-
isIconButton: true,
|
81
|
-
iconName: "DropdownArrowLeft16px",
|
82
|
-
onClick: prev,
|
83
|
-
variant: "secondary-gray",
|
84
|
-
size: "l"
|
85
|
-
}
|
86
|
-
),
|
87
|
-
/* @__PURE__ */ jsx("div", { onClick: () => onType == null ? void 0 : onType("years"), className: cls["d"] }),
|
88
|
-
/* @__PURE__ */ jsx(
|
89
|
-
Button,
|
90
|
-
{
|
91
|
-
isIconButton: true,
|
92
|
-
iconName: "DropdownArrowRight16px",
|
93
|
-
onClick: next,
|
94
|
-
variant: "secondary-gray",
|
95
|
-
size: "l"
|
96
|
-
}
|
97
|
-
)
|
98
|
-
] }),
|
99
|
-
/* @__PURE__ */ jsx("div", { className: cls["monthGrid"], children: years.map((i, s) => /* @__PURE__ */ jsx(
|
100
|
-
"div",
|
101
|
-
{
|
102
|
-
className: isBefore(
|
103
|
-
(/* @__PURE__ */ new Date(`${i}-${formating.Number(2, current.m)}`)).getTime()
|
104
|
-
) ? cls["m"] : cls["a"],
|
105
|
-
children: /* @__PURE__ */ jsx(
|
106
|
-
"b",
|
107
|
-
{
|
108
|
-
className: current.y === i ? cls["current"] : "",
|
109
|
-
onClick: () => send(i),
|
110
|
-
children: i
|
111
|
-
}
|
112
|
-
)
|
113
|
-
},
|
114
|
-
s
|
115
|
-
)) })
|
116
|
-
] }) });
|
117
|
-
}
|
118
|
-
export {
|
119
|
-
YearPickerModal
|
120
|
-
};
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import './assets/styles.css';const input = "_input_3fxwe_2";
|
2
|
-
const wrapper = "_wrapper_3fxwe_41";
|
3
|
-
const active = "_active_3fxwe_47";
|
4
|
-
const button = "_button_3fxwe_35";
|
5
|
-
const h = "_h_3fxwe_97";
|
6
|
-
const b = "_b_3fxwe_35";
|
7
|
-
const d = "_d_3fxwe_10";
|
8
|
-
const m = "_m_3fxwe_118";
|
9
|
-
const a = "_a_3fxwe_47";
|
10
|
-
const prev = "_prev_3fxwe_120";
|
11
|
-
const orange = "_orange_3fxwe_136";
|
12
|
-
const current = "_current_3fxwe_161";
|
13
|
-
const monthGrid = "_monthGrid_3fxwe_166";
|
14
|
-
const cls = {
|
15
|
-
input,
|
16
|
-
"input-wrapper": "_input-wrapper_3fxwe_6",
|
17
|
-
"date-wrapper": "_date-wrapper_3fxwe_10",
|
18
|
-
"button-wrapper": "_button-wrapper_3fxwe_35",
|
19
|
-
wrapper,
|
20
|
-
active,
|
21
|
-
button,
|
22
|
-
"field-overlow": "_field-overlow_3fxwe_68",
|
23
|
-
"calendar-block": "_calendar-block_3fxwe_74",
|
24
|
-
h,
|
25
|
-
b,
|
26
|
-
d,
|
27
|
-
m,
|
28
|
-
a,
|
29
|
-
prev,
|
30
|
-
orange,
|
31
|
-
current,
|
32
|
-
monthGrid
|
33
|
-
};
|
34
|
-
export {
|
35
|
-
cls as c
|
36
|
-
};
|