@plesk/ui-library 3.44.0 → 3.45.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/cjs/components/Action/Action.js +0 -6
- package/cjs/components/Alert/Alert.js +5 -1
- package/cjs/components/Button/Button.js +2 -0
- package/cjs/components/Carousel/Carousel.js +9 -4
- package/cjs/components/ComboBox/ComboBox.js +3 -0
- package/cjs/components/ComboBoxDropdown/ComboBoxDropdown.js +6 -2
- package/cjs/components/ComboBoxDropdown/index.js +6 -0
- package/cjs/components/Dialog/Dialog.js +3 -0
- package/cjs/components/Drawer/Header.js +5 -0
- package/cjs/components/Dropdown/Dropdown.js +3 -0
- package/cjs/components/Form/Form.js +3 -1
- package/cjs/components/FormField/FormField.js +9 -5
- package/cjs/components/FormFieldPassword/FormFieldPassword.js +9 -11
- package/cjs/components/InPlaceEdit/Editor.js +6 -7
- package/cjs/components/InPlaceEdit/InPlaceEdit.js +4 -4
- package/cjs/components/InputFile/InputFile.js +4 -4
- package/cjs/components/InputNumber/InputNumber.js +4 -0
- package/cjs/components/Layout/Layout.js +8 -0
- package/cjs/components/List/List.js +11 -6
- package/cjs/components/List/ListActions.js +5 -0
- package/cjs/components/LocaleProvider/LocaleProvider.js +13 -3
- package/cjs/components/Menu/MenuItem.js +4 -0
- package/cjs/components/Overlay/Overlay.js +1 -0
- package/cjs/components/Panel/Panel.js +3 -0
- package/cjs/components/Popover/Popover.js +3 -0
- package/cjs/components/Section/Section.js +4 -0
- package/cjs/components/Select/Select.js +12 -1
- package/cjs/components/Select/SelectControl.js +24 -7
- package/cjs/components/Spinner/Spinner.js +1 -0
- package/cjs/components/SwitchesPanelItem/SwitchesPanelItem.js +3 -0
- package/cjs/components/Tabs/SearchBar.js +7 -0
- package/cjs/components/Tabs/TabClose.js +3 -0
- package/cjs/components/Toast/Toast.js +3 -0
- package/cjs/components/Tooltip/Tooltip.js +92 -202
- package/cjs/components/Tooltip/TooltipContent.js +83 -0
- package/cjs/components/Tooltip/getA11yAttributes.js +30 -0
- package/cjs/components/Tooltip/useVirtualElement.js +35 -0
- package/cjs/components/utils.js +42 -2
- package/cjs/hooks/useEscapeKeydown.js +25 -0
- package/cjs/index.js +1 -1
- package/cjs/locales/ar.js +66 -4
- package/cjs/locales/ca-ES.js +66 -4
- package/cjs/locales/cs-CZ.js +66 -4
- package/cjs/locales/da-DK.js +66 -4
- package/cjs/locales/de-DE.js +66 -4
- package/cjs/locales/el-GR.js +66 -4
- package/cjs/locales/en-US.js +66 -4
- package/cjs/locales/es-ES.js +66 -4
- package/cjs/locales/fi-FI.js +66 -4
- package/cjs/locales/fr-FR.js +66 -4
- package/cjs/locales/he-IL.js +66 -4
- package/cjs/locales/hu-HU.js +66 -4
- package/cjs/locales/id-ID.js +66 -4
- package/cjs/locales/it-IT.js +66 -4
- package/cjs/locales/ja-JP.js +66 -4
- package/cjs/locales/ko-KR.js +66 -4
- package/cjs/locales/ms-MY.js +66 -4
- package/cjs/locales/nb-NO.js +66 -4
- package/cjs/locales/nl-NL.js +66 -4
- package/cjs/locales/pl-PL.js +66 -4
- package/cjs/locales/pt-BR.js +66 -4
- package/cjs/locales/pt-PT.js +66 -4
- package/cjs/locales/ro-RO.js +66 -4
- package/cjs/locales/ru-RU.js +66 -4
- package/cjs/locales/sv-SE.js +66 -4
- package/cjs/locales/th-TH.js +66 -4
- package/cjs/locales/tl-PH.js +66 -4
- package/cjs/locales/tr-TR.js +66 -4
- package/cjs/locales/uk-UA.js +66 -4
- package/cjs/locales/vi-VN.js +66 -4
- package/cjs/locales/zh-CN.js +66 -4
- package/cjs/locales/zh-TW.js +66 -4
- package/cjs/utils.js +2 -17
- package/dist/plesk-ui-library-rtl.css +1 -1
- package/dist/plesk-ui-library-rtl.css.map +1 -1
- package/dist/plesk-ui-library.css +1 -1
- package/dist/plesk-ui-library.css.map +1 -1
- package/dist/plesk-ui-library.js +7632 -3008
- package/dist/plesk-ui-library.js.map +1 -1
- package/dist/plesk-ui-library.min.js +6 -6
- package/dist/plesk-ui-library.min.js.map +1 -1
- package/esm/components/Action/Action.js +0 -6
- package/esm/components/Alert/Alert.js +5 -1
- package/esm/components/Button/Button.js +2 -0
- package/esm/components/Carousel/Carousel.js +9 -4
- package/esm/components/ComboBox/ComboBox.js +3 -0
- package/esm/components/ComboBoxDropdown/ComboBoxDropdown.js +4 -1
- package/esm/components/ComboBoxDropdown/index.js +1 -1
- package/esm/components/Dialog/Dialog.js +3 -0
- package/esm/components/Drawer/Header.js +5 -0
- package/esm/components/Dropdown/Dropdown.js +3 -0
- package/esm/components/Form/Form.js +3 -1
- package/esm/components/FormField/FormField.js +9 -5
- package/esm/components/FormFieldPassword/FormFieldPassword.js +9 -11
- package/esm/components/InPlaceEdit/Editor.js +6 -7
- package/esm/components/InPlaceEdit/InPlaceEdit.js +4 -4
- package/esm/components/InputFile/InputFile.js +4 -4
- package/esm/components/InputNumber/InputNumber.js +4 -0
- package/esm/components/Layout/Layout.js +8 -0
- package/esm/components/List/List.js +11 -6
- package/esm/components/List/ListActions.js +5 -0
- package/esm/components/LocaleProvider/LocaleProvider.js +11 -2
- package/esm/components/Menu/MenuItem.js +5 -1
- package/esm/components/Overlay/Overlay.js +2 -1
- package/esm/components/Panel/Panel.js +3 -0
- package/esm/components/Popover/Popover.js +3 -0
- package/esm/components/Section/Section.js +4 -0
- package/esm/components/Select/Select.js +13 -2
- package/esm/components/Select/SelectControl.js +24 -7
- package/esm/components/Spinner/Spinner.js +1 -0
- package/esm/components/SwitchesPanelItem/SwitchesPanelItem.js +3 -0
- package/esm/components/Tabs/SearchBar.js +7 -0
- package/esm/components/Tabs/TabClose.js +3 -0
- package/esm/components/Toast/Toast.js +3 -0
- package/esm/components/Tooltip/Tooltip.js +94 -204
- package/esm/components/Tooltip/TooltipContent.js +75 -0
- package/esm/components/Tooltip/getA11yAttributes.js +23 -0
- package/esm/components/Tooltip/useVirtualElement.js +28 -0
- package/esm/components/utils.js +37 -1
- package/esm/hooks/useEscapeKeydown.js +18 -0
- package/esm/index.js +1 -1
- package/esm/locales/ar.js +66 -4
- package/esm/locales/ca-ES.js +66 -4
- package/esm/locales/cs-CZ.js +66 -4
- package/esm/locales/da-DK.js +66 -4
- package/esm/locales/de-DE.js +66 -4
- package/esm/locales/el-GR.js +66 -4
- package/esm/locales/en-US.js +66 -4
- package/esm/locales/es-ES.js +66 -4
- package/esm/locales/fi-FI.js +66 -4
- package/esm/locales/fr-FR.js +66 -4
- package/esm/locales/he-IL.js +66 -4
- package/esm/locales/hu-HU.js +66 -4
- package/esm/locales/id-ID.js +66 -4
- package/esm/locales/it-IT.js +66 -4
- package/esm/locales/ja-JP.js +66 -4
- package/esm/locales/ko-KR.js +66 -4
- package/esm/locales/ms-MY.js +66 -4
- package/esm/locales/nb-NO.js +66 -4
- package/esm/locales/nl-NL.js +66 -4
- package/esm/locales/pl-PL.js +66 -4
- package/esm/locales/pt-BR.js +66 -4
- package/esm/locales/pt-PT.js +66 -4
- package/esm/locales/ro-RO.js +66 -4
- package/esm/locales/ru-RU.js +66 -4
- package/esm/locales/sv-SE.js +66 -4
- package/esm/locales/th-TH.js +66 -4
- package/esm/locales/tl-PH.js +66 -4
- package/esm/locales/tr-TR.js +66 -4
- package/esm/locales/uk-UA.js +66 -4
- package/esm/locales/vi-VN.js +66 -4
- package/esm/locales/zh-CN.js +66 -4
- package/esm/locales/zh-TW.js +66 -4
- package/esm/utils.js +0 -14
- package/package.json +7 -6
- package/styleguide/build/bundle.1771d6b7.js +2 -0
- package/styleguide/index.html +2 -2
- package/types/components/Button/Button.d.ts +6 -0
- package/types/components/ComboBoxDropdown/ComboBoxDropdown.d.ts +1 -0
- package/types/components/ComboBoxDropdown/index.d.ts +1 -1
- package/types/components/Dropdown/Dropdown.d.ts +5 -0
- package/types/components/Layout/Layout.d.ts +1 -0
- package/types/components/List/ListActions.d.ts +6 -1
- package/types/components/LocaleProvider/LocaleProvider.d.ts +3 -0
- package/types/components/Select/Select.d.ts +4 -0
- package/types/components/Select/SelectControl.d.ts +4 -0
- package/types/components/Tooltip/Tooltip.d.ts +15 -26
- package/types/components/Tooltip/TooltipContent.d.ts +11 -0
- package/types/components/Tooltip/getA11yAttributes.d.ts +19 -0
- package/types/components/Tooltip/useVirtualElement.d.ts +3 -0
- package/types/components/utils.d.ts +8 -1
- package/types/hooks/useEscapeKeydown.d.ts +1 -0
- package/types/utils.d.ts +0 -3
- package/styleguide/build/bundle.cf3363eb.js +0 -2
- /package/styleguide/build/{bundle.cf3363eb.js.LICENSE.txt → bundle.1771d6b7.js.LICENSE.txt} +0 -0
|
@@ -5,218 +5,108 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
9
|
-
var _Layer = _interopRequireDefault(require("../Layer"));
|
|
8
|
+
var _react = require("react");
|
|
10
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
10
|
var _constants = require("../../constants");
|
|
12
11
|
var _utils = require("../utils");
|
|
13
|
-
var
|
|
12
|
+
var _TooltipContent = require("./TooltipContent");
|
|
13
|
+
var _useVirtualElement = require("./useVirtualElement");
|
|
14
|
+
var _getA11yAttributes = require("./getA11yAttributes");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
|
|
16
17
|
|
|
17
|
-
const createRectFactory = (width, height) => (left, top) => ({
|
|
18
|
-
top,
|
|
19
|
-
left,
|
|
20
|
-
right: left + width,
|
|
21
|
-
bottom: top + height
|
|
22
|
-
});
|
|
23
|
-
const isInside = (r1, r2) => r1.left >= r2.left && r1.right <= r2.right && r1.top >= r2.top && r1.bottom <= r2.bottom;
|
|
24
|
-
let tooltipId = 0;
|
|
25
|
-
const generateTooltipId = () => `tooltip-${tooltipId++}`;
|
|
26
|
-
const determinePosition = _ref => {
|
|
27
|
-
let {
|
|
28
|
-
clientX,
|
|
29
|
-
clientY,
|
|
30
|
-
tooltipWidth,
|
|
31
|
-
tooltipHeight,
|
|
32
|
-
targetRect
|
|
33
|
-
} = _ref;
|
|
34
|
-
const X_EXTRA_SPACE = 8;
|
|
35
|
-
const Y_BOTTOM_EXTRA_SPACE = 16;
|
|
36
|
-
const Y_TOP_EXTRA_SPACE = 8;
|
|
37
|
-
const createTooltipRect = createRectFactory(tooltipWidth, tooltipHeight);
|
|
38
|
-
const viewRect = {
|
|
39
|
-
top: 0,
|
|
40
|
-
left: 0,
|
|
41
|
-
right: document.documentElement.clientWidth,
|
|
42
|
-
bottom: document.documentElement.clientHeight
|
|
43
|
-
};
|
|
44
|
-
const positionFns = [
|
|
45
|
-
// right bottom
|
|
46
|
-
() => ({
|
|
47
|
-
left: clientX + X_EXTRA_SPACE,
|
|
48
|
-
top: clientY + Y_BOTTOM_EXTRA_SPACE
|
|
49
|
-
}),
|
|
50
|
-
// left bottom
|
|
51
|
-
() => ({
|
|
52
|
-
left: clientX - tooltipWidth - X_EXTRA_SPACE,
|
|
53
|
-
top: clientY + Y_BOTTOM_EXTRA_SPACE
|
|
54
|
-
}),
|
|
55
|
-
// center bottom
|
|
56
|
-
() => ({
|
|
57
|
-
left: targetRect.left + (targetRect.right - targetRect.left) / 2 - tooltipWidth / 2,
|
|
58
|
-
top: clientY + Y_BOTTOM_EXTRA_SPACE
|
|
59
|
-
}),
|
|
60
|
-
// right top
|
|
61
|
-
() => ({
|
|
62
|
-
left: clientX + X_EXTRA_SPACE,
|
|
63
|
-
top: clientY - tooltipHeight - Y_TOP_EXTRA_SPACE
|
|
64
|
-
}),
|
|
65
|
-
// left top
|
|
66
|
-
() => ({
|
|
67
|
-
left: clientX - tooltipWidth - Y_TOP_EXTRA_SPACE,
|
|
68
|
-
top: clientY - tooltipHeight - Y_TOP_EXTRA_SPACE
|
|
69
|
-
}),
|
|
70
|
-
// center top
|
|
71
|
-
() => ({
|
|
72
|
-
left: targetRect.left + (targetRect.right - targetRect.left) / 2 - tooltipWidth / 2,
|
|
73
|
-
top: clientY - tooltipHeight - Y_BOTTOM_EXTRA_SPACE
|
|
74
|
-
})];
|
|
75
|
-
for (let i = 0; i < positionFns.length; i++) {
|
|
76
|
-
const fn = positionFns[i];
|
|
77
|
-
const {
|
|
78
|
-
left,
|
|
79
|
-
top
|
|
80
|
-
} = fn();
|
|
81
|
-
const tooltipRect = createTooltipRect(left, top);
|
|
82
|
-
if (isInside(tooltipRect, viewRect)) {
|
|
83
|
-
return {
|
|
84
|
-
left: left + window.pageXOffset,
|
|
85
|
-
top: top + window.pageYOffset
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
top: targetRect.top + Y_BOTTOM_EXTRA_SPACE,
|
|
91
|
-
left: targetRect.left + X_EXTRA_SPACE
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
18
|
/**
|
|
95
19
|
* `Tooltip` component is used for providing information about an interface element
|
|
96
20
|
* while user hovers the pointer over the element.
|
|
97
21
|
* @since 0.0.35
|
|
98
22
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
style,
|
|
176
|
-
delay,
|
|
177
|
-
...props
|
|
178
|
-
} = this.props;
|
|
179
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layer.default, {
|
|
180
|
-
level: _constants.Z_INDEX_TOOLTIP,
|
|
181
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
182
|
-
ref: this.tooltipRef,
|
|
183
|
-
id: id,
|
|
184
|
-
className: (0, _classnames.default)(baseClassName, className),
|
|
185
|
-
style: {
|
|
186
|
-
...style,
|
|
187
|
-
transform: `translate(${left}px, ${top}px)`,
|
|
188
|
-
visibility: visible ? 'visible' : 'hidden'
|
|
189
|
-
},
|
|
190
|
-
role: "tooltip",
|
|
191
|
-
...props,
|
|
192
|
-
children: title
|
|
23
|
+
const Tooltip = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
title,
|
|
26
|
+
children,
|
|
27
|
+
delay = 550,
|
|
28
|
+
asLabel = false,
|
|
29
|
+
className,
|
|
30
|
+
baseClassName = `${_constants.CLS_PREFIX}tooltip`,
|
|
31
|
+
...props
|
|
32
|
+
} = _ref;
|
|
33
|
+
const [ready, setReady] = (0, _react.useState)(false);
|
|
34
|
+
const [visible, setVisible] = (0, _react.useState)(false);
|
|
35
|
+
const [trigger, setTrigger] = (0, _react.useState)(null);
|
|
36
|
+
const id = (0, _react.useId)();
|
|
37
|
+
const timer = (0, _react.useRef)(null);
|
|
38
|
+
const isPointerDown = (0, _react.useRef)(false);
|
|
39
|
+
const clearTimer = () => {
|
|
40
|
+
if (timer.current) {
|
|
41
|
+
clearTimeout(timer.current);
|
|
42
|
+
timer.current = null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
(0, _react.useEffect)(() => () => clearTimer(), []);
|
|
46
|
+
const [virtualElement, createVirtualElement, resetVirtualElement] = (0, _useVirtualElement.useVirtualElement)();
|
|
47
|
+
const handlePointerMove = e => {
|
|
48
|
+
createVirtualElement(e);
|
|
49
|
+
};
|
|
50
|
+
const handlePointerEnter = e => {
|
|
51
|
+
if (e.pointerType === 'touch') return;
|
|
52
|
+
createVirtualElement(e);
|
|
53
|
+
setReady(true);
|
|
54
|
+
timer.current = setTimeout(() => handleShow(), delay);
|
|
55
|
+
};
|
|
56
|
+
const handleShow = () => {
|
|
57
|
+
clearTimer();
|
|
58
|
+
setVisible(true);
|
|
59
|
+
};
|
|
60
|
+
const handleHide = () => {
|
|
61
|
+
clearTimer();
|
|
62
|
+
setVisible(false);
|
|
63
|
+
setReady(false);
|
|
64
|
+
resetVirtualElement();
|
|
65
|
+
};
|
|
66
|
+
const handlePointerDown = () => {
|
|
67
|
+
handleHide();
|
|
68
|
+
isPointerDown.current = true;
|
|
69
|
+
};
|
|
70
|
+
const handlePointerUp = () => {
|
|
71
|
+
isPointerDown.current = false;
|
|
72
|
+
};
|
|
73
|
+
const handleFocus = e => {
|
|
74
|
+
if (isPointerDown.current) return;
|
|
75
|
+
if (!(0, _utils.isFocusVisible)(e.target) && !(0, _utils.isFocusVisible)(e.currentTarget)) return;
|
|
76
|
+
setReady(true);
|
|
77
|
+
setTrigger(e.currentTarget);
|
|
78
|
+
const delay = (0, _utils.getFocusReturned)(e.target);
|
|
79
|
+
if (delay) {
|
|
80
|
+
timer.current = setTimeout(() => handleShow(), delay);
|
|
81
|
+
} else {
|
|
82
|
+
handleShow();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
86
|
+
children: [/*#__PURE__*/(0, _react.cloneElement)(children, {
|
|
87
|
+
onPointerEnter: (0, _utils.wrapFunction)(children.props.onPointerEnter, handlePointerEnter),
|
|
88
|
+
onPointerMove: (0, _utils.wrapFunction)(children.props.onPointerMove, handlePointerMove),
|
|
89
|
+
onPointerLeave: (0, _utils.wrapFunction)(children.props.onPointerLeave, handleHide),
|
|
90
|
+
onPointerUp: (0, _utils.wrapFunction)(children.props.onPointerUp, handlePointerUp),
|
|
91
|
+
onPointerDown: (0, _utils.wrapFunction)(children.props.onPointerDown, handlePointerDown),
|
|
92
|
+
onFocus: (0, _utils.wrapFunction)(children.props.onFocus, handleFocus),
|
|
93
|
+
onBlur: (0, _utils.wrapFunction)(children.props.onBlur, handleHide),
|
|
94
|
+
...(0, _getA11yAttributes.getA11yAttributes)({
|
|
95
|
+
asLabel,
|
|
96
|
+
title,
|
|
97
|
+
ready,
|
|
98
|
+
id: props.id ?? id
|
|
193
99
|
})
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
onMouseEnter: (0, _utils.wrapFunction)(children.props.onMouseEnter, this.handleMouseEnter),
|
|
207
|
-
onMouseMove: (0, _utils.wrapFunction)(children.props.onMouseMove, this.handleMouseMove),
|
|
208
|
-
onMouseLeave: (0, _utils.wrapFunction)(children.props.onMouseLeave, this.handleHide),
|
|
209
|
-
onMouseDown: (0, _utils.wrapFunction)(children.props.onMouseDown, this.handleHide),
|
|
210
|
-
'aria-labelledby': id
|
|
211
|
-
}), ready && this.renderTooltip()]
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
(0, _defineProperty2.default)(Tooltip, "defaultProps", {
|
|
216
|
-
// in ms.
|
|
217
|
-
delay: 550,
|
|
218
|
-
style: undefined,
|
|
219
|
-
className: undefined,
|
|
220
|
-
baseClassName: `${_constants.CLS_PREFIX}tooltip`
|
|
221
|
-
});
|
|
100
|
+
}), ready && /*#__PURE__*/(0, _jsxRuntime.jsx)(_TooltipContent.TooltipContent, {
|
|
101
|
+
title: title,
|
|
102
|
+
className: (0, _classnames.default)(baseClassName, className),
|
|
103
|
+
...props,
|
|
104
|
+
id: props.id ?? id,
|
|
105
|
+
visible: visible,
|
|
106
|
+
virtualElement: virtualElement,
|
|
107
|
+
trigger: trigger,
|
|
108
|
+
onEscapeKeyDown: handleHide
|
|
109
|
+
})]
|
|
110
|
+
});
|
|
111
|
+
};
|
|
222
112
|
var _default = exports.default = Tooltip;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TooltipContent = void 0;
|
|
8
|
+
var _reactDom = require("@floating-ui/react-dom");
|
|
9
|
+
var _constants = require("../../constants");
|
|
10
|
+
var _useEscapeKeydown = require("../../hooks/useEscapeKeydown");
|
|
11
|
+
var _Layer = _interopRequireDefault(require("../Layer"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
|
|
14
|
+
|
|
15
|
+
const isVirtualElement = element => element !== null && !(element instanceof HTMLElement);
|
|
16
|
+
const TooltipContent = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
title,
|
|
19
|
+
visible,
|
|
20
|
+
virtualElement,
|
|
21
|
+
trigger,
|
|
22
|
+
onEscapeKeyDown,
|
|
23
|
+
className,
|
|
24
|
+
style,
|
|
25
|
+
id,
|
|
26
|
+
...props
|
|
27
|
+
} = _ref;
|
|
28
|
+
(0, _useEscapeKeydown.useEscapeKeydown)(onEscapeKeyDown);
|
|
29
|
+
const {
|
|
30
|
+
refs,
|
|
31
|
+
floatingStyles
|
|
32
|
+
} = (0, _reactDom.useFloating)({
|
|
33
|
+
middleware: [(0, _reactDom.offset)(_ref2 => {
|
|
34
|
+
let {
|
|
35
|
+
placement,
|
|
36
|
+
elements
|
|
37
|
+
} = _ref2;
|
|
38
|
+
if (!isVirtualElement(elements.reference)) {
|
|
39
|
+
return {
|
|
40
|
+
mainAxis: 8
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const [side] = placement.split('-');
|
|
44
|
+
return {
|
|
45
|
+
mainAxis: side === 'bottom' ? 16 : 8,
|
|
46
|
+
alignmentAxis: 8
|
|
47
|
+
};
|
|
48
|
+
}), (0, _reactDom.flip)(_ref3 => {
|
|
49
|
+
let {
|
|
50
|
+
elements
|
|
51
|
+
} = _ref3;
|
|
52
|
+
let fallbackPlacements = ['bottom-end', 'bottom', 'top-start', 'top-end', 'top'];
|
|
53
|
+
if (!isVirtualElement(elements.reference)) {
|
|
54
|
+
fallbackPlacements = ['top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'right', 'left'];
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
padding: 5,
|
|
58
|
+
fallbackPlacements
|
|
59
|
+
};
|
|
60
|
+
})],
|
|
61
|
+
placement: virtualElement ? 'bottom-start' : 'top',
|
|
62
|
+
elements: {
|
|
63
|
+
reference: virtualElement ? virtualElement : trigger
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layer.default, {
|
|
67
|
+
level: _constants.Z_INDEX_TOOLTIP,
|
|
68
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
69
|
+
ref: refs.setFloating,
|
|
70
|
+
id: id,
|
|
71
|
+
className: className,
|
|
72
|
+
style: {
|
|
73
|
+
...style,
|
|
74
|
+
visibility: visible ? 'visible' : 'hidden',
|
|
75
|
+
...floatingStyles
|
|
76
|
+
},
|
|
77
|
+
role: "tooltip",
|
|
78
|
+
...props,
|
|
79
|
+
children: title
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
exports.TooltipContent = TooltipContent;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getA11yAttributes = void 0;
|
|
7
|
+
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
|
|
8
|
+
|
|
9
|
+
const getA11yAttributes = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
asLabel,
|
|
12
|
+
title,
|
|
13
|
+
ready,
|
|
14
|
+
id
|
|
15
|
+
} = _ref;
|
|
16
|
+
if (!asLabel) {
|
|
17
|
+
return {
|
|
18
|
+
'aria-describedby': ready ? id : undefined
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (typeof title === 'string') {
|
|
22
|
+
return {
|
|
23
|
+
'aria-label': title
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
'aria-labelledby': ready ? id : undefined
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.getA11yAttributes = getA11yAttributes;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useVirtualElement = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
|
|
9
|
+
|
|
10
|
+
const useVirtualElement = () => {
|
|
11
|
+
const [virtualElement, setVirtualElement] = (0, _react.useState)(null);
|
|
12
|
+
const createVirtualElement = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
clientX,
|
|
15
|
+
clientY
|
|
16
|
+
} = _ref;
|
|
17
|
+
setVirtualElement({
|
|
18
|
+
getBoundingClientRect() {
|
|
19
|
+
return {
|
|
20
|
+
width: 0,
|
|
21
|
+
height: 0,
|
|
22
|
+
x: clientX,
|
|
23
|
+
y: clientY,
|
|
24
|
+
left: clientX,
|
|
25
|
+
right: clientX,
|
|
26
|
+
top: clientY,
|
|
27
|
+
bottom: clientY
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const resetVirtualElement = () => setVirtualElement(null);
|
|
33
|
+
return [virtualElement, createVirtualElement, resetVirtualElement];
|
|
34
|
+
};
|
|
35
|
+
exports.useVirtualElement = useVirtualElement;
|
package/cjs/components/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.wrapFunction = exports.scrollIntoView = exports.safeInvoke = exports.normalizeSize = exports.mergeRefs = exports.isClickable = exports.createProxyProps = exports.createFocusManager = exports.EventEmitter = void 0;
|
|
7
|
+
exports.wrapFunction = exports.setFocusReturned = exports.scrollIntoView = exports.safeInvoke = exports.normalizeSize = exports.mergeRefs = exports.isFocusVisible = exports.isClickable = exports.getFocusReturned = exports.createProxyProps = exports.createKeyboardClickAdapter = exports.createFocusManager = exports.EventEmitter = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _scrollIntoViewIfNeeded = _interopRequireDefault(require("scroll-into-view-if-needed"));
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -215,4 +215,44 @@ const mergeRefs = function () {
|
|
|
215
215
|
};
|
|
216
216
|
exports.mergeRefs = mergeRefs;
|
|
217
217
|
const normalizeSize = value => String(Number(value)) === String(value) ? `${value}px` : value;
|
|
218
|
-
exports.normalizeSize = normalizeSize;
|
|
218
|
+
exports.normalizeSize = normalizeSize;
|
|
219
|
+
const createKeyboardClickAdapter = function () {
|
|
220
|
+
let {
|
|
221
|
+
existingHandler,
|
|
222
|
+
disabled = false
|
|
223
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
224
|
+
const keyboardHandler = ev => {
|
|
225
|
+
if (disabled) return;
|
|
226
|
+
if (ev.key === 'Enter' || ev.key === ' ') {
|
|
227
|
+
ev.preventDefault();
|
|
228
|
+
ev.currentTarget.click();
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
return wrapFunction(existingHandler, keyboardHandler);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
/* Mark element as focus returned to avoid animation z-index collisions */
|
|
235
|
+
exports.createKeyboardClickAdapter = createKeyboardClickAdapter;
|
|
236
|
+
const setFocusReturned = function (element) {
|
|
237
|
+
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
238
|
+
if (document.body === element) return;
|
|
239
|
+
element?.setAttribute('data-pul-focus-returned', duration.toString());
|
|
240
|
+
setTimeout(() => {
|
|
241
|
+
element?.removeAttribute('data-pul-focus-returned');
|
|
242
|
+
}, duration);
|
|
243
|
+
};
|
|
244
|
+
exports.setFocusReturned = setFocusReturned;
|
|
245
|
+
const getFocusReturned = element => {
|
|
246
|
+
const duration = element.getAttribute('data-pul-focus-returned');
|
|
247
|
+
return duration ? parseInt(duration, 10) : 0;
|
|
248
|
+
};
|
|
249
|
+
exports.getFocusReturned = getFocusReturned;
|
|
250
|
+
const isFocusVisible = element => {
|
|
251
|
+
try {
|
|
252
|
+
return element.matches(':focus-visible');
|
|
253
|
+
} catch {
|
|
254
|
+
/* empty */
|
|
255
|
+
}
|
|
256
|
+
return false;
|
|
257
|
+
};
|
|
258
|
+
exports.isFocusVisible = isFocusVisible;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useEscapeKeydown = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
const useEscapeKeydown = onEscapeKeyDown => {
|
|
9
|
+
const onEscapeKeyDownRef = (0, _react.useRef)(onEscapeKeyDown);
|
|
10
|
+
onEscapeKeyDownRef.current = onEscapeKeyDown;
|
|
11
|
+
(0, _react.useEffect)(() => {
|
|
12
|
+
const handleKeyDown = e => {
|
|
13
|
+
if (e.key === 'Escape') {
|
|
14
|
+
onEscapeKeyDownRef.current?.(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
document.addEventListener('keydown', handleKeyDown, {
|
|
18
|
+
capture: true
|
|
19
|
+
});
|
|
20
|
+
return () => document.removeEventListener('keydown', handleKeyDown, {
|
|
21
|
+
capture: true
|
|
22
|
+
});
|
|
23
|
+
}, []);
|
|
24
|
+
};
|
|
25
|
+
exports.useEscapeKeydown = useEscapeKeydown;
|
package/cjs/index.js
CHANGED
|
@@ -46,5 +46,5 @@ Object.keys(_components).forEach(function (key) {
|
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
48
|
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
|
|
49
|
-
const version = exports.version = "3.
|
|
49
|
+
const version = exports.version = "3.45.0";
|
|
50
50
|
(0, _svg4everybody.default)();
|