@seeqdev/qomponents 0.0.107 → 0.0.109
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/index.esm.js +30 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +30 -17
- package/dist/index.js.map +1 -1
- package/dist/styles.css +520 -520
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -6584,27 +6584,40 @@ const QTip = () => {
|
|
|
6584
6584
|
};
|
|
6585
6585
|
}, []);
|
|
6586
6586
|
const ttTimeout = useRef();
|
|
6587
|
+
const findTooltipData = (element) => {
|
|
6588
|
+
// Traverse up to 8 levels to find the tooltip data
|
|
6589
|
+
for (let i = 0; i < 8 && element; i++) {
|
|
6590
|
+
if (!element) {
|
|
6591
|
+
return null;
|
|
6592
|
+
}
|
|
6593
|
+
if (element?.dataset?.qtipText) {
|
|
6594
|
+
return element.dataset;
|
|
6595
|
+
}
|
|
6596
|
+
element = element?.parentElement;
|
|
6597
|
+
}
|
|
6598
|
+
return null;
|
|
6599
|
+
};
|
|
6587
6600
|
const onMouseMove = (e) => {
|
|
6588
6601
|
clearTimeout(ttTimeout.current);
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
dataset = currentTooltipTarget?.dataset;
|
|
6597
|
-
text = dataset?.qtipText;
|
|
6598
|
-
if (!text || text === '') {
|
|
6599
|
-
currentTooltipTarget = e.target?.parentElement?.parentElement || null;
|
|
6600
|
-
dataset = currentTooltipTarget?.dataset;
|
|
6601
|
-
text = dataset?.qtipText;
|
|
6602
|
-
}
|
|
6603
|
-
tooltipTarget.current = currentTooltipTarget;
|
|
6602
|
+
// Find tooltip data on the current or parent elements
|
|
6603
|
+
const target = e.target;
|
|
6604
|
+
const dataset = findTooltipData(target);
|
|
6605
|
+
if (!dataset) {
|
|
6606
|
+
// No tooltip data found
|
|
6607
|
+
tooltipTarget.current = null;
|
|
6608
|
+
return;
|
|
6604
6609
|
}
|
|
6610
|
+
tooltipTarget.current = target;
|
|
6611
|
+
const text = dataset.qtipText;
|
|
6605
6612
|
if (text) {
|
|
6606
|
-
const delay = parseInt(dataset
|
|
6607
|
-
|
|
6613
|
+
const delay = parseInt(dataset.qtipDelay || `${DEFAULT_TOOL_TIP_DELAY}`, 10);
|
|
6614
|
+
const placement = dataset.qtipPlacement || 'top';
|
|
6615
|
+
const isHtml = dataset.qtipIsHtml === 'true';
|
|
6616
|
+
const testId = dataset.qtipTestid;
|
|
6617
|
+
// Debounced tooltip display
|
|
6618
|
+
ttTimeout.current = setTimeout(() => {
|
|
6619
|
+
makeTooltip(text, placement, isHtml, testId, delay);
|
|
6620
|
+
}, delay);
|
|
6608
6621
|
}
|
|
6609
6622
|
};
|
|
6610
6623
|
const makeTooltip = (tooltipText, position = 'top', isHtml, dataTestId, delay) => {
|