mimir-ui-kit 1.35.2 → 1.35.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,102 +1,94 @@
1
- import { jsx as o, Fragment as z, jsxs as u } from "react/jsx-runtime";
2
- import { useRef as A, useState as F, useEffect as I } from "react";
3
- import { months as R } from "./constants.js";
4
- import { c as i } from "../../styles.module-BQZZ6FB1.js";
5
- import { Icon as S } from "../../icons/Icon.js";
6
- import { formating as c } from "../../utils/index.js";
7
- import { Button as C } from "../Button/Button.js";
8
- function K({
1
+ import { jsxs as l, jsx as n } from "react/jsx-runtime";
2
+ import { c as k } from "../../index-DIxK0V-G.js";
3
+ import { useState as $ } from "react";
4
+ import { months as x } from "./constants.js";
5
+ import { useDatePickerPosition as v } from "./hooks.js";
6
+ import { c as e } from "../../styles.module-Chnn6DA-.js";
7
+ import { Icon as B } from "../../icons/Icon.js";
8
+ import { formating as a } from "../../utils/index.js";
9
+ import { Button as b } from "../Button/Button.js";
10
+ const F = ({
9
11
  date: d,
10
- onChangeValue: H,
11
- before: f,
12
- onType: s
13
- }) {
14
- const t = A(null), a = new Date(d), m = new Date(d), p = {
15
- y: a.getFullYear(),
16
- d: a.getDate(),
17
- m: a.getMonth() + 1
18
- }, l = {
12
+ onChangeValue: D,
13
+ before: u,
14
+ onChangeType: i
15
+ }) => {
16
+ const h = v(), c = new Date(d), m = new Date(d), f = {
17
+ y: c.getFullYear(),
18
+ d: c.getDate(),
19
+ m: c.getMonth() + 1
20
+ }, s = {
19
21
  y: m.getFullYear(),
20
22
  d: m.getDate(),
21
23
  m: m.getMonth() + 1
22
- }, [n, h] = F(l.y), g = 368;
23
- I(() => {
24
- var N, y, x, D, b, k;
25
- const e = window.innerHeight, r = window.innerWidth;
26
- if (t.current !== null) {
27
- const j = ((y = (N = t == null ? void 0 : t.current) == null ? void 0 : N.parentElement) == null ? void 0 : y.offsetWidth) || 0, v = ((D = (x = t == null ? void 0 : t.current) == null ? void 0 : x.parentElement) == null ? void 0 : D.offsetHeight) || 0, $ = (k = (b = t == null ? void 0 : t.current) == null ? void 0 : b.parentElement) == null ? void 0 : k.getBoundingClientRect(), B = t.current.offsetHeight;
28
- e < $.y + B + v ? t.current.style.top = -B + "px" : t.current.style.top = v + "px", r < $.x + g && (t.current.style.left = j - g + "px"), t.current.style.opacity = "1";
29
- }
30
- }, []);
31
- const W = () => {
32
- h(n + 1);
33
- }, E = () => {
34
- h(n - 1);
35
- }, w = (e) => !!(f && f.getTime() > e), M = (e) => {
36
- w(
24
+ }, [t, p] = $(s.y), w = () => {
25
+ p(t + 1);
26
+ }, g = () => {
27
+ p(t - 1);
28
+ }, N = (r) => !!(u && u.getTime() > r), y = (r) => {
29
+ N(
37
30
  (/* @__PURE__ */ new Date(
38
- `${n}-${c.Number(2, e)}-${c.Number(2, l.d)}`
31
+ `${t}-${a.Number(2, r)}-${a.Number(2, s.d)}`
39
32
  )).getTime()
40
- ) || H(
33
+ ) || D(
41
34
  /* @__PURE__ */ new Date(
42
- `${n}-${c.Number(2, e)}-${c.Number(2, l.d)}`
35
+ `${t}-${a.Number(2, r)}-${a.Number(2, s.d)}`
43
36
  )
44
37
  );
45
38
  };
46
- return /* @__PURE__ */ o(z, { children: /* @__PURE__ */ u("div", { className: [i["calendar-block"]].join(" "), ref: t, children: [
47
- /* @__PURE__ */ u("div", { className: i.h, children: [
48
- /* @__PURE__ */ o(
49
- C,
39
+ return /* @__PURE__ */ l("div", { className: e["calendar-block"], ref: h, children: [
40
+ /* @__PURE__ */ l("div", { className: e.h, children: [
41
+ /* @__PURE__ */ n(
42
+ b,
50
43
  {
51
44
  isIconButton: !0,
52
45
  iconName: "DropdownArrowLeft16px",
53
- onClick: E,
46
+ onClick: g,
54
47
  variant: "secondary-gray",
55
48
  size: "l"
56
49
  }
57
50
  ),
58
- /* @__PURE__ */ u(
59
- "div",
51
+ /* @__PURE__ */ l(
52
+ "button",
60
53
  {
61
- onClick: () => s == null ? void 0 : s("years"),
62
- className: i.d,
54
+ type: "button",
55
+ onClick: () => i == null ? void 0 : i("years"),
56
+ className: e.d,
63
57
  "data-testid": "year-button",
64
58
  children: [
65
- n.toString(),
66
- /* @__PURE__ */ o(S, { iconName: "DropdownArrowBottom16px" })
59
+ t.toString(),
60
+ /* @__PURE__ */ n(B, { iconName: "DropdownArrowBottom16px" })
67
61
  ]
68
62
  }
69
63
  ),
70
- /* @__PURE__ */ o(
71
- C,
64
+ /* @__PURE__ */ n(
65
+ b,
72
66
  {
73
67
  isIconButton: !0,
74
68
  iconName: "DropdownArrowRight16px",
75
- onClick: W,
69
+ onClick: w,
76
70
  variant: "secondary-gray",
77
71
  size: "l"
78
72
  }
79
73
  )
80
74
  ] }),
81
- /* @__PURE__ */ o("div", { className: i.monthGrid, "data-testid": "month-picker", children: R.map((e, r) => /* @__PURE__ */ o(
82
- "div",
75
+ /* @__PURE__ */ n("div", { className: e.monthGrid, "data-testid": "month-picker", children: x.map((r, o) => /* @__PURE__ */ n(
76
+ "button",
83
77
  {
84
- className: w(
85
- (/* @__PURE__ */ new Date(`${n}-${c.Number(2, r + 1)}`)).getTime()
86
- ) ? i.m : i.a,
87
- children: /* @__PURE__ */ o(
88
- "b",
89
- {
90
- className: p.y === n && p.m === r + 1 ? i.current : "",
91
- onClick: () => M(r + 1),
92
- children: e
93
- }
94
- )
78
+ type: "button",
79
+ onClick: () => y(o + 1),
80
+ className: k(
81
+ N(
82
+ (/* @__PURE__ */ new Date(`${t}-${a.Number(2, o + 1)}`)).getTime()
83
+ ) ? e.m : e.a,
84
+ { [e.current]: f.y === t && f.m === o + 1 }
85
+ ),
86
+ children: r
95
87
  },
96
- r
88
+ o
97
89
  )) })
98
- ] }) });
99
- }
90
+ ] });
91
+ };
100
92
  export {
101
- K as MonthPickerModal
93
+ F as MonthPickerModal
102
94
  };
@@ -1,9 +1,8 @@
1
- type YearPickerModal = {
1
+ type TProps = {
2
2
  date: Date;
3
- onChangeValue: (d: Date) => void;
4
- setActive: (s: boolean) => void;
5
3
  before?: Date;
6
- onType?: (s: 'years') => void;
4
+ onChangeValue: (date: Date) => void;
5
+ onChangeType?: (type: 'years') => void;
7
6
  };
8
- export declare function YearPickerModal({ date, onChangeValue, before, onType }: YearPickerModal): import("react/jsx-runtime").JSX.Element;
7
+ export declare const YearPickerModal: ({ date, onChangeValue, before, onChangeType }: TProps) => import("react/jsx-runtime").JSX.Element;
9
8
  export {};
@@ -1,89 +1,89 @@
1
- import { jsx as r, Fragment as F, jsxs as B } from "react/jsx-runtime";
2
- import { useRef as M, useState as R, useEffect as I } from "react";
3
- import { c as n } from "../../styles.module-BQZZ6FB1.js";
4
- import { formating as c } from "../../utils/index.js";
5
- import { Button as C } from "../Button/Button.js";
6
- function q({
7
- date: u,
8
- onChangeValue: H,
9
- before: d,
10
- onType: i
11
- }) {
12
- const e = M(null), a = new Date(u), m = new Date(u), f = {
13
- y: a.getFullYear(),
14
- d: a.getDate(),
15
- m: a.getMonth() + 1
16
- }, o = {
17
- y: m.getFullYear(),
18
- d: m.getDate(),
19
- m: m.getMonth() + 1
20
- }, [l, p] = R(o.y), g = 368, W = l - 7, Y = Array.from(Array(15).keys()).map((t) => t + W);
21
- I(() => {
22
- var w, y, N, x, D, b;
23
- const t = window.innerHeight, s = window.innerWidth;
24
- if (e.current !== null) {
25
- const z = ((y = (w = e == null ? void 0 : e.current) == null ? void 0 : w.parentElement) == null ? void 0 : y.offsetWidth) || 0, k = ((x = (N = e == null ? void 0 : e.current) == null ? void 0 : N.parentElement) == null ? void 0 : x.offsetHeight) || 0, v = (b = (D = e == null ? void 0 : e.current) == null ? void 0 : D.parentElement) == null ? void 0 : b.getBoundingClientRect(), $ = e.current.offsetHeight;
26
- t < v.y + $ + k ? e.current.style.top = -$ + "px" : e.current.style.top = k + "px", s < v.x + g && (e.current.style.left = z - g + "px"), e.current.style.opacity = "1";
27
- }
28
- }, []);
29
- const A = () => {
30
- p(l + 15);
31
- }, E = () => {
32
- p(l - 15);
33
- }, h = (t) => !!(d && d.getTime() > t), j = (t) => {
34
- h(
1
+ import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
+ import { c as v } from "../../index-DIxK0V-G.js";
3
+ import { useState as x } from "react";
4
+ import { useDatePickerPosition as Y } from "./hooks.js";
5
+ import { c as t } from "../../styles.module-Chnn6DA-.js";
6
+ import { formating as n } from "../../utils/index.js";
7
+ import { Button as y } from "../Button/Button.js";
8
+ const F = ({
9
+ date: m,
10
+ onChangeValue: b,
11
+ before: l,
12
+ onChangeType: a
13
+ }) => {
14
+ const D = Y(), s = new Date(m), c = new Date(m), u = {
15
+ y: s.getFullYear(),
16
+ d: s.getDate(),
17
+ m: s.getMonth() + 1
18
+ }, r = {
19
+ y: c.getFullYear(),
20
+ d: c.getDate(),
21
+ m: c.getMonth() + 1
22
+ }, [i, d] = x(r.y), g = i - 7, k = Array.from(Array(15).keys()).map((e) => e + g), w = () => {
23
+ d(i + 15);
24
+ }, $ = () => {
25
+ d(i - 15);
26
+ }, f = (e) => !!(l && l.getTime() > e), h = (e) => {
27
+ f(
35
28
  (/* @__PURE__ */ new Date(
36
- `${t}-${c.Number(2, o.m)}-${c.Number(2, o.d)}`
29
+ `${e}-${n.Number(2, r.m)}-${n.Number(2, r.d)}`
37
30
  )).getTime()
38
- ) || H(
31
+ ) || b(
39
32
  /* @__PURE__ */ new Date(
40
- `${t}-${c.Number(2, o.m)}-${c.Number(2, o.d)}`
33
+ `${e}-${n.Number(2, r.m)}-${n.Number(2, r.d)}`
41
34
  )
42
35
  );
43
36
  };
44
- return /* @__PURE__ */ r(F, { children: /* @__PURE__ */ B("div", { className: [n["calendar-block"]].join(" "), ref: e, children: [
45
- /* @__PURE__ */ B("div", { className: n.h, children: [
46
- /* @__PURE__ */ r(
47
- C,
37
+ return /* @__PURE__ */ p("div", { className: t["calendar-block"], ref: D, children: [
38
+ /* @__PURE__ */ p("div", { className: t.h, children: [
39
+ /* @__PURE__ */ o(
40
+ y,
48
41
  {
49
42
  isIconButton: !0,
50
43
  iconName: "DropdownArrowLeft16px",
51
- onClick: E,
44
+ onClick: $,
52
45
  variant: "secondary-gray",
53
46
  size: "l"
54
47
  }
55
48
  ),
56
- /* @__PURE__ */ r("div", { onClick: () => i == null ? void 0 : i("years"), className: n.d }),
57
- /* @__PURE__ */ r(
58
- C,
49
+ /* @__PURE__ */ o(
50
+ "button",
51
+ {
52
+ type: "button",
53
+ onClick: () => a == null ? void 0 : a("years"),
54
+ className: t.d
55
+ }
56
+ ),
57
+ /* @__PURE__ */ o(
58
+ y,
59
59
  {
60
60
  isIconButton: !0,
61
61
  iconName: "DropdownArrowRight16px",
62
- onClick: A,
62
+ onClick: w,
63
63
  variant: "secondary-gray",
64
64
  size: "l"
65
65
  }
66
66
  )
67
67
  ] }),
68
- /* @__PURE__ */ r("div", { className: n.monthGrid, "data-testid": "year-picker", children: Y.map((t, s) => /* @__PURE__ */ r(
69
- "div",
68
+ /* @__PURE__ */ o("div", { className: t.monthGrid, "data-testid": "year-picker", children: k.map((e, N) => /* @__PURE__ */ o(
69
+ "button",
70
70
  {
71
- className: h(
72
- (/* @__PURE__ */ new Date(`${t}-${c.Number(2, f.m)}`)).getTime()
73
- ) ? n.m : n.a,
74
- children: /* @__PURE__ */ r(
75
- "b",
71
+ type: "button",
72
+ onClick: () => h(e),
73
+ className: v(
74
+ f(
75
+ (/* @__PURE__ */ new Date(`${e}-${n.Number(2, u.m)}`)).getTime()
76
+ ) ? t.m : t.a,
76
77
  {
77
- className: f.y === t ? n.current : "",
78
- onClick: () => j(t),
79
- children: t
78
+ [t.current]: u.y === e
80
79
  }
81
- )
80
+ ),
81
+ children: e
82
82
  },
83
- s
83
+ N
84
84
  )) })
85
- ] }) });
86
- }
85
+ ] });
86
+ };
87
87
  export {
88
- q as YearPickerModal
88
+ F as YearPickerModal
89
89
  };
@@ -10,3 +10,8 @@ export declare enum EDatePickerValue {
10
10
  CurrentDate = "20240510",
11
11
  CurrentDate3 = "2024-09-10"
12
12
  }
13
+ export declare const BLOCK_WIDTH = 368;
14
+ export declare const COUNT_WORK_DAYS = 4;
15
+ export declare const MAX_DAY = 31;
16
+ export declare const MAX_MONTH = 12;
17
+ export declare const DATE_LENGTH = 10;
@@ -1,5 +1,5 @@
1
- var t = /* @__PURE__ */ ((r) => (r.CurrentDate1 = "2024-08-01", r.CurrentDate2 = "2024-07-01", r.CurrentDate3 = "1995-07-11", r))(t || {});
2
- const u = ["пн", "вт", "ср", "чт", "пт", "сб", "вс"], C = [
1
+ var n = /* @__PURE__ */ ((t) => (t.CurrentDate1 = "2024-08-01", t.CurrentDate2 = "2024-07-01", t.CurrentDate3 = "1995-07-11", t))(n || {});
2
+ const s = ["пн", "вт", "ср", "чт", "пт", "сб", "вс"], C = [
3
3
  "Январь",
4
4
  "Февраль",
5
5
  "Март",
@@ -13,10 +13,16 @@ const u = ["пн", "вт", "ср", "чт", "пт", "сб", "вс"], C = [
13
13
  "Ноябрь",
14
14
  "Декабрь"
15
15
  ];
16
- var n = /* @__PURE__ */ ((r) => (r.CurrentDate1 = "", r.CurrentDate = "20240510", r.CurrentDate3 = "2024-09-10", r))(n || {});
16
+ var r = /* @__PURE__ */ ((t) => (t.CurrentDate1 = "", t.CurrentDate = "20240510", t.CurrentDate3 = "2024-09-10", t))(r || {});
17
+ const o = 368, u = 4, _ = 31, A = 12, T = 10;
17
18
  export {
18
- t as EDatePickerBeforeDate,
19
- n as EDatePickerValue,
19
+ o as BLOCK_WIDTH,
20
+ u as COUNT_WORK_DAYS,
21
+ T as DATE_LENGTH,
22
+ n as EDatePickerBeforeDate,
23
+ r as EDatePickerValue,
24
+ _ as MAX_DAY,
25
+ A as MAX_MONTH,
20
26
  C as months,
21
- u as week
27
+ s as week
22
28
  };
@@ -0,0 +1,3 @@
1
+ import { DependencyList } from 'react';
2
+
3
+ export declare const useDatePickerPosition: (deps?: DependencyList) => import('react').RefObject<HTMLDivElement>;
@@ -0,0 +1,16 @@
1
+ import { useRef as a, useEffect as g } from "react";
2
+ import { BLOCK_WIDTH as p } from "./constants.js";
3
+ const H = (d) => {
4
+ const t = a(null);
5
+ return g(() => {
6
+ var e, n, i, o, r, c;
7
+ const f = window.innerHeight, h = window.innerWidth;
8
+ if (t.current !== null) {
9
+ const w = ((n = (e = t == null ? void 0 : t.current) == null ? void 0 : e.parentElement) == null ? void 0 : n.offsetWidth) ?? 0, s = ((o = (i = t == null ? void 0 : t.current) == null ? void 0 : i.parentElement) == null ? void 0 : o.offsetHeight) ?? 0, u = (c = (r = t == null ? void 0 : t.current) == null ? void 0 : r.parentElement) == null ? void 0 : c.getBoundingClientRect(), l = t.current.offsetHeight;
10
+ f < u.y + l + s ? t.current.style.top = -l + "px" : t.current.style.top = s + "px", h < u.x + p && (t.current.style.left = w - p + "px"), t.current.style.opacity = "1";
11
+ }
12
+ }, [d]), t;
13
+ };
14
+ export {
15
+ H as useDatePickerPosition
16
+ };
@@ -1,2 +1,2 @@
1
1
  export { DatePicker } from './DatePicker';
2
- export type { DatePicker as TDatePickerProps, TDatePickerValue } from './DatePicker';
2
+ export type { TProps as TDatePickerProps, TDatePickerValue } from './DatePicker';
@@ -1,2 +1,6 @@
1
1
  export declare const formatDatePart: (value: string, max: number) => string;
2
2
  export declare const getFullYear: (year: string) => number;
3
+ export declare const getUpdateDate: (m: number, y: number) => {
4
+ y: number;
5
+ m: number;
6
+ };
@@ -1,8 +1,9 @@
1
- const o = (r, t) => parseInt(r) > t ? t.toString() : r, c = (r) => {
2
- const t = (/* @__PURE__ */ new Date()).getFullYear(), e = Math.floor(t / 100) * 100, n = parseInt(r) + e;
3
- return n > t + 20 ? n - 100 : n;
4
- };
1
+ const o = (t, r) => parseInt(t) > r ? r.toString() : t, a = (t) => {
2
+ const r = (/* @__PURE__ */ new Date()).getFullYear(), e = Math.floor(r / 100) * 100, n = parseInt(t) + e;
3
+ return n > r + 20 ? n - 100 : n;
4
+ }, c = (t, r) => (r = t > 12 ? r + 1 : t < 1 ? r - 1 : r, t = t > 12 ? 1 : t < 1 ? 12 : t, { y: r, m: t });
5
5
  export {
6
6
  o as formatDatePart,
7
- c as getFullYear
7
+ a as getFullYear,
8
+ c as getUpdateDate
8
9
  };
@@ -32,7 +32,7 @@ import '../../assets/Image.css';const k = "_picture_9zemz_2", x = "_image_9zemz_
32
32
  [s.loading]: a
33
33
  }),
34
34
  children: [
35
- r && /* @__PURE__ */ i("source", { srcSet: r, media: N.S }),
35
+ r && /* @__PURE__ */ i("source", { srcSet: r, media: N.XS1 }),
36
36
  e && /* @__PURE__ */ i("source", { srcSet: e, media: S.S }),
37
37
  /* @__PURE__ */ i(
38
38
  "img",
@@ -0,0 +1,24 @@
1
+ import './assets/styles.css';const _ = "_input_yyf2c_2", t = "_inputBorderControl_yyf2c_14", c = "_editable_yyf2c_27", r = "_wrapper_yyf2c_50", n = "_active_yyf2c_56", o = "_button_yyf2c_44", y = "_h_yyf2c_100", e = "_b_yyf2c_44", p = "_d_yyf2c_10", a = "_m_yyf2c_122", f = "_a_yyf2c_56", s = "_prev_yyf2c_124", i = "_orange_yyf2c_138", d = "_current_yyf2c_155", u = "_monthGrid_yyf2c_160", b = {
2
+ input: _,
3
+ "input-wrapper": "_input-wrapper_yyf2c_6",
4
+ "date-wrapper": "_date-wrapper_yyf2c_10",
5
+ inputBorderControl: t,
6
+ editable: c,
7
+ "button-wrapper": "_button-wrapper_yyf2c_44",
8
+ wrapper: r,
9
+ active: n,
10
+ button: o,
11
+ "calendar-block": "_calendar-block_yyf2c_78",
12
+ h: y,
13
+ b: e,
14
+ d: p,
15
+ m: a,
16
+ a: f,
17
+ prev: s,
18
+ orange: i,
19
+ current: d,
20
+ monthGrid: u
21
+ };
22
+ export {
23
+ b as c
24
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.35.2",
4
+ "version": "1.35.3",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -1,25 +0,0 @@
1
- import './assets/styles.css';const o = "_input_1uohj_2", _ = "_inputBorderControl_1uohj_14", t = "_editable_1uohj_27", r = "_wrapper_1uohj_50", n = "_active_1uohj_56", e = "_button_1uohj_44", u = "_h_1uohj_107", p = "_b_1uohj_44", a = "_d_1uohj_10", c = "_m_1uohj_128", h = "_a_1uohj_56", j = "_prev_1uohj_130", i = "_orange_1uohj_146", d = "_current_1uohj_171", s = "_monthGrid_1uohj_176", l = {
2
- input: o,
3
- "input-wrapper": "_input-wrapper_1uohj_6",
4
- "date-wrapper": "_date-wrapper_1uohj_10",
5
- inputBorderControl: _,
6
- editable: t,
7
- "button-wrapper": "_button-wrapper_1uohj_44",
8
- wrapper: r,
9
- active: n,
10
- button: e,
11
- "field-overlow": "_field-overlow_1uohj_78",
12
- "calendar-block": "_calendar-block_1uohj_84",
13
- h: u,
14
- b: p,
15
- d: a,
16
- m: c,
17
- a: h,
18
- prev: j,
19
- orange: i,
20
- current: d,
21
- monthGrid: s
22
- };
23
- export {
24
- l as c
25
- };