skillgrid 0.0.81 → 0.0.83

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,153 +1,160 @@
1
- import { jsx as o, jsxs as C } from "react/jsx-runtime";
2
- import { useState as v, useEffect as W } from "react";
3
- import j from "rc-tooltip";
1
+ import { jsx as o, jsxs as x } from "react/jsx-runtime";
2
+ import { useState as O, useEffect as N } from "react";
3
+ import q from "rc-tooltip";
4
4
  import t from "./Tooltip.module.css.js";
5
- import { clsx as S } from "clsx";
6
- import { TOOLTIP_PLACEMENTS_M as F, TOOLTIP_PLACEMENTS_SMALL as q, BUTTON_PRESETS as D } from "./Tooltip.constants.js";
7
- import { TooltipArrowIcon as H, CrossOutlinedIcon as U } from "./assets/react-svg-icons.js";
8
- import { Typography as x } from "../Typography/Typography.js";
9
- import { mergeTooltipButtonProps as $ } from "./utils/merge-tooltip-button-props.js";
10
- import { Button as G } from "../Button/Button.js";
11
- import { getIntInRange as J } from "../../lib/get-int-in-range.js";
12
- const K = (f, a, s) => {
13
- const r = J(a, 1, 3), c = D[s][r];
14
- return c[Math.min(f, c.length - 1)];
15
- }, O = ({
16
- text: f,
17
- title: a,
18
- media: s,
5
+ import { clsx as A } from "clsx";
6
+ import { TOOLTIP_PLACEMENTS_M as C, TOOLTIP_PLACEMENTS_SMALL as D, BUTTON_PRESETS as H } from "./Tooltip.constants.js";
7
+ import { TooltipArrowIcon as U, CrossOutlinedIcon as $ } from "./assets/react-svg-icons.js";
8
+ import { Typography as _ } from "../Typography/Typography.js";
9
+ import { mergeTooltipButtonProps as G } from "./utils/merge-tooltip-button-props.js";
10
+ import { Button as J } from "../Button/Button.js";
11
+ import { getIntInRange as K } from "../../lib/get-int-in-range.js";
12
+ const Q = (y, p, a) => {
13
+ const r = K(p, 1, 3), l = H[a][r];
14
+ return l[Math.min(y, l.length - 1)];
15
+ }, R = ({
16
+ text: y,
17
+ title: p,
18
+ media: a,
19
19
  variant: r = "neutral",
20
- size: c,
21
- classNames: e = {},
22
- onClose: p,
20
+ size: l,
21
+ classNames: n = {},
22
+ onClose: s,
23
23
  buttons: m,
24
- buttonProps: k,
24
+ buttonProps: E,
25
25
  showClose: d
26
26
  }) => {
27
- const n = ["neutral", "accent"].includes(r) ? "contrast" : "primary", l = c === "m", w = !!(a && l), g = !!(s && l), A = m && !!m.length, I = !!(d && l) || !d && l && !A, u = c === "xs" ? 4 : 3;
28
- return /* @__PURE__ */ C("div", { className: t.content, children: [
29
- g && /* @__PURE__ */ o("div", { className: S(t.mediaWrapper, e.mediaWrapper), children: s }),
30
- /* @__PURE__ */ C("div", { className: e == null ? void 0 : e.textWrapper, children: [
31
- w && /* @__PURE__ */ o(
32
- x.Subtitle,
27
+ const e = ["neutral", "accent"].includes(r) ? "contrast" : "primary", i = l === "m", k = !!(p && i), B = !!(a && i), M = m && !!m.length, w = !!(d && i) || !d && i && !M, u = l === "xs" ? 4 : 3;
28
+ return /* @__PURE__ */ x("div", { className: t.content, children: [
29
+ B && /* @__PURE__ */ o("div", { className: A(t.mediaWrapper, n.mediaWrapper), children: a }),
30
+ /* @__PURE__ */ x("div", { className: n == null ? void 0 : n.textWrapper, children: [
31
+ k && /* @__PURE__ */ o(
32
+ _.Subtitle,
33
33
  {
34
- className: S(t.typography, t.title, e.typography),
34
+ className: A(t.typography, t.title, n.typography),
35
35
  size: 1,
36
36
  as: "h3",
37
- typographyStyle: n,
38
- children: a
37
+ typographyStyle: e,
38
+ children: p
39
39
  }
40
40
  ),
41
41
  /* @__PURE__ */ o(
42
- x.Label,
42
+ _.Label,
43
43
  {
44
- className: S(t.typography, t.text, e.typography),
45
- typographyStyle: n,
44
+ className: A(t.typography, t.text, n.typography),
45
+ typographyStyle: e,
46
46
  size: u,
47
- children: f
47
+ children: y
48
48
  }
49
49
  )
50
50
  ] }),
51
- I && /* @__PURE__ */ o(
51
+ w && /* @__PURE__ */ o(
52
52
  "button",
53
53
  {
54
54
  type: "button",
55
- className: S(t.closeButton, t[r], e.closeButton, {
56
- [t.hasMedia]: g
55
+ className: A(t.closeButton, t[r], n.closeButton, {
56
+ [t.hasMedia]: B
57
57
  }),
58
- onClick: p,
58
+ onClick: s,
59
59
  "aria-label": "Закрыть подсказку",
60
60
  "data-testid": "tooltip-close-button",
61
- children: /* @__PURE__ */ o(U, {})
61
+ children: /* @__PURE__ */ o($, {})
62
62
  }
63
63
  ),
64
- l && A && /* @__PURE__ */ o("div", { className: t.buttonStack, children: m.map((y, h) => {
65
- const B = K(h, m.length, r), T = $(y, B, k), { closeOnClick: M, ...i } = T;
66
- return /* @__PURE__ */ o(G, { ...i, onClick: (P) => {
67
- var b;
68
- (b = i.onClick) == null || b.call(i, P), M && (p == null || p());
64
+ i && M && /* @__PURE__ */ o("div", { className: t.buttonStack, children: m.map((T, h) => {
65
+ const f = Q(h, m.length, r), I = G(T, f, E), { closeOnClick: S, ...c } = I;
66
+ return /* @__PURE__ */ o(J, { ...c, onClick: (L) => {
67
+ var g;
68
+ (g = c.onClick) == null || g.call(c, L), S && (s == null || s());
69
69
  } }, h);
70
70
  }) })
71
71
  ] });
72
72
  }, lt = ({
73
- customContent: f,
74
- children: a,
75
- placement: s = "top",
73
+ customContent: y,
74
+ children: p,
75
+ placement: a = "top",
76
76
  contentClassNames: r,
77
- mouseEnterDelay: c = 0,
78
- mouseLeaveDelay: e = 0.1,
79
- showArrow: p = !0,
77
+ mouseEnterDelay: l = 0,
78
+ mouseLeaveDelay: n = 0.1,
79
+ showArrow: s = !0,
80
80
  showClose: m = !0,
81
- trigger: k = "hover",
81
+ trigger: E = "hover",
82
82
  variant: d = "neutral",
83
- size: n = "s",
84
- text: l,
85
- title: w,
86
- media: g,
87
- buttons: A,
88
- buttonProps: I,
83
+ size: e = "s",
84
+ text: i,
85
+ title: k,
86
+ media: B,
87
+ buttons: M,
88
+ buttonProps: w,
89
89
  onClose: u,
90
- visible: y,
90
+ visible: T,
91
91
  onVisibleChange: h,
92
- ...B
92
+ classNames: f,
93
+ ...I
93
94
  }) => {
94
- const [T, M] = v(!!y), i = y !== void 0, [L, P] = v(!1), b = n === "m" ? F : q, N = () => {
95
- i || M(!1), u == null || u();
96
- }, _ = (E) => {
97
- i || M(E), h == null || h(E);
98
- }, R = f || (n === "m" ? /* @__PURE__ */ o(
99
- O,
95
+ const [S, c] = O(!!T), P = T !== void 0, [L, g] = O(!1), W = e === "m" ? C : D, v = () => {
96
+ P || c(!1), u == null || u();
97
+ }, j = (b) => {
98
+ P || c(b), h == null || h(b);
99
+ }, F = y || (e === "m" ? /* @__PURE__ */ o(
100
+ R,
100
101
  {
101
102
  classNames: r,
102
- text: l,
103
+ text: i,
103
104
  variant: d,
104
- size: n,
105
- onClose: N,
106
- title: w,
107
- media: g,
105
+ size: e,
106
+ onClose: v,
107
+ title: k,
108
+ media: B,
108
109
  showClose: m,
109
- buttons: A,
110
- buttonProps: I
110
+ buttons: M,
111
+ buttonProps: w
111
112
  }
112
113
  ) : /* @__PURE__ */ o(
113
- O,
114
+ R,
114
115
  {
115
116
  classNames: r,
116
- text: l,
117
+ text: i,
117
118
  variant: d,
118
- size: n,
119
- onClose: N
119
+ size: e,
120
+ onClose: v
120
121
  }
121
122
  ));
122
- return W(() => {
123
- if (T) {
124
- const E = requestAnimationFrame(() => P(!0));
125
- return () => cancelAnimationFrame(E);
123
+ return N(() => {
124
+ if (S) {
125
+ const b = requestAnimationFrame(() => g(!0));
126
+ return () => cancelAnimationFrame(b);
126
127
  }
127
- P(!1);
128
- }, [T]), /* @__PURE__ */ o(
129
- j,
128
+ g(!1);
129
+ }, [S]), /* @__PURE__ */ o(
130
+ q,
130
131
  {
131
- visible: i ? y : T,
132
- onVisibleChange: _,
133
- classNames: {
134
- root: S(t.root, t[d], t[n], L && t.open),
135
- ...B.classNames
136
- },
137
- placement: s,
138
- overlay: R,
139
- trigger: k,
140
- mouseEnterDelay: c,
141
- mouseLeaveDelay: e,
132
+ visible: P ? T : S,
133
+ onVisibleChange: j,
134
+ placement: a,
135
+ overlay: F,
136
+ trigger: E,
137
+ mouseEnterDelay: l,
138
+ mouseLeaveDelay: n,
142
139
  motion: { motionName: "tooltipMotion" },
143
- builtinPlacements: b,
144
- showArrow: p ? {
145
- content: /* @__PURE__ */ o(H, {}),
146
- className: `tooltipArrow tooltipArrow-${n}`
140
+ builtinPlacements: W,
141
+ showArrow: s ? {
142
+ content: /* @__PURE__ */ o(U, {}),
143
+ className: `tooltipArrow tooltipArrow-${e}`
147
144
  } : !1,
148
145
  destroyTooltipOnHide: !0,
149
- ...B,
150
- children: a
146
+ ...I,
147
+ classNames: {
148
+ ...f,
149
+ root: A(
150
+ t.root,
151
+ t[d],
152
+ t[e],
153
+ L && t.open,
154
+ f == null ? void 0 : f.root
155
+ )
156
+ },
157
+ children: p
151
158
  }
152
159
  );
153
160
  };