mimir-ui-kit 1.43.0 → 1.43.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.
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
2
2
  import { SwiperProps } from 'swiper/react';
3
3
  import { EProgressBarPosition } from './constants';
4
4
 
5
- type TSlideImage = {
5
+ export type TSlideImage = {
6
6
  image?: string;
7
7
  imageDesktop?: string;
8
8
  imageMobile?: string;
@@ -14,6 +14,10 @@ type TProps = SwiperProps & {
14
14
  * Задержка перехода между слайдами
15
15
  */
16
16
  delay?: number;
17
+ /**
18
+ * Расстояние между слайдами
19
+ */
20
+ gap?: number;
17
21
  /**
18
22
  * Ширина пагинации слайдера на весь размер родительского контейнера
19
23
  */
@@ -71,5 +75,5 @@ type TProps = SwiperProps & {
71
75
  */
72
76
  images?: TSlideImage[];
73
77
  };
74
- export default function Slider({ images, children, onSlideClick, swiperClassName, slideClassName, imageClassName, navigationClassName, sliderBottomPanelClassName, descriptionsClassName, progressBarPosition, isFullPaginationWidth, needNavigation, leftDescription, rightDescription, delay, ...props }: TProps): import("react/jsx-runtime").JSX.Element;
78
+ export default function Slider({ images, children, gap, onSlideClick, swiperClassName, slideClassName, imageClassName, navigationClassName, sliderBottomPanelClassName, descriptionsClassName, progressBarPosition, isFullPaginationWidth, needNavigation, leftDescription, rightDescription, delay, ...props }: TProps): import("react/jsx-runtime").JSX.Element;
75
79
  export {};
@@ -1,189 +1,203 @@
1
- import { jsx as s, jsxs as n, Fragment as $ } from "react/jsx-runtime";
2
- import { c as a } from "../../index-DIxK0V-G.js";
3
- import { memo as k, useCallback as d, useMemo as F, forwardRef as j, useRef as S, useState as D } from "react";
4
- import { u as U, S as Y, A as z, a as G } from "../../swiper-react-BvAw14a4.js";
5
- import { EProgressBarPosition as N } from "./constants.js";
6
- import { AppImage as q } from "../Image/Image.js";
7
- import { MergedButton as H } from "../MergedButton/MergedButton.js";
8
- import '../../assets/Slider.css';const J = "_swiper_qafre_2", K = "_slide_qafre_8", Q = "_link_qafre_15", V = "_image_qafre_21", W = "_navigation_qafre_28", X = "_pagination_qafre_38", Z = "_slides_qafre_57", ee = "_separator_qafre_63", re = "_progress_qafre_70", se = "_descriptions_qafre_87", r = {
9
- swiper: J,
10
- slide: K,
11
- link: Q,
12
- image: V,
13
- navigation: W,
14
- pagination: X,
1
+ import { jsx as t, jsxs as i, Fragment as G } from "react/jsx-runtime";
2
+ import { c as n } from "../../index-DIxK0V-G.js";
3
+ import { memo as x, useCallback as u, useMemo as H, forwardRef as J, useRef as q, useState as K, Children as v } from "react";
4
+ import { u as Q, S as V, A as W, a as k } from "../../swiper-react-BvAw14a4.js";
5
+ import { EProgressBarPosition as C } from "./constants.js";
6
+ import { formatSlideNumber as y } from "./utils.js";
7
+ import { AppImage as A } from "../Image/Image.js";
8
+ import { MergedButton as X } from "../MergedButton/MergedButton.js";
9
+ import '../../assets/Slider.css';const Z = "_swiper_qafre_2", ee = "_slide_qafre_8", re = "_link_qafre_15", se = "_image_qafre_21", te = "_navigation_qafre_28", ae = "_pagination_qafre_38", ne = "_slides_qafre_57", oe = "_separator_qafre_63", ie = "_progress_qafre_70", le = "_descriptions_qafre_87", s = {
10
+ swiper: Z,
11
+ slide: ee,
12
+ link: re,
13
+ image: se,
14
+ navigation: te,
15
+ pagination: ae,
15
16
  "is-full": "_is-full_qafre_52",
16
- slides: Z,
17
- separator: ee,
18
- progress: re,
17
+ slides: ne,
18
+ separator: oe,
19
+ progress: ie,
19
20
  "progress-bar-bottom": "_progress-bar-bottom_qafre_77",
20
21
  "progress-bar": "_progress-bar_qafre_77",
21
- descriptions: se
22
- }, te = 15e3, ae = k(() => {
23
- const e = U(), o = d(() => {
22
+ descriptions: le
23
+ }, ce = 15e3, de = x(() => {
24
+ const e = Q(), a = u(() => {
24
25
  e.slideNext();
25
- }, [e]), l = d(() => {
26
+ }, [e]), c = u(() => {
26
27
  e.slidePrev();
27
- }, [e]), p = F(
28
+ }, [e]), d = H(
28
29
  () => [
29
30
  {
30
31
  isIconButton: !0,
31
32
  iconName: "ArrowLeft16px",
32
33
  variant: "white",
33
- onClick: l
34
+ onClick: c
34
35
  },
35
36
  {
36
37
  isIconButton: !0,
37
38
  iconName: "ArrowRight16px",
38
39
  variant: "white",
39
- onClick: o
40
+ onClick: a
40
41
  }
41
42
  ],
42
- [l, o]
43
+ [c, a]
43
44
  );
44
- return /* @__PURE__ */ s(H, { buttons: p });
45
- }), v = k(
46
- j((e, o) => /* @__PURE__ */ s(
45
+ return /* @__PURE__ */ t(X, { buttons: d });
46
+ }), B = x(
47
+ J((e, a) => /* @__PURE__ */ t(
47
48
  "div",
48
49
  {
49
50
  "data-testid": "progress-bar-wrapper",
50
- className: a(r.progress, e == null ? void 0 : e.className),
51
- children: /* @__PURE__ */ s(
51
+ className: n(s.progress, e == null ? void 0 : e.className),
52
+ children: /* @__PURE__ */ t(
52
53
  "div",
53
54
  {
54
- ref: o,
55
- className: r["progress-bar"],
55
+ ref: a,
56
+ className: s["progress-bar"],
56
57
  "data-testid": "progress-bar"
57
58
  }
58
59
  )
59
60
  }
60
61
  ))
61
62
  );
62
- function fe({
63
+ function Se({
63
64
  images: e,
64
- children: o,
65
- onSlideClick: l,
66
- swiperClassName: p,
67
- slideClassName: x,
68
- imageClassName: g,
69
- navigationClassName: A,
70
- sliderBottomPanelClassName: y,
71
- descriptionsClassName: B,
72
- progressBarPosition: h = "top",
73
- isFullPaginationWidth: C = !1,
74
- needNavigation: i = !0,
75
- leftDescription: w,
76
- rightDescription: b,
77
- delay: I = te,
78
- ...P
65
+ children: a,
66
+ gap: c,
67
+ onSlideClick: d,
68
+ swiperClassName: I,
69
+ slideClassName: g,
70
+ imageClassName: w,
71
+ navigationClassName: P,
72
+ sliderBottomPanelClassName: T,
73
+ descriptionsClassName: F,
74
+ progressBarPosition: b = "top",
75
+ isFullPaginationWidth: E = !1,
76
+ needNavigation: l = !0,
77
+ leftDescription: S,
78
+ rightDescription: N,
79
+ delay: L = ce,
80
+ ...M
79
81
  }) {
80
- const c = S(null), f = S(null), [T, E] = D(1), L = `0${T}`, M = `0${(e == null ? void 0 : e.length) ?? 0}`, O = d(() => {
81
- if (f.current && i) {
82
- const t = f.current.swiper;
83
- E(t.realIndex + 1);
82
+ const p = q(null), f = q(null), [O, R] = K(1), m = !(typeof a == "function") && !!a, $ = m ? v.count(a) : 0, j = (e == null ? void 0 : e.length) ?? 0, D = y(O), U = y(
83
+ m ? $ : j
84
+ ), Y = u(() => {
85
+ if (f.current && l) {
86
+ const r = f.current.swiper;
87
+ R(r.realIndex + 1);
84
88
  }
85
- }, [i]), R = d(
86
- (t, u) => {
87
- if (c.current && i) {
88
- const _ = t.params.autoplay.delay, m = u / _ * 100;
89
- c.current.style.width = `${100 - m}%`;
89
+ }, [l]), z = u(
90
+ (r, o) => {
91
+ if (p.current && l) {
92
+ const _ = r.params.autoplay.delay, h = o / _ * 100;
93
+ p.current.style.width = `${100 - h}%`;
90
94
  }
91
95
  },
92
- [i]
96
+ [l]
93
97
  );
94
- return /* @__PURE__ */ n(
95
- Y,
98
+ return /* @__PURE__ */ i(
99
+ V,
96
100
  {
97
- ...P,
101
+ ...M,
98
102
  ref: f,
99
- className: a(r.swiper, p),
103
+ className: n(s.swiper, I),
100
104
  loop: !0,
105
+ spaceBetween: c,
101
106
  autoplay: {
102
- delay: I,
107
+ delay: L,
103
108
  disableOnInteraction: !1
104
109
  },
105
110
  fadeEffect: {
106
111
  crossFade: !0
107
112
  },
108
- modules: [z],
109
- onAutoplayTimeLeft: R,
110
- onSlideChange: O,
113
+ modules: [W],
114
+ onAutoplayTimeLeft: z,
115
+ onSlideChange: Y,
111
116
  children: [
112
- /* @__PURE__ */ s(
117
+ /* @__PURE__ */ t(
113
118
  "div",
114
119
  {
115
- className: a(r.navigation, A),
120
+ className: n(s.navigation, P),
116
121
  slot: "container-start",
117
- children: i && /* @__PURE__ */ n($, { children: [
118
- /* @__PURE__ */ n(
122
+ children: l && /* @__PURE__ */ i(G, { children: [
123
+ /* @__PURE__ */ i(
119
124
  "div",
120
125
  {
121
126
  "data-testid": "pagination",
122
- className: a(r.pagination, {
123
- [r["is-full"]]: C
127
+ className: n(s.pagination, {
128
+ [s["is-full"]]: E
124
129
  }),
125
130
  children: [
126
- /* @__PURE__ */ n("h2", { className: r.slides, children: [
127
- L,
128
- /* @__PURE__ */ s("span", { className: r.separator }),
129
- M
131
+ /* @__PURE__ */ i("h2", { className: s.slides, children: [
132
+ D,
133
+ /* @__PURE__ */ t("span", { className: s.separator }),
134
+ U
130
135
  ] }),
131
- /* @__PURE__ */ s(ae, {})
136
+ /* @__PURE__ */ t(de, {})
132
137
  ]
133
138
  }
134
139
  ),
135
- h === N.TOP && /* @__PURE__ */ s(v, { ref: c })
140
+ b === C.TOP && /* @__PURE__ */ t(B, { ref: p })
136
141
  ] })
137
142
  }
138
143
  ),
139
- e == null ? void 0 : e.map((t, u) => {
140
- if (!t) return null;
141
- const _ = /* @__PURE__ */ s(
144
+ m ? v.map(a, (r, o) => /* @__PURE__ */ t(
145
+ k,
146
+ {
147
+ onClick: d,
148
+ "data-testid": `slide-${o}`,
149
+ className: n(s.slide, g),
150
+ children: r
151
+ },
152
+ o
153
+ )) : e == null ? void 0 : e.map((r, o) => {
154
+ if (!r) return null;
155
+ const _ = /* @__PURE__ */ t(
142
156
  "a",
143
157
  {
144
- className: r.link,
145
- href: t.url,
158
+ className: s.link,
159
+ href: r.url,
146
160
  rel: "noopener noreferrer",
147
161
  target: "_blank",
148
- children: /* @__PURE__ */ s(
149
- q,
162
+ children: /* @__PURE__ */ t(
163
+ A,
150
164
  {
151
- className: a(r.image, g),
152
- src: t.image
165
+ className: n(s.image, w),
166
+ src: r.image
153
167
  }
154
168
  )
155
169
  }
156
- ), m = () => typeof o == "function" ? o(t) : t.url ? _ : /* @__PURE__ */ s(
157
- q,
170
+ ), h = () => typeof a == "function" ? a(r) : r.url ? _ : /* @__PURE__ */ t(
171
+ A,
158
172
  {
159
- className: a(r.image, g),
160
- src: t.image,
161
- desktopImage: t.imageDesktop,
162
- mobileImage: t.imageMobile
173
+ className: n(s.image, w),
174
+ src: r.image,
175
+ desktopImage: r.imageDesktop,
176
+ mobileImage: r.imageMobile
163
177
  }
164
178
  );
165
- return /* @__PURE__ */ s(
166
- G,
179
+ return /* @__PURE__ */ t(
180
+ k,
167
181
  {
168
- "data-testid": `slide-${u}`,
169
- onClick: l,
170
- className: a(r.slide, x),
171
- children: m()
182
+ "data-testid": `slide-${o}`,
183
+ onClick: d,
184
+ className: n(s.slide, g),
185
+ children: h()
172
186
  },
173
- t.id
187
+ r.id
174
188
  );
175
189
  }),
176
- h === N.BOTTOM && /* @__PURE__ */ n("div", { className: y, children: [
177
- /* @__PURE__ */ s(
178
- v,
190
+ b === C.BOTTOM && /* @__PURE__ */ i("div", { className: T, children: [
191
+ /* @__PURE__ */ t(
192
+ B,
179
193
  {
180
- ref: c,
181
- className: r["progress-bar-bottom"]
194
+ ref: p,
195
+ className: s["progress-bar-bottom"]
182
196
  }
183
197
  ),
184
- /* @__PURE__ */ n("div", { className: a(r.descriptions, B), children: [
185
- w && /* @__PURE__ */ s("div", { "data-testid": "slider-left-description", children: w }),
186
- b && /* @__PURE__ */ s("div", { "data-testid": "slider-right-description", children: b })
198
+ /* @__PURE__ */ i("div", { className: n(s.descriptions, F), children: [
199
+ S && /* @__PURE__ */ t("div", { "data-testid": "slider-left-description", children: S }),
200
+ N && /* @__PURE__ */ t("div", { "data-testid": "slider-right-description", children: N })
187
201
  ] })
188
202
  ] })
189
203
  ]
@@ -191,5 +205,5 @@ function fe({
191
205
  );
192
206
  }
193
207
  export {
194
- fe as default
208
+ Se as default
195
209
  };
@@ -0,0 +1 @@
1
+ export declare const formatSlideNumber: (num: number) => string;
@@ -0,0 +1,4 @@
1
+ const r = (t) => t.toString().padStart(2, "0");
2
+ export {
3
+ r as formatSlideNumber
4
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.43.0",
4
+ "version": "1.43.1",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {