mimir-ui-kit 1.43.7 → 1.43.8

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
  };
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.8",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {