react-core-ts 2.1.41 → 2.1.43
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/styles/components/autocomplete.css +36 -142
- package/dist/styles/global.css +1 -3
- package/dist/styles/styles/components/autocomplete.css +5 -0
- package/dist/utilities/NewTooltip.js +34 -47
- package/dist/utilities/NewTooltip.js.map +1 -1
- package/dist/utilities/expandableTootltip.js +36 -70
- package/dist/utilities/expandableTootltip.js.map +1 -1
- package/dist/utilities/getPosition.d.ts +9 -0
- package/dist/utilities/getPosition.js +41 -1
- package/dist/utilities/getPosition.js.map +1 -1
- package/package.json +1 -1
- package/src/styles/components/autocomplete.css +5 -0
- package/src/utilities/NewTooltip.tsx +55 -70
- package/src/utilities/expandableTootltip.tsx +53 -83
- package/src/utilities/getPosition.ts +62 -0
- package/dist/styles/components/modern-input.css +0 -208
- package/dist/styles/components/qbs-fallbacks.css +0 -174
- package/dist/styles/library-entry.css +0 -9
|
@@ -1,68 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
:root {
|
|
3
|
-
--rcts-grey-dark: #4a4a4a;
|
|
4
|
-
--rcts-grey-light: #d3d3d3;
|
|
5
|
-
--rcts-blue-navy: #001f3f;
|
|
6
|
-
--rcts-input-disabled: #a9a9a9;
|
|
7
|
-
--rcts-error-light: #f08080;
|
|
8
|
-
--rcts-error-extra-light: #fddede;
|
|
9
|
-
--rcts-success: #28a745;
|
|
10
|
-
--rcts-success-light: #d4edda;
|
|
11
|
-
--rcts-blue-light: #add8e6;
|
|
12
|
-
/* Back-compat aliases */
|
|
13
|
-
--grey-dark: var(--rcts-grey-dark);
|
|
14
|
-
--grey-light: var(--rcts-grey-light);
|
|
15
|
-
--blue-navy: var(--rcts-blue-navy);
|
|
16
|
-
--input-disabled: var(--rcts-input-disabled);
|
|
17
|
-
--error-light: var(--rcts-error-light);
|
|
18
|
-
--error-extra-light: var(--rcts-error-extra-light);
|
|
19
|
-
--success: var(--rcts-success);
|
|
20
|
-
--success-light: var(--rcts-success-light);
|
|
21
|
-
--blue-light: var(--rcts-blue-light);
|
|
22
|
-
--table-hover: #f8f8f8;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
* Scoped border-box so TextField / Autocomplete heights match pre-4.0.2 behavior.
|
|
27
|
-
* (Removing global body * broke height because padding+border were added outside h-*).
|
|
28
|
-
*/
|
|
29
|
-
.qbs-textfield,
|
|
30
|
-
.qbs-textfield *,
|
|
31
|
-
.qbs-autocomplete-selected-comp,
|
|
32
|
-
.qbs-autocomplete-selected-comp *,
|
|
33
|
-
.qbs-autocomplete-suggestions,
|
|
34
|
-
.qbs-autocomplete-suggestions *,
|
|
35
|
-
.autocomplete-suggections,
|
|
36
|
-
.autocomplete-suggections *,
|
|
37
|
-
.qbs-expandable-container,
|
|
38
|
-
.qbs-expandable-container *,
|
|
39
|
-
.tooltip-container,
|
|
40
|
-
.tooltip-container *,
|
|
41
|
-
.react-core-ts-search-container,
|
|
42
|
-
.react-core-ts-search-container *,
|
|
43
|
-
.qbs-autocomplete-container-table-view,
|
|
44
|
-
.qbs-autocomplete-container-table-view * {
|
|
45
|
-
box-sizing: border-box;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* Explicit TextField size heights — reliable even if utility order fights other CSS */
|
|
49
|
-
.qbs-textfield input.qbs-h-10,
|
|
50
|
-
input.qbs-peer.qbs-h-10 {
|
|
51
|
-
height: 2.5rem;
|
|
52
|
-
min-height: 2.5rem;
|
|
1
|
+
body * {
|
|
53
2
|
box-sizing: border-box;
|
|
54
3
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
4
|
+
:root {
|
|
5
|
+
--grey-dark: #4a4a4a;
|
|
6
|
+
--grey-light: #d3d3d3;
|
|
7
|
+
--blue-navy: #001f3f;
|
|
8
|
+
--input-disabled: #a9a9a9;
|
|
9
|
+
--error-light: #f08080;
|
|
10
|
+
--error-extra-light: #fddede;
|
|
11
|
+
--success: #28a745;
|
|
12
|
+
--success-light: #d4edda;
|
|
13
|
+
--blue-light: #add8e6;
|
|
60
14
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
min-height: 34px;
|
|
65
|
-
box-sizing: border-box;
|
|
15
|
+
:root {
|
|
16
|
+
--blue-navy: #001f3f;
|
|
17
|
+
--table-hover: #your-hover-color; /* Replace with your actual color code */
|
|
66
18
|
}
|
|
67
19
|
|
|
68
20
|
.custom-spinner {
|
|
@@ -248,6 +200,10 @@ input.qbs-peer.qbs-h-\[34px\] {
|
|
|
248
200
|
color: #313131;
|
|
249
201
|
}
|
|
250
202
|
|
|
203
|
+
.qbs-textfield-default:disabled {
|
|
204
|
+
z-index: 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
251
207
|
.qbs-expandable-container {
|
|
252
208
|
border: 1px solid #d6d8dc;
|
|
253
209
|
background: #fff;
|
|
@@ -442,8 +398,7 @@ ul {
|
|
|
442
398
|
position: absolute;
|
|
443
399
|
right: 25px;
|
|
444
400
|
z-index: 99;
|
|
445
|
-
top:
|
|
446
|
-
transform: translateY(-50%);
|
|
401
|
+
top: 18px;
|
|
447
402
|
flex-wrap: wrap;
|
|
448
403
|
}
|
|
449
404
|
|
|
@@ -469,8 +424,7 @@ ul {
|
|
|
469
424
|
position: absolute;
|
|
470
425
|
right: 8px;
|
|
471
426
|
z-index: 99;
|
|
472
|
-
top:
|
|
473
|
-
transform: translateY(-50%);
|
|
427
|
+
top: 6.5px;
|
|
474
428
|
flex-wrap: wrap;
|
|
475
429
|
}
|
|
476
430
|
|
|
@@ -494,6 +448,12 @@ ul {
|
|
|
494
448
|
right: 8px;
|
|
495
449
|
}
|
|
496
450
|
|
|
451
|
+
.selected-item-inline-counter-disabled .badge {
|
|
452
|
+
background-color: #c63a3a;
|
|
453
|
+
color: #fff;
|
|
454
|
+
opacity: 1;
|
|
455
|
+
}
|
|
456
|
+
|
|
497
457
|
.selected-item-tool-direct-counter {
|
|
498
458
|
right: 60px;
|
|
499
459
|
}
|
|
@@ -745,6 +705,11 @@ span.dropdown-search-icon {
|
|
|
745
705
|
border-color: transparent transparent #000 transparent;
|
|
746
706
|
}
|
|
747
707
|
|
|
708
|
+
.custom_tooltip_style_class.up.tooltiptext::after,
|
|
709
|
+
.custom_tooltip_style_class.down.tooltiptext::after {
|
|
710
|
+
left: var(--tooltip-arrow-left, 50%);
|
|
711
|
+
}
|
|
712
|
+
|
|
748
713
|
.autocomplete-suggections .qbs-autocomplete-suggections-items {
|
|
749
714
|
display: flex;
|
|
750
715
|
/* justify-content: space-between; */
|
|
@@ -869,89 +834,18 @@ span.dropdown-search-icon {
|
|
|
869
834
|
|
|
870
835
|
/* TextField Inner Search Button */
|
|
871
836
|
.inner-search-button {
|
|
872
|
-
position: absolute;
|
|
873
837
|
background: #f8f8f8;
|
|
874
|
-
border:
|
|
875
|
-
|
|
876
|
-
padding: 0 8px;
|
|
838
|
+
border-radius: 6px;
|
|
839
|
+
padding: 0px 8px;
|
|
877
840
|
display: flex;
|
|
878
841
|
align-items: center;
|
|
879
|
-
justify-content: center;
|
|
842
|
+
justify-content: center;
|
|
880
843
|
cursor: pointer;
|
|
881
|
-
height:
|
|
844
|
+
height: 38px;
|
|
882
845
|
width: 38px;
|
|
883
846
|
top: 1px;
|
|
884
|
-
right:
|
|
885
|
-
z-index: 2;
|
|
886
|
-
box-sizing: border-box;
|
|
847
|
+
right: 2px;
|
|
887
848
|
}
|
|
888
849
|
.search-btn-input {
|
|
889
850
|
padding-right: 38px;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
/*
|
|
893
|
-
* Keep end icons inside the input border.
|
|
894
|
-
* (Sibling flex + qbs-w-full previously pushed icons outside the bordered input.)
|
|
895
|
-
*/
|
|
896
|
-
.qbs-autocomplete-adorement-wrapper,
|
|
897
|
-
.qbs-input-adorement-wrapper {
|
|
898
|
-
position: absolute;
|
|
899
|
-
top: 0;
|
|
900
|
-
right: 0;
|
|
901
|
-
bottom: 0;
|
|
902
|
-
display: flex;
|
|
903
|
-
align-items: center;
|
|
904
|
-
z-index: 2;
|
|
905
|
-
pointer-events: none;
|
|
906
|
-
}
|
|
907
|
-
.qbs-autocomplete-adorement-wrapper > *,
|
|
908
|
-
.qbs-input-adorement-wrapper > * {
|
|
909
|
-
pointer-events: auto;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
.qbs-autocomplete-adorement-wrapper .adorement,
|
|
913
|
-
.qbs-autocomplete-adorement-wrapper .qbs-autocomplete-adorement,
|
|
914
|
-
.qbs-input-adorement-wrapper .adorement {
|
|
915
|
-
position: relative !important;
|
|
916
|
-
right: auto !important;
|
|
917
|
-
top: auto !important;
|
|
918
|
-
height: 100%;
|
|
919
|
-
padding-right: 4px;
|
|
920
|
-
box-sizing: border-box;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
/* Avoid Tailwind `container` utility collision (prefix makes it `.qbs-container`) */
|
|
924
|
-
.qbs-selected-comp-normal {
|
|
925
|
-
position: relative;
|
|
926
|
-
display: block;
|
|
927
|
-
width: 100%;
|
|
928
|
-
max-width: none;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
.qbs-autocomplete-selected-comp {
|
|
932
|
-
position: relative;
|
|
933
|
-
display: block;
|
|
934
|
-
width: 100%;
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
.qbs-autocomplete-selected-comp > .qbs-textfield-expandable.qbs-normal,
|
|
938
|
-
.qbs-autocomplete-selected-comp > .qbs-textfield-expandable.qbs-normal .qbs-textfield-default {
|
|
939
|
-
display: block;
|
|
940
|
-
width: 100%;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
/* Tools icon should sit inside the field, vertically centered */
|
|
944
|
-
.qbs-tools-drop-btn {
|
|
945
|
-
position: absolute !important;
|
|
946
|
-
right: 8px !important;
|
|
947
|
-
top: 50% !important;
|
|
948
|
-
transform: translateY(-50%);
|
|
949
|
-
z-index: 2;
|
|
950
|
-
display: inline-flex;
|
|
951
|
-
align-items: center;
|
|
952
|
-
justify-content: center;
|
|
953
|
-
background: transparent;
|
|
954
|
-
border: none;
|
|
955
|
-
padding: 0;
|
|
956
|
-
cursor: pointer;
|
|
957
851
|
}
|
package/dist/styles/global.css
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
@tailwind components;
|
|
3
3
|
@tailwind utilities;
|
|
4
4
|
|
|
5
|
-
@import './components/modern-input.css';
|
|
6
|
-
@import './components/qbs-fallbacks.css';
|
|
7
5
|
@import './components/autocomplete.css';
|
|
8
6
|
@import './components/treedropdown.css';
|
|
9
7
|
@import './components/selectedautocomplete.css';
|
|
10
|
-
@import './components/tooltip.css';
|
|
8
|
+
@import './components/tooltip.css';
|
|
@@ -705,6 +705,11 @@ span.dropdown-search-icon {
|
|
|
705
705
|
border-color: transparent transparent #000 transparent;
|
|
706
706
|
}
|
|
707
707
|
|
|
708
|
+
.custom_tooltip_style_class.up.tooltiptext::after,
|
|
709
|
+
.custom_tooltip_style_class.down.tooltiptext::after {
|
|
710
|
+
left: var(--tooltip-arrow-left, 50%);
|
|
711
|
+
}
|
|
712
|
+
|
|
708
713
|
.autocomplete-suggections .qbs-autocomplete-suggections-items {
|
|
709
714
|
display: flex;
|
|
710
715
|
/* justify-content: space-between; */
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
18
|
var react_1 = require("react");
|
|
19
19
|
var react_dom_1 = __importDefault(require("react-dom"));
|
|
20
|
+
var getPosition_1 = require("./getPosition");
|
|
20
21
|
var ExpandableToolTip = function (_a) {
|
|
21
22
|
var title = _a.title, children = _a.children, enabled = _a.enabled;
|
|
22
23
|
var _b = (0, react_1.useState)('bottom-position'), dropdownPosition = _b[0], setDropdownPosition = _b[1];
|
|
@@ -27,10 +28,10 @@ var ExpandableToolTip = function (_a) {
|
|
|
27
28
|
var _e = (0, react_1.useState)({
|
|
28
29
|
top: 0,
|
|
29
30
|
left: 0,
|
|
30
|
-
|
|
31
|
+
arrowOffset: 50,
|
|
31
32
|
}), tooltipStyle = _e[0], setTooltipStyle = _e[1];
|
|
32
33
|
var hideTimeoutRef = (0, react_1.useRef)(null);
|
|
33
|
-
var handleMouseEnter = function (
|
|
34
|
+
var handleMouseEnter = function () {
|
|
34
35
|
if (hideTimeoutRef.current) {
|
|
35
36
|
clearTimeout(hideTimeoutRef.current);
|
|
36
37
|
hideTimeoutRef.current = null;
|
|
@@ -39,51 +40,37 @@ var ExpandableToolTip = function (_a) {
|
|
|
39
40
|
setVisible(true);
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
|
-
(0, react_1.
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var spaceAbove = inputBoxRect_1.top;
|
|
53
|
-
var spaceBelow = viewportHeight - inputBoxRect_1.bottom;
|
|
54
|
-
var dropPosition_1 = 'bottom-position';
|
|
55
|
-
if (spaceBelow >= tooltipHeight + 20) {
|
|
56
|
-
dropPosition_1 = 'bottom-position';
|
|
57
|
-
}
|
|
58
|
-
else if (spaceAbove >= tooltipHeight + 20) {
|
|
59
|
-
dropPosition_1 = 'top-position';
|
|
43
|
+
var updatePosition = (0, react_1.useCallback)(function () {
|
|
44
|
+
if (!menuButtonRef.current || !dropRef.current)
|
|
45
|
+
return;
|
|
46
|
+
var coords = (0, getPosition_1.getPortalTooltipCoords)(menuButtonRef.current, dropRef.current);
|
|
47
|
+
setDropdownPosition(coords.placement);
|
|
48
|
+
setTooltipStyle(function (prev) {
|
|
49
|
+
if (prev.top === coords.top &&
|
|
50
|
+
prev.left === coords.left &&
|
|
51
|
+
prev.arrowOffset === coords.arrowOffset) {
|
|
52
|
+
return prev;
|
|
60
53
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
: inputBoxRect_1.top - correctedHeight - 8 + window.scrollY;
|
|
82
|
-
setTooltipStyle(function (prev) { return (__assign(__assign({}, prev), { top: correctedTop_1 })); });
|
|
83
|
-
}
|
|
84
|
-
}, 0);
|
|
85
|
-
}
|
|
86
|
-
}, [visible]);
|
|
54
|
+
return {
|
|
55
|
+
top: coords.top,
|
|
56
|
+
left: coords.left,
|
|
57
|
+
arrowOffset: coords.arrowOffset,
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
}, []);
|
|
61
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
62
|
+
if (!visible || !isTooltipMounted)
|
|
63
|
+
return;
|
|
64
|
+
updatePosition();
|
|
65
|
+
var frame = window.requestAnimationFrame(updatePosition);
|
|
66
|
+
window.addEventListener('resize', updatePosition);
|
|
67
|
+
window.addEventListener('scroll', updatePosition, true);
|
|
68
|
+
return function () {
|
|
69
|
+
window.cancelAnimationFrame(frame);
|
|
70
|
+
window.removeEventListener('resize', updatePosition);
|
|
71
|
+
window.removeEventListener('scroll', updatePosition, true);
|
|
72
|
+
};
|
|
73
|
+
}, [visible, isTooltipMounted, updatePosition]);
|
|
87
74
|
(0, react_1.useEffect)(function () {
|
|
88
75
|
var handleMouseMove = function (event) {
|
|
89
76
|
if (!menuButtonRef.current || !dropRef.current)
|
|
@@ -140,11 +127,11 @@ var ExpandableToolTip = function (_a) {
|
|
|
140
127
|
left: tooltipStyle.left,
|
|
141
128
|
opacity: visible ? 1 : 0,
|
|
142
129
|
visibility: visible ? 'visible' : 'hidden',
|
|
143
|
-
width: tooltipStyle.width,
|
|
144
130
|
minWidth: '60px',
|
|
145
131
|
maxWidth: '200px',
|
|
146
132
|
pointerEvents: 'auto',
|
|
147
133
|
maxHeight: '210px',
|
|
134
|
+
'--tooltip-arrow-left': "".concat(tooltipStyle.arrowOffset, "px"),
|
|
148
135
|
} }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "", style: {
|
|
149
136
|
maxHeight: '200px',
|
|
150
137
|
overflowY: 'auto',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewTooltip.js","sourceRoot":"","sources":["../../src/utilities/NewTooltip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"NewTooltip.js","sourceRoot":"","sources":["../../src/utilities/NewTooltip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAAyF;AACzF,wDAAiC;AACjC,6CAAuD;AAEvD,IAAM,iBAAiB,GAAkB,UAAC,EAA4B;QAA1B,KAAK,WAAA,EAAE,QAAQ,cAAA,EAAE,OAAO,aAAA;IAC5D,IAAA,KAA0C,IAAA,gBAAQ,EAAC,iBAAiB,CAAC,EAApE,gBAAgB,QAAA,EAAE,mBAAmB,QAA+B,CAAC;IAC5E,IAAM,OAAO,GAAG,IAAA,cAAM,EAAwB,IAAI,CAAC,CAAC;IACpD,IAAM,aAAa,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAC7C,IAAA,KAA0C,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAAxD,gBAAgB,QAAA,EAAE,mBAAmB,QAAmB,CAAC;IAE1D,IAAA,KAAwB,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAAtC,OAAO,QAAA,EAAE,UAAU,QAAmB,CAAC;IACxC,IAAA,KAAkC,IAAA,gBAAQ,EAAC;QAC/C,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,WAAW,EAAE,EAAE;KAChB,CAAC,EAJK,YAAY,QAAA,EAAE,eAAe,QAIlC,CAAC;IACH,IA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Y,CAAC,GAAG;wBACrB,IAAI,EAAE,YAAY,CAAC,IAAI;wBACvB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBACxB,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;wBAC1C,QAAQ,EAAE,MAAM;wBAChB,QAAQ,EAAE,OAAO;wBACjB,aAAa,EAAE,MAAM;wBACrB,SAAS,EAAE,OAAO;wBAClB,sBAAsB,EAAE,UAAG,YAAY,CAAC,WAAW,OAAI;qBACjC,gBAG1B,yCACE,SAAS,EAAC,EAAE,EACZ,KAAK,EAAE;4BACL,SAAS,EAAE,OAAO;4BAClB,SAAS,EAAE,MAAM;4BACjB,SAAS,EAAE,QAAQ;4BACnB,OAAO,EAAE,KAAK;yBACf,gBAEA,KAAK,IACF,IACF,EACN,QAAQ,CAAC,IAAI,CACd,KACC,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
18
|
var react_1 = require("react");
|
|
19
19
|
var react_dom_1 = __importDefault(require("react-dom"));
|
|
20
|
+
var getPosition_1 = require("./getPosition");
|
|
20
21
|
var ExpandableToolTip = function (_a) {
|
|
21
22
|
var title = _a.title, children = _a.children, enabled = _a.enabled;
|
|
22
23
|
var _b = (0, react_1.useState)('bottom-position'), dropdownPosition = _b[0], setDropdownPosition = _b[1];
|
|
@@ -26,82 +27,45 @@ var ExpandableToolTip = function (_a) {
|
|
|
26
27
|
var _d = (0, react_1.useState)({
|
|
27
28
|
top: 0,
|
|
28
29
|
left: 0,
|
|
29
|
-
|
|
30
|
+
arrowOffset: 50,
|
|
30
31
|
}), tooltipStyle = _d[0], setTooltipStyle = _d[1];
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
if (menuButtonRef.current) {
|
|
34
|
-
var inputBoxRect = (_a = menuButtonRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
35
|
-
var viewportHeight = window.innerHeight;
|
|
36
|
-
var spaceAbove = inputBoxRect.top;
|
|
37
|
-
var spaceBelow = viewportHeight - inputBoxRect.bottom;
|
|
38
|
-
if (spaceAbove > spaceBelow) {
|
|
39
|
-
if (spaceAbove > 90 && spaceBelow < 120) {
|
|
40
|
-
return 'top-position';
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
return 'bottom-position';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
var diff = spaceBelow - spaceAbove;
|
|
48
|
-
if (spaceAbove > 90 && spaceBelow > 90 && diff < 90) {
|
|
49
|
-
return 'top-position';
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
return 'bottom-position';
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var handleMouseEnter = function (e) {
|
|
58
|
-
var _a;
|
|
59
|
-
if (menuButtonRef.current) {
|
|
60
|
-
var dropPosition = adjustDropdownPosition();
|
|
61
|
-
setDropdownPosition(dropPosition);
|
|
62
|
-
var rect = e.target.getBoundingClientRect();
|
|
63
|
-
var top_1 = rect.bottom + window.scrollY;
|
|
64
|
-
var left = rect.left + window.scrollX;
|
|
65
|
-
var height = rect.height;
|
|
66
|
-
var width = (_a = dropRef === null || dropRef === void 0 ? void 0 : dropRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth;
|
|
67
|
-
if (dropPosition === 'bottom-position') {
|
|
68
|
-
top_1 = top_1 + height / 2 - 5;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
top_1 = top_1 - height * 2 + 15;
|
|
72
|
-
}
|
|
73
|
-
setTooltipStyle({
|
|
74
|
-
top: top_1,
|
|
75
|
-
left: left,
|
|
76
|
-
width: width,
|
|
77
|
-
});
|
|
78
|
-
setVisible(true);
|
|
79
|
-
}
|
|
32
|
+
var handleMouseEnter = function () {
|
|
33
|
+
setVisible(true);
|
|
80
34
|
};
|
|
81
35
|
var handleMouseLeave = function () {
|
|
82
36
|
setVisible(false);
|
|
83
37
|
};
|
|
84
|
-
(0, react_1.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
: prevStyle.top - tooltipHeight_1 })); });
|
|
38
|
+
var updatePosition = (0, react_1.useCallback)(function () {
|
|
39
|
+
if (!menuButtonRef.current || !dropRef.current)
|
|
40
|
+
return;
|
|
41
|
+
var coords = (0, getPosition_1.getPortalTooltipCoords)(menuButtonRef.current, dropRef.current);
|
|
42
|
+
setDropdownPosition(coords.placement);
|
|
43
|
+
setTooltipStyle(function (prev) {
|
|
44
|
+
if (prev.top === coords.top &&
|
|
45
|
+
prev.left === coords.left &&
|
|
46
|
+
prev.arrowOffset === coords.arrowOffset) {
|
|
47
|
+
return prev;
|
|
95
48
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
49
|
+
return {
|
|
50
|
+
top: coords.top,
|
|
51
|
+
left: coords.left,
|
|
52
|
+
arrowOffset: coords.arrowOffset,
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}, []);
|
|
56
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
57
|
+
if (!visible)
|
|
58
|
+
return;
|
|
59
|
+
updatePosition();
|
|
60
|
+
var frame = window.requestAnimationFrame(updatePosition);
|
|
61
|
+
window.addEventListener('resize', updatePosition);
|
|
62
|
+
window.addEventListener('scroll', updatePosition, true);
|
|
101
63
|
return function () {
|
|
102
|
-
window.
|
|
64
|
+
window.cancelAnimationFrame(frame);
|
|
65
|
+
window.removeEventListener('resize', updatePosition);
|
|
66
|
+
window.removeEventListener('scroll', updatePosition, true);
|
|
103
67
|
};
|
|
104
|
-
}, [visible,
|
|
68
|
+
}, [visible, updatePosition]);
|
|
105
69
|
(0, react_1.useEffect)(function () {
|
|
106
70
|
var handleClickOutside = function (event) {
|
|
107
71
|
if (dropRef.current && !dropRef.current.contains(event.target)) {
|
|
@@ -116,14 +80,16 @@ var ExpandableToolTip = function (_a) {
|
|
|
116
80
|
return ((0, jsx_runtime_1.jsxs)("div", __assign({ onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, ref: menuButtonRef, style: { display: 'flex' } }, { children: [children, visible &&
|
|
117
81
|
enabled &&
|
|
118
82
|
tooltipStyle &&
|
|
119
|
-
react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("span", __assign({ ref: function (node) {
|
|
83
|
+
react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("span", __assign({ ref: function (node) {
|
|
84
|
+
dropRef.current = node;
|
|
85
|
+
}, className: "tooltiptext custom_tooltip_style_class ".concat(dropdownPosition == 'bottom-position' ? 'down' : 'up'), style: {
|
|
120
86
|
top: tooltipStyle.top,
|
|
121
87
|
left: tooltipStyle.left,
|
|
122
88
|
opacity: 1,
|
|
123
|
-
width: tooltipStyle.width,
|
|
124
89
|
minWidth: '60px',
|
|
125
90
|
maxWidth: '200px',
|
|
126
91
|
visibility: 'visible',
|
|
92
|
+
'--tooltip-arrow-left': "".concat(tooltipStyle.arrowOffset, "px"),
|
|
127
93
|
} }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ className: "tooltip-text-container" }, { children: title })) })), document.body)] })));
|
|
128
94
|
};
|
|
129
95
|
exports.default = ExpandableToolTip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandableTootltip.js","sourceRoot":"","sources":["../../src/utilities/expandableTootltip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"expandableTootltip.js","sourceRoot":"","sources":["../../src/utilities/expandableTootltip.tsx"],"names":[],"mappings":";;;;;;;;;;;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EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,0CACE,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,iBAEzB,QAAQ,EAER,OAAO;gBACN,OAAO;gBACP,YAAY;gBACZ,mBAAQ,CAAC,YAAY,CACnB,0CACE,GAAG,EAAE,UAAC,IAAI;wBACR,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;oBACzB,CAAC,EACD,SAAS,EAAE,kDACT,gBAAgB,IAAI,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CACrD,EACF,KAAK,EACH;wBACE,GAAG,EAAE,YAAY,CAAC,GAAG;wBACrB,IAAI,EAAE,YAAY,CAAC,IAAI;wBACvB,OAAO,EAAE,CAAC;wBACV,QAAQ,EAAE,MAAM;wBAChB,QAAQ,EAAE,OAAO;wBACjB,UAAU,EAAE,SAAS;wBACrB,sBAAsB,EAAE,UAAG,YAAY,CAAC,WAAW,OAAI;qBACjC,gBAG1B,0CAAM,SAAS,EAAC,wBAAwB,gBAAE,KAAK,IAAQ,IAClD,EACP,QAAQ,CAAC,IAAI,CACd,KACC,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const applyPositionClass: (textFieldRef: React.RefObject<HTMLDivElement>, isHovered?: boolean) => void;
|
|
3
3
|
export declare const applyToolTipPositionClass: (textFieldRef: React.RefObject<HTMLDivElement>) => void;
|
|
4
|
+
export type PortalTooltipPlacement = 'top-position' | 'bottom-position';
|
|
5
|
+
export type PortalTooltipCoords = {
|
|
6
|
+
top: number;
|
|
7
|
+
left: number;
|
|
8
|
+
arrowOffset: number;
|
|
9
|
+
placement: PortalTooltipPlacement;
|
|
10
|
+
};
|
|
11
|
+
/** Center a portaled tooltip on its trigger and keep the arrow on the trigger. */
|
|
12
|
+
export declare const getPortalTooltipCoords: (anchorEl: HTMLElement, tooltipEl: HTMLElement) => PortalTooltipCoords;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyToolTipPositionClass = exports.applyPositionClass = void 0;
|
|
3
|
+
exports.getPortalTooltipCoords = exports.applyToolTipPositionClass = exports.applyPositionClass = void 0;
|
|
4
4
|
// const getPosition = (textFieldElement: HTMLElement) => {
|
|
5
5
|
// const textFieldRect = textFieldElement.getBoundingClientRect()
|
|
6
6
|
// const spaceBelow = window.innerHeight - textFieldRect.bottom
|
|
@@ -52,4 +52,44 @@ var applyToolTipPositionClass = function (textFieldRef) {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
exports.applyToolTipPositionClass = applyToolTipPositionClass;
|
|
55
|
+
var VIEWPORT_PAD = 8;
|
|
56
|
+
var TOOLTIP_GAP = 8;
|
|
57
|
+
var ARROW_HALF = 5;
|
|
58
|
+
/** Center a portaled tooltip on its trigger and keep the arrow on the trigger. */
|
|
59
|
+
var getPortalTooltipCoords = function (anchorEl, tooltipEl) {
|
|
60
|
+
var anchor = anchorEl.getBoundingClientRect();
|
|
61
|
+
var tooltipWidth = Math.max(tooltipEl.offsetWidth, 60);
|
|
62
|
+
var tooltipHeight = tooltipEl.offsetHeight;
|
|
63
|
+
var spaceAbove = anchor.top;
|
|
64
|
+
var spaceBelow = window.innerHeight - anchor.bottom;
|
|
65
|
+
var placement = 'bottom-position';
|
|
66
|
+
if (spaceBelow >= tooltipHeight + 20) {
|
|
67
|
+
placement = 'bottom-position';
|
|
68
|
+
}
|
|
69
|
+
else if (spaceAbove >= tooltipHeight + 20) {
|
|
70
|
+
placement = 'top-position';
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
placement = spaceBelow > spaceAbove ? 'bottom-position' : 'top-position';
|
|
74
|
+
}
|
|
75
|
+
var top = placement === 'bottom-position'
|
|
76
|
+
? anchor.bottom + TOOLTIP_GAP + window.scrollY
|
|
77
|
+
: anchor.top - tooltipHeight - TOOLTIP_GAP + window.scrollY;
|
|
78
|
+
var triggerCenterX = anchor.left + anchor.width / 2;
|
|
79
|
+
var minLeft = VIEWPORT_PAD;
|
|
80
|
+
var maxLeft = window.innerWidth - tooltipWidth - VIEWPORT_PAD;
|
|
81
|
+
var left = maxLeft < minLeft
|
|
82
|
+
? minLeft
|
|
83
|
+
: Math.min(Math.max(triggerCenterX - tooltipWidth / 2, minLeft), maxLeft);
|
|
84
|
+
var minArrow = ARROW_HALF + 6;
|
|
85
|
+
var maxArrow = Math.max(minArrow, tooltipWidth - ARROW_HALF - 6);
|
|
86
|
+
var arrowOffset = Math.min(Math.max(triggerCenterX - left, minArrow), maxArrow);
|
|
87
|
+
return {
|
|
88
|
+
top: top,
|
|
89
|
+
left: left + window.scrollX,
|
|
90
|
+
arrowOffset: arrowOffset,
|
|
91
|
+
placement: placement,
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
exports.getPortalTooltipCoords = getPortalTooltipCoords;
|
|
55
95
|
//# sourceMappingURL=getPosition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPosition.js","sourceRoot":"","sources":["../../src/utilities/getPosition.ts"],"names":[],"mappings":";;;AAEA,2DAA2D;AAC3D,mEAAmE;AAEnE,iEAAiE;AACjE,+CAA+C;AAC/C,IAAI;AACJ,IAAM,mBAAmB,GAAG,UAAC,OAAoB;IAC/C,IAAI,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IACnC,OAAO,MAAM,EAAE;QACb,IAAM,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC;QAC5D,IAAI,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,MAAM,EAAE;YAClD,OAAO,MAAM,CAAC;SACf;QACD,MAA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