Commit 6cf0fe87 authored by Johann-S's avatar Johann-S
Browse files

Use Popper for tooltip and popover

parent aa68ca35
main cleanup-floating-forms cssvar-function dependabot/npm_and_yarn/stylelint-and-stylelint-config-twbs-bootstrap-15.3.0 extend-snippets feat/data-target floating-always-visible floating-labels-icons fod-main-banner form-controls-with-icons github/fork/719media/patch-13 github/fork/719media/patch-14 github/fork/719media/patch-9 github/fork/ChellyAhmed/fix-typo-reboot.md github/fork/ChellyAhmed/offcanvas-scroll-back github/fork/CtrlAltLilith/main github/fork/Elysiome/offcanvas-optional-window-resizing github/fork/JanSargsyan/main github/fork/LunicLynx/support-different-line-height-for-buttons github/fork/Psixodelik/main github/fork/Ronid1/ronid1/offcanvas_static_backdrop github/fork/RyanBerliner/tooltip-accessibility github/fork/SantiagoPVazquez/Feature-default-border-bottom-to-dropdown-item github/fork/Sir-Genius/utils github/fork/Sumit-Singh-8/main github/fork/Viktor-VERA2020/offcanvas-slide github/fork/Zivangu9/input-group-for-form-control-plaintext github/fork/alpadev/alpadev/call-dispose-on-component-reinstantiation github/fork/astagi/fix/tree-shake-modules github/fork/compnerd/dark-accordion-icon github/fork/derSascha/dropdown-dont-close-on-input-click github/fork/dev-ph1l/main github/fork/donquixote/issue-33861-utl-mixin github/fork/florianlacreuse/mixin-make-row-gutter-y github/fork/gregorw/main github/fork/iteggmbh/transitionend-dispose-race github/fork/jdelStrother/patch-1 github/fork/jonnysp/form-floating github/fork/jonnysp/independent-offcanvas github/fork/jonnysp/theme-dark-on-card-and-modal-fix github/fork/josefdlange/floating-label-placeholder-opacity github/fork/julien-deramond/enhance-change-version.js github/fork/julien-deramond/main-jd-fix-offset-content github/fork/julien-deramond/main-jd-issue-with-utitlies github/fork/julien-deramond/main-xmr-pa11y-ci-jd-add-hideElements github/fork/kyletsang/fix-tooltip-padding github/fork/lacutah/CheckboxCenteringDocumentation github/fork/lekoala/patch-3 github/fork/louismaximepiton/main-kld-lmp-collapse-proposal github/fork/louismaximepiton/main-lmp-card-inner-border-radius-fix github/fork/louismaximepiton/main-lmp-carousel-multiple-images github/fork/louismaximepiton/main-lmp-css-var-init github/fork/louismaximepiton/main-lmp-disabled-floating-label-fix github/fork/louismaximepiton/main-lmp-input-range-fix github/fork/louismaximepiton/main-lmp-shift-color github/fork/louismaximepiton/main-lmp-table-active-tr-fix github/fork/maciek-szn/switch github/fork/michael-roth/feature/19964-multiple-tab-targets github/fork/mistic100/dom-utils github/fork/nkdas91/accordion github/fork/nstungcom/fix-missing-modal-open-class github/fork/oraliahdz/animation-utilities github/fork/pine3ree/patch-7 github/fork/pouwerkerk/unindent-scss-docs-shortcode github/fork/smares/smares-no-scolling-on-modal-close github/fork/tgm-git/patch-1 gs-forms gs-toasts-with-animated-progress-bar gs/add-history-helper gs/change-version-dir-on-docs gs/data-must-set-onlu-one-instance gs/docs/fix-drop-down-error gs/event-handler-2 gs/make-docs-js-build gs/make-simple-attribute-toggler gs/popover-fix-doc gs/provide-steConfig-method gs/scrollspy-smoothscroll-option-use-browser-history gs/streamline-jqueryInterface gs/support-drop-down-in-navbar gs/test-js-generic-trigger gs/try-web-components gs/tweak-collapse-js-selector gs/use-event-handler-in-cocmponent gs/use-rollup-replace-for-version jo-docs-thanks-page jo-ssr-friendly logical-props-spacing-utils main-fod-disabled-form-check-label main-fod-nested-accordion main-fod-simpler-table-structure main-fod-table-separator main-fod-utilities-contrast main-jd-abbr-title main-jd-add-chips main-jd-add-doc-for-sass-custom-colors main-jd-add-enable-host-to-handle-web-components main-jd-browserstack-fine-tune main-jd-browserstack-updates main-jd-docs-consistent-usage-of-css-sections-step-2 main-jd-fix-docs-headers-in-white main-jd-fix-highlight-docs-border-radius main-jd-fix-placeholder-color-background-params-for-img-markup main-jd-glossary-experiment main-jd-postcss-drop-empty-css-vars main-jd-proto-doc-astro main-jd-skip-navigation-component main-jd-stackblitz-for-examples main-jd-upgrade-browserlistrc main-jd-use-host main-lmp-dark-theme-customization main-lmp-handle-scroll-target main-lmp-tab-fix main-mc-opensearch main-xmr-bundlewatch-action main-xmr-eslint-plugin-compat main-xmr-hugo-docs-vendor main-xmr-hugo-rm-ver main-xmr-linkinator-prod main-xmr-min-mangle main-xmr-pa11y-ci more-darkmode-examples nested-dropdowns patrickhlauke-issue37428 patrickhlauke-use-of-color-tweaks pr/34102 pr/37590 previous-next-docs-links sticky-thead utilities-functions-mixin v4-dev v4-dev-dropdown-hide-method v530-dev v6-postcss-custom-media v6-spinner-dots v6/gs/use-floating-ui-in-place-of-popper xmr/dev xmr/docs-png xmr/docs-svgs xmr/hugo-reorg-files xmr/js-2 xmr/markdownlint xmr/prepare-530-alpha2 xmr/xo v5.3.0-alpha1 v5.2.3 v5.2.2 v5.2.1 v5.2.0 v5.2.0-beta1 v5.1.3 v5.1.2 v5.1.1 v5.1.0 v5.0.2 v5.0.1 v5.0.0 v5.0.0-beta3 v5.0.0-beta2 v5.0.0-beta1 v5.0.0-alpha3 v5.0.0-alpha2 v5.0.0-alpha1 v4.6.2 v4.6.1 v4.6.0 v4.5.3 v4.5.2 v4.5.1 v4.5.0 v4.4.1 v4.4.0 v4.3.1 v4.3.0 v4.2.1 v4.2.0 v4.1.3 v4.1.2 v4.1.1 v4.1.0 v4.0.0 v4.0.0-beta.3 v4.0.0-beta.2 v4.0.0-beta
6 merge requests!28721Hot test,!27561Adds font-weight-medium to font weight classes,!25326Adjust examples,!23995Add back cursor: pointer for .btn-link,!23178Spinner,!17021v4
Showing with 27 additions and 56 deletions
+27 -56
(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(he){const ce=he.offsetParent,ue=ce&&ce.nodeName;return ue&&'BODY'!==ue&&'HTML'!==ue?ce:window.document.documentElement}function t(he,ce){if(1!==he.nodeType)return[];const ue=window.getComputedStyle(he,null);return ce?ue[ce]:ue}function o(he){return'HTML'===he.nodeName?he:he.parentNode||he.host}function r(he){if(!he||-1!==['HTML','BODY','#document'].indexOf(he.nodeName))return window.document.body;const{overflow:ce,overflowX:ue,overflowY:ge}=t(he);return /(auto|scroll)/.test(ce+ge+ue)?he:r(o(he))}function s(he){const ce=he.nodeName;return'BODY'===ce||'HTML'===ce?!1:'fixed'===t(he,'position')||s(o(he))}function p(he){const ce=e(he),ue=s(ce);return ue?'fixed':'absolute'}function f(he,ce){const ue='x'===ce?'Left':'Top',ge='Left'==ue?'Right':'Bottom';return+he[`border${ue}Width`].split('px')[0]+ +he[`border${ge}Width`].split('px')[0]}function d(he){const ce=-1!==navigator.appVersion.indexOf('MSIE 10');let ue;if(ce)try{ue=he.getBoundingClientRect()}catch(xe){ue={}}else ue=he.getBoundingClientRect();const ge={left:ue.left,top:ue.top,right:ue.right,bottom:ue.bottom,width:ue.right-ue.left,height:ue.bottom-ue.top};if('HTML'===he.nodeName&&ce){const{scrollTop:xe,scrollLeft:ye}=window.document.documentElement;ge.top-=xe,ge.bottom-=xe,ge.left-=ye,ge.right-=ye}let be=ue.width-(he.clientWidth||ue.right-ue.left),we=ue.height-(he.clientHeight||ue.bottom-ue.top);if(be||we){const xe=t(he);be-=f(xe,'x'),we-=f(xe,'y')}return ge.right-=be,ge.width-=be,ge.bottom-=we,ge.height-=we,ge}function l(he,ce='top'){const ue='top'===ce?'scrollTop':'scrollLeft',ge=he.nodeName;if('BODY'===ge||'HTML'===ge){const be=window.document.documentElement,we=window.document.scrollingElement||be;return we[ue]}return he[ue]}function m(he,ce,ue=!1){const ge=l(ce,'top'),be=l(ce,'left'),we=ue?-1:1;return he.top+=ge*we,he.bottom+=ge*we,he.left+=be*we,he.right+=be*we,he}function h(he,ce,ue=!1,ge=!1){const be=r(ce),we=d(he),xe=d(ce);let ye={top:we.top-xe.top,left:we.left-xe.left,bottom:we.top-xe.top+we.height,right:we.left-xe.left+we.width,width:we.width,height:we.height};ue&&!ge?ye=m(ye,be,!0):e(he).contains(be)&&'BODY'!==be.nodeName&&(ye=m(ye,ce));const ve=t(ce),Oe=+ve.borderTopWidth.split('px')[0],Ee=+ve.borderLeftWidth.split('px')[0];return ye.top-=Oe,ye.bottom-=Oe,ye.left-=Ee,ye.right-=Ee,ye}function c(){const he=window.document.body,ce=window.document.documentElement;return{height:Math.max(he.scrollHeight,he.offsetHeight,ce.clientHeight,ce.scrollHeight,ce.offsetHeight),width:Math.max(he.scrollWidth,he.offsetWidth,ce.clientWidth,ce.scrollWidth,ce.offsetWidth)}}function u(he){let ce;if('HTML'===he.nodeName){const{width:ue,height:ge}=c();ce={width:ue,height:ge,left:0,top:0}}else ce={width:he.offsetWidth,height:he.offsetHeight,left:he.offsetLeft,top:he.offsetTop};return ce.right=ce.left+ce.width,ce.bottom=ce.top+ce.height,ce}function g(he){const ce=u(he);if('HTML'!==he.nodeName){const ue=e(he),ge=g(ue),be={width:ce.offsetWidth,height:ce.offsetHeight,left:ce.left+ge.left,top:ce.top+ge.top,right:ce.right-ge.right,bottom:ce.bottom-ge.bottom};return be}return ce}function w(he,ce='top'){const ue=r(he),ge=l(ue,ce);return-1===['BODY','HTML'].indexOf(ue.nodeName)?ge+w(o(ue),ce):ge}function v(he,ce,ue){let ge={top:0,left:0};const be=e(he);if('viewport'===ue){const{left:we,top:xe}=g(be),{clientWidth:ye,clientHeight:ve}=window.document.documentElement;if('fixed'===p(he))ge.right=ye,ge.bottom=ve;else{const Oe=w(he,'left'),Ee=w(he,'top');ge={top:0-xe,right:ye-we+Oe,bottom:ve-xe+Ee,left:0-we}}}else{let we;if(we='scrollParent'===ue?r(o(he)):'window'===ue?window.document.body:ue,'BODY'===we.nodeName){const{height:xe,width:ye}=c();ge.right=ye,ge.bottom=xe}else ge=h(we,be,s(he))}return ge.left+=ce,ge.top+=ce,ge.right-=ce,ge.bottom-=ce,ge}function O(he,ce,ue){if(-1===he.indexOf('auto'))return he;const ge=v(ue,0,'scrollParent'),be={top:ce.top-ge.top,right:ge.right-ce.right,bottom:ge.bottom-ce.bottom,left:ce.left-ge.left},we=Object.keys(be).sort((ye,ve)=>be[ve]-be[ye])[0],xe=he.split('-')[1];return we+(xe?`-${xe}`:'')}function N(he,ce){return Array.prototype.find?he.find(ce):he.filter(ce)[0]}function L(he,ce,ue){if(Array.prototype.findIndex)return he.findIndex((be)=>be[ce]===ue);const ge=N(he,(be)=>be[ce]===ue);return he.indexOf(ge)}function T(he){return fe({},he,{right:he.left+he.width,bottom:he.top+he.height})}function P(he){const ce=window.getComputedStyle(he),ue=parseFloat(ce.marginTop)+parseFloat(ce.marginBottom),ge=parseFloat(ce.marginLeft)+parseFloat(ce.marginRight),be={width:he.offsetWidth+ge,height:he.offsetHeight+ue};return be}function B(he){const ce={left:'right',right:'left',bottom:'top',top:'bottom'};return he.replace(/left|right|bottom|top/g,(ue)=>ce[ue])}function H(he,ce,ue,ge){ge=ge.split('-')[0];const be=P(ce),we={position:he,width:be.width,height:be.height},xe=-1!==['right','left'].indexOf(ge),ye=xe?'top':'left',ve=xe?'left':'top',Oe=xe?'height':'width',Ee=xe?'width':'height';return we[ye]=ue[ye]+ue[Oe]/2-be[Oe]/2,we[ve]=ge===ve?ue[ve]-be[Ee]:ue[B(ve)],we}function W(he,ce,ue){const ge='fixed'===he.position,be=he.isParentTransformed,we=e(ge&&be?ue:ce);return h(ue,we,ge,be)}function D(he){const ce=[!1,'ms','webkit','moz','o'],ue=he.charAt(0).toUpperCase()+he.slice(1);for(let ge=0;ge<ce.length-1;ge++){const be=ce[ge],we=be?`${be}${ue}`:he;if('undefined'!=typeof window.document.body.style[we])return we}return null}function C(he){return he&&'[object Function]'==={}.toString.call(he)}function M(he,ce){return he.some(({name:ue,enabled:ge})=>ge&&ue===ce)}function R(he,ce,ue){const ge=N(he,({name:be})=>be===ce);return!!ge&&he.some((be)=>{return be.name===ue&&be.enabled&&be.order<ge.order})}function A(he){return''!==he&&!isNaN(parseFloat(he))&&isFinite(he)}function k(he){return'BODY'!==he.nodeName&&('none'!==t(he,'transform')||(o(he)?k(o(he)):he))}function Y(he,ce){return window.removeEventListener('resize',ce.updateBound),ce.scrollParents.forEach((ue)=>{ue.removeEventListener('scroll',ce.updateBound)}),ce.updateBound=null,ce.scrollParents=[],ce.scrollElement=null,ce.eventsEnabled=!1,ce}function I(he,ce,ue){const ge=void 0===ue?he:he.slice(0,L(he,'name',ue));return ge.forEach((be)=>{be.enabled&&C(be.function)&&(ce=be.function(ce,be))}),ce}function U(he,ce){Object.keys(ce).forEach(function(ue){const ge=ce[ue];!1===ge?he.removeAttribute(ue):he.setAttribute(ue,ce[ue])})}function q(he,ce){Object.keys(ce).forEach((ue)=>{let ge='';-1!==['width','height','top','right','bottom','left'].indexOf(ue)&&A(ce[ue])&&(ge='px'),he.style[ue]=ce[ue]+ge})}function z(he,ce,ue,ge){const be='BODY'===he.nodeName,we=be?window:he;we.addEventListener(ce,ue,{passive:!0}),be||z(r(we.parentNode),ce,ue,ge),ge.push(we)}function F(he,ce,ue,ge){ue.updateBound=ge,window.addEventListener('resize',ue.updateBound,{passive:!0});const be=r(he);return z(be,'scroll',ue.updateBound,ue.scrollParents),ue.scrollElement=be,ue.eventsEnabled=!0,ue}function X(he){return'end'===he?'start':'start'===he?'end':he}const te=['native code','[object MutationObserverConstructor]'];var oe=(he)=>te.some((ce)=>-1<(he||'').toString().indexOf(ce));const ie='undefined'!=typeof window,re=['Edge','Trident','Firefox'];let ne=0;for(let he=0;he<re.length;he+=1)if(ie&&0<=navigator.userAgent.indexOf(re[he])){ne=1;break}const se=ie&&oe(window.MutationObserver);var pe=se?function(he){let ce=!1,ue=0;const ge=document.createElement('span'),be=new MutationObserver(()=>{he(),ce=!1});return be.observe(ge,{attributes:!0}),()=>{ce||(ce=!0,ge.setAttribute('x-index',ue),++ue)}}:function(he){let ce=!1;return()=>{ce||(ce=!0,setTimeout(()=>{ce=!1,he()},ne))}},fe=Object.assign||function(he){for(var ue,ce=1;ce<arguments.length;ce++)for(var ge in ue=arguments[ce],ue)Object.prototype.hasOwnProperty.call(ue,ge)&&(he[ge]=ue[ge]);return he};class me{constructor(he,ce,ue={}){this.scheduleUpdate=()=>requestAnimationFrame(this.update),this.update=pe(this.update.bind(this)),this.options=fe({},me.Defaults,ue),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=he.jquery?he[0]:he,this.popper=ce.jquery?ce[0]:ce,this.modifiers=Object.keys(me.Defaults.modifiers).map((be)=>fe({name:be},me.Defaults.modifiers[be])),this.modifiers=this.modifiers.map((be)=>{const we=ue.modifiers&&ue.modifiers[be.name]||{};return fe({},be,we)}),ue.modifiers&&(this.options.modifiers=fe({},me.Defaults.modifiers,ue.modifiers),Object.keys(ue.modifiers).forEach((be)=>{if(void 0===me.Defaults.modifiers[be]){const we=ue.modifiers[be];we.name=be,this.modifiers.push(we)}})),this.state.position=p(this.reference),this.modifiers=this.modifiers.sort((be,we)=>be.order-we.order),this.modifiers.forEach((be)=>{be.enabled&&C(be.onLoad)&&be.onLoad(this.reference,this.popper,this.options,be,this.state)}),this.state.isParentTransformed=k(this.popper.parentNode),this.update();const ge=this.options.eventsEnabled;ge&&this.enableEventListeners(),this.state.eventsEnabled=ge}update(){if(!this.state.isDestroyed){let he={instance:this,styles:{},attributes:{},flipped:!1,offsets:{}};this.state.position=p(this.reference),q(this.popper,{position:this.state.position}),he.offsets.reference=W(this.state,this.popper,this.reference),he.placement=O(this.options.placement,he.offsets.reference,this.popper),he.originalPlacement=this.options.placement,he.offsets.popper=H(this.state,this.popper,he.offsets.reference,he.placement),he=I(this.modifiers,he),this.state.isCreated?this.options.onUpdate(he):(this.state.isCreated=!0,this.options.onCreate(he))}}destroy(){return this.state.isDestroyed=!0,M(this.modifiers,'applyStyle')&&(this.popper.removeAttribute('x-placement'),this.popper.style.left='',this.popper.style.position='',this.popper.style.top='',this.popper.style[D('transform')]=''),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}enableEventListeners(){this.state.eventsEnabled||(this.state=F(this.reference,this.options,this.state,this.scheduleUpdate))}disableEventListeners(){this.state.eventsEnabled&&(window.cancelAnimationFrame(this.scheduleUpdate),this.state=Y(this.reference,this.state))}}return me.Utils={computeAutoPlacement:O,debounce:pe,findIndex:L,getBordersSize:f,getBoundaries:v,getBoundingClientRect:d,getClientRect:T,getOffsetParent:e,getOffsetRect:u,getOffsetRectRelativeToCustomParent:h,getOuterSizes:P,getParentNode:o,getPopperOffsets:H,getPosition:p,getReferenceOffsets:W,getScroll:l,getScrollParent:r,getStyleComputedProperty:t,getSupportedPropertyName:D,getTotalScroll:w,getWindowSizes:c,includeScroll:m,isFixed:s,isFunction:C,isModifierEnabled:M,isModifierRequired:R,isNative:oe,isNumeric:A,isTransformed:k,removeEventListeners:Y,runModifiers:I,setAttributes:U,setStyles:q,setupEventListeners:F},me.placements=['auto','auto-start','auto-end','top','top-start','top-end','right','right-start','right-end','bottom','bottom-start','bottom-end','left','left-start','left-end'],me.Defaults={placement:'bottom',eventsEnabled:!0,onCreate:()=>{},onUpdate:()=>{},modifiers:{shift:{order:100,enabled:!0,function:function(he){const ce=he.placement,ue=ce.split('-')[0],ge=ce.split('-')[1];if(ge){const be=he.offsets.reference,we=T(he.offsets.popper),xe=-1!==['bottom','top'].indexOf(ue),ye=xe?'left':'top',ve=xe?'width':'height',Oe={start:{[ye]:be[ye]},end:{[ye]:be[ye]+be[ve]-we[ve]}};he.offsets.popper=fe({},we,Oe[ge])}return he}},offset:{order:200,enabled:!0,function:function(he,ce){const ue=he.placement,ge=he.offsets.popper;let be;return A(ce.offset)?be=[ce.offset,0]:(be=ce.offset.split(' '),be=be.map((we,xe)=>{const ye=we.match(/(\d*\.?\d*)(.*)/),ve=+ye[1],Oe=ye[2];let Ee=-1!==ue.indexOf('right')||-1!==ue.indexOf('left');1===xe&&(Ee=!Ee);const Se=Ee?'height':'width';if(0===Oe.indexOf('%')){let Ne;switch(Oe){case'%p':Ne=he.offsets.popper;break;case'%':case'$r':default:Ne=he.offsets.reference;}const Le=T(Ne),Te=Le[Se];return Te/100*ve}if('vh'===Oe||'vw'===Oe){let Ne;return Ne='vh'===Oe?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0),Ne/100*ve}return'px'===Oe?+ve:+we})),-1===he.placement.indexOf('left')?-1===he.placement.indexOf('right')?-1===he.placement.indexOf('top')?-1!==he.placement.indexOf('bottom')&&(ge.left+=be[0],ge.top+=be[1]||0):(ge.left+=be[0],ge.top-=be[1]||0):(ge.top+=be[0],ge.left+=be[1]||0):(ge.top+=be[0],ge.left-=be[1]||0),he},offset:0},preventOverflow:{order:300,enabled:!0,function:function(he,ce){const ue=ce.boundariesElement||e(he.instance.popper),ge=v(he.instance.popper,ce.padding,ue);ce.boundaries=ge;const be=ce.priority;let we=T(he.offsets.popper);const xe={primary(ye){let ve=we[ye];return we[ye]<ge[ye]&&!ce.escapeWithReference&&(ve=Math.max(we[ye],ge[ye])),{[ye]:ve}},secondary(ye){const ve='right'===ye?'left':'top';let Oe=we[ve];return we[ye]>ge[ye]&&!ce.escapeWithReference&&(Oe=Math.min(we[ve],ge[ye]-('right'===ye?we.width:we.height))),{[ve]:Oe}}};return be.forEach((ye)=>{const ve=-1===['left','top'].indexOf(ye)?'secondary':'primary';we=fe({},we,xe[ve](ye))}),he.offsets.popper=we,he},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,function:function(he){const ce=T(he.offsets.popper),ue=he.offsets.reference,ge=he.placement.split('-')[0],be=Math.floor,we=-1!==['top','bottom'].indexOf(ge),xe=we?'right':'bottom',ye=we?'left':'top',ve=we?'width':'height';return ce[xe]<be(ue[ye])&&(he.offsets.popper[ye]=be(ue[ye])-ce[ve]),ce[ye]>be(ue[xe])&&(he.offsets.popper[ye]=be(ue[xe])),he}},arrow:{order:500,enabled:!0,function:function(he,ce){if(!R(he.instance.modifiers,'arrow','keepTogether'))return console.warn('WARNING: `keepTogether` modifier is required by arrow modifier in order to work, be sure to include it before `arrow`!'),he;let ue=ce.element;if('string'==typeof ue){if(ue=he.instance.popper.querySelector(ue),!ue)return he;}else if(!he.instance.popper.contains(ue))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),he;const ge=he.placement.split('-')[0],be=T(he.offsets.popper),we=he.offsets.reference,xe=-1!==['left','right'].indexOf(ge),ye=xe?'height':'width',ve=xe?'top':'left',Oe=xe?'left':'top',Ee=xe?'bottom':'right',Se=P(ue)[ye];we[Ee]-Se<be[ve]&&(he.offsets.popper[ve]-=be[ve]-(we[Ee]-Se)),we[ve]+Se>be[Ee]&&(he.offsets.popper[ve]+=we[ve]+Se-be[Ee]);const Ne=we[ve]+we[ye]/2-Se/2;let Le=Ne-T(he.offsets.popper)[ve];return Le=Math.max(Math.min(be[ye]-Se,Le),0),he.arrowElement=ue,he.offsets.arrow={},he.offsets.arrow[ve]=Le,he.offsets.arrow[Oe]='',he},element:'[x-arrow]'},flip:{order:600,enabled:!0,function:function(he,ce){if(M(he.instance.modifiers,'inner'))return he;if(he.flipped&&he.placement===he.originalPlacement)return he;const ue=v(he.instance.popper,ce.padding,ce.boundariesElement);let ge=he.placement.split('-')[0],be=B(ge),we=he.placement.split('-')[1]||'',xe=[];return xe='flip'===ce.behavior?[ge,be]:ce.behavior,xe.forEach((ye,ve)=>{if(ge!==ye||xe.length===ve+1)return he;ge=he.placement.split('-')[0],be=B(ge);const Oe=T(he.offsets.popper),Ee=he.offsets.reference,Se=Math.floor,Ne='left'===ge&&Se(Oe.right)>Se(Ee.left)||'right'===ge&&Se(Oe.left)<Se(Ee.right)||'top'===ge&&Se(Oe.bottom)>Se(Ee.top)||'bottom'===ge&&Se(Oe.top)<Se(Ee.bottom),Le=Se(Oe.left)<Se(ue.left),Te=Se(Oe.right)>Se(ue.right),Pe=Se(Oe.top)<Se(ue.top),Be=Se(Oe.bottom)>Se(ue.bottom),He='left'===ge&&Le||'right'===ge&&Te||'top'===ge&&Pe||'bottom'===ge&&Be,We=-1!==['top','bottom'].indexOf(ge),De=!!ce.flipVariations&&(We&&'start'===we&&Le||We&&'end'===we&&Te||!We&&'start'===we&&Pe||!We&&'end'===we&&Be);(Ne||He||De)&&(he.flipped=!0,(Ne||He)&&(ge=xe[ve+1]),De&&(we=X(we)),he.placement=ge+(we?'-'+we:''),he.offsets.popper=H(he.instance.state.position,he.instance.popper,he.offsets.reference,he.placement),he=I(he.instance.modifiers,he,'flip'))}),he},behavior:'flip',padding:5,boundariesElement:'viewport'},inner:{order:700,enabled:!1,function:function(he){const ce=he.placement,ue=ce.split('-')[0],ge=T(he.offsets.popper),be=T(he.offsets.reference),we=-1!==['left','right'].indexOf(ue),xe=-1===['top','left'].indexOf(ue);return ge[we?'left':'top']=be[ce]-(xe?ge[we?'width':'height']:0),he.placement=B(ce),he.offsets.popper=T(ge),he}},hide:{order:800,enabled:!0,function:function(he){if(!R(he.instance.modifiers,'hide','preventOverflow'))return console.warn('WARNING: preventOverflow modifier is required by hide modifier in order to work, be sure to include it before hide!'),he;const ce=he.offsets.reference,ue=N(he.instance.modifiers,(ge)=>'preventOverflow'===ge.name).boundaries;if(ce.bottom<ue.top||ce.left>ue.right||ce.top>ue.bottom||ce.right<ue.left){if(!0===he.hide)return he;he.hide=!0,he.attributes['x-out-of-boundaries']=''}else{if(!1===he.hide)return he;he.hide=!1,he.attributes['x-out-of-boundaries']=!1}return he}},applyStyle:{order:900,enabled:!0,gpuAcceleration:!0,function:function(he,ce){const ue={position:he.offsets.popper.position},ge={'x-placement':he.placement},be=Math.round(he.offsets.popper.left),we=Math.round(he.offsets.popper.top),xe=D('transform');return ce.gpuAcceleration&&xe?(ue[xe]='translate3d('+be+'px, '+we+'px, 0)',ue.top=0,ue.left=0,ue.willChange='transform'):(ue.left=be,ue.top=we,ue.willChange='top, left'),q(he.instance.popper,fe({},ue,he.styles)),U(he.instance.popper,fe({},ge,he.attributes)),he.offsets.arrow&&q(he.arrowElement,he.offsets.arrow),he},onLoad:function(he,ce,ue,ge,be){const we=W(be,ce,he);return ue.placement=O(ue.placement,we,ce),ce.setAttribute('x-placement',ue.placement),ue}}}},me});
//# sourceMappingURL=popper.min.js.map
\ No newline at end of file
This diff is collapsed.
......@@ -118,8 +118,6 @@ const Popover = (($) => {
this.setElementContent($tip.find(Selector.CONTENT), this._getContent())
$tip.removeClass(`${ClassName.FADE} ${ClassName.SHOW}`)
this.cleanupTether()
}
// private
......
/* global Tether */
/* global Popper */
import Util from './util'
......@@ -13,11 +13,11 @@ import Util from './util'
const Tooltip = (($) => {
/**
* Check for Tether dependency
* Tether - http://tether.io/
* Check for Popper dependency
* Tether - https://popper.js.org
*/
if (typeof Tether === 'undefined') {
throw new Error('Bootstrap tooltips require Tether (http://tether.io/)')
if (typeof Popper === 'undefined') {
throw new Error('Bootstrap tooltips require Popper (https://popper.js.org)')
}
......@@ -33,8 +33,6 @@ const Tooltip = (($) => {
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
const TRANSITION_DURATION = 150
const CLASS_PREFIX = 'bs-tether'
const TETHER_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
const Default = {
animation : true,
......@@ -66,10 +64,10 @@ const Tooltip = (($) => {
}
const AttachmentMap = {
TOP : 'bottom center',
RIGHT : 'middle left',
BOTTOM : 'top center',
LEFT : 'middle right'
TOP : 'top',
RIGHT : 'right',
BOTTOM : 'bottom',
LEFT : 'left'
}
const HoverState = {
......@@ -100,11 +98,6 @@ const Tooltip = (($) => {
TOOLTIP_INNER : '.tooltip-inner'
}
const TetherClass = {
element : false,
enabled : false
}
const Trigger = {
HOVER : 'hover',
FOCUS : 'focus',
......@@ -128,7 +121,7 @@ const Tooltip = (($) => {
this._timeout = 0
this._hoverState = ''
this._activeTrigger = {}
this._tether = null
this._popper = null
// protected
this.element = element
......@@ -220,8 +213,6 @@ const Tooltip = (($) => {
dispose() {
clearTimeout(this._timeout)
this.cleanupTether()
$.removeData(this.element, this.constructor.DATA_KEY)
$(this.element).off(this.constructor.EVENT_KEY)
......@@ -235,7 +226,7 @@ const Tooltip = (($) => {
this._timeout = null
this._hoverState = null
this._activeTrigger = null
this._tether = null
this._popper = null
this.element = null
this.config = null
......@@ -288,19 +279,19 @@ const Tooltip = (($) => {
$(this.element).trigger(this.constructor.Event.INSERTED)
this._tether = new Tether({
attachment,
element : tip,
target : this.element,
classes : TetherClass,
classPrefix : CLASS_PREFIX,
offset : this.config.offset,
constraints : this.config.constraints,
addTargetClasses: false
this._popper = new Popper(this.element, tip, {
placement : attachment,
modifiers : {
arrow : {
element : Selector.TOOLTIP
},
offset : {
offset : this.config.offset
}
}
})
Util.reflow(tip)
this._tether.position()
$(tip).addClass(ClassName.SHOW)
......@@ -342,11 +333,9 @@ const Tooltip = (($) => {
tip.parentNode.removeChild(tip)
}
this._cleanTipClass()
this.element.removeAttribute('aria-describedby')
$(this.element).trigger(this.constructor.Event.HIDDEN)
this.cleanupTether()
this._popper.destroy()
if (callback) {
callback()
}
......@@ -398,12 +387,8 @@ const Tooltip = (($) => {
setContent() {
const $tip = $(this.getTipElement())
this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle())
$tip.removeClass(`${ClassName.FADE} ${ClassName.SHOW}`)
this.cleanupTether()
}
setElementContent($element, content) {
......@@ -434,12 +419,6 @@ const Tooltip = (($) => {
return title
}
cleanupTether() {
if (this._tether) {
this._tether.destroy()
}
}
// private
......@@ -447,14 +426,6 @@ const Tooltip = (($) => {
return AttachmentMap[placement.toUpperCase()]
}
_cleanTipClass() {
const $tip = $(this.getTipElement())
const tabClass = $tip.attr('class').match(TETHER_PREFIX_REGEX)
if (tabClass !== null && tabClass.length > 0) {
$tip.removeClass(tabClass.join(''))
}
}
_setListeners() {
const triggers = this.config.trigger.split(' ')
......
......@@ -29,7 +29,7 @@
</div>
<script src="../../../docs/assets/js/vendor/jquery-slim.min.js"></script>
<script src="../../../docs/assets/js/vendor/tether.min.js"></script>
<script src="../../../docs/assets/js/vendor/popper.min.js"></script>
<script src="../../dist/util.js"></script>
<script src="../../dist/tooltip.js"></script>
<script src="../../dist/popover.js"></script>
......
......@@ -34,7 +34,7 @@
</div>
<script src="../../../docs/assets/js/vendor/jquery-slim.min.js"></script>
<script src="../../../docs/assets/js/vendor/tether.min.js"></script>
<script src="../../../docs/assets/js/vendor/popper.min.js"></script>
<script src="../../dist/util.js"></script>
<script src="../../dist/tooltip.js"></script>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment