bnstooltips 1.4.9 → 1.5.6
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/build/ItemTooltip/SubComponents/ItemCooldowns.d.ts +1 -0
- package/build/ItemTooltipWrapper/ItemTooltipWrapper.types.d.ts +2 -4
- package/build/SkillTooltipWrapper/SkillTooltipWrapper.types.d.ts +2 -4
- package/build/Utilities/Models.d.ts +8 -0
- package/build/index.d.ts +2 -0
- package/build/index.es.js +193 -10
- package/build/index.es.js.map +1 -1
- package/build/index.js +193 -9
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -63,7 +63,7 @@ styleInject(css_248z$6);
|
|
|
63
63
|
|
|
64
64
|
function TooltipBase(_a) {
|
|
65
65
|
var title = _a.title, category = _a.subtitle, grade = _a.grade, _b = _a.icon, icon = _b === void 0 ? "" : _b, _c = _a.mainInfos, mainTexts = _c === void 0 ? [] : _c, _d = _a.subInfoGroups, subTexts = _d === void 0 ? [] : _d, id = _a.id, _e = _a.fullHeight, fullHeight = _e === void 0 ? false : _e;
|
|
66
|
-
return (React__default["default"].createElement("div", {
|
|
66
|
+
return (React__default["default"].createElement("div", { "data-contentid": id !== null && id !== void 0 ? id : "", "data-testid": "TooltipBase", className: "TooltipBase_container TooltipBase_border-grade-".concat(grade, " ").concat(fullHeight ? "TooltipBase_containerFullHeight" : "") },
|
|
67
67
|
(title != null && title != "") ||
|
|
68
68
|
(category != null && category != "") ? (React__default["default"].createElement("div", { className: "TooltipBase_titlesubtitle" },
|
|
69
69
|
React__default["default"].createElement("div", { className: "TooltipBase_title" },
|
|
@@ -4948,6 +4948,184 @@ Object.assign({}, applyStyles$1, {
|
|
|
4948
4948
|
}
|
|
4949
4949
|
});
|
|
4950
4950
|
|
|
4951
|
+
var mouseCoords = {
|
|
4952
|
+
clientX: 0,
|
|
4953
|
+
clientY: 0
|
|
4954
|
+
};
|
|
4955
|
+
var activeInstances = [];
|
|
4956
|
+
|
|
4957
|
+
function storeMouseCoords(_ref) {
|
|
4958
|
+
var clientX = _ref.clientX,
|
|
4959
|
+
clientY = _ref.clientY;
|
|
4960
|
+
mouseCoords = {
|
|
4961
|
+
clientX: clientX,
|
|
4962
|
+
clientY: clientY
|
|
4963
|
+
};
|
|
4964
|
+
}
|
|
4965
|
+
|
|
4966
|
+
function addMouseCoordsListener(doc) {
|
|
4967
|
+
doc.addEventListener('mousemove', storeMouseCoords);
|
|
4968
|
+
}
|
|
4969
|
+
|
|
4970
|
+
function removeMouseCoordsListener(doc) {
|
|
4971
|
+
doc.removeEventListener('mousemove', storeMouseCoords);
|
|
4972
|
+
}
|
|
4973
|
+
|
|
4974
|
+
var followCursor = {
|
|
4975
|
+
name: 'followCursor',
|
|
4976
|
+
defaultValue: false,
|
|
4977
|
+
fn: function fn(instance) {
|
|
4978
|
+
var reference = instance.reference;
|
|
4979
|
+
var doc = getOwnerDocument(instance.props.triggerTarget || reference);
|
|
4980
|
+
var isInternalUpdate = false;
|
|
4981
|
+
var wasFocusEvent = false;
|
|
4982
|
+
var isUnmounted = true;
|
|
4983
|
+
var prevProps = instance.props;
|
|
4984
|
+
|
|
4985
|
+
function getIsInitialBehavior() {
|
|
4986
|
+
return instance.props.followCursor === 'initial' && instance.state.isVisible;
|
|
4987
|
+
}
|
|
4988
|
+
|
|
4989
|
+
function addListener() {
|
|
4990
|
+
doc.addEventListener('mousemove', onMouseMove);
|
|
4991
|
+
}
|
|
4992
|
+
|
|
4993
|
+
function removeListener() {
|
|
4994
|
+
doc.removeEventListener('mousemove', onMouseMove);
|
|
4995
|
+
}
|
|
4996
|
+
|
|
4997
|
+
function unsetGetReferenceClientRect() {
|
|
4998
|
+
isInternalUpdate = true;
|
|
4999
|
+
instance.setProps({
|
|
5000
|
+
getReferenceClientRect: null
|
|
5001
|
+
});
|
|
5002
|
+
isInternalUpdate = false;
|
|
5003
|
+
}
|
|
5004
|
+
|
|
5005
|
+
function onMouseMove(event) {
|
|
5006
|
+
// If the instance is interactive, avoid updating the position unless it's
|
|
5007
|
+
// over the reference element
|
|
5008
|
+
var isCursorOverReference = event.target ? reference.contains(event.target) : true;
|
|
5009
|
+
var followCursor = instance.props.followCursor;
|
|
5010
|
+
var clientX = event.clientX,
|
|
5011
|
+
clientY = event.clientY;
|
|
5012
|
+
var rect = reference.getBoundingClientRect();
|
|
5013
|
+
var relativeX = clientX - rect.left;
|
|
5014
|
+
var relativeY = clientY - rect.top;
|
|
5015
|
+
|
|
5016
|
+
if (isCursorOverReference || !instance.props.interactive) {
|
|
5017
|
+
instance.setProps({
|
|
5018
|
+
// @ts-ignore - unneeded DOMRect properties
|
|
5019
|
+
getReferenceClientRect: function getReferenceClientRect() {
|
|
5020
|
+
var rect = reference.getBoundingClientRect();
|
|
5021
|
+
var x = clientX;
|
|
5022
|
+
var y = clientY;
|
|
5023
|
+
|
|
5024
|
+
if (followCursor === 'initial') {
|
|
5025
|
+
x = rect.left + relativeX;
|
|
5026
|
+
y = rect.top + relativeY;
|
|
5027
|
+
}
|
|
5028
|
+
|
|
5029
|
+
var top = followCursor === 'horizontal' ? rect.top : y;
|
|
5030
|
+
var right = followCursor === 'vertical' ? rect.right : x;
|
|
5031
|
+
var bottom = followCursor === 'horizontal' ? rect.bottom : y;
|
|
5032
|
+
var left = followCursor === 'vertical' ? rect.left : x;
|
|
5033
|
+
return {
|
|
5034
|
+
width: right - left,
|
|
5035
|
+
height: bottom - top,
|
|
5036
|
+
top: top,
|
|
5037
|
+
right: right,
|
|
5038
|
+
bottom: bottom,
|
|
5039
|
+
left: left
|
|
5040
|
+
};
|
|
5041
|
+
}
|
|
5042
|
+
});
|
|
5043
|
+
}
|
|
5044
|
+
}
|
|
5045
|
+
|
|
5046
|
+
function create() {
|
|
5047
|
+
if (instance.props.followCursor) {
|
|
5048
|
+
activeInstances.push({
|
|
5049
|
+
instance: instance,
|
|
5050
|
+
doc: doc
|
|
5051
|
+
});
|
|
5052
|
+
addMouseCoordsListener(doc);
|
|
5053
|
+
}
|
|
5054
|
+
}
|
|
5055
|
+
|
|
5056
|
+
function destroy() {
|
|
5057
|
+
activeInstances = activeInstances.filter(function (data) {
|
|
5058
|
+
return data.instance !== instance;
|
|
5059
|
+
});
|
|
5060
|
+
|
|
5061
|
+
if (activeInstances.filter(function (data) {
|
|
5062
|
+
return data.doc === doc;
|
|
5063
|
+
}).length === 0) {
|
|
5064
|
+
removeMouseCoordsListener(doc);
|
|
5065
|
+
}
|
|
5066
|
+
}
|
|
5067
|
+
|
|
5068
|
+
return {
|
|
5069
|
+
onCreate: create,
|
|
5070
|
+
onDestroy: destroy,
|
|
5071
|
+
onBeforeUpdate: function onBeforeUpdate() {
|
|
5072
|
+
prevProps = instance.props;
|
|
5073
|
+
},
|
|
5074
|
+
onAfterUpdate: function onAfterUpdate(_, _ref2) {
|
|
5075
|
+
var followCursor = _ref2.followCursor;
|
|
5076
|
+
|
|
5077
|
+
if (isInternalUpdate) {
|
|
5078
|
+
return;
|
|
5079
|
+
}
|
|
5080
|
+
|
|
5081
|
+
if (followCursor !== undefined && prevProps.followCursor !== followCursor) {
|
|
5082
|
+
destroy();
|
|
5083
|
+
|
|
5084
|
+
if (followCursor) {
|
|
5085
|
+
create();
|
|
5086
|
+
|
|
5087
|
+
if (instance.state.isMounted && !wasFocusEvent && !getIsInitialBehavior()) {
|
|
5088
|
+
addListener();
|
|
5089
|
+
}
|
|
5090
|
+
} else {
|
|
5091
|
+
removeListener();
|
|
5092
|
+
unsetGetReferenceClientRect();
|
|
5093
|
+
}
|
|
5094
|
+
}
|
|
5095
|
+
},
|
|
5096
|
+
onMount: function onMount() {
|
|
5097
|
+
if (instance.props.followCursor && !wasFocusEvent) {
|
|
5098
|
+
if (isUnmounted) {
|
|
5099
|
+
onMouseMove(mouseCoords);
|
|
5100
|
+
isUnmounted = false;
|
|
5101
|
+
}
|
|
5102
|
+
|
|
5103
|
+
if (!getIsInitialBehavior()) {
|
|
5104
|
+
addListener();
|
|
5105
|
+
}
|
|
5106
|
+
}
|
|
5107
|
+
},
|
|
5108
|
+
onTrigger: function onTrigger(_, event) {
|
|
5109
|
+
if (isMouseEvent(event)) {
|
|
5110
|
+
mouseCoords = {
|
|
5111
|
+
clientX: event.clientX,
|
|
5112
|
+
clientY: event.clientY
|
|
5113
|
+
};
|
|
5114
|
+
}
|
|
5115
|
+
|
|
5116
|
+
wasFocusEvent = event.type === 'focus';
|
|
5117
|
+
},
|
|
5118
|
+
onHidden: function onHidden() {
|
|
5119
|
+
if (instance.props.followCursor) {
|
|
5120
|
+
unsetGetReferenceClientRect();
|
|
5121
|
+
removeListener();
|
|
5122
|
+
isUnmounted = true;
|
|
5123
|
+
}
|
|
5124
|
+
}
|
|
5125
|
+
};
|
|
5126
|
+
}
|
|
5127
|
+
};
|
|
5128
|
+
|
|
4951
5129
|
tippy.setDefaultProps({
|
|
4952
5130
|
render: render
|
|
4953
5131
|
});
|
|
@@ -5340,9 +5518,9 @@ var css_248z$3 = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[
|
|
|
5340
5518
|
styleInject(css_248z$3);
|
|
5341
5519
|
|
|
5342
5520
|
var ItemTooltipWrapper = function (_a) {
|
|
5343
|
-
var data = _a.data, region = _a.region, children = _a.children, client = _a.client, _b = _a.offline, offline = _b === void 0 ? false : _b, _c = _a.interactive, interactive = _c === void 0 ? true : _c, _d = _a.placement, placement = _d === void 0 ? "right" : _d, _e = _a.debug, debug = _e === void 0 ? false : _e, jobstyleOverride = _a.jobstyleOverride;
|
|
5521
|
+
var data = _a.data, region = _a.region, children = _a.children, client = _a.client, _b = _a.offline, offline = _b === void 0 ? false : _b, _c = _a.interactive, interactive = _c === void 0 ? true : _c, _d = _a.placement, placement = _d === void 0 ? "right" : _d, _e = _a.debug, debug = _e === void 0 ? false : _e, jobstyleOverride = _a.jobstyleOverride, _f = _a.followCursor, followCursor$1 = _f === void 0 ? false : _f, _g = _a.trigger, trigger = _g === void 0 ? "mouseenter focus" : _g, _h = _a.showArrow, showArrow = _h === void 0 ? true : _h;
|
|
5344
5522
|
var spanRef = React.useRef(null);
|
|
5345
|
-
var
|
|
5523
|
+
var _j = React.useState(null), childRef = _j[0], setChildRef = _j[1];
|
|
5346
5524
|
/**
|
|
5347
5525
|
* Mount the temporary span element.
|
|
5348
5526
|
* retrieve and store the target element's reference.
|
|
@@ -5353,10 +5531,10 @@ var ItemTooltipWrapper = function (_a) {
|
|
|
5353
5531
|
}
|
|
5354
5532
|
return function () { return setChildRef(null); };
|
|
5355
5533
|
}, []);
|
|
5356
|
-
var
|
|
5534
|
+
var _k = React.useState(true), isOffline = _k[0], setIsOffline = _k[1];
|
|
5357
5535
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
5358
5536
|
children,
|
|
5359
|
-
childRef ? (React__default["default"].createElement(Tippy, { appendTo: document.body, onMount: function () { return setIsOffline(offline); }, placement: placement, animation: "fade", interactive: interactive, content: React__default["default"].createElement(ItemTooltip, { region: region, jobstyleOverride: jobstyleOverride, data: data, offline: isOffline, client: client, debug: debug }), theme: "grade" + data.grade, reference: childRef })) : (React__default["default"].createElement("span", { ref: spanRef, style: { display: "none" } }))));
|
|
5537
|
+
childRef ? (React__default["default"].createElement(Tippy, { arrow: showArrow, trigger: trigger, plugins: [followCursor], followCursor: followCursor$1 && !interactive, appendTo: document.body, onMount: function () { return setIsOffline(offline); }, placement: placement, animation: "fade", interactive: interactive, content: React__default["default"].createElement(ItemTooltip, { region: region, jobstyleOverride: jobstyleOverride, data: data, offline: isOffline, client: client, debug: debug }), theme: "grade" + data.grade, reference: childRef })) : (React__default["default"].createElement("span", { ref: spanRef, style: { display: "none" } }))));
|
|
5360
5538
|
};
|
|
5361
5539
|
|
|
5362
5540
|
function ItemIconNameDiv(_a) {
|
|
@@ -5510,11 +5688,15 @@ function ItemTooltip(_a) {
|
|
|
5510
5688
|
}
|
|
5511
5689
|
}, [jobstyleOverride]);
|
|
5512
5690
|
var item = data;
|
|
5691
|
+
var itemCategory = (_c = (_b = item.categories) === null || _b === void 0 ? void 0 : _b.sort(function (a, b) { return b.index - a.index; })[0].localizedName) !== null && _c !== void 0 ? _c : "";
|
|
5692
|
+
if (itemCategory == "none")
|
|
5693
|
+
itemCategory = "";
|
|
5513
5694
|
var tooltipBaseProps = {
|
|
5514
5695
|
title: item.name,
|
|
5515
5696
|
grade: item.grade,
|
|
5697
|
+
id: item.id + "-" + item.level,
|
|
5516
5698
|
icon: item.icon ? BuildIconPath(item.icon.iconPath) : "",
|
|
5517
|
-
subtitle:
|
|
5699
|
+
subtitle: itemCategory,
|
|
5518
5700
|
mainInfos: [],
|
|
5519
5701
|
subInfoGroups: [],
|
|
5520
5702
|
fullHeight: fullHeight,
|
|
@@ -5982,6 +6164,7 @@ function SkillTooltip(_a) {
|
|
|
5982
6164
|
var skill = data;
|
|
5983
6165
|
var tooltipBaseProps = {
|
|
5984
6166
|
title: skill.Name,
|
|
6167
|
+
id: skill.ID + "-" + skill.Variation,
|
|
5985
6168
|
grade: 4,
|
|
5986
6169
|
icon: skill.IconPath ? React__default["default"].createElement(SkillIconWithButton, { skill: skill }) : "",
|
|
5987
6170
|
subtitle: skill.AdditionalInfo
|
|
@@ -6093,9 +6276,9 @@ var css_248z = ".tippy-box {\n max-width: none !important;\n background-color:
|
|
|
6093
6276
|
styleInject(css_248z);
|
|
6094
6277
|
|
|
6095
6278
|
var SkillTooltipWrapper = function (_a) {
|
|
6096
|
-
var data = _a.data, children = _a.children, _b = _a.interactive, interactive = _b === void 0 ? false : _b, _c = _a.placement, placement = _c === void 0 ? "right" : _c;
|
|
6279
|
+
var data = _a.data, children = _a.children, _b = _a.interactive, interactive = _b === void 0 ? false : _b, _c = _a.placement, placement = _c === void 0 ? "right" : _c, _d = _a.followCursor, followCursor$1 = _d === void 0 ? false : _d, _e = _a.trigger, trigger = _e === void 0 ? "mouseenter focus" : _e, _f = _a.showArrow, showArrow = _f === void 0 ? true : _f;
|
|
6097
6280
|
var spanRef = React.useRef(null);
|
|
6098
|
-
var
|
|
6281
|
+
var _g = React.useState(null), childRef = _g[0], setChildRef = _g[1];
|
|
6099
6282
|
/**
|
|
6100
6283
|
* Mount the temporary span element.
|
|
6101
6284
|
* retrieve and store the target element's reference.
|
|
@@ -6108,7 +6291,7 @@ var SkillTooltipWrapper = function (_a) {
|
|
|
6108
6291
|
}, []);
|
|
6109
6292
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6110
6293
|
children,
|
|
6111
|
-
childRef ? (React__default["default"].createElement(Tippy, { appendTo: document.body, placement: placement, animation: "fade", interactive: interactive, content: React__default["default"].createElement(SkillTooltip, { data: data, debug: false }), theme: "grade" + 4, reference: childRef })) : (React__default["default"].createElement("span", { ref: spanRef, style: { display: "none" } }))));
|
|
6294
|
+
childRef ? (React__default["default"].createElement(Tippy, { arrow: showArrow, trigger: trigger, plugins: [followCursor], followCursor: followCursor$1 && !interactive, appendTo: document.body, placement: placement, animation: "fade", interactive: interactive, content: React__default["default"].createElement(SkillTooltip, { data: data, debug: false }), theme: "grade" + 4, reference: childRef })) : (React__default["default"].createElement("span", { ref: spanRef, style: { display: "none" } }))));
|
|
6112
6295
|
};
|
|
6113
6296
|
|
|
6114
6297
|
exports.ServerRegion = void 0;
|
|
@@ -6117,6 +6300,7 @@ exports.ServerRegion = void 0;
|
|
|
6117
6300
|
ServerRegion["Korea"] = "Korea";
|
|
6118
6301
|
})(exports.ServerRegion || (exports.ServerRegion = {}));
|
|
6119
6302
|
|
|
6303
|
+
exports.GetCooldownString = GetCooldownString;
|
|
6120
6304
|
exports.ItemTooltip = ItemTooltip;
|
|
6121
6305
|
exports.ItemTooltipWrapper = ItemTooltipWrapper;
|
|
6122
6306
|
exports.JsonTooltip = JsonTooltip;
|