mimir-ui-kit 1.43.9 → 1.43.11

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.
Files changed (162) hide show
  1. package/dist/Input-CGZoshMl.js +224 -0
  2. package/dist/assets/Accordion.css +1 -1
  3. package/dist/assets/AccordionItem.css +1 -1
  4. package/dist/assets/Avatar.css +1 -1
  5. package/dist/assets/Button.css +1 -1
  6. package/dist/assets/CarBodyButton.css +1 -0
  7. package/dist/assets/CheckboxMimir.css +1 -1
  8. package/dist/assets/Chip.css +1 -1
  9. package/dist/assets/Drawer.css +1 -1
  10. package/dist/assets/GosZnak.css +1 -1
  11. package/dist/assets/Input.css +1 -1
  12. package/dist/assets/InputPassword.css +1 -1
  13. package/dist/assets/InputRangeSlider.css +1 -1
  14. package/dist/assets/Link.css +1 -1
  15. package/dist/assets/ListFiles.css +1 -1
  16. package/dist/assets/ListPhotos.css +1 -1
  17. package/dist/assets/MessageShortReply.css +1 -1
  18. package/dist/assets/MiniButton.css +1 -0
  19. package/dist/assets/MultiSelectSearch.css +1 -1
  20. package/dist/assets/NotificationBadge.css +1 -1
  21. package/dist/assets/OtpInput.css +1 -1
  22. package/dist/assets/Pagination.css +1 -1
  23. package/dist/assets/RoundButton.css +1 -0
  24. package/dist/assets/ScrollWrapper.css +1 -0
  25. package/dist/assets/SelectSearch.css +1 -1
  26. package/dist/assets/hooks.css +1 -1
  27. package/dist/assets/index.css +1 -1
  28. package/dist/assets/styles.css +1 -1
  29. package/dist/components/Accordion/Accordion.d.ts +10 -3
  30. package/dist/components/Accordion/Accordion.js +286 -212
  31. package/dist/components/Accordion/AccordionItem/AccordionItem.js +3 -3
  32. package/dist/components/Accordion/constants.d.ts +0 -4
  33. package/dist/components/Accordion/constants.js +4 -5
  34. package/dist/components/AnchorLink/Link.js +21 -20
  35. package/dist/components/Avatar/Avatar.js +26 -26
  36. package/dist/components/Button/Button.js +110 -87
  37. package/dist/components/Button/constants.d.ts +8 -2
  38. package/dist/components/Button/constants.js +6 -5
  39. package/dist/components/CarBodyButton/CarBodyButton.d.ts +26 -0
  40. package/dist/components/CarBodyButton/CarBodyButton.js +40 -0
  41. package/dist/components/CarBodyButton/index.d.ts +1 -0
  42. package/dist/components/CarBodyButton/index.js +4 -0
  43. package/dist/components/CheckboxMimir/CheckboxMimir.d.ts +2 -0
  44. package/dist/components/CheckboxMimir/CheckboxMimir.js +37 -35
  45. package/dist/components/Chip/Chip.js +17 -17
  46. package/dist/components/DatePicker/DatePicker.d.ts +8 -0
  47. package/dist/components/DatePicker/DatePicker.js +182 -169
  48. package/dist/components/DatePicker/DatePickerModal.js +134 -98
  49. package/dist/components/DatePicker/MonthPickerModal.js +115 -95
  50. package/dist/components/DatePicker/YearPickerModal.js +109 -89
  51. package/dist/components/DatePicker/constants.d.ts +1 -0
  52. package/dist/components/DatePicker/constants.js +1 -1
  53. package/dist/components/DatePicker/hooks.d.ts +2 -1
  54. package/dist/components/DatePicker/hooks.js +12 -12
  55. package/dist/components/Drawer/Drawer.js +172 -138
  56. package/dist/components/Drawer/ScrollWrapper/ScrollWrapper.d.ts +11 -0
  57. package/dist/components/Drawer/ScrollWrapper/ScrollWrapper.js +27 -0
  58. package/dist/components/Dropdown/Dropdown.js +1 -1
  59. package/dist/components/Dropdown/hooks.js +1 -1
  60. package/dist/components/GosZnak/GosZnak.js +47 -38
  61. package/dist/components/GosZnak/utils.d.ts +6 -0
  62. package/dist/components/GosZnak/utils.js +15 -0
  63. package/dist/components/Input/Input.d.ts +4 -0
  64. package/dist/components/Input/Input.js +2 -2
  65. package/dist/components/Input/index.js +1 -1
  66. package/dist/components/InputPassword/InputPassword.js +38 -42
  67. package/dist/components/InputPhoneNumber/InputPhoneNumber.js +1 -1
  68. package/dist/components/InputRangeSlider/InputRangeSlider.js +159 -139
  69. package/dist/components/InputRangeSlider/constants.d.ts +5 -0
  70. package/dist/components/InputRangeSlider/constants.js +11 -6
  71. package/dist/components/ListFiles/ListFiles.js +41 -39
  72. package/dist/components/ListPhotos/ListPhotos.js +17 -18
  73. package/dist/components/MessageShortReply/MessageShortReply.js +34 -34
  74. package/dist/components/{InputClearButton/ClearButton.d.ts → MiniButton/MiniButton.d.ts} +17 -8
  75. package/dist/components/MiniButton/MiniButton.js +44 -0
  76. package/dist/components/MiniButton/constants.d.ts +9 -0
  77. package/dist/components/MiniButton/constants.js +5 -0
  78. package/dist/components/MiniButton/index.d.ts +4 -0
  79. package/dist/components/MiniButton/index.js +6 -0
  80. package/dist/components/MultiSelectSearch/MultiSelectSearch.js +153 -152
  81. package/dist/components/MultiSelectSearch/constants.d.ts +1 -0
  82. package/dist/components/MultiSelectSearch/constants.js +7 -7
  83. package/dist/components/MultiSelectSearch/utils.d.ts +1 -1
  84. package/dist/components/MultiSelectSearch/utils.js +18 -16
  85. package/dist/components/NotificationBadge/NotificationBadge.js +49 -33
  86. package/dist/components/NotificationBadge/constants.d.ts +9 -2
  87. package/dist/components/NotificationBadge/constants.js +3 -2
  88. package/dist/components/NotificationBadge/types.d.ts +11 -1
  89. package/dist/components/NotificationBadge/utils.d.ts +8 -0
  90. package/dist/components/NotificationBadge/utils.js +4 -0
  91. package/dist/components/OtpInput/OtpInput.js +44 -40
  92. package/dist/components/OtpInput/constants.d.ts +4 -0
  93. package/dist/components/OtpInput/constants.js +6 -4
  94. package/dist/components/OtpInput/index.d.ts +1 -0
  95. package/dist/components/OtpInput/index.js +2 -0
  96. package/dist/components/Pagination/Pagination.js +23 -23
  97. package/dist/components/RoundButton/RoundButton.d.ts +82 -0
  98. package/dist/components/RoundButton/RoundButton.js +69 -0
  99. package/dist/components/RoundButton/constants.d.ts +11 -0
  100. package/dist/components/RoundButton/constants.js +5 -0
  101. package/dist/components/RoundButton/index.d.ts +2 -0
  102. package/dist/components/RoundButton/index.js +7 -0
  103. package/dist/components/RoundButton/types.d.ts +20 -0
  104. package/dist/components/SelectSearch/SelectSearch.d.ts +2 -0
  105. package/dist/components/SelectSearch/SelectSearch.js +273 -236
  106. package/dist/components/SelectSearch/types.d.ts +9 -1
  107. package/dist/components/SelectSearch/utils.d.ts +1 -1
  108. package/dist/components/SelectSearch/utils.js +1 -1
  109. package/dist/components/Slider/Slider.d.ts +1 -5
  110. package/dist/components/Slider/Slider.js +34 -36
  111. package/dist/components/TextArea/TextArea.js +1 -1
  112. package/dist/components/index.d.ts +3 -1
  113. package/dist/components/index.js +55 -51
  114. package/dist/hooks-Cd4Ez6_j.js +117 -0
  115. package/dist/icons/Icon.js +1 -1
  116. package/dist/icons/components/16px/DropdownArrowDown16px.js +23 -0
  117. package/dist/icons/components/24px/EyeClosed24px.js +65 -0
  118. package/dist/icons/components/Avito.js +36 -13
  119. package/dist/icons/components/Site.js +13 -36
  120. package/dist/icons/components/index.js +564 -591
  121. package/dist/{index-C2dQUuc9.js → index-DrVFMaBi.js} +1184 -1346
  122. package/dist/index.js +73 -69
  123. package/dist/styles.module-BfkM1-KJ.js +32 -0
  124. package/package.json +1 -1
  125. package/dist/Input-BU_6U1CW.js +0 -227
  126. package/dist/assets/ClearButton.css +0 -1
  127. package/dist/components/InputClearButton/ClearButton.js +0 -41
  128. package/dist/components/InputClearButton/constants.d.ts +0 -8
  129. package/dist/components/InputClearButton/constants.js +0 -5
  130. package/dist/components/InputClearButton/index.d.ts +0 -4
  131. package/dist/components/InputClearButton/index.js +0 -6
  132. package/dist/hooks-HgN6Yauq.js +0 -117
  133. package/dist/icons/components/64px/AdvancePaymentDiscount64px.js +0 -59
  134. package/dist/icons/components/64px/AtsVendors64px.js +0 -37
  135. package/dist/icons/components/64px/ButtonOn64px.js +0 -31
  136. package/dist/icons/components/64px/BuyoutAuto64px.js +0 -45
  137. package/dist/icons/components/64px/CarAssistance64px.js +0 -44
  138. package/dist/icons/components/64px/CarDelivery64px.js +0 -37
  139. package/dist/icons/components/64px/CarSearchReturn64px.js +0 -45
  140. package/dist/icons/components/64px/CarService64px.js +0 -37
  141. package/dist/icons/components/64px/Case64px.js +0 -33
  142. package/dist/icons/components/64px/CoatOfArms64px.js +0 -149
  143. package/dist/icons/components/64px/CoffeeCup64px.js +0 -44
  144. package/dist/icons/components/64px/Cup64px.js +0 -38
  145. package/dist/icons/components/64px/ExpertAdvice64px.js +0 -40
  146. package/dist/icons/components/64px/Fines64px.js +0 -88
  147. package/dist/icons/components/64px/Fuel64px.js +0 -38
  148. package/dist/icons/components/64px/GazprombankIcon24px.js +0 -21
  149. package/dist/icons/components/64px/Kasko64px.js +0 -44
  150. package/dist/icons/components/64px/LegalSupport64px.js +0 -58
  151. package/dist/icons/components/64px/Microphone64px.js +0 -37
  152. package/dist/icons/components/64px/Money64px.js +0 -60
  153. package/dist/icons/components/64px/PaymentSchedule64px.js +0 -39
  154. package/dist/icons/components/64px/PersonalManager64px.js +0 -100
  155. package/dist/icons/components/64px/PreApproval64px.js +0 -44
  156. package/dist/icons/components/64px/Questions64px.js +0 -37
  157. package/dist/icons/components/64px/SupportGeography64px.js +0 -51
  158. package/dist/icons/components/64px/Timer64px.js +0 -45
  159. package/dist/icons/components/64px/Twogis64px.js +0 -51
  160. package/dist/icons/components/64px/Vehicles64px.js +0 -45
  161. package/dist/icons/components/64px/Workplace64px.js +0 -38
  162. package/dist/styles.module-Cuqm31CO.js +0 -28
@@ -1,117 +1,137 @@
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";
5
- import { c as n } from "../../styles.module-Cuqm31CO.js";
6
- import { formating as F } from "../../utils/index.js";
7
- import { Button as P } from "../Button/Button.js";
8
- const p = 15, I = 7, W = ({
9
- date: v,
10
- selectedDate: u,
1
+ import { jsxs as F, jsx as c } from "react/jsx-runtime";
2
+ import { c as P } from "../../index-DIxK0V-G.js";
3
+ import { useState as C } from "react";
4
+ import { useDatePickerPosition as L } from "./hooks.js";
5
+ import { c as o } from "../../styles.module-BfkM1-KJ.js";
6
+ import { formating as _ } from "../../utils/index.js";
7
+ import { Button as v } from "../Button/Button.js";
8
+ const N = 15, O = 7, T = ({
9
+ date: y,
10
+ selectedDate: d,
11
11
  onChangeValue: E,
12
12
  before: Y,
13
- onChangeType: d,
14
- onChangeYear: N,
15
- disableFuture: S = !1,
16
- disablePast: _ = !1,
17
- disabledDate: o,
13
+ onChangeType: l,
14
+ onChangeYear: g,
15
+ disableFuture: M = !1,
16
+ disablePast: S = !1,
17
+ disabledDate: r,
18
18
  validRange: k
19
19
  }) => {
20
- const y = z(), i = new Date(v), l = u ? new Date(u) : i, G = {
21
- y: l.getFullYear(),
22
- d: l.getDate(),
23
- m: l.getMonth() + 1
20
+ const [G, Q] = L(), i = new Date(y), u = d ? new Date(d) : i, D = /* @__PURE__ */ new Date(), $ = {
21
+ y: u.getFullYear(),
22
+ d: u.getDate(),
23
+ m: u.getMonth() + 1
24
24
  }, e = {
25
25
  y: i.getFullYear(),
26
26
  d: i.getDate(),
27
27
  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 = () => {
31
- h(D + p);
32
- }, H = () => {
33
- h(D - p);
34
- }, g = (t) => {
28
+ }, B = {
29
+ y: D.getFullYear(),
30
+ d: D.getDate(),
31
+ m: D.getMonth() + 1
32
+ }, [w, h] = C(e.y), H = w - O, R = Array.from(Array(N).keys()).map(
33
+ (t) => t + H
34
+ ), j = () => {
35
+ h(w + N);
36
+ }, z = () => {
37
+ h(w - N);
38
+ }, x = (t) => {
35
39
  const s = (/* @__PURE__ */ new Date()).getFullYear();
36
40
  if (k) {
37
- const [a, w] = k;
38
- let r;
41
+ const [a, p] = k;
42
+ let n;
39
43
  if (e.m && e.d)
40
- r = new Date(t, e.m - 1, e.d);
44
+ n = new Date(t, e.m - 1, e.d);
41
45
  else {
42
46
  const A = /* @__PURE__ */ new Date();
43
- r = new Date(t, A.getMonth(), A.getDate());
47
+ n = new Date(t, A.getMonth(), A.getDate());
44
48
  }
45
- r.setHours(0, 0, 0, 0);
46
- const m = new Date(a), f = new Date(w);
47
- if (m.setHours(0, 0, 0, 0), f.setHours(23, 59, 59, 999), r < m || r > f)
49
+ n.setHours(0, 0, 0, 0);
50
+ const m = new Date(a), f = new Date(p);
51
+ if (m.setHours(0, 0, 0, 0), f.setHours(23, 59, 59, 999), n < m || n > f)
48
52
  return !0;
49
53
  }
50
- if (Y && Y.getFullYear() > t || S && t > s || _ && t < s)
54
+ if (Y && Y.getFullYear() > t || M && t > s || S && t < s)
51
55
  return !0;
52
- if (o) {
56
+ if (r) {
53
57
  const a = new Date(t, e.m - 1, e.d);
54
- if (!o(a)) return !1;
55
- 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);
56
- return o(w) && o(r) && o(m) && o(f);
58
+ if (!r(a)) return !1;
59
+ const p = new Date(t, 2, 15), n = new Date(t, 5, 15), m = new Date(t, 8, 15), f = new Date(t, 11, 15);
60
+ return r(p) && r(n) && r(m) && r(f);
57
61
  }
58
62
  return !1;
59
- }, R = (t) => {
60
- g(t) || (N ? N(t) : E(
63
+ }, I = (t) => {
64
+ x(t) || (g ? g(t) : E(
61
65
  /* @__PURE__ */ new Date(
62
- `${t}-${F.Number(2, e.m)}-${F.Number(2, e.d)}`
66
+ `${t}-${_.Number(2, e.m)}-${_.Number(2, e.d)}`
63
67
  )
64
68
  ));
65
69
  };
66
- return /* @__PURE__ */ b("div", { className: n["calendar-block"], ref: y, children: [
67
- /* @__PURE__ */ b("div", { className: n.h, children: [
68
- /* @__PURE__ */ c(
69
- P,
70
- {
71
- isIconButton: !0,
72
- iconName: "DropdownArrowLeft16px",
73
- onClick: H,
74
- variant: "secondary-gray",
75
- size: "l"
76
- }
70
+ return /* @__PURE__ */ F(
71
+ "div",
72
+ {
73
+ className: P(
74
+ o["calendar-block"],
75
+ o[`calendar-block--position-${Q}`]
77
76
  ),
78
- /* @__PURE__ */ c(
79
- "button",
80
- {
81
- type: "button",
82
- onClick: () => d == null ? void 0 : d("years"),
83
- className: n.d
84
- }
85
- ),
86
- /* @__PURE__ */ c(
87
- P,
88
- {
89
- isIconButton: !0,
90
- iconName: "DropdownArrowRight16px",
91
- onClick: B,
92
- variant: "secondary-gray",
93
- size: "l"
94
- }
95
- )
96
- ] }),
97
- /* @__PURE__ */ c("div", { className: n.monthGrid, "data-testid": "year-picker", children: Q.map((t, x) => {
98
- const s = g(t);
99
- return /* @__PURE__ */ c(
100
- "button",
101
- {
102
- type: "button",
103
- onClick: () => R(t),
104
- disabled: s,
105
- className: $(s ? n.m : n.a, {
106
- [n.current]: u && G.y === t
107
- }),
108
- children: t
109
- },
110
- x
111
- );
112
- }) })
113
- ] });
77
+ ref: G,
78
+ children: [
79
+ /* @__PURE__ */ F("div", { className: o.h, children: [
80
+ /* @__PURE__ */ c(
81
+ v,
82
+ {
83
+ isIconButton: !0,
84
+ iconName: "DropdownArrowLeft16px",
85
+ onClick: z,
86
+ variant: "secondary-gray",
87
+ size: "l"
88
+ }
89
+ ),
90
+ /* @__PURE__ */ c(
91
+ "button",
92
+ {
93
+ type: "button",
94
+ onClick: () => l == null ? void 0 : l("years"),
95
+ className: o.d
96
+ }
97
+ ),
98
+ /* @__PURE__ */ c(
99
+ v,
100
+ {
101
+ isIconButton: !0,
102
+ iconName: "DropdownArrowRight16px",
103
+ onClick: j,
104
+ variant: "secondary-gray",
105
+ size: "l"
106
+ }
107
+ )
108
+ ] }),
109
+ /* @__PURE__ */ c("div", { className: o.monthGrid, "data-testid": "year-picker", children: R.map((t, b) => {
110
+ const s = x(t);
111
+ return /* @__PURE__ */ c(
112
+ "button",
113
+ {
114
+ type: "button",
115
+ onClick: () => I(t),
116
+ disabled: s,
117
+ className: P(
118
+ s ? o.m : o.a,
119
+ {
120
+ [o.current]: B.y === t
121
+ },
122
+ {
123
+ [o.selecte]: d && $.y === t
124
+ }
125
+ ),
126
+ children: t
127
+ },
128
+ b
129
+ );
130
+ }) })
131
+ ]
132
+ }
133
+ );
114
134
  };
115
135
  export {
116
- W as YearPickerModal
136
+ T as YearPickerModal
117
137
  };
@@ -10,6 +10,7 @@ export declare enum EDatePickerValue {
10
10
  CurrentDate = "20240510",
11
11
  CurrentDate3 = "2024-09-10"
12
12
  }
13
+ export type TCalendarBlockPosition = 'top' | 'medium' | 'bottom';
13
14
  export declare const BLOCK_WIDTH = 368;
14
15
  export declare const COUNT_WORK_DAYS = 4;
15
16
  export declare const MAX_DAY = 31;
@@ -1,5 +1,5 @@
1
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 = [
2
+ const s = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"], C = [
3
3
  "Январь",
4
4
  "Февраль",
5
5
  "Март",
@@ -1,3 +1,4 @@
1
1
  import { DependencyList } from 'react';
2
+ import { TCalendarBlockPosition } from './constants';
2
3
 
3
- export declare const useDatePickerPosition: (deps?: DependencyList) => import('react').RefObject<HTMLDivElement>;
4
+ export declare const useDatePickerPosition: (deps?: DependencyList) => (import('react').RefObject<HTMLDivElement> | TCalendarBlockPosition | null)[];
@@ -1,20 +1,20 @@
1
- import { useRef as x, useEffect as w } from "react";
1
+ import { useRef as w, useState as g, useLayoutEffect as H } from "react";
2
2
  import { BLOCK_WIDTH as r } from "./constants.js";
3
- const H = (a) => {
4
- const t = x(null);
5
- return w(() => {
6
- var o, c, s, l, u, p;
7
- const d = window.innerHeight, h = window.innerWidth;
3
+ const E = (d) => {
4
+ const t = w(null), [y, o] = g(null);
5
+ return H(() => {
6
+ var s, c, l, u, p, a;
7
+ const h = window.innerHeight, m = window.innerWidth;
8
8
  if (t.current !== null) {
9
- const y = ((c = (o = t == null ? void 0 : t.current) == null ? void 0 : o.parentElement) == null ? void 0 : c.offsetWidth) ?? 0, f = ((l = (s = t == null ? void 0 : t.current) == null ? void 0 : s.parentElement) == null ? void 0 : l.offsetHeight) ?? 0, n = (p = (u = t == null ? void 0 : t.current) == null ? void 0 : u.parentElement) == null ? void 0 : p.getBoundingClientRect(), i = t.current.offsetHeight;
10
- if (h < n.x + r) {
11
- const e = y - r;
9
+ const x = ((c = (s = t == null ? void 0 : t.current) == null ? void 0 : s.parentElement) == null ? void 0 : c.offsetWidth) ?? 0, f = ((u = (l = t == null ? void 0 : t.current) == null ? void 0 : l.parentElement) == null ? void 0 : u.offsetHeight) ?? 0, n = (a = (p = t == null ? void 0 : t.current) == null ? void 0 : p.parentElement) == null ? void 0 : a.getBoundingClientRect(), i = t.current.offsetHeight;
10
+ if (m < n.x + r) {
11
+ const e = x - r;
12
12
  n.x - Math.abs(e) < 0 ? t.current.style.left = (e < 0 ? e / 2 : e) + "px" : t.current.style.left = e + "px";
13
13
  }
14
- d < n.y + i + f ? n.y - i > 0 ? t.current.style.top = -i + "px" : (t.current.style.position = "fixed", t.current.style.top = `calc(50vh - ${i / 2}px)`, t.current.style.left = `calc(50vw - ${r / 2}px)`) : t.current.style.top = f + "px", t.current.style.opacity = "1";
14
+ h < n.y + i + f ? n.y - i > 0 ? (t.current.style.top = -i + "px", o("top")) : (t.current.style.position = "fixed", t.current.style.top = `calc(50vh - ${i / 2}px)`, t.current.style.left = `calc(50vw - ${r / 2}px)`, o("medium")) : (t.current.style.top = f + "px", o("bottom")), t.current.style.opacity = "1";
15
15
  }
16
- }, [a]), t;
16
+ }, [d]), [t, y];
17
17
  };
18
18
  export {
19
- H as useDatePickerPosition
19
+ E as useDatePickerPosition
20
20
  };
@@ -1,38 +1,41 @@
1
- import { jsxs as f, Fragment as I, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as l, Fragment as L, jsx as t } from "react/jsx-runtime";
2
2
  import { c as n } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as q, useState as M, useRef as J, useCallback as h, useEffect as U } from "react";
4
- import { EDrawerPosition as O } from "./constants.js";
5
- import { useContainer as Z } from "./hooks.js";
6
- import { useMediaQuery as $ } from "../../hooks/useMediaQuery/useMediaQuery.js";
7
- import { EMediaQuery as ee } from "../../hooks/useMediaQuery/constants.js";
8
- import { useLockBodyScroll as te } from "../../hooks/useLockBodyScroll/useLockBodyScroll.js";
9
- import { useResizeObserver as oe } from "../../hooks/useResizeObserver/useResizeObserver.js";
10
- import { Button as S } from "../Button/Button.js";
11
- import { EButtonVariantDefault as ne, EButtonSize as r } from "../Button/constants.js";
12
- import { Loader as se } from "../Loader/Loader.js";
13
- import { Portal as re } from "../Portal/Portal.js";
14
- import '../../assets/Drawer.css';const ae = "_drawer_13ua6_2", ie = "_content_13ua6_26", le = "_header_13ua6_44", ce = "_title_13ua6_58", ue = "_space_13ua6_72", de = "_inner_13ua6_83", me = "_button_13ua6_86", _e = "_footer_13ua6_91", fe = "_left_13ua6_104", he = "_right_13ua6_108", pe = "_full_13ua6_112", ye = "_bottom_13ua6_122", ge = "_opened_13ua6_139", Ce = "_overlay_13ua6_195", ve = "_unmount_13ua6_211", e = {
15
- drawer: ae,
16
- content: ie,
17
- "is-loading": "_is-loading_13ua6_40",
18
- header: le,
19
- "sticky-header": "_sticky-header_13ua6_52",
20
- title: ce,
21
- space: ue,
22
- inner: de,
23
- button: me,
24
- footer: _e,
25
- "footer-button": "_footer-button_13ua6_100",
26
- left: fe,
27
- right: he,
28
- full: pe,
29
- bottom: ye,
30
- "full-bottom-height": "_full-bottom-height_13ua6_133",
31
- opened: ge,
32
- "is-closing": "_is-closing_13ua6_158",
33
- overlay: Ce,
34
- unmount: ve
35
- }, Ne = 300, be = (a) => a ? {
3
+ import { forwardRef as ne, useState as p, useRef as M, useEffect as R, useCallback as g } from "react";
4
+ import { EDrawerPosition as H } from "./constants.js";
5
+ import { useContainer as re } from "./hooks.js";
6
+ import { ScrollWrapper as se } from "./ScrollWrapper/ScrollWrapper.js";
7
+ import { useMediaQuery as ae } from "../../hooks/useMediaQuery/useMediaQuery.js";
8
+ import { EMediaQuery as ie } from "../../hooks/useMediaQuery/constants.js";
9
+ import { useLockBodyScroll as le } from "../../hooks/useLockBodyScroll/useLockBodyScroll.js";
10
+ import { useResizeObserver as ce } from "../../hooks/useResizeObserver/useResizeObserver.js";
11
+ import { Button as T } from "../Button/Button.js";
12
+ import { EButtonVariantDefault as de, EButtonSize as c } from "../Button/constants.js";
13
+ import { Loader as ue } from "../Loader/Loader.js";
14
+ import { Portal as me } from "../Portal/Portal.js";
15
+ import { EScrollBarVariant as fe, EScrollBarSize as _e } from "../ScrollBar/constants.js";
16
+ import '../../assets/Drawer.css';const he = "_drawer_1btea_2", be = "_content_1btea_26", pe = "_header_1btea_45", ge = "_title_1btea_58", ye = "_space_1btea_74", ve = "_inner_1btea_82", Ce = "_button_1btea_87", we = "_footer_1btea_92", Ne = "_left_1btea_109", ke = "_right_1btea_113", Se = "_full_1btea_117", Be = "_bottom_1btea_127", Ee = "_opened_1btea_144", ze = "_overlay_1btea_208", Ie = "_unmount_1btea_224", e = {
17
+ drawer: he,
18
+ content: be,
19
+ "is-loading": "_is-loading_1btea_41",
20
+ header: pe,
21
+ "sticky-header": "_sticky-header_1btea_52",
22
+ title: ge,
23
+ space: ye,
24
+ inner: ve,
25
+ button: Ce,
26
+ footer: we,
27
+ "has-scroll": "_has-scroll_1btea_102",
28
+ "footer-button": "_footer-button_1btea_105",
29
+ left: Ne,
30
+ right: ke,
31
+ full: Se,
32
+ bottom: Be,
33
+ "full-bottom-height": "_full-bottom-height_1btea_138",
34
+ opened: Ee,
35
+ "is-closing": "_is-closing_1btea_165",
36
+ overlay: ze,
37
+ unmount: Ie
38
+ }, Oe = 300, Le = (d) => d ? {
36
39
  drawer: {
37
40
  position: "absolute",
38
41
  zIndex: 100
@@ -41,120 +44,151 @@ import '../../assets/Drawer.css';const ae = "_drawer_13ua6_2", ie = "_content_13
41
44
  position: "absolute",
42
45
  zIndex: 90
43
46
  }
44
- } : {}, Ae = q(
45
- (a, L) => {
47
+ } : {}, Ye = ne(
48
+ (d, x) => {
46
49
  const {
47
- as: R = "div",
48
- isOpen: s,
49
- onClose: i,
50
- title: T,
51
- className: x,
52
- unmount: p = !0,
53
- isLoading: l = !1,
54
- stickyHeader: z,
55
- fullBottomHeight: D = !1,
56
- position: c = O.RIGHT,
57
- paddingRight: A = 8,
58
- footer: u,
59
- children: H,
60
- classNameTitle: P,
61
- classNameHeader: X,
62
- classNameInner: j,
63
- classNameContent: F,
64
- classNameFooter: Q,
65
- closeOnClickOutside: y = !0,
66
- showCloseButton: g = !0,
67
- getContainer: d,
68
- ...G
69
- } = a, [C, v] = M(!1), [K, N] = M(!1), b = J(), m = $(ee.XS1), { ref: V } = oe({
70
- enabled: c === O.BOTTOM
71
- }), w = Z(d);
72
- te({
73
- on: s && !C,
74
- paddingRight: A
50
+ as: D = "div",
51
+ isOpen: r,
52
+ onClose: u,
53
+ title: A,
54
+ className: P,
55
+ unmount: y = !0,
56
+ isLoading: a = !1,
57
+ stickyHeader: X,
58
+ fullBottomHeight: j = !1,
59
+ position: m = H.RIGHT,
60
+ paddingRight: F = 8,
61
+ footer: f,
62
+ children: G,
63
+ classNameTitle: Q,
64
+ classNameHeader: V,
65
+ classNameInner: W,
66
+ classNameContent: K,
67
+ classNameFooter: Y,
68
+ closeOnClickOutside: v = !0,
69
+ showCloseButton: C = !0,
70
+ getContainer: _,
71
+ ...q
72
+ } = d, [w, N] = p(!1), [J, k] = p(!1), S = M(), h = ae(ie.XS1), { ref: U } = ce({
73
+ enabled: m === H.BOTTOM
74
+ }), B = re(_), s = M(null), [Z, $] = p(!1);
75
+ R(() => {
76
+ const i = () => {
77
+ if (s.current) {
78
+ const { scrollHeight: te, clientHeight: oe } = s.current;
79
+ $(te > oe);
80
+ }
81
+ };
82
+ i();
83
+ const O = new ResizeObserver(i);
84
+ return s.current && O.observe(s.current), () => {
85
+ O.disconnect();
86
+ };
87
+ }, [r, a]), le({
88
+ on: r && !w,
89
+ paddingRight: F
75
90
  });
76
- const o = h(() => {
77
- i && (v(!0), b.current = setTimeout(() => {
78
- i(), v(!1);
79
- }, Ne));
80
- }, [i]), W = h(() => {
81
- y && o();
82
- }, [y, o]), _ = h(
83
- (Y) => {
84
- Y.key === "Escape" && o();
91
+ const o = g(() => {
92
+ u && (N(!0), S.current = setTimeout(() => {
93
+ u(), N(!1);
94
+ }, Oe));
95
+ }, [u]), ee = g(() => {
96
+ v && o();
97
+ }, [v, o]), b = g(
98
+ (i) => {
99
+ i.key === "Escape" && o();
85
100
  },
86
101
  [o]
87
102
  );
88
- U(() => (s && (N(!0), window.addEventListener("keydown", _)), () => {
89
- N(!1), clearTimeout(b.current), window.removeEventListener("keydown", _);
90
- }), [s, _]);
91
- const k = {
92
- [e.opened]: K,
93
- [e["is-closing"]]: C,
94
- [e["full-bottom-height"]]: D,
95
- [e["is-loading"]]: l
103
+ R(() => (r && (k(!0), window.addEventListener("keydown", b)), () => {
104
+ k(!1), clearTimeout(S.current), window.removeEventListener("keydown", b);
105
+ }), [r, b]);
106
+ const E = {
107
+ [e.opened]: J,
108
+ [e["is-closing"]]: w,
109
+ [e["full-bottom-height"]]: j,
110
+ [e["is-loading"]]: a
96
111
  };
97
- if (!s && p)
112
+ if (!r && y)
98
113
  return null;
99
- const B = be(d !== void 0 && d !== !1), E = /* @__PURE__ */ f(I, { children: [
100
- /* @__PURE__ */ t(
101
- R,
114
+ const z = Le(_ !== void 0 && _ !== !1), I = /* @__PURE__ */ l(L, { children: [
115
+ /* @__PURE__ */ l(
116
+ D,
102
117
  {
103
- ref: L,
104
- "aria-hidden": !s,
118
+ ref: x,
119
+ "aria-hidden": !r,
105
120
  role: "dialog",
106
- style: B.drawer,
107
- className: n(e.drawer, e[c], k, x),
108
- ...G,
109
- children: /* @__PURE__ */ t(
110
- "section",
111
- {
112
- ref: V,
113
- className: n(
114
- e.content,
115
- F,
116
- e[c],
117
- {
118
- [e["is-loading"]]: !!l
119
- }
120
- ),
121
- children: l ? /* @__PURE__ */ t(se, {}) : /* @__PURE__ */ f(I, { children: [
122
- /* @__PURE__ */ f(
123
- "header",
121
+ style: z.drawer,
122
+ className: n(e.drawer, e[m], E, P),
123
+ ...q,
124
+ children: [
125
+ /* @__PURE__ */ t(
126
+ "section",
127
+ {
128
+ ref: U,
129
+ className: n(
130
+ e.content,
131
+ K,
132
+ e[m],
124
133
  {
125
- className: n(e.header, X, {
126
- [e["sticky-header"]]: z
127
- }),
128
- children: [
129
- /* @__PURE__ */ t("h2", { className: n(e.title, P), children: T }),
130
- /* @__PURE__ */ t("div", { className: e.space, children: g && /* @__PURE__ */ t(
131
- S,
132
- {
133
- variant: ne.SecondaryWhite,
134
- isIconButton: !0,
135
- size: m ? r.S : r.M,
136
- iconName: "Close16px",
137
- onClick: o,
138
- className: e.button
139
- }
140
- ) })
141
- ]
134
+ [e["is-loading"]]: !!a
142
135
  }
143
136
  ),
144
- /* @__PURE__ */ t("div", { className: n(e.inner, j), children: H }),
145
- /* @__PURE__ */ t("footer", { className: n(e.footer, Q), children: typeof u == "function" ? u({ handleClose: o }) : u || g && /* @__PURE__ */ t(
146
- S,
137
+ children: a ? /* @__PURE__ */ t(ue, {}) : /* @__PURE__ */ l(L, { children: [
138
+ /* @__PURE__ */ l(
139
+ "header",
140
+ {
141
+ className: n(e.header, V, {
142
+ [e["sticky-header"]]: X
143
+ }),
144
+ children: [
145
+ /* @__PURE__ */ t("h2", { className: n(e.title, Q), children: A }),
146
+ /* @__PURE__ */ t("div", { className: e.space, children: C && /* @__PURE__ */ t(
147
+ T,
148
+ {
149
+ variant: de.SecondaryWhite,
150
+ isIconButton: !0,
151
+ size: h ? c.S : c.M,
152
+ iconName: "Close16px",
153
+ onClick: o,
154
+ className: e.button
155
+ }
156
+ ) })
157
+ ]
158
+ }
159
+ ),
160
+ /* @__PURE__ */ t(
161
+ se,
162
+ {
163
+ ref: s,
164
+ className: n(e.inner, W),
165
+ variant: fe.LIGHT,
166
+ size: _e.M,
167
+ children: G
168
+ }
169
+ )
170
+ ] })
171
+ }
172
+ ),
173
+ /* @__PURE__ */ t(
174
+ "footer",
175
+ {
176
+ className: n(e.footer, Y, {
177
+ [e["has-scroll"]]: Z
178
+ }),
179
+ children: typeof f == "function" ? f({ handleClose: o }) : f || C && /* @__PURE__ */ t(
180
+ T,
147
181
  {
148
- size: m ? r.M : r.XXL,
149
- full: m,
182
+ size: h ? c.L : c.XXL,
183
+ full: h,
150
184
  onClick: o,
151
185
  className: e["footer-button"],
152
186
  children: "Закрыть"
153
187
  }
154
- ) })
155
- ] })
156
- }
157
- )
188
+ )
189
+ }
190
+ )
191
+ ]
158
192
  }
159
193
  ),
160
194
  /* @__PURE__ */ t(
@@ -163,20 +197,20 @@ import '../../assets/Drawer.css';const ae = "_drawer_13ua6_2", ie = "_content_13
163
197
  className: n(
164
198
  e.overlay,
165
199
  {
166
- [e.unmount]: !p
200
+ [e.unmount]: !y
167
201
  },
168
- k
202
+ E
169
203
  ),
170
- style: B.overlay,
204
+ style: z.overlay,
171
205
  "data-testid": "drawer-overlay",
172
- onClick: W
206
+ onClick: ee
173
207
  }
174
208
  )
175
209
  ] });
176
- return w === !1 ? E : /* @__PURE__ */ t(re, { element: w, children: E });
210
+ return B === !1 ? I : /* @__PURE__ */ t(me, { element: B, children: I });
177
211
  }
178
212
  );
179
213
  export {
180
- Ne as ANIMATION_DELAY,
181
- Ae as Drawer
214
+ Oe as ANIMATION_DELAY,
215
+ Ye as Drawer
182
216
  };
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { EScrollBarSize, EScrollBarVariant } from '../../ScrollBar/constants';
3
+
4
+ type Props = {
5
+ children: React.ReactNode;
6
+ className?: string;
7
+ variant?: `${EScrollBarVariant}`;
8
+ size?: `${EScrollBarSize}`;
9
+ };
10
+ export declare const ScrollWrapper: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
11
+ export {};