@tippyjs/react
Advanced tools
Comparing version 4.2.5 to 4.2.6
@@ -221,13 +221,12 @@ import tippy, { createSingleton } from 'tippy.js'; | ||
computedProps = Object.assign({}, props, { | ||
plugins: isSingletonMode ? [].concat(plugins, [{ | ||
plugins: isSingletonMode && singleton.data != null ? [].concat(plugins, [{ | ||
fn: function fn() { | ||
return { | ||
onTrigger: function onTrigger(_, event) { | ||
var _singleton$data$child = singleton.data.children.find(function (_ref2) { | ||
onTrigger: function onTrigger(instance, event) { | ||
var node = singleton.data.children.find(function (_ref2) { | ||
var instance = _ref2.instance; | ||
return instance.reference === event.currentTarget; | ||
}), | ||
content = _singleton$data$child.content; | ||
setSingletonContent(content); | ||
}); | ||
instance.state.$$activeSingletonInstance = node.instance; | ||
setSingletonContent(node.content); | ||
} | ||
@@ -271,3 +270,4 @@ }; | ||
content: content, | ||
props: computedProps | ||
props: computedProps, | ||
setSingletonContent: setSingletonContent | ||
}); | ||
@@ -315,3 +315,4 @@ } | ||
content: content, | ||
props: computedProps | ||
props: computedProps, | ||
setSingletonContent: setSingletonContent | ||
}); | ||
@@ -464,2 +465,3 @@ } | ||
mutableBox.sourceData = data; | ||
mutableBox.setSingletonContent = data.setSingletonContent; | ||
}, | ||
@@ -472,14 +474,19 @@ cleanup: function cleanup() { | ||
hook: function hook(data) { | ||
if (!mutableBox.children.find(function (_ref3) { | ||
var _mutableBox$instance, _mutableBox$instance2; | ||
mutableBox.children = mutableBox.children.filter(function (_ref3) { | ||
var instance = _ref3.instance; | ||
return data.instance === instance; | ||
})) { | ||
mutableBox.children.push(data); | ||
return data.instance !== instance; | ||
}); | ||
mutableBox.children.push(data); | ||
if (mutableBox.instance && !mutableBox.instance.state.isDestroyed) { | ||
mutableBox.instance.setInstances(mutableBox.children.map(function (child) { | ||
return child.instance; | ||
})); | ||
} | ||
if (((_mutableBox$instance = mutableBox.instance) == null ? void 0 : _mutableBox$instance.state.isMounted) && ((_mutableBox$instance2 = mutableBox.instance) == null ? void 0 : _mutableBox$instance2.state.$$activeSingletonInstance) === data.instance) { | ||
mutableBox.setSingletonContent == null ? void 0 : mutableBox.setSingletonContent(data.content); | ||
} | ||
if (mutableBox.instance && !mutableBox.instance.state.isDestroyed) { | ||
mutableBox.instance.setInstances(mutableBox.children.map(function (child) { | ||
return child.instance; | ||
})); | ||
} | ||
}, | ||
@@ -486,0 +493,0 @@ cleanup: function cleanup(instance) { |
@@ -225,13 +225,12 @@ (function (global, factory) { | ||
computedProps = Object.assign({}, props, { | ||
plugins: isSingletonMode ? [].concat(plugins, [{ | ||
plugins: isSingletonMode && singleton.data != null ? [].concat(plugins, [{ | ||
fn: function fn() { | ||
return { | ||
onTrigger: function onTrigger(_, event) { | ||
var _singleton$data$child = singleton.data.children.find(function (_ref2) { | ||
onTrigger: function onTrigger(instance, event) { | ||
var node = singleton.data.children.find(function (_ref2) { | ||
var instance = _ref2.instance; | ||
return instance.reference === event.currentTarget; | ||
}), | ||
content = _singleton$data$child.content; | ||
setSingletonContent(content); | ||
}); | ||
instance.state.$$activeSingletonInstance = node.instance; | ||
setSingletonContent(node.content); | ||
} | ||
@@ -275,3 +274,4 @@ }; | ||
content: content, | ||
props: computedProps | ||
props: computedProps, | ||
setSingletonContent: setSingletonContent | ||
}); | ||
@@ -319,3 +319,4 @@ } | ||
content: content, | ||
props: computedProps | ||
props: computedProps, | ||
setSingletonContent: setSingletonContent | ||
}); | ||
@@ -468,2 +469,3 @@ } | ||
mutableBox.sourceData = data; | ||
mutableBox.setSingletonContent = data.setSingletonContent; | ||
}, | ||
@@ -476,14 +478,19 @@ cleanup: function cleanup() { | ||
hook: function hook(data) { | ||
if (!mutableBox.children.find(function (_ref3) { | ||
var _mutableBox$instance, _mutableBox$instance2; | ||
mutableBox.children = mutableBox.children.filter(function (_ref3) { | ||
var instance = _ref3.instance; | ||
return data.instance === instance; | ||
})) { | ||
mutableBox.children.push(data); | ||
return data.instance !== instance; | ||
}); | ||
mutableBox.children.push(data); | ||
if (mutableBox.instance && !mutableBox.instance.state.isDestroyed) { | ||
mutableBox.instance.setInstances(mutableBox.children.map(function (child) { | ||
return child.instance; | ||
})); | ||
} | ||
if (((_mutableBox$instance = mutableBox.instance) == null ? void 0 : _mutableBox$instance.state.isMounted) && ((_mutableBox$instance2 = mutableBox.instance) == null ? void 0 : _mutableBox$instance2.state.$$activeSingletonInstance) === data.instance) { | ||
mutableBox.setSingletonContent == null ? void 0 : mutableBox.setSingletonContent(data.content); | ||
} | ||
if (mutableBox.instance && !mutableBox.instance.state.isDestroyed) { | ||
mutableBox.instance.setInstances(mutableBox.children.map(function (child) { | ||
return child.instance; | ||
})); | ||
} | ||
}, | ||
@@ -490,0 +497,0 @@ cleanup: function cleanup(instance) { |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("tippy.js"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","tippy.js","react","react-dom"],n):n((e=e||self).Tippy={},e.tippy,e.React,e.ReactDOM)}(this,(function(e,n,t,r){"use strict";var i="default"in n?n.default:n,o="default"in t?t.default:t;function c(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}var s="undefined"!=typeof window&&"undefined"!=typeof document;function a(e,n){e&&("function"==typeof e&&e(n),{}.hasOwnProperty.call(e,"current")&&(e.current=n))}function u(){return s&&document.createElement("div")}function p(e){var n=[];return e.forEach((function(e){n.find((function(n){return function e(n,t){if(n===t)return!0;if("object"==typeof n&&null!=n&&"object"==typeof t&&null!=t){if(Object.keys(n).length!==Object.keys(t).length)return!1;for(var r in n){if(!t.hasOwnProperty(r))return!1;if(!e(n[r],t[r]))return!1}return!0}return!1}(e,n)}))||n.push(e)})),n}function f(e,n){var t,r;return Object.assign({},n,{popperOptions:Object.assign({},e.popperOptions,n.popperOptions,{modifiers:p([].concat((null==(t=e.popperOptions)?void 0:t.modifiers)||[],(null==(r=n.popperOptions)?void 0:r.modifiers)||[]))})})}var d=s?t.useLayoutEffect:t.useEffect;function l(e){var n=t.useRef();return n.current||(n.current="function"==typeof e?e():e),n.current}function v(e,n,t){t.split(/\s+/).forEach((function(t){t&&e.classList[n](t)}))}var m={name:"className",defaultValue:"",fn:function(e){var n=e.popper.firstElementChild,t=function(){var n;return!!(null==(n=e.props.render)?void 0:n.$$tippy)};function r(){e.props.className&&!t()||v(n,"add",e.props.className)}return{onCreate:r,onBeforeUpdate:function(){t()&&v(n,"remove",e.props.className)},onAfterUpdate:r}}};function h(e){return function(n){var i=n.children,s=n.content,p=n.visible,v=n.singleton,h=n.render,b=n.reference,y=n.disabled,g=void 0!==y&&y,O=n.ignoreAttributes,j=void 0===O||O,E=(n.__source,n.__self,c(n,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"])),P=void 0!==p,_=void 0!==v,D=t.useState(!1),k=D[0],w=D[1],R=t.useState({}),S=R[0],H=R[1],$=t.useState(),q=$[0],x=$[1],A=l((function(){return{container:u(),renders:1}})),I=Object.assign({ignoreAttributes:j},E,{content:A.container});P&&(I.trigger="manual",I.hideOnClick=!1),_&&(g=!0);var N=I,C=I.plugins||[];h&&(N=Object.assign({},I,{plugins:_?[].concat(C,[{fn:function(){return{onTrigger:function(e,n){var t=v.data.children.find((function(e){return e.instance.reference===n.currentTarget})).content;x(t)}}}}]):C,render:function(){return{popper:A.container}}}));var M=[b].concat(i?[i.type]:[]);return d((function(){var n=b;b&&b.hasOwnProperty("current")&&(n=b.current);var t=e(n||A.ref||u(),Object.assign({},N,{plugins:[m].concat(I.plugins||[])}));return A.instance=t,g&&t.disable(),p&&t.show(),_&&v.hook({instance:t,content:s,props:N}),w(!0),function(){t.destroy(),null==v||v.cleanup(t)}}),M),d((function(){var e;if(1!==A.renders){var n=A.instance;n.setProps(f(n.props,N)),null==(e=n.popperInstance)||e.forceUpdate(),g?n.disable():n.enable(),P&&(p?n.show():n.hide()),_&&v.hook({instance:n,content:s,props:N})}else A.renders++})),d((function(){var e;if(h){var n=A.instance;n.setProps({popperOptions:Object.assign({},n.props.popperOptions,{modifiers:[].concat(((null==(e=n.props.popperOptions)?void 0:e.modifiers)||[]).filter((function(e){return"$$tippyReact"!==e.name})),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var n,t=e.state,r=null==(n=t.modifiersData)?void 0:n.hide;S.placement===t.placement&&S.referenceHidden===(null==r?void 0:r.isReferenceHidden)&&S.escaped===(null==r?void 0:r.hasPopperEscaped)||H({placement:t.placement,referenceHidden:null==r?void 0:r.isReferenceHidden,escaped:null==r?void 0:r.hasPopperEscaped}),t.attributes.popper={}}}])})})}}),[S.placement,S.referenceHidden,S.escaped].concat(M)),o.createElement(o.Fragment,null,i?t.cloneElement(i,{ref:function(e){A.ref=e,a(i.ref,e)}}):null,k&&r.createPortal(h?h(function(e){var n={"data-placement":e.placement};return e.referenceHidden&&(n["data-reference-hidden"]=""),e.escaped&&(n["data-escaped"]=""),n}(S),q,A.instance):s,A.container))}}function b(e){return function(n){var r=void 0===n?{}:n,i=r.disabled,o=void 0!==i&&i,s=r.overrides,a=void 0===s?[]:s,u=t.useState(!1),p=u[0],v=u[1],h=l({children:[],renders:1});return d((function(){if(p){var n=h.children,t=h.sourceData;if(t){var r=e(n.map((function(e){return e.instance})),Object.assign({},t.props,{popperOptions:t.instance.props.popperOptions,overrides:a,plugins:[m].concat(t.props.plugins||[])}));return h.instance=r,o&&r.disable(),function(){r.destroy(),h.children=n.filter((function(e){return!e.instance.state.isDestroyed}))}}}else v(!0)}),[p]),d((function(){if(p)if(1!==h.renders){var e=h.children,n=h.instance,t=h.sourceData;if(n&&t){var r=t.props,i=(r.content,c(r,["content"]));n.setProps(f(n.props,Object.assign({},i,{overrides:a}))),n.setInstances(e.map((function(e){return e.instance}))),o?n.disable():n.enable()}}else h.renders++})),t.useMemo((function(){return[{data:h,hook:function(e){h.sourceData=e},cleanup:function(){h.sourceData=null}},{hook:function(e){h.children.find((function(n){var t=n.instance;return e.instance===t}))||(h.children.push(e),h.instance&&!h.instance.state.isDestroyed&&h.instance.setInstances(h.children.map((function(e){return e.instance}))))},cleanup:function(e){h.children=h.children.filter((function(n){return n.instance!==e})),h.instance&&!h.instance.state.isDestroyed&&h.instance.setInstances(h.children.map((function(e){return e.instance})))}}]}),[])}}var y=function(e,n){return t.forwardRef((function(r,i){var s=r.children,u=c(r,["children"]);return o.createElement(e,Object.assign({},n,u),s?t.cloneElement(s,{ref:function(e){a(i,e),a(s.ref,e)}}):null)}))},g=b(n.createSingleton),O=y(h(i));e.tippy=i,e.default=O,e.useSingleton=g,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("tippy.js"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","tippy.js","react","react-dom"],n):n((e=e||self).Tippy={},e.tippy,e.React,e.ReactDOM)}(this,(function(e,n,t,r){"use strict";var i="default"in n?n.default:n,o="default"in t?t.default:t;function c(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}var s="undefined"!=typeof window&&"undefined"!=typeof document;function a(e,n){e&&("function"==typeof e&&e(n),{}.hasOwnProperty.call(e,"current")&&(e.current=n))}function u(){return s&&document.createElement("div")}function p(e){var n=[];return e.forEach((function(e){n.find((function(n){return function e(n,t){if(n===t)return!0;if("object"==typeof n&&null!=n&&"object"==typeof t&&null!=t){if(Object.keys(n).length!==Object.keys(t).length)return!1;for(var r in n){if(!t.hasOwnProperty(r))return!1;if(!e(n[r],t[r]))return!1}return!0}return!1}(e,n)}))||n.push(e)})),n}function l(e,n){var t,r;return Object.assign({},n,{popperOptions:Object.assign({},e.popperOptions,n.popperOptions,{modifiers:p([].concat((null==(t=e.popperOptions)?void 0:t.modifiers)||[],(null==(r=n.popperOptions)?void 0:r.modifiers)||[]))})})}var f=s?t.useLayoutEffect:t.useEffect;function d(e){var n=t.useRef();return n.current||(n.current="function"==typeof e?e():e),n.current}function v(e,n,t){t.split(/\s+/).forEach((function(t){t&&e.classList[n](t)}))}var h={name:"className",defaultValue:"",fn:function(e){var n=e.popper.firstElementChild,t=function(){var n;return!!(null==(n=e.props.render)?void 0:n.$$tippy)};function r(){e.props.className&&!t()||v(n,"add",e.props.className)}return{onCreate:r,onBeforeUpdate:function(){t()&&v(n,"remove",e.props.className)},onAfterUpdate:r}}};function m(e){return function(n){var i=n.children,s=n.content,p=n.visible,v=n.singleton,m=n.render,g=n.reference,b=n.disabled,y=void 0!==b&&b,O=n.ignoreAttributes,j=void 0===O||O,S=(n.__source,n.__self,c(n,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"])),E=void 0!==p,P=void 0!==v,$=t.useState(!1),_=$[0],C=$[1],D=t.useState({}),k=D[0],w=D[1],R=t.useState(),H=R[0],I=R[1],q=d((function(){return{container:u(),renders:1}})),x=Object.assign({ignoreAttributes:j},S,{content:q.container});E&&(x.trigger="manual",x.hideOnClick=!1),P&&(y=!0);var A=x,M=x.plugins||[];m&&(A=Object.assign({},x,{plugins:P&&null!=v.data?[].concat(M,[{fn:function(){return{onTrigger:function(e,n){var t=v.data.children.find((function(e){return e.instance.reference===n.currentTarget}));e.state.$$activeSingletonInstance=t.instance,I(t.content)}}}}]):M,render:function(){return{popper:q.container}}}));var N=[g].concat(i?[i.type]:[]);return f((function(){var n=g;g&&g.hasOwnProperty("current")&&(n=g.current);var t=e(n||q.ref||u(),Object.assign({},A,{plugins:[h].concat(x.plugins||[])}));return q.instance=t,y&&t.disable(),p&&t.show(),P&&v.hook({instance:t,content:s,props:A,setSingletonContent:I}),C(!0),function(){t.destroy(),null==v||v.cleanup(t)}}),N),f((function(){var e;if(1!==q.renders){var n=q.instance;n.setProps(l(n.props,A)),null==(e=n.popperInstance)||e.forceUpdate(),y?n.disable():n.enable(),E&&(p?n.show():n.hide()),P&&v.hook({instance:n,content:s,props:A,setSingletonContent:I})}else q.renders++})),f((function(){var e;if(m){var n=q.instance;n.setProps({popperOptions:Object.assign({},n.props.popperOptions,{modifiers:[].concat(((null==(e=n.props.popperOptions)?void 0:e.modifiers)||[]).filter((function(e){return"$$tippyReact"!==e.name})),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var n,t=e.state,r=null==(n=t.modifiersData)?void 0:n.hide;k.placement===t.placement&&k.referenceHidden===(null==r?void 0:r.isReferenceHidden)&&k.escaped===(null==r?void 0:r.hasPopperEscaped)||w({placement:t.placement,referenceHidden:null==r?void 0:r.isReferenceHidden,escaped:null==r?void 0:r.hasPopperEscaped}),t.attributes.popper={}}}])})})}}),[k.placement,k.referenceHidden,k.escaped].concat(N)),o.createElement(o.Fragment,null,i?t.cloneElement(i,{ref:function(e){q.ref=e,a(i.ref,e)}}):null,_&&r.createPortal(m?m(function(e){var n={"data-placement":e.placement};return e.referenceHidden&&(n["data-reference-hidden"]=""),e.escaped&&(n["data-escaped"]=""),n}(k),H,q.instance):s,q.container))}}function g(e){return function(n){var r=void 0===n?{}:n,i=r.disabled,o=void 0!==i&&i,s=r.overrides,a=void 0===s?[]:s,u=t.useState(!1),p=u[0],v=u[1],m=d({children:[],renders:1});return f((function(){if(p){var n=m.children,t=m.sourceData;if(t){var r=e(n.map((function(e){return e.instance})),Object.assign({},t.props,{popperOptions:t.instance.props.popperOptions,overrides:a,plugins:[h].concat(t.props.plugins||[])}));return m.instance=r,o&&r.disable(),function(){r.destroy(),m.children=n.filter((function(e){return!e.instance.state.isDestroyed}))}}}else v(!0)}),[p]),f((function(){if(p)if(1!==m.renders){var e=m.children,n=m.instance,t=m.sourceData;if(n&&t){var r=t.props,i=(r.content,c(r,["content"]));n.setProps(l(n.props,Object.assign({},i,{overrides:a}))),n.setInstances(e.map((function(e){return e.instance}))),o?n.disable():n.enable()}}else m.renders++})),t.useMemo((function(){return[{data:m,hook:function(e){m.sourceData=e,m.setSingletonContent=e.setSingletonContent},cleanup:function(){m.sourceData=null}},{hook:function(e){var n,t;m.children=m.children.filter((function(n){var t=n.instance;return e.instance!==t})),m.children.push(e),(null==(n=m.instance)?void 0:n.state.isMounted)&&(null==(t=m.instance)?void 0:t.state.$$activeSingletonInstance)===e.instance&&(null==m.setSingletonContent||m.setSingletonContent(e.content)),m.instance&&!m.instance.state.isDestroyed&&m.instance.setInstances(m.children.map((function(e){return e.instance})))},cleanup:function(e){m.children=m.children.filter((function(n){return n.instance!==e})),m.instance&&!m.instance.state.isDestroyed&&m.instance.setInstances(m.children.map((function(e){return e.instance})))}}]}),[])}}var b=function(e,n){return t.forwardRef((function(r,i){var s=r.children,u=c(r,["children"]);return o.createElement(e,Object.assign({},n,u),s?t.cloneElement(s,{ref:function(e){a(i,e),a(s.ref,e)}}):null)}))},y=g(n.createSingleton),O=b(m(i));e.tippy=i,e.default=O,e.useSingleton=y,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=tippy-react.umd.min.js.map |
@@ -221,13 +221,12 @@ import tippy, { createSingleton } from 'tippy.js/headless'; | ||
computedProps = Object.assign({}, props, { | ||
plugins: isSingletonMode ? [].concat(plugins, [{ | ||
plugins: isSingletonMode && singleton.data != null ? [].concat(plugins, [{ | ||
fn: function fn() { | ||
return { | ||
onTrigger: function onTrigger(_, event) { | ||
var _singleton$data$child = singleton.data.children.find(function (_ref2) { | ||
onTrigger: function onTrigger(instance, event) { | ||
var node = singleton.data.children.find(function (_ref2) { | ||
var instance = _ref2.instance; | ||
return instance.reference === event.currentTarget; | ||
}), | ||
content = _singleton$data$child.content; | ||
setSingletonContent(content); | ||
}); | ||
instance.state.$$activeSingletonInstance = node.instance; | ||
setSingletonContent(node.content); | ||
} | ||
@@ -271,3 +270,4 @@ }; | ||
content: content, | ||
props: computedProps | ||
props: computedProps, | ||
setSingletonContent: setSingletonContent | ||
}); | ||
@@ -315,3 +315,4 @@ } | ||
content: content, | ||
props: computedProps | ||
props: computedProps, | ||
setSingletonContent: setSingletonContent | ||
}); | ||
@@ -464,2 +465,3 @@ } | ||
mutableBox.sourceData = data; | ||
mutableBox.setSingletonContent = data.setSingletonContent; | ||
}, | ||
@@ -472,14 +474,19 @@ cleanup: function cleanup() { | ||
hook: function hook(data) { | ||
if (!mutableBox.children.find(function (_ref3) { | ||
var _mutableBox$instance, _mutableBox$instance2; | ||
mutableBox.children = mutableBox.children.filter(function (_ref3) { | ||
var instance = _ref3.instance; | ||
return data.instance === instance; | ||
})) { | ||
mutableBox.children.push(data); | ||
return data.instance !== instance; | ||
}); | ||
mutableBox.children.push(data); | ||
if (mutableBox.instance && !mutableBox.instance.state.isDestroyed) { | ||
mutableBox.instance.setInstances(mutableBox.children.map(function (child) { | ||
return child.instance; | ||
})); | ||
} | ||
if (((_mutableBox$instance = mutableBox.instance) == null ? void 0 : _mutableBox$instance.state.isMounted) && ((_mutableBox$instance2 = mutableBox.instance) == null ? void 0 : _mutableBox$instance2.state.$$activeSingletonInstance) === data.instance) { | ||
mutableBox.setSingletonContent == null ? void 0 : mutableBox.setSingletonContent(data.content); | ||
} | ||
if (mutableBox.instance && !mutableBox.instance.state.isDestroyed) { | ||
mutableBox.instance.setInstances(mutableBox.children.map(function (child) { | ||
return child.instance; | ||
})); | ||
} | ||
}, | ||
@@ -486,0 +493,0 @@ cleanup: function cleanup(instance) { |
@@ -225,13 +225,12 @@ (function (global, factory) { | ||
computedProps = Object.assign({}, props, { | ||
plugins: isSingletonMode ? [].concat(plugins, [{ | ||
plugins: isSingletonMode && singleton.data != null ? [].concat(plugins, [{ | ||
fn: function fn() { | ||
return { | ||
onTrigger: function onTrigger(_, event) { | ||
var _singleton$data$child = singleton.data.children.find(function (_ref2) { | ||
onTrigger: function onTrigger(instance, event) { | ||
var node = singleton.data.children.find(function (_ref2) { | ||
var instance = _ref2.instance; | ||
return instance.reference === event.currentTarget; | ||
}), | ||
content = _singleton$data$child.content; | ||
setSingletonContent(content); | ||
}); | ||
instance.state.$$activeSingletonInstance = node.instance; | ||
setSingletonContent(node.content); | ||
} | ||
@@ -275,3 +274,4 @@ }; | ||
content: content, | ||
props: computedProps | ||
props: computedProps, | ||
setSingletonContent: setSingletonContent | ||
}); | ||
@@ -319,3 +319,4 @@ } | ||
content: content, | ||
props: computedProps | ||
props: computedProps, | ||
setSingletonContent: setSingletonContent | ||
}); | ||
@@ -468,2 +469,3 @@ } | ||
mutableBox.sourceData = data; | ||
mutableBox.setSingletonContent = data.setSingletonContent; | ||
}, | ||
@@ -476,14 +478,19 @@ cleanup: function cleanup() { | ||
hook: function hook(data) { | ||
if (!mutableBox.children.find(function (_ref3) { | ||
var _mutableBox$instance, _mutableBox$instance2; | ||
mutableBox.children = mutableBox.children.filter(function (_ref3) { | ||
var instance = _ref3.instance; | ||
return data.instance === instance; | ||
})) { | ||
mutableBox.children.push(data); | ||
return data.instance !== instance; | ||
}); | ||
mutableBox.children.push(data); | ||
if (mutableBox.instance && !mutableBox.instance.state.isDestroyed) { | ||
mutableBox.instance.setInstances(mutableBox.children.map(function (child) { | ||
return child.instance; | ||
})); | ||
} | ||
if (((_mutableBox$instance = mutableBox.instance) == null ? void 0 : _mutableBox$instance.state.isMounted) && ((_mutableBox$instance2 = mutableBox.instance) == null ? void 0 : _mutableBox$instance2.state.$$activeSingletonInstance) === data.instance) { | ||
mutableBox.setSingletonContent == null ? void 0 : mutableBox.setSingletonContent(data.content); | ||
} | ||
if (mutableBox.instance && !mutableBox.instance.state.isDestroyed) { | ||
mutableBox.instance.setInstances(mutableBox.children.map(function (child) { | ||
return child.instance; | ||
})); | ||
} | ||
}, | ||
@@ -490,0 +497,0 @@ cleanup: function cleanup(instance) { |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("tippy.js/headless"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","tippy.js/headless","react","react-dom"],n):n((e=e||self).Tippy={},e.tippy,e.React,e.ReactDOM)}(this,(function(e,n,t,r){"use strict";var i="default"in n?n.default:n,o="default"in t?t.default:t;function c(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}var s="undefined"!=typeof window&&"undefined"!=typeof document;function a(e,n){e&&("function"==typeof e&&e(n),{}.hasOwnProperty.call(e,"current")&&(e.current=n))}function u(){return s&&document.createElement("div")}function p(e){var n=[];return e.forEach((function(e){n.find((function(n){return function e(n,t){if(n===t)return!0;if("object"==typeof n&&null!=n&&"object"==typeof t&&null!=t){if(Object.keys(n).length!==Object.keys(t).length)return!1;for(var r in n){if(!t.hasOwnProperty(r))return!1;if(!e(n[r],t[r]))return!1}return!0}return!1}(e,n)}))||n.push(e)})),n}function f(e,n){var t,r;return Object.assign({},n,{popperOptions:Object.assign({},e.popperOptions,n.popperOptions,{modifiers:p([].concat((null==(t=e.popperOptions)?void 0:t.modifiers)||[],(null==(r=n.popperOptions)?void 0:r.modifiers)||[]))})})}var d=s?t.useLayoutEffect:t.useEffect;function l(e){var n=t.useRef();return n.current||(n.current="function"==typeof e?e():e),n.current}function v(e,n,t){t.split(/\s+/).forEach((function(t){t&&e.classList[n](t)}))}var h={name:"className",defaultValue:"",fn:function(e){var n=e.popper.firstElementChild,t=function(){var n;return!!(null==(n=e.props.render)?void 0:n.$$tippy)};function r(){e.props.className&&!t()||v(n,"add",e.props.className)}return{onCreate:r,onBeforeUpdate:function(){t()&&v(n,"remove",e.props.className)},onAfterUpdate:r}}};function m(e){return function(n){var i=n.children,s=n.content,p=n.visible,v=n.singleton,m=n.render,b=n.reference,y=n.disabled,g=void 0!==y&&y,O=n.ignoreAttributes,j=void 0===O||O,E=(n.__source,n.__self,c(n,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"])),P=void 0!==p,_=void 0!==v,D=t.useState(!1),k=D[0],w=D[1],R=t.useState({}),S=R[0],H=R[1],$=t.useState(),q=$[0],x=$[1],A=l((function(){return{container:u(),renders:1}})),I=Object.assign({ignoreAttributes:j},E,{content:A.container});P&&(I.trigger="manual",I.hideOnClick=!1),_&&(g=!0);var N=I,C=I.plugins||[];m&&(N=Object.assign({},I,{plugins:_?[].concat(C,[{fn:function(){return{onTrigger:function(e,n){var t=v.data.children.find((function(e){return e.instance.reference===n.currentTarget})).content;x(t)}}}}]):C,render:function(){return{popper:A.container}}}));var M=[b].concat(i?[i.type]:[]);return d((function(){var n=b;b&&b.hasOwnProperty("current")&&(n=b.current);var t=e(n||A.ref||u(),Object.assign({},N,{plugins:[h].concat(I.plugins||[])}));return A.instance=t,g&&t.disable(),p&&t.show(),_&&v.hook({instance:t,content:s,props:N}),w(!0),function(){t.destroy(),null==v||v.cleanup(t)}}),M),d((function(){var e;if(1!==A.renders){var n=A.instance;n.setProps(f(n.props,N)),null==(e=n.popperInstance)||e.forceUpdate(),g?n.disable():n.enable(),P&&(p?n.show():n.hide()),_&&v.hook({instance:n,content:s,props:N})}else A.renders++})),d((function(){var e;if(m){var n=A.instance;n.setProps({popperOptions:Object.assign({},n.props.popperOptions,{modifiers:[].concat(((null==(e=n.props.popperOptions)?void 0:e.modifiers)||[]).filter((function(e){return"$$tippyReact"!==e.name})),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var n,t=e.state,r=null==(n=t.modifiersData)?void 0:n.hide;S.placement===t.placement&&S.referenceHidden===(null==r?void 0:r.isReferenceHidden)&&S.escaped===(null==r?void 0:r.hasPopperEscaped)||H({placement:t.placement,referenceHidden:null==r?void 0:r.isReferenceHidden,escaped:null==r?void 0:r.hasPopperEscaped}),t.attributes.popper={}}}])})})}}),[S.placement,S.referenceHidden,S.escaped].concat(M)),o.createElement(o.Fragment,null,i?t.cloneElement(i,{ref:function(e){A.ref=e,a(i.ref,e)}}):null,k&&r.createPortal(m?m(function(e){var n={"data-placement":e.placement};return e.referenceHidden&&(n["data-reference-hidden"]=""),e.escaped&&(n["data-escaped"]=""),n}(S),q,A.instance):s,A.container))}}function b(e){return function(n){var r=void 0===n?{}:n,i=r.disabled,o=void 0!==i&&i,s=r.overrides,a=void 0===s?[]:s,u=t.useState(!1),p=u[0],v=u[1],m=l({children:[],renders:1});return d((function(){if(p){var n=m.children,t=m.sourceData;if(t){var r=e(n.map((function(e){return e.instance})),Object.assign({},t.props,{popperOptions:t.instance.props.popperOptions,overrides:a,plugins:[h].concat(t.props.plugins||[])}));return m.instance=r,o&&r.disable(),function(){r.destroy(),m.children=n.filter((function(e){return!e.instance.state.isDestroyed}))}}}else v(!0)}),[p]),d((function(){if(p)if(1!==m.renders){var e=m.children,n=m.instance,t=m.sourceData;if(n&&t){var r=t.props,i=(r.content,c(r,["content"]));n.setProps(f(n.props,Object.assign({},i,{overrides:a}))),n.setInstances(e.map((function(e){return e.instance}))),o?n.disable():n.enable()}}else m.renders++})),t.useMemo((function(){return[{data:m,hook:function(e){m.sourceData=e},cleanup:function(){m.sourceData=null}},{hook:function(e){m.children.find((function(n){var t=n.instance;return e.instance===t}))||(m.children.push(e),m.instance&&!m.instance.state.isDestroyed&&m.instance.setInstances(m.children.map((function(e){return e.instance}))))},cleanup:function(e){m.children=m.children.filter((function(n){return n.instance!==e})),m.instance&&!m.instance.state.isDestroyed&&m.instance.setInstances(m.children.map((function(e){return e.instance})))}}]}),[])}}var y=function(e,n){return t.forwardRef((function(r,i){var s=r.children,u=c(r,["children"]);return o.createElement(e,Object.assign({},n,u),s?t.cloneElement(s,{ref:function(e){a(i,e),a(s.ref,e)}}):null)}))},g=b(n.createSingleton),O=y(m(i),{render:function(){return""}});e.tippy=i,e.default=O,e.useSingleton=g,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("tippy.js/headless"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","tippy.js/headless","react","react-dom"],n):n((e=e||self).Tippy={},e.tippy,e.React,e.ReactDOM)}(this,(function(e,n,t,r){"use strict";var i="default"in n?n.default:n,o="default"in t?t.default:t;function c(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}var s="undefined"!=typeof window&&"undefined"!=typeof document;function a(e,n){e&&("function"==typeof e&&e(n),{}.hasOwnProperty.call(e,"current")&&(e.current=n))}function u(){return s&&document.createElement("div")}function p(e){var n=[];return e.forEach((function(e){n.find((function(n){return function e(n,t){if(n===t)return!0;if("object"==typeof n&&null!=n&&"object"==typeof t&&null!=t){if(Object.keys(n).length!==Object.keys(t).length)return!1;for(var r in n){if(!t.hasOwnProperty(r))return!1;if(!e(n[r],t[r]))return!1}return!0}return!1}(e,n)}))||n.push(e)})),n}function l(e,n){var t,r;return Object.assign({},n,{popperOptions:Object.assign({},e.popperOptions,n.popperOptions,{modifiers:p([].concat((null==(t=e.popperOptions)?void 0:t.modifiers)||[],(null==(r=n.popperOptions)?void 0:r.modifiers)||[]))})})}var f=s?t.useLayoutEffect:t.useEffect;function d(e){var n=t.useRef();return n.current||(n.current="function"==typeof e?e():e),n.current}function v(e,n,t){t.split(/\s+/).forEach((function(t){t&&e.classList[n](t)}))}var h={name:"className",defaultValue:"",fn:function(e){var n=e.popper.firstElementChild,t=function(){var n;return!!(null==(n=e.props.render)?void 0:n.$$tippy)};function r(){e.props.className&&!t()||v(n,"add",e.props.className)}return{onCreate:r,onBeforeUpdate:function(){t()&&v(n,"remove",e.props.className)},onAfterUpdate:r}}};function m(e){return function(n){var i=n.children,s=n.content,p=n.visible,v=n.singleton,m=n.render,g=n.reference,b=n.disabled,y=void 0!==b&&b,O=n.ignoreAttributes,j=void 0===O||O,S=(n.__source,n.__self,c(n,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"])),E=void 0!==p,P=void 0!==v,$=t.useState(!1),_=$[0],C=$[1],D=t.useState({}),k=D[0],w=D[1],R=t.useState(),H=R[0],I=R[1],q=d((function(){return{container:u(),renders:1}})),x=Object.assign({ignoreAttributes:j},S,{content:q.container});E&&(x.trigger="manual",x.hideOnClick=!1),P&&(y=!0);var A=x,M=x.plugins||[];m&&(A=Object.assign({},x,{plugins:P&&null!=v.data?[].concat(M,[{fn:function(){return{onTrigger:function(e,n){var t=v.data.children.find((function(e){return e.instance.reference===n.currentTarget}));e.state.$$activeSingletonInstance=t.instance,I(t.content)}}}}]):M,render:function(){return{popper:q.container}}}));var N=[g].concat(i?[i.type]:[]);return f((function(){var n=g;g&&g.hasOwnProperty("current")&&(n=g.current);var t=e(n||q.ref||u(),Object.assign({},A,{plugins:[h].concat(x.plugins||[])}));return q.instance=t,y&&t.disable(),p&&t.show(),P&&v.hook({instance:t,content:s,props:A,setSingletonContent:I}),C(!0),function(){t.destroy(),null==v||v.cleanup(t)}}),N),f((function(){var e;if(1!==q.renders){var n=q.instance;n.setProps(l(n.props,A)),null==(e=n.popperInstance)||e.forceUpdate(),y?n.disable():n.enable(),E&&(p?n.show():n.hide()),P&&v.hook({instance:n,content:s,props:A,setSingletonContent:I})}else q.renders++})),f((function(){var e;if(m){var n=q.instance;n.setProps({popperOptions:Object.assign({},n.props.popperOptions,{modifiers:[].concat(((null==(e=n.props.popperOptions)?void 0:e.modifiers)||[]).filter((function(e){return"$$tippyReact"!==e.name})),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var n,t=e.state,r=null==(n=t.modifiersData)?void 0:n.hide;k.placement===t.placement&&k.referenceHidden===(null==r?void 0:r.isReferenceHidden)&&k.escaped===(null==r?void 0:r.hasPopperEscaped)||w({placement:t.placement,referenceHidden:null==r?void 0:r.isReferenceHidden,escaped:null==r?void 0:r.hasPopperEscaped}),t.attributes.popper={}}}])})})}}),[k.placement,k.referenceHidden,k.escaped].concat(N)),o.createElement(o.Fragment,null,i?t.cloneElement(i,{ref:function(e){q.ref=e,a(i.ref,e)}}):null,_&&r.createPortal(m?m(function(e){var n={"data-placement":e.placement};return e.referenceHidden&&(n["data-reference-hidden"]=""),e.escaped&&(n["data-escaped"]=""),n}(k),H,q.instance):s,q.container))}}function g(e){return function(n){var r=void 0===n?{}:n,i=r.disabled,o=void 0!==i&&i,s=r.overrides,a=void 0===s?[]:s,u=t.useState(!1),p=u[0],v=u[1],m=d({children:[],renders:1});return f((function(){if(p){var n=m.children,t=m.sourceData;if(t){var r=e(n.map((function(e){return e.instance})),Object.assign({},t.props,{popperOptions:t.instance.props.popperOptions,overrides:a,plugins:[h].concat(t.props.plugins||[])}));return m.instance=r,o&&r.disable(),function(){r.destroy(),m.children=n.filter((function(e){return!e.instance.state.isDestroyed}))}}}else v(!0)}),[p]),f((function(){if(p)if(1!==m.renders){var e=m.children,n=m.instance,t=m.sourceData;if(n&&t){var r=t.props,i=(r.content,c(r,["content"]));n.setProps(l(n.props,Object.assign({},i,{overrides:a}))),n.setInstances(e.map((function(e){return e.instance}))),o?n.disable():n.enable()}}else m.renders++})),t.useMemo((function(){return[{data:m,hook:function(e){m.sourceData=e,m.setSingletonContent=e.setSingletonContent},cleanup:function(){m.sourceData=null}},{hook:function(e){var n,t;m.children=m.children.filter((function(n){var t=n.instance;return e.instance!==t})),m.children.push(e),(null==(n=m.instance)?void 0:n.state.isMounted)&&(null==(t=m.instance)?void 0:t.state.$$activeSingletonInstance)===e.instance&&(null==m.setSingletonContent||m.setSingletonContent(e.content)),m.instance&&!m.instance.state.isDestroyed&&m.instance.setInstances(m.children.map((function(e){return e.instance})))},cleanup:function(e){m.children=m.children.filter((function(n){return n.instance!==e})),m.instance&&!m.instance.state.isDestroyed&&m.instance.setInstances(m.children.map((function(e){return e.instance})))}}]}),[])}}var b=function(e,n){return t.forwardRef((function(r,i){var s=r.children,u=c(r,["children"]);return o.createElement(e,Object.assign({},n,u),s?t.cloneElement(s,{ref:function(e){a(i,e),a(s.ref,e)}}):null)}))},y=g(n.createSingleton),O=b(m(i),{render:function(){return""}});e.tippy=i,e.default=O,e.useSingleton=y,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=tippy-react-headless.umd.min.js.map |
{ | ||
"name": "@tippyjs/react", | ||
"version": "4.2.5", | ||
"version": "4.2.6", | ||
"description": "React component for Tippy.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/tippy-react.umd.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
262931
1909