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.
Files changed (36) hide show
  1. package/dist/assets/ListFiles.css +1 -0
  2. package/dist/assets/ListPhotos.css +1 -1
  3. package/dist/assets/Uploader.css +1 -1
  4. package/dist/assets/UploaderPhotos.css +1 -1
  5. package/dist/assets/styles.css +1 -0
  6. package/dist/components/DatePicker/DatePicker.d.ts +12 -0
  7. package/dist/components/DatePicker/DatePicker.js +87 -18
  8. package/dist/components/DatePicker/DatePickerModal.d.ts +2 -1
  9. package/dist/components/DatePicker/DatePickerModal.js +182 -7
  10. package/dist/components/DatePicker/MonthPickerModal.d.ts +9 -0
  11. package/dist/components/DatePicker/MonthPickerModal.js +123 -0
  12. package/dist/components/DatePicker/YearPickerModal.d.ts +9 -0
  13. package/dist/components/DatePicker/YearPickerModal.js +120 -0
  14. package/dist/components/DatePicker/constants.d.ts +1 -0
  15. package/dist/components/DatePicker/constants.js +15 -0
  16. package/dist/components/ListFiles/ListFiles.d.ts +26 -0
  17. package/dist/components/ListFiles/ListFiles.js +45 -0
  18. package/dist/components/ListFiles/constants.d.ts +3 -0
  19. package/dist/components/ListFiles/constants.js +33 -0
  20. package/dist/components/ListFiles/index.d.ts +2 -0
  21. package/dist/components/ListFiles/index.js +4 -0
  22. package/dist/components/ListPhotos/ListPhotos.js +1 -1
  23. package/dist/components/Uploader/Uploader.js +5 -5
  24. package/dist/components/UploaderFiles/UploaderFiles.d.ts +38 -0
  25. package/dist/components/UploaderFiles/UploaderFiles.js +68 -0
  26. package/dist/components/UploaderFiles/index.d.ts +2 -0
  27. package/dist/components/UploaderFiles/index.js +4 -0
  28. package/dist/components/UploaderPhotos/UploaderPhotos.js +2 -2
  29. package/dist/styles.module-BZXDqssF.js +36 -0
  30. package/dist/utils/formating/FileSize.d.ts +1 -0
  31. package/dist/utils/formating/FileSize.js +15 -0
  32. package/dist/utils/index.d.ts +2 -0
  33. package/dist/utils/index.js +3 -1
  34. package/package.json +1 -1
  35. package/dist/DatePickerModal-BM0BgzTb.js +0 -204
  36. package/dist/assets/DatePickerModal.css +0 -1
@@ -0,0 +1 @@
1
+ ._file-info_1qfel_2{display:flex;flex-direction:column;gap:var(--space-xs);overflow:hidden}._file-info_1qfel_2 ._file-info-size_1qfel_8{font-family:var(--font-inter),sans-serif;font-size:var(--size-text-m);font-weight:var(--font-weight-text-regular);line-height:var(--line-height-text-xxs);text-align:left;color:var(--disabled-color)}._file-info_1qfel_2 ._file-info-name-wrapper_1qfel_16{display:table;table-layout:fixed;width:100%}._file-info_1qfel_2 ._file-info-name-wrapper_1qfel_16 ._file-info-name_1qfel_16{font-family:var(--font-inter),sans-serif;font-size:var(--size-text-l2);font-weight:var(--font-weight-text-regular);line-height:var(--line-height-text-xl);text-align:left;color:var(--black-100);display:table-cell;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._file-upload-container_1qfel_34{display:flex;flex-direction:column;width:100%;padding-left:0;margin-bottom:0;gap:var(--space-xs)}._file-upload-container_1qfel_34 ._file-upload-container-item_1qfel_42{display:flex;justify-content:space-between;align-items:center;background:var(--white);position:relative;padding:var(--space-xs) var(--space-m);border-radius:var(--control-radius)}._file-upload-container_1qfel_34 ._file-upload-container-item_1qfel_42 button{background:var(--black-5);position:absolute;right:var(--space-2xs);top:var(--space-2xs)}._file-upload-container_1qfel_34 ._file-upload-container-item_1qfel_42 span{display:flex}
@@ -1 +1 @@
1
- ._list-photos_19pfh_2{display:flex;gap:var(--space-m);overflow-x:auto}._list-photos_19pfh_2::-webkit-scrollbar{display:none}._list-photos_19pfh_2 li{position:relative;flex-shrink:0;width:64px;height:64px;overflow:hidden;border-radius:var(--control-radius);box-shadow:0 0 #16172705,0 2px 4px #16172705,0 6px 6px #16172705,0 15px 9px #16172703}._list-photos_19pfh_2 img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}._list-photos_19pfh_2 button{position:absolute;top:4px;right:4px}
1
+ ._list-photos_16pts_2{display:flex;gap:var(--space-m);overflow-x:auto}._list-photos_16pts_2::-webkit-scrollbar{display:none}._list-photos_16pts_2 li{position:relative;flex-shrink:0;width:var(--space-4xxl);height:var(--space-4xxl);overflow:hidden;border-radius:var(--control-radius);box-shadow:0 0 #16172705,0 2px 4px #16172705,0 6px 6px #16172705,0 15px 9px #16172703}._list-photos_16pts_2 img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}._list-photos_16pts_2 button{position:absolute;top:var(--space-2xs);right:var(--space-2xs)}
@@ -1 +1 @@
1
- ._upload-file__wrapper_165vi_2{position:relative;width:100%}._upload-file__wrapper_165vi_2 label{display:flex;flex-direction:column;gap:var(--space-m);align-items:center;justify-content:center}._upload-file__wrapper_165vi_2 label button{z-index:1}._upload-file__wrapper_165vi_2 label b{color:var(--black-100);font-weight:var(--font-weight-text-regular);font-size:var(--size-text-l2);font-family:var(--font-inter);font-style:normal;line-height:130%;text-align:center}._upload-file__wrapper_165vi_2 label ._upload-text_165vi_25{color:var(--disabled-color);font-weight:var(--font-weight-text-regular);font-size:var(--size-text-m);font-family:var(--font-inter);font-style:normal;line-height:var(--line-height-text-xxs);text-align:center}._upload-file-input_165vi_35{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;opacity:0}
1
+ ._upload-file-wrapper_n3hxs_2{position:relative;width:100%}._upload-file-wrapper_n3hxs_2 label{display:flex;flex-direction:column;gap:var(--space-m);align-items:center;justify-content:center}._upload-file-wrapper_n3hxs_2 label button{z-index:1}._upload-file-wrapper_n3hxs_2 label b{color:var(--black-100);font-weight:var(--font-weight-text-regular);font-size:var(--size-text-l2);font-family:var(--font-inter);font-style:normal;line-height:130%;text-align:center}._upload-file-wrapper_n3hxs_2 label ._upload-text_n3hxs_25{color:var(--disabled-color);font-weight:var(--font-weight-text-regular);font-size:var(--size-text-m);font-family:var(--font-inter);font-style:normal;line-height:var(--line-height-text-xxs);text-align:center}._upload-file-input_n3hxs_35{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;opacity:0}
@@ -1 +1 @@
1
- ._upload-file__wrapper_17bcu_2{display:flex;flex-direction:column;gap:var(--space-m);overflow:hidden}
1
+ ._upload-file-wrapper_2zki8_2{display:flex;flex-direction:column;gap:var(--space-m);overflow:hidden}
@@ -0,0 +1 @@
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)}
@@ -14,6 +14,12 @@ export type DatePicker = {
14
14
  * значение из стейта (data)
15
15
  */
16
16
  value?: string;
17
+ /**
18
+ * значение типа модально окна календаря
19
+ */
20
+ type?: 'days' | 'months' | 'years';
21
+ disabled?: boolean;
22
+ error?: boolean;
17
23
  } & TInputProps;
18
24
  export type TDatePickerValue = {
19
25
  value?: Date;
@@ -33,4 +39,10 @@ export declare const DatePicker: import('react').MemoExoticComponent<import('rea
33
39
  * значение из стейта (data)
34
40
  */
35
41
  value?: string;
42
+ /**
43
+ * значение типа модально окна календаря
44
+ */
45
+ type?: "days" | "months" | "years";
46
+ disabled?: boolean;
47
+ error?: boolean;
36
48
  } & import('../Input/types').TInputProps & import('../Input').TAdditionalProps & import('react').RefAttributes<HTMLInputElement>>>;
@@ -1,44 +1,92 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { c as classNames } from "../../index-CweZ_OcN.js";
3
- import { memo, forwardRef, useState } from "react";
4
- import { c as cls, D as DatePickerModal } from "../../DatePickerModal-BM0BgzTb.js";
3
+ import { memo, forwardRef, useState, useEffect } from "react";
4
+ import { DatePickerModal } from "./DatePickerModal.js";
5
+ import { MonthPickerModal } from "./MonthPickerModal.js";
6
+ import { c as cls } from "../../styles.module-BZXDqssF.js";
7
+ import { YearPickerModal } from "./YearPickerModal.js";
5
8
  import { useClickOutside } from "../../hooks/useClickOutside/useClickOutside.js";
6
9
  import { formating } from "../../utils/index.js";
7
10
  import { Button } from "../Button/Button.js";
8
11
  import { I as Input } from "../../Input-6mudFqTb.js";
12
+ import { EInputVariant } from "../Input/constants.js";
9
13
  const DatePicker = memo(
10
14
  forwardRef(
11
- ({ size, value, onChangeValue, name, before, ...props }, ref) => {
15
+ ({
16
+ size,
17
+ value,
18
+ onChangeValue,
19
+ name,
20
+ before,
21
+ type = "days",
22
+ error,
23
+ variant,
24
+ disabled = false,
25
+ ...props
26
+ }, ref) => {
12
27
  const [isActive, setActive] = useState(false);
28
+ const [pickerType, setType] = useState(type);
13
29
  const [date, setDate] = useState(
14
30
  value ? new Date(value) : /* @__PURE__ */ new Date()
15
31
  );
32
+ const [isError, setError] = useState(error);
33
+ useEffect(() => {
34
+ setError(error);
35
+ }, [error]);
16
36
  useClickOutside({
17
37
  isActive,
18
- setActive,
38
+ setActive: (e) => {
39
+ setActive(e);
40
+ setType(type);
41
+ },
19
42
  className: cls["calendar-block"]
20
43
  });
21
44
  const onOpen = () => {
22
- setActive(true);
45
+ if (!disabled) setActive(true);
23
46
  };
24
47
  const onDate = (d) => {
48
+ if (pickerType === "years") {
49
+ if (type === "years") {
50
+ setActive(false);
51
+ setType(type);
52
+ } else {
53
+ setType("months");
54
+ }
55
+ }
56
+ if (pickerType === "months") {
57
+ if (type === "months") {
58
+ setActive(false);
59
+ setType(type);
60
+ } else {
61
+ setType("days");
62
+ }
63
+ }
25
64
  setDate(d);
26
65
  onChangeValue == null ? void 0 : onChangeValue({ value: d, name });
27
66
  };
28
67
  const wrapperClassNames = classNames(cls.wrapper, isActive && cls.active);
29
- return /* @__PURE__ */ jsxs("div", { className: wrapperClassNames, children: [
30
- /* @__PURE__ */ jsx("div", { className: cls["date-wrapper"], onClick: onOpen, children: /* @__PURE__ */ jsx(
31
- Input,
68
+ return /* @__PURE__ */ jsxs("div", { className: wrapperClassNames, "data-disabled": disabled, children: [
69
+ /* @__PURE__ */ jsx(
70
+ "div",
32
71
  {
33
- ref,
34
- className: cls.input,
35
- wrapperClassName: cls["input-wrapper"],
36
- size,
37
- type: "text",
38
- value: formating.Date(date, "dd.mm.yy"),
39
- ...props
72
+ "data-error": isError,
73
+ className: cls["date-wrapper"],
74
+ onClick: onOpen,
75
+ children: /* @__PURE__ */ jsx(
76
+ Input,
77
+ {
78
+ ref,
79
+ className: cls.input,
80
+ wrapperClassName: cls["input-wrapper"],
81
+ size,
82
+ type: "text",
83
+ variant: isError ? EInputVariant.Error : variant,
84
+ value: formating.Date(date, "dd.mm.yy"),
85
+ ...props
86
+ }
87
+ )
40
88
  }
41
- ) }),
89
+ ),
42
90
  /* @__PURE__ */ jsx("div", { className: cls["button-wrapper"], children: /* @__PURE__ */ jsx(
43
91
  Button,
44
92
  {
@@ -50,13 +98,34 @@ const DatePicker = memo(
50
98
  iconName: isActive ? "DropdownArrowUp16px" : "DropdownArrowBottom16px"
51
99
  }
52
100
  ) }),
53
- isActive && /* @__PURE__ */ jsx(
101
+ pickerType === "days" && isActive && /* @__PURE__ */ jsx(
54
102
  DatePickerModal,
55
103
  {
56
104
  onChangeValue: onDate,
57
105
  date,
58
106
  setActive,
59
- before: typeof before === "string" ? new Date(before) : before
107
+ before: typeof before === "string" ? new Date(before) : before,
108
+ onType: setType
109
+ }
110
+ ),
111
+ pickerType === "months" && isActive && /* @__PURE__ */ jsx(
112
+ MonthPickerModal,
113
+ {
114
+ onChangeValue: onDate,
115
+ date,
116
+ setActive,
117
+ before: typeof before === "string" ? new Date(before) : before,
118
+ onType: setType
119
+ }
120
+ ),
121
+ pickerType === "years" && isActive && /* @__PURE__ */ jsx(
122
+ YearPickerModal,
123
+ {
124
+ onChangeValue: onDate,
125
+ date,
126
+ setActive,
127
+ before: typeof before === "string" ? new Date(before) : before,
128
+ onType: setType
60
129
  }
61
130
  )
62
131
  ] });
@@ -3,6 +3,7 @@ type DatePickerModal = {
3
3
  onChangeValue: (d: Date) => void;
4
4
  setActive: (s: boolean) => void;
5
5
  before?: Date;
6
+ onType?: (s: 'days' | 'months' | 'years') => void;
6
7
  };
7
- export declare function DatePickerModal({ date, onChangeValue, setActive, before }: DatePickerModal): import("react/jsx-runtime").JSX.Element;
8
+ export declare function DatePickerModal({ date, onChangeValue, setActive, before, onType }: DatePickerModal): import("react/jsx-runtime").JSX.Element;
8
9
  export {};
@@ -1,9 +1,184 @@
1
- import "react/jsx-runtime";
2
- import "react";
3
- import "./constants.js";
4
- import { D } from "../../DatePickerModal-BM0BgzTb.js";
5
- import "../../utils/index.js";
6
- import "../Button/Button.js";
1
+ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
+ import { useRef, useState, useEffect } from "react";
3
+ import { week } 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 DatePickerModal({
9
+ date,
10
+ onChangeValue,
11
+ setActive,
12
+ before,
13
+ onType
14
+ }) {
15
+ const field = useRef(null);
16
+ const _current = new Date(date);
17
+ const _selecte = new Date(date);
18
+ const current = {
19
+ y: _current.getFullYear(),
20
+ d: _current.getDate(),
21
+ m: _current.getMonth() + 1
22
+ };
23
+ const selecte = {
24
+ y: _selecte.getFullYear(),
25
+ d: _selecte.getDate(),
26
+ m: _selecte.getMonth() + 1
27
+ };
28
+ const countWorkDays = 4;
29
+ const [month, setMonth] = useState({ y: selecte.y, m: selecte.m });
30
+ const blockWidth = 368;
31
+ useEffect(() => {
32
+ var _a, _b, _c, _d;
33
+ const windowHeight = window.innerHeight;
34
+ const windowWidth = window.innerWidth;
35
+ if (field.current !== null) {
36
+ const inputWidth = ((_b = (_a = field == null ? void 0 : field.current) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.offsetWidth) || 0;
37
+ const inputHeight = (_d = (_c = field == null ? void 0 : field.current) == null ? void 0 : _c.parentElement) == null ? void 0 : _d.offsetHeight;
38
+ const inputPosition = field.current.getBoundingClientRect();
39
+ const calendarSize = field.current.offsetHeight;
40
+ if (windowHeight < inputPosition.y + calendarSize) {
41
+ field.current.style.top = -calendarSize + "px";
42
+ } else {
43
+ field.current.style.top = inputHeight + "px";
44
+ }
45
+ if (windowWidth < inputPosition.x + blockWidth) {
46
+ field.current.style.left = inputWidth - blockWidth + "px";
47
+ }
48
+ field.current.style.opacity = "1";
49
+ }
50
+ }, [month]);
51
+ const countPrevDays = (e) => {
52
+ let dayOfWeek = e.getDay();
53
+ if (dayOfWeek === 0) dayOfWeek = 7;
54
+ return dayOfWeek - 1;
55
+ };
56
+ const currentMonthIndex = month.m - 1;
57
+ const currentMonthFull = new Date(month.y, currentMonthIndex);
58
+ const days = [];
59
+ const prevDays = () => {
60
+ const prevMonth = new Date(currentMonthFull);
61
+ prevMonth.setDate(prevMonth.getDate() - 1);
62
+ const lastDayPrevMohth = prevMonth.getDate();
63
+ const prevList = [];
64
+ for (let i = 0; i < countPrevDays(currentMonthFull); i++) {
65
+ prevList.push(lastDayPrevMohth - i);
66
+ }
67
+ prevList.reverse();
68
+ return prevList;
69
+ };
70
+ const prevDaysArray = prevDays();
71
+ while (currentMonthFull.getMonth() === currentMonthIndex) {
72
+ days.push(currentMonthFull.getDate());
73
+ currentMonthFull.setDate(currentMonthFull.getDate() + 1);
74
+ }
75
+ const nextDays = () => {
76
+ const totalViewDays = 42;
77
+ const daysCount = totalViewDays - (prevDaysArray.length + days.length);
78
+ const nextList = [];
79
+ for (let i = 1; i <= daysCount; i++) {
80
+ nextList.push(i);
81
+ }
82
+ return nextList;
83
+ };
84
+ const nextDaysArray = nextDays();
85
+ const update = (m, y) => {
86
+ y = m > 12 ? y + 1 : m < 1 ? y - 1 : y;
87
+ m = m > 12 ? 1 : m < 1 ? 12 : m;
88
+ return { y, m };
89
+ };
90
+ const onExit = () => {
91
+ setActive(false);
92
+ };
93
+ const next = () => {
94
+ setMonth(update(month.m + 1, month.y));
95
+ };
96
+ const prev = () => {
97
+ setMonth(update(month.m - 1, month.y));
98
+ };
99
+ const isBefore = (activeDate) => {
100
+ if (before) {
101
+ const beforeDate = before.getTime();
102
+ if (beforeDate > activeDate) return true;
103
+ }
104
+ return false;
105
+ };
106
+ const send = (searchDate) => {
107
+ if (isBefore(
108
+ (/* @__PURE__ */ new Date(
109
+ `${month.y}-${formating.Number(2, month.m)}-${formating.Number(2, searchDate)}`
110
+ )).getTime()
111
+ ))
112
+ return;
113
+ onChangeValue(
114
+ /* @__PURE__ */ new Date(
115
+ `${month.y}-${formating.Number(2, month.m)}-${formating.Number(2, searchDate)}`
116
+ )
117
+ );
118
+ onExit();
119
+ };
120
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: [cls["calendar-block"]].join(" "), ref: field, children: [
121
+ /* @__PURE__ */ jsxs("div", { className: cls["h"], children: [
122
+ /* @__PURE__ */ jsx(
123
+ Button,
124
+ {
125
+ isIconButton: true,
126
+ iconName: "DropdownArrowLeft16px",
127
+ onClick: prev,
128
+ variant: "secondary-gray",
129
+ size: "l"
130
+ }
131
+ ),
132
+ /* @__PURE__ */ jsxs("div", { className: cls["d"], onClick: () => onType == null ? void 0 : onType("months"), children: [
133
+ formating.Month(month.m).name,
134
+ "’",
135
+ month.y.toString().slice(-2),
136
+ /* @__PURE__ */ jsx(Icon, { iconName: "DropdownArrowBottom16px" })
137
+ ] }),
138
+ /* @__PURE__ */ jsx(
139
+ Button,
140
+ {
141
+ isIconButton: true,
142
+ iconName: "DropdownArrowRight16px",
143
+ onClick: next,
144
+ variant: "secondary-gray",
145
+ size: "l"
146
+ }
147
+ )
148
+ ] }),
149
+ /* @__PURE__ */ jsxs("div", { className: cls["b"], children: [
150
+ week.map((i, s) => /* @__PURE__ */ jsx(
151
+ "div",
152
+ {
153
+ className: `${s > countWorkDays ? [cls["m"], cls["orange"]].join(" ") : cls["m"]}`,
154
+ children: i
155
+ },
156
+ `v${s}`
157
+ )),
158
+ prevDaysArray.map((el, key) => /* @__PURE__ */ jsx("div", { className: cls["m"], children: el }, key)),
159
+ days.map((i, s) => /* @__PURE__ */ jsx(
160
+ "div",
161
+ {
162
+ className: isBefore(
163
+ (/* @__PURE__ */ new Date(
164
+ `${month.y}-${formating.Number(2, month.m)}-${formating.Number(2, i)}`
165
+ )).getTime()
166
+ ) ? cls["m"] : cls["a"],
167
+ children: i !== 0 ? /* @__PURE__ */ jsx(
168
+ "b",
169
+ {
170
+ className: current.y === month.y && current.m === month.m && current.d === i ? cls["current"] : "",
171
+ onClick: () => send(i),
172
+ children: i
173
+ }
174
+ ) : /* @__PURE__ */ jsx("p", {})
175
+ },
176
+ s
177
+ )),
178
+ nextDaysArray.map((el, key) => /* @__PURE__ */ jsx("div", { className: cls["m"], children: el }, key))
179
+ ] })
180
+ ] }) });
181
+ }
7
182
  export {
8
- D as DatePickerModal
183
+ DatePickerModal
9
184
  };
@@ -0,0 +1,9 @@
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 {};
@@ -0,0 +1,123 @@
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
+ };
@@ -0,0 +1,9 @@
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 {};
@@ -0,0 +1,120 @@
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
+ };
@@ -4,3 +4,4 @@ export declare enum EDatePickerBeforeDate {
4
4
  CurrentDate3 = "2024-07-11"
5
5
  }
6
6
  export declare const week: string[];
7
+ export declare const months: string[];