mimir-ui-kit 1.59.1 → 1.59.3

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.
@@ -33,7 +33,7 @@ const ct = ({
33
33
  y: l.getFullYear(),
34
34
  d: l.getDate(),
35
35
  m: l.getMonth() + 1
36
- }, [r, b] = V({ y: v.y, m: v.m }), C = K([r], j), L = (t) => {
36
+ }, [r, b] = V({ y: v.y, m: v.m }), C = K(j, [r]), L = (t) => {
37
37
  let e = t.getDay();
38
38
  return e === 0 && (e = 7), e - 1;
39
39
  }, x = r.m - 1, c = new Date(r.y, x), h = [], M = (() => {
@@ -10,6 +10,7 @@ type TProps = {
10
10
  disabledDate?: (date: Date) => boolean;
11
11
  validRange?: [Date, Date];
12
12
  dateFormat?: 'full' | 'month' | 'year';
13
+ position?: 'center' | 'bottom' | 'top';
13
14
  };
14
- export declare const MonthPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeMonth, disableFuture, disablePast, disabledDate, validRange, dateFormat }: TProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const MonthPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeMonth, disableFuture, disablePast, disabledDate, validRange, dateFormat, position }: TProps) => import("react/jsx-runtime").JSX.Element;
15
16
  export {};
@@ -1,13 +1,13 @@
1
1
  import { jsxs as w, jsx as f } from "react/jsx-runtime";
2
- import { c as _ } from "../../index-DIxK0V-G.js";
3
- import { useState as C } from "react";
4
- import { months as L } from "./constants.js";
5
- import { useDatePickerPosition as b } from "./hooks.js";
2
+ import { c as C } from "../../index-DIxK0V-G.js";
3
+ import { useState as L } from "react";
4
+ import { months as b } from "./constants.js";
5
+ import { useDatePickerPosition as q } from "./hooks.js";
6
6
  import { c } from "../../styles.module-DeBRSK_x.js";
7
- import { Icon as q } from "../../icons/Icon.js";
7
+ import { Icon as E } from "../../icons/Icon.js";
8
8
  import { formating as P } from "../../utils/index.js";
9
9
  import { Button as A } from "../Button/Button.js";
10
- const T = ({
10
+ const tt = ({
11
11
  date: F,
12
12
  selectedDate: D,
13
13
  onChangeValue: G,
@@ -18,9 +18,10 @@ const T = ({
18
18
  disablePast: N = !1,
19
19
  disabledDate: u,
20
20
  validRange: h,
21
- dateFormat: M
21
+ dateFormat: M,
22
+ position: O
22
23
  }) => {
23
- const O = b(), d = new Date(F), p = D ? new Date(D) : d, k = {
24
+ const S = q(O), d = new Date(F), p = D ? new Date(D) : d, k = {
24
25
  y: p.getFullYear(),
25
26
  d: p.getDate(),
26
27
  m: p.getMonth() + 1
@@ -28,9 +29,9 @@ const T = ({
28
29
  y: d.getFullYear(),
29
30
  d: d.getDate(),
30
31
  m: d.getMonth() + 1
31
- }, [t, Y] = C(x.y), S = () => {
32
+ }, [t, Y] = L(x.y), $ = () => {
32
33
  Y(t + 1);
33
- }, $ = () => {
34
+ }, j = () => {
34
35
  Y(t - 1);
35
36
  }, v = (e) => {
36
37
  const i = /* @__PURE__ */ new Date(), r = i.getFullYear(), l = i.getMonth() + 1;
@@ -39,8 +40,8 @@ const T = ({
39
40
  o.setHours(0, 0, 0, 0), s.setHours(23, 59, 59, 999);
40
41
  const B = new Date(n), H = new Date(a);
41
42
  B.setHours(0, 0, 0, 0), H.setHours(23, 59, 59, 999);
42
- const z = s < B, R = o > H;
43
- if (z || R)
43
+ const R = s < B, _ = o > H;
44
+ if (R || _)
44
45
  return !0;
45
46
  }
46
47
  if (m) {
@@ -69,21 +70,21 @@ const T = ({
69
70
  return !0;
70
71
  }
71
72
  return !1;
72
- }, j = (e) => {
73
+ }, z = (e) => {
73
74
  v(e) || (g ? g(t, e) : G(
74
75
  /* @__PURE__ */ new Date(
75
76
  `${t}-${P.Number(2, e)}-${P.Number(2, x.d)}`
76
77
  )
77
78
  ));
78
79
  };
79
- return /* @__PURE__ */ w("div", { className: c["calendar-block"], ref: O, children: [
80
+ return /* @__PURE__ */ w("div", { className: c["calendar-block"], ref: S, children: [
80
81
  /* @__PURE__ */ w("div", { className: c.h, children: [
81
82
  /* @__PURE__ */ f(
82
83
  A,
83
84
  {
84
85
  isIconButton: !0,
85
86
  iconName: "DropdownArrowLeft16px",
86
- onClick: $,
87
+ onClick: j,
87
88
  variant: "secondary-gray",
88
89
  size: "l"
89
90
  }
@@ -97,7 +98,7 @@ const T = ({
97
98
  onClick: M === "month" ? void 0 : () => y == null ? void 0 : y("years"),
98
99
  children: [
99
100
  t.toString(),
100
- M !== "month" && /* @__PURE__ */ f(q, { iconName: "DropdownArrowBottom16px" })
101
+ M !== "month" && /* @__PURE__ */ f(E, { iconName: "DropdownArrowBottom16px" })
101
102
  ]
102
103
  }
103
104
  ),
@@ -106,21 +107,21 @@ const T = ({
106
107
  {
107
108
  isIconButton: !0,
108
109
  iconName: "DropdownArrowRight16px",
109
- onClick: S,
110
+ onClick: $,
110
111
  variant: "secondary-gray",
111
112
  size: "l"
112
113
  }
113
114
  )
114
115
  ] }),
115
- /* @__PURE__ */ f("div", { className: c.monthGrid, "data-testid": "month-picker", children: L.map((e, i) => {
116
+ /* @__PURE__ */ f("div", { className: c.monthGrid, "data-testid": "month-picker", children: b.map((e, i) => {
116
117
  const r = i + 1, l = v(r);
117
118
  return /* @__PURE__ */ f(
118
119
  "button",
119
120
  {
120
121
  type: "button",
121
- onClick: () => j(r),
122
+ onClick: () => z(r),
122
123
  disabled: l,
123
- className: _(l ? c.m : c.a, {
124
+ className: C(l ? c.m : c.a, {
124
125
  [c.current]: D && k.y === t && k.m === r
125
126
  }),
126
127
  children: e
@@ -131,5 +132,5 @@ const T = ({
131
132
  ] });
132
133
  };
133
134
  export {
134
- T as MonthPickerModal
135
+ tt as MonthPickerModal
135
136
  };
@@ -9,6 +9,7 @@ type TProps = {
9
9
  disablePast?: boolean;
10
10
  disabledDate?: (date: Date) => boolean;
11
11
  validRange?: [Date, Date];
12
+ position?: 'center' | 'bottom' | 'top';
12
13
  };
13
- export declare const YearPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeYear, disableFuture, disablePast, disabledDate, validRange }: TProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const YearPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeYear, disableFuture, disablePast, disabledDate, validRange, position }: TProps) => import("react/jsx-runtime").JSX.Element;
14
15
  export {};
@@ -1,11 +1,11 @@
1
1
  import { jsxs as b, jsx as c } from "react/jsx-runtime";
2
- import { c as $ } from "../../index-DIxK0V-G.js";
3
- import { useState as j } from "react";
4
- import { useDatePickerPosition as z } from "./hooks.js";
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
5
  import { c as n } from "../../styles.module-DeBRSK_x.js";
6
6
  import { formating as F } from "../../utils/index.js";
7
7
  import { Button as P } from "../Button/Button.js";
8
- const p = 15, I = 7, W = ({
8
+ const p = 15, C = 7, X = ({
9
9
  date: v,
10
10
  selectedDate: u,
11
11
  onChangeValue: E,
@@ -15,9 +15,10 @@ const p = 15, I = 7, W = ({
15
15
  disableFuture: S = !1,
16
16
  disablePast: _ = !1,
17
17
  disabledDate: o,
18
- validRange: k
18
+ validRange: k,
19
+ position: y
19
20
  }) => {
20
- const y = z(), i = new Date(v), l = u ? new Date(u) : i, G = {
21
+ const G = I(y), i = new Date(v), l = u ? new Date(u) : i, M = {
21
22
  y: l.getFullYear(),
22
23
  d: l.getDate(),
23
24
  m: l.getMonth() + 1
@@ -25,11 +26,11 @@ const p = 15, I = 7, W = ({
25
26
  y: i.getFullYear(),
26
27
  d: i.getDate(),
27
28
  m: i.getMonth() + 1
28
- }, [D, h] = j(e.y), M = D - I, Q = Array.from(Array(p).keys()).map(
29
- (t) => t + M
30
- ), B = () => {
29
+ }, [D, h] = z(e.y), Q = D - C, B = Array.from(Array(p).keys()).map(
30
+ (t) => t + Q
31
+ ), H = () => {
31
32
  h(D + p);
32
- }, H = () => {
33
+ }, R = () => {
33
34
  h(D - p);
34
35
  }, g = (t) => {
35
36
  const s = (/* @__PURE__ */ new Date()).getFullYear();
@@ -56,21 +57,21 @@ const p = 15, I = 7, W = ({
56
57
  return o(w) && o(r) && o(m) && o(f);
57
58
  }
58
59
  return !1;
59
- }, R = (t) => {
60
+ }, $ = (t) => {
60
61
  g(t) || (N ? N(t) : E(
61
62
  /* @__PURE__ */ new Date(
62
63
  `${t}-${F.Number(2, e.m)}-${F.Number(2, e.d)}`
63
64
  )
64
65
  ));
65
66
  };
66
- return /* @__PURE__ */ b("div", { className: n["calendar-block"], ref: y, children: [
67
+ return /* @__PURE__ */ b("div", { className: n["calendar-block"], ref: G, children: [
67
68
  /* @__PURE__ */ b("div", { className: n.h, children: [
68
69
  /* @__PURE__ */ c(
69
70
  P,
70
71
  {
71
72
  isIconButton: !0,
72
73
  iconName: "DropdownArrowLeft16px",
73
- onClick: H,
74
+ onClick: R,
74
75
  variant: "secondary-gray",
75
76
  size: "l"
76
77
  }
@@ -88,22 +89,22 @@ const p = 15, I = 7, W = ({
88
89
  {
89
90
  isIconButton: !0,
90
91
  iconName: "DropdownArrowRight16px",
91
- onClick: B,
92
+ onClick: H,
92
93
  variant: "secondary-gray",
93
94
  size: "l"
94
95
  }
95
96
  )
96
97
  ] }),
97
- /* @__PURE__ */ c("div", { className: n.monthGrid, "data-testid": "year-picker", children: Q.map((t, x) => {
98
+ /* @__PURE__ */ c("div", { className: n.monthGrid, "data-testid": "year-picker", children: B.map((t, x) => {
98
99
  const s = g(t);
99
100
  return /* @__PURE__ */ c(
100
101
  "button",
101
102
  {
102
103
  type: "button",
103
- onClick: () => R(t),
104
+ onClick: () => $(t),
104
105
  disabled: s,
105
- className: $(s ? n.m : n.a, {
106
- [n.current]: u && G.y === t
106
+ className: j(s ? n.m : n.a, {
107
+ [n.current]: u && M.y === t
107
108
  }),
108
109
  children: t
109
110
  },
@@ -113,5 +114,5 @@ const p = 15, I = 7, W = ({
113
114
  ] });
114
115
  };
115
116
  export {
116
- W as YearPickerModal
117
+ X as YearPickerModal
117
118
  };
@@ -1,3 +1,3 @@
1
1
  import { DependencyList } from 'react';
2
2
 
3
- export declare const useDatePickerPosition: (deps?: DependencyList, position?: "center" | "bottom" | "top") => import('react').RefObject<HTMLDivElement>;
3
+ export declare const useDatePickerPosition: (position?: "center" | "bottom" | "top", deps?: DependencyList) => import('react').RefObject<HTMLDivElement>;
@@ -1,33 +1,34 @@
1
- import { useRef as h, useEffect as u } from "react";
2
- import { BLOCK_WIDTH as n, MAX_MOBILE_WIDTH as w } from "./constants.js";
3
- const H = (a, y) => {
4
- const l = h(null);
5
- return u(() => {
6
- var c, f, r;
7
- const x = window.innerHeight, p = window.innerWidth, t = l.current;
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;
8
8
  if (t && t !== null) {
9
- const d = ((c = t == null ? void 0 : t.parentElement) == null ? void 0 : c.offsetWidth) ?? 0, s = ((f = t == null ? void 0 : t.parentElement) == null ? void 0 : f.offsetHeight) ?? 0, o = (r = t == null ? void 0 : t.parentElement) == null ? void 0 : r.getBoundingClientRect(), e = t.offsetHeight;
10
- switch (y) {
11
- case "center":
12
- t.style.position = "fixed", t.style.top = `calc(50vh - ${e / 2}px)`, t.style.left = `calc(50vw - ${n / 2}px)`;
13
- break;
14
- case "bottom":
15
- t.style.top = s + "px";
16
- break;
17
- case "top":
18
- t.style.top = -e + "px";
19
- break;
20
- default:
21
- if (p < o.x + n) {
22
- const i = d - n;
23
- o.x - Math.abs(i) < 0 ? t.style.left = (i < 0 ? i / 2 : i) + "px" : t.style.left = i + "px";
24
- }
25
- 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 - ${n / 2}px)`) : t.style.top = s + "px";
26
- break;
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";
13
+ return;
14
+ }
15
+ if (i === "bottom") {
16
+ t.style.top = s + "px", t.style.opacity = "1";
17
+ return;
18
+ }
19
+ if (i === "top") {
20
+ t.style.top = -e + "px", t.style.opacity = "1";
21
+ return;
22
+ }
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";
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";
27
29
  }
28
- t.style.opacity = "1";
29
30
  }
30
- }, [a]), l;
31
+ }, [a, i]), f;
31
32
  };
32
33
  export {
33
34
  H as useDatePickerPosition
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.59.1",
4
+ "version": "1.59.3",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {