mimir-ui-kit 1.64.0 → 1.64.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.
@@ -1,24 +1,25 @@
1
- import { jsxs as b, jsx as c } from "react/jsx-runtime";
2
- import { c as j } from "../../index-DIxK0V-G.js";
3
- import { useState as z } from "react";
4
- import { useDatePickerPosition as I } from "./hooks.js";
5
- import { c as n } from "../../styles.module-DeBRSK_x.js";
6
- import { formating as F } from "../../utils/index.js";
7
- import { Button as P } from "../Button/Button.js";
8
- const p = 15, C = 7, X = ({
9
- date: v,
1
+ import { jsxs as P, jsx as c } from "react/jsx-runtime";
2
+ import { c as v } from "../../index-DIxK0V-G.js";
3
+ import { useState as I } from "react";
4
+ import { useDatePickerPosition as C } from "./hooks.js";
5
+ import { c as r } from "../../styles.module-DjQdoVeY.js";
6
+ import { formating as E } from "../../utils/index.js";
7
+ import { Button as F } from "../Button/Button.js";
8
+ const p = 15, L = 7, Z = ({
9
+ date: S,
10
10
  selectedDate: u,
11
- onChangeValue: E,
11
+ onChangeValue: _,
12
12
  before: Y,
13
13
  onChangeType: d,
14
14
  onChangeYear: N,
15
- disableFuture: S = !1,
16
- disablePast: _ = !1,
15
+ disableFuture: y = !1,
16
+ disablePast: G = !1,
17
17
  disabledDate: o,
18
18
  validRange: k,
19
- position: y
19
+ position: M,
20
+ isFixed: h
20
21
  }) => {
21
- const G = I(y), i = new Date(v), l = u ? new Date(u) : i, M = {
22
+ const Q = C(M, h), i = new Date(S), l = u ? new Date(u) : i, B = {
22
23
  y: l.getFullYear(),
23
24
  d: l.getDate(),
24
25
  m: l.getMonth() + 1
@@ -26,93 +27,100 @@ const p = 15, C = 7, X = ({
26
27
  y: i.getFullYear(),
27
28
  d: i.getDate(),
28
29
  m: i.getMonth() + 1
29
- }, [D, h] = z(e.y), Q = D - C, B = Array.from(Array(p).keys()).map(
30
- (t) => t + Q
31
- ), H = () => {
32
- h(D + p);
33
- }, R = () => {
34
- h(D - p);
35
- }, g = (t) => {
30
+ }, [D, g] = I(e.y), H = D - L, R = Array.from(Array(p).keys()).map(
31
+ (t) => t + H
32
+ ), $ = () => {
33
+ g(D + p);
34
+ }, j = () => {
35
+ g(D - p);
36
+ }, x = (t) => {
36
37
  const s = (/* @__PURE__ */ new Date()).getFullYear();
37
38
  if (k) {
38
39
  const [a, w] = k;
39
- let r;
40
+ let n;
40
41
  if (e.m && e.d)
41
- r = new Date(t, e.m - 1, e.d);
42
+ n = new Date(t, e.m - 1, e.d);
42
43
  else {
43
- const A = /* @__PURE__ */ new Date();
44
- r = new Date(t, A.getMonth(), A.getDate());
44
+ const b = /* @__PURE__ */ new Date();
45
+ n = new Date(t, b.getMonth(), b.getDate());
45
46
  }
46
- r.setHours(0, 0, 0, 0);
47
+ n.setHours(0, 0, 0, 0);
47
48
  const m = new Date(a), f = new Date(w);
48
- if (m.setHours(0, 0, 0, 0), f.setHours(23, 59, 59, 999), r < m || r > f)
49
+ if (m.setHours(0, 0, 0, 0), f.setHours(23, 59, 59, 999), n < m || n > f)
49
50
  return !0;
50
51
  }
51
- if (Y && Y.getFullYear() > t || S && t > s || _ && t < s)
52
+ if (Y && Y.getFullYear() > t || y && t > s || G && t < s)
52
53
  return !0;
53
54
  if (o) {
54
55
  const a = new Date(t, e.m - 1, e.d);
55
56
  if (!o(a)) return !1;
56
- const w = new Date(t, 2, 15), r = new Date(t, 5, 15), m = new Date(t, 8, 15), f = new Date(t, 11, 15);
57
- return o(w) && o(r) && o(m) && o(f);
57
+ const w = new Date(t, 2, 15), n = new Date(t, 5, 15), m = new Date(t, 8, 15), f = new Date(t, 11, 15);
58
+ return o(w) && o(n) && o(m) && o(f);
58
59
  }
59
60
  return !1;
60
- }, $ = (t) => {
61
- g(t) || (N ? N(t) : E(
61
+ }, z = (t) => {
62
+ x(t) || (N ? N(t) : _(
62
63
  /* @__PURE__ */ new Date(
63
- `${t}-${F.Number(2, e.m)}-${F.Number(2, e.d)}`
64
+ `${t}-${E.Number(2, e.m)}-${E.Number(2, e.d)}`
64
65
  )
65
66
  ));
66
67
  };
67
- return /* @__PURE__ */ b("div", { className: n["calendar-block"], ref: G, children: [
68
- /* @__PURE__ */ b("div", { className: n.h, children: [
69
- /* @__PURE__ */ c(
70
- P,
71
- {
72
- isIconButton: !0,
73
- iconName: "DropdownArrowLeft16px",
74
- onClick: R,
75
- variant: "secondary-gray",
76
- size: "l"
77
- }
78
- ),
79
- /* @__PURE__ */ c(
80
- "button",
81
- {
82
- type: "button",
83
- onClick: () => d == null ? void 0 : d("years"),
84
- className: n.d
85
- }
86
- ),
87
- /* @__PURE__ */ c(
88
- P,
89
- {
90
- isIconButton: !0,
91
- iconName: "DropdownArrowRight16px",
92
- onClick: H,
93
- variant: "secondary-gray",
94
- size: "l"
95
- }
96
- )
97
- ] }),
98
- /* @__PURE__ */ c("div", { className: n.monthGrid, "data-testid": "year-picker", children: B.map((t, x) => {
99
- const s = g(t);
100
- return /* @__PURE__ */ c(
101
- "button",
102
- {
103
- type: "button",
104
- onClick: () => $(t),
105
- disabled: s,
106
- className: j(s ? n.m : n.a, {
107
- [n.current]: u && M.y === t
108
- }),
109
- children: t
110
- },
111
- x
112
- );
113
- }) })
114
- ] });
68
+ return /* @__PURE__ */ P(
69
+ "div",
70
+ {
71
+ className: v(r["calendar-block"], h && r.fixed),
72
+ ref: Q,
73
+ children: [
74
+ /* @__PURE__ */ P("div", { className: r.h, children: [
75
+ /* @__PURE__ */ c(
76
+ F,
77
+ {
78
+ isIconButton: !0,
79
+ iconName: "DropdownArrowLeft16px",
80
+ onClick: j,
81
+ variant: "secondary-gray",
82
+ size: "l"
83
+ }
84
+ ),
85
+ /* @__PURE__ */ c(
86
+ "button",
87
+ {
88
+ type: "button",
89
+ onClick: () => d == null ? void 0 : d("years"),
90
+ className: r.d
91
+ }
92
+ ),
93
+ /* @__PURE__ */ c(
94
+ F,
95
+ {
96
+ isIconButton: !0,
97
+ iconName: "DropdownArrowRight16px",
98
+ onClick: $,
99
+ variant: "secondary-gray",
100
+ size: "l"
101
+ }
102
+ )
103
+ ] }),
104
+ /* @__PURE__ */ c("div", { className: r.monthGrid, "data-testid": "year-picker", children: R.map((t, A) => {
105
+ const s = x(t);
106
+ return /* @__PURE__ */ c(
107
+ "button",
108
+ {
109
+ type: "button",
110
+ onClick: () => z(t),
111
+ disabled: s,
112
+ className: v(s ? r.m : r.a, {
113
+ [r.current]: u && B.y === t
114
+ }),
115
+ children: t
116
+ },
117
+ A
118
+ );
119
+ }) })
120
+ ]
121
+ }
122
+ );
115
123
  };
116
124
  export {
117
- X as YearPickerModal
125
+ Z as YearPickerModal
118
126
  };
@@ -1,3 +1,3 @@
1
1
  import { DependencyList } from 'react';
2
2
 
3
- export declare const useDatePickerPosition: (position?: "center" | "bottom" | "top", deps?: DependencyList) => import('react').RefObject<HTMLDivElement>;
3
+ export declare const useDatePickerPosition: (position?: "center" | "bottom" | "top", isFixed?: boolean, deps?: DependencyList) => import('react').RefObject<HTMLDivElement>;
@@ -1,35 +1,35 @@
1
- import { useRef as d, useEffect as h } from "react";
2
- import { BLOCK_WIDTH as l, MAX_MOBILE_WIDTH as w } from "./constants.js";
3
- const H = (i, a) => {
4
- const f = d(null);
5
- return h(() => {
6
- var c, r, y;
7
- const x = window.innerHeight, p = window.innerWidth, t = f.current;
1
+ import { useRef as w, useEffect as d } from "react";
2
+ import { BLOCK_WIDTH as p, MAX_MOBILE_WIDTH as m } from "./constants.js";
3
+ const W = (n, i, x) => {
4
+ const f = w(null);
5
+ return d(() => {
6
+ var c, r, a;
7
+ const u = window.innerHeight, y = window.innerWidth, t = f.current;
8
8
  if (t && t !== null) {
9
- const u = ((c = t == null ? void 0 : t.parentElement) == null ? void 0 : c.offsetWidth) ?? 0, s = ((r = t == null ? void 0 : t.parentElement) == null ? void 0 : r.offsetHeight) ?? 0, o = (y = t == null ? void 0 : t.parentElement) == null ? void 0 : y.getBoundingClientRect(), e = t.offsetHeight;
10
- if (i) {
11
- if (i === "center") {
12
- t.style.position = "fixed", t.style.top = `calc(50vh - ${e / 2}px)`, t.style.left = `calc(50vw - ${l / 2}px)`, t.style.opacity = "1";
9
+ const h = ((c = t == null ? void 0 : t.parentElement) == null ? void 0 : c.offsetWidth) ?? 0, l = ((r = t == null ? void 0 : t.parentElement) == null ? void 0 : r.offsetHeight) ?? 0, e = (a = t == null ? void 0 : t.parentElement) == null ? void 0 : a.getBoundingClientRect(), s = t.offsetHeight;
10
+ if (n) {
11
+ if (n === "center") {
12
+ t.style.position = "fixed", t.style.top = `calc(50vh - ${s / 2}px)`, t.style.left = `calc(50vw - ${p / 2}px)`, t.style.opacity = "1";
13
13
  return;
14
14
  }
15
- if (i === "bottom") {
16
- t.style.top = s + "px", t.style.opacity = "1";
15
+ if (n === "bottom") {
16
+ t.style.top = l + "px", t.style.opacity = "1";
17
17
  return;
18
18
  }
19
- if (i === "top") {
20
- t.style.top = -e + "px", t.style.opacity = "1";
19
+ if (n === "top") {
20
+ t.style.top = -s + "px", t.style.opacity = "1";
21
21
  return;
22
22
  }
23
23
  } else {
24
- if (p < o.x + l) {
25
- const n = u - l;
26
- o.x - Math.abs(n) < 0 ? t.style.left = (n < 0 ? n / 2 : n) + "px" : t.style.left = n + "px";
24
+ if (y < e.x + p) {
25
+ const o = h - p;
26
+ e.x - Math.abs(o) < 0 ? t.style.left = (o < 0 ? o / 2 : o) + "px" : t.style.left = o + "px";
27
27
  }
28
- x < o.y + e + s ? o.y - e > 0 ? t.style.top = -e + "px" : p > w ? t.style.top = s + "px" : (t.style.position = "fixed", t.style.top = `calc(50vh - ${e / 2}px)`, t.style.left = `calc(50vw - ${l / 2}px)`) : t.style.top = s + "px", t.style.opacity = "1";
28
+ u < e.y + s + l ? e.y - s > 0 ? i ? t.style.top = e.y - s + "px" : t.style.top = -s + "px" : y > m ? i ? t.style.top = e.y + l + "px" : t.style.top = l + "px" : (t.style.position = "fixed", t.style.top = `calc(50vh - ${s / 2}px)`, t.style.left = `calc(50vw - ${p / 2}px)`) : i ? t.style.top = e.y + l + "px" : t.style.top = l + "px", t.style.opacity = "1";
29
29
  }
30
30
  }
31
- }, [a, i]), f;
31
+ }, [x, n, i]), f;
32
32
  };
33
33
  export {
34
- H as useDatePickerPosition
34
+ W as useDatePickerPosition
35
35
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import { Suspense as s } from "react";
3
- import { i as e } from "../index-DClkrDWX.js";
3
+ import { i as e } from "../index-CQCTAWGm.js";
4
4
  const p = ({ iconName: o, ...n }) => {
5
5
  const r = e[o];
6
6
  return r ? /* @__PURE__ */ t(s, { fallback: null, children: /* @__PURE__ */ t(r, { ...n, "data-testid": o }) }) : null;
@@ -0,0 +1,35 @@
1
+ import { jsxs as V, jsx as l } from "react/jsx-runtime";
2
+ const t = (H) => /* @__PURE__ */ V(
3
+ "svg",
4
+ {
5
+ width: "16",
6
+ height: "16",
7
+ viewBox: "0 0 16 16",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ ...H,
11
+ children: [
12
+ /* @__PURE__ */ l("path", { d: "M6 1V6H1V1H6ZM2 5H5V2H2V5Z", fill: "black" }),
13
+ /* @__PURE__ */ l("path", { d: "M6 10V15H1V10H6ZM2 14H5V11H2V14Z", fill: "black" }),
14
+ /* @__PURE__ */ l("path", { d: "M15 1V6H10V1H15ZM11 5H14V2H11V5Z", fill: "black" }),
15
+ /* @__PURE__ */ l("path", { d: "M4 3H3V4H4V3Z", fill: "black" }),
16
+ /* @__PURE__ */ l("path", { d: "M4 12H3V13H4V12Z", fill: "black" }),
17
+ /* @__PURE__ */ l("path", { d: "M2 7.5H1V8.5H2V7.5Z", fill: "black" }),
18
+ /* @__PURE__ */ l("path", { d: "M8.5 14H7.5V15H8.5V14Z", fill: "black" }),
19
+ /* @__PURE__ */ l("path", { d: "M12 14H11V15H12V14Z", fill: "black" }),
20
+ /* @__PURE__ */ l("path", { d: "M13 14H12V15H13V14Z", fill: "black" }),
21
+ /* @__PURE__ */ l("path", { d: "M8.5 11H7.5V13H8.5V11Z", fill: "black" }),
22
+ /* @__PURE__ */ l("path", { d: "M15 10H14V15H15V10Z", fill: "black" }),
23
+ /* @__PURE__ */ l("path", { d: "M11 11H10V15H11V11Z", fill: "black" }),
24
+ /* @__PURE__ */ l("path", { d: "M15 7.5H14V8.5H15V7.5Z", fill: "black" }),
25
+ /* @__PURE__ */ l("path", { d: "M12 7.5H11V9.5H12V7.5Z", fill: "black" }),
26
+ /* @__PURE__ */ l("path", { d: "M7 7.5H4V8.5H7V7.5Z", fill: "black" }),
27
+ /* @__PURE__ */ l("path", { d: "M12 9H7.5V10H12V9Z", fill: "black" }),
28
+ /* @__PURE__ */ l("path", { d: "M13 3H12V4H13V3Z", fill: "black" }),
29
+ /* @__PURE__ */ l("path", { d: "M7.5 1H8.5V6H7.5V1Z", fill: "black" })
30
+ ]
31
+ }
32
+ );
33
+ export {
34
+ t as default
35
+ };
@@ -0,0 +1,34 @@
1
+ import { jsxs as V, jsx as l } from "react/jsx-runtime";
2
+ const t = (H) => /* @__PURE__ */ V(
3
+ "svg",
4
+ {
5
+ width: "24",
6
+ height: "24",
7
+ viewBox: "0 0 24 24",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ ...H,
11
+ children: [
12
+ /* @__PURE__ */ l("path", { d: "M9 2V9H2V2H9ZM3.5 7.5H7.5V3.5H3.5V7.5Z", fill: "black" }),
13
+ /* @__PURE__ */ l("path", { d: "M9 15V22H2V15H9ZM3.5 20.5H7.5V16.5H3.5V20.5Z", fill: "black" }),
14
+ /* @__PURE__ */ l("path", { d: "M22 2V9H15V2H22ZM16.5 7.5H20.5V3.5H16.5V7.5Z", fill: "black" }),
15
+ /* @__PURE__ */ l("path", { d: "M6.25 4.75H4.75V6.25H6.25V4.75Z", fill: "black" }),
16
+ /* @__PURE__ */ l("path", { d: "M6.25 17.75H4.75V19.25H6.25V17.75Z", fill: "black" }),
17
+ /* @__PURE__ */ l("path", { d: "M3.5 11.25H2V12.75H3.5V11.25Z", fill: "black" }),
18
+ /* @__PURE__ */ l("path", { d: "M12.75 20.5H11.25V22H12.75V20.5Z", fill: "black" }),
19
+ /* @__PURE__ */ l("path", { d: "M19 20.5H15V22H19V20.5Z", fill: "black" }),
20
+ /* @__PURE__ */ l("path", { d: "M12.75 16H11.25V19H12.75V16Z", fill: "black" }),
21
+ /* @__PURE__ */ l("path", { d: "M16.5 16H15V22H16.5V16Z", fill: "black" }),
22
+ /* @__PURE__ */ l("path", { d: "M22 11.25H20.5V12.75H22V11.25Z", fill: "black" }),
23
+ /* @__PURE__ */ l("path", { d: "M18.25 11H16.75V15H18.25V11Z", fill: "black" }),
24
+ /* @__PURE__ */ l("path", { d: "M22.1 15H20.5V22H22.1V15Z", fill: "black" }),
25
+ /* @__PURE__ */ l("path", { d: "M11 11.25H6V12.75H11V11.25Z", fill: "black" }),
26
+ /* @__PURE__ */ l("path", { d: "M18.25 13.5H11.25V15H18.25V13.5Z", fill: "black" }),
27
+ /* @__PURE__ */ l("path", { d: "M19.25 4.75H17.75V6.25H19.25V4.75Z", fill: "black" }),
28
+ /* @__PURE__ */ l("path", { d: "M11.2856 2H12.7142V9.14286H11.2856V2Z", fill: "black" })
29
+ ]
30
+ }
31
+ );
32
+ export {
33
+ t as default
34
+ };
@@ -0,0 +1,34 @@
1
+ import { jsxs as V, jsx as l } from "react/jsx-runtime";
2
+ const t = (H) => /* @__PURE__ */ V(
3
+ "svg",
4
+ {
5
+ width: "32",
6
+ height: "32",
7
+ viewBox: "0 0 32 32",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ ...H,
11
+ children: [
12
+ /* @__PURE__ */ l("path", { d: "M12 2V12H2V2H12ZM4 10H10V4H4V10Z", fill: "black" }),
13
+ /* @__PURE__ */ l("path", { d: "M12 20V30H2V20H12ZM4 28H10V22H4V28Z", fill: "black" }),
14
+ /* @__PURE__ */ l("path", { d: "M30 2V12H20V2H30ZM22 10H28V4H22V10Z", fill: "black" }),
15
+ /* @__PURE__ */ l("path", { d: "M8 6H6V8H8V6Z", fill: "black" }),
16
+ /* @__PURE__ */ l("path", { d: "M8 24H6V26H8V24Z", fill: "black" }),
17
+ /* @__PURE__ */ l("path", { d: "M26 6H24V8H26V6Z", fill: "black" }),
18
+ /* @__PURE__ */ l("path", { d: "M4 15H2V17H4V15Z", fill: "black" }),
19
+ /* @__PURE__ */ l("path", { d: "M17 28H15V30H17V28Z", fill: "black" }),
20
+ /* @__PURE__ */ l("path", { d: "M26 28H20V30H26V28Z", fill: "black" }),
21
+ /* @__PURE__ */ l("path", { d: "M17 22H15V26H17V22Z", fill: "black" }),
22
+ /* @__PURE__ */ l("path", { d: "M22 22H20V30H22V22Z", fill: "black" }),
23
+ /* @__PURE__ */ l("path", { d: "M30 15H28V17H30V15Z", fill: "black" }),
24
+ /* @__PURE__ */ l("path", { d: "M25 15H23V20H25V15Z", fill: "black" }),
25
+ /* @__PURE__ */ l("path", { d: "M30 20H28V30H30V20Z", fill: "black" }),
26
+ /* @__PURE__ */ l("path", { d: "M15 15H8V17H15V15Z", fill: "black" }),
27
+ /* @__PURE__ */ l("path", { d: "M25 18H15V20H25V18Z", fill: "black" }),
28
+ /* @__PURE__ */ l("path", { d: "M15 2H17V12H15V2Z", fill: "black" })
29
+ ]
30
+ }
31
+ );
32
+ export {
33
+ t as default
34
+ };