@via-profit/ui-kit 0.11.0 → 0.12.0
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/CHANGELOG.md +11 -0
- package/Popper/Popper.js +17 -12
- package/Tooltip/index.d.ts +6 -0
- package/Tooltip/index.js +9 -6
- package/esm/Popper/Popper.js +17 -12
- package/esm/Tooltip/index.js +9 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
## Не выпущено
|
|
6
6
|
|
|
7
|
+
## 0.12.0 — 2026-11-05
|
|
8
|
+
|
|
9
|
+
### Добавлено
|
|
10
|
+
|
|
11
|
+
- **Tooltip**: свойство `interactive` — указатель можно перевести на подсказку, чтобы выделить текст или нажать ссылку внутри. Без него подсказка не перехватывает указатель.
|
|
12
|
+
|
|
13
|
+
### Изменено
|
|
14
|
+
|
|
15
|
+
- **Tooltip**: по умолчанию подсказка не получает события указателя. Раньше указатель, попавший на подсказку, удерживал её открытой: в плотном списке подсказка нижней кнопки перекрывала кнопку выше, и навести на неё было нельзя. Если подсказку нужно выделять или нажимать в ней, передайте `interactive`;
|
|
16
|
+
- **Popper**: явный `pointerEvents` в `style` больше не затирается — скрытый поппер по-прежнему не перехватывает указатель.
|
|
17
|
+
|
|
7
18
|
## 0.11.0 — 2026-11-05
|
|
8
19
|
|
|
9
20
|
### Добавлено
|
package/Popper/Popper.js
CHANGED
|
@@ -81,19 +81,24 @@ const Popper = (props, ref) => {
|
|
|
81
81
|
}
|
|
82
82
|
}, [actualPlacement]);
|
|
83
83
|
const childrenMemo = react_1.default.useMemo(() => children, [children]);
|
|
84
|
-
const renderNode = react_1.default.useCallback(() =>
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
const renderNode = react_1.default.useCallback(() => {
|
|
85
|
+
var _a, _b;
|
|
86
|
+
return (react_1.default.createElement(overridesMap.Container, Object.assign({}, nativeProps, { style: Object.assign(Object.assign(Object.assign(Object.assign({}, style), nativeProps.style), { opacity: isVisible ? 1 : 0,
|
|
87
|
+
// A hidden popper never intercepts the pointer; a visible one lets the caller opt out
|
|
88
|
+
pointerEvents: !isVisible ? 'none' : ((_b = (_a = nativeProps.style) === null || _a === void 0 ? void 0 : _a.pointerEvents) !== null && _b !== void 0 ? _b : 'auto') }), (positionStrategy === 'fixed' && {
|
|
89
|
+
position: 'fixed',
|
|
90
|
+
})), zIndex: zIndex, positionStrategy: positionStrategy, "data-popper-placement": actualPlacement, "data-popper-strategy": positionStrategy, ref: el => {
|
|
91
|
+
popperRef.current = el;
|
|
92
|
+
if (ref) {
|
|
93
|
+
if (typeof ref === 'function') {
|
|
94
|
+
ref(el);
|
|
95
|
+
}
|
|
96
|
+
if (typeof ref === 'object') {
|
|
97
|
+
ref.current = el;
|
|
98
|
+
}
|
|
91
99
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
} }), childrenMemo)), [
|
|
100
|
+
} }), childrenMemo));
|
|
101
|
+
}, [
|
|
97
102
|
overridesMap,
|
|
98
103
|
nativeProps,
|
|
99
104
|
style,
|
package/Tooltip/index.d.ts
CHANGED
|
@@ -49,6 +49,12 @@ export type TooltipProps = {
|
|
|
49
49
|
* Default: false
|
|
50
50
|
*/
|
|
51
51
|
readonly describeChild?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Lets the pointer move onto the tooltip, e.g. to select its text or click a link inside.
|
|
54
|
+
* When `false`, the tooltip does not receive pointer events and cannot block the elements under it
|
|
55
|
+
* Default: false
|
|
56
|
+
*/
|
|
57
|
+
readonly interactive?: boolean;
|
|
52
58
|
/**
|
|
53
59
|
* Default: 8
|
|
54
60
|
*/
|
package/Tooltip/index.js
CHANGED
|
@@ -45,7 +45,7 @@ const setRef = (ref, value) => {
|
|
|
45
45
|
const isEmptyTitle = (title) => title === null || typeof title === 'undefined' || title === false || title === '';
|
|
46
46
|
const Tooltip = props => {
|
|
47
47
|
var _a;
|
|
48
|
-
const { title, children, placement = 'top', arrow = false, enterDelay = 400, leaveDelay = 100, isOpen, onOpenChange, describeChild = false, offset = 8, zIndex, id, overrides, } = props;
|
|
48
|
+
const { title, children, placement = 'top', arrow = false, enterDelay = 400, leaveDelay = 100, isOpen, onOpenChange, describeChild = false, interactive = false, offset = 8, zIndex, id, overrides, } = props;
|
|
49
49
|
const theme = (0, react_2.useTheme)();
|
|
50
50
|
const generatedId = `tooltip-${react_1.default.useId().replace(/:/g, '')}`;
|
|
51
51
|
const tooltipId = id || generatedId;
|
|
@@ -182,12 +182,15 @@ const Tooltip = props => {
|
|
|
182
182
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
183
183
|
anchor,
|
|
184
184
|
react_1.default.createElement(Popper_1.default, { isOpen: open, anchorElement: anchorElement, anchorPos: placement, autoFlip: true, offset: offset, viewportMargin: 8, zIndex: zIndex !== null && zIndex !== void 0 ? zIndex : theme.zIndex.modal + 1, onAnchorPosChanged: setActualPlacement, id: tooltipId, role: "tooltip",
|
|
185
|
-
//
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
// Without `interactive` the tooltip must not intercept the pointer: otherwise it
|
|
186
|
+
// blocks the elements under it and sticks under the cursor that moves across it
|
|
187
|
+
style: interactive ? undefined : { pointerEvents: 'none' }, onPointerEnter: interactive ? clearTimer : undefined, onPointerLeave: interactive
|
|
188
|
+
? event => {
|
|
189
|
+
if (isHoverPointer(event)) {
|
|
190
|
+
hide(leaveDelay);
|
|
191
|
+
}
|
|
189
192
|
}
|
|
190
|
-
|
|
193
|
+
: undefined },
|
|
191
194
|
react_1.default.createElement(overridesMap.Container, null,
|
|
192
195
|
title,
|
|
193
196
|
arrow && react_1.default.createElement(overridesMap.Arrow, { placement: actualPlacement })))));
|
package/esm/Popper/Popper.js
CHANGED
|
@@ -61,19 +61,24 @@ const Popper = (props, ref) => {
|
|
|
61
61
|
}
|
|
62
62
|
}, [actualPlacement]);
|
|
63
63
|
const childrenMemo = React.useMemo(() => children, [children]);
|
|
64
|
-
const renderNode = React.useCallback(() =>
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
const renderNode = React.useCallback(() => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
return (React.createElement(overridesMap.Container, Object.assign({}, nativeProps, { style: Object.assign(Object.assign(Object.assign(Object.assign({}, style), nativeProps.style), { opacity: isVisible ? 1 : 0,
|
|
67
|
+
// A hidden popper never intercepts the pointer; a visible one lets the caller opt out
|
|
68
|
+
pointerEvents: !isVisible ? 'none' : ((_b = (_a = nativeProps.style) === null || _a === void 0 ? void 0 : _a.pointerEvents) !== null && _b !== void 0 ? _b : 'auto') }), (positionStrategy === 'fixed' && {
|
|
69
|
+
position: 'fixed',
|
|
70
|
+
})), zIndex: zIndex, positionStrategy: positionStrategy, "data-popper-placement": actualPlacement, "data-popper-strategy": positionStrategy, ref: el => {
|
|
71
|
+
popperRef.current = el;
|
|
72
|
+
if (ref) {
|
|
73
|
+
if (typeof ref === 'function') {
|
|
74
|
+
ref(el);
|
|
75
|
+
}
|
|
76
|
+
if (typeof ref === 'object') {
|
|
77
|
+
ref.current = el;
|
|
78
|
+
}
|
|
71
79
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
} }), childrenMemo)), [
|
|
80
|
+
} }), childrenMemo));
|
|
81
|
+
}, [
|
|
77
82
|
overridesMap,
|
|
78
83
|
nativeProps,
|
|
79
84
|
style,
|
package/esm/Tooltip/index.js
CHANGED
|
@@ -40,7 +40,7 @@ const setRef = (ref, value) => {
|
|
|
40
40
|
const isEmptyTitle = (title) => title === null || typeof title === 'undefined' || title === false || title === '';
|
|
41
41
|
const Tooltip = props => {
|
|
42
42
|
var _a;
|
|
43
|
-
const { title, children, placement = 'top', arrow = false, enterDelay = 400, leaveDelay = 100, isOpen, onOpenChange, describeChild = false, offset = 8, zIndex, id, overrides, } = props;
|
|
43
|
+
const { title, children, placement = 'top', arrow = false, enterDelay = 400, leaveDelay = 100, isOpen, onOpenChange, describeChild = false, interactive = false, offset = 8, zIndex, id, overrides, } = props;
|
|
44
44
|
const theme = useTheme();
|
|
45
45
|
const generatedId = `tooltip-${React.useId().replace(/:/g, '')}`;
|
|
46
46
|
const tooltipId = id || generatedId;
|
|
@@ -177,12 +177,15 @@ const Tooltip = props => {
|
|
|
177
177
|
return (React.createElement(React.Fragment, null,
|
|
178
178
|
anchor,
|
|
179
179
|
React.createElement(Popper, { isOpen: open, anchorElement: anchorElement, anchorPos: placement, autoFlip: true, offset: offset, viewportMargin: 8, zIndex: zIndex !== null && zIndex !== void 0 ? zIndex : theme.zIndex.modal + 1, onAnchorPosChanged: setActualPlacement, id: tooltipId, role: "tooltip",
|
|
180
|
-
//
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
// Without `interactive` the tooltip must not intercept the pointer: otherwise it
|
|
181
|
+
// blocks the elements under it and sticks under the cursor that moves across it
|
|
182
|
+
style: interactive ? undefined : { pointerEvents: 'none' }, onPointerEnter: interactive ? clearTimer : undefined, onPointerLeave: interactive
|
|
183
|
+
? event => {
|
|
184
|
+
if (isHoverPointer(event)) {
|
|
185
|
+
hide(leaveDelay);
|
|
186
|
+
}
|
|
184
187
|
}
|
|
185
|
-
|
|
188
|
+
: undefined },
|
|
186
189
|
React.createElement(overridesMap.Container, null,
|
|
187
190
|
title,
|
|
188
191
|
arrow && React.createElement(overridesMap.Arrow, { placement: actualPlacement })))));
|