mimir-ui-kit 1.43.7 → 1.43.9

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.
@@ -60,6 +60,10 @@ export type TProps = {
60
60
  * Класс, применяемый к карточке.
61
61
  */
62
62
  cardClassName?: string;
63
+ /**
64
+ * Колбэк, вызываемый при клике на стрелку.
65
+ */
66
+ onArrowClick?: () => void;
63
67
  };
64
68
  export declare const CardTrail: import('react').ForwardRefExoticComponent<TProps & {
65
69
  children?: import('react').ReactNode | undefined;
@@ -1,67 +1,68 @@
1
- import { jsxs as w, jsx as d } from "react/jsx-runtime";
2
- import { c as l } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as Y, useRef as f, useState as _, useEffect as G, Children as J } from "react";
4
- import { DEFAULT_SPACE_BETWEEN as K, DEFAULT_SCROLL_STEP as Q, DEFAULT_DIVIDED as Z, DEFAULT_CARD_INDEX as rr } from "./constants.js";
5
- import { hasHorizontalScroll as g, getCSSVariableNumericValue as D, isScrollAtEdge as L } from "./utils.js";
6
- import { useMergeRefs as tr } from "../../hooks/useMergeRefs/useMergeRefs.js";
7
- import { useThrottledCallback as er } from "../../hooks/useThrottledCallback/index.js";
8
- import { MergedButton as ar } from "../MergedButton/MergedButton.js";
9
- import '../../assets/CardTrail.css';const ir = "_pointer_1wzbr_50", i = {
1
+ import { jsxs as L, jsx as u } from "react/jsx-runtime";
2
+ import { c as n } from "../../index-DIxK0V-G.js";
3
+ import { forwardRef as G, useRef as _, useState as g, useEffect as J, Children as K } from "react";
4
+ import { DEFAULT_SPACE_BETWEEN as Q, DEFAULT_SCROLL_STEP as Z, DEFAULT_DIVIDED as rr, DEFAULT_CARD_INDEX as tr } from "./constants.js";
5
+ import { hasHorizontalScroll as p, getCSSVariableNumericValue as z, isScrollAtEdge as W } from "./utils.js";
6
+ import { useMergeRefs as er } from "../../hooks/useMergeRefs/useMergeRefs.js";
7
+ import { useThrottledCallback as ar } from "../../hooks/useThrottledCallback/index.js";
8
+ import { MergedButton as ir } from "../MergedButton/MergedButton.js";
9
+ import '../../assets/CardTrail.css';const cr = "_pointer_1wzbr_50", i = {
10
10
  "card-trail": "_card-trail_1wzbr_3",
11
11
  "card-trail-header": "_card-trail-header_1wzbr_7",
12
12
  "card-trail-header-title": "_card-trail-header-title_1wzbr_15",
13
13
  "card-trail-header-merged-button": "_card-trail-header-merged-button_1wzbr_29",
14
14
  "card-trail-list": "_card-trail-list_1wzbr_32",
15
15
  "card-trail-list-item": "_card-trail-list-item_1wzbr_46",
16
- pointer: ir
16
+ pointer: cr
17
17
  };
18
- let z = {};
19
- const mr = Y((W, A) => {
18
+ let w = {};
19
+ const fr = G((R, I) => {
20
20
  const {
21
- cardClassName: R,
22
- cardTrailClassName: k,
23
- cardTrailHeaderClassName: I,
24
- cardTrailListClassName: y,
25
- cardTrailMergedButtonClassName: M,
26
- children: p,
27
- title: u,
28
- spaceBetween: n = K,
29
- scrollStep: b = Q,
30
- dividedCardWidth: V = Z,
31
- currentCardIndex: h = rr,
21
+ cardClassName: A,
22
+ cardTrailClassName: y,
23
+ cardTrailHeaderClassName: M,
24
+ cardTrailListClassName: V,
25
+ cardTrailMergedButtonClassName: k,
26
+ children: b,
27
+ title: h,
28
+ spaceBetween: s = Q,
29
+ scrollStep: C = Z,
30
+ dividedCardWidth: x = rr,
31
+ currentCardIndex: m = tr,
32
32
  mergedButtonProps: c,
33
- scrollToCard: C = !1,
34
- needButtons: B = !0,
35
- padding: N = 0
36
- } = W, r = f(null), S = f(!0), o = f(null), [s, x] = _({
33
+ scrollToCard: B = !1,
34
+ needButtons: N = !0,
35
+ padding: S = 0,
36
+ onArrowClick: l
37
+ } = R, r = _(null), E = _(!0), d = _(null), [o, U] = g({
37
38
  leftButton: !0,
38
39
  rightButton: !1
39
- }), [U, F] = _(0), [E, T] = _(
40
- () => g(r == null ? void 0 : r.current)
41
- ), H = tr(r, A), O = er(() => {
42
- var v;
43
- if (S.current) {
44
- S.current = !1;
45
- const m = r.current, P = ((v = m == null ? void 0 : m.children[h]) == null ? void 0 : v.clientWidth) ?? 0, X = D(N);
46
- F(
47
- P / V + X + n
40
+ }), [F, H] = g(0), [T, v] = g(
41
+ () => p(r == null ? void 0 : r.current)
42
+ ), O = er(r, I), $ = ar(() => {
43
+ var D;
44
+ if (E.current) {
45
+ E.current = !1;
46
+ const f = r.current, X = ((D = f == null ? void 0 : f.children[m]) == null ? void 0 : D.clientWidth) ?? 0, Y = z(S);
47
+ H(
48
+ X / x + Y + s
48
49
  );
49
50
  }
50
- const t = D(N);
51
- z = {
51
+ const t = z(S);
52
+ w = {
52
53
  paddingLeft: t,
53
54
  paddingRight: t,
54
55
  marginLeft: -t,
55
56
  marginRight: -t
56
57
  };
57
- const e = !L(r.current, "left"), a = !L(r.current, "right");
58
- x({
58
+ const e = !W(r.current, "left"), a = !W(r.current, "right");
59
+ U({
59
60
  leftButton: !e,
60
61
  rightButton: !a
61
62
  });
62
- }, 300), $ = (t) => () => {
63
+ }, 300), j = (t) => () => {
63
64
  var a;
64
- if (!C)
65
+ if (!B)
65
66
  return;
66
67
  const e = (a = r == null ? void 0 : r.current) == null ? void 0 : a.querySelector(
67
68
  `[data-active-card='${t}']`
@@ -71,55 +72,55 @@ const mr = Y((W, A) => {
71
72
  block: "nearest",
72
73
  inline: "center"
73
74
  }));
74
- }, j = () => {
75
+ }, q = () => {
75
76
  var a;
76
- if (!r.current || s.leftButton) return;
77
- const t = r.current, e = ((a = t.children[h]) == null ? void 0 : a.clientWidth) ?? 0;
77
+ if (l == null || l(), !r.current || o.leftButton) return;
78
+ const t = r.current, e = ((a = t.children[m]) == null ? void 0 : a.clientWidth) ?? 0;
78
79
  t.scrollBy({
79
- left: -(e + n) * b,
80
+ left: -(e + s) * C,
80
81
  behavior: "smooth"
81
82
  });
82
- }, q = () => {
83
+ }, P = () => {
83
84
  var a;
84
- if (!r.current || s.rightButton) return;
85
- const t = r.current, e = ((a = t.children[h]) == null ? void 0 : a.clientWidth) ?? 0;
85
+ if (l == null || l(), !r.current || o.rightButton) return;
86
+ const t = r.current, e = ((a = t.children[m]) == null ? void 0 : a.clientWidth) ?? 0;
86
87
  t.scrollBy({
87
- left: (e + n) * b,
88
+ left: (e + s) * C,
88
89
  behavior: "smooth"
89
90
  });
90
91
  };
91
- return G(() => {
92
+ return J(() => {
92
93
  const t = r.current;
93
94
  if (t)
94
- return o.current = new ResizeObserver(() => {
95
- T(g(r == null ? void 0 : r.current));
96
- }), o.current.observe(t), T(g(r == null ? void 0 : r.current)), () => {
97
- o.current && o.current.disconnect();
95
+ return d.current = new ResizeObserver(() => {
96
+ v(p(r == null ? void 0 : r.current));
97
+ }), d.current.observe(t), v(p(r == null ? void 0 : r.current)), () => {
98
+ d.current && d.current.disconnect();
98
99
  };
99
- }, [p]), /* @__PURE__ */ w("section", { className: l(i["card-trail"], k), children: [
100
- (u || E && B) && /* @__PURE__ */ w(
100
+ }, [b]), /* @__PURE__ */ L("section", { className: n(i["card-trail"], y), children: [
101
+ (h || T && N) && /* @__PURE__ */ L(
101
102
  "header",
102
103
  {
103
- className: l(
104
+ className: n(
104
105
  i["card-trail-header"],
105
- I
106
+ M
106
107
  ),
107
108
  children: [
108
- u && /* @__PURE__ */ d("h3", { className: i["card-trail-header-title"], children: u }),
109
- E && B && /* @__PURE__ */ d(
110
- ar,
109
+ h && /* @__PURE__ */ u("h3", { className: i["card-trail-header-title"], children: h }),
110
+ T && N && /* @__PURE__ */ u(
111
+ ir,
111
112
  {
112
- buttonsWrapperClassName: l(
113
+ buttonsWrapperClassName: n(
113
114
  i["card-trail-header-merged-button"],
114
- M
115
+ k
115
116
  ),
116
117
  buttons: [
117
118
  {
118
119
  isIconButton: !0,
119
120
  iconName: "ArrowLeft16px",
120
121
  variant: "gray",
121
- onClick: j,
122
- disabled: s.leftButton,
122
+ onClick: q,
123
+ disabled: o.leftButton,
123
124
  size: "s",
124
125
  ...c == null ? void 0 : c.leftButton
125
126
  },
@@ -127,9 +128,9 @@ const mr = Y((W, A) => {
127
128
  isIconButton: !0,
128
129
  iconName: "ArrowRight16px",
129
130
  variant: "gray",
130
- onClick: q,
131
+ onClick: P,
131
132
  size: "s",
132
- disabled: s.rightButton,
133
+ disabled: o.rightButton,
133
134
  ...c == null ? void 0 : c.rightButton
134
135
  }
135
136
  ]
@@ -138,27 +139,27 @@ const mr = Y((W, A) => {
138
139
  ]
139
140
  }
140
141
  ),
141
- /* @__PURE__ */ d(
142
+ /* @__PURE__ */ u(
142
143
  "ul",
143
144
  {
144
- onScroll: O,
145
+ onScroll: $,
145
146
  style: {
146
- gap: n,
147
- scrollPadding: `0 ${U}px`,
148
- ...z
147
+ gap: s,
148
+ scrollPadding: `0 ${F}px`,
149
+ ...w
149
150
  },
150
- className: l(i["card-trail-list"], y),
151
- ref: H,
152
- children: J.map(p, (t, e) => /* @__PURE__ */ d(
151
+ className: n(i["card-trail-list"], V),
152
+ ref: O,
153
+ children: K.map(b, (t, e) => /* @__PURE__ */ u(
153
154
  "li",
154
155
  {
155
- onClick: $(e),
156
+ onClick: j(e),
156
157
  "data-active-card": e,
157
158
  "data-testid": `card-trail-item-${e}`,
158
- className: l(
159
+ className: n(
159
160
  i["card-trail-list-item"],
160
- { [i.pointer]: C },
161
- R
161
+ { [i.pointer]: B },
162
+ A
162
163
  ),
163
164
  children: t
164
165
  }
@@ -168,5 +169,5 @@ const mr = Y((W, A) => {
168
169
  ] });
169
170
  });
170
171
  export {
171
- mr as CardTrail
172
+ fr as CardTrail
172
173
  };
@@ -27,6 +27,10 @@ type TProps = SwiperProps & {
27
27
  * Показывать стрелки навигации и количество слайдов.
28
28
  */
29
29
  needNavigation?: boolean;
30
+ /**
31
+ * Приостанавливать автопрокрутку при наведении на слайдер.
32
+ */
33
+ pauseOnMouseEnter?: boolean;
30
34
  /**
31
35
  * Функция, которая будет вызвана при клике на слайд.
32
36
  */
@@ -88,5 +92,5 @@ type TProps = SwiperProps & {
88
92
  */
89
93
  images?: TSlideImage[];
90
94
  };
91
- export default function Slider({ images, children, gap, onSlideClick, swiperClassName, slideClassName, imageClassName, navigationClassName, navigationContent, sliderBottomPanelClassName, descriptionsClassName, navigationContentClassName, buttonsVariant, progressBarPosition, isFullPaginationWidth, needNavigation, leftDescription, rightDescription, delay, ...props }: TProps): import("react/jsx-runtime").JSX.Element;
95
+ export default function Slider({ images, children, gap, onSlideClick, swiperClassName, slideClassName, imageClassName, navigationClassName, navigationContent, sliderBottomPanelClassName, descriptionsClassName, navigationContentClassName, buttonsVariant, progressBarPosition, isFullPaginationWidth, needNavigation, leftDescription, rightDescription, delay, pauseOnMouseEnter, ...props }: TProps): import("react/jsx-runtime").JSX.Element;
92
96
  export {};
@@ -1,35 +1,35 @@
1
1
  import { jsx as s, jsxs as o, Fragment as N } from "react/jsx-runtime";
2
2
  import { c as a } from "../../index-DIxK0V-G.js";
3
- import { memo as F, useCallback as u, useMemo as X, forwardRef as Z, useRef as B, useState as V, Children as I } from "react";
4
- import { u as W, S as ee, A as se, a as T } from "../../swiper-react-BvAw14a4.js";
3
+ import { memo as F, useCallback as u, useMemo as Z, forwardRef as V, useRef as B, useState as W, Children as I } from "react";
4
+ import { u as ee, S as se, A as re, a as T } from "../../swiper-react-BvAw14a4.js";
5
5
  import { EProgressBarPosition as S } from "./constants.js";
6
6
  import { formatSlideNumber as O } from "./utils.js";
7
7
  import { AppImage as P } from "../Image/Image.js";
8
- import { MergedButton as re } from "../MergedButton/MergedButton.js";
9
- import '../../assets/Slider.css';const te = "_swiper_zqjj3_2", ne = "_slide_zqjj3_8", ae = "_link_zqjj3_15", oe = "_image_zqjj3_21", ie = "_navigation_zqjj3_28", le = "_pagination_zqjj3_46", ce = "_slides_zqjj3_65", de = "_separator_zqjj3_71", pe = "_progress_zqjj3_78", ue = "_descriptions_zqjj3_95", e = {
10
- swiper: te,
11
- slide: ne,
12
- link: ae,
13
- image: oe,
14
- navigation: ie,
8
+ import { MergedButton as te } from "../MergedButton/MergedButton.js";
9
+ import '../../assets/Slider.css';const ne = "_swiper_zqjj3_2", ae = "_slide_zqjj3_8", oe = "_link_zqjj3_15", ie = "_image_zqjj3_21", le = "_navigation_zqjj3_28", ce = "_pagination_zqjj3_46", de = "_slides_zqjj3_65", pe = "_separator_zqjj3_71", ue = "_progress_zqjj3_78", me = "_descriptions_zqjj3_95", e = {
10
+ swiper: ne,
11
+ slide: ae,
12
+ link: oe,
13
+ image: ie,
14
+ navigation: le,
15
15
  "navigation-content": "_navigation-content_zqjj3_37",
16
- pagination: le,
16
+ pagination: ce,
17
17
  "is-full": "_is-full_zqjj3_60",
18
- slides: ce,
19
- separator: de,
20
- progress: pe,
18
+ slides: de,
19
+ separator: pe,
20
+ progress: ue,
21
21
  "progress-bar-bottom": "_progress-bar-bottom_zqjj3_85",
22
22
  "progress-bar": "_progress-bar_zqjj3_85",
23
- descriptions: ue
24
- }, me = 15e3, E = F(
23
+ descriptions: me
24
+ }, _e = 15e3, E = F(
25
25
  ({
26
26
  variant: t = "white"
27
27
  }) => {
28
- const n = W(), p = u(() => {
28
+ const n = ee(), p = u(() => {
29
29
  n.slideNext();
30
30
  }, [n]), c = u(() => {
31
31
  n.slidePrev();
32
- }, [n]), m = X(
32
+ }, [n]), m = Z(
33
33
  () => [
34
34
  {
35
35
  isIconButton: !0,
@@ -46,10 +46,10 @@ import '../../assets/Slider.css';const te = "_swiper_zqjj3_2", ne = "_slide_zqjj
46
46
  ],
47
47
  [c, t, p]
48
48
  );
49
- return /* @__PURE__ */ s(re, { buttons: m });
49
+ return /* @__PURE__ */ s(te, { buttons: m });
50
50
  }
51
51
  ), b = F(
52
- Z((t, n) => /* @__PURE__ */ s(
52
+ V((t, n) => /* @__PURE__ */ s(
53
53
  "div",
54
54
  {
55
55
  "data-testid": "progress-bar-wrapper",
@@ -65,7 +65,7 @@ import '../../assets/Slider.css';const te = "_swiper_zqjj3_2", ne = "_slide_zqjj
65
65
  }
66
66
  ))
67
67
  );
68
- function qe({
68
+ function ze({
69
69
  images: t,
70
70
  children: n,
71
71
  gap: p,
@@ -84,17 +84,18 @@ function qe({
84
84
  needNavigation: i = !0,
85
85
  leftDescription: C,
86
86
  rightDescription: y,
87
- delay: D = me,
88
- ...U
87
+ delay: D = _e,
88
+ pauseOnMouseEnter: U = !1,
89
+ ...Y
89
90
  }) {
90
- const d = B(null), h = B(null), [Y, G] = V(1), j = !(typeof n == "function") && !!n, H = j ? I.count(n) : 0, J = (t == null ? void 0 : t.length) ?? 0, A = O(Y), x = O(
91
- j ? H : J
92
- ), K = u(() => {
91
+ const d = B(null), h = B(null), [G, H] = W(1), j = !(typeof n == "function") && !!n, J = j ? I.count(n) : 0, K = (t == null ? void 0 : t.length) ?? 0, A = O(G), x = O(
92
+ j ? J : K
93
+ ), Q = u(() => {
93
94
  if (h.current && i) {
94
95
  const r = h.current.swiper;
95
- G(r.realIndex + 1);
96
+ H(r.realIndex + 1);
96
97
  }
97
- }, [i]), Q = u(
98
+ }, [i]), X = u(
98
99
  (r, l) => {
99
100
  if (d.current && i) {
100
101
  const g = r.params.autoplay.delay, w = l / g * 100;
@@ -104,23 +105,24 @@ function qe({
104
105
  [i]
105
106
  );
106
107
  return /* @__PURE__ */ o(
107
- ee,
108
+ se,
108
109
  {
109
- ...U,
110
+ ...Y,
110
111
  ref: h,
111
112
  className: a(e.swiper, m),
112
113
  loop: !0,
113
114
  spaceBetween: p,
114
115
  autoplay: {
115
116
  delay: D,
116
- disableOnInteraction: !1
117
+ disableOnInteraction: !1,
118
+ pauseOnMouseEnter: U
117
119
  },
118
120
  fadeEffect: {
119
121
  crossFade: !0
120
122
  },
121
- modules: [se],
122
- onAutoplayTimeLeft: Q,
123
- onSlideChange: K,
123
+ modules: [re],
124
+ onAutoplayTimeLeft: X,
125
+ onSlideChange: Q,
124
126
  children: [
125
127
  /* @__PURE__ */ s(
126
128
  "div",
@@ -246,5 +248,5 @@ function qe({
246
248
  );
247
249
  }
248
250
  export {
249
- qe as default
251
+ ze as default
250
252
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.43.7",
4
+ "version": "1.43.9",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {