mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°7331 - Fix cleanup script to remove all denied folders
This commit is contained in:
2
node_modules/tippy.js/README.md
generated
vendored
2
node_modules/tippy.js/README.md
generated
vendored
@@ -52,7 +52,7 @@ The core CSS comes bundled with the default unpkg import.
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
For detailed usage information,
|
For detailed usage information,
|
||||||
[visit the docs](https://atomiks.github.io/tippyjs/v6/creation/).
|
[visit the docs](https://atomiks.github.io/tippyjs/v6/getting-started/).
|
||||||
|
|
||||||
## Component Wrappers
|
## Component Wrappers
|
||||||
|
|
||||||
|
|||||||
391
node_modules/tippy.js/dist/tippy-bundle.umd.js
generated
vendored
391
node_modules/tippy.js/dist/tippy-bundle.umd.js
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
/**!
|
/**!
|
||||||
* tippy.js v6.2.5
|
* tippy.js v6.3.7
|
||||||
* (c) 2017-2020 atomiks
|
* (c) 2017-2021 atomiks
|
||||||
* MIT License
|
* MIT License
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
(global = global || self, global.tippy = factory(global.Popper));
|
(global = global || self, global.tippy = factory(global.Popper));
|
||||||
}(this, (function (core) { 'use strict';
|
}(this, (function (core) { 'use strict';
|
||||||
|
|
||||||
var css = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:\"\";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}";
|
var css = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:\"\";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}";
|
||||||
|
|
||||||
function injectCSS(css) {
|
function injectCSS(css) {
|
||||||
var style = document.createElement('style');
|
var style = document.createElement('style');
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||||
var ua = isBrowser ? navigator.userAgent : '';
|
var isIE11 = isBrowser ? // @ts-ignore
|
||||||
var isIE = /MSIE |Trident\//.test(ua);
|
!!window.msCrypto : false;
|
||||||
|
|
||||||
var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>';
|
var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>';
|
||||||
var BOX_CLASS = "tippy-box";
|
var BOX_CLASS = "tippy-box";
|
||||||
@@ -39,6 +39,9 @@
|
|||||||
passive: true,
|
passive: true,
|
||||||
capture: true
|
capture: true
|
||||||
};
|
};
|
||||||
|
var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
|
||||||
|
return document.body;
|
||||||
|
};
|
||||||
|
|
||||||
function hasOwnProperty(obj, key) {
|
function hasOwnProperty(obj, key) {
|
||||||
return {}.hasOwnProperty.call(obj, key);
|
return {}.hasOwnProperty.call(obj, key);
|
||||||
@@ -158,10 +161,13 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getOwnerDocument(elementOrElements) {
|
function getOwnerDocument(elementOrElements) {
|
||||||
var _normalizeToArray = normalizeToArray(elementOrElements),
|
var _element$ownerDocumen;
|
||||||
element = _normalizeToArray[0];
|
|
||||||
|
|
||||||
return element ? element.ownerDocument || document : document;
|
var _normalizeToArray = normalizeToArray(elementOrElements),
|
||||||
|
element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
|
||||||
|
|
||||||
|
|
||||||
|
return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
|
||||||
}
|
}
|
||||||
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
||||||
var clientX = event.clientX,
|
var clientX = event.clientX,
|
||||||
@@ -197,6 +203,26 @@
|
|||||||
box[method](event, listener);
|
box[method](event, listener);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Compared to xxx.contains, this function works for dom structures with shadow
|
||||||
|
* dom
|
||||||
|
*/
|
||||||
|
|
||||||
|
function actualContains(parent, child) {
|
||||||
|
var target = child;
|
||||||
|
|
||||||
|
while (target) {
|
||||||
|
var _target$getRootNode;
|
||||||
|
|
||||||
|
if (parent.contains(target)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var currentInput = {
|
var currentInput = {
|
||||||
isTouch: false
|
isTouch: false
|
||||||
@@ -332,9 +358,7 @@
|
|||||||
zIndex: 9999
|
zIndex: 9999
|
||||||
};
|
};
|
||||||
var defaultProps = Object.assign({
|
var defaultProps = Object.assign({
|
||||||
appendTo: function appendTo() {
|
appendTo: TIPPY_DEFAULT_APPEND_TO,
|
||||||
return document.body;
|
|
||||||
},
|
|
||||||
aria: {
|
aria: {
|
||||||
content: 'auto',
|
content: 'auto',
|
||||||
expanded: 'auto'
|
expanded: 'auto'
|
||||||
@@ -369,7 +393,7 @@
|
|||||||
touch: true,
|
touch: true,
|
||||||
trigger: 'mouseenter focus',
|
trigger: 'mouseenter focus',
|
||||||
triggerTarget: null
|
triggerTarget: null
|
||||||
}, pluginProps, {}, renderProps);
|
}, pluginProps, renderProps);
|
||||||
var defaultKeys = Object.keys(defaultProps);
|
var defaultKeys = Object.keys(defaultProps);
|
||||||
var setDefaultProps = function setDefaultProps(partialProps) {
|
var setDefaultProps = function setDefaultProps(partialProps) {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
@@ -389,12 +413,14 @@
|
|||||||
defaultValue = plugin.defaultValue;
|
defaultValue = plugin.defaultValue;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
|
var _name;
|
||||||
|
|
||||||
|
acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
return Object.assign({}, passedProps, {}, pluginProps);
|
return Object.assign({}, passedProps, pluginProps);
|
||||||
}
|
}
|
||||||
function getDataAttributeProps(reference, plugins) {
|
function getDataAttributeProps(reference, plugins) {
|
||||||
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
||||||
@@ -425,7 +451,7 @@
|
|||||||
var out = Object.assign({}, props, {
|
var out = Object.assign({}, props, {
|
||||||
content: invokeWithArgsOrReturn(props.content, [reference])
|
content: invokeWithArgsOrReturn(props.content, [reference])
|
||||||
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
||||||
out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
|
out.aria = Object.assign({}, defaultProps.aria, out.aria);
|
||||||
out.aria = {
|
out.aria = {
|
||||||
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
||||||
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
||||||
@@ -586,7 +612,7 @@
|
|||||||
|
|
||||||
var mountedInstances = [];
|
var mountedInstances = [];
|
||||||
function createTippy(reference, passedProps) {
|
function createTippy(reference, passedProps) {
|
||||||
var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
||||||
// 🔒 Private members
|
// 🔒 Private members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -602,8 +628,7 @@
|
|||||||
var onFirstUpdate;
|
var onFirstUpdate;
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
||||||
var currentTarget;
|
var currentTarget; // ===========================================================================
|
||||||
var doc = getOwnerDocument(props.triggerTarget || reference); // ===========================================================================
|
|
||||||
// 🔑 Public members
|
// 🔑 Public members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -687,10 +712,9 @@
|
|||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popper.addEventListener('mouseleave', function (event) {
|
popper.addEventListener('mouseleave', function () {
|
||||||
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return instance; // ===========================================================================
|
return instance; // ===========================================================================
|
||||||
@@ -710,13 +734,18 @@
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
|
return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentTarget() {
|
function getCurrentTarget() {
|
||||||
return currentTarget || reference;
|
return currentTarget || reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDocument() {
|
||||||
|
var parent = getCurrentTarget().parentNode;
|
||||||
|
return parent ? getOwnerDocument(parent) : document;
|
||||||
|
}
|
||||||
|
|
||||||
function getDefaultTemplateChildren() {
|
function getDefaultTemplateChildren() {
|
||||||
return getChildren(popper);
|
return getChildren(popper);
|
||||||
}
|
}
|
||||||
@@ -732,8 +761,12 @@
|
|||||||
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleStyles() {
|
function handleStyles(fromHide) {
|
||||||
popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
|
if (fromHide === void 0) {
|
||||||
|
fromHide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
|
||||||
popper.style.zIndex = "" + instance.props.zIndex;
|
popper.style.zIndex = "" + instance.props.zIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -744,7 +777,7 @@
|
|||||||
|
|
||||||
pluginsHooks.forEach(function (pluginHooks) {
|
pluginsHooks.forEach(function (pluginHooks) {
|
||||||
if (pluginHooks[hook]) {
|
if (pluginHooks[hook]) {
|
||||||
pluginHooks[hook].apply(void 0, args);
|
pluginHooks[hook].apply(pluginHooks, args);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -798,7 +831,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanupInteractiveMouseListeners() {
|
function cleanupInteractiveMouseListeners() {
|
||||||
doc.removeEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
|
||||||
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
||||||
return listener !== debouncedOnMouseMove;
|
return listener !== debouncedOnMouseMove;
|
||||||
});
|
});
|
||||||
@@ -810,15 +843,18 @@
|
|||||||
if (didTouchMove || event.type === 'mousedown') {
|
if (didTouchMove || event.type === 'mousedown') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} // Clicked on interactive popper
|
}
|
||||||
|
|
||||||
|
var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
|
||||||
|
|
||||||
if (instance.props.interactive && popper.contains(event.target)) {
|
if (instance.props.interactive && actualContains(popper, actualTarget)) {
|
||||||
return;
|
return;
|
||||||
} // Clicked on the event listeners target
|
} // Clicked on the event listeners target
|
||||||
|
|
||||||
|
|
||||||
if (getCurrentTarget().contains(event.target)) {
|
if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
|
||||||
|
return actualContains(el, actualTarget);
|
||||||
|
})) {
|
||||||
if (currentInput.isTouch) {
|
if (currentInput.isTouch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -831,7 +867,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (instance.props.hideOnClick === true) {
|
if (instance.props.hideOnClick === true) {
|
||||||
isVisibleFromClick = false;
|
|
||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
||||||
// currentTarget. This lets a tippy with `focus` trigger know that it
|
// currentTarget. This lets a tippy with `focus` trigger know that it
|
||||||
@@ -859,6 +894,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addDocumentPress() {
|
function addDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.addEventListener('mousedown', onDocumentPress, true);
|
doc.addEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -866,6 +902,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeDocumentPress() {
|
function removeDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.removeEventListener('mousedown', onDocumentPress, true);
|
doc.removeEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -945,7 +982,7 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focus':
|
case 'focus':
|
||||||
on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
|
on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focusin':
|
case 'focusin':
|
||||||
@@ -1008,7 +1045,7 @@
|
|||||||
|
|
||||||
function onMouseMove(event) {
|
function onMouseMove(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
var isCursorOverReferenceOrPopper = reference.contains(target) || popper.contains(target);
|
var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
|
||||||
|
|
||||||
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
||||||
return;
|
return;
|
||||||
@@ -1171,7 +1208,7 @@
|
|||||||
|
|
||||||
var node = getCurrentTarget();
|
var node = getCurrentTarget();
|
||||||
|
|
||||||
if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
|
if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
|
||||||
parentNode = node.parentNode;
|
parentNode = node.parentNode;
|
||||||
} else {
|
} else {
|
||||||
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
||||||
@@ -1183,6 +1220,7 @@
|
|||||||
parentNode.appendChild(popper);
|
parentNode.appendChild(popper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance.state.isMounted = true;
|
||||||
createPopperInstance();
|
createPopperInstance();
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
|
|
||||||
@@ -1290,7 +1328,7 @@
|
|||||||
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
||||||
removeListeners();
|
removeListeners();
|
||||||
var prevProps = instance.props;
|
var prevProps = instance.props;
|
||||||
var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
|
var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
|
||||||
ignoreAttributes: true
|
ignoreAttributes: true
|
||||||
}));
|
}));
|
||||||
instance.props = nextProps;
|
instance.props = nextProps;
|
||||||
@@ -1393,6 +1431,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFirstUpdate = function onFirstUpdate() {
|
onFirstUpdate = function onFirstUpdate() {
|
||||||
|
var _instance$popperInsta2;
|
||||||
|
|
||||||
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1413,8 +1453,10 @@
|
|||||||
|
|
||||||
handleAriaContentAttribute();
|
handleAriaContentAttribute();
|
||||||
handleAriaExpandedAttribute();
|
handleAriaExpandedAttribute();
|
||||||
pushIfUnique(mountedInstances, instance);
|
pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
|
||||||
instance.state.isMounted = true;
|
// popper has been positioned for the first time
|
||||||
|
|
||||||
|
(_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
|
||||||
invokeHook('onMount', [instance]);
|
invokeHook('onMount', [instance]);
|
||||||
|
|
||||||
if (instance.props.animation && getIsDefaultRenderFn()) {
|
if (instance.props.animation && getIsDefaultRenderFn()) {
|
||||||
@@ -1453,6 +1495,7 @@
|
|||||||
instance.state.isVisible = false;
|
instance.state.isVisible = false;
|
||||||
instance.state.isShown = false;
|
instance.state.isShown = false;
|
||||||
ignoreOnFirstUpdate = false;
|
ignoreOnFirstUpdate = false;
|
||||||
|
isVisibleFromClick = false;
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
popper.style.visibility = 'hidden';
|
popper.style.visibility = 'hidden';
|
||||||
@@ -1460,7 +1503,7 @@
|
|||||||
|
|
||||||
cleanupInteractiveMouseListeners();
|
cleanupInteractiveMouseListeners();
|
||||||
removeDocumentPress();
|
removeDocumentPress();
|
||||||
handleStyles();
|
handleStyles(true);
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
||||||
@@ -1491,7 +1534,7 @@
|
|||||||
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
debouncedOnMouseMove(event);
|
||||||
}
|
}
|
||||||
@@ -1617,7 +1660,39 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// every time the popper is destroyed (i.e. a new target), removing the styles
|
||||||
|
// and causing transitions to break for singletons when the console is open, but
|
||||||
|
// most notably for non-transform styles being used, `gpuAcceleration: false`.
|
||||||
|
|
||||||
|
var applyStylesModifier = Object.assign({}, core.applyStyles, {
|
||||||
|
effect: function effect(_ref) {
|
||||||
|
var state = _ref.state;
|
||||||
|
var initialStyles = {
|
||||||
|
popper: {
|
||||||
|
position: state.options.strategy,
|
||||||
|
left: '0',
|
||||||
|
top: '0',
|
||||||
|
margin: '0'
|
||||||
|
},
|
||||||
|
arrow: {
|
||||||
|
position: 'absolute'
|
||||||
|
},
|
||||||
|
reference: {}
|
||||||
|
};
|
||||||
|
Object.assign(state.elements.popper.style, initialStyles.popper);
|
||||||
|
state.styles = initialStyles;
|
||||||
|
|
||||||
|
if (state.elements.arrow) {
|
||||||
|
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
||||||
|
} // intentionally return no cleanup function
|
||||||
|
// return () => { ... }
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
||||||
|
var _optionalProps$popper;
|
||||||
|
|
||||||
if (optionalProps === void 0) {
|
if (optionalProps === void 0) {
|
||||||
optionalProps = {};
|
optionalProps = {};
|
||||||
}
|
}
|
||||||
@@ -1627,19 +1702,30 @@
|
|||||||
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
var mutTippyInstances = tippyInstances;
|
var individualInstances = tippyInstances;
|
||||||
var references = [];
|
var references = [];
|
||||||
|
var triggerTargets = [];
|
||||||
var currentTarget;
|
var currentTarget;
|
||||||
var overrides = optionalProps.overrides;
|
var overrides = optionalProps.overrides;
|
||||||
|
var interceptSetPropsCleanups = [];
|
||||||
|
var shownOnCreate = false;
|
||||||
|
|
||||||
|
function setTriggerTargets() {
|
||||||
|
triggerTargets = individualInstances.map(function (instance) {
|
||||||
|
return normalizeToArray(instance.props.triggerTarget || instance.reference);
|
||||||
|
}).reduce(function (acc, item) {
|
||||||
|
return acc.concat(item);
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
function setReferences() {
|
function setReferences() {
|
||||||
references = mutTippyInstances.map(function (instance) {
|
references = individualInstances.map(function (instance) {
|
||||||
return instance.reference;
|
return instance.reference;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableInstances(isEnabled) {
|
function enableInstances(isEnabled) {
|
||||||
mutTippyInstances.forEach(function (instance) {
|
individualInstances.forEach(function (instance) {
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
instance.enable();
|
instance.enable();
|
||||||
} else {
|
} else {
|
||||||
@@ -1648,58 +1734,163 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function interceptSetProps(singleton) {
|
||||||
|
return individualInstances.map(function (instance) {
|
||||||
|
var originalSetProps = instance.setProps;
|
||||||
|
|
||||||
|
instance.setProps = function (props) {
|
||||||
|
originalSetProps(props);
|
||||||
|
|
||||||
|
if (instance.reference === currentTarget) {
|
||||||
|
singleton.setProps(props);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
instance.setProps = originalSetProps;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} // have to pass singleton, as it maybe undefined on first call
|
||||||
|
|
||||||
|
|
||||||
|
function prepareInstance(singleton, target) {
|
||||||
|
var index = triggerTargets.indexOf(target); // bail-out
|
||||||
|
|
||||||
|
if (target === currentTarget) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTarget = target;
|
||||||
|
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
||||||
|
acc[prop] = individualInstances[index].props[prop];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
singleton.setProps(Object.assign({}, overrideProps, {
|
||||||
|
getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
|
||||||
|
var _references$index;
|
||||||
|
|
||||||
|
return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
var singleton = {
|
setTriggerTargets();
|
||||||
|
var plugin = {
|
||||||
fn: function fn() {
|
fn: function fn() {
|
||||||
return {
|
return {
|
||||||
onDestroy: function onDestroy() {
|
onDestroy: function onDestroy() {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(instance, event) {
|
onHidden: function onHidden() {
|
||||||
var target = event.currentTarget;
|
currentTarget = null;
|
||||||
var index = references.indexOf(target); // bail-out
|
},
|
||||||
|
onClickOutside: function onClickOutside(instance) {
|
||||||
if (target === currentTarget) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
return;
|
shownOnCreate = true;
|
||||||
|
currentTarget = null;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
currentTarget = target;
|
onShow: function onShow(instance) {
|
||||||
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
acc[prop] = mutTippyInstances[index].props[prop];
|
shownOnCreate = true;
|
||||||
return acc;
|
prepareInstance(instance, references[0]);
|
||||||
}, {});
|
}
|
||||||
instance.setProps(Object.assign({}, overrideProps, {
|
},
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
onTrigger: function onTrigger(instance, event) {
|
||||||
return target.getBoundingClientRect();
|
prepareInstance(instance, event.currentTarget);
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var instance = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
||||||
plugins: [singleton].concat(optionalProps.plugins || []),
|
plugins: [plugin].concat(optionalProps.plugins || []),
|
||||||
triggerTarget: references
|
triggerTarget: triggerTargets,
|
||||||
|
popperOptions: Object.assign({}, optionalProps.popperOptions, {
|
||||||
|
modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
|
||||||
|
})
|
||||||
}));
|
}));
|
||||||
var originalSetProps = instance.setProps;
|
var originalShow = singleton.show;
|
||||||
|
|
||||||
instance.setProps = function (props) {
|
singleton.show = function (target) {
|
||||||
|
originalShow(); // first time, showOnCreate or programmatic call with no params
|
||||||
|
// default to showing first instance
|
||||||
|
|
||||||
|
if (!currentTarget && target == null) {
|
||||||
|
return prepareInstance(singleton, references[0]);
|
||||||
|
} // triggered from event (do nothing as prepareInstance already called by onTrigger)
|
||||||
|
// programmatic call with no params when already visible (do nothing again)
|
||||||
|
|
||||||
|
|
||||||
|
if (currentTarget && target == null) {
|
||||||
|
return;
|
||||||
|
} // target is index of instance
|
||||||
|
|
||||||
|
|
||||||
|
if (typeof target === 'number') {
|
||||||
|
return references[target] && prepareInstance(singleton, references[target]);
|
||||||
|
} // target is a child tippy instance
|
||||||
|
|
||||||
|
|
||||||
|
if (individualInstances.indexOf(target) >= 0) {
|
||||||
|
var ref = target.reference;
|
||||||
|
return prepareInstance(singleton, ref);
|
||||||
|
} // target is a ReferenceElement
|
||||||
|
|
||||||
|
|
||||||
|
if (references.indexOf(target) >= 0) {
|
||||||
|
return prepareInstance(singleton, target);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showNext = function () {
|
||||||
|
var first = references[0];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
singleton.show(references[index + 1] || first);
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showPrevious = function () {
|
||||||
|
var last = references[references.length - 1];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(last);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
var target = references[index - 1] || last;
|
||||||
|
singleton.show(target);
|
||||||
|
};
|
||||||
|
|
||||||
|
var originalSetProps = singleton.setProps;
|
||||||
|
|
||||||
|
singleton.setProps = function (props) {
|
||||||
overrides = props.overrides || overrides;
|
overrides = props.overrides || overrides;
|
||||||
originalSetProps(props);
|
originalSetProps(props);
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.setInstances = function (nextInstances) {
|
singleton.setInstances = function (nextInstances) {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
mutTippyInstances = nextInstances;
|
interceptSetPropsCleanups.forEach(function (fn) {
|
||||||
|
return fn();
|
||||||
|
});
|
||||||
|
individualInstances = nextInstances;
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
instance.setProps({
|
setTriggerTargets();
|
||||||
triggerTarget: references
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
singleton.setProps({
|
||||||
|
triggerTarget: triggerTargets
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return instance;
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
return singleton;
|
||||||
};
|
};
|
||||||
|
|
||||||
var BUBBLING_EVENTS_MAP = {
|
var BUBBLING_EVENTS_MAP = {
|
||||||
@@ -1720,20 +1911,23 @@
|
|||||||
|
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var childTippyInstances = [];
|
var childTippyInstances = [];
|
||||||
|
var disabled = false;
|
||||||
var target = props.target;
|
var target = props.target;
|
||||||
var nativeProps = removeProperties(props, ['target']);
|
var nativeProps = removeProperties(props, ['target']);
|
||||||
var parentProps = Object.assign({}, nativeProps, {
|
var parentProps = Object.assign({}, nativeProps, {
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
touch: false
|
touch: false
|
||||||
});
|
});
|
||||||
var childProps = Object.assign({}, nativeProps, {
|
var childProps = Object.assign({
|
||||||
|
touch: defaultProps.touch
|
||||||
|
}, nativeProps, {
|
||||||
showOnCreate: true
|
showOnCreate: true
|
||||||
});
|
});
|
||||||
var returnValue = tippy(targets, parentProps);
|
var returnValue = tippy(targets, parentProps);
|
||||||
var normalizedReturnValue = normalizeToArray(returnValue);
|
var normalizedReturnValue = normalizeToArray(returnValue);
|
||||||
|
|
||||||
function onTrigger(event) {
|
function onTrigger(event) {
|
||||||
if (!event.target) {
|
if (!event.target || disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1757,7 +1951,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type])) {
|
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type]) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1784,7 +1978,7 @@
|
|||||||
|
|
||||||
function addEventListeners(instance) {
|
function addEventListeners(instance) {
|
||||||
var reference = instance.reference;
|
var reference = instance.reference;
|
||||||
on(reference, 'touchstart', onTrigger);
|
on(reference, 'touchstart', onTrigger, TOUCH_OPTIONS);
|
||||||
on(reference, 'mouseover', onTrigger);
|
on(reference, 'mouseover', onTrigger);
|
||||||
on(reference, 'focusin', onTrigger);
|
on(reference, 'focusin', onTrigger);
|
||||||
on(reference, 'click', onTrigger);
|
on(reference, 'click', onTrigger);
|
||||||
@@ -1803,6 +1997,8 @@
|
|||||||
|
|
||||||
function applyMutations(instance) {
|
function applyMutations(instance) {
|
||||||
var originalDestroy = instance.destroy;
|
var originalDestroy = instance.destroy;
|
||||||
|
var originalEnable = instance.enable;
|
||||||
|
var originalDisable = instance.disable;
|
||||||
|
|
||||||
instance.destroy = function (shouldDestroyChildInstances) {
|
instance.destroy = function (shouldDestroyChildInstances) {
|
||||||
if (shouldDestroyChildInstances === void 0) {
|
if (shouldDestroyChildInstances === void 0) {
|
||||||
@@ -1820,6 +2016,22 @@
|
|||||||
originalDestroy();
|
originalDestroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
instance.enable = function () {
|
||||||
|
originalEnable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.enable();
|
||||||
|
});
|
||||||
|
disabled = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
instance.disable = function () {
|
||||||
|
originalDisable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.disable();
|
||||||
|
});
|
||||||
|
disabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
addEventListeners(instance);
|
addEventListeners(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1834,7 +2046,7 @@
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
|
if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
|
||||||
{
|
{
|
||||||
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
||||||
}
|
}
|
||||||
@@ -1959,6 +2171,7 @@
|
|||||||
|
|
||||||
if (isCursorOverReference || !instance.props.interactive) {
|
if (isCursorOverReference || !instance.props.interactive) {
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
var rect = reference.getBoundingClientRect();
|
var rect = reference.getBoundingClientRect();
|
||||||
var x = clientX;
|
var x = clientX;
|
||||||
@@ -2037,20 +2250,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMount: function onMount() {
|
onMount: function onMount() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor && !wasFocusEvent) {
|
||||||
if (isUnmounted) {
|
if (isUnmounted) {
|
||||||
onMouseMove(mouseCoords);
|
onMouseMove(mouseCoords);
|
||||||
isUnmounted = false;
|
isUnmounted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasFocusEvent && !getIsInitialBehavior()) {
|
if (!getIsInitialBehavior()) {
|
||||||
addListener();
|
addListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(_, _ref3) {
|
onTrigger: function onTrigger(_, event) {
|
||||||
var type = _ref3.type;
|
if (isMouseEvent(event)) {
|
||||||
wasFocusEvent = type === 'focus';
|
mouseCoords = {
|
||||||
|
clientX: event.clientX,
|
||||||
|
clientY: event.clientY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
wasFocusEvent = event.type === 'focus';
|
||||||
},
|
},
|
||||||
onHidden: function onHidden() {
|
onHidden: function onHidden() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor) {
|
||||||
@@ -2089,6 +2308,7 @@
|
|||||||
var placement;
|
var placement;
|
||||||
var cursorRectIndex = -1;
|
var cursorRectIndex = -1;
|
||||||
var isInternalUpdate = false;
|
var isInternalUpdate = false;
|
||||||
|
var triedPlacements = [];
|
||||||
var modifier = {
|
var modifier = {
|
||||||
name: 'tippyInlinePositioning',
|
name: 'tippyInlinePositioning',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -2097,8 +2317,14 @@
|
|||||||
var state = _ref2.state;
|
var state = _ref2.state;
|
||||||
|
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
if (placement !== state.placement) {
|
if (triedPlacements.indexOf(state.placement) !== -1) {
|
||||||
|
triedPlacements = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
|
||||||
|
triedPlacements.push(state.placement);
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
return _getReferenceClientRect(state.placement);
|
return _getReferenceClientRect(state.placement);
|
||||||
}
|
}
|
||||||
@@ -2135,10 +2361,11 @@
|
|||||||
var cursorRect = rects.find(function (rect) {
|
var cursorRect = rects.find(function (rect) {
|
||||||
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
||||||
});
|
});
|
||||||
cursorRectIndex = rects.indexOf(cursorRect);
|
var index = rects.indexOf(cursorRect);
|
||||||
|
cursorRectIndex = index > -1 ? index : cursorRectIndex;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUntrigger: function onUntrigger() {
|
onHidden: function onHidden() {
|
||||||
cursorRectIndex = -1;
|
cursorRectIndex = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
2
node_modules/tippy.js/dist/tippy-bundle.umd.js.map
generated
vendored
2
node_modules/tippy.js/dist/tippy-bundle.umd.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/tippy.js/dist/tippy-bundle.umd.min.js
generated
vendored
2
node_modules/tippy.js/dist/tippy-bundle.umd.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/tippy.js/dist/tippy-bundle.umd.min.js.map
generated
vendored
2
node_modules/tippy.js/dist/tippy-bundle.umd.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
389
node_modules/tippy.js/dist/tippy.cjs.js
generated
vendored
389
node_modules/tippy.js/dist/tippy.cjs.js
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
/**!
|
/**!
|
||||||
* tippy.js v6.2.5
|
* tippy.js v6.3.7
|
||||||
* (c) 2017-2020 atomiks
|
* (c) 2017-2021 atomiks
|
||||||
* MIT License
|
* MIT License
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -19,6 +19,9 @@ var TOUCH_OPTIONS = {
|
|||||||
passive: true,
|
passive: true,
|
||||||
capture: true
|
capture: true
|
||||||
};
|
};
|
||||||
|
var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
|
||||||
|
return document.body;
|
||||||
|
};
|
||||||
|
|
||||||
function hasOwnProperty(obj, key) {
|
function hasOwnProperty(obj, key) {
|
||||||
return {}.hasOwnProperty.call(obj, key);
|
return {}.hasOwnProperty.call(obj, key);
|
||||||
@@ -138,10 +141,13 @@ function setVisibilityState(els, state) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getOwnerDocument(elementOrElements) {
|
function getOwnerDocument(elementOrElements) {
|
||||||
var _normalizeToArray = normalizeToArray(elementOrElements),
|
var _element$ownerDocumen;
|
||||||
element = _normalizeToArray[0];
|
|
||||||
|
|
||||||
return element ? element.ownerDocument || document : document;
|
var _normalizeToArray = normalizeToArray(elementOrElements),
|
||||||
|
element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
|
||||||
|
|
||||||
|
|
||||||
|
return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
|
||||||
}
|
}
|
||||||
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
||||||
var clientX = event.clientX,
|
var clientX = event.clientX,
|
||||||
@@ -177,6 +183,26 @@ function updateTransitionEndListener(box, action, listener) {
|
|||||||
box[method](event, listener);
|
box[method](event, listener);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Compared to xxx.contains, this function works for dom structures with shadow
|
||||||
|
* dom
|
||||||
|
*/
|
||||||
|
|
||||||
|
function actualContains(parent, child) {
|
||||||
|
var target = child;
|
||||||
|
|
||||||
|
while (target) {
|
||||||
|
var _target$getRootNode;
|
||||||
|
|
||||||
|
if (parent.contains(target)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var currentInput = {
|
var currentInput = {
|
||||||
isTouch: false
|
isTouch: false
|
||||||
@@ -240,8 +266,8 @@ function bindGlobalEventListeners() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||||
var ua = isBrowser ? navigator.userAgent : '';
|
var isIE11 = isBrowser ? // @ts-ignore
|
||||||
var isIE = /MSIE |Trident\//.test(ua);
|
!!window.msCrypto : false;
|
||||||
|
|
||||||
function createMemoryLeakWarning(method) {
|
function createMemoryLeakWarning(method) {
|
||||||
var txt = method === 'destroy' ? 'n already-' : ' ';
|
var txt = method === 'destroy' ? 'n already-' : ' ';
|
||||||
@@ -316,9 +342,7 @@ var renderProps = {
|
|||||||
zIndex: 9999
|
zIndex: 9999
|
||||||
};
|
};
|
||||||
var defaultProps = Object.assign({
|
var defaultProps = Object.assign({
|
||||||
appendTo: function appendTo() {
|
appendTo: TIPPY_DEFAULT_APPEND_TO,
|
||||||
return document.body;
|
|
||||||
},
|
|
||||||
aria: {
|
aria: {
|
||||||
content: 'auto',
|
content: 'auto',
|
||||||
expanded: 'auto'
|
expanded: 'auto'
|
||||||
@@ -353,7 +377,7 @@ var defaultProps = Object.assign({
|
|||||||
touch: true,
|
touch: true,
|
||||||
trigger: 'mouseenter focus',
|
trigger: 'mouseenter focus',
|
||||||
triggerTarget: null
|
triggerTarget: null
|
||||||
}, pluginProps, {}, renderProps);
|
}, pluginProps, renderProps);
|
||||||
var defaultKeys = Object.keys(defaultProps);
|
var defaultKeys = Object.keys(defaultProps);
|
||||||
var setDefaultProps = function setDefaultProps(partialProps) {
|
var setDefaultProps = function setDefaultProps(partialProps) {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
@@ -373,12 +397,14 @@ function getExtendedPassedProps(passedProps) {
|
|||||||
defaultValue = plugin.defaultValue;
|
defaultValue = plugin.defaultValue;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
|
var _name;
|
||||||
|
|
||||||
|
acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
return Object.assign({}, passedProps, {}, pluginProps);
|
return Object.assign({}, passedProps, pluginProps);
|
||||||
}
|
}
|
||||||
function getDataAttributeProps(reference, plugins) {
|
function getDataAttributeProps(reference, plugins) {
|
||||||
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
||||||
@@ -409,7 +435,7 @@ function evaluateProps(reference, props) {
|
|||||||
var out = Object.assign({}, props, {
|
var out = Object.assign({}, props, {
|
||||||
content: invokeWithArgsOrReturn(props.content, [reference])
|
content: invokeWithArgsOrReturn(props.content, [reference])
|
||||||
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
||||||
out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
|
out.aria = Object.assign({}, defaultProps.aria, out.aria);
|
||||||
out.aria = {
|
out.aria = {
|
||||||
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
||||||
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
||||||
@@ -570,7 +596,7 @@ var mouseMoveListeners = []; // Used by `hideAll()`
|
|||||||
|
|
||||||
var mountedInstances = [];
|
var mountedInstances = [];
|
||||||
function createTippy(reference, passedProps) {
|
function createTippy(reference, passedProps) {
|
||||||
var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
||||||
// 🔒 Private members
|
// 🔒 Private members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -586,8 +612,7 @@ function createTippy(reference, passedProps) {
|
|||||||
var onFirstUpdate;
|
var onFirstUpdate;
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
||||||
var currentTarget;
|
var currentTarget; // ===========================================================================
|
||||||
var doc = getOwnerDocument(props.triggerTarget || reference); // ===========================================================================
|
|
||||||
// 🔑 Public members
|
// 🔑 Public members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -671,10 +696,9 @@ function createTippy(reference, passedProps) {
|
|||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popper.addEventListener('mouseleave', function (event) {
|
popper.addEventListener('mouseleave', function () {
|
||||||
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return instance; // ===========================================================================
|
return instance; // ===========================================================================
|
||||||
@@ -694,13 +718,18 @@ function createTippy(reference, passedProps) {
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
|
return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentTarget() {
|
function getCurrentTarget() {
|
||||||
return currentTarget || reference;
|
return currentTarget || reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDocument() {
|
||||||
|
var parent = getCurrentTarget().parentNode;
|
||||||
|
return parent ? getOwnerDocument(parent) : document;
|
||||||
|
}
|
||||||
|
|
||||||
function getDefaultTemplateChildren() {
|
function getDefaultTemplateChildren() {
|
||||||
return getChildren(popper);
|
return getChildren(popper);
|
||||||
}
|
}
|
||||||
@@ -716,8 +745,12 @@ function createTippy(reference, passedProps) {
|
|||||||
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleStyles() {
|
function handleStyles(fromHide) {
|
||||||
popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
|
if (fromHide === void 0) {
|
||||||
|
fromHide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
|
||||||
popper.style.zIndex = "" + instance.props.zIndex;
|
popper.style.zIndex = "" + instance.props.zIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -728,7 +761,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
pluginsHooks.forEach(function (pluginHooks) {
|
pluginsHooks.forEach(function (pluginHooks) {
|
||||||
if (pluginHooks[hook]) {
|
if (pluginHooks[hook]) {
|
||||||
pluginHooks[hook].apply(void 0, args);
|
pluginHooks[hook].apply(pluginHooks, args);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -782,7 +815,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanupInteractiveMouseListeners() {
|
function cleanupInteractiveMouseListeners() {
|
||||||
doc.removeEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
|
||||||
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
||||||
return listener !== debouncedOnMouseMove;
|
return listener !== debouncedOnMouseMove;
|
||||||
});
|
});
|
||||||
@@ -794,15 +827,18 @@ function createTippy(reference, passedProps) {
|
|||||||
if (didTouchMove || event.type === 'mousedown') {
|
if (didTouchMove || event.type === 'mousedown') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} // Clicked on interactive popper
|
}
|
||||||
|
|
||||||
|
var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
|
||||||
|
|
||||||
if (instance.props.interactive && popper.contains(event.target)) {
|
if (instance.props.interactive && actualContains(popper, actualTarget)) {
|
||||||
return;
|
return;
|
||||||
} // Clicked on the event listeners target
|
} // Clicked on the event listeners target
|
||||||
|
|
||||||
|
|
||||||
if (getCurrentTarget().contains(event.target)) {
|
if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
|
||||||
|
return actualContains(el, actualTarget);
|
||||||
|
})) {
|
||||||
if (currentInput.isTouch) {
|
if (currentInput.isTouch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -815,7 +851,6 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (instance.props.hideOnClick === true) {
|
if (instance.props.hideOnClick === true) {
|
||||||
isVisibleFromClick = false;
|
|
||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
||||||
// currentTarget. This lets a tippy with `focus` trigger know that it
|
// currentTarget. This lets a tippy with `focus` trigger know that it
|
||||||
@@ -843,6 +878,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addDocumentPress() {
|
function addDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.addEventListener('mousedown', onDocumentPress, true);
|
doc.addEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -850,6 +886,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeDocumentPress() {
|
function removeDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.removeEventListener('mousedown', onDocumentPress, true);
|
doc.removeEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -929,7 +966,7 @@ function createTippy(reference, passedProps) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focus':
|
case 'focus':
|
||||||
on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
|
on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focusin':
|
case 'focusin':
|
||||||
@@ -992,7 +1029,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
function onMouseMove(event) {
|
function onMouseMove(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
var isCursorOverReferenceOrPopper = reference.contains(target) || popper.contains(target);
|
var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
|
||||||
|
|
||||||
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
||||||
return;
|
return;
|
||||||
@@ -1155,7 +1192,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
var node = getCurrentTarget();
|
var node = getCurrentTarget();
|
||||||
|
|
||||||
if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
|
if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
|
||||||
parentNode = node.parentNode;
|
parentNode = node.parentNode;
|
||||||
} else {
|
} else {
|
||||||
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
||||||
@@ -1167,6 +1204,7 @@ function createTippy(reference, passedProps) {
|
|||||||
parentNode.appendChild(popper);
|
parentNode.appendChild(popper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance.state.isMounted = true;
|
||||||
createPopperInstance();
|
createPopperInstance();
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
|
|
||||||
@@ -1274,7 +1312,7 @@ function createTippy(reference, passedProps) {
|
|||||||
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
||||||
removeListeners();
|
removeListeners();
|
||||||
var prevProps = instance.props;
|
var prevProps = instance.props;
|
||||||
var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
|
var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
|
||||||
ignoreAttributes: true
|
ignoreAttributes: true
|
||||||
}));
|
}));
|
||||||
instance.props = nextProps;
|
instance.props = nextProps;
|
||||||
@@ -1377,6 +1415,8 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFirstUpdate = function onFirstUpdate() {
|
onFirstUpdate = function onFirstUpdate() {
|
||||||
|
var _instance$popperInsta2;
|
||||||
|
|
||||||
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1397,8 +1437,10 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
handleAriaContentAttribute();
|
handleAriaContentAttribute();
|
||||||
handleAriaExpandedAttribute();
|
handleAriaExpandedAttribute();
|
||||||
pushIfUnique(mountedInstances, instance);
|
pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
|
||||||
instance.state.isMounted = true;
|
// popper has been positioned for the first time
|
||||||
|
|
||||||
|
(_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
|
||||||
invokeHook('onMount', [instance]);
|
invokeHook('onMount', [instance]);
|
||||||
|
|
||||||
if (instance.props.animation && getIsDefaultRenderFn()) {
|
if (instance.props.animation && getIsDefaultRenderFn()) {
|
||||||
@@ -1437,6 +1479,7 @@ function createTippy(reference, passedProps) {
|
|||||||
instance.state.isVisible = false;
|
instance.state.isVisible = false;
|
||||||
instance.state.isShown = false;
|
instance.state.isShown = false;
|
||||||
ignoreOnFirstUpdate = false;
|
ignoreOnFirstUpdate = false;
|
||||||
|
isVisibleFromClick = false;
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
popper.style.visibility = 'hidden';
|
popper.style.visibility = 'hidden';
|
||||||
@@ -1444,7 +1487,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
cleanupInteractiveMouseListeners();
|
cleanupInteractiveMouseListeners();
|
||||||
removeDocumentPress();
|
removeDocumentPress();
|
||||||
handleStyles();
|
handleStyles(true);
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
||||||
@@ -1475,7 +1518,7 @@ function createTippy(reference, passedProps) {
|
|||||||
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
debouncedOnMouseMove(event);
|
||||||
}
|
}
|
||||||
@@ -1601,7 +1644,39 @@ var hideAll = function hideAll(_temp) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// every time the popper is destroyed (i.e. a new target), removing the styles
|
||||||
|
// and causing transitions to break for singletons when the console is open, but
|
||||||
|
// most notably for non-transform styles being used, `gpuAcceleration: false`.
|
||||||
|
|
||||||
|
var applyStylesModifier = Object.assign({}, core.applyStyles, {
|
||||||
|
effect: function effect(_ref) {
|
||||||
|
var state = _ref.state;
|
||||||
|
var initialStyles = {
|
||||||
|
popper: {
|
||||||
|
position: state.options.strategy,
|
||||||
|
left: '0',
|
||||||
|
top: '0',
|
||||||
|
margin: '0'
|
||||||
|
},
|
||||||
|
arrow: {
|
||||||
|
position: 'absolute'
|
||||||
|
},
|
||||||
|
reference: {}
|
||||||
|
};
|
||||||
|
Object.assign(state.elements.popper.style, initialStyles.popper);
|
||||||
|
state.styles = initialStyles;
|
||||||
|
|
||||||
|
if (state.elements.arrow) {
|
||||||
|
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
||||||
|
} // intentionally return no cleanup function
|
||||||
|
// return () => { ... }
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
||||||
|
var _optionalProps$popper;
|
||||||
|
|
||||||
if (optionalProps === void 0) {
|
if (optionalProps === void 0) {
|
||||||
optionalProps = {};
|
optionalProps = {};
|
||||||
}
|
}
|
||||||
@@ -1611,19 +1686,30 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|||||||
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
var mutTippyInstances = tippyInstances;
|
var individualInstances = tippyInstances;
|
||||||
var references = [];
|
var references = [];
|
||||||
|
var triggerTargets = [];
|
||||||
var currentTarget;
|
var currentTarget;
|
||||||
var overrides = optionalProps.overrides;
|
var overrides = optionalProps.overrides;
|
||||||
|
var interceptSetPropsCleanups = [];
|
||||||
|
var shownOnCreate = false;
|
||||||
|
|
||||||
|
function setTriggerTargets() {
|
||||||
|
triggerTargets = individualInstances.map(function (instance) {
|
||||||
|
return normalizeToArray(instance.props.triggerTarget || instance.reference);
|
||||||
|
}).reduce(function (acc, item) {
|
||||||
|
return acc.concat(item);
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
function setReferences() {
|
function setReferences() {
|
||||||
references = mutTippyInstances.map(function (instance) {
|
references = individualInstances.map(function (instance) {
|
||||||
return instance.reference;
|
return instance.reference;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableInstances(isEnabled) {
|
function enableInstances(isEnabled) {
|
||||||
mutTippyInstances.forEach(function (instance) {
|
individualInstances.forEach(function (instance) {
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
instance.enable();
|
instance.enable();
|
||||||
} else {
|
} else {
|
||||||
@@ -1632,58 +1718,163 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function interceptSetProps(singleton) {
|
||||||
|
return individualInstances.map(function (instance) {
|
||||||
|
var originalSetProps = instance.setProps;
|
||||||
|
|
||||||
|
instance.setProps = function (props) {
|
||||||
|
originalSetProps(props);
|
||||||
|
|
||||||
|
if (instance.reference === currentTarget) {
|
||||||
|
singleton.setProps(props);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
instance.setProps = originalSetProps;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} // have to pass singleton, as it maybe undefined on first call
|
||||||
|
|
||||||
|
|
||||||
|
function prepareInstance(singleton, target) {
|
||||||
|
var index = triggerTargets.indexOf(target); // bail-out
|
||||||
|
|
||||||
|
if (target === currentTarget) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTarget = target;
|
||||||
|
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
||||||
|
acc[prop] = individualInstances[index].props[prop];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
singleton.setProps(Object.assign({}, overrideProps, {
|
||||||
|
getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
|
||||||
|
var _references$index;
|
||||||
|
|
||||||
|
return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
var singleton = {
|
setTriggerTargets();
|
||||||
|
var plugin = {
|
||||||
fn: function fn() {
|
fn: function fn() {
|
||||||
return {
|
return {
|
||||||
onDestroy: function onDestroy() {
|
onDestroy: function onDestroy() {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(instance, event) {
|
onHidden: function onHidden() {
|
||||||
var target = event.currentTarget;
|
currentTarget = null;
|
||||||
var index = references.indexOf(target); // bail-out
|
},
|
||||||
|
onClickOutside: function onClickOutside(instance) {
|
||||||
if (target === currentTarget) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
return;
|
shownOnCreate = true;
|
||||||
|
currentTarget = null;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
currentTarget = target;
|
onShow: function onShow(instance) {
|
||||||
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
acc[prop] = mutTippyInstances[index].props[prop];
|
shownOnCreate = true;
|
||||||
return acc;
|
prepareInstance(instance, references[0]);
|
||||||
}, {});
|
}
|
||||||
instance.setProps(Object.assign({}, overrideProps, {
|
},
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
onTrigger: function onTrigger(instance, event) {
|
||||||
return target.getBoundingClientRect();
|
prepareInstance(instance, event.currentTarget);
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var instance = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
||||||
plugins: [singleton].concat(optionalProps.plugins || []),
|
plugins: [plugin].concat(optionalProps.plugins || []),
|
||||||
triggerTarget: references
|
triggerTarget: triggerTargets,
|
||||||
|
popperOptions: Object.assign({}, optionalProps.popperOptions, {
|
||||||
|
modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
|
||||||
|
})
|
||||||
}));
|
}));
|
||||||
var originalSetProps = instance.setProps;
|
var originalShow = singleton.show;
|
||||||
|
|
||||||
instance.setProps = function (props) {
|
singleton.show = function (target) {
|
||||||
|
originalShow(); // first time, showOnCreate or programmatic call with no params
|
||||||
|
// default to showing first instance
|
||||||
|
|
||||||
|
if (!currentTarget && target == null) {
|
||||||
|
return prepareInstance(singleton, references[0]);
|
||||||
|
} // triggered from event (do nothing as prepareInstance already called by onTrigger)
|
||||||
|
// programmatic call with no params when already visible (do nothing again)
|
||||||
|
|
||||||
|
|
||||||
|
if (currentTarget && target == null) {
|
||||||
|
return;
|
||||||
|
} // target is index of instance
|
||||||
|
|
||||||
|
|
||||||
|
if (typeof target === 'number') {
|
||||||
|
return references[target] && prepareInstance(singleton, references[target]);
|
||||||
|
} // target is a child tippy instance
|
||||||
|
|
||||||
|
|
||||||
|
if (individualInstances.indexOf(target) >= 0) {
|
||||||
|
var ref = target.reference;
|
||||||
|
return prepareInstance(singleton, ref);
|
||||||
|
} // target is a ReferenceElement
|
||||||
|
|
||||||
|
|
||||||
|
if (references.indexOf(target) >= 0) {
|
||||||
|
return prepareInstance(singleton, target);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showNext = function () {
|
||||||
|
var first = references[0];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
singleton.show(references[index + 1] || first);
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showPrevious = function () {
|
||||||
|
var last = references[references.length - 1];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(last);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
var target = references[index - 1] || last;
|
||||||
|
singleton.show(target);
|
||||||
|
};
|
||||||
|
|
||||||
|
var originalSetProps = singleton.setProps;
|
||||||
|
|
||||||
|
singleton.setProps = function (props) {
|
||||||
overrides = props.overrides || overrides;
|
overrides = props.overrides || overrides;
|
||||||
originalSetProps(props);
|
originalSetProps(props);
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.setInstances = function (nextInstances) {
|
singleton.setInstances = function (nextInstances) {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
mutTippyInstances = nextInstances;
|
interceptSetPropsCleanups.forEach(function (fn) {
|
||||||
|
return fn();
|
||||||
|
});
|
||||||
|
individualInstances = nextInstances;
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
instance.setProps({
|
setTriggerTargets();
|
||||||
triggerTarget: references
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
singleton.setProps({
|
||||||
|
triggerTarget: triggerTargets
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return instance;
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
return singleton;
|
||||||
};
|
};
|
||||||
|
|
||||||
var BUBBLING_EVENTS_MAP = {
|
var BUBBLING_EVENTS_MAP = {
|
||||||
@@ -1704,20 +1895,23 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var childTippyInstances = [];
|
var childTippyInstances = [];
|
||||||
|
var disabled = false;
|
||||||
var target = props.target;
|
var target = props.target;
|
||||||
var nativeProps = removeProperties(props, ['target']);
|
var nativeProps = removeProperties(props, ['target']);
|
||||||
var parentProps = Object.assign({}, nativeProps, {
|
var parentProps = Object.assign({}, nativeProps, {
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
touch: false
|
touch: false
|
||||||
});
|
});
|
||||||
var childProps = Object.assign({}, nativeProps, {
|
var childProps = Object.assign({
|
||||||
|
touch: defaultProps.touch
|
||||||
|
}, nativeProps, {
|
||||||
showOnCreate: true
|
showOnCreate: true
|
||||||
});
|
});
|
||||||
var returnValue = tippy(targets, parentProps);
|
var returnValue = tippy(targets, parentProps);
|
||||||
var normalizedReturnValue = normalizeToArray(returnValue);
|
var normalizedReturnValue = normalizeToArray(returnValue);
|
||||||
|
|
||||||
function onTrigger(event) {
|
function onTrigger(event) {
|
||||||
if (!event.target) {
|
if (!event.target || disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1741,7 +1935,7 @@ function delegate(targets, props) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type])) {
|
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type]) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1768,7 +1962,7 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
function addEventListeners(instance) {
|
function addEventListeners(instance) {
|
||||||
var reference = instance.reference;
|
var reference = instance.reference;
|
||||||
on(reference, 'touchstart', onTrigger);
|
on(reference, 'touchstart', onTrigger, TOUCH_OPTIONS);
|
||||||
on(reference, 'mouseover', onTrigger);
|
on(reference, 'mouseover', onTrigger);
|
||||||
on(reference, 'focusin', onTrigger);
|
on(reference, 'focusin', onTrigger);
|
||||||
on(reference, 'click', onTrigger);
|
on(reference, 'click', onTrigger);
|
||||||
@@ -1787,6 +1981,8 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
function applyMutations(instance) {
|
function applyMutations(instance) {
|
||||||
var originalDestroy = instance.destroy;
|
var originalDestroy = instance.destroy;
|
||||||
|
var originalEnable = instance.enable;
|
||||||
|
var originalDisable = instance.disable;
|
||||||
|
|
||||||
instance.destroy = function (shouldDestroyChildInstances) {
|
instance.destroy = function (shouldDestroyChildInstances) {
|
||||||
if (shouldDestroyChildInstances === void 0) {
|
if (shouldDestroyChildInstances === void 0) {
|
||||||
@@ -1804,6 +2000,22 @@ function delegate(targets, props) {
|
|||||||
originalDestroy();
|
originalDestroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
instance.enable = function () {
|
||||||
|
originalEnable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.enable();
|
||||||
|
});
|
||||||
|
disabled = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
instance.disable = function () {
|
||||||
|
originalDisable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.disable();
|
||||||
|
});
|
||||||
|
disabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
addEventListeners(instance);
|
addEventListeners(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1818,7 +2030,7 @@ var animateFill = {
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
|
if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== "production") {
|
||||||
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
||||||
}
|
}
|
||||||
@@ -1943,6 +2155,7 @@ var followCursor = {
|
|||||||
|
|
||||||
if (isCursorOverReference || !instance.props.interactive) {
|
if (isCursorOverReference || !instance.props.interactive) {
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
var rect = reference.getBoundingClientRect();
|
var rect = reference.getBoundingClientRect();
|
||||||
var x = clientX;
|
var x = clientX;
|
||||||
@@ -2021,20 +2234,26 @@ var followCursor = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMount: function onMount() {
|
onMount: function onMount() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor && !wasFocusEvent) {
|
||||||
if (isUnmounted) {
|
if (isUnmounted) {
|
||||||
onMouseMove(mouseCoords);
|
onMouseMove(mouseCoords);
|
||||||
isUnmounted = false;
|
isUnmounted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasFocusEvent && !getIsInitialBehavior()) {
|
if (!getIsInitialBehavior()) {
|
||||||
addListener();
|
addListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(_, _ref3) {
|
onTrigger: function onTrigger(_, event) {
|
||||||
var type = _ref3.type;
|
if (isMouseEvent(event)) {
|
||||||
wasFocusEvent = type === 'focus';
|
mouseCoords = {
|
||||||
|
clientX: event.clientX,
|
||||||
|
clientY: event.clientY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
wasFocusEvent = event.type === 'focus';
|
||||||
},
|
},
|
||||||
onHidden: function onHidden() {
|
onHidden: function onHidden() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor) {
|
||||||
@@ -2073,6 +2292,7 @@ var inlinePositioning = {
|
|||||||
var placement;
|
var placement;
|
||||||
var cursorRectIndex = -1;
|
var cursorRectIndex = -1;
|
||||||
var isInternalUpdate = false;
|
var isInternalUpdate = false;
|
||||||
|
var triedPlacements = [];
|
||||||
var modifier = {
|
var modifier = {
|
||||||
name: 'tippyInlinePositioning',
|
name: 'tippyInlinePositioning',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -2081,8 +2301,14 @@ var inlinePositioning = {
|
|||||||
var state = _ref2.state;
|
var state = _ref2.state;
|
||||||
|
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
if (placement !== state.placement) {
|
if (triedPlacements.indexOf(state.placement) !== -1) {
|
||||||
|
triedPlacements = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
|
||||||
|
triedPlacements.push(state.placement);
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
return _getReferenceClientRect(state.placement);
|
return _getReferenceClientRect(state.placement);
|
||||||
}
|
}
|
||||||
@@ -2119,10 +2345,11 @@ var inlinePositioning = {
|
|||||||
var cursorRect = rects.find(function (rect) {
|
var cursorRect = rects.find(function (rect) {
|
||||||
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
||||||
});
|
});
|
||||||
cursorRectIndex = rects.indexOf(cursorRect);
|
var index = rects.indexOf(cursorRect);
|
||||||
|
cursorRectIndex = index > -1 ? index : cursorRectIndex;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUntrigger: function onUntrigger() {
|
onHidden: function onHidden() {
|
||||||
cursorRectIndex = -1;
|
cursorRectIndex = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
2
node_modules/tippy.js/dist/tippy.cjs.js.map
generated
vendored
2
node_modules/tippy.js/dist/tippy.cjs.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/tippy.js/dist/tippy.css
generated
vendored
2
node_modules/tippy.js/dist/tippy.css
generated
vendored
@@ -1 +1 @@
|
|||||||
.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}
|
.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}
|
||||||
391
node_modules/tippy.js/dist/tippy.esm.js
generated
vendored
391
node_modules/tippy.js/dist/tippy.esm.js
generated
vendored
@@ -1,9 +1,9 @@
|
|||||||
/**!
|
/**!
|
||||||
* tippy.js v6.2.5
|
* tippy.js v6.3.7
|
||||||
* (c) 2017-2020 atomiks
|
* (c) 2017-2021 atomiks
|
||||||
* MIT License
|
* MIT License
|
||||||
*/
|
*/
|
||||||
import { createPopper } from '@popperjs/core';
|
import { createPopper, applyStyles } from '@popperjs/core';
|
||||||
|
|
||||||
var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>';
|
var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>';
|
||||||
var BOX_CLASS = "tippy-box";
|
var BOX_CLASS = "tippy-box";
|
||||||
@@ -15,6 +15,9 @@ var TOUCH_OPTIONS = {
|
|||||||
passive: true,
|
passive: true,
|
||||||
capture: true
|
capture: true
|
||||||
};
|
};
|
||||||
|
var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
|
||||||
|
return document.body;
|
||||||
|
};
|
||||||
|
|
||||||
function hasOwnProperty(obj, key) {
|
function hasOwnProperty(obj, key) {
|
||||||
return {}.hasOwnProperty.call(obj, key);
|
return {}.hasOwnProperty.call(obj, key);
|
||||||
@@ -134,10 +137,13 @@ function setVisibilityState(els, state) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getOwnerDocument(elementOrElements) {
|
function getOwnerDocument(elementOrElements) {
|
||||||
var _normalizeToArray = normalizeToArray(elementOrElements),
|
var _element$ownerDocumen;
|
||||||
element = _normalizeToArray[0];
|
|
||||||
|
|
||||||
return element ? element.ownerDocument || document : document;
|
var _normalizeToArray = normalizeToArray(elementOrElements),
|
||||||
|
element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
|
||||||
|
|
||||||
|
|
||||||
|
return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
|
||||||
}
|
}
|
||||||
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
||||||
var clientX = event.clientX,
|
var clientX = event.clientX,
|
||||||
@@ -173,6 +179,26 @@ function updateTransitionEndListener(box, action, listener) {
|
|||||||
box[method](event, listener);
|
box[method](event, listener);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Compared to xxx.contains, this function works for dom structures with shadow
|
||||||
|
* dom
|
||||||
|
*/
|
||||||
|
|
||||||
|
function actualContains(parent, child) {
|
||||||
|
var target = child;
|
||||||
|
|
||||||
|
while (target) {
|
||||||
|
var _target$getRootNode;
|
||||||
|
|
||||||
|
if (parent.contains(target)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var currentInput = {
|
var currentInput = {
|
||||||
isTouch: false
|
isTouch: false
|
||||||
@@ -236,8 +262,8 @@ function bindGlobalEventListeners() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||||
var ua = isBrowser ? navigator.userAgent : '';
|
var isIE11 = isBrowser ? // @ts-ignore
|
||||||
var isIE = /MSIE |Trident\//.test(ua);
|
!!window.msCrypto : false;
|
||||||
|
|
||||||
function createMemoryLeakWarning(method) {
|
function createMemoryLeakWarning(method) {
|
||||||
var txt = method === 'destroy' ? 'n already-' : ' ';
|
var txt = method === 'destroy' ? 'n already-' : ' ';
|
||||||
@@ -312,9 +338,7 @@ var renderProps = {
|
|||||||
zIndex: 9999
|
zIndex: 9999
|
||||||
};
|
};
|
||||||
var defaultProps = Object.assign({
|
var defaultProps = Object.assign({
|
||||||
appendTo: function appendTo() {
|
appendTo: TIPPY_DEFAULT_APPEND_TO,
|
||||||
return document.body;
|
|
||||||
},
|
|
||||||
aria: {
|
aria: {
|
||||||
content: 'auto',
|
content: 'auto',
|
||||||
expanded: 'auto'
|
expanded: 'auto'
|
||||||
@@ -349,7 +373,7 @@ var defaultProps = Object.assign({
|
|||||||
touch: true,
|
touch: true,
|
||||||
trigger: 'mouseenter focus',
|
trigger: 'mouseenter focus',
|
||||||
triggerTarget: null
|
triggerTarget: null
|
||||||
}, pluginProps, {}, renderProps);
|
}, pluginProps, renderProps);
|
||||||
var defaultKeys = Object.keys(defaultProps);
|
var defaultKeys = Object.keys(defaultProps);
|
||||||
var setDefaultProps = function setDefaultProps(partialProps) {
|
var setDefaultProps = function setDefaultProps(partialProps) {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
@@ -369,12 +393,14 @@ function getExtendedPassedProps(passedProps) {
|
|||||||
defaultValue = plugin.defaultValue;
|
defaultValue = plugin.defaultValue;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
|
var _name;
|
||||||
|
|
||||||
|
acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
return Object.assign({}, passedProps, {}, pluginProps);
|
return Object.assign({}, passedProps, pluginProps);
|
||||||
}
|
}
|
||||||
function getDataAttributeProps(reference, plugins) {
|
function getDataAttributeProps(reference, plugins) {
|
||||||
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
||||||
@@ -405,7 +431,7 @@ function evaluateProps(reference, props) {
|
|||||||
var out = Object.assign({}, props, {
|
var out = Object.assign({}, props, {
|
||||||
content: invokeWithArgsOrReturn(props.content, [reference])
|
content: invokeWithArgsOrReturn(props.content, [reference])
|
||||||
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
||||||
out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
|
out.aria = Object.assign({}, defaultProps.aria, out.aria);
|
||||||
out.aria = {
|
out.aria = {
|
||||||
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
||||||
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
||||||
@@ -566,7 +592,7 @@ var mouseMoveListeners = []; // Used by `hideAll()`
|
|||||||
|
|
||||||
var mountedInstances = [];
|
var mountedInstances = [];
|
||||||
function createTippy(reference, passedProps) {
|
function createTippy(reference, passedProps) {
|
||||||
var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
||||||
// 🔒 Private members
|
// 🔒 Private members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -582,8 +608,7 @@ function createTippy(reference, passedProps) {
|
|||||||
var onFirstUpdate;
|
var onFirstUpdate;
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
||||||
var currentTarget;
|
var currentTarget; // ===========================================================================
|
||||||
var doc = getOwnerDocument(props.triggerTarget || reference); // ===========================================================================
|
|
||||||
// 🔑 Public members
|
// 🔑 Public members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -667,10 +692,9 @@ function createTippy(reference, passedProps) {
|
|||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popper.addEventListener('mouseleave', function (event) {
|
popper.addEventListener('mouseleave', function () {
|
||||||
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return instance; // ===========================================================================
|
return instance; // ===========================================================================
|
||||||
@@ -690,13 +714,18 @@ function createTippy(reference, passedProps) {
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
|
return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentTarget() {
|
function getCurrentTarget() {
|
||||||
return currentTarget || reference;
|
return currentTarget || reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDocument() {
|
||||||
|
var parent = getCurrentTarget().parentNode;
|
||||||
|
return parent ? getOwnerDocument(parent) : document;
|
||||||
|
}
|
||||||
|
|
||||||
function getDefaultTemplateChildren() {
|
function getDefaultTemplateChildren() {
|
||||||
return getChildren(popper);
|
return getChildren(popper);
|
||||||
}
|
}
|
||||||
@@ -712,8 +741,12 @@ function createTippy(reference, passedProps) {
|
|||||||
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleStyles() {
|
function handleStyles(fromHide) {
|
||||||
popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
|
if (fromHide === void 0) {
|
||||||
|
fromHide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
|
||||||
popper.style.zIndex = "" + instance.props.zIndex;
|
popper.style.zIndex = "" + instance.props.zIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,7 +757,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
pluginsHooks.forEach(function (pluginHooks) {
|
pluginsHooks.forEach(function (pluginHooks) {
|
||||||
if (pluginHooks[hook]) {
|
if (pluginHooks[hook]) {
|
||||||
pluginHooks[hook].apply(void 0, args);
|
pluginHooks[hook].apply(pluginHooks, args);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -778,7 +811,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanupInteractiveMouseListeners() {
|
function cleanupInteractiveMouseListeners() {
|
||||||
doc.removeEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
|
||||||
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
||||||
return listener !== debouncedOnMouseMove;
|
return listener !== debouncedOnMouseMove;
|
||||||
});
|
});
|
||||||
@@ -790,15 +823,18 @@ function createTippy(reference, passedProps) {
|
|||||||
if (didTouchMove || event.type === 'mousedown') {
|
if (didTouchMove || event.type === 'mousedown') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} // Clicked on interactive popper
|
}
|
||||||
|
|
||||||
|
var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
|
||||||
|
|
||||||
if (instance.props.interactive && popper.contains(event.target)) {
|
if (instance.props.interactive && actualContains(popper, actualTarget)) {
|
||||||
return;
|
return;
|
||||||
} // Clicked on the event listeners target
|
} // Clicked on the event listeners target
|
||||||
|
|
||||||
|
|
||||||
if (getCurrentTarget().contains(event.target)) {
|
if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
|
||||||
|
return actualContains(el, actualTarget);
|
||||||
|
})) {
|
||||||
if (currentInput.isTouch) {
|
if (currentInput.isTouch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -811,7 +847,6 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (instance.props.hideOnClick === true) {
|
if (instance.props.hideOnClick === true) {
|
||||||
isVisibleFromClick = false;
|
|
||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
||||||
// currentTarget. This lets a tippy with `focus` trigger know that it
|
// currentTarget. This lets a tippy with `focus` trigger know that it
|
||||||
@@ -839,6 +874,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addDocumentPress() {
|
function addDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.addEventListener('mousedown', onDocumentPress, true);
|
doc.addEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -846,6 +882,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeDocumentPress() {
|
function removeDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.removeEventListener('mousedown', onDocumentPress, true);
|
doc.removeEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -925,7 +962,7 @@ function createTippy(reference, passedProps) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focus':
|
case 'focus':
|
||||||
on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
|
on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focusin':
|
case 'focusin':
|
||||||
@@ -988,7 +1025,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
function onMouseMove(event) {
|
function onMouseMove(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
var isCursorOverReferenceOrPopper = reference.contains(target) || popper.contains(target);
|
var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
|
||||||
|
|
||||||
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
||||||
return;
|
return;
|
||||||
@@ -1151,7 +1188,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
var node = getCurrentTarget();
|
var node = getCurrentTarget();
|
||||||
|
|
||||||
if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
|
if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
|
||||||
parentNode = node.parentNode;
|
parentNode = node.parentNode;
|
||||||
} else {
|
} else {
|
||||||
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
||||||
@@ -1163,6 +1200,7 @@ function createTippy(reference, passedProps) {
|
|||||||
parentNode.appendChild(popper);
|
parentNode.appendChild(popper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance.state.isMounted = true;
|
||||||
createPopperInstance();
|
createPopperInstance();
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
|
|
||||||
@@ -1270,7 +1308,7 @@ function createTippy(reference, passedProps) {
|
|||||||
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
||||||
removeListeners();
|
removeListeners();
|
||||||
var prevProps = instance.props;
|
var prevProps = instance.props;
|
||||||
var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
|
var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
|
||||||
ignoreAttributes: true
|
ignoreAttributes: true
|
||||||
}));
|
}));
|
||||||
instance.props = nextProps;
|
instance.props = nextProps;
|
||||||
@@ -1373,6 +1411,8 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFirstUpdate = function onFirstUpdate() {
|
onFirstUpdate = function onFirstUpdate() {
|
||||||
|
var _instance$popperInsta2;
|
||||||
|
|
||||||
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1393,8 +1433,10 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
handleAriaContentAttribute();
|
handleAriaContentAttribute();
|
||||||
handleAriaExpandedAttribute();
|
handleAriaExpandedAttribute();
|
||||||
pushIfUnique(mountedInstances, instance);
|
pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
|
||||||
instance.state.isMounted = true;
|
// popper has been positioned for the first time
|
||||||
|
|
||||||
|
(_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
|
||||||
invokeHook('onMount', [instance]);
|
invokeHook('onMount', [instance]);
|
||||||
|
|
||||||
if (instance.props.animation && getIsDefaultRenderFn()) {
|
if (instance.props.animation && getIsDefaultRenderFn()) {
|
||||||
@@ -1433,6 +1475,7 @@ function createTippy(reference, passedProps) {
|
|||||||
instance.state.isVisible = false;
|
instance.state.isVisible = false;
|
||||||
instance.state.isShown = false;
|
instance.state.isShown = false;
|
||||||
ignoreOnFirstUpdate = false;
|
ignoreOnFirstUpdate = false;
|
||||||
|
isVisibleFromClick = false;
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
popper.style.visibility = 'hidden';
|
popper.style.visibility = 'hidden';
|
||||||
@@ -1440,7 +1483,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
cleanupInteractiveMouseListeners();
|
cleanupInteractiveMouseListeners();
|
||||||
removeDocumentPress();
|
removeDocumentPress();
|
||||||
handleStyles();
|
handleStyles(true);
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
||||||
@@ -1471,7 +1514,7 @@ function createTippy(reference, passedProps) {
|
|||||||
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
debouncedOnMouseMove(event);
|
||||||
}
|
}
|
||||||
@@ -1597,7 +1640,39 @@ var hideAll = function hideAll(_temp) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// every time the popper is destroyed (i.e. a new target), removing the styles
|
||||||
|
// and causing transitions to break for singletons when the console is open, but
|
||||||
|
// most notably for non-transform styles being used, `gpuAcceleration: false`.
|
||||||
|
|
||||||
|
var applyStylesModifier = Object.assign({}, applyStyles, {
|
||||||
|
effect: function effect(_ref) {
|
||||||
|
var state = _ref.state;
|
||||||
|
var initialStyles = {
|
||||||
|
popper: {
|
||||||
|
position: state.options.strategy,
|
||||||
|
left: '0',
|
||||||
|
top: '0',
|
||||||
|
margin: '0'
|
||||||
|
},
|
||||||
|
arrow: {
|
||||||
|
position: 'absolute'
|
||||||
|
},
|
||||||
|
reference: {}
|
||||||
|
};
|
||||||
|
Object.assign(state.elements.popper.style, initialStyles.popper);
|
||||||
|
state.styles = initialStyles;
|
||||||
|
|
||||||
|
if (state.elements.arrow) {
|
||||||
|
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
||||||
|
} // intentionally return no cleanup function
|
||||||
|
// return () => { ... }
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
||||||
|
var _optionalProps$popper;
|
||||||
|
|
||||||
if (optionalProps === void 0) {
|
if (optionalProps === void 0) {
|
||||||
optionalProps = {};
|
optionalProps = {};
|
||||||
}
|
}
|
||||||
@@ -1607,19 +1682,30 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|||||||
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
var mutTippyInstances = tippyInstances;
|
var individualInstances = tippyInstances;
|
||||||
var references = [];
|
var references = [];
|
||||||
|
var triggerTargets = [];
|
||||||
var currentTarget;
|
var currentTarget;
|
||||||
var overrides = optionalProps.overrides;
|
var overrides = optionalProps.overrides;
|
||||||
|
var interceptSetPropsCleanups = [];
|
||||||
|
var shownOnCreate = false;
|
||||||
|
|
||||||
|
function setTriggerTargets() {
|
||||||
|
triggerTargets = individualInstances.map(function (instance) {
|
||||||
|
return normalizeToArray(instance.props.triggerTarget || instance.reference);
|
||||||
|
}).reduce(function (acc, item) {
|
||||||
|
return acc.concat(item);
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
function setReferences() {
|
function setReferences() {
|
||||||
references = mutTippyInstances.map(function (instance) {
|
references = individualInstances.map(function (instance) {
|
||||||
return instance.reference;
|
return instance.reference;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableInstances(isEnabled) {
|
function enableInstances(isEnabled) {
|
||||||
mutTippyInstances.forEach(function (instance) {
|
individualInstances.forEach(function (instance) {
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
instance.enable();
|
instance.enable();
|
||||||
} else {
|
} else {
|
||||||
@@ -1628,58 +1714,163 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function interceptSetProps(singleton) {
|
||||||
|
return individualInstances.map(function (instance) {
|
||||||
|
var originalSetProps = instance.setProps;
|
||||||
|
|
||||||
|
instance.setProps = function (props) {
|
||||||
|
originalSetProps(props);
|
||||||
|
|
||||||
|
if (instance.reference === currentTarget) {
|
||||||
|
singleton.setProps(props);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
instance.setProps = originalSetProps;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} // have to pass singleton, as it maybe undefined on first call
|
||||||
|
|
||||||
|
|
||||||
|
function prepareInstance(singleton, target) {
|
||||||
|
var index = triggerTargets.indexOf(target); // bail-out
|
||||||
|
|
||||||
|
if (target === currentTarget) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTarget = target;
|
||||||
|
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
||||||
|
acc[prop] = individualInstances[index].props[prop];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
singleton.setProps(Object.assign({}, overrideProps, {
|
||||||
|
getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
|
||||||
|
var _references$index;
|
||||||
|
|
||||||
|
return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
var singleton = {
|
setTriggerTargets();
|
||||||
|
var plugin = {
|
||||||
fn: function fn() {
|
fn: function fn() {
|
||||||
return {
|
return {
|
||||||
onDestroy: function onDestroy() {
|
onDestroy: function onDestroy() {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(instance, event) {
|
onHidden: function onHidden() {
|
||||||
var target = event.currentTarget;
|
currentTarget = null;
|
||||||
var index = references.indexOf(target); // bail-out
|
},
|
||||||
|
onClickOutside: function onClickOutside(instance) {
|
||||||
if (target === currentTarget) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
return;
|
shownOnCreate = true;
|
||||||
|
currentTarget = null;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
currentTarget = target;
|
onShow: function onShow(instance) {
|
||||||
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
acc[prop] = mutTippyInstances[index].props[prop];
|
shownOnCreate = true;
|
||||||
return acc;
|
prepareInstance(instance, references[0]);
|
||||||
}, {});
|
}
|
||||||
instance.setProps(Object.assign({}, overrideProps, {
|
},
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
onTrigger: function onTrigger(instance, event) {
|
||||||
return target.getBoundingClientRect();
|
prepareInstance(instance, event.currentTarget);
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var instance = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
||||||
plugins: [singleton].concat(optionalProps.plugins || []),
|
plugins: [plugin].concat(optionalProps.plugins || []),
|
||||||
triggerTarget: references
|
triggerTarget: triggerTargets,
|
||||||
|
popperOptions: Object.assign({}, optionalProps.popperOptions, {
|
||||||
|
modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
|
||||||
|
})
|
||||||
}));
|
}));
|
||||||
var originalSetProps = instance.setProps;
|
var originalShow = singleton.show;
|
||||||
|
|
||||||
instance.setProps = function (props) {
|
singleton.show = function (target) {
|
||||||
|
originalShow(); // first time, showOnCreate or programmatic call with no params
|
||||||
|
// default to showing first instance
|
||||||
|
|
||||||
|
if (!currentTarget && target == null) {
|
||||||
|
return prepareInstance(singleton, references[0]);
|
||||||
|
} // triggered from event (do nothing as prepareInstance already called by onTrigger)
|
||||||
|
// programmatic call with no params when already visible (do nothing again)
|
||||||
|
|
||||||
|
|
||||||
|
if (currentTarget && target == null) {
|
||||||
|
return;
|
||||||
|
} // target is index of instance
|
||||||
|
|
||||||
|
|
||||||
|
if (typeof target === 'number') {
|
||||||
|
return references[target] && prepareInstance(singleton, references[target]);
|
||||||
|
} // target is a child tippy instance
|
||||||
|
|
||||||
|
|
||||||
|
if (individualInstances.indexOf(target) >= 0) {
|
||||||
|
var ref = target.reference;
|
||||||
|
return prepareInstance(singleton, ref);
|
||||||
|
} // target is a ReferenceElement
|
||||||
|
|
||||||
|
|
||||||
|
if (references.indexOf(target) >= 0) {
|
||||||
|
return prepareInstance(singleton, target);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showNext = function () {
|
||||||
|
var first = references[0];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
singleton.show(references[index + 1] || first);
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showPrevious = function () {
|
||||||
|
var last = references[references.length - 1];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(last);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
var target = references[index - 1] || last;
|
||||||
|
singleton.show(target);
|
||||||
|
};
|
||||||
|
|
||||||
|
var originalSetProps = singleton.setProps;
|
||||||
|
|
||||||
|
singleton.setProps = function (props) {
|
||||||
overrides = props.overrides || overrides;
|
overrides = props.overrides || overrides;
|
||||||
originalSetProps(props);
|
originalSetProps(props);
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.setInstances = function (nextInstances) {
|
singleton.setInstances = function (nextInstances) {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
mutTippyInstances = nextInstances;
|
interceptSetPropsCleanups.forEach(function (fn) {
|
||||||
|
return fn();
|
||||||
|
});
|
||||||
|
individualInstances = nextInstances;
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
instance.setProps({
|
setTriggerTargets();
|
||||||
triggerTarget: references
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
singleton.setProps({
|
||||||
|
triggerTarget: triggerTargets
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return instance;
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
return singleton;
|
||||||
};
|
};
|
||||||
|
|
||||||
var BUBBLING_EVENTS_MAP = {
|
var BUBBLING_EVENTS_MAP = {
|
||||||
@@ -1700,20 +1891,23 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var childTippyInstances = [];
|
var childTippyInstances = [];
|
||||||
|
var disabled = false;
|
||||||
var target = props.target;
|
var target = props.target;
|
||||||
var nativeProps = removeProperties(props, ['target']);
|
var nativeProps = removeProperties(props, ['target']);
|
||||||
var parentProps = Object.assign({}, nativeProps, {
|
var parentProps = Object.assign({}, nativeProps, {
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
touch: false
|
touch: false
|
||||||
});
|
});
|
||||||
var childProps = Object.assign({}, nativeProps, {
|
var childProps = Object.assign({
|
||||||
|
touch: defaultProps.touch
|
||||||
|
}, nativeProps, {
|
||||||
showOnCreate: true
|
showOnCreate: true
|
||||||
});
|
});
|
||||||
var returnValue = tippy(targets, parentProps);
|
var returnValue = tippy(targets, parentProps);
|
||||||
var normalizedReturnValue = normalizeToArray(returnValue);
|
var normalizedReturnValue = normalizeToArray(returnValue);
|
||||||
|
|
||||||
function onTrigger(event) {
|
function onTrigger(event) {
|
||||||
if (!event.target) {
|
if (!event.target || disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1737,7 +1931,7 @@ function delegate(targets, props) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type])) {
|
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type]) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1764,7 +1958,7 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
function addEventListeners(instance) {
|
function addEventListeners(instance) {
|
||||||
var reference = instance.reference;
|
var reference = instance.reference;
|
||||||
on(reference, 'touchstart', onTrigger);
|
on(reference, 'touchstart', onTrigger, TOUCH_OPTIONS);
|
||||||
on(reference, 'mouseover', onTrigger);
|
on(reference, 'mouseover', onTrigger);
|
||||||
on(reference, 'focusin', onTrigger);
|
on(reference, 'focusin', onTrigger);
|
||||||
on(reference, 'click', onTrigger);
|
on(reference, 'click', onTrigger);
|
||||||
@@ -1783,6 +1977,8 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
function applyMutations(instance) {
|
function applyMutations(instance) {
|
||||||
var originalDestroy = instance.destroy;
|
var originalDestroy = instance.destroy;
|
||||||
|
var originalEnable = instance.enable;
|
||||||
|
var originalDisable = instance.disable;
|
||||||
|
|
||||||
instance.destroy = function (shouldDestroyChildInstances) {
|
instance.destroy = function (shouldDestroyChildInstances) {
|
||||||
if (shouldDestroyChildInstances === void 0) {
|
if (shouldDestroyChildInstances === void 0) {
|
||||||
@@ -1800,6 +1996,22 @@ function delegate(targets, props) {
|
|||||||
originalDestroy();
|
originalDestroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
instance.enable = function () {
|
||||||
|
originalEnable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.enable();
|
||||||
|
});
|
||||||
|
disabled = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
instance.disable = function () {
|
||||||
|
originalDisable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.disable();
|
||||||
|
});
|
||||||
|
disabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
addEventListeners(instance);
|
addEventListeners(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1814,7 +2026,7 @@ var animateFill = {
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
|
if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== "production") {
|
||||||
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
||||||
}
|
}
|
||||||
@@ -1939,6 +2151,7 @@ var followCursor = {
|
|||||||
|
|
||||||
if (isCursorOverReference || !instance.props.interactive) {
|
if (isCursorOverReference || !instance.props.interactive) {
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
var rect = reference.getBoundingClientRect();
|
var rect = reference.getBoundingClientRect();
|
||||||
var x = clientX;
|
var x = clientX;
|
||||||
@@ -2017,20 +2230,26 @@ var followCursor = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMount: function onMount() {
|
onMount: function onMount() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor && !wasFocusEvent) {
|
||||||
if (isUnmounted) {
|
if (isUnmounted) {
|
||||||
onMouseMove(mouseCoords);
|
onMouseMove(mouseCoords);
|
||||||
isUnmounted = false;
|
isUnmounted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasFocusEvent && !getIsInitialBehavior()) {
|
if (!getIsInitialBehavior()) {
|
||||||
addListener();
|
addListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(_, _ref3) {
|
onTrigger: function onTrigger(_, event) {
|
||||||
var type = _ref3.type;
|
if (isMouseEvent(event)) {
|
||||||
wasFocusEvent = type === 'focus';
|
mouseCoords = {
|
||||||
|
clientX: event.clientX,
|
||||||
|
clientY: event.clientY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
wasFocusEvent = event.type === 'focus';
|
||||||
},
|
},
|
||||||
onHidden: function onHidden() {
|
onHidden: function onHidden() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor) {
|
||||||
@@ -2069,6 +2288,7 @@ var inlinePositioning = {
|
|||||||
var placement;
|
var placement;
|
||||||
var cursorRectIndex = -1;
|
var cursorRectIndex = -1;
|
||||||
var isInternalUpdate = false;
|
var isInternalUpdate = false;
|
||||||
|
var triedPlacements = [];
|
||||||
var modifier = {
|
var modifier = {
|
||||||
name: 'tippyInlinePositioning',
|
name: 'tippyInlinePositioning',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -2077,8 +2297,14 @@ var inlinePositioning = {
|
|||||||
var state = _ref2.state;
|
var state = _ref2.state;
|
||||||
|
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
if (placement !== state.placement) {
|
if (triedPlacements.indexOf(state.placement) !== -1) {
|
||||||
|
triedPlacements = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
|
||||||
|
triedPlacements.push(state.placement);
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
return _getReferenceClientRect(state.placement);
|
return _getReferenceClientRect(state.placement);
|
||||||
}
|
}
|
||||||
@@ -2115,10 +2341,11 @@ var inlinePositioning = {
|
|||||||
var cursorRect = rects.find(function (rect) {
|
var cursorRect = rects.find(function (rect) {
|
||||||
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
||||||
});
|
});
|
||||||
cursorRectIndex = rects.indexOf(cursorRect);
|
var index = rects.indexOf(cursorRect);
|
||||||
|
cursorRectIndex = index > -1 ? index : cursorRectIndex;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUntrigger: function onUntrigger() {
|
onHidden: function onHidden() {
|
||||||
cursorRectIndex = -1;
|
cursorRectIndex = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
2
node_modules/tippy.js/dist/tippy.esm.js.map
generated
vendored
2
node_modules/tippy.js/dist/tippy.esm.js.map
generated
vendored
File diff suppressed because one or more lines are too long
389
node_modules/tippy.js/dist/tippy.umd.js
generated
vendored
389
node_modules/tippy.js/dist/tippy.umd.js
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
/**!
|
/**!
|
||||||
* tippy.js v6.2.5
|
* tippy.js v6.3.7
|
||||||
* (c) 2017-2020 atomiks
|
* (c) 2017-2021 atomiks
|
||||||
* MIT License
|
* MIT License
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
@@ -19,6 +19,9 @@
|
|||||||
passive: true,
|
passive: true,
|
||||||
capture: true
|
capture: true
|
||||||
};
|
};
|
||||||
|
var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
|
||||||
|
return document.body;
|
||||||
|
};
|
||||||
|
|
||||||
function hasOwnProperty(obj, key) {
|
function hasOwnProperty(obj, key) {
|
||||||
return {}.hasOwnProperty.call(obj, key);
|
return {}.hasOwnProperty.call(obj, key);
|
||||||
@@ -138,10 +141,13 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getOwnerDocument(elementOrElements) {
|
function getOwnerDocument(elementOrElements) {
|
||||||
var _normalizeToArray = normalizeToArray(elementOrElements),
|
var _element$ownerDocumen;
|
||||||
element = _normalizeToArray[0];
|
|
||||||
|
|
||||||
return element ? element.ownerDocument || document : document;
|
var _normalizeToArray = normalizeToArray(elementOrElements),
|
||||||
|
element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
|
||||||
|
|
||||||
|
|
||||||
|
return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
|
||||||
}
|
}
|
||||||
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
||||||
var clientX = event.clientX,
|
var clientX = event.clientX,
|
||||||
@@ -177,6 +183,26 @@
|
|||||||
box[method](event, listener);
|
box[method](event, listener);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Compared to xxx.contains, this function works for dom structures with shadow
|
||||||
|
* dom
|
||||||
|
*/
|
||||||
|
|
||||||
|
function actualContains(parent, child) {
|
||||||
|
var target = child;
|
||||||
|
|
||||||
|
while (target) {
|
||||||
|
var _target$getRootNode;
|
||||||
|
|
||||||
|
if (parent.contains(target)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var currentInput = {
|
var currentInput = {
|
||||||
isTouch: false
|
isTouch: false
|
||||||
@@ -240,8 +266,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||||
var ua = isBrowser ? navigator.userAgent : '';
|
var isIE11 = isBrowser ? // @ts-ignore
|
||||||
var isIE = /MSIE |Trident\//.test(ua);
|
!!window.msCrypto : false;
|
||||||
|
|
||||||
function createMemoryLeakWarning(method) {
|
function createMemoryLeakWarning(method) {
|
||||||
var txt = method === 'destroy' ? 'n already-' : ' ';
|
var txt = method === 'destroy' ? 'n already-' : ' ';
|
||||||
@@ -316,9 +342,7 @@
|
|||||||
zIndex: 9999
|
zIndex: 9999
|
||||||
};
|
};
|
||||||
var defaultProps = Object.assign({
|
var defaultProps = Object.assign({
|
||||||
appendTo: function appendTo() {
|
appendTo: TIPPY_DEFAULT_APPEND_TO,
|
||||||
return document.body;
|
|
||||||
},
|
|
||||||
aria: {
|
aria: {
|
||||||
content: 'auto',
|
content: 'auto',
|
||||||
expanded: 'auto'
|
expanded: 'auto'
|
||||||
@@ -353,7 +377,7 @@
|
|||||||
touch: true,
|
touch: true,
|
||||||
trigger: 'mouseenter focus',
|
trigger: 'mouseenter focus',
|
||||||
triggerTarget: null
|
triggerTarget: null
|
||||||
}, pluginProps, {}, renderProps);
|
}, pluginProps, renderProps);
|
||||||
var defaultKeys = Object.keys(defaultProps);
|
var defaultKeys = Object.keys(defaultProps);
|
||||||
var setDefaultProps = function setDefaultProps(partialProps) {
|
var setDefaultProps = function setDefaultProps(partialProps) {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
@@ -373,12 +397,14 @@
|
|||||||
defaultValue = plugin.defaultValue;
|
defaultValue = plugin.defaultValue;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
|
var _name;
|
||||||
|
|
||||||
|
acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
return Object.assign({}, passedProps, {}, pluginProps);
|
return Object.assign({}, passedProps, pluginProps);
|
||||||
}
|
}
|
||||||
function getDataAttributeProps(reference, plugins) {
|
function getDataAttributeProps(reference, plugins) {
|
||||||
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
||||||
@@ -409,7 +435,7 @@
|
|||||||
var out = Object.assign({}, props, {
|
var out = Object.assign({}, props, {
|
||||||
content: invokeWithArgsOrReturn(props.content, [reference])
|
content: invokeWithArgsOrReturn(props.content, [reference])
|
||||||
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
||||||
out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
|
out.aria = Object.assign({}, defaultProps.aria, out.aria);
|
||||||
out.aria = {
|
out.aria = {
|
||||||
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
||||||
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
||||||
@@ -570,7 +596,7 @@
|
|||||||
|
|
||||||
var mountedInstances = [];
|
var mountedInstances = [];
|
||||||
function createTippy(reference, passedProps) {
|
function createTippy(reference, passedProps) {
|
||||||
var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
||||||
// 🔒 Private members
|
// 🔒 Private members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -586,8 +612,7 @@
|
|||||||
var onFirstUpdate;
|
var onFirstUpdate;
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
||||||
var currentTarget;
|
var currentTarget; // ===========================================================================
|
||||||
var doc = getOwnerDocument(props.triggerTarget || reference); // ===========================================================================
|
|
||||||
// 🔑 Public members
|
// 🔑 Public members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -671,10 +696,9 @@
|
|||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popper.addEventListener('mouseleave', function (event) {
|
popper.addEventListener('mouseleave', function () {
|
||||||
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return instance; // ===========================================================================
|
return instance; // ===========================================================================
|
||||||
@@ -694,13 +718,18 @@
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
|
return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentTarget() {
|
function getCurrentTarget() {
|
||||||
return currentTarget || reference;
|
return currentTarget || reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDocument() {
|
||||||
|
var parent = getCurrentTarget().parentNode;
|
||||||
|
return parent ? getOwnerDocument(parent) : document;
|
||||||
|
}
|
||||||
|
|
||||||
function getDefaultTemplateChildren() {
|
function getDefaultTemplateChildren() {
|
||||||
return getChildren(popper);
|
return getChildren(popper);
|
||||||
}
|
}
|
||||||
@@ -716,8 +745,12 @@
|
|||||||
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleStyles() {
|
function handleStyles(fromHide) {
|
||||||
popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
|
if (fromHide === void 0) {
|
||||||
|
fromHide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
|
||||||
popper.style.zIndex = "" + instance.props.zIndex;
|
popper.style.zIndex = "" + instance.props.zIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -728,7 +761,7 @@
|
|||||||
|
|
||||||
pluginsHooks.forEach(function (pluginHooks) {
|
pluginsHooks.forEach(function (pluginHooks) {
|
||||||
if (pluginHooks[hook]) {
|
if (pluginHooks[hook]) {
|
||||||
pluginHooks[hook].apply(void 0, args);
|
pluginHooks[hook].apply(pluginHooks, args);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -782,7 +815,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanupInteractiveMouseListeners() {
|
function cleanupInteractiveMouseListeners() {
|
||||||
doc.removeEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
|
||||||
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
||||||
return listener !== debouncedOnMouseMove;
|
return listener !== debouncedOnMouseMove;
|
||||||
});
|
});
|
||||||
@@ -794,15 +827,18 @@
|
|||||||
if (didTouchMove || event.type === 'mousedown') {
|
if (didTouchMove || event.type === 'mousedown') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} // Clicked on interactive popper
|
}
|
||||||
|
|
||||||
|
var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
|
||||||
|
|
||||||
if (instance.props.interactive && popper.contains(event.target)) {
|
if (instance.props.interactive && actualContains(popper, actualTarget)) {
|
||||||
return;
|
return;
|
||||||
} // Clicked on the event listeners target
|
} // Clicked on the event listeners target
|
||||||
|
|
||||||
|
|
||||||
if (getCurrentTarget().contains(event.target)) {
|
if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
|
||||||
|
return actualContains(el, actualTarget);
|
||||||
|
})) {
|
||||||
if (currentInput.isTouch) {
|
if (currentInput.isTouch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -815,7 +851,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (instance.props.hideOnClick === true) {
|
if (instance.props.hideOnClick === true) {
|
||||||
isVisibleFromClick = false;
|
|
||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
||||||
// currentTarget. This lets a tippy with `focus` trigger know that it
|
// currentTarget. This lets a tippy with `focus` trigger know that it
|
||||||
@@ -843,6 +878,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addDocumentPress() {
|
function addDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.addEventListener('mousedown', onDocumentPress, true);
|
doc.addEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -850,6 +886,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeDocumentPress() {
|
function removeDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.removeEventListener('mousedown', onDocumentPress, true);
|
doc.removeEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -929,7 +966,7 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focus':
|
case 'focus':
|
||||||
on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
|
on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focusin':
|
case 'focusin':
|
||||||
@@ -992,7 +1029,7 @@
|
|||||||
|
|
||||||
function onMouseMove(event) {
|
function onMouseMove(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
var isCursorOverReferenceOrPopper = reference.contains(target) || popper.contains(target);
|
var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
|
||||||
|
|
||||||
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
||||||
return;
|
return;
|
||||||
@@ -1155,7 +1192,7 @@
|
|||||||
|
|
||||||
var node = getCurrentTarget();
|
var node = getCurrentTarget();
|
||||||
|
|
||||||
if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
|
if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
|
||||||
parentNode = node.parentNode;
|
parentNode = node.parentNode;
|
||||||
} else {
|
} else {
|
||||||
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
||||||
@@ -1167,6 +1204,7 @@
|
|||||||
parentNode.appendChild(popper);
|
parentNode.appendChild(popper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance.state.isMounted = true;
|
||||||
createPopperInstance();
|
createPopperInstance();
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
|
|
||||||
@@ -1274,7 +1312,7 @@
|
|||||||
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
||||||
removeListeners();
|
removeListeners();
|
||||||
var prevProps = instance.props;
|
var prevProps = instance.props;
|
||||||
var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
|
var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
|
||||||
ignoreAttributes: true
|
ignoreAttributes: true
|
||||||
}));
|
}));
|
||||||
instance.props = nextProps;
|
instance.props = nextProps;
|
||||||
@@ -1377,6 +1415,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFirstUpdate = function onFirstUpdate() {
|
onFirstUpdate = function onFirstUpdate() {
|
||||||
|
var _instance$popperInsta2;
|
||||||
|
|
||||||
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1397,8 +1437,10 @@
|
|||||||
|
|
||||||
handleAriaContentAttribute();
|
handleAriaContentAttribute();
|
||||||
handleAriaExpandedAttribute();
|
handleAriaExpandedAttribute();
|
||||||
pushIfUnique(mountedInstances, instance);
|
pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
|
||||||
instance.state.isMounted = true;
|
// popper has been positioned for the first time
|
||||||
|
|
||||||
|
(_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
|
||||||
invokeHook('onMount', [instance]);
|
invokeHook('onMount', [instance]);
|
||||||
|
|
||||||
if (instance.props.animation && getIsDefaultRenderFn()) {
|
if (instance.props.animation && getIsDefaultRenderFn()) {
|
||||||
@@ -1437,6 +1479,7 @@
|
|||||||
instance.state.isVisible = false;
|
instance.state.isVisible = false;
|
||||||
instance.state.isShown = false;
|
instance.state.isShown = false;
|
||||||
ignoreOnFirstUpdate = false;
|
ignoreOnFirstUpdate = false;
|
||||||
|
isVisibleFromClick = false;
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
popper.style.visibility = 'hidden';
|
popper.style.visibility = 'hidden';
|
||||||
@@ -1444,7 +1487,7 @@
|
|||||||
|
|
||||||
cleanupInteractiveMouseListeners();
|
cleanupInteractiveMouseListeners();
|
||||||
removeDocumentPress();
|
removeDocumentPress();
|
||||||
handleStyles();
|
handleStyles(true);
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
||||||
@@ -1475,7 +1518,7 @@
|
|||||||
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
debouncedOnMouseMove(event);
|
||||||
}
|
}
|
||||||
@@ -1601,7 +1644,39 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// every time the popper is destroyed (i.e. a new target), removing the styles
|
||||||
|
// and causing transitions to break for singletons when the console is open, but
|
||||||
|
// most notably for non-transform styles being used, `gpuAcceleration: false`.
|
||||||
|
|
||||||
|
var applyStylesModifier = Object.assign({}, core.applyStyles, {
|
||||||
|
effect: function effect(_ref) {
|
||||||
|
var state = _ref.state;
|
||||||
|
var initialStyles = {
|
||||||
|
popper: {
|
||||||
|
position: state.options.strategy,
|
||||||
|
left: '0',
|
||||||
|
top: '0',
|
||||||
|
margin: '0'
|
||||||
|
},
|
||||||
|
arrow: {
|
||||||
|
position: 'absolute'
|
||||||
|
},
|
||||||
|
reference: {}
|
||||||
|
};
|
||||||
|
Object.assign(state.elements.popper.style, initialStyles.popper);
|
||||||
|
state.styles = initialStyles;
|
||||||
|
|
||||||
|
if (state.elements.arrow) {
|
||||||
|
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
||||||
|
} // intentionally return no cleanup function
|
||||||
|
// return () => { ... }
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
||||||
|
var _optionalProps$popper;
|
||||||
|
|
||||||
if (optionalProps === void 0) {
|
if (optionalProps === void 0) {
|
||||||
optionalProps = {};
|
optionalProps = {};
|
||||||
}
|
}
|
||||||
@@ -1611,19 +1686,30 @@
|
|||||||
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
var mutTippyInstances = tippyInstances;
|
var individualInstances = tippyInstances;
|
||||||
var references = [];
|
var references = [];
|
||||||
|
var triggerTargets = [];
|
||||||
var currentTarget;
|
var currentTarget;
|
||||||
var overrides = optionalProps.overrides;
|
var overrides = optionalProps.overrides;
|
||||||
|
var interceptSetPropsCleanups = [];
|
||||||
|
var shownOnCreate = false;
|
||||||
|
|
||||||
|
function setTriggerTargets() {
|
||||||
|
triggerTargets = individualInstances.map(function (instance) {
|
||||||
|
return normalizeToArray(instance.props.triggerTarget || instance.reference);
|
||||||
|
}).reduce(function (acc, item) {
|
||||||
|
return acc.concat(item);
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
function setReferences() {
|
function setReferences() {
|
||||||
references = mutTippyInstances.map(function (instance) {
|
references = individualInstances.map(function (instance) {
|
||||||
return instance.reference;
|
return instance.reference;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableInstances(isEnabled) {
|
function enableInstances(isEnabled) {
|
||||||
mutTippyInstances.forEach(function (instance) {
|
individualInstances.forEach(function (instance) {
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
instance.enable();
|
instance.enable();
|
||||||
} else {
|
} else {
|
||||||
@@ -1632,58 +1718,163 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function interceptSetProps(singleton) {
|
||||||
|
return individualInstances.map(function (instance) {
|
||||||
|
var originalSetProps = instance.setProps;
|
||||||
|
|
||||||
|
instance.setProps = function (props) {
|
||||||
|
originalSetProps(props);
|
||||||
|
|
||||||
|
if (instance.reference === currentTarget) {
|
||||||
|
singleton.setProps(props);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
instance.setProps = originalSetProps;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} // have to pass singleton, as it maybe undefined on first call
|
||||||
|
|
||||||
|
|
||||||
|
function prepareInstance(singleton, target) {
|
||||||
|
var index = triggerTargets.indexOf(target); // bail-out
|
||||||
|
|
||||||
|
if (target === currentTarget) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTarget = target;
|
||||||
|
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
||||||
|
acc[prop] = individualInstances[index].props[prop];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
singleton.setProps(Object.assign({}, overrideProps, {
|
||||||
|
getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
|
||||||
|
var _references$index;
|
||||||
|
|
||||||
|
return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
var singleton = {
|
setTriggerTargets();
|
||||||
|
var plugin = {
|
||||||
fn: function fn() {
|
fn: function fn() {
|
||||||
return {
|
return {
|
||||||
onDestroy: function onDestroy() {
|
onDestroy: function onDestroy() {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(instance, event) {
|
onHidden: function onHidden() {
|
||||||
var target = event.currentTarget;
|
currentTarget = null;
|
||||||
var index = references.indexOf(target); // bail-out
|
},
|
||||||
|
onClickOutside: function onClickOutside(instance) {
|
||||||
if (target === currentTarget) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
return;
|
shownOnCreate = true;
|
||||||
|
currentTarget = null;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
currentTarget = target;
|
onShow: function onShow(instance) {
|
||||||
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
acc[prop] = mutTippyInstances[index].props[prop];
|
shownOnCreate = true;
|
||||||
return acc;
|
prepareInstance(instance, references[0]);
|
||||||
}, {});
|
}
|
||||||
instance.setProps(Object.assign({}, overrideProps, {
|
},
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
onTrigger: function onTrigger(instance, event) {
|
||||||
return target.getBoundingClientRect();
|
prepareInstance(instance, event.currentTarget);
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var instance = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
||||||
plugins: [singleton].concat(optionalProps.plugins || []),
|
plugins: [plugin].concat(optionalProps.plugins || []),
|
||||||
triggerTarget: references
|
triggerTarget: triggerTargets,
|
||||||
|
popperOptions: Object.assign({}, optionalProps.popperOptions, {
|
||||||
|
modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
|
||||||
|
})
|
||||||
}));
|
}));
|
||||||
var originalSetProps = instance.setProps;
|
var originalShow = singleton.show;
|
||||||
|
|
||||||
instance.setProps = function (props) {
|
singleton.show = function (target) {
|
||||||
|
originalShow(); // first time, showOnCreate or programmatic call with no params
|
||||||
|
// default to showing first instance
|
||||||
|
|
||||||
|
if (!currentTarget && target == null) {
|
||||||
|
return prepareInstance(singleton, references[0]);
|
||||||
|
} // triggered from event (do nothing as prepareInstance already called by onTrigger)
|
||||||
|
// programmatic call with no params when already visible (do nothing again)
|
||||||
|
|
||||||
|
|
||||||
|
if (currentTarget && target == null) {
|
||||||
|
return;
|
||||||
|
} // target is index of instance
|
||||||
|
|
||||||
|
|
||||||
|
if (typeof target === 'number') {
|
||||||
|
return references[target] && prepareInstance(singleton, references[target]);
|
||||||
|
} // target is a child tippy instance
|
||||||
|
|
||||||
|
|
||||||
|
if (individualInstances.indexOf(target) >= 0) {
|
||||||
|
var ref = target.reference;
|
||||||
|
return prepareInstance(singleton, ref);
|
||||||
|
} // target is a ReferenceElement
|
||||||
|
|
||||||
|
|
||||||
|
if (references.indexOf(target) >= 0) {
|
||||||
|
return prepareInstance(singleton, target);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showNext = function () {
|
||||||
|
var first = references[0];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
singleton.show(references[index + 1] || first);
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showPrevious = function () {
|
||||||
|
var last = references[references.length - 1];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(last);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
var target = references[index - 1] || last;
|
||||||
|
singleton.show(target);
|
||||||
|
};
|
||||||
|
|
||||||
|
var originalSetProps = singleton.setProps;
|
||||||
|
|
||||||
|
singleton.setProps = function (props) {
|
||||||
overrides = props.overrides || overrides;
|
overrides = props.overrides || overrides;
|
||||||
originalSetProps(props);
|
originalSetProps(props);
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.setInstances = function (nextInstances) {
|
singleton.setInstances = function (nextInstances) {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
mutTippyInstances = nextInstances;
|
interceptSetPropsCleanups.forEach(function (fn) {
|
||||||
|
return fn();
|
||||||
|
});
|
||||||
|
individualInstances = nextInstances;
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
instance.setProps({
|
setTriggerTargets();
|
||||||
triggerTarget: references
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
singleton.setProps({
|
||||||
|
triggerTarget: triggerTargets
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return instance;
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
return singleton;
|
||||||
};
|
};
|
||||||
|
|
||||||
var BUBBLING_EVENTS_MAP = {
|
var BUBBLING_EVENTS_MAP = {
|
||||||
@@ -1704,20 +1895,23 @@
|
|||||||
|
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var childTippyInstances = [];
|
var childTippyInstances = [];
|
||||||
|
var disabled = false;
|
||||||
var target = props.target;
|
var target = props.target;
|
||||||
var nativeProps = removeProperties(props, ['target']);
|
var nativeProps = removeProperties(props, ['target']);
|
||||||
var parentProps = Object.assign({}, nativeProps, {
|
var parentProps = Object.assign({}, nativeProps, {
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
touch: false
|
touch: false
|
||||||
});
|
});
|
||||||
var childProps = Object.assign({}, nativeProps, {
|
var childProps = Object.assign({
|
||||||
|
touch: defaultProps.touch
|
||||||
|
}, nativeProps, {
|
||||||
showOnCreate: true
|
showOnCreate: true
|
||||||
});
|
});
|
||||||
var returnValue = tippy(targets, parentProps);
|
var returnValue = tippy(targets, parentProps);
|
||||||
var normalizedReturnValue = normalizeToArray(returnValue);
|
var normalizedReturnValue = normalizeToArray(returnValue);
|
||||||
|
|
||||||
function onTrigger(event) {
|
function onTrigger(event) {
|
||||||
if (!event.target) {
|
if (!event.target || disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1741,7 +1935,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type])) {
|
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type]) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1768,7 +1962,7 @@
|
|||||||
|
|
||||||
function addEventListeners(instance) {
|
function addEventListeners(instance) {
|
||||||
var reference = instance.reference;
|
var reference = instance.reference;
|
||||||
on(reference, 'touchstart', onTrigger);
|
on(reference, 'touchstart', onTrigger, TOUCH_OPTIONS);
|
||||||
on(reference, 'mouseover', onTrigger);
|
on(reference, 'mouseover', onTrigger);
|
||||||
on(reference, 'focusin', onTrigger);
|
on(reference, 'focusin', onTrigger);
|
||||||
on(reference, 'click', onTrigger);
|
on(reference, 'click', onTrigger);
|
||||||
@@ -1787,6 +1981,8 @@
|
|||||||
|
|
||||||
function applyMutations(instance) {
|
function applyMutations(instance) {
|
||||||
var originalDestroy = instance.destroy;
|
var originalDestroy = instance.destroy;
|
||||||
|
var originalEnable = instance.enable;
|
||||||
|
var originalDisable = instance.disable;
|
||||||
|
|
||||||
instance.destroy = function (shouldDestroyChildInstances) {
|
instance.destroy = function (shouldDestroyChildInstances) {
|
||||||
if (shouldDestroyChildInstances === void 0) {
|
if (shouldDestroyChildInstances === void 0) {
|
||||||
@@ -1804,6 +2000,22 @@
|
|||||||
originalDestroy();
|
originalDestroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
instance.enable = function () {
|
||||||
|
originalEnable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.enable();
|
||||||
|
});
|
||||||
|
disabled = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
instance.disable = function () {
|
||||||
|
originalDisable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.disable();
|
||||||
|
});
|
||||||
|
disabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
addEventListeners(instance);
|
addEventListeners(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1818,7 +2030,7 @@
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
|
if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
|
||||||
{
|
{
|
||||||
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
||||||
}
|
}
|
||||||
@@ -1943,6 +2155,7 @@
|
|||||||
|
|
||||||
if (isCursorOverReference || !instance.props.interactive) {
|
if (isCursorOverReference || !instance.props.interactive) {
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
var rect = reference.getBoundingClientRect();
|
var rect = reference.getBoundingClientRect();
|
||||||
var x = clientX;
|
var x = clientX;
|
||||||
@@ -2021,20 +2234,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMount: function onMount() {
|
onMount: function onMount() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor && !wasFocusEvent) {
|
||||||
if (isUnmounted) {
|
if (isUnmounted) {
|
||||||
onMouseMove(mouseCoords);
|
onMouseMove(mouseCoords);
|
||||||
isUnmounted = false;
|
isUnmounted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasFocusEvent && !getIsInitialBehavior()) {
|
if (!getIsInitialBehavior()) {
|
||||||
addListener();
|
addListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(_, _ref3) {
|
onTrigger: function onTrigger(_, event) {
|
||||||
var type = _ref3.type;
|
if (isMouseEvent(event)) {
|
||||||
wasFocusEvent = type === 'focus';
|
mouseCoords = {
|
||||||
|
clientX: event.clientX,
|
||||||
|
clientY: event.clientY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
wasFocusEvent = event.type === 'focus';
|
||||||
},
|
},
|
||||||
onHidden: function onHidden() {
|
onHidden: function onHidden() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor) {
|
||||||
@@ -2073,6 +2292,7 @@
|
|||||||
var placement;
|
var placement;
|
||||||
var cursorRectIndex = -1;
|
var cursorRectIndex = -1;
|
||||||
var isInternalUpdate = false;
|
var isInternalUpdate = false;
|
||||||
|
var triedPlacements = [];
|
||||||
var modifier = {
|
var modifier = {
|
||||||
name: 'tippyInlinePositioning',
|
name: 'tippyInlinePositioning',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -2081,8 +2301,14 @@
|
|||||||
var state = _ref2.state;
|
var state = _ref2.state;
|
||||||
|
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
if (placement !== state.placement) {
|
if (triedPlacements.indexOf(state.placement) !== -1) {
|
||||||
|
triedPlacements = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
|
||||||
|
triedPlacements.push(state.placement);
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
return _getReferenceClientRect(state.placement);
|
return _getReferenceClientRect(state.placement);
|
||||||
}
|
}
|
||||||
@@ -2119,10 +2345,11 @@
|
|||||||
var cursorRect = rects.find(function (rect) {
|
var cursorRect = rects.find(function (rect) {
|
||||||
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
||||||
});
|
});
|
||||||
cursorRectIndex = rects.indexOf(cursorRect);
|
var index = rects.indexOf(cursorRect);
|
||||||
|
cursorRectIndex = index > -1 ? index : cursorRectIndex;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUntrigger: function onUntrigger() {
|
onHidden: function onHidden() {
|
||||||
cursorRectIndex = -1;
|
cursorRectIndex = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
2
node_modules/tippy.js/dist/tippy.umd.js.map
generated
vendored
2
node_modules/tippy.js/dist/tippy.umd.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/tippy.js/dist/tippy.umd.min.js
generated
vendored
2
node_modules/tippy.js/dist/tippy.umd.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/tippy.js/dist/tippy.umd.min.js.map
generated
vendored
2
node_modules/tippy.js/dist/tippy.umd.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
389
node_modules/tippy.js/headless/dist/tippy-headless.cjs.js
generated
vendored
389
node_modules/tippy.js/headless/dist/tippy-headless.cjs.js
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
/**!
|
/**!
|
||||||
* tippy.js v6.2.5
|
* tippy.js v6.3.7
|
||||||
* (c) 2017-2020 atomiks
|
* (c) 2017-2021 atomiks
|
||||||
* MIT License
|
* MIT License
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -18,6 +18,9 @@ var TOUCH_OPTIONS = {
|
|||||||
passive: true,
|
passive: true,
|
||||||
capture: true
|
capture: true
|
||||||
};
|
};
|
||||||
|
var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
|
||||||
|
return document.body;
|
||||||
|
};
|
||||||
|
|
||||||
function hasOwnProperty(obj, key) {
|
function hasOwnProperty(obj, key) {
|
||||||
return {}.hasOwnProperty.call(obj, key);
|
return {}.hasOwnProperty.call(obj, key);
|
||||||
@@ -137,10 +140,13 @@ function setVisibilityState(els, state) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getOwnerDocument(elementOrElements) {
|
function getOwnerDocument(elementOrElements) {
|
||||||
var _normalizeToArray = normalizeToArray(elementOrElements),
|
var _element$ownerDocumen;
|
||||||
element = _normalizeToArray[0];
|
|
||||||
|
|
||||||
return element ? element.ownerDocument || document : document;
|
var _normalizeToArray = normalizeToArray(elementOrElements),
|
||||||
|
element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
|
||||||
|
|
||||||
|
|
||||||
|
return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
|
||||||
}
|
}
|
||||||
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
||||||
var clientX = event.clientX,
|
var clientX = event.clientX,
|
||||||
@@ -176,6 +182,26 @@ function updateTransitionEndListener(box, action, listener) {
|
|||||||
box[method](event, listener);
|
box[method](event, listener);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Compared to xxx.contains, this function works for dom structures with shadow
|
||||||
|
* dom
|
||||||
|
*/
|
||||||
|
|
||||||
|
function actualContains(parent, child) {
|
||||||
|
var target = child;
|
||||||
|
|
||||||
|
while (target) {
|
||||||
|
var _target$getRootNode;
|
||||||
|
|
||||||
|
if (parent.contains(target)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var currentInput = {
|
var currentInput = {
|
||||||
isTouch: false
|
isTouch: false
|
||||||
@@ -239,8 +265,8 @@ function bindGlobalEventListeners() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||||
var ua = isBrowser ? navigator.userAgent : '';
|
var isIE11 = isBrowser ? // @ts-ignore
|
||||||
var isIE = /MSIE |Trident\//.test(ua);
|
!!window.msCrypto : false;
|
||||||
|
|
||||||
function createMemoryLeakWarning(method) {
|
function createMemoryLeakWarning(method) {
|
||||||
var txt = method === 'destroy' ? 'n already-' : ' ';
|
var txt = method === 'destroy' ? 'n already-' : ' ';
|
||||||
@@ -315,9 +341,7 @@ var renderProps = {
|
|||||||
zIndex: 9999
|
zIndex: 9999
|
||||||
};
|
};
|
||||||
var defaultProps = Object.assign({
|
var defaultProps = Object.assign({
|
||||||
appendTo: function appendTo() {
|
appendTo: TIPPY_DEFAULT_APPEND_TO,
|
||||||
return document.body;
|
|
||||||
},
|
|
||||||
aria: {
|
aria: {
|
||||||
content: 'auto',
|
content: 'auto',
|
||||||
expanded: 'auto'
|
expanded: 'auto'
|
||||||
@@ -352,7 +376,7 @@ var defaultProps = Object.assign({
|
|||||||
touch: true,
|
touch: true,
|
||||||
trigger: 'mouseenter focus',
|
trigger: 'mouseenter focus',
|
||||||
triggerTarget: null
|
triggerTarget: null
|
||||||
}, pluginProps, {}, renderProps);
|
}, pluginProps, renderProps);
|
||||||
var defaultKeys = Object.keys(defaultProps);
|
var defaultKeys = Object.keys(defaultProps);
|
||||||
var setDefaultProps = function setDefaultProps(partialProps) {
|
var setDefaultProps = function setDefaultProps(partialProps) {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
@@ -372,12 +396,14 @@ function getExtendedPassedProps(passedProps) {
|
|||||||
defaultValue = plugin.defaultValue;
|
defaultValue = plugin.defaultValue;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
|
var _name;
|
||||||
|
|
||||||
|
acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
return Object.assign({}, passedProps, {}, pluginProps);
|
return Object.assign({}, passedProps, pluginProps);
|
||||||
}
|
}
|
||||||
function getDataAttributeProps(reference, plugins) {
|
function getDataAttributeProps(reference, plugins) {
|
||||||
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
||||||
@@ -408,7 +434,7 @@ function evaluateProps(reference, props) {
|
|||||||
var out = Object.assign({}, props, {
|
var out = Object.assign({}, props, {
|
||||||
content: invokeWithArgsOrReturn(props.content, [reference])
|
content: invokeWithArgsOrReturn(props.content, [reference])
|
||||||
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
||||||
out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
|
out.aria = Object.assign({}, defaultProps.aria, out.aria);
|
||||||
out.aria = {
|
out.aria = {
|
||||||
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
||||||
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
||||||
@@ -461,7 +487,7 @@ var mouseMoveListeners = []; // Used by `hideAll()`
|
|||||||
|
|
||||||
var mountedInstances = [];
|
var mountedInstances = [];
|
||||||
function createTippy(reference, passedProps) {
|
function createTippy(reference, passedProps) {
|
||||||
var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
||||||
// 🔒 Private members
|
// 🔒 Private members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -477,8 +503,7 @@ function createTippy(reference, passedProps) {
|
|||||||
var onFirstUpdate;
|
var onFirstUpdate;
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
||||||
var currentTarget;
|
var currentTarget; // ===========================================================================
|
||||||
var doc = getOwnerDocument(props.triggerTarget || reference); // ===========================================================================
|
|
||||||
// 🔑 Public members
|
// 🔑 Public members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -562,10 +587,9 @@ function createTippy(reference, passedProps) {
|
|||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popper.addEventListener('mouseleave', function (event) {
|
popper.addEventListener('mouseleave', function () {
|
||||||
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return instance; // ===========================================================================
|
return instance; // ===========================================================================
|
||||||
@@ -585,13 +609,18 @@ function createTippy(reference, passedProps) {
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
|
return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentTarget() {
|
function getCurrentTarget() {
|
||||||
return currentTarget || reference;
|
return currentTarget || reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDocument() {
|
||||||
|
var parent = getCurrentTarget().parentNode;
|
||||||
|
return parent ? getOwnerDocument(parent) : document;
|
||||||
|
}
|
||||||
|
|
||||||
function getDefaultTemplateChildren() {
|
function getDefaultTemplateChildren() {
|
||||||
return getChildren(popper);
|
return getChildren(popper);
|
||||||
}
|
}
|
||||||
@@ -607,8 +636,12 @@ function createTippy(reference, passedProps) {
|
|||||||
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleStyles() {
|
function handleStyles(fromHide) {
|
||||||
popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
|
if (fromHide === void 0) {
|
||||||
|
fromHide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
|
||||||
popper.style.zIndex = "" + instance.props.zIndex;
|
popper.style.zIndex = "" + instance.props.zIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,7 +652,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
pluginsHooks.forEach(function (pluginHooks) {
|
pluginsHooks.forEach(function (pluginHooks) {
|
||||||
if (pluginHooks[hook]) {
|
if (pluginHooks[hook]) {
|
||||||
pluginHooks[hook].apply(void 0, args);
|
pluginHooks[hook].apply(pluginHooks, args);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -673,7 +706,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanupInteractiveMouseListeners() {
|
function cleanupInteractiveMouseListeners() {
|
||||||
doc.removeEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
|
||||||
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
||||||
return listener !== debouncedOnMouseMove;
|
return listener !== debouncedOnMouseMove;
|
||||||
});
|
});
|
||||||
@@ -685,15 +718,18 @@ function createTippy(reference, passedProps) {
|
|||||||
if (didTouchMove || event.type === 'mousedown') {
|
if (didTouchMove || event.type === 'mousedown') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} // Clicked on interactive popper
|
}
|
||||||
|
|
||||||
|
var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
|
||||||
|
|
||||||
if (instance.props.interactive && popper.contains(event.target)) {
|
if (instance.props.interactive && actualContains(popper, actualTarget)) {
|
||||||
return;
|
return;
|
||||||
} // Clicked on the event listeners target
|
} // Clicked on the event listeners target
|
||||||
|
|
||||||
|
|
||||||
if (getCurrentTarget().contains(event.target)) {
|
if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
|
||||||
|
return actualContains(el, actualTarget);
|
||||||
|
})) {
|
||||||
if (currentInput.isTouch) {
|
if (currentInput.isTouch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -706,7 +742,6 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (instance.props.hideOnClick === true) {
|
if (instance.props.hideOnClick === true) {
|
||||||
isVisibleFromClick = false;
|
|
||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
||||||
// currentTarget. This lets a tippy with `focus` trigger know that it
|
// currentTarget. This lets a tippy with `focus` trigger know that it
|
||||||
@@ -734,6 +769,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addDocumentPress() {
|
function addDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.addEventListener('mousedown', onDocumentPress, true);
|
doc.addEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -741,6 +777,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeDocumentPress() {
|
function removeDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.removeEventListener('mousedown', onDocumentPress, true);
|
doc.removeEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -820,7 +857,7 @@ function createTippy(reference, passedProps) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focus':
|
case 'focus':
|
||||||
on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
|
on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focusin':
|
case 'focusin':
|
||||||
@@ -883,7 +920,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
function onMouseMove(event) {
|
function onMouseMove(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
var isCursorOverReferenceOrPopper = reference.contains(target) || popper.contains(target);
|
var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
|
||||||
|
|
||||||
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
||||||
return;
|
return;
|
||||||
@@ -1046,7 +1083,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
var node = getCurrentTarget();
|
var node = getCurrentTarget();
|
||||||
|
|
||||||
if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
|
if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
|
||||||
parentNode = node.parentNode;
|
parentNode = node.parentNode;
|
||||||
} else {
|
} else {
|
||||||
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
||||||
@@ -1058,6 +1095,7 @@ function createTippy(reference, passedProps) {
|
|||||||
parentNode.appendChild(popper);
|
parentNode.appendChild(popper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance.state.isMounted = true;
|
||||||
createPopperInstance();
|
createPopperInstance();
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
|
|
||||||
@@ -1165,7 +1203,7 @@ function createTippy(reference, passedProps) {
|
|||||||
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
||||||
removeListeners();
|
removeListeners();
|
||||||
var prevProps = instance.props;
|
var prevProps = instance.props;
|
||||||
var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
|
var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
|
||||||
ignoreAttributes: true
|
ignoreAttributes: true
|
||||||
}));
|
}));
|
||||||
instance.props = nextProps;
|
instance.props = nextProps;
|
||||||
@@ -1268,6 +1306,8 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFirstUpdate = function onFirstUpdate() {
|
onFirstUpdate = function onFirstUpdate() {
|
||||||
|
var _instance$popperInsta2;
|
||||||
|
|
||||||
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1288,8 +1328,10 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
handleAriaContentAttribute();
|
handleAriaContentAttribute();
|
||||||
handleAriaExpandedAttribute();
|
handleAriaExpandedAttribute();
|
||||||
pushIfUnique(mountedInstances, instance);
|
pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
|
||||||
instance.state.isMounted = true;
|
// popper has been positioned for the first time
|
||||||
|
|
||||||
|
(_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
|
||||||
invokeHook('onMount', [instance]);
|
invokeHook('onMount', [instance]);
|
||||||
|
|
||||||
if (instance.props.animation && getIsDefaultRenderFn()) {
|
if (instance.props.animation && getIsDefaultRenderFn()) {
|
||||||
@@ -1328,6 +1370,7 @@ function createTippy(reference, passedProps) {
|
|||||||
instance.state.isVisible = false;
|
instance.state.isVisible = false;
|
||||||
instance.state.isShown = false;
|
instance.state.isShown = false;
|
||||||
ignoreOnFirstUpdate = false;
|
ignoreOnFirstUpdate = false;
|
||||||
|
isVisibleFromClick = false;
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
popper.style.visibility = 'hidden';
|
popper.style.visibility = 'hidden';
|
||||||
@@ -1335,7 +1378,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
cleanupInteractiveMouseListeners();
|
cleanupInteractiveMouseListeners();
|
||||||
removeDocumentPress();
|
removeDocumentPress();
|
||||||
handleStyles();
|
handleStyles(true);
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
||||||
@@ -1366,7 +1409,7 @@ function createTippy(reference, passedProps) {
|
|||||||
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
debouncedOnMouseMove(event);
|
||||||
}
|
}
|
||||||
@@ -1492,7 +1535,39 @@ var hideAll = function hideAll(_temp) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// every time the popper is destroyed (i.e. a new target), removing the styles
|
||||||
|
// and causing transitions to break for singletons when the console is open, but
|
||||||
|
// most notably for non-transform styles being used, `gpuAcceleration: false`.
|
||||||
|
|
||||||
|
var applyStylesModifier = Object.assign({}, core.applyStyles, {
|
||||||
|
effect: function effect(_ref) {
|
||||||
|
var state = _ref.state;
|
||||||
|
var initialStyles = {
|
||||||
|
popper: {
|
||||||
|
position: state.options.strategy,
|
||||||
|
left: '0',
|
||||||
|
top: '0',
|
||||||
|
margin: '0'
|
||||||
|
},
|
||||||
|
arrow: {
|
||||||
|
position: 'absolute'
|
||||||
|
},
|
||||||
|
reference: {}
|
||||||
|
};
|
||||||
|
Object.assign(state.elements.popper.style, initialStyles.popper);
|
||||||
|
state.styles = initialStyles;
|
||||||
|
|
||||||
|
if (state.elements.arrow) {
|
||||||
|
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
||||||
|
} // intentionally return no cleanup function
|
||||||
|
// return () => { ... }
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
||||||
|
var _optionalProps$popper;
|
||||||
|
|
||||||
if (optionalProps === void 0) {
|
if (optionalProps === void 0) {
|
||||||
optionalProps = {};
|
optionalProps = {};
|
||||||
}
|
}
|
||||||
@@ -1502,19 +1577,30 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|||||||
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
var mutTippyInstances = tippyInstances;
|
var individualInstances = tippyInstances;
|
||||||
var references = [];
|
var references = [];
|
||||||
|
var triggerTargets = [];
|
||||||
var currentTarget;
|
var currentTarget;
|
||||||
var overrides = optionalProps.overrides;
|
var overrides = optionalProps.overrides;
|
||||||
|
var interceptSetPropsCleanups = [];
|
||||||
|
var shownOnCreate = false;
|
||||||
|
|
||||||
|
function setTriggerTargets() {
|
||||||
|
triggerTargets = individualInstances.map(function (instance) {
|
||||||
|
return normalizeToArray(instance.props.triggerTarget || instance.reference);
|
||||||
|
}).reduce(function (acc, item) {
|
||||||
|
return acc.concat(item);
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
function setReferences() {
|
function setReferences() {
|
||||||
references = mutTippyInstances.map(function (instance) {
|
references = individualInstances.map(function (instance) {
|
||||||
return instance.reference;
|
return instance.reference;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableInstances(isEnabled) {
|
function enableInstances(isEnabled) {
|
||||||
mutTippyInstances.forEach(function (instance) {
|
individualInstances.forEach(function (instance) {
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
instance.enable();
|
instance.enable();
|
||||||
} else {
|
} else {
|
||||||
@@ -1523,58 +1609,163 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function interceptSetProps(singleton) {
|
||||||
|
return individualInstances.map(function (instance) {
|
||||||
|
var originalSetProps = instance.setProps;
|
||||||
|
|
||||||
|
instance.setProps = function (props) {
|
||||||
|
originalSetProps(props);
|
||||||
|
|
||||||
|
if (instance.reference === currentTarget) {
|
||||||
|
singleton.setProps(props);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
instance.setProps = originalSetProps;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} // have to pass singleton, as it maybe undefined on first call
|
||||||
|
|
||||||
|
|
||||||
|
function prepareInstance(singleton, target) {
|
||||||
|
var index = triggerTargets.indexOf(target); // bail-out
|
||||||
|
|
||||||
|
if (target === currentTarget) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTarget = target;
|
||||||
|
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
||||||
|
acc[prop] = individualInstances[index].props[prop];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
singleton.setProps(Object.assign({}, overrideProps, {
|
||||||
|
getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
|
||||||
|
var _references$index;
|
||||||
|
|
||||||
|
return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
var singleton = {
|
setTriggerTargets();
|
||||||
|
var plugin = {
|
||||||
fn: function fn() {
|
fn: function fn() {
|
||||||
return {
|
return {
|
||||||
onDestroy: function onDestroy() {
|
onDestroy: function onDestroy() {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(instance, event) {
|
onHidden: function onHidden() {
|
||||||
var target = event.currentTarget;
|
currentTarget = null;
|
||||||
var index = references.indexOf(target); // bail-out
|
},
|
||||||
|
onClickOutside: function onClickOutside(instance) {
|
||||||
if (target === currentTarget) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
return;
|
shownOnCreate = true;
|
||||||
|
currentTarget = null;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
currentTarget = target;
|
onShow: function onShow(instance) {
|
||||||
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
acc[prop] = mutTippyInstances[index].props[prop];
|
shownOnCreate = true;
|
||||||
return acc;
|
prepareInstance(instance, references[0]);
|
||||||
}, {});
|
}
|
||||||
instance.setProps(Object.assign({}, overrideProps, {
|
},
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
onTrigger: function onTrigger(instance, event) {
|
||||||
return target.getBoundingClientRect();
|
prepareInstance(instance, event.currentTarget);
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var instance = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
||||||
plugins: [singleton].concat(optionalProps.plugins || []),
|
plugins: [plugin].concat(optionalProps.plugins || []),
|
||||||
triggerTarget: references
|
triggerTarget: triggerTargets,
|
||||||
|
popperOptions: Object.assign({}, optionalProps.popperOptions, {
|
||||||
|
modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
|
||||||
|
})
|
||||||
}));
|
}));
|
||||||
var originalSetProps = instance.setProps;
|
var originalShow = singleton.show;
|
||||||
|
|
||||||
instance.setProps = function (props) {
|
singleton.show = function (target) {
|
||||||
|
originalShow(); // first time, showOnCreate or programmatic call with no params
|
||||||
|
// default to showing first instance
|
||||||
|
|
||||||
|
if (!currentTarget && target == null) {
|
||||||
|
return prepareInstance(singleton, references[0]);
|
||||||
|
} // triggered from event (do nothing as prepareInstance already called by onTrigger)
|
||||||
|
// programmatic call with no params when already visible (do nothing again)
|
||||||
|
|
||||||
|
|
||||||
|
if (currentTarget && target == null) {
|
||||||
|
return;
|
||||||
|
} // target is index of instance
|
||||||
|
|
||||||
|
|
||||||
|
if (typeof target === 'number') {
|
||||||
|
return references[target] && prepareInstance(singleton, references[target]);
|
||||||
|
} // target is a child tippy instance
|
||||||
|
|
||||||
|
|
||||||
|
if (individualInstances.indexOf(target) >= 0) {
|
||||||
|
var ref = target.reference;
|
||||||
|
return prepareInstance(singleton, ref);
|
||||||
|
} // target is a ReferenceElement
|
||||||
|
|
||||||
|
|
||||||
|
if (references.indexOf(target) >= 0) {
|
||||||
|
return prepareInstance(singleton, target);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showNext = function () {
|
||||||
|
var first = references[0];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
singleton.show(references[index + 1] || first);
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showPrevious = function () {
|
||||||
|
var last = references[references.length - 1];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(last);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
var target = references[index - 1] || last;
|
||||||
|
singleton.show(target);
|
||||||
|
};
|
||||||
|
|
||||||
|
var originalSetProps = singleton.setProps;
|
||||||
|
|
||||||
|
singleton.setProps = function (props) {
|
||||||
overrides = props.overrides || overrides;
|
overrides = props.overrides || overrides;
|
||||||
originalSetProps(props);
|
originalSetProps(props);
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.setInstances = function (nextInstances) {
|
singleton.setInstances = function (nextInstances) {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
mutTippyInstances = nextInstances;
|
interceptSetPropsCleanups.forEach(function (fn) {
|
||||||
|
return fn();
|
||||||
|
});
|
||||||
|
individualInstances = nextInstances;
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
instance.setProps({
|
setTriggerTargets();
|
||||||
triggerTarget: references
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
singleton.setProps({
|
||||||
|
triggerTarget: triggerTargets
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return instance;
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
return singleton;
|
||||||
};
|
};
|
||||||
|
|
||||||
var BUBBLING_EVENTS_MAP = {
|
var BUBBLING_EVENTS_MAP = {
|
||||||
@@ -1595,20 +1786,23 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var childTippyInstances = [];
|
var childTippyInstances = [];
|
||||||
|
var disabled = false;
|
||||||
var target = props.target;
|
var target = props.target;
|
||||||
var nativeProps = removeProperties(props, ['target']);
|
var nativeProps = removeProperties(props, ['target']);
|
||||||
var parentProps = Object.assign({}, nativeProps, {
|
var parentProps = Object.assign({}, nativeProps, {
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
touch: false
|
touch: false
|
||||||
});
|
});
|
||||||
var childProps = Object.assign({}, nativeProps, {
|
var childProps = Object.assign({
|
||||||
|
touch: defaultProps.touch
|
||||||
|
}, nativeProps, {
|
||||||
showOnCreate: true
|
showOnCreate: true
|
||||||
});
|
});
|
||||||
var returnValue = tippy(targets, parentProps);
|
var returnValue = tippy(targets, parentProps);
|
||||||
var normalizedReturnValue = normalizeToArray(returnValue);
|
var normalizedReturnValue = normalizeToArray(returnValue);
|
||||||
|
|
||||||
function onTrigger(event) {
|
function onTrigger(event) {
|
||||||
if (!event.target) {
|
if (!event.target || disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1632,7 +1826,7 @@ function delegate(targets, props) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type])) {
|
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type]) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1659,7 +1853,7 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
function addEventListeners(instance) {
|
function addEventListeners(instance) {
|
||||||
var reference = instance.reference;
|
var reference = instance.reference;
|
||||||
on(reference, 'touchstart', onTrigger);
|
on(reference, 'touchstart', onTrigger, TOUCH_OPTIONS);
|
||||||
on(reference, 'mouseover', onTrigger);
|
on(reference, 'mouseover', onTrigger);
|
||||||
on(reference, 'focusin', onTrigger);
|
on(reference, 'focusin', onTrigger);
|
||||||
on(reference, 'click', onTrigger);
|
on(reference, 'click', onTrigger);
|
||||||
@@ -1678,6 +1872,8 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
function applyMutations(instance) {
|
function applyMutations(instance) {
|
||||||
var originalDestroy = instance.destroy;
|
var originalDestroy = instance.destroy;
|
||||||
|
var originalEnable = instance.enable;
|
||||||
|
var originalDisable = instance.disable;
|
||||||
|
|
||||||
instance.destroy = function (shouldDestroyChildInstances) {
|
instance.destroy = function (shouldDestroyChildInstances) {
|
||||||
if (shouldDestroyChildInstances === void 0) {
|
if (shouldDestroyChildInstances === void 0) {
|
||||||
@@ -1695,6 +1891,22 @@ function delegate(targets, props) {
|
|||||||
originalDestroy();
|
originalDestroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
instance.enable = function () {
|
||||||
|
originalEnable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.enable();
|
||||||
|
});
|
||||||
|
disabled = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
instance.disable = function () {
|
||||||
|
originalDisable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.disable();
|
||||||
|
});
|
||||||
|
disabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
addEventListeners(instance);
|
addEventListeners(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1709,7 +1921,7 @@ var animateFill = {
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
|
if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== "production") {
|
||||||
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
||||||
}
|
}
|
||||||
@@ -1834,6 +2046,7 @@ var followCursor = {
|
|||||||
|
|
||||||
if (isCursorOverReference || !instance.props.interactive) {
|
if (isCursorOverReference || !instance.props.interactive) {
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
var rect = reference.getBoundingClientRect();
|
var rect = reference.getBoundingClientRect();
|
||||||
var x = clientX;
|
var x = clientX;
|
||||||
@@ -1912,20 +2125,26 @@ var followCursor = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMount: function onMount() {
|
onMount: function onMount() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor && !wasFocusEvent) {
|
||||||
if (isUnmounted) {
|
if (isUnmounted) {
|
||||||
onMouseMove(mouseCoords);
|
onMouseMove(mouseCoords);
|
||||||
isUnmounted = false;
|
isUnmounted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasFocusEvent && !getIsInitialBehavior()) {
|
if (!getIsInitialBehavior()) {
|
||||||
addListener();
|
addListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(_, _ref3) {
|
onTrigger: function onTrigger(_, event) {
|
||||||
var type = _ref3.type;
|
if (isMouseEvent(event)) {
|
||||||
wasFocusEvent = type === 'focus';
|
mouseCoords = {
|
||||||
|
clientX: event.clientX,
|
||||||
|
clientY: event.clientY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
wasFocusEvent = event.type === 'focus';
|
||||||
},
|
},
|
||||||
onHidden: function onHidden() {
|
onHidden: function onHidden() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor) {
|
||||||
@@ -1964,6 +2183,7 @@ var inlinePositioning = {
|
|||||||
var placement;
|
var placement;
|
||||||
var cursorRectIndex = -1;
|
var cursorRectIndex = -1;
|
||||||
var isInternalUpdate = false;
|
var isInternalUpdate = false;
|
||||||
|
var triedPlacements = [];
|
||||||
var modifier = {
|
var modifier = {
|
||||||
name: 'tippyInlinePositioning',
|
name: 'tippyInlinePositioning',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -1972,8 +2192,14 @@ var inlinePositioning = {
|
|||||||
var state = _ref2.state;
|
var state = _ref2.state;
|
||||||
|
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
if (placement !== state.placement) {
|
if (triedPlacements.indexOf(state.placement) !== -1) {
|
||||||
|
triedPlacements = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
|
||||||
|
triedPlacements.push(state.placement);
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
return _getReferenceClientRect(state.placement);
|
return _getReferenceClientRect(state.placement);
|
||||||
}
|
}
|
||||||
@@ -2010,10 +2236,11 @@ var inlinePositioning = {
|
|||||||
var cursorRect = rects.find(function (rect) {
|
var cursorRect = rects.find(function (rect) {
|
||||||
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
||||||
});
|
});
|
||||||
cursorRectIndex = rects.indexOf(cursorRect);
|
var index = rects.indexOf(cursorRect);
|
||||||
|
cursorRectIndex = index > -1 ? index : cursorRectIndex;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUntrigger: function onUntrigger() {
|
onHidden: function onHidden() {
|
||||||
cursorRectIndex = -1;
|
cursorRectIndex = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
2
node_modules/tippy.js/headless/dist/tippy-headless.cjs.js.map
generated
vendored
2
node_modules/tippy.js/headless/dist/tippy-headless.cjs.js.map
generated
vendored
File diff suppressed because one or more lines are too long
391
node_modules/tippy.js/headless/dist/tippy-headless.esm.js
generated
vendored
391
node_modules/tippy.js/headless/dist/tippy-headless.esm.js
generated
vendored
@@ -1,9 +1,9 @@
|
|||||||
/**!
|
/**!
|
||||||
* tippy.js v6.2.5
|
* tippy.js v6.3.7
|
||||||
* (c) 2017-2020 atomiks
|
* (c) 2017-2021 atomiks
|
||||||
* MIT License
|
* MIT License
|
||||||
*/
|
*/
|
||||||
import { createPopper } from '@popperjs/core';
|
import { createPopper, applyStyles } from '@popperjs/core';
|
||||||
|
|
||||||
var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>';
|
var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>';
|
||||||
var CONTENT_CLASS = "tippy-content";
|
var CONTENT_CLASS = "tippy-content";
|
||||||
@@ -14,6 +14,9 @@ var TOUCH_OPTIONS = {
|
|||||||
passive: true,
|
passive: true,
|
||||||
capture: true
|
capture: true
|
||||||
};
|
};
|
||||||
|
var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
|
||||||
|
return document.body;
|
||||||
|
};
|
||||||
|
|
||||||
function hasOwnProperty(obj, key) {
|
function hasOwnProperty(obj, key) {
|
||||||
return {}.hasOwnProperty.call(obj, key);
|
return {}.hasOwnProperty.call(obj, key);
|
||||||
@@ -133,10 +136,13 @@ function setVisibilityState(els, state) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getOwnerDocument(elementOrElements) {
|
function getOwnerDocument(elementOrElements) {
|
||||||
var _normalizeToArray = normalizeToArray(elementOrElements),
|
var _element$ownerDocumen;
|
||||||
element = _normalizeToArray[0];
|
|
||||||
|
|
||||||
return element ? element.ownerDocument || document : document;
|
var _normalizeToArray = normalizeToArray(elementOrElements),
|
||||||
|
element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
|
||||||
|
|
||||||
|
|
||||||
|
return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
|
||||||
}
|
}
|
||||||
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
||||||
var clientX = event.clientX,
|
var clientX = event.clientX,
|
||||||
@@ -172,6 +178,26 @@ function updateTransitionEndListener(box, action, listener) {
|
|||||||
box[method](event, listener);
|
box[method](event, listener);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Compared to xxx.contains, this function works for dom structures with shadow
|
||||||
|
* dom
|
||||||
|
*/
|
||||||
|
|
||||||
|
function actualContains(parent, child) {
|
||||||
|
var target = child;
|
||||||
|
|
||||||
|
while (target) {
|
||||||
|
var _target$getRootNode;
|
||||||
|
|
||||||
|
if (parent.contains(target)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var currentInput = {
|
var currentInput = {
|
||||||
isTouch: false
|
isTouch: false
|
||||||
@@ -235,8 +261,8 @@ function bindGlobalEventListeners() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||||
var ua = isBrowser ? navigator.userAgent : '';
|
var isIE11 = isBrowser ? // @ts-ignore
|
||||||
var isIE = /MSIE |Trident\//.test(ua);
|
!!window.msCrypto : false;
|
||||||
|
|
||||||
function createMemoryLeakWarning(method) {
|
function createMemoryLeakWarning(method) {
|
||||||
var txt = method === 'destroy' ? 'n already-' : ' ';
|
var txt = method === 'destroy' ? 'n already-' : ' ';
|
||||||
@@ -311,9 +337,7 @@ var renderProps = {
|
|||||||
zIndex: 9999
|
zIndex: 9999
|
||||||
};
|
};
|
||||||
var defaultProps = Object.assign({
|
var defaultProps = Object.assign({
|
||||||
appendTo: function appendTo() {
|
appendTo: TIPPY_DEFAULT_APPEND_TO,
|
||||||
return document.body;
|
|
||||||
},
|
|
||||||
aria: {
|
aria: {
|
||||||
content: 'auto',
|
content: 'auto',
|
||||||
expanded: 'auto'
|
expanded: 'auto'
|
||||||
@@ -348,7 +372,7 @@ var defaultProps = Object.assign({
|
|||||||
touch: true,
|
touch: true,
|
||||||
trigger: 'mouseenter focus',
|
trigger: 'mouseenter focus',
|
||||||
triggerTarget: null
|
triggerTarget: null
|
||||||
}, pluginProps, {}, renderProps);
|
}, pluginProps, renderProps);
|
||||||
var defaultKeys = Object.keys(defaultProps);
|
var defaultKeys = Object.keys(defaultProps);
|
||||||
var setDefaultProps = function setDefaultProps(partialProps) {
|
var setDefaultProps = function setDefaultProps(partialProps) {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
@@ -368,12 +392,14 @@ function getExtendedPassedProps(passedProps) {
|
|||||||
defaultValue = plugin.defaultValue;
|
defaultValue = plugin.defaultValue;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
|
var _name;
|
||||||
|
|
||||||
|
acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
return Object.assign({}, passedProps, {}, pluginProps);
|
return Object.assign({}, passedProps, pluginProps);
|
||||||
}
|
}
|
||||||
function getDataAttributeProps(reference, plugins) {
|
function getDataAttributeProps(reference, plugins) {
|
||||||
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
||||||
@@ -404,7 +430,7 @@ function evaluateProps(reference, props) {
|
|||||||
var out = Object.assign({}, props, {
|
var out = Object.assign({}, props, {
|
||||||
content: invokeWithArgsOrReturn(props.content, [reference])
|
content: invokeWithArgsOrReturn(props.content, [reference])
|
||||||
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
||||||
out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
|
out.aria = Object.assign({}, defaultProps.aria, out.aria);
|
||||||
out.aria = {
|
out.aria = {
|
||||||
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
||||||
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
||||||
@@ -457,7 +483,7 @@ var mouseMoveListeners = []; // Used by `hideAll()`
|
|||||||
|
|
||||||
var mountedInstances = [];
|
var mountedInstances = [];
|
||||||
function createTippy(reference, passedProps) {
|
function createTippy(reference, passedProps) {
|
||||||
var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
||||||
// 🔒 Private members
|
// 🔒 Private members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -473,8 +499,7 @@ function createTippy(reference, passedProps) {
|
|||||||
var onFirstUpdate;
|
var onFirstUpdate;
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
||||||
var currentTarget;
|
var currentTarget; // ===========================================================================
|
||||||
var doc = getOwnerDocument(props.triggerTarget || reference); // ===========================================================================
|
|
||||||
// 🔑 Public members
|
// 🔑 Public members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -558,10 +583,9 @@ function createTippy(reference, passedProps) {
|
|||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popper.addEventListener('mouseleave', function (event) {
|
popper.addEventListener('mouseleave', function () {
|
||||||
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return instance; // ===========================================================================
|
return instance; // ===========================================================================
|
||||||
@@ -581,13 +605,18 @@ function createTippy(reference, passedProps) {
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
|
return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentTarget() {
|
function getCurrentTarget() {
|
||||||
return currentTarget || reference;
|
return currentTarget || reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDocument() {
|
||||||
|
var parent = getCurrentTarget().parentNode;
|
||||||
|
return parent ? getOwnerDocument(parent) : document;
|
||||||
|
}
|
||||||
|
|
||||||
function getDefaultTemplateChildren() {
|
function getDefaultTemplateChildren() {
|
||||||
return getChildren(popper);
|
return getChildren(popper);
|
||||||
}
|
}
|
||||||
@@ -603,8 +632,12 @@ function createTippy(reference, passedProps) {
|
|||||||
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleStyles() {
|
function handleStyles(fromHide) {
|
||||||
popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
|
if (fromHide === void 0) {
|
||||||
|
fromHide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
|
||||||
popper.style.zIndex = "" + instance.props.zIndex;
|
popper.style.zIndex = "" + instance.props.zIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,7 +648,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
pluginsHooks.forEach(function (pluginHooks) {
|
pluginsHooks.forEach(function (pluginHooks) {
|
||||||
if (pluginHooks[hook]) {
|
if (pluginHooks[hook]) {
|
||||||
pluginHooks[hook].apply(void 0, args);
|
pluginHooks[hook].apply(pluginHooks, args);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -669,7 +702,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanupInteractiveMouseListeners() {
|
function cleanupInteractiveMouseListeners() {
|
||||||
doc.removeEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
|
||||||
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
||||||
return listener !== debouncedOnMouseMove;
|
return listener !== debouncedOnMouseMove;
|
||||||
});
|
});
|
||||||
@@ -681,15 +714,18 @@ function createTippy(reference, passedProps) {
|
|||||||
if (didTouchMove || event.type === 'mousedown') {
|
if (didTouchMove || event.type === 'mousedown') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} // Clicked on interactive popper
|
}
|
||||||
|
|
||||||
|
var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
|
||||||
|
|
||||||
if (instance.props.interactive && popper.contains(event.target)) {
|
if (instance.props.interactive && actualContains(popper, actualTarget)) {
|
||||||
return;
|
return;
|
||||||
} // Clicked on the event listeners target
|
} // Clicked on the event listeners target
|
||||||
|
|
||||||
|
|
||||||
if (getCurrentTarget().contains(event.target)) {
|
if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
|
||||||
|
return actualContains(el, actualTarget);
|
||||||
|
})) {
|
||||||
if (currentInput.isTouch) {
|
if (currentInput.isTouch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -702,7 +738,6 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (instance.props.hideOnClick === true) {
|
if (instance.props.hideOnClick === true) {
|
||||||
isVisibleFromClick = false;
|
|
||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
||||||
// currentTarget. This lets a tippy with `focus` trigger know that it
|
// currentTarget. This lets a tippy with `focus` trigger know that it
|
||||||
@@ -730,6 +765,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addDocumentPress() {
|
function addDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.addEventListener('mousedown', onDocumentPress, true);
|
doc.addEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -737,6 +773,7 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeDocumentPress() {
|
function removeDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.removeEventListener('mousedown', onDocumentPress, true);
|
doc.removeEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -816,7 +853,7 @@ function createTippy(reference, passedProps) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focus':
|
case 'focus':
|
||||||
on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
|
on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focusin':
|
case 'focusin':
|
||||||
@@ -879,7 +916,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
function onMouseMove(event) {
|
function onMouseMove(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
var isCursorOverReferenceOrPopper = reference.contains(target) || popper.contains(target);
|
var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
|
||||||
|
|
||||||
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
||||||
return;
|
return;
|
||||||
@@ -1042,7 +1079,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
var node = getCurrentTarget();
|
var node = getCurrentTarget();
|
||||||
|
|
||||||
if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
|
if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
|
||||||
parentNode = node.parentNode;
|
parentNode = node.parentNode;
|
||||||
} else {
|
} else {
|
||||||
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
||||||
@@ -1054,6 +1091,7 @@ function createTippy(reference, passedProps) {
|
|||||||
parentNode.appendChild(popper);
|
parentNode.appendChild(popper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance.state.isMounted = true;
|
||||||
createPopperInstance();
|
createPopperInstance();
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
|
|
||||||
@@ -1161,7 +1199,7 @@ function createTippy(reference, passedProps) {
|
|||||||
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
||||||
removeListeners();
|
removeListeners();
|
||||||
var prevProps = instance.props;
|
var prevProps = instance.props;
|
||||||
var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
|
var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
|
||||||
ignoreAttributes: true
|
ignoreAttributes: true
|
||||||
}));
|
}));
|
||||||
instance.props = nextProps;
|
instance.props = nextProps;
|
||||||
@@ -1264,6 +1302,8 @@ function createTippy(reference, passedProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFirstUpdate = function onFirstUpdate() {
|
onFirstUpdate = function onFirstUpdate() {
|
||||||
|
var _instance$popperInsta2;
|
||||||
|
|
||||||
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1284,8 +1324,10 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
handleAriaContentAttribute();
|
handleAriaContentAttribute();
|
||||||
handleAriaExpandedAttribute();
|
handleAriaExpandedAttribute();
|
||||||
pushIfUnique(mountedInstances, instance);
|
pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
|
||||||
instance.state.isMounted = true;
|
// popper has been positioned for the first time
|
||||||
|
|
||||||
|
(_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
|
||||||
invokeHook('onMount', [instance]);
|
invokeHook('onMount', [instance]);
|
||||||
|
|
||||||
if (instance.props.animation && getIsDefaultRenderFn()) {
|
if (instance.props.animation && getIsDefaultRenderFn()) {
|
||||||
@@ -1324,6 +1366,7 @@ function createTippy(reference, passedProps) {
|
|||||||
instance.state.isVisible = false;
|
instance.state.isVisible = false;
|
||||||
instance.state.isShown = false;
|
instance.state.isShown = false;
|
||||||
ignoreOnFirstUpdate = false;
|
ignoreOnFirstUpdate = false;
|
||||||
|
isVisibleFromClick = false;
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
popper.style.visibility = 'hidden';
|
popper.style.visibility = 'hidden';
|
||||||
@@ -1331,7 +1374,7 @@ function createTippy(reference, passedProps) {
|
|||||||
|
|
||||||
cleanupInteractiveMouseListeners();
|
cleanupInteractiveMouseListeners();
|
||||||
removeDocumentPress();
|
removeDocumentPress();
|
||||||
handleStyles();
|
handleStyles(true);
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
||||||
@@ -1362,7 +1405,7 @@ function createTippy(reference, passedProps) {
|
|||||||
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
debouncedOnMouseMove(event);
|
||||||
}
|
}
|
||||||
@@ -1488,7 +1531,39 @@ var hideAll = function hideAll(_temp) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// every time the popper is destroyed (i.e. a new target), removing the styles
|
||||||
|
// and causing transitions to break for singletons when the console is open, but
|
||||||
|
// most notably for non-transform styles being used, `gpuAcceleration: false`.
|
||||||
|
|
||||||
|
var applyStylesModifier = Object.assign({}, applyStyles, {
|
||||||
|
effect: function effect(_ref) {
|
||||||
|
var state = _ref.state;
|
||||||
|
var initialStyles = {
|
||||||
|
popper: {
|
||||||
|
position: state.options.strategy,
|
||||||
|
left: '0',
|
||||||
|
top: '0',
|
||||||
|
margin: '0'
|
||||||
|
},
|
||||||
|
arrow: {
|
||||||
|
position: 'absolute'
|
||||||
|
},
|
||||||
|
reference: {}
|
||||||
|
};
|
||||||
|
Object.assign(state.elements.popper.style, initialStyles.popper);
|
||||||
|
state.styles = initialStyles;
|
||||||
|
|
||||||
|
if (state.elements.arrow) {
|
||||||
|
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
||||||
|
} // intentionally return no cleanup function
|
||||||
|
// return () => { ... }
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
||||||
|
var _optionalProps$popper;
|
||||||
|
|
||||||
if (optionalProps === void 0) {
|
if (optionalProps === void 0) {
|
||||||
optionalProps = {};
|
optionalProps = {};
|
||||||
}
|
}
|
||||||
@@ -1498,19 +1573,30 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|||||||
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
var mutTippyInstances = tippyInstances;
|
var individualInstances = tippyInstances;
|
||||||
var references = [];
|
var references = [];
|
||||||
|
var triggerTargets = [];
|
||||||
var currentTarget;
|
var currentTarget;
|
||||||
var overrides = optionalProps.overrides;
|
var overrides = optionalProps.overrides;
|
||||||
|
var interceptSetPropsCleanups = [];
|
||||||
|
var shownOnCreate = false;
|
||||||
|
|
||||||
|
function setTriggerTargets() {
|
||||||
|
triggerTargets = individualInstances.map(function (instance) {
|
||||||
|
return normalizeToArray(instance.props.triggerTarget || instance.reference);
|
||||||
|
}).reduce(function (acc, item) {
|
||||||
|
return acc.concat(item);
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
function setReferences() {
|
function setReferences() {
|
||||||
references = mutTippyInstances.map(function (instance) {
|
references = individualInstances.map(function (instance) {
|
||||||
return instance.reference;
|
return instance.reference;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableInstances(isEnabled) {
|
function enableInstances(isEnabled) {
|
||||||
mutTippyInstances.forEach(function (instance) {
|
individualInstances.forEach(function (instance) {
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
instance.enable();
|
instance.enable();
|
||||||
} else {
|
} else {
|
||||||
@@ -1519,58 +1605,163 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function interceptSetProps(singleton) {
|
||||||
|
return individualInstances.map(function (instance) {
|
||||||
|
var originalSetProps = instance.setProps;
|
||||||
|
|
||||||
|
instance.setProps = function (props) {
|
||||||
|
originalSetProps(props);
|
||||||
|
|
||||||
|
if (instance.reference === currentTarget) {
|
||||||
|
singleton.setProps(props);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
instance.setProps = originalSetProps;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} // have to pass singleton, as it maybe undefined on first call
|
||||||
|
|
||||||
|
|
||||||
|
function prepareInstance(singleton, target) {
|
||||||
|
var index = triggerTargets.indexOf(target); // bail-out
|
||||||
|
|
||||||
|
if (target === currentTarget) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTarget = target;
|
||||||
|
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
||||||
|
acc[prop] = individualInstances[index].props[prop];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
singleton.setProps(Object.assign({}, overrideProps, {
|
||||||
|
getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
|
||||||
|
var _references$index;
|
||||||
|
|
||||||
|
return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
var singleton = {
|
setTriggerTargets();
|
||||||
|
var plugin = {
|
||||||
fn: function fn() {
|
fn: function fn() {
|
||||||
return {
|
return {
|
||||||
onDestroy: function onDestroy() {
|
onDestroy: function onDestroy() {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(instance, event) {
|
onHidden: function onHidden() {
|
||||||
var target = event.currentTarget;
|
currentTarget = null;
|
||||||
var index = references.indexOf(target); // bail-out
|
},
|
||||||
|
onClickOutside: function onClickOutside(instance) {
|
||||||
if (target === currentTarget) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
return;
|
shownOnCreate = true;
|
||||||
|
currentTarget = null;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
currentTarget = target;
|
onShow: function onShow(instance) {
|
||||||
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
acc[prop] = mutTippyInstances[index].props[prop];
|
shownOnCreate = true;
|
||||||
return acc;
|
prepareInstance(instance, references[0]);
|
||||||
}, {});
|
}
|
||||||
instance.setProps(Object.assign({}, overrideProps, {
|
},
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
onTrigger: function onTrigger(instance, event) {
|
||||||
return target.getBoundingClientRect();
|
prepareInstance(instance, event.currentTarget);
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var instance = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
||||||
plugins: [singleton].concat(optionalProps.plugins || []),
|
plugins: [plugin].concat(optionalProps.plugins || []),
|
||||||
triggerTarget: references
|
triggerTarget: triggerTargets,
|
||||||
|
popperOptions: Object.assign({}, optionalProps.popperOptions, {
|
||||||
|
modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
|
||||||
|
})
|
||||||
}));
|
}));
|
||||||
var originalSetProps = instance.setProps;
|
var originalShow = singleton.show;
|
||||||
|
|
||||||
instance.setProps = function (props) {
|
singleton.show = function (target) {
|
||||||
|
originalShow(); // first time, showOnCreate or programmatic call with no params
|
||||||
|
// default to showing first instance
|
||||||
|
|
||||||
|
if (!currentTarget && target == null) {
|
||||||
|
return prepareInstance(singleton, references[0]);
|
||||||
|
} // triggered from event (do nothing as prepareInstance already called by onTrigger)
|
||||||
|
// programmatic call with no params when already visible (do nothing again)
|
||||||
|
|
||||||
|
|
||||||
|
if (currentTarget && target == null) {
|
||||||
|
return;
|
||||||
|
} // target is index of instance
|
||||||
|
|
||||||
|
|
||||||
|
if (typeof target === 'number') {
|
||||||
|
return references[target] && prepareInstance(singleton, references[target]);
|
||||||
|
} // target is a child tippy instance
|
||||||
|
|
||||||
|
|
||||||
|
if (individualInstances.indexOf(target) >= 0) {
|
||||||
|
var ref = target.reference;
|
||||||
|
return prepareInstance(singleton, ref);
|
||||||
|
} // target is a ReferenceElement
|
||||||
|
|
||||||
|
|
||||||
|
if (references.indexOf(target) >= 0) {
|
||||||
|
return prepareInstance(singleton, target);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showNext = function () {
|
||||||
|
var first = references[0];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
singleton.show(references[index + 1] || first);
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showPrevious = function () {
|
||||||
|
var last = references[references.length - 1];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(last);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
var target = references[index - 1] || last;
|
||||||
|
singleton.show(target);
|
||||||
|
};
|
||||||
|
|
||||||
|
var originalSetProps = singleton.setProps;
|
||||||
|
|
||||||
|
singleton.setProps = function (props) {
|
||||||
overrides = props.overrides || overrides;
|
overrides = props.overrides || overrides;
|
||||||
originalSetProps(props);
|
originalSetProps(props);
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.setInstances = function (nextInstances) {
|
singleton.setInstances = function (nextInstances) {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
mutTippyInstances = nextInstances;
|
interceptSetPropsCleanups.forEach(function (fn) {
|
||||||
|
return fn();
|
||||||
|
});
|
||||||
|
individualInstances = nextInstances;
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
instance.setProps({
|
setTriggerTargets();
|
||||||
triggerTarget: references
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
singleton.setProps({
|
||||||
|
triggerTarget: triggerTargets
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return instance;
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
return singleton;
|
||||||
};
|
};
|
||||||
|
|
||||||
var BUBBLING_EVENTS_MAP = {
|
var BUBBLING_EVENTS_MAP = {
|
||||||
@@ -1591,20 +1782,23 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var childTippyInstances = [];
|
var childTippyInstances = [];
|
||||||
|
var disabled = false;
|
||||||
var target = props.target;
|
var target = props.target;
|
||||||
var nativeProps = removeProperties(props, ['target']);
|
var nativeProps = removeProperties(props, ['target']);
|
||||||
var parentProps = Object.assign({}, nativeProps, {
|
var parentProps = Object.assign({}, nativeProps, {
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
touch: false
|
touch: false
|
||||||
});
|
});
|
||||||
var childProps = Object.assign({}, nativeProps, {
|
var childProps = Object.assign({
|
||||||
|
touch: defaultProps.touch
|
||||||
|
}, nativeProps, {
|
||||||
showOnCreate: true
|
showOnCreate: true
|
||||||
});
|
});
|
||||||
var returnValue = tippy(targets, parentProps);
|
var returnValue = tippy(targets, parentProps);
|
||||||
var normalizedReturnValue = normalizeToArray(returnValue);
|
var normalizedReturnValue = normalizeToArray(returnValue);
|
||||||
|
|
||||||
function onTrigger(event) {
|
function onTrigger(event) {
|
||||||
if (!event.target) {
|
if (!event.target || disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1628,7 +1822,7 @@ function delegate(targets, props) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type])) {
|
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type]) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1655,7 +1849,7 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
function addEventListeners(instance) {
|
function addEventListeners(instance) {
|
||||||
var reference = instance.reference;
|
var reference = instance.reference;
|
||||||
on(reference, 'touchstart', onTrigger);
|
on(reference, 'touchstart', onTrigger, TOUCH_OPTIONS);
|
||||||
on(reference, 'mouseover', onTrigger);
|
on(reference, 'mouseover', onTrigger);
|
||||||
on(reference, 'focusin', onTrigger);
|
on(reference, 'focusin', onTrigger);
|
||||||
on(reference, 'click', onTrigger);
|
on(reference, 'click', onTrigger);
|
||||||
@@ -1674,6 +1868,8 @@ function delegate(targets, props) {
|
|||||||
|
|
||||||
function applyMutations(instance) {
|
function applyMutations(instance) {
|
||||||
var originalDestroy = instance.destroy;
|
var originalDestroy = instance.destroy;
|
||||||
|
var originalEnable = instance.enable;
|
||||||
|
var originalDisable = instance.disable;
|
||||||
|
|
||||||
instance.destroy = function (shouldDestroyChildInstances) {
|
instance.destroy = function (shouldDestroyChildInstances) {
|
||||||
if (shouldDestroyChildInstances === void 0) {
|
if (shouldDestroyChildInstances === void 0) {
|
||||||
@@ -1691,6 +1887,22 @@ function delegate(targets, props) {
|
|||||||
originalDestroy();
|
originalDestroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
instance.enable = function () {
|
||||||
|
originalEnable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.enable();
|
||||||
|
});
|
||||||
|
disabled = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
instance.disable = function () {
|
||||||
|
originalDisable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.disable();
|
||||||
|
});
|
||||||
|
disabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
addEventListeners(instance);
|
addEventListeners(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1705,7 +1917,7 @@ var animateFill = {
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
|
if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== "production") {
|
||||||
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
||||||
}
|
}
|
||||||
@@ -1830,6 +2042,7 @@ var followCursor = {
|
|||||||
|
|
||||||
if (isCursorOverReference || !instance.props.interactive) {
|
if (isCursorOverReference || !instance.props.interactive) {
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
var rect = reference.getBoundingClientRect();
|
var rect = reference.getBoundingClientRect();
|
||||||
var x = clientX;
|
var x = clientX;
|
||||||
@@ -1908,20 +2121,26 @@ var followCursor = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMount: function onMount() {
|
onMount: function onMount() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor && !wasFocusEvent) {
|
||||||
if (isUnmounted) {
|
if (isUnmounted) {
|
||||||
onMouseMove(mouseCoords);
|
onMouseMove(mouseCoords);
|
||||||
isUnmounted = false;
|
isUnmounted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasFocusEvent && !getIsInitialBehavior()) {
|
if (!getIsInitialBehavior()) {
|
||||||
addListener();
|
addListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(_, _ref3) {
|
onTrigger: function onTrigger(_, event) {
|
||||||
var type = _ref3.type;
|
if (isMouseEvent(event)) {
|
||||||
wasFocusEvent = type === 'focus';
|
mouseCoords = {
|
||||||
|
clientX: event.clientX,
|
||||||
|
clientY: event.clientY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
wasFocusEvent = event.type === 'focus';
|
||||||
},
|
},
|
||||||
onHidden: function onHidden() {
|
onHidden: function onHidden() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor) {
|
||||||
@@ -1960,6 +2179,7 @@ var inlinePositioning = {
|
|||||||
var placement;
|
var placement;
|
||||||
var cursorRectIndex = -1;
|
var cursorRectIndex = -1;
|
||||||
var isInternalUpdate = false;
|
var isInternalUpdate = false;
|
||||||
|
var triedPlacements = [];
|
||||||
var modifier = {
|
var modifier = {
|
||||||
name: 'tippyInlinePositioning',
|
name: 'tippyInlinePositioning',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -1968,8 +2188,14 @@ var inlinePositioning = {
|
|||||||
var state = _ref2.state;
|
var state = _ref2.state;
|
||||||
|
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
if (placement !== state.placement) {
|
if (triedPlacements.indexOf(state.placement) !== -1) {
|
||||||
|
triedPlacements = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
|
||||||
|
triedPlacements.push(state.placement);
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
return _getReferenceClientRect(state.placement);
|
return _getReferenceClientRect(state.placement);
|
||||||
}
|
}
|
||||||
@@ -2006,10 +2232,11 @@ var inlinePositioning = {
|
|||||||
var cursorRect = rects.find(function (rect) {
|
var cursorRect = rects.find(function (rect) {
|
||||||
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
||||||
});
|
});
|
||||||
cursorRectIndex = rects.indexOf(cursorRect);
|
var index = rects.indexOf(cursorRect);
|
||||||
|
cursorRectIndex = index > -1 ? index : cursorRectIndex;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUntrigger: function onUntrigger() {
|
onHidden: function onHidden() {
|
||||||
cursorRectIndex = -1;
|
cursorRectIndex = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
2
node_modules/tippy.js/headless/dist/tippy-headless.esm.js.map
generated
vendored
2
node_modules/tippy.js/headless/dist/tippy-headless.esm.js.map
generated
vendored
File diff suppressed because one or more lines are too long
385
node_modules/tippy.js/headless/dist/tippy-headless.umd.js
generated
vendored
385
node_modules/tippy.js/headless/dist/tippy-headless.umd.js
generated
vendored
@@ -13,6 +13,9 @@
|
|||||||
passive: true,
|
passive: true,
|
||||||
capture: true
|
capture: true
|
||||||
};
|
};
|
||||||
|
var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
|
||||||
|
return document.body;
|
||||||
|
};
|
||||||
|
|
||||||
function hasOwnProperty(obj, key) {
|
function hasOwnProperty(obj, key) {
|
||||||
return {}.hasOwnProperty.call(obj, key);
|
return {}.hasOwnProperty.call(obj, key);
|
||||||
@@ -132,10 +135,13 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getOwnerDocument(elementOrElements) {
|
function getOwnerDocument(elementOrElements) {
|
||||||
var _normalizeToArray = normalizeToArray(elementOrElements),
|
var _element$ownerDocumen;
|
||||||
element = _normalizeToArray[0];
|
|
||||||
|
|
||||||
return element ? element.ownerDocument || document : document;
|
var _normalizeToArray = normalizeToArray(elementOrElements),
|
||||||
|
element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
|
||||||
|
|
||||||
|
|
||||||
|
return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
|
||||||
}
|
}
|
||||||
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
||||||
var clientX = event.clientX,
|
var clientX = event.clientX,
|
||||||
@@ -171,6 +177,26 @@
|
|||||||
box[method](event, listener);
|
box[method](event, listener);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Compared to xxx.contains, this function works for dom structures with shadow
|
||||||
|
* dom
|
||||||
|
*/
|
||||||
|
|
||||||
|
function actualContains(parent, child) {
|
||||||
|
var target = child;
|
||||||
|
|
||||||
|
while (target) {
|
||||||
|
var _target$getRootNode;
|
||||||
|
|
||||||
|
if (parent.contains(target)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var currentInput = {
|
var currentInput = {
|
||||||
isTouch: false
|
isTouch: false
|
||||||
@@ -234,8 +260,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||||
var ua = isBrowser ? navigator.userAgent : '';
|
var isIE11 = isBrowser ? // @ts-ignore
|
||||||
var isIE = /MSIE |Trident\//.test(ua);
|
!!window.msCrypto : false;
|
||||||
|
|
||||||
function createMemoryLeakWarning(method) {
|
function createMemoryLeakWarning(method) {
|
||||||
var txt = method === 'destroy' ? 'n already-' : ' ';
|
var txt = method === 'destroy' ? 'n already-' : ' ';
|
||||||
@@ -310,9 +336,7 @@
|
|||||||
zIndex: 9999
|
zIndex: 9999
|
||||||
};
|
};
|
||||||
var defaultProps = Object.assign({
|
var defaultProps = Object.assign({
|
||||||
appendTo: function appendTo() {
|
appendTo: TIPPY_DEFAULT_APPEND_TO,
|
||||||
return document.body;
|
|
||||||
},
|
|
||||||
aria: {
|
aria: {
|
||||||
content: 'auto',
|
content: 'auto',
|
||||||
expanded: 'auto'
|
expanded: 'auto'
|
||||||
@@ -347,7 +371,7 @@
|
|||||||
touch: true,
|
touch: true,
|
||||||
trigger: 'mouseenter focus',
|
trigger: 'mouseenter focus',
|
||||||
triggerTarget: null
|
triggerTarget: null
|
||||||
}, pluginProps, {}, renderProps);
|
}, pluginProps, renderProps);
|
||||||
var defaultKeys = Object.keys(defaultProps);
|
var defaultKeys = Object.keys(defaultProps);
|
||||||
var setDefaultProps = function setDefaultProps(partialProps) {
|
var setDefaultProps = function setDefaultProps(partialProps) {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
@@ -367,12 +391,14 @@
|
|||||||
defaultValue = plugin.defaultValue;
|
defaultValue = plugin.defaultValue;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
|
var _name;
|
||||||
|
|
||||||
|
acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
return Object.assign({}, passedProps, {}, pluginProps);
|
return Object.assign({}, passedProps, pluginProps);
|
||||||
}
|
}
|
||||||
function getDataAttributeProps(reference, plugins) {
|
function getDataAttributeProps(reference, plugins) {
|
||||||
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
||||||
@@ -403,7 +429,7 @@
|
|||||||
var out = Object.assign({}, props, {
|
var out = Object.assign({}, props, {
|
||||||
content: invokeWithArgsOrReturn(props.content, [reference])
|
content: invokeWithArgsOrReturn(props.content, [reference])
|
||||||
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
||||||
out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
|
out.aria = Object.assign({}, defaultProps.aria, out.aria);
|
||||||
out.aria = {
|
out.aria = {
|
||||||
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
||||||
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
||||||
@@ -456,7 +482,7 @@
|
|||||||
|
|
||||||
var mountedInstances = [];
|
var mountedInstances = [];
|
||||||
function createTippy(reference, passedProps) {
|
function createTippy(reference, passedProps) {
|
||||||
var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
||||||
// 🔒 Private members
|
// 🔒 Private members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -472,8 +498,7 @@
|
|||||||
var onFirstUpdate;
|
var onFirstUpdate;
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
|
||||||
var currentTarget;
|
var currentTarget; // ===========================================================================
|
||||||
var doc = getOwnerDocument(props.triggerTarget || reference); // ===========================================================================
|
|
||||||
// 🔑 Public members
|
// 🔑 Public members
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -557,10 +582,9 @@
|
|||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popper.addEventListener('mouseleave', function (event) {
|
popper.addEventListener('mouseleave', function () {
|
||||||
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return instance; // ===========================================================================
|
return instance; // ===========================================================================
|
||||||
@@ -580,13 +604,18 @@
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
|
return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentTarget() {
|
function getCurrentTarget() {
|
||||||
return currentTarget || reference;
|
return currentTarget || reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDocument() {
|
||||||
|
var parent = getCurrentTarget().parentNode;
|
||||||
|
return parent ? getOwnerDocument(parent) : document;
|
||||||
|
}
|
||||||
|
|
||||||
function getDefaultTemplateChildren() {
|
function getDefaultTemplateChildren() {
|
||||||
return getChildren(popper);
|
return getChildren(popper);
|
||||||
}
|
}
|
||||||
@@ -602,8 +631,12 @@
|
|||||||
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleStyles() {
|
function handleStyles(fromHide) {
|
||||||
popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
|
if (fromHide === void 0) {
|
||||||
|
fromHide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
|
||||||
popper.style.zIndex = "" + instance.props.zIndex;
|
popper.style.zIndex = "" + instance.props.zIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,7 +647,7 @@
|
|||||||
|
|
||||||
pluginsHooks.forEach(function (pluginHooks) {
|
pluginsHooks.forEach(function (pluginHooks) {
|
||||||
if (pluginHooks[hook]) {
|
if (pluginHooks[hook]) {
|
||||||
pluginHooks[hook].apply(void 0, args);
|
pluginHooks[hook].apply(pluginHooks, args);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -668,7 +701,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanupInteractiveMouseListeners() {
|
function cleanupInteractiveMouseListeners() {
|
||||||
doc.removeEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
|
||||||
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
||||||
return listener !== debouncedOnMouseMove;
|
return listener !== debouncedOnMouseMove;
|
||||||
});
|
});
|
||||||
@@ -680,15 +713,18 @@
|
|||||||
if (didTouchMove || event.type === 'mousedown') {
|
if (didTouchMove || event.type === 'mousedown') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} // Clicked on interactive popper
|
}
|
||||||
|
|
||||||
|
var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
|
||||||
|
|
||||||
if (instance.props.interactive && popper.contains(event.target)) {
|
if (instance.props.interactive && actualContains(popper, actualTarget)) {
|
||||||
return;
|
return;
|
||||||
} // Clicked on the event listeners target
|
} // Clicked on the event listeners target
|
||||||
|
|
||||||
|
|
||||||
if (getCurrentTarget().contains(event.target)) {
|
if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
|
||||||
|
return actualContains(el, actualTarget);
|
||||||
|
})) {
|
||||||
if (currentInput.isTouch) {
|
if (currentInput.isTouch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -701,7 +737,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (instance.props.hideOnClick === true) {
|
if (instance.props.hideOnClick === true) {
|
||||||
isVisibleFromClick = false;
|
|
||||||
instance.clearDelayTimeouts();
|
instance.clearDelayTimeouts();
|
||||||
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
|
||||||
// currentTarget. This lets a tippy with `focus` trigger know that it
|
// currentTarget. This lets a tippy with `focus` trigger know that it
|
||||||
@@ -729,6 +764,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addDocumentPress() {
|
function addDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.addEventListener('mousedown', onDocumentPress, true);
|
doc.addEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -736,6 +772,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeDocumentPress() {
|
function removeDocumentPress() {
|
||||||
|
var doc = getDocument();
|
||||||
doc.removeEventListener('mousedown', onDocumentPress, true);
|
doc.removeEventListener('mousedown', onDocumentPress, true);
|
||||||
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
|
||||||
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
|
||||||
@@ -815,7 +852,7 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focus':
|
case 'focus':
|
||||||
on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
|
on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'focusin':
|
case 'focusin':
|
||||||
@@ -878,7 +915,7 @@
|
|||||||
|
|
||||||
function onMouseMove(event) {
|
function onMouseMove(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
var isCursorOverReferenceOrPopper = reference.contains(target) || popper.contains(target);
|
var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
|
||||||
|
|
||||||
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
|
||||||
return;
|
return;
|
||||||
@@ -1041,7 +1078,7 @@
|
|||||||
|
|
||||||
var node = getCurrentTarget();
|
var node = getCurrentTarget();
|
||||||
|
|
||||||
if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
|
if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
|
||||||
parentNode = node.parentNode;
|
parentNode = node.parentNode;
|
||||||
} else {
|
} else {
|
||||||
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
||||||
@@ -1053,6 +1090,7 @@
|
|||||||
parentNode.appendChild(popper);
|
parentNode.appendChild(popper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance.state.isMounted = true;
|
||||||
createPopperInstance();
|
createPopperInstance();
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
|
|
||||||
@@ -1160,7 +1198,7 @@
|
|||||||
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
||||||
removeListeners();
|
removeListeners();
|
||||||
var prevProps = instance.props;
|
var prevProps = instance.props;
|
||||||
var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
|
var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
|
||||||
ignoreAttributes: true
|
ignoreAttributes: true
|
||||||
}));
|
}));
|
||||||
instance.props = nextProps;
|
instance.props = nextProps;
|
||||||
@@ -1263,6 +1301,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFirstUpdate = function onFirstUpdate() {
|
onFirstUpdate = function onFirstUpdate() {
|
||||||
|
var _instance$popperInsta2;
|
||||||
|
|
||||||
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1283,8 +1323,10 @@
|
|||||||
|
|
||||||
handleAriaContentAttribute();
|
handleAriaContentAttribute();
|
||||||
handleAriaExpandedAttribute();
|
handleAriaExpandedAttribute();
|
||||||
pushIfUnique(mountedInstances, instance);
|
pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
|
||||||
instance.state.isMounted = true;
|
// popper has been positioned for the first time
|
||||||
|
|
||||||
|
(_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
|
||||||
invokeHook('onMount', [instance]);
|
invokeHook('onMount', [instance]);
|
||||||
|
|
||||||
if (instance.props.animation && getIsDefaultRenderFn()) {
|
if (instance.props.animation && getIsDefaultRenderFn()) {
|
||||||
@@ -1323,6 +1365,7 @@
|
|||||||
instance.state.isVisible = false;
|
instance.state.isVisible = false;
|
||||||
instance.state.isShown = false;
|
instance.state.isShown = false;
|
||||||
ignoreOnFirstUpdate = false;
|
ignoreOnFirstUpdate = false;
|
||||||
|
isVisibleFromClick = false;
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
popper.style.visibility = 'hidden';
|
popper.style.visibility = 'hidden';
|
||||||
@@ -1330,7 +1373,7 @@
|
|||||||
|
|
||||||
cleanupInteractiveMouseListeners();
|
cleanupInteractiveMouseListeners();
|
||||||
removeDocumentPress();
|
removeDocumentPress();
|
||||||
handleStyles();
|
handleStyles(true);
|
||||||
|
|
||||||
if (getIsDefaultRenderFn()) {
|
if (getIsDefaultRenderFn()) {
|
||||||
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
||||||
@@ -1361,7 +1404,7 @@
|
|||||||
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.addEventListener('mousemove', debouncedOnMouseMove);
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
||||||
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
||||||
debouncedOnMouseMove(event);
|
debouncedOnMouseMove(event);
|
||||||
}
|
}
|
||||||
@@ -1487,7 +1530,39 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// every time the popper is destroyed (i.e. a new target), removing the styles
|
||||||
|
// and causing transitions to break for singletons when the console is open, but
|
||||||
|
// most notably for non-transform styles being used, `gpuAcceleration: false`.
|
||||||
|
|
||||||
|
var applyStylesModifier = Object.assign({}, core.applyStyles, {
|
||||||
|
effect: function effect(_ref) {
|
||||||
|
var state = _ref.state;
|
||||||
|
var initialStyles = {
|
||||||
|
popper: {
|
||||||
|
position: state.options.strategy,
|
||||||
|
left: '0',
|
||||||
|
top: '0',
|
||||||
|
margin: '0'
|
||||||
|
},
|
||||||
|
arrow: {
|
||||||
|
position: 'absolute'
|
||||||
|
},
|
||||||
|
reference: {}
|
||||||
|
};
|
||||||
|
Object.assign(state.elements.popper.style, initialStyles.popper);
|
||||||
|
state.styles = initialStyles;
|
||||||
|
|
||||||
|
if (state.elements.arrow) {
|
||||||
|
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
||||||
|
} // intentionally return no cleanup function
|
||||||
|
// return () => { ... }
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
||||||
|
var _optionalProps$popper;
|
||||||
|
|
||||||
if (optionalProps === void 0) {
|
if (optionalProps === void 0) {
|
||||||
optionalProps = {};
|
optionalProps = {};
|
||||||
}
|
}
|
||||||
@@ -1497,19 +1572,30 @@
|
|||||||
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
var mutTippyInstances = tippyInstances;
|
var individualInstances = tippyInstances;
|
||||||
var references = [];
|
var references = [];
|
||||||
|
var triggerTargets = [];
|
||||||
var currentTarget;
|
var currentTarget;
|
||||||
var overrides = optionalProps.overrides;
|
var overrides = optionalProps.overrides;
|
||||||
|
var interceptSetPropsCleanups = [];
|
||||||
|
var shownOnCreate = false;
|
||||||
|
|
||||||
|
function setTriggerTargets() {
|
||||||
|
triggerTargets = individualInstances.map(function (instance) {
|
||||||
|
return normalizeToArray(instance.props.triggerTarget || instance.reference);
|
||||||
|
}).reduce(function (acc, item) {
|
||||||
|
return acc.concat(item);
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
function setReferences() {
|
function setReferences() {
|
||||||
references = mutTippyInstances.map(function (instance) {
|
references = individualInstances.map(function (instance) {
|
||||||
return instance.reference;
|
return instance.reference;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableInstances(isEnabled) {
|
function enableInstances(isEnabled) {
|
||||||
mutTippyInstances.forEach(function (instance) {
|
individualInstances.forEach(function (instance) {
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
instance.enable();
|
instance.enable();
|
||||||
} else {
|
} else {
|
||||||
@@ -1518,58 +1604,163 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function interceptSetProps(singleton) {
|
||||||
|
return individualInstances.map(function (instance) {
|
||||||
|
var originalSetProps = instance.setProps;
|
||||||
|
|
||||||
|
instance.setProps = function (props) {
|
||||||
|
originalSetProps(props);
|
||||||
|
|
||||||
|
if (instance.reference === currentTarget) {
|
||||||
|
singleton.setProps(props);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
instance.setProps = originalSetProps;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} // have to pass singleton, as it maybe undefined on first call
|
||||||
|
|
||||||
|
|
||||||
|
function prepareInstance(singleton, target) {
|
||||||
|
var index = triggerTargets.indexOf(target); // bail-out
|
||||||
|
|
||||||
|
if (target === currentTarget) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTarget = target;
|
||||||
|
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
||||||
|
acc[prop] = individualInstances[index].props[prop];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
singleton.setProps(Object.assign({}, overrideProps, {
|
||||||
|
getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
|
||||||
|
var _references$index;
|
||||||
|
|
||||||
|
return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
var singleton = {
|
setTriggerTargets();
|
||||||
|
var plugin = {
|
||||||
fn: function fn() {
|
fn: function fn() {
|
||||||
return {
|
return {
|
||||||
onDestroy: function onDestroy() {
|
onDestroy: function onDestroy() {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(instance, event) {
|
onHidden: function onHidden() {
|
||||||
var target = event.currentTarget;
|
currentTarget = null;
|
||||||
var index = references.indexOf(target); // bail-out
|
},
|
||||||
|
onClickOutside: function onClickOutside(instance) {
|
||||||
if (target === currentTarget) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
return;
|
shownOnCreate = true;
|
||||||
|
currentTarget = null;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
currentTarget = target;
|
onShow: function onShow(instance) {
|
||||||
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
if (instance.props.showOnCreate && !shownOnCreate) {
|
||||||
acc[prop] = mutTippyInstances[index].props[prop];
|
shownOnCreate = true;
|
||||||
return acc;
|
prepareInstance(instance, references[0]);
|
||||||
}, {});
|
}
|
||||||
instance.setProps(Object.assign({}, overrideProps, {
|
},
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
onTrigger: function onTrigger(instance, event) {
|
||||||
return target.getBoundingClientRect();
|
prepareInstance(instance, event.currentTarget);
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var instance = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
||||||
plugins: [singleton].concat(optionalProps.plugins || []),
|
plugins: [plugin].concat(optionalProps.plugins || []),
|
||||||
triggerTarget: references
|
triggerTarget: triggerTargets,
|
||||||
|
popperOptions: Object.assign({}, optionalProps.popperOptions, {
|
||||||
|
modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
|
||||||
|
})
|
||||||
}));
|
}));
|
||||||
var originalSetProps = instance.setProps;
|
var originalShow = singleton.show;
|
||||||
|
|
||||||
instance.setProps = function (props) {
|
singleton.show = function (target) {
|
||||||
|
originalShow(); // first time, showOnCreate or programmatic call with no params
|
||||||
|
// default to showing first instance
|
||||||
|
|
||||||
|
if (!currentTarget && target == null) {
|
||||||
|
return prepareInstance(singleton, references[0]);
|
||||||
|
} // triggered from event (do nothing as prepareInstance already called by onTrigger)
|
||||||
|
// programmatic call with no params when already visible (do nothing again)
|
||||||
|
|
||||||
|
|
||||||
|
if (currentTarget && target == null) {
|
||||||
|
return;
|
||||||
|
} // target is index of instance
|
||||||
|
|
||||||
|
|
||||||
|
if (typeof target === 'number') {
|
||||||
|
return references[target] && prepareInstance(singleton, references[target]);
|
||||||
|
} // target is a child tippy instance
|
||||||
|
|
||||||
|
|
||||||
|
if (individualInstances.indexOf(target) >= 0) {
|
||||||
|
var ref = target.reference;
|
||||||
|
return prepareInstance(singleton, ref);
|
||||||
|
} // target is a ReferenceElement
|
||||||
|
|
||||||
|
|
||||||
|
if (references.indexOf(target) >= 0) {
|
||||||
|
return prepareInstance(singleton, target);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showNext = function () {
|
||||||
|
var first = references[0];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
singleton.show(references[index + 1] || first);
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton.showPrevious = function () {
|
||||||
|
var last = references[references.length - 1];
|
||||||
|
|
||||||
|
if (!currentTarget) {
|
||||||
|
return singleton.show(last);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = references.indexOf(currentTarget);
|
||||||
|
var target = references[index - 1] || last;
|
||||||
|
singleton.show(target);
|
||||||
|
};
|
||||||
|
|
||||||
|
var originalSetProps = singleton.setProps;
|
||||||
|
|
||||||
|
singleton.setProps = function (props) {
|
||||||
overrides = props.overrides || overrides;
|
overrides = props.overrides || overrides;
|
||||||
originalSetProps(props);
|
originalSetProps(props);
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.setInstances = function (nextInstances) {
|
singleton.setInstances = function (nextInstances) {
|
||||||
enableInstances(true);
|
enableInstances(true);
|
||||||
mutTippyInstances = nextInstances;
|
interceptSetPropsCleanups.forEach(function (fn) {
|
||||||
|
return fn();
|
||||||
|
});
|
||||||
|
individualInstances = nextInstances;
|
||||||
enableInstances(false);
|
enableInstances(false);
|
||||||
setReferences();
|
setReferences();
|
||||||
instance.setProps({
|
setTriggerTargets();
|
||||||
triggerTarget: references
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
singleton.setProps({
|
||||||
|
triggerTarget: triggerTargets
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return instance;
|
interceptSetPropsCleanups = interceptSetProps(singleton);
|
||||||
|
return singleton;
|
||||||
};
|
};
|
||||||
|
|
||||||
var BUBBLING_EVENTS_MAP = {
|
var BUBBLING_EVENTS_MAP = {
|
||||||
@@ -1590,20 +1781,23 @@
|
|||||||
|
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var childTippyInstances = [];
|
var childTippyInstances = [];
|
||||||
|
var disabled = false;
|
||||||
var target = props.target;
|
var target = props.target;
|
||||||
var nativeProps = removeProperties(props, ['target']);
|
var nativeProps = removeProperties(props, ['target']);
|
||||||
var parentProps = Object.assign({}, nativeProps, {
|
var parentProps = Object.assign({}, nativeProps, {
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
touch: false
|
touch: false
|
||||||
});
|
});
|
||||||
var childProps = Object.assign({}, nativeProps, {
|
var childProps = Object.assign({
|
||||||
|
touch: defaultProps.touch
|
||||||
|
}, nativeProps, {
|
||||||
showOnCreate: true
|
showOnCreate: true
|
||||||
});
|
});
|
||||||
var returnValue = tippy(targets, parentProps);
|
var returnValue = tippy(targets, parentProps);
|
||||||
var normalizedReturnValue = normalizeToArray(returnValue);
|
var normalizedReturnValue = normalizeToArray(returnValue);
|
||||||
|
|
||||||
function onTrigger(event) {
|
function onTrigger(event) {
|
||||||
if (!event.target) {
|
if (!event.target || disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1627,7 +1821,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type])) {
|
if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type]) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1654,7 +1848,7 @@
|
|||||||
|
|
||||||
function addEventListeners(instance) {
|
function addEventListeners(instance) {
|
||||||
var reference = instance.reference;
|
var reference = instance.reference;
|
||||||
on(reference, 'touchstart', onTrigger);
|
on(reference, 'touchstart', onTrigger, TOUCH_OPTIONS);
|
||||||
on(reference, 'mouseover', onTrigger);
|
on(reference, 'mouseover', onTrigger);
|
||||||
on(reference, 'focusin', onTrigger);
|
on(reference, 'focusin', onTrigger);
|
||||||
on(reference, 'click', onTrigger);
|
on(reference, 'click', onTrigger);
|
||||||
@@ -1673,6 +1867,8 @@
|
|||||||
|
|
||||||
function applyMutations(instance) {
|
function applyMutations(instance) {
|
||||||
var originalDestroy = instance.destroy;
|
var originalDestroy = instance.destroy;
|
||||||
|
var originalEnable = instance.enable;
|
||||||
|
var originalDisable = instance.disable;
|
||||||
|
|
||||||
instance.destroy = function (shouldDestroyChildInstances) {
|
instance.destroy = function (shouldDestroyChildInstances) {
|
||||||
if (shouldDestroyChildInstances === void 0) {
|
if (shouldDestroyChildInstances === void 0) {
|
||||||
@@ -1690,6 +1886,22 @@
|
|||||||
originalDestroy();
|
originalDestroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
instance.enable = function () {
|
||||||
|
originalEnable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.enable();
|
||||||
|
});
|
||||||
|
disabled = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
instance.disable = function () {
|
||||||
|
originalDisable();
|
||||||
|
childTippyInstances.forEach(function (instance) {
|
||||||
|
return instance.disable();
|
||||||
|
});
|
||||||
|
disabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
addEventListeners(instance);
|
addEventListeners(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1704,7 +1916,7 @@
|
|||||||
var _instance$props$rende;
|
var _instance$props$rende;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
|
if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
|
||||||
{
|
{
|
||||||
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
||||||
}
|
}
|
||||||
@@ -1829,6 +2041,7 @@
|
|||||||
|
|
||||||
if (isCursorOverReference || !instance.props.interactive) {
|
if (isCursorOverReference || !instance.props.interactive) {
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
var rect = reference.getBoundingClientRect();
|
var rect = reference.getBoundingClientRect();
|
||||||
var x = clientX;
|
var x = clientX;
|
||||||
@@ -1907,20 +2120,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMount: function onMount() {
|
onMount: function onMount() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor && !wasFocusEvent) {
|
||||||
if (isUnmounted) {
|
if (isUnmounted) {
|
||||||
onMouseMove(mouseCoords);
|
onMouseMove(mouseCoords);
|
||||||
isUnmounted = false;
|
isUnmounted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasFocusEvent && !getIsInitialBehavior()) {
|
if (!getIsInitialBehavior()) {
|
||||||
addListener();
|
addListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTrigger: function onTrigger(_, _ref3) {
|
onTrigger: function onTrigger(_, event) {
|
||||||
var type = _ref3.type;
|
if (isMouseEvent(event)) {
|
||||||
wasFocusEvent = type === 'focus';
|
mouseCoords = {
|
||||||
|
clientX: event.clientX,
|
||||||
|
clientY: event.clientY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
wasFocusEvent = event.type === 'focus';
|
||||||
},
|
},
|
||||||
onHidden: function onHidden() {
|
onHidden: function onHidden() {
|
||||||
if (instance.props.followCursor) {
|
if (instance.props.followCursor) {
|
||||||
@@ -1959,6 +2178,7 @@
|
|||||||
var placement;
|
var placement;
|
||||||
var cursorRectIndex = -1;
|
var cursorRectIndex = -1;
|
||||||
var isInternalUpdate = false;
|
var isInternalUpdate = false;
|
||||||
|
var triedPlacements = [];
|
||||||
var modifier = {
|
var modifier = {
|
||||||
name: 'tippyInlinePositioning',
|
name: 'tippyInlinePositioning',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -1967,8 +2187,14 @@
|
|||||||
var state = _ref2.state;
|
var state = _ref2.state;
|
||||||
|
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
if (placement !== state.placement) {
|
if (triedPlacements.indexOf(state.placement) !== -1) {
|
||||||
|
triedPlacements = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
|
||||||
|
triedPlacements.push(state.placement);
|
||||||
instance.setProps({
|
instance.setProps({
|
||||||
|
// @ts-ignore - unneeded DOMRect properties
|
||||||
getReferenceClientRect: function getReferenceClientRect() {
|
getReferenceClientRect: function getReferenceClientRect() {
|
||||||
return _getReferenceClientRect(state.placement);
|
return _getReferenceClientRect(state.placement);
|
||||||
}
|
}
|
||||||
@@ -2005,10 +2231,11 @@
|
|||||||
var cursorRect = rects.find(function (rect) {
|
var cursorRect = rects.find(function (rect) {
|
||||||
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
||||||
});
|
});
|
||||||
cursorRectIndex = rects.indexOf(cursorRect);
|
var index = rects.indexOf(cursorRect);
|
||||||
|
cursorRectIndex = index > -1 ? index : cursorRectIndex;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUntrigger: function onUntrigger() {
|
onHidden: function onHidden() {
|
||||||
cursorRectIndex = -1;
|
cursorRectIndex = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
2
node_modules/tippy.js/headless/dist/tippy-headless.umd.js.map
generated
vendored
2
node_modules/tippy.js/headless/dist/tippy-headless.umd.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/tippy.js/headless/dist/tippy-headless.umd.min.js
generated
vendored
2
node_modules/tippy.js/headless/dist/tippy-headless.umd.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/tippy.js/headless/dist/tippy-headless.umd.min.js.map
generated
vendored
2
node_modules/tippy.js/headless/dist/tippy-headless.umd.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3
node_modules/tippy.js/index.d.ts
generated
vendored
3
node_modules/tippy.js/index.d.ts
generated
vendored
@@ -187,6 +187,9 @@ export type CreateSingletonInstance<TProps = CreateSingletonProps> = Instance<
|
|||||||
TProps
|
TProps
|
||||||
> & {
|
> & {
|
||||||
setInstances(instances: Instance<any>[]): void;
|
setInstances(instances: Instance<any>[]): void;
|
||||||
|
show(target?: ReferenceElement | Instance | number): void;
|
||||||
|
showNext(): void;
|
||||||
|
showPrevious(): void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CreateSingleton<TProps = Props> = (
|
export type CreateSingleton<TProps = Props> = (
|
||||||
|
|||||||
14
node_modules/tippy.js/package.json
generated
vendored
14
node_modules/tippy.js/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tippy.js",
|
"name": "tippy.js",
|
||||||
"version": "6.2.5",
|
"version": "6.3.7",
|
||||||
"description": "The complete tooltip, popover, dropdown, and menu solution for the web",
|
"description": "The complete tooltip, popover, dropdown, and menu solution for the web",
|
||||||
"main": "dist/tippy.cjs.js",
|
"main": "dist/tippy.cjs.js",
|
||||||
"module": "dist/tippy.esm.js",
|
"module": "dist/tippy.esm.js",
|
||||||
@@ -106,11 +106,11 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.8.3",
|
"@babel/core": "^7.8.3",
|
||||||
"@babel/preset-env": "^7.8.3",
|
"@babel/preset-env": "^7.8.3",
|
||||||
"@babel/preset-typescript": "^7.8.3",
|
"@babel/preset-typescript": "^7.13.0",
|
||||||
"@testing-library/dom": "^6.11.0",
|
"@testing-library/dom": "^6.11.0",
|
||||||
"@types/node": "^12.12.25",
|
"@types/node": "^12.12.25",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.21.0",
|
"@typescript-eslint/eslint-plugin": "^4.16.1",
|
||||||
"@typescript-eslint/parser": "^2.21.0",
|
"@typescript-eslint/parser": "^4.16.1",
|
||||||
"autoprefixer": "^9.7.4",
|
"autoprefixer": "^9.7.4",
|
||||||
"babel-jest": "^25.3.0",
|
"babel-jest": "^25.3.0",
|
||||||
"babel-plugin-dev-expression": "^0.2.2",
|
"babel-plugin-dev-expression": "^0.2.2",
|
||||||
@@ -148,10 +148,10 @@
|
|||||||
"rollup-plugin-terser": "^5.2.0",
|
"rollup-plugin-terser": "^5.2.0",
|
||||||
"sass": "^1.25.0",
|
"sass": "^1.25.0",
|
||||||
"serve": "^11.3.0",
|
"serve": "^11.3.0",
|
||||||
"tsd": "^0.11.0",
|
"tsd": "^0.14.0",
|
||||||
"typescript": "^3.7.5"
|
"typescript": "^4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@popperjs/core": "^2.4.4"
|
"@popperjs/core": "^2.9.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ abstract class AbstractFolderAnalyzer
|
|||||||
* @since 3.2.0 N°7175 update regexp to also remove `examples` folder
|
* @since 3.2.0 N°7175 update regexp to also remove `examples` folder
|
||||||
* @link https://www.regular-expressions.info/alternation.html RegExp alternation reference
|
* @link https://www.regular-expressions.info/alternation.html RegExp alternation reference
|
||||||
*/
|
*/
|
||||||
public const QUESTIONNABLE_FOLDER_REGEXP = '/^(tests?|examples?|htdocs?|demos?|external)$/i';
|
public const QUESTIONNABLE_FOLDER_REGEXP = '/^(tests?|examples?|htdocs?|demos?)$/i';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string Relative path to the root folder of the dependencies (e.g. "lib" for composer, "node_modules" for npm, ...) from iTop app. root
|
* @return string Relative path to the root folder of the dependencies (e.g. "lib" for composer, "node_modules" for npm, ...) from iTop app. root
|
||||||
@@ -134,7 +134,7 @@ abstract class AbstractFolderAnalyzer
|
|||||||
public function ListDeniedButStillPresentFoldersAbsPaths(): array
|
public function ListDeniedButStillPresentFoldersAbsPaths(): array
|
||||||
{
|
{
|
||||||
$aDeniedTestDir = $this->ListDeniedFoldersAbsPaths();
|
$aDeniedTestDir = $this->ListDeniedFoldersAbsPaths();
|
||||||
$aAllTestDir = $this->ListAllowedFoldersAbsPaths();
|
$aAllTestDir = $this->ListAllFoldersAbsPaths();
|
||||||
return array_intersect($aDeniedTestDir, $aAllTestDir);
|
return array_intersect($aDeniedTestDir, $aAllTestDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,9 @@ use Combodo\iTop\Dependencies\AbstractFolderAnalyzer;
|
|||||||
|
|
||||||
class iTopNPM extends AbstractFolderAnalyzer
|
class iTopNPM extends AbstractFolderAnalyzer
|
||||||
{
|
{
|
||||||
|
/** @inheritDoc */
|
||||||
|
public const QUESTIONNABLE_FOLDER_REGEXP = '/^(tests?|examples?|htdocs?|demos?|website|external|libs?|src)$/i';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@@ -39,8 +42,19 @@ class iTopNPM extends AbstractFolderAnalyzer
|
|||||||
public function ListAllowedFoldersRelPaths(): array
|
public function ListAllowedFoldersRelPaths(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
// jQuery Sizzle used by jQuery
|
'ace-builds/textarea/src', // Unknown usage
|
||||||
'jquery/external',
|
'cliui/build/lib', // Unknown usage
|
||||||
|
|
||||||
|
'jquery/external', // jQuery Sizzle used by jQuery
|
||||||
|
|
||||||
|
'jquery-contextmenu/src', // Used sources
|
||||||
|
'magnific-popup/libs', // Unknown usage
|
||||||
|
'toastify-js/src', // Used sources
|
||||||
|
|
||||||
|
'y18n/build/lib', // Unknown usage
|
||||||
|
'yargs/build/lib', // Unknown usage
|
||||||
|
'yargs/lib', // Unknown usage
|
||||||
|
'yargs-parser/build/lib', // Unknown usage
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,6 +64,10 @@ class iTopNPM extends AbstractFolderAnalyzer
|
|||||||
public function ListDeniedFoldersRelPaths(): array
|
public function ListDeniedFoldersRelPaths(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'@popperjs/core/dist/cjs',
|
||||||
|
'@popperjs/core/dist/esm',
|
||||||
|
'@popperjs/core/lib',
|
||||||
|
|
||||||
// ACE Editor see https://www.npmjs.com/package/ace-builds for dir contents
|
// ACE Editor see https://www.npmjs.com/package/ace-builds for dir contents
|
||||||
'ace-builds/demo',
|
'ace-builds/demo',
|
||||||
'ace-builds/src',
|
'ace-builds/src',
|
||||||
@@ -57,12 +75,19 @@ class iTopNPM extends AbstractFolderAnalyzer
|
|||||||
'ace-builds/src-noconflict',
|
'ace-builds/src-noconflict',
|
||||||
|
|
||||||
'c3/htdocs',
|
'c3/htdocs',
|
||||||
|
'c3/src',
|
||||||
'clipboard/demo',
|
'clipboard/demo',
|
||||||
|
'clipboard/src',
|
||||||
'clipboard/test',
|
'clipboard/test',
|
||||||
|
'd3/src',
|
||||||
'delegate/demo',
|
'delegate/demo',
|
||||||
|
'delegate/src',
|
||||||
'delegate/test',
|
'delegate/test',
|
||||||
'good-listener/demo',
|
'good-listener/demo',
|
||||||
|
'good-listener/src',
|
||||||
'good-listener/test',
|
'good-listener/test',
|
||||||
|
'jquery/src',
|
||||||
|
'jquery-migrate/src',
|
||||||
'jquery-migrate/test',
|
'jquery-migrate/test',
|
||||||
|
|
||||||
// `jquery-ui` package is just there for vulnerability scans, so we don't want to version its files (only `jquery-ui-dist` is used within the code base)
|
// `jquery-ui` package is just there for vulnerability scans, so we don't want to version its files (only `jquery-ui-dist` is used within the code base)
|
||||||
@@ -74,9 +99,14 @@ class iTopNPM extends AbstractFolderAnalyzer
|
|||||||
'jquery-ui/ui',
|
'jquery-ui/ui',
|
||||||
|
|
||||||
'jquery-ui-dist/external',
|
'jquery-ui-dist/external',
|
||||||
|
'magnific-popup/libs/jquery',
|
||||||
|
'magnific-popup/src',
|
||||||
|
'magnific-popup/website',
|
||||||
|
'moment/src',
|
||||||
'mousetrap/plugins/record/tests',
|
'mousetrap/plugins/record/tests',
|
||||||
'mousetrap/tests',
|
'mousetrap/tests',
|
||||||
'select/demo',
|
'select/demo',
|
||||||
|
'select/src',
|
||||||
'select/test',
|
'select/test',
|
||||||
'selectize-plugin-a11y/examples',
|
'selectize-plugin-a11y/examples',
|
||||||
'tiny-emitter/test',
|
'tiny-emitter/test',
|
||||||
|
|||||||
Reference in New Issue
Block a user