mimir-ui-kit 1.21.3 → 1.23.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/ListFiles.css +1 -0
- package/dist/assets/ListPhotos.css +1 -1
- package/dist/assets/Uploader.css +1 -1
- package/dist/assets/UploaderPhotos.css +1 -1
- package/dist/assets/styles.css +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +12 -0
- package/dist/components/DatePicker/DatePicker.js +87 -18
- package/dist/components/DatePicker/DatePickerModal.d.ts +2 -1
- package/dist/components/DatePicker/DatePickerModal.js +182 -7
- package/dist/components/DatePicker/MonthPickerModal.d.ts +9 -0
- package/dist/components/DatePicker/MonthPickerModal.js +123 -0
- package/dist/components/DatePicker/YearPickerModal.d.ts +9 -0
- package/dist/components/DatePicker/YearPickerModal.js +120 -0
- package/dist/components/DatePicker/constants.d.ts +1 -0
- package/dist/components/DatePicker/constants.js +15 -0
- package/dist/components/ListFiles/ListFiles.d.ts +26 -0
- package/dist/components/ListFiles/ListFiles.js +45 -0
- package/dist/components/ListFiles/constants.d.ts +3 -0
- package/dist/components/ListFiles/constants.js +33 -0
- package/dist/components/ListFiles/index.d.ts +2 -0
- package/dist/components/ListFiles/index.js +4 -0
- package/dist/components/ListPhotos/ListPhotos.js +1 -1
- package/dist/components/Uploader/Uploader.js +5 -5
- package/dist/components/UploaderFiles/UploaderFiles.d.ts +38 -0
- package/dist/components/UploaderFiles/UploaderFiles.js +68 -0
- package/dist/components/UploaderFiles/index.d.ts +2 -0
- package/dist/components/UploaderFiles/index.js +4 -0
- package/dist/components/UploaderPhotos/UploaderPhotos.js +2 -2
- package/dist/styles.module-BZXDqssF.js +36 -0
- package/dist/utils/formating/FileSize.d.ts +1 -0
- package/dist/utils/formating/FileSize.js +15 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +3 -1
- package/package.json +1 -1
- package/dist/DatePickerModal-BM0BgzTb.js +0 -204
- package/dist/assets/DatePickerModal.css +0 -1
@@ -5,7 +5,22 @@ var EDatePickerBeforeDate = /* @__PURE__ */ ((EDatePickerBeforeDate2) => {
|
|
5
5
|
return EDatePickerBeforeDate2;
|
6
6
|
})(EDatePickerBeforeDate || {});
|
7
7
|
const week = ["пн", "вт", "ср", "чт", "пт", "сб", "вс"];
|
8
|
+
const months = [
|
9
|
+
"Январь",
|
10
|
+
"Февраль",
|
11
|
+
"Март",
|
12
|
+
"Апрель",
|
13
|
+
"Май",
|
14
|
+
"Июнь",
|
15
|
+
"Июль",
|
16
|
+
"Август",
|
17
|
+
"Сентябрь",
|
18
|
+
"Октябрь",
|
19
|
+
"Ноябрь",
|
20
|
+
"Декабрь"
|
21
|
+
];
|
8
22
|
export {
|
9
23
|
EDatePickerBeforeDate,
|
24
|
+
months,
|
10
25
|
week
|
11
26
|
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
export type TListFiles = {
|
2
|
+
/**
|
3
|
+
* Массив фото
|
4
|
+
*/
|
5
|
+
value: TFilesDetail[];
|
6
|
+
/**
|
7
|
+
* функция -callback, которая вызывается при изменении списка и передает обновленный список и deleteId,
|
8
|
+
*/
|
9
|
+
onChange?: (e: TFileValue) => void;
|
10
|
+
};
|
11
|
+
export type TFileItem = {
|
12
|
+
id: number;
|
13
|
+
url: string;
|
14
|
+
};
|
15
|
+
export type TFileValue = {
|
16
|
+
deleteId?: number;
|
17
|
+
list: TFilesDetail[];
|
18
|
+
};
|
19
|
+
export type TFilesDetail = {
|
20
|
+
id: number;
|
21
|
+
url: string;
|
22
|
+
name: string;
|
23
|
+
size?: number;
|
24
|
+
type?: string;
|
25
|
+
};
|
26
|
+
export declare function ListFiles({ value, onChange }: TListFiles): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
2
|
+
import { useState, useEffect } from "react";
|
3
|
+
import { formating } from "../../utils/index.js";
|
4
|
+
import { Button } from "../Button/Button.js";
|
5
|
+
import '../../assets/ListFiles.css';const cls = {
|
6
|
+
"file-info": "_file-info_1qfel_2",
|
7
|
+
"file-info-size": "_file-info-size_1qfel_8",
|
8
|
+
"file-info-name-wrapper": "_file-info-name-wrapper_1qfel_16",
|
9
|
+
"file-info-name": "_file-info-name_1qfel_16",
|
10
|
+
"file-upload-container": "_file-upload-container_1qfel_34",
|
11
|
+
"file-upload-container-item": "_file-upload-container-item_1qfel_42"
|
12
|
+
};
|
13
|
+
function ListFiles({ value, onChange }) {
|
14
|
+
const [list, setList] = useState(value);
|
15
|
+
useEffect(() => {
|
16
|
+
setList(value);
|
17
|
+
}, [value]);
|
18
|
+
const onDelete = async (id) => {
|
19
|
+
const newList = [...list.filter((el) => el.id !== id)];
|
20
|
+
setList(newList);
|
21
|
+
onChange == null ? void 0 : onChange({ deleteId: id, list: newList });
|
22
|
+
};
|
23
|
+
return /* @__PURE__ */ jsx("ul", { className: cls["file-upload-container"], children: list.map((el, key) => /* @__PURE__ */ jsxs("li", { className: cls["file-upload-container-item"], children: [
|
24
|
+
/* @__PURE__ */ jsxs("div", { className: cls["file-info"], children: [
|
25
|
+
(el == null ? void 0 : el.size) && /* @__PURE__ */ jsxs("span", { className: cls["file-info-size"], children: [
|
26
|
+
" ",
|
27
|
+
formating.Size(el == null ? void 0 : el.size)
|
28
|
+
] }),
|
29
|
+
/* @__PURE__ */ jsx("div", { className: cls["file-info-name-wrapper"], children: /* @__PURE__ */ jsx("div", { className: cls["file-info-name"], children: el.name }) })
|
30
|
+
] }),
|
31
|
+
/* @__PURE__ */ jsx(
|
32
|
+
Button,
|
33
|
+
{
|
34
|
+
isIconButton: true,
|
35
|
+
iconName: "Close12px",
|
36
|
+
size: "m-s",
|
37
|
+
variant: "secondary-gray",
|
38
|
+
onClick: () => onDelete(el.id)
|
39
|
+
}
|
40
|
+
)
|
41
|
+
] }, key)) });
|
42
|
+
}
|
43
|
+
export {
|
44
|
+
ListFiles
|
45
|
+
};
|
@@ -0,0 +1,33 @@
|
|
1
|
+
const photos = [
|
2
|
+
{
|
3
|
+
id: 111,
|
4
|
+
name: "ООО “КИЗ-СТРОЙ” - Свидетельство о регистрации (06.12.2003).xls",
|
5
|
+
url: "https://i.pinimg.com/736x/5a/e6/12/5ae612a7ecf50870c8f41961fefc332f.jpg",
|
6
|
+
size: 1024,
|
7
|
+
type: "image/png"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
id: 112,
|
11
|
+
name: "ООО “КИЗ-СТРОЙ” - Доверенность (20.10.2005).xls",
|
12
|
+
url: "https://i1.sndcdn.com/artworks-rQAPPfrs44UvRwIz-WJkvyQ-t500x500.jpg",
|
13
|
+
size: 1024,
|
14
|
+
type: "image/png"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
id: 113,
|
18
|
+
name: "Скан паспорта.pdf",
|
19
|
+
url: "https://i1.sndcdn.com/avatars-000095020320-0pmjnu-t500x500.jpg",
|
20
|
+
size: 2064,
|
21
|
+
type: "image/png"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
id: 114,
|
25
|
+
name: "Прочие документы.xls",
|
26
|
+
url: "https://i1.sndcdn.com/avatars-000151937348-27m28p-t500x500.jpg",
|
27
|
+
size: 1024,
|
28
|
+
type: "image/png"
|
29
|
+
}
|
30
|
+
];
|
31
|
+
export {
|
32
|
+
photos
|
33
|
+
};
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
3
3
|
import { Button } from "../Button/Button.js";
|
4
4
|
import '../../assets/ListPhotos.css';const cls = {
|
5
|
-
"list-photos": "_list-
|
5
|
+
"list-photos": "_list-photos_16pts_2"
|
6
6
|
};
|
7
7
|
function ListPhotos({ value, onChange }) {
|
8
8
|
const [list, setList] = useState(value);
|
@@ -3,9 +3,9 @@ import { forwardRef, useRef, useId } from "react";
|
|
3
3
|
import { Icon } from "../../icons/Icon.js";
|
4
4
|
import { Button } from "../Button/Button.js";
|
5
5
|
import '../../assets/Uploader.css';const cls = {
|
6
|
-
"upload-
|
7
|
-
"upload-text": "_upload-
|
8
|
-
"upload-file-input": "_upload-file-
|
6
|
+
"upload-file-wrapper": "_upload-file-wrapper_n3hxs_2",
|
7
|
+
"upload-text": "_upload-text_n3hxs_25",
|
8
|
+
"upload-file-input": "_upload-file-input_n3hxs_35"
|
9
9
|
};
|
10
10
|
const MIME = {
|
11
11
|
jpeg: "image/jpeg",
|
@@ -23,7 +23,7 @@ const MIME = {
|
|
23
23
|
};
|
24
24
|
const filesTyps = ["jpeg", "jpg", "png", "tiff", "gif"];
|
25
25
|
const generateId = (min, max) => {
|
26
|
-
return Math.random() * (max - min) + min;
|
26
|
+
return Math.round(Math.random() * (max - min) + min);
|
27
27
|
};
|
28
28
|
const Uploader = forwardRef(
|
29
29
|
(props, ref) => {
|
@@ -51,7 +51,7 @@ const Uploader = forwardRef(
|
|
51
51
|
var _a;
|
52
52
|
(_a = uploaderRef.current) == null ? void 0 : _a.click();
|
53
53
|
};
|
54
|
-
return /* @__PURE__ */ jsxs("div", { className: cls["upload-
|
54
|
+
return /* @__PURE__ */ jsxs("div", { className: cls["upload-file-wrapper"], ref, children: [
|
55
55
|
/* @__PURE__ */ jsx(
|
56
56
|
"input",
|
57
57
|
{
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { TFilesDetail } from '../ListFiles/ListFiles';
|
2
|
+
import { imageTypesArr } from '../Uploader/constants';
|
3
|
+
import { TFileItem } from '../Uploader/Uploader';
|
4
|
+
|
5
|
+
export type TUploaderFiles = {
|
6
|
+
/**
|
7
|
+
* Массив разрешенных типов файлов для настройки валидации
|
8
|
+
* 'jpeg' | 'jpg' | 'png' | 'tiff' | 'gif' | 'doc' | 'xls' | 'pdf' |'docx' | 'txt'
|
9
|
+
*/
|
10
|
+
filesType: imageTypesArr[];
|
11
|
+
/**
|
12
|
+
* Наименование передаваемого массива файлов
|
13
|
+
*/
|
14
|
+
arrayName: string;
|
15
|
+
/**
|
16
|
+
* Максимальный размер файлов.
|
17
|
+
*/
|
18
|
+
maxSize: number;
|
19
|
+
/**
|
20
|
+
* Функция обратного вызова, передает параметры type и data,
|
21
|
+
* type 'add' в data передает массив файлов,
|
22
|
+
* type:'delete' в data передает id удаленного файла
|
23
|
+
*/
|
24
|
+
onChange: (j: TOnChangeFilesUpdate) => void;
|
25
|
+
/**
|
26
|
+
* Передаваемые файлы.
|
27
|
+
*/
|
28
|
+
value?: TFilesDetail[];
|
29
|
+
/**
|
30
|
+
* Максимальное количество файлов.
|
31
|
+
*/
|
32
|
+
maxFiles: number;
|
33
|
+
};
|
34
|
+
export type TOnChangeFilesUpdate = {
|
35
|
+
type: string;
|
36
|
+
data: TFileItem[] | number;
|
37
|
+
};
|
38
|
+
export declare const UploaderFiles: import('react').ForwardRefExoticComponent<TUploaderFiles & import('react').RefAttributes<HTMLDivElement>>;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
2
|
+
import { c as classNames } from "../../index-CweZ_OcN.js";
|
3
|
+
import { forwardRef, useState, useEffect } from "react";
|
4
|
+
import { ListFiles } from "../ListFiles/ListFiles.js";
|
5
|
+
import { Uploader } from "../Uploader/Uploader.js";
|
6
|
+
import '../../assets/UploaderPhotos.css';const cls = {
|
7
|
+
"upload-file-wrapper": "_upload-file-wrapper_2zki8_2"
|
8
|
+
};
|
9
|
+
const UploaderFiles = forwardRef(
|
10
|
+
(props, ref) => {
|
11
|
+
const { filesType, arrayName, maxSize, onChange, value, maxFiles } = props;
|
12
|
+
const [files, setFiles] = useState(value || []);
|
13
|
+
const isMaxFilesReached = files.length >= maxFiles;
|
14
|
+
useEffect(() => {
|
15
|
+
if (value) {
|
16
|
+
setFiles(value);
|
17
|
+
}
|
18
|
+
}, [value]);
|
19
|
+
const onChangeValue = (e) => {
|
20
|
+
const newFiles = [
|
21
|
+
...files,
|
22
|
+
...e.value.map((el) => {
|
23
|
+
var _a, _b, _c;
|
24
|
+
return {
|
25
|
+
id: el.id,
|
26
|
+
url: "",
|
27
|
+
size: (_a = el == null ? void 0 : el.file) == null ? void 0 : _a.size,
|
28
|
+
name: (_b = el == null ? void 0 : el.file) == null ? void 0 : _b.name,
|
29
|
+
type: (_c = el == null ? void 0 : el.file) == null ? void 0 : _c.type
|
30
|
+
};
|
31
|
+
})
|
32
|
+
];
|
33
|
+
setFiles(newFiles);
|
34
|
+
onChange == null ? void 0 : onChange({ type: "add", data: e.value });
|
35
|
+
};
|
36
|
+
const onDelete = (j) => {
|
37
|
+
setFiles(j.list);
|
38
|
+
if (j.deleteId) onChange == null ? void 0 : onChange({ type: "delete", data: j.deleteId });
|
39
|
+
};
|
40
|
+
return /* @__PURE__ */ jsxs(
|
41
|
+
"div",
|
42
|
+
{
|
43
|
+
className: classNames(
|
44
|
+
cls["upload-file-wrapper"],
|
45
|
+
isMaxFilesReached && cls.disabled
|
46
|
+
),
|
47
|
+
children: [
|
48
|
+
/* @__PURE__ */ jsx(
|
49
|
+
Uploader,
|
50
|
+
{
|
51
|
+
filesType,
|
52
|
+
arrayName,
|
53
|
+
maxSize,
|
54
|
+
onChangeValue,
|
55
|
+
ref,
|
56
|
+
maxFiles,
|
57
|
+
isDisabled: isMaxFilesReached
|
58
|
+
}
|
59
|
+
),
|
60
|
+
/* @__PURE__ */ jsx(ListFiles, { value: files, onChange: onDelete })
|
61
|
+
]
|
62
|
+
}
|
63
|
+
);
|
64
|
+
}
|
65
|
+
);
|
66
|
+
export {
|
67
|
+
UploaderFiles
|
68
|
+
};
|
@@ -4,7 +4,7 @@ import { forwardRef, useState, useEffect } from "react";
|
|
4
4
|
import { ListPhotos } from "../ListPhotos/ListPhotos.js";
|
5
5
|
import { Uploader } from "../Uploader/Uploader.js";
|
6
6
|
import '../../assets/UploaderPhotos.css';const cls = {
|
7
|
-
"upload-
|
7
|
+
"upload-file-wrapper": "_upload-file-wrapper_2zki8_2"
|
8
8
|
};
|
9
9
|
const UploaderPhotos = forwardRef(
|
10
10
|
(props, ref) => {
|
@@ -35,7 +35,7 @@ const UploaderPhotos = forwardRef(
|
|
35
35
|
"div",
|
36
36
|
{
|
37
37
|
className: classNames(
|
38
|
-
cls["upload-
|
38
|
+
cls["upload-file-wrapper"],
|
39
39
|
isMaxFilesReached && cls.disabled
|
40
40
|
),
|
41
41
|
children: [
|
@@ -0,0 +1,36 @@
|
|
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
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function Size(size: number): string;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
function Size(size) {
|
2
|
+
if (!size) return "";
|
3
|
+
let i = -1;
|
4
|
+
const b = [" Kb", " Mb", " Gb", " Tb", "Pb", "Eb", "Zb", "Yb"];
|
5
|
+
const sistemParams = 1024;
|
6
|
+
const maxValue = 0.1;
|
7
|
+
do {
|
8
|
+
size /= sistemParams;
|
9
|
+
i += 1;
|
10
|
+
} while (size > sistemParams);
|
11
|
+
return Math.max(size, maxValue).toFixed(1) + b[i];
|
12
|
+
}
|
13
|
+
export {
|
14
|
+
Size as default
|
15
|
+
};
|
package/dist/utils/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { default as Date } from './formating/Date';
|
2
|
+
import { default as Size } from './formating/FileSize';
|
2
3
|
import { default as Month } from './formating/Month';
|
3
4
|
import { default as Number } from './formating/Numbers';
|
4
5
|
import { default as UUIDv4 } from './UUID4';
|
@@ -8,4 +9,5 @@ export declare const formating: {
|
|
8
9
|
Month: typeof Month;
|
9
10
|
Date: typeof Date;
|
10
11
|
UUIDv4: typeof UUIDv4;
|
12
|
+
Size: typeof Size;
|
11
13
|
};
|
package/dist/utils/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import _Date from "./formating/Date.js";
|
2
|
+
import Size from "./formating/FileSize.js";
|
2
3
|
import Month from "./formating/Month.js";
|
3
4
|
import Numbers from "./formating/Numbers.js";
|
4
5
|
import UUIDv4 from "./UUID4.js";
|
@@ -6,7 +7,8 @@ const formating = {
|
|
6
7
|
Number: Numbers,
|
7
8
|
Month,
|
8
9
|
Date: _Date,
|
9
|
-
UUIDv4
|
10
|
+
UUIDv4,
|
11
|
+
Size
|
10
12
|
};
|
11
13
|
export {
|
12
14
|
formating
|
package/package.json
CHANGED
@@ -1,204 +0,0 @@
|
|
1
|
-
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
2
|
-
import { useRef, useState, useEffect } from "react";
|
3
|
-
import { week } from "./components/DatePicker/constants.js";
|
4
|
-
import { formating } from "./utils/index.js";
|
5
|
-
import { Button } from "./components/Button/Button.js";
|
6
|
-
import './assets/DatePickerModal.css';const input = "_input_1ndkx_2";
|
7
|
-
const wrapper = "_wrapper_1ndkx_21";
|
8
|
-
const active = "_active_1ndkx_27";
|
9
|
-
const button = "_button_1ndkx_35";
|
10
|
-
const h = "_h_1ndkx_81";
|
11
|
-
const b = "_b_1ndkx_35";
|
12
|
-
const d = "_d_1ndkx_6";
|
13
|
-
const m = "_m_1ndkx_100";
|
14
|
-
const a = "_a_1ndkx_27";
|
15
|
-
const prev = "_prev_1ndkx_102";
|
16
|
-
const orange = "_orange_1ndkx_118";
|
17
|
-
const current = "_current_1ndkx_143";
|
18
|
-
const cls = {
|
19
|
-
input,
|
20
|
-
"date-wrapper": "_date-wrapper_1ndkx_6",
|
21
|
-
wrapper,
|
22
|
-
active,
|
23
|
-
"input-wrapper": "_input-wrapper_1ndkx_31",
|
24
|
-
"button-wrapper": "_button-wrapper_1ndkx_35",
|
25
|
-
button,
|
26
|
-
"field-overlow": "_field-overlow_1ndkx_52",
|
27
|
-
"calendar-block": "_calendar-block_1ndkx_58",
|
28
|
-
h,
|
29
|
-
b,
|
30
|
-
d,
|
31
|
-
m,
|
32
|
-
a,
|
33
|
-
prev,
|
34
|
-
orange,
|
35
|
-
current
|
36
|
-
};
|
37
|
-
function DatePickerModal({
|
38
|
-
date,
|
39
|
-
onChangeValue,
|
40
|
-
setActive,
|
41
|
-
before
|
42
|
-
}) {
|
43
|
-
const field = useRef(null);
|
44
|
-
const _current = new Date(date);
|
45
|
-
const _selecte = new Date(date);
|
46
|
-
const current2 = {
|
47
|
-
y: _current.getFullYear(),
|
48
|
-
d: _current.getDate(),
|
49
|
-
m: _current.getMonth() + 1
|
50
|
-
};
|
51
|
-
const selecte = {
|
52
|
-
y: _selecte.getFullYear(),
|
53
|
-
d: _selecte.getDate(),
|
54
|
-
m: _selecte.getMonth() + 1
|
55
|
-
};
|
56
|
-
const countWorkDays = 4;
|
57
|
-
const [month, setMonth] = useState({ y: selecte.y, m: selecte.m });
|
58
|
-
useEffect(() => {
|
59
|
-
const windowHeight = window.innerHeight;
|
60
|
-
if (field.current !== null) {
|
61
|
-
const inputPosition = field.current.getBoundingClientRect();
|
62
|
-
const calendarSize = field.current.offsetHeight;
|
63
|
-
if (windowHeight < inputPosition.y + calendarSize) {
|
64
|
-
field.current.style.top = -calendarSize + "px";
|
65
|
-
} else {
|
66
|
-
field.current.style.top = "65px";
|
67
|
-
}
|
68
|
-
field.current.style.opacity = "1";
|
69
|
-
}
|
70
|
-
}, [month]);
|
71
|
-
const countPrevDays = (e) => {
|
72
|
-
let dayOfWeek = e.getDay();
|
73
|
-
if (dayOfWeek === 0) dayOfWeek = 7;
|
74
|
-
return dayOfWeek - 1;
|
75
|
-
};
|
76
|
-
const currentMonthIndex = month.m - 1;
|
77
|
-
const currentMonthFull = new Date(month.y, currentMonthIndex);
|
78
|
-
const days = [];
|
79
|
-
const prevDays = () => {
|
80
|
-
const prevMonth = new Date(currentMonthFull);
|
81
|
-
prevMonth.setDate(prevMonth.getDate() - 1);
|
82
|
-
const lastDayPrevMohth = prevMonth.getDate();
|
83
|
-
const prevList = [];
|
84
|
-
for (let i = 0; i < countPrevDays(currentMonthFull); i++) {
|
85
|
-
prevList.push(lastDayPrevMohth - i);
|
86
|
-
}
|
87
|
-
prevList.reverse();
|
88
|
-
return prevList;
|
89
|
-
};
|
90
|
-
const prevDaysArray = prevDays();
|
91
|
-
while (currentMonthFull.getMonth() === currentMonthIndex) {
|
92
|
-
days.push(currentMonthFull.getDate());
|
93
|
-
currentMonthFull.setDate(currentMonthFull.getDate() + 1);
|
94
|
-
}
|
95
|
-
const nextDays = () => {
|
96
|
-
const totalViewDays = 42;
|
97
|
-
const daysCount = totalViewDays - (prevDaysArray.length + days.length);
|
98
|
-
const nextList = [];
|
99
|
-
for (let i = 1; i <= daysCount; i++) {
|
100
|
-
nextList.push(i);
|
101
|
-
}
|
102
|
-
return nextList;
|
103
|
-
};
|
104
|
-
const nextDaysArray = nextDays();
|
105
|
-
const update = (m2, y) => {
|
106
|
-
y = m2 > 12 ? y + 1 : m2 < 1 ? y - 1 : y;
|
107
|
-
m2 = m2 > 12 ? 1 : m2 < 1 ? 12 : m2;
|
108
|
-
return { y, m: m2 };
|
109
|
-
};
|
110
|
-
const onExit = () => {
|
111
|
-
setActive(false);
|
112
|
-
};
|
113
|
-
const next = () => {
|
114
|
-
setMonth(update(month.m + 1, month.y));
|
115
|
-
};
|
116
|
-
const prev2 = () => {
|
117
|
-
setMonth(update(month.m - 1, month.y));
|
118
|
-
};
|
119
|
-
const isBefore = (activeDate) => {
|
120
|
-
if (before) {
|
121
|
-
const beforeDate = before.getTime();
|
122
|
-
if (beforeDate > activeDate) return true;
|
123
|
-
}
|
124
|
-
return false;
|
125
|
-
};
|
126
|
-
const send = (searchDate) => {
|
127
|
-
if (isBefore(
|
128
|
-
(/* @__PURE__ */ new Date(
|
129
|
-
`${month.y}-${formating.Number(2, month.m)}-${formating.Number(2, searchDate)}`
|
130
|
-
)).getTime()
|
131
|
-
))
|
132
|
-
return;
|
133
|
-
onChangeValue(
|
134
|
-
/* @__PURE__ */ new Date(
|
135
|
-
`${month.y}-${formating.Number(2, month.m)}-${formating.Number(2, searchDate)}`
|
136
|
-
)
|
137
|
-
);
|
138
|
-
onExit();
|
139
|
-
};
|
140
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: [cls["calendar-block"]].join(" "), ref: field, children: [
|
141
|
-
/* @__PURE__ */ jsxs("div", { className: cls["h"], children: [
|
142
|
-
/* @__PURE__ */ jsx(
|
143
|
-
Button,
|
144
|
-
{
|
145
|
-
isIconButton: true,
|
146
|
-
iconName: "DropdownArrowLeft16px",
|
147
|
-
onClick: prev2,
|
148
|
-
variant: "secondary-gray",
|
149
|
-
size: "l"
|
150
|
-
}
|
151
|
-
),
|
152
|
-
/* @__PURE__ */ jsxs("div", { className: cls["d"], children: [
|
153
|
-
formating.Month(month.m).name,
|
154
|
-
"’",
|
155
|
-
month.y.toString().slice(-2)
|
156
|
-
] }),
|
157
|
-
/* @__PURE__ */ jsx(
|
158
|
-
Button,
|
159
|
-
{
|
160
|
-
isIconButton: true,
|
161
|
-
iconName: "DropdownArrowRight16px",
|
162
|
-
onClick: next,
|
163
|
-
variant: "secondary-gray",
|
164
|
-
size: "l"
|
165
|
-
}
|
166
|
-
)
|
167
|
-
] }),
|
168
|
-
/* @__PURE__ */ jsxs("div", { className: cls["b"], children: [
|
169
|
-
week.map((i, s) => /* @__PURE__ */ jsx(
|
170
|
-
"div",
|
171
|
-
{
|
172
|
-
className: `${s > countWorkDays ? [cls["m"], cls["orange"]].join(" ") : cls["m"]}`,
|
173
|
-
children: i
|
174
|
-
},
|
175
|
-
`v${s}`
|
176
|
-
)),
|
177
|
-
prevDaysArray.map((el, key) => /* @__PURE__ */ jsx("div", { className: cls["m"], children: el }, key)),
|
178
|
-
days.map((i, s) => /* @__PURE__ */ jsx(
|
179
|
-
"div",
|
180
|
-
{
|
181
|
-
className: isBefore(
|
182
|
-
(/* @__PURE__ */ new Date(
|
183
|
-
`${month.y}-${formating.Number(2, month.m)}-${formating.Number(2, i)}`
|
184
|
-
)).getTime()
|
185
|
-
) ? cls["m"] : cls["a"],
|
186
|
-
children: i !== 0 ? /* @__PURE__ */ jsx(
|
187
|
-
"b",
|
188
|
-
{
|
189
|
-
className: current2.y === month.y && current2.m === month.m && current2.d === i ? cls["current"] : "",
|
190
|
-
onClick: () => send(i),
|
191
|
-
children: i
|
192
|
-
}
|
193
|
-
) : /* @__PURE__ */ jsx("p", {})
|
194
|
-
},
|
195
|
-
s
|
196
|
-
)),
|
197
|
-
nextDaysArray.map((el, key) => /* @__PURE__ */ jsx("div", { className: cls["m"], children: el }, key))
|
198
|
-
] })
|
199
|
-
] }) });
|
200
|
-
}
|
201
|
-
export {
|
202
|
-
DatePickerModal as D,
|
203
|
-
cls as c
|
204
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
._input_1ndkx_2{padding-right:var(--space-3xl)}._date-wrapper_1ndkx_6{position:relative;width:100%}._date-wrapper_1ndkx_6:hover input{background:var(--input-bg-color-hover)}._date-wrapper_1ndkx_6:before{position:absolute;top:0;right:60px;bottom:0;left:0;z-index:3;cursor:pointer;content:""}._wrapper_1ndkx_21{position:relative;display:flex;align-items:center;border-radius:var(--control-radius-s)}._wrapper_1ndkx_21._active_1ndkx_27{border-bottom:1px solid var(--citrine-100)}._input-wrapper_1ndkx_31{flex:1}._button-wrapper_1ndkx_35{position:absolute;top:0;right:0;z-index:2;display:flex;width:44px;height:100%;max-height:var(--button-height-xxl)}._button_1ndkx_35{align-self:center;background-color:transparent;border-radius:var(--control-radius-s)}._field-overlow_1ndkx_52{position:fixed;top:0;right:0;bottom:0;left:0;z-index:3}._calendar-block_1ndkx_58{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:#fff;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_1ndkx_58 ._h_1ndkx_81{display:flex;width:100%;color:var(--black-100)}._calendar-block_1ndkx_58 ._b_1ndkx_35{display:grid;grid-template-columns:repeat(7,1fr)}._calendar-block_1ndkx_58 ._d_1ndkx_6{display:flex;flex:1;align-items:center;justify-content:center;color:var(--black-100)}._calendar-block_1ndkx_58 ._m_1ndkx_100,._calendar-block_1ndkx_58 ._a_1ndkx_27,._calendar-block_1ndkx_58 ._prev_1ndkx_102{width:48px;height:48px;overflow:hidden}._calendar-block_1ndkx_58 ._m_1ndkx_100{display:flex;align-items:center;justify-content:center;color:var(--disabled)}._calendar-block_1ndkx_58 ._m_1ndkx_100 b{font-weight:var(--font-weight-text-regular)}._calendar-block_1ndkx_58 ._orange_1ndkx_118{color:var(--citrine-100)}._calendar-block_1ndkx_58 ._a_1ndkx_27{color:var(--black-100);border-radius:var(--control-radius-s)}._calendar-block_1ndkx_58 ._a_1ndkx_27 b{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-weight:var(--font-weight-text-regular);cursor:pointer}._calendar-block_1ndkx_58 ._a_1ndkx_27 b:hover{background:var(--black-10)}._calendar-block_1ndkx_58 ._a_1ndkx_27 b:active{color:var(--white);background:var(--sapphire-100)}._calendar-block_1ndkx_58 ._current_1ndkx_143{background:var(--sapphire-10);border-radius:var(--control-radius-s)}
|