mimir-ui-kit 1.64.0 → 1.64.1

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
  };
@@ -0,0 +1,31 @@
1
+ import './assets/styles.css';const r = "_full_1p14j_8", _ = "_wrapper_1p14j_11", t = "_inputBorderControl_1p14j_29", o = "_editable_1p14j_42", p = "_textError_1p14j_71", e = "_button_1p14j_90", n = "_fixed_1p14j_135", d = "_h_1p14j_139", a = "_b_1p14j_48", i = "_d_1p14j_18", c = "_m_1p14j_161", u = "_a_1p14j_162", s = "_prev_1p14j_163", j = "_orange_1p14j_177", l = "_current_1p14j_194", b = "_monthGrid_1p14j_199", f = {
2
+ "input-field-group-datePicker": "_input-field-group-datePicker_1p14j_3",
3
+ full: r,
4
+ wrapper: _,
5
+ "date-wrapper": "_date-wrapper_1p14j_18",
6
+ "input-wrapper": "_input-wrapper_1p14j_22",
7
+ "right-slot": "_right-slot_1p14j_25",
8
+ inputBorderControl: t,
9
+ editable: o,
10
+ "border-radius-left": "_border-radius-left_1p14j_48",
11
+ "border-radius-right": "_border-radius-right_1p14j_52",
12
+ "border-radius-none": "_border-radius-none_1p14j_56",
13
+ "calendar-block": "_calendar-block_1p14j_68",
14
+ textError: p,
15
+ "button-wrapper": "_button-wrapper_1p14j_90",
16
+ button: e,
17
+ fixed: n,
18
+ h: d,
19
+ b: a,
20
+ d: i,
21
+ m: c,
22
+ a: u,
23
+ prev: s,
24
+ orange: j,
25
+ current: l,
26
+ monthGrid: b,
27
+ "icon-button": "_icon-button_1p14j_204"
28
+ };
29
+ export {
30
+ f as c
31
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.64.0",
4
+ "version": "1.64.1",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -1,30 +0,0 @@
1
- import './assets/styles.css';const r = "_full_1snrv_8", n = "_wrapper_1snrv_11", _ = "_inputBorderControl_1snrv_29", t = "_editable_1snrv_42", o = "_textError_1snrv_71", e = "_button_1snrv_90", s = "_h_1snrv_136", a = "_b_1snrv_48", d = "_d_1snrv_18", p = "_m_1snrv_158", c = "_a_1snrv_159", i = "_prev_1snrv_160", u = "_orange_1snrv_174", v = "_current_1snrv_191", l = "_monthGrid_1snrv_196", b = {
2
- "input-field-group-datePicker": "_input-field-group-datePicker_1snrv_3",
3
- full: r,
4
- wrapper: n,
5
- "date-wrapper": "_date-wrapper_1snrv_18",
6
- "input-wrapper": "_input-wrapper_1snrv_22",
7
- "right-slot": "_right-slot_1snrv_25",
8
- inputBorderControl: _,
9
- editable: t,
10
- "border-radius-left": "_border-radius-left_1snrv_48",
11
- "border-radius-right": "_border-radius-right_1snrv_52",
12
- "border-radius-none": "_border-radius-none_1snrv_56",
13
- "calendar-block": "_calendar-block_1snrv_68",
14
- textError: o,
15
- "button-wrapper": "_button-wrapper_1snrv_90",
16
- button: e,
17
- h: s,
18
- b: a,
19
- d,
20
- m: p,
21
- a: c,
22
- prev: i,
23
- orange: u,
24
- current: v,
25
- monthGrid: l,
26
- "icon-button": "_icon-button_1snrv_201"
27
- };
28
- export {
29
- b as c
30
- };