skillgrid 0.0.81 → 0.0.82
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.
- package/dist/assets/components/Dialog/Dialog.module-OXi8ThCq.css +1 -0
- package/dist/components/Avatar/AvatarGroup/AvatarGroupRoot.js +5 -5
- package/dist/components/Dialog/Dialog.js +52 -47
- package/dist/components/Dialog/Dialog.module.css.js +13 -13
- package/dist/components/Dialog/lib/index.d.ts +1 -0
- package/dist/components/Dialog/lib/use-visual-viewport-center.d.ts +7 -0
- package/dist/components/Dialog/lib/use-visual-viewport-center.js +41 -0
- package/dist/components/Dialog/lib/use-visual-viewport-center.test.d.ts +1 -0
- package/dist/components/FileUpload/FileUpload.js +1 -1
- package/dist/components/InputBase/Input.js +6 -6
- package/dist/components/Popover/lib/use-popover.js +1 -1
- package/dist/components/Tabs/ScrollWrapper.js +1 -1
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +107 -100
- package/dist/index.cjs.js +3 -3
- package/dist/index.css +1 -1
- package/package.json +1 -1
- package/dist/assets/components/Dialog/Dialog.module-COQZK-Ta.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--dialog-margin: 12px;--dialog-border-radius: 24px}._overlay_1gisq_6{position:fixed;top:0;right:0;bottom:0;left:0;overflow:hidden;display:flex;flex-direction:column;background:#00000080;transition:opacity .2s ease-in-out}._container_1gisq_19{position:absolute;overflow:hidden;overflow-y:auto;min-width:300px;background:var(--bg-primary);border-radius:var(--dialog-border-radius);box-shadow:0 4px 24px #0000001a}._placement-default_1gisq_32{top:0;left:50%;translate:-50% 0;max-width:90dvw;max-height:90dvh;margin-right:auto;margin-left:auto;margin-block:80px}._placement-bottom-left_1gisq_45{bottom:0;left:0;max-width:90dvw;max-height:90dvh;margin:12px}._placement-bottom-right_1gisq_54{right:0;bottom:0;max-width:90dvw;max-height:90dvh;margin:12px}._placement-center_1gisq_64{position:fixed;top:50%;left:50%;translate:-50% -50%;max-width:90dvw;max-height:90dvh;margin-right:auto;margin-left:auto}._placement-left-drawer_1gisq_77{inset:0 auto 0 0;margin:12px;border-radius:16px}._placement-right-drawer_1gisq_83{inset:0 0 0 auto;margin:12px;border-radius:16px}._placement-bottom-sheet_1gisq_89{inset:auto 0 0;max-width:100dvw;max-height:90dvh;margin:0;border-radius:var(--dialog-border-radius) var(--dialog-border-radius) 0 0}._grabber_1gisq_100{position:absolute;z-index:1000;width:40px;height:4px;opacity:.7;background:var(--stroke-neutral);border-radius:4px}._container_1gisq_19:hover ._grabber_1gisq_100{opacity:1}._grabber-top_1gisq_118,._grabber-bottom_1gisq_119{top:10px;left:50%;transform:translate(-50%)}._grabber-right_1gisq_125{top:50%;left:10px;transform:translateY(-50%);width:4px;height:40px}._grabber-left_1gisq_134{top:50%;right:10px;transform:translateY(-50%);width:4px;height:40px}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import d from "classnames";
|
|
3
|
-
import g from "
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
3
|
+
import { useBackgroundColor as g } from "../../../hooks/useBackgroundColor.js";
|
|
4
|
+
import v from "./AvatarGroup.module.css.js";
|
|
5
|
+
import { AvatarGroupProvider as B } from "./AvatarGroupProvider.js";
|
|
6
6
|
const G = (t) => {
|
|
7
7
|
const {
|
|
8
8
|
children: a,
|
|
@@ -12,12 +12,12 @@ const G = (t) => {
|
|
|
12
12
|
cutoutBackground: u,
|
|
13
13
|
className: m,
|
|
14
14
|
style: n
|
|
15
|
-
} = t, { ref: p, bgColor: f } =
|
|
15
|
+
} = t, { ref: p, bgColor: f } = g(), o = u || f || "#ffffff", l = d(v.avatarGroup, m), i = {
|
|
16
16
|
"--avatar-cutout-bg": o,
|
|
17
17
|
...n
|
|
18
18
|
};
|
|
19
19
|
return /* @__PURE__ */ r(
|
|
20
|
-
|
|
20
|
+
B,
|
|
21
21
|
{
|
|
22
22
|
size: s,
|
|
23
23
|
shape: c,
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMergeRefs as
|
|
3
|
-
import
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { clsx as
|
|
1
|
+
import { jsxs as f, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useMergeRefs as w, FloatingPortal as V, FloatingOverlay as E, FloatingFocusManager as $ } from "@floating-ui/react";
|
|
3
|
+
import o from "./Dialog.module.css.js";
|
|
4
|
+
import { forwardRef as j } from "react";
|
|
5
|
+
import { clsx as c } from "clsx";
|
|
6
6
|
import { useDialogDraggable as I } from "./lib/use-dialog-draggable.js";
|
|
7
|
-
|
|
7
|
+
import { useVisualViewportCenter as M } from "./lib/use-visual-viewport-center.js";
|
|
8
|
+
const G = j((p, u) => {
|
|
8
9
|
const {
|
|
9
|
-
placement:
|
|
10
|
+
placement: i = "default",
|
|
10
11
|
open: d,
|
|
11
|
-
onOpenChange:
|
|
12
|
+
onOpenChange: m,
|
|
12
13
|
overlayProps: e,
|
|
13
|
-
portalProps:
|
|
14
|
-
focusManagement:
|
|
15
|
-
children:
|
|
16
|
-
disableOutsideClick:
|
|
17
|
-
disableEscapeKey:
|
|
18
|
-
disableOverlay:
|
|
19
|
-
closeOnDrag:
|
|
20
|
-
className:
|
|
14
|
+
portalProps: b,
|
|
15
|
+
focusManagement: a,
|
|
16
|
+
children: h,
|
|
17
|
+
disableOutsideClick: N = !1,
|
|
18
|
+
disableEscapeKey: O = !1,
|
|
19
|
+
disableOverlay: x = !1,
|
|
20
|
+
closeOnDrag: l,
|
|
21
|
+
className: C,
|
|
21
22
|
style: D,
|
|
22
|
-
"data-testid":
|
|
23
|
+
"data-testid": s,
|
|
23
24
|
...F
|
|
24
|
-
} =
|
|
25
|
+
} = p;
|
|
25
26
|
d === void 0 && process.env.NODE_ENV !== "production" && console.error(
|
|
26
27
|
"Dialog: компонент должен быть контролируемым. Используйте пропсы open и onOpenChange."
|
|
27
28
|
);
|
|
28
|
-
const
|
|
29
|
+
const r = I({
|
|
29
30
|
open: d,
|
|
30
|
-
onOpenChange:
|
|
31
|
-
placement:
|
|
32
|
-
disableEscapeKey:
|
|
33
|
-
closeOnDrag:
|
|
34
|
-
}), { isMounted:
|
|
35
|
-
|
|
31
|
+
onOpenChange: m,
|
|
32
|
+
placement: i,
|
|
33
|
+
disableEscapeKey: O,
|
|
34
|
+
closeOnDrag: l
|
|
35
|
+
}), { isMounted: g, transitionStyles: t } = r, y = M(i === "center" && g), v = w([u, r.refs.setFloating]), k = () => {
|
|
36
|
+
N || m(!1);
|
|
36
37
|
};
|
|
37
|
-
return
|
|
38
|
+
return g ? (
|
|
38
39
|
// `FloatingPortal` рендерит диалог в корне `document.body`,
|
|
39
40
|
// чтобы избежать проблем с z-index и overflow.
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
!
|
|
42
|
-
|
|
41
|
+
/* @__PURE__ */ f(V, { ...b, children: [
|
|
42
|
+
!x && /* @__PURE__ */ n(
|
|
43
|
+
E,
|
|
43
44
|
{
|
|
44
45
|
onPointerDown: k,
|
|
45
46
|
"data-testid": "dialog-overlay",
|
|
46
|
-
className:
|
|
47
|
+
className: c(o.overlay, e == null ? void 0 : e.className),
|
|
47
48
|
lockScroll: (e == null ? void 0 : e.lockScroll) ?? !0,
|
|
48
49
|
style: {
|
|
49
50
|
// Стили для анимации прозрачности оверлея
|
|
@@ -53,35 +54,39 @@ const z = w((f, p) => {
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
57
|
+
/* @__PURE__ */ n(
|
|
58
|
+
$,
|
|
58
59
|
{
|
|
59
60
|
initialFocus: 1 / 0,
|
|
60
|
-
...
|
|
61
|
-
context: { ...
|
|
62
|
-
children: /* @__PURE__ */
|
|
61
|
+
...a,
|
|
62
|
+
context: { ...r.context, ...a == null ? void 0 : a.context },
|
|
63
|
+
children: /* @__PURE__ */ f(
|
|
63
64
|
"section",
|
|
64
65
|
{
|
|
65
|
-
ref:
|
|
66
|
+
ref: v,
|
|
66
67
|
"aria-modal": "true",
|
|
67
68
|
role: "dialog",
|
|
68
|
-
className:
|
|
69
|
-
style: {
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
className: c(C, o.container, o[`placement-${i}`]),
|
|
70
|
+
style: {
|
|
71
|
+
...y ?? {},
|
|
72
|
+
...D,
|
|
73
|
+
...t
|
|
74
|
+
},
|
|
75
|
+
"data-testid": s,
|
|
76
|
+
...r.getFloatingProps(F),
|
|
72
77
|
children: [
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
h,
|
|
79
|
+
l && /* @__PURE__ */ n(
|
|
75
80
|
"div",
|
|
76
81
|
{
|
|
77
|
-
className:
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
className: c(
|
|
83
|
+
o.grabber,
|
|
84
|
+
o[`grabber-${l.direction}`]
|
|
80
85
|
// classNames?.grabber,
|
|
81
86
|
),
|
|
82
87
|
role: "presentation",
|
|
83
88
|
"aria-hidden": "true",
|
|
84
|
-
"data-testid":
|
|
89
|
+
"data-testid": s ? `${s}-grabber` : void 0
|
|
85
90
|
}
|
|
86
91
|
)
|
|
87
92
|
]
|
|
@@ -93,5 +98,5 @@ const z = w((f, p) => {
|
|
|
93
98
|
) : null;
|
|
94
99
|
});
|
|
95
100
|
export {
|
|
96
|
-
|
|
101
|
+
G as Dialog
|
|
97
102
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import '../../assets/components/Dialog/Dialog.module-
|
|
1
|
+
import '../../assets/components/Dialog/Dialog.module-OXi8ThCq.css';const e = "_overlay_1gisq_6", t = "_container_1gisq_19", r = "_grabber_1gisq_100", _ = {
|
|
2
2
|
overlay: e,
|
|
3
3
|
container: t,
|
|
4
|
-
"placement-default": "_placement-
|
|
5
|
-
"placement-bottom-left": "_placement-bottom-
|
|
6
|
-
"placement-bottom-right": "_placement-bottom-
|
|
7
|
-
"placement-center": "_placement-
|
|
8
|
-
"placement-left-drawer": "_placement-left-
|
|
9
|
-
"placement-right-drawer": "_placement-right-
|
|
10
|
-
"placement-bottom-sheet": "_placement-bottom-
|
|
4
|
+
"placement-default": "_placement-default_1gisq_32",
|
|
5
|
+
"placement-bottom-left": "_placement-bottom-left_1gisq_45",
|
|
6
|
+
"placement-bottom-right": "_placement-bottom-right_1gisq_54",
|
|
7
|
+
"placement-center": "_placement-center_1gisq_64",
|
|
8
|
+
"placement-left-drawer": "_placement-left-drawer_1gisq_77",
|
|
9
|
+
"placement-right-drawer": "_placement-right-drawer_1gisq_83",
|
|
10
|
+
"placement-bottom-sheet": "_placement-bottom-sheet_1gisq_89",
|
|
11
11
|
grabber: r,
|
|
12
|
-
"grabber-top": "_grabber-
|
|
13
|
-
"grabber-bottom": "_grabber-
|
|
14
|
-
"grabber-right": "_grabber-
|
|
15
|
-
"grabber-left": "_grabber-
|
|
12
|
+
"grabber-top": "_grabber-top_1gisq_118",
|
|
13
|
+
"grabber-bottom": "_grabber-bottom_1gisq_119",
|
|
14
|
+
"grabber-right": "_grabber-right_1gisq_125",
|
|
15
|
+
"grabber-left": "_grabber-left_1gisq_134"
|
|
16
16
|
};
|
|
17
17
|
export {
|
|
18
18
|
t as container,
|
|
19
|
-
|
|
19
|
+
_ as default,
|
|
20
20
|
r as grabber,
|
|
21
21
|
e as overlay
|
|
22
22
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type VisualViewportCenter = {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const getVisualViewportCenter: (targetWindow: Window) => VisualViewportCenter;
|
|
6
|
+
/** Удерживает центрированный диалог в видимой области visual viewport. */
|
|
7
|
+
export declare const useVisualViewportCenter: (enabled: boolean) => VisualViewportCenter | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useState as m, useEffect as a, useLayoutEffect as u } from "react";
|
|
2
|
+
const E = typeof window > "u" ? a : u, f = (t, n) => (t == null ? void 0 : t.left) === n.left && t.top === n.top, d = (t) => {
|
|
3
|
+
const n = t.visualViewport;
|
|
4
|
+
if (n)
|
|
5
|
+
return {
|
|
6
|
+
left: n.offsetLeft + n.width / 2,
|
|
7
|
+
top: n.offsetTop + n.height / 2
|
|
8
|
+
};
|
|
9
|
+
const i = t.document.documentElement, o = i.clientWidth || t.innerWidth, e = i.clientHeight || t.innerHeight;
|
|
10
|
+
return {
|
|
11
|
+
left: o / 2,
|
|
12
|
+
top: e / 2
|
|
13
|
+
};
|
|
14
|
+
}, C = (t) => {
|
|
15
|
+
const [n, i] = m(null);
|
|
16
|
+
return E(() => {
|
|
17
|
+
if (!t || typeof window > "u") {
|
|
18
|
+
i(null);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const o = window, e = o.visualViewport;
|
|
22
|
+
let s = null;
|
|
23
|
+
const r = () => {
|
|
24
|
+
s !== null && o.cancelAnimationFrame(s), s = o.requestAnimationFrame(() => {
|
|
25
|
+
s = null;
|
|
26
|
+
const l = d(o);
|
|
27
|
+
i((c) => f(c, l) ? c : l);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
return (() => {
|
|
31
|
+
const l = d(o);
|
|
32
|
+
i((c) => f(c, l) ? c : l);
|
|
33
|
+
})(), e == null || e.addEventListener("resize", r), e == null || e.addEventListener("scroll", r), o.addEventListener("resize", r), () => {
|
|
34
|
+
s !== null && o.cancelAnimationFrame(s), e == null || e.removeEventListener("resize", r), e == null || e.removeEventListener("scroll", r), o.removeEventListener("resize", r);
|
|
35
|
+
};
|
|
36
|
+
}, [t]), n;
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
d as getVisualViewportCenter,
|
|
40
|
+
C as useVisualViewportCenter
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,11 +2,11 @@ import { jsxs as m, jsx as a } from "react/jsx-runtime";
|
|
|
2
2
|
import { clsx as p } from "clsx";
|
|
3
3
|
import Ge from "rc-upload";
|
|
4
4
|
import { forwardRef as je, useContext as Fe, useState as W, useRef as se, useMemo as we, useLayoutEffect as He } from "react";
|
|
5
|
+
import { useIsMobile as ze } from "../../hooks/useIsMobile.js";
|
|
5
6
|
import { interpolate as de } from "../../locale/interpolate.js";
|
|
6
7
|
import t from "./FileUpload.module.css.js";
|
|
7
8
|
import { isMobileViewport as ve } from "../../utils/adaptive.js";
|
|
8
9
|
import { useLocale as ue } from "../ConfigProvider/ConfigProvider.hook.js";
|
|
9
|
-
import { useIsMobile as ze } from "../../hooks/useIsMobile.js";
|
|
10
10
|
import { SnackbarContext as We } from "../Snackbar/lib/useSnackbar.js";
|
|
11
11
|
import { Button as M } from "../Button/Button.js";
|
|
12
12
|
import { Icon as h } from "../Icon/IconWithCategories.js";
|
|
@@ -2,9 +2,9 @@ import { jsx as r, jsxs as W } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as z, useImperativeHandle as P } from "react";
|
|
3
3
|
import { clsx as f } from "clsx";
|
|
4
4
|
import e from "./InputBase.module.css.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useCompatId as Q } from "../../hooks/useCompatId.js";
|
|
6
|
+
import { useInputSync as Y } from "./lib/useInputSync.js";
|
|
7
|
+
import { useTextareaResize as Z } from "./lib/useTextareaResize.js";
|
|
8
8
|
import { MAX_HINT_LENGTH as k } from "./lib/constants.js";
|
|
9
9
|
import { useGripResize as U } from "./lib/useGripResize.js";
|
|
10
10
|
import { GripIcon as E } from "./assets/GripIcon.js";
|
|
@@ -32,8 +32,8 @@ const K = z(
|
|
|
32
32
|
resize: c,
|
|
33
33
|
...H
|
|
34
34
|
}, R) => {
|
|
35
|
-
const { textareaRef: w, inputRef: j, currentRef: d } =
|
|
36
|
-
if (
|
|
35
|
+
const { textareaRef: w, inputRef: j, currentRef: d } = Y(a, t);
|
|
36
|
+
if (Z(a, c, w), P(R, () => d.current, [d]), t === "textarea")
|
|
37
37
|
return /* @__PURE__ */ r(
|
|
38
38
|
"textarea",
|
|
39
39
|
{
|
|
@@ -132,7 +132,7 @@ const K = z(
|
|
|
132
132
|
showGrip: T = !1,
|
|
133
133
|
...L
|
|
134
134
|
}, O) => {
|
|
135
|
-
const X =
|
|
135
|
+
const X = Q("input-wrapper"), S = D || X, _ = y && s && (d || p), q = s && s.length > k ? s.substring(0, k) + "..." : s, B = f(
|
|
136
136
|
e.wrapper,
|
|
137
137
|
e[`size-${m}`],
|
|
138
138
|
a && e.error,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { offset as G, flip as H, shift as V, inline as q, size as J, hide as K, useFloating as Q, autoUpdate as Z, useTransitionStyles as M, useClick as ee, useHover as te, useFocus as oe, useDismiss as ne, useRole as se, useInteractions as re } from "@floating-ui/react";
|
|
2
2
|
import { useState as i, useMemo as v, useCallback as ce, useEffect as ae, useLayoutEffect as ie } from "react";
|
|
3
|
-
import { DEFAULT_FLOATING as le, hasMiddleware as fe } from "./utils.js";
|
|
4
3
|
import { useCompatId as S } from "../../../hooks/useCompatId.js";
|
|
4
|
+
import { DEFAULT_FLOATING as le, hasMiddleware as fe } from "./utils.js";
|
|
5
5
|
const r = 8, ue = (c) => {
|
|
6
6
|
switch (c.split("-")[0]) {
|
|
7
7
|
case "top":
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as N, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as W, useState as g, useEffect as w } from "react";
|
|
3
|
+
import { useBackgroundColor as M } from "../../hooks/useBackgroundColor.js";
|
|
3
4
|
import { clsx as i } from "clsx";
|
|
4
5
|
import e from "./ScrollWrapper.module.css.js";
|
|
5
|
-
import { useBackgroundColor as M } from "../../hooks/useBackgroundColor.js";
|
|
6
6
|
const B = "white", G = ({
|
|
7
7
|
children: b,
|
|
8
8
|
withControls: a = !0,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as n, jsxs as V } from "react/jsx-runtime";
|
|
2
2
|
import F, { useState as U, createContext as j, useContext as k } from "react";
|
|
3
3
|
import { ScrollWrapper as G } from "./ScrollWrapper.js";
|
|
4
|
+
import { useIsMobile as M } from "../../hooks/useIsMobile.js";
|
|
4
5
|
import { clsx as d } from "clsx";
|
|
5
6
|
import f from "../../styles/typography.module.css.js";
|
|
6
7
|
import a from "./Tabs.module.css.js";
|
|
7
|
-
import { useIsMobile as M } from "../../hooks/useIsMobile.js";
|
|
8
8
|
import { Badge as O } from "../Badge/Badge.js";
|
|
9
9
|
const W = "md", R = !1, Y = 8, Z = "top-right-inside", P = j(null), h = () => {
|
|
10
10
|
const t = k(P);
|
|
@@ -2,4 +2,4 @@ import { TooltipProps } from './Tooltip.type';
|
|
|
2
2
|
/**
|
|
3
3
|
* Tooltip component to render tooltip
|
|
4
4
|
*/
|
|
5
|
-
export declare const Tooltip: ({ customContent, children, placement, contentClassNames, mouseEnterDelay, mouseLeaveDelay, showArrow, showClose, trigger, variant, size, text, title, media, buttons, buttonProps, onClose, visible: outerVisible, onVisibleChange: outerOnVisibleChange, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const Tooltip: ({ customContent, children, placement, contentClassNames, mouseEnterDelay, mouseLeaveDelay, showArrow, showClose, trigger, variant, size, text, title, media, buttons, buttonProps, onClose, visible: outerVisible, onVisibleChange: outerOnVisibleChange, classNames: outerClassNames, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,153 +1,160 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
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
|
|
6
|
-
import { TOOLTIP_PLACEMENTS_M as
|
|
7
|
-
import { TooltipArrowIcon as
|
|
8
|
-
import { Typography as
|
|
9
|
-
import { mergeTooltipButtonProps as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { getIntInRange as
|
|
12
|
-
const
|
|
13
|
-
const r =
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
text:
|
|
17
|
-
title:
|
|
18
|
-
media:
|
|
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:
|
|
21
|
-
classNames:
|
|
22
|
-
onClose:
|
|
20
|
+
size: l,
|
|
21
|
+
classNames: n = {},
|
|
22
|
+
onClose: s,
|
|
23
23
|
buttons: m,
|
|
24
|
-
buttonProps:
|
|
24
|
+
buttonProps: E,
|
|
25
25
|
showClose: d
|
|
26
26
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
|
|
32
|
-
|
|
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:
|
|
34
|
+
className: A(t.typography, t.title, n.typography),
|
|
35
35
|
size: 1,
|
|
36
36
|
as: "h3",
|
|
37
|
-
typographyStyle:
|
|
38
|
-
children:
|
|
37
|
+
typographyStyle: e,
|
|
38
|
+
children: p
|
|
39
39
|
}
|
|
40
40
|
),
|
|
41
41
|
/* @__PURE__ */ o(
|
|
42
|
-
|
|
42
|
+
_.Label,
|
|
43
43
|
{
|
|
44
|
-
className:
|
|
45
|
-
typographyStyle:
|
|
44
|
+
className: A(t.typography, t.text, n.typography),
|
|
45
|
+
typographyStyle: e,
|
|
46
46
|
size: u,
|
|
47
|
-
children:
|
|
47
|
+
children: y
|
|
48
48
|
}
|
|
49
49
|
)
|
|
50
50
|
] }),
|
|
51
|
-
|
|
51
|
+
w && /* @__PURE__ */ o(
|
|
52
52
|
"button",
|
|
53
53
|
{
|
|
54
54
|
type: "button",
|
|
55
|
-
className:
|
|
56
|
-
[t.hasMedia]:
|
|
55
|
+
className: A(t.closeButton, t[r], n.closeButton, {
|
|
56
|
+
[t.hasMedia]: B
|
|
57
57
|
}),
|
|
58
|
-
onClick:
|
|
58
|
+
onClick: s,
|
|
59
59
|
"aria-label": "Закрыть подсказку",
|
|
60
60
|
"data-testid": "tooltip-close-button",
|
|
61
|
-
children: /* @__PURE__ */ o(
|
|
61
|
+
children: /* @__PURE__ */ o($, {})
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
return /* @__PURE__ */ o(
|
|
67
|
-
var
|
|
68
|
-
(
|
|
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:
|
|
74
|
-
children:
|
|
75
|
-
placement:
|
|
73
|
+
customContent: y,
|
|
74
|
+
children: p,
|
|
75
|
+
placement: a = "top",
|
|
76
76
|
contentClassNames: r,
|
|
77
|
-
mouseEnterDelay:
|
|
78
|
-
mouseLeaveDelay:
|
|
79
|
-
showArrow:
|
|
77
|
+
mouseEnterDelay: l = 0,
|
|
78
|
+
mouseLeaveDelay: n = 0.1,
|
|
79
|
+
showArrow: s = !0,
|
|
80
80
|
showClose: m = !0,
|
|
81
|
-
trigger:
|
|
81
|
+
trigger: E = "hover",
|
|
82
82
|
variant: d = "neutral",
|
|
83
|
-
size:
|
|
84
|
-
text:
|
|
85
|
-
title:
|
|
86
|
-
media:
|
|
87
|
-
buttons:
|
|
88
|
-
buttonProps:
|
|
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:
|
|
90
|
+
visible: T,
|
|
91
91
|
onVisibleChange: h,
|
|
92
|
-
|
|
92
|
+
classNames: f,
|
|
93
|
+
...I
|
|
93
94
|
}) => {
|
|
94
|
-
const [
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
|
|
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:
|
|
103
|
+
text: i,
|
|
103
104
|
variant: d,
|
|
104
|
-
size:
|
|
105
|
-
onClose:
|
|
106
|
-
title:
|
|
107
|
-
media:
|
|
105
|
+
size: e,
|
|
106
|
+
onClose: v,
|
|
107
|
+
title: k,
|
|
108
|
+
media: B,
|
|
108
109
|
showClose: m,
|
|
109
|
-
buttons:
|
|
110
|
-
buttonProps:
|
|
110
|
+
buttons: M,
|
|
111
|
+
buttonProps: w
|
|
111
112
|
}
|
|
112
113
|
) : /* @__PURE__ */ o(
|
|
113
|
-
|
|
114
|
+
R,
|
|
114
115
|
{
|
|
115
116
|
classNames: r,
|
|
116
|
-
text:
|
|
117
|
+
text: i,
|
|
117
118
|
variant: d,
|
|
118
|
-
size:
|
|
119
|
-
onClose:
|
|
119
|
+
size: e,
|
|
120
|
+
onClose: v
|
|
120
121
|
}
|
|
121
122
|
));
|
|
122
|
-
return
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
125
|
-
return () => cancelAnimationFrame(
|
|
123
|
+
return N(() => {
|
|
124
|
+
if (S) {
|
|
125
|
+
const b = requestAnimationFrame(() => g(!0));
|
|
126
|
+
return () => cancelAnimationFrame(b);
|
|
126
127
|
}
|
|
127
|
-
|
|
128
|
-
}, [
|
|
129
|
-
|
|
128
|
+
g(!1);
|
|
129
|
+
}, [S]), /* @__PURE__ */ o(
|
|
130
|
+
q,
|
|
130
131
|
{
|
|
131
|
-
visible:
|
|
132
|
-
onVisibleChange:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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:
|
|
144
|
-
showArrow:
|
|
145
|
-
content: /* @__PURE__ */ o(
|
|
146
|
-
className: `tooltipArrow tooltipArrow-${
|
|
140
|
+
builtinPlacements: W,
|
|
141
|
+
showArrow: s ? {
|
|
142
|
+
content: /* @__PURE__ */ o(U, {}),
|
|
143
|
+
className: `tooltipArrow tooltipArrow-${e}`
|
|
147
144
|
} : !1,
|
|
148
145
|
destroyTooltipOnHide: !0,
|
|
149
|
-
...
|
|
150
|
-
|
|
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
|
};
|